beautx-cli 1.1.1-beta.2 → 1.1.1-beta.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +26 -4
  2. package/dist/{analyze-Cq-Hmoqp.mjs → analyze-CtxR02Xr.mjs} +5 -5
  3. package/dist/{api-jIGM86TK.mjs → api-BdaZkABF.mjs} +1 -1
  4. package/dist/{audio-p2QCYFdq.mjs → audio-DlgPatwd.mjs} +3 -3
  5. package/dist/{beauty-plan-D9B8kaf-.mjs → beauty-plan-CmcNlyKk.mjs} +4 -4
  6. package/dist/{beauty-plan-reminder-D-gVCeWO.mjs → beauty-plan-reminder-B7g7RRTs.mjs} +2 -2
  7. package/dist/{capability-profile-DxrzExct.mjs → capability-profile-yPTx4Mn4.mjs} +5 -5
  8. package/dist/cli.mjs +22 -21
  9. package/dist/{config-V1amf6sh.mjs → config-BjsUQ9I-.mjs} +3 -3
  10. package/dist/{consultant-DZeIOYgS.mjs → consultant-vVraua0_.mjs} +1 -1
  11. package/dist/{content-CfzyDYSy.mjs → content-Ce7jKBol.mjs} +2 -2
  12. package/dist/{current-xqaZxhbN.mjs → current-fzCrzKjn.mjs} +1 -1
  13. package/dist/{customer-iWrGhESH.mjs → customer-CnAv26d0.mjs} +1 -1
  14. package/dist/{deal-analysis-Da8iNy64.mjs → deal-analysis-CX4IXbgk.mjs} +3 -3
  15. package/dist/{detail-BnUTSlRa.mjs → detail-ZG7WTexq.mjs} +4 -4
  16. package/dist/{doc-_TnZLbtD.mjs → doc-DU2dYD57.mjs} +3 -3
  17. package/dist/env-vars-osVxvm7z.mjs +212 -0
  18. package/dist/{fields-F00auxKR.mjs → fields-DuAxLfSA.mjs} +3 -3
  19. package/dist/{focus-DlptSJrZ.mjs → focus-Dx1rT6QE.mjs} +1 -1
  20. package/dist/{get-ByAQXto5.mjs → get-CCpn3m06.mjs} +4 -4
  21. package/dist/{get-BDXbs-_c.mjs → get-HrCcvm-j.mjs} +2 -2
  22. package/dist/{golden-sentence-CwT4AyLu.mjs → golden-sentence-DAM_YC7V.mjs} +1 -1
  23. package/dist/install-B9_5ceYu.mjs +50 -0
  24. package/dist/{kb-CBj6tJE9.mjs → kb-CygBF0br.mjs} +2 -2
  25. package/dist/{list-D7_yNqIG.mjs → list-6eMMquS2.mjs} +3 -1
  26. package/dist/{list-DPVEnWni.mjs → list-7ynSCgKJ.mjs} +4 -4
  27. package/dist/{list-Cnz5CuQB.mjs → list-Bt87oTfo.mjs} +4 -4
  28. package/dist/{list-Boz4Dr1p.mjs → list-Cc0bsWKY.mjs} +4 -4
  29. package/dist/{list-CB-bwmRO2.mjs → list-DKbbBiI62.mjs} +4 -4
  30. package/dist/{list-BGjT1Ovk.mjs → list-Dttn4hHn.mjs} +4 -4
  31. package/dist/list-DyAO08z92.mjs +77 -0
  32. package/dist/{list-DMFhAeTT.mjs → list-EcRLnxXY.mjs} +4 -4
  33. package/dist/{list-CQOLK3Xu.mjs → list-e0tVlYwh.mjs} +4 -4
  34. package/dist/{list-CnsJlbrZ.mjs → list-xjVc-39m.mjs} +1 -1
  35. package/dist/{mcp-args-DK3IGaO1.mjs → mcp-args-CG7OuBep.mjs} +1 -1
  36. package/dist/{mcp-client-BTZH22b5.mjs → mcp-client-huLKHRT3.mjs} +3 -3
  37. package/dist/{mcp-result-De_0PPlD.mjs → mcp-result-BzDGJUdM.mjs} +1 -1
  38. package/dist/{panke-DmzQyQHt.mjs → panke-DY7IFcsN.mjs} +2 -2
  39. package/dist/{portrait-tags-c7OW_KzT.mjs → portrait-tags-Dq0faG7k.mjs} +3 -3
  40. package/dist/{project-DeLeVoA3.mjs → project-BuF0FYZp.mjs} +3 -3
  41. package/dist/{project-access-pTN7ry15.mjs → project-access-ChmJv4Z4.mjs} +3 -2
  42. package/dist/project-access-D4b4oc5E.mjs +2 -0
  43. package/dist/{project-store-Dl35JzZr.mjs → project-store-DUlIIW51.mjs} +2 -207
  44. package/dist/project-store-DlbRmRAS.mjs +2 -0
  45. package/dist/{qa-DIZmvMwE.mjs → qa-MQphVELO.mjs} +5 -5
  46. package/dist/{resistance-CC4cxxUk.mjs → resistance-CzNYvRYF.mjs} +1 -1
  47. package/dist/{search-eIzMHyPL.mjs → search-CnFRGjnD.mjs} +5 -5
  48. package/dist/skill-_PLQOZgT.mjs +15 -0
  49. package/dist/skill-client-CLXEQ0Hv.mjs +146 -0
  50. package/dist/{staff-BVu2Hmu1.mjs → staff-ZUbldU8P.mjs} +1 -1
  51. package/dist/{summary-CYLljvrY.mjs → summary-B12uZDGr.mjs} +4 -4
  52. package/dist/{task-Fa1R-6DI.mjs → task-CAobpQXt.mjs} +4 -4
  53. package/dist/{text-BIIl7PmC.mjs → text-CCxnry4V.mjs} +4 -4
  54. package/dist/upload-COReB487.mjs +76 -0
  55. package/dist/{use-DIjJeiXP.mjs → use-e7Wzfw1k.mjs} +2 -2
  56. package/dist/{visit-D-HS1jjx.mjs → visit-DPkOV48n.mjs} +2 -2
  57. package/dist/{visit-query-args-BsfU3CUz.mjs → visit-query-args-BVeYwlRt.mjs} +2 -2
  58. package/package.json +1 -1
  59. package/dist/project-access-Bf87OLJP.mjs +0 -2
  60. package/dist/project-store-DDVZ7T4t.mjs +0 -2
  61. package/dist/visit-evaluate-COKpVvhv.mjs +0 -30
  62. /package/dist/{doctor-DuGxP40X.mjs → doctor-BuiUn2Zy.mjs} +0 -0
  63. /package/dist/{util-Bko-nm_R.mjs → util-BtgWHKWv.mjs} +0 -0
package/README.md CHANGED
@@ -57,6 +57,27 @@ beautx-cli project current
57
57
  beautx-cli project use --project-id <项目ID>
58
58
  ```
59
59
 
60
+ ### Skill 中心
61
+
62
+ Skill 中心命令走 REST,并使用 Host 注入的沙箱双凭证鉴权。
63
+
64
+ ```bash
65
+ # 按 personal / tenant / project 分组列出当前项目可见的 Skill
66
+ beautx-cli skill list [--type <personal|tenant|project>] [--project-id <项目ID>]
67
+
68
+ # 按数字 ID 下载安装包;默认项目取当前激活项目
69
+ beautx-cli skill install <Skill ID> [--project-id <项目ID>] [--dir <安装目录>]
70
+
71
+ # 上传包含 SKILL.md 的 zip;默认新建 personal Skill
72
+ beautx-cli skill upload <zip路径> [--type <personal|tenant|project>] \
73
+ [--project-id <项目ID>] [--skill-id <已有Skill ID>] [--tags <JSON数组>]
74
+ ```
75
+
76
+ - `list` 省略 `--type` 时按归属分组;返回的雪花 ID 始终按字符串处理。
77
+ - `install` 默认写入 `SKILL_INSTALL_DIR`,未设置时写入 `/home/wuying/jvscrew/.wangai-cli/skills`,并校验 SHA-256 checksum。
78
+ - `upload` 内部一次完成申请上传、对象存储 PUT 和服务端确认;`type=project` 时必须传 `--project-id`。
79
+ - 三个子命令均支持 `--format toon|json|yaml`。
80
+
60
81
  ### 顾问管理
61
82
 
62
83
  ```bash
@@ -156,9 +177,6 @@ beautx-cli resistance list [选项]
156
177
  ### 医美专项分析
157
178
 
158
179
  ```bash
159
- # 查询接诊评价
160
- beautx-cli visit-evaluate [选项]
161
-
162
180
  # 查询变美计划
163
181
  beautx-cli beauty-plan [选项]
164
182
  --followup-report-id <计划ID>
@@ -263,9 +281,11 @@ CLI 通过环境变量获取身份(由 QCA / Host 沙箱注入)。当前项
263
281
  | --- | --- |
264
282
  | ENV | `test` / `prod` |
265
283
  | TENANT_ID / USER_ID | 租户、用户 |
266
- | SANDBOX_TENANT_SECRET / SANDBOX_USER_SECRET | 沙箱双 secret,用于向 `/out/v2/mcp-token` 借 AT |
284
+ | SANDBOX_TENANT_SECRET / SANDBOX_USER_SECRET | 沙箱双 secret,用于 Token Broker 与 Skill 中心 REST 鉴权 |
267
285
  | XB_APP_ID | 应用 ID(`aike` 时禁止 `project use`) |
268
286
  | SESSION_ID | 可选;有则 MCP 请求带 `X-MCP-Session-Id` |
287
+ | SKILL_BFF_URL | 可选;覆盖当前环境内置的 Skill BFF 地址 |
288
+ | SKILL_INSTALL_DIR | 可选;覆盖 `skill install` 的安装根目录 |
269
289
 
270
290
  - **MCP AT**:每次调用向 `{callbackBaseUrl}/api/qca-wangclaw/out/v2/mcp-token` 借用(进程内缓存)。
271
291
  - **当前项目**:`GET/PUT /api/qca-wangclaw/out/v2/current-project`(`project current` / `project use`)。
@@ -277,6 +297,7 @@ CLI 通过环境变量获取身份(由 QCA / Host 沙箱注入)。当前项
277
297
 
278
298
  ```
279
299
  beautx-cli → MCP Gateway → beautx-mcp-bff → wangai-mcp-application (beautx 端点)
300
+ ↘ Skill BFF REST (`/api/wc-skill/out/**`)
280
301
  ```
281
302
 
282
303
  - **beautx-cli**:TypeScript CLI 工具,发送 JSON-RPC 请求
@@ -300,6 +321,7 @@ src/
300
321
  │ ├── resistance/ # 抗性点
301
322
  │ ├── audio/ # 录音管理
302
323
  │ ├── kb/ # 知识库
324
+ │ ├── skill/ # Skill 中心
303
325
  │ ├── config/ # 配置查看
304
326
  │ ├── qa.ts # SQL Agent
305
327
  │ └── api.ts # 通用 API 调用
@@ -1,9 +1,9 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
4
- import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-DK3IGaO1.mjs";
5
- import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
6
- import { t as csvToArray } from "./util-Bko-nm_R.mjs";
3
+ import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
4
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
5
+ import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
6
+ import { t as csvToArray } from "./util-BtgWHKWv.mjs";
7
7
  import { defineCommand } from "citty";
8
8
  //#region src/commands/audio/analyze.ts
9
9
  /**
@@ -1,5 +1,5 @@
1
1
  import { n as writeError, r as writeResult, t as formatCliArg } from "./cli.mjs";
2
- import { n as mcpCall, t as MCP_SERVICE_CODE } from "./mcp-client-BTZH22b5.mjs";
2
+ import { n as mcpCall, t as MCP_SERVICE_CODE } from "./mcp-client-huLKHRT3.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/commands/api.ts
5
5
  /**
@@ -6,9 +6,9 @@ var audio_default = defineCommand({
6
6
  description: "录音元数据分页 / 单条文本查询 / 全文批量分析"
7
7
  },
8
8
  subCommands: {
9
- list: () => import("./list-Cnz5CuQB.mjs").then((m) => m.default),
10
- text: () => import("./text-BIIl7PmC.mjs").then((m) => m.default),
11
- analyze: () => import("./analyze-Cq-Hmoqp.mjs").then((m) => m.default)
9
+ list: () => import("./list-Bt87oTfo.mjs").then((m) => m.default),
10
+ text: () => import("./text-CCxnry4V.mjs").then((m) => m.default),
11
+ analyze: () => import("./analyze-CtxR02Xr.mjs").then((m) => m.default)
12
12
  }
13
13
  });
14
14
  //#endregion
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError } from "./cli.mjs";
3
- import { t as mcpCallPage } from "./mcp-result-De_0PPlD.mjs";
4
- import { n as mergeIds, t as csvToArray } from "./util-Bko-nm_R.mjs";
5
- import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-BsfU3CUz.mjs";
3
+ import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
4
+ import { n as mergeIds, t as csvToArray } from "./util-BtgWHKWv.mjs";
5
+ import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-BVeYwlRt.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/beauty-plan/index.ts
8
8
  /**
@@ -1,6 +1,6 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError } from "./cli.mjs";
3
- import { t as mcpCallPage } from "./mcp-result-De_0PPlD.mjs";
3
+ import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/commands/beauty-plan-reminder/index.ts
6
6
  /**
@@ -1,9 +1,9 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
4
- import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-DK3IGaO1.mjs";
5
- import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
6
- import { i as toLocalDateTime } from "./util-Bko-nm_R.mjs";
3
+ import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
4
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
5
+ import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
6
+ import { i as toLocalDateTime } from "./util-BtgWHKWv.mjs";
7
7
  import { defineCommand } from "citty";
8
8
  //#region src/commands/staff/capability-profile.ts
9
9
  function buildStaffCapabilityProfileArgs(args, active) {
package/dist/cli.mjs CHANGED
@@ -1,7 +1,8 @@
1
1
  #!/usr/bin/env node
2
2
  import { i as __toESM, r as __require, t as __commonJSMin } from "./rolldown-runtime-YLnNgb9a.mjs";
3
- import { C as MissingAccessTokenError, S as ConfigInvalidError, _ as readEnv, b as syncProcessEnv, g as readCredentials, h as needsRefresh, m as isTokenExpired, o as loadActiveProject, u as ENV_KEYS, v as requireUserId, x as AccessTokenExpiredError, y as resolveEndpoints } from "./project-store-Dl35JzZr.mjs";
4
- import { i as invalidateProjectAccessCache } from "./project-access-pTN7ry15.mjs";
3
+ import { a as isTokenExpired, c as readEnv, d as syncProcessEnv, f as AccessTokenExpiredError, h as MissingAccessTokenError, l as requireUserId, o as needsRefresh, p as ConfigInvalidError, s as readCredentials, t as ENV_KEYS, u as resolveEndpoints } from "./env-vars-osVxvm7z.mjs";
4
+ import { i as invalidateProjectAccessCache } from "./project-access-ChmJv4Z4.mjs";
5
+ import { o as loadActiveProject } from "./project-store-DUlIIW51.mjs";
5
6
  import { appendFileSync, mkdirSync, readFileSync } from "node:fs";
6
7
  import { dirname, join } from "node:path";
7
8
  import { fileURLToPath } from "node:url";
@@ -7635,25 +7636,25 @@ runMain(defineCommand({
7635
7636
  }
7636
7637
  },
7637
7638
  subCommands: {
7638
- config: () => import("./config-V1amf6sh.mjs").then((m) => m.default),
7639
- project: () => import("./project-DeLeVoA3.mjs").then((m) => m.default),
7640
- consultant: () => import("./consultant-DZeIOYgS.mjs").then((m) => m.default),
7641
- staff: () => import("./staff-BVu2Hmu1.mjs").then((m) => m.default),
7642
- "golden-sentence": () => import("./golden-sentence-CwT4AyLu.mjs").then((m) => m.default),
7643
- panke: () => import("./panke-DmzQyQHt.mjs").then((m) => m.default),
7644
- audio: () => import("./audio-p2QCYFdq.mjs").then((m) => m.default),
7645
- customer: () => import("./customer-iWrGhESH.mjs").then((m) => m.default),
7646
- visit: () => import("./visit-D-HS1jjx.mjs").then((m) => m.default),
7647
- "visit-evaluate": () => import("./visit-evaluate-COKpVvhv.mjs").then((m) => m.default),
7648
- "beauty-plan": () => import("./beauty-plan-D9B8kaf-.mjs").then((m) => m.default),
7649
- "beauty-plan-reminder": () => import("./beauty-plan-reminder-D-gVCeWO.mjs").then((m) => m.default),
7650
- "deal-analysis": () => import("./deal-analysis-Da8iNy64.mjs").then((m) => m.default),
7651
- "portrait-tags": () => import("./portrait-tags-c7OW_KzT.mjs").then((m) => m.default),
7652
- focus: () => import("./focus-DlptSJrZ.mjs").then((m) => m.default),
7653
- resistance: () => import("./resistance-CC4cxxUk.mjs").then((m) => m.default),
7654
- qa: () => import("./qa-DIZmvMwE.mjs").then((m) => m.default),
7655
- kb: () => import("./kb-CBj6tJE9.mjs").then((m) => m.default)
7639
+ config: () => import("./config-BjsUQ9I-.mjs").then((m) => m.default),
7640
+ project: () => import("./project-BuF0FYZp.mjs").then((m) => m.default),
7641
+ skill: () => import("./skill-_PLQOZgT.mjs").then((m) => m.default),
7642
+ consultant: () => import("./consultant-vVraua0_.mjs").then((m) => m.default),
7643
+ staff: () => import("./staff-ZUbldU8P.mjs").then((m) => m.default),
7644
+ "golden-sentence": () => import("./golden-sentence-DAM_YC7V.mjs").then((m) => m.default),
7645
+ panke: () => import("./panke-DY7IFcsN.mjs").then((m) => m.default),
7646
+ audio: () => import("./audio-DlgPatwd.mjs").then((m) => m.default),
7647
+ customer: () => import("./customer-CnAv26d0.mjs").then((m) => m.default),
7648
+ visit: () => import("./visit-DPkOV48n.mjs").then((m) => m.default),
7649
+ "beauty-plan": () => import("./beauty-plan-CmcNlyKk.mjs").then((m) => m.default),
7650
+ "beauty-plan-reminder": () => import("./beauty-plan-reminder-B7g7RRTs.mjs").then((m) => m.default),
7651
+ "deal-analysis": () => import("./deal-analysis-CX4IXbgk.mjs").then((m) => m.default),
7652
+ "portrait-tags": () => import("./portrait-tags-Dq0faG7k.mjs").then((m) => m.default),
7653
+ focus: () => import("./focus-Dx1rT6QE.mjs").then((m) => m.default),
7654
+ resistance: () => import("./resistance-CzNYvRYF.mjs").then((m) => m.default),
7655
+ qa: () => import("./qa-MQphVELO.mjs").then((m) => m.default),
7656
+ kb: () => import("./kb-CygBF0br.mjs").then((m) => m.default)
7656
7657
  }
7657
7658
  }));
7658
7659
  //#endregion
7659
- export { debugLogInfo as a, runPreflight as c, debugLogError as i, ensureAuth as l, writeError as n, debugLogPath as o, writeResult as r, isVerboseDebugEnabled as s, formatCliArg as t };
7660
+ export { debugLogInfo as a, runPreflight as c, buildSandboxProof as d, requireSandboxSecrets as f, debugLogError as i, ensureAuth as l, writeError as n, debugLogPath as o, requireTenantId as p, writeResult as r, isVerboseDebugEnabled as s, formatCliArg as t, WANGCLAW_AUTH_HEADER as u };
@@ -6,9 +6,9 @@ var config_default = defineCommand({
6
6
  description: "沙箱配置:list 只读诊断;doctor 自检;fields 客户字段字典"
7
7
  },
8
8
  subCommands: {
9
- list: () => import("./list-D7_yNqIG.mjs").then((m) => m.default),
10
- doctor: () => import("./doctor-DuGxP40X.mjs").then((m) => m.default),
11
- fields: () => import("./fields-F00auxKR.mjs").then((m) => m.default)
9
+ list: () => import("./list-6eMMquS2.mjs").then((m) => m.default),
10
+ doctor: () => import("./doctor-BuiUn2Zy.mjs").then((m) => m.default),
11
+ fields: () => import("./fields-DuAxLfSA.mjs").then((m) => m.default)
12
12
  }
13
13
  });
14
14
  //#endregion
@@ -5,7 +5,7 @@ var consultant_default = defineCommand({
5
5
  name: "consultant",
6
6
  description: "查询有权限的顾问列表"
7
7
  },
8
- subCommands: { list: () => import("./list-DPVEnWni.mjs").then((m) => m.default) }
8
+ subCommands: { list: () => import("./list-7ynSCgKJ.mjs").then((m) => m.default) }
9
9
  });
10
10
  //#endregion
11
11
  export { consultant_default as default };
@@ -1,6 +1,6 @@
1
1
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
2
- import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
3
- import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
2
+ import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
3
+ import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/commands/kb/doc/content.ts
6
6
  /**
@@ -1,4 +1,4 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError, r as writeResult, t as formatCliArg } from "./cli.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/commands/project/current.ts
@@ -5,7 +5,7 @@ var customer_default = defineCommand({
5
5
  name: "customer",
6
6
  description: "客户画像分页查询"
7
7
  },
8
- subCommands: { list: () => import("./list-BGjT1Ovk.mjs").then((m) => m.default) }
8
+ subCommands: { list: () => import("./list-Dttn4hHn.mjs").then((m) => m.default) }
9
9
  });
10
10
  //#endregion
11
11
  export { customer_default as default };
@@ -1,7 +1,7 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError } from "./cli.mjs";
3
- import { t as mcpCallPage } from "./mcp-result-De_0PPlD.mjs";
4
- import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-BsfU3CUz.mjs";
3
+ import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
4
+ import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-BVeYwlRt.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  //#region src/commands/deal-analysis/index.ts
7
7
  /**
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
4
- import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-DK3IGaO1.mjs";
5
- import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
3
+ import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
4
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
5
+ import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/panke/detail.ts
8
8
  function buildPankeDetailArgs(args, active) {
@@ -6,9 +6,9 @@ var doc_default = defineCommand({
6
6
  description: "知识库文档列表 / 元数据 / 全文"
7
7
  },
8
8
  subCommands: {
9
- list: () => import("./list-DMFhAeTT.mjs").then((m) => m.default),
10
- get: () => import("./get-BDXbs-_c.mjs").then((m) => m.default),
11
- content: () => import("./content-CfzyDYSy.mjs").then((m) => m.default)
9
+ list: () => import("./list-EcRLnxXY.mjs").then((m) => m.default),
10
+ get: () => import("./get-HrCcvm-j.mjs").then((m) => m.default),
11
+ content: () => import("./content-Ce7jKBol.mjs").then((m) => m.default)
12
12
  }
13
13
  });
14
14
  //#endregion
@@ -0,0 +1,212 @@
1
+ //#region src/core/config-errors.ts
2
+ /**
3
+ * Structured config errors for agent-facing hints.
4
+ */
5
+ var MissingGatewayError = class extends Error {
6
+ code = "MISSING_GATEWAY";
7
+ hint = "由 Host 设置 ENV=test(或 prod),CLI 将使用内置网关地址";
8
+ constructor() {
9
+ super("缺少 MCP 网关地址");
10
+ this.name = "MissingGatewayError";
11
+ }
12
+ };
13
+ var MissingAccessTokenError = class extends Error {
14
+ code = "MISSING_ACCESS_TOKEN";
15
+ hint = "向 /out/v2/mcp-token 借 AT 失败:确认沙箱已注入 SANDBOX_*_SECRET,且 PC/App 已完成 MCP 凭证初始化";
16
+ constructor() {
17
+ super("缺少 MCP access token");
18
+ this.name = "MissingAccessTokenError";
19
+ }
20
+ };
21
+ var AccessTokenExpiredError = class extends Error {
22
+ code = "ACCESS_TOKEN_EXPIRED";
23
+ hint = "重新调用 CLI(会向 Token Broker 借新 AT),或先在 PC/App 登录刷新凭证仓";
24
+ constructor() {
25
+ super("MCP access token 已过期");
26
+ this.name = "AccessTokenExpiredError";
27
+ }
28
+ };
29
+ var CurrentProjectFailedError = class extends Error {
30
+ code = "CURRENT_PROJECT_FAILED";
31
+ hint = "读写当前项目失败,请检查 TENANT_ID、USER_ID 与 /out/v2/current-project 服务是否可用";
32
+ status;
33
+ upstreamCode;
34
+ details;
35
+ constructor(message, options) {
36
+ super(message);
37
+ this.name = "CurrentProjectFailedError";
38
+ this.status = options?.status;
39
+ this.upstreamCode = options?.upstreamCode;
40
+ this.details = options?.details;
41
+ if (options?.hint) this.hint = options.hint;
42
+ }
43
+ };
44
+ var ConfigInvalidError = class extends Error {
45
+ code = "CONFIG_INVALID";
46
+ hint;
47
+ constructor(message, hint) {
48
+ super(message);
49
+ this.name = "ConfigInvalidError";
50
+ this.hint = hint;
51
+ }
52
+ };
53
+ //#endregion
54
+ //#region src/core/endpoints.ts
55
+ /** Fallback when Host has not injected ENV (local dev via env.sh only). */
56
+ const DEFAULT_ENV = "test";
57
+ /** ENV value → MCP gateway / auth / Host callback / Skill BFF base URLs. */
58
+ const PROFILES = {
59
+ test: {
60
+ gatewayUrl: "https://mcp.test.wangxiaobao.com",
61
+ authUrl: "https://mcp-auth.test.wangxiaobao.com",
62
+ callbackBaseUrl: "https://wangke.test.wangxiaobao.com",
63
+ skillBffUrl: "https://wangke.test.wangxiaobao.com/api/wc-skill"
64
+ },
65
+ prod: {
66
+ gatewayUrl: `https://mcp.wangxiaobao.com`,
67
+ authUrl: `https://mcp-auth.wangxiaobao.com`,
68
+ callbackBaseUrl: `https://wangke.wangxiaobao.com`,
69
+ skillBffUrl: "https://wangke.wangxiaobao.com/api/wc-skill"
70
+ }
71
+ };
72
+ function isProfileUrlConfigured(url) {
73
+ return url.startsWith("https://");
74
+ }
75
+ function parseEnvName(raw) {
76
+ if (raw === "test" || raw === "prod") return raw;
77
+ return null;
78
+ }
79
+ //#endregion
80
+ //#region src/core/config-store.ts
81
+ /**
82
+ * Shared config helpers (env-only mode; no file persistence).
83
+ */
84
+ /** Decode JWT exp (seconds) → ms; returns null if not a JWT or no exp. */
85
+ function jwtExpMs(token) {
86
+ const parts = token.split(".");
87
+ if (parts.length < 2) return null;
88
+ try {
89
+ const payload = JSON.parse(Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64url").toString("utf8"));
90
+ if (typeof payload.exp === "number") return payload.exp * 1e3;
91
+ } catch {}
92
+ return null;
93
+ }
94
+ //#endregion
95
+ //#region src/core/env-vars.ts
96
+ /**
97
+ * Environment-variable backed CLI state (sandbox single source of truth).
98
+ */
99
+ const ENV_KEYS = {
100
+ ESTATE_ID: "ESTATE_ID",
101
+ ESTATE_NAME: "ESTATE_NAME",
102
+ TENANT_ID: "TENANT_ID",
103
+ TENANT_NAME: "TENANT_NAME",
104
+ USER_ID: "USER_ID",
105
+ USER_NAME: "USER_NAME",
106
+ MCP_TOKEN: "MCP_TOKEN",
107
+ REFRESH_TOKEN: "REFRESH_TOKEN",
108
+ EXPIRES_TIMES: "EXPIRES_TIMES",
109
+ SESSION_ID: "SESSION_ID",
110
+ XB_APP_ID: "XB_APP_ID",
111
+ ENV: "ENV",
112
+ /** 沙箱只读:创建模板时注入,用于 Token Broker 等敏感请求 */
113
+ SANDBOX_TENANT_SECRET: "SANDBOX_TENANT_SECRET",
114
+ /** 沙箱只读:创建用户时注入 */
115
+ SANDBOX_USER_SECRET: "SANDBOX_USER_SECRET"
116
+ };
117
+ /** Refresh when remaining lifetime is below this threshold (ms). */
118
+ const REFRESH_BUFFER_MS = 12e4;
119
+ function readEnv(key) {
120
+ return process.env[key]?.trim() ?? "";
121
+ }
122
+ function syncProcessEnv(pairs) {
123
+ for (const [key, value] of Object.entries(pairs)) process.env[key] = value;
124
+ }
125
+ /**
126
+ * Resolve deployment env from Host-injected `ENV`.
127
+ * Missing ENV falls back to DEFAULT_ENV (local shell only); invalid values error out.
128
+ */
129
+ function resolveDeploymentEnv() {
130
+ const raw = readEnv(ENV_KEYS.ENV);
131
+ if (!raw) return DEFAULT_ENV;
132
+ const parsed = parseEnvName(raw);
133
+ if (!parsed) throw new ConfigInvalidError(`无效 ENV: ${raw}`, "由 Host 注入 ENV=test 或 ENV=prod");
134
+ return parsed;
135
+ }
136
+ /** Whether Host injected ENV (vs CLI local default). */
137
+ function isEnvInjectedByHost() {
138
+ return Boolean(readEnv(ENV_KEYS.ENV));
139
+ }
140
+ function resolveEndpoints() {
141
+ const env = resolveDeploymentEnv();
142
+ const profile = PROFILES[env];
143
+ const skillBffOverride = process.env.SKILL_BFF_URL?.trim();
144
+ return {
145
+ env,
146
+ gatewayUrl: profile.gatewayUrl,
147
+ authUrl: profile.authUrl,
148
+ callbackBaseUrl: profile.callbackBaseUrl,
149
+ skillBffUrl: skillBffOverride || profile.skillBffUrl
150
+ };
151
+ }
152
+ function assertEndpointsValid(endpoints) {
153
+ if (!isProfileUrlConfigured(endpoints.gatewayUrl)) throw new ConfigInvalidError(`环境 ${endpoints.env} 的网关 URL 尚未配置`, "由 Host 设置 ENV=test,或待 prod 域名就绪后设置 ENV=prod");
154
+ if (!isProfileUrlConfigured(endpoints.callbackBaseUrl)) throw new ConfigInvalidError(`环境 ${endpoints.env} 的回调 URL 尚未配置`, "由 Host 设置 ENV=test,或待 prod 域名就绪后设置 ENV=prod");
155
+ }
156
+ function requireUserId() {
157
+ const userId = readEnv(ENV_KEYS.USER_ID);
158
+ if (!userId) throw new ConfigInvalidError("缺少 USER_ID 环境变量", "由 QCA 在沙箱启动时注入 USER_ID");
159
+ return userId;
160
+ }
161
+ function readCredentials() {
162
+ const accessToken = readEnv(ENV_KEYS.MCP_TOKEN) || null;
163
+ const refreshToken = readEnv(ENV_KEYS.REFRESH_TOKEN) || null;
164
+ const expiresRaw = readEnv(ENV_KEYS.EXPIRES_TIMES);
165
+ let expiresAt = null;
166
+ if (expiresRaw) {
167
+ const parsed = Number(expiresRaw);
168
+ if (!Number.isNaN(parsed) && parsed > 0) expiresAt = parsed;
169
+ }
170
+ if (expiresAt == null && accessToken) expiresAt = jwtExpMs(accessToken);
171
+ return {
172
+ accessToken,
173
+ refreshToken,
174
+ expiresAt
175
+ };
176
+ }
177
+ function credentialStatus(creds) {
178
+ if (!creds.accessToken) return {
179
+ configured: false,
180
+ status: "missing",
181
+ expiresAt: null,
182
+ expiresInSec: null
183
+ };
184
+ return buildExpiryView(creds, computeExpiryStatus(creds.expiresAt));
185
+ }
186
+ function buildExpiryView(creds, status) {
187
+ const expiresAt = creds.expiresAt;
188
+ const expiresInSec = expiresAt != null ? Math.max(0, Math.floor((expiresAt - Date.now()) / 1e3)) : null;
189
+ return {
190
+ configured: true,
191
+ status,
192
+ expiresAt: expiresAt ?? null,
193
+ expiresInSec
194
+ };
195
+ }
196
+ function computeExpiryStatus(expiresAt) {
197
+ if (expiresAt == null) return "valid";
198
+ const remaining = expiresAt - Date.now();
199
+ if (remaining <= 0) return "expired";
200
+ if (remaining < 12e4) return "expiring";
201
+ return "valid";
202
+ }
203
+ function needsRefresh(expiresAt, force = false) {
204
+ if (force) return true;
205
+ if (expiresAt == null) return false;
206
+ return expiresAt - Date.now() < REFRESH_BUFFER_MS;
207
+ }
208
+ function isTokenExpired(expiresAt) {
209
+ return expiresAt != null && expiresAt <= Date.now();
210
+ }
211
+ //#endregion
212
+ export { isTokenExpired as a, readEnv as c, syncProcessEnv as d, AccessTokenExpiredError as f, MissingGatewayError as g, MissingAccessTokenError as h, isEnvInjectedByHost as i, requireUserId as l, CurrentProjectFailedError as m, assertEndpointsValid as n, needsRefresh as o, ConfigInvalidError as p, credentialStatus as r, readCredentials as s, ENV_KEYS as t, resolveEndpoints as u };
@@ -1,7 +1,7 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-DK3IGaO1.mjs";
4
- import { t as mcpCallPage } from "./mcp-result-De_0PPlD.mjs";
3
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
4
+ import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
5
5
  import { defineCommand } from "citty";
6
6
  //#region src/commands/config/fields.ts
7
7
  /**
@@ -5,7 +5,7 @@ var focus_default = defineCommand({
5
5
  name: "focus",
6
6
  description: "客户关注点标签分页查询"
7
7
  },
8
- subCommands: { list: () => import("./list-Boz4Dr1p.mjs").then((m) => m.default) }
8
+ subCommands: { list: () => import("./list-Cc0bsWKY.mjs").then((m) => m.default) }
9
9
  });
10
10
  //#endregion
11
11
  export { focus_default as default };
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
4
- import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-DK3IGaO1.mjs";
5
- import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
3
+ import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
4
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
5
+ import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/golden-sentence/get.ts
8
8
  function buildGoldenSentenceGetArgs(args, active) {
@@ -1,6 +1,6 @@
1
1
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
2
- import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
3
- import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
2
+ import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
3
+ import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/commands/kb/doc/get.ts
6
6
  /**
@@ -5,7 +5,7 @@ var golden_sentence_default = defineCommand({
5
5
  name: "golden-sentence",
6
6
  description: "小美金句查询"
7
7
  },
8
- subCommands: { get: () => import("./get-ByAQXto5.mjs").then((m) => m.default) }
8
+ subCommands: { get: () => import("./get-CCpn3m06.mjs").then((m) => m.default) }
9
9
  });
10
10
  //#endregion
11
11
  export { golden_sentence_default as default };
@@ -0,0 +1,50 @@
1
+ import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
2
+ import { n as writeError, r as writeResult, t as formatCliArg } from "./cli.mjs";
3
+ import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
4
+ import { i as skillInstallGrant, r as resolveSkillInstallDir, t as downloadSkillPackage } from "./skill-client-CLXEQ0Hv.mjs";
5
+ import { defineCommand } from "citty";
6
+ //#region src/commands/skill/install.ts
7
+ /**
8
+ * `beautx-cli skill install <id>` — download a Skill package by id.
9
+ */
10
+ var install_default = defineCommand({
11
+ meta: {
12
+ name: "install",
13
+ description: "按 Skill ID 下载安装包(默认使用当前激活项目做权限判定)"
14
+ },
15
+ args: {
16
+ id: {
17
+ type: "positional",
18
+ description: "Skill 数字 ID",
19
+ required: true
20
+ },
21
+ dir: {
22
+ type: "string",
23
+ description: `安装根目录(默认 ${resolveSkillInstallDir()},可由 SKILL_INSTALL_DIR 覆盖)`
24
+ },
25
+ ...projectIdCliArg,
26
+ format: formatCliArg
27
+ },
28
+ async run({ args }) {
29
+ try {
30
+ const active = await requireActiveProject();
31
+ const projectId = resolveProjectId(args["project-id"], active);
32
+ const grant = await skillInstallGrant(args.id, projectId);
33
+ const { skillDir, zipPath } = await downloadSkillPackage(grant, args.dir?.trim() || resolveSkillInstallDir());
34
+ writeResult({
35
+ skillId: grant.skillId,
36
+ name: grant.name,
37
+ version: grant.version,
38
+ checksum: grant.checksum,
39
+ skillDir,
40
+ zipPath,
41
+ projectId
42
+ }, args.format);
43
+ } catch (err) {
44
+ writeError(err, args.format);
45
+ process.exit(1);
46
+ }
47
+ }
48
+ });
49
+ //#endregion
50
+ export { install_default as default };
@@ -6,8 +6,8 @@ var kb_default = defineCommand({
6
6
  description: "知识库检索与文档查询"
7
7
  },
8
8
  subCommands: {
9
- search: () => import("./search-eIzMHyPL.mjs").then((m) => m.default),
10
- doc: () => import("./doc-_TnZLbtD.mjs").then((m) => m.default)
9
+ search: () => import("./search-CnFRGjnD.mjs").then((m) => m.default),
10
+ doc: () => import("./doc-DU2dYD57.mjs").then((m) => m.default)
11
11
  }
12
12
  });
13
13
  //#endregion