@hcmai/cli 0.37.1 → 0.37.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 +194 -76
- package/dist/index.js.map +1 -1
- package/dist/skills/manifest.json +1 -1
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -8523,37 +8523,109 @@ init_auth_guard();
|
|
|
8523
8523
|
async function client(args) {
|
|
8524
8524
|
return HcmClient9.fromAuthContext(await getActiveAuthContextFromCli(args));
|
|
8525
8525
|
}
|
|
8526
|
-
function fail2(e, args) {
|
|
8526
|
+
function fail2(e, args, domain) {
|
|
8527
8527
|
const err = e;
|
|
8528
|
-
if (err?.
|
|
8529
|
-
|
|
8528
|
+
if (err?.isAxiosError) {
|
|
8529
|
+
const ce = fromAxiosError11(err, args.env);
|
|
8530
|
+
const code2 = ce.context?.responseCode;
|
|
8531
|
+
const rewrap = (message, extra) => new CliError19({
|
|
8532
|
+
code: ce.code,
|
|
8533
|
+
message,
|
|
8534
|
+
traceId: ce.traceId,
|
|
8535
|
+
profile: ce.profile,
|
|
8536
|
+
cause: ce.cause,
|
|
8537
|
+
context: { ...ce.context, ...extra }
|
|
8538
|
+
});
|
|
8539
|
+
if (err.response?.status === 404) {
|
|
8540
|
+
exitWithError(rewrap(`\u6CA1\u6709\u53C2\u6570\u57DF ${domain ?? ""}\uFF08\u540E\u7AEF 404\uFF09`, {
|
|
8541
|
+
nextStep: `\u6838\u5BF9\u57DF\u540D\u62FC\u5199\u540E\u91CD\u8DD1 hcm setting get <\u57DF>${connFlags(args)}\uFF1B\u5E38\u89C1\u57DF\uFF1Asecurity / feature / integration / ai / time / share / hr`
|
|
8542
|
+
}));
|
|
8543
|
+
}
|
|
8544
|
+
if (code2 === "REVISION_CONFLICT" || code2 === "REVISION_REQUIRED") {
|
|
8545
|
+
exitWithError(rewrap(ce.message, {
|
|
8546
|
+
localDiagnosis: "\u8BE5\u9879\u7684\u7248\u672C\u5DF2\u53D8\uFF08\u88AB\u4ED6\u4EBA\u4FEE\u6539\u6216\u6062\u590D\u9ED8\u8BA4\uFF09\uFF0C\u672C\u6B21\u672A\u5199\u5165",
|
|
8547
|
+
nextStep: args.revision !== void 0 ? `\u91CD\u8DD1 hcm setting get ${domain ?? "<\u57DF>"}${connFlags(args)} \u6838\u5BF9\u73B0\u503C\uFF1B\u786E\u8BA4\u4ECD\u8981\u6E05\u9664\u5C31\u53BB\u6389 --revision \u91CD\u8DD1\uFF08\u4F1A\u81EA\u52A8\u8BFB\u5F53\u524D\u7248\u672C\uFF09\uFF0C\u6216\u6362\u6210 get \u91CC\u7684\u65B0 revision` : `\u91CD\u8DD1 hcm setting get ${domain ?? "<\u57DF>"}${connFlags(args)} \u6838\u5BF9\u73B0\u503C\u4E0E revision\uFF0C\u786E\u8BA4\u4ECD\u8981\u6539\u518D\u91CD\u8DD1\u539F\u547D\u4EE4`
|
|
8548
|
+
}));
|
|
8549
|
+
}
|
|
8550
|
+
exitWithError(ce);
|
|
8530
8551
|
}
|
|
8531
|
-
if (err?.isAxiosError) exitWithError(fromAxiosError11(err, args.env));
|
|
8532
8552
|
exitWithError(e);
|
|
8533
8553
|
process.exit(1);
|
|
8534
8554
|
}
|
|
8555
|
+
function display(v) {
|
|
8556
|
+
if (v === void 0 || v === null) return "";
|
|
8557
|
+
return typeof v === "object" ? JSON.stringify(v) : v;
|
|
8558
|
+
}
|
|
8559
|
+
function shownValue(i) {
|
|
8560
|
+
if (i.credentialName || i.credentialType) {
|
|
8561
|
+
return `${i.credentialName ?? i.credentialId ?? ""}${i.credentialType ? ` (${i.credentialType})` : ""}`;
|
|
8562
|
+
}
|
|
8563
|
+
if (i.credentialId) return `${i.credentialId} (\u51ED\u636E\u6458\u8981\u8BFB\u4E0D\u5230\uFF1A\u5DF2\u5220\u9664\u6216\u65E0\u6743\u8BFB\u53D6)`;
|
|
8564
|
+
return display(i.currentValue);
|
|
8565
|
+
}
|
|
8566
|
+
function note(i) {
|
|
8567
|
+
const parts = [];
|
|
8568
|
+
if (i.invalid) parts.push("invalid");
|
|
8569
|
+
if (i.degraded) parts.push("degraded");
|
|
8570
|
+
if (i.reason) parts.push(String(i.reason));
|
|
8571
|
+
if (i.effective === false) parts.push(`\u672A\u751F\u6548${i.ineffectiveReason ? `: ${i.ineffectiveReason}` : ""}`);
|
|
8572
|
+
return parts.join("; ");
|
|
8573
|
+
}
|
|
8574
|
+
function formatSettingRows(items) {
|
|
8575
|
+
return items.map((i) => ({
|
|
8576
|
+
group: i.group,
|
|
8577
|
+
namespace: i.namespace,
|
|
8578
|
+
key: i.settingKey,
|
|
8579
|
+
name: i.name ?? "",
|
|
8580
|
+
value: shownValue(i),
|
|
8581
|
+
default: display(i.defaultValue),
|
|
8582
|
+
overridden: i.isDefault ? "" : "yes",
|
|
8583
|
+
revision: i.revision ?? ""
|
|
8584
|
+
}));
|
|
8585
|
+
}
|
|
8586
|
+
function formatSettingNotes(items) {
|
|
8587
|
+
return items.flatMap((i) => {
|
|
8588
|
+
const text2 = note(i);
|
|
8589
|
+
return text2 ? [`\u26A0\uFE0F ${i.namespace}.${i.settingKey}: ${text2}`] : [];
|
|
8590
|
+
});
|
|
8591
|
+
}
|
|
8535
8592
|
async function settingGetCommand(domain, args) {
|
|
8536
8593
|
try {
|
|
8537
8594
|
const c2 = await client(args);
|
|
8538
8595
|
const { items } = await getSettingDomain(c2.raw(), domain);
|
|
8539
8596
|
const fmt = args.output ?? "table";
|
|
8540
8597
|
if (fmt === "table") {
|
|
8541
|
-
|
|
8542
|
-
|
|
8543
|
-
key: i.settingKey,
|
|
8544
|
-
value: i.value ?? i.defaultValue,
|
|
8545
|
-
overridden: i.value !== void 0 && i.value !== null ? "yes" : "",
|
|
8546
|
-
revision: i.revision ?? ""
|
|
8547
|
-
}));
|
|
8548
|
-
process.stdout.write(formatRows2(rows2, { format: "table" }) + "\n");
|
|
8598
|
+
process.stdout.write(formatRows2(formatSettingRows(items), { format: "table" }) + "\n");
|
|
8599
|
+
for (const line of formatSettingNotes(items)) process.stdout.write(line + "\n");
|
|
8549
8600
|
} else {
|
|
8550
8601
|
process.stdout.write(formatObject7(items, { format: fmt }) + "\n");
|
|
8551
8602
|
}
|
|
8552
8603
|
process.exitCode = 0;
|
|
8553
8604
|
return;
|
|
8554
8605
|
} catch (e) {
|
|
8555
|
-
fail2(e, args);
|
|
8606
|
+
fail2(e, args, domain);
|
|
8607
|
+
}
|
|
8608
|
+
}
|
|
8609
|
+
function attachRevisions(domain, writes, current, args) {
|
|
8610
|
+
const byKey = new Map(current.map((i) => [`${i.namespace}.${i.settingKey}`, i]));
|
|
8611
|
+
const missing2 = writes.filter((w) => !byKey.has(`${w.namespace}.${w.settingKey}`));
|
|
8612
|
+
if (missing2.length) {
|
|
8613
|
+
throw new CliError19({
|
|
8614
|
+
code: CliErrorCode17.INVALID_ARGUMENT,
|
|
8615
|
+
message: `\u57DF ${domain} \u91CC\u6CA1\u6709 ${missing2.map((w) => `${w.namespace}.${w.settingKey}`).join(", ")}\uFF1B\u672A\u5199\u5165\u4EFB\u4F55\u9879`,
|
|
8616
|
+
context: {
|
|
8617
|
+
details: { availableSettings: [...byKey.keys()] },
|
|
8618
|
+
nextStep: `hcm setting get ${domain}${connFlags(args)} \u770B\u672C\u57DF\u53EF\u5199\u7684\u952E\uFF08namespace.key\uFF09`
|
|
8619
|
+
}
|
|
8620
|
+
});
|
|
8556
8621
|
}
|
|
8622
|
+
return writes.map((w) => {
|
|
8623
|
+
const revision = byKey.get(`${w.namespace}.${w.settingKey}`).revision;
|
|
8624
|
+
return revision === null || revision === void 0 ? w : { ...w, revision };
|
|
8625
|
+
});
|
|
8626
|
+
}
|
|
8627
|
+
function connFlags(args) {
|
|
8628
|
+
return (args.env ? ` --env ${args.env}` : "") + (args.as ? ` --as ${args.as}` : "");
|
|
8557
8629
|
}
|
|
8558
8630
|
async function settingSetCommand(domain, args) {
|
|
8559
8631
|
try {
|
|
@@ -8570,6 +8642,14 @@ async function settingSetCommand(domain, args) {
|
|
|
8570
8642
|
} catch (e) {
|
|
8571
8643
|
throw new CliError19({ code: CliErrorCode17.INVALID_ARGUMENT, message: e.message });
|
|
8572
8644
|
}
|
|
8645
|
+
const keys = items.map((w) => `${w.namespace}.${w.settingKey}`);
|
|
8646
|
+
const dup = [...new Set(keys.filter((k, i) => keys.indexOf(k) !== i))];
|
|
8647
|
+
if (dup.length) {
|
|
8648
|
+
throw new CliError19({
|
|
8649
|
+
code: CliErrorCode17.INVALID_ARGUMENT,
|
|
8650
|
+
message: `--set \u91CC ${dup.join(", ")} \u7ED9\u4E86\u4E0D\u6B62\u4E00\u6B21\uFF1B\u540C\u4E00\u9879\u4E00\u6B21\u53EA\u80FD\u5199\u4E00\u4E2A\u503C\uFF0C\u672A\u5199\u5165\u4EFB\u4F55\u9879`
|
|
8651
|
+
});
|
|
8652
|
+
}
|
|
8573
8653
|
if (args.dryRun) {
|
|
8574
8654
|
process.stdout.write(`[dry-run] \u5C06\u5728\u57DF ${domain} \u5199\u5165 ${items.length} \u9879\uFF0C\u672A\u5B9E\u9645\u5199\u5165\uFF1A
|
|
8575
8655
|
`);
|
|
@@ -8579,7 +8659,17 @@ async function settingSetCommand(domain, args) {
|
|
|
8579
8659
|
return;
|
|
8580
8660
|
}
|
|
8581
8661
|
const c2 = await client(args);
|
|
8582
|
-
const
|
|
8662
|
+
const { items: current } = await getSettingDomain(c2.raw(), domain);
|
|
8663
|
+
const withRevision = attachRevisions(domain, items, current, args);
|
|
8664
|
+
const result = await patchSettingDomain(c2.raw(), domain, withRevision);
|
|
8665
|
+
const before = new Map(current.map((i) => [`${i.namespace}.${i.settingKey}`, i]));
|
|
8666
|
+
for (const w of items) {
|
|
8667
|
+
const k = `${w.namespace}.${w.settingKey}`;
|
|
8668
|
+
const old = before.get(k);
|
|
8669
|
+
const was = old.isDefault ? "\u539F\u4E3A\u9ED8\u8BA4\u503C" : `\u8986\u76D6\u4E86 revision ${old.revision} \u7684\u79DF\u6237\u503C`;
|
|
8670
|
+
process.stderr.write(` ${k}: ${String(shownValue(old))} \u2192 ${String(w.value)}\uFF08${was}\uFF09
|
|
8671
|
+
`);
|
|
8672
|
+
}
|
|
8583
8673
|
const fmt = args.output ?? "json";
|
|
8584
8674
|
if (fmt !== "json") process.stdout.write(`\u2705 ${domain} \u5DF2\u66F4\u65B0 ${items.length} \u9879
|
|
8585
8675
|
`);
|
|
@@ -8587,11 +8677,18 @@ async function settingSetCommand(domain, args) {
|
|
|
8587
8677
|
process.exitCode = 0;
|
|
8588
8678
|
return;
|
|
8589
8679
|
} catch (e) {
|
|
8590
|
-
fail2(e, args);
|
|
8680
|
+
fail2(e, args, domain);
|
|
8591
8681
|
}
|
|
8592
8682
|
}
|
|
8593
8683
|
async function settingResetCommand(domain, namespace, key2, args) {
|
|
8594
8684
|
try {
|
|
8685
|
+
let givenRevision;
|
|
8686
|
+
if (args.revision !== void 0) {
|
|
8687
|
+
givenRevision = /^\d+$/.test(args.revision) ? Number(args.revision) : NaN;
|
|
8688
|
+
if (!Number.isSafeInteger(givenRevision)) {
|
|
8689
|
+
throw new CliError19({ code: CliErrorCode17.INVALID_ARGUMENT, message: `--revision \u9700\u8981\u975E\u8D1F\u6574\u6570\uFF0C\u6536\u5230 "${args.revision}"\uFF1B\u672A\u6E05\u9664\u3001\u672A\u53D1\u9001\u8BF7\u6C42` });
|
|
8690
|
+
}
|
|
8691
|
+
}
|
|
8595
8692
|
if (!args.yes) {
|
|
8596
8693
|
const conn = (args.revision !== void 0 ? ` --revision ${args.revision}` : "") + (args.env ? ` --env ${args.env}` : "") + (args.as ? ` --as ${args.as}` : "");
|
|
8597
8694
|
requireTerminalForPrompt(
|
|
@@ -8605,16 +8702,28 @@ async function settingResetCommand(domain, namespace, key2, args) {
|
|
|
8605
8702
|
}
|
|
8606
8703
|
}
|
|
8607
8704
|
const c2 = await client(args);
|
|
8608
|
-
const revision = args.revision === void 0 ? void 0 : Number(args.revision);
|
|
8609
|
-
const result = await resetSettingItem(c2.raw(), domain, namespace, key2, revision);
|
|
8610
8705
|
const fmt = args.output ?? "json";
|
|
8706
|
+
let revision = givenRevision;
|
|
8707
|
+
if (revision === void 0) {
|
|
8708
|
+
const { items: current } = await getSettingDomain(c2.raw(), domain);
|
|
8709
|
+
revision = attachRevisions(domain, [{ namespace, settingKey: key2, value: null }], current, args)[0]?.revision;
|
|
8710
|
+
const cur = current.find((i) => i.namespace === namespace && i.settingKey === key2);
|
|
8711
|
+
if (cur.isDefault) {
|
|
8712
|
+
process.stderr.write(`\u2139\uFE0F ${namespace}.${key2} \u672C\u6765\u5C31\u6CA1\u6709\u79DF\u6237\u8986\u76D6\uFF08\u751F\u6548\u7684\u5C31\u662F\u9ED8\u8BA4\u503C\uFF09\uFF0C\u672A\u6539\u52A8\u3001\u672A\u53D1\u9001\u6E05\u9664\u8BF7\u6C42
|
|
8713
|
+
`);
|
|
8714
|
+
process.stdout.write(formatObject7({ changed: false, reason: "NO_TENANT_OVERRIDE", namespace, settingKey: key2 }, { format: fmt }) + "\n");
|
|
8715
|
+
process.exitCode = 0;
|
|
8716
|
+
return;
|
|
8717
|
+
}
|
|
8718
|
+
}
|
|
8719
|
+
const result = await resetSettingItem(c2.raw(), domain, namespace, key2, revision);
|
|
8611
8720
|
if (fmt !== "json") process.stdout.write(`\u2705 ${namespace}.${key2} \u5DF2\u56DE\u843D\u5230\u9ED8\u8BA4\u503C
|
|
8612
8721
|
`);
|
|
8613
8722
|
process.stdout.write(formatObject7(result, { format: fmt }) + "\n");
|
|
8614
8723
|
process.exitCode = 0;
|
|
8615
8724
|
return;
|
|
8616
8725
|
} catch (e) {
|
|
8617
|
-
fail2(e, args);
|
|
8726
|
+
fail2(e, args, domain);
|
|
8618
8727
|
}
|
|
8619
8728
|
}
|
|
8620
8729
|
|
|
@@ -9146,6 +9255,10 @@ function formatDescriptionTable(desc, verbose = false) {
|
|
|
9146
9255
|
` ${a.name.padEnd(20)} ${call.padEnd(12)} ${a.label ?? ""}${source} ${actionTags(desc, a, verbose)}${params}${description}`
|
|
9147
9256
|
);
|
|
9148
9257
|
if (verbose) lines.push(...verificationDetail(a));
|
|
9258
|
+
for (const p of a.params ?? []) {
|
|
9259
|
+
const text2 = p.description?.replace(/\s+/g, " ").trim();
|
|
9260
|
+
if (text2) lines.push(` ${p.name}: ${text2}`);
|
|
9261
|
+
}
|
|
9149
9262
|
}
|
|
9150
9263
|
if (!desc.effectiveActionsAvailable) {
|
|
9151
9264
|
lines.push(
|
|
@@ -9203,8 +9316,8 @@ function candidateItem(c2) {
|
|
|
9203
9316
|
const cand = c2;
|
|
9204
9317
|
const where = [cand.source, cand.scope].map((v) => typeof v === "string" && v ? v : "?").join("/");
|
|
9205
9318
|
const cdecl = cand.verification === void 0 ? void 0 : readVerificationCell(cand.verification);
|
|
9206
|
-
const
|
|
9207
|
-
return `${where} effect=${shown(cand.effect, false)} verify=${verifyValue(cand.verification)}${
|
|
9319
|
+
const note2 = cdecl?.kind === "declared" && cdecl.note ? `\uFF08${cdecl.note}\uFF09` : "";
|
|
9320
|
+
return `${where} effect=${shown(cand.effect, false)} verify=${verifyValue(cand.verification)}${note2}`;
|
|
9208
9321
|
}
|
|
9209
9322
|
function candidateVerifyValues(a) {
|
|
9210
9323
|
const candidates = a.candidates ?? [];
|
|
@@ -14342,8 +14455,8 @@ async function listInstalledSkills(keyword, args, cwd = process.cwd()) {
|
|
|
14342
14455
|
`);
|
|
14343
14456
|
for (const row of group) {
|
|
14344
14457
|
const mark = row.status === "missing" ? "?" : row.status === "locally-modified" ? "!" : row.direct ? "\u25CF" : "\u25CB";
|
|
14345
|
-
const
|
|
14346
|
-
process.stdout.write(` ${mark} ${row.id.padEnd(30)} ${row.title.padEnd(24)} ${
|
|
14458
|
+
const note2 = row.status === "missing" ? "\u6587\u4EF6\u4E0D\u89C1\u4E86\uFF08hcm chiron skills sync \u4F1A\u88C5\u56DE\uFF09" : row.status === "locally-modified" ? "\u672C\u5730\u6539\u8FC7" : row.direct ? "" : "\u4F9D\u8D56\u5E26\u5165";
|
|
14459
|
+
process.stdout.write(` ${mark} ${row.id.padEnd(30)} ${row.title.padEnd(24)} ${note2}
|
|
14347
14460
|
`);
|
|
14348
14461
|
}
|
|
14349
14462
|
process.stdout.write("\n");
|
|
@@ -15708,9 +15821,9 @@ async function planSkillUpdate(options) {
|
|
|
15708
15821
|
continue;
|
|
15709
15822
|
}
|
|
15710
15823
|
const installed2 = state.skills[rawId] !== void 0;
|
|
15711
|
-
const
|
|
15712
|
-
if (existing) existing.note =
|
|
15713
|
-
else entries.push({ id: rawId, status: "not-checked", note });
|
|
15824
|
+
const note2 = (dependents ? `${dependents}\u777F\u620E\u6280\u80FD ${rawId}\uFF0C` : `\u777F\u620E\u6280\u80FD ${rawId}\uFF1A`) + "\u4F46\u8FD9\u4E00\u8D9F\u6CA1\u8FDE\u7F51\u53D6\u777F\u620E\u76EE\u5F55\uFF08--source cli\uFF09\uFF0C\u8FD9\u4EFD\u4F9D\u8D56\u6CA1\u6709\u89E3\u6790\u3001\u4E5F\u6CA1\u6838\u5BF9\u662F\u4E0D\u662F\u6700\u65B0" + (installed2 ? "" : "\uFF1B\u672C\u5730\u4E5F\u6CA1\u88C5\u5B83\u2014\u2014\u4F9D\u8D56\u5B83\u7684\u6280\u80FD\u6B63\u6587\u4F1A\u6307\u5411\u4E00\u4EFD\u4E0D\u5728\u76D8\u4E0A\u7684\u6280\u80FD") + "\u3002\u8054\u7F51\u540E\u91CD\u8DD1 hcm chiron skills sync";
|
|
15825
|
+
if (existing) existing.note = note2;
|
|
15826
|
+
else entries.push({ id: rawId, status: "not-checked", note: note2 });
|
|
15714
15827
|
continue;
|
|
15715
15828
|
}
|
|
15716
15829
|
const id = resolveRenamedId(rawId, catalog.chiron);
|
|
@@ -16756,7 +16869,7 @@ function parseMetaPath(path50) {
|
|
|
16756
16869
|
const parts = base.replace(/\.(yml|yaml)$/i, "").split(".");
|
|
16757
16870
|
return { model: parts[0] || void 0, kind: parts[1] ?? "model", state: parts[2] };
|
|
16758
16871
|
}
|
|
16759
|
-
function
|
|
16872
|
+
function connFlags2(args) {
|
|
16760
16873
|
return (args.env ? ` --env ${args.env}` : "") + (args.as ? ` --as ${args.as}` : "");
|
|
16761
16874
|
}
|
|
16762
16875
|
function unverifiableReason(e) {
|
|
@@ -16899,10 +17012,10 @@ ${content}
|
|
|
16899
17012
|
if (fmt !== "json") process.stdout.write(`\u2705 \u5DF2\u5199\u5165 ${path50}
|
|
16900
17013
|
`);
|
|
16901
17014
|
const restoreHint = backupState === "saved" && backupFile ? ` \u65E7\u5185\u5BB9\u5DF2\u5B58\uFF1A${backupFile}
|
|
16902
|
-
\u653E\u56DE\u53BB\uFF1Ahcm meta set ${path50} --file ${backupFile}${
|
|
16903
|
-
` : backupState === "absent" ? ` \u8FD9\u4E00\u5C42\u6B64\u524D\u6CA1\u6709\u8986\u76D6\uFF08\u5DF2\u8BC1\u5B9E\uFF09\uFF0C\u6062\u590D\u5373\u5220\u9664\uFF1Ahcm meta delete ${path50}${
|
|
17015
|
+
\u653E\u56DE\u53BB\uFF1Ahcm meta set ${path50} --file ${backupFile}${connFlags2(args)}
|
|
17016
|
+
` : backupState === "absent" ? ` \u8FD9\u4E00\u5C42\u6B64\u524D\u6CA1\u6709\u8986\u76D6\uFF08\u5DF2\u8BC1\u5B9E\uFF09\uFF0C\u6062\u590D\u5373\u5220\u9664\uFF1Ahcm meta delete ${path50}${connFlags2(args)}
|
|
16904
17017
|
` : ` \u26A0\uFE0F \u65E7\u5185\u5BB9**\u6CA1\u5907\u4EFD\u6210**\uFF08${backupWhy ?? "\u539F\u56E0\u672A\u77E5"}\uFF09\u2014\u2014\u65E2\u4E0D\u77E5\u9053\u6B64\u524D\u6709\u6CA1\u6709\u8986\u76D6\uFF0C\u4E5F\u5C31\u7ED9\u4E0D\u51FA\u6062\u590D\u547D\u4EE4\u3002
|
|
16905
|
-
\u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path50}${
|
|
17018
|
+
\u5148\u81EA\u5DF1\u8BFB\u4E00\u904D\u786E\u8BA4\uFF1Ahcm meta get ${path50}${connFlags2(args)}
|
|
16906
17019
|
`;
|
|
16907
17020
|
if (args.verify === false) {
|
|
16908
17021
|
process.stderr.write(
|
|
@@ -16948,7 +17061,7 @@ async function metaDeleteCommand(path50, args) {
|
|
|
16948
17061
|
if (!args.yes) {
|
|
16949
17062
|
requireTerminalForPrompt(
|
|
16950
17063
|
`\u6807\u51C6\u8F93\u5165\u4E0D\u662F\u7EC8\u7AEF\uFF0C\u65E0\u6CD5\u786E\u8BA4\u5220\u9664\u5143\u6570\u636E ${path50}\uFF1B\u672A\u5220\u9664\u3001\u672A\u53D1\u9001\u8BF7\u6C42\u3002`,
|
|
16951
|
-
`\u6838\u5BF9\u8DEF\u5F84\u4E0E\u5F71\u54CD\u540E\u52A0 --yes\uFF1Ahcm meta delete ${path50} --yes${
|
|
17064
|
+
`\u6838\u5BF9\u8DEF\u5F84\u4E0E\u5F71\u54CD\u540E\u52A0 --yes\uFF1Ahcm meta delete ${path50} --yes${connFlags2(args)}`
|
|
16952
17065
|
);
|
|
16953
17066
|
const ok = await promptConfirm(`\u5C06\u5220\u9664\u5143\u6570\u636E ${path50}\uFF0C\u6B64\u64CD\u4F5C\u4E0D\u53EF\u9006\u3002\u7EE7\u7EED\uFF1F`);
|
|
16954
17067
|
if (!ok) {
|
|
@@ -17050,7 +17163,7 @@ var STEP_LABEL = {
|
|
|
17050
17163
|
};
|
|
17051
17164
|
var isKnownKey = (key2) => COLUMN_SLOT_SQL_KEYS.includes(key2);
|
|
17052
17165
|
function flagsOf(args) {
|
|
17053
|
-
return
|
|
17166
|
+
return connFlags2(args) + (args.workspace ? ` --workspace ${args.workspace}` : "");
|
|
17054
17167
|
}
|
|
17055
17168
|
function client3(args) {
|
|
17056
17169
|
return getActiveAuthContextFromCli(args).then((ctx) => HcmClient29.fromAuthContext(ctx));
|
|
@@ -22447,20 +22560,20 @@ function reportEnvelopeError(body, platformOps = false) {
|
|
|
22447
22560
|
return void 0;
|
|
22448
22561
|
}
|
|
22449
22562
|
function failedReport(out, env2, as) {
|
|
22450
|
-
const
|
|
22563
|
+
const note2 = httpNote(out);
|
|
22451
22564
|
if (out.status === 429) return unknown("REPORT_THROTTLED", "\u670D\u52A1\u7AEF\u4F53\u68C0\u63A5\u53E3\u8BF7\u6C42\u88AB\u9650\u6D41", { note: throttleNote(out) });
|
|
22452
22565
|
if ([401, 403].includes(out.status)) return unknown("REPORT_UNAUTHORIZED", "\u670D\u52A1\u7AEF\u4F53\u68C0\u63A5\u53E3\u8BF7\u6C42\u6743\u9650\u4E0D\u8DB3", {
|
|
22453
22566
|
reason: "PERMISSION_DENIED",
|
|
22454
|
-
note: `${
|
|
22567
|
+
note: `${note2}${as ? `\uFF1B${env2.proxied ? "\u4F7F\u7528\u4EE3\u7406 token" : "\u4F7F\u7528\u672C\u673A token"}` : ""}`,
|
|
22455
22568
|
nextStep: codeStep("REPORT_UNAUTHORIZED", env2.name)
|
|
22456
22569
|
});
|
|
22457
|
-
if (out.status >= 500 || out.error === "network") return unknown("REPORT_UNAVAILABLE", "\u670D\u52A1\u7AEF\u4F53\u68C0\u62A5\u544A\u6682\u4E0D\u53EF\u7528\uFF1B\u7A0D\u540E\u91CD\u8BD5", { note });
|
|
22570
|
+
if (out.status >= 500 || out.error === "network") return unknown("REPORT_UNAVAILABLE", "\u670D\u52A1\u7AEF\u4F53\u68C0\u62A5\u544A\u6682\u4E0D\u53EF\u7528\uFF1B\u7A0D\u540E\u91CD\u8BD5", { note: note2 });
|
|
22458
22571
|
if (out.status !== 200) return unknown("REPORT_MALFORMED", "\u670D\u52A1\u7AEF\u4F53\u68C0\u63A5\u53E3\u8FD4\u56DE\u975E\u9884\u671F\u72B6\u6001", {
|
|
22459
22572
|
reason: "EVALUATOR_ERROR",
|
|
22460
|
-
note: `${
|
|
22573
|
+
note: `${note2}\uFF1B${(typeof out.body === "string" ? out.body : JSON.stringify(out.body) ?? "").slice(0, 200)}`
|
|
22461
22574
|
});
|
|
22462
22575
|
const invalid3 = reportEnvelopeError(out.body);
|
|
22463
|
-
if (invalid3) return unknown("REPORT_MALFORMED", "\u670D\u52A1\u7AEF\u4F53\u68C0\u62A5\u544A\u4FE1\u5C01\u4E0D\u5408\u6CD5", { reason: "EVALUATOR_ERROR", note: `${
|
|
22576
|
+
if (invalid3) return unknown("REPORT_MALFORMED", "\u670D\u52A1\u7AEF\u4F53\u68C0\u62A5\u544A\u4FE1\u5C01\u4E0D\u5408\u6CD5", { reason: "EVALUATOR_ERROR", note: `${note2}\uFF1B${invalid3}` });
|
|
22464
22577
|
return void 0;
|
|
22465
22578
|
}
|
|
22466
22579
|
function placeholderRows(ctx, env2, observation, duration = 0) {
|
|
@@ -22496,15 +22609,15 @@ function reconcileReport(ctx, env2, report, requested, platformOps) {
|
|
|
22496
22609
|
const layer2 = known ? env2.catalog?.checks.find((c2) => c2.id === id)?.spec?.layer : void 0;
|
|
22497
22610
|
return layer2 === "platform" || layer2 === "tenant" ? layer2 : String(id).startsWith("platform.") ? "platform" : "tenant";
|
|
22498
22611
|
};
|
|
22499
|
-
const issue = (layer2,
|
|
22500
|
-
const both2 = (
|
|
22501
|
-
issue("platform",
|
|
22502
|
-
issue("tenant",
|
|
22612
|
+
const issue = (layer2, note2) => issues.set(layer2, [...issues.get(layer2) ?? [], note2]);
|
|
22613
|
+
const both2 = (note2) => {
|
|
22614
|
+
issue("platform", note2);
|
|
22615
|
+
issue("tenant", note2);
|
|
22503
22616
|
};
|
|
22504
22617
|
if (platformOps) {
|
|
22505
22618
|
for (const id of report.scopeIds) if (!id.startsWith("platform.")) issue("platform", `${id}\uFF1A\u8FD0\u7EF4\u62A5\u544A\u8303\u56F4\u4E0D\u662F platform`);
|
|
22506
22619
|
}
|
|
22507
|
-
const synthesize = (id, code2,
|
|
22620
|
+
const synthesize = (id, code2, note2) => {
|
|
22508
22621
|
env2.report.server.verdict = null;
|
|
22509
22622
|
const catalogRow = known ? env2.catalog?.checks.find((c2) => c2.id === id) : void 0;
|
|
22510
22623
|
return makeResult({
|
|
@@ -22516,7 +22629,7 @@ function reconcileReport(ctx, env2, report, requested, platformOps) {
|
|
|
22516
22629
|
owner: "RND"
|
|
22517
22630
|
}, unknown(code2, code2 === "REPORT_ITEM_MISSING" ? "\u670D\u52A1\u7AEF\u62A5\u544A\u91CC\u6CA1\u6709\u8FD9\u4E00\u9879\uFF08CLI \u8865\u9879\uFF09" : "\u670D\u52A1\u7AEF\u68C0\u67E5\u7ED3\u8BBA\u4E0D\u5408\u6CD5\uFF08CLI \u6539\u5199\uFF09", {
|
|
22518
22631
|
reason: code2 === "REPORT_ITEM_MISSING" ? "SOURCE_UNAVAILABLE" : "EVALUATOR_ERROR",
|
|
22519
|
-
note
|
|
22632
|
+
note: note2
|
|
22520
22633
|
}), env2.name, true, ctx.requestedAt, 0, codeStep(code2, env2.name));
|
|
22521
22634
|
};
|
|
22522
22635
|
const rewrite = (row, originals, why) => {
|
|
@@ -22563,7 +22676,7 @@ function reconcileReport(ctx, env2, report, requested, platformOps) {
|
|
|
22563
22676
|
const marks = /* @__PURE__ */ new Map();
|
|
22564
22677
|
for (const [layer2, notes] of issues) {
|
|
22565
22678
|
const home = selected(layer2) ? layer2 : platformOps ? "platform" : SERVER_PLACEHOLDERS.map((d) => d.layer).find(selected);
|
|
22566
|
-
marks.set(home, [...marks.get(home) ?? [], ...notes.map((
|
|
22679
|
+
marks.set(home, [...marks.get(home) ?? [], ...notes.map((note2) => home === layer2 ? note2 : `${String(layer2)} \u5C42\uFF08\u4E0D\u5728\u672C\u6B21\u8303\u56F4\uFF09\uFF1A${note2}`)]);
|
|
22567
22680
|
}
|
|
22568
22681
|
const unverifiable = "\u6838\u9A8C\u671F\u95F4\u68C0\u67E5\u76EE\u5F55\u53D8\u5316\uFF1A\u670D\u52A1\u7AEF\u6709\u6CA1\u6709\u6F0F\u62A5\u6838\u4E0D\u51FA\u6765\uFF0C\u76EE\u5F55\u7A33\u5B9A\u540E\u91CD\u8DD1\u4E00\u6B21";
|
|
22569
22682
|
if (changed) for (const notes of marks.values()) notes.push(unverifiable);
|
|
@@ -22592,12 +22705,12 @@ function reconcileReport(ctx, env2, report, requested, platformOps) {
|
|
|
22592
22705
|
async function fetchServerReport(ctx, env2, dependencies, deadline, requested = fullScope) {
|
|
22593
22706
|
const [identity3, health] = dependencies;
|
|
22594
22707
|
const missing2 = SERVER_PLACEHOLDERS[0].dependsOn.filter((_, i) => dependencies[i]?.verdict.level !== "PASS");
|
|
22595
|
-
const prerequisites = (
|
|
22708
|
+
const prerequisites = (note2) => placeholderRows(ctx, env2, {
|
|
22596
22709
|
level: "NOT_RUN",
|
|
22597
22710
|
code: "PREREQUISITE_NOT_MET",
|
|
22598
22711
|
reason: "PREREQUISITE_NOT_MET",
|
|
22599
22712
|
summary: "\u670D\u52A1\u7AEF\u4F53\u68C0\u62A5\u544A\u672A\u6267\u884C\uFF1A\u524D\u7F6E\u68C0\u67E5\u672A\u901A\u8FC7",
|
|
22600
|
-
note
|
|
22713
|
+
note: note2
|
|
22601
22714
|
});
|
|
22602
22715
|
if (identity3?.verdict.level !== "PASS" || !health || health.verdict.level === "NOT_RUN") return prerequisites(missing2.join(", "));
|
|
22603
22716
|
if (health.code === "BACKEND_UNSUPPORTED") return placeholderRows(ctx, env2, {
|
|
@@ -22762,13 +22875,13 @@ var identity = async (ctx, env2, execution) => {
|
|
|
22762
22875
|
const targetMissing = status === 404 && proxyStart && envelope?.code === "NOT_FOUND";
|
|
22763
22876
|
const targetAdvice = envelope?.details === "\u76EE\u6807\u7528\u6237\u4E0D\u5B58\u5728" ? "\u670D\u52A1\u7AEF\uFF1A\u76EE\u6807\u7528\u6237\u4E0D\u5B58\u5728\uFF1B\u6838\u5BF9\u5F53\u524D\u79DF\u6237\u4E0E\u76EE\u6807\u7528\u6237 UUID" : "\u670D\u52A1\u7AEF\u56DE 404 NOT_FOUND\uFF0C\u672A\u6307\u660E\u76EE\u6807\u7528\u6237\u4E0D\u5B58\u5728\uFF08\u4E5F\u53EF\u80FD\u662F\u540E\u7AEF\u6CA1\u6709\u4EE3\u7406\u63A5\u53E3\uFF09\uFF1B\u6838\u5BF9\u5F53\u524D\u79DF\u6237\u4E0E\u76EE\u6807\u7528\u6237 UUID\uFF0C\u5E76\u6838\u540E\u7AEF\u7248\u672C";
|
|
22764
22877
|
const code2 = status === 403 || targetMissing || errorCode && ["SCOPE_FORBIDDEN", "IDENTITY_NOT_FOUND", "INVALID_ARGUMENT", "IDENTITY_NOT_IN_ENV", "IDENTITY_META_INCOMPLETE"].includes(errorCode) ? "AS_PROXY_DENIED" : errorCode === "AUTH_FAILED" ? "IDENTITY_NOT_LOGGED_IN" : status === 401 ? "TOKEN_REJECTED" : "IDENTITY_UNVERIFIED";
|
|
22765
|
-
const
|
|
22878
|
+
const note2 = detail?.issuance === "unconfirmed" ? "\u4EE3\u7406\u7B7E\u53D1\u8BF7\u6C42\u88AB\u4E2D\u6B62\uFF1B\u670D\u52A1\u7AEF\u53EF\u80FD\u5DF2\u7B7E\u53D1\uFF0C\u5BA2\u6237\u7AEF\u62FF\u4E0D\u5230\u4F1A\u8BDD\uFF0C\u670D\u52A1\u7AEF\u6309\u6709\u6548\u671F\u81EA\u7136\u8FC7\u671F" : detail?.cleanup === "unconfirmed" ? "\u4EE3\u7406\u4F1A\u8BDD\u6536\u5C3E\u5931\u8D25\uFF0C\u670D\u52A1\u7AEF\u6309\u6709\u6548\u671F\u81EA\u7136\u8FC7\u671F" : safeError(error);
|
|
22766
22879
|
const reason = status === 403 && envelope ? ["code", "message", "details"].flatMap((field) => typeof envelope[field] === "string" && envelope[field].trim() ? [`${field}: ${safeError(envelope[field])}`] : []).join("\uFF1B") : "";
|
|
22767
22880
|
const policyDenied = typeof envelope?.details === "string" && /禁止代理|不得代理|不允许代理|策略保护/.test(envelope.details);
|
|
22768
22881
|
const permissionDenied = !policyDenied && /权限|角色|admin\.system|permission|role/i.test(reason);
|
|
22769
22882
|
const deniedAdvice = status !== 403 ? "" : proxyStart ? permissionDenied ? "\u64CD\u4F5C\u8005\u9700\u5177\u5907 admin.system \u4EE3\u7406\u6743\u9650\uFF1B\u8BF7\u7BA1\u7406\u5458\u6838\u5BF9\u89D2\u8272\u540E\u4F7F\u7528\u6709\u6743\u9650\u7684\u8EAB\u4EFD\u91CD\u8BD5" : "\u6362\u4E00\u4E2A\u53EF\u4EE3\u7406\u7684\u76EE\u6807\uFF1B\u5982\u65E0\u9700\u4EE3\u7406\uFF0C\u53BB\u6389 --as \u91CD\u65B0\u6838\u9A8C" : userLookup ? "\u76EE\u6807 User \u67E5\u8BE2\u88AB\u62D2\uFF1B\u8BF7\u7BA1\u7406\u5458\u4E3A\u5F53\u524D\u8EAB\u4EFD\u6388\u4E88 User \u8BFB\u53D6\u6743\u9650\u540E\u91CD\u8DD1\u672C\u68C0\u67E5" : `\u8BF7\u6C42 ${requestPath || "\uFF08\u672A\u53D6\u5F97\u8DEF\u5F84\uFF09"} \u88AB\u62D2\uFF0C\u4E0D\u662F\u4EE3\u7406\u7B7E\u53D1\u6216\u76EE\u6807 User \u67E5\u8BE2\uFF08\u53EF\u80FD\u6765\u81EA\u7F51\u5173\u3001WAF \u6216\u4EE4\u724C\u9650\u5236\uFF09\uFF1B\u6392\u67E5\u540E\u91CD\u8DD1\u672C\u68C0\u67E5`;
|
|
22770
22883
|
return (code2 === "IDENTITY_UNVERIFIED" ? unknown : found)(code2, void 0, {
|
|
22771
|
-
note: `${
|
|
22884
|
+
note: `${note2}${status === 403 ? `\uFF1B${reason ? `\u670D\u52A1\u7AEF\uFF1A${reason}` : "\u670D\u52A1\u7AEF\u672A\u7ED9\u539F\u56E0"}\uFF1B${deniedAdvice}` : ""}${typeof detail?.nextStep === "string" ? `\uFF1B${detail.nextStep}` : targetMissing ? `\uFF1B${targetAdvice}` : ""}`,
|
|
22772
22885
|
...status === 403 ? { nextStep: { owner: "FDE", command: proxyStart ? permissionDenied ? `hcm login --env ${quote(e.name)}` : doctorRerun(ctx, e.name, "--only connect.identity", { keepAs: false }) : doctorRerun(ctx, e.name, "--only connect.identity") } } : {}
|
|
22773
22886
|
});
|
|
22774
22887
|
}
|
|
@@ -22809,20 +22922,20 @@ var websocket = async (ctx, env2) => {
|
|
|
22809
22922
|
}
|
|
22810
22923
|
};
|
|
22811
22924
|
function classifyHealthApi(out) {
|
|
22812
|
-
const
|
|
22925
|
+
const note2 = httpNote(out);
|
|
22813
22926
|
if (out.status === 429) return unknown("REPORT_THROTTLED", void 0, { note: throttleNote(out) });
|
|
22814
|
-
if ([401, 403].includes(out.status)) return unknown("REPORT_UNAUTHORIZED", void 0, { reason: "PERMISSION_DENIED", note });
|
|
22815
|
-
if (out.status >= 500) return unknown("REPORT_UNAVAILABLE", "\u670D\u52A1\u7AEF\u4F53\u68C0\u76EE\u5F55\u6682\u4E0D\u53EF\u7528\uFF1B\u7A0D\u540E\u91CD\u8BD5\uFF0C\u82E5\u540E\u7AEF\u65E9\u4E8E #2318 \u5219\u5148\u5347\u7EA7\u540E\u7AEF", { note });
|
|
22816
|
-
if (out.error === "network") return unknown("REPORT_UNAVAILABLE", "\u670D\u52A1\u7AEF\u4F53\u68C0\u76EE\u5F55\u6682\u4E0D\u53EF\u7528\uFF1B\u7A0D\u540E\u91CD\u8BD5", { note });
|
|
22927
|
+
if ([401, 403].includes(out.status)) return unknown("REPORT_UNAUTHORIZED", void 0, { reason: "PERMISSION_DENIED", note: note2 });
|
|
22928
|
+
if (out.status >= 500) return unknown("REPORT_UNAVAILABLE", "\u670D\u52A1\u7AEF\u4F53\u68C0\u76EE\u5F55\u6682\u4E0D\u53EF\u7528\uFF1B\u7A0D\u540E\u91CD\u8BD5\uFF0C\u82E5\u540E\u7AEF\u65E9\u4E8E #2318 \u5219\u5148\u5347\u7EA7\u540E\u7AEF", { note: note2 });
|
|
22929
|
+
if (out.error === "network") return unknown("REPORT_UNAVAILABLE", "\u670D\u52A1\u7AEF\u4F53\u68C0\u76EE\u5F55\u6682\u4E0D\u53EF\u7528\uFF1B\u7A0D\u540E\u91CD\u8BD5", { note: note2 });
|
|
22817
22930
|
if (out.status === 404) {
|
|
22818
22931
|
const envelope = obj(out.body) && obj(out.body.error) && out.body.error.code === "NOT_FOUND" && typeof out.body.error.message === "string";
|
|
22819
|
-
if (out.headers["x-trace-id"] && envelope) return found("BACKEND_UNSUPPORTED", void 0, { note });
|
|
22820
|
-
return found("HEALTH_API_ROUTE_MISSING", void 0, { evidence: "INFERRED", note: `${
|
|
22932
|
+
if (out.headers["x-trace-id"] && envelope) return found("BACKEND_UNSUPPORTED", void 0, { note: note2 });
|
|
22933
|
+
return found("HEALTH_API_ROUTE_MISSING", void 0, { evidence: "INFERRED", note: `${note2}\uFF1B\u7F3A\u540E\u7AEF traceId \u6216 HCM \u4FE1\u5C01\uFF1B\u4EE3\u7406\u4E5F\u53EF\u80FD\u5265\u6389\u54CD\u5E94\u5934` });
|
|
22821
22934
|
}
|
|
22822
22935
|
if (out.status === 200 && parseCatalog(out.body)) return pass("\u540E\u7AEF\u652F\u6301\u4F53\u68C0 API");
|
|
22823
22936
|
if (out.status === 200 && /text\/html/i.test(out.headers["content-type"] ?? ""))
|
|
22824
|
-
return found("HEALTH_API_ROUTE_MISSING", void 0, { evidence: "INFERRED", note: `${
|
|
22825
|
-
return unknown("REPORT_MALFORMED", void 0, { reason: "EVALUATOR_ERROR", note: `${
|
|
22937
|
+
return found("HEALTH_API_ROUTE_MISSING", void 0, { evidence: "INFERRED", note: `${note2}\uFF1B\u6536\u5230 HTML\uFF0C\u63A8\u65AD\u8DEF\u7531\u843D\u5230\u524D\u7AEF SPA` });
|
|
22938
|
+
return unknown("REPORT_MALFORMED", void 0, { reason: "EVALUATOR_ERROR", note: `${note2}\uFF1B\u76EE\u5F55\u987B\u542B checks\u3001reservedCodes \u6570\u7EC4\uFF08checks \u6BCF\u9879\u662F\u5E26\u5B57\u7B26\u4E32 id \u7684\u5BF9\u8C61\uFF09\u3001catalogRevision \u5B57\u7B26\u4E32\u6216 null\u3001tenantCatalog \u5BF9\u8C61` });
|
|
22826
22939
|
}
|
|
22827
22940
|
var healthApi = async (ctx, env2, execution) => {
|
|
22828
22941
|
const out = await probeDoctorEndpoint(probe2(ctx, env2, execution), "health-api");
|
|
@@ -23374,8 +23487,8 @@ function renderChironDoctor(report) {
|
|
|
23374
23487
|
const actions = firstActions(report.results);
|
|
23375
23488
|
if (actions.length) out.push(`\u5148\u5904\u7406\uFF1A${actions.map((r) => `${r.checkId}${r.env ? `\uFF08${r.env}\uFF09` : ""}`).join("\u3001")}`);
|
|
23376
23489
|
if (platformOps) {
|
|
23377
|
-
const
|
|
23378
|
-
if (
|
|
23490
|
+
const note2 = target?.server?.note;
|
|
23491
|
+
if (note2) out.push(note2);
|
|
23379
23492
|
out.push("\u672C\u62A5\u544A\u4EC5\u4EE3\u8868\u5E94\u7B54\u5B9E\u4F8B");
|
|
23380
23493
|
}
|
|
23381
23494
|
return out.join("\n");
|
|
@@ -23535,7 +23648,7 @@ function redact(text2, key2) {
|
|
|
23535
23648
|
return raw.replaceAll(key2, "[redacted]").replace(/hcm\s+login/gi, "[login advice omitted]");
|
|
23536
23649
|
}
|
|
23537
23650
|
function classifyOpsApi(out, endpoint, key2) {
|
|
23538
|
-
const
|
|
23651
|
+
const note2 = httpNote(out), error = object(out.body) && object(out.body.error) ? out.body.error : void 0;
|
|
23539
23652
|
const wireCode = error?.code;
|
|
23540
23653
|
if (out.status === 200) {
|
|
23541
23654
|
if (object(out.body) || Array.isArray(out.body)) return pass("\u540E\u7AEF\u652F\u6301\u8FD0\u7EF4\u4F53\u68C0 API");
|
|
@@ -23547,7 +23660,7 @@ function classifyOpsApi(out, endpoint, key2) {
|
|
|
23547
23660
|
return unknown(
|
|
23548
23661
|
"REPORT_MALFORMED",
|
|
23549
23662
|
"\u8FD0\u7EF4\u4F53\u68C0\u63A5\u53E3 JSON \u89E3\u6790\u5931\u8D25",
|
|
23550
|
-
{ reason: "EVALUATOR_ERROR", note: `${
|
|
23663
|
+
{ reason: "EVALUATOR_ERROR", note: `${note2}\uFF1B${redact(out.body, key2).slice(0, 200)}` }
|
|
23551
23664
|
);
|
|
23552
23665
|
}
|
|
23553
23666
|
}
|
|
@@ -23556,7 +23669,7 @@ function classifyOpsApi(out, endpoint, key2) {
|
|
|
23556
23669
|
return found(
|
|
23557
23670
|
"HEALTH_API_ROUTE_MISSING",
|
|
23558
23671
|
void 0,
|
|
23559
|
-
{ evidence: "INFERRED", note: `${
|
|
23672
|
+
{ evidence: "INFERRED", note: `${note2}\uFF1B\u6536\u5230\u975E JSON\uFF0C\u63A8\u65AD\u8DEF\u7531\u843D\u5230\u53CD\u4EE3\u6216\u524D\u7AEF SPA` }
|
|
23560
23673
|
);
|
|
23561
23674
|
}
|
|
23562
23675
|
if (out.status === 403 && wireCode === "HEALTH_OPS_KEY_INVALID") return pass("\u8FD0\u7EF4\u4F53\u68C0 API \u5DF2\u5E94\u7B54");
|
|
@@ -23565,24 +23678,24 @@ function classifyOpsApi(out, endpoint, key2) {
|
|
|
23565
23678
|
if (out.status === 401 && !out.headers["x-trace-id"]) return found(
|
|
23566
23679
|
"HEALTH_API_ROUTE_MISSING",
|
|
23567
23680
|
void 0,
|
|
23568
|
-
{ evidence: "INFERRED", note: `${
|
|
23681
|
+
{ evidence: "INFERRED", note: `${note2}\uFF1B\u7F3A\u540E\u7AEF traceId\uFF0C\u63A8\u65AD\u7F51\u5173\u62E6\u622A\uFF1B\u4EE3\u7406\u4E5F\u53EF\u80FD\u5265\u6389\u54CD\u5E94\u5934` }
|
|
23569
23682
|
);
|
|
23570
23683
|
const requestPath = new URL(`${endpoint.replace(/\/+$/, "")}${OPS_PATH}`).pathname;
|
|
23571
|
-
if (out.status === 401 && out.headers["x-trace-id"] && object(out.body) && out.body.code === 401 && [requestPath, OPS_PATH].includes(String(out.body.path))) return found("BACKEND_UNSUPPORTED", void 0, { note });
|
|
23684
|
+
if (out.status === 401 && out.headers["x-trace-id"] && object(out.body) && out.body.code === 401 && [requestPath, OPS_PATH].includes(String(out.body.path))) return found("BACKEND_UNSUPPORTED", void 0, { note: note2 });
|
|
23572
23685
|
if (out.status === 404) {
|
|
23573
23686
|
if (out.headers["x-trace-id"] && error && typeof error.code === "string" && typeof error.message === "string")
|
|
23574
|
-
return found("BACKEND_UNSUPPORTED", void 0, { note });
|
|
23687
|
+
return found("BACKEND_UNSUPPORTED", void 0, { note: note2 });
|
|
23575
23688
|
if (!out.headers["x-trace-id"]) return found(
|
|
23576
23689
|
"HEALTH_API_ROUTE_MISSING",
|
|
23577
23690
|
void 0,
|
|
23578
|
-
{ evidence: "INFERRED", note: `${
|
|
23691
|
+
{ evidence: "INFERRED", note: `${note2}\uFF1B\u7F3A\u540E\u7AEF traceId\uFF0C\u63A8\u65AD\u8DEF\u7531\u672A\u5230\u540E\u7AEF\uFF1B\u4EE3\u7406\u4E5F\u53EF\u80FD\u5265\u6389\u54CD\u5E94\u5934` }
|
|
23579
23692
|
);
|
|
23580
23693
|
}
|
|
23581
|
-
if (out.status >= 500 || out.error === "network") return unknown("REPORT_UNAVAILABLE", void 0, { note });
|
|
23694
|
+
if (out.status >= 500 || out.error === "network") return unknown("REPORT_UNAVAILABLE", void 0, { note: note2 });
|
|
23582
23695
|
return unknown(
|
|
23583
23696
|
"REPORT_MALFORMED",
|
|
23584
23697
|
"\u8FD0\u7EF4\u4F53\u68C0\u63A5\u53E3\u8FD4\u56DE\u975E\u9884\u671F\u72B6\u6001",
|
|
23585
|
-
{ reason: "EVALUATOR_ERROR", note: `${
|
|
23698
|
+
{ reason: "EVALUATOR_ERROR", note: `${note2}\uFF1B${redact(out.body, key2).slice(0, 200)}` }
|
|
23586
23699
|
);
|
|
23587
23700
|
}
|
|
23588
23701
|
function opsPlaceholder(ctx, env2, observation) {
|
|
@@ -24802,7 +24915,8 @@ function textHead(text2) {
|
|
|
24802
24915
|
}
|
|
24803
24916
|
var BLANK_PAGE_NEXT_STEP = "\u6253\u5F00\u622A\u56FE\u770B\u4E00\u773C\u3002\u2460 \u8DEF\u5F84\u4E0D\u5B58\u5728\uFF1A\u5217\u8868\u9875\u7684\u8DEF\u7531\u662F /model_list/<\u6A21\u578B\u540D>\uFF08\u4F8B\u5982 /model_list/Employee\uFF0C\u4E0D\u662F /employee\uFF09\uFF0C\u62FF\u4E0D\u51C6\u5C31\u5728\u6D4F\u89C8\u5668\u91CC\u4ECE\u83DC\u5355\u70B9\u8FDB\u53BB\uFF0C\u7167\u5730\u5740\u680F\u91CC\u7684\u8DEF\u5F84\u91CD\u8DD1\uFF1B\u2461 \u9875\u9762\u8FD8\u6CA1\u6E32\u67D3\u5B8C\uFF1A\u52A0\u5927 --wait-ms \u91CD\u8DD1\uFF1B\u2462 \u6CA1\u767B\u5F55\u4E0A\u6216\u6CA1\u6743\u9650\uFF1A\u6838 --env / --as \u7528\u7684\u8EAB\u4EFD";
|
|
24804
24917
|
var NAVIGATION_FAILED_NEXT_STEP = "\u5BFC\u822A\u6CA1\u8D70\u5230 load \u4E8B\u4EF6\uFF0C\u591A\u534A\u662F\u524D\u7AEF\u6CA1\u8FDE\u4E0A\uFF1A\u6838 env.yaml\uFF08\u6216 --env \u7684\u672C\u673A\u69FD\uFF09\u91CC\u7684\u524D\u7AEF\u5730\u5740\u5728\u6D4F\u89C8\u5668\u91CC\u6253\u5F97\u5F00\u3001\u524D\u540E\u7AEF\u90FD\u8D77\u7740\u3001\u8BC1\u4E66\u6CA1\u95EE\u9898\uFF0C\u518D\u91CD\u8DD1\uFF1B\u4E0D\u662F\u8DEF\u5F84\u7684\u95EE\u9898\uFF0C\u5148\u522B\u6539\u8DEF\u5F84";
|
|
24805
|
-
var MISSING_TEXT_NEXT_STEP = "\u6253\u5F00\u622A\u56FE\u770B\u4E00\u773C\uFF1A\u662F\u767B\u5F55\u9875\u3001\u62A5\u9519\u9875\uFF0C\u8FD8\u662F\u9875\u9762\u771F\u7684\u5C11\u4E86\u4E1C\u897F\uFF1B\u5BF9\u7167\
|
|
24918
|
+
var MISSING_TEXT_NEXT_STEP = "\u6253\u5F00\u622A\u56FE\u770B\u4E00\u773C\uFF1A\u662F\u767B\u5F55\u9875\u3001\u62A5\u9519\u9875\uFF0C\u8FD8\u662F\u9875\u9762\u771F\u7684\u5C11\u4E86\u4E1C\u897F\uFF1B\u5BF9\u7167\u4E0A\u9762\u6253\u51FA\u7684\u9875\u9762\u5F00\u5934";
|
|
24919
|
+
var DUMP_DOM_NEXT_STEP_SUFFIX = "\uFF1B\u8FD9\u6B21\u8D70\u7684\u662F\u8001 spawn \u8DEF\u5F84\uFF0C\u5224\u4E0D\u4E86\u767D\u5C4F\uFF08\u88AB CSS \u85CF\u8D77\u6765\u7684\u5B57\u4E5F\u7B97\u8FDB\u53BB\uFF09\uFF1A\u5148 npx playwright install chromium-headless-shell \u518D\u91CD\u8DD1\uFF0C\u80FD\u5206\u6E05\u662F\u4E0D\u662F\u6B63\u6587\u4E3A\u7A7A";
|
|
24806
24920
|
function failureSummary(r) {
|
|
24807
24921
|
if (r.blank) return r.navigated === false ? "\u5BFC\u822A\u5931\u8D25\u3001\u9875\u9762\u6B63\u6587\u4E3A\u7A7A" : "\u9875\u9762\u6B63\u6587\u4E3A\u7A7A";
|
|
24808
24922
|
const parts = [];
|
|
@@ -25014,7 +25128,9 @@ async function runChironPage(target, args, deps) {
|
|
|
25014
25128
|
textSource,
|
|
25015
25129
|
blank: verdict.blank,
|
|
25016
25130
|
...verdict.ok ? {} : { textHead: textHead(text2) },
|
|
25017
|
-
...verdict.ok ? {} : {
|
|
25131
|
+
...verdict.ok ? {} : {
|
|
25132
|
+
nextStep: verdict.blank ? navigated === false ? NAVIGATION_FAILED_NEXT_STEP : BLANK_PAGE_NEXT_STEP : MISSING_TEXT_NEXT_STEP + (textSource === "dump-dom" ? DUMP_DOM_NEXT_STEP_SUFFIX : "")
|
|
25133
|
+
}
|
|
25018
25134
|
};
|
|
25019
25135
|
}
|
|
25020
25136
|
function spawnFailureNextStep(browser, result, platform) {
|
|
@@ -25038,7 +25154,9 @@ function renderChironPage(receipt) {
|
|
|
25038
25154
|
} else {
|
|
25039
25155
|
for (const t of receipt.missing) out.push(` \u274C \u9875\u9762\u4E0A\u6CA1\u6709\u300C${t}\u300D`);
|
|
25040
25156
|
for (const t of receipt.forbidden) out.push(` \u274C \u9875\u9762\u4E0A\u51FA\u73B0\u4E86\u4E0D\u8BE5\u6709\u7684\u300C${t}\u300D`);
|
|
25041
|
-
if (!receipt.ok && receipt.textHead !== void 0)
|
|
25157
|
+
if (!receipt.ok && receipt.textHead !== void 0) {
|
|
25158
|
+
out.push(receipt.textSource === "innerText" ? ` \u9875\u9762\u4E0A\u770B\u5F97\u89C1\u7684\u5F00\u5934\uFF1A\u300C${receipt.textHead}\u300D` : ` \u6E90\u7801\u53BB\u6807\u7B7E\u540E\u7684\u5F00\u5934\uFF08\u8001 spawn \u8DEF\u5F84\uFF0C\u542B\u88AB CSS \u85CF\u8D77\u6765\u7684\u5B57\uFF0C\u4E0D\u4E00\u5B9A\u770B\u5F97\u89C1\uFF09\uFF1A\u300C${receipt.textHead}\u300D`);
|
|
25159
|
+
}
|
|
25042
25160
|
}
|
|
25043
25161
|
if (!receipt.ok) out.push(` \u274C ${failureSummary(receipt)}\u3002\u622A\u56FE\u4FDD\u7559\u7740\u3002\u4E0B\u4E00\u6B65\uFF1A${receipt.nextStep ?? "\u6253\u5F00\u622A\u56FE\u770B\u4E00\u773C"}`);
|
|
25044
25162
|
return out.join("\n");
|
|
@@ -26560,9 +26678,9 @@ async function runSeedApply(args, client4) {
|
|
|
26560
26678
|
const [recorded, loadCause] = loadRecordedFingerprint(out, plan.baseline?.path ?? null);
|
|
26561
26679
|
const current = await computeFingerprint(client4);
|
|
26562
26680
|
const verdict = judgeDrift(recorded, current, { baseline: plan.baseline?.path ?? null, loadCause });
|
|
26563
|
-
let
|
|
26681
|
+
let note2;
|
|
26564
26682
|
try {
|
|
26565
|
-
|
|
26683
|
+
note2 = enforceDriftGate(verdict, {
|
|
26566
26684
|
journal,
|
|
26567
26685
|
roundId: plan.roundId,
|
|
26568
26686
|
forced: args.forceStale ?? false,
|
|
@@ -26578,7 +26696,7 @@ async function runSeedApply(args, client4) {
|
|
|
26578
26696
|
}
|
|
26579
26697
|
throw e;
|
|
26580
26698
|
}
|
|
26581
|
-
if (
|
|
26699
|
+
if (note2) process.stderr.write(note2 + "\n");
|
|
26582
26700
|
let lease;
|
|
26583
26701
|
try {
|
|
26584
26702
|
lease = acquireLease(work, plan.roundId);
|
|
@@ -30429,9 +30547,9 @@ async function runOfflineFlush(opts, deps) {
|
|
|
30429
30547
|
todo.push(it);
|
|
30430
30548
|
continue;
|
|
30431
30549
|
}
|
|
30432
|
-
const
|
|
30550
|
+
const note2 = ledger.entries[it.entry.uid] ? `\u603B\u8D26\u91CC\u8BB0\u7740\u5DF2\u4EA4\uFF08${ledger.entries[it.entry.uid].from}\uFF09` : "\u4E0A\u4E00\u6B21\u4EA4\u51FA\u540E\u6CA1\u632A\u8FDB done/";
|
|
30433
30551
|
const moveErr = await moveTo(it, path47.join(dir, DONE_DIR)).then(() => recordDoneQuiet(it, prior)).then(() => "", (e) => `\uFF1B\u8FD9\u6B21\u4E5F\u6CA1\u632A\u8FDB done/\uFF08${e.code ?? e.message}\uFF09`);
|
|
30434
|
-
rows2.push(doneRow(it, prior,
|
|
30552
|
+
rows2.push(doneRow(it, prior, note2 + moveErr));
|
|
30435
30553
|
}
|
|
30436
30554
|
let run3 = todo;
|
|
30437
30555
|
if (opts.only !== void 0) {
|
|
@@ -31581,11 +31699,11 @@ offline.command("uninstall").description("\u628A\u777F\u620E\u4ECE\u8FD9\u53F0\u
|
|
|
31581
31699
|
program.command("open [path]").description("\u7528\u5F53\u524D CLI \u8EAB\u4EFD\u6253\u5F00\u524D\u7AEF\u9875\u9762\uFF1A\u94F8\u4E00\u5F20 60s \u4E00\u6B21\u6027\u7968\u636E\u4EA4\u7ED9\u6D4F\u89C8\u5668\uFF0C\u4F1A\u8BDD token \u4E0D\u8FDB URL").option("--print-url", "\u53EA\u6253\u5370\u767B\u5F55 URL\uFF0C\u4E0D\u5F00\u6D4F\u89C8\u5668\uFF08\u7ED9 agent \u6D4F\u89C8\u5668 navigate \u7528\uFF09").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("--profile <name>", "[deprecated] \u7528 --env \u66FF\u4EE3").action((path50, opts) => openCommand(path50, opts));
|
|
31582
31700
|
var setting = program.command("setting").description("\u79DF\u6237\u7CFB\u7EDF\u53C2\u6570\uFF08\u767B\u5F55\u7B56\u7565 / \u5BC6\u7801\u7B56\u7565 / \u529F\u80FD\u5F00\u5173 / \u96C6\u6210\u53C2\u6570\uFF09");
|
|
31583
31701
|
setting.command("get <domain>").description("\u8BFB\u67D0\u57DF\u53C2\u6570\uFF08\u5B9A\u4E49 + \u79DF\u6237\u8986\u76D6\u503C\u5408\u5E76\uFF0C\u7F3A\u5931\u56DE\u843D\u9ED8\u8BA4\u503C\uFF09").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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "table").action((d, opts) => settingGetCommand(d, opts));
|
|
31584
|
-
setting.command("set <domain>").description("\u6539\u53C2\u6570\uFF0C\u53EF\u91CD\u590D --set\uFF1B\u8D70\u53D7\u63A7\u6821\u9A8C\u8DEF\u5F84\u800C\u975E\u6807\u51C6 CRUD").option(
|
|
31702
|
+
setting.command("set <domain>").description("\u6539\u53C2\u6570\uFF0C\u53EF\u91CD\u590D --set\uFF1B\u8D70\u53D7\u63A7\u6821\u9A8C\u8DEF\u5F84\u800C\u975E\u6807\u51C6 CRUD\uFF1B\u5DF2\u6709\u79DF\u6237\u8986\u76D6\u7684\u9879\u4F1A\u5148\u8BFB\u5F53\u524D revision \u518D\u5199").option(
|
|
31585
31703
|
"--set <assignment...>",
|
|
31586
31704
|
"namespace.key=value\uFF0C\u4F8B\u5982 security.password.passwordPolicy=complex"
|
|
31587
31705
|
).option("--dry-run", "\u53EA\u663E\u793A\u5C06\u5199\u5165\u4EC0\u4E48\uFF0C\u4E0D\u5B9E\u9645\u5199\u5165").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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((d, opts) => settingSetCommand(d, opts));
|
|
31588
|
-
setting.command("reset <domain> <namespace> <key>").description("\u6E05\u9664\u79DF\u6237\u8986\u76D6\uFF0C\u56DE\u843D\u5230\u9ED8\u8BA4\u503C").option("--revision <n>", "\u4E50\u89C2\u9501\u7248\u672C\u53F7").option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4").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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((d, ns, k, opts) => settingResetCommand(d, ns, k, opts));
|
|
31706
|
+
setting.command("reset <domain> <namespace> <key>").description("\u6E05\u9664\u79DF\u6237\u8986\u76D6\uFF0C\u56DE\u843D\u5230\u9ED8\u8BA4\u503C").option("--revision <n>", "\u4E50\u89C2\u9501\u7248\u672C\u53F7\uFF08setting get \u7684 revision \u5217\uFF09\uFF1B\u4E0D\u7ED9\u5219\u5148\u8BFB\u5F53\u524D\u7248\u672C").option("-y, --yes", "\u8DF3\u8FC7\u786E\u8BA4").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").option("--output <fmt>", "\u8F93\u51FA\u683C\u5F0F\uFF1Atable | json | yaml", "json").action((d, ns, k, opts) => settingResetCommand(d, ns, k, opts));
|
|
31589
31707
|
async function main() {
|
|
31590
31708
|
if (needsLegacyProfileMigration(process.argv)) {
|
|
31591
31709
|
try {
|