@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.
Files changed (119) hide show
  1. package/README.md +8 -5
  2. package/README.zh.md +10 -9
  3. package/bin/runtime-capabilities.json +1 -1
  4. package/cli-installation-guide.md +14 -4
  5. package/dist/{ai-monitor-MKMHSSNI.js → ai-monitor-TVRFVZBH.js} +11 -9
  6. package/dist/ai-monitor.js +18 -16
  7. package/dist/{auth-CZHHPZOQ.js → auth-JAXLMPBB.js} +33 -316
  8. package/dist/{automation-FLCPFMN4.js → automation-OQ647CSW.js} +7 -7
  9. package/dist/{capability-64KVJFIA.js → capability-2Z4ZXTPD.js} +19 -16
  10. package/dist/chunk-2H3SFJE3.js +344 -0
  11. package/dist/{chunk-TMQGS4TO.js → chunk-3PZNM5KN.js} +3 -3
  12. package/dist/chunk-3ZQY7SLZ.js +147 -0
  13. package/dist/chunk-6E6HCTP2.js +60 -0
  14. package/dist/{local-data-upload-client-KCMG6J62.js → chunk-6IUTXRAD.js} +32 -4
  15. package/dist/{chunk-5M5LBRR3.js → chunk-CYZV5AXW.js} +18 -9
  16. package/dist/{chunk-3ULDJJTZ.js → chunk-DE5XHQQ6.js} +2 -2
  17. package/dist/{chunk-FCAA7I2D.js → chunk-E5CJI7L3.js} +26 -10
  18. package/dist/{chunk-QVRIDN42.js → chunk-EQMGH32F.js} +2 -2
  19. package/dist/{chunk-DWBYNGSR.js → chunk-FNACCKQR.js} +372 -194
  20. package/dist/{chunk-OAWPT7VP.js → chunk-GD5JSAGV.js} +2 -2
  21. package/dist/{chunk-CF6JTT2U.js → chunk-GYODT7C4.js} +1 -1
  22. package/dist/chunk-HBI7IQH3.js +1207 -0
  23. package/dist/{chunk-4PSTYEG5.js → chunk-IGU3R2JD.js} +9 -5
  24. package/dist/{chunk-IDDWEZ7F.js → chunk-IWMDPHMI.js} +3 -3
  25. package/dist/{chunk-P7QDCWJ6.js → chunk-L7MT53VM.js} +8 -2
  26. package/dist/{chunk-F2VFZUGG.js → chunk-LXRALNNA.js} +2 -2
  27. package/dist/{chunk-6M7ZEDT2.js → chunk-M2OCZRVX.js} +14 -8
  28. package/dist/{chunk-Z3Q2AEIN.js → chunk-MTK4ZE7W.js} +17 -145
  29. package/dist/{chunk-T7WF4HYW.js → chunk-NK5PS5X7.js} +3 -3
  30. package/dist/{chunk-JEUXDY3B.js → chunk-NPH5J65M.js} +1 -1
  31. package/dist/chunk-PUSFEC6B.js +29 -0
  32. package/dist/{chunk-BNBCMCYN.js → chunk-Q764EZND.js} +78 -72
  33. package/dist/chunk-QOJXLXDJ.js +55 -0
  34. package/dist/{chunk-HVMCPKOZ.js → chunk-QPUPWGZ3.js} +1 -1
  35. package/dist/{chunk-72NJKS7O.js → chunk-RLPMXKDQ.js} +8921 -10119
  36. package/dist/{chunk-NLEXY2TM.js → chunk-S74XV3A6.js} +7 -5
  37. package/dist/{chunk-KTJXD27G.js → chunk-SHB7A2JE.js} +3 -3
  38. package/dist/{chunk-HTZ2MLYA.js → chunk-UWQXGF44.js} +25 -11
  39. package/dist/{data-integration-QE37EQ3A.js → chunk-V6UKLIM6.js} +160 -2258
  40. package/dist/{chunk-4XKTRCRK.js → chunk-VPLRZSMY.js} +22 -13
  41. package/dist/{chunk-2F64AZYH.js → chunk-Z6WSCIHM.js} +2 -2
  42. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-5VNT6HCV.js} +4 -2
  43. package/dist/{compat-check-ZJNCMNQV.js → compat-check-E7AQ7UCG.js} +6 -4
  44. package/dist/{config-FSH2NMNZ.js → config-PGSUWIK5.js} +16 -11
  45. package/dist/{context-YAQG6YQC.js → context-Y2A6QIS3.js} +9 -6
  46. package/dist/conversion-4FR3RA45.js +16 -0
  47. package/dist/data-integration-EIF5QHYF.js +2138 -0
  48. package/dist/{evaluation-2JSF4V47.js → evaluation-OZM54MES.js} +6 -5
  49. package/dist/index.js +79 -52
  50. package/dist/local-data-upload-client-2U3LFD7Z.js +16 -0
  51. package/dist/{memory-VEZZVAAP.js → memory-6QMZS4HF.js} +7 -7
  52. package/dist/{metadata-3IWHX3V4.js → metadata-7MZ3CJ2N.js} +11 -9
  53. package/dist/{model-T7H7Q6BG.js → model-LEYRQKOS.js} +8 -8
  54. package/dist/{personal-semantic-preference-YITU23SA.js → personal-semantic-preference-SWOUNDWJ.js} +46 -14
  55. package/dist/{project-semantic-MHEXJF3C.js → project-semantic-M2DDPAMD.js} +10 -8
  56. package/dist/{sync-AQHVCSPI.js → sync-PWC63JCO.js} +17 -16
  57. package/dist/{te-agent-RXI7WOH4.js → te-agent-S7UH657Z.js} +304 -16
  58. package/dist/{te-analysis-CZY74HVF.js → te-analysis-BK6PE333.js} +295 -223
  59. package/dist/{te-community-DKCYUBCM.js → te-community-OLNTKGCW.js} +17 -13
  60. package/dist/{te-dataops-QEH6VE56.js → te-dataops-XUWRIF5R.js} +18 -14
  61. package/dist/{te-engage-WK7WKDKF.js → te-engage-I3I4FJOM.js} +10 -8
  62. package/dist/{te-experiment-LH3RPIOE.js → te-experiment-XSDUL4KH.js} +216 -28
  63. package/dist/{te-kb-UPORIOVN.js → te-kb-QFH3YLFQ.js} +74 -21
  64. package/dist/{te-system-AL4B4XZL.js → te-system-DB5Z3LLF.js} +7 -7
  65. package/dist/{te-team-LLVTO2G4.js → te-team-UADF2HBO.js} +10 -8
  66. package/dist/{things-XLMLBYQR.js → things-G2QFXDK7.js} +10 -8
  67. package/dist/{update-7J5UQHSK.js → update-6I366ICW.js} +10 -9
  68. package/dist/web-runtime-3XFREWRF.js +2367 -0
  69. package/dist/{workspace-FF2HXJGR.js → workspace-RZESYB6T.js} +7 -7
  70. package/package.json +9 -5
  71. package/skills/ae-agent/SKILL.md +19 -5
  72. package/skills/ae-agent/references/a2a.md +103 -0
  73. package/skills/ae-agent/references/command_index.md +11 -0
  74. package/skills/ae-analysis/SKILL.md +35 -23
  75. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  76. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  77. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  78. package/skills/ae-analysis/references/bad_case_review.md +4 -4
  79. package/skills/ae-analysis/references/command_index.md +7 -7
  80. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  81. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  82. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  83. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  84. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  85. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  86. package/skills/ae-analysis/references/project_owner_update.md +5 -1
  87. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  88. package/skills/ae-analysis/references/scenario_list.md +5 -6
  89. package/skills/ae-capability/SKILL.md +8 -4
  90. package/skills/ae-data-integration/references/ue-mapping.md +2 -0
  91. package/skills/ae-experiment/SKILL.md +45 -16
  92. package/skills/ae-experiment/references/experiment_approval.md +87 -29
  93. package/skills/ae-experiment/references/manage_experiment.md +7 -3
  94. package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
  95. package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
  96. package/skills/ae-experiment/references/query_experiment_list.md +6 -0
  97. package/skills/ae-experiment/references/save_experiment.md +39 -13
  98. package/skills/ae-experiment/references/save_metric.md +29 -2
  99. package/skills/ae-experiment/references/save_submit_experiment.md +11 -7
  100. package/skills/ae-experiment/references/save_submit_external_experiment.md +16 -14
  101. package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
  102. package/skills/ae-kb/SKILL.md +4 -2
  103. package/skills/ae-kb/references/publication.md +45 -0
  104. package/skills/ae-onboarding/SKILL.md +64 -0
  105. package/skills/ae-onboarding/references/business-sdk.md +8 -0
  106. package/skills/ae-onboarding/references/demo-operations.md +79 -0
  107. package/skills/ae-onboarding/references/import.md +19 -0
  108. package/skills/ae-onboarding/references/onboarding_experiment_launch.md +12 -0
  109. package/skills/ae-onboarding/references/onboarding_experiment_plan.md +14 -0
  110. package/skills/ae-onboarding/references/onboarding_growth.md +36 -0
  111. package/skills/ae-onboarding/references/onboarding_run.md +11 -0
  112. package/skills/ae-onboarding/references/onboarding_status.md +5 -0
  113. package/skills/ae-onboarding/scripts/experiment-preset.json +252 -0
  114. package/skills/ae-onboarding/scripts/experiment-requests.mjs +120 -0
  115. package/skills/ae-onboarding/scripts/generate.mjs +170 -0
  116. package/skills/ae-onboarding/scripts/resolve-experiment-preset.mjs +26 -0
  117. package/skills/ae-onboarding/scripts/web-journey.mjs +39 -0
  118. package/dist/chunk-6ZIQV5GW.js +0 -26
  119. 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
  createCapabilityCommand
4
- } from "./chunk-TMQGS4TO.js";
4
+ } from "./chunk-3PZNM5KN.js";
5
5
  import {
6
6
  registerCapabilityGatewayRoute,
7
7
  resolveGatewayDomain
@@ -9,32 +9,36 @@ import {
9
9
  import {
10
10
  unwrapOutputData,
11
11
  withOutputMetadata
12
- } from "./chunk-3ULDJJTZ.js";
12
+ } from "./chunk-DE5XHQQ6.js";
13
13
  import {
14
14
  CapabilityGatewayError,
15
15
  buildCapabilityGatewayUrl,
16
16
  requestCapabilityGatewayWithEnvelope
17
- } from "./chunk-4XKTRCRK.js";
17
+ } from "./chunk-VPLRZSMY.js";
18
18
  import {
19
- internalCallSourceHeaders
20
- } from "./chunk-Y74WTIKJ.js";
21
- import "./chunk-DWBYNGSR.js";
19
+ sourceLoggedFetch
20
+ } from "./chunk-6E6HCTP2.js";
21
+ import "./chunk-FNACCKQR.js";
22
+ import "./chunk-PUSFEC6B.js";
22
23
  import {
23
24
  SecureStoreAuthError,
24
- getCliToken
25
- } from "./chunk-HTZ2MLYA.js";
25
+ getCliToken,
26
+ internalCallSourceHeaders
27
+ } from "./chunk-UWQXGF44.js";
26
28
  import {
27
29
  getActiveHost,
28
30
  parseJsonRequest,
29
31
  safeJsonParse,
30
32
  stringifyJsonRequest
31
- } from "./chunk-4PSTYEG5.js";
33
+ } from "./chunk-IGU3R2JD.js";
32
34
  import {
33
- CliValidationError,
34
- PermissionError,
35
35
  externalCliTokenRequestOptions,
36
36
  logger
37
- } from "./chunk-Z3Q2AEIN.js";
37
+ } from "./chunk-MTK4ZE7W.js";
38
+ import {
39
+ CliValidationError,
40
+ PermissionError
41
+ } from "./chunk-3ZQY7SLZ.js";
38
42
 
39
43
  // src/core/mcp.ts
40
44
  async function permissionDetails(resp) {
@@ -109,7 +113,7 @@ async function mcpRequest(url, method, params = {}, hostOverride) {
109
113
  ...internalCallSourceHeaders(),
110
114
  ...buildAuthHeaders(token)
111
115
  };
112
- const resp = await fetch(url, {
116
+ const resp = await sourceLoggedFetch(url, {
113
117
  method: "POST",
114
118
  headers,
115
119
  body: stringifyJsonRequest(body),
@@ -1,28 +1,32 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  resolveHost
4
- } from "./chunk-2F64AZYH.js";
4
+ } from "./chunk-Z6WSCIHM.js";
5
5
  import {
6
6
  printError
7
- } from "./chunk-3ULDJJTZ.js";
7
+ } from "./chunk-DE5XHQQ6.js";
8
8
  import {
9
- internalCallSourceHeaders
10
- } from "./chunk-Y74WTIKJ.js";
11
- import "./chunk-DWBYNGSR.js";
9
+ sourceLoggedFetch
10
+ } from "./chunk-6E6HCTP2.js";
11
+ import "./chunk-FNACCKQR.js";
12
+ import "./chunk-PUSFEC6B.js";
12
13
  import {
13
14
  SecureStoreAuthError,
14
- getCliToken
15
- } from "./chunk-HTZ2MLYA.js";
15
+ getCliToken,
16
+ internalCallSourceHeaders
17
+ } from "./chunk-UWQXGF44.js";
16
18
  import {
17
19
  safeJsonParse
18
- } from "./chunk-4PSTYEG5.js";
20
+ } from "./chunk-IGU3R2JD.js";
19
21
  import {
20
- CliApiError,
21
- CliValidationError,
22
- PermissionError,
23
22
  externalCliTokenRequestOptions,
24
23
  logger
25
- } from "./chunk-Z3Q2AEIN.js";
24
+ } from "./chunk-MTK4ZE7W.js";
25
+ import {
26
+ CliApiError,
27
+ CliValidationError,
28
+ PermissionError
29
+ } from "./chunk-3ZQY7SLZ.js";
26
30
 
27
31
  // src/commands/te-dataops/shared.ts
28
32
  import { randomBytes } from "crypto";
@@ -172,7 +176,7 @@ async function downloadDataopsApi(ctx, path, params, targetPath) {
172
176
  const host = resolveHost(ctx.host());
173
177
  const token = await getCliToken(host);
174
178
  const url = buildUrl(host, path, compactArgs(params));
175
- const resp = await fetch(url, {
179
+ const resp = await sourceLoggedFetch(url, {
176
180
  method: "GET",
177
181
  ...externalCliTokenRequestOptions(url),
178
182
  headers: {
@@ -231,7 +235,7 @@ async function dataopsRequest(ctx, method, path, params = {}, body) {
231
235
  if (method !== "GET") {
232
236
  options.body = JSON.stringify(body ?? {});
233
237
  }
234
- const resp = await fetch(url, { ...options, ...externalCliTokenRequestOptions(url) });
238
+ const resp = await sourceLoggedFetch(url, { ...options, ...externalCliTokenRequestOptions(url) });
235
239
  const text = await resp.text();
236
240
  const data = parseResponseBody(text, url, resp.status, !resp.ok);
237
241
  logger.api(method, url, resp.status, body, data);
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCapabilityCommand
4
- } from "./chunk-TMQGS4TO.js";
4
+ } from "./chunk-3PZNM5KN.js";
5
5
  import {
6
6
  registerCapabilityGatewayRoute,
7
7
  resolveGatewayDomain
@@ -9,21 +9,23 @@ import {
9
9
  import {
10
10
  printError,
11
11
  withOutputMetadata
12
- } from "./chunk-3ULDJJTZ.js";
12
+ } from "./chunk-DE5XHQQ6.js";
13
13
  import {
14
14
  CapabilityGatewayError,
15
15
  buildCapabilityGatewayUrl,
16
16
  fetchCapabilityGateway,
17
17
  requestCapabilityGateway,
18
18
  requestCapabilityGatewayWithEnvelope
19
- } from "./chunk-4XKTRCRK.js";
20
- import "./chunk-Y74WTIKJ.js";
21
- import "./chunk-DWBYNGSR.js";
22
- import "./chunk-HTZ2MLYA.js";
23
- import "./chunk-4PSTYEG5.js";
19
+ } from "./chunk-VPLRZSMY.js";
20
+ import "./chunk-6E6HCTP2.js";
21
+ import "./chunk-FNACCKQR.js";
22
+ import "./chunk-PUSFEC6B.js";
23
+ import "./chunk-UWQXGF44.js";
24
+ import "./chunk-IGU3R2JD.js";
25
+ import "./chunk-MTK4ZE7W.js";
24
26
  import {
25
27
  CliValidationError
26
- } from "./chunk-Z3Q2AEIN.js";
28
+ } from "./chunk-3ZQY7SLZ.js";
27
29
 
28
30
  // src/commands/te-engage/shared.ts
29
31
  function createEngageCapabilityCommand(cliService, config) {
@@ -1,19 +1,21 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCapabilityCommand
4
- } from "./chunk-TMQGS4TO.js";
4
+ } from "./chunk-3PZNM5KN.js";
5
5
  import {
6
6
  registerCapabilityGatewayRoute
7
7
  } from "./chunk-AWW2T2WL.js";
8
- import "./chunk-3ULDJJTZ.js";
9
- import "./chunk-4XKTRCRK.js";
10
- import "./chunk-Y74WTIKJ.js";
11
- import "./chunk-DWBYNGSR.js";
12
- import "./chunk-HTZ2MLYA.js";
13
- import "./chunk-4PSTYEG5.js";
8
+ import "./chunk-DE5XHQQ6.js";
9
+ import "./chunk-VPLRZSMY.js";
10
+ import "./chunk-6E6HCTP2.js";
11
+ import "./chunk-FNACCKQR.js";
12
+ import "./chunk-PUSFEC6B.js";
13
+ import "./chunk-UWQXGF44.js";
14
+ import "./chunk-IGU3R2JD.js";
15
+ import "./chunk-MTK4ZE7W.js";
14
16
  import {
15
17
  CliValidationError
16
- } from "./chunk-Z3Q2AEIN.js";
18
+ } from "./chunk-3ZQY7SLZ.js";
17
19
 
18
20
  // src/commands/te-experiment/capability-shared.ts
19
21
  function createExperimentCapabilityCommand(config) {
@@ -95,8 +97,8 @@ var approvalSubmit = createExperimentCapabilityCommand({
95
97
  resource: "approval",
96
98
  command: "submit",
97
99
  capabilityId: "experiment.approval.submit",
98
- description: "Submit a saved experiment draft for approval.",
99
- helpText: "Submission creates a pending review; it does not approve or start the experiment.\nRead approval get after submission to inspect the exact proposal and approval ID.",
100
+ description: "Submit a saved experiment draft using the server approval policy.",
101
+ helpText: "On updated servers, only Feature experiments with configured approvers enter review.\nExternal experiments and Feature experiments with an empty roster submit directly.\nAn exempt Feature submission stays pending for its existing manual or scheduled start.\nExisting pending reviews must be withdrawn before resubmission.\nRead experiment get for actual status and approval get for any review; older servers may use a different policy.",
100
102
  flags: [
101
103
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Positive integer project ID." },
102
104
  { name: "exp-id", type: "string", required: true, desc: "Existing experiment ID." }
@@ -201,6 +203,7 @@ var approverList = createExperimentCapabilityCommand({
201
203
  command: "list",
202
204
  capabilityId: "experiment.approver.list",
203
205
  description: "List project experiment approvers and their eligibility.",
206
+ helpText: "Requires engage:read and experiment settings view permission (experimentViewSetting).",
204
207
  flags: [
205
208
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Positive integer project ID." }
206
209
  ],
@@ -227,7 +230,7 @@ var approverAdd = createExperimentCapabilityCommand({
227
230
  command: "add",
228
231
  capabilityId: "experiment.approver.add",
229
232
  description: "Add eligible project experiment approvers.",
230
- helpText: "Adds 1 to 10 verified project member open IDs. Experiment management permission is required.\nExperiment approvers are independent of Engage task approvers.",
233
+ helpText: "Adds 1 to 10 verified project member open IDs.\nRequires engage:write and experiment settings edit permission (experimentEditSetting).\nExperiment approvers are independent of Engage task approvers.\nOn updated servers, a non-empty roster enables Feature experiment approval for subsequent submissions and delivery changes.\nExternal experiments are exempt; existing effective configurations do not require retrospective approval.",
231
234
  flags: [
232
235
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Positive integer project ID." },
233
236
  { name: "approvers", type: "json", required: true, desc: "JSON array of 1 to 10 eligible project member open IDs." }
@@ -251,7 +254,7 @@ var approverDelete = createExperimentCapabilityCommand({
251
254
  command: "delete",
252
255
  capabilityId: "experiment.approver.delete",
253
256
  description: "Remove one project experiment approver.",
254
- helpText: "Requires experiment management permission. Removing a member preserves approval history.",
257
+ helpText: "Requires engage:write and experiment settings edit permission (experimentEditSetting).\nRemoving a member preserves approval history.\nOn updated servers, removing the last approver disables approval for subsequent Feature submissions and delivery changes.\nExisting pending reviews remain pending; withdraw and resubmit them under the current policy when authorized.",
255
258
  flags: [
256
259
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Positive integer project ID." },
257
260
  { name: "approver", type: "string", required: true, desc: "Existing experiment approver open ID to remove." }
@@ -428,7 +431,7 @@ var experimentManage = createExperimentCapabilityCommand({
428
431
  command: "manage",
429
432
  capabilityId: "experiment.experiment.manage",
430
433
  description: "Update an experiment status.",
431
- helpText: "On approval-enabled servers, draft to pending submits the saved draft for approval.\nThe pending submission path also works on older servers. Use approval get only when supported.\nSubmit once; success does not mean running. Verify runtime status with experiment get.\nUsing --target-status running on an eligible experiment starts immediately. Read detail first: when\nstart_time_adjustment_required is true, an early start uses the current server time.",
434
+ helpText: "Draft to pending submits the saved draft under the server approval policy.\nOn updated servers, only Feature experiments with configured approvers enter review; exempt submissions use the existing lifecycle.\nThe pending submission path also works on older servers. Use approval get only when supported.\nSubmit once; success does not establish pending or running status. Verify status and approval with experiment get.\nUsing --target-status running on an eligible experiment starts immediately. Read detail first: when\nstart_time_adjustment_required is true, an early start uses the current server time.",
432
435
  flags: [
433
436
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
434
437
  { name: "exp-id", type: "string", required: true, desc: "Experiment ID." },
@@ -460,6 +463,19 @@ var experimentReadyCheck = createExperimentCapabilityCommand({
460
463
  });
461
464
 
462
465
  // src/commands/te-experiment/experiment/save.ts
466
+ var layerTypes = /* @__PURE__ */ new Set(["remote", "local"]);
467
+ function validateExperimentSaveRequest(req) {
468
+ const layerType = req.layerType;
469
+ if (layerType !== void 0 && (typeof layerType !== "string" || !layerTypes.has(layerType))) {
470
+ throw new Error("Flag --req.layerType must be one of: remote, local");
471
+ }
472
+ if (layerType !== void 0 && req.isExpSharing !== 0) {
473
+ throw new Error("Flag --req.layerType requires --req.isExpSharing=0");
474
+ }
475
+ if (layerType === "local" && req.bucketId === "#user_id") {
476
+ throw new Error("Flag --req.bucketId #user_id is not supported when --req.layerType=local");
477
+ }
478
+ }
463
479
  function readTimestamp(ctx, name) {
464
480
  const value = ctx.str(name);
465
481
  if (!(ctx.has?.(name) ?? value !== "")) return void 0;
@@ -470,6 +486,7 @@ function readTimestamp(ctx, name) {
470
486
  }
471
487
  function buildInput12(ctx) {
472
488
  const req = { ...readRequiredObject(ctx, "req") };
489
+ validateExperimentSaveRequest(req);
473
490
  const startTime = readTimestamp(ctx, "start-time");
474
491
  const fixedEndTime = readTimestamp(ctx, "fixed-end-time");
475
492
  if (startTime !== void 0 || fixedEndTime !== void 0) {
@@ -491,14 +508,14 @@ var experimentSave = createExperimentCapabilityCommand({
491
508
  command: "save",
492
509
  capabilityId: "experiment.experiment.save",
493
510
  description: "Create or update an experiment, including Feature start and end times.",
494
- helpText: "Timing flags override matching fields in --req. Saving a draft does not submit or start it.\nAfter readiness checks, use experiment experiment manage --target-status pending to submit once.\nThat submission path works on older and approval-enabled servers.\nDelivery changes to submitted experiments enter approval on approval-enabled servers.\nVerify runtime status with experiment get; use approval commands only when supported.\nUse timestamps with minutes 00 or 30 to align with scheduling checks.",
511
+ helpText: "Timing flags override matching fields in --req. Saving a draft does not submit or start it.\nAfter readiness checks, use experiment experiment manage --target-status pending to submit once.\nThat submission path works on older and approval-enabled servers.\nOn updated servers, delivery changes enter approval only for Feature experiments with configured approvers.\nExternal experiments and Feature experiments with an empty roster save directly; existing pending reviews still block edits.\nVerify runtime status with experiment get; use approval commands only when supported.\nUse timestamps with minutes 00 or 30 to align with scheduling checks.",
495
512
  flags: [
496
513
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
497
514
  {
498
515
  name: "req",
499
516
  type: "json",
500
517
  required: true,
501
- desc: "Native camelCase request; custom audiences use targeting.definitionRequest, never targetConfig."
518
+ desc: "Native camelCase request; custom audiences use targeting.definitionRequest, never targetConfig; optional domainId selects an exclusive draft domain; exclusive local routing uses isExpSharing=0, layerType=local, and a bucketId other than #user_id."
502
519
  },
503
520
  { name: "start-time", type: "string", desc: "Optional Feature start timestamp with timezone offset; overrides req.startTime. The server clears seconds and milliseconds." },
504
521
  { name: "fixed-end-time", type: "string", desc: "Optional Feature deadline with timezone offset; sets req.expCycle.cycleType=time and overrides fixedEndTime." }
@@ -677,7 +694,7 @@ var externalExperimentSaveSubmit = createExperimentCapabilityCommand({
677
694
  command: "save-submit",
678
695
  capabilityId: "experiment.experiment.save-submit",
679
696
  description: "Create or update and submit an external experiment without Feature or traffic-layer configuration.",
680
- helpText: "On approval-enabled servers, initial submission and delivery changes enter approval.\nOn servers exposing req.clearEndTime, omitting --end-time preserves an existing deadline; use --clear-end-time true to cancel it.\nVerify runtime status with experiment experiment get; read approval get only when supported.\nOlder servers retain their existing submission behavior; success does not mean running.",
697
+ helpText: "On updated servers, external experiments submit and save delivery changes without approval, regardless of the approver roster.\nExisting pending reviews remain pending and must be withdrawn before resubmission.\nOn servers exposing req.clearEndTime, omitting --end-time preserves an existing deadline; use --clear-end-time true to cancel it.\nVerify runtime status with experiment experiment get; read approval get only when supported.\nOlder servers retain their existing submission behavior; success does not mean running.",
681
698
  flags: [
682
699
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
683
700
  { name: "exp-id", type: "string", desc: "Existing external experiment ID; omit to create." },
@@ -1038,12 +1055,15 @@ var aggregations = /* @__PURE__ */ new Set([
1038
1055
  "distinct_count"
1039
1056
  ]);
1040
1057
  var propertyAggregations = /* @__PURE__ */ new Set(["sum", "avg", "max", "distinct_count"]);
1058
+ var countAggregations = /* @__PURE__ */ new Set(["total_count", "user_count", "active_days"]);
1059
+ var gatewayValidatedMetricTypes = /* @__PURE__ */ new Set(["formula", "retention", "funnel"]);
1041
1060
  var metricDefinitionFields = /* @__PURE__ */ new Set([
1042
1061
  "type",
1043
1062
  "event",
1044
1063
  "aggregation",
1045
1064
  "property",
1046
- "filters"
1065
+ "filters",
1066
+ "display_name"
1047
1067
  ]);
1048
1068
  function validateMetricFilters(rawFilters) {
1049
1069
  if (rawFilters === void 0) return;
@@ -1081,14 +1101,15 @@ function validateMetricSaveRequest(req) {
1081
1101
  throw new Error("Flag --req.metricDefinition must be a JSON object");
1082
1102
  }
1083
1103
  const definition = rawDefinition;
1104
+ if (typeof definition.type === "string" && gatewayValidatedMetricTypes.has(definition.type)) return;
1105
+ if (definition.type !== "event") {
1106
+ throw new Error("Flag --req.metricDefinition.type must be one of: event, formula, retention, funnel");
1107
+ }
1084
1108
  for (const field of Object.keys(definition)) {
1085
1109
  if (!metricDefinitionFields.has(field)) {
1086
1110
  throw new Error(`Flag --req.metricDefinition.${field} is not supported`);
1087
1111
  }
1088
1112
  }
1089
- if (definition.type !== "event") {
1090
- throw new Error("Flag --req.metricDefinition.type must be event");
1091
- }
1092
1113
  if (typeof definition.event !== "string" || definition.event.trim() === "") {
1093
1114
  throw new Error("Flag --req.metricDefinition.event is required");
1094
1115
  }
@@ -1100,6 +1121,16 @@ function validateMetricSaveRequest(req) {
1100
1121
  }
1101
1122
  validateMetricFilters(definition.filters);
1102
1123
  }
1124
+ function applyMetricCreateDefaults(req) {
1125
+ if (req.update !== void 0 && req.update !== false) return req;
1126
+ const definition = req.metricDefinition;
1127
+ if (definition?.type !== "event" || typeof definition.aggregation !== "string" || !countAggregations.has(definition.aggregation)) return req;
1128
+ return {
1129
+ metricPurpose: "confidence_statistics",
1130
+ format: "integer",
1131
+ ...req
1132
+ };
1133
+ }
1103
1134
  var metricSave = createExperimentCapabilityCommand({
1104
1135
  resource: "metric",
1105
1136
  command: "save",
@@ -1111,14 +1142,17 @@ var metricSave = createExperimentCapabilityCommand({
1111
1142
  name: "req",
1112
1143
  type: "json",
1113
1144
  required: true,
1114
- desc: "Native camelCase request. Property comparisons use metricDefinition.filters={relation,items:[{field,operator,values}]}. Never use metricConfig, calcType, or raw filts."
1145
+ desc: "Native camelCase request. New user_count, total_count, and active_days metrics default to metricPurpose=confidence_statistics and format=integer. metricDefinition supports event, formula, retention, and funnel. Event property comparisons use metricDefinition.filters={relation,items:[{field,operator,values}]}. Never use metricConfig, calcType, or raw filts."
1115
1146
  }
1116
1147
  ],
1117
1148
  risk: "write",
1118
1149
  validate: (ctx) => {
1119
1150
  validateMetricSaveRequest(readRequiredObject(ctx, "req"));
1120
1151
  },
1121
- buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequiredObject(ctx, "req") })
1152
+ buildInput: (ctx) => ({
1153
+ project_id: ctx.num("project-id"),
1154
+ req: applyMetricCreateDefaults(readRequiredObject(ctx, "req"))
1155
+ })
1122
1156
  });
1123
1157
 
1124
1158
  // src/commands/te-experiment/operation-log/query.ts
@@ -1195,11 +1229,15 @@ var saveValidate = createExperimentCapabilityCommand({
1195
1229
  }
1196
1230
  readRequiredObject(ctx, "req");
1197
1231
  },
1198
- buildInput: (ctx) => ({
1199
- project_id: ctx.num("project-id"),
1200
- operation_mode: ctx.str("operation-mode"),
1201
- req: readRequiredObject(ctx, "req")
1202
- })
1232
+ buildInput: (ctx) => {
1233
+ const mode = ctx.str("operation-mode");
1234
+ const req = readRequiredObject(ctx, "req");
1235
+ return {
1236
+ project_id: ctx.num("project-id"),
1237
+ operation_mode: mode,
1238
+ req: mode === "save_metric" ? applyMetricCreateDefaults(req) : req
1239
+ };
1240
+ }
1203
1241
  });
1204
1242
 
1205
1243
  // src/commands/te-experiment/report/metric-trend.ts
@@ -1294,6 +1332,148 @@ var reportSummary = createExperimentCapabilityCommand({
1294
1332
  }
1295
1333
  });
1296
1334
 
1335
+ // src/commands/te-experiment/traffic-domain/shared.ts
1336
+ function integerFlag(ctx, name, min, max = Number.MAX_SAFE_INTEGER) {
1337
+ const value = ctx.num(name);
1338
+ if (ctx.str(name).trim() === "" || !Number.isSafeInteger(value) || value < min || value > max) {
1339
+ throw new Error(`Flag --${name} must be an integer between ${min} and ${max}`);
1340
+ }
1341
+ return value;
1342
+ }
1343
+ function baseInput(ctx, bucketRequired = false) {
1344
+ const input = { project_id: integerFlag(ctx, "project-id", 1, 2147483647) };
1345
+ const bucket = ctx.str("bucket-id").trim();
1346
+ if (bucketRequired || bucket !== "") {
1347
+ if (!["#user_id", "#account_id", "#distinct_id", "#device_id"].includes(bucket)) {
1348
+ throw new Error("Flag --bucket-id must be one of #user_id, #account_id, #distinct_id, #device_id");
1349
+ }
1350
+ input.bucket_id = bucket;
1351
+ }
1352
+ return input;
1353
+ }
1354
+ function domainId(ctx) {
1355
+ const value = ctx.str("domain-id").trim();
1356
+ if (!value) throw new Error("Flag --domain-id must be a non-empty string");
1357
+ return value;
1358
+ }
1359
+ function writeInput(ctx, create) {
1360
+ const input = baseInput(ctx, create);
1361
+ if (!create) input.domain_id = domainId(ctx);
1362
+ const name = ctx.str("name").trim();
1363
+ const description = ctx.str("description");
1364
+ if (!name || name.length > 128) throw new Error("Flag --name must contain 1 to 128 characters");
1365
+ if (description.length > 200) throw new Error("Flag --description must contain at most 200 characters");
1366
+ input.domain_name = name;
1367
+ input.domain_desc = description;
1368
+ const quotaChange = create || ["allocation-bps", "allocations", "expected-version"].some(
1369
+ (flag) => ctx.has?.(flag) ?? ctx.str(flag) !== ""
1370
+ );
1371
+ if (!quotaChange) return input;
1372
+ input.allocation_bps = integerFlag(ctx, "allocation-bps", 1, 1e4);
1373
+ input.expected_version = integerFlag(ctx, "expected-version", 0);
1374
+ const raw = ctx.json("allocations");
1375
+ const allocations = raw === void 0 && create ? [] : raw;
1376
+ if (!Array.isArray(allocations)) throw new Error("Flag --allocations must be a JSON array of all other domains");
1377
+ const ids = /* @__PURE__ */ new Set();
1378
+ let total = input.allocation_bps;
1379
+ input.allocations = allocations.map((item, index) => {
1380
+ if (!item || typeof item !== "object" || Array.isArray(item) || Object.keys(item).some((key) => !["domain_id", "allocation_bps"].includes(key)) || typeof item.domain_id !== "string" || !item.domain_id.trim() || !Number.isInteger(item.allocation_bps) || item.allocation_bps < 1 || item.allocation_bps > 1e4) {
1381
+ throw new Error(`Flag --allocations[${index}] must contain only domain_id and integer allocation_bps (1 to 10000)`);
1382
+ }
1383
+ const id = item.domain_id.trim();
1384
+ if (ids.has(id) || id === input.domain_id) {
1385
+ throw new Error("Flag --allocations must not repeat a domain or include the domain being updated");
1386
+ }
1387
+ ids.add(id);
1388
+ total += item.allocation_bps;
1389
+ return { domain_id: id, allocation_bps: item.allocation_bps };
1390
+ });
1391
+ if (total > 1e4) throw new Error("Total domain allocation must not exceed 10000 basis points");
1392
+ return input;
1393
+ }
1394
+
1395
+ // src/commands/te-experiment/traffic-domain/list.ts
1396
+ var trafficDomainList = createExperimentCapabilityCommand({
1397
+ resource: "traffic-domain",
1398
+ command: "list",
1399
+ capabilityId: "experiment.traffic_domain.list",
1400
+ description: "List traffic domains grouped into bucket Spaces with quotas, versions, and permissions.",
1401
+ flags: [
1402
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
1403
+ { name: "bucket-id", type: "string", desc: "Bucket subject: #user_id, #account_id, #distinct_id, or #device_id." }
1404
+ ],
1405
+ risk: "read",
1406
+ validate: (ctx) => {
1407
+ baseInput(ctx);
1408
+ },
1409
+ buildInput: baseInput
1410
+ });
1411
+
1412
+ // src/commands/te-experiment/traffic-domain/create.ts
1413
+ var trafficDomainCreate = createExperimentCapabilityCommand({
1414
+ resource: "traffic-domain",
1415
+ command: "create",
1416
+ capabilityId: "experiment.traffic_domain.create",
1417
+ description: "Create a traffic domain with complete Space quotas.",
1418
+ flags: [
1419
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
1420
+ { name: "bucket-id", type: "string", required: true, desc: "Bucket subject: #user_id, #account_id, #distinct_id, or #device_id." },
1421
+ { name: "name", type: "string", required: true, desc: "Domain name, 1 to 128 characters; unique within the bucket subject." },
1422
+ { name: "description", type: "string", desc: "Domain description, at most 200 characters; omitted value clears the description." },
1423
+ { name: "allocation-bps", type: "number", required: true, desc: "Domain quota in integer basis points (1 to 10000; 10000 = 100%)." },
1424
+ { name: "expected-version", type: "number", required: true, desc: "Current Space allocation_version from list; use 0 only when no domains exist." },
1425
+ { name: "allocations", type: "json", desc: 'Complete other-domain quotas: [{"domain_id":"d1","allocation_bps":3000}]; omit only for the first domain.' }
1426
+ ],
1427
+ risk: "write",
1428
+ validate: (ctx) => {
1429
+ writeInput(ctx, true);
1430
+ },
1431
+ buildInput: (ctx) => writeInput(ctx, true)
1432
+ });
1433
+
1434
+ // src/commands/te-experiment/traffic-domain/update.ts
1435
+ var trafficDomainUpdate = createExperimentCapabilityCommand({
1436
+ resource: "traffic-domain",
1437
+ command: "update",
1438
+ capabilityId: "experiment.traffic_domain.update",
1439
+ description: "Update traffic domain metadata and optionally replace complete Space quotas.",
1440
+ flags: [
1441
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
1442
+ { name: "domain-id", type: "string", required: true, desc: "Existing traffic domain ID in this project." },
1443
+ { name: "bucket-id", type: "string", desc: "Bucket subject: #user_id, #account_id, #distinct_id, or #device_id." },
1444
+ { name: "name", type: "string", required: true, desc: "Domain name, 1 to 128 characters; unique within the bucket subject." },
1445
+ { name: "description", type: "string", desc: "Domain description, at most 200 characters; omitted value clears the description." },
1446
+ { name: "allocation-bps", type: "number", desc: "Domain quota in integer basis points (1 to 10000; 10000 = 100%)." },
1447
+ { name: "expected-version", type: "number", desc: "Current Space allocation_version from list; use 0 only when no domains exist." },
1448
+ { name: "allocations", type: "json", desc: 'Complete other-domain quotas: [{"domain_id":"d1","allocation_bps":3000}]; required with --allocation-bps and --expected-version; exclude this domain.' }
1449
+ ],
1450
+ risk: "write",
1451
+ validate: (ctx) => {
1452
+ writeInput(ctx, false);
1453
+ },
1454
+ buildInput: (ctx) => writeInput(ctx, false)
1455
+ });
1456
+
1457
+ // src/commands/te-experiment/traffic-domain/delete.ts
1458
+ var trafficDomainDelete = createExperimentCapabilityCommand({
1459
+ resource: "traffic-domain",
1460
+ command: "delete",
1461
+ capabilityId: "experiment.traffic_domain.delete",
1462
+ description: "Delete a traffic domain and unbind its layers while retaining layers and experiments.",
1463
+ flags: [
1464
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
1465
+ { name: "domain-id", type: "string", required: true, desc: "Existing traffic domain ID in this project." },
1466
+ { name: "expected-version", type: "number", required: true, desc: "Current Space allocation_version from list; use 0 only when no domains exist." }
1467
+ ],
1468
+ risk: "high-risk-write",
1469
+ validate: (ctx) => {
1470
+ baseInput(ctx);
1471
+ domainId(ctx);
1472
+ integerFlag(ctx, "expected-version", 0);
1473
+ },
1474
+ buildInput: (ctx) => ({ ...baseInput(ctx), domain_id: domainId(ctx), expected_version: integerFlag(ctx, "expected-version", 0) })
1475
+ });
1476
+
1297
1477
  // src/commands/te-experiment/traffic-layer/batch-delete.ts
1298
1478
  var trafficLayerBatchDelete = createExperimentCapabilityCommand({
1299
1479
  resource: "traffic-layer",
@@ -1347,7 +1527,7 @@ var trafficLayerSave = createExperimentCapabilityCommand({
1347
1527
  description: "Create or update a traffic layer.",
1348
1528
  flags: [
1349
1529
  { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
1350
- { name: "req", type: "json", required: true, desc: "Native camelCase traffic layer save request object." }
1530
+ { name: "req", type: "json", required: true, desc: "Native camelCase traffic layer save request; optional domainId binds a domain, empty string clears membership on eligible layers." }
1351
1531
  ],
1352
1532
  risk: "write",
1353
1533
  validate: (ctx) => {
@@ -1381,6 +1561,10 @@ var commands = [
1381
1561
  operationLogQuery,
1382
1562
  saveBuildGuide,
1383
1563
  saveValidate,
1564
+ trafficDomainList,
1565
+ trafficDomainCreate,
1566
+ trafficDomainUpdate,
1567
+ trafficDomainDelete,
1384
1568
  trafficLayerSave,
1385
1569
  trafficLayerGet,
1386
1570
  trafficLayerList,
@@ -1449,6 +1633,10 @@ export {
1449
1633
  reportSummary,
1450
1634
  saveBuildGuide,
1451
1635
  saveValidate,
1636
+ trafficDomainCreate,
1637
+ trafficDomainDelete,
1638
+ trafficDomainList,
1639
+ trafficDomainUpdate,
1452
1640
  trafficLayerBatchDelete,
1453
1641
  trafficLayerGet,
1454
1642
  trafficLayerList,