@thinkingai/ae-cli 6.1.32 → 6.1.34
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -5
- package/README.zh.md +10 -9
- package/bin/runtime-capabilities.json +1 -1
- package/cli-installation-guide.md +14 -4
- package/dist/{ai-monitor-MKMHSSNI.js → ai-monitor-TVRFVZBH.js} +11 -9
- package/dist/ai-monitor.js +18 -16
- package/dist/{auth-CZHHPZOQ.js → auth-JAXLMPBB.js} +33 -316
- package/dist/{automation-FLCPFMN4.js → automation-OQ647CSW.js} +7 -7
- package/dist/{capability-64KVJFIA.js → capability-2Z4ZXTPD.js} +19 -16
- package/dist/chunk-2H3SFJE3.js +344 -0
- package/dist/{chunk-TMQGS4TO.js → chunk-3PZNM5KN.js} +3 -3
- package/dist/chunk-3ZQY7SLZ.js +147 -0
- package/dist/chunk-6E6HCTP2.js +60 -0
- package/dist/{local-data-upload-client-KCMG6J62.js → chunk-6IUTXRAD.js} +32 -4
- package/dist/{chunk-5M5LBRR3.js → chunk-CYZV5AXW.js} +18 -9
- package/dist/{chunk-3ULDJJTZ.js → chunk-DE5XHQQ6.js} +2 -2
- package/dist/{chunk-FCAA7I2D.js → chunk-E5CJI7L3.js} +26 -10
- package/dist/{chunk-QVRIDN42.js → chunk-EQMGH32F.js} +2 -2
- package/dist/{chunk-DWBYNGSR.js → chunk-FNACCKQR.js} +372 -194
- package/dist/{chunk-OAWPT7VP.js → chunk-GD5JSAGV.js} +2 -2
- package/dist/{chunk-CF6JTT2U.js → chunk-GYODT7C4.js} +1 -1
- package/dist/chunk-HBI7IQH3.js +1207 -0
- package/dist/{chunk-4PSTYEG5.js → chunk-IGU3R2JD.js} +9 -5
- package/dist/{chunk-IDDWEZ7F.js → chunk-IWMDPHMI.js} +3 -3
- package/dist/{chunk-P7QDCWJ6.js → chunk-L7MT53VM.js} +8 -2
- package/dist/{chunk-F2VFZUGG.js → chunk-LXRALNNA.js} +2 -2
- package/dist/{chunk-6M7ZEDT2.js → chunk-M2OCZRVX.js} +14 -8
- package/dist/{chunk-Z3Q2AEIN.js → chunk-MTK4ZE7W.js} +17 -145
- package/dist/{chunk-T7WF4HYW.js → chunk-NK5PS5X7.js} +3 -3
- package/dist/{chunk-JEUXDY3B.js → chunk-NPH5J65M.js} +1 -1
- package/dist/chunk-PUSFEC6B.js +29 -0
- package/dist/{chunk-BNBCMCYN.js → chunk-Q764EZND.js} +78 -72
- package/dist/chunk-QOJXLXDJ.js +55 -0
- package/dist/{chunk-HVMCPKOZ.js → chunk-QPUPWGZ3.js} +1 -1
- package/dist/{chunk-72NJKS7O.js → chunk-RLPMXKDQ.js} +8921 -10119
- package/dist/{chunk-NLEXY2TM.js → chunk-S74XV3A6.js} +7 -5
- package/dist/{chunk-KTJXD27G.js → chunk-SHB7A2JE.js} +3 -3
- package/dist/{chunk-HTZ2MLYA.js → chunk-UWQXGF44.js} +25 -11
- package/dist/{data-integration-QE37EQ3A.js → chunk-V6UKLIM6.js} +160 -2258
- package/dist/{chunk-4XKTRCRK.js → chunk-VPLRZSMY.js} +22 -13
- package/dist/{chunk-2F64AZYH.js → chunk-Z6WSCIHM.js} +2 -2
- package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-5VNT6HCV.js} +4 -2
- package/dist/{compat-check-ZJNCMNQV.js → compat-check-E7AQ7UCG.js} +6 -4
- package/dist/{config-FSH2NMNZ.js → config-PGSUWIK5.js} +16 -11
- package/dist/{context-YAQG6YQC.js → context-Y2A6QIS3.js} +9 -6
- package/dist/conversion-4FR3RA45.js +16 -0
- package/dist/data-integration-EIF5QHYF.js +2138 -0
- package/dist/{evaluation-2JSF4V47.js → evaluation-OZM54MES.js} +6 -5
- package/dist/index.js +79 -52
- package/dist/local-data-upload-client-2U3LFD7Z.js +16 -0
- package/dist/{memory-VEZZVAAP.js → memory-6QMZS4HF.js} +7 -7
- package/dist/{metadata-3IWHX3V4.js → metadata-7MZ3CJ2N.js} +11 -9
- package/dist/{model-T7H7Q6BG.js → model-LEYRQKOS.js} +8 -8
- package/dist/{personal-semantic-preference-YITU23SA.js → personal-semantic-preference-SWOUNDWJ.js} +46 -14
- package/dist/{project-semantic-MHEXJF3C.js → project-semantic-M2DDPAMD.js} +10 -8
- package/dist/{sync-AQHVCSPI.js → sync-PWC63JCO.js} +17 -16
- package/dist/{te-agent-RXI7WOH4.js → te-agent-S7UH657Z.js} +304 -16
- package/dist/{te-analysis-CZY74HVF.js → te-analysis-BK6PE333.js} +295 -223
- package/dist/{te-community-DKCYUBCM.js → te-community-OLNTKGCW.js} +17 -13
- package/dist/{te-dataops-QEH6VE56.js → te-dataops-XUWRIF5R.js} +18 -14
- package/dist/{te-engage-WK7WKDKF.js → te-engage-I3I4FJOM.js} +10 -8
- package/dist/{te-experiment-LH3RPIOE.js → te-experiment-XSDUL4KH.js} +216 -28
- package/dist/{te-kb-UPORIOVN.js → te-kb-QFH3YLFQ.js} +74 -21
- package/dist/{te-system-AL4B4XZL.js → te-system-DB5Z3LLF.js} +7 -7
- package/dist/{te-team-LLVTO2G4.js → te-team-UADF2HBO.js} +10 -8
- package/dist/{things-XLMLBYQR.js → things-G2QFXDK7.js} +10 -8
- package/dist/{update-7J5UQHSK.js → update-6I366ICW.js} +10 -9
- package/dist/web-runtime-3XFREWRF.js +2367 -0
- package/dist/{workspace-FF2HXJGR.js → workspace-RZESYB6T.js} +7 -7
- package/package.json +9 -5
- package/skills/ae-agent/SKILL.md +19 -5
- package/skills/ae-agent/references/a2a.md +103 -0
- package/skills/ae-agent/references/command_index.md +11 -0
- package/skills/ae-analysis/SKILL.md +35 -23
- package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
- package/skills/ae-analysis/references/bad_case_review.md +4 -4
- package/skills/ae-analysis/references/command_index.md +7 -7
- package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
- package/skills/ae-analysis/references/project_owner_update.md +5 -1
- package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
- package/skills/ae-analysis/references/scenario_list.md +5 -6
- package/skills/ae-capability/SKILL.md +8 -4
- package/skills/ae-data-integration/references/ue-mapping.md +2 -0
- package/skills/ae-experiment/SKILL.md +45 -16
- package/skills/ae-experiment/references/experiment_approval.md +87 -29
- package/skills/ae-experiment/references/manage_experiment.md +7 -3
- package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
- package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
- package/skills/ae-experiment/references/query_experiment_list.md +6 -0
- package/skills/ae-experiment/references/save_experiment.md +39 -13
- package/skills/ae-experiment/references/save_metric.md +29 -2
- package/skills/ae-experiment/references/save_submit_experiment.md +11 -7
- package/skills/ae-experiment/references/save_submit_external_experiment.md +16 -14
- package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
- package/skills/ae-kb/SKILL.md +4 -2
- package/skills/ae-kb/references/publication.md +45 -0
- package/skills/ae-onboarding/SKILL.md +64 -0
- package/skills/ae-onboarding/references/business-sdk.md +8 -0
- package/skills/ae-onboarding/references/demo-operations.md +79 -0
- package/skills/ae-onboarding/references/import.md +19 -0
- package/skills/ae-onboarding/references/onboarding_experiment_launch.md +12 -0
- package/skills/ae-onboarding/references/onboarding_experiment_plan.md +14 -0
- package/skills/ae-onboarding/references/onboarding_growth.md +36 -0
- package/skills/ae-onboarding/references/onboarding_run.md +11 -0
- package/skills/ae-onboarding/references/onboarding_status.md +5 -0
- package/skills/ae-onboarding/scripts/experiment-preset.json +252 -0
- package/skills/ae-onboarding/scripts/experiment-requests.mjs +120 -0
- package/skills/ae-onboarding/scripts/generate.mjs +170 -0
- package/skills/ae-onboarding/scripts/resolve-experiment-preset.mjs +26 -0
- package/skills/ae-onboarding/scripts/web-journey.mjs +39 -0
- package/dist/chunk-6ZIQV5GW.js +0 -26
- package/dist/chunk-Y74WTIKJ.js +0 -10
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
|
|
2
2
|
import {
|
|
3
3
|
evalApi
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-M2OCZRVX.js";
|
|
5
5
|
import {
|
|
6
6
|
assertOutputPathAvailable,
|
|
7
7
|
clientWaitTimeoutSeconds,
|
|
@@ -10,23 +10,28 @@ import {
|
|
|
10
10
|
waitForAnalysisRun,
|
|
11
11
|
withAsyncArtifactLifecycle,
|
|
12
12
|
withInterruptSignal
|
|
13
|
-
} from "./chunk-
|
|
14
|
-
import {
|
|
15
|
-
EvalApiError
|
|
16
|
-
} from "./chunk-P7QDCWJ6.js";
|
|
13
|
+
} from "./chunk-NK5PS5X7.js";
|
|
17
14
|
import {
|
|
18
15
|
createCapabilityCommand,
|
|
19
16
|
definitionIntentSnapshotFlag,
|
|
20
17
|
modelDefinitionIntentSnapshotFlag
|
|
21
|
-
} from "./chunk-
|
|
18
|
+
} from "./chunk-3PZNM5KN.js";
|
|
22
19
|
import {
|
|
23
20
|
registerCapabilityGatewayRoute,
|
|
24
21
|
resolveGatewayDomain
|
|
25
22
|
} from "./chunk-AWW2T2WL.js";
|
|
23
|
+
import {
|
|
24
|
+
EvalApiError
|
|
25
|
+
} from "./chunk-L7MT53VM.js";
|
|
26
26
|
import {
|
|
27
27
|
unwrapOutputData,
|
|
28
28
|
withOutputMetadata
|
|
29
|
-
} from "./chunk-
|
|
29
|
+
} from "./chunk-DE5XHQQ6.js";
|
|
30
|
+
import {
|
|
31
|
+
normalizeResourceUrlFields,
|
|
32
|
+
normalizeResourceUrls,
|
|
33
|
+
resolvePublicWebHost
|
|
34
|
+
} from "./chunk-QOJXLXDJ.js";
|
|
30
35
|
import {
|
|
31
36
|
CapabilityGatewayError,
|
|
32
37
|
buildCapabilityGatewayUrl,
|
|
@@ -40,16 +45,18 @@ import {
|
|
|
40
45
|
uploadInputFile,
|
|
41
46
|
validateCapability,
|
|
42
47
|
validateCapabilityWithEnvelope
|
|
43
|
-
} from "./chunk-
|
|
44
|
-
import "./chunk-
|
|
45
|
-
import "./chunk-
|
|
48
|
+
} from "./chunk-VPLRZSMY.js";
|
|
49
|
+
import "./chunk-6E6HCTP2.js";
|
|
50
|
+
import "./chunk-FNACCKQR.js";
|
|
51
|
+
import "./chunk-PUSFEC6B.js";
|
|
46
52
|
import {
|
|
47
53
|
getCliToken
|
|
48
|
-
} from "./chunk-
|
|
49
|
-
import "./chunk-
|
|
54
|
+
} from "./chunk-UWQXGF44.js";
|
|
55
|
+
import "./chunk-IGU3R2JD.js";
|
|
56
|
+
import "./chunk-MTK4ZE7W.js";
|
|
50
57
|
import {
|
|
51
58
|
CliValidationError
|
|
52
|
-
} from "./chunk-
|
|
59
|
+
} from "./chunk-3ZQY7SLZ.js";
|
|
53
60
|
|
|
54
61
|
// src/commands/te-analysis/capability-shared.ts
|
|
55
62
|
var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
|
|
@@ -384,9 +391,9 @@ function optionalJsonArray(ctx, name) {
|
|
|
384
391
|
const parsed = ctx.json(name);
|
|
385
392
|
return Array.isArray(parsed) ? parsed : [parsed];
|
|
386
393
|
}
|
|
387
|
-
function compactInput(
|
|
394
|
+
function compactInput(input2) {
|
|
388
395
|
const result = {};
|
|
389
|
-
for (const [key, value] of Object.entries(
|
|
396
|
+
for (const [key, value] of Object.entries(input2)) {
|
|
390
397
|
if (value !== void 0) {
|
|
391
398
|
result[key] = value;
|
|
392
399
|
}
|
|
@@ -474,7 +481,7 @@ function optionalQueries(ctx) {
|
|
|
474
481
|
return value === void 0 || value === null ? void 0 : value;
|
|
475
482
|
}
|
|
476
483
|
function catalogExportPostProcess(resourceType, arrayField) {
|
|
477
|
-
return async (result,
|
|
484
|
+
return async (result, input2, ctx) => {
|
|
478
485
|
if (typeof result !== "object" || result === null) {
|
|
479
486
|
throw new Error(`Full ${resourceType} catalog returned an invalid response`);
|
|
480
487
|
}
|
|
@@ -521,7 +528,7 @@ function catalogExportPostProcess(resourceType, arrayField) {
|
|
|
521
528
|
schema_version: 1,
|
|
522
529
|
resource_type: resourceType,
|
|
523
530
|
host: ctx.host(),
|
|
524
|
-
project_id:
|
|
531
|
+
project_id: input2.project_id,
|
|
525
532
|
principal_fingerprint: `sha256:${createHash("sha256").update(token).digest("hex")}`,
|
|
526
533
|
generated_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
527
534
|
row_count: rows.length,
|
|
@@ -1705,70 +1712,26 @@ function assetGovernanceInput(ctx, fields2) {
|
|
|
1705
1712
|
if (payload && Object.hasOwn(payload, "payload")) {
|
|
1706
1713
|
throw new CliValidationError("--payload must not contain a nested payload field.");
|
|
1707
1714
|
}
|
|
1708
|
-
const
|
|
1715
|
+
const input2 = {
|
|
1709
1716
|
...payload,
|
|
1710
1717
|
...projectInput(ctx)
|
|
1711
1718
|
};
|
|
1712
1719
|
for (const field of fields2) {
|
|
1713
1720
|
const value = readers[field]?.(ctx);
|
|
1714
|
-
if (value !== void 0)
|
|
1721
|
+
if (value !== void 0) input2[field] = value;
|
|
1715
1722
|
}
|
|
1716
1723
|
for (const field of ["node_ids", "searchs", "status"]) {
|
|
1717
|
-
if (
|
|
1724
|
+
if (input2[field] !== void 0 && !Array.isArray(input2[field])) {
|
|
1718
1725
|
throw new CliValidationError(`${field} must be a JSON array.`);
|
|
1719
1726
|
}
|
|
1720
1727
|
}
|
|
1721
|
-
if (
|
|
1728
|
+
if (input2.rule !== void 0 && (!input2.rule || typeof input2.rule !== "object" || Array.isArray(input2.rule))) {
|
|
1722
1729
|
throw new CliValidationError("rule must be a JSON object.");
|
|
1723
1730
|
}
|
|
1724
|
-
if (fields2.includes("to_user_id") && (!Number.isInteger(
|
|
1731
|
+
if (fields2.includes("to_user_id") && (!Number.isInteger(input2.to_user_id) || Number(input2.to_user_id) <= 0)) {
|
|
1725
1732
|
throw new CliValidationError("to_user_id must be a positive integer; provide --to-user-id or payload.to_user_id.");
|
|
1726
1733
|
}
|
|
1727
|
-
return
|
|
1728
|
-
}
|
|
1729
|
-
|
|
1730
|
-
// src/core/resource-url.ts
|
|
1731
|
-
var LOCAL_BACKEND_PORTS = /* @__PURE__ */ new Set(["8992", "8996"]);
|
|
1732
|
-
function normalizeResourceUrlFields(node, host, sourceHost = host) {
|
|
1733
|
-
if (!node || typeof node !== "object") return;
|
|
1734
|
-
const obj = node;
|
|
1735
|
-
for (const [key, value] of Object.entries(obj)) {
|
|
1736
|
-
if (typeof value === "string") {
|
|
1737
|
-
if (/url|link/i.test(key) || value.includes("/#/")) {
|
|
1738
|
-
obj[key] = normalizeResourceUrls(value, host, sourceHost);
|
|
1739
|
-
}
|
|
1740
|
-
} else if (value && typeof value === "object") {
|
|
1741
|
-
normalizeResourceUrlFields(value, host, sourceHost);
|
|
1742
|
-
}
|
|
1743
|
-
}
|
|
1744
|
-
}
|
|
1745
|
-
function normalizeResourceUrls(s, host, sourceHost = host) {
|
|
1746
|
-
const base = host.replace(/\/+$/, "");
|
|
1747
|
-
const sourceBase = sourceHost.replace(/\/+$/, "");
|
|
1748
|
-
if (sourceBase && sourceBase !== base) {
|
|
1749
|
-
s = s.replace(new RegExp(`${escapeRegExp(sourceBase)}/#`, "g"), `${base}/#`);
|
|
1750
|
-
}
|
|
1751
|
-
s = s.replace(/\]\((\/(?!\/)[^)]*)\)/g, `](${base}$1)`);
|
|
1752
|
-
if (/^\/(?!\/)/.test(s)) s = base + s;
|
|
1753
|
-
return s;
|
|
1754
|
-
}
|
|
1755
|
-
function resolvePublicWebHost(host) {
|
|
1756
|
-
const override = process.env.AE_CLI_PUBLIC_WEB_URL || process.env.AE_CLI_WEB_HOST;
|
|
1757
|
-
if (override?.trim()) {
|
|
1758
|
-
return override.trim().replace(/\/+$/, "");
|
|
1759
|
-
}
|
|
1760
|
-
try {
|
|
1761
|
-
const url = new URL(host);
|
|
1762
|
-
if ((url.hostname === "127.0.0.1" || url.hostname === "localhost") && LOCAL_BACKEND_PORTS.has(url.port)) {
|
|
1763
|
-
url.port = "10010";
|
|
1764
|
-
return url.toString().replace(/\/+$/, "");
|
|
1765
|
-
}
|
|
1766
|
-
} catch {
|
|
1767
|
-
}
|
|
1768
|
-
return host.replace(/\/+$/, "");
|
|
1769
|
-
}
|
|
1770
|
-
function escapeRegExp(value) {
|
|
1771
|
-
return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1734
|
+
return input2;
|
|
1772
1735
|
}
|
|
1773
1736
|
|
|
1774
1737
|
// src/commands/te-analysis/meta/asset/url-get.ts
|
|
@@ -2384,19 +2347,19 @@ var metadataGovernanceRecommendationAutoReview = {
|
|
|
2384
2347
|
autoReviewInput(ctx)
|
|
2385
2348
|
),
|
|
2386
2349
|
execute: async (ctx) => withAutoReviewAgentContext(async () => {
|
|
2387
|
-
const
|
|
2350
|
+
const input2 = autoReviewInput(ctx);
|
|
2388
2351
|
if (hasExplicitLimit(ctx)) {
|
|
2389
|
-
await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID,
|
|
2390
|
-
const finalExport = await exportRecommendationMaterial(ctx,
|
|
2391
|
-
const result2 = await executeCliAgentAutoReview(ctx,
|
|
2352
|
+
await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID, input2);
|
|
2353
|
+
const finalExport = await exportRecommendationMaterial(ctx, input2, numberValue(input2.limit) || DEFAULT_LIMIT);
|
|
2354
|
+
const result2 = await executeCliAgentAutoReview(ctx, input2, finalExport.data);
|
|
2392
2355
|
return withOutputMetadata({
|
|
2393
2356
|
...record(result2.data),
|
|
2394
2357
|
manual_review_handoff: buildManualReviewHandoff(result2.data, finalExport.data)
|
|
2395
2358
|
}, result2.meta);
|
|
2396
2359
|
}
|
|
2397
|
-
const plan = await planBoundedExpansion(ctx,
|
|
2360
|
+
const plan = await planBoundedExpansion(ctx, input2);
|
|
2398
2361
|
const expansion = plan.expansion;
|
|
2399
|
-
const finalInput = { ...
|
|
2362
|
+
const finalInput = { ...input2, limit: expansion.final_limit };
|
|
2400
2363
|
const result = await executeCliAgentAutoReview(ctx, finalInput, plan.finalExport);
|
|
2401
2364
|
if (result.data && typeof result.data === "object" && !Array.isArray(result.data)) {
|
|
2402
2365
|
return withOutputMetadata({
|
|
@@ -2428,8 +2391,8 @@ function gatewayDomain() {
|
|
|
2428
2391
|
function hasExplicitLimit(ctx) {
|
|
2429
2392
|
return typeof ctx.has === "function" ? ctx.has("limit") : ctx.str("limit") !== "";
|
|
2430
2393
|
}
|
|
2431
|
-
async function executeCliAgentAutoReview(ctx,
|
|
2432
|
-
const review = buildCliAgentAutoReview(
|
|
2394
|
+
async function executeCliAgentAutoReview(ctx, input2, exportResult) {
|
|
2395
|
+
const review = buildCliAgentAutoReview(input2, exportResult);
|
|
2433
2396
|
if (review.decisions.length === 0) {
|
|
2434
2397
|
return {
|
|
2435
2398
|
data: {
|
|
@@ -2444,7 +2407,7 @@ async function executeCliAgentAutoReview(ctx, input, exportResult) {
|
|
|
2444
2407
|
};
|
|
2445
2408
|
}
|
|
2446
2409
|
const submitted = await executeCapabilityWithEnvelope(ctx.host(), gatewayDomain(), SUBMIT_CAPABILITY_ID, {
|
|
2447
|
-
...
|
|
2410
|
+
...input2,
|
|
2448
2411
|
run_id: review.runId,
|
|
2449
2412
|
snapshot_hash: review.snapshotHash,
|
|
2450
2413
|
topic_id: "agent_auto_asset_certification",
|
|
@@ -2464,9 +2427,9 @@ async function executeCliAgentAutoReview(ctx, input, exportResult) {
|
|
|
2464
2427
|
meta: submitted.meta
|
|
2465
2428
|
};
|
|
2466
2429
|
}
|
|
2467
|
-
async function planBoundedExpansion(ctx,
|
|
2430
|
+
async function planBoundedExpansion(ctx, input2) {
|
|
2468
2431
|
await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID, {
|
|
2469
|
-
...
|
|
2432
|
+
...input2,
|
|
2470
2433
|
limit: DEFAULT_LIMIT
|
|
2471
2434
|
});
|
|
2472
2435
|
const attempts = [];
|
|
@@ -2474,7 +2437,7 @@ async function planBoundedExpansion(ctx, input) {
|
|
|
2474
2437
|
let finalLimit = DEFAULT_LIMIT;
|
|
2475
2438
|
let stopReason = "top_100_inspected";
|
|
2476
2439
|
for (const limit2 of EXPANSION_LIMITS) {
|
|
2477
|
-
const exported = await exportRecommendationMaterial(ctx,
|
|
2440
|
+
const exported = await exportRecommendationMaterial(ctx, input2, limit2);
|
|
2478
2441
|
finalExport = exported.data;
|
|
2479
2442
|
const summary = summarizeExport(exported.data, limit2);
|
|
2480
2443
|
attempts.push(summary);
|
|
@@ -2506,12 +2469,12 @@ async function planBoundedExpansion(ctx, input) {
|
|
|
2506
2469
|
finalExport
|
|
2507
2470
|
};
|
|
2508
2471
|
}
|
|
2509
|
-
function exportRecommendationMaterial(ctx,
|
|
2472
|
+
function exportRecommendationMaterial(ctx, input2, limit2) {
|
|
2510
2473
|
return executeCapabilityWithEnvelope(
|
|
2511
2474
|
ctx.host(),
|
|
2512
2475
|
gatewayDomain(),
|
|
2513
2476
|
EXPORT_CAPABILITY_ID,
|
|
2514
|
-
compactInput({ ...
|
|
2477
|
+
compactInput({ ...input2, limit: limit2, include_completed: false })
|
|
2515
2478
|
);
|
|
2516
2479
|
}
|
|
2517
2480
|
function summarizeExport(result, requestedLimit) {
|
|
@@ -2547,7 +2510,7 @@ function countPendingAssetCandidates(workUnits) {
|
|
|
2547
2510
|
}
|
|
2548
2511
|
return seen.size;
|
|
2549
2512
|
}
|
|
2550
|
-
function buildCliAgentAutoReview(
|
|
2513
|
+
function buildCliAgentAutoReview(input2, exportResult) {
|
|
2551
2514
|
const exported = record(exportResult);
|
|
2552
2515
|
const material = record(exported.review_material_package);
|
|
2553
2516
|
const candidates = array(material.candidate_assets).map(record);
|
|
@@ -2588,9 +2551,9 @@ function buildCliAgentAutoReview(input, exportResult) {
|
|
|
2588
2551
|
base: {
|
|
2589
2552
|
schema_version: "1.0",
|
|
2590
2553
|
run_id: runId,
|
|
2591
|
-
project_id:
|
|
2592
|
-
window_days:
|
|
2593
|
-
dashboard_limit:
|
|
2554
|
+
project_id: input2.project_id ?? exported.project_id,
|
|
2555
|
+
window_days: input2.window_days ?? exported.window_days,
|
|
2556
|
+
dashboard_limit: input2.limit ?? exported.dashboard_limit,
|
|
2594
2557
|
snapshot_hash: snapshotHash,
|
|
2595
2558
|
rule_version: "agent_auto_asset_certification_v1",
|
|
2596
2559
|
config_key: "agent_auto_asset_certification_enabled",
|
|
@@ -3238,9 +3201,9 @@ var agentReviewSubmitToPage = createAnalysisMetaCapabilityCommand({
|
|
|
3238
3201
|
const publicWebHost = resolvePublicWebHost(ctx.host());
|
|
3239
3202
|
const file = ctx.str("input-file");
|
|
3240
3203
|
if (file) {
|
|
3241
|
-
const
|
|
3204
|
+
const input2 = object(JSON.parse(readFileSync(file, "utf8")), "--input-file");
|
|
3242
3205
|
return normalizeSubmitInput(validateInput({
|
|
3243
|
-
...
|
|
3206
|
+
...input2,
|
|
3244
3207
|
...projectInput2(ctx),
|
|
3245
3208
|
client_request_id: text(ctx, "client-request-id")
|
|
3246
3209
|
}), publicWebHost, ctx.host());
|
|
@@ -3265,8 +3228,8 @@ var agentReviewSubmitToPage = createAnalysisMetaCapabilityCommand({
|
|
|
3265
3228
|
},
|
|
3266
3229
|
postProcess: (result, _input, ctx) => normalizeSubmitResult(result, resolvePublicWebHost(ctx.host()), ctx.host())
|
|
3267
3230
|
});
|
|
3268
|
-
function validateInput(
|
|
3269
|
-
const items = array2(
|
|
3231
|
+
function validateInput(input2) {
|
|
3232
|
+
const items = array2(input2.items, "items").map((value) => {
|
|
3270
3233
|
const item2 = object(value, "items[]");
|
|
3271
3234
|
fields(item2, [
|
|
3272
3235
|
"client_item_id",
|
|
@@ -3305,7 +3268,7 @@ function validateInput(input) {
|
|
|
3305
3268
|
return item2;
|
|
3306
3269
|
});
|
|
3307
3270
|
unique(items.map((item2) => item2.client_item_id), "client_item_id");
|
|
3308
|
-
fields(
|
|
3271
|
+
fields(input2, [
|
|
3309
3272
|
"project_id",
|
|
3310
3273
|
"review_type",
|
|
3311
3274
|
"schema_version",
|
|
@@ -3318,12 +3281,12 @@ function validateInput(input) {
|
|
|
3318
3281
|
"presentation_snapshot",
|
|
3319
3282
|
"items"
|
|
3320
3283
|
], "submit-to-page input");
|
|
3321
|
-
object(
|
|
3322
|
-
validatePresentation(object(
|
|
3323
|
-
if (
|
|
3284
|
+
object(input2.ai_summary, "ai_summary");
|
|
3285
|
+
validatePresentation(object(input2.presentation_snapshot, "presentation_snapshot"), new Set(items.map((item2) => item2.client_item_id)));
|
|
3286
|
+
if (input2.review_type !== "ASSET_GOVERNANCE" || input2.schema_version !== "1.0") {
|
|
3324
3287
|
throw new Error("submit-to-page input requires review_type=ASSET_GOVERNANCE and schema_version=1.0.");
|
|
3325
3288
|
}
|
|
3326
|
-
return { ...
|
|
3289
|
+
return { ...input2, items };
|
|
3327
3290
|
}
|
|
3328
3291
|
function validateItemAiSummary(aiSummary, name) {
|
|
3329
3292
|
if (!meaningfulText(aiSummary.summary)) {
|
|
@@ -3450,9 +3413,9 @@ function validatePresentation(presentation, itemIds) {
|
|
|
3450
3413
|
}
|
|
3451
3414
|
}
|
|
3452
3415
|
}
|
|
3453
|
-
function normalizeSubmitInput(
|
|
3454
|
-
normalizeResourceUrlFields(
|
|
3455
|
-
return
|
|
3416
|
+
function normalizeSubmitInput(input2, publicWebHost, sourceHost) {
|
|
3417
|
+
normalizeResourceUrlFields(input2, publicWebHost, sourceHost);
|
|
3418
|
+
return input2;
|
|
3456
3419
|
}
|
|
3457
3420
|
function normalizeSubmitResult(result, publicWebHost, sourceHost) {
|
|
3458
3421
|
normalizeResourceUrlFields(result, publicWebHost, sourceHost);
|
|
@@ -3944,7 +3907,7 @@ function validateAuthenticationExport(ctx) {
|
|
|
3944
3907
|
}
|
|
3945
3908
|
}
|
|
3946
3909
|
function authenticationExportPostProcess() {
|
|
3947
|
-
return async (result,
|
|
3910
|
+
return async (result, input2, ctx) => {
|
|
3948
3911
|
if (typeof result !== "object" || result === null) {
|
|
3949
3912
|
throw new Error("Asset-authentication export returned an invalid response");
|
|
3950
3913
|
}
|
|
@@ -3980,7 +3943,7 @@ function authenticationExportPostProcess() {
|
|
|
3980
3943
|
const checksum = hash.digest("hex");
|
|
3981
3944
|
const metadata = {
|
|
3982
3945
|
complete: true,
|
|
3983
|
-
project_id:
|
|
3946
|
+
project_id: input2.project_id,
|
|
3984
3947
|
total: rows.length,
|
|
3985
3948
|
stat_as_of: data.stat_as_of,
|
|
3986
3949
|
snapshot_hash: data.snapshot_hash,
|
|
@@ -4133,7 +4096,7 @@ var expectedSnapshotHashFlag = {
|
|
|
4133
4096
|
name: "expected-snapshot-hash",
|
|
4134
4097
|
type: "string",
|
|
4135
4098
|
required: false,
|
|
4136
|
-
desc: "
|
|
4099
|
+
desc: "Deprecated compatibility no-op. Project snapshots are not checked; only specified assets are updated."
|
|
4137
4100
|
};
|
|
4138
4101
|
var analysisGovernanceAssetAuthenticationUpdate = createAnalysisGovernanceCapabilityCommand({
|
|
4139
4102
|
resource: "asset-authentication",
|
|
@@ -4151,13 +4114,17 @@ var analysisGovernanceAssetAuthenticationUpdate = createAnalysisGovernanceCapabi
|
|
|
4151
4114
|
requestIdFlag
|
|
4152
4115
|
],
|
|
4153
4116
|
risk: "write",
|
|
4154
|
-
buildInput: (ctx) =>
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4160
|
-
|
|
4117
|
+
buildInput: (ctx) => {
|
|
4118
|
+
if (optionalString(ctx, "expected-snapshot-hash") !== void 0) {
|
|
4119
|
+
process.stderr.write("Warning: --expected-snapshot-hash is deprecated and ignored. Only the specified assets are updated; project snapshots are not checked.\n");
|
|
4120
|
+
}
|
|
4121
|
+
return compactInput({
|
|
4122
|
+
project_id: ctx.num("project-id"),
|
|
4123
|
+
authentication_status: ctx.num("authentication-status"),
|
|
4124
|
+
asset_refs: assetRefsInput(ctx),
|
|
4125
|
+
request_id: optionalString(ctx, "request-id")
|
|
4126
|
+
});
|
|
4127
|
+
}
|
|
4161
4128
|
});
|
|
4162
4129
|
|
|
4163
4130
|
// src/commands/te-analysis/governance/index.ts
|
|
@@ -8531,7 +8498,7 @@ function memberGroupNameInput(ctx) {
|
|
|
8531
8498
|
return { group_name: name };
|
|
8532
8499
|
}
|
|
8533
8500
|
function memberGroupChangeInput(ctx) {
|
|
8534
|
-
const
|
|
8501
|
+
const input2 = memberGroupInput(ctx);
|
|
8535
8502
|
let userIds;
|
|
8536
8503
|
try {
|
|
8537
8504
|
userIds = ctx.json("user-ids");
|
|
@@ -8541,7 +8508,7 @@ function memberGroupChangeInput(ctx) {
|
|
|
8541
8508
|
if (!Array.isArray(userIds) || userIds.length === 0 || userIds.length > 1e3 || userIds.some((id) => !Number.isSafeInteger(id) || id < 1 || id > MAX_ID)) {
|
|
8542
8509
|
throw new CliValidationError("--user-ids must contain 1 to 1000 positive integer user IDs.");
|
|
8543
8510
|
}
|
|
8544
|
-
return { ...
|
|
8511
|
+
return { ...input2, user_ids: userIds, yes: true };
|
|
8545
8512
|
}
|
|
8546
8513
|
|
|
8547
8514
|
// src/commands/te-analysis/project/member-group/add-members.ts
|
|
@@ -8711,7 +8678,7 @@ var projectOwnerUpdate = createAnalysisCapabilityCommand({
|
|
|
8711
8678
|
flags: [
|
|
8712
8679
|
projectIdFlag,
|
|
8713
8680
|
{ name: "company-id", type: "number", required: true, desc: "Company ID." },
|
|
8714
|
-
{ name: "owner-user-id", type: "number", required: false, desc: "New owner user ID. Omit
|
|
8681
|
+
{ name: "owner-user-id", type: "number", required: false, desc: "New owner user ID. Common treats a company root as company-admin management. Omit for the same behavior; the existing owner is downgraded." },
|
|
8715
8682
|
{ name: "project-name", type: "string", required: false, desc: "Optional project name update." },
|
|
8716
8683
|
{ name: "project-remark", type: "string", required: false, desc: "Optional project remark update." }
|
|
8717
8684
|
],
|
|
@@ -9777,7 +9744,7 @@ var trackingPlanSyncDisplayNames = {
|
|
|
9777
9744
|
};
|
|
9778
9745
|
}
|
|
9779
9746
|
};
|
|
9780
|
-
async function fetchAllDirectoryItems(host, capabilityId,
|
|
9747
|
+
async function fetchAllDirectoryItems(host, capabilityId, input2, arrayField) {
|
|
9781
9748
|
const items = [];
|
|
9782
9749
|
let offset = 0;
|
|
9783
9750
|
const visitedOffsets = /* @__PURE__ */ new Set();
|
|
@@ -9787,7 +9754,7 @@ async function fetchAllDirectoryItems(host, capabilityId, input, arrayField) {
|
|
|
9787
9754
|
}
|
|
9788
9755
|
visitedOffsets.add(offset);
|
|
9789
9756
|
const result = await executeCapability(host, GATEWAY_DOMAIN, capabilityId, {
|
|
9790
|
-
...
|
|
9757
|
+
...input2,
|
|
9791
9758
|
limit: DIRECTORY_PAGE_SIZE,
|
|
9792
9759
|
offset
|
|
9793
9760
|
});
|
|
@@ -10164,14 +10131,14 @@ var trackingDebugDataList = createTrackingCapabilityCommand({
|
|
|
10164
10131
|
start_time: optionalString(ctx, "start-time") ?? formatLocalTime(new Date(Date.now() - 60 * 60 * 1e3)),
|
|
10165
10132
|
event_name: optionalString(ctx, "event-name")
|
|
10166
10133
|
}),
|
|
10167
|
-
postProcess: (result,
|
|
10134
|
+
postProcess: (result, input2) => {
|
|
10168
10135
|
const data = isRecord3(result) ? result : {};
|
|
10169
10136
|
const eventList = Array.isArray(data.event_list) ? data.event_list : [];
|
|
10170
10137
|
const deviceDataList = Array.isArray(data.device_data_list) ? data.device_data_list : [];
|
|
10171
10138
|
return {
|
|
10172
|
-
device_id:
|
|
10173
|
-
start_time:
|
|
10174
|
-
...
|
|
10139
|
+
device_id: input2.device_id,
|
|
10140
|
+
start_time: input2.start_time,
|
|
10141
|
+
...input2.event_name ? { event_name: input2.event_name } : {},
|
|
10175
10142
|
has_data: deviceDataList.length > 0,
|
|
10176
10143
|
event_count: eventList.length,
|
|
10177
10144
|
data_count: deviceDataList.length,
|
|
@@ -10463,21 +10430,21 @@ function defineSystemCommand(spec) {
|
|
|
10463
10430
|
risk: spec.risk,
|
|
10464
10431
|
validate: (ctx) => {
|
|
10465
10432
|
validateSecretSources(ctx, secrets);
|
|
10466
|
-
const
|
|
10433
|
+
const input2 = buildSystemInput(ctx, fields2, [], spec.capabilityId);
|
|
10467
10434
|
for (const secret of secrets) {
|
|
10468
10435
|
if (ctx.str(`${secret.flag}-file`) || ctx.bool(`${secret.flag}-stdin`)) {
|
|
10469
|
-
|
|
10436
|
+
input2[secret.input] = "<provided>";
|
|
10470
10437
|
}
|
|
10471
10438
|
}
|
|
10472
|
-
validateFields(fields2,
|
|
10473
|
-
spec.validate?.(ctx,
|
|
10439
|
+
validateFields(fields2, input2);
|
|
10440
|
+
spec.validate?.(ctx, input2);
|
|
10474
10441
|
},
|
|
10475
10442
|
buildInput: (ctx) => {
|
|
10476
|
-
const
|
|
10477
|
-
validateFields(fields2,
|
|
10443
|
+
const input2 = buildSystemInput(ctx, fields2, secrets, spec.capabilityId);
|
|
10444
|
+
validateFields(fields2, input2);
|
|
10478
10445
|
validateSecretSources(ctx, secrets);
|
|
10479
|
-
spec.validate?.(ctx,
|
|
10480
|
-
return
|
|
10446
|
+
spec.validate?.(ctx, input2);
|
|
10447
|
+
return input2;
|
|
10481
10448
|
}
|
|
10482
10449
|
});
|
|
10483
10450
|
}
|
|
@@ -10511,17 +10478,17 @@ function secretFlags(secret) {
|
|
|
10511
10478
|
];
|
|
10512
10479
|
}
|
|
10513
10480
|
function buildSystemInput(ctx, fields2, secrets, capabilityId) {
|
|
10514
|
-
const
|
|
10481
|
+
const input2 = {};
|
|
10515
10482
|
for (const field of fields2) {
|
|
10516
10483
|
const value = fieldValue(ctx, field);
|
|
10517
|
-
if (value !== void 0)
|
|
10484
|
+
if (value !== void 0) input2[field.input ?? kebabToSnake(field.flag)] = value;
|
|
10518
10485
|
}
|
|
10519
10486
|
for (const secret of secrets) {
|
|
10520
10487
|
const value = secretValue(ctx, secret);
|
|
10521
|
-
if (value !== void 0)
|
|
10488
|
+
if (value !== void 0) input2[secret.input] = secret.transform ? secret.transform(value) : value;
|
|
10522
10489
|
}
|
|
10523
|
-
if (backendConfirmationCapabilities.has(capabilityId))
|
|
10524
|
-
return compactInput(
|
|
10490
|
+
if (backendConfirmationCapabilities.has(capabilityId)) input2.yes = true;
|
|
10491
|
+
return compactInput(input2);
|
|
10525
10492
|
}
|
|
10526
10493
|
function fieldValue(ctx, field) {
|
|
10527
10494
|
const raw = ctx.str(field.flag);
|
|
@@ -10531,10 +10498,10 @@ function fieldValue(ctx, field) {
|
|
|
10531
10498
|
if (field.type === "boolean") return ctx.bool(field.flag);
|
|
10532
10499
|
return ctx.json(field.flag);
|
|
10533
10500
|
}
|
|
10534
|
-
function validateFields(fields2,
|
|
10501
|
+
function validateFields(fields2, input2) {
|
|
10535
10502
|
for (const field of fields2) {
|
|
10536
10503
|
const inputName = field.input ?? kebabToSnake(field.flag);
|
|
10537
|
-
const value =
|
|
10504
|
+
const value = input2[inputName];
|
|
10538
10505
|
if (field.required && value === void 0) {
|
|
10539
10506
|
throw validation(`--${field.flag} is required.`);
|
|
10540
10507
|
}
|
|
@@ -10593,15 +10560,15 @@ function nonEmptySecret(value, flag) {
|
|
|
10593
10560
|
if (normalized.length === 0) throw validation(`Secret input for --${flag} must not be empty.`);
|
|
10594
10561
|
return normalized;
|
|
10595
10562
|
}
|
|
10596
|
-
function requireAtLeastOne(
|
|
10563
|
+
function requireAtLeastOne(input2, names, message) {
|
|
10597
10564
|
const present = names.some((name) => {
|
|
10598
|
-
const value =
|
|
10565
|
+
const value = input2[name];
|
|
10599
10566
|
return Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== "";
|
|
10600
10567
|
});
|
|
10601
10568
|
if (!present) throw validation(message);
|
|
10602
10569
|
}
|
|
10603
|
-
function requireArrayObjects(
|
|
10604
|
-
const value =
|
|
10570
|
+
function requireArrayObjects(input2, name, requiredKeys) {
|
|
10571
|
+
const value = input2[name];
|
|
10605
10572
|
if (value === void 0) return;
|
|
10606
10573
|
if (!Array.isArray(value)) throw validation(`${snakeToFlag(name)} must be a JSON array.`);
|
|
10607
10574
|
value.forEach((item2, index) => {
|
|
@@ -10729,8 +10696,8 @@ var systemConfigurationCommands = [
|
|
|
10729
10696
|
{ flag: "original-address-url", type: "string", desc: "Original URL when changing an existing address." },
|
|
10730
10697
|
{ flag: "original-address-type", type: "string", desc: "Original address type.", allowed: ["public", "private"] }
|
|
10731
10698
|
],
|
|
10732
|
-
validate: (_ctx,
|
|
10733
|
-
if (
|
|
10699
|
+
validate: (_ctx, input2) => {
|
|
10700
|
+
if (input2.scope === "project" && (!Array.isArray(input2.project_ids) || input2.project_ids.length === 0)) {
|
|
10734
10701
|
throw validation("--project-ids is required when --scope project.");
|
|
10735
10702
|
}
|
|
10736
10703
|
}
|
|
@@ -10808,14 +10775,14 @@ var systemConfigurationCommands = [
|
|
|
10808
10775
|
{ input: "app_secret", flag: "app-secret", required: true, desc: "Provider application secret." },
|
|
10809
10776
|
{ input: "dd_scan_app_secret", flag: "dd-scan-app-secret", desc: "DingTalk scan-login application secret." }
|
|
10810
10777
|
],
|
|
10811
|
-
validate: (_ctx,
|
|
10812
|
-
if (
|
|
10778
|
+
validate: (_ctx, input2) => {
|
|
10779
|
+
if (input2.login_type === "wecom" && !input2.corp_id) {
|
|
10813
10780
|
throw validation("--corp-id is required for wecom.");
|
|
10814
10781
|
}
|
|
10815
|
-
if (
|
|
10816
|
-
requireAtLeastOne(
|
|
10782
|
+
if (input2.login_type === "dingtalk") {
|
|
10783
|
+
requireAtLeastOne(input2, ["corp_id"], "--corp-id is required for dingtalk.");
|
|
10817
10784
|
for (const name of ["agent_id", "dd_scan_app_id", "dd_scan_app_secret"]) {
|
|
10818
|
-
if (!
|
|
10785
|
+
if (!input2[name]) throw validation(`--${name.replaceAll("_", "-")} is required for dingtalk.`);
|
|
10819
10786
|
}
|
|
10820
10787
|
}
|
|
10821
10788
|
}
|
|
@@ -10869,9 +10836,9 @@ var systemIdentityCommands = [
|
|
|
10869
10836
|
fields: [
|
|
10870
10837
|
{ flag: "members", type: "json", required: true, array: true, desc: "Member array with login_name and user_name." }
|
|
10871
10838
|
],
|
|
10872
|
-
validate: (_ctx,
|
|
10873
|
-
requireAtLeastOne(
|
|
10874
|
-
requireArrayObjects(
|
|
10839
|
+
validate: (_ctx, input2) => {
|
|
10840
|
+
requireAtLeastOne(input2, ["members"], "Provide a non-empty --members array.");
|
|
10841
|
+
requireArrayObjects(input2, "members", ["login_name", "user_name"]);
|
|
10875
10842
|
}
|
|
10876
10843
|
}),
|
|
10877
10844
|
defineSystemCommand({
|
|
@@ -10907,10 +10874,10 @@ var systemIdentityCommands = [
|
|
|
10907
10874
|
{ flag: "project-updates", type: "json", array: true, desc: "Project update array: project_id, role_names, and optional data_power_id." },
|
|
10908
10875
|
{ flag: "project-removals", type: "json", array: true, desc: "Project removal and handover array." }
|
|
10909
10876
|
],
|
|
10910
|
-
validate: (_ctx,
|
|
10911
|
-
requireAtLeastOne(
|
|
10912
|
-
requireArrayObjects(
|
|
10913
|
-
requireArrayObjects(
|
|
10877
|
+
validate: (_ctx, input2) => {
|
|
10878
|
+
requireAtLeastOne(input2, ["project_updates", "project_removals"], "Provide a non-empty --project-updates or --project-removals array.");
|
|
10879
|
+
requireArrayObjects(input2, "project_updates", ["project_id", "role_names"]);
|
|
10880
|
+
requireArrayObjects(input2, "project_removals", ["project_id", "handover_type"]);
|
|
10914
10881
|
}
|
|
10915
10882
|
}),
|
|
10916
10883
|
defineSystemCommand({
|
|
@@ -10939,7 +10906,7 @@ var systemIdentityCommands = [
|
|
|
10939
10906
|
fields: [
|
|
10940
10907
|
{ flag: "admins", type: "json", required: true, array: true, desc: "Administrator array with target_user_id and function_names." }
|
|
10941
10908
|
],
|
|
10942
|
-
validate: (_ctx,
|
|
10909
|
+
validate: (_ctx, input2) => requireArrayObjects(input2, "admins", ["target_user_id", "function_names"])
|
|
10943
10910
|
}),
|
|
10944
10911
|
defineSystemCommand({
|
|
10945
10912
|
resource: "admin-function",
|
|
@@ -10959,7 +10926,7 @@ var systemIdentityCommands = [
|
|
|
10959
10926
|
targetOpenId,
|
|
10960
10927
|
{ flag: "function-names", type: "json", required: true, array: true, desc: "Complete function-name JSON array." }
|
|
10961
10928
|
],
|
|
10962
|
-
validate: (_ctx,
|
|
10929
|
+
validate: (_ctx, input2) => requireAtLeastOne(input2, ["function_names"], "--function-names must contain at least one function.")
|
|
10963
10930
|
}),
|
|
10964
10931
|
defineSystemCommand({
|
|
10965
10932
|
resource: "admin",
|
|
@@ -10996,7 +10963,7 @@ var systemIdentityCommands = [
|
|
|
10996
10963
|
{ flag: "role-desc", type: "string", required: true, desc: "Role description." },
|
|
10997
10964
|
{ flag: "function-names", type: "json", required: true, array: true, desc: "Complete function-name JSON array." }
|
|
10998
10965
|
],
|
|
10999
|
-
validate: (_ctx,
|
|
10966
|
+
validate: (_ctx, input2) => requireAtLeastOne(input2, ["function_names"], "--function-names must contain at least one function.")
|
|
11000
10967
|
}),
|
|
11001
10968
|
defineSystemCommand({
|
|
11002
10969
|
resource: "role",
|
|
@@ -11055,7 +11022,7 @@ var systemIdentityCommands = [
|
|
|
11055
11022
|
{ flag: "seat-type", type: "string", required: true, desc: "Seat type; empty removes seats.", allowed: ["manage", "view", "empty"] },
|
|
11056
11023
|
{ flag: "open-ids", type: "json", required: true, array: true, desc: "Company member open-ID JSON array." }
|
|
11057
11024
|
],
|
|
11058
|
-
validate: (_ctx,
|
|
11025
|
+
validate: (_ctx, input2) => requireAtLeastOne(input2, ["open_ids"], "--open-ids must contain at least one company member.")
|
|
11059
11026
|
})
|
|
11060
11027
|
];
|
|
11061
11028
|
|
|
@@ -11080,15 +11047,15 @@ var monitorTimeFields = [
|
|
|
11080
11047
|
desc: "Inclusive completion-time range end, including the entire second, yyyy-MM-dd HH:mm:ss."
|
|
11081
11048
|
}
|
|
11082
11049
|
];
|
|
11083
|
-
function validateTaskQueryInput(
|
|
11084
|
-
validateMonitorScope(
|
|
11050
|
+
function validateTaskQueryInput(input2) {
|
|
11051
|
+
validateMonitorScope(input2);
|
|
11085
11052
|
for (const name of ["status_codes", "content_codes", "task_type_codes"]) {
|
|
11086
|
-
requireAtLeastOne(
|
|
11053
|
+
requireAtLeastOne(input2, [name], `--${name.replaceAll("_", "-")} must be a non-empty JSON array.`);
|
|
11087
11054
|
}
|
|
11088
11055
|
}
|
|
11089
|
-
function validateMonitorScope(
|
|
11056
|
+
function validateMonitorScope(input2) {
|
|
11090
11057
|
requireAtLeastOne(
|
|
11091
|
-
|
|
11058
|
+
input2,
|
|
11092
11059
|
["project_ids", "space_codes"],
|
|
11093
11060
|
"Provide a non-empty --project-ids or --space-codes array."
|
|
11094
11061
|
);
|
|
@@ -11113,7 +11080,7 @@ var systemMonitoringCommands = [
|
|
|
11113
11080
|
{ flag: "cluster-names", type: "json", required: true, array: true, desc: "Query cluster-name JSON array." },
|
|
11114
11081
|
{ flag: "point-interval-seconds", type: "number", min: 5, max: 300, desc: "Chart sample interval seconds. Default: 5." }
|
|
11115
11082
|
],
|
|
11116
|
-
validate: (_ctx,
|
|
11083
|
+
validate: (_ctx, input2) => validateMonitorScope(input2)
|
|
11117
11084
|
}),
|
|
11118
11085
|
defineSystemCommand({
|
|
11119
11086
|
resource: "query-task",
|
|
@@ -11139,7 +11106,7 @@ var systemMonitoringCommands = [
|
|
|
11139
11106
|
offsetField,
|
|
11140
11107
|
fieldsField
|
|
11141
11108
|
],
|
|
11142
|
-
validate: (_ctx,
|
|
11109
|
+
validate: (_ctx, input2) => validateTaskQueryInput(input2)
|
|
11143
11110
|
}),
|
|
11144
11111
|
defineSystemCommand({
|
|
11145
11112
|
resource: "query-task",
|
|
@@ -11154,11 +11121,11 @@ var systemMonitoringCommands = [
|
|
|
11154
11121
|
{ flag: "status-codes", type: "json", array: true, desc: "Optional task status-code JSON array." },
|
|
11155
11122
|
{ flag: "limit", type: "number", min: 1, max: 200, desc: "Maximum returned tasks. Default: 100, max: 200." }
|
|
11156
11123
|
],
|
|
11157
|
-
validate: (_ctx,
|
|
11158
|
-
validateMonitorScope(
|
|
11159
|
-
requireAtLeastOne(
|
|
11160
|
-
if (
|
|
11161
|
-
requireAtLeastOne(
|
|
11124
|
+
validate: (_ctx, input2) => {
|
|
11125
|
+
validateMonitorScope(input2);
|
|
11126
|
+
requireAtLeastOne(input2, ["cluster_names"], "--cluster-names must be a non-empty JSON array.");
|
|
11127
|
+
if (input2.status_codes !== void 0) {
|
|
11128
|
+
requireAtLeastOne(input2, ["status_codes"], "--status-codes must be a non-empty JSON array.");
|
|
11162
11129
|
}
|
|
11163
11130
|
}
|
|
11164
11131
|
}),
|
|
@@ -11212,7 +11179,7 @@ var systemMonitoringCommands = [
|
|
|
11212
11179
|
desc: "Maximum export runtime in seconds. Default and max: 21600."
|
|
11213
11180
|
}
|
|
11214
11181
|
],
|
|
11215
|
-
validate: (_ctx,
|
|
11182
|
+
validate: (_ctx, input2) => validateTaskQueryInput(input2)
|
|
11216
11183
|
}),
|
|
11217
11184
|
defineSystemCommand({
|
|
11218
11185
|
resource: "node-monitor",
|
|
@@ -11243,14 +11210,14 @@ var systemMonitoringCommands = [
|
|
|
11243
11210
|
{ flag: "upserts", type: "json", array: true, desc: "Rule upsert JSON array." },
|
|
11244
11211
|
{ flag: "delete-ids", type: "json", array: true, desc: "Positive rule-ID JSON array to delete." }
|
|
11245
11212
|
],
|
|
11246
|
-
validate: (_ctx,
|
|
11247
|
-
requireAtLeastOne(
|
|
11248
|
-
requireArrayObjects(
|
|
11249
|
-
const deleteIds =
|
|
11213
|
+
validate: (_ctx, input2) => {
|
|
11214
|
+
requireAtLeastOne(input2, ["upserts", "delete_ids"], "Provide a non-empty --upserts or --delete-ids array.");
|
|
11215
|
+
requireArrayObjects(input2, "upserts", ["metric_content", "wheel_minutes", "wheel_interval", "threshold"]);
|
|
11216
|
+
const deleteIds = input2.delete_ids;
|
|
11250
11217
|
if (deleteIds?.some((id) => !Number.isInteger(id) || Number(id) <= 0)) {
|
|
11251
11218
|
throw validation("--delete-ids must contain positive integers.");
|
|
11252
11219
|
}
|
|
11253
|
-
const upserts =
|
|
11220
|
+
const upserts = input2.upserts;
|
|
11254
11221
|
for (const [index, item2] of (upserts ?? []).entries()) {
|
|
11255
11222
|
const metric = Number(item2.metric_content);
|
|
11256
11223
|
const wheelMinutes = Number(item2.wheel_minutes);
|
|
@@ -11291,12 +11258,12 @@ var systemMonitoringCommands = [
|
|
|
11291
11258
|
{ flag: "on-status", type: "number", allowed: [0, 1], desc: "Enable state: 0 or 1; required on create." }
|
|
11292
11259
|
],
|
|
11293
11260
|
secrets: contactWebhookSecrets,
|
|
11294
|
-
validate: (_ctx,
|
|
11295
|
-
if (
|
|
11296
|
-
if (!
|
|
11297
|
-
if (
|
|
11261
|
+
validate: (_ctx, input2) => {
|
|
11262
|
+
if (input2.contact_id === void 0) {
|
|
11263
|
+
if (!input2.name) throw validation("--name is required when creating a contact.");
|
|
11264
|
+
if (input2.on_status === void 0) throw validation("--on-status is required when creating a contact.");
|
|
11298
11265
|
requireAtLeastOne(
|
|
11299
|
-
|
|
11266
|
+
input2,
|
|
11300
11267
|
["mail_address", "mobile", ...contactWebhookSecrets.map((item2) => item2.input)],
|
|
11301
11268
|
"Provide at least one delivery target when creating a contact."
|
|
11302
11269
|
);
|
|
@@ -11446,11 +11413,11 @@ var systemUsageCommands = [
|
|
|
11446
11413
|
{ flag: "project-ids", type: "json", array: true, desc: "Project ID JSON array; required for project scope." },
|
|
11447
11414
|
{ flag: "data-type", type: "string", desc: "Optional event-volume data type.", allowed: ["all", "event", "user"] }
|
|
11448
11415
|
],
|
|
11449
|
-
validate: (_ctx,
|
|
11450
|
-
if (
|
|
11416
|
+
validate: (_ctx, input2) => {
|
|
11417
|
+
if (input2.metric === "apollo_token") {
|
|
11451
11418
|
throw validation("--metric apollo_token is not implemented by the current service.");
|
|
11452
11419
|
}
|
|
11453
|
-
if (
|
|
11420
|
+
if (input2.scope === "project" && (!Array.isArray(input2.project_ids) || input2.project_ids.length === 0)) {
|
|
11454
11421
|
throw validation("--project-ids is required when --scope project.");
|
|
11455
11422
|
}
|
|
11456
11423
|
}
|
|
@@ -11483,11 +11450,11 @@ var systemUsageCommands = [
|
|
|
11483
11450
|
desc: "Maximum export runtime in seconds. Default and max: 21600."
|
|
11484
11451
|
}
|
|
11485
11452
|
],
|
|
11486
|
-
validate: (_ctx,
|
|
11487
|
-
if (
|
|
11453
|
+
validate: (_ctx, input2) => {
|
|
11454
|
+
if (input2.metric === "apollo_token") {
|
|
11488
11455
|
throw validation("--metric apollo_token is not implemented by the current service.");
|
|
11489
11456
|
}
|
|
11490
|
-
if (
|
|
11457
|
+
if (input2.scope === "project" && (!Array.isArray(input2.project_ids) || input2.project_ids.length === 0)) {
|
|
11491
11458
|
throw validation("--project-ids is required when --scope project.");
|
|
11492
11459
|
}
|
|
11493
11460
|
}
|
|
@@ -11598,7 +11565,7 @@ function scenarioInput(ctx, append = false) {
|
|
|
11598
11565
|
const questionId = text2(ctx.str("question-id") || (!append ? agent.agent_turn_id ?? "" : ""), "question-id", 191);
|
|
11599
11566
|
const projectId = ctx.optionalNum("project-id");
|
|
11600
11567
|
if (projectId !== void 0 && (!Number.isInteger(projectId) || projectId <= 0)) throw new CliValidationError("project-id must be a positive integer.");
|
|
11601
|
-
const
|
|
11568
|
+
const input2 = {
|
|
11602
11569
|
agent_session_id: session,
|
|
11603
11570
|
question_id: questionId,
|
|
11604
11571
|
...projectId !== void 0 ? { project_id: projectId } : {}
|
|
@@ -11608,18 +11575,18 @@ function scenarioInput(ctx, append = false) {
|
|
|
11608
11575
|
throw new CliValidationError("entry-type must be user_feedback or answer_revision.");
|
|
11609
11576
|
}
|
|
11610
11577
|
if (append) {
|
|
11611
|
-
|
|
11612
|
-
|
|
11613
|
-
|
|
11614
|
-
|
|
11578
|
+
input2.entry_type = entryType;
|
|
11579
|
+
input2.entry_id = text2(ctx.str("entry-id") || (agent.agent_turn_id ? `${agent.agent_turn_id}:${entryType}` : ""), "entry-id", 191);
|
|
11580
|
+
input2.target_answer_id = text2(ctx.str("target-answer-id"), "target-answer-id", 191);
|
|
11581
|
+
input2.text = text2(ctx.str("text"), "text", entryType === "user_feedback" ? 4096 : 16384);
|
|
11615
11582
|
} else {
|
|
11616
|
-
|
|
11617
|
-
|
|
11583
|
+
input2.question = text2(ctx.str("question"), "question", 8192);
|
|
11584
|
+
input2.answer = text2(ctx.str("answer"), "answer", 16384);
|
|
11618
11585
|
}
|
|
11619
11586
|
if (entryType !== "user_feedback") {
|
|
11620
|
-
if (append && ctx.str("user-message"))
|
|
11621
|
-
|
|
11622
|
-
if (
|
|
11587
|
+
if (append && ctx.str("user-message")) input2.user_message = text2(ctx.str("user-message"), "user-message", 4096);
|
|
11588
|
+
input2.answer_id = text2(ctx.str("answer-id") || (agent.agent_turn_id ? `answer:${agent.agent_turn_id}` : ""), "answer-id", 191);
|
|
11589
|
+
if (input2.answer_id === input2.target_answer_id) throw new CliValidationError("A revision requires a new answer-id; target-answer-id must preserve the previous answer.");
|
|
11623
11590
|
const path = ctx.json("query-path");
|
|
11624
11591
|
if (!Array.isArray(path) || !path.length || path.length > 64) throw new CliValidationError("query-path must contain 1..64 ordered CLI call references.");
|
|
11625
11592
|
for (const step of path) {
|
|
@@ -11631,23 +11598,23 @@ function scenarioInput(ctx, append = false) {
|
|
|
11631
11598
|
}
|
|
11632
11599
|
if (!path.some((step) => analysisQueryCapabilities.has(step.capability_id))) throw new CliValidationError("query-path must reference at least one attempted analysis data query.");
|
|
11633
11600
|
if (JSON.stringify(path).length > 2e4) throw new CliValidationError("query-path must be at most 20000 characters.");
|
|
11634
|
-
|
|
11601
|
+
input2.query_path = path;
|
|
11635
11602
|
const started = ctx.str("start-time");
|
|
11636
|
-
if (started)
|
|
11603
|
+
if (started) input2.duration_ms = scenarioDuration(started);
|
|
11637
11604
|
} else if (ctx.json("query-path") !== void 0 || ctx.str("answer-id") || ctx.str("user-message") || ctx.str("start-time")) {
|
|
11638
11605
|
throw new CliValidationError("user_feedback records user text and its target only; do not attach an answer or query path.");
|
|
11639
11606
|
}
|
|
11640
|
-
return
|
|
11607
|
+
return input2;
|
|
11641
11608
|
}
|
|
11642
11609
|
function scenarioTransportInput(ctx, append = false) {
|
|
11643
|
-
const
|
|
11610
|
+
const input2 = scenarioInput(ctx, append);
|
|
11644
11611
|
const field = append ? "text" : "answer";
|
|
11645
|
-
const original =
|
|
11612
|
+
const original = input2[field];
|
|
11646
11613
|
const bytes = Buffer.from(original, "utf8");
|
|
11647
11614
|
if (bytes.toString("utf8") !== original) {
|
|
11648
11615
|
throw new CliValidationError(`${field} must contain valid Unicode text.`);
|
|
11649
11616
|
}
|
|
11650
|
-
return { ...
|
|
11617
|
+
return { ...input2, [field]: bytes.toString("base64"), content_encoding: "base64" };
|
|
11651
11618
|
}
|
|
11652
11619
|
var commonFlags2 = [
|
|
11653
11620
|
{ name: "start-time", type: "string", desc: "Exact start_time returned by scenario begin for this answer. CLI computes one question-to-answer duration; omit if not captured." },
|
|
@@ -11660,22 +11627,22 @@ function withProjectCollectionPolicy(command2) {
|
|
|
11660
11627
|
return {
|
|
11661
11628
|
...command2,
|
|
11662
11629
|
execute: async (ctx) => {
|
|
11663
|
-
const
|
|
11630
|
+
const input2 = scenarioInput(ctx, command2.command === "append");
|
|
11664
11631
|
const skipped = (reason) => withOutputMetadata({
|
|
11665
11632
|
accepted: false,
|
|
11666
11633
|
skipped: true,
|
|
11667
11634
|
reason,
|
|
11668
|
-
question_id:
|
|
11669
|
-
...
|
|
11670
|
-
...
|
|
11671
|
-
...
|
|
11635
|
+
question_id: input2.question_id,
|
|
11636
|
+
...input2.answer_id ? { answer_id: input2.answer_id } : {},
|
|
11637
|
+
...input2.entry_id ? { entry_id: input2.entry_id } : {},
|
|
11638
|
+
...input2.target_answer_id ? { target_answer_id: input2.target_answer_id } : {},
|
|
11672
11639
|
event_name: command2.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
|
|
11673
11640
|
delivery: "best_effort"
|
|
11674
11641
|
}, { capability_id: command2.capabilityId });
|
|
11675
|
-
if (
|
|
11642
|
+
if (input2.project_id === void 0) return skipped("PROJECT_REQUIRED");
|
|
11676
11643
|
try {
|
|
11677
11644
|
const policy = await executeCapabilityWithEnvelope(ctx.host(), "analysis", "project.info.get", {
|
|
11678
|
-
project_id:
|
|
11645
|
+
project_id: input2.project_id
|
|
11679
11646
|
});
|
|
11680
11647
|
if (policy.data?.analysis_scenario_collection_enabled !== true) {
|
|
11681
11648
|
return skipped("PROJECT_COLLECTION_DISABLED");
|
|
@@ -11734,7 +11701,7 @@ var scenarioBegin = {
|
|
|
11734
11701
|
execute: async () => ({ start_time: (/* @__PURE__ */ new Date()).toISOString() })
|
|
11735
11702
|
};
|
|
11736
11703
|
function scenarioListInput(ctx) {
|
|
11737
|
-
const
|
|
11704
|
+
const input2 = {};
|
|
11738
11705
|
for (const [flag, min, max, fallback] of [
|
|
11739
11706
|
["project-id", 1, 2147483647, void 0],
|
|
11740
11707
|
["days", 1, 90, 7],
|
|
@@ -11745,16 +11712,16 @@ function scenarioListInput(ctx) {
|
|
|
11745
11712
|
if (value === void 0 || !Number.isInteger(value) || value < min || value > max) {
|
|
11746
11713
|
throw new CliValidationError(`${flag} must be an integer between ${min} and ${max}.`);
|
|
11747
11714
|
}
|
|
11748
|
-
|
|
11715
|
+
input2[flag.replaceAll("-", "_")] = value;
|
|
11749
11716
|
}
|
|
11750
11717
|
const end = ctx.str("end-time");
|
|
11751
11718
|
if (end) {
|
|
11752
11719
|
if (!/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/.test(end) || !Number.isFinite(Date.parse(end)) || !(/* @__PURE__ */ new Date(`${end.slice(0, 10)}T00:00:00Z`)).toISOString().startsWith(end.slice(0, 10))) {
|
|
11753
11720
|
throw new CliValidationError("end-time must be an ISO-8601 timestamp with a timezone.");
|
|
11754
11721
|
}
|
|
11755
|
-
|
|
11722
|
+
input2.end_time = end;
|
|
11756
11723
|
}
|
|
11757
|
-
return
|
|
11724
|
+
return input2;
|
|
11758
11725
|
}
|
|
11759
11726
|
var scenarioList = createAnalysisCapabilityCommand({
|
|
11760
11727
|
resource: "scenario",
|
|
@@ -11772,11 +11739,11 @@ var scenarioList = createAnalysisCapabilityCommand({
|
|
|
11772
11739
|
buildInput: scenarioListInput
|
|
11773
11740
|
});
|
|
11774
11741
|
function scenarioGetInput(ctx) {
|
|
11775
|
-
const { limit: limit2, offset, ...
|
|
11742
|
+
const { limit: limit2, offset, ...input2 } = scenarioListInput(ctx);
|
|
11776
11743
|
for (const key of ["open-id", "agent-session-id", "question-id"]) {
|
|
11777
|
-
|
|
11744
|
+
input2[key.replaceAll("-", "_")] = text2(ctx.str(key), key, 191);
|
|
11778
11745
|
}
|
|
11779
|
-
return
|
|
11746
|
+
return input2;
|
|
11780
11747
|
}
|
|
11781
11748
|
var scenarioGet = createAnalysisCapabilityCommand({
|
|
11782
11749
|
resource: "scenario",
|
|
@@ -11798,7 +11765,7 @@ var scenario_default = [scenarioBegin, scenarioCollect, scenarioAppend, scenario
|
|
|
11798
11765
|
async function syncBadCaseEvaluation(ctx, projectId, value) {
|
|
11799
11766
|
const item2 = value;
|
|
11800
11767
|
if (!item2?.evaluation || !["PENDING", "ERROR"].includes(item2.evaluation.state)) return value;
|
|
11801
|
-
const common = (action,
|
|
11768
|
+
const common = (action, input2 = {}) => executeCapability(ctx.host(), "analysis", `analysis.bad_case.${action}`, { project_id: projectId, ...input2 });
|
|
11802
11769
|
let report;
|
|
11803
11770
|
try {
|
|
11804
11771
|
const config = await common("evaluation_config");
|
|
@@ -11849,7 +11816,7 @@ var item = { name: "item-id", type: "string", required: true, desc: "Bad Case it
|
|
|
11849
11816
|
var batch = { name: "batch-id", type: "string", required: true, desc: "Discovery batch ID returned by begin." };
|
|
11850
11817
|
var limit = { name: "limit", type: "number", desc: "Page size, 1..100. Follow pagination until complete." };
|
|
11851
11818
|
function badCaseInput(action, flags, ctx) {
|
|
11852
|
-
const
|
|
11819
|
+
const input2 = {};
|
|
11853
11820
|
for (const flag of flags) {
|
|
11854
11821
|
if (flag.name === "input-file") continue;
|
|
11855
11822
|
const value = ctx.str(flag.name);
|
|
@@ -11860,17 +11827,17 @@ function badCaseInput(action, flags, ctx) {
|
|
|
11860
11827
|
const minimum = flag.name === "offset" ? 0 : 1;
|
|
11861
11828
|
const maximum = flag.name === "limit" ? 100 : 2147483647;
|
|
11862
11829
|
if (!Number.isInteger(number) || number < minimum || number > maximum) throw new CliValidationError(`${flag.name} must be an integer between ${minimum} and ${maximum}.`);
|
|
11863
|
-
|
|
11830
|
+
input2[flag.name.replaceAll("-", "_")] = number;
|
|
11864
11831
|
} else if (flag.type === "boolean") {
|
|
11865
11832
|
if (!["true", "false"].includes(value)) throw new CliValidationError(`${flag.name} must be true or false.`);
|
|
11866
|
-
|
|
11833
|
+
input2[flag.name.replaceAll("-", "_")] = value === "true";
|
|
11867
11834
|
} else {
|
|
11868
11835
|
if (["item-id", "batch-id", "after-id", "version"].includes(flag.name) && (!/^\d+$/.test(value) || BigInt(value) > 9223372036854775807n)) throw new CliValidationError(`${flag.name} must be a nonnegative 64-bit integer string.`);
|
|
11869
|
-
|
|
11836
|
+
input2[flag.name.replaceAll("-", "_")] = value;
|
|
11870
11837
|
}
|
|
11871
11838
|
}
|
|
11872
|
-
if (action === "review" && !["APPROVE", "REJECT", "REVOKE"].includes(String(
|
|
11873
|
-
if (action === "run" && !["HEARTBEAT", "FAILED"].includes(String(
|
|
11839
|
+
if (action === "review" && !["APPROVE", "REJECT", "REVOKE"].includes(String(input2.decision))) throw new CliValidationError("decision must be APPROVE, REJECT or REVOKE.");
|
|
11840
|
+
if (action === "run" && !["HEARTBEAT", "FAILED"].includes(String(input2.action))) throw new CliValidationError("action must be HEARTBEAT or FAILED.");
|
|
11874
11841
|
if (action === "submit") {
|
|
11875
11842
|
let packet;
|
|
11876
11843
|
try {
|
|
@@ -11894,9 +11861,9 @@ function badCaseInput(action, flags, ctx) {
|
|
|
11894
11861
|
}
|
|
11895
11862
|
if (!candidate.source || ["open_id", "agent_session_id", "question_id", "answer_id", "days", "end_time"].some((key) => !candidate.source[key])) throw new CliValidationError("Each source must preserve the exact scenario identity and scan window.");
|
|
11896
11863
|
}
|
|
11897
|
-
|
|
11864
|
+
input2.candidates = packet.candidates;
|
|
11898
11865
|
}
|
|
11899
|
-
return
|
|
11866
|
+
return input2;
|
|
11900
11867
|
}
|
|
11901
11868
|
function command(action, description, flags, read = false) {
|
|
11902
11869
|
return createAnalysisCapabilityCommand({
|
|
@@ -11907,7 +11874,7 @@ function command(action, description, flags, read = false) {
|
|
|
11907
11874
|
risk: read ? "read" : "write",
|
|
11908
11875
|
flags: [project, ...flags],
|
|
11909
11876
|
buildInput: (ctx) => badCaseInput(action, [project, ...flags], ctx),
|
|
11910
|
-
...action === "review" ? { postProcess: (result,
|
|
11877
|
+
...action === "review" ? { postProcess: (result, input2, ctx) => syncBadCaseEvaluation(ctx, Number(input2.project_id), result) } : {}
|
|
11911
11878
|
});
|
|
11912
11879
|
}
|
|
11913
11880
|
var badCaseBegin = command("begin", "Begin a project-serialized discovery batch. Renew its 15-minute lease every minute; preserve request ID on retry.", [request, { name: "source-task-id", type: "string", desc: "Actual scheduled task ID, if known." }]);
|
|
@@ -11928,6 +11895,111 @@ var badCaseSyncEvaluation = {
|
|
|
11928
11895
|
};
|
|
11929
11896
|
var bad_case_default = [badCaseBegin, badCaseRun, badCaseHistory, badCaseSubmit, badCaseList, badCaseGet, badCaseReview, badCaseSubmitToPage, badCaseSyncEvaluation];
|
|
11930
11897
|
|
|
11898
|
+
// src/commands/te-analysis/onboarding/index.ts
|
|
11899
|
+
function input(ctx) {
|
|
11900
|
+
return {
|
|
11901
|
+
host: ctx.hostOverride?.(),
|
|
11902
|
+
source: ctx.str("source") || void 0,
|
|
11903
|
+
region: ctx.str("region") || void 0,
|
|
11904
|
+
language: ctx.str("language") || void 0,
|
|
11905
|
+
website_env: ctx.str("website-env") || void 0,
|
|
11906
|
+
session_id: ctx.str("session-id") || void 0,
|
|
11907
|
+
choice: ctx.str("choice") || void 0,
|
|
11908
|
+
sample: ctx.str("sample") || void 0,
|
|
11909
|
+
scenario: ctx.str("scenario") || void 0,
|
|
11910
|
+
confirm_business_project_id: ctx.num("confirm-business-project-id") || void 0,
|
|
11911
|
+
browser: ctx.str("browser") || void 0,
|
|
11912
|
+
sdk_complete: ctx.bool("sdk-complete"),
|
|
11913
|
+
upload_metric_event: ctx.bool("upload-metric-event"),
|
|
11914
|
+
prepare_approver: ctx.bool("prepare-approver"),
|
|
11915
|
+
run_id: ctx.str("run-id") || void 0,
|
|
11916
|
+
start_only: ctx.bool("start-only")
|
|
11917
|
+
};
|
|
11918
|
+
}
|
|
11919
|
+
function invoke(ctx, action) {
|
|
11920
|
+
if (!ctx.onboarding) throw new Error("The runtime does not support PLG onboarding. Update the matching CLI.");
|
|
11921
|
+
return ctx.onboarding(action, input(ctx));
|
|
11922
|
+
}
|
|
11923
|
+
var sharedFlags = [
|
|
11924
|
+
{ name: "session-id", type: "string", required: false, desc: "Private local continuation reference returned by an earlier onboarding command." }
|
|
11925
|
+
];
|
|
11926
|
+
var scenarioFlag = {
|
|
11927
|
+
name: "scenario",
|
|
11928
|
+
type: "string",
|
|
11929
|
+
desc: "Demo growth scenario: item-coupon (default) or checkout-recovery."
|
|
11930
|
+
};
|
|
11931
|
+
var onboardingRun = {
|
|
11932
|
+
service: "analysis",
|
|
11933
|
+
resource: "onboarding",
|
|
11934
|
+
command: "run",
|
|
11935
|
+
risk: "write",
|
|
11936
|
+
description: "Start or resume one bounded PLG onboarding step for the sample or business SDK integration.",
|
|
11937
|
+
flags: [
|
|
11938
|
+
...sharedFlags,
|
|
11939
|
+
{ name: "source", type: "string", required: false, desc: "Local AI tool: codex, claude-code, cursor, or other. This is not an authorization credential." },
|
|
11940
|
+
{ name: "region", type: "string", required: false, desc: "Production onboarding market: jp, kr, or us." },
|
|
11941
|
+
{ name: "language", type: "string", required: false, desc: "Conversation language: zh-CN, en-US, ja-JP, or ko-KR. Use --region for the market when it differs from the language default." },
|
|
11942
|
+
{ name: "website-env", type: "string", required: false, desc: "Compatibility flag. Website onboarding uses production." },
|
|
11943
|
+
{ name: "choice", type: "string", required: false, desc: "Select demo or business after the user chooses an experience." },
|
|
11944
|
+
{ name: "sample", type: "string", required: false, desc: "Select a sample after the user chooses it: star-island or season-pass." },
|
|
11945
|
+
{ name: "confirm-business-project-id", type: "number", required: false, desc: "Confirm the eligible business project for a legacy account." },
|
|
11946
|
+
{ name: "sdk-complete", type: "boolean", required: false, desc: "Show the business project live-data link after the user confirms SDK setup." },
|
|
11947
|
+
{ name: "browser", type: "string", required: false, desc: "Open website login and CLI authorization in the system default browser. Legacy values auto and agent also use the system browser." }
|
|
11948
|
+
],
|
|
11949
|
+
dryRun: (ctx) => invoke(ctx, "plan"),
|
|
11950
|
+
execute: (ctx) => invoke(ctx, "run")
|
|
11951
|
+
};
|
|
11952
|
+
var onboardingStatus = {
|
|
11953
|
+
service: "analysis",
|
|
11954
|
+
resource: "onboarding",
|
|
11955
|
+
command: "status",
|
|
11956
|
+
risk: "read",
|
|
11957
|
+
description: "Read PLG onboarding progress, authorization continuation and sample preparation without advancing.",
|
|
11958
|
+
flags: sharedFlags,
|
|
11959
|
+
dryRun: (ctx) => invoke(ctx, "plan"),
|
|
11960
|
+
execute: (ctx) => invoke(ctx, "status")
|
|
11961
|
+
};
|
|
11962
|
+
var onboardingGrowth = {
|
|
11963
|
+
service: "analysis",
|
|
11964
|
+
resource: "onboarding",
|
|
11965
|
+
command: "growth",
|
|
11966
|
+
risk: "read",
|
|
11967
|
+
description: "Analyze growth opportunities and the ordered purchase funnel for the active PLG Demo.",
|
|
11968
|
+
flags: [{ ...sharedFlags[0], required: true }, scenarioFlag],
|
|
11969
|
+
dryRun: (ctx) => invoke(ctx, "growth-plan"),
|
|
11970
|
+
execute: (ctx) => invoke(ctx, "growth")
|
|
11971
|
+
};
|
|
11972
|
+
var onboardingExperimentPlan = {
|
|
11973
|
+
service: "analysis",
|
|
11974
|
+
resource: "onboarding",
|
|
11975
|
+
command: "experiment-plan",
|
|
11976
|
+
risk: "write",
|
|
11977
|
+
description: "Generate an A/B experiment plan and optionally submit one synthetic payment to the active PLG Demo.",
|
|
11978
|
+
flags: [
|
|
11979
|
+
{ ...sharedFlags[0], required: true },
|
|
11980
|
+
scenarioFlag,
|
|
11981
|
+
{ name: "prepare-approver", type: "boolean", desc: "Compatibility flag. All Demo experiment plans automatically add the signed-in account as an approver." },
|
|
11982
|
+
{ name: "upload-metric-event", type: "boolean", desc: "Submit exactly one synthetic payment_success event to the current Demo project." }
|
|
11983
|
+
],
|
|
11984
|
+
dryRun: (ctx) => invoke(ctx, "experiment-plan-preview"),
|
|
11985
|
+
execute: (ctx) => invoke(ctx, "experiment-plan")
|
|
11986
|
+
};
|
|
11987
|
+
var onboardingExperimentLaunch = {
|
|
11988
|
+
service: "analysis",
|
|
11989
|
+
resource: "onboarding",
|
|
11990
|
+
command: "experiment-launch",
|
|
11991
|
+
risk: "write",
|
|
11992
|
+
description: "Create, approve, start and replay a confirmed synthetic PLG Demo experiment.",
|
|
11993
|
+
flags: [
|
|
11994
|
+
{ ...sharedFlags[0], required: true },
|
|
11995
|
+
{ name: "run-id", type: "string", required: true, desc: "Run ID returned by experiment-plan for the confirmed Demo proposal." },
|
|
11996
|
+
{ name: "start-only", type: "boolean", desc: "Return the link when the experiment is running. Resume with the same run ID to send the replay." }
|
|
11997
|
+
],
|
|
11998
|
+
dryRun: (ctx) => invoke(ctx, "experiment-launch-preview"),
|
|
11999
|
+
execute: (ctx) => invoke(ctx, "experiment-launch")
|
|
12000
|
+
};
|
|
12001
|
+
var onboarding_default = [onboardingRun, onboardingStatus, onboardingGrowth, onboardingExperimentPlan, onboardingExperimentLaunch];
|
|
12002
|
+
|
|
11931
12003
|
// src/commands/te-analysis/index.ts
|
|
11932
12004
|
registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
|
|
11933
12005
|
registerCapabilityGatewayRoute("project", { gatewayDomain: "analysis" });
|
|
@@ -11980,7 +12052,7 @@ var baseCommands = [
|
|
|
11980
12052
|
...scenario_default,
|
|
11981
12053
|
...bad_case_default
|
|
11982
12054
|
];
|
|
11983
|
-
var commands84 = [...baseCommands];
|
|
12055
|
+
var commands84 = [...baseCommands, ...onboarding_default];
|
|
11984
12056
|
var te_analysis_default = commands84;
|
|
11985
12057
|
export {
|
|
11986
12058
|
baseCommands,
|