beautx-cli 1.0.9-beta.1 → 1.1.1-beta.2

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 +40 -26
  2. package/dist/{analyze-CtxR02Xr.mjs → analyze-Cq-Hmoqp.mjs} +5 -5
  3. package/dist/{api-BdaZkABF.mjs → api-jIGM86TK.mjs} +1 -1
  4. package/dist/{audio-DlgPatwd.mjs → audio-p2QCYFdq.mjs} +3 -3
  5. package/dist/beauty-plan-D9B8kaf-.mjs +51 -0
  6. package/dist/beauty-plan-reminder-D-gVCeWO.mjs +79 -0
  7. package/dist/capability-profile-DxrzExct.mjs +61 -0
  8. package/dist/cli.mjs +21 -19
  9. package/dist/{config-DICowNg_.mjs → config-V1amf6sh.mjs} +2 -2
  10. package/dist/{consultant-Det5PdFh.mjs → consultant-DZeIOYgS.mjs} +1 -1
  11. package/dist/{content-BOTX5RjP.mjs → content-CfzyDYSy.mjs} +2 -2
  12. package/dist/{current-aBOk-h5x.mjs → current-xqaZxhbN.mjs} +1 -1
  13. package/dist/{customer-Dr_mISml.mjs → customer-iWrGhESH.mjs} +1 -1
  14. package/dist/{deal-analysis-K0jAibrc.mjs → deal-analysis-Da8iNy64.mjs} +3 -3
  15. package/dist/detail-BnUTSlRa.mjs +44 -0
  16. package/dist/{doc-BuvQ5-m4.mjs → doc-_TnZLbtD.mjs} +3 -3
  17. package/dist/{fields-CiWGp1Uy.mjs → fields-F00auxKR.mjs} +3 -3
  18. package/dist/{focus-c7Sx7x3t.mjs → focus-DlptSJrZ.mjs} +1 -1
  19. package/dist/{get-ByeAOvme.mjs → get-BDXbs-_c.mjs} +2 -2
  20. package/dist/get-ByAQXto5.mjs +40 -0
  21. package/dist/golden-sentence-CwT4AyLu.mjs +11 -0
  22. package/dist/{kb-DsyLK84W.mjs → kb-CBj6tJE9.mjs} +2 -2
  23. package/dist/{list-CGDMjHuN.mjs → list-BGjT1Ovk.mjs} +14 -4
  24. package/dist/{list-Cq9rAt2i.mjs → list-Boz4Dr1p.mjs} +4 -4
  25. package/dist/{list-u0XN5Mv3.mjs → list-CB-bwmRO2.mjs} +4 -4
  26. package/dist/{list-DD5SDjF3.mjs → list-CQOLK3Xu.mjs} +4 -4
  27. package/dist/{list-D4gnORuG.mjs → list-CnsJlbrZ.mjs} +1 -1
  28. package/dist/{list-Bt87oTfo.mjs → list-Cnz5CuQB.mjs} +4 -4
  29. package/dist/{list-BPBUK6SR.mjs → list-D7_yNqIG.mjs} +1 -3
  30. package/dist/{list-CDhdZByU.mjs → list-DMFhAeTT.mjs} +4 -4
  31. package/dist/{list-BTsFZamG.mjs → list-DPVEnWni.mjs} +4 -4
  32. package/dist/{mcp-args-CG7OuBep.mjs → mcp-args-DK3IGaO1.mjs} +1 -1
  33. package/dist/{mcp-client-huLKHRT3.mjs → mcp-client-BTZH22b5.mjs} +3 -3
  34. package/dist/{mcp-result-BzDGJUdM.mjs → mcp-result-De_0PPlD.mjs} +1 -1
  35. package/dist/panke-DmzQyQHt.mjs +14 -0
  36. package/dist/{portrait-tags-DDfhu52n.mjs → portrait-tags-c7OW_KzT.mjs} +3 -3
  37. package/dist/{project-CFjWR38i.mjs → project-DeLeVoA3.mjs} +3 -3
  38. package/dist/project-access-Bf87OLJP.mjs +2 -0
  39. package/dist/{project-access-ChmJv4Z4.mjs → project-access-pTN7ry15.mjs} +2 -3
  40. package/dist/project-store-DDVZ7T4t.mjs +2 -0
  41. package/dist/{project-store-DUlIIW51.mjs → project-store-Dl35JzZr.mjs} +207 -2
  42. package/dist/{qa-BvSY8aGf.mjs → qa-DIZmvMwE.mjs} +5 -5
  43. package/dist/{resistance-BsDf3Ywa.mjs → resistance-CC4cxxUk.mjs} +1 -1
  44. package/dist/{search-Chnn4fM0.mjs → search-eIzMHyPL.mjs} +5 -5
  45. package/dist/staff-BVu2Hmu1.mjs +11 -0
  46. package/dist/{summary-BBOsN5T9.mjs → summary-CYLljvrY.mjs} +4 -4
  47. package/dist/task-Fa1R-6DI.mjs +40 -0
  48. package/dist/{text-CCxnry4V.mjs → text-BIIl7PmC.mjs} +4 -4
  49. package/dist/{use-DAcv-VQ0.mjs → use-DIjJeiXP.mjs} +2 -2
  50. package/dist/{visit-B70PkDSX.mjs → visit-D-HS1jjx.mjs} +2 -2
  51. package/dist/{visit-evaluate-CaO2KvPG.mjs → visit-evaluate-COKpVvhv.mjs} +3 -3
  52. package/dist/{visit-query-args-DW3qNnoL.mjs → visit-query-args-BsfU3CUz.mjs} +2 -2
  53. package/package.json +1 -1
  54. package/dist/beauty-plan-DNsCkUJY.mjs +0 -36
  55. package/dist/env-vars-osVxvm7z.mjs +0 -212
  56. package/dist/install-DQmxrW3j.mjs +0 -50
  57. package/dist/list-SIx70dm2.mjs +0 -77
  58. package/dist/project-access-D4b4oc5E.mjs +0 -2
  59. package/dist/project-store-DlbRmRAS.mjs +0 -2
  60. package/dist/skill-7jpFz8M3.mjs +0 -15
  61. package/dist/skill-client-DEbjlHcX.mjs +0 -146
  62. package/dist/upload-BSwTTmow.mjs +0 -76
  63. /package/dist/{util-BtgWHKWv.mjs → util-Bko-nm_R.mjs} +0 -0
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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
- import { i as toLocalDateTime } from "./util-BtgWHKWv.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";
5
+ import { i as toLocalDateTime, t as csvToArray } from "./util-Bko-nm_R.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/customer/list.ts
8
8
  /**
@@ -15,6 +15,14 @@ var list_default = defineCommand({
15
15
  },
16
16
  args: {
17
17
  ...projectIdCliArg,
18
+ "customer-id": {
19
+ type: "string",
20
+ description: "单个客户 wang_id(精确匹配)"
21
+ },
22
+ "customer-ids": {
23
+ type: "string",
24
+ description: "客户 wang_id 列表,CSV 精确匹配"
25
+ },
18
26
  "user-id": {
19
27
  type: "string",
20
28
  description: "顾问 userId"
@@ -58,6 +66,8 @@ var list_default = defineCommand({
58
66
  const active = await requireActiveProject();
59
67
  await mcpCallPage("customer-list", {
60
68
  project_id: resolveProjectId(args["project-id"], active),
69
+ customer_id: args["customer-id"],
70
+ customer_ids: csvToArray(args["customer-ids"]),
61
71
  user_id: args["user-id"],
62
72
  user_name: args["user-name"],
63
73
  customer_name: args["customer-name"],
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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
- import { i as toLocalDateTime, t as csvToArray } from "./util-BtgWHKWv.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";
5
+ import { i as toLocalDateTime, t as csvToArray } from "./util-Bko-nm_R.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/focus/list.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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
- import { i as toLocalDateTime, t as csvToArray } from "./util-BtgWHKWv.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";
5
+ import { i as toLocalDateTime, t as csvToArray } from "./util-Bko-nm_R.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/resistance/list.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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
- import { i as toLocalDateTime } from "./util-BtgWHKWv.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";
5
+ import { i as toLocalDateTime } from "./util-Bko-nm_R.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/visit/list.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
1
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
2
- import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
2
+ import { t as mcpCallPage } from "./mcp-result-De_0PPlD.mjs";
3
3
  import { defineCommand } from "citty";
4
4
  //#region src/commands/project/list.ts
5
5
  /**
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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
- import { i as toLocalDateTime, r as mergeUserIds, t as csvToArray } from "./util-BtgWHKWv.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";
5
+ import { i as toLocalDateTime, r as mergeUserIds, t as csvToArray } from "./util-Bko-nm_R.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/audio/list.ts
8
8
  /**
@@ -1,5 +1,4 @@
1
- import { c as readEnv, i as isEnvInjectedByHost, r as credentialStatus, s as readCredentials, t as ENV_KEYS, u as resolveEndpoints } from "./env-vars-osVxvm7z.mjs";
2
- import { a as isProjectSwitchAllowed, o as loadActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { _ as readEnv, a as isProjectSwitchAllowed, f as credentialStatus, g as readCredentials, o as loadActiveProject, p as isEnvInjectedByHost, u as ENV_KEYS, y as resolveEndpoints } from "./project-store-Dl35JzZr.mjs";
3
2
  import { n as writeError, o as debugLogPath, r as writeResult, s as isVerboseDebugEnabled, t as formatCliArg } from "./cli.mjs";
4
3
  import { defineCommand } from "citty";
5
4
  //#region src/core/mask-env.ts
@@ -40,7 +39,6 @@ var list_default = defineCommand({
40
39
  gatewayUrl: endpoints.gatewayUrl,
41
40
  authUrl: endpoints.authUrl,
42
41
  callbackBaseUrl: endpoints.callbackBaseUrl,
43
- skillBffUrl: endpoints.skillBffUrl,
44
42
  urlProfileSource: "src/core/endpoints.ts",
45
43
  configSource: "environment",
46
44
  credentialsManagedBy: "host",
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
4
- import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, t as projectIdCliArg } from "./mcp-args-CG7OuBep.mjs";
5
- import { n as writeMcpDataResult } from "./mcp-result-BzDGJUdM.mjs";
3
+ import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
4
+ import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, t as projectIdCliArg } from "./mcp-args-DK3IGaO1.mjs";
5
+ import { n as writeMcpDataResult } from "./mcp-result-De_0PPlD.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/kb/doc/list.ts
8
8
  /**
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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";
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
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/consultant/list.ts
8
8
  /**
@@ -1,4 +1,4 @@
1
- import { c as readEnv, t as ENV_KEYS } from "./env-vars-osVxvm7z.mjs";
1
+ import { _ as readEnv, u as ENV_KEYS } from "./project-store-Dl35JzZr.mjs";
2
2
  //#region src/core/mcp-args.ts
3
3
  /**
4
4
  * Shared MCP argument helpers — align CLI flags with BFF tool schemas.
@@ -1,5 +1,5 @@
1
1
  import { n as __exportAll } from "./rolldown-runtime-YLnNgb9a.mjs";
2
- import { c as readEnv, g as MissingGatewayError, h as MissingAccessTokenError, n as assertEndpointsValid, t as ENV_KEYS, u as resolveEndpoints } from "./env-vars-osVxvm7z.mjs";
2
+ import { C as MissingAccessTokenError, _ as readEnv, d as assertEndpointsValid, u as ENV_KEYS, w as MissingGatewayError, y as resolveEndpoints } from "./project-store-Dl35JzZr.mjs";
3
3
  import { a as debugLogInfo, i as debugLogError, l as ensureAuth } from "./cli.mjs";
4
4
  import { randomUUID } from "node:crypto";
5
5
  //#region src/core/config.ts
@@ -135,13 +135,13 @@ function buildMcpHttpHeaders(token) {
135
135
  return headers;
136
136
  }
137
137
  async function mcpCall(toolName, opts) {
138
- const { loadActiveProject } = await import("./project-store-DlbRmRAS.mjs");
138
+ const { loadActiveProject } = await import("./project-store-DDVZ7T4t.mjs");
139
139
  const active = await loadActiveProject();
140
140
  const wireArguments = augmentMcpWireArguments(toolName, opts.arguments ?? {}, active?.projectId);
141
141
  if (toolName !== "project-list") {
142
142
  const rawProjectId = wireArguments.project_id;
143
143
  if (rawProjectId != null && String(rawProjectId).trim()) {
144
- const { assertProjectAllowed } = await import("./project-access-D4b4oc5E.mjs");
144
+ const { assertProjectAllowed } = await import("./project-access-Bf87OLJP.mjs");
145
145
  await assertProjectAllowed(String(rawProjectId).trim());
146
146
  }
147
147
  }
@@ -1,5 +1,5 @@
1
1
  import { n as writeError, r as writeResult } from "./cli.mjs";
2
- import { i as unwrapMcpToolEnvelope, n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
2
+ import { i as unwrapMcpToolEnvelope, n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
3
3
  //#region src/core/mcp-result.ts
4
4
  /**
5
5
  * Normalize MCP tool responses for agent-friendly stdout (TOON tabular arrays).
@@ -0,0 +1,14 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/panke/index.ts
3
+ var panke_default = defineCommand({
4
+ meta: {
5
+ name: "panke",
6
+ description: "盘客只读查询"
7
+ },
8
+ subCommands: {
9
+ detail: () => import("./detail-BnUTSlRa.mjs").then((m) => m.default),
10
+ task: () => import("./task-Fa1R-6DI.mjs").then((m) => m.default)
11
+ }
12
+ });
13
+ //#endregion
14
+ export { panke_default as default };
@@ -1,7 +1,7 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError } from "./cli.mjs";
3
- import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
4
- import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-DW3qNnoL.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";
5
5
  import { defineCommand } from "citty";
6
6
  //#region src/commands/portrait-tags/index.ts
7
7
  /**
@@ -6,9 +6,9 @@ var project_default = defineCommand({
6
6
  description: "查询 / 切换激活项目"
7
7
  },
8
8
  subCommands: {
9
- list: () => import("./list-D4gnORuG.mjs").then((m) => m.default),
10
- use: () => import("./use-DAcv-VQ0.mjs").then((m) => m.default),
11
- current: () => import("./current-aBOk-h5x.mjs").then((m) => m.default)
9
+ list: () => import("./list-CnsJlbrZ.mjs").then((m) => m.default),
10
+ use: () => import("./use-DIjJeiXP.mjs").then((m) => m.default),
11
+ current: () => import("./current-xqaZxhbN.mjs").then((m) => m.default)
12
12
  }
13
13
  });
14
14
  //#endregion
@@ -0,0 +1,2 @@
1
+ import { r as assertProjectAllowed } from "./project-access-pTN7ry15.mjs";
2
+ export { assertProjectAllowed };
@@ -1,5 +1,4 @@
1
- import { c as readEnv, l as requireUserId, p as ConfigInvalidError, t as ENV_KEYS, u as resolveEndpoints } from "./env-vars-osVxvm7z.mjs";
2
- import { o as loadActiveProject, s as peekCachedActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { S as ConfigInvalidError, _ as readEnv, o as loadActiveProject, s as peekCachedActiveProject, u as ENV_KEYS, v as requireUserId, y as resolveEndpoints } from "./project-store-Dl35JzZr.mjs";
3
2
  var InsufficientCreditError = class extends Error {
4
3
  code = "INSUFFICIENT_CREDIT";
5
4
  hint = "(该项目下)用户积分余额不足,无法继续查询;请告知用户联系管理员充值";
@@ -228,7 +227,7 @@ function normalizeProjectListPage(page) {
228
227
  };
229
228
  }
230
229
  async function fetchProjectListPage(page, size) {
231
- const { mcpCall, unwrapMcpToolEnvelope } = await import("./mcp-client-huLKHRT3.mjs").then((n) => n.r);
230
+ const { mcpCall, unwrapMcpToolEnvelope } = await import("./mcp-client-BTZH22b5.mjs").then((n) => n.r);
232
231
  const result = await mcpCall("project-list", { arguments: {
233
232
  page,
234
233
  size
@@ -0,0 +1,2 @@
1
+ import { o as loadActiveProject } from "./project-store-Dl35JzZr.mjs";
2
+ export { loadActiveProject };
@@ -1,4 +1,209 @@
1
- import { c as readEnv, l as requireUserId, m as CurrentProjectFailedError, t as ENV_KEYS, u as resolveEndpoints } from "./env-vars-osVxvm7z.mjs";
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 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
+ },
64
+ prod: {
65
+ gatewayUrl: `https://mcp.wangxiaobao.com`,
66
+ authUrl: `https://mcp-auth.wangxiaobao.com`,
67
+ callbackBaseUrl: `https://wangke.wangxiaobao.com`
68
+ }
69
+ };
70
+ function isProfileUrlConfigured(url) {
71
+ return url.startsWith("https://");
72
+ }
73
+ function parseEnvName(raw) {
74
+ if (raw === "test" || raw === "prod") return raw;
75
+ return null;
76
+ }
77
+ //#endregion
78
+ //#region src/core/config-store.ts
79
+ /**
80
+ * Shared config helpers (env-only mode; no file persistence).
81
+ */
82
+ /** Decode JWT exp (seconds) → ms; returns null if not a JWT or no exp. */
83
+ function jwtExpMs(token) {
84
+ const parts = token.split(".");
85
+ if (parts.length < 2) return null;
86
+ try {
87
+ const payload = JSON.parse(Buffer.from(parts[1].replace(/-/g, "+").replace(/_/g, "/"), "base64url").toString("utf8"));
88
+ if (typeof payload.exp === "number") return payload.exp * 1e3;
89
+ } catch {}
90
+ return null;
91
+ }
92
+ //#endregion
93
+ //#region src/core/env-vars.ts
94
+ /**
95
+ * Environment-variable backed CLI state (sandbox single source of truth).
96
+ */
97
+ const ENV_KEYS = {
98
+ ESTATE_ID: "ESTATE_ID",
99
+ ESTATE_NAME: "ESTATE_NAME",
100
+ TENANT_ID: "TENANT_ID",
101
+ TENANT_NAME: "TENANT_NAME",
102
+ USER_ID: "USER_ID",
103
+ USER_NAME: "USER_NAME",
104
+ MCP_TOKEN: "MCP_TOKEN",
105
+ REFRESH_TOKEN: "REFRESH_TOKEN",
106
+ EXPIRES_TIMES: "EXPIRES_TIMES",
107
+ SESSION_ID: "SESSION_ID",
108
+ XB_APP_ID: "XB_APP_ID",
109
+ ENV: "ENV",
110
+ /** 沙箱只读:创建模板时注入,用于 Token Broker 等敏感请求 */
111
+ SANDBOX_TENANT_SECRET: "SANDBOX_TENANT_SECRET",
112
+ /** 沙箱只读:创建用户时注入 */
113
+ SANDBOX_USER_SECRET: "SANDBOX_USER_SECRET"
114
+ };
115
+ /** Refresh when remaining lifetime is below this threshold (ms). */
116
+ const REFRESH_BUFFER_MS = 12e4;
117
+ function readEnv(key) {
118
+ return process.env[key]?.trim() ?? "";
119
+ }
120
+ function syncProcessEnv(pairs) {
121
+ for (const [key, value] of Object.entries(pairs)) process.env[key] = value;
122
+ }
123
+ /**
124
+ * Resolve deployment env from Host-injected `ENV`.
125
+ * Missing ENV falls back to DEFAULT_ENV (local shell only); invalid values error out.
126
+ */
127
+ function resolveDeploymentEnv() {
128
+ const raw = readEnv(ENV_KEYS.ENV);
129
+ if (!raw) return DEFAULT_ENV;
130
+ const parsed = parseEnvName(raw);
131
+ if (!parsed) throw new ConfigInvalidError(`无效 ENV: ${raw}`, "由 Host 注入 ENV=test 或 ENV=prod");
132
+ return parsed;
133
+ }
134
+ /** Whether Host injected ENV (vs CLI local default). */
135
+ function isEnvInjectedByHost() {
136
+ return Boolean(readEnv(ENV_KEYS.ENV));
137
+ }
138
+ function resolveEndpoints() {
139
+ const env = resolveDeploymentEnv();
140
+ const profile = PROFILES[env];
141
+ return {
142
+ env,
143
+ gatewayUrl: profile.gatewayUrl,
144
+ authUrl: profile.authUrl,
145
+ callbackBaseUrl: profile.callbackBaseUrl
146
+ };
147
+ }
148
+ function assertEndpointsValid(endpoints) {
149
+ if (!isProfileUrlConfigured(endpoints.gatewayUrl)) throw new ConfigInvalidError(`环境 ${endpoints.env} 的网关 URL 尚未配置`, "由 Host 设置 ENV=test,或待 prod 域名就绪后设置 ENV=prod");
150
+ if (!isProfileUrlConfigured(endpoints.callbackBaseUrl)) throw new ConfigInvalidError(`环境 ${endpoints.env} 的回调 URL 尚未配置`, "由 Host 设置 ENV=test,或待 prod 域名就绪后设置 ENV=prod");
151
+ }
152
+ function requireUserId() {
153
+ const userId = readEnv(ENV_KEYS.USER_ID);
154
+ if (!userId) throw new ConfigInvalidError("缺少 USER_ID 环境变量", "由 QCA 在沙箱启动时注入 USER_ID");
155
+ return userId;
156
+ }
157
+ function readCredentials() {
158
+ const accessToken = readEnv(ENV_KEYS.MCP_TOKEN) || null;
159
+ const refreshToken = readEnv(ENV_KEYS.REFRESH_TOKEN) || null;
160
+ const expiresRaw = readEnv(ENV_KEYS.EXPIRES_TIMES);
161
+ let expiresAt = null;
162
+ if (expiresRaw) {
163
+ const parsed = Number(expiresRaw);
164
+ if (!Number.isNaN(parsed) && parsed > 0) expiresAt = parsed;
165
+ }
166
+ if (expiresAt == null && accessToken) expiresAt = jwtExpMs(accessToken);
167
+ return {
168
+ accessToken,
169
+ refreshToken,
170
+ expiresAt
171
+ };
172
+ }
173
+ function credentialStatus(creds) {
174
+ if (!creds.accessToken) return {
175
+ configured: false,
176
+ status: "missing",
177
+ expiresAt: null,
178
+ expiresInSec: null
179
+ };
180
+ return buildExpiryView(creds, computeExpiryStatus(creds.expiresAt));
181
+ }
182
+ function buildExpiryView(creds, status) {
183
+ const expiresAt = creds.expiresAt;
184
+ const expiresInSec = expiresAt != null ? Math.max(0, Math.floor((expiresAt - Date.now()) / 1e3)) : null;
185
+ return {
186
+ configured: true,
187
+ status,
188
+ expiresAt: expiresAt ?? null,
189
+ expiresInSec
190
+ };
191
+ }
192
+ function computeExpiryStatus(expiresAt) {
193
+ if (expiresAt == null) return "valid";
194
+ const remaining = expiresAt - Date.now();
195
+ if (remaining <= 0) return "expired";
196
+ if (remaining < 12e4) return "expiring";
197
+ return "valid";
198
+ }
199
+ function needsRefresh(expiresAt, force = false) {
200
+ if (force) return true;
201
+ if (expiresAt == null) return false;
202
+ return expiresAt - Date.now() < REFRESH_BUFFER_MS;
203
+ }
204
+ function isTokenExpired(expiresAt) {
205
+ return expiresAt != null && expiresAt <= Date.now();
206
+ }
2
207
  function requireTenantId() {
3
208
  const tenantId = readEnv(ENV_KEYS.TENANT_ID);
4
209
  if (!tenantId) throw new CurrentProjectFailedError("缺少 TENANT_ID 环境变量", { hint: "由 QCA 在沙箱启动时注入 TENANT_ID" });
@@ -216,4 +421,4 @@ function toActiveProject(remote) {
216
421
  };
217
422
  }
218
423
  //#endregion
219
- export { isProjectSwitchAllowed as a, requireActiveProject as c, invalidateActiveProjectCache as i, switchActiveProjectViaCallback as l, ProjectSwitchNotAllowedError as n, loadActiveProject as o, assertProjectSwitchAllowed as r, peekCachedActiveProject as s, NoActiveProjectError as t };
424
+ export { MissingAccessTokenError as C, ConfigInvalidError as S, readEnv as _, isProjectSwitchAllowed as a, syncProcessEnv as b, requireActiveProject as c, assertEndpointsValid as d, credentialStatus as f, readCredentials as g, needsRefresh as h, invalidateActiveProjectCache as i, switchActiveProjectViaCallback as l, isTokenExpired as m, ProjectSwitchNotAllowedError as n, loadActiveProject as o, isEnvInjectedByHost as p, assertProjectSwitchAllowed as r, peekCachedActiveProject as s, NoActiveProjectError as t, ENV_KEYS as u, requireUserId as v, MissingGatewayError as w, AccessTokenExpiredError as x, resolveEndpoints as y };
@@ -1,9 +1,9 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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";
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";
7
7
  import { defineCommand } from "citty";
8
8
  //#region src/commands/qa.ts
9
9
  /**
@@ -5,7 +5,7 @@ var resistance_default = defineCommand({
5
5
  name: "resistance",
6
6
  description: "客户抗性点标签分页查询"
7
7
  },
8
- subCommands: { list: () => import("./list-u0XN5Mv3.mjs").then((m) => m.default) }
8
+ subCommands: { list: () => import("./list-CB-bwmRO2.mjs").then((m) => m.default) }
9
9
  });
10
10
  //#endregion
11
11
  export { resistance_default as default };
@@ -1,9 +1,9 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.mjs";
3
- import { n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
4
- import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, 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";
3
+ import { n as mcpCall } from "./mcp-client-BTZH22b5.mjs";
4
+ import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, 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";
7
7
  import { defineCommand } from "citty";
8
8
  //#region src/commands/kb/search.ts
9
9
  /**
@@ -0,0 +1,11 @@
1
+ import { defineCommand } from "citty";
2
+ //#region src/commands/staff/index.ts
3
+ var staff_default = defineCommand({
4
+ meta: {
5
+ name: "staff",
6
+ description: "员工能力查询"
7
+ },
8
+ subCommands: { "capability-profile": () => import("./capability-profile-DxrzExct.mjs").then((m) => m.default) }
9
+ });
10
+ //#endregion
11
+ export { staff_default as default };
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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
- import { i as toLocalDateTime } from "./util-BtgWHKWv.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";
5
+ import { i as toLocalDateTime } from "./util-Bko-nm_R.mjs";
6
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/visit/summary.ts
8
8
  /**
@@ -0,0 +1,40 @@
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
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 { defineCommand } from "citty";
7
+ //#region src/commands/panke/task.ts
8
+ function buildPankeTaskArgs(args, active) {
9
+ const pankeTaskId = String(args["panke-task-id"] || "").trim();
10
+ if (!/^[1-9]\d*$/.test(pankeTaskId)) throw new Error("--panke-task-id must be a positive task ID");
11
+ return {
12
+ project_id: resolveProjectId(args["project-id"], active),
13
+ panke_task_id: pankeTaskId
14
+ };
15
+ }
16
+ var task_default = defineCommand({
17
+ meta: {
18
+ name: "task",
19
+ description: "按小美盘客任务 ID 查询任务详情"
20
+ },
21
+ args: {
22
+ ...projectIdCliArg,
23
+ "panke-task-id": {
24
+ type: "string",
25
+ required: true,
26
+ description: "小美待盘客页面 taskId"
27
+ },
28
+ format: formatCliArg
29
+ },
30
+ async run({ args }) {
31
+ try {
32
+ writeMcpDataResult(await mcpCall("panke-task-get", { arguments: buildPankeTaskArgs(args, await requireActiveProject()) }), args.format);
33
+ } catch (err) {
34
+ writeError(err, args.format);
35
+ process.exit(1);
36
+ }
37
+ }
38
+ });
39
+ //#endregion
40
+ export { task_default as default };
@@ -1,8 +1,8 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError, t as formatCliArg } from "./cli.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";
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
6
  import { defineCommand } from "citty";
7
7
  //#region src/commands/audio/text.ts
8
8
  /**
@@ -1,5 +1,5 @@
1
- import { a as resolveProjectForUse, i as invalidateProjectAccessCache } from "./project-access-ChmJv4Z4.mjs";
2
- import { i as invalidateActiveProjectCache, l as switchActiveProjectViaCallback, r as assertProjectSwitchAllowed } from "./project-store-DUlIIW51.mjs";
1
+ import { i as invalidateActiveProjectCache, l as switchActiveProjectViaCallback, r as assertProjectSwitchAllowed } from "./project-store-Dl35JzZr.mjs";
2
+ import { a as resolveProjectForUse, i as invalidateProjectAccessCache } from "./project-access-pTN7ry15.mjs";
3
3
  import { n as writeError, r as writeResult, t as formatCliArg } from "./cli.mjs";
4
4
  import { defineCommand } from "citty";
5
5
  //#region src/commands/project/use.ts
@@ -6,8 +6,8 @@ var visit_default = defineCommand({
6
6
  description: "客户来访查询"
7
7
  },
8
8
  subCommands: {
9
- list: () => import("./list-DD5SDjF3.mjs").then((m) => m.default),
10
- summary: () => import("./summary-BBOsN5T9.mjs").then((m) => m.default)
9
+ list: () => import("./list-CQOLK3Xu.mjs").then((m) => m.default),
10
+ summary: () => import("./summary-CYLljvrY.mjs").then((m) => m.default)
11
11
  }
12
12
  });
13
13
  //#endregion
@@ -1,7 +1,7 @@
1
- import { c as requireActiveProject } from "./project-store-DUlIIW51.mjs";
1
+ import { c as requireActiveProject } from "./project-store-Dl35JzZr.mjs";
2
2
  import { n as writeError } from "./cli.mjs";
3
- import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
4
- import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-DW3qNnoL.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";
5
5
  import { defineCommand } from "citty";
6
6
  //#region src/commands/visit-evaluate/index.ts
7
7
  /**