beautx-cli 1.1.1-beta.2 → 1.1.1
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.
- package/README.md +26 -4
- package/dist/{analyze-Cq-Hmoqp.mjs → analyze-CtxR02Xr.mjs} +5 -5
- package/dist/{api-jIGM86TK.mjs → api-BdaZkABF.mjs} +1 -1
- package/dist/{audio-p2QCYFdq.mjs → audio-DlgPatwd.mjs} +3 -3
- package/dist/{beauty-plan-D9B8kaf-.mjs → beauty-plan-CmcNlyKk.mjs} +4 -4
- package/dist/{beauty-plan-reminder-D-gVCeWO.mjs → beauty-plan-reminder-B7g7RRTs.mjs} +2 -2
- package/dist/{capability-profile-DxrzExct.mjs → capability-profile-yPTx4Mn4.mjs} +5 -5
- package/dist/cli.mjs +22 -21
- package/dist/{config-V1amf6sh.mjs → config-BjsUQ9I-.mjs} +3 -3
- package/dist/{consultant-DZeIOYgS.mjs → consultant-vVraua0_.mjs} +1 -1
- package/dist/{content-CfzyDYSy.mjs → content-Ce7jKBol.mjs} +2 -2
- package/dist/{current-xqaZxhbN.mjs → current-fzCrzKjn.mjs} +1 -1
- package/dist/{customer-iWrGhESH.mjs → customer-CnAv26d0.mjs} +1 -1
- package/dist/{deal-analysis-Da8iNy64.mjs → deal-analysis-CX4IXbgk.mjs} +3 -3
- package/dist/{detail-BnUTSlRa.mjs → detail-ZG7WTexq.mjs} +4 -4
- package/dist/{doc-_TnZLbtD.mjs → doc-DU2dYD57.mjs} +3 -3
- package/dist/env-vars-osVxvm7z.mjs +212 -0
- package/dist/{fields-F00auxKR.mjs → fields-DuAxLfSA.mjs} +3 -3
- package/dist/{focus-DlptSJrZ.mjs → focus-Dx1rT6QE.mjs} +1 -1
- package/dist/{get-ByAQXto5.mjs → get-CCpn3m06.mjs} +4 -4
- package/dist/{get-BDXbs-_c.mjs → get-HrCcvm-j.mjs} +2 -2
- package/dist/{golden-sentence-CwT4AyLu.mjs → golden-sentence-DAM_YC7V.mjs} +1 -1
- package/dist/install-B9_5ceYu.mjs +50 -0
- package/dist/{kb-CBj6tJE9.mjs → kb-CygBF0br.mjs} +2 -2
- package/dist/{list-D7_yNqIG.mjs → list-6eMMquS2.mjs} +3 -1
- package/dist/{list-DPVEnWni.mjs → list-7ynSCgKJ.mjs} +4 -4
- package/dist/{list-Cnz5CuQB.mjs → list-Bt87oTfo.mjs} +4 -4
- package/dist/{list-Boz4Dr1p.mjs → list-Cc0bsWKY.mjs} +4 -4
- package/dist/{list-CB-bwmRO2.mjs → list-DKbbBiI62.mjs} +4 -4
- package/dist/{list-BGjT1Ovk.mjs → list-Dttn4hHn.mjs} +4 -4
- package/dist/list-DyAO08z92.mjs +77 -0
- package/dist/{list-DMFhAeTT.mjs → list-EcRLnxXY.mjs} +4 -4
- package/dist/{list-CQOLK3Xu.mjs → list-e0tVlYwh.mjs} +4 -4
- package/dist/{list-CnsJlbrZ.mjs → list-xjVc-39m.mjs} +1 -1
- package/dist/{mcp-args-DK3IGaO1.mjs → mcp-args-CG7OuBep.mjs} +1 -1
- package/dist/{mcp-client-BTZH22b5.mjs → mcp-client-huLKHRT3.mjs} +3 -3
- package/dist/{mcp-result-De_0PPlD.mjs → mcp-result-BzDGJUdM.mjs} +1 -1
- package/dist/{panke-DmzQyQHt.mjs → panke-DY7IFcsN.mjs} +2 -2
- package/dist/{portrait-tags-c7OW_KzT.mjs → portrait-tags-Dq0faG7k.mjs} +3 -3
- package/dist/{project-DeLeVoA3.mjs → project-BuF0FYZp.mjs} +3 -3
- package/dist/{project-access-pTN7ry15.mjs → project-access-ChmJv4Z4.mjs} +3 -2
- package/dist/project-access-D4b4oc5E.mjs +2 -0
- package/dist/{project-store-Dl35JzZr.mjs → project-store-DUlIIW51.mjs} +2 -207
- package/dist/project-store-DlbRmRAS.mjs +2 -0
- package/dist/{qa-DIZmvMwE.mjs → qa-MQphVELO.mjs} +5 -5
- package/dist/{resistance-CC4cxxUk.mjs → resistance-CzNYvRYF.mjs} +1 -1
- package/dist/{search-eIzMHyPL.mjs → search-CnFRGjnD.mjs} +5 -5
- package/dist/skill-_PLQOZgT.mjs +15 -0
- package/dist/skill-client-CLXEQ0Hv.mjs +146 -0
- package/dist/{staff-BVu2Hmu1.mjs → staff-ZUbldU8P.mjs} +1 -1
- package/dist/{summary-CYLljvrY.mjs → summary-B12uZDGr.mjs} +4 -4
- package/dist/{task-Fa1R-6DI.mjs → task-CAobpQXt.mjs} +4 -4
- package/dist/{text-BIIl7PmC.mjs → text-CCxnry4V.mjs} +4 -4
- package/dist/upload-COReB487.mjs +76 -0
- package/dist/{use-DIjJeiXP.mjs → use-e7Wzfw1k.mjs} +2 -2
- package/dist/{visit-D-HS1jjx.mjs → visit-DPkOV48n.mjs} +2 -2
- package/dist/{visit-query-args-BsfU3CUz.mjs → visit-query-args-BVeYwlRt.mjs} +2 -2
- package/package.json +1 -1
- package/dist/project-access-Bf87OLJP.mjs +0 -2
- package/dist/project-store-DDVZ7T4t.mjs +0 -2
- package/dist/visit-evaluate-COKpVvhv.mjs +0 -30
- /package/dist/{doctor-DuGxP40X.mjs → doctor-BuiUn2Zy.mjs} +0 -0
- /package/dist/{util-Bko-nm_R.mjs → util-BtgWHKWv.mjs} +0 -0
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
2
3
|
import { n as writeError, o as debugLogPath, r as writeResult, s as isVerboseDebugEnabled, t as formatCliArg } from "./cli.mjs";
|
|
3
4
|
import { defineCommand } from "citty";
|
|
4
5
|
//#region src/core/mask-env.ts
|
|
@@ -39,6 +40,7 @@ var list_default = defineCommand({
|
|
|
39
40
|
gatewayUrl: endpoints.gatewayUrl,
|
|
40
41
|
authUrl: endpoints.authUrl,
|
|
41
42
|
callbackBaseUrl: endpoints.callbackBaseUrl,
|
|
43
|
+
skillBffUrl: endpoints.skillBffUrl,
|
|
42
44
|
urlProfileSource: "src/core/endpoints.ts",
|
|
43
45
|
configSource: "environment",
|
|
44
46
|
credentialsManagedBy: "host",
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as requireActiveProject } from "./project-store-
|
|
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-
|
|
4
|
-
import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-
|
|
5
|
-
import { n as writeMcpDataResult } from "./mcp-result-
|
|
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/consultant/list.ts
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as requireActiveProject } from "./project-store-
|
|
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-
|
|
4
|
-
import { t as mcpCallPage } from "./mcp-result-
|
|
5
|
-
import { i as toLocalDateTime, r as mergeUserIds, t as csvToArray } from "./util-
|
|
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";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
//#region src/commands/audio/list.ts
|
|
8
8
|
/**
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as requireActiveProject } from "./project-store-
|
|
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-
|
|
4
|
-
import { t as mcpCallPage } from "./mcp-result-
|
|
5
|
-
import { i as toLocalDateTime, t as csvToArray } from "./util-
|
|
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";
|
|
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-
|
|
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-
|
|
4
|
-
import { t as mcpCallPage } from "./mcp-result-
|
|
5
|
-
import { i as toLocalDateTime, t as csvToArray } from "./util-
|
|
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";
|
|
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-
|
|
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-
|
|
4
|
-
import { t as mcpCallPage } from "./mcp-result-
|
|
5
|
-
import { i as toLocalDateTime, t as csvToArray } from "./util-
|
|
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";
|
|
6
6
|
import { defineCommand } from "citty";
|
|
7
7
|
//#region src/commands/customer/list.ts
|
|
8
8
|
/**
|
|
@@ -0,0 +1,77 @@
|
|
|
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 { a as skillList } from "./skill-client-CLXEQ0Hv.mjs";
|
|
5
|
+
import { defineCommand } from "citty";
|
|
6
|
+
//#region src/commands/skill/list.ts
|
|
7
|
+
/**
|
|
8
|
+
* `beautx-cli skill list` — list the Skill BFF catalog.
|
|
9
|
+
*/
|
|
10
|
+
function groupByOwnerType(items) {
|
|
11
|
+
return {
|
|
12
|
+
personal: items.filter((item) => item.ownerType === "personal"),
|
|
13
|
+
tenant: items.filter((item) => item.ownerType === "tenant"),
|
|
14
|
+
project: items.filter((item) => item.ownerType === "project"),
|
|
15
|
+
other: items.filter((item) => item.ownerType !== "personal" && item.ownerType !== "tenant" && item.ownerType !== "project")
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
var list_default = defineCommand({
|
|
19
|
+
meta: {
|
|
20
|
+
name: "list",
|
|
21
|
+
description: "列出可见 Skill(按归属分组;默认使用当前激活项目过滤)"
|
|
22
|
+
},
|
|
23
|
+
args: {
|
|
24
|
+
type: {
|
|
25
|
+
type: "string",
|
|
26
|
+
description: "personal | tenant | project;省略时按三种归属分组输出"
|
|
27
|
+
},
|
|
28
|
+
...projectIdCliArg,
|
|
29
|
+
format: formatCliArg
|
|
30
|
+
},
|
|
31
|
+
async run({ args }) {
|
|
32
|
+
try {
|
|
33
|
+
const rawType = args.type?.trim().toLowerCase();
|
|
34
|
+
let type;
|
|
35
|
+
if (rawType === "personal" || rawType === "tenant" || rawType === "project") type = rawType;
|
|
36
|
+
else if (rawType) throw new Error("type 仅支持 personal | tenant | project");
|
|
37
|
+
const active = await requireActiveProject();
|
|
38
|
+
const projectId = resolveProjectId(args["project-id"], active);
|
|
39
|
+
const items = await skillList(type, projectId);
|
|
40
|
+
if (type) {
|
|
41
|
+
writeResult({
|
|
42
|
+
items,
|
|
43
|
+
total: items.length,
|
|
44
|
+
type,
|
|
45
|
+
projectId
|
|
46
|
+
}, args.format);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const grouped = groupByOwnerType(items);
|
|
50
|
+
writeResult({
|
|
51
|
+
projectId,
|
|
52
|
+
personal: {
|
|
53
|
+
items: grouped.personal,
|
|
54
|
+
total: grouped.personal.length
|
|
55
|
+
},
|
|
56
|
+
tenant: {
|
|
57
|
+
items: grouped.tenant,
|
|
58
|
+
total: grouped.tenant.length
|
|
59
|
+
},
|
|
60
|
+
project: {
|
|
61
|
+
items: grouped.project,
|
|
62
|
+
total: grouped.project.length
|
|
63
|
+
},
|
|
64
|
+
...grouped.other.length ? { other: {
|
|
65
|
+
items: grouped.other,
|
|
66
|
+
total: grouped.other.length
|
|
67
|
+
} } : {},
|
|
68
|
+
total: items.length
|
|
69
|
+
}, args.format);
|
|
70
|
+
} catch (err) {
|
|
71
|
+
writeError(err, args.format);
|
|
72
|
+
process.exit(1);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
//#endregion
|
|
77
|
+
export { list_default as default };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as requireActiveProject } from "./project-store-
|
|
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-
|
|
4
|
-
import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, t as projectIdCliArg } from "./mcp-args-
|
|
5
|
-
import { n as writeMcpDataResult } from "./mcp-result-
|
|
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
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-
|
|
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-
|
|
4
|
-
import { t as mcpCallPage } from "./mcp-result-
|
|
5
|
-
import { i as toLocalDateTime } from "./util-
|
|
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";
|
|
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-
|
|
2
|
+
import { t as mcpCallPage } from "./mcp-result-BzDGJUdM.mjs";
|
|
3
3
|
import { defineCommand } from "citty";
|
|
4
4
|
//#region src/commands/project/list.ts
|
|
5
5
|
/**
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { n as __exportAll } from "./rolldown-runtime-YLnNgb9a.mjs";
|
|
2
|
-
import {
|
|
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";
|
|
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-
|
|
138
|
+
const { loadActiveProject } = await import("./project-store-DlbRmRAS.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-
|
|
144
|
+
const { assertProjectAllowed } = await import("./project-access-D4b4oc5E.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-
|
|
2
|
+
import { i as unwrapMcpToolEnvelope, n as mcpCall } from "./mcp-client-huLKHRT3.mjs";
|
|
3
3
|
//#region src/core/mcp-result.ts
|
|
4
4
|
/**
|
|
5
5
|
* Normalize MCP tool responses for agent-friendly stdout (TOON tabular arrays).
|
|
@@ -6,8 +6,8 @@ var panke_default = defineCommand({
|
|
|
6
6
|
description: "盘客只读查询"
|
|
7
7
|
},
|
|
8
8
|
subCommands: {
|
|
9
|
-
detail: () => import("./detail-
|
|
10
|
-
task: () => import("./task-
|
|
9
|
+
detail: () => import("./detail-ZG7WTexq.mjs").then((m) => m.default),
|
|
10
|
+
task: () => import("./task-CAobpQXt.mjs").then((m) => m.default)
|
|
11
11
|
}
|
|
12
12
|
});
|
|
13
13
|
//#endregion
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { c as requireActiveProject } from "./project-store-
|
|
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-
|
|
4
|
-
import { n as visitBatchQueryCliArgs, t as buildVisitBatchQueryArgs } from "./visit-query-args-
|
|
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/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-
|
|
10
|
-
use: () => import("./use-
|
|
11
|
-
current: () => import("./current-
|
|
9
|
+
list: () => import("./list-xjVc-39m.mjs").then((m) => m.default),
|
|
10
|
+
use: () => import("./use-e7Wzfw1k.mjs").then((m) => m.default),
|
|
11
|
+
current: () => import("./current-fzCrzKjn.mjs").then((m) => m.default)
|
|
12
12
|
}
|
|
13
13
|
});
|
|
14
14
|
//#endregion
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
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";
|
|
2
3
|
var InsufficientCreditError = class extends Error {
|
|
3
4
|
code = "INSUFFICIENT_CREDIT";
|
|
4
5
|
hint = "(该项目下)用户积分余额不足,无法继续查询;请告知用户联系管理员充值";
|
|
@@ -227,7 +228,7 @@ function normalizeProjectListPage(page) {
|
|
|
227
228
|
};
|
|
228
229
|
}
|
|
229
230
|
async function fetchProjectListPage(page, size) {
|
|
230
|
-
const { mcpCall, unwrapMcpToolEnvelope } = await import("./mcp-client-
|
|
231
|
+
const { mcpCall, unwrapMcpToolEnvelope } = await import("./mcp-client-huLKHRT3.mjs").then((n) => n.r);
|
|
231
232
|
const result = await mcpCall("project-list", { arguments: {
|
|
232
233
|
page,
|
|
233
234
|
size
|
|
@@ -1,209 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
}
|
|
1
|
+
import { c as readEnv, l as requireUserId, m as CurrentProjectFailedError, t as ENV_KEYS, u as resolveEndpoints } from "./env-vars-osVxvm7z.mjs";
|
|
207
2
|
function requireTenantId() {
|
|
208
3
|
const tenantId = readEnv(ENV_KEYS.TENANT_ID);
|
|
209
4
|
if (!tenantId) throw new CurrentProjectFailedError("缺少 TENANT_ID 环境变量", { hint: "由 QCA 在沙箱启动时注入 TENANT_ID" });
|
|
@@ -421,4 +216,4 @@ function toActiveProject(remote) {
|
|
|
421
216
|
};
|
|
422
217
|
}
|
|
423
218
|
//#endregion
|
|
424
|
-
export {
|
|
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 };
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { c as requireActiveProject } from "./project-store-
|
|
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-
|
|
4
|
-
import { n as resolveProjectId, t as projectIdCliArg } from "./mcp-args-
|
|
5
|
-
import { n as writeMcpDataResult } from "./mcp-result-
|
|
6
|
-
import { t as csvToArray } from "./util-
|
|
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/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-
|
|
8
|
+
subCommands: { list: () => import("./list-DKbbBiI62.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-
|
|
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-
|
|
4
|
-
import { i as tenantIdCliArg, n as resolveProjectId, r as resolveTenantId, t as projectIdCliArg } from "./mcp-args-
|
|
5
|
-
import { n as writeMcpDataResult } from "./mcp-result-
|
|
6
|
-
import { t as csvToArray } from "./util-
|
|
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";
|
|
7
7
|
import { defineCommand } from "citty";
|
|
8
8
|
//#region src/commands/kb/search.ts
|
|
9
9
|
/**
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { defineCommand } from "citty";
|
|
2
|
+
//#region src/commands/skill/index.ts
|
|
3
|
+
var skill_default = defineCommand({
|
|
4
|
+
meta: {
|
|
5
|
+
name: "skill",
|
|
6
|
+
description: "Skill 中心:列表 / 安装 / 上传(REST,沙箱双凭证)"
|
|
7
|
+
},
|
|
8
|
+
subCommands: {
|
|
9
|
+
list: () => import("./list-DyAO08z92.mjs").then((m) => m.default),
|
|
10
|
+
install: () => import("./install-B9_5ceYu.mjs").then((m) => m.default),
|
|
11
|
+
upload: () => import("./upload-COReB487.mjs").then((m) => m.default)
|
|
12
|
+
}
|
|
13
|
+
});
|
|
14
|
+
//#endregion
|
|
15
|
+
export { skill_default as default };
|