Commit Graph
26 Commits
Author SHA1 Message Date
gitea 55573de6a8 fix: 显式标注 multicall 入口身份并补齐目录文档
- CliRuntime 新增 app?: "hose-use" | "hose-aipro",由 runCli 与
  runAiProCli 各自标注;skill.ts 优先用它判断调用方,修复
  hose-aipro skill dump 误输出 hose-use Skill 的既有 bug——根因是
  multicall 二进制的 argv0 不会进入 parsed.raw。保留 raw 里的历史
  aipro 标记作为兼容。
- 新增 skill.test.ts 覆盖两个入口与历史兼容三条路径。
- 补齐 4 份目录 README(scripts/build、cli/commands/aipro、web、
  web/src):web/ 文件在 #177 合入后由 untracked 转为 tracked,
  才被 check:readme 纳入扫描,暴露出 4 个目录缺文档。

校验:bun test 1111 pass / 0 fail,bun run check 通过,
check:readme 36/36 通过;编译产物实测 hose-aipro skill dump
返回 AI PRO Skill、hose-use 返回平台 Skill。
2026-11-05 19:36:49 +08:00
gitea 36e21e5dc2 feat: AI PRO 本地 Web 控制台与聚合报表
持久化常驻复用现有 hose-aipro service start(detached + pid 文件、
127.0.0.1:8889),本次只补前端与数据出口,不做端口/K8s 化改造。
是否映射公网由使用者自行决定,工具仍只监听回环地址。

- web/:Vue 3.5 + Vite 6 + TS + vue-router + Tailwind 3 子工程,配置对齐
  本机 twc-approval-go-bridge/web(base /static/、outDir 到后端内嵌目录、
  dev proxy → 8889、hash 路由)。5 个视图:总览、审批会话、规则与要点、
  审计流水、命令终端;统一经 POST /api/cli 调用现有 CLI 能力。
- scripts/build/build-webui.mjs:把 Vite 产物 JS/CSS 内联成单文件 HTML,
  生成 src/packaging/generated/webui.txt。生成物随 git 提交,编译二进制
  与 CI 不需要安装前端依赖;.webui-dist/ 为忽略的中间产物。
- src/packaging/embedded-webui.ts:with { type: text } 内嵌。用 .txt 后缀
  而非 .html,避开 Bun 对 .html 的 HTMLBundle 类型推断导致 tsc 报错。
- src/http/routes.ts:AI Pro daemon 暴露 GET /report(含 /report/* 兜底);
  server.ts 启动日志补控制台地址;hose-use daemon 不暴露该路由。
- src/cli/commands/aipro/report.ts:新增 report --json 聚合命令,一次返回
  场景/规则/会话/要点/流水/授权状态;单据快照等大字段不下发,避免撑爆
  浏览器。命令在统一门禁之后,未激活仍会被拦截。
- 新增 embedded-webui / webui 路由 / report 聚合三组测试;同步
  SKILL.md、README.md、packaging README、.gitignore 与 package.json 脚本。

校验:bun test 1108 pass / 0 fail,bun run check、check:readme 全通过;
编译二进制实测 GET /report 返回 200 且资源全内联(140KB、零外链),
POST /api/cli report --json 返回真实聚合数据(2 场景/3 规则/45 条流水)。

本次不打 tag、不发版,留待 0.9.4。
2026-11-05 19:25:52 +08:00
gitea 957cb04324 feat: AI PRO 离线凭证激活与统一门禁
默认不激活 AI PRO,需服务方离线下发 Ed25519 签名凭证后在本地执行
hose-aipro login 激活。凭证只含 sub / exp / maxVersion 等业务字段,
校验完全在本地完成,不联网。

约束仅两条:
- 当前二进制版本不得高于 maxVersion(三段数字比较,忽略 -dev 后缀)
- 当前时间不得晚于 exp(绝对到期时间;不做时长上限、不做时钟防篡改)

实现要点:
- src/cli/aipro-license.ts 单文件承载验签、版本比较、0600 凭证落盘、
  门禁与 login;公钥内嵌源码,私钥由签发方离线保管、绝不进仓库
- src/aipro-cli.ts 分发层 12 行统一门禁;login 在门禁前分流且不进命令
  注册表。以后新增任何 AI PRO 命令只需照常注册,自动受门禁管辖,
  授权代码零侵入
- scripts/license/issue.ts 离线签发,私钥只读本地文件或环境变量,
  exp 想签多久签多久,脚本不施加任何天数限制
- 放行 status / help / version 等自省命令,其余业务命令未激活一律拦截
- 测试用进程内依赖注入临时密钥对,不引入环境变量后门
- skills/hose-aipro/SKILL.md 补充激活说明

校验:bun test 1094 pass / 0 fail,bun run check 通过;
端到端冒烟(未激活拦截 → 签发 → login → 版本超限拒绝)全通过。
2026-11-05 15:07:55 +08:00
gitea 362acfba58 feat(cli): 分离 hose-aipro 独立命令体系并升级至 v0.9.0
1. 架构对称性与声明式注册表抽取:
   - 新增 src/cli/aipro-registry.ts,声明式定义 AIPRO_COMMAND_REGISTRY 及其别名映射与 mutating 突变检查
   - 重构 src/aipro-cli.ts,移除过程式 switch-case 分发,改为查表式声明分发,与 hose-use 的 CLI_COMMAND_REGISTRY 保持 100% 对称
   - 在 src/cli/registry.ts 统一重导出 aipro-registry,巩固其作为顶层声明注册表的单一事实源地位
   - 增加 aipro-cli 测试用例,强制校验 COMMAND_METADATA["hose-aipro"] 与声明式注册表双向一致性

2. 双 Skill 独立打包与内嵌部署:
   - 注册两个独立技能:skills/hose-use 与 skills/hose-aipro,互相关联引用
   - src/packaging/embedded-skill.ts 增加双 Skill 编译期嵌入与 installSkillFiles 全量同步
   - hose-use / hose-aipro 下的 skill status/dump/install 完全对齐

3. 守护服务交叉治理:
   - src/cli/service.ts 支持 ServiceTargetName ("hose-use" | "hose-aipro"),默认端口 8888 与 8889
   - 支持 hose-use aipro <start|stop|...> 与 hose-aipro hose-use <start|stop|...> 双向服务纳管
   - 误触非本领域业务命令时提供友好互导拦截

4. 审批领域数据层防御加固:
   - 迁移 004:approval_runs 增加 short_id 唯一约束
   - 增加 allocateUniqueShortId 冲突重试,多步写操作纳入事务

5. 版本升级至 v0.9.0:
   - package.json、README.md、specs、.zcode-plugin 及两套 Skill 同步更新至 0.9.0
   - bump-version 脚本适配多 Skill 自动递增
2026-11-03 19:16:12 +08:00
gitea ae2a1a9d60 fix(approval): keep dry-run paths free of remote and local mutations 2026-10-20 17:50:06 +08:00
gitea 103ead0fe5 fix: harden CLI parsing, MCP startup and release integrity 2026-10-17 20:32:36 +08:00
gitea 88c57558e1 refactor(aipro): modularize 1181-line aipro-cli.ts into src/cli/commands/aipro and reuse shared CLI helpers 2026-09-30 00:35:27 +08:00
gitea 5a0c277993 refactor(architecture): eliminate direct domains/*/api imports in CLI entrypoints and add boundary tests 2026-09-30 00:22:36 +08:00
gitea c60d49fb8c fix(cli): prevent boolean flags from swallowing positional args and unify aipro arg parsing 2026-09-29 23:36:18 +08:00
gitea d0f3d2738a refactor(core): 全量语义化客户端迁移并移除历史兼容桥接层 2026-09-17 15:44:25 +08:00
gitea 2ed9bf0236 feat: make development builds visibly identifiable 2026-09-13 14:24:27 +08:00
gitea 3e072b490e feat: install development build globally 2026-09-11 17:35:29 +08:00
gitea a8e32cff32 feat(bill): support full invoice validation details, datalink cards, and department paths (v0.7.3) 2026-09-07 15:47:44 +08:00
gitea 3777e81ee7 feat(bill): refactor translator to modular functions and preserve inline positions for attachments and invoices 2026-09-07 15:20:27 +08:00
gitea 7efa83ff30 feat(cli): add context introspection command and hose-aipro status for zero-source-reading AX 2026-09-07 14:17:35 +08:00
gitea 27660bed92 feat(approval): introduce configurable gateway policy script and enforce strict reject/approve guardrails 2026-09-07 14:03:22 +08:00
gitea ca00e9a2cc feat(aipro): implement bind, review, decide with gateway guardrail and <150 chars opinion validation 2026-09-06 23:54:36 +08:00
gitea 7e39d95b36 feat(aipro): translate JSON output field names to Chinese in scopes and rules commands 2026-09-06 23:32:25 +08:00
gitea b0149ed32d feat(aipro): introduce init session with 6-char short runId and 6h TTL, support --run audit logging in scopes, translate, rules and logs 2026-09-06 23:23:57 +08:00
gitea a16d429d44 feat(aipro): add standalone document field translator and translate command 2026-09-06 22:58:34 +08:00
gitea 2afde446d2 feat(aipro): require wrapped array for rules input and flatten output by code 2026-09-06 22:46:37 +08:00
gitea 950dd6d8fa feat(aipro): add multi-index rules command outputting matched scopes and rules 2026-09-06 22:44:00 +08:00
gitea 8d203fc230 feat(aipro): format scopes command output as pure json with index and scope 2026-09-06 22:39:45 +08:00
gitea 62025cb6f1 feat(aipro): add scopes index command and decouple points from bills 2026-09-06 22:36:58 +08:00
gitea 9fa4cfe38f fix(approval): isolate runs by corp, handle execution error, bundle hose-aipro alias, and bump to v0.7.1 2026-09-06 21:57:53 +08:00
gitea 4e36a1d9a5 feat(approval): introduce sqlite rule engine, deterministic gateway, and hose-aipro cli (v0.7.0)
- Pure Rule Model & AST Parser:
  - Eliminate redundant title field; model rules purely via scope (scene index) and natural language body.
  - Implement AST parser for inline clauses: [action]{硬性|弹性|建议|特殊}.
  - Validate and enforce preference references with @{级别} syntax, strictly blocking invalid grammar.

- Embedded SQLite Database & Repository:
  - Native bun:sqlite integration with zero external dependencies, stored at ~/.config/hose-use/approval.db.
  - 5 core schemas: rules, preferences, approval_runs, approval_findings, and aipro_logs.
  - Support deduplicated scope indexing (listScopes with 1-based indices) and scope drill-down (getScopeDetail).

- Bill Requisition & Backlog Query Extension:
  - Add formatFlowAsBill adapter in domains/bill/tools.ts.
  - Fall back to flow and backlog inspection when bills are not found in invoice endpoints, unlocking full structured inspection for requisitions (such as S26000001) and loan requests.

- Deterministic Approval Gateway & Lifecycle:
  - Enforce mandatory approval lifecycle: points -> checklist -> review -> decide.
  - Physical gateway blocking: forbid decision if audit checklist is missing or empty, or if pending points remain unverified.
  - Hard tier severance: automatically sever and throw GatewayBlockError on approval attempts violating {硬性} clauses.

- Dedicated hose-aipro Global CLI & Immutable Audit Ledger:
  - Register secondary global binary hose-aipro alongside hose-use in package.json and build-binary.mjs.
  - Automatically record every AI Pro invocation, document context, args snapshot, operator, status, and verdict in aipro_logs.
  - Provide intuitive subcommands: points, checklist, review, decide, logs, rules.
  - Bump project version to v0.7.0 and regenerate OpenAPI bundles.
2026-09-06 19:03:06 +08:00