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。
This commit is contained in:
1 parent
b51152276d
commit
36e21e5dc2
34 files changed
+1668
-1
No files matched your search
@@ -15,6 +15,7 @@ import {
|
||||
handleSaasPlatformRedirect,
|
||||
} from "./cli/aipro-registry.js";
|
||||
import { handleAiProHelp } from "./cli/commands/aipro/status.js";
|
||||
import { handleAiProReport } from "./cli/commands/aipro/report.js";
|
||||
import { assertAiProEnabled, handleAiProLogin } from "./cli/aipro-license.js";
|
||||
import type { AiProExecutionContext } from "./cli/commands/aipro/types.js";
|
||||
|
||||
@@ -114,6 +115,11 @@ async function runAiProCliOnce(rawArgs: string[]): Promise<{ stdout: string; std
|
||||
if (licenseGate) return licenseGate;
|
||||
}
|
||||
|
||||
// 本地 Web 控制台的聚合数据源(只读,不进命令注册表)
|
||||
if (command === "report") {
|
||||
return handleAiProReport(ctx);
|
||||
}
|
||||
|
||||
const commandDef = findAiProCommand(command);
|
||||
if (commandDef) {
|
||||
return await commandDef.handler(ctx);
|
||||
|
||||
Reference in new issue
Block a user