chore(repo): consolidate spec artifacts into specs/ and complete README coverage
- Move generated OpenAPI bundles out of dist/ into committed specs/ (specs/openapi.json, specs/openapi.raw.json); source YAML tree moves openapi/ -> specs/openapi/; schemas/workflow-schema.json joins as specs/workflow-schema.json - Update all generators/consumers: bundle-openapi, generate-raw-openapi, check-version-sync, bump-version, export-workflow-schema, packaging/embedded-openapi - Rewrite stale .env.example with current HOSE_* environment variables - Archive stale repo-local enterprise configs (superseded by ~/.config/hose-use/enterprises) out of the repo; root enterprises/ keeps only the tracked example.json plus an explanatory README - Add missing directory READMEs: approval/contact/message/task/events domains, cli/, http/, packaging/ - Fix stale domain doc links in README.domains.md and docs/modules/platform.md
This commit is contained in:
1 parent
6d532fc719
commit
a3b64d8c8d
29 files changed
+177
-28
No files matched your search
+20
-7
@@ -1,10 +1,23 @@
|
|||||||
# EKB MCP 配置示例
|
# hose-use 环境变量示例(全部可选,不设置即使用默认值)
|
||||||
|
|
||||||
# 企业配置目录(默认 ./enterprises)
|
# 企业配置目录覆盖(默认 ~/.config/hose-use/enterprises,目录权限 0700)
|
||||||
# EKB_CONFIG_DIR=./enterprises
|
# HOSE_ENTERPRISES_DIR=~/.config/hose-use/enterprises
|
||||||
|
|
||||||
# Token 缓存目录(默认 ~/.cache/ekb-mcp)
|
# 全局配置文件覆盖(默认 ~/.config/hose-use/config.json)
|
||||||
# EKB_TOKEN_CACHE_DIR=~/.cache/ekb-mcp
|
# HOSE_CONFIG_FILE=~/.config/hose-use/config.json
|
||||||
|
|
||||||
# 默认 API 基础 URL
|
# 账号与 Token 缓存文件覆盖(默认位于 ~/.config/hose-use/,文件权限 0600)
|
||||||
# EKB_BASE_URL=https://app.ekuaibao.com
|
# HOSE_ACCOUNTS_FILE=~/.config/hose-use/accounts.json
|
||||||
|
# HOSE_TOKENS_FILE=~/.config/hose-use/tokens.json
|
||||||
|
|
||||||
|
# 本地状态目录(审批引擎 / Token 缓存 / 守护进程状态,默认 ~/.config/hose-use)
|
||||||
|
# HOSE_STATE_DIR=~/.config/hose-use
|
||||||
|
|
||||||
|
# 本地 HTTP Daemon(默认 127.0.0.1,建议保持回环地址)
|
||||||
|
# HOST=127.0.0.1
|
||||||
|
# PORT=8888
|
||||||
|
# HOSE_HTTP_TOKEN=<访问令牌>
|
||||||
|
# HOSE_HTTP_CORS_ORIGIN=http://localhost:7788
|
||||||
|
|
||||||
|
# MCP Server 总开关(默认关闭)
|
||||||
|
# HOSE_USE_MCP_ENABLED=true
|
||||||
@@ -105,7 +105,7 @@ CLI 入口保持在 `platform` 命令域,支持 `list`、`get`、`entities`、
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
bun run export:workflow-schema
|
bun run export:workflow-schema
|
||||||
# 输出:schemas/workflow-schema.json
|
# 输出:specs/workflow-schema.json
|
||||||
```
|
```
|
||||||
|
|
||||||
## 工作流数据结构要点
|
## 工作流数据结构要点
|
||||||
|
|||||||
@@ -0,0 +1,5 @@
|
|||||||
|
# enterprises/ 目录说明
|
||||||
|
|
||||||
|
本目录仅保留 `example.json`(企业配置字段示例,随 git 分发),用于说明企业配置文件的格式。
|
||||||
|
|
||||||
|
**运行时数据不在这里。** CLI 实际读取的企业配置目录为 `~/.config/hose-use/enterprises/`(可用环境变量 `HOSE_ENTERPRISES_DIR` 覆盖),文件权限强制 `0600`、目录权限 `0700`,且已被 `.gitignore` 排除。解析逻辑见 `src/core/config/loader.ts`。
|
||||||
@@ -52,13 +52,13 @@ skillContent = skillContent.replace(/\(v[\d.]+\)/g, `(v${nextVersion})`);
|
|||||||
writeFileSync(skillPath, skillContent);
|
writeFileSync(skillPath, skillContent);
|
||||||
console.log("✓ Updated skills/hose-use/SKILL.md");
|
console.log("✓ Updated skills/hose-use/SKILL.md");
|
||||||
|
|
||||||
// 4. openapi/openapi.yaml
|
// 4. specs/openapi/openapi.yaml
|
||||||
const openapiPath = join(ROOT, "openapi", "openapi.yaml");
|
const openapiPath = join(ROOT, "specs", "openapi", "openapi.yaml");
|
||||||
if (existsSync(openapiPath)) {
|
if (existsSync(openapiPath)) {
|
||||||
let openapiContent = readFileSync(openapiPath, "utf-8");
|
let openapiContent = readFileSync(openapiPath, "utf-8");
|
||||||
openapiContent = openapiContent.replace(/version: [\d.]+/g, `version: ${nextVersion}`);
|
openapiContent = openapiContent.replace(/version: [\d.]+/g, `version: ${nextVersion}`);
|
||||||
writeFileSync(openapiPath, openapiContent);
|
writeFileSync(openapiPath, openapiContent);
|
||||||
console.log("✓ Updated openapi/openapi.yaml");
|
console.log("✓ Updated specs/openapi/openapi.yaml");
|
||||||
}
|
}
|
||||||
|
|
||||||
// 4.5 .zcode-plugin/plugin.json
|
// 4.5 .zcode-plugin/plugin.json
|
||||||
|
|||||||
@@ -6,8 +6,8 @@ import YAML from "yaml";
|
|||||||
|
|
||||||
type Json = null | boolean | number | string | Json[] | { [key: string]: Json };
|
type Json = null | boolean | number | string | Json[] | { [key: string]: Json };
|
||||||
|
|
||||||
const inputFile = resolve("openapi/openapi.yaml");
|
const inputFile = resolve("specs/openapi/openapi.yaml");
|
||||||
const outputFile = resolve("dist/openapi.json");
|
const outputFile = resolve("specs/openapi.json");
|
||||||
|
|
||||||
const bundled = bundle(inputFile, new Set());
|
const bundled = bundle(inputFile, new Set());
|
||||||
|
|
||||||
|
|||||||
@@ -7,8 +7,8 @@ const packageVersion = (JSON.parse(readFileSync(join(root, "package.json"), "utf
|
|||||||
const expected: Array<[string, string | undefined]> = [
|
const expected: Array<[string, string | undefined]> = [
|
||||||
["package.json", packageVersion],
|
["package.json", packageVersion],
|
||||||
[".zcode-plugin/plugin.json", readJsonVersion(".zcode-plugin/plugin.json")],
|
[".zcode-plugin/plugin.json", readJsonVersion(".zcode-plugin/plugin.json")],
|
||||||
["openapi/openapi.yaml", readFileSync(join(root, "openapi/openapi.yaml"), "utf8").match(/^\s+version:\s+([^\s]+)\s*$/m)?.[1]],
|
["specs/openapi/openapi.yaml", readFileSync(join(root, "specs/openapi/openapi.yaml"), "utf8").match(/^\s+version:\s+([^\s]+)\s*$/m)?.[1]],
|
||||||
["dist/openapi.json", readJsonVersion("dist/openapi.json", ["info", "version"])],
|
["specs/openapi.json", readJsonVersion("specs/openapi.json", ["info", "version"])],
|
||||||
];
|
];
|
||||||
|
|
||||||
const mismatches = expected.filter(([, value]) => value !== packageVersion);
|
const mismatches = expected.filter(([, value]) => value !== packageVersion);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@ import {
|
|||||||
WorkflowSchema,
|
WorkflowSchema,
|
||||||
} from "../src/domains/platform/types.js";
|
} from "../src/domains/platform/types.js";
|
||||||
|
|
||||||
const OUTPUT_DIR = join(process.cwd(), "schemas");
|
const OUTPUT_DIR = join(process.cwd(), "specs");
|
||||||
const OUTPUT_FILE = join(OUTPUT_DIR, "workflow-schema.json");
|
const OUTPUT_FILE = join(OUTPUT_DIR, "workflow-schema.json");
|
||||||
|
|
||||||
function writeJson(path: string, data: unknown): void {
|
function writeJson(path: string, data: unknown): void {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
import { mkdirSync, writeFileSync } from "node:fs";
|
import { mkdirSync, writeFileSync } from "node:fs";
|
||||||
import { dirname, resolve } from "node:path";
|
import { dirname, resolve } from "node:path";
|
||||||
|
|
||||||
const outputFile = resolve("dist/raw-hose-openapi.json");
|
const outputFile = resolve("specs/openapi.raw.json");
|
||||||
|
|
||||||
function standardResponse(description: string, dataSchema: any) {
|
function standardResponse(description: string, dataSchema: any) {
|
||||||
return {
|
return {
|
||||||
|
|||||||
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -0,0 +1,22 @@
|
|||||||
|
# CLI 引擎层说明
|
||||||
|
|
||||||
|
本目录是三个入口(`src/cli.ts` 主 CLI、`src/aipro-cli.ts` AI PRO CLI、`src/server.ts` MCP 网关)共享的命令引擎:声明式注册、参数解析、写防护、输出渲染与错误映射。入口层只做薄壳,业务编排统一在 `domains/`。
|
||||||
|
|
||||||
|
## 文件职责
|
||||||
|
|
||||||
|
- `registry.ts`:`CLI_COMMAND_REGISTRY` 顶层命令唯一声明式注册表(`area` / `aliases` / `standing` 常驻属性 / `handler`)。新增命令先在此注册。
|
||||||
|
- `runner.ts`:`runCli` 分发入口。按注册表查命令;非常驻命令经 `runQueue` 串行化执行,避免并发写冲突。
|
||||||
|
- `parser.ts`:参数解析器(`parseArgs` / `stringOption` / `booleanOption` / `outputOptions`)。
|
||||||
|
- `printer.ts`:输出渲染(`printJson` / `printHelp` / `redactSensitiveText` 敏感信息脱敏)。
|
||||||
|
- `errors.ts`:`classifyCliError` 按 `EkbError` 子类与状态码映射退出码与恢复建议。
|
||||||
|
- `mutation.ts`:写操作统一防护(确认/dry-run 语义),边界由 `mutation-boundaries.test.ts` 强制。
|
||||||
|
- `helpers.ts`:横切运行时助手(`initCorpRuntime` / `requireSelectedCorp` / `getSessionClientForRuntime`)。
|
||||||
|
- `service.ts`:常驻守护进程管理(安装/启停/状态)。
|
||||||
|
- `help.ts`:帮助文本组织。
|
||||||
|
- `commands/`:每个顶层命令域一个 handler 文件,与 `src/domains/` 一一对应;复杂命令(如 `aipro/`)可用子目录形态。
|
||||||
|
- `architecture-boundaries.test.ts`:分层导入约束的机器卡点(入口层禁触 `domains/*/api.ts`、域层禁反向依赖、core 白名单)。
|
||||||
|
|
||||||
|
## 约定
|
||||||
|
|
||||||
|
- handler 统一签名 `(parsed, runtime, options) => Promise<CliResult>`。
|
||||||
|
- 命令文件内部不重复做异常体系,只抛/透传 `EkbError` 子类。
|
||||||
@@ -9,17 +9,17 @@
|
|||||||
| `platform/` | `api / tools / services / analysis / workflow-state / workflow-alert-store / types` | 自建应用(DataLink Platform)与工作流(EASO/Piper)、静态分析、草稿乐观锁状态机与错误指纹告警 | [README.platform.md](./platform/README.platform.md) |
|
| `platform/` | `api / tools / services / analysis / workflow-state / workflow-alert-store / types` | 自建应用(DataLink Platform)与工作流(EASO/Piper)、静态分析、草稿乐观锁状态机与错误指纹告警 | [README.platform.md](./platform/README.platform.md) |
|
||||||
| `datalink/` | `api / tools / services / types` | 自建应用下的业务对象、字段、记录检索、安全合并编辑(Read-Modify-Write)、台账体检与导入状态 | [README.datalink.md](./datalink/README.datalink.md) |
|
| `datalink/` | `api / tools / services / types` | 自建应用下的业务对象、字段、记录检索、安全合并编辑(Read-Modify-Write)、台账体检与导入状态 | [README.datalink.md](./datalink/README.datalink.md) |
|
||||||
| `bill/` | `api / tools / translator / types` | 费控单据、报销单、发票、审批流时间线、风控扫描与 Markdown 智能转译器 | [README.bill.md](./bill/README.bill.md) |
|
| `bill/` | `api / tools / translator / types` | 费控单据、报销单、发票、审批流时间线、风控扫描与 Markdown 智能转译器 | [README.bill.md](./bill/README.bill.md) |
|
||||||
| `approval/` | `index / gateway / parser / repository / service / db / types` | AI PRO 智能审批引擎(DSL 规则解析、确定性安全网关、要点核验与 `core/db` 会话持久化) | - |
|
| `approval/` | `index / gateway / parser / repository / service / db / types` | AI PRO 智能审批引擎(DSL 规则解析、确定性安全网关、要点核验与 `core/db` 会话持久化) | [README.approval.md](./approval/README.approval.md) |
|
||||||
| `store/` | `api / tools / types` | 企业应用中心/应用商店与 OpenAPI 密钥凭证探查 | [README.store.md](./store/README.store.md) |
|
| `store/` | `api / tools / types` | 企业应用中心/应用商店与 OpenAPI 密钥凭证探查 | [README.store.md](./store/README.store.md) |
|
||||||
| `feetype/` | `api / tools / types` | 企业费用类型全生命周期管理与字段规格配置 | [README.feetype.md](./feetype/README.feetype.md) |
|
| `feetype/` | `api / tools / types` | 企业费用类型全生命周期管理与字段规格配置 | [README.feetype.md](./feetype/README.feetype.md) |
|
||||||
| `contact/` | `api / tools / types` | 企业组织架构(部门树)与员工通讯录检索 | - |
|
| `contact/` | `api / tools / types` | 企业组织架构(部门树)与员工通讯录检索 | [README.contact.md](./contact/README.contact.md) |
|
||||||
| `dimension/` | `api / tools / types` | 自定义档案/核算维度类别与档案项管理 | - |
|
| `dimension/` | `api / tools / types` | 自定义档案/核算维度类别与档案项管理 | [README.dimension.md](./dimension/README.dimension.md) |
|
||||||
| `role/` | `api / tools / types` | 企业角色定义组与角色成员分配查询 | - |
|
| `role/` | `api / tools / types` | 企业角色定义组与角色成员分配查询 | [README.role.md](./role/README.role.md) |
|
||||||
| `permission/` | `api / tools / types` | 单据数据权限与可见范围规则查询 | - |
|
| `permission/` | `api / tools / types` | 单据数据权限与可见范围规则查询 | [README.permission.md](./permission/README.permission.md) |
|
||||||
| `menu/` | `api / tools / types` | 企业桌面端导航菜单与工作台应用清单查询 | - |
|
| `menu/` | `api / tools / types` | 企业桌面端导航菜单与工作台应用清单查询 | [README.menu.md](./menu/README.menu.md) |
|
||||||
| `message/` | `api / tools / types` | 系统通知消息分页查询与已读状态标记 | - |
|
| `message/` | `api / tools / types` | 系统通知消息分页查询与已读状态标记 | [README.message.md](./message/README.message.md) |
|
||||||
| `task/` | `api / tools / types` | 待办/已办审批任务流分页查询与汇总 | - |
|
| `task/` | `api / tools / types` | 待办/已办审批任务流分页查询与汇总 | [README.task.md](./task/README.task.md) |
|
||||||
| `events/` | `poller / store / types` | 待办与未读消息增量事件轮询及基于 `core/db` (`observed_events`) 的去重存储 | - |
|
| `events/` | `poller / store / types` | 待办与未读消息增量事件轮询及基于 `core/db` (`observed_events`) 的去重存储 | [README.events.md](./events/README.events.md) |
|
||||||
|
|
||||||
## 分层与形态规则
|
## 分层与形态规则
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
# Approval 智能审批引擎域说明
|
||||||
|
|
||||||
|
本域是 AI PRO 的智能审批引擎:DSL 规则解析、确定性安全网关仲裁、要点核验与基于 `core/db` 的会话持久化。采用六件套微架构,导出形状统一经 `index.ts` barrel 暴露。
|
||||||
|
|
||||||
|
## 架构
|
||||||
|
|
||||||
|
- `parser.ts`:DSL 解析层,`parseRuleBody` 将自然语言/结构化规则文本解析为 `ParsedRule`,`validateRuleBody` / `validatePreferenceText` 提供语法校验。
|
||||||
|
- `gateway.ts`:确定性仲裁门禁。`analyzeFindings` 汇总要点核验结论,`validateGatewayAction` 校验决策动作合法性,`evaluateGatewayPolicy` / `ApprovalGatewayPolicy` 实现策略仲裁(默认策略 `defaultGatewayPolicy`)。
|
||||||
|
- `repository.ts`:数据访问层,`ApprovalRepository` 基于 `core/db` 管理审批规则、偏好、运行记录(run)、要点(finding)与 AI PRO 日志的持久化。
|
||||||
|
- `service.ts`:业务编排层,`ApprovalService.injectAuditPoints`(要点核验注入)与 `decideAudit`(确定性审批决策)。
|
||||||
|
- `db.ts`:SQLite schema 初始化与连接管理(`getApprovalDatabase`,路径可经 `HOSE_APPROVAL_DB` 覆盖),迁移统一收敛至 `core/db/migrations.ts`。
|
||||||
|
- `types.ts`:`StrictnessTier`、`ParsedRule`、`ApprovalDecision`、`ApprovalRunRecord` 等模型定义。
|
||||||
|
|
||||||
|
## 关键约束
|
||||||
|
|
||||||
|
- 决策必须经 gateway 仲裁:`ApprovalDecision` 为封闭枚举(`APPROVE` / `REJECT` / `PASS_WITH_NOTE` / `REVIEW` / `PENDING` / `ERROR`),写动作由 `validateGatewayAction` 卡点。
|
||||||
|
- 规则严格度分四级:`硬性` / `弹性` / `建议` / `特殊`。
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
# Contact 通讯录域说明
|
||||||
|
|
||||||
|
本域负责企业组织架构(部门树)与员工通讯录检索。
|
||||||
|
|
||||||
|
## 架构
|
||||||
|
|
||||||
|
- `api.ts`:传输层,负责员工列表的 HTTP 请求与响应校验。
|
||||||
|
- `tools.ts`:业务层,提供限额保护、关键词检索与按 ID 精确查询的纯函数编排。
|
||||||
|
- `types.ts`:Zod 模式与 TypeScript 类型定义。
|
||||||
|
|
||||||
|
## 关键接口
|
||||||
|
|
||||||
|
- `listStaffsProtected`: 分页列出员工(默认限额 `DEFAULT_STAFF_LIST_LIMIT = 20`,防止全量拉取)
|
||||||
|
- `searchStaffs`: 按姓名/关键词检索员工
|
||||||
|
- `getStaffById`: 按 ID 获取员工详情
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
# Events 事件轮询域说明
|
||||||
|
|
||||||
|
本域负责待办与未读消息的增量事件轮询,以及基于 `core/db`(`observed_events` 表)的去重落盘。
|
||||||
|
|
||||||
|
## 架构
|
||||||
|
|
||||||
|
- `poller.ts`:组合 `task/` 与 `message/` 域的 `tools.ts` 并行拉取待办与未读消息,生成去重事件 ID(`kind:id:updatedAt`),返回新增事件与重复计数。
|
||||||
|
- `store.ts`:`EventStore`,通过 `core/db` 单一 SQLite 通道持久化已观测事件,提供 `has` / `commit` 幂等去重。
|
||||||
|
- `types.ts`:`EventRecord`、`EventPollResult` 等类型定义。
|
||||||
|
|
||||||
|
## 关键接口
|
||||||
|
|
||||||
|
- `pollEvents`: 单轮增量轮询(返回 `newEvents` / `duplicateCount` / 扫描统计)
|
||||||
|
- `EventStore`: 事件去重存储(迁移表 `observed_events`,由 `core/db/migrations.ts` 统一管理)
|
||||||
|
|
||||||
|
## 设计约束
|
||||||
|
|
||||||
|
- 本域无 `api.ts`:不直接触达 HTTP 传输层,复用 `task/` 与 `message/` 域的编排能力。
|
||||||
|
- 事件 ID 含 `updatedAt`(消息含 `updateTime`),同一实体更新时视为新事件。
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
# Message 消息域说明
|
||||||
|
|
||||||
|
本域负责系统通知消息的分页查询、过滤合并与已读状态标记。
|
||||||
|
|
||||||
|
## 架构
|
||||||
|
|
||||||
|
- `api.ts`:传输层,负责消息分页拉取与单条已读标记的 HTTP 请求。
|
||||||
|
- `tools.ts`:业务层,提供消息归一化、类型过滤、同实体合并与已读确认等纯函数编排。
|
||||||
|
- `types.ts`:Zod 模式与 TypeScript 类型定义。
|
||||||
|
|
||||||
|
## 关键接口
|
||||||
|
|
||||||
|
- `listMessages`: 分页拉取系统消息(支持已读/未读过滤)
|
||||||
|
- `filterMessages`: 按消息类型过滤
|
||||||
|
- `mergeMessages`: 合并同一实体的重复消息
|
||||||
|
- `readMessage`: 标记单条消息为已读
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Task 任务域说明
|
||||||
|
|
||||||
|
本域负责待办/已办审批任务流的分页查询与汇总。
|
||||||
|
|
||||||
|
## 架构
|
||||||
|
|
||||||
|
- `api.ts`:传输层,负责任务分页拉取的 HTTP 请求与响应校验。
|
||||||
|
- `tools.ts`:业务层,提供任务字段归一化与待办/已办查询编排。
|
||||||
|
- `types.ts`:Zod 模式与 TypeScript 类型定义。
|
||||||
|
|
||||||
|
## 关键接口
|
||||||
|
|
||||||
|
- `listTasks`: 分页查询待办(`todo`)/已办(`done`)任务流
|
||||||
|
- `normalizeTask`: 将合思原生任务字段归一化为 `TaskItem`
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# HTTP Daemon 说明
|
||||||
|
|
||||||
|
本目录是本地常驻 HTTP API 网关:暴露 CLI 能力的 HTTP 端点与交互式 OpenAPI 文档页。属入口层,业务调用一律经 `runCli` 委托 CLI 引擎,严禁直连 `domains/*/api.ts`。
|
||||||
|
|
||||||
|
## 文件职责
|
||||||
|
|
||||||
|
- `server.ts`:`startHttpServer` 启动常驻服务(默认 `127.0.0.1:8888`,可用 `HOST` / `PORT` 覆盖)。
|
||||||
|
- `routes.ts`:路由与安全——`isTrustedOrigin` 跨站来源校验、`checkHttpAuth` 访问令牌校验(`HOSE_HTTP_TOKEN` / `HOSE_HTTP_CORS_ORIGIN`)、`handleHttpRequest` 主分发。
|
||||||
|
- `docs.ts`:`renderDocsHtml` 渲染交互式 OpenAPI 文档页。
|
||||||
|
|
||||||
|
## 安全约束
|
||||||
|
|
||||||
|
- 默认仅绑定回环地址;跨站网页对 `/api/cli` 的调用被 `isTrustedOrigin` 阻断。
|
||||||
|
- 敏感字段输出经 `redactSensitiveText` 脱敏。
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
# Packaging 构建与分发内嵌层说明
|
||||||
|
|
||||||
|
本目录负责 OpenAPI 规范与 Agent Skill 的内嵌分发,以及二进制运行态自省。不属于业务域,也不属于 core 基础设施白名单。
|
||||||
|
|
||||||
|
## 文件职责
|
||||||
|
|
||||||
|
- `embedded-openapi.ts`:内嵌 `specs/openapi.json`(包装层)与 `specs/openapi.raw.json`(原生下游)两份 OpenAPI 规范,供 `hose-use openapi` 命令与 HTTP 文档页读取;产物由 `scripts/bundle-openapi.ts` / `scripts/generate-raw-openapi.ts` 生成。
|
||||||
|
- `embedded-skill.ts`:内嵌 `skills/hose-use/` 全量 Skill 文件(`EMBEDDED_SKILL_FILES`),支持 `hose-use skill install` 一键安装到全局目录,并在编译二进制运行时自动同步(`syncGlobalSkillIfPresent`)。
|
||||||
|
- `runtime.ts`:二进制运行态自省——`isCompiledBinary` 判定编译态、`resolveAppRoot` 解析应用根目录、`resolveDefaultLauncher` 解析启动配置。
|
||||||
|
|
||||||
|
## 依赖约束
|
||||||
|
|
||||||
|
- 仅可被入口层与 `cli/` 导入;不得反向依赖 `domains/`。
|
||||||
|
- 内嵌产物必须随 git 提交(`specs/*.json`),保证编译二进制无需构建步骤即可携带完整规范。
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import wrappedOpenApi from "../../dist/openapi.json" with { type: "json" };
|
import wrappedOpenApi from "../../specs/openapi.json" with { type: "json" };
|
||||||
import rawOpenApi from "../../dist/raw-hose-openapi.json" with { type: "json" };
|
import rawOpenApi from "../../specs/openapi.raw.json" with { type: "json" };
|
||||||
|
|
||||||
export type OpenApiType = "wrapped" | "raw";
|
export type OpenApiType = "wrapped" | "raw";
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user