Compare commits
9
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
f3caebfd8a | ||
|
|
1eeb288143 | ||
|
|
4272dd8e60 | ||
|
|
7666db9f1d | ||
|
|
f9de8337b2 | ||
|
|
4beafe40cc | ||
|
|
3710f50ea4 | ||
|
|
55573de6a8 | ||
|
|
50362c2937 |
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hose-use",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.5",
|
||||
"description": "合思/易快报 (ekuaibao) 企业级 SaaS CLI 与底层 SDK:多账号登录、企业租户切换、单据明细检索、工作流管理、内置 HTTP 服务与常驻守护进程。",
|
||||
"author": {
|
||||
"name": "yingqing"
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# hose-use (v0.9.3)
|
||||
# hose-use (v0.9.5)
|
||||
|
||||
合思/易快报(ekuaibao)企业级 CLI 命令行工具与底层 SDK。
|
||||
|
||||
@@ -55,7 +55,7 @@ hose-use version
|
||||
| `HOSE_AIPRO_LICENSE_FILE` | AI PRO 凭证文件路径(默认 `~/.config/hose-use/aipro-license.token`,0600) |
|
||||
| `HOSE_AIPRO_LICENSE_PRIVATE_KEY` / `HOSE_AIPRO_LICENSE_PRIVATE_FILE` | 仅签发方使用,客户端运行不需要 |
|
||||
|
||||
AI PRO 常驻服务启动后,浏览器打开 `http://127.0.0.1:8889/report` 即为本地 Web 控制台(Vue 单页、资源全内嵌、不依赖 CDN)。前端源码在 `web/`,构建产物由 `bun run web:build` 生成并内嵌进二进制。
|
||||
AI PRO 常驻服务启动后,浏览器打开 `http://127.0.0.1:8889/report` 即为本地 Web 控制台(Vue 单页、资源全内嵌、不依赖 CDN)。前端源码在 `web/`,构建产物由 `bun run web:build` 生成并内嵌进二进制。`GET /docs` 的交互式 API 文档同样全离线——Scalar 运行时由 `GET /static/scalar.js` 本地提供,仅在升级版本时才需要 `bun run docs:fetch` 联网刷新。
|
||||
|
||||
---
|
||||
|
||||
|
||||
+2
-1
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hose-use",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.5",
|
||||
"module": "src/server.ts",
|
||||
"type": "module",
|
||||
"exports": {
|
||||
@@ -29,6 +29,7 @@
|
||||
"openapi:bundle": "bun run scripts/generate/bundle-openapi.ts",
|
||||
"openapi:generate-raw": "bun run scripts/generate/generate-raw-openapi.ts",
|
||||
"openapi:all": "bun run scripts/generate/generate-raw-openapi.ts && bun run scripts/generate/bundle-openapi.ts",
|
||||
"docs:fetch": "node scripts/build/build-docs.mjs",
|
||||
"web:dev": "bun --cwd web run dev",
|
||||
"web:build": "node scripts/build/build-webui.mjs",
|
||||
"build:binary": "node scripts/build/build-binary.mjs",
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
# 构建脚本
|
||||
|
||||
| 脚本 | 职责 |
|
||||
|---|---|
|
||||
| `build-binary.mjs` | 用 `bun build --compile` 编译各平台单二进制,注入 `HOSE_BUILD_*` 版本元数据,并创建 `hose-aipro` multicall 软链 |
|
||||
| `build-plugin.mjs` | 打包 `dist/mcp/server.js`(MCP 单文件产物) |
|
||||
| `package-plugin.mjs` | 生成 `dist/bin/hose-use-plugin-v<版本>.tar.gz` 完整插件包 |
|
||||
| `build-webui.mjs` | 构建 `web/` 的 Vue 控制台,把 JS/CSS 内联成 `src/packaging/generated/webui.txt` 供二进制内嵌 |
|
||||
| `build-docs.mjs` | 拉取固定版本 Scalar standalone 并校验 SHA-256,生成 `src/packaging/generated/scalar-standalone.js.txt` |
|
||||
|
||||
`build-webui.mjs` 需要开发机先执行 `bun install --cwd web`;生成物随 git 提交,CI 与编译二进制不需要前端依赖。其余三个脚本只依赖根仓库的 `bun install`。
|
||||
|
||||
对应根命令:`build:binary`、`build:plugin`、`package:plugin`、`web:build`。
|
||||
@@ -0,0 +1,39 @@
|
||||
#!/usr/bin/env node
|
||||
/**
|
||||
* 刷新 /docs 页面使用的 Scalar 浏览器运行时。
|
||||
*
|
||||
* 固定版本 + SHA-256 校验,产物写到 src/packaging/generated/ 并随 git 提交,
|
||||
* 因此运行时完全离线,编译二进制与 CI 都不需要访问 CDN。
|
||||
* 用法:bun run docs:fetch(仅在升级 Scalar 版本时需要)
|
||||
*/
|
||||
import { createHash } from "node:crypto";
|
||||
import { mkdirSync, writeFileSync } from "node:fs";
|
||||
import { dirname, join, resolve } from "node:path";
|
||||
|
||||
const SCALAR_VERSION = "1.25.101";
|
||||
const SOURCE = `https://cdn.jsdelivr.net/npm/@scalar/api-reference@${SCALAR_VERSION}/dist/browser/standalone.js`;
|
||||
const EXPECTED_SHA256 = "045c6a1ffa88167ea7f8adb8359cdfe2d2233faead3ebe1d2ec0b1e7975d3fdc";
|
||||
|
||||
const root = resolve(import.meta.dirname, "../..");
|
||||
const target = join(root, "src", "packaging", "generated", "scalar-standalone.js.txt");
|
||||
|
||||
console.log(`[build:docs] fetching @scalar/api-reference@${SCALAR_VERSION} ...`);
|
||||
const response = await fetch(SOURCE);
|
||||
if (!response.ok) {
|
||||
console.error(`[build:docs] 下载失败: HTTP ${response.status}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const bytes = Buffer.from(await response.arrayBuffer());
|
||||
const actual = createHash("sha256").update(bytes).digest("hex");
|
||||
if (actual !== EXPECTED_SHA256) {
|
||||
console.error(`[build:docs] SHA-256 不匹配,拒绝写入`);
|
||||
console.error(` expected=${EXPECTED_SHA256}`);
|
||||
console.error(` actual =${actual}`);
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
// 后缀 .txt:Bun 对 .js 的 text import 可能被当成模块;内容仍是完整 JS。
|
||||
mkdirSync(dirname(target), { recursive: true });
|
||||
writeFileSync(target, bytes);
|
||||
console.log(`[build:docs] ✓ ${target} (${(bytes.length / 1024 / 1024).toFixed(2)} MiB, sha256 ${actual.slice(0, 12)}…)`);
|
||||
@@ -2,11 +2,11 @@
|
||||
name: hose-aipro
|
||||
description: "合思 AI PRO(EASO AI PRO)确定性审批仲裁网关 CLI 与技能套件:单据挂载绑定、事实证据核验与打标 (PASS/FAIL/SKIP)、审核要点/规则场景库检索、确定性审批仲裁(同意/驳回/转人工硬阻断)、审计轨迹日志查询与常驻服务管理。用于一切合思 AI PRO 确定性审批仲裁与要点核验请求。"
|
||||
metadata:
|
||||
version: 0.9.3
|
||||
version: 0.9.5
|
||||
short-description: 合思 AI PRO 确定性审批仲裁网关与审核要点核验 skill
|
||||
---
|
||||
|
||||
# hose-aipro (v0.9.3)
|
||||
# hose-aipro (v0.9.5)
|
||||
|
||||
合思 AI PRO 确定性审批仲裁网关是专门面向企业财务核算、单据审核与自动化合规风控的确定性仲裁命令行与 SDK。
|
||||
|
||||
|
||||
@@ -2,11 +2,11 @@
|
||||
name: hose-use
|
||||
description: "合思/易快报(Ekuaibao)企业级 SaaS 一站式能力:hose-use CLI/SDK 多账号登录、租户切换、单据检索与审批动作、自建应用与工作流扫描、密钥与应用中心、常驻守护进程与 HTTP 文档/OpenAPI,以及工作流 MVEL 代码节点脚本生成调试、节点批量开通。用于一切合思/易快报相关请求。"
|
||||
metadata:
|
||||
version: 0.9.3
|
||||
version: 0.9.5
|
||||
short-description: 合思/易快报 企业级 CLI 与工作流 skill 套件(含 MVEL 代码节点)
|
||||
---
|
||||
|
||||
# hose-use (v0.9.3)
|
||||
# hose-use (v0.9.5)
|
||||
|
||||
在具备 MCP 的 AI 智能体环境中,**优先使用 `hose_cli` 单工具网关**,传入 `command: string` 执行;在终端或自动化脚本中,直接调用全局 `hose` 或 `hose-use` 命令行。
|
||||
本 Skill 是智能体的路由分发层:保持主文档简明,遇到复杂业务时深入查阅对应的专属参考文档(`references/*.md`)。
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
openapi: 3.1.0
|
||||
info:
|
||||
title: hose-use API & MCP Tools Specification
|
||||
version: 0.9.3
|
||||
version: 0.9.5
|
||||
description: >-
|
||||
Unified Enterprise SaaS API, CLI, and MCP Specification for Ekuaibao (合思/易快报), EASO, and Piper Workflows.
|
||||
servers:
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
"openapi": "3.1.0",
|
||||
"info": {
|
||||
"title": "hose-use API & MCP Tools Specification",
|
||||
"version": "0.9.3",
|
||||
"version": "0.9.5",
|
||||
"description": "Unified Enterprise SaaS API, CLI, and MCP Specification for Ekuaibao (合思/易快报), EASO, and Piper Workflows."
|
||||
},
|
||||
"servers": [
|
||||
|
||||
@@ -40,6 +40,8 @@ async function runAiProCliOnce(rawArgs: string[]): Promise<{ stdout: string; std
|
||||
corpId: stringOption(parsed.options, ["corp"]),
|
||||
jsonMode,
|
||||
});
|
||||
// multicall 二进制的 argv0 不进 parsed.raw,显式标注入口身份供命令层判断
|
||||
runtime.app = "hose-aipro";
|
||||
|
||||
const corp = runtime.selectedCorp;
|
||||
const previewPositional = parsed.positional || [];
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
# AI PRO 命令层
|
||||
|
||||
`hose-aipro` 专属命令的 handler,由 `src/cli/aipro-registry.ts` 注册,经 `src/aipro-cli.ts` 的统一凭证门禁后分发。只读自省命令(`status` / `version` / `help` 等)豁免门禁,其余一律要求有效离线凭证。
|
||||
|
||||
| 文件 | 职责 |
|
||||
|---|---|
|
||||
| `status.ts` | 网关运行上下文、企业信息与帮助页 |
|
||||
| `rules.ts` | 规约场景、审核要点、核验清单 |
|
||||
| `bind.ts` | 单据挂载与会话初始化 |
|
||||
| `review.ts` | 事实证据核验打标(PASS / FAIL / SKIP) |
|
||||
| `decide.ts` | 确定性仲裁与流转 |
|
||||
| `logs.ts` | 审计流水查询 |
|
||||
| `service.ts` | 常驻服务控制 |
|
||||
| `report.ts` | `report --json` 聚合数据源,供本地 Web 控制台一次拉取场景 / 规则 / 会话 / 要点 / 流水 / 授权状态 |
|
||||
|
||||
`types.ts` 定义 `AiProExecutionContext` 与命令结果类型;`index.ts` 汇总导出。新增命令照常注册即可自动受门禁管辖,不需要改授权代码。
|
||||
|
||||
**边界**:凭证只作用于 `hose-aipro`;`hose-use` 是免费功能,不受任何激活门禁约束。
|
||||
@@ -0,0 +1,37 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { handleSkillCommand } from "./skill.js";
|
||||
import { getAiProSkillContent, getSkillContent } from "../../packaging/embedded-skill.js";
|
||||
|
||||
const parsed = {
|
||||
area: "skill",
|
||||
action: "dump",
|
||||
args: [],
|
||||
options: {},
|
||||
raw: ["skill", "dump"],
|
||||
};
|
||||
|
||||
const baseRuntime = {
|
||||
selectedCorp: null,
|
||||
corpContext: {},
|
||||
jsonMode: false,
|
||||
};
|
||||
|
||||
describe("skill dump 的 multicall 入口识别", () => {
|
||||
test("hose-aipro 入口返回 AI PRO Skill(不依赖 argv0 猜测)", async () => {
|
||||
const result = await handleSkillCommand(parsed as never,{ ...baseRuntime, app: "hose-aipro" } as never);
|
||||
expect(result.stdout).toBe(`${getAiProSkillContent()}\n`);
|
||||
expect(result.stdout).toContain("hose-aipro (v");
|
||||
});
|
||||
|
||||
test("hose-use 入口返回平台 Skill", async () => {
|
||||
const result = await handleSkillCommand(parsed as never,{ ...baseRuntime, app: "hose-use" } as never);
|
||||
expect(result.stdout).toBe(`${getSkillContent()}\n`);
|
||||
expect(result.stdout).toContain("hose-use (v");
|
||||
});
|
||||
|
||||
test("兼容历史:未标注 app 时仍按 parsed.raw 里的 aipro 标记识别", async () => {
|
||||
const legacyParsed = { ...parsed, raw: ["skill", "dump", "aipro"] };
|
||||
const result = await handleSkillCommand(legacyParsed as never, baseRuntime as never);
|
||||
expect(result.stdout).toBe(`${getAiProSkillContent()}\n`);
|
||||
});
|
||||
});
|
||||
@@ -22,6 +22,7 @@ export async function handleSkillCommand(
|
||||
): Promise<CliResult> {
|
||||
const action = parsed.action || "status";
|
||||
const isAiProCaller =
|
||||
runtime.app === "hose-aipro" ||
|
||||
parsed.area === "hose-aipro" ||
|
||||
parsed.raw.some((arg) => arg.includes("hose-aipro") || arg === "aipro");
|
||||
|
||||
|
||||
@@ -162,6 +162,7 @@ async function dispatchParsedCli(
|
||||
launcher: options.launcher,
|
||||
});
|
||||
runtime.writeStdout = options.writeStdout;
|
||||
runtime.app = "hose-use";
|
||||
|
||||
try {
|
||||
if (!parsed.area) {
|
||||
|
||||
@@ -44,6 +44,8 @@ export interface CliRuntime {
|
||||
outputOptions?: OutputOptions;
|
||||
appRoot?: string;
|
||||
entryFile?: string;
|
||||
/** 入口身份,由 runCli / runAiProCli 显式标注,供命令层区分 multicall 调用方。 */
|
||||
app?: "hose-use" | "hose-aipro";
|
||||
launcher?: {
|
||||
command: string;
|
||||
args?: string[];
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
import { describe, expect, test } from "bun:test";
|
||||
import { renderDocsHtml } from "./docs.js";
|
||||
import { handleHttpRequest } from "./routes.js";
|
||||
import { getScalarStandaloneJs } from "../packaging/embedded-docs.js";
|
||||
|
||||
describe("离线 API 文档", () => {
|
||||
test("HTML 不引用任何 CDN,指向本地路由", () => {
|
||||
const html = renderDocsHtml();
|
||||
expect(html).toContain('src="/static/scalar.js"');
|
||||
expect(html).toContain('data-url="/openapi.json"');
|
||||
expect(html).toContain('id="api-reference"');
|
||||
expect(html).not.toContain("cdn.jsdelivr.net");
|
||||
expect(html).not.toMatch(/src="https?:\/\//);
|
||||
expect(html).toContain("connect-src 'self'");
|
||||
expect(html).toContain("Content-Security-Policy");
|
||||
});
|
||||
|
||||
test("内嵌运行时是完整的 Scalar standalone", () => {
|
||||
const js = getScalarStandaloneJs();
|
||||
expect(js.length).toBeGreaterThan(1_000_000);
|
||||
expect(js).toContain("Scalar");
|
||||
expect(js).not.toContain("</script>");
|
||||
});
|
||||
|
||||
test("GET /static/scalar.js 返回 JS 且与内嵌产物一致", async () => {
|
||||
let status = 0;
|
||||
let headers: Record<string, string> = {};
|
||||
let body = "";
|
||||
const res = {
|
||||
setHeader: (key: string, value: unknown) => { headers[key] = String(value); },
|
||||
writeHead: (code: number, next: Record<string, string>) => {
|
||||
status = code;
|
||||
headers = { ...headers, ...next };
|
||||
},
|
||||
end: (value?: string) => { body = value ?? ""; },
|
||||
headersSent: false,
|
||||
};
|
||||
|
||||
await handleHttpRequest(
|
||||
{ method: "GET", url: "/static/scalar.js", headers: { host: "localhost" } } as never,
|
||||
res as never,
|
||||
{ app: "hose-use" }
|
||||
);
|
||||
|
||||
expect(status).toBe(200);
|
||||
expect(headers["Content-Type"]).toContain("application/javascript");
|
||||
expect(body).toBe(getScalarStandaloneJs());
|
||||
});
|
||||
});
|
||||
+3
-1
@@ -6,6 +6,8 @@ export function renderDocsHtml(): string {
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no" />
|
||||
<!-- 运行时全部资源来自本地:即使 Scalar 内置的"示例规范"分支被触发也发不出外网请求 -->
|
||||
<meta http-equiv="Content-Security-Policy" content="default-src 'self' data: blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval'; style-src 'self' 'unsafe-inline'; img-src 'self' data:; font-src 'self' data:; connect-src 'self'; worker-src 'self' blob:;" />
|
||||
<title>hose-use API Reference (v${VERSION})</title>
|
||||
<link rel="icon" type="image/svg+xml" href="data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 100 100'><text y='.9em' font-size='90'>⚡</text></svg>" />
|
||||
<style>
|
||||
@@ -22,7 +24,7 @@ export function renderDocsHtml(): string {
|
||||
id="api-reference"
|
||||
data-url="/openapi.json"
|
||||
data-configuration='{"theme":"purple","layout":"modern","showSidebar":true}'
|
||||
src="https://cdn.jsdelivr.net/npm/@scalar/api-reference@1.25.101/dist/browser/standalone.js"
|
||||
src="/static/scalar.js"
|
||||
></script>
|
||||
</body>
|
||||
</html>`;
|
||||
|
||||
@@ -5,6 +5,7 @@ import { runAiProCli } from "../aipro-cli.js";
|
||||
import { loadCorpConfigs, loadGlobalConfig } from "../core/config/loader.js";
|
||||
import { getOpenApiSchema } from "../packaging/embedded-openapi.js";
|
||||
import { getAiProWebUiHtml } from "../packaging/embedded-webui.js";
|
||||
import { getScalarStandaloneJs } from "../packaging/embedded-docs.js";
|
||||
import { tokenizeCommand, normalizeCliArgs } from "../server.js";
|
||||
import { VERSION } from "../version.js";
|
||||
import { renderDocsHtml } from "./docs.js";
|
||||
@@ -125,6 +126,12 @@ export async function handleHttpRequest(
|
||||
return;
|
||||
}
|
||||
|
||||
// /docs 的 Scalar 运行时由本地提供,彻底去掉 CDN 依赖
|
||||
if (method === "GET" && pathname === "/static/scalar.js") {
|
||||
sendJavascript(res, 200, getScalarStandaloneJs());
|
||||
return;
|
||||
}
|
||||
|
||||
if (method === "GET" && pathname === "/docs") {
|
||||
sendHtml(res, 200, renderDocsHtml());
|
||||
return;
|
||||
@@ -235,6 +242,16 @@ function sendHtml(res: ServerResponse, status: number, html: string): void {
|
||||
res.end(html);
|
||||
}
|
||||
|
||||
function sendJavascript(res: ServerResponse, status: number, source: string): void {
|
||||
if (res.headersSent) return;
|
||||
res.writeHead(status, {
|
||||
"Content-Type": "application/javascript; charset=utf-8",
|
||||
"Content-Length": Buffer.byteLength(source, "utf-8"),
|
||||
"Cache-Control": "public, max-age=86400",
|
||||
});
|
||||
res.end(source);
|
||||
}
|
||||
|
||||
function sendError(res: ServerResponse, status: number, message: string): void {
|
||||
sendJson(res, status, { error: true, message });
|
||||
}
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
- `embedded-openapi.ts`:内嵌 `specs/openapi.json`(包装层)与 `specs/openapi.raw.json`(原生下游)两份 OpenAPI 规范,供 `hose-use openapi` 命令与 HTTP 文档页读取;产物由 `scripts/generate/bundle-openapi.ts` / `scripts/generate/generate-raw-openapi.ts` 生成。
|
||||
- `embedded-skill.ts`:内嵌 `skills/hose-use/` 全量 Skill 文件(`EMBEDDED_SKILL_FILES`),支持 `hose-use skill install --yes` 一键安装到全局目录,并在编译二进制运行时自动同步(`syncGlobalSkillIfPresent`)。
|
||||
- `embedded-webui.ts`:内嵌 AI PRO 本地 Web 控制台的单文件 HTML,供 `GET /report` 返回。
|
||||
- `embedded-docs.ts`:内嵌 `/docs` 交互式文档使用的 Scalar 浏览器运行时,供 `GET /static/scalar.js` 返回。
|
||||
- `runtime.ts`:二进制运行态自省——`isCompiledBinary` 判定编译态、`resolveAppRoot` 解析应用根目录、`resolveDefaultLauncher` 解析启动配置。
|
||||
|
||||
## Web 控制台内嵌产物
|
||||
@@ -22,6 +23,19 @@ bun run web:build # 生成 src/packaging/generated/webui.txt
|
||||
- 该生成物**必须随 git 提交**,与 `specs/*.json` 同理——编译二进制与 CI 不需要安装前端依赖。
|
||||
- `.webui-dist/` 是 Vite 中间产物,已被 `.gitignore` 忽略。
|
||||
|
||||
## 离线 API 文档运行时
|
||||
|
||||
`GET /docs` 的 Scalar 交互式文档不再引用 CDN。`scripts/build/build-docs.mjs` 固定 `@scalar/api-reference@1.25.101`,下载后按 SHA-256 校验,生成 `src/packaging/generated/scalar-standalone.js.txt`:
|
||||
|
||||
```bash
|
||||
bun run docs:fetch # 仅升级 Scalar 版本时需要联网
|
||||
```
|
||||
|
||||
- 生成物随 git 提交;daemon 的 `GET /static/scalar.js` 返回它,`/docs` 用相对路径加载,运行时完全离线。
|
||||
- 后缀用 `.txt` 与 webui 同理,避开 Bun 对 `.js` / `.html` 的非字符串类型推断。
|
||||
- `renderDocsHtml()` 里加了 CSP(`connect-src 'self'`):Scalar 内置一个"加载示例规范"分支会 `fetch` jsdelivr 的 galaxy.yaml,我们的页面用 `data-url="/openapi.json"` 不走该分支,CSP 再兜一层,保证任何情况下都发不出外网请求。
|
||||
- 生成物约 2.7 MiB,二进制体积因此增加约 2.9 MB。
|
||||
|
||||
## 依赖约束
|
||||
|
||||
- 仅可被入口层与 `cli/` 导入;不得反向依赖 `domains/`。
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
/**
|
||||
* /docs 交互式 API 文档的 Scalar 浏览器运行时(固定版本,随源码提交)。
|
||||
*
|
||||
* 由 scripts/build/build-docs.mjs 从 jsdelivr 拉取并校验 SHA-256 后生成,
|
||||
* 运行时由本地 daemon 的 GET /static/scalar.js 提供,不访问任何 CDN。
|
||||
*/
|
||||
import scalarStandaloneJs from "./generated/scalar-standalone.js.txt" with { type: "text" };
|
||||
|
||||
export function getScalarStandaloneJs(): string {
|
||||
return scalarStandaloneJs;
|
||||
}
|
||||
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,13 @@
|
||||
# AI PRO Web 控制台(前端子工程)
|
||||
|
||||
Vue 3.5 + Vite 6 + TypeScript + vue-router + Tailwind 3,配置对齐 `~/Code/影视飓风/twc-approval-go-bridge/web`。页面由 `hose-aipro` 常驻服务在 `http://127.0.0.1:8889/report` 提供,只监听回环地址。
|
||||
|
||||
```bash
|
||||
bun install --cwd web # 仅开发机需要
|
||||
bun run web:dev # Vite dev server :3000,/api /v1 代理到 8889
|
||||
bun run web:build # 生成 ../src/packaging/generated/webui.txt
|
||||
```
|
||||
|
||||
`scripts/build/build-webui.mjs` 会把 Vite 产物的 JS/CSS 内联成单个 HTML,再由 `src/packaging/embedded-webui.ts` 内嵌进二进制。**生成物随 git 提交**,所以 CI 与编译二进制不需要安装前端依赖;`.webui-dist/` 是忽略的中间产物。
|
||||
|
||||
前端统一经 `POST /api/cli` 调用现有 CLI 命令,不新增鉴权路径;`report --json` 是聚合数据源。设置 `HOSE_HTTP_TOKEN` 时浏览器请求需带 Bearer Token。
|
||||
@@ -0,0 +1,13 @@
|
||||
# 前端源码结构
|
||||
|
||||
| 路径 | 职责 |
|
||||
|---|---|
|
||||
| `main.ts` | 创建 Vue 实例、挂载路由与全局样式 |
|
||||
| `App.vue` | 侧边导航、网关健康状态 |
|
||||
| `router/index.ts` | hash 路由(适配 `/report` 挂载点) |
|
||||
| `api/client.ts` | 统一 CLI 网关取数与错误处理 |
|
||||
| `views/` | 总览、审批会话、规则与要点、审计流水、命令终端 |
|
||||
| `styles/main.css` | Tailwind 入口与共享组件类 |
|
||||
| `env.d.ts` | Vite 与 `.vue` 单文件组件类型声明 |
|
||||
|
||||
写操作(`bind` / `review` / `decide --apply`)在页面上保留二次确认,与 CLI 的 `--yes` 约定一致。
|
||||
Reference in new issue
Block a user