@thinkingai/ae-cli 6.1.33 → 6.1.35

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. package/README.md +2 -2
  2. package/README.zh.md +2 -6
  3. package/cli-installation-guide.md +18 -4
  4. package/dist/{ai-monitor-OHTSU6SV.js → ai-monitor-TVRFVZBH.js} +10 -9
  5. package/dist/ai-monitor.js +17 -16
  6. package/dist/{auth-2MOK4OI6.js → auth-JAXLMPBB.js} +25 -317
  7. package/dist/{automation-6L6IAYRK.js → automation-OQ647CSW.js} +7 -6
  8. package/dist/{capability-EMIHQJA3.js → capability-2Z4ZXTPD.js} +18 -16
  9. package/dist/chunk-2H3SFJE3.js +344 -0
  10. package/dist/{chunk-RC3PPCYD.js → chunk-3PZNM5KN.js} +3 -3
  11. package/dist/chunk-3ZQY7SLZ.js +147 -0
  12. package/dist/{chunk-NNK3JBH4.js → chunk-6E6HCTP2.js} +2 -2
  13. package/dist/{local-data-upload-client-YTWMAAGE.js → chunk-6IUTXRAD.js} +32 -4
  14. package/dist/{chunk-VLOGOM7N.js → chunk-CYZV5AXW.js} +8 -5
  15. package/dist/{chunk-O45NOIWR.js → chunk-DE5XHQQ6.js} +2 -2
  16. package/dist/{chunk-KD5UC33N.js → chunk-E5CJI7L3.js} +7 -5
  17. package/dist/{chunk-UCMO4LKL.js → chunk-EQMGH32F.js} +2 -2
  18. package/dist/{chunk-E3ONSFUN.js → chunk-FNACCKQR.js} +211 -12
  19. package/dist/{chunk-2I5SZ5DS.js → chunk-GD5JSAGV.js} +2 -2
  20. package/dist/{chunk-EFGUBGA6.js → chunk-GYODT7C4.js} +1 -1
  21. package/dist/chunk-HBI7IQH3.js +1207 -0
  22. package/dist/{chunk-AMURHMS3.js → chunk-IGU3R2JD.js} +4 -4
  23. package/dist/{chunk-YE6MJB5V.js → chunk-IWMDPHMI.js} +3 -3
  24. package/dist/{chunk-LFJ7N36I.js → chunk-L7MT53VM.js} +5 -3
  25. package/dist/{chunk-HIMOBNEY.js → chunk-LXRALNNA.js} +2 -2
  26. package/dist/{chunk-BQFLABJQ.js → chunk-M2OCZRVX.js} +7 -5
  27. package/dist/{chunk-R2SVAO4G.js → chunk-MTK4ZE7W.js} +3 -143
  28. package/dist/{chunk-7DHSB3FL.js → chunk-NK5PS5X7.js} +3 -3
  29. package/dist/{chunk-HQED4YB4.js → chunk-NPH5J65M.js} +1 -1
  30. package/dist/{chunk-EWVEAERM.js → chunk-Q764EZND.js} +78 -72
  31. package/dist/chunk-QOJXLXDJ.js +55 -0
  32. package/dist/{chunk-THTROEGD.js → chunk-QPUPWGZ3.js} +1 -1
  33. package/dist/{chunk-XZDKAR4N.js → chunk-RLPMXKDQ.js} +8921 -10119
  34. package/dist/{chunk-DWAG2QJM.js → chunk-S74XV3A6.js} +4 -4
  35. package/dist/{chunk-COOMXFUG.js → chunk-SHB7A2JE.js} +3 -3
  36. package/dist/{chunk-PLNS5J33.js → chunk-UWQXGF44.js} +17 -9
  37. package/dist/{data-integration-UNJ7EPW2.js → chunk-V6UKLIM6.js} +160 -2258
  38. package/dist/{chunk-4IQYPWCX.js → chunk-VPLRZSMY.js} +18 -10
  39. package/dist/{chunk-KA5WKR5P.js → chunk-Z6WSCIHM.js} +2 -2
  40. package/dist/{community-report-client-ULRNXLQV.js → community-report-client-5VNT6HCV.js} +4 -2
  41. package/dist/{compat-check-CADG7GND.js → compat-check-E7AQ7UCG.js} +5 -4
  42. package/dist/{config-PFD3KWQG.js → config-PGSUWIK5.js} +15 -11
  43. package/dist/{context-SOQDFZIB.js → context-Y2A6QIS3.js} +5 -4
  44. package/dist/conversion-4FR3RA45.js +16 -0
  45. package/dist/data-integration-EIF5QHYF.js +2138 -0
  46. package/dist/{evaluation-Q3AIGFOG.js → evaluation-OZM54MES.js} +6 -5
  47. package/dist/index.js +74 -51
  48. package/dist/local-data-upload-client-2U3LFD7Z.js +16 -0
  49. package/dist/{memory-HKNGUIPK.js → memory-6QMZS4HF.js} +7 -6
  50. package/dist/{metadata-GFWR5ZHC.js → metadata-7MZ3CJ2N.js} +10 -9
  51. package/dist/{model-NAKQWK4W.js → model-LEYRQKOS.js} +8 -7
  52. package/dist/{personal-semantic-preference-JCTKXLC3.js → personal-semantic-preference-SWOUNDWJ.js} +9 -8
  53. package/dist/{project-semantic-B2NWQOKK.js → project-semantic-M2DDPAMD.js} +9 -8
  54. package/dist/{sync-UQH4J4BD.js → sync-PWC63JCO.js} +16 -15
  55. package/dist/{te-agent-L6EYFQCC.js → te-agent-S7UH657Z.js} +11 -9
  56. package/dist/{te-analysis-U7NNOY66.js → te-analysis-BK6PE333.js} +281 -214
  57. package/dist/{te-community-3UQEW3KD.js → te-community-OLNTKGCW.js} +12 -10
  58. package/dist/{te-dataops-SUNYXF5G.js → te-dataops-XUWRIF5R.js} +12 -10
  59. package/dist/{te-engage-KMXZJ2KN.js → te-engage-I3I4FJOM.js} +9 -8
  60. package/dist/{te-experiment-IEYKP6VC.js → te-experiment-XSDUL4KH.js} +9 -8
  61. package/dist/{te-kb-MT3V5ZMH.js → te-kb-QFH3YLFQ.js} +15 -13
  62. package/dist/{te-system-F4ZU2HRQ.js → te-system-DB5Z3LLF.js} +7 -6
  63. package/dist/{te-team-M6E6XQ5H.js → te-team-UADF2HBO.js} +9 -8
  64. package/dist/{things-FRLBZV2Z.js → things-G2QFXDK7.js} +9 -8
  65. package/dist/{update-NULYHVE6.js → update-6I366ICW.js} +7 -8
  66. package/dist/web-runtime-3XFREWRF.js +2367 -0
  67. package/dist/{workspace-Z7L33OBQ.js → workspace-RZESYB6T.js} +7 -6
  68. package/package.json +4 -3
  69. package/skills/ae-analysis/SKILL.md +1 -1
  70. package/skills/ae-data-integration/references/ue-mapping.md +2 -0
  71. package/skills/ae-onboarding/SKILL.md +64 -0
  72. package/skills/ae-onboarding/references/business-sdk.md +8 -0
  73. package/skills/ae-onboarding/references/demo-operations.md +79 -0
  74. package/skills/ae-onboarding/references/import.md +19 -0
  75. package/skills/ae-onboarding/references/onboarding_experiment_launch.md +12 -0
  76. package/skills/ae-onboarding/references/onboarding_experiment_plan.md +14 -0
  77. package/skills/ae-onboarding/references/onboarding_growth.md +36 -0
  78. package/skills/ae-onboarding/references/onboarding_run.md +11 -0
  79. package/skills/ae-onboarding/references/onboarding_status.md +5 -0
  80. package/skills/ae-onboarding/scripts/experiment-preset.json +252 -0
  81. package/skills/ae-onboarding/scripts/experiment-requests.mjs +120 -0
  82. package/skills/ae-onboarding/scripts/generate.mjs +170 -0
  83. package/skills/ae-onboarding/scripts/resolve-experiment-preset.mjs +26 -0
  84. package/skills/ae-onboarding/scripts/web-journey.mjs +39 -0
  85. package/dist/chunk-6ZIQV5GW.js +0 -26
@@ -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-BQFLABJQ.js";
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-7DHSB3FL.js";
14
- import {
15
- EvalApiError
16
- } from "./chunk-LFJ7N36I.js";
13
+ } from "./chunk-NK5PS5X7.js";
17
14
  import {
18
15
  createCapabilityCommand,
19
16
  definitionIntentSnapshotFlag,
20
17
  modelDefinitionIntentSnapshotFlag
21
- } from "./chunk-RC3PPCYD.js";
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-O45NOIWR.js";
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,17 +45,18 @@ import {
40
45
  uploadInputFile,
41
46
  validateCapability,
42
47
  validateCapabilityWithEnvelope
43
- } from "./chunk-4IQYPWCX.js";
44
- import "./chunk-NNK3JBH4.js";
45
- import "./chunk-E3ONSFUN.js";
48
+ } from "./chunk-VPLRZSMY.js";
49
+ import "./chunk-6E6HCTP2.js";
50
+ import "./chunk-FNACCKQR.js";
46
51
  import "./chunk-PUSFEC6B.js";
47
52
  import {
48
53
  getCliToken
49
- } from "./chunk-PLNS5J33.js";
50
- import "./chunk-AMURHMS3.js";
54
+ } from "./chunk-UWQXGF44.js";
55
+ import "./chunk-IGU3R2JD.js";
56
+ import "./chunk-MTK4ZE7W.js";
51
57
  import {
52
58
  CliValidationError
53
- } from "./chunk-R2SVAO4G.js";
59
+ } from "./chunk-3ZQY7SLZ.js";
54
60
 
55
61
  // src/commands/te-analysis/capability-shared.ts
56
62
  var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
@@ -385,9 +391,9 @@ function optionalJsonArray(ctx, name) {
385
391
  const parsed = ctx.json(name);
386
392
  return Array.isArray(parsed) ? parsed : [parsed];
387
393
  }
388
- function compactInput(input) {
394
+ function compactInput(input2) {
389
395
  const result = {};
390
- for (const [key, value] of Object.entries(input)) {
396
+ for (const [key, value] of Object.entries(input2)) {
391
397
  if (value !== void 0) {
392
398
  result[key] = value;
393
399
  }
@@ -475,7 +481,7 @@ function optionalQueries(ctx) {
475
481
  return value === void 0 || value === null ? void 0 : value;
476
482
  }
477
483
  function catalogExportPostProcess(resourceType, arrayField) {
478
- return async (result, input, ctx) => {
484
+ return async (result, input2, ctx) => {
479
485
  if (typeof result !== "object" || result === null) {
480
486
  throw new Error(`Full ${resourceType} catalog returned an invalid response`);
481
487
  }
@@ -522,7 +528,7 @@ function catalogExportPostProcess(resourceType, arrayField) {
522
528
  schema_version: 1,
523
529
  resource_type: resourceType,
524
530
  host: ctx.host(),
525
- project_id: input.project_id,
531
+ project_id: input2.project_id,
526
532
  principal_fingerprint: `sha256:${createHash("sha256").update(token).digest("hex")}`,
527
533
  generated_at: (/* @__PURE__ */ new Date()).toISOString(),
528
534
  row_count: rows.length,
@@ -1706,70 +1712,26 @@ function assetGovernanceInput(ctx, fields2) {
1706
1712
  if (payload && Object.hasOwn(payload, "payload")) {
1707
1713
  throw new CliValidationError("--payload must not contain a nested payload field.");
1708
1714
  }
1709
- const input = {
1715
+ const input2 = {
1710
1716
  ...payload,
1711
1717
  ...projectInput(ctx)
1712
1718
  };
1713
1719
  for (const field of fields2) {
1714
1720
  const value = readers[field]?.(ctx);
1715
- if (value !== void 0) input[field] = value;
1721
+ if (value !== void 0) input2[field] = value;
1716
1722
  }
1717
1723
  for (const field of ["node_ids", "searchs", "status"]) {
1718
- if (input[field] !== void 0 && !Array.isArray(input[field])) {
1724
+ if (input2[field] !== void 0 && !Array.isArray(input2[field])) {
1719
1725
  throw new CliValidationError(`${field} must be a JSON array.`);
1720
1726
  }
1721
1727
  }
1722
- if (input.rule !== void 0 && (!input.rule || typeof input.rule !== "object" || Array.isArray(input.rule))) {
1728
+ if (input2.rule !== void 0 && (!input2.rule || typeof input2.rule !== "object" || Array.isArray(input2.rule))) {
1723
1729
  throw new CliValidationError("rule must be a JSON object.");
1724
1730
  }
1725
- if (fields2.includes("to_user_id") && (!Number.isInteger(input.to_user_id) || Number(input.to_user_id) <= 0)) {
1731
+ if (fields2.includes("to_user_id") && (!Number.isInteger(input2.to_user_id) || Number(input2.to_user_id) <= 0)) {
1726
1732
  throw new CliValidationError("to_user_id must be a positive integer; provide --to-user-id or payload.to_user_id.");
1727
1733
  }
1728
- return input;
1729
- }
1730
-
1731
- // src/core/resource-url.ts
1732
- var LOCAL_BACKEND_PORTS = /* @__PURE__ */ new Set(["8992", "8996"]);
1733
- function normalizeResourceUrlFields(node, host, sourceHost = host) {
1734
- if (!node || typeof node !== "object") return;
1735
- const obj = node;
1736
- for (const [key, value] of Object.entries(obj)) {
1737
- if (typeof value === "string") {
1738
- if (/url|link/i.test(key) || value.includes("/#/")) {
1739
- obj[key] = normalizeResourceUrls(value, host, sourceHost);
1740
- }
1741
- } else if (value && typeof value === "object") {
1742
- normalizeResourceUrlFields(value, host, sourceHost);
1743
- }
1744
- }
1745
- }
1746
- function normalizeResourceUrls(s, host, sourceHost = host) {
1747
- const base = host.replace(/\/+$/, "");
1748
- const sourceBase = sourceHost.replace(/\/+$/, "");
1749
- if (sourceBase && sourceBase !== base) {
1750
- s = s.replace(new RegExp(`${escapeRegExp(sourceBase)}/#`, "g"), `${base}/#`);
1751
- }
1752
- s = s.replace(/\]\((\/(?!\/)[^)]*)\)/g, `](${base}$1)`);
1753
- if (/^\/(?!\/)/.test(s)) s = base + s;
1754
- return s;
1755
- }
1756
- function resolvePublicWebHost(host) {
1757
- const override = process.env.AE_CLI_PUBLIC_WEB_URL || process.env.AE_CLI_WEB_HOST;
1758
- if (override?.trim()) {
1759
- return override.trim().replace(/\/+$/, "");
1760
- }
1761
- try {
1762
- const url = new URL(host);
1763
- if ((url.hostname === "127.0.0.1" || url.hostname === "localhost") && LOCAL_BACKEND_PORTS.has(url.port)) {
1764
- url.port = "10010";
1765
- return url.toString().replace(/\/+$/, "");
1766
- }
1767
- } catch {
1768
- }
1769
- return host.replace(/\/+$/, "");
1770
- }
1771
- function escapeRegExp(value) {
1772
- return value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
1734
+ return input2;
1773
1735
  }
1774
1736
 
1775
1737
  // src/commands/te-analysis/meta/asset/url-get.ts
@@ -2385,19 +2347,19 @@ var metadataGovernanceRecommendationAutoReview = {
2385
2347
  autoReviewInput(ctx)
2386
2348
  ),
2387
2349
  execute: async (ctx) => withAutoReviewAgentContext(async () => {
2388
- const input = autoReviewInput(ctx);
2350
+ const input2 = autoReviewInput(ctx);
2389
2351
  if (hasExplicitLimit(ctx)) {
2390
- await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID, input);
2391
- const finalExport = await exportRecommendationMaterial(ctx, input, numberValue(input.limit) || DEFAULT_LIMIT);
2392
- const result2 = await executeCliAgentAutoReview(ctx, input, finalExport.data);
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);
2393
2355
  return withOutputMetadata({
2394
2356
  ...record(result2.data),
2395
2357
  manual_review_handoff: buildManualReviewHandoff(result2.data, finalExport.data)
2396
2358
  }, result2.meta);
2397
2359
  }
2398
- const plan = await planBoundedExpansion(ctx, input);
2360
+ const plan = await planBoundedExpansion(ctx, input2);
2399
2361
  const expansion = plan.expansion;
2400
- const finalInput = { ...input, limit: expansion.final_limit };
2362
+ const finalInput = { ...input2, limit: expansion.final_limit };
2401
2363
  const result = await executeCliAgentAutoReview(ctx, finalInput, plan.finalExport);
2402
2364
  if (result.data && typeof result.data === "object" && !Array.isArray(result.data)) {
2403
2365
  return withOutputMetadata({
@@ -2429,8 +2391,8 @@ function gatewayDomain() {
2429
2391
  function hasExplicitLimit(ctx) {
2430
2392
  return typeof ctx.has === "function" ? ctx.has("limit") : ctx.str("limit") !== "";
2431
2393
  }
2432
- async function executeCliAgentAutoReview(ctx, input, exportResult) {
2433
- const review = buildCliAgentAutoReview(input, exportResult);
2394
+ async function executeCliAgentAutoReview(ctx, input2, exportResult) {
2395
+ const review = buildCliAgentAutoReview(input2, exportResult);
2434
2396
  if (review.decisions.length === 0) {
2435
2397
  return {
2436
2398
  data: {
@@ -2445,7 +2407,7 @@ async function executeCliAgentAutoReview(ctx, input, exportResult) {
2445
2407
  };
2446
2408
  }
2447
2409
  const submitted = await executeCapabilityWithEnvelope(ctx.host(), gatewayDomain(), SUBMIT_CAPABILITY_ID, {
2448
- ...input,
2410
+ ...input2,
2449
2411
  run_id: review.runId,
2450
2412
  snapshot_hash: review.snapshotHash,
2451
2413
  topic_id: "agent_auto_asset_certification",
@@ -2465,9 +2427,9 @@ async function executeCliAgentAutoReview(ctx, input, exportResult) {
2465
2427
  meta: submitted.meta
2466
2428
  };
2467
2429
  }
2468
- async function planBoundedExpansion(ctx, input) {
2430
+ async function planBoundedExpansion(ctx, input2) {
2469
2431
  await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID, {
2470
- ...input,
2432
+ ...input2,
2471
2433
  limit: DEFAULT_LIMIT
2472
2434
  });
2473
2435
  const attempts = [];
@@ -2475,7 +2437,7 @@ async function planBoundedExpansion(ctx, input) {
2475
2437
  let finalLimit = DEFAULT_LIMIT;
2476
2438
  let stopReason = "top_100_inspected";
2477
2439
  for (const limit2 of EXPANSION_LIMITS) {
2478
- const exported = await exportRecommendationMaterial(ctx, input, limit2);
2440
+ const exported = await exportRecommendationMaterial(ctx, input2, limit2);
2479
2441
  finalExport = exported.data;
2480
2442
  const summary = summarizeExport(exported.data, limit2);
2481
2443
  attempts.push(summary);
@@ -2507,12 +2469,12 @@ async function planBoundedExpansion(ctx, input) {
2507
2469
  finalExport
2508
2470
  };
2509
2471
  }
2510
- function exportRecommendationMaterial(ctx, input, limit2) {
2472
+ function exportRecommendationMaterial(ctx, input2, limit2) {
2511
2473
  return executeCapabilityWithEnvelope(
2512
2474
  ctx.host(),
2513
2475
  gatewayDomain(),
2514
2476
  EXPORT_CAPABILITY_ID,
2515
- compactInput({ ...input, limit: limit2, include_completed: false })
2477
+ compactInput({ ...input2, limit: limit2, include_completed: false })
2516
2478
  );
2517
2479
  }
2518
2480
  function summarizeExport(result, requestedLimit) {
@@ -2548,7 +2510,7 @@ function countPendingAssetCandidates(workUnits) {
2548
2510
  }
2549
2511
  return seen.size;
2550
2512
  }
2551
- function buildCliAgentAutoReview(input, exportResult) {
2513
+ function buildCliAgentAutoReview(input2, exportResult) {
2552
2514
  const exported = record(exportResult);
2553
2515
  const material = record(exported.review_material_package);
2554
2516
  const candidates = array(material.candidate_assets).map(record);
@@ -2589,9 +2551,9 @@ function buildCliAgentAutoReview(input, exportResult) {
2589
2551
  base: {
2590
2552
  schema_version: "1.0",
2591
2553
  run_id: runId,
2592
- project_id: input.project_id ?? exported.project_id,
2593
- window_days: input.window_days ?? exported.window_days,
2594
- dashboard_limit: input.limit ?? exported.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,
2595
2557
  snapshot_hash: snapshotHash,
2596
2558
  rule_version: "agent_auto_asset_certification_v1",
2597
2559
  config_key: "agent_auto_asset_certification_enabled",
@@ -3239,9 +3201,9 @@ var agentReviewSubmitToPage = createAnalysisMetaCapabilityCommand({
3239
3201
  const publicWebHost = resolvePublicWebHost(ctx.host());
3240
3202
  const file = ctx.str("input-file");
3241
3203
  if (file) {
3242
- const input = object(JSON.parse(readFileSync(file, "utf8")), "--input-file");
3204
+ const input2 = object(JSON.parse(readFileSync(file, "utf8")), "--input-file");
3243
3205
  return normalizeSubmitInput(validateInput({
3244
- ...input,
3206
+ ...input2,
3245
3207
  ...projectInput2(ctx),
3246
3208
  client_request_id: text(ctx, "client-request-id")
3247
3209
  }), publicWebHost, ctx.host());
@@ -3266,8 +3228,8 @@ var agentReviewSubmitToPage = createAnalysisMetaCapabilityCommand({
3266
3228
  },
3267
3229
  postProcess: (result, _input, ctx) => normalizeSubmitResult(result, resolvePublicWebHost(ctx.host()), ctx.host())
3268
3230
  });
3269
- function validateInput(input) {
3270
- const items = array2(input.items, "items").map((value) => {
3231
+ function validateInput(input2) {
3232
+ const items = array2(input2.items, "items").map((value) => {
3271
3233
  const item2 = object(value, "items[]");
3272
3234
  fields(item2, [
3273
3235
  "client_item_id",
@@ -3306,7 +3268,7 @@ function validateInput(input) {
3306
3268
  return item2;
3307
3269
  });
3308
3270
  unique(items.map((item2) => item2.client_item_id), "client_item_id");
3309
- fields(input, [
3271
+ fields(input2, [
3310
3272
  "project_id",
3311
3273
  "review_type",
3312
3274
  "schema_version",
@@ -3319,12 +3281,12 @@ function validateInput(input) {
3319
3281
  "presentation_snapshot",
3320
3282
  "items"
3321
3283
  ], "submit-to-page input");
3322
- object(input.ai_summary, "ai_summary");
3323
- validatePresentation(object(input.presentation_snapshot, "presentation_snapshot"), new Set(items.map((item2) => item2.client_item_id)));
3324
- if (input.review_type !== "ASSET_GOVERNANCE" || input.schema_version !== "1.0") {
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") {
3325
3287
  throw new Error("submit-to-page input requires review_type=ASSET_GOVERNANCE and schema_version=1.0.");
3326
3288
  }
3327
- return { ...input, items };
3289
+ return { ...input2, items };
3328
3290
  }
3329
3291
  function validateItemAiSummary(aiSummary, name) {
3330
3292
  if (!meaningfulText(aiSummary.summary)) {
@@ -3451,9 +3413,9 @@ function validatePresentation(presentation, itemIds) {
3451
3413
  }
3452
3414
  }
3453
3415
  }
3454
- function normalizeSubmitInput(input, publicWebHost, sourceHost) {
3455
- normalizeResourceUrlFields(input, publicWebHost, sourceHost);
3456
- return input;
3416
+ function normalizeSubmitInput(input2, publicWebHost, sourceHost) {
3417
+ normalizeResourceUrlFields(input2, publicWebHost, sourceHost);
3418
+ return input2;
3457
3419
  }
3458
3420
  function normalizeSubmitResult(result, publicWebHost, sourceHost) {
3459
3421
  normalizeResourceUrlFields(result, publicWebHost, sourceHost);
@@ -3945,7 +3907,7 @@ function validateAuthenticationExport(ctx) {
3945
3907
  }
3946
3908
  }
3947
3909
  function authenticationExportPostProcess() {
3948
- return async (result, input, ctx) => {
3910
+ return async (result, input2, ctx) => {
3949
3911
  if (typeof result !== "object" || result === null) {
3950
3912
  throw new Error("Asset-authentication export returned an invalid response");
3951
3913
  }
@@ -3981,7 +3943,7 @@ function authenticationExportPostProcess() {
3981
3943
  const checksum = hash.digest("hex");
3982
3944
  const metadata = {
3983
3945
  complete: true,
3984
- project_id: input.project_id,
3946
+ project_id: input2.project_id,
3985
3947
  total: rows.length,
3986
3948
  stat_as_of: data.stat_as_of,
3987
3949
  snapshot_hash: data.snapshot_hash,
@@ -8536,7 +8498,7 @@ function memberGroupNameInput(ctx) {
8536
8498
  return { group_name: name };
8537
8499
  }
8538
8500
  function memberGroupChangeInput(ctx) {
8539
- const input = memberGroupInput(ctx);
8501
+ const input2 = memberGroupInput(ctx);
8540
8502
  let userIds;
8541
8503
  try {
8542
8504
  userIds = ctx.json("user-ids");
@@ -8546,7 +8508,7 @@ function memberGroupChangeInput(ctx) {
8546
8508
  if (!Array.isArray(userIds) || userIds.length === 0 || userIds.length > 1e3 || userIds.some((id) => !Number.isSafeInteger(id) || id < 1 || id > MAX_ID)) {
8547
8509
  throw new CliValidationError("--user-ids must contain 1 to 1000 positive integer user IDs.");
8548
8510
  }
8549
- return { ...input, user_ids: userIds, yes: true };
8511
+ return { ...input2, user_ids: userIds, yes: true };
8550
8512
  }
8551
8513
 
8552
8514
  // src/commands/te-analysis/project/member-group/add-members.ts
@@ -9782,7 +9744,7 @@ var trackingPlanSyncDisplayNames = {
9782
9744
  };
9783
9745
  }
9784
9746
  };
9785
- async function fetchAllDirectoryItems(host, capabilityId, input, arrayField) {
9747
+ async function fetchAllDirectoryItems(host, capabilityId, input2, arrayField) {
9786
9748
  const items = [];
9787
9749
  let offset = 0;
9788
9750
  const visitedOffsets = /* @__PURE__ */ new Set();
@@ -9792,7 +9754,7 @@ async function fetchAllDirectoryItems(host, capabilityId, input, arrayField) {
9792
9754
  }
9793
9755
  visitedOffsets.add(offset);
9794
9756
  const result = await executeCapability(host, GATEWAY_DOMAIN, capabilityId, {
9795
- ...input,
9757
+ ...input2,
9796
9758
  limit: DIRECTORY_PAGE_SIZE,
9797
9759
  offset
9798
9760
  });
@@ -10169,14 +10131,14 @@ var trackingDebugDataList = createTrackingCapabilityCommand({
10169
10131
  start_time: optionalString(ctx, "start-time") ?? formatLocalTime(new Date(Date.now() - 60 * 60 * 1e3)),
10170
10132
  event_name: optionalString(ctx, "event-name")
10171
10133
  }),
10172
- postProcess: (result, input) => {
10134
+ postProcess: (result, input2) => {
10173
10135
  const data = isRecord3(result) ? result : {};
10174
10136
  const eventList = Array.isArray(data.event_list) ? data.event_list : [];
10175
10137
  const deviceDataList = Array.isArray(data.device_data_list) ? data.device_data_list : [];
10176
10138
  return {
10177
- device_id: input.device_id,
10178
- start_time: input.start_time,
10179
- ...input.event_name ? { event_name: input.event_name } : {},
10139
+ device_id: input2.device_id,
10140
+ start_time: input2.start_time,
10141
+ ...input2.event_name ? { event_name: input2.event_name } : {},
10180
10142
  has_data: deviceDataList.length > 0,
10181
10143
  event_count: eventList.length,
10182
10144
  data_count: deviceDataList.length,
@@ -10468,21 +10430,21 @@ function defineSystemCommand(spec) {
10468
10430
  risk: spec.risk,
10469
10431
  validate: (ctx) => {
10470
10432
  validateSecretSources(ctx, secrets);
10471
- const input = buildSystemInput(ctx, fields2, [], spec.capabilityId);
10433
+ const input2 = buildSystemInput(ctx, fields2, [], spec.capabilityId);
10472
10434
  for (const secret of secrets) {
10473
10435
  if (ctx.str(`${secret.flag}-file`) || ctx.bool(`${secret.flag}-stdin`)) {
10474
- input[secret.input] = "<provided>";
10436
+ input2[secret.input] = "<provided>";
10475
10437
  }
10476
10438
  }
10477
- validateFields(fields2, input);
10478
- spec.validate?.(ctx, input);
10439
+ validateFields(fields2, input2);
10440
+ spec.validate?.(ctx, input2);
10479
10441
  },
10480
10442
  buildInput: (ctx) => {
10481
- const input = buildSystemInput(ctx, fields2, secrets, spec.capabilityId);
10482
- validateFields(fields2, input);
10443
+ const input2 = buildSystemInput(ctx, fields2, secrets, spec.capabilityId);
10444
+ validateFields(fields2, input2);
10483
10445
  validateSecretSources(ctx, secrets);
10484
- spec.validate?.(ctx, input);
10485
- return input;
10446
+ spec.validate?.(ctx, input2);
10447
+ return input2;
10486
10448
  }
10487
10449
  });
10488
10450
  }
@@ -10516,17 +10478,17 @@ function secretFlags(secret) {
10516
10478
  ];
10517
10479
  }
10518
10480
  function buildSystemInput(ctx, fields2, secrets, capabilityId) {
10519
- const input = {};
10481
+ const input2 = {};
10520
10482
  for (const field of fields2) {
10521
10483
  const value = fieldValue(ctx, field);
10522
- if (value !== void 0) input[field.input ?? kebabToSnake(field.flag)] = value;
10484
+ if (value !== void 0) input2[field.input ?? kebabToSnake(field.flag)] = value;
10523
10485
  }
10524
10486
  for (const secret of secrets) {
10525
10487
  const value = secretValue(ctx, secret);
10526
- if (value !== void 0) input[secret.input] = secret.transform ? secret.transform(value) : value;
10488
+ if (value !== void 0) input2[secret.input] = secret.transform ? secret.transform(value) : value;
10527
10489
  }
10528
- if (backendConfirmationCapabilities.has(capabilityId)) input.yes = true;
10529
- return compactInput(input);
10490
+ if (backendConfirmationCapabilities.has(capabilityId)) input2.yes = true;
10491
+ return compactInput(input2);
10530
10492
  }
10531
10493
  function fieldValue(ctx, field) {
10532
10494
  const raw = ctx.str(field.flag);
@@ -10536,10 +10498,10 @@ function fieldValue(ctx, field) {
10536
10498
  if (field.type === "boolean") return ctx.bool(field.flag);
10537
10499
  return ctx.json(field.flag);
10538
10500
  }
10539
- function validateFields(fields2, input) {
10501
+ function validateFields(fields2, input2) {
10540
10502
  for (const field of fields2) {
10541
10503
  const inputName = field.input ?? kebabToSnake(field.flag);
10542
- const value = input[inputName];
10504
+ const value = input2[inputName];
10543
10505
  if (field.required && value === void 0) {
10544
10506
  throw validation(`--${field.flag} is required.`);
10545
10507
  }
@@ -10598,15 +10560,15 @@ function nonEmptySecret(value, flag) {
10598
10560
  if (normalized.length === 0) throw validation(`Secret input for --${flag} must not be empty.`);
10599
10561
  return normalized;
10600
10562
  }
10601
- function requireAtLeastOne(input, names, message) {
10563
+ function requireAtLeastOne(input2, names, message) {
10602
10564
  const present = names.some((name) => {
10603
- const value = input[name];
10565
+ const value = input2[name];
10604
10566
  return Array.isArray(value) ? value.length > 0 : value !== void 0 && value !== "";
10605
10567
  });
10606
10568
  if (!present) throw validation(message);
10607
10569
  }
10608
- function requireArrayObjects(input, name, requiredKeys) {
10609
- const value = input[name];
10570
+ function requireArrayObjects(input2, name, requiredKeys) {
10571
+ const value = input2[name];
10610
10572
  if (value === void 0) return;
10611
10573
  if (!Array.isArray(value)) throw validation(`${snakeToFlag(name)} must be a JSON array.`);
10612
10574
  value.forEach((item2, index) => {
@@ -10734,8 +10696,8 @@ var systemConfigurationCommands = [
10734
10696
  { flag: "original-address-url", type: "string", desc: "Original URL when changing an existing address." },
10735
10697
  { flag: "original-address-type", type: "string", desc: "Original address type.", allowed: ["public", "private"] }
10736
10698
  ],
10737
- validate: (_ctx, input) => {
10738
- if (input.scope === "project" && (!Array.isArray(input.project_ids) || input.project_ids.length === 0)) {
10699
+ validate: (_ctx, input2) => {
10700
+ if (input2.scope === "project" && (!Array.isArray(input2.project_ids) || input2.project_ids.length === 0)) {
10739
10701
  throw validation("--project-ids is required when --scope project.");
10740
10702
  }
10741
10703
  }
@@ -10813,14 +10775,14 @@ var systemConfigurationCommands = [
10813
10775
  { input: "app_secret", flag: "app-secret", required: true, desc: "Provider application secret." },
10814
10776
  { input: "dd_scan_app_secret", flag: "dd-scan-app-secret", desc: "DingTalk scan-login application secret." }
10815
10777
  ],
10816
- validate: (_ctx, input) => {
10817
- if (input.login_type === "wecom" && !input.corp_id) {
10778
+ validate: (_ctx, input2) => {
10779
+ if (input2.login_type === "wecom" && !input2.corp_id) {
10818
10780
  throw validation("--corp-id is required for wecom.");
10819
10781
  }
10820
- if (input.login_type === "dingtalk") {
10821
- requireAtLeastOne(input, ["corp_id"], "--corp-id is required for dingtalk.");
10782
+ if (input2.login_type === "dingtalk") {
10783
+ requireAtLeastOne(input2, ["corp_id"], "--corp-id is required for dingtalk.");
10822
10784
  for (const name of ["agent_id", "dd_scan_app_id", "dd_scan_app_secret"]) {
10823
- if (!input[name]) throw validation(`--${name.replaceAll("_", "-")} is required for dingtalk.`);
10785
+ if (!input2[name]) throw validation(`--${name.replaceAll("_", "-")} is required for dingtalk.`);
10824
10786
  }
10825
10787
  }
10826
10788
  }
@@ -10874,9 +10836,9 @@ var systemIdentityCommands = [
10874
10836
  fields: [
10875
10837
  { flag: "members", type: "json", required: true, array: true, desc: "Member array with login_name and user_name." }
10876
10838
  ],
10877
- validate: (_ctx, input) => {
10878
- requireAtLeastOne(input, ["members"], "Provide a non-empty --members array.");
10879
- requireArrayObjects(input, "members", ["login_name", "user_name"]);
10839
+ validate: (_ctx, input2) => {
10840
+ requireAtLeastOne(input2, ["members"], "Provide a non-empty --members array.");
10841
+ requireArrayObjects(input2, "members", ["login_name", "user_name"]);
10880
10842
  }
10881
10843
  }),
10882
10844
  defineSystemCommand({
@@ -10912,10 +10874,10 @@ var systemIdentityCommands = [
10912
10874
  { flag: "project-updates", type: "json", array: true, desc: "Project update array: project_id, role_names, and optional data_power_id." },
10913
10875
  { flag: "project-removals", type: "json", array: true, desc: "Project removal and handover array." }
10914
10876
  ],
10915
- validate: (_ctx, input) => {
10916
- requireAtLeastOne(input, ["project_updates", "project_removals"], "Provide a non-empty --project-updates or --project-removals array.");
10917
- requireArrayObjects(input, "project_updates", ["project_id", "role_names"]);
10918
- requireArrayObjects(input, "project_removals", ["project_id", "handover_type"]);
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"]);
10919
10881
  }
10920
10882
  }),
10921
10883
  defineSystemCommand({
@@ -10944,7 +10906,7 @@ var systemIdentityCommands = [
10944
10906
  fields: [
10945
10907
  { flag: "admins", type: "json", required: true, array: true, desc: "Administrator array with target_user_id and function_names." }
10946
10908
  ],
10947
- validate: (_ctx, input) => requireArrayObjects(input, "admins", ["target_user_id", "function_names"])
10909
+ validate: (_ctx, input2) => requireArrayObjects(input2, "admins", ["target_user_id", "function_names"])
10948
10910
  }),
10949
10911
  defineSystemCommand({
10950
10912
  resource: "admin-function",
@@ -10964,7 +10926,7 @@ var systemIdentityCommands = [
10964
10926
  targetOpenId,
10965
10927
  { flag: "function-names", type: "json", required: true, array: true, desc: "Complete function-name JSON array." }
10966
10928
  ],
10967
- validate: (_ctx, input) => requireAtLeastOne(input, ["function_names"], "--function-names must contain at least one function.")
10929
+ validate: (_ctx, input2) => requireAtLeastOne(input2, ["function_names"], "--function-names must contain at least one function.")
10968
10930
  }),
10969
10931
  defineSystemCommand({
10970
10932
  resource: "admin",
@@ -11001,7 +10963,7 @@ var systemIdentityCommands = [
11001
10963
  { flag: "role-desc", type: "string", required: true, desc: "Role description." },
11002
10964
  { flag: "function-names", type: "json", required: true, array: true, desc: "Complete function-name JSON array." }
11003
10965
  ],
11004
- validate: (_ctx, input) => requireAtLeastOne(input, ["function_names"], "--function-names must contain at least one function.")
10966
+ validate: (_ctx, input2) => requireAtLeastOne(input2, ["function_names"], "--function-names must contain at least one function.")
11005
10967
  }),
11006
10968
  defineSystemCommand({
11007
10969
  resource: "role",
@@ -11060,7 +11022,7 @@ var systemIdentityCommands = [
11060
11022
  { flag: "seat-type", type: "string", required: true, desc: "Seat type; empty removes seats.", allowed: ["manage", "view", "empty"] },
11061
11023
  { flag: "open-ids", type: "json", required: true, array: true, desc: "Company member open-ID JSON array." }
11062
11024
  ],
11063
- validate: (_ctx, input) => requireAtLeastOne(input, ["open_ids"], "--open-ids must contain at least one company member.")
11025
+ validate: (_ctx, input2) => requireAtLeastOne(input2, ["open_ids"], "--open-ids must contain at least one company member.")
11064
11026
  })
11065
11027
  ];
11066
11028
 
@@ -11085,15 +11047,15 @@ var monitorTimeFields = [
11085
11047
  desc: "Inclusive completion-time range end, including the entire second, yyyy-MM-dd HH:mm:ss."
11086
11048
  }
11087
11049
  ];
11088
- function validateTaskQueryInput(input) {
11089
- validateMonitorScope(input);
11050
+ function validateTaskQueryInput(input2) {
11051
+ validateMonitorScope(input2);
11090
11052
  for (const name of ["status_codes", "content_codes", "task_type_codes"]) {
11091
- requireAtLeastOne(input, [name], `--${name.replaceAll("_", "-")} must be a non-empty JSON array.`);
11053
+ requireAtLeastOne(input2, [name], `--${name.replaceAll("_", "-")} must be a non-empty JSON array.`);
11092
11054
  }
11093
11055
  }
11094
- function validateMonitorScope(input) {
11056
+ function validateMonitorScope(input2) {
11095
11057
  requireAtLeastOne(
11096
- input,
11058
+ input2,
11097
11059
  ["project_ids", "space_codes"],
11098
11060
  "Provide a non-empty --project-ids or --space-codes array."
11099
11061
  );
@@ -11118,7 +11080,7 @@ var systemMonitoringCommands = [
11118
11080
  { flag: "cluster-names", type: "json", required: true, array: true, desc: "Query cluster-name JSON array." },
11119
11081
  { flag: "point-interval-seconds", type: "number", min: 5, max: 300, desc: "Chart sample interval seconds. Default: 5." }
11120
11082
  ],
11121
- validate: (_ctx, input) => validateMonitorScope(input)
11083
+ validate: (_ctx, input2) => validateMonitorScope(input2)
11122
11084
  }),
11123
11085
  defineSystemCommand({
11124
11086
  resource: "query-task",
@@ -11144,7 +11106,7 @@ var systemMonitoringCommands = [
11144
11106
  offsetField,
11145
11107
  fieldsField
11146
11108
  ],
11147
- validate: (_ctx, input) => validateTaskQueryInput(input)
11109
+ validate: (_ctx, input2) => validateTaskQueryInput(input2)
11148
11110
  }),
11149
11111
  defineSystemCommand({
11150
11112
  resource: "query-task",
@@ -11159,11 +11121,11 @@ var systemMonitoringCommands = [
11159
11121
  { flag: "status-codes", type: "json", array: true, desc: "Optional task status-code JSON array." },
11160
11122
  { flag: "limit", type: "number", min: 1, max: 200, desc: "Maximum returned tasks. Default: 100, max: 200." }
11161
11123
  ],
11162
- validate: (_ctx, input) => {
11163
- validateMonitorScope(input);
11164
- requireAtLeastOne(input, ["cluster_names"], "--cluster-names must be a non-empty JSON array.");
11165
- if (input.status_codes !== void 0) {
11166
- requireAtLeastOne(input, ["status_codes"], "--status-codes must be a non-empty JSON array.");
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.");
11167
11129
  }
11168
11130
  }
11169
11131
  }),
@@ -11217,7 +11179,7 @@ var systemMonitoringCommands = [
11217
11179
  desc: "Maximum export runtime in seconds. Default and max: 21600."
11218
11180
  }
11219
11181
  ],
11220
- validate: (_ctx, input) => validateTaskQueryInput(input)
11182
+ validate: (_ctx, input2) => validateTaskQueryInput(input2)
11221
11183
  }),
11222
11184
  defineSystemCommand({
11223
11185
  resource: "node-monitor",
@@ -11248,14 +11210,14 @@ var systemMonitoringCommands = [
11248
11210
  { flag: "upserts", type: "json", array: true, desc: "Rule upsert JSON array." },
11249
11211
  { flag: "delete-ids", type: "json", array: true, desc: "Positive rule-ID JSON array to delete." }
11250
11212
  ],
11251
- validate: (_ctx, input) => {
11252
- requireAtLeastOne(input, ["upserts", "delete_ids"], "Provide a non-empty --upserts or --delete-ids array.");
11253
- requireArrayObjects(input, "upserts", ["metric_content", "wheel_minutes", "wheel_interval", "threshold"]);
11254
- const deleteIds = input.delete_ids;
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;
11255
11217
  if (deleteIds?.some((id) => !Number.isInteger(id) || Number(id) <= 0)) {
11256
11218
  throw validation("--delete-ids must contain positive integers.");
11257
11219
  }
11258
- const upserts = input.upserts;
11220
+ const upserts = input2.upserts;
11259
11221
  for (const [index, item2] of (upserts ?? []).entries()) {
11260
11222
  const metric = Number(item2.metric_content);
11261
11223
  const wheelMinutes = Number(item2.wheel_minutes);
@@ -11296,12 +11258,12 @@ var systemMonitoringCommands = [
11296
11258
  { flag: "on-status", type: "number", allowed: [0, 1], desc: "Enable state: 0 or 1; required on create." }
11297
11259
  ],
11298
11260
  secrets: contactWebhookSecrets,
11299
- validate: (_ctx, input) => {
11300
- if (input.contact_id === void 0) {
11301
- if (!input.name) throw validation("--name is required when creating a contact.");
11302
- if (input.on_status === void 0) throw validation("--on-status is required when creating a contact.");
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.");
11303
11265
  requireAtLeastOne(
11304
- input,
11266
+ input2,
11305
11267
  ["mail_address", "mobile", ...contactWebhookSecrets.map((item2) => item2.input)],
11306
11268
  "Provide at least one delivery target when creating a contact."
11307
11269
  );
@@ -11451,11 +11413,11 @@ var systemUsageCommands = [
11451
11413
  { flag: "project-ids", type: "json", array: true, desc: "Project ID JSON array; required for project scope." },
11452
11414
  { flag: "data-type", type: "string", desc: "Optional event-volume data type.", allowed: ["all", "event", "user"] }
11453
11415
  ],
11454
- validate: (_ctx, input) => {
11455
- if (input.metric === "apollo_token") {
11416
+ validate: (_ctx, input2) => {
11417
+ if (input2.metric === "apollo_token") {
11456
11418
  throw validation("--metric apollo_token is not implemented by the current service.");
11457
11419
  }
11458
- if (input.scope === "project" && (!Array.isArray(input.project_ids) || input.project_ids.length === 0)) {
11420
+ if (input2.scope === "project" && (!Array.isArray(input2.project_ids) || input2.project_ids.length === 0)) {
11459
11421
  throw validation("--project-ids is required when --scope project.");
11460
11422
  }
11461
11423
  }
@@ -11488,11 +11450,11 @@ var systemUsageCommands = [
11488
11450
  desc: "Maximum export runtime in seconds. Default and max: 21600."
11489
11451
  }
11490
11452
  ],
11491
- validate: (_ctx, input) => {
11492
- if (input.metric === "apollo_token") {
11453
+ validate: (_ctx, input2) => {
11454
+ if (input2.metric === "apollo_token") {
11493
11455
  throw validation("--metric apollo_token is not implemented by the current service.");
11494
11456
  }
11495
- if (input.scope === "project" && (!Array.isArray(input.project_ids) || input.project_ids.length === 0)) {
11457
+ if (input2.scope === "project" && (!Array.isArray(input2.project_ids) || input2.project_ids.length === 0)) {
11496
11458
  throw validation("--project-ids is required when --scope project.");
11497
11459
  }
11498
11460
  }
@@ -11603,7 +11565,7 @@ function scenarioInput(ctx, append = false) {
11603
11565
  const questionId = text2(ctx.str("question-id") || (!append ? agent.agent_turn_id ?? "" : ""), "question-id", 191);
11604
11566
  const projectId = ctx.optionalNum("project-id");
11605
11567
  if (projectId !== void 0 && (!Number.isInteger(projectId) || projectId <= 0)) throw new CliValidationError("project-id must be a positive integer.");
11606
- const input = {
11568
+ const input2 = {
11607
11569
  agent_session_id: session,
11608
11570
  question_id: questionId,
11609
11571
  ...projectId !== void 0 ? { project_id: projectId } : {}
@@ -11613,18 +11575,18 @@ function scenarioInput(ctx, append = false) {
11613
11575
  throw new CliValidationError("entry-type must be user_feedback or answer_revision.");
11614
11576
  }
11615
11577
  if (append) {
11616
- input.entry_type = entryType;
11617
- input.entry_id = text2(ctx.str("entry-id") || (agent.agent_turn_id ? `${agent.agent_turn_id}:${entryType}` : ""), "entry-id", 191);
11618
- input.target_answer_id = text2(ctx.str("target-answer-id"), "target-answer-id", 191);
11619
- input.text = text2(ctx.str("text"), "text", entryType === "user_feedback" ? 4096 : 16384);
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);
11620
11582
  } else {
11621
- input.question = text2(ctx.str("question"), "question", 8192);
11622
- input.answer = text2(ctx.str("answer"), "answer", 16384);
11583
+ input2.question = text2(ctx.str("question"), "question", 8192);
11584
+ input2.answer = text2(ctx.str("answer"), "answer", 16384);
11623
11585
  }
11624
11586
  if (entryType !== "user_feedback") {
11625
- if (append && ctx.str("user-message")) input.user_message = text2(ctx.str("user-message"), "user-message", 4096);
11626
- input.answer_id = text2(ctx.str("answer-id") || (agent.agent_turn_id ? `answer:${agent.agent_turn_id}` : ""), "answer-id", 191);
11627
- if (input.answer_id === input.target_answer_id) throw new CliValidationError("A revision requires a new answer-id; target-answer-id must preserve the previous answer.");
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.");
11628
11590
  const path = ctx.json("query-path");
11629
11591
  if (!Array.isArray(path) || !path.length || path.length > 64) throw new CliValidationError("query-path must contain 1..64 ordered CLI call references.");
11630
11592
  for (const step of path) {
@@ -11636,23 +11598,23 @@ function scenarioInput(ctx, append = false) {
11636
11598
  }
11637
11599
  if (!path.some((step) => analysisQueryCapabilities.has(step.capability_id))) throw new CliValidationError("query-path must reference at least one attempted analysis data query.");
11638
11600
  if (JSON.stringify(path).length > 2e4) throw new CliValidationError("query-path must be at most 20000 characters.");
11639
- input.query_path = path;
11601
+ input2.query_path = path;
11640
11602
  const started = ctx.str("start-time");
11641
- if (started) input.duration_ms = scenarioDuration(started);
11603
+ if (started) input2.duration_ms = scenarioDuration(started);
11642
11604
  } else if (ctx.json("query-path") !== void 0 || ctx.str("answer-id") || ctx.str("user-message") || ctx.str("start-time")) {
11643
11605
  throw new CliValidationError("user_feedback records user text and its target only; do not attach an answer or query path.");
11644
11606
  }
11645
- return input;
11607
+ return input2;
11646
11608
  }
11647
11609
  function scenarioTransportInput(ctx, append = false) {
11648
- const input = scenarioInput(ctx, append);
11610
+ const input2 = scenarioInput(ctx, append);
11649
11611
  const field = append ? "text" : "answer";
11650
- const original = input[field];
11612
+ const original = input2[field];
11651
11613
  const bytes = Buffer.from(original, "utf8");
11652
11614
  if (bytes.toString("utf8") !== original) {
11653
11615
  throw new CliValidationError(`${field} must contain valid Unicode text.`);
11654
11616
  }
11655
- return { ...input, [field]: bytes.toString("base64"), content_encoding: "base64" };
11617
+ return { ...input2, [field]: bytes.toString("base64"), content_encoding: "base64" };
11656
11618
  }
11657
11619
  var commonFlags2 = [
11658
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." },
@@ -11665,22 +11627,22 @@ function withProjectCollectionPolicy(command2) {
11665
11627
  return {
11666
11628
  ...command2,
11667
11629
  execute: async (ctx) => {
11668
- const input = scenarioInput(ctx, command2.command === "append");
11630
+ const input2 = scenarioInput(ctx, command2.command === "append");
11669
11631
  const skipped = (reason) => withOutputMetadata({
11670
11632
  accepted: false,
11671
11633
  skipped: true,
11672
11634
  reason,
11673
- question_id: input.question_id,
11674
- ...input.answer_id ? { answer_id: input.answer_id } : {},
11675
- ...input.entry_id ? { entry_id: input.entry_id } : {},
11676
- ...input.target_answer_id ? { target_answer_id: input.target_answer_id } : {},
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 } : {},
11677
11639
  event_name: command2.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
11678
11640
  delivery: "best_effort"
11679
11641
  }, { capability_id: command2.capabilityId });
11680
- if (input.project_id === void 0) return skipped("PROJECT_REQUIRED");
11642
+ if (input2.project_id === void 0) return skipped("PROJECT_REQUIRED");
11681
11643
  try {
11682
11644
  const policy = await executeCapabilityWithEnvelope(ctx.host(), "analysis", "project.info.get", {
11683
- project_id: input.project_id
11645
+ project_id: input2.project_id
11684
11646
  });
11685
11647
  if (policy.data?.analysis_scenario_collection_enabled !== true) {
11686
11648
  return skipped("PROJECT_COLLECTION_DISABLED");
@@ -11739,7 +11701,7 @@ var scenarioBegin = {
11739
11701
  execute: async () => ({ start_time: (/* @__PURE__ */ new Date()).toISOString() })
11740
11702
  };
11741
11703
  function scenarioListInput(ctx) {
11742
- const input = {};
11704
+ const input2 = {};
11743
11705
  for (const [flag, min, max, fallback] of [
11744
11706
  ["project-id", 1, 2147483647, void 0],
11745
11707
  ["days", 1, 90, 7],
@@ -11750,16 +11712,16 @@ function scenarioListInput(ctx) {
11750
11712
  if (value === void 0 || !Number.isInteger(value) || value < min || value > max) {
11751
11713
  throw new CliValidationError(`${flag} must be an integer between ${min} and ${max}.`);
11752
11714
  }
11753
- input[flag.replaceAll("-", "_")] = value;
11715
+ input2[flag.replaceAll("-", "_")] = value;
11754
11716
  }
11755
11717
  const end = ctx.str("end-time");
11756
11718
  if (end) {
11757
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))) {
11758
11720
  throw new CliValidationError("end-time must be an ISO-8601 timestamp with a timezone.");
11759
11721
  }
11760
- input.end_time = end;
11722
+ input2.end_time = end;
11761
11723
  }
11762
- return input;
11724
+ return input2;
11763
11725
  }
11764
11726
  var scenarioList = createAnalysisCapabilityCommand({
11765
11727
  resource: "scenario",
@@ -11777,11 +11739,11 @@ var scenarioList = createAnalysisCapabilityCommand({
11777
11739
  buildInput: scenarioListInput
11778
11740
  });
11779
11741
  function scenarioGetInput(ctx) {
11780
- const { limit: limit2, offset, ...input } = scenarioListInput(ctx);
11742
+ const { limit: limit2, offset, ...input2 } = scenarioListInput(ctx);
11781
11743
  for (const key of ["open-id", "agent-session-id", "question-id"]) {
11782
- input[key.replaceAll("-", "_")] = text2(ctx.str(key), key, 191);
11744
+ input2[key.replaceAll("-", "_")] = text2(ctx.str(key), key, 191);
11783
11745
  }
11784
- return input;
11746
+ return input2;
11785
11747
  }
11786
11748
  var scenarioGet = createAnalysisCapabilityCommand({
11787
11749
  resource: "scenario",
@@ -11803,7 +11765,7 @@ var scenario_default = [scenarioBegin, scenarioCollect, scenarioAppend, scenario
11803
11765
  async function syncBadCaseEvaluation(ctx, projectId, value) {
11804
11766
  const item2 = value;
11805
11767
  if (!item2?.evaluation || !["PENDING", "ERROR"].includes(item2.evaluation.state)) return value;
11806
- const common = (action, input = {}) => executeCapability(ctx.host(), "analysis", `analysis.bad_case.${action}`, { project_id: projectId, ...input });
11768
+ const common = (action, input2 = {}) => executeCapability(ctx.host(), "analysis", `analysis.bad_case.${action}`, { project_id: projectId, ...input2 });
11807
11769
  let report;
11808
11770
  try {
11809
11771
  const config = await common("evaluation_config");
@@ -11854,7 +11816,7 @@ var item = { name: "item-id", type: "string", required: true, desc: "Bad Case it
11854
11816
  var batch = { name: "batch-id", type: "string", required: true, desc: "Discovery batch ID returned by begin." };
11855
11817
  var limit = { name: "limit", type: "number", desc: "Page size, 1..100. Follow pagination until complete." };
11856
11818
  function badCaseInput(action, flags, ctx) {
11857
- const input = {};
11819
+ const input2 = {};
11858
11820
  for (const flag of flags) {
11859
11821
  if (flag.name === "input-file") continue;
11860
11822
  const value = ctx.str(flag.name);
@@ -11865,17 +11827,17 @@ function badCaseInput(action, flags, ctx) {
11865
11827
  const minimum = flag.name === "offset" ? 0 : 1;
11866
11828
  const maximum = flag.name === "limit" ? 100 : 2147483647;
11867
11829
  if (!Number.isInteger(number) || number < minimum || number > maximum) throw new CliValidationError(`${flag.name} must be an integer between ${minimum} and ${maximum}.`);
11868
- input[flag.name.replaceAll("-", "_")] = number;
11830
+ input2[flag.name.replaceAll("-", "_")] = number;
11869
11831
  } else if (flag.type === "boolean") {
11870
11832
  if (!["true", "false"].includes(value)) throw new CliValidationError(`${flag.name} must be true or false.`);
11871
- input[flag.name.replaceAll("-", "_")] = value === "true";
11833
+ input2[flag.name.replaceAll("-", "_")] = value === "true";
11872
11834
  } else {
11873
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.`);
11874
- input[flag.name.replaceAll("-", "_")] = value;
11836
+ input2[flag.name.replaceAll("-", "_")] = value;
11875
11837
  }
11876
11838
  }
11877
- if (action === "review" && !["APPROVE", "REJECT", "REVOKE"].includes(String(input.decision))) throw new CliValidationError("decision must be APPROVE, REJECT or REVOKE.");
11878
- if (action === "run" && !["HEARTBEAT", "FAILED"].includes(String(input.action))) throw new CliValidationError("action must be HEARTBEAT or FAILED.");
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.");
11879
11841
  if (action === "submit") {
11880
11842
  let packet;
11881
11843
  try {
@@ -11899,9 +11861,9 @@ function badCaseInput(action, flags, ctx) {
11899
11861
  }
11900
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.");
11901
11863
  }
11902
- input.candidates = packet.candidates;
11864
+ input2.candidates = packet.candidates;
11903
11865
  }
11904
- return input;
11866
+ return input2;
11905
11867
  }
11906
11868
  function command(action, description, flags, read = false) {
11907
11869
  return createAnalysisCapabilityCommand({
@@ -11912,7 +11874,7 @@ function command(action, description, flags, read = false) {
11912
11874
  risk: read ? "read" : "write",
11913
11875
  flags: [project, ...flags],
11914
11876
  buildInput: (ctx) => badCaseInput(action, [project, ...flags], ctx),
11915
- ...action === "review" ? { postProcess: (result, input, ctx) => syncBadCaseEvaluation(ctx, Number(input.project_id), result) } : {}
11877
+ ...action === "review" ? { postProcess: (result, input2, ctx) => syncBadCaseEvaluation(ctx, Number(input2.project_id), result) } : {}
11916
11878
  });
11917
11879
  }
11918
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." }]);
@@ -11933,6 +11895,111 @@ var badCaseSyncEvaluation = {
11933
11895
  };
11934
11896
  var bad_case_default = [badCaseBegin, badCaseRun, badCaseHistory, badCaseSubmit, badCaseList, badCaseGet, badCaseReview, badCaseSubmitToPage, badCaseSyncEvaluation];
11935
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
+
11936
12003
  // src/commands/te-analysis/index.ts
11937
12004
  registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
11938
12005
  registerCapabilityGatewayRoute("project", { gatewayDomain: "analysis" });
@@ -11985,7 +12052,7 @@ var baseCommands = [
11985
12052
  ...scenario_default,
11986
12053
  ...bad_case_default
11987
12054
  ];
11988
- var commands84 = [...baseCommands];
12055
+ var commands84 = [...baseCommands, ...onboarding_default];
11989
12056
  var te_analysis_default = commands84;
11990
12057
  export {
11991
12058
  baseCommands,