@thinkingai/ae-cli 6.1.12 → 6.1.14

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 (154) hide show
  1. package/README.md +0 -2
  2. package/README.zh.md +0 -2
  3. package/dist/{auth-NN55553T.js → auth-GBMV6TEJ.js} +2 -2
  4. package/dist/{auth-GDV3H5I4.js → auth-NDSXE54J.js} +4 -4
  5. package/dist/{capability-DRLGDVS4.js → capability-TAMDRZYV.js} +18 -8
  6. package/dist/{capability-P6GK3AQH.js → capability-U7TDEEEG.js} +18 -8
  7. package/dist/{chunk-GJJA4CQZ.js → chunk-3FY3RJ26.js} +0 -4
  8. package/dist/{chunk-GS2P7LFD.js → chunk-5XUSIK27.js} +2 -2
  9. package/dist/{chunk-7KQWSBSL.js → chunk-753BUTNZ.js} +3 -3
  10. package/dist/{chunk-VTXHDCBW.js → chunk-AFXA7BRK.js} +2 -2
  11. package/dist/chunk-IBH3LDAH.js +556 -0
  12. package/dist/{chunk-RBNKI5ZW.js → chunk-JUW4AJXN.js} +2 -2
  13. package/dist/{chunk-TS6BUGUY.js → chunk-QATA32VR.js} +3 -3
  14. package/dist/{chunk-Z3OXWCIA.js → chunk-S5NTSDBS.js} +2 -2
  15. package/dist/chunk-UIHQJK5E.js +556 -0
  16. package/dist/{chunk-VKD5WQKN.js → chunk-VLWOLBGZ.js} +142 -24
  17. package/dist/{chunk-YTG6Q75E.js → chunk-WZRX4KOH.js} +25 -3
  18. package/dist/{chunk-YV52FB5G.js → chunk-ZQKDZXDO.js} +1 -1
  19. package/dist/{cli-token-GL5MS5FK.js → cli-token-4UPER74P.js} +3 -3
  20. package/dist/{chunk-6A2FUCIS.js → client-L2YDMHQ6.js} +5 -6
  21. package/dist/{config-4VZNLBKF.js → config-OL2LWGBV.js} +4 -33
  22. package/dist/index.js +25 -38
  23. package/dist/{memory-RWJW4XFO.js → memory-MUP7PPL7.js} +4 -4
  24. package/dist/{memory-VO2ZJCRT.js → memory-U4O5PMXH.js} +4 -4
  25. package/dist/{metadata-ZRN2GHPN.js → metadata-5MIMNIMT.js} +33 -20
  26. package/dist/{metadata-YGTHR2XJ.js → metadata-LERKDJN6.js} +33 -20
  27. package/dist/{model-CLUIK3K5.js → model-JTUEO5M4.js} +2 -2
  28. package/dist/{sync-3REDHGY6.js → sync-MOSFNBVR.js} +5 -5
  29. package/dist/{te-agent-XNPELAKX.js → te-agent-IFKZDHZI.js} +25 -18
  30. package/dist/{te-analysis-GJI5FZUL.js → te-analysis-FCHRTNIY.js} +1267 -492
  31. package/dist/{te-analysis-N2BRDJZ5.js → te-analysis-QG7UKGDA.js} +1267 -492
  32. package/dist/{te-community-SQXKE5OO.js → te-community-HNKVTERD.js} +207 -12
  33. package/dist/{te-community-TYSNU3NQ.js → te-community-IWE5B7W6.js} +208 -12
  34. package/dist/{te-dataops-OWIADNSM.js → te-dataops-KQPYNAE3.js} +262 -145
  35. package/dist/{te-dataops-5TM7WZDI.js → te-dataops-KXCEB4CS.js} +262 -145
  36. package/dist/{te-engage-L72HWRGO.js → te-engage-D6EG3NOR.js} +951 -17
  37. package/dist/{te-engage-QWM4GFS7.js → te-engage-ZSMIJLUW.js} +951 -17
  38. package/dist/{te-experiment-2T2HEZML.js → te-experiment-K5US7RMG.js} +6 -6
  39. package/dist/{te-experiment-PVEY7AEZ.js → te-experiment-WA7TFMEL.js} +6 -6
  40. package/dist/{te-kb-VRMEY3D4.js → te-kb-OIH3T6CS.js} +4 -4
  41. package/dist/{te-system-XGS5EQIQ.js → te-system-AZ3URMUO.js} +515 -11
  42. package/dist/{te-team-BZRDV2CM.js → te-team-GZPU6UWA.js} +5 -5
  43. package/dist/{update-HEDXGOJH.js → update-TOBFXF2V.js} +4 -4
  44. package/package.json +5 -5
  45. package/skills/ae-agent/SKILL.md +3 -3
  46. package/skills/ae-agent/references/list-skill-references.md +4 -4
  47. package/skills/ae-agent/references/read-skill-reference.md +10 -7
  48. package/skills/ae-agent/references/upload-skill-reference.md +11 -9
  49. package/skills/ae-analysis/SKILL.md +15 -12
  50. package/skills/ae-analysis/metadata_resolution.md +150 -0
  51. package/skills/ae-analysis/references/adhoc_export.md +17 -2
  52. package/skills/ae-analysis/references/adhoc_run.md +12 -8
  53. package/skills/ae-analysis/references/ai_models.md +35 -6
  54. package/skills/ae-analysis/references/alert_list.md +2 -3
  55. package/skills/ae-analysis/references/analysis_data_retrieval.md +104 -16
  56. package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -4
  57. package/skills/ae-analysis/references/analysis_gateway_assets.md +17 -15
  58. package/skills/ae-analysis/references/artifact_download.md +4 -3
  59. package/skills/ae-analysis/references/asset_abnormal_list.md +5 -3
  60. package/skills/ae-analysis/references/asset_authentication_list.md +5 -3
  61. package/skills/ae-analysis/references/asset_search.md +5 -3
  62. package/skills/ae-analysis/references/bi_panel_list.md +2 -2
  63. package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
  64. package/skills/ae-analysis/references/bi_panel_page_data_run.md +4 -4
  65. package/skills/ae-analysis/references/catalog_export.md +28 -0
  66. package/skills/ae-analysis/references/catalog_list.md +44 -0
  67. package/skills/ae-analysis/references/command_index.md +78 -69
  68. package/skills/ae-analysis/references/dashboard_list.md +2 -2
  69. package/skills/ae-analysis/references/dashboard_report_data_run.md +11 -4
  70. package/skills/ae-analysis/references/datatable_version_list.md +5 -3
  71. package/skills/ae-analysis/references/drilldown_entities_run.md +4 -4
  72. package/skills/ae-analysis/references/drilldown_events_run.md +2 -2
  73. package/skills/ae-analysis/references/drilldown_user_events_export.md +1 -1
  74. package/skills/ae-analysis/references/drilldown_user_events_run.md +2 -2
  75. package/skills/ae-analysis/references/entity_detail_run.md +4 -4
  76. package/skills/ae-analysis/references/entity_id_import_options.md +1 -1
  77. package/skills/ae-analysis/references/event_detail_run.md +4 -4
  78. package/skills/ae-analysis/references/event_export.md +21 -0
  79. package/skills/ae-analysis/references/event_list.md +7 -6
  80. package/skills/ae-analysis/references/exchange_rule_list.md +5 -3
  81. package/skills/ae-analysis/references/favorite_add.md +2 -2
  82. package/skills/ae-analysis/references/favorite_remove.md +2 -2
  83. package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -2
  84. package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +2 -2
  85. package/skills/ae-analysis/references/history_tag_data_run.md +2 -2
  86. package/skills/ae-analysis/references/metric_create.md +7 -8
  87. package/skills/ae-analysis/references/metric_export.md +21 -0
  88. package/skills/ae-analysis/references/metric_list.md +8 -7
  89. package/skills/ae-analysis/references/project_space_list.md +2 -2
  90. package/skills/ae-analysis/references/property_export.md +21 -0
  91. package/skills/ae-analysis/references/property_list.md +9 -8
  92. package/skills/ae-analysis/references/public_link_list.md +2 -2
  93. package/skills/ae-analysis/references/query_context_get.md +20 -0
  94. package/skills/ae-analysis/references/query_create_result_cluster.md +1 -1
  95. package/skills/ae-analysis/references/report_change_log_list.md +1 -1
  96. package/skills/ae-analysis/references/report_create.md +3 -3
  97. package/skills/ae-analysis/references/report_data_run.md +8 -8
  98. package/skills/ae-analysis/references/report_list.md +3 -3
  99. package/skills/ae-analysis/references/report_list_export.md +2 -2
  100. package/skills/ae-analysis/references/report_update.md +3 -3
  101. package/skills/ae-analysis/references/report_version_rollback.md +1 -1
  102. package/skills/ae-analysis/references/rule_list.md +6 -4
  103. package/skills/ae-analysis/references/run_inspect.md +8 -5
  104. package/skills/ae-analysis/references/run_wait.md +37 -0
  105. package/skills/ae-analysis/references/sql_table_list.md +3 -2
  106. package/skills/ae-analysis/references/user_cluster_export.md +13 -0
  107. package/skills/ae-analysis/references/user_cluster_list.md +6 -2
  108. package/skills/ae-analysis/references/user_cluster_member_export.md +5 -3
  109. package/skills/ae-analysis/references/user_cluster_member_list.md +4 -4
  110. package/skills/ae-analysis/references/user_cluster_update.md +4 -2
  111. package/skills/ae-analysis/references/user_tag_export.md +13 -0
  112. package/skills/ae-analysis/references/user_tag_list.md +6 -2
  113. package/skills/ae-analysis/references/user_tag_member_export.md +5 -3
  114. package/skills/ae-analysis/references/user_tag_member_list.md +4 -4
  115. package/skills/ae-analysis/references/user_tag_update.md +4 -2
  116. package/skills/ae-analysis/references/virtual_property_create.md +2 -2
  117. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +3 -3
  118. package/skills/ae-community/SKILL.md +2 -2
  119. package/skills/ae-dataops/SKILL.md +4 -3
  120. package/skills/ae-dataops/references/dataops-flow-create.md +47 -3
  121. package/skills/ae-engage/SKILL.md +55 -7
  122. package/skills/ae-engage/references/build-task-save-guide.md +12 -0
  123. package/skills/ae-engage/references/cancel-query-run.md +31 -0
  124. package/skills/ae-engage/references/config-item-analysis-report.md +14 -1
  125. package/skills/ae-engage/references/config-item-strategy-comparison.md +11 -1
  126. package/skills/ae-engage/references/config-item-trigger-report.md +15 -1
  127. package/skills/ae-engage/references/flow-metric-detail-report.md +134 -0
  128. package/skills/ae-engage/references/flow-metric-update.md +77 -0
  129. package/skills/ae-engage/references/flow-metric-user.md +119 -0
  130. package/skills/ae-engage/references/flow-node-metric-user.md +123 -0
  131. package/skills/ae-engage/references/flow-node-user.md +123 -0
  132. package/skills/ae-engage/references/push-record-query.md +32 -1
  133. package/skills/ae-engage/references/save-task.md +9 -0
  134. package/skills/ae-engage/references/task-data-detail.md +9 -2
  135. package/skills/ae-engage/references/task-indicator-user.md +104 -0
  136. package/skills/ae-engage/references/task-metric-detail.md +9 -2
  137. package/skills/ae-engage/references/task-submit-approval.md +3 -0
  138. package/skills/ae-engage/references/task-user-detail-export.md +31 -0
  139. package/skills/ae-experiment/references/save_experiment.md +4 -0
  140. package/skills/ae-experiment-design/SKILL.md +1 -1
  141. package/skills/ae-experiment-design/references/platform-operations.md +1 -1
  142. package/skills/ae-experiment-insight/references/platform-operations.md +1 -1
  143. package/skills/ae-metadata/SKILL.md +2 -1
  144. package/skills/ae-metadata/references/metadata_data_table_download.md +10 -2
  145. package/skills/ae-metadata/references/metadata_data_table_list.md +5 -2
  146. package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +1 -1
  147. package/skills/ae-system/SKILL.md +66 -3
  148. package/dist/chunk-DT6Y3TD7.js +0 -232
  149. package/dist/chunk-MVDZ7DBQ.js +0 -231
  150. package/dist/chunk-NBPKWKRA.js +0 -51
  151. package/dist/client-DAIPF7XN.js +0 -23
  152. package/dist/raw-52B4UKO4.js +0 -71
  153. package/dist/te-meta-53BVXPFI.js +0 -95
  154. package/dist/te-meta-TOCBPBXI.js +0 -95
@@ -1,16 +1,24 @@
1
1
  import {
2
2
  createCapabilityCommand
3
- } from "./chunk-7KQWSBSL.js";
3
+ } from "./chunk-753BUTNZ.js";
4
4
  import {
5
- registerCapabilityGatewayRoute
5
+ registerCapabilityGatewayRoute,
6
+ resolveGatewayDomain
6
7
  } from "./chunk-PTE56QPL.js";
7
8
  import {
8
- printError
9
- } from "./chunk-YTG6Q75E.js";
10
- import "./chunk-RBNKI5ZW.js";
11
- import "./chunk-Z3OXWCIA.js";
12
- import "./chunk-YV52FB5G.js";
13
- import "./chunk-GJJA4CQZ.js";
9
+ printError,
10
+ withOutputMetadata
11
+ } from "./chunk-WZRX4KOH.js";
12
+ import {
13
+ CapabilityGatewayError,
14
+ buildCapabilityGatewayUrl,
15
+ fetchCapabilityGateway,
16
+ requestCapabilityGateway,
17
+ requestCapabilityGatewayWithEnvelope
18
+ } from "./chunk-5XUSIK27.js";
19
+ import "./chunk-S5NTSDBS.js";
20
+ import "./chunk-ZQKDZXDO.js";
21
+ import "./chunk-3FY3RJ26.js";
14
22
  import {
15
23
  CliValidationError
16
24
  } from "./chunk-AXDXJTPC.js";
@@ -42,6 +50,9 @@ function createEngageActivityCapabilityCommand(config) {
42
50
  function createEngageWorkbenchCapabilityCommand(config) {
43
51
  return createEngageCapabilityCommand("engage-workbench", config);
44
52
  }
53
+ function createEngageQueryCapabilityCommand(config) {
54
+ return createEngageCapabilityCommand("engage-query", config);
55
+ }
45
56
 
46
57
  // src/commands/te-engage/engage-flow/flow/update-remark.ts
47
58
  var flowUpdateRemark = createEngageFlowCapabilityCommand({
@@ -78,6 +89,9 @@ function readOptionalString(ctx, name) {
78
89
  function readOptionalNumber(ctx, name) {
79
90
  return hasFlag(ctx, name) ? ctx.num(name) : void 0;
80
91
  }
92
+ function readOptionalBoolean(ctx, name) {
93
+ return hasFlag(ctx, name) ? ctx.bool(name) : void 0;
94
+ }
81
95
  function readOptionalJsonArray(ctx, name) {
82
96
  const value = ctx.json(name);
83
97
  if (value === void 0) return void 0;
@@ -256,6 +270,7 @@ var METRIC_AGGREGATIONS = /* @__PURE__ */ new Set([
256
270
  "variance",
257
271
  "stddev"
258
272
  ]);
273
+ var TASK_TRIGGER_PERIOD_SYMBOLS = /* @__PURE__ */ new Set(["TS01", "TS02", "TS03", "TS04"]);
259
274
  function validateSemanticAudienceDefinition(value, path) {
260
275
  const definition = object(value, path);
261
276
  rejectUnknown(definition, ["type", "conditions", "include_filter", "exclude_filter"], path);
@@ -307,6 +322,18 @@ function validateSemanticMetricDefinition(value, path) {
307
322
  function validateEmbeddedSemanticDefinitions(value, path) {
308
323
  walk(value, path);
309
324
  }
325
+ function validateTaskTriggerPeriodDefinition(value, path) {
326
+ const request = object(value, path);
327
+ if (!isObject(request.triggerConfig)) return;
328
+ const triggerConfig = request.triggerConfig;
329
+ if (triggerConfig.triggerDefinition === void 0 || triggerConfig.triggerDefinition === null) return;
330
+ const definition = object(triggerConfig.triggerDefinition, `${path}.triggerConfig.triggerDefinition`);
331
+ const rules = array(definition.rules, `${path}.triggerConfig.triggerDefinition.rules`, 1);
332
+ const primaryRule = object(rules[0], `${path}.triggerConfig.triggerDefinition.rules[0]`);
333
+ const symbolPath = `${path}.triggerConfig.triggerDefinition.rules[0].periodTimeSymbol`;
334
+ required(primaryRule.periodTimeSymbol, symbolPath);
335
+ enumValue(primaryRule.periodTimeSymbol, TASK_TRIGGER_PERIOD_SYMBOLS, symbolPath);
336
+ }
310
337
  function walk(value, path) {
311
338
  if (Array.isArray(value)) {
312
339
  value.forEach((item, index) => walk(item, `${path}[${index}]`));
@@ -603,6 +630,30 @@ var flowSave = createEngageFlowCapabilityCommand({
603
630
  buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequest(ctx) })
604
631
  });
605
632
 
633
+ // src/commands/te-engage/engage-flow/metric/update.ts
634
+ var flowMetricUpdate = createEngageFlowCapabilityCommand({
635
+ resource: "metric",
636
+ command: "update",
637
+ capabilityId: "engage-flow.metric.update",
638
+ description: "Update metric settings for a flow canvas.",
639
+ flags: [
640
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
641
+ { name: "flow-id", type: "string", required: true, desc: "Logical flow ID." },
642
+ {
643
+ name: "metric-map",
644
+ type: "json",
645
+ required: true,
646
+ desc: "Metric configuration map keyed by metric group."
647
+ }
648
+ ],
649
+ risk: "write",
650
+ buildInput: (ctx) => ({
651
+ project_id: ctx.num("project-id"),
652
+ flow_id: ctx.str("flow-id"),
653
+ metric_map: ctx.json("metric-map")
654
+ })
655
+ });
656
+
606
657
  // src/commands/te-engage/engage-flow/node-config/schema.ts
607
658
  var nodeConfigSchema = createEngageFlowCapabilityCommand({
608
659
  resource: "node-config",
@@ -638,6 +689,208 @@ var nodeConfigValidate = createEngageFlowCapabilityCommand({
638
689
  })
639
690
  });
640
691
 
692
+ // src/commands/te-engage/engage-flow/report/shared.ts
693
+ var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
694
+ var flowReportCommonFlags = [
695
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
696
+ { name: "flow-id", type: "string", required: false, desc: "Logical flow ID." },
697
+ { name: "flow-uuid", type: "string", required: false, desc: "Flow version UUID." },
698
+ { name: "request-id", type: "string", required: false, desc: "Query correlation ID. Generated when omitted." },
699
+ { name: "push-language-code", type: "string", required: false, desc: "Push language code." },
700
+ { name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset." }
701
+ ];
702
+ var flowMetricDetailFlags = [
703
+ ...flowReportCommonFlags,
704
+ { name: "node-uuid", type: "string", required: true, desc: "Flow node UUID." },
705
+ { name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
706
+ { name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
707
+ { name: "branch-id", type: "string", required: false, desc: "Optional branch ID." },
708
+ { name: "indicator-name", type: "string", required: false, desc: "Optional indicator name." },
709
+ { name: "indicators-uuid", type: "string", required: false, desc: "Optional AB metric indicator UUID." },
710
+ { name: "data-dim-type", type: "string", required: false, desc: "Data dimension type, usually uv or pv." },
711
+ { name: "report-mode", type: "string", required: false, desc: "Metric report mode: node or ab. Defaults to node." }
712
+ ];
713
+ var flowUserDetailFlags = [
714
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
715
+ { name: "flow-id", type: "string", required: false, desc: "Logical flow ID." },
716
+ { name: "flow-uuid", type: "string", required: false, desc: "Flow version UUID." },
717
+ { name: "request-id", type: "string", required: false, desc: "Query correlation ID. Generated when omitted." },
718
+ { name: "cluster-def", type: "string", required: false, desc: "Legacy cluster definition JSON. Prefer the report metric fields below." },
719
+ { name: "indicator-name", type: "string", required: false, desc: "Metric key returned by the corresponding flow report." },
720
+ { name: "data-view-type", type: "string", required: false, desc: "Data view type. Defaults to 2 (date view)." },
721
+ { name: "is-summary", type: "boolean", required: false, desc: "Whether to query a summary segment. Defaults to false." },
722
+ { name: "start-time", type: "string", required: false, desc: "Segment start date in yyyy-MM-dd format." },
723
+ { name: "end-time", type: "string", required: false, desc: "Segment end date in yyyy-MM-dd format." },
724
+ { name: "push-language-code", type: "string", required: false, desc: "Optional push language code from the report context." },
725
+ { name: "user-time-zone", type: "string", required: false, desc: "Optional user timezone." },
726
+ { name: "show-time-zone", type: "string", required: false, desc: "Optional report display timezone." },
727
+ { name: "node-uuid", type: "string", required: false, desc: "Flow node UUID." },
728
+ { name: "branch-id", type: "string", required: false, desc: "Optional branch ID." }
729
+ ];
730
+ var flowNodeUserDetailFlags = flowUserDetailFlags.map((flag) => flag.name === "node-uuid" ? { ...flag, required: true } : flag);
731
+ var inlineLimitFlag = {
732
+ name: "limit",
733
+ type: "number",
734
+ required: false,
735
+ desc: "Maximum number of rows returned inline. Defaults to backend value."
736
+ };
737
+ var timeoutSecondsFlag = {
738
+ name: "timeout-seconds",
739
+ type: "number",
740
+ required: false,
741
+ desc: "Query or export timeout in seconds. Defaults to backend policy."
742
+ };
743
+ var exportFormatFlags = [
744
+ {
745
+ name: "artifact-format",
746
+ type: "string",
747
+ required: false,
748
+ desc: "Export artifact format. Flow report and user detail exports support csv or jsonl. Defaults to jsonl."
749
+ }
750
+ ];
751
+ function validateFlowReportInput(ctx) {
752
+ if (!ctx.str("flow-id") && !ctx.str("flow-uuid")) {
753
+ printError("validation", "At least one of --flow-id or --flow-uuid is required");
754
+ process.exit(1);
755
+ }
756
+ validateDate(ctx.str("start-time"), "--start-time");
757
+ validateDate(ctx.str("end-time"), "--end-time");
758
+ }
759
+ function validateFlowUserDetailInput(ctx) {
760
+ if (!ctx.str("flow-id") && !ctx.str("flow-uuid")) {
761
+ printError("validation", "At least one of --flow-id or --flow-uuid is required");
762
+ process.exit(1);
763
+ }
764
+ if (!ctx.str("cluster-def") && (!ctx.str("indicator-name") || !ctx.str("start-time") || !ctx.str("end-time"))) {
765
+ printError("validation", "Pass either --cluster-def or --indicator-name with --start-time and --end-time");
766
+ process.exit(1);
767
+ }
768
+ validateDate(ctx.str("start-time"), "--start-time");
769
+ validateDate(ctx.str("end-time"), "--end-time");
770
+ }
771
+ function buildFlowReportInput(ctx) {
772
+ return {
773
+ project_id: ctx.num("project-id"),
774
+ flow_id: ctx.str("flow-id") || void 0,
775
+ flow_uuid: ctx.str("flow-uuid") || void 0,
776
+ request_id: ctx.str("request-id") || void 0,
777
+ push_language_code: ctx.str("push-language-code") || void 0,
778
+ show_time_zone: ctx.str("show-time-zone") || void 0,
779
+ node_uuid: ctx.str("node-uuid") || void 0,
780
+ branch_id: ctx.str("branch-id") || void 0,
781
+ indicator_name: ctx.str("indicator-name") || void 0,
782
+ indicators_uuid: ctx.str("indicators-uuid") || void 0,
783
+ data_dim_type: ctx.str("data-dim-type") || void 0,
784
+ start_time: ctx.str("start-time") || void 0,
785
+ end_time: ctx.str("end-time") || void 0,
786
+ report_mode: ctx.str("report-mode") || void 0,
787
+ cluster_def: ctx.str("cluster-def") || void 0,
788
+ limit: ctx.optionalNum("limit"),
789
+ format: ctx.str("artifact-format") || void 0,
790
+ timeout_seconds: ctx.optionalNum("timeout-seconds")
791
+ };
792
+ }
793
+ function buildFlowUserDetailInput(ctx) {
794
+ return {
795
+ project_id: ctx.num("project-id"),
796
+ flow_id: ctx.str("flow-id") || void 0,
797
+ flow_uuid: ctx.str("flow-uuid") || void 0,
798
+ request_id: ctx.str("request-id") || void 0,
799
+ node_uuid: ctx.str("node-uuid") || void 0,
800
+ branch_id: ctx.str("branch-id") || void 0,
801
+ cluster_def: ctx.str("cluster-def") || void 0,
802
+ indicator_name: ctx.str("indicator-name") || void 0,
803
+ data_view_type: ctx.str("data-view-type") || void 0,
804
+ is_summary: readOptionalBoolean(ctx, "is-summary"),
805
+ start_time: ctx.str("start-time") || void 0,
806
+ end_time: ctx.str("end-time") || void 0,
807
+ push_language_code: ctx.str("push-language-code") || void 0,
808
+ user_time_zone: ctx.str("user-time-zone") || void 0,
809
+ show_time_zone: ctx.str("show-time-zone") || void 0,
810
+ limit: ctx.optionalNum("limit"),
811
+ format: ctx.str("artifact-format") || void 0,
812
+ timeout_seconds: ctx.optionalNum("timeout-seconds")
813
+ };
814
+ }
815
+ function validateDate(value, flag) {
816
+ if (value && !ISO_DATE.test(value)) {
817
+ printError("validation", `${flag} must be in yyyy-MM-dd format`);
818
+ process.exit(1);
819
+ }
820
+ }
821
+
822
+ // src/commands/te-engage/engage-flow/metric-user/export.ts
823
+ var metricUserExport = createEngageFlowCapabilityCommand({
824
+ resource: "metric-user",
825
+ command: "export",
826
+ capabilityId: "engage-flow.metric-user.export",
827
+ description: "Export users behind a flow metric segment.",
828
+ flags: [...flowUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
829
+ risk: "read",
830
+ validate: validateFlowUserDetailInput,
831
+ buildInput: buildFlowUserDetailInput
832
+ });
833
+
834
+ // src/commands/te-engage/engage-flow/metric-user/run.ts
835
+ var metricUserRun = createEngageFlowCapabilityCommand({
836
+ resource: "metric-user",
837
+ command: "run",
838
+ capabilityId: "engage-flow.metric-user.run",
839
+ description: "Query users behind a flow metric segment inline.",
840
+ flags: [...flowUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
841
+ risk: "read",
842
+ validate: validateFlowUserDetailInput,
843
+ buildInput: buildFlowUserDetailInput
844
+ });
845
+
846
+ // src/commands/te-engage/engage-flow/node-metric-user/export.ts
847
+ var nodeMetricUserExport = createEngageFlowCapabilityCommand({
848
+ resource: "node-metric-user",
849
+ command: "export",
850
+ capabilityId: "engage-flow.node-metric-user.export",
851
+ description: "Export users behind a flow node metric segment.",
852
+ flags: [...flowNodeUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
853
+ risk: "read",
854
+ validate: validateFlowUserDetailInput,
855
+ buildInput: buildFlowUserDetailInput
856
+ });
857
+
858
+ // src/commands/te-engage/engage-flow/node-metric-user/run.ts
859
+ var nodeMetricUserRun = createEngageFlowCapabilityCommand({
860
+ resource: "node-metric-user",
861
+ command: "run",
862
+ capabilityId: "engage-flow.node-metric-user.run",
863
+ description: "Query users behind a flow node metric segment inline.",
864
+ flags: [...flowNodeUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
865
+ risk: "read",
866
+ validate: validateFlowUserDetailInput,
867
+ buildInput: buildFlowUserDetailInput
868
+ });
869
+
870
+ // src/commands/te-engage/engage-flow/node-user/export.ts
871
+ var nodeUserExport = createEngageFlowCapabilityCommand({
872
+ resource: "node-user",
873
+ command: "export",
874
+ capabilityId: "engage-flow.node-user.export",
875
+ description: "Export users behind a flow node segment.",
876
+ flags: [...flowNodeUserDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
877
+ risk: "read",
878
+ validate: validateFlowUserDetailInput,
879
+ buildInput: buildFlowUserDetailInput
880
+ });
881
+
882
+ // src/commands/te-engage/engage-flow/node-user/run.ts
883
+ var nodeUserRun = createEngageFlowCapabilityCommand({
884
+ resource: "node-user",
885
+ command: "run",
886
+ capabilityId: "engage-flow.node-user.run",
887
+ description: "Query users behind a flow node segment inline.",
888
+ flags: [...flowNodeUserDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
889
+ risk: "read",
890
+ validate: validateFlowUserDetailInput,
891
+ buildInput: buildFlowUserDetailInput
892
+ });
893
+
641
894
  // src/commands/te-engage/engage-flow/operation-log/query.ts
642
895
  var operationLogQuery = createEngageFlowCapabilityCommand({
643
896
  resource: "operation-log",
@@ -652,6 +905,30 @@ var operationLogQuery = createEngageFlowCapabilityCommand({
652
905
  buildInput: (ctx) => ({ project_id: ctx.num("project-id"), flow_id: ctx.str("flow-id") })
653
906
  });
654
907
 
908
+ // src/commands/te-engage/engage-flow/report/metric-detail-export.ts
909
+ var flowReportMetricDetailExport = createEngageFlowCapabilityCommand({
910
+ resource: "report metric-detail",
911
+ command: "export",
912
+ capabilityId: "engage-flow.report.metric-detail.export",
913
+ description: "Export a flow node metric detail report artifact.",
914
+ flags: [...flowMetricDetailFlags, ...exportFormatFlags, timeoutSecondsFlag],
915
+ risk: "read",
916
+ validate: validateFlowReportInput,
917
+ buildInput: buildFlowReportInput
918
+ });
919
+
920
+ // src/commands/te-engage/engage-flow/report/metric-detail-run.ts
921
+ var flowReportMetricDetailRun = createEngageFlowCapabilityCommand({
922
+ resource: "report metric-detail",
923
+ command: "run",
924
+ capabilityId: "engage-flow.report.metric-detail.run",
925
+ description: "Query a flow node metric detail report inline.",
926
+ flags: [...flowMetricDetailFlags, inlineLimitFlag, timeoutSecondsFlag],
927
+ risk: "read",
928
+ validate: validateFlowReportInput,
929
+ buildInput: buildFlowReportInput
930
+ });
931
+
655
932
  // src/commands/te-engage/engage-flow/version/list.ts
656
933
  var versionList = createEngageFlowCapabilityCommand({
657
934
  resource: "version",
@@ -673,9 +950,18 @@ var commands = [
673
950
  flowSave,
674
951
  nodeConfigSchema,
675
952
  nodeConfigValidate,
953
+ flowMetricUpdate,
676
954
  flowModifyBaseInfo,
677
955
  flowManage,
678
956
  flowDelete,
957
+ flowReportMetricDetailRun,
958
+ flowReportMetricDetailExport,
959
+ metricUserRun,
960
+ metricUserExport,
961
+ nodeUserRun,
962
+ nodeUserExport,
963
+ nodeMetricUserRun,
964
+ nodeMetricUserExport,
679
965
  operationLogQuery,
680
966
  // testRun,
681
967
  versionList,
@@ -3444,6 +3730,121 @@ var channelRefStats = createEngageTaskCapabilityCommand({
3444
3730
  })
3445
3731
  });
3446
3732
 
3733
+ // src/commands/te-engage/engage-task/task-data-shared.ts
3734
+ var ISO_DATE2 = /^\d{4}-\d{2}-\d{2}$/;
3735
+ var taskMetricDetailFlags = [
3736
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
3737
+ { name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
3738
+ { name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
3739
+ { name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
3740
+ { name: "metric-id-list", type: "json", required: false, desc: "Optional metric setting ID JSON array." },
3741
+ { name: "group-type", type: "number", required: false, desc: "Optional metric grouping mode: 1, 2, 3, or 4." },
3742
+ { name: "push-language-code", type: "string", required: false, desc: "Optional push content language code." },
3743
+ { name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset, such as 8.0 or -5.0." },
3744
+ { name: "request-id", type: "string", required: false, desc: "Caller-provided report request ID." }
3745
+ ];
3746
+ var taskDataDetailFlags = [
3747
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
3748
+ { name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
3749
+ { name: "detail-type", type: "string", required: true, desc: "Detail mode: time, instance, or instance_daily." },
3750
+ { name: "start-time", type: "string", required: true, desc: "Start date in yyyy-MM-dd format." },
3751
+ { name: "end-time", type: "string", required: true, desc: "End date in yyyy-MM-dd format." },
3752
+ { name: "task-instance-id", type: "string", required: false, desc: "Task instance ID. Required when detail-type is instance_daily." },
3753
+ { name: "data-dim-type", type: "string", required: false, desc: "Data dimension type: uv or pv." },
3754
+ { name: "retention-type", type: "string", required: false, desc: "Optional retention mode: retention or lost." },
3755
+ { name: "data-view-type", type: "number", required: false, desc: "Triggered-task detail view type: 2 or 3." },
3756
+ { name: "push-language-code", type: "string", required: false, desc: "Optional push content language code." },
3757
+ { name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset, such as 8.0 or -5.0." },
3758
+ { name: "request-id", type: "string", required: false, desc: "Caller-provided report request ID." }
3759
+ ];
3760
+ function validateTaskMetricDetailInput(ctx) {
3761
+ validateDateRange(ctx);
3762
+ const metricIdList = ctx.json("metric-id-list");
3763
+ if (metricIdList != null && !Array.isArray(metricIdList)) {
3764
+ printError("validation", "--metric-id-list must be a JSON array");
3765
+ process.exit(1);
3766
+ }
3767
+ }
3768
+ function validateTaskDataDetailInput(ctx) {
3769
+ validateDateRange(ctx);
3770
+ const detailType = ctx.str("detail-type");
3771
+ if (!["time", "instance", "instance_daily"].includes(detailType)) {
3772
+ printError("validation", "--detail-type must be time, instance, or instance_daily");
3773
+ process.exit(1);
3774
+ }
3775
+ if (detailType === "instance_daily" && !ctx.str("task-instance-id")) {
3776
+ printError("validation", "--task-instance-id is required when --detail-type is instance_daily");
3777
+ process.exit(1);
3778
+ }
3779
+ }
3780
+ function buildTaskMetricDetailInput(ctx) {
3781
+ return {
3782
+ project_id: ctx.num("project-id"),
3783
+ task_id: ctx.str("task-id"),
3784
+ start_time: ctx.str("start-time"),
3785
+ end_time: ctx.str("end-time"),
3786
+ metric_id_list: ctx.json("metric-id-list") || void 0,
3787
+ group_type: ctx.optionalNum("group-type"),
3788
+ push_language_code: ctx.str("push-language-code") || void 0,
3789
+ show_time_zone: ctx.str("show-time-zone") || void 0,
3790
+ request_id: ctx.str("request-id") || void 0
3791
+ };
3792
+ }
3793
+ function buildTaskDataDetailInput(ctx) {
3794
+ return {
3795
+ project_id: ctx.num("project-id"),
3796
+ task_id: ctx.str("task-id"),
3797
+ detail_type: ctx.str("detail-type"),
3798
+ task_instance_id: ctx.str("task-instance-id") || void 0,
3799
+ start_time: ctx.str("start-time"),
3800
+ end_time: ctx.str("end-time"),
3801
+ data_dim_type: ctx.str("data-dim-type") || void 0,
3802
+ retention_type: ctx.str("retention-type") || void 0,
3803
+ data_view_type: ctx.optionalNum("data-view-type"),
3804
+ push_language_code: ctx.str("push-language-code") || void 0,
3805
+ show_time_zone: ctx.str("show-time-zone") || void 0,
3806
+ request_id: ctx.str("request-id") || void 0
3807
+ };
3808
+ }
3809
+ function validateDateRange(ctx) {
3810
+ validateDate2(ctx.str("start-time"), "--start-time");
3811
+ validateDate2(ctx.str("end-time"), "--end-time");
3812
+ if (ctx.str("start-time") > ctx.str("end-time")) {
3813
+ printError("validation", "--start-time must be earlier than or equal to --end-time");
3814
+ process.exit(1);
3815
+ }
3816
+ }
3817
+ function validateDate2(value, flag) {
3818
+ if (value && !ISO_DATE2.test(value)) {
3819
+ printError("validation", `${flag} must be in yyyy-MM-dd format`);
3820
+ process.exit(1);
3821
+ }
3822
+ }
3823
+
3824
+ // src/commands/te-engage/engage-task/data-detail/query.ts
3825
+ var dataDetailQuery = createEngageTaskCapabilityCommand({
3826
+ resource: "data-detail",
3827
+ command: "query",
3828
+ capabilityId: "engage-task.task-data.detail",
3829
+ description: "Query task data-detail report data.",
3830
+ flags: taskDataDetailFlags,
3831
+ risk: "read",
3832
+ validate: validateTaskDataDetailInput,
3833
+ buildInput: buildTaskDataDetailInput
3834
+ });
3835
+
3836
+ // src/commands/te-engage/engage-task/effect/query.ts
3837
+ var taskEffectQuery = createEngageTaskCapabilityCommand({
3838
+ resource: "effect",
3839
+ command: "query",
3840
+ capabilityId: "engage-task.task-data.metric-detail",
3841
+ description: "Query task metric-detail report data.",
3842
+ flags: taskMetricDetailFlags,
3843
+ risk: "read",
3844
+ validate: validateTaskMetricDetailInput,
3845
+ buildInput: buildTaskMetricDetailInput
3846
+ });
3847
+
3447
3848
  // src/commands/te-engage/engage-task/group/create.ts
3448
3849
  var groupCreate = createEngageTaskCapabilityCommand({
3449
3850
  resource: "group",
@@ -3517,6 +3918,319 @@ var groupUpdate = createEngageTaskCapabilityCommand({
3517
3918
  })
3518
3919
  });
3519
3920
 
3921
+ // src/commands/te-engage/engage-task/indicator-user/shared.ts
3922
+ var ISO_DATE3 = /^\d{4}-\d{2}-\d{2}$/;
3923
+ var DECIMAL_TIME_ZONE = /^[+-]?\d{1,2}(?:\.\d+)?$/;
3924
+ var taskIndicatorUserIndicators = [
3925
+ "original_trigger",
3926
+ "plan",
3927
+ "actual_trigger",
3928
+ "trigger_success",
3929
+ "view",
3930
+ "click",
3931
+ "main",
3932
+ "secondary",
3933
+ "metric",
3934
+ "click_activate",
3935
+ "main_activate",
3936
+ "secondary_activate"
3937
+ ];
3938
+ var indicatorSet = new Set(taskIndicatorUserIndicators);
3939
+ var groupBySet = /* @__PURE__ */ new Set(["batch", "date", "trigger", "experiment"]);
3940
+ var retentionTypeSet = /* @__PURE__ */ new Set(["retention", "lost"]);
3941
+ var sourceSet = /* @__PURE__ */ new Set(["task", "experiment", "metric"]);
3942
+ var pushLanguageCodeSet = /* @__PURE__ */ new Set([
3943
+ "all",
3944
+ "default",
3945
+ "ar",
3946
+ "az",
3947
+ "bs",
3948
+ "ca",
3949
+ "zh-Hans",
3950
+ "zh-Hant",
3951
+ "hr",
3952
+ "cs",
3953
+ "da",
3954
+ "nl",
3955
+ "en",
3956
+ "et",
3957
+ "fi",
3958
+ "fr",
3959
+ "ka",
3960
+ "bg",
3961
+ "de",
3962
+ "el",
3963
+ "hi",
3964
+ "he",
3965
+ "hu",
3966
+ "id",
3967
+ "it",
3968
+ "ja",
3969
+ "ko",
3970
+ "lv",
3971
+ "lt",
3972
+ "ms",
3973
+ "nb",
3974
+ "fa",
3975
+ "pl",
3976
+ "pt",
3977
+ "pa",
3978
+ "ro",
3979
+ "ru",
3980
+ "sr",
3981
+ "sk",
3982
+ "es",
3983
+ "sv",
3984
+ "th",
3985
+ "tr",
3986
+ "uk",
3987
+ "vi"
3988
+ ]);
3989
+ var lostUnsupportedIndicatorSet = /* @__PURE__ */ new Set([
3990
+ "original_trigger",
3991
+ "metric",
3992
+ "click_activate",
3993
+ "main_activate",
3994
+ "secondary_activate"
3995
+ ]);
3996
+ var taskIndicatorUserFlags = [
3997
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
3998
+ { name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
3999
+ {
4000
+ name: "indicator",
4001
+ type: "string",
4002
+ required: true,
4003
+ desc: `Indicator segment. Values: ${taskIndicatorUserIndicators.join(", ")}.`
4004
+ },
4005
+ { name: "start-time", type: "string", required: true, desc: "Segment start date in yyyy-MM-dd format." },
4006
+ { name: "end-time", type: "string", required: true, desc: "Segment end date in yyyy-MM-dd format." },
4007
+ {
4008
+ name: "group-by",
4009
+ type: "string",
4010
+ required: false,
4011
+ desc: "Grouping context: batch, date, trigger, or experiment. Activate indicators require and default to experiment; others default to date."
4012
+ },
4013
+ { name: "is-summary", type: "boolean", required: false, desc: "Whether to query a summary segment. Defaults to true." },
4014
+ {
4015
+ name: "retention-type",
4016
+ type: "string",
4017
+ required: false,
4018
+ desc: "Segment mode: retention or lost. Defaults to retention."
4019
+ },
4020
+ {
4021
+ name: "source",
4022
+ type: "string",
4023
+ required: false,
4024
+ desc: "Report source: task, experiment, or metric. Defaults to metric for metric indicators, experiment for activate indicators or experiment grouping, and task otherwise."
4025
+ },
4026
+ { name: "secondary-index", type: "number", required: false, desc: "Secondary indicator index from 1 to 10." },
4027
+ { name: "metric-id", type: "string", required: false, desc: "Metric setting ID; required when --indicator=metric." },
4028
+ { name: "task-instance-id", type: "string", required: false, desc: "Optional non-triggered task instance ID." },
4029
+ { name: "exp-group-id", type: "string", required: false, desc: "Optional experiment group ID." },
4030
+ { name: "push-language-code", type: "string", required: false, desc: "Push language filter, such as all, default, en, zh-Hans, or zh-Hant." },
4031
+ { name: "user-time-zone", type: "string", required: false, desc: "User timezone filter: all or a decimal offset available on the task." },
4032
+ { name: "show-time-zone", type: "string", required: false, desc: "Display timezone offset from -12 to 14. Omitted or 99 uses the backend default." }
4033
+ ];
4034
+ var taskIndicatorUserRequestFlag = {
4035
+ name: "request-id",
4036
+ type: "string",
4037
+ required: false,
4038
+ desc: "Query correlation ID. Generated when omitted."
4039
+ };
4040
+ var taskIndicatorUserLimitFlag = {
4041
+ name: "limit",
4042
+ type: "number",
4043
+ required: false,
4044
+ desc: "Maximum number of rows returned inline. Defaults to backend policy."
4045
+ };
4046
+ var taskIndicatorUserTimeoutFlag = {
4047
+ name: "timeout-seconds",
4048
+ type: "number",
4049
+ required: false,
4050
+ desc: "Query or export timeout in seconds. Defaults to backend policy."
4051
+ };
4052
+ var taskIndicatorUserFormatFlag = {
4053
+ name: "artifact-format",
4054
+ type: "string",
4055
+ required: false,
4056
+ desc: "Export artifact format: csv or jsonl. Defaults to jsonl."
4057
+ };
4058
+ function validateTaskIndicatorUserInput(ctx) {
4059
+ const indicator = ctx.str("indicator");
4060
+ if (!indicatorSet.has(indicator)) {
4061
+ fail2(`--indicator must be one of: ${taskIndicatorUserIndicators.join(", ")}`);
4062
+ }
4063
+ validateDate3(ctx.str("start-time"), "--start-time");
4064
+ validateDate3(ctx.str("end-time"), "--end-time");
4065
+ if (ctx.str("start-time") > ctx.str("end-time")) {
4066
+ fail2("--start-time must be earlier than or equal to --end-time");
4067
+ }
4068
+ validateOptionalSet(ctx.str("group-by"), "--group-by", groupBySet);
4069
+ validateOptionalSet(ctx.str("retention-type"), "--retention-type", retentionTypeSet);
4070
+ validateOptionalSet(ctx.str("source"), "--source", sourceSet);
4071
+ validateOptionalSet(ctx.str("push-language-code"), "--push-language-code", pushLanguageCodeSet);
4072
+ validateShowTimeZone(ctx.str("show-time-zone"));
4073
+ validateUserTimeZone(ctx.str("user-time-zone"));
4074
+ const secondary = indicator === "secondary" || indicator === "secondary_activate";
4075
+ const secondaryIndex = ctx.optionalNum("secondary-index");
4076
+ if (secondary && (secondaryIndex === void 0 || !Number.isInteger(secondaryIndex) || secondaryIndex < 1 || secondaryIndex > 10)) {
4077
+ fail2("--secondary-index must be an integer from 1 to 10 for secondary indicators");
4078
+ }
4079
+ if (!secondary && secondaryIndex !== void 0) {
4080
+ fail2("--secondary-index is only accepted for secondary indicators");
4081
+ }
4082
+ if (indicator === "metric" && !ctx.str("metric-id")) {
4083
+ fail2("--metric-id is required when --indicator=metric");
4084
+ }
4085
+ if (indicator !== "metric" && ctx.str("metric-id")) {
4086
+ fail2("--metric-id is only accepted when --indicator=metric");
4087
+ }
4088
+ const source = ctx.str("source");
4089
+ const metric = indicator === "metric";
4090
+ if (metric && source && source !== "metric") {
4091
+ fail2("--source must be metric when --indicator=metric");
4092
+ }
4093
+ if (!metric && source === "metric") {
4094
+ fail2("--source=metric requires --indicator=metric");
4095
+ }
4096
+ const activate = indicator === "click_activate" || indicator === "main_activate" || indicator === "secondary_activate";
4097
+ const groupBy = ctx.str("group-by");
4098
+ if (activate && source && source !== "experiment") {
4099
+ fail2("--source must be experiment for activate indicators");
4100
+ }
4101
+ if (activate && groupBy && groupBy !== "experiment") {
4102
+ fail2("--group-by must be experiment for activate indicators");
4103
+ }
4104
+ if (ctx.str("retention-type") === "lost" && lostUnsupportedIndicatorSet.has(indicator)) {
4105
+ fail2(`--retention-type=lost is not supported for --indicator=${indicator}`);
4106
+ }
4107
+ const isSummary = readOptionalBoolean(ctx, "is-summary");
4108
+ const effectiveGroupBy = groupBy || (activate ? "experiment" : "date");
4109
+ if (indicator === "plan" && ctx.str("exp-group-id")) {
4110
+ fail2("--exp-group-id is not supported when --indicator=plan");
4111
+ }
4112
+ if (indicator === "plan" && effectiveGroupBy === "experiment" && isSummary === false) {
4113
+ fail2("--is-summary=false is not supported for plan indicators grouped by experiment");
4114
+ }
4115
+ if (effectiveGroupBy === "experiment" && !metric && source && source !== "experiment") {
4116
+ fail2("--source must be experiment when --group-by=experiment");
4117
+ }
4118
+ if (effectiveGroupBy === "batch" && isSummary === false && !ctx.str("task-instance-id")) {
4119
+ fail2("--task-instance-id is required for a non-summary batch segment");
4120
+ }
4121
+ if (effectiveGroupBy === "experiment" && isSummary === false && !ctx.str("exp-group-id")) {
4122
+ fail2("--exp-group-id is required for a non-summary experiment segment");
4123
+ }
4124
+ }
4125
+ function buildTaskIndicatorUserInput(ctx) {
4126
+ return {
4127
+ project_id: ctx.num("project-id"),
4128
+ task_id: ctx.str("task-id"),
4129
+ indicator: ctx.str("indicator"),
4130
+ start_time: ctx.str("start-time"),
4131
+ end_time: ctx.str("end-time"),
4132
+ group_by: ctx.str("group-by") || void 0,
4133
+ is_summary: readOptionalBoolean(ctx, "is-summary"),
4134
+ retention_type: ctx.str("retention-type") || void 0,
4135
+ source: ctx.str("source") || void 0,
4136
+ secondary_index: ctx.optionalNum("secondary-index"),
4137
+ metric_id: ctx.str("metric-id") || void 0,
4138
+ task_instance_id: ctx.str("task-instance-id") || void 0,
4139
+ exp_group_id: ctx.str("exp-group-id") || void 0,
4140
+ push_language_code: ctx.str("push-language-code") || void 0,
4141
+ user_time_zone: ctx.str("user-time-zone") || void 0,
4142
+ show_time_zone: ctx.str("show-time-zone") || void 0,
4143
+ request_id: ctx.str("request-id") || void 0,
4144
+ limit: ctx.optionalNum("limit"),
4145
+ format: ctx.str("artifact-format") || void 0,
4146
+ timeout_seconds: ctx.optionalNum("timeout-seconds")
4147
+ };
4148
+ }
4149
+ function validateDate3(value, flag) {
4150
+ if (!ISO_DATE3.test(value)) {
4151
+ fail2(`${flag} must be in yyyy-MM-dd format`);
4152
+ }
4153
+ }
4154
+ function validateOptionalSet(value, flag, allowed) {
4155
+ if (value && !allowed.has(value)) {
4156
+ fail2(`${flag} must be one of: ${[...allowed].join(", ")}`);
4157
+ }
4158
+ }
4159
+ function validateShowTimeZone(value) {
4160
+ if (!value) {
4161
+ return;
4162
+ }
4163
+ if (!DECIMAL_TIME_ZONE.test(value)) {
4164
+ fail2("--show-time-zone must use decimal hour-offset format like 8.0 or -5.0");
4165
+ }
4166
+ const offset = Number(value);
4167
+ if ((offset < -12 || offset > 14) && offset !== 99) {
4168
+ fail2("--show-time-zone must be between -12 and 14, or 99");
4169
+ }
4170
+ }
4171
+ function validateUserTimeZone(value) {
4172
+ if (!value || value === "all") {
4173
+ return;
4174
+ }
4175
+ if (!DECIMAL_TIME_ZONE.test(value)) {
4176
+ fail2("--user-time-zone must be all or a decimal hour offset like 8.0 or -5.0");
4177
+ }
4178
+ const offset = Number(value);
4179
+ if (offset < -12 || offset > 14) {
4180
+ fail2("--user-time-zone must be between -12 and 14, or all");
4181
+ }
4182
+ }
4183
+ function fail2(message) {
4184
+ printError("validation", message);
4185
+ process.exit(1);
4186
+ }
4187
+
4188
+ // src/commands/te-engage/engage-task/indicator-user/export.ts
4189
+ var taskIndicatorUserExport = createEngageTaskCapabilityCommand({
4190
+ resource: "indicator-user",
4191
+ command: "export",
4192
+ capabilityId: "engage-task.indicator-user.export",
4193
+ description: "Export users behind an engagement-task indicator segment.",
4194
+ flags: [
4195
+ ...taskIndicatorUserFlags,
4196
+ taskIndicatorUserRequestFlag,
4197
+ taskIndicatorUserFormatFlag,
4198
+ taskIndicatorUserTimeoutFlag
4199
+ ],
4200
+ risk: "read",
4201
+ validate: validateTaskIndicatorUserInput,
4202
+ buildInput: buildTaskIndicatorUserInput
4203
+ });
4204
+
4205
+ // src/commands/te-engage/engage-task/indicator-user/run.ts
4206
+ var taskIndicatorUserRun = createEngageTaskCapabilityCommand({
4207
+ resource: "indicator-user",
4208
+ command: "run",
4209
+ capabilityId: "engage-task.indicator-user.run",
4210
+ description: "Query users behind an engagement-task indicator segment inline.",
4211
+ flags: [
4212
+ ...taskIndicatorUserFlags,
4213
+ taskIndicatorUserRequestFlag,
4214
+ taskIndicatorUserLimitFlag,
4215
+ taskIndicatorUserTimeoutFlag
4216
+ ],
4217
+ risk: "read",
4218
+ validate: validateTaskIndicatorUserInput,
4219
+ buildInput: buildTaskIndicatorUserInput
4220
+ });
4221
+
4222
+ // src/commands/te-engage/engage-task/indicator-user/sql.ts
4223
+ var taskIndicatorUserSql = createEngageTaskCapabilityCommand({
4224
+ resource: "indicator-user",
4225
+ command: "sql",
4226
+ capabilityId: "engage-task.indicator-user.sql",
4227
+ description: "Build validated user-detail SQL for an engagement-task indicator segment.",
4228
+ flags: taskIndicatorUserFlags,
4229
+ risk: "read",
4230
+ validate: validateTaskIndicatorUserInput,
4231
+ buildInput: buildTaskIndicatorUserInput
4232
+ });
4233
+
3520
4234
  // src/commands/te-engage/engage-task/metric/list.ts
3521
4235
  var metricList = createEngageTaskCapabilityCommand({
3522
4236
  resource: "metric",
@@ -3573,7 +4287,7 @@ var operationLogQuery2 = createEngageTaskCapabilityCommand({
3573
4287
  });
3574
4288
 
3575
4289
  // src/commands/te-engage/engage-task/push-record/query.ts
3576
- var ISO_DATE = /^\d{4}-\d{2}-\d{2}$/;
4290
+ var ISO_DATE4 = /^\d{4}-\d{2}-\d{2}$/;
3577
4291
  var pushRecordQuery = createEngageTaskCapabilityCommand({
3578
4292
  resource: "push-record",
3579
4293
  command: "query",
@@ -3601,11 +4315,11 @@ var pushRecordQuery = createEngageTaskCapabilityCommand({
3601
4315
  validate: (ctx) => {
3602
4316
  const startDate = ctx.str("start-date");
3603
4317
  const endDate = ctx.str("end-date");
3604
- if (startDate && !ISO_DATE.test(startDate)) {
4318
+ if (startDate && !ISO_DATE4.test(startDate)) {
3605
4319
  printError("validation", "--start-date must be in yyyy-MM-dd format");
3606
4320
  process.exit(1);
3607
4321
  }
3608
- if (endDate && !ISO_DATE.test(endDate)) {
4322
+ if (endDate && !ISO_DATE4.test(endDate)) {
3609
4323
  printError("validation", "--end-date must be in yyyy-MM-dd format");
3610
4324
  process.exit(1);
3611
4325
  }
@@ -3887,12 +4601,14 @@ var taskSave = createEngageTaskCapabilityCommand({
3887
4601
  name: "req",
3888
4602
  type: "json",
3889
4603
  required: true,
3890
- desc: "Task save JSON; custom audiences use targetConfig.definitionRequest."
4604
+ desc: "Task save JSON; triggered tasks require periodTimeSymbol on the primary trigger rule."
3891
4605
  }
3892
4606
  ],
3893
4607
  risk: "write",
3894
4608
  validate: (ctx) => {
3895
- validateEmbeddedSemanticDefinitions(readRequiredJsonObject(ctx, "req"), "--req");
4609
+ const req = readRequiredJsonObject(ctx, "req");
4610
+ validateEmbeddedSemanticDefinitions(req, "--req");
4611
+ validateTaskTriggerPeriodDefinition(req, "--req");
3896
4612
  },
3897
4613
  buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequiredJsonObject(ctx, "req") })
3898
4614
  });
@@ -3914,6 +4630,74 @@ var taskStats = createEngageTaskCapabilityCommand({
3914
4630
  buildInput: (ctx) => ({ project_id: ctx.num("project-id"), req: readRequiredJsonObject(ctx, "req") })
3915
4631
  });
3916
4632
 
4633
+ // src/commands/te-engage/engage-task/user-detail/export.ts
4634
+ var taskUserDetailStatuses = [
4635
+ "frequency_control",
4636
+ "fatigue_control",
4637
+ "fail",
4638
+ "success",
4639
+ "sample",
4640
+ "exp_skip_push",
4641
+ "deduplicate",
4642
+ "push_plan",
4643
+ "push_actual"
4644
+ ];
4645
+ var statusSet = new Set(taskUserDetailStatuses);
4646
+ var taskUserDetailExport = createEngageTaskCapabilityCommand({
4647
+ resource: "user-detail",
4648
+ command: "export",
4649
+ capabilityId: "engage-task.user-detail.export",
4650
+ description: "Export user details for one non-triggered task instance and user status.",
4651
+ flags: [
4652
+ { name: "project-id", type: "number", required: true, alias: "p", desc: "Numeric project ID." },
4653
+ { name: "task-id", type: "string", required: true, desc: "Engagement task ID." },
4654
+ { name: "task-instance-id", type: "string", required: true, desc: "Non-triggered task instance ID." },
4655
+ {
4656
+ name: "task-exec-detail-id",
4657
+ type: "string",
4658
+ required: false,
4659
+ desc: "Optional execution detail ID used to narrow the task instance export."
4660
+ },
4661
+ {
4662
+ name: "user-status",
4663
+ type: "string",
4664
+ required: false,
4665
+ desc: `English user status. Defaults to fail. Values: ${taskUserDetailStatuses.join(", ")}.`
4666
+ },
4667
+ { name: "request-id", type: "string", required: false, desc: "Export correlation ID. Generated when omitted." },
4668
+ {
4669
+ name: "artifact-format",
4670
+ type: "string",
4671
+ required: false,
4672
+ desc: "Export artifact format: csv or jsonl. Defaults to jsonl."
4673
+ },
4674
+ {
4675
+ name: "timeout-seconds",
4676
+ type: "number",
4677
+ required: false,
4678
+ desc: "Export timeout in seconds. Defaults to backend policy and cannot exceed 21600."
4679
+ }
4680
+ ],
4681
+ risk: "read",
4682
+ validate: (ctx) => {
4683
+ const status = ctx.str("user-status") || "fail";
4684
+ if (!statusSet.has(status)) {
4685
+ printError("validation", `--user-status must be one of: ${taskUserDetailStatuses.join(", ")}`);
4686
+ process.exit(1);
4687
+ }
4688
+ },
4689
+ buildInput: (ctx) => ({
4690
+ project_id: ctx.num("project-id"),
4691
+ task_id: ctx.str("task-id"),
4692
+ task_instance_id: ctx.str("task-instance-id"),
4693
+ task_exec_detail_id: ctx.str("task-exec-detail-id") || void 0,
4694
+ user_status: ctx.str("user-status") || "fail",
4695
+ request_id: ctx.str("request-id") || void 0,
4696
+ format: ctx.str("artifact-format") || void 0,
4697
+ timeout_seconds: ctx.optionalNum("timeout-seconds")
4698
+ })
4699
+ });
4700
+
3917
4701
  // src/commands/te-engage/engage-task/index.ts
3918
4702
  var commands6 = [
3919
4703
  taskList,
@@ -3922,11 +4706,16 @@ var commands6 = [
3922
4706
  taskBuildSaveGuide,
3923
4707
  taskSave,
3924
4708
  taskManage,
4709
+ taskEffectQuery,
4710
+ dataDetailQuery,
3925
4711
  channelRefStats,
3926
4712
  groupCreate,
3927
4713
  groupDelete,
3928
4714
  groupList,
3929
4715
  groupUpdate,
4716
+ taskIndicatorUserSql,
4717
+ taskIndicatorUserRun,
4718
+ taskIndicatorUserExport,
3930
4719
  metricList,
3931
4720
  metricUpdate,
3932
4721
  operationLogQuery2,
@@ -3938,10 +4727,153 @@ var commands6 = [
3938
4727
  segmentListSetVisibility,
3939
4728
  taskDelete,
3940
4729
  taskModifyGroup,
3941
- taskSubmitApproval
4730
+ taskSubmitApproval,
4731
+ taskUserDetailExport
3942
4732
  ];
3943
4733
  var engage_task_default = commands6;
3944
4734
 
4735
+ // src/commands/te-engage/engage-query/artifact/download.ts
4736
+ import { mkdir, writeFile } from "fs/promises";
4737
+ import { dirname, resolve } from "path";
4738
+ var artifactDownload = {
4739
+ service: "engage-query",
4740
+ resource: "artifact",
4741
+ command: "download",
4742
+ description: "Download a generated engagement query artifact.",
4743
+ flags: [
4744
+ { name: "run-id", type: "string", required: true, desc: "Query or export run ID." },
4745
+ { name: "artifact-id", type: "string", required: true, desc: "Artifact ID returned by an export capability." },
4746
+ { name: "output", type: "string", required: true, desc: "Local output file path. Use a file path, not a directory." }
4747
+ ],
4748
+ risk: "read",
4749
+ dryRun: (ctx) => ({
4750
+ method: "GET",
4751
+ url: buildCapabilityGatewayUrl(
4752
+ ctx.host(),
4753
+ resolveGatewayDomain("engage-query", "engage"),
4754
+ artifactPath(ctx.str("run-id"), ctx.str("artifact-id"))
4755
+ ),
4756
+ output_path: resolve(ctx.str("output"))
4757
+ }),
4758
+ execute: async (ctx) => {
4759
+ const runId = ctx.str("run-id");
4760
+ const artifactId = ctx.str("artifact-id");
4761
+ const outputPath = resolve(ctx.str("output"));
4762
+ await ensureArtifactReady(ctx.host(), runId, artifactId);
4763
+ const resp = await fetchArtifact(ctx.host(), runId, artifactId);
4764
+ const bytes = Buffer.from(await resp.arrayBuffer());
4765
+ await mkdir(dirname(outputPath), { recursive: true });
4766
+ await writeFile(outputPath, bytes);
4767
+ return {
4768
+ run_id: runId,
4769
+ artifact_id: artifactId,
4770
+ output_path: outputPath,
4771
+ bytes: bytes.length,
4772
+ content_type: resp.headers.get("content-type") ?? void 0,
4773
+ content_encoding: resp.headers.get("content-encoding") ?? void 0,
4774
+ content_disposition: resp.headers.get("content-disposition") ?? void 0
4775
+ };
4776
+ }
4777
+ };
4778
+ function artifactPath(runId, artifactId) {
4779
+ return `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`;
4780
+ }
4781
+ async function ensureArtifactReady(host, runId, artifactId) {
4782
+ const descriptor = await inspectRun(host, runId);
4783
+ const descriptorArtifactId = descriptor.artifact_id ?? descriptor.artifactId;
4784
+ const artifactStatus = descriptor.artifact_status ?? descriptor.artifactStatus;
4785
+ const errorMessage = descriptor.error_message ?? descriptor.errorMessage;
4786
+ if (descriptorArtifactId && descriptorArtifactId !== artifactId) {
4787
+ throw new CapabilityGatewayError(
4788
+ `artifact_id ${artifactId} does not belong to run_id ${runId}`,
4789
+ "ARTIFACT_RUN_MISMATCH",
4790
+ 400,
4791
+ "Use the run_id and artifact_id pair from the same export response."
4792
+ );
4793
+ }
4794
+ const ready = descriptor.status === "SUCCEEDED" && (artifactStatus === "READY" || artifactStatus === "COMPLETED");
4795
+ if (ready) {
4796
+ return;
4797
+ }
4798
+ const reason = errorMessage ? `; error=${errorMessage}` : "";
4799
+ throw new CapabilityGatewayError(
4800
+ `Artifact is not ready: run_status=${descriptor.status ?? "UNKNOWN"}, artifact_status=${artifactStatus ?? "UNKNOWN"}${reason}`,
4801
+ "ARTIFACT_NOT_READY",
4802
+ 409,
4803
+ "Run ae-cli engage-query run inspect --run-id <run_id> until status=SUCCEEDED and artifact_status=READY or COMPLETED, then retry artifact download. If status is FAILED or CANCELED, do not retry download."
4804
+ );
4805
+ }
4806
+ async function inspectRun(host, runId) {
4807
+ return await requestCapabilityGateway(
4808
+ host,
4809
+ resolveGatewayDomain("engage-query", "engage"),
4810
+ `runs/${encodeURIComponent(runId)}`
4811
+ );
4812
+ }
4813
+ async function fetchArtifact(host, runId, artifactId) {
4814
+ return fetchCapabilityGateway(
4815
+ host,
4816
+ resolveGatewayDomain("engage-query", "engage"),
4817
+ artifactPath(runId, artifactId),
4818
+ "GET",
4819
+ void 0,
4820
+ "application/octet-stream"
4821
+ );
4822
+ }
4823
+
4824
+ // src/commands/te-engage/engage-query/query/cancel.ts
4825
+ var queryCancel = createEngageQueryCapabilityCommand({
4826
+ resource: "query",
4827
+ command: "cancel",
4828
+ capabilityId: "engage-query.query.cancel",
4829
+ description: "Cancel one running engagement query or export run.",
4830
+ flags: [
4831
+ { name: "run-id", type: "string", required: true, desc: "Query or export run ID." },
4832
+ { name: "reason", type: "string", required: false, desc: "Optional cancellation reason." }
4833
+ ],
4834
+ risk: "write",
4835
+ buildInput: (ctx) => ({
4836
+ run_id: ctx.str("run-id"),
4837
+ reason: ctx.str("reason") || void 0
4838
+ })
4839
+ });
4840
+
4841
+ // src/commands/te-engage/engage-query/run/inspect.ts
4842
+ var runInspect = {
4843
+ service: "engage-query",
4844
+ resource: "run",
4845
+ command: "inspect",
4846
+ description: "Inspect one engagement query or export run status.",
4847
+ flags: [
4848
+ { name: "run-id", type: "string", required: true, desc: "Query or export run ID." }
4849
+ ],
4850
+ risk: "read",
4851
+ dryRun: (ctx) => ({
4852
+ method: "GET",
4853
+ url: buildCapabilityGatewayUrl(
4854
+ ctx.host(),
4855
+ resolveGatewayDomain("engage-query", "engage"),
4856
+ `runs/${encodeURIComponent(ctx.str("run-id"))}`
4857
+ )
4858
+ }),
4859
+ execute: async (ctx) => {
4860
+ const result = await requestCapabilityGatewayWithEnvelope(
4861
+ ctx.host(),
4862
+ resolveGatewayDomain("engage-query", "engage"),
4863
+ `runs/${encodeURIComponent(ctx.str("run-id"))}`
4864
+ );
4865
+ return withOutputMetadata(result.data, result.meta);
4866
+ }
4867
+ };
4868
+
4869
+ // src/commands/te-engage/engage-query/index.ts
4870
+ var commands7 = [
4871
+ runInspect,
4872
+ artifactDownload,
4873
+ queryCancel
4874
+ ];
4875
+ var engage_query_default = commands7;
4876
+
3945
4877
  // src/commands/te-engage/index.ts
3946
4878
  registerCapabilityGatewayRoute("engage-flow", { gatewayDomain: "engage" });
3947
4879
  registerCapabilityGatewayRoute("engage-task", { gatewayDomain: "engage" });
@@ -3949,15 +4881,17 @@ registerCapabilityGatewayRoute("engage-setting", { gatewayDomain: "engage" });
3949
4881
  registerCapabilityGatewayRoute("engage-scene", { gatewayDomain: "engage" });
3950
4882
  registerCapabilityGatewayRoute("engage-activity", { gatewayDomain: "engage" });
3951
4883
  registerCapabilityGatewayRoute("engage-workbench", { gatewayDomain: "engage" });
3952
- var commands7 = [
4884
+ registerCapabilityGatewayRoute("engage-query", { gatewayDomain: "engage" });
4885
+ var commands8 = [
3953
4886
  ...engage_flow_default,
3954
4887
  ...engage_task_default,
3955
4888
  ...engage_setting_default,
3956
4889
  ...engage_scene_default,
3957
4890
  ...engage_activity_default,
3958
- ...engage_workbench_default
4891
+ ...engage_workbench_default,
4892
+ ...engage_query_default
3959
4893
  ];
3960
- var te_engage_default = commands7;
4894
+ var te_engage_default = commands8;
3961
4895
  export {
3962
4896
  te_engage_default as default
3963
4897
  };