@hcmai/cli 0.34.1 → 0.34.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.
- package/dist/index.js +238 -86
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -82,6 +82,7 @@ async function ensureActiveAuth(args) {
|
|
|
82
82
|
const principal = await readSessionPrincipal(axios.create({
|
|
83
83
|
baseURL: envCfg.endpoint,
|
|
84
84
|
timeout: 3e4,
|
|
85
|
+
maxRedirects: 0,
|
|
85
86
|
headers: { Authorization: `Bearer ${accessToken}` }
|
|
86
87
|
}));
|
|
87
88
|
if (idMeta.username && principal.username !== idMeta.username) throw new CliError({
|
|
@@ -678,6 +679,24 @@ var init_package_version = __esm({
|
|
|
678
679
|
}
|
|
679
680
|
});
|
|
680
681
|
|
|
682
|
+
// src/utils/agent-ref-notice.ts
|
|
683
|
+
function agentRefNotice(ref) {
|
|
684
|
+
if (ref.source !== "agentKey") return void 0;
|
|
685
|
+
const who2 = ref.agentName ? `${ref.agentName}\uFF08${ref.agentId}\uFF09` : ref.agentId;
|
|
686
|
+
const folded = ref.foldedIds && ref.foldedIds.length > 1 ? `\uFF1B\u540C\u4E00 agentKey \u67E5\u56DE ${ref.foldedIds.length} \u884C\uFF08${ref.foldedIds.join("\u3001")}\uFF09\uFF0C\u670D\u52A1\u7AEF\u6309 agentKey \u89C6\u4E3A\u540C\u4E00\u4E2A\u6570\u5B57\u5458\u5DE5\uFF0C\u7528\u7B2C\u4E00\u4E2A` : "";
|
|
687
|
+
return `\u21BB --agent ${ref.agentKey ?? "(\u672A\u8BFB\u51FA agentKey)"} \u2192 ${who2}${folded}
|
|
688
|
+
`;
|
|
689
|
+
}
|
|
690
|
+
function announceAgentRef(ref) {
|
|
691
|
+
const line = agentRefNotice(ref);
|
|
692
|
+
if (line) process.stderr.write(line);
|
|
693
|
+
}
|
|
694
|
+
var init_agent_ref_notice = __esm({
|
|
695
|
+
"src/utils/agent-ref-notice.ts"() {
|
|
696
|
+
"use strict";
|
|
697
|
+
}
|
|
698
|
+
});
|
|
699
|
+
|
|
681
700
|
// src/utils/attachment-args.ts
|
|
682
701
|
var attachment_args_exports = {};
|
|
683
702
|
__export(attachment_args_exports, {
|
|
@@ -1923,7 +1942,8 @@ import {
|
|
|
1923
1942
|
buildResumeSummary,
|
|
1924
1943
|
replHistoryFile,
|
|
1925
1944
|
DEFAULT_AGENT_ID,
|
|
1926
|
-
uploadDocument
|
|
1945
|
+
uploadDocument,
|
|
1946
|
+
fromAxiosError as fromAxiosError15
|
|
1927
1947
|
} from "@hcmai/sdk";
|
|
1928
1948
|
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
1929
1949
|
function ReplApp(props) {
|
|
@@ -2075,7 +2095,8 @@ function ReplApp(props) {
|
|
|
2075
2095
|
off();
|
|
2076
2096
|
}
|
|
2077
2097
|
} catch (e) {
|
|
2078
|
-
|
|
2098
|
+
const text2 = e?.isAxiosError ? fromAxiosError15(e, props.env).toFormattedString() : e.message ?? String(e);
|
|
2099
|
+
appendBlock({ kind: "error", text: text2 });
|
|
2079
2100
|
} finally {
|
|
2080
2101
|
cancelRef.current = null;
|
|
2081
2102
|
setBusy(false);
|
|
@@ -2240,6 +2261,7 @@ function ReplApp(props) {
|
|
|
2240
2261
|
identity: props.identity,
|
|
2241
2262
|
tenantId: props.tenantId,
|
|
2242
2263
|
agentId: props.agentId,
|
|
2264
|
+
agentKey: props.agentKey,
|
|
2243
2265
|
conversationId,
|
|
2244
2266
|
conversationMode,
|
|
2245
2267
|
sessionTokens
|
|
@@ -2275,7 +2297,7 @@ function StatusBar(props) {
|
|
|
2275
2297
|
props.env,
|
|
2276
2298
|
identity3,
|
|
2277
2299
|
`t${props.tenantId}`,
|
|
2278
|
-
agentLabel(props.agentId)
|
|
2300
|
+
agentLabel(props.agentId, props.agentKey)
|
|
2279
2301
|
].join(" \xB7 ");
|
|
2280
2302
|
const right = [
|
|
2281
2303
|
conversationStatus(props.conversationMode, props.conversationId),
|
|
@@ -2302,7 +2324,8 @@ function shortConversationId(id) {
|
|
|
2302
2324
|
function shortLabel(value, max) {
|
|
2303
2325
|
return value.length > max ? value.slice(0, Math.max(0, max - 1)) + "\u2026" : value;
|
|
2304
2326
|
}
|
|
2305
|
-
function agentLabel(agentId) {
|
|
2327
|
+
function agentLabel(agentId, agentKey) {
|
|
2328
|
+
if (agentKey) return agentDisplayName(agentKey);
|
|
2306
2329
|
if (agentId === DEFAULT_AGENT_ID) return "Moirai";
|
|
2307
2330
|
if (/^[0-9a-f]{8}-[0-9a-f-]{27}$/i.test(agentId)) return `agent \u2026${agentId.slice(-4)}`;
|
|
2308
2331
|
return agentDisplayName(agentId);
|
|
@@ -2440,7 +2463,14 @@ __export(run_exports, {
|
|
|
2440
2463
|
});
|
|
2441
2464
|
import React3 from "react";
|
|
2442
2465
|
import { render } from "ink";
|
|
2443
|
-
import {
|
|
2466
|
+
import {
|
|
2467
|
+
HcmClient as HcmClient12,
|
|
2468
|
+
WsClient,
|
|
2469
|
+
assertDangerWrite,
|
|
2470
|
+
conversationWebSocketEndpoint,
|
|
2471
|
+
fromAxiosError as fromAxiosError16,
|
|
2472
|
+
resolveAgentRef
|
|
2473
|
+
} from "@hcmai/sdk";
|
|
2444
2474
|
async function runInkRepl(args) {
|
|
2445
2475
|
if (process.stdout.isTTY) {
|
|
2446
2476
|
process.stdout.write("\x1B[>4;1m");
|
|
@@ -2462,6 +2492,8 @@ async function runInkRepl(args) {
|
|
|
2462
2492
|
} else if (args.conversation && args.conversation !== "NEW") {
|
|
2463
2493
|
initialConversationId = args.conversation;
|
|
2464
2494
|
}
|
|
2495
|
+
const agent = await resolveAgentRef(client4.raw(), args.agent);
|
|
2496
|
+
announceAgentRef(agent);
|
|
2465
2497
|
const ws = new WsClient({
|
|
2466
2498
|
endpoint: conversationWebSocketEndpoint(ctx.endpoint),
|
|
2467
2499
|
getAccessToken: () => client4.getAccessToken(),
|
|
@@ -2473,7 +2505,8 @@ async function runInkRepl(args) {
|
|
|
2473
2505
|
React3.createElement(ReplApp, {
|
|
2474
2506
|
ws,
|
|
2475
2507
|
client: client4,
|
|
2476
|
-
agentId:
|
|
2508
|
+
agentId: agent.agentId,
|
|
2509
|
+
agentKey: agent.agentKey,
|
|
2477
2510
|
env: ctx.env,
|
|
2478
2511
|
identity: ctx.identity,
|
|
2479
2512
|
tenantId: String(ctx.tenantId),
|
|
@@ -2486,7 +2519,7 @@ async function runInkRepl(args) {
|
|
|
2486
2519
|
process.exitCode = 0;
|
|
2487
2520
|
return;
|
|
2488
2521
|
} catch (e) {
|
|
2489
|
-
exitWithError(e);
|
|
2522
|
+
exitWithError(e?.isAxiosError ? fromAxiosError16(e, args.env) : e);
|
|
2490
2523
|
}
|
|
2491
2524
|
}
|
|
2492
2525
|
var init_run = __esm({
|
|
@@ -2494,6 +2527,7 @@ var init_run = __esm({
|
|
|
2494
2527
|
"use strict";
|
|
2495
2528
|
init_auth_guard();
|
|
2496
2529
|
init_exit();
|
|
2530
|
+
init_agent_ref_notice();
|
|
2497
2531
|
init_App();
|
|
2498
2532
|
}
|
|
2499
2533
|
});
|
|
@@ -6656,10 +6690,10 @@ async function loginCommand(args) {
|
|
|
6656
6690
|
}
|
|
6657
6691
|
const err = e;
|
|
6658
6692
|
if (err.isAxiosError) {
|
|
6659
|
-
const { fromAxiosError:
|
|
6693
|
+
const { fromAxiosError: fromAxiosError41 } = await import("@hcmai/sdk");
|
|
6660
6694
|
exitWithError(
|
|
6661
6695
|
withTenantHostMismatchStep(
|
|
6662
|
-
|
|
6696
|
+
fromAxiosError41(
|
|
6663
6697
|
e,
|
|
6664
6698
|
envName
|
|
6665
6699
|
),
|
|
@@ -8285,9 +8319,14 @@ var IMPORT_NEXT_STEP = {
|
|
|
8285
8319
|
CONTAINER_KEYS_DROPPED: "\u6574\u4EFD\u9001\u5BB9\u5668\u6E05\u6389\u4E86\u5B50\u952E\uFF1A\u8865\u56DE\u5B50\u952E\uFF08\u6216\u6539\u6210\u53EA\u9001\u8981\u6539\u7684\u9876\u5C42\u952E\uFF09\u540E\u7528 --update-only \u53EA\u91CD\u5BFC\u8FD9\u51E0\u884C",
|
|
8286
8320
|
VALUE_DIFFERS: "\u5E93\u91CC\u5B58\u7684\u503C\u548C\u9001\u7684\u4E0D\u4E00\u6837\uFF1A\u4EE5\u5E93\u91CC\u7684\u503C\u4E3A\u51C6\u6539\u672C\u5730\u6E90\uFF0C\u4E0D\u8981\u91CD\u5BFC\uFF08\u56DE\u8BFB\u524D\u540E\u82E5\u6709\u4ED6\u4EBA\u4FEE\u6539\uFF0C\u4EE5\u6700\u65B0\u503C\u4E3A\u51C6\uFF09",
|
|
8287
8321
|
VALUE_NOT_STORED: "\u503C\u6CA1\u5B58\u8FDB\u53BB\uFF1A\u4E0D\u8981\u91CD\u5BFC\uFF0C\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF08\u9644 --report \u91CC\u8FD9\u51E0\u884C\uFF09",
|
|
8288
|
-
NOT_FOUND_ON_READBACK: "\u5199\u5B8C\u6309 id \u8BFB\u4E0D\u5230\uFF1A\u{1F534} \u4E0D\u8981\u91CD\u5BFC\uFF08\u4F1A\u518D\u5EFA\u4E00\u6761\uFF09\uFF0C\u7528\u6709\u6743\u9650\u7684\u8D26\u53F7\u6309 id \u67E5\u4E00\u6B21"
|
|
8322
|
+
NOT_FOUND_ON_READBACK: "\u5199\u5B8C\u6309 id \u8BFB\u4E0D\u5230\uFF1A\u{1F534} \u4E0D\u8981\u91CD\u5BFC\uFF08\u4F1A\u518D\u5EFA\u4E00\u6761\uFF09\uFF0C\u7528\u6709\u6743\u9650\u7684\u8D26\u53F7\u6309 id \u67E5\u4E00\u6B21",
|
|
8323
|
+
WRITE_ONLY_PLACEHOLDER: "\u5BC6\u94A5\u5B57\u6BB5\u53EA\u5199\u4E0D\u8BFB\u3001\u56DE\u8BFB\u662F\u5360\u4F4D\uFF08WRITE_ONLY_PLACEHOLDER\uFF09\uFF0C\u6838\u4E0D\u4E86\uFF1A\u4E0D\u8981\u91CD\u5BFC\uFF0C\u4E5F\u4E0D\u7528\u627E\u4EBA\uFF1B\u5BC6\u94A5\u80FD\u4E0D\u80FD\u7528\u6309\u5B83\u81EA\u5DF1\u7684\u8FDE\u901A\u68C0\u67E5\u9A8C\uFF08\u79DF\u6237\u5927\u6A21\u578B\u914D\u7F6E\uFF1ALLM \u7528\u9014 hcm llm probe --config <id>\uFF0CEMBEDDING / ASR / TTS \u7528 hcm action TenantLLMConfig.testConnection --id <id>\uFF09"
|
|
8324
|
+
};
|
|
8325
|
+
var IMPORT_NEXT_STEP_WITHHELD = {
|
|
8326
|
+
VALUE_NOT_STORED: "\u5BC6\u94A5\u5B57\u6BB5\u7684\u503C\u6CA1\u5B58\u8FDB\u53BB\uFF1A\u4E0D\u8981\u91CD\u5BFC\uFF0C\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF08\u9644 --report \u91CC\u8FD9\u51E0\u884C\uFF0C\u53EA\u62A5\u5B57\u6BB5\u540D\uFF1B\u503C\u5DF2\u6309\u5BC6\u94A5\u6263\u4E0B\uFF0C\u4E5F\u4E0D\u8981\u4ECE\u6E90\u6570\u636E\u91CC\u8865\u4E0A\uFF09",
|
|
8327
|
+
VALUE_DIFFERS: "\u5BC6\u94A5\u5B57\u6BB5\u5E93\u91CC\u5B58\u7684\u548C\u9001\u7684\u4E0D\u4E00\u6837\uFF1A\u4E0D\u8981\u91CD\u5BFC\uFF1B\u5BC6\u94A5\u80FD\u4E0D\u80FD\u7528\u6309\u5B83\u81EA\u5DF1\u7684\u8FDE\u901A\u68C0\u67E5\u9A8C\uFF0C\u9A8C\u4E0D\u8FC7\u518D\u62A5\u7ED9\u4EA7\u54C1\u4FA7\uFF08\u53EA\u62A5\u5B57\u6BB5\u540D\uFF0C\u4E0D\u8981\u628A\u6E90\u6570\u636E\u91CC\u7684\u5BC6\u94A5\u8D34\u51FA\u6765\uFF09"
|
|
8289
8328
|
};
|
|
8290
|
-
var importNextStep = (reason) => (reason && IMPORT_NEXT_STEP[reason]) ?? `${reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0\u7801"}\uFF1A\u6309 id \u624B\u5DE5\u6838\u5BF9\uFF0C\u4E0D\u8981\u91CD\u5BFC`;
|
|
8329
|
+
var importNextStep = (reason, withheld = false) => (reason && (withheld && IMPORT_NEXT_STEP_WITHHELD[reason] || IMPORT_NEXT_STEP[reason])) ?? `${reason ?? "\u670D\u52A1\u7AEF\u6CA1\u7ED9\u539F\u56E0\u7801"}\uFF1A\u6309 id \u624B\u5DE5\u6838\u5BF9\uFF0C\u4E0D\u8981\u91CD\u5BFC`;
|
|
8291
8330
|
var MAX_NAMED_ROWS = 20;
|
|
8292
8331
|
function printExcluded(excluded) {
|
|
8293
8332
|
if (!excluded.length) return;
|
|
@@ -8301,6 +8340,13 @@ function printExcluded(excluded) {
|
|
|
8301
8340
|
}
|
|
8302
8341
|
process.stderr.write(" \u8981\u786E\u8BA4\u8FD9\u4E9B\u5217\uFF0C\u6309 id \u8BFB\u56DE\u90A3\u51E0\u884C\u6838\u5BF9\uFF1B\u9010\u884C\u89C1 --report \u6216 stdout \u7684 rows[].verification.excluded\n");
|
|
8303
8342
|
}
|
|
8343
|
+
function printPlaceholderStep(rows2) {
|
|
8344
|
+
const hit = (reason) => reason === "WRITE_ONLY_PLACEHOLDER";
|
|
8345
|
+
const n2 = rows2.filter((r) => (r.verification?.exitCode === 6 || r.verification?.exitCode === 7) && (r.verification.fields ?? []).some((f) => hit(f.reason) || (f.leaves ?? []).some((l) => hit(l.reason)))).length;
|
|
8346
|
+
if (n2) process.stderr.write(` \xB7 ${n2} \u884C\uFF1A${IMPORT_NEXT_STEP.WRITE_ONLY_PLACEHOLDER}
|
|
8347
|
+
`);
|
|
8348
|
+
return n2;
|
|
8349
|
+
}
|
|
8304
8350
|
function printVerification(result) {
|
|
8305
8351
|
const v = result.verification;
|
|
8306
8352
|
process.stderr.write(
|
|
@@ -8311,6 +8357,7 @@ function printVerification(result) {
|
|
|
8311
8357
|
const one = (f) => {
|
|
8312
8358
|
const extra = [
|
|
8313
8359
|
...f.reason ? [f.reason] : [],
|
|
8360
|
+
...f.valuesWithheld ? ["\u503C\u5DF2\u6309\u5BC6\u94A5\u6263\u4E0B\uFF0C\u63D0\u5355\u65F6\u4E5F\u4E0D\u8981\u9644"] : [],
|
|
8314
8361
|
...f.droppedKeys?.length ? [`\u88AB\u6E05\u6389\uFF1A${f.droppedKeys.join("\u3001")}`] : [],
|
|
8315
8362
|
...(f.leaves ?? []).map((l) => `${l.path} ${l.reason ?? l.status ?? ""}`.trim())
|
|
8316
8363
|
];
|
|
@@ -8351,16 +8398,19 @@ function printVerification(result) {
|
|
|
8351
8398
|
if (mismatched.length) {
|
|
8352
8399
|
const byStep = /* @__PURE__ */ new Map();
|
|
8353
8400
|
for (const r of mismatched) {
|
|
8354
|
-
const bad = (r.verification?.fields ?? []).filter((f) => f.status !== "UNVERIFIABLE")
|
|
8355
|
-
const
|
|
8356
|
-
for (const step2 of new Set(
|
|
8401
|
+
const bad = (r.verification?.fields ?? []).filter((f) => f.status !== "UNVERIFIABLE");
|
|
8402
|
+
const steps = bad.length ? bad.map((f) => importNextStep(f.reason, f.valuesWithheld === true)) : [importNextStep(r.verification?.reason)];
|
|
8403
|
+
for (const step2 of new Set(steps)) byStep.set(step2, (byStep.get(step2) ?? 0) + 1);
|
|
8357
8404
|
}
|
|
8358
8405
|
for (const [step2, n2] of byStep) process.stderr.write(` \xB7 ${n2} \u884C\uFF1A${step2}
|
|
8359
8406
|
`);
|
|
8407
|
+
printPlaceholderStep(result.rows);
|
|
8360
8408
|
process.stderr.write("\u4E0B\u4E00\u6B65\uFF1A\u6838\u9A8C\u5931\u8D25\u7684\u884C\u5DF2\u7ECF\u5199\u5165\uFF0C\u{1F534} \u4E0D\u8981\u6574\u4EFD\u91CD\u8DD1\uFF08\u5DF2\u5B58\u5728\u7684\u884C\u4F1A\u88AB\u8DF3\u8FC7\uFF0C\u8BFB\u4E0D\u5230\u7684\u884C\u4F1A\u518D\u5EFA\u4E00\u6761\uFF09\uFF1B\u6309\u4E0A\u9762\u6BCF\u79CD\u539F\u56E0\u5404\u81EA\u5904\u7406\n");
|
|
8361
8409
|
} else if (unverified.length) {
|
|
8410
|
+
const placeholderRows2 = printPlaceholderStep(result.rows);
|
|
8362
8411
|
const legacyOnly = unverified.every((r) => r.verification?.status === "LEGACY_NO_VERIFICATION");
|
|
8363
|
-
process.stderr.write(legacyOnly ? "\u4E0B\u4E00\u6B65\uFF1ACore \u7248\u672C\u65E9\u4E8E\u5199\u540E\u6838\u9A8C\u4E0A\u7EBF\uFF08\u6CA1\u6536\u5230\u6838\u9A8C\u5757\uFF09\uFF0C\u5347\u7EA7 Core \u540E --verify \u624D\u6709\u7ED3\u8BBA\uFF1B\u5DF2\u5199\u5165\u7684\u884C\u4E0D\u8981\u56E0\u6B64\u91CD\u8DD1\n" :
|
|
8412
|
+
process.stderr.write(legacyOnly ? "\u4E0B\u4E00\u6B65\uFF1ACore \u7248\u672C\u65E9\u4E8E\u5199\u540E\u6838\u9A8C\u4E0A\u7EBF\uFF08\u6CA1\u6536\u5230\u6838\u9A8C\u5757\uFF09\uFF0C\u5347\u7EA7 Core \u540E --verify \u624D\u6709\u7ED3\u8BBA\uFF1B\u5DF2\u5199\u5165\u7684\u884C\u4E0D\u8981\u56E0\u6B64\u91CD\u8DD1\n" : `\u4E0B\u4E00\u6B65\uFF1A\u5DF2\u5199\u5165\u3001${placeholderRows2 ? "\u5176\u4F59" : ""}\u6CA1\u6838\u6210\u7684\u884C\u6309\u539F\u56E0\u624B\u5DE5\u6838\u5BF9\uFF1B\u4E0D\u8981\u56E0\u4E3A\u300C\u672A\u6838\u9A8C\u300D\u6574\u4EFD\u91CD\u8DD1
|
|
8413
|
+
`);
|
|
8364
8414
|
}
|
|
8365
8415
|
}
|
|
8366
8416
|
|
|
@@ -8370,10 +8420,12 @@ init_auth_guard();
|
|
|
8370
8420
|
import {
|
|
8371
8421
|
HcmClient as HcmClient11,
|
|
8372
8422
|
MUTATION_CAPABILITY_OPS,
|
|
8423
|
+
mutationCapabilityKeyIn,
|
|
8373
8424
|
MUTATION_CELL_KEYS,
|
|
8374
8425
|
formatObject as formatObject10,
|
|
8375
8426
|
fromAxiosError as fromAxiosError14,
|
|
8376
|
-
missingKeys
|
|
8427
|
+
missingKeys,
|
|
8428
|
+
readVerificationCell
|
|
8377
8429
|
} from "@hcmai/sdk";
|
|
8378
8430
|
|
|
8379
8431
|
// src/commands/introspection-cli.ts
|
|
@@ -8554,13 +8606,14 @@ function formatDescriptionTable(desc, verbose = false) {
|
|
|
8554
8606
|
lines.push(
|
|
8555
8607
|
` ${a.name.padEnd(20)} ${call.padEnd(12)} ${a.label ?? ""}${source} ${actionTags(desc, a, verbose)}${params}${description}`
|
|
8556
8608
|
);
|
|
8609
|
+
if (verbose) lines.push(...verificationDetail(a));
|
|
8557
8610
|
}
|
|
8558
8611
|
if (!desc.effectiveActionsAvailable) {
|
|
8559
8612
|
lines.push(
|
|
8560
8613
|
` \u26A0\uFE0F \u4EE5\u4E0A\u53EA\u542B\u6CE8\u89E3 action\uFF0CYAML \u58F0\u660E\u7684\u811A\u672C Action \u672A\u7EB3\u5165\uFF1A${desc.effectiveActionsNote ?? "\u539F\u56E0\u672A\u77E5"}`
|
|
8561
8614
|
);
|
|
8562
8615
|
}
|
|
8563
|
-
if (desc.actions.length) lines.push(...actionLegend(desc));
|
|
8616
|
+
if (desc.actions.length) lines.push(...actionLegend(desc, verbose));
|
|
8564
8617
|
if (desc.relations.length) {
|
|
8565
8618
|
lines.push(`relations: ${desc.relations.map((r) => {
|
|
8566
8619
|
const target = r.target ? ` \u2192 ${r.target}` : "";
|
|
@@ -8588,6 +8641,39 @@ function grantCell(desc, a) {
|
|
|
8588
8641
|
if (a.effectiveRow === "not-listed") return "\u4E0D\u5728\u6709\u6548\u96C6";
|
|
8589
8642
|
return shown(a.grantForCaller, !!a.notProvided?.includes("grantForCaller"));
|
|
8590
8643
|
}
|
|
8644
|
+
var FROM_META = "[/meta]";
|
|
8645
|
+
function confirmCell(a) {
|
|
8646
|
+
if (a.requiresConfirmation !== void 0) return shown(a.requiresConfirmation, false);
|
|
8647
|
+
if (a.confirm !== void 0) return `${shown(a.confirm, false)}${FROM_META}`;
|
|
8648
|
+
return NOT_PROVIDED;
|
|
8649
|
+
}
|
|
8650
|
+
function verifyCell(desc, a) {
|
|
8651
|
+
if (!desc.effectiveActionsAvailable) return "\u672A\u53D6\u5230";
|
|
8652
|
+
if (a.effectiveRow === "not-listed") return "\u4E0D\u5728\u6709\u6548\u96C6";
|
|
8653
|
+
if (a.notProvided?.includes("verification")) return NOT_PROVIDED;
|
|
8654
|
+
return verifyValue(a.verification);
|
|
8655
|
+
}
|
|
8656
|
+
var VERIFY_MALFORMED = "\u5F62\u72B6\u8BA4\u4E0D\u51FA";
|
|
8657
|
+
function verifyValue(cell2) {
|
|
8658
|
+
if (cell2 === void 0) return NOT_PROVIDED;
|
|
8659
|
+
const decl = readVerificationCell(cell2);
|
|
8660
|
+
return decl.kind === "declared" ? decl.status : VERIFY_MALFORMED;
|
|
8661
|
+
}
|
|
8662
|
+
function candidateItem(c2) {
|
|
8663
|
+
if (!c2 || typeof c2 !== "object") return `${VERIFY_MALFORMED}\uFF08\u670D\u52A1\u7AEF\u539F\u6587 ${JSON.stringify(c2)}\uFF09`;
|
|
8664
|
+
const cand = c2;
|
|
8665
|
+
const where = [cand.source, cand.scope].map((v) => typeof v === "string" && v ? v : "?").join("/");
|
|
8666
|
+
const cdecl = cand.verification === void 0 ? void 0 : readVerificationCell(cand.verification);
|
|
8667
|
+
const note = cdecl?.kind === "declared" && cdecl.note ? `\uFF08${cdecl.note}\uFF09` : "";
|
|
8668
|
+
return `${where} effect=${shown(cand.effect, false)} verify=${verifyValue(cand.verification)}${note}`;
|
|
8669
|
+
}
|
|
8670
|
+
function candidateVerifyValues(a) {
|
|
8671
|
+
const candidates = a.candidates ?? [];
|
|
8672
|
+
if (candidates.length <= 1) return [];
|
|
8673
|
+
return candidates.map(
|
|
8674
|
+
(c2) => c2 && typeof c2 === "object" ? verifyValue(c2.verification) : VERIFY_MALFORMED
|
|
8675
|
+
);
|
|
8676
|
+
}
|
|
8591
8677
|
function actionTags(desc, a, verbose) {
|
|
8592
8678
|
const tags = [
|
|
8593
8679
|
`effect=${shown(a.effect, !!a.notProvided?.includes("effect"))}`,
|
|
@@ -8597,12 +8683,31 @@ function actionTags(desc, a, verbose) {
|
|
|
8597
8683
|
tags.push(
|
|
8598
8684
|
`ext=${shown(a.hasExternalDep, false)}`,
|
|
8599
8685
|
`sens=${shown(a.sensitiveData, false)}`,
|
|
8600
|
-
`confirm=${
|
|
8686
|
+
`confirm=${confirmCell(a)}`
|
|
8601
8687
|
);
|
|
8602
8688
|
if (desc.effectiveActionsAvailable && a.effectiveRow === "listed") tags.push(`conflict=${shown(a.conflict, false)}`);
|
|
8689
|
+
tags.push(`verify=${verifyCell(desc, a)}`);
|
|
8603
8690
|
}
|
|
8604
8691
|
return tags.join(" ");
|
|
8605
8692
|
}
|
|
8693
|
+
function verificationDetail(a) {
|
|
8694
|
+
const out = [];
|
|
8695
|
+
if (a.verification !== void 0) {
|
|
8696
|
+
const decl = readVerificationCell(a.verification);
|
|
8697
|
+
if (decl.kind !== "declared") {
|
|
8698
|
+
out.push(` \u21B3 \u6838\u9A8C\u58F0\u660E\u5F62\u72B6\u8BA4\u4E0D\u51FA\uFF08\u670D\u52A1\u7AEF\u539F\u6587 ${JSON.stringify(a.verification)}\uFF09\uFF0C\u4E0D\u5F53\u6210\u4EFB\u4F55\u4E00\u79CD\u58F0\u660E`);
|
|
8699
|
+
} else if (decl.note) {
|
|
8700
|
+
out.push(` \u21B3 \u6838\u9A8C\u58F0\u660E\u539F\u6587\uFF1A${decl.note}`);
|
|
8701
|
+
} else if (decl.status === "NONE") {
|
|
8702
|
+
out.push(" \u21B3 \u6838\u9A8C\u58F0\u660E\u539F\u6587\uFF1A\uFF08\u58F0\u660E\u4E86 NONE\uFF0C\u4F46\u6CA1\u7ED9\u8BF4\u660E\u2014\u2014\u53BB\u54EA\u67E5\u6267\u884C\u7ED3\u679C\uFF0C\u95EE\u4EBA\uFF09");
|
|
8703
|
+
}
|
|
8704
|
+
}
|
|
8705
|
+
const candidates = a.candidates ?? [];
|
|
8706
|
+
if (candidates.length > 1) {
|
|
8707
|
+
out.push(` \u21B3 \u5019\u9009 ${candidates.length} \u6761\uFF1A${candidates.map(candidateItem).join(" \xB7 ")}`);
|
|
8708
|
+
}
|
|
8709
|
+
return out;
|
|
8710
|
+
}
|
|
8606
8711
|
var EFFECT_MEANING = {
|
|
8607
8712
|
READ_ONLY: "\u5224\u8FC7\u3001\u4E0D\u5199\u5E93",
|
|
8608
8713
|
WRITES: "\u5224\u8FC7\u3001\u4F1A\u5199\u5E93",
|
|
@@ -8618,12 +8723,25 @@ var GRANT_MEANING = {
|
|
|
8618
8723
|
\u4E0D\u5728\u6709\u6548\u96C6: "\u672C\u89C6\u56FE\u4E0B /actions \u6CA1\u5217\u8FD9\u4E00\u884C\uFF08\u6362 --state \u518D\u770B\uFF09",
|
|
8619
8724
|
[NOT_PROVIDED]: "\u670D\u52A1\u7AEF\u65E9\u4E8E\u8BE5\u5B57\u6BB5\uFF0C\u6CA1\u8BF4\u2014\u2014\u4E0D\u8BB8\u6309\u4EFB\u4F55\u4E00\u6863\u8BFB"
|
|
8620
8725
|
};
|
|
8621
|
-
|
|
8726
|
+
var VERIFY_MEANING = {
|
|
8727
|
+
NONE: "\u58F0\u660E\u4E86\u6267\u884C\u5B8C\u6838\u9A8C\u4E0D\u4E86\u2014\u2014\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\uFF0C\u7ED3\u679C\u53BB \u21B3 \u58F0\u660E\u539F\u6587\u8BF4\u7684\u5730\u65B9\u67E5",
|
|
8728
|
+
UNKNOWN: "\u6CA1\u4EBA\u58F0\u660E\u8FC7\u2014\u2014\u4E0D\u7B49\u4E8E\u300C\u53EF\u6838\u9A8C\u300D\uFF0C\u6267\u884C\u540E\u540C\u6837\u6309\u300C\u5DF2\u6267\u884C\u3001\u672A\u6838\u9A8C\u300D\u5BF9\u5F85",
|
|
8729
|
+
\u672A\u53D6\u5230: "\u8FD9\u6B21\u6CA1\u8BFB\u5230 /actions\uFF0C\u6838\u9A8C\u58F0\u660E\u65E0\u4ECE\u8BF4\u8D77",
|
|
8730
|
+
\u4E0D\u5728\u6709\u6548\u96C6: "\u672C\u89C6\u56FE\u4E0B /actions \u6CA1\u5217\u8FD9\u4E00\u884C\uFF08\u6362 --state \u518D\u770B\uFF09",
|
|
8731
|
+
[NOT_PROVIDED]: "\u670D\u52A1\u7AEF\u65E9\u4E8E\u6838\u9A8C\u58F0\u660E\uFF0C\u6CA1\u8BF4\u2014\u2014\u62A5\u544A\u91CC\u7167\u5199\u300C\u672C\u73AF\u5883\u672A\u63D0\u4F9B\u300D\uFF0C\u4E0D\u8981\u5199\u6210 UNKNOWN",
|
|
8732
|
+
[VERIFY_MALFORMED]: "\u8FD9\u4E00\u683C\u5728\u3001\u4F46\u8BFB\u4E0D\u51FA status\uFF0C\u4E0D\u5F53\u6210\u4EFB\u4F55\u4E00\u79CD\u58F0\u660E"
|
|
8733
|
+
};
|
|
8734
|
+
function actionLegend(desc, verbose) {
|
|
8622
8735
|
const effects = /* @__PURE__ */ new Set();
|
|
8623
8736
|
const grants = /* @__PURE__ */ new Set();
|
|
8737
|
+
const verifies = /* @__PURE__ */ new Set();
|
|
8738
|
+
let confirmFromMeta = false;
|
|
8624
8739
|
for (const a of desc.actions) {
|
|
8625
8740
|
effects.add(shown(a.effect, !!a.notProvided?.includes("effect")));
|
|
8626
8741
|
grants.add(grantCell(desc, a));
|
|
8742
|
+
verifies.add(verifyCell(desc, a));
|
|
8743
|
+
for (const v of candidateVerifyValues(a)) verifies.add(v);
|
|
8744
|
+
if (confirmCell(a).endsWith(FROM_META)) confirmFromMeta = true;
|
|
8627
8745
|
}
|
|
8628
8746
|
const describeSet = (set, meaning) => [...set].map((v) => `${v} ${meaning[v] ?? (v === NOT_PROVIDED ? "\u670D\u52A1\u7AEF\u65E9\u4E8E\u8BE5\u5B57\u6BB5" : "\uFF08\u8FD9\u7248 CLI \u4E0D\u8BA4\u8BC6\u8FD9\u4E00\u6863\uFF0C\u7167\u670D\u52A1\u7AEF\u539F\u6587\u5224\uFF09")}`).join(" \xB7 ");
|
|
8629
8747
|
const lines = [
|
|
@@ -8633,7 +8751,15 @@ function actionLegend(desc) {
|
|
|
8633
8751
|
];
|
|
8634
8752
|
if (desc.effectiveActionsAvailable) {
|
|
8635
8753
|
const view = desc.actionsState === void 0 ? `state=${NOT_PROVIDED} \u7684\u89C6\u56FE` : desc.actionsState ? `state=${desc.actionsState}` : "\u9ED8\u8BA4\u89C6\u56FE";
|
|
8636
|
-
lines.push(` \u2139\uFE0F \u8FD9\u4EFD\u52A8\u4F5C\u96C6\u53EA\u5BF9 ${view} \u6210\u7ACB\uFF08state-scoped\uFF09\uFF0C\u522B\u7684\u89C6\u56FE\u6362 \`--state <\u89C6\u56FE>\` \u518D\u770B\uFF1B\u5916\u90E8\u4F9D\u8D56 / \u654F\u611F\u6570\u636E / \u786E\u8BA4\u8981\u6C42\u52A0 -v \u770B`);
|
|
8754
|
+
lines.push(` \u2139\uFE0F \u8FD9\u4EFD\u52A8\u4F5C\u96C6\u53EA\u5BF9 ${view} \u6210\u7ACB\uFF08state-scoped\uFF09\uFF0C\u522B\u7684\u89C6\u56FE\u6362 \`--state <\u89C6\u56FE>\` \u518D\u770B\uFF1B\u5916\u90E8\u4F9D\u8D56 / \u654F\u611F\u6570\u636E / \u786E\u8BA4\u8981\u6C42 / \u5199\u540E\u6838\u9A8C\u58F0\u660E\u52A0 -v \u770B`);
|
|
8755
|
+
}
|
|
8756
|
+
if (verbose) {
|
|
8757
|
+
lines.push(` \u2139\uFE0F verify = \u5199\u540E\u6838\u9A8C\u58F0\u660E\uFF08\u6267\u884C\u5B8C\u670D\u52A1\u7AEF\u80FD\u4E0D\u80FD\u6838\u9A8C\u5199\u6CA1\u5199\u6210\uFF09\uFF1A${describeSet(verifies, VERIFY_MEANING)}`);
|
|
8758
|
+
if (confirmFromMeta) {
|
|
8759
|
+
lines.push(
|
|
8760
|
+
` \u2139\uFE0F confirm=\u2026${FROM_META} = /actions \u6CA1\u7ED9\u6D3E\u751F\u7ED3\u8BBA requiresConfirmation\uFF0C\u9000\u56DE /meta \u7684\u4F5C\u8005\u58F0\u660E confirm\uFF08DEFAULT \u6309 HTTP \u65B9\u6CD5\u6D3E\u751F\u3001\u975E GET \u5373\u8981\u786E\u8BA4\uFF09\uFF0C\u4E0D\u662F\u6D3E\u751F\u7ED3\u8BBA\uFF1B\u4E0D\u5E26\u6807\u7684 true / false \u53D6\u81EA /actions`
|
|
8761
|
+
);
|
|
8762
|
+
}
|
|
8637
8763
|
}
|
|
8638
8764
|
return lines;
|
|
8639
8765
|
}
|
|
@@ -8647,7 +8773,7 @@ function formatMutationCapability(model, mc) {
|
|
|
8647
8773
|
const gateNotProvided = [];
|
|
8648
8774
|
const scopes = /* @__PURE__ */ new Set();
|
|
8649
8775
|
for (const op of MUTATION_CAPABILITY_OPS) {
|
|
8650
|
-
const key2 =
|
|
8776
|
+
const key2 = mutationCapabilityKeyIn(mc.ops, op);
|
|
8651
8777
|
if (!key2) {
|
|
8652
8778
|
lines.push(` ${op.padEnd(12)} ${NOT_PROVIDED}`);
|
|
8653
8779
|
continue;
|
|
@@ -8697,7 +8823,8 @@ import {
|
|
|
8697
8823
|
oneShot,
|
|
8698
8824
|
sendMessageAndStream as sendMessageAndStream2,
|
|
8699
8825
|
createConversation as createConversation2,
|
|
8700
|
-
|
|
8826
|
+
resolveAgentRef as resolveAgentRef2,
|
|
8827
|
+
fromAxiosError as fromAxiosError17,
|
|
8701
8828
|
saveConversationState as saveConversationState2,
|
|
8702
8829
|
formatObject as formatObject11,
|
|
8703
8830
|
formatRows as formatRows3,
|
|
@@ -8735,6 +8862,7 @@ function serverCodeOf(raw) {
|
|
|
8735
8862
|
|
|
8736
8863
|
// src/commands/chat.ts
|
|
8737
8864
|
init_exit();
|
|
8865
|
+
init_agent_ref_notice();
|
|
8738
8866
|
init_impersonation_lifecycle();
|
|
8739
8867
|
init_auth_guard();
|
|
8740
8868
|
function parseInjectOn(s) {
|
|
@@ -9066,7 +9194,9 @@ async function chatCommand(prompt, args) {
|
|
|
9066
9194
|
const wsUrl = conversationWebSocketEndpoint2(ctx.endpoint);
|
|
9067
9195
|
const client4 = HcmClient13.fromAuthContext(ctx);
|
|
9068
9196
|
const stateKey = ctx.env;
|
|
9069
|
-
const
|
|
9197
|
+
const agentRef = await resolveAgentRef2(client4.raw(), args.agent);
|
|
9198
|
+
announceAgentRef(agentRef);
|
|
9199
|
+
const { agentId } = agentRef;
|
|
9070
9200
|
let resumeConversationId = requestedConversationId;
|
|
9071
9201
|
const resumedExisting = !!resumeConversationId;
|
|
9072
9202
|
if (!resumeConversationId) {
|
|
@@ -9373,18 +9503,20 @@ async function chatCommand(prompt, args) {
|
|
|
9373
9503
|
process.exitCode = 0;
|
|
9374
9504
|
return;
|
|
9375
9505
|
} catch (e) {
|
|
9376
|
-
exitWithError(e);
|
|
9506
|
+
exitWithError(e?.isAxiosError ? fromAxiosError17(e, args.env) : e);
|
|
9377
9507
|
}
|
|
9378
9508
|
}
|
|
9379
9509
|
|
|
9380
9510
|
// src/commands/interactions.ts
|
|
9381
9511
|
init_exit();
|
|
9512
|
+
init_agent_ref_notice();
|
|
9382
9513
|
init_auth_guard();
|
|
9383
9514
|
import {
|
|
9384
9515
|
CliError as CliError21,
|
|
9385
9516
|
CliErrorCode as CliErrorCode21,
|
|
9386
|
-
DEFAULT_AGENT_ID as DEFAULT_AGENT_ID4,
|
|
9387
9517
|
HcmClient as HcmClient14,
|
|
9518
|
+
fromAxiosError as fromAxiosError18,
|
|
9519
|
+
resolveAgentRef as resolveAgentRef3,
|
|
9388
9520
|
WsClient as WsClient3,
|
|
9389
9521
|
conversationWebSocketEndpoint as conversationWebSocketEndpoint3,
|
|
9390
9522
|
assertDangerWrite as assertDangerWrite3,
|
|
@@ -9506,7 +9638,9 @@ async function interactionsListCommand(args) {
|
|
|
9506
9638
|
const json2 = args.output === "json";
|
|
9507
9639
|
announceSource(source, conversationId, json2);
|
|
9508
9640
|
const client4 = HcmClient14.fromAuthContext(ctx);
|
|
9509
|
-
const
|
|
9641
|
+
const agentRef = await resolveAgentRef3(client4.raw(), args.agent);
|
|
9642
|
+
if (!json2) announceAgentRef(agentRef);
|
|
9643
|
+
const { agentId } = agentRef;
|
|
9510
9644
|
const rows2 = await listPendingInteractions(client4.raw(), agentId, conversationId);
|
|
9511
9645
|
if (json2) {
|
|
9512
9646
|
process.stdout.write(
|
|
@@ -9520,7 +9654,7 @@ async function interactionsListCommand(args) {
|
|
|
9520
9654
|
}
|
|
9521
9655
|
process.exitCode = 0;
|
|
9522
9656
|
} catch (e) {
|
|
9523
|
-
exitWithError(e);
|
|
9657
|
+
exitWithError(e?.isAxiosError ? fromAxiosError18(e, args.env) : e);
|
|
9524
9658
|
}
|
|
9525
9659
|
}
|
|
9526
9660
|
async function interactionsRespondCommand(action, interactionId, args) {
|
|
@@ -9575,7 +9709,7 @@ async function interactionsRespondCommand(action, interactionId, args) {
|
|
|
9575
9709
|
// src/commands/download.ts
|
|
9576
9710
|
init_auth_guard();
|
|
9577
9711
|
init_exit();
|
|
9578
|
-
import { downloadDocument, fromAxiosError as
|
|
9712
|
+
import { downloadDocument, fromAxiosError as fromAxiosError19 } from "@hcmai/sdk";
|
|
9579
9713
|
import { HcmClient as HcmClient15 } from "@hcmai/sdk";
|
|
9580
9714
|
async function downloadCommand(documentId, args) {
|
|
9581
9715
|
try {
|
|
@@ -9590,7 +9724,7 @@ async function downloadCommand(documentId, args) {
|
|
|
9590
9724
|
if (status === 401) {
|
|
9591
9725
|
exitWithError(new Error(`\u4E0B\u8F7D\u672A\u6388\u6743\uFF08${status}\uFF09\u2014\u2014\u8BF7 hcm login \u540E\u91CD\u8BD5`));
|
|
9592
9726
|
} else if (status === 403) {
|
|
9593
|
-
const denied =
|
|
9727
|
+
const denied = fromAxiosError19(e, args.env);
|
|
9594
9728
|
denied.message += "\uFF1B\u8BF7\u6838\u5BF9\u9644\u4EF6\u7684\u4E1A\u52A1\u5F52\u5C5E\u3001\u5B57\u6BB5\u6743\u9650\u548C\u7EC4\u7EC7\u8303\u56F4\uFF0C\u6743\u9650\u62D2\u7EDD\u65E0\u9700\u91CD\u590D\u767B\u5F55\u3002";
|
|
9595
9729
|
exitWithError(denied);
|
|
9596
9730
|
} else if (status === 404) {
|
|
@@ -9607,7 +9741,7 @@ init_exit();
|
|
|
9607
9741
|
import {
|
|
9608
9742
|
deleteDocument,
|
|
9609
9743
|
HcmClient as HcmClient16,
|
|
9610
|
-
fromAxiosError as
|
|
9744
|
+
fromAxiosError as fromAxiosError20,
|
|
9611
9745
|
formatObject as formatObject13
|
|
9612
9746
|
} from "@hcmai/sdk";
|
|
9613
9747
|
async function documentDeleteCommand(documentId, args) {
|
|
@@ -9618,7 +9752,7 @@ async function documentDeleteCommand(documentId, args) {
|
|
|
9618
9752
|
process.exitCode = 0;
|
|
9619
9753
|
} catch (e) {
|
|
9620
9754
|
const err = e;
|
|
9621
|
-
if (err?.isAxiosError) exitWithError(
|
|
9755
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError20(err, args.env));
|
|
9622
9756
|
exitWithError(e);
|
|
9623
9757
|
}
|
|
9624
9758
|
}
|
|
@@ -9626,7 +9760,7 @@ async function documentDeleteCommand(documentId, args) {
|
|
|
9626
9760
|
// src/commands/trace.ts
|
|
9627
9761
|
init_exit();
|
|
9628
9762
|
init_auth_guard();
|
|
9629
|
-
import { HcmClient as HcmClient17, formatObject as formatObject14, formatRows as formatRows5, fromAxiosError as
|
|
9763
|
+
import { HcmClient as HcmClient17, formatObject as formatObject14, formatRows as formatRows5, fromAxiosError as fromAxiosError21 } from "@hcmai/sdk";
|
|
9630
9764
|
function parsePositiveInt2(value, fallback, flag) {
|
|
9631
9765
|
const n2 = Number(value ?? fallback);
|
|
9632
9766
|
if (!Number.isInteger(n2) || n2 <= 0) {
|
|
@@ -10085,7 +10219,7 @@ async function traceCommand(traceId, args) {
|
|
|
10085
10219
|
} catch (e) {
|
|
10086
10220
|
const err = e;
|
|
10087
10221
|
if (err?.isAxiosError) {
|
|
10088
|
-
exitWithError(
|
|
10222
|
+
exitWithError(fromAxiosError21(err, args.profile));
|
|
10089
10223
|
}
|
|
10090
10224
|
exitWithError(e);
|
|
10091
10225
|
}
|
|
@@ -10095,7 +10229,7 @@ async function traceCommand(traceId, args) {
|
|
|
10095
10229
|
init_auth_guard();
|
|
10096
10230
|
init_exit();
|
|
10097
10231
|
import { readFile as readFile5 } from "fs/promises";
|
|
10098
|
-
import { HcmClient as HcmClient18, fromAxiosError as
|
|
10232
|
+
import { HcmClient as HcmClient18, fromAxiosError as fromAxiosError22 } from "@hcmai/sdk";
|
|
10099
10233
|
var FAILED_TASK_STATUSES = /* @__PURE__ */ new Set(["FAILED", "CANCELLED", "TIMEOUT", "DEAD_LETTERED"]);
|
|
10100
10234
|
async function subscriptionMigrationCommand(operation, args) {
|
|
10101
10235
|
try {
|
|
@@ -10138,7 +10272,7 @@ async function subscriptionMigrationCommand(operation, args) {
|
|
|
10138
10272
|
process.exitCode = failed2 ? 1 : 0;
|
|
10139
10273
|
} catch (error) {
|
|
10140
10274
|
if (error && typeof error === "object" && "isAxiosError" in error) {
|
|
10141
|
-
exitWithError(
|
|
10275
|
+
exitWithError(fromAxiosError22(error, args.env));
|
|
10142
10276
|
}
|
|
10143
10277
|
exitWithError(error);
|
|
10144
10278
|
}
|
|
@@ -10150,7 +10284,7 @@ init_auth_guard();
|
|
|
10150
10284
|
import {
|
|
10151
10285
|
HcmClient as HcmClient19,
|
|
10152
10286
|
formatObject as formatObject15,
|
|
10153
|
-
fromAxiosError as
|
|
10287
|
+
fromAxiosError as fromAxiosError23,
|
|
10154
10288
|
getCacheStats,
|
|
10155
10289
|
clearModelCache,
|
|
10156
10290
|
clearMetaCache
|
|
@@ -10168,7 +10302,7 @@ function emit(result, args, human) {
|
|
|
10168
10302
|
}
|
|
10169
10303
|
function fail3(e, args) {
|
|
10170
10304
|
const err = e;
|
|
10171
|
-
if (err?.isAxiosError) exitWithError(
|
|
10305
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError23(err, args.env));
|
|
10172
10306
|
exitWithError(e);
|
|
10173
10307
|
process.exit(1);
|
|
10174
10308
|
}
|
|
@@ -10208,7 +10342,7 @@ import { readFileSync as readFileSync4 } from "fs";
|
|
|
10208
10342
|
import {
|
|
10209
10343
|
HcmClient as HcmClient20,
|
|
10210
10344
|
formatObject as formatObject16,
|
|
10211
|
-
fromAxiosError as
|
|
10345
|
+
fromAxiosError as fromAxiosError24,
|
|
10212
10346
|
scriptDryRun,
|
|
10213
10347
|
validateScriptManifest,
|
|
10214
10348
|
queryScriptLogs,
|
|
@@ -10227,7 +10361,7 @@ function emit2(result, args, human) {
|
|
|
10227
10361
|
}
|
|
10228
10362
|
function fail4(e, args) {
|
|
10229
10363
|
const err = e;
|
|
10230
|
-
if (err?.isAxiosError) exitWithError(
|
|
10364
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError24(err, args.env));
|
|
10231
10365
|
exitWithError(e);
|
|
10232
10366
|
process.exit(1);
|
|
10233
10367
|
}
|
|
@@ -10319,7 +10453,7 @@ init_auth_guard();
|
|
|
10319
10453
|
import {
|
|
10320
10454
|
HcmClient as HcmClient21,
|
|
10321
10455
|
formatObject as formatObject17,
|
|
10322
|
-
fromAxiosError as
|
|
10456
|
+
fromAxiosError as fromAxiosError25,
|
|
10323
10457
|
uploadDocument as uploadDocument2
|
|
10324
10458
|
} from "@hcmai/sdk";
|
|
10325
10459
|
var DEFAULT_UPLOAD_CATEGORY = "attachment";
|
|
@@ -10360,7 +10494,7 @@ async function uploadCommand(filePath2, args) {
|
|
|
10360
10494
|
} else if (status === 413) {
|
|
10361
10495
|
exitWithError(new Error("\u6587\u4EF6\u8D85\u51FA\u670D\u52A1\u7AEF\u5927\u5C0F\u4E0A\u9650\uFF08413\uFF09"));
|
|
10362
10496
|
} else if (err?.isAxiosError) {
|
|
10363
|
-
exitWithError(
|
|
10497
|
+
exitWithError(fromAxiosError25(err, args.env));
|
|
10364
10498
|
} else {
|
|
10365
10499
|
exitWithError(e);
|
|
10366
10500
|
}
|
|
@@ -10375,7 +10509,7 @@ import {
|
|
|
10375
10509
|
CliError as CliError22,
|
|
10376
10510
|
CliErrorCode as CliErrorCode22,
|
|
10377
10511
|
formatObject as formatObject18,
|
|
10378
|
-
fromAxiosError as
|
|
10512
|
+
fromAxiosError as fromAxiosError26,
|
|
10379
10513
|
packDataPackage,
|
|
10380
10514
|
installDataPackageArtifactAsync,
|
|
10381
10515
|
waitForInstallRun,
|
|
@@ -10559,7 +10693,7 @@ async function datapackageInstallCommand(artifactPath, args) {
|
|
|
10559
10693
|
if (err?.code === "ENOENT") {
|
|
10560
10694
|
exitWithError(new Error(`\u5236\u54C1\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${artifactPath}`));
|
|
10561
10695
|
} else if (err?.isAxiosError) {
|
|
10562
|
-
exitWithError(
|
|
10696
|
+
exitWithError(fromAxiosError26(err, args.env));
|
|
10563
10697
|
} else {
|
|
10564
10698
|
exitWithError(e);
|
|
10565
10699
|
}
|
|
@@ -10597,7 +10731,7 @@ async function datapackageStatusCommand(runId, args) {
|
|
|
10597
10731
|
return;
|
|
10598
10732
|
} catch (e) {
|
|
10599
10733
|
const err = e;
|
|
10600
|
-
if (err?.isAxiosError) exitWithError(
|
|
10734
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError26(err, args.env));
|
|
10601
10735
|
else exitWithError(e);
|
|
10602
10736
|
}
|
|
10603
10737
|
}
|
|
@@ -10623,7 +10757,7 @@ init_auth_guard();
|
|
|
10623
10757
|
import { promises as fs7 } from "fs";
|
|
10624
10758
|
import * as path7 from "path";
|
|
10625
10759
|
import yaml from "js-yaml";
|
|
10626
|
-
import { HcmClient as HcmClient23, fromAxiosError as
|
|
10760
|
+
import { HcmClient as HcmClient23, fromAxiosError as fromAxiosError27, CliError as CliError23, CliErrorCode as CliErrorCode23, stripDefinitionIds, columnSlotsToFlex, redactDescriptiveUuids, removeActionsUsingScripts, stripUnknownFieldKeysForPath } from "@hcmai/sdk";
|
|
10627
10761
|
|
|
10628
10762
|
// src/commands/env-lane-api.ts
|
|
10629
10763
|
function createLaneApi(http2) {
|
|
@@ -11704,7 +11838,7 @@ async function envExportConfigCommand(args) {
|
|
|
11704
11838
|
process.stderr.write(renderNextSteps(outDir, r));
|
|
11705
11839
|
process.exitCode = r.status === "DEGRADED" ? 3 : 0;
|
|
11706
11840
|
} catch (e) {
|
|
11707
|
-
if (e?.isAxiosError) exitWithError(
|
|
11841
|
+
if (e?.isAxiosError) exitWithError(fromAxiosError27(e, args.env));
|
|
11708
11842
|
exitWithError(e);
|
|
11709
11843
|
}
|
|
11710
11844
|
}
|
|
@@ -11755,7 +11889,7 @@ init_auth_guard();
|
|
|
11755
11889
|
import { promises as fs8 } from "fs";
|
|
11756
11890
|
import * as path8 from "path";
|
|
11757
11891
|
import yaml2 from "js-yaml";
|
|
11758
|
-
import { HcmClient as HcmClient24, fromAxiosError as
|
|
11892
|
+
import { HcmClient as HcmClient24, fromAxiosError as fromAxiosError28, CliError as CliError24, CliErrorCode as CliErrorCode24 } from "@hcmai/sdk";
|
|
11759
11893
|
var FINGERPRINT_MODELS = ["Employee", "OrgUnit", "Position", "Assignment"];
|
|
11760
11894
|
var RED_LINE_FIELD_RE = /^(name|shortName|code|fullName|realName|userName|username|idNumber|idNo|certNo|archiveNumber)$|(name|idnumber|idcard|phone|mobile|tel|email|address|contact|remark|description|comment|memo|note|reason|text)$|(creator|updator|updater|operator|modifier|handler|approver|reviewer|auditor)(id|code|no)?$/i;
|
|
11761
11895
|
var OTHER_BUCKET = "_other";
|
|
@@ -12470,7 +12604,7 @@ async function envFingerprintCommand(args) {
|
|
|
12470
12604
|
`);
|
|
12471
12605
|
process.exitCode = exit;
|
|
12472
12606
|
} catch (e) {
|
|
12473
|
-
if (e?.isAxiosError) exitWithError(
|
|
12607
|
+
if (e?.isAxiosError) exitWithError(fromAxiosError28(e, args.env));
|
|
12474
12608
|
exitWithError(e);
|
|
12475
12609
|
}
|
|
12476
12610
|
}
|
|
@@ -12500,7 +12634,7 @@ import {
|
|
|
12500
12634
|
matchSkills,
|
|
12501
12635
|
filterByStage,
|
|
12502
12636
|
formatObject as formatObject21,
|
|
12503
|
-
fromAxiosError as
|
|
12637
|
+
fromAxiosError as fromAxiosError29,
|
|
12504
12638
|
loadGlobalConfig as loadGlobalConfig6,
|
|
12505
12639
|
discoverProjectEnv as discoverProjectEnv3,
|
|
12506
12640
|
resolveEnvContext as resolveEnvContext5,
|
|
@@ -13166,6 +13300,18 @@ async function resolveInstallLayout(args, cwd = process.cwd(), forWrite = false)
|
|
|
13166
13300
|
baseDir: explicitDir ?? (args.global ? path16.join(os3.homedir(), ".claude", "skills") : path16.join(cwd, ".claude", "skills"))
|
|
13167
13301
|
};
|
|
13168
13302
|
}
|
|
13303
|
+
function staleStoredCredential(error) {
|
|
13304
|
+
if (error instanceof CliError31) {
|
|
13305
|
+
if (error.code === CliErrorCode31.TOKEN_EXPIRED) return `\u672C\u5730\u8BB0\u5F55\u5DF2\u8FC7\u671F\uFF08${CliErrorCode31.TOKEN_EXPIRED}\uFF09\uFF0C\u6CA1\u6709\u5411\u670D\u52A1\u7AEF\u6838\u9A8C`;
|
|
13306
|
+
if (error.code === CliErrorCode31.AUTH_FAILED) return `\u672C\u673A\u8BFB\u4E0D\u51FA\u5B83\u7684\u51ED\u636E\uFF08${CliErrorCode31.AUTH_FAILED}\uFF09`;
|
|
13307
|
+
return void 0;
|
|
13308
|
+
}
|
|
13309
|
+
if (axios4.isAxiosError(error) && error.response?.status === 401) {
|
|
13310
|
+
const serverCode = fromAxiosError29(error).context?.responseCode;
|
|
13311
|
+
return `\u88AB\u670D\u52A1\u7AEF\u62D2\u7EDD\uFF08${typeof serverCode === "string" && serverCode ? serverCode : "HTTP 401"}\uFF09`;
|
|
13312
|
+
}
|
|
13313
|
+
return void 0;
|
|
13314
|
+
}
|
|
13169
13315
|
async function createChironHttpClient(endpoint, args, timeoutMs) {
|
|
13170
13316
|
const target = normalizeEndpoint(endpoint);
|
|
13171
13317
|
let accessToken = null;
|
|
@@ -13174,13 +13320,13 @@ async function createChironHttpClient(endpoint, args, timeoutMs) {
|
|
|
13174
13320
|
if (explicitToken && args.endpoint && !project2 && normalizeEndpoint(args.endpoint) === target) {
|
|
13175
13321
|
accessToken = explicitToken;
|
|
13176
13322
|
} else {
|
|
13323
|
+
let envName;
|
|
13324
|
+
let stale;
|
|
13177
13325
|
try {
|
|
13178
13326
|
const resolved = await resolveEnvContext5({ envFlag: args.env, cwd: args.cwd }, process.env, await loadGlobalConfig6());
|
|
13179
13327
|
if (normalizeEndpoint(resolved.config.endpoint) === target) {
|
|
13180
|
-
|
|
13181
|
-
|
|
13182
|
-
{ cwd: args.cwd }
|
|
13183
|
-
);
|
|
13328
|
+
envName = args.env ?? resolved.project?.name ?? resolved.name;
|
|
13329
|
+
const context = await getActiveAuthContextFromCli({ env: envName }, { cwd: args.cwd });
|
|
13184
13330
|
if (normalizeEndpoint(context.endpoint) !== target) {
|
|
13185
13331
|
throw new CliError31({
|
|
13186
13332
|
code: CliErrorCode31.IDENTITY_NOT_IN_ENV,
|
|
@@ -13189,9 +13335,15 @@ async function createChironHttpClient(endpoint, args, timeoutMs) {
|
|
|
13189
13335
|
});
|
|
13190
13336
|
}
|
|
13191
13337
|
accessToken = context.ephemeralAccessToken ?? await TokenStore4.forIdentity(context.identity).getStoredAccessToken();
|
|
13338
|
+
if (!accessToken) stale = `\u672C\u673A\u8BFB\u4E0D\u51FA\u5B83\u7684\u51ED\u636E\uFF08${CliErrorCode31.AUTH_FAILED}\uFF09`;
|
|
13192
13339
|
}
|
|
13193
13340
|
} catch (error) {
|
|
13194
|
-
|
|
13341
|
+
stale = envName === void 0 ? void 0 : staleStoredCredential(error);
|
|
13342
|
+
if (stale === void 0 && !(error instanceof CliError31 && (error.code === CliErrorCode31.NO_ACTIVE_ENV || error.code === CliErrorCode31.ENV_NOT_FOUND || error.code === CliErrorCode31.IDENTITY_NOT_FOUND))) throw error;
|
|
13343
|
+
}
|
|
13344
|
+
if (stale !== void 0) {
|
|
13345
|
+
process.stderr.write(`\u2192 \u73AF\u5883 '${envName}' \u7684\u5DF2\u5B58\u8EAB\u4EFD${stale}\uFF1A\u672C\u6B21\u6309\u533F\u540D\u8BFB\u53D6\u777F\u620E\u6280\u80FD\u76EE\u5F55\u3001\u4E0D\u5E26\u51ED\u636E\uFF08\u65B0\u7248\u670D\u52A1\u7AEF\u76EE\u5F55\u514D\u8BA4\u8BC1\uFF1B\u82E5\u968F\u540E\u62A5 401\uFF0C\u8BF4\u660E\u8BE5\u73AF\u5883\u4ECD\u8981\u6C42\u51ED\u636E\uFF09\uFF1B\u6062\u590D\u767B\u5F55\u6001\uFF1Ahcm login --env ${envName}
|
|
13346
|
+
`);
|
|
13195
13347
|
}
|
|
13196
13348
|
}
|
|
13197
13349
|
const http2 = createHttpClient2({ endpoint: target, getAccessToken: async () => accessToken, onRefresh: async () => {
|
|
@@ -13234,13 +13386,13 @@ function fail6(e, args) {
|
|
|
13234
13386
|
if (err.config?.url) requestPath = new URL(axios4.getUri(err.config), "https://request-path.invalid").pathname;
|
|
13235
13387
|
} catch {
|
|
13236
13388
|
}
|
|
13237
|
-
const traceId =
|
|
13389
|
+
const traceId = fromAxiosError29(err, args.env).traceId;
|
|
13238
13390
|
exitWithError(new Error(
|
|
13239
13391
|
`\u6280\u80FD\u8D44\u6E90\u8BF7\u6C42\u8FD4\u56DE HTTP 404${requestPath ? `\uFF1A${requestPath}` : "\uFF08\u8BF7\u6C42\u8DEF\u5F84\u672A\u77E5\uFF09"}${traceId ? ` [traceId: ${traceId}]` : ""}\u3002
|
|
13240
13392
|
\u4E0B\u4E00\u6B65: \u8FD0\u884C hcm skills list \u6838\u5BF9\u5F53\u524D\u76EE\u5F55\uFF1B\u82E5\u76EE\u5F55\u4ECD\u58F0\u660E\u8BE5\u8D44\u6E90\uFF0C\u8BF7\u68C0\u67E5\u670D\u52A1\u7AEF\u8D44\u6E90\u548C\u5B9E\u4F8B\u7248\u672C\uFF0C\u518D\u91CD\u8BD5\u3002`
|
|
13241
13393
|
));
|
|
13242
13394
|
}
|
|
13243
|
-
if (err?.isAxiosError) exitWithError(
|
|
13395
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError29(err, args.env));
|
|
13244
13396
|
exitWithError(e);
|
|
13245
13397
|
process.exit(1);
|
|
13246
13398
|
}
|
|
@@ -13499,7 +13651,7 @@ var SHOW_CHECK_REQUEST_TIMEOUT_MS = 5e3;
|
|
|
13499
13651
|
var SHOW_CHECK_TOTAL_MS = 8e3;
|
|
13500
13652
|
function uncheckedReason(error, args) {
|
|
13501
13653
|
const err = error;
|
|
13502
|
-
const resolved = err?.isAxiosError ?
|
|
13654
|
+
const resolved = err?.isAxiosError ? fromAxiosError29(err, args.env) : error;
|
|
13503
13655
|
const first = (resolved instanceof Error ? resolved.message : String(resolved)).split("\n")[0].trim();
|
|
13504
13656
|
if (!(resolved instanceof CliError31)) return first || String(resolved);
|
|
13505
13657
|
const reason = typeof resolved.context?.reason === "string" ? `\uFF1A${resolved.context.reason}` : "";
|
|
@@ -15413,7 +15565,7 @@ import {
|
|
|
15413
15565
|
normalizeOrigin as normalizeOrigin4,
|
|
15414
15566
|
createHttpClient as createHttpClient3,
|
|
15415
15567
|
formatObject as formatObject22,
|
|
15416
|
-
fromAxiosError as
|
|
15568
|
+
fromAxiosError as fromAxiosError30,
|
|
15417
15569
|
loadGlobalConfig as loadGlobalConfig7,
|
|
15418
15570
|
resolveEnvContext as resolveEnvContext6,
|
|
15419
15571
|
printResolvedEnvironment as printResolvedEnvironment5,
|
|
@@ -15483,7 +15635,7 @@ PostgreSQL \u6838\u9A8C=${receipt.pgVerified}\uFF1B\u6574\u4F53\u6838\u9A8C=${re
|
|
|
15483
15635
|
process.exitCode = receipt.pgVerified ? 0 : 4;
|
|
15484
15636
|
} catch (error) {
|
|
15485
15637
|
const e = error;
|
|
15486
|
-
const cliError = e?.isAxiosError ?
|
|
15638
|
+
const cliError = e?.isAxiosError ? fromAxiosError30(error, args.env) : error;
|
|
15487
15639
|
if (attempted) {
|
|
15488
15640
|
process.stderr.write(rejectedBeforeExecution(cliError) ? "TENANT_RESET_REJECTED_BEFORE_EXECUTION\uFF1A\u670D\u52A1\u7AEF\u5728\u6267\u884C\u524D\u62D2\u7EDD\u4E86\u672C\u6B21\u8BF7\u6C42\uFF0C\u672A\u53D1\u751F\u91CD\u7F6E\u3001\u6CA1\u6709\u91CD\u7F6E\u6D41\u6C34\uFF1B\u6309\u4E0B\u9762\u7684\u670D\u52A1\u7AEF\u8BF4\u660E\u5904\u7406\u540E\u518D\u91CD\u8BD5\u3002\n" : "TENANT_RESET_RESULT_UNKNOWN\uFF1A\u672C\u6B21\u5DF2\u5C1D\u8BD5\u4E00\u6B21\u91CD\u7F6E\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF1B\u672A\u81EA\u52A8\u91CD\u8BD5\u3002\u4E0D\u8981\u76F2\u76EE\u91CD\u8DD1\uFF0C\u8BF7\u6838\u67E5\u670D\u52A1\u7AEF\u6D41\u6C34\u4E0E\u5F53\u524D\u79DF\u6237\u72B6\u6001\u3002\n");
|
|
15489
15641
|
}
|
|
@@ -15656,7 +15808,7 @@ async function tenantBootstrapCommand(args) {
|
|
|
15656
15808
|
if (err?.response?.status === 403) {
|
|
15657
15809
|
exitWithError(new Error("bootstrap key \u65E0\u6548\uFF08403\uFF09\u2014\u2014 \u6838\u5BF9\u90E8\u7F72\u65B9\u63D0\u4F9B\u7684 key\uFF0C\u52FF\u590D\u7528\u5176\u4ED6\u73AF\u5883\u7684"));
|
|
15658
15810
|
} else if (err?.isAxiosError) {
|
|
15659
|
-
exitWithError(
|
|
15811
|
+
exitWithError(fromAxiosError30(err, args.env));
|
|
15660
15812
|
} else {
|
|
15661
15813
|
exitWithError(e);
|
|
15662
15814
|
}
|
|
@@ -15673,7 +15825,7 @@ import {
|
|
|
15673
15825
|
formatObject as formatObject23,
|
|
15674
15826
|
CliError as CliError33,
|
|
15675
15827
|
CliErrorCode as CliErrorCode33,
|
|
15676
|
-
fromAxiosError as
|
|
15828
|
+
fromAxiosError as fromAxiosError31
|
|
15677
15829
|
} from "@hcmai/sdk";
|
|
15678
15830
|
import axios5 from "axios";
|
|
15679
15831
|
init_exit();
|
|
@@ -15762,7 +15914,7 @@ async function tenantReconcileCommand(args) {
|
|
|
15762
15914
|
...!passed ? { reason: "\u521D\u59CB\u5316\u590D\u9A8C\u672A\u8BC1\u660E\u5F53\u524D\u79DF\u6237\u5168\u90E8\u7EC4\u4EF6\u901A\u8FC7\uFF1B\u8BF7\u8BFB\u53D6\u539F\u59CB report\uFF0C\u4E0D\u80FD\u5BA3\u79F0\u5B8C\u6210\u3002" } : {}
|
|
15763
15915
|
};
|
|
15764
15916
|
} catch (error) {
|
|
15765
|
-
const translated = axios5.isAxiosError(error) ?
|
|
15917
|
+
const translated = axios5.isAxiosError(error) ? fromAxiosError31(error, env2) : error;
|
|
15766
15918
|
verification = { status: "UNDETERMINED", reason: translated instanceof Error ? translated.message : "\u521D\u59CB\u5316\u590D\u9A8C\u5931\u8D25\uFF0C\u539F\u56E0\u672A\u77E5" };
|
|
15767
15919
|
}
|
|
15768
15920
|
}
|
|
@@ -15783,7 +15935,7 @@ async function tenantReconcileCommand(args) {
|
|
|
15783
15935
|
process.exitCode = verification.status === "PASS" ? 0 : 3;
|
|
15784
15936
|
} catch (error) {
|
|
15785
15937
|
if (attempted) process.stderr.write("TENANT_RECONCILE_RESULT_UNKNOWN\uFF1A\u5DF2\u5C1D\u8BD5\u4E00\u6B21\u8865\u8DD1\uFF0C\u7ED3\u679C\u672A\u786E\u8BA4\uFF0C\u672A\u81EA\u52A8\u91CD\u53D1\uFF1B\u5148\u53EA\u8BFB\u68C0\u67E5 tenant.bootstrap \u4E0E\u670D\u52A1\u7AEF\u65E5\u5FD7\uFF0C\u4E0D\u8981\u76F2\u76EE\u91CD\u8DD1\u3002\n");
|
|
15786
|
-
exitWithError(axios5.isAxiosError(error) ?
|
|
15938
|
+
exitWithError(axios5.isAxiosError(error) ? fromAxiosError31(error, args.env) : error);
|
|
15787
15939
|
}
|
|
15788
15940
|
}
|
|
15789
15941
|
|
|
@@ -15794,7 +15946,7 @@ import nodePath from "path";
|
|
|
15794
15946
|
import {
|
|
15795
15947
|
HcmClient as HcmClient27,
|
|
15796
15948
|
formatObject as formatObject24,
|
|
15797
|
-
fromAxiosError as
|
|
15949
|
+
fromAxiosError as fromAxiosError32,
|
|
15798
15950
|
listTenantMeta,
|
|
15799
15951
|
getTenantMeta,
|
|
15800
15952
|
saveTenantMeta,
|
|
@@ -15826,7 +15978,7 @@ function fail7(e, args, mode = "write") {
|
|
|
15826
15978
|
new Error(formatMetaForbiddenMessage(mode))
|
|
15827
15979
|
);
|
|
15828
15980
|
}
|
|
15829
|
-
if (err?.isAxiosError) exitWithError(
|
|
15981
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError32(err, args.env));
|
|
15830
15982
|
exitWithError(e);
|
|
15831
15983
|
process.exit(1);
|
|
15832
15984
|
}
|
|
@@ -16504,14 +16656,14 @@ import {
|
|
|
16504
16656
|
validateMiniProject,
|
|
16505
16657
|
validateMetaContent as validateMetaContent2,
|
|
16506
16658
|
validateWorkspaceFiles,
|
|
16507
|
-
fromAxiosError as
|
|
16659
|
+
fromAxiosError as fromAxiosError34,
|
|
16508
16660
|
CliError as CliError38,
|
|
16509
16661
|
CliErrorCode as CliErrorCode38
|
|
16510
16662
|
} from "@hcmai/sdk";
|
|
16511
16663
|
|
|
16512
16664
|
// src/commands/workspace-push-progress.ts
|
|
16513
16665
|
import { isAxiosError as isAxiosError2 } from "axios";
|
|
16514
|
-
import { CliError as CliError37, CliErrorCode as CliErrorCode37, fromAxiosError as
|
|
16666
|
+
import { CliError as CliError37, CliErrorCode as CliErrorCode37, fromAxiosError as fromAxiosError33 } from "@hcmai/sdk";
|
|
16515
16667
|
var PUSH_DEADLINE_MS = 3e5;
|
|
16516
16668
|
var HEARTBEAT_MS = 1e4;
|
|
16517
16669
|
async function withWorkspacePushProgress(run3, profile) {
|
|
@@ -16582,7 +16734,7 @@ async function withWorkspacePushProgress(run3, profile) {
|
|
|
16582
16734
|
return await Promise.race([operation, deadline]);
|
|
16583
16735
|
} catch (error) {
|
|
16584
16736
|
if (!isAxiosError2(error)) throw error;
|
|
16585
|
-
const translated =
|
|
16737
|
+
const translated = fromAxiosError33(error, profile);
|
|
16586
16738
|
throw new CliError37({
|
|
16587
16739
|
code: translated.code,
|
|
16588
16740
|
message: translated.message,
|
|
@@ -16898,7 +17050,7 @@ function releaseIssueNextStep(issue, deletedPaths) {
|
|
|
16898
17050
|
const data = isRecord(issue.data) ? issue.data : {};
|
|
16899
17051
|
const app = appDirOf(issue.path);
|
|
16900
17052
|
if (data.source === "ACTIVE" && app && deletedPaths.some((p) => p.startsWith(app))) {
|
|
16901
|
-
return "
|
|
17053
|
+
return "\u672C\u6B21\u63A8\u9001\u5220\u6389\u7684\u6587\u4EF6\u4F1A\u968F\u4E0B\u6B21\u53D1\u5E03\u4ECE active \u79FB\u9664\uFF08\u9700 Core \u542B core#947\uFF09\uFF0C\u8FD9\u6761\u95EE\u9898\u51FA\u5728 active \u91CC\u4ECD\u4FDD\u7559\u7684\u6587\u4EF6\u4E0A\uFF1A\u5728\u5F00\u53D1\u7A7A\u95F4\u653E\u4E00\u4EFD\u4FEE\u597D\u7684\u526F\u672C\uFF0C\u6216\u8FDE manifest.json \u4E00\u8D77\u5220\u6389\u6574\u4E2A\u5E94\u7528\uFF1B\u7528 hcm workspace release-plan <version> \u6838\u5BF9\u6700\u7EC8\u89C6\u56FE";
|
|
16902
17054
|
}
|
|
16903
17055
|
if (issue.errCode === "SDK_VERSION_MISMATCH") {
|
|
16904
17056
|
return `\u628A ${issue.path ?? "manifest.json"} \u7684 sdkVersion \u6539\u6210 ${String(data.requiredSdkVersion ?? "\u670D\u52A1\u7AEF\u8981\u6C42\u7684\u7248\u672C\uFF08\u56DE\u6267\u6CA1\u7ED9\uFF09")}\uFF0C\u91CD\u8DD1 hcm workspace verify \u786E\u8BA4\u901A\u8FC7\uFF0C\u518D hcm workspace push`;
|
|
@@ -18053,7 +18205,7 @@ ${formatReleaseIssues(result.preflight.releaseIssues, " ")}` : ""),
|
|
|
18053
18205
|
checkpointSaved
|
|
18054
18206
|
});
|
|
18055
18207
|
} catch (error) {
|
|
18056
|
-
const translated = error?.isAxiosError ?
|
|
18208
|
+
const translated = error?.isAxiosError ? fromAxiosError34(error, args.profile ?? args.context.profile) : error;
|
|
18057
18209
|
const details = translated instanceof CliError38 ? translated.context?.details : void 0;
|
|
18058
18210
|
const commitDetails = details && typeof details === "object" && !Array.isArray(details) ? details : void 0;
|
|
18059
18211
|
const serverCommitted = error?.isAxiosError === true && commitDetails?.workspaceKey === args.context.workspaceKey && commitDetails.relativePath === operation.remotePath && commitDetails.commitState === "COMMITTED";
|
|
@@ -18144,7 +18296,7 @@ async function preflightWorkspacePlan(http2, workspaceKey, operations, localFile
|
|
|
18144
18296
|
}
|
|
18145
18297
|
function preflightCallFailure(error, sent, profile) {
|
|
18146
18298
|
const status = error?.response?.status;
|
|
18147
|
-
const translated = error?.isAxiosError ?
|
|
18299
|
+
const translated = error?.isAxiosError ? fromAxiosError34(error, profile) : error;
|
|
18148
18300
|
const detail = translated instanceof Error ? translated.message : String(translated);
|
|
18149
18301
|
return {
|
|
18150
18302
|
status: "unavailable",
|
|
@@ -18975,7 +19127,7 @@ function exitWorkspaceError(err, profile, operation, format) {
|
|
|
18975
19127
|
return exitWithError(failure2);
|
|
18976
19128
|
};
|
|
18977
19129
|
const maybeAxios = err;
|
|
18978
|
-
const translated = maybeAxios?.isAxiosError ?
|
|
19130
|
+
const translated = maybeAxios?.isAxiosError ? fromAxiosError34(err, profile) : err;
|
|
18979
19131
|
if (translated instanceof CliError38 && operation && translated.context?.status === 409 && ["WORKSPACE_REVISION_CONFLICT", "DEPLOY_IN_PROGRESS"].includes(String(translated.context.responseCode))) {
|
|
18980
19132
|
const scope = `${profile ? ` --env ${quoteWorkspaceArg(profile)}` : ""}${operation.as ? ` --as ${quoteWorkspaceArg(operation.as)}` : ""}`;
|
|
18981
19133
|
const active = "hcm workspace active" + scope + (operation.dir ? ` --dir ${quoteWorkspaceArg(operation.dir)}` : "");
|
|
@@ -19111,7 +19263,7 @@ import {
|
|
|
19111
19263
|
CliErrorCode as CliErrorCode39,
|
|
19112
19264
|
formatObject as formatObject29,
|
|
19113
19265
|
formatRows as formatRows7,
|
|
19114
|
-
fromAxiosError as
|
|
19266
|
+
fromAxiosError as fromAxiosError35,
|
|
19115
19267
|
loadEnv as loadEnv4,
|
|
19116
19268
|
saveEnv as saveEnv3,
|
|
19117
19269
|
loadIdentity as loadIdentity4,
|
|
@@ -19166,7 +19318,7 @@ async function identityShow(name, args) {
|
|
|
19166
19318
|
const details = await inspectIdentity(name);
|
|
19167
19319
|
return exitOk(formatObject29(details, { format: args.output ?? "json" }));
|
|
19168
19320
|
} catch (e) {
|
|
19169
|
-
exitWithError(axios6.isAxiosError(e) ?
|
|
19321
|
+
exitWithError(axios6.isAxiosError(e) ? fromAxiosError35(e, name) : e);
|
|
19170
19322
|
}
|
|
19171
19323
|
}
|
|
19172
19324
|
async function identityList(args) {
|
|
@@ -25295,7 +25447,7 @@ import {
|
|
|
25295
25447
|
ROUND_EXIT_CODES,
|
|
25296
25448
|
computeReconSourceKey,
|
|
25297
25449
|
formatObject as formatObject37,
|
|
25298
|
-
fromAxiosError as
|
|
25450
|
+
fromAxiosError as fromAxiosError36,
|
|
25299
25451
|
httpProbe as httpProbe3,
|
|
25300
25452
|
inspectRound,
|
|
25301
25453
|
renderRound,
|
|
@@ -25317,7 +25469,7 @@ async function deliveryReconCommand(args) {
|
|
|
25317
25469
|
process.stdout.write(formatObject37(summary, { format: args.output ?? "json" }) + "\n");
|
|
25318
25470
|
} catch (e) {
|
|
25319
25471
|
const err = e;
|
|
25320
|
-
if (err?.isAxiosError) exitWithError(
|
|
25472
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError36(err, args.env));
|
|
25321
25473
|
exitWithError(e);
|
|
25322
25474
|
process.exit(1);
|
|
25323
25475
|
}
|
|
@@ -26129,7 +26281,7 @@ import {
|
|
|
26129
26281
|
HcmClient as HcmClient38,
|
|
26130
26282
|
adminResetPassword,
|
|
26131
26283
|
formatObject as formatObject38,
|
|
26132
|
-
fromAxiosError as
|
|
26284
|
+
fromAxiosError as fromAxiosError37,
|
|
26133
26285
|
CliError as CliError53,
|
|
26134
26286
|
CliErrorCode as CliErrorCode52
|
|
26135
26287
|
} from "@hcmai/sdk";
|
|
@@ -26165,7 +26317,7 @@ async function userResetPasswordCommand(args) {
|
|
|
26165
26317
|
process.stdout.write(formatObject38(result, { format: args.output ?? "json" }) + "\n");
|
|
26166
26318
|
} catch (cause) {
|
|
26167
26319
|
const err = cause;
|
|
26168
|
-
if (err?.isAxiosError) exitWithError(
|
|
26320
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError37(err, args.env));
|
|
26169
26321
|
exitWithError(cause);
|
|
26170
26322
|
}
|
|
26171
26323
|
}
|
|
@@ -26189,7 +26341,7 @@ import {
|
|
|
26189
26341
|
CliErrorCode as CliErrorCode54,
|
|
26190
26342
|
HcmClient as HcmClient39,
|
|
26191
26343
|
formatObject as formatObject40,
|
|
26192
|
-
fromAxiosError as
|
|
26344
|
+
fromAxiosError as fromAxiosError38
|
|
26193
26345
|
} from "@hcmai/sdk";
|
|
26194
26346
|
|
|
26195
26347
|
// src/commands/models-search.ts
|
|
@@ -26396,7 +26548,7 @@ async function modelsCommand(keyword, args) {
|
|
|
26396
26548
|
return;
|
|
26397
26549
|
} catch (e) {
|
|
26398
26550
|
const err = e;
|
|
26399
|
-
if (err?.isAxiosError) exitWithError(
|
|
26551
|
+
if (err?.isAxiosError) exitWithError(fromAxiosError38(err, args.env ?? args.profile));
|
|
26400
26552
|
exitWithError(e);
|
|
26401
26553
|
}
|
|
26402
26554
|
}
|
|
@@ -26416,7 +26568,7 @@ import {
|
|
|
26416
26568
|
classifyEndpointFailure as classifyEndpointFailure2,
|
|
26417
26569
|
fetchIntrospection,
|
|
26418
26570
|
formatObject as formatObject41,
|
|
26419
|
-
fromAxiosError as
|
|
26571
|
+
fromAxiosError as fromAxiosError39,
|
|
26420
26572
|
missingKeys as missingKeys3
|
|
26421
26573
|
} from "@hcmai/sdk";
|
|
26422
26574
|
function parseLimit2(raw) {
|
|
@@ -26544,7 +26696,7 @@ function handleError(e, args, capability) {
|
|
|
26544
26696
|
context: { nextStep: NOT_PROVIDED_NEXT_STEP2 }
|
|
26545
26697
|
}));
|
|
26546
26698
|
}
|
|
26547
|
-
const ce =
|
|
26699
|
+
const ce = fromAxiosError39(err, args.env);
|
|
26548
26700
|
const body = err.response?.data?.error;
|
|
26549
26701
|
if (capability !== void 0 && body?.code === "INTROSPECTION_PATH_NOT_FOUND") {
|
|
26550
26702
|
const available = body?.details?.availablePaths;
|
|
@@ -26606,7 +26758,7 @@ import {
|
|
|
26606
26758
|
classifyEndpointFailure as classifyEndpointFailure3,
|
|
26607
26759
|
fetchPresetOrigin,
|
|
26608
26760
|
formatObject as formatObject42,
|
|
26609
|
-
fromAxiosError as
|
|
26761
|
+
fromAxiosError as fromAxiosError40,
|
|
26610
26762
|
isUuid
|
|
26611
26763
|
} from "@hcmai/sdk";
|
|
26612
26764
|
var ORIGIN_MEANING = {
|
|
@@ -26737,7 +26889,7 @@ async function presetOriginCommand(model, args) {
|
|
|
26737
26889
|
context: { nextStep: NOT_PROVIDED_NEXT_STEP3 }
|
|
26738
26890
|
}));
|
|
26739
26891
|
}
|
|
26740
|
-
exitWithError(
|
|
26892
|
+
exitWithError(fromAxiosError40(err, args.env));
|
|
26741
26893
|
}
|
|
26742
26894
|
}
|
|
26743
26895
|
|
|
@@ -30386,7 +30538,7 @@ program.command("describe <Model>").description("\u67E5\u770B Model \u5143\u6570
|
|
|
30386
30538
|
program.command("preset-origin <Model>").description("\u9884\u7F6E\u6A21\u578B\u7684\u884C\u6765\u6E90\uFF1A\u8981\u6539\u7684\u90A3\u4E00\u884C\u662F\u5E73\u53F0\u57FA\u7EBF\u3001\u79DF\u6237\u8986\u76D6\u8FD8\u662F\u79DF\u6237\u81EA\u5DF1\u5EFA\u7684\uFF08\u53EA\u8BFB\uFF09").option("--id <canonicalId>", "\u95EE\u67D0\u4E00\u884C\uFF08UUID\uFF09\u843D\u5728\u54EA\u4E00\u4FA7\u3001resetToDefault \u7ED3\u6784\u4E0A\u9002\u4E0D\u9002\u7528").option("--include-tenant-ids", "\u4E00\u6B21\u62FF\u5168\u79DF\u6237\u8986\u76D6 / \u79DF\u6237\u539F\u521B\u90A3\u51E0\u884C\u7684 id\uFF0C\u5E76\u4E0E\u8BA1\u6570\u5BF9\u8D26").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((m, opts) => presetOriginCommand(m, opts));
|
|
30387
30539
|
var interactions = program.command("interactions").description("\u770B\u89C1\u5E76\u5904\u7406\u4F1A\u8BDD\u91CC\u672A\u51B3\u7684\u6682\u505C\uFF08\u786E\u8BA4 / \u8FFD\u95EE\uFF09\u2014\u2014\u4E0D\u53D1\u65B0\u6D88\u606F\uFF0C\u76F4\u63A5\u56DE\u5230\u90A3\u4E00\u6761");
|
|
30388
30540
|
var withInteractionCommonOpts = (cmd) => {
|
|
30389
|
-
cmd.option("--conversation <id>", "\u76EE\u6807\u4F1A\u8BDD\uFF1B\u4E0D\u4F20\u5219\u7528\u672C env \u4E0A\u4E00\u6B21\u804A\u7684\u90A3\u4E2A").option("--agent <
|
|
30541
|
+
cmd.option("--conversation <id>", "\u76EE\u6807\u4F1A\u8BDD\uFF1B\u4E0D\u4F20\u5219\u7528\u672C env \u4E0A\u4E00\u6B21\u804A\u7684\u90A3\u4E2A").option("--agent <keyOrId>", "\u6570\u5B57\u5458\u5DE5 agentKey\uFF08\u5982 moirai\uFF09\u6216 UUID\uFF1B\u9ED8\u8BA4\u5185\u7F6E\u58A8\u777F").option("--env <name>", "\u672C\u6B21\u4F7F\u7528\u7684\u9879\u76EE\u73AF\u5883\u540D\u6216\u672C\u673A\u69FD\u540D").option("--as <identity>", "\u4E34\u65F6\u6362\u8EAB\u4EFD\uFF08\u8986\u76D6 env defaultIdentity\uFF0C\u672C\u6B21\u547D\u4EE4\uFF09").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atext | json", "text");
|
|
30390
30542
|
return cmd;
|
|
30391
30543
|
};
|
|
30392
30544
|
withInteractionCommonOpts(
|
|
@@ -30401,7 +30553,7 @@ withInteractionCommonOpts(
|
|
|
30401
30553
|
withInteractionCommonOpts(
|
|
30402
30554
|
interactions.command("answer <interactionId>").description("\u56DE\u7B54\u4E00\u6761\u8FFD\u95EE\uFF08ASK\uFF09").option("--answer <text>", "\u7B54\u6848\u6587\u672C\uFF08\u5FC5\u586B\uFF09").option("--choice <index>", "\u9009\u9879\u4E0B\u6807\uFF0C\u4ECE 0 \u8D77\uFF1B\u53EA\u4F5C\u8865\u5145\uFF0C\u4E0D\u80FD\u66FF\u4EE3 --answer").option("--timeout <sec>", "\u7B49\u7EC8\u6001\u7684\u79D2\u6570", "180")
|
|
30403
30555
|
).action((id, opts) => interactionsRespondCommand("answer", id, opts));
|
|
30404
|
-
program.command("chat [prompt]").description("\u4E0E\u6570\u5B57\u5458\u5DE5 Moirai \u5BF9\u8BDD\uFF1B\u6709 prompt \u5355\u53D1\u540E\u9000\u51FA\uFF0C\u4E0D\u5E26 prompt \u8FDB\u5165 REPL").option("--agent <
|
|
30556
|
+
program.command("chat [prompt]").description("\u4E0E\u6570\u5B57\u5458\u5DE5 Moirai \u5BF9\u8BDD\uFF1B\u6709 prompt \u5355\u53D1\u540E\u9000\u51FA\uFF0C\u4E0D\u5E26 prompt \u8FDB\u5165 REPL").option("--agent <keyOrId>", "\u6570\u5B57\u5458\u5DE5 agentKey\uFF08\u5982 moirai\uFF09\u6216 UUID\uFF1B\u9ED8\u8BA4\u5185\u7F6E\u58A8\u777F\u3002\u67E5\u53EF\u7528\u7684\uFF1Ahcm query AIAgentModel --fields id,agentKey,agentName").option("--resume <id>", "\u7EED\u63A5\u6307\u5B9A conversation\uFF1B\u4E0D\u4F20\u5219\u9ED8\u8BA4\u5F00\u65B0\u4F1A\u8BDD").option("--conversation <id>", "[deprecated] \u7528 --resume \u66FF\u4EE3\uFF1B\u4F20 NEW \u7B49\u4EF7\u9ED8\u8BA4\u65B0\u4F1A\u8BDD").option("--list", "\u5217\u51FA\u6700\u8FD1\u4F1A\u8BDD\uFF0C\u4E0D\u8FDB\u5165\u804A\u5929").option(
|
|
30405
30557
|
"--events [conversationId]",
|
|
30406
30558
|
"\u53EA\u8BFB\u67E5\u770B\u6307\u5B9A conversation \u7684 timeline/event \u6D41\uFF1B\u4E5F\u53EF\u914D --resume <id>"
|
|
30407
30559
|
).option("--limit <N>", "\u914D\u5408 --list\uFF1A\u663E\u793A\u6700\u8FD1 N \u6761\u4F1A\u8BDD", "10").option("--stream", "\u6D41\u5F0F\u8F93\u51FA\uFF08\u9ED8\u8BA4\u5F00\u542F\uFF0C\u9010 token \u6253\u5370 + thinking/tools \u5B9E\u65F6\u663E\u793A\uFF09", true).option("--no-stream", "\u5173\u95ED\u6D41\u5F0F\uFF0C\u7B49 LLM \u5168\u6587\u8FD4\u56DE\u540E\u4E00\u6B21\u6027\u663E\u793A\uFF08CI / \u811A\u672C\u7BA1\u9053\u573A\u666F\uFF09").option(
|