@thinkingai/ae-cli 6.1.24 → 6.1.26

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 (195) hide show
  1. package/README.md +35 -10
  2. package/README.zh.md +32 -10
  3. package/bin/ae-cli.js +6 -1
  4. package/cli-installation-guide.md +91 -0
  5. package/dist/{auth-XZNXFRJS.js → auth-YHMC3GDH.js} +168 -10
  6. package/dist/automation-NWWVLWG2.js +459 -0
  7. package/dist/{capability-FYTU3X6L.js → capability-3QLLIVFB.js} +11 -6
  8. package/dist/chunk-4655PUNX.js +43 -0
  9. package/dist/{chunk-4NRCTUZJ.js → chunk-5XJYLEVC.js} +4 -4
  10. package/dist/{chunk-JOCDD4ON.js → chunk-7QXISROD.js} +1 -1
  11. package/dist/{chunk-EQ255HKO.js → chunk-AP7YP2NX.js} +2 -2
  12. package/dist/{chunk-DVMLWQD4.js → chunk-CT7QDJS6.js} +2 -2
  13. package/dist/chunk-D6ACFILC.js +56 -0
  14. package/dist/{chunk-HFGZGYCG.js → chunk-EOYSKMXN.js} +264 -10
  15. package/dist/{chunk-57RRFUEZ.js → chunk-FMNNGNYO.js} +43 -8
  16. package/dist/{chunk-7XGFSUOM.js → chunk-GIK6EDUG.js} +291 -84
  17. package/dist/chunk-HVHR4SCP.js +133 -0
  18. package/dist/{chunk-CCS66K4K.js → chunk-KAEHZZH4.js} +3 -3
  19. package/dist/{chunk-DX5CDO34.js → chunk-KFNMQTZI.js} +580 -214
  20. package/dist/{chunk-HBGADCKA.js → chunk-PLE722AJ.js} +28 -11
  21. package/dist/chunk-RK6GLDGI.js +27 -0
  22. package/dist/{chunk-V2NUHPXF.js → chunk-S6M42KND.js} +1 -1
  23. package/dist/{chunk-7FTTULED.js → chunk-UQ77JXYH.js} +7 -3
  24. package/dist/{chunk-MAPZ7VB6.js → chunk-WNGFSIOB.js} +20 -1
  25. package/dist/{chunk-VYXXOKYS.js → chunk-XCHAYMSF.js} +7 -4
  26. package/dist/{community-report-client-CU22W53K.js → community-report-client-PEERQCX2.js} +1 -1
  27. package/dist/{config-XO3LI3SA.js → config-AHPMEW5A.js} +25 -6
  28. package/dist/context-YAE3QXP3.js +136 -0
  29. package/dist/{data-integration-HNGUKFIC.js → data-integration-HESZET7E.js} +6 -6
  30. package/dist/index.js +167 -53
  31. package/dist/{local-data-upload-client-GTRIT64F.js → local-data-upload-client-TWMHFLUA.js} +1 -1
  32. package/dist/memory-62BJOULV.js +580 -0
  33. package/dist/{metadata-DI5BMYFU.js → metadata-C7CEDHOJ.js} +7 -7
  34. package/dist/{model-RNPQXIBI.js → model-SBV2JFJI.js} +9 -5
  35. package/dist/{personal-semantic-preference-5C3WUXFI.js → personal-semantic-preference-QECDPHND.js} +119 -11
  36. package/dist/project-semantic-Z4QAMBWF.js +356 -0
  37. package/dist/{sync-O45NXEQY.js → sync-SU33KYX7.js} +12 -8
  38. package/dist/{te-agent-K5MSPNHJ.js → te-agent-F5QBZSQA.js} +423 -494
  39. package/dist/{te-analysis-AISWCOOZ.js → te-analysis-2ECAAIFK.js} +1227 -154
  40. package/dist/{te-community-4OYU3BDA.js → te-community-PFLDLPP4.js} +3 -3
  41. package/dist/{te-dataops-NFIPB6FX.js → te-dataops-FOQSRIAZ.js} +644 -276
  42. package/dist/{te-engage-BAM3GBFX.js → te-engage-QKUGIWSR.js} +6 -6
  43. package/dist/{te-experiment-GUTZXZ5Z.js → te-experiment-26PXR2UO.js} +6 -6
  44. package/dist/{te-kb-3TS73NO6.js → te-kb-MHDOST62.js} +666 -244
  45. package/dist/{te-system-STMHLS5J.js → te-system-J2FQF5ER.js} +6 -6
  46. package/dist/{te-team-3I5AOX3N.js → te-team-5UOZPTU3.js} +6 -6
  47. package/dist/things-VPPXXLHB.js +1091 -0
  48. package/dist/{update-RZXLPCRH.js → update-EEUTEI6R.js} +59 -51
  49. package/dist/workspace-O3EEIYQM.js +554 -0
  50. package/package.json +30 -11
  51. package/skills/ae-agent/SKILL.md +95 -140
  52. package/skills/ae-agent/references/add-model.md +1 -1
  53. package/skills/ae-agent/references/create-agent.md +1 -1
  54. package/skills/ae-agent/references/find-archived-conversations.md +12 -5
  55. package/skills/ae-agent/references/get-agent.md +1 -1
  56. package/skills/ae-agent/references/list-agents.md +2 -2
  57. package/skills/ae-agent/references/list-models.md +2 -2
  58. package/skills/ae-agent/references/notification.md +40 -0
  59. package/skills/ae-agent/references/restore-conversation.md +3 -1
  60. package/skills/ae-analysis/SKILL.md +55 -23
  61. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  62. package/skills/ae-analysis/references/adhoc_run.md +1 -1
  63. package/skills/ae-analysis/references/agent_review_submit_to_page.md +2 -0
  64. package/skills/ae-analysis/references/ai_models/event.md +6 -1
  65. package/skills/ae-analysis/references/ai_models/funnel.md +12 -4
  66. package/skills/ae-analysis/references/ai_models/heat_map.md +23 -0
  67. package/skills/ae-analysis/references/ai_models/interval.md +24 -0
  68. package/skills/ae-analysis/references/ai_models/path.md +20 -0
  69. package/skills/ae-analysis/references/ai_models/prop_analysis.md +2 -0
  70. package/skills/ae-analysis/references/ai_models/rank_list.md +30 -0
  71. package/skills/ae-analysis/references/ai_models/retention.md +45 -1
  72. package/skills/ae-analysis/references/ai_models/revenue.md +20 -2
  73. package/skills/ae-analysis/references/ai_models/session.md +76 -0
  74. package/skills/ae-analysis/references/ai_models/tag.md +2 -0
  75. package/skills/ae-analysis/references/ai_models.md +100 -3
  76. package/skills/ae-analysis/references/analysis_data_retrieval.md +4 -0
  77. package/skills/ae-analysis/references/analysis_drilldown_contract.md +4 -1
  78. package/skills/ae-analysis/references/asset_batch_info_export.md +10 -0
  79. package/skills/ae-analysis/references/asset_batch_sql_export.md +13 -1
  80. package/skills/ae-analysis/references/asset_export.md +12 -1
  81. package/skills/ae-analysis/references/asset_list.md +1 -0
  82. package/skills/ae-analysis/references/asset_search.md +11 -5
  83. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  84. package/skills/ae-analysis/references/catalog_list.md +1 -1
  85. package/skills/ae-analysis/references/collaboration.md +48 -0
  86. package/skills/ae-analysis/references/command_index.md +29 -19
  87. package/skills/ae-analysis/references/dashboard_list.md +4 -4
  88. package/skills/ae-analysis/references/dashboard_move.md +21 -0
  89. package/skills/ae-analysis/references/dashboard_report_add.md +2 -0
  90. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  91. package/skills/ae-analysis/references/dashboard_report_get.md +19 -0
  92. package/skills/ae-analysis/references/dashboard_report_update.md +27 -0
  93. package/skills/ae-analysis/references/dashboard_update.md +1 -1
  94. package/skills/ae-analysis/references/drilldown_session_details_run.md +41 -0
  95. package/skills/ae-analysis/references/event_export.md +3 -1
  96. package/skills/ae-analysis/references/event_report_presentation.md +76 -0
  97. package/skills/ae-analysis/references/feedback_submit.md +37 -0
  98. package/skills/ae-analysis/references/governance_recommendation_auto_review.md +77 -0
  99. package/skills/ae-analysis/references/governance_recommendation_export.md +11 -0
  100. package/skills/ae-analysis/references/metadata_resolution.md +18 -3
  101. package/skills/ae-analysis/references/metric_export.md +3 -1
  102. package/skills/ae-analysis/references/metric_list.md +1 -1
  103. package/skills/ae-analysis/references/operation_record_export.md +10 -0
  104. package/skills/ae-analysis/references/personal_semantic_preference_add.md +2 -2
  105. package/skills/ae-analysis/references/personal_semantic_preference_get.md +4 -4
  106. package/skills/ae-analysis/references/personal_semantic_preference_list.md +4 -4
  107. package/skills/ae-analysis/references/personal_semantic_preference_review.md +9 -0
  108. package/skills/ae-analysis/references/personal_semantic_preference_review_list.md +7 -0
  109. package/skills/ae-analysis/references/personal_semantic_preference_submit.md +7 -0
  110. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +91 -32
  111. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +99 -1
  112. package/skills/ae-analysis/references/property_export.md +3 -1
  113. package/skills/ae-analysis/references/report_create.md +18 -4
  114. package/skills/ae-analysis/references/report_data_export.md +6 -0
  115. package/skills/ae-analysis/references/report_get.md +7 -1
  116. package/skills/ae-analysis/references/report_list.md +5 -5
  117. package/skills/ae-analysis/references/report_update.md +21 -4
  118. package/skills/ae-analysis/references/sql_table_columns.md +4 -4
  119. package/skills/ae-analysis/references/sql_table_list.md +5 -5
  120. package/skills/ae-analysis/references/system_query_monitor_overview.md +2 -0
  121. package/skills/ae-analysis/references/system_query_task_cancel.md +2 -0
  122. package/skills/ae-analysis/references/system_query_task_export.md +6 -2
  123. package/skills/ae-analysis/references/system_query_task_get.md +2 -0
  124. package/skills/ae-analysis/references/system_query_task_list.md +7 -3
  125. package/skills/ae-analysis/references/system_query_task_options.md +2 -2
  126. package/skills/ae-analysis/references/system_query_task_realtime_list.md +15 -0
  127. package/skills/ae-analysis/references/user_cluster_models.md +8 -0
  128. package/skills/ae-analysis/references/user_tag_create.md +7 -1
  129. package/skills/ae-analysis/references/user_tag_get.md +1 -1
  130. package/skills/ae-analysis/references/user_tag_models.md +20 -2
  131. package/skills/ae-analysis/references/user_tag_refresh.md +1 -1
  132. package/skills/ae-analysis/references/user_tag_update.md +2 -2
  133. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-empty-skeleton.mjs +105 -0
  134. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +669 -29
  135. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +21 -8
  136. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +28 -10
  137. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +66 -0
  138. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +285 -24
  139. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +262 -30
  140. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +1 -1
  141. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +46 -2
  142. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/prepare-compile-schema.mjs +64 -0
  143. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/refresh-state-parts.mjs +91 -0
  144. package/skills/ae-automation/SKILL.md +16 -0
  145. package/skills/ae-automation/references/cli.md +53 -0
  146. package/skills/ae-automation/references/command_index.md +17 -0
  147. package/skills/ae-capability/SKILL.md +73 -2
  148. package/skills/ae-capability/references/collaboration.md +48 -0
  149. package/skills/ae-community/SKILL.md +5 -1
  150. package/skills/ae-community/references/collaboration.md +48 -0
  151. package/skills/ae-current-context/SKILL.md +3 -2
  152. package/skills/ae-data-integration/SKILL.md +4 -0
  153. package/skills/ae-data-integration/references/collaboration.md +48 -0
  154. package/skills/ae-dataops/SKILL.md +54 -74
  155. package/skills/ae-dataops/references/collaboration.md +48 -0
  156. package/skills/ae-dataops/references/dataops-backfill.md +23 -18
  157. package/skills/ae-dataops/references/dataops-flow-create.md +74 -23
  158. package/skills/ae-dataops/references/dataops-flow-monitor.md +45 -13
  159. package/skills/ae-dataops/references/dataops-integration.md +57 -30
  160. package/skills/ae-dataops/references/dataops-query.md +21 -4
  161. package/skills/ae-dataops/references/dataops-table.md +143 -11
  162. package/skills/ae-engage/SKILL.md +21 -6
  163. package/skills/ae-engage/references/channel-mgmt.md +3 -3
  164. package/skills/ae-engage/references/collaboration.md +48 -0
  165. package/skills/ae-engage/references/scene-config-channel.md +4 -4
  166. package/skills/ae-generate-tracking-plan/SKILL.md +4 -0
  167. package/skills/ae-generate-tracking-plan/references/collaboration.md +48 -0
  168. package/skills/ae-kb/SKILL.md +70 -12
  169. package/skills/ae-kb/references/analysis-workflow.md +73 -36
  170. package/skills/ae-kb/references/collaboration.md +48 -0
  171. package/skills/ae-kb/references/query-workflow.md +67 -33
  172. package/skills/ae-kb/references/schema-import.md +32 -0
  173. package/skills/ae-kb/references/source-mutations.md +6 -4
  174. package/skills/ae-kb/references/text-sources.md +53 -0
  175. package/skills/ae-kb-discovery/SKILL.md +8 -3
  176. package/skills/ae-kb-discovery/references/collaboration.md +48 -0
  177. package/skills/ae-metadata/SKILL.md +20 -12
  178. package/skills/ae-metadata/references/collaboration.md +48 -0
  179. package/skills/ae-team/SKILL.md +23 -17
  180. package/skills/ae-things/SKILL.md +85 -0
  181. package/skills/ae-things/references/cli.md +103 -0
  182. package/skills/ae-things-progress/SKILL.md +43 -0
  183. package/skills/ae-things-review/SKILL.md +42 -0
  184. package/skills/ae-workspace/SKILL.md +43 -0
  185. package/skills/ae-workspace/references/commands.md +51 -0
  186. package/dist/chunk-E2JKXMVO.js +0 -29
  187. package/dist/context-IFJI3LIT.js +0 -46
  188. package/dist/memory-QGPSNCQS.js +0 -892
  189. package/dist/project-semantic-3LF6Q6JZ.js +0 -1119
  190. package/skills/ae-agent/references/create-automation.md +0 -125
  191. package/skills/ae-agent/references/list-automations.md +0 -56
  192. package/skills/ae-agent/references/update-automation.md +0 -107
  193. package/skills/ae-project-semantic/SKILL.md +0 -193
  194. package/skills/ae-project-semantic/references/query-routing-v5.md +0 -165
  195. package/skills/ae-project-semantic/references/recommendation-quality.md +0 -68
@@ -7,38 +7,41 @@ import {
7
7
  waitForAnalysisRun,
8
8
  withAsyncArtifactLifecycle,
9
9
  withInterruptSignal
10
- } from "./chunk-VYXXOKYS.js";
10
+ } from "./chunk-XCHAYMSF.js";
11
11
  import {
12
12
  createCapabilityCommand,
13
13
  definitionIntentSnapshotFlag,
14
14
  modelDefinitionIntentSnapshotFlag
15
- } from "./chunk-CCS66K4K.js";
15
+ } from "./chunk-KAEHZZH4.js";
16
16
  import {
17
17
  CapabilityGatewayError,
18
18
  buildCapabilityGatewayUrl,
19
19
  dryRunCapability,
20
20
  executeCapability,
21
21
  executeCapabilityWithEnvelope,
22
+ readCliAgentContext,
22
23
  requestCapabilityGateway,
23
24
  requestCapabilityGatewayWithEnvelope,
25
+ runWithCliAgentContext,
24
26
  uploadInputFile,
25
- validateCapability
26
- } from "./chunk-HFGZGYCG.js";
27
+ validateCapability,
28
+ validateCapabilityWithEnvelope
29
+ } from "./chunk-EOYSKMXN.js";
27
30
  import {
28
31
  registerCapabilityGatewayRoute,
29
32
  resolveGatewayDomain
30
33
  } from "./chunk-KPQY44JQ.js";
31
34
  import {
32
35
  withOutputMetadata
33
- } from "./chunk-DX5CDO34.js";
36
+ } from "./chunk-KFNMQTZI.js";
34
37
  import "./chunk-Y74WTIKJ.js";
35
38
  import {
36
39
  getCliToken
37
- } from "./chunk-7XGFSUOM.js";
38
- import "./chunk-7FTTULED.js";
40
+ } from "./chunk-GIK6EDUG.js";
41
+ import "./chunk-UQ77JXYH.js";
39
42
  import {
40
43
  CliValidationError
41
- } from "./chunk-MAPZ7VB6.js";
44
+ } from "./chunk-WNGFSIOB.js";
42
45
 
43
46
  // src/commands/te-analysis/capability-shared.ts
44
47
  var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
@@ -148,7 +151,7 @@ var sqlTableUsageFlag = {
148
151
  name: "usage",
149
152
  type: "string",
150
153
  required: false,
151
- desc: "Authorized table set: analysis (default) or tag_cluster. Use tag_cluster before creating SQL tags or clusters."
154
+ desc: "Authorized table set: analysis (default), tag_cluster for SQL tags/clusters, or sql_datatable for SQL-built data tables. Use the same usage for list and columns."
152
155
  };
153
156
  var reportListLimitFlag = {
154
157
  name: "limit",
@@ -288,7 +291,7 @@ function certificationScopeInput(ctx) {
288
291
  }
289
292
  return value;
290
293
  }
291
- function dashboardReportDataInput(ctx) {
294
+ function dashboardReportDataInput(ctx, includeCache = true) {
292
295
  return compactInput({
293
296
  ...projectInput(ctx),
294
297
  dashboard_id: ctx.num("dashboard-id"),
@@ -299,7 +302,7 @@ function dashboardReportDataInput(ctx) {
299
302
  cluster_query_scope: optionalString(ctx, "cluster-query-scope"),
300
303
  slave_cluster_id: optionalString(ctx, "slave-cluster-id"),
301
304
  zone_offset: optionalNumber(ctx, "zone-offset"),
302
- use_cache: optionalBoolean(ctx, "use-cache"),
305
+ ...includeCache ? { use_cache: optionalBoolean(ctx, "use-cache") } : {},
303
306
  request_id: optionalString(ctx, "request-id"),
304
307
  preview_rows: optionalNumber(ctx, "preview-rows"),
305
308
  timeout_seconds: optionalNumber(ctx, "timeout-seconds"),
@@ -756,6 +759,7 @@ var metadataEventExport = createAnalysisMetaCapabilityCommand({
756
759
  queriesFlag,
757
760
  fieldsFlag,
758
761
  { name: "authenticated-only", type: "boolean", required: false, desc: "When true, export only authenticated events." },
762
+ certificationScopeFlag,
759
763
  metadataExportOutputFlag
760
764
  ],
761
765
  risk: "read",
@@ -764,7 +768,8 @@ var metadataEventExport = createAnalysisMetaCapabilityCommand({
764
768
  ...projectInput(ctx),
765
769
  queries: optionalQueries(ctx),
766
770
  fields: optionalJson(ctx, "fields"),
767
- authenticated_only: optionalBoolean(ctx, "authenticated-only")
771
+ authenticated_only: optionalBoolean(ctx, "authenticated-only"),
772
+ certification_scope: certificationScopeInput(ctx)
768
773
  }),
769
774
  postProcess: metadataExportPostProcess("event", "events")
770
775
  });
@@ -947,6 +952,7 @@ var metadataPropertyExport = createAnalysisMetaCapabilityCommand({
947
952
  queriesFlag,
948
953
  fieldsFlag,
949
954
  { name: "authenticated-only", type: "boolean", required: false, desc: "When true, export only authenticated properties." },
955
+ certificationScopeFlag,
950
956
  metadataExportOutputFlag
951
957
  ],
952
958
  risk: "read",
@@ -958,7 +964,8 @@ var metadataPropertyExport = createAnalysisMetaCapabilityCommand({
958
964
  event_name: optionalString(ctx, "event-name"),
959
965
  queries: optionalQueries(ctx),
960
966
  fields: optionalJson(ctx, "fields"),
961
- authenticated_only: optionalBoolean(ctx, "authenticated-only")
967
+ authenticated_only: optionalBoolean(ctx, "authenticated-only"),
968
+ certification_scope: certificationScopeInput(ctx)
962
969
  }),
963
970
  postProcess: metadataExportPostProcess("property", "properties")
964
971
  });
@@ -1350,6 +1357,7 @@ var metadataMetricExport = createAnalysisMetaCapabilityCommand({
1350
1357
  queriesFlag,
1351
1358
  fieldsFlag,
1352
1359
  { name: "authenticated-only", type: "boolean", required: false, desc: "When true, export only authenticated metrics." },
1360
+ certificationScopeFlag,
1353
1361
  metadataExportOutputFlag
1354
1362
  ],
1355
1363
  risk: "read",
@@ -1359,7 +1367,8 @@ var metadataMetricExport = createAnalysisMetaCapabilityCommand({
1359
1367
  ignore_authentication: optionalBoolean(ctx, "ignore-authentication"),
1360
1368
  queries: optionalQueries(ctx),
1361
1369
  fields: optionalJson(ctx, "fields"),
1362
- authenticated_only: optionalBoolean(ctx, "authenticated-only")
1370
+ authenticated_only: optionalBoolean(ctx, "authenticated-only"),
1371
+ certification_scope: certificationScopeInput(ctx)
1363
1372
  }),
1364
1373
  postProcess: metadataExportPostProcess("metric", "metrics")
1365
1374
  });
@@ -1500,13 +1509,13 @@ var ownTypesFlag = {
1500
1509
  var requiredQueriesFlag = {
1501
1510
  ...queriesFlag,
1502
1511
  required: true,
1503
- desc: "Required JSON array of 1 to 20 keyword filters. For first-pass asset discovery, use one broad search without --asset-types so results can include both dashboards and reports."
1512
+ desc: "Required JSON array of 1 to 20 keyword filters. For first-pass asset discovery, use one broad search without --asset-types and request a large page; when has_more is true and no strong candidate is present, continue with next_offset before narrowing or rewriting keywords."
1504
1513
  };
1505
1514
  var analysisAssetSearch = createAnalysisCapabilityCommand({
1506
1515
  resource: "asset",
1507
1516
  command: "search",
1508
1517
  capabilityId: "analysis.asset.search",
1509
- description: "Search visible saved analysis assets by keyword. Default first-pass search should omit --asset-types to cover both dashboards and reports.",
1518
+ description: "Search readable saved analysis assets by keyword, including shared read-only and editable dashboards and reports. Results are ranked before pagination by match quality, certification, recent heat/users, and governance impact. Omit --asset-types for first-pass discovery.",
1510
1519
  flags: [
1511
1520
  projectIdFlag,
1512
1521
  requiredQueriesFlag,
@@ -1635,7 +1644,16 @@ var statusFlag = { name: "status", type: "json", required: false, desc: "Operati
1635
1644
  var sortFieldFlag = { name: "sort-field", type: "string", required: false, desc: "Sort field." };
1636
1645
  var sortOrderFlag = { name: "sort-order", type: "string", required: false, desc: "Sort order: asc or desc." };
1637
1646
  var recordIdFlag = { name: "record-id", type: "number", required: false, desc: "Operation record ID." };
1647
+ var governanceExportFlags = (format) => [
1648
+ requestIdFlag,
1649
+ { ...artifactFormatFlag, desc: `Artifact format: ${format}. This capability supports only ${format}.` },
1650
+ { ...asyncTimeoutSecondsFlag, max: 7200, desc: "Async export runtime in seconds. Default: 3600, max: 7200." }
1651
+ ];
1652
+ var governanceExportFields = ["request_id", "format", "timeout_seconds"];
1638
1653
  var readers = {
1654
+ request_id: (ctx) => optionalString(ctx, "request-id"),
1655
+ format: (ctx) => optionalString(ctx, "artifact-format"),
1656
+ timeout_seconds: (ctx) => optionalNumber(ctx, "timeout-seconds"),
1639
1657
  node_id: (ctx) => optionalString(ctx, "node-id"),
1640
1658
  resource_id: (ctx) => optionalString(ctx, "resource-id"),
1641
1659
  resource_type: (ctx) => optionalString(ctx, "resource-type"),
@@ -2238,6 +2256,722 @@ var metadataGovernanceRecommendationSubmit = createAnalysisMetaCapabilityCommand
2238
2256
  })
2239
2257
  });
2240
2258
 
2259
+ // src/commands/te-analysis/meta/governance-recommendation/auto-review.ts
2260
+ import { randomUUID } from "crypto";
2261
+ var windowDaysFlag3 = {
2262
+ name: "window-days",
2263
+ type: "number",
2264
+ required: false,
2265
+ min: 1,
2266
+ max: 365,
2267
+ desc: "Usage window in days for the recommendation batch. Default: 90."
2268
+ };
2269
+ var limitFlag4 = {
2270
+ name: "limit",
2271
+ type: "number",
2272
+ required: false,
2273
+ min: 1,
2274
+ max: 100,
2275
+ desc: "Maximum hot dashboard evidence packages selected before automatic asset review. Omit for CLI bounded expansion over top-20/top-50/top-100; pass explicitly for a fixed diagnostic scope."
2276
+ };
2277
+ var GOVERNANCE_RECOMMENDATION_AUTO_REVIEW_HELP = [
2278
+ "Automatic asset certification contract:",
2279
+ "- Use this command only when the user explicitly asks to automatically review or automatically certify recommended assets.",
2280
+ "- Do not call this command for a plain recommendation request.",
2281
+ "- Do not call this command when the user asks to submit recommendations to the review page.",
2282
+ "- The command first validates project config agent_auto_asset_certification_enabled and project_semantic_enable. If disabled, report the returned config error and stop before collecting recommendations.",
2283
+ "- When --limit is omitted, the CLI performs the same bounded expansion used by recurring page-review jobs: inspect top-20 pending material, then top-50/top-100 only when pending assets or pending dashboard branches are insufficient.",
2284
+ "- Expansion is read-only. The CLI Agent builds automatic decisions once from the final selected material, then submits those decisions for execution and audit.",
2285
+ "- When --limit is explicitly provided, respect that scope and do not expand it.",
2286
+ "- Automatic review only certifies eligible asset candidates from the current recommendation batch. It does not create recommended metrics.",
2287
+ "- CLI Agent blocks semantic duplicates, copy-like assets, synonym properties and ambiguous close definitions; every duplicate skip must name the conflicting asset targets.",
2288
+ "- The result includes manual_review_handoff for assets still uncertified after automatic review. Use it only when the user later asks to submit those assets to the review page.",
2289
+ "- For that later page submission, build the review packet from manual_review_handoff.page_review_items and relations so skipped assets keep their dashboard/report parent context; manual_review_handoff.items remains the exact unapproved review workload.",
2290
+ "- Automatic decisions are recorded for audit. Page-visible reasons must be reviewer-readable Chinese; keep raw source/rule codes only in debug exports.",
2291
+ "- Returned SKIP decisions mean the asset remains for manual review; do not describe skipped items as certified."
2292
+ ].join("\n");
2293
+ var AUTO_REVIEW_CAPABILITY_ID = "metadata.governance_recommendation.auto_review";
2294
+ var EXPORT_CAPABILITY_ID = "metadata.governance_recommendation.export";
2295
+ var SUBMIT_CAPABILITY_ID = "metadata.governance_recommendation.submit";
2296
+ var DEFAULT_LIMIT = 20;
2297
+ var EXPANSION_LIMITS = [20, 50, 100];
2298
+ var MIN_PENDING_ASSETS = 10;
2299
+ var MIN_PENDING_WORK_UNITS = 3;
2300
+ var AUTO_REVIEW_DECISION_LIMIT = 100;
2301
+ var AUTO_REVIEW_MIN_HEAT = 50;
2302
+ var AUTO_REVIEW_MIN_USERS = 5;
2303
+ var AUTO_REVIEW_MIN_IMPACT = 2;
2304
+ var metadataGovernanceRecommendationAutoReview = {
2305
+ service: "analysis-meta",
2306
+ resource: "governance-recommendation",
2307
+ command: "auto-review",
2308
+ capabilityId: AUTO_REVIEW_CAPABILITY_ID,
2309
+ description: "Automatically review and certify eligible recommended assets when the project switch is enabled.",
2310
+ helpText: GOVERNANCE_RECOMMENDATION_AUTO_REVIEW_HELP,
2311
+ flags: [projectIdFlag, windowDaysFlag3, limitFlag4],
2312
+ risk: "write",
2313
+ preflight: (ctx) => {
2314
+ autoReviewInput(ctx);
2315
+ },
2316
+ validateInput: async (ctx) => validateCapability(
2317
+ ctx.host(),
2318
+ gatewayDomain(),
2319
+ AUTO_REVIEW_CAPABILITY_ID,
2320
+ autoReviewInput(ctx)
2321
+ ),
2322
+ dryRun: async (ctx) => dryRunCapability(
2323
+ ctx.host(),
2324
+ gatewayDomain(),
2325
+ AUTO_REVIEW_CAPABILITY_ID,
2326
+ autoReviewInput(ctx)
2327
+ ),
2328
+ execute: async (ctx) => withAutoReviewAgentContext(async () => {
2329
+ const input = autoReviewInput(ctx);
2330
+ if (hasExplicitLimit(ctx)) {
2331
+ await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID, input);
2332
+ const finalExport = await exportRecommendationMaterial(ctx, input, numberValue(input.limit) || DEFAULT_LIMIT);
2333
+ const result2 = await executeCliAgentAutoReview(ctx, input, finalExport.data);
2334
+ return withOutputMetadata({
2335
+ ...record(result2.data),
2336
+ manual_review_handoff: buildManualReviewHandoff(result2.data, finalExport.data)
2337
+ }, result2.meta);
2338
+ }
2339
+ const plan = await planBoundedExpansion(ctx, input);
2340
+ const expansion = plan.expansion;
2341
+ const finalInput = { ...input, limit: expansion.final_limit };
2342
+ const result = await executeCliAgentAutoReview(ctx, finalInput, plan.finalExport);
2343
+ if (result.data && typeof result.data === "object" && !Array.isArray(result.data)) {
2344
+ return withOutputMetadata({
2345
+ ...result.data,
2346
+ auto_review_expansion: expansion,
2347
+ manual_review_handoff: buildManualReviewHandoff(result.data, plan.finalExport)
2348
+ }, result.meta);
2349
+ }
2350
+ return withOutputMetadata(result.data, result.meta);
2351
+ })
2352
+ };
2353
+ async function withAutoReviewAgentContext(run) {
2354
+ const inherited = readCliAgentContext();
2355
+ return runWithCliAgentContext({
2356
+ agent_session_id: inherited.agent_session_id || randomUUID(),
2357
+ agent_turn_id: inherited.agent_turn_id || randomUUID()
2358
+ }, run);
2359
+ }
2360
+ function autoReviewInput(ctx) {
2361
+ return compactInput({
2362
+ ...projectInput(ctx),
2363
+ window_days: optionalNumber(ctx, "window-days"),
2364
+ limit: optionalNumber(ctx, "limit")
2365
+ });
2366
+ }
2367
+ function gatewayDomain() {
2368
+ return resolveGatewayDomain("analysis-meta", "analysis");
2369
+ }
2370
+ function hasExplicitLimit(ctx) {
2371
+ return typeof ctx.has === "function" ? ctx.has("limit") : ctx.str("limit") !== "";
2372
+ }
2373
+ async function executeCliAgentAutoReview(ctx, input, exportResult) {
2374
+ const review = buildCliAgentAutoReview(input, exportResult);
2375
+ if (review.decisions.length === 0) {
2376
+ return {
2377
+ data: {
2378
+ ...review.base,
2379
+ total: 0,
2380
+ applied: 0,
2381
+ recorded: 0,
2382
+ failed: 0,
2383
+ items: []
2384
+ },
2385
+ meta: {}
2386
+ };
2387
+ }
2388
+ const submitted = await executeCapabilityWithEnvelope(ctx.host(), gatewayDomain(), SUBMIT_CAPABILITY_ID, {
2389
+ ...input,
2390
+ run_id: review.runId,
2391
+ snapshot_hash: review.snapshotHash,
2392
+ topic_id: "agent_auto_asset_certification",
2393
+ topic_name: "Agent \u81EA\u52A8\u8BA4\u8BC1\u8D44\u4EA7",
2394
+ decisions: review.decisions
2395
+ });
2396
+ const submittedData = record(submitted.data);
2397
+ return {
2398
+ data: {
2399
+ ...review.base,
2400
+ total: submittedData.total,
2401
+ applied: submittedData.applied,
2402
+ recorded: submittedData.recorded,
2403
+ failed: submittedData.failed,
2404
+ items: autoReviewItemsWithDisplayReason(submittedData.items)
2405
+ },
2406
+ meta: submitted.meta
2407
+ };
2408
+ }
2409
+ async function planBoundedExpansion(ctx, input) {
2410
+ await validateCapabilityWithEnvelope(ctx.host(), gatewayDomain(), AUTO_REVIEW_CAPABILITY_ID, {
2411
+ ...input,
2412
+ limit: DEFAULT_LIMIT
2413
+ });
2414
+ const attempts = [];
2415
+ let finalExport = {};
2416
+ let finalLimit = DEFAULT_LIMIT;
2417
+ let stopReason = "top_100_inspected";
2418
+ for (const limit of EXPANSION_LIMITS) {
2419
+ const exported = await exportRecommendationMaterial(ctx, input, limit);
2420
+ finalExport = exported.data;
2421
+ const summary = summarizeExport(exported.data, limit);
2422
+ attempts.push(summary);
2423
+ finalLimit = limit;
2424
+ const pendingAssets = numberValue(summary.pending_asset_candidates);
2425
+ const pendingWorkUnits = numberValue(summary.pending_work_units);
2426
+ const hasMore = summary.has_more === true;
2427
+ if (pendingAssets >= MIN_PENDING_ASSETS && pendingWorkUnits >= MIN_PENDING_WORK_UNITS) {
2428
+ stopReason = "sufficient_pending_scope";
2429
+ break;
2430
+ }
2431
+ if (!hasMore) {
2432
+ stopReason = "dashboard_pool_exhausted";
2433
+ break;
2434
+ }
2435
+ }
2436
+ return {
2437
+ expansion: {
2438
+ strategy: "bounded_hot_dashboard_expansion",
2439
+ initial_limit: DEFAULT_LIMIT,
2440
+ final_limit: finalLimit,
2441
+ inspected_limits: attempts.map((attempt) => attempt.dashboard_limit),
2442
+ min_pending_asset_candidates: MIN_PENDING_ASSETS,
2443
+ min_pending_work_units: MIN_PENDING_WORK_UNITS,
2444
+ attempts,
2445
+ stop_reason: stopReason,
2446
+ write_policy: "single_auto_review_execute_after_read_only_expansion"
2447
+ },
2448
+ finalExport
2449
+ };
2450
+ }
2451
+ function exportRecommendationMaterial(ctx, input, limit) {
2452
+ return executeCapabilityWithEnvelope(
2453
+ ctx.host(),
2454
+ gatewayDomain(),
2455
+ EXPORT_CAPABILITY_ID,
2456
+ compactInput({ ...input, limit, include_completed: false })
2457
+ );
2458
+ }
2459
+ function summarizeExport(result, requestedLimit) {
2460
+ const data = record(result);
2461
+ const workUnits = array(data.work_units);
2462
+ const coverage = record(data.coverage);
2463
+ const pendingAssetCandidates = countPendingAssetCandidates(workUnits);
2464
+ return {
2465
+ dashboard_limit: numberValue(data.dashboard_limit) || requestedLimit,
2466
+ run_id: stringValue(data.run_id),
2467
+ snapshot_hash: stringValue(data.snapshot_hash),
2468
+ selected_dashboards: numberValue(coverage.selected_dashboards),
2469
+ returned_work_units: workUnits.length,
2470
+ pending_work_units: workUnits.filter((unit) => numberValue(record(unit).actionable_count) > 0).length,
2471
+ pending_asset_candidates: pendingAssetCandidates,
2472
+ has_more: coverage.has_more === true
2473
+ };
2474
+ }
2475
+ function countPendingAssetCandidates(workUnits) {
2476
+ const seen = /* @__PURE__ */ new Set();
2477
+ for (const unit of workUnits) {
2478
+ for (const candidate of array(record(unit).asset_candidates)) {
2479
+ const item = record(candidate);
2480
+ if (item.actionable !== true || item.action_state !== "PENDING") {
2481
+ continue;
2482
+ }
2483
+ const type = stringValue(item.resource_type);
2484
+ const key = stringValue(item.resource_key);
2485
+ if (type && key) {
2486
+ seen.add(`${type}|${key}`);
2487
+ }
2488
+ }
2489
+ }
2490
+ return seen.size;
2491
+ }
2492
+ function buildCliAgentAutoReview(input, exportResult) {
2493
+ const exported = record(exportResult);
2494
+ const material = record(exported.review_material_package);
2495
+ const candidates = array(material.candidate_assets).map(record);
2496
+ const runId = `rec_auto_${randomUUID().replace(/-/g, "")}`;
2497
+ const snapshotHash = stringValue(exported.snapshot_hash);
2498
+ const semanticConflicts = semanticDuplicateConflicts(candidates);
2499
+ const decisions = [];
2500
+ let approved = 0;
2501
+ let skipped = 0;
2502
+ let overflow = 0;
2503
+ const seen = /* @__PURE__ */ new Set();
2504
+ for (const candidate of candidates) {
2505
+ const target = record(candidate.target_ref);
2506
+ const type = stringValue(target.type);
2507
+ const key = stringValue(target.key);
2508
+ if (!type || !key || !seen.add(`${type}|${key}`)) continue;
2509
+ if (candidate.actionable !== true || candidate.action_state !== "PENDING") continue;
2510
+ if (decisions.length >= AUTO_REVIEW_DECISION_LIMIT) {
2511
+ overflow++;
2512
+ continue;
2513
+ }
2514
+ const verdict = cliAgentAutoReviewVerdict(candidate, semanticConflicts.get(`${type}|${key}`));
2515
+ if (verdict.decision === "APPROVE") approved++;
2516
+ else skipped++;
2517
+ decisions.push({
2518
+ item_type: "asset",
2519
+ decision: verdict.decision,
2520
+ resource_type: type,
2521
+ resource_key: key,
2522
+ evidence_hash: candidate.evidence_hash,
2523
+ reason: verdict.reason
2524
+ });
2525
+ }
2526
+ return {
2527
+ runId,
2528
+ snapshotHash,
2529
+ decisions,
2530
+ base: {
2531
+ schema_version: "1.0",
2532
+ run_id: runId,
2533
+ project_id: input.project_id ?? exported.project_id,
2534
+ window_days: input.window_days ?? exported.window_days,
2535
+ dashboard_limit: input.limit ?? exported.dashboard_limit,
2536
+ snapshot_hash: snapshotHash,
2537
+ rule_version: "agent_auto_asset_certification_v1",
2538
+ config_key: "agent_auto_asset_certification_enabled",
2539
+ semantic_config_key: "project_semantic_enable",
2540
+ auto_approved: approved,
2541
+ skipped,
2542
+ overflow
2543
+ }
2544
+ };
2545
+ }
2546
+ function cliAgentAutoReviewVerdict(candidate, semanticConflict) {
2547
+ if (semanticConflict) {
2548
+ return {
2549
+ decision: "SKIP",
2550
+ reason: autoReviewReason(`semantic_duplicate_targets=${encodeReasonPayload(semanticConflict)}`)
2551
+ };
2552
+ }
2553
+ if (listIncludes(candidate.conflict_risks, "same_evidence_rejected_before")) {
2554
+ return {
2555
+ decision: "SKIP",
2556
+ reason: autoReviewReason("same_evidence_rejected_before")
2557
+ };
2558
+ }
2559
+ if (array(candidate.source_evidence).length === 0 && candidate.recommendation_role !== "source_dashboard") {
2560
+ return {
2561
+ decision: "SKIP",
2562
+ reason: autoReviewReason("source_evidence_missing")
2563
+ };
2564
+ }
2565
+ const heat = numberValue(candidate.heat_count90d);
2566
+ const users = numberValue(candidate.user_count90d);
2567
+ const impact = numberValue(candidate.impact_degree);
2568
+ const matched = [];
2569
+ if (heat >= AUTO_REVIEW_MIN_HEAT) matched.push(`heat_count90d>=${AUTO_REVIEW_MIN_HEAT}`);
2570
+ if (users >= AUTO_REVIEW_MIN_USERS) matched.push(`user_count90d>=${AUTO_REVIEW_MIN_USERS}`);
2571
+ if (impact > AUTO_REVIEW_MIN_IMPACT) matched.push(`impact_degree>${AUTO_REVIEW_MIN_IMPACT}.0`);
2572
+ if (matched.length === 0) {
2573
+ return {
2574
+ decision: "SKIP",
2575
+ reason: autoReviewReason(`signals_below_threshold: heat_count90d=${heat}, user_count90d=${users}, impact_degree=${impact}`)
2576
+ };
2577
+ }
2578
+ return {
2579
+ decision: "APPROVE",
2580
+ reason: autoReviewReason(`matched=${matched.join(",")}; role=${stringValue(candidate.recommendation_role) ?? "asset"}`)
2581
+ };
2582
+ }
2583
+ function autoReviewReason(reason) {
2584
+ return `source=AGENT_AUTO_REVIEW; rule_version=agent_auto_asset_certification_v1; ${reason}`;
2585
+ }
2586
+ function autoReviewItemsWithDisplayReason(items) {
2587
+ return array(items).map((value) => {
2588
+ const item = record(value);
2589
+ const copy = {
2590
+ ...item,
2591
+ semantic_duplicate_targets: semanticDuplicateTargetsFromReason(stringValue(item.reason) ?? "")
2592
+ };
2593
+ if (item.decision !== "APPROVE") {
2594
+ copy.display_reason = autoReviewDisplayReason(item);
2595
+ }
2596
+ return copy;
2597
+ });
2598
+ }
2599
+ function semanticDuplicateConflicts(candidates) {
2600
+ const result = /* @__PURE__ */ new Map();
2601
+ const comparable = candidates.map((candidate) => comparableAsset(candidate)).filter((candidate) => !!candidate);
2602
+ for (const candidate of comparable) {
2603
+ if (candidate.actionable !== true || candidate.actionState !== "PENDING") continue;
2604
+ const matches = [];
2605
+ for (const other of comparable) {
2606
+ if (candidate.assetKey === other.assetKey) continue;
2607
+ const basis = semanticDuplicateBasis(candidate, other);
2608
+ if (basis) matches.push({ asset: other, basis });
2609
+ }
2610
+ if (!matches.length) continue;
2611
+ matches.sort((left, right) => duplicateRank(right.asset) - duplicateRank(left.asset));
2612
+ const targets = matches.slice(0, 3).map(({ asset, basis }) => ({
2613
+ target_ref: { type: asset.type, key: asset.key },
2614
+ display_name: asset.displayName,
2615
+ resource_type: asset.type,
2616
+ resource_key: asset.key,
2617
+ authentication_status: asset.authenticationStatus,
2618
+ action_state: asset.actionState,
2619
+ reason: duplicateBasisText(basis)
2620
+ }));
2621
+ result.set(candidate.assetKey, {
2622
+ targets,
2623
+ basis: Array.from(new Set(matches.map((match) => match.basis))).map(duplicateBasisText)
2624
+ });
2625
+ }
2626
+ return result;
2627
+ }
2628
+ function comparableAsset(candidate) {
2629
+ const target = record(candidate.target_ref);
2630
+ const type = stringValue(target.type);
2631
+ const key = stringValue(target.key);
2632
+ if (!type || !key) return void 0;
2633
+ const displayName = stringValue(candidate.display_name) ?? key;
2634
+ const evidence = record(candidate.evidence_snapshot);
2635
+ const evidenceAsset = record(evidence.asset);
2636
+ const description = stringValue(record(candidate.evidence_snapshot).description) ?? stringValue(evidenceAsset.description) ?? stringValue(candidate.description) ?? "";
2637
+ return {
2638
+ assetKey: `${type}|${key}`,
2639
+ type,
2640
+ key,
2641
+ displayName,
2642
+ description,
2643
+ authenticationStatus: numberValue(evidenceAsset.authentication_status ?? candidate.authentication_status),
2644
+ actionState: stringValue(candidate.action_state) ?? "",
2645
+ actionable: candidate.actionable === true,
2646
+ normalizedName: normalizeSemanticText(displayName || key),
2647
+ canonicalName: canonicalDuplicateText(displayName || key),
2648
+ aliasName: aliasDuplicateText(displayName || key),
2649
+ normalizedDescription: normalizeSemanticText(description),
2650
+ heat: numberValue(candidate.heat_count90d),
2651
+ users: numberValue(candidate.user_count90d),
2652
+ impact: numberValue(candidate.impact_degree)
2653
+ };
2654
+ }
2655
+ function semanticDuplicateBasis(left, right) {
2656
+ if (!left.normalizedName || !right.normalizedName) return void 0;
2657
+ if (left.normalizedName.length >= 3 && left.normalizedName === right.normalizedName) return "same_display_name";
2658
+ if (left.canonicalName.length >= 3 && left.canonicalName === right.canonicalName) return "copy_or_suffix_variant";
2659
+ if (left.aliasName.length >= 3 && left.aliasName === right.aliasName && relatedAssetTypes(left.type, right.type)) {
2660
+ return "business_alias_equivalent";
2661
+ }
2662
+ if (left.normalizedDescription.length >= 6 && left.normalizedDescription === right.normalizedDescription) {
2663
+ return "same_description";
2664
+ }
2665
+ return void 0;
2666
+ }
2667
+ function relatedAssetTypes(left, right) {
2668
+ if (left === right) return true;
2669
+ return left.endsWith("_prop") && right.endsWith("_prop");
2670
+ }
2671
+ function duplicateRank(asset) {
2672
+ return (asset.authenticationStatus === 1 ? 1e5 : 0) + (asset.actionState === "AUTHENTICATED" ? 5e4 : 0) + asset.heat + asset.users * 10 + asset.impact * 100;
2673
+ }
2674
+ function normalizeSemanticText(value) {
2675
+ return value.toLowerCase().replace(/[\s_\-—–/\\|::,,.。"'`【】\[\]()(){}<>《》]/g, "").trim();
2676
+ }
2677
+ function canonicalDuplicateText(value) {
2678
+ return normalizeSemanticText(value).replace(/(副本|复制|拷贝|备份|copy|backup|bak|test|测试|临时|tmp)+$/g, "").replace(/v\d+$/g, "").replace(/\d+$/g, "");
2679
+ }
2680
+ function aliasDuplicateText(value) {
2681
+ return canonicalDuplicateText(value).replace(/(公司|企业|客户|客戶|client|customer|company|account)/g, "\u5BA2\u6237").replace(/(项目|工程|project)/g, "\u9879\u76EE").replace(/(用户|玩家|会员|user|player|member)/g, "\u7528\u6237");
2682
+ }
2683
+ function duplicateBasisText(value) {
2684
+ switch (value) {
2685
+ case "same_display_name":
2686
+ return "\u8D44\u4EA7\u540D\u79F0\u4E00\u81F4";
2687
+ case "copy_or_suffix_variant":
2688
+ return "\u540D\u79F0\u4EC5\u5B58\u5728\u526F\u672C\u3001\u7248\u672C\u6216\u4E34\u65F6\u540E\u7F00\u5DEE\u5F02";
2689
+ case "business_alias_equivalent":
2690
+ return "\u4E1A\u52A1\u5BF9\u8C61\u8868\u8FF0\u76F8\u8FD1\uFF0C\u53EF\u80FD\u662F\u540C\u4E49\u5C5E\u6027\u6216\u76F8\u8FD1\u53E3\u5F84";
2691
+ case "same_description":
2692
+ return "\u8D44\u4EA7\u63CF\u8FF0\u4E00\u81F4";
2693
+ default:
2694
+ return value;
2695
+ }
2696
+ }
2697
+ function encodeReasonPayload(value) {
2698
+ return Buffer.from(JSON.stringify(value), "utf8").toString("base64url");
2699
+ }
2700
+ function decodeReasonPayload(value) {
2701
+ try {
2702
+ return record(JSON.parse(Buffer.from(value, "base64url").toString("utf8")));
2703
+ } catch {
2704
+ return {};
2705
+ }
2706
+ }
2707
+ function semanticDuplicateTargetsFromReason(reason) {
2708
+ const encoded = /semantic_duplicate_targets=([A-Za-z0-9_-]+)/.exec(reason)?.[1];
2709
+ if (!encoded) return [];
2710
+ return array(decodeReasonPayload(encoded).targets);
2711
+ }
2712
+ function listIncludes(value, expected) {
2713
+ return array(value).some((item) => item === expected);
2714
+ }
2715
+ function buildManualReviewHandoff(autoReviewResult, exportResult) {
2716
+ const result = record(autoReviewResult);
2717
+ const exported = record(exportResult);
2718
+ const material = record(exported.review_material_package);
2719
+ const decisions = decisionsByAsset(result.items);
2720
+ const candidates = array(material.candidate_assets);
2721
+ const relations = array(material.relations).map(record);
2722
+ const handoffItems = [];
2723
+ const approved = /* @__PURE__ */ new Set();
2724
+ for (const decision of decisions.values()) {
2725
+ if (decision.decision === "APPROVE" && decision.landing_status === "APPLIED") {
2726
+ approved.add(decision.assetKey);
2727
+ }
2728
+ }
2729
+ const autoCertifiedItems = buildAutoCertifiedItems(decisions, candidates);
2730
+ for (const value of candidates) {
2731
+ const candidate = record(value);
2732
+ const target = record(candidate.target_ref);
2733
+ const type = stringValue(target.type);
2734
+ const key = stringValue(target.key);
2735
+ if (!type || !key) {
2736
+ continue;
2737
+ }
2738
+ const assetKey = `${type}|${key}`;
2739
+ if (approved.has(assetKey)) {
2740
+ continue;
2741
+ }
2742
+ const decision = decisions.get(assetKey);
2743
+ const actionable = candidate.actionable === true;
2744
+ if (!decision && !actionable) {
2745
+ continue;
2746
+ }
2747
+ const reviewReason = decision ? manualReviewReason(decision, candidate) : "\u672C\u6B21\u81EA\u52A8\u8BA4\u8BC1\u672A\u4EA7\u751F\u660E\u786E\u7ED3\u8BBA\uFF0C\u53EF\u80FD\u662F\u5019\u9009\u8D44\u4EA7\u8D85\u51FA\u672C\u6B21\u81EA\u52A8\u8BA4\u8BC1\u5904\u7406\u4E0A\u9650\u6216\u88AB\u53BB\u91CD\uFF0C\u8BF7\u4EBA\u5DE5\u786E\u8BA4\u3002";
2748
+ handoffItems.push({
2749
+ ...candidate,
2750
+ auto_review_decision: decision ? decision.raw : {
2751
+ decision: "NOT_REVIEWED",
2752
+ reason: reviewReason
2753
+ },
2754
+ semantic_duplicate_targets: decision ? array(decision.raw.semantic_duplicate_targets) : [],
2755
+ manual_review_reason: reviewReason
2756
+ });
2757
+ }
2758
+ const pageReviewItems = buildPageReviewItems(handoffItems, candidates, relations, decisions);
2759
+ const pageReviewIds = new Set(pageReviewItems.map((item) => stringValue(item.client_item_id)).filter(Boolean));
2760
+ return {
2761
+ schema_version: "1.0",
2762
+ handoff_type: "auto_review_uncertified_assets_to_page_review",
2763
+ project_id: result.project_id ?? exported.project_id,
2764
+ source_auto_review_run_id: result.run_id,
2765
+ source_export_run_id: exported.run_id,
2766
+ snapshot_hash: exported.snapshot_hash ?? result.snapshot_hash,
2767
+ dashboard_limit: exported.dashboard_limit ?? result.dashboard_limit,
2768
+ auto_review_trace: {
2769
+ run_id: result.run_id,
2770
+ rule_version: result.rule_version,
2771
+ auto_approved: result.auto_approved,
2772
+ skipped: result.skipped,
2773
+ overflow: result.overflow,
2774
+ approved_items: autoCertifiedItems,
2775
+ skipped_items: handoffItems.map((item) => ({
2776
+ target_ref: record(item.target_ref),
2777
+ display_name: item.display_name,
2778
+ manual_review_reason: item.manual_review_reason
2779
+ }))
2780
+ },
2781
+ auto_certified_items: autoCertifiedItems,
2782
+ candidate_count: handoffItems.length,
2783
+ items: handoffItems,
2784
+ page_review_items: pageReviewItems,
2785
+ page_review_context_count: pageReviewItems.length - handoffItems.length,
2786
+ relations: relations.filter((edge) => pageReviewIds.has(stringValue(edge.parent)) && pageReviewIds.has(stringValue(edge.child))),
2787
+ source_index: array(material.source_index).map(record).filter((source) => pageReviewIds.has(stringValue(source.client_item_id))),
2788
+ quality_gates: array(material.quality_gates),
2789
+ definition_policy: record(material.definition_policy),
2790
+ submit_to_page_policy: {
2791
+ command: "analysis-meta agent-review submit-to-page",
2792
+ scope: "Submit page_review_items so unapproved assets keep dashboard/report parent context; only items without manual_review_context require human certification decisions.",
2793
+ reason_field: "manual_review_reason",
2794
+ source_metadata: "When submitting leftovers, copy manual_review_handoff.auto_review_trace to submit-to-page source_metadata.auto_review_trace so the page audit records show the assets Agent already certified.",
2795
+ requires_user_submission_intent: true
2796
+ }
2797
+ };
2798
+ }
2799
+ function buildPageReviewItems(handoffItems, candidates, relations, decisions) {
2800
+ const byId = /* @__PURE__ */ new Map();
2801
+ const requiredIds = /* @__PURE__ */ new Set();
2802
+ for (const value of candidates) {
2803
+ const candidate = record(value);
2804
+ const id = stringValue(candidate.client_item_id);
2805
+ if (id) byId.set(id, candidate);
2806
+ }
2807
+ for (const item of handoffItems) {
2808
+ const id = stringValue(item.client_item_id);
2809
+ if (id) requiredIds.add(id);
2810
+ }
2811
+ let changed = true;
2812
+ while (changed) {
2813
+ changed = false;
2814
+ for (const edge of relations) {
2815
+ const parent = stringValue(edge.parent);
2816
+ const child = stringValue(edge.child);
2817
+ if (parent && child && requiredIds.has(child) && !requiredIds.has(parent) && byId.has(parent)) {
2818
+ requiredIds.add(parent);
2819
+ changed = true;
2820
+ }
2821
+ }
2822
+ }
2823
+ const handoffById = new Map(handoffItems.map((item) => [stringValue(item.client_item_id), item]).filter((entry) => !!entry[0]));
2824
+ return candidates.map(record).filter((candidate) => {
2825
+ const id = stringValue(candidate.client_item_id);
2826
+ return id !== void 0 && requiredIds.has(id);
2827
+ }).map((candidate) => {
2828
+ const id = stringValue(candidate.client_item_id) ?? "";
2829
+ const handoff = handoffById.get(id);
2830
+ if (handoff) return handoff;
2831
+ const target = record(candidate.target_ref);
2832
+ const type = stringValue(target.type);
2833
+ const key = stringValue(target.key);
2834
+ const decision = type && key ? decisions.get(`${type}|${key}`) : void 0;
2835
+ return markContextCandidate(candidate, decision);
2836
+ });
2837
+ }
2838
+ function markContextCandidate(candidate, decision) {
2839
+ const item = { ...candidate };
2840
+ item.manual_review_context = true;
2841
+ item.manual_review_reason = "\u8BE5\u8D44\u4EA7\u7528\u4E8E\u4FDD\u7559\u81EA\u52A8\u53D1\u73B0\u9875\u9762\u7684\u7236\u5B50\u5C42\u7EA7\u548C\u6765\u6E90\u4E0A\u4E0B\u6587\uFF0C\u4E0D\u4F5C\u4E3A\u672C\u6B21\u4EBA\u5DE5\u5BA1\u6838\u5BF9\u8C61\u3002";
2842
+ if (decision?.decision === "APPROVE" && decision.landing_status === "APPLIED") {
2843
+ item.auto_review_decision = decision.raw;
2844
+ item.auto_review_context_reason = autoReviewDisplayReason(decision.raw, candidate);
2845
+ item.evidence_snapshot = markEvidenceAuthenticated(record(candidate.evidence_snapshot));
2846
+ }
2847
+ return item;
2848
+ }
2849
+ function markEvidenceAuthenticated(evidence) {
2850
+ const snapshot = { ...evidence };
2851
+ const asset = record(snapshot.asset);
2852
+ if (Object.keys(asset).length) {
2853
+ snapshot.asset = { ...asset, authentication_status: 1 };
2854
+ }
2855
+ return snapshot;
2856
+ }
2857
+ function decisionsByAsset(value) {
2858
+ const result = /* @__PURE__ */ new Map();
2859
+ for (const itemValue of array(value)) {
2860
+ const item = record(itemValue);
2861
+ if (item.item_type !== "asset") {
2862
+ continue;
2863
+ }
2864
+ const type = stringValue(item.resource_type);
2865
+ const key = stringValue(item.resource_key);
2866
+ if (!type || !key) {
2867
+ continue;
2868
+ }
2869
+ const assetKey = `${type}|${key}`;
2870
+ result.set(assetKey, {
2871
+ assetKey,
2872
+ decision: stringValue(item.decision) ?? "",
2873
+ landing_status: stringValue(item.landing_status) ?? "",
2874
+ raw: item
2875
+ });
2876
+ }
2877
+ return result;
2878
+ }
2879
+ function buildAutoCertifiedItems(decisions, candidates) {
2880
+ const byAsset = /* @__PURE__ */ new Map();
2881
+ for (const value of candidates) {
2882
+ const candidate = record(value);
2883
+ const target = record(candidate.target_ref);
2884
+ const type = stringValue(target.type);
2885
+ const key = stringValue(target.key);
2886
+ if (type && key) byAsset.set(`${type}|${key}`, candidate);
2887
+ }
2888
+ const items = [];
2889
+ for (const decision of decisions.values()) {
2890
+ if (decision.decision !== "APPROVE" || decision.landing_status !== "APPLIED") continue;
2891
+ const candidate = byAsset.get(decision.assetKey) ?? {};
2892
+ items.push({
2893
+ target_ref: record(candidate.target_ref),
2894
+ display_name: candidate.display_name ?? decision.raw.resource_key,
2895
+ auto_review_reason: autoReviewDisplayReason(decision.raw, candidate),
2896
+ landing_message: decision.raw.landing_message
2897
+ });
2898
+ }
2899
+ return items;
2900
+ }
2901
+ function manualReviewReason(decision, context) {
2902
+ const reason = autoReviewDisplayReason(decision.raw, context);
2903
+ if (decision.decision === "SKIP") {
2904
+ return reason;
2905
+ }
2906
+ if (decision.decision === "APPROVE" && decision.landing_status !== "APPLIED") {
2907
+ const landing = stringValue(decision.raw.landing_message);
2908
+ return landing ? `${reason}; landing_${decision.landing_status.toLowerCase()}: ${landing}` : `${reason}; landing_${decision.landing_status.toLowerCase()}`;
2909
+ }
2910
+ return reason;
2911
+ }
2912
+ function autoReviewDisplayReason(raw, context = {}) {
2913
+ const display = stringValue(raw.display_reason);
2914
+ if (display) return display;
2915
+ const reason = stringValue(raw.reason);
2916
+ if (!reason) return "\u672C\u6B21\u81EA\u52A8\u8BA4\u8BC1\u6CA1\u6709\u8FD4\u56DE\u539F\u56E0\uFF0C\u8BF7\u4EBA\u5DE5\u786E\u8BA4\u3002";
2917
+ return humanizeAutoReviewReason(reason, context);
2918
+ }
2919
+ function humanizeAutoReviewReason(reason, context) {
2920
+ if (reason.includes("semantic_duplicate_targets=")) {
2921
+ const targets = semanticDuplicateTargetsFromReason(reason).map(record).map((target) => {
2922
+ const ref = record(target.target_ref);
2923
+ const label = stringValue(target.display_name) ?? stringValue(target.resource_key) ?? stringValue(ref.key) ?? "\u672A\u77E5\u8D44\u4EA7";
2924
+ const type = stringValue(target.resource_type) ?? stringValue(ref.type) ?? "asset";
2925
+ const key = stringValue(target.resource_key) ?? stringValue(ref.key) ?? "-";
2926
+ const targetReason = stringValue(target.reason);
2927
+ return `${label}\uFF08${type}:${key}${targetReason ? `\uFF0C${targetReason}` : ""}\uFF09`;
2928
+ });
2929
+ const targetText = targets.length ? targets.join("\uFF1B") : "\u76F8\u8FD1\u8D44\u4EA7";
2930
+ return `\u672A\u81EA\u52A8\u8BA4\u8BC1\u539F\u56E0\uFF1A\u7591\u4F3C\u4E0E ${targetText} \u8BED\u4E49\u91CD\u590D\u6216\u53E3\u5F84\u76F8\u8FD1\u3002\u8BF7\u4EBA\u5DE5\u786E\u8BA4\u662F\u5426\u5E94\u4F5C\u4E3A\u72EC\u7ACB\u8D44\u4EA7\u8BA4\u8BC1\uFF1B\u5982\u679C\u53EA\u662F\u526F\u672C\u3001\u540C\u4E49\u5C5E\u6027\u6216\u76F8\u8FD1\u53E3\u5F84\uFF0C\u8BF7\u4F18\u5148\u9009\u62E9\u66F4\u6807\u51C6\u7684\u8D44\u4EA7\u3002`;
2931
+ }
2932
+ if (reason.includes("previous_decision_exists_for_different_evidence")) {
2933
+ return "\u672A\u81EA\u52A8\u8BA4\u8BC1\u539F\u56E0\uFF1A\u68C0\u6D4B\u5230\u8BE5\u8D44\u4EA7\u5B58\u5728\u5386\u53F2\u5904\u7406\u8BB0\u5F55\uFF0C\u4F46\u672C\u6B21\u672A\u8FD4\u56DE\u53EF\u6838\u9A8C\u7684\u91CD\u590D\u5BF9\u8C61\u3002\u8BF7\u6309\u5F53\u524D\u8D44\u4EA7\u5B9A\u4E49\u548C\u6765\u6E90\u8BC1\u636E\u4EBA\u5DE5\u786E\u8BA4\uFF1B\u8FD9\u4E0D\u4EE3\u8868\u7CFB\u7EDF\u53D1\u73B0\u4E86\u91CD\u590D\u8D44\u4EA7\u3002";
2934
+ }
2935
+ if (reason.includes("same_evidence_rejected_before")) {
2936
+ return "\u672A\u81EA\u52A8\u8BA4\u8BC1\u539F\u56E0\uFF1A\u76F8\u540C\u8BA4\u8BC1\u5EFA\u8BAE\u6B64\u524D\u5DF2\u88AB\u4EBA\u5DE5\u9A73\u56DE\uFF0C\u81EA\u52A8\u8BA4\u8BC1\u4E0D\u4F1A\u8986\u76D6\u4EBA\u5DE5\u7ED3\u8BBA\u3002\u5982\u4E1A\u52A1\u53E3\u5F84\u5DF2\u8C03\u6574\uFF0C\u8BF7\u4EBA\u5DE5\u91CD\u65B0\u786E\u8BA4\u662F\u5426\u8BA4\u8BC1\u3002";
2937
+ }
2938
+ if (reason.includes("source_evidence_missing")) {
2939
+ return "\u81EA\u52A8\u8BA4\u8BC1\u672A\u901A\u8FC7\uFF1A\u7F3A\u5C11\u53EF\u6838\u9A8C\u7684\u6765\u6E90\u8D44\u4EA7\u8BC1\u636E\uFF0C\u8BF7\u4EBA\u5DE5\u786E\u8BA4\u8D44\u4EA7\u6765\u6E90\u3001\u5B9A\u4E49\u548C\u4F9D\u8D56\u5173\u7CFB\u540E\u518D\u8BA4\u8BC1\u3002";
2940
+ }
2941
+ if (reason.includes("signals_below_threshold")) {
2942
+ const heat = /heat_count90d=(\d+)/.exec(reason)?.[1];
2943
+ const users = /user_count90d=(\d+)/.exec(reason)?.[1];
2944
+ const impact = /impact_degree=([0-9.]+)/.exec(reason)?.[1];
2945
+ return `\u81EA\u52A8\u8BA4\u8BC1\u672A\u901A\u8FC7\uFF1A\u8BE5\u8D44\u4EA7\u8FD1 90 \u5929\u8BBF\u95EE/\u4F7F\u7528 ${heat ?? "\u672A\u77E5"} \u6B21\u3001\u4F7F\u7528\u4EBA\u6570 ${users ?? "\u672A\u77E5"}\uFF0C\u5F71\u54CD\u5EA6 ${impact ?? "\u672A\u77E5"}\uFF0C\u672A\u8FBE\u5230\u81EA\u52A8\u8BA4\u8BC1\u9608\u503C\uFF0C\u8BF7\u4EBA\u5DE5\u786E\u8BA4\u662F\u5426\u4ECD\u9700\u8981\u8BA4\u8BC1\u3002`;
2946
+ }
2947
+ if (reason.includes("matched=")) {
2948
+ const matched = [];
2949
+ if (reason.includes("heat_count90d>=")) matched.push("\u8BBF\u95EE/\u4F7F\u7528\u6B21\u6570\u8FBE\u5230\u9608\u503C");
2950
+ if (reason.includes("user_count90d>=")) matched.push("\u4F7F\u7528\u4EBA\u6570\u8FBE\u5230\u9608\u503C");
2951
+ if (reason.includes("impact_degree>")) matched.push("\u5F71\u54CD\u5EA6\u8FBE\u5230\u9608\u503C");
2952
+ const matchedText = matched.length ? matched.join("\u3001") : "\u547D\u4E2D\u81EA\u52A8\u8BA4\u8BC1\u89C4\u5219";
2953
+ return `Agent \u81EA\u52A8\u8BA4\u8BC1\u901A\u8FC7\uFF1A\u8BE5\u8D44\u4EA7\u8FD1 90 \u5929\u8BBF\u95EE/\u4F7F\u7528 ${displaySignal(context.heat_count90d)} \u6B21\u3001\u4F7F\u7528\u4EBA\u6570 ${displaySignal(context.user_count90d)}\uFF0C\u5F71\u54CD\u5EA6 ${displaySignal(context.impact_degree)}\uFF1B\u672A\u53D1\u73B0\u8BED\u4E49\u91CD\u590D\u98CE\u9669\uFF0C\u4E14${matchedText}\u3002`;
2954
+ }
2955
+ return reason.replace(/^source=AGENT_AUTO_REVIEW;\s*/, "").replace(/rule_version=[^;]+;\s*/, "").replace(/conflict_risks=\[[^\]]*]/, "\u81EA\u52A8\u8BA4\u8BC1\u672A\u901A\u8FC7\uFF1A\u5B58\u5728\u9700\u8981\u4EBA\u5DE5\u786E\u8BA4\u7684\u5BA1\u6838\u98CE\u9669\u3002").replace(/conflict_risks=/, "\u81EA\u52A8\u8BA4\u8BC1\u672A\u901A\u8FC7\uFF1A\u5B58\u5728\u9700\u8981\u4EBA\u5DE5\u786E\u8BA4\u7684\u5BA1\u6838\u98CE\u9669\u3002");
2956
+ }
2957
+ function displaySignal(value) {
2958
+ if (typeof value === "number" && Number.isFinite(value)) return String(value);
2959
+ if (typeof value === "string" && value.trim()) return value;
2960
+ return "\u672A\u77E5";
2961
+ }
2962
+ function record(value) {
2963
+ return value && typeof value === "object" && !Array.isArray(value) ? value : {};
2964
+ }
2965
+ function array(value) {
2966
+ return Array.isArray(value) ? value : [];
2967
+ }
2968
+ function numberValue(value) {
2969
+ return typeof value === "number" && Number.isFinite(value) ? value : 0;
2970
+ }
2971
+ function stringValue(value) {
2972
+ return typeof value === "string" && value.trim() ? value : void 0;
2973
+ }
2974
+
2241
2975
  // src/commands/te-analysis/meta/governance-recommendation/decisions.ts
2242
2976
  var runIdFlag2 = {
2243
2977
  name: "run-id",
@@ -2245,7 +2979,7 @@ var runIdFlag2 = {
2245
2979
  required: false,
2246
2980
  desc: "Optional run_id filter."
2247
2981
  };
2248
- var limitFlag4 = {
2982
+ var limitFlag5 = {
2249
2983
  name: "limit",
2250
2984
  type: "number",
2251
2985
  required: false,
@@ -2258,7 +2992,7 @@ var metadataGovernanceRecommendationDecisions = createAnalysisMetaCapabilityComm
2258
2992
  command: "decisions",
2259
2993
  capabilityId: "metadata.governance_recommendation.decisions",
2260
2994
  description: "List recent CLI Agent recommendation approval decisions.",
2261
- flags: [projectIdFlag, runIdFlag2, limitFlag4],
2995
+ flags: [projectIdFlag, runIdFlag2, limitFlag5],
2262
2996
  risk: "read",
2263
2997
  buildInput: (ctx) => compactInput({
2264
2998
  ...projectInput(ctx),
@@ -2271,6 +3005,7 @@ var metadataGovernanceRecommendationDecisions = createAnalysisMetaCapabilityComm
2271
3005
  var commands11 = [
2272
3006
  metadataGovernanceRecommendationExport,
2273
3007
  metadataGovernanceRecommendationSubmit,
3008
+ metadataGovernanceRecommendationAutoReview,
2274
3009
  metadataGovernanceRecommendationDecisions
2275
3010
  ];
2276
3011
  var governance_recommendation_default = commands11;
@@ -2322,7 +3057,7 @@ function object(value, name) {
2322
3057
  }
2323
3058
  return value;
2324
3059
  }
2325
- function array(value, name) {
3060
+ function array2(value, name) {
2326
3061
  if (!Array.isArray(value) || value.length < 1 || value.length > 5e3) {
2327
3062
  throw new Error(`${name} must contain 1 to 5000 items.`);
2328
3063
  }
@@ -2367,6 +3102,7 @@ var SUBMIT_TO_PAGE_HELP = [
2367
3102
  "- relations should let the page render dashboard -> report -> metadata with contains/uses edges. Use an empty relations array only when the package truly has no known parent-child evidence.",
2368
3103
  "- Each submitted item must keep source_link or evidence_links[].url so reviewers can jump to source evidence.",
2369
3104
  "- item.ai_summary.summary is the per-item recommendation reason. It must cite concrete item evidence, not generic review boilerplate. batch ai_summary.summary is only the batch overview.",
3105
+ "- When submitting manual_review_handoff leftovers, copy manual_review_handoff.auto_review_trace into source_metadata.auto_review_trace so page audit records include the assets already certified automatically.",
2370
3106
  "- For reports and SQL reports, item.ai_summary.analysis_explanation must explain reviewer-readable calculations or measures from packaged evidence_snapshot.analysis. A purpose-only summary is incomplete and is rejected locally before dispatch.",
2371
3107
  "- Reviewer-visible text should follow the project-KB source style: one business Chinese Agent summary that explains purpose, calculation caliber, filters, time scope, boundaries, and concrete reviewer questions. Keep raw SQL, parser labels, temporary aliases, parameter placeholders, hashes, and evidence paths in evidence_snapshot only; independent Agent preflight flags visible implementation terms as quality findings.",
2372
3108
  "- The command output includes review_page_url when review_url is present. Return review_page_url to the user; do not prepend the Common/API host to review_url yourself.",
@@ -2378,6 +3114,7 @@ var SUBMIT_TO_PAGE_HELP = [
2378
3114
  ' "title": "<review batch title>",',
2379
3115
  ' "source_run_id": "<export.run_id>",',
2380
3116
  ' "source_task_id": "<optional preauthorized task id>",',
3117
+ ' "source_metadata": { "auto_review_trace": "<optional trace from manual_review_handoff.auto_review_trace>" },',
2381
3118
  ' "ai_summary": { "summary": "<batch overview>" },',
2382
3119
  ' "presentation_snapshot": {',
2383
3120
  ' "project": { "id": 1, "name": "<project name>" },',
@@ -2465,7 +3202,7 @@ var agentReviewSubmitToPage = createAnalysisMetaCapabilityCommand({
2465
3202
  postProcess: (result, _input, ctx) => normalizeSubmitResult(result, resolvePublicWebHost(ctx.host()), ctx.host())
2466
3203
  });
2467
3204
  function validateInput(input) {
2468
- const items = array(input.items, "items").map((value) => {
3205
+ const items = array2(input.items, "items").map((value) => {
2469
3206
  const item = object(value, "items[]");
2470
3207
  fields(item, [
2471
3208
  "client_item_id",
@@ -2512,6 +3249,7 @@ function validateInput(input) {
2512
3249
  "title",
2513
3250
  "source_run_id",
2514
3251
  "source_task_id",
3252
+ "source_metadata",
2515
3253
  "ai_summary",
2516
3254
  "presentation_snapshot",
2517
3255
  "items"
@@ -2581,7 +3319,7 @@ function validateEvidenceLinks(item) {
2581
3319
  const sourceLink = typeof item.source_link === "string" && item.source_link.trim();
2582
3320
  let evidenceLink = false;
2583
3321
  if ("evidence_links" in item) {
2584
- evidenceLink = array(item.evidence_links, "items[].evidence_links").some((value) => {
3322
+ evidenceLink = array2(item.evidence_links, "items[].evidence_links").some((value) => {
2585
3323
  const link = object(value, "items[].evidence_links[]");
2586
3324
  return typeof link.url === "string" && !!link.url.trim();
2587
3325
  });
@@ -2592,17 +3330,17 @@ function validateEvidenceLinks(item) {
2592
3330
  }
2593
3331
  function validatePresentation(presentation, itemIds) {
2594
3332
  const displayed = /* @__PURE__ */ new Set();
2595
- for (const topicValue of array(presentation.topics, "presentation_snapshot.topics")) {
3333
+ for (const topicValue of array2(presentation.topics, "presentation_snapshot.topics")) {
2596
3334
  const topic = object(topicValue, "presentation_snapshot.topics[]");
2597
3335
  if ("items" in topic) {
2598
3336
  throw new Error("presentation_snapshot.topics[] must use groups[].items, not top-level items.");
2599
3337
  }
2600
- for (const groupValue of array(topic.groups, "presentation_snapshot.topics[].groups")) {
3338
+ for (const groupValue of array2(topic.groups, "presentation_snapshot.topics[].groups")) {
2601
3339
  const group = object(groupValue, "presentation_snapshot.topics[].groups[]");
2602
3340
  if (typeof group.id !== "string" || !group.id.trim() || typeof group.name !== "string" || !group.name.trim()) {
2603
3341
  throw new Error("presentation_snapshot.topics[].groups[] requires nonempty string id and name.");
2604
3342
  }
2605
- for (const itemValue of array(group.items, "presentation_snapshot.topics[].groups[].items")) {
3343
+ for (const itemValue of array2(group.items, "presentation_snapshot.topics[].groups[].items")) {
2606
3344
  const item = object(itemValue, "presentation_snapshot.topics[].groups[].items[]");
2607
3345
  if (typeof item.id !== "string" || !item.id.trim()) {
2608
3346
  throw new Error("presentation_snapshot display items require nonempty string id.");
@@ -2649,7 +3387,7 @@ var agentReviewReview = createAnalysisMetaCapabilityCommand({
2649
3387
  { name: "decisions", type: "json", required: true, desc: "Versioned decisions: item_id (string), version (integer), decision APPROVE/DEFER/REJECT, reason (required for DEFER/REJECT)." }
2650
3388
  ],
2651
3389
  buildInput: (ctx) => {
2652
- const decisions = array(ctx.json("decisions"), "--decisions").map((value) => {
3390
+ const decisions = array2(ctx.json("decisions"), "--decisions").map((value) => {
2653
3391
  const decision = object(value, "decisions[]");
2654
3392
  fields(decision, ["item_id", "version", "decision", "reason"], "decisions[]");
2655
3393
  decimalId(decision.item_id, "decisions[].item_id");
@@ -2686,7 +3424,7 @@ var agentReviewRetry = createAnalysisMetaCapabilityCommand({
2686
3424
  { name: "item-ids", type: "json", required: true, desc: "1 to 5000 failed item IDs as decimal strings. Successful items must not be retried." }
2687
3425
  ],
2688
3426
  buildInput: (ctx) => {
2689
- const ids = array(ctx.json("item-ids"), "--item-ids").map((id) => decimalId(id, "item_ids[]"));
3427
+ const ids = array2(ctx.json("item-ids"), "--item-ids").map((id) => decimalId(id, "item_ids[]"));
2690
3428
  unique(ids, "item_ids");
2691
3429
  return { ...batchInput(ctx), client_request_id: text(ctx, "client-request-id"), item_ids: ids };
2692
3430
  }
@@ -2770,9 +3508,9 @@ var analysisMetaAssetUsageList = createAnalysisGovernanceCapabilityCommand({
2770
3508
  command: "list",
2771
3509
  capabilityId: "governance.asset.list",
2772
3510
  description: "List assets for usage governance.",
2773
- flags: [projectIdFlag, queryFlag, searchsFlag, ruleFlag, operationTypeFlag, directoryLimitFlag, directoryOffsetFlag, payloadFlag],
3511
+ flags: [projectIdFlag, nodeIdFlag, queryFlag, searchsFlag, ruleFlag, operationTypeFlag, directoryLimitFlag, directoryOffsetFlag, payloadFlag],
2774
3512
  risk: "read",
2775
- buildInput: (ctx) => assetGovernanceInput(ctx, ["query", "searchs", "rule", "operation_type", "limit", "offset"])
3513
+ buildInput: (ctx) => assetGovernanceInput(ctx, ["node_id", "query", "searchs", "rule", "operation_type", "limit", "offset"])
2776
3514
  });
2777
3515
 
2778
3516
  // src/commands/te-analysis/meta/asset/usage-export.ts
@@ -2780,10 +3518,11 @@ var analysisMetaAssetUsageExport = createAnalysisGovernanceCapabilityCommand({
2780
3518
  resource: "asset",
2781
3519
  command: "export",
2782
3520
  capabilityId: "governance.asset.export",
2783
- description: "Export asset usage governance rows as an inline gateway result.",
2784
- flags: [projectIdFlag, queryFlag, searchsFlag, ruleFlag, operationTypeFlag, limitFlag, offsetFlag, payloadFlag],
3521
+ description: "Export asset usage governance rows as an asynchronous artifact; optionally wait and download.",
3522
+ flags: [projectIdFlag, nodeIdFlag, queryFlag, searchsFlag, ruleFlag, operationTypeFlag, limitFlag, offsetFlag, payloadFlag, ...governanceExportFlags("jsonl")],
2785
3523
  risk: "read",
2786
- buildInput: (ctx) => assetGovernanceInput(ctx, ["query", "searchs", "rule", "operation_type", "limit", "offset"])
3524
+ asyncArtifact: true,
3525
+ buildInput: (ctx) => assetGovernanceInput(ctx, [...governanceExportFields, "node_id", "query", "searchs", "rule", "operation_type", "limit", "offset"])
2787
3526
  });
2788
3527
 
2789
3528
  // src/commands/te-analysis/meta/asset/lineage-get.ts
@@ -2891,9 +3630,10 @@ var analysisMetaAssetBatchInfoExport = createAnalysisGovernanceCapabilityCommand
2891
3630
  command: "batch-info-export",
2892
3631
  capabilityId: "governance.asset.batch_export_info",
2893
3632
  description: "Batch export asset information.",
2894
- flags: [projectIdFlag, nodeIdsFlag, payloadFlag],
3633
+ flags: [projectIdFlag, nodeIdsFlag, payloadFlag, ...governanceExportFlags("xlsx")],
2895
3634
  risk: "read",
2896
- buildInput: (ctx) => assetGovernanceInput(ctx, ["node_ids"])
3635
+ asyncArtifact: true,
3636
+ buildInput: (ctx) => assetGovernanceInput(ctx, [...governanceExportFields, "node_ids"])
2897
3637
  });
2898
3638
 
2899
3639
  // src/commands/te-analysis/meta/asset/batch-sql-export.ts
@@ -2902,9 +3642,10 @@ var analysisMetaAssetBatchSqlExport = createAnalysisGovernanceCapabilityCommand(
2902
3642
  command: "batch-sql-export",
2903
3643
  capabilityId: "governance.asset.batch_export_sql",
2904
3644
  description: "Batch export asset SQL definitions.",
2905
- flags: [projectIdFlag, nodeIdsFlag, payloadFlag],
3645
+ flags: [projectIdFlag, nodeIdsFlag, payloadFlag, ...governanceExportFlags("xlsx")],
2906
3646
  risk: "read",
2907
- buildInput: (ctx) => assetGovernanceInput(ctx, ["node_ids"])
3647
+ asyncArtifact: true,
3648
+ buildInput: (ctx) => assetGovernanceInput(ctx, [...governanceExportFields, "node_ids"])
2908
3649
  });
2909
3650
 
2910
3651
  // src/commands/te-analysis/meta/asset/batch-delete.ts
@@ -2979,9 +3720,10 @@ var analysisMetaAssetOperationRecordExport = createAnalysisGovernanceCapabilityC
2979
3720
  command: "export",
2980
3721
  capabilityId: "governance.operation_record.export",
2981
3722
  description: "Export one asset batch operation record result.",
2982
- flags: [projectIdFlag, recordIdFlag, payloadFlag],
3723
+ flags: [projectIdFlag, recordIdFlag, payloadFlag, ...governanceExportFlags("xlsx")],
2983
3724
  risk: "read",
2984
- buildInput: (ctx) => assetGovernanceInput(ctx, ["record_id"])
3725
+ asyncArtifact: true,
3726
+ buildInput: (ctx) => assetGovernanceInput(ctx, [...governanceExportFields, "record_id"])
2985
3727
  });
2986
3728
 
2987
3729
  // src/commands/te-analysis/governance/asset-authentication-shared.ts
@@ -3359,7 +4101,7 @@ var reportList = createAnalysisCapabilityCommand({
3359
4101
  resource: "report",
3360
4102
  command: "list",
3361
4103
  capabilityId: "analysis.report.list",
3362
- description: "List analysis reports visible to the current user through the capability gateway.",
4104
+ description: "List analysis reports the current user can edit or manage. Read-only reports are excluded; use analysis asset search for readable asset discovery.",
3363
4105
  flags: [
3364
4106
  projectIdFlag,
3365
4107
  queriesFlag,
@@ -3408,7 +4150,7 @@ var reportGet = createAnalysisCapabilityCommand({
3408
4150
  resource: "report",
3409
4151
  command: "get",
3410
4152
  capabilityId: "analysis.report.get",
3411
- description: "Get one analysis report definition as AI QP without executing report data.",
4153
+ description: "Get one analysis report definition and event-report presentation without executing report data.",
3412
4154
  flags: [projectIdFlag, { name: "report-id", type: "number", required: true, desc: "Report ID." }],
3413
4155
  risk: "read",
3414
4156
  buildInput: (ctx) => ({
@@ -3428,18 +4170,19 @@ var AI_MODEL_TYPE_VALUES = [
3428
4170
  "path",
3429
4171
  "prop_analysis",
3430
4172
  "sql",
4173
+ "session",
3431
4174
  "heat_map",
3432
4175
  "rank_list",
3433
4176
  "revenue"
3434
4177
  ];
3435
- var AI_MODEL_DESCRIPTION = "Supported AI-facing model_type values, 12 total. 9 common models: event (event analysis), retention (retention analysis), funnel (funnel conversion), distribution (distribution analysis), attribution (attribution analysis), interval (interval analysis), path (path analysis), prop_analysis (property analysis), sql (SQL analysis). 3 scenario models: heat_map (heat map analysis), rank_list (ranking analysis), revenue (revenue analysis). Tags and cohorts/clusters are separate capabilities and are not ad-hoc model_type values.";
4178
+ var AI_MODEL_DESCRIPTION = "Supported AI-facing model_type values, 13 total. 10 common models: event (event analysis), retention (retention analysis), funnel (funnel conversion), distribution (distribution analysis), attribution (attribution analysis), interval (interval analysis), path (path analysis), prop_analysis (property analysis), sql (SQL analysis), session (session analysis). 3 scenario models: heat_map (heat map analysis), rank_list (ranking analysis), revenue (revenue analysis). Tags and cohorts/clusters are separate capabilities and are not ad-hoc model_type values.";
3436
4179
  var REPORT_WRITE_MODEL_TYPE_VALUES = [
3437
4180
  ...AI_MODEL_TYPE_VALUES,
3438
4181
  "tag"
3439
4182
  ];
3440
4183
  var REPORT_WRITE_MODEL_DESCRIPTION = `${AI_MODEL_DESCRIPTION} Report create/update also supports tag for saved tag report data; use tag as the AI-facing spelling.`;
3441
- var AI_DEFINITION_DESCRIPTION = 'Event metrics: omit optional display_name unless the target command schema explicitly supports it. Funnel step filters use event_property_name (not field) and string-array values, including "true"/"false" for boolean properties. For tag/cluster filters, cluster_date_policy accepts LATEST (default), AUTO (match the computed result for each analysis date), or SPECIFIED (requires specified_cluster_date in yyyy-MM-dd format). AI-facing model definition JSON. Do not pass raw QP, events, event_view, visual_view, or analysis_query. Distribution filters must be attached to the corresponding distribution_metrics[].filters; do not use top-level filters or relation. For path definitions, global filters support user_property, cluster, and tag only; event_property is not supported. session_unit accepts second (1..999), minute (1..999), or hour (1..24). Do not use day; express one day as session_interval=24 and session_unit=hour. For SQL, a simple query is {"sql":"select ..."}; raw variables use ${name}, while typed params use ${Text:name}, ${Selector:name}, or ${PartDate:name}. PartDate expands to a complete predicate, so write WHERE ${PartDate:d}, not a column followed by the placeholder. A part_date parameter may set boolean use_timezone; it defaults to false and controls whether that parameter uses the query effective timezone. Selector value must match one options[].value. Trino identifiers containing #, $, @, spaces, punctuation, or a reserved word must be delimited with double quotes, for example SELECT "#user_id", "$part_event", "end" FROM ...; single quotes are string literals. For multiline SQL JSON, the decoded sql value must contain a real line break; do not submit a literal \\n sequence outside quoted SQL text. Queries against an event table must include a date-partition predicate on the quoted "$part_date" column, for example WHERE "$part_date" BETWEEN \'2026-07-01\' AND \'2026-07-07\'; the backend rejects event-table SQL without it. The CLI preserves SQL text and never auto-quotes identifiers.';
3442
- var REPORT_WRITE_DEFINITION_DESCRIPTION = `${AI_DEFINITION_DESCRIPTION} For model_type=tag, pass a tag report intent such as {"tag":{"tag_name":"vip_users","time_range":{"mode":"recent","unit":"day","value":7}}}. Tags are supported for report create/update and report data, not ad-hoc analysis.`;
4184
+ var AI_DEFINITION_DESCRIPTION = 'Event metrics: omit optional display_name unless the target command schema explicitly supports it. Funnel step filters use event_property_name (not field) and string-array values, including "true"/"false" for boolean properties. For tag/cluster filters, cluster_date_policy accepts LATEST (default), AUTO (match the computed result for each analysis date), or SPECIFIED (requires specified_cluster_date in yyyy-MM-dd format). AI-facing model definition JSON. Do not pass raw QP, events, event_view, visual_view, or analysis_query. Distribution filters must be attached to the corresponding distribution_metrics[].filters; do not use top-level filters or relation. For path definitions, global filters support user_property, cluster, and tag only; event_property is not supported. session_unit accepts second (1..999), minute (1..999), or hour (1..24). Do not use day; express one day as session_interval=24 and session_unit=hour. Session analysis is a different model: it cuts sessions with session_interval plus interval_unit (second and minute 1..999, hour 1..24), required unless cut_mode=session_id, and its metrics must match view_mode. For SQL, a simple query is {"sql":"select ..."}; raw variables use ${name}, while typed params use ${Text:name}, ${Selector:name}, or ${PartDate:name}. PartDate expands to a complete predicate, so write WHERE ${PartDate:d}, not a column followed by the placeholder. A part_date parameter may set boolean use_timezone; it defaults to false and controls whether that parameter uses the query effective timezone. Selector value must match one options[].value. Trino identifiers containing #, $, @, spaces, punctuation, or a reserved word must be delimited with double quotes, for example SELECT "#user_id", "$part_event", "end" FROM ...; single quotes are string literals. For multiline SQL JSON, the decoded sql value must contain a real line break; do not submit a literal \\n sequence outside quoted SQL text. Queries against an event table must include a date-partition predicate on the quoted "$part_date" column, for example WHERE "$part_date" BETWEEN \'2026-07-01\' AND \'2026-07-07\'; the backend rejects event-table SQL without it. The CLI preserves SQL text and never auto-quotes identifiers.';
4185
+ var REPORT_WRITE_DEFINITION_DESCRIPTION = `${AI_DEFINITION_DESCRIPTION} Saved funnel definitions may set optional funnel.steps[].display_name; report get returns it and report create/update preserves it. Saved-report filters may contain one compound group level only; every item inside that group must be a leaf without another items array. Historical deeper trees remain readable but cannot be written back as a definition. For model_type=tag, pass a tag report intent such as {"tag":{"tag_name":"vip_users","time_range":{"mode":"recent","unit":"day","value":7}}}. Tags are supported for report create/update and report data, not ad-hoc analysis.`;
3443
4186
  function aiModelTypeFlag(required) {
3444
4187
  return {
3445
4188
  name: "model-type",
@@ -3453,18 +4196,32 @@ function validateFunnelStepFilters(modelType, definition) {
3453
4196
  const steps = definition.funnel.steps;
3454
4197
  if (!Array.isArray(steps)) return;
3455
4198
  const errors = [];
3456
- steps.forEach((step, stepIndex) => {
3457
- if (!isRecord(step) || !Array.isArray(step.filters)) return;
3458
- step.filters.forEach((filter, filterIndex) => {
3459
- if (!isRecord(filter)) return;
3460
- const location = `definition.funnel.steps[${stepIndex}].filters[${filterIndex}]`;
3461
- if ("field" in filter || typeof filter.event_property_name !== "string" || !filter.event_property_name.trim()) {
3462
- errors.push(`${location}: use a non-empty event_property_name, not a generic field object.`);
4199
+ const visit = (filter, location) => {
4200
+ if (!isRecord(filter)) {
4201
+ errors.push(`${location}: use a filter object.`);
4202
+ return;
4203
+ }
4204
+ if ("items" in filter) {
4205
+ if (Object.keys(filter).some((key) => key !== "items" && key !== "relation")) {
4206
+ errors.push(`${location}: compound groups contain only items and relation; put event_property_name and operator on their leaf items.`);
3463
4207
  }
3464
- if ("values" in filter && (!Array.isArray(filter.values) || filter.values.some((value) => typeof value !== "string"))) {
3465
- errors.push(`${location}.values: use an array of strings (boolean properties use "true" or "false").`);
4208
+ if (!Array.isArray(filter.items) || filter.items.length === 0) {
4209
+ errors.push(`${location}.items: use a non-empty array of event-property filters or nested groups.`);
4210
+ } else {
4211
+ filter.items.forEach((item, index) => visit(item, `${location}.items[${index}]`));
3466
4212
  }
3467
- });
4213
+ return;
4214
+ }
4215
+ if ("field" in filter || typeof filter.event_property_name !== "string" || !filter.event_property_name.trim()) {
4216
+ errors.push(`${location}: use a non-empty event_property_name, not a generic field object.`);
4217
+ }
4218
+ if ("values" in filter && (!Array.isArray(filter.values) || filter.values.some((value) => typeof value !== "string"))) {
4219
+ errors.push(`${location}.values: use an array of strings (boolean properties use "true" or "false").`);
4220
+ }
4221
+ };
4222
+ steps.forEach((step, stepIndex) => {
4223
+ if (!isRecord(step) || !Array.isArray(step.filters)) return;
4224
+ step.filters.forEach((filter, filterIndex) => visit(filter, `definition.funnel.steps[${stepIndex}].filters[${filterIndex}]`));
3468
4225
  });
3469
4226
  if (errors.length) {
3470
4227
  throw new CliValidationError(errors.join("\n"), {
@@ -3516,6 +4273,61 @@ function validateReportMetadataResolutions(ctx) {
3516
4273
  }
3517
4274
  }
3518
4275
 
4276
+ // src/commands/te-analysis/report/presentation.ts
4277
+ var reportPresentationFlag = {
4278
+ name: "presentation",
4279
+ type: "json",
4280
+ required: false,
4281
+ desc: 'Optional top-level event-report display JSON: chart_type (line|combo|bar|stacked|cumulative|pie), table_layout (date|event|group), series [{metric_index:1,type:"bar"|"line",axis:"primary"|"secondary"}]. Line/combo/cumulative require a non-total time_particle_size. Metric indexes are 1-based definition.metrics positions. Series is a subset patch; [] resets all series, and chart_type=line resets to pure primary-axis lines. Omit to preserve the saved chart/result-table layout on same-model updates. For a dashboard table card use analysis dashboard-report update --chart-type table.'
4282
+ };
4283
+ function validateReportPresentation(ctx) {
4284
+ if (!(ctx.has?.("presentation") ?? ctx.str("presentation") !== "")) return;
4285
+ const value = ctx.json("presentation");
4286
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
4287
+ throw new Error("--presentation must be a non-empty event-report display object.");
4288
+ }
4289
+ const presentation = value;
4290
+ const keys = Object.keys(presentation);
4291
+ if (keys.length === 0 || keys.some((key) => !["chart_type", "table_layout", "series"].includes(key))) {
4292
+ throw new Error("--presentation accepts only chart_type, table_layout, and series; use semantic names, not raw QP fields.");
4293
+ }
4294
+ if (presentation.chart_type === "table") {
4295
+ throw new Error("A table is a dashboard card display; use analysis dashboard-report update --chart-type table.");
4296
+ }
4297
+ if (Object.hasOwn(presentation, "chart_type") && (typeof presentation.chart_type !== "string" || !["line", "combo", "bar", "stacked", "cumulative", "pie"].includes(presentation.chart_type))) {
4298
+ throw new Error("--presentation.chart_type must be line, combo, bar, stacked, cumulative, or pie.");
4299
+ }
4300
+ if (Object.hasOwn(presentation, "table_layout") && (typeof presentation.table_layout !== "string" || !["date", "event", "group"].includes(presentation.table_layout))) {
4301
+ throw new Error("--presentation.table_layout must be date, event, or group.");
4302
+ }
4303
+ if (ctx.str("model-type") !== "" && ctx.str("model-type") !== "event") {
4304
+ throw new Error("--presentation is supported only for event reports.");
4305
+ }
4306
+ if (Object.hasOwn(presentation, "series")) validateSeries(presentation.series);
4307
+ }
4308
+ function validateSeries(value) {
4309
+ if (!Array.isArray(value)) throw new Error("--presentation.series must be an array; [] resets all series.");
4310
+ const indexes = /* @__PURE__ */ new Set();
4311
+ for (const [position, item] of value.entries()) {
4312
+ const path = `--presentation.series[${position}]`;
4313
+ if (!item || typeof item !== "object" || Array.isArray(item) || Object.keys(item).length !== 3 || Object.keys(item).some((key) => !["metric_index", "type", "axis"].includes(key))) {
4314
+ throw new Error(`${path} requires only metric_index, type, and axis, all three required.`);
4315
+ }
4316
+ const series = item;
4317
+ if (typeof series.metric_index !== "number" || !Number.isInteger(series.metric_index) || series.metric_index < 1) {
4318
+ throw new Error(`${path}.metric_index must be a positive 1-based integer position in definition.metrics.`);
4319
+ }
4320
+ if (indexes.has(series.metric_index)) throw new Error(`${path}.metric_index must not repeat another series binding.`);
4321
+ indexes.add(series.metric_index);
4322
+ if (typeof series.type !== "string" || !["bar", "line"].includes(series.type)) {
4323
+ throw new Error(`${path}.type must be bar or line.`);
4324
+ }
4325
+ if (typeof series.axis !== "string" || !["primary", "secondary"].includes(series.axis)) {
4326
+ throw new Error(`${path}.axis must be primary or secondary.`);
4327
+ }
4328
+ }
4329
+ }
4330
+
3519
4331
  // src/commands/te-analysis/report/create.ts
3520
4332
  var reportCreate = createAnalysisCapabilityCommand({
3521
4333
  resource: "report",
@@ -3527,6 +4339,7 @@ var reportCreate = createAnalysisCapabilityCommand({
3527
4339
  { name: "report-name", type: "string", required: true, desc: "Report display name." },
3528
4340
  reportWriteModelTypeFlag(true),
3529
4341
  reportWriteDefinitionFlag(true),
4342
+ reportPresentationFlag,
3530
4343
  modelDefinitionIntentSnapshotFlag,
3531
4344
  reportMetadataResolutionsFlag,
3532
4345
  { name: "report-desc", type: "string", required: false, desc: "Optional report description." },
@@ -3535,15 +4348,19 @@ var reportCreate = createAnalysisCapabilityCommand({
3535
4348
  { name: "dashboard-ids", type: "json", required: false, desc: "Optional dashboard ID array to associate after creation." }
3536
4349
  ],
3537
4350
  risk: "write",
3538
- validate: validateReportMetadataResolutions,
4351
+ validate: (ctx) => {
4352
+ validateReportMetadataResolutions(ctx);
4353
+ validateReportPresentation(ctx);
4354
+ },
3539
4355
  intentConsistency: { definitionFlag: "definition", modelTypeFlag: "model-type" },
3540
4356
  buildInput: (ctx) => compactInput({
3541
4357
  ...projectInput(ctx),
3542
4358
  report_name: ctx.str("report-name"),
3543
4359
  model_type: ctx.str("model-type"),
3544
4360
  definition: ctx.json("definition"),
4361
+ presentation: optionalJson(ctx, "presentation"),
3545
4362
  resolutions: optionalJson(ctx, "resolutions"),
3546
- report_desc: optionalString(ctx, "report-desc"),
4363
+ report_desc: optionalString(ctx, "report-desc") ?? "",
3547
4364
  cache_seconds: optionalNumber(ctx, "cache-seconds"),
3548
4365
  query_duration_ms: optionalNumber(ctx, "query-duration-ms"),
3549
4366
  dashboard_ids: optionalJsonArray(ctx, "dashboard-ids")
@@ -3554,9 +4371,10 @@ var reportCreate = createAnalysisCapabilityCommand({
3554
4371
  function validateReportUpdate(ctx) {
3555
4372
  const hasDefinition = ctx.str("definition") !== "";
3556
4373
  const hasResolutions = ctx.json("resolutions") !== void 0;
3557
- const hasMetadataUpdate = ctx.str("report-name") !== "" || ctx.str("report-desc") !== "";
3558
- if (!hasDefinition && !hasMetadataUpdate) {
3559
- throw new Error("At least one of --report-name, --report-desc, or --definition is required.");
4374
+ const hasPresentation = ctx.has?.("presentation") ?? ctx.str("presentation") !== "";
4375
+ const hasMetadataUpdate = ctx.str("report-name") !== "" || optionalStringPreserveEmpty(ctx, "report-desc") !== void 0;
4376
+ if (!hasDefinition && !hasMetadataUpdate && !hasPresentation) {
4377
+ throw new Error("At least one of --report-name, --report-desc, --definition, or --presentation is required.");
3560
4378
  }
3561
4379
  if (hasDefinition && ctx.str("model-type") === "") {
3562
4380
  throw new Error("--model-type is required when --definition is provided.");
@@ -3565,20 +4383,22 @@ function validateReportUpdate(ctx) {
3565
4383
  throw new Error("--resolutions requires --definition.");
3566
4384
  }
3567
4385
  validateReportMetadataResolutions(ctx);
4386
+ validateReportPresentation(ctx);
3568
4387
  }
3569
4388
  var reportUpdate = createAnalysisCapabilityCommand({
3570
4389
  resource: "report",
3571
4390
  command: "update",
3572
4391
  capabilityId: "analysis.report.update",
3573
- description: "Update report metadata or AI QP definition through the capability gateway.",
4392
+ description: "Update report metadata, AI QP definition, or event-report presentation through the capability gateway.",
3574
4393
  flags: [
3575
4394
  projectIdFlag,
3576
4395
  { name: "report-id", type: "number", required: true, desc: "Report ID to update." },
3577
4396
  { name: "report-version", type: "number", required: true, desc: "Current report version from report get." },
3578
4397
  { name: "report-name", type: "string", required: false, desc: "New report display name." },
3579
- { name: "report-desc", type: "string", required: false, desc: "New report description." },
4398
+ { name: "report-desc", type: "string", required: false, desc: "New report description. Pass an empty string to clear it; omit to preserve it." },
3580
4399
  reportWriteModelTypeFlag(false),
3581
4400
  reportWriteDefinitionFlag(false),
4401
+ reportPresentationFlag,
3582
4402
  modelDefinitionIntentSnapshotFlag,
3583
4403
  reportMetadataResolutionsFlag,
3584
4404
  { name: "cache-seconds", type: "number", required: false, desc: "Optional cache duration in seconds." },
@@ -3592,9 +4412,10 @@ var reportUpdate = createAnalysisCapabilityCommand({
3592
4412
  report_id: ctx.num("report-id"),
3593
4413
  version: ctx.num("report-version"),
3594
4414
  report_name: optionalString(ctx, "report-name"),
3595
- report_desc: optionalString(ctx, "report-desc"),
4415
+ report_desc: optionalStringPreserveEmpty(ctx, "report-desc"),
3596
4416
  model_type: optionalString(ctx, "model-type"),
3597
4417
  definition: optionalJson(ctx, "definition"),
4418
+ presentation: optionalJson(ctx, "presentation"),
3598
4419
  resolutions: optionalJson(ctx, "resolutions"),
3599
4420
  cache_seconds: optionalNumber(ctx, "cache-seconds"),
3600
4421
  query_duration_ms: optionalNumber(ctx, "query-duration-ms")
@@ -3841,7 +4662,7 @@ var dashboardList = createAnalysisCapabilityCommand({
3841
4662
  resource: "dashboard",
3842
4663
  command: "list",
3843
4664
  capabilityId: "analysis.dashboard.list",
3844
- description: "List dashboards visible to the current user through the capability gateway.",
4665
+ description: "List dashboards the current user can update or manage. Read-only dashboards are excluded; use analysis asset search for readable asset discovery.",
3845
4666
  flags: [
3846
4667
  projectIdFlag,
3847
4668
  queriesFlag,
@@ -4044,6 +4865,42 @@ var dashboardCopy = createAnalysisCapabilityCommand({
4044
4865
  })
4045
4866
  });
4046
4867
 
4868
+ // src/commands/te-analysis/dashboard/move.ts
4869
+ var dashboardMove = createAnalysisCapabilityCommand({
4870
+ resource: "dashboard",
4871
+ command: "move",
4872
+ capabilityId: "analysis.dashboard.move",
4873
+ description: "Move one or more dashboards to the same project-space root or folder.",
4874
+ flags: [
4875
+ projectIdFlag,
4876
+ {
4877
+ name: "dashboard-ids",
4878
+ type: "json",
4879
+ required: true,
4880
+ desc: "Dashboard ID array. Pass a one-item array to move a single dashboard."
4881
+ },
4882
+ {
4883
+ name: "to-space-id",
4884
+ type: "number",
4885
+ required: true,
4886
+ desc: "Target project space ID."
4887
+ },
4888
+ {
4889
+ name: "to-folder-id",
4890
+ type: "number",
4891
+ required: false,
4892
+ desc: "Target folder ID within the target project space. Omit to move to the space root."
4893
+ }
4894
+ ],
4895
+ risk: "write",
4896
+ buildInput: (ctx) => compactInput({
4897
+ ...projectInput(ctx),
4898
+ dashboard_ids: jsonArray(ctx, "dashboard-ids"),
4899
+ to_space_id: ctx.num("to-space-id"),
4900
+ to_folder_id: optionalNumber(ctx, "to-folder-id")
4901
+ })
4902
+ });
4903
+
4047
4904
  // src/commands/te-analysis/dashboard/freeze.ts
4048
4905
  var dashboardFreeze = createAnalysisCapabilityCommand({
4049
4906
  resource: "dashboard",
@@ -4102,6 +4959,7 @@ var commands19 = [
4102
4959
  dashboardDelete,
4103
4960
  dashboardHandover,
4104
4961
  dashboardCopy,
4962
+ dashboardMove,
4105
4963
  dashboardFreeze,
4106
4964
  dashboardAbnormalGet,
4107
4965
  dashboardTaskStatus
@@ -4127,9 +4985,71 @@ var dashboardReportAdd = createAnalysisCapabilityCommand({
4127
4985
  })
4128
4986
  });
4129
4987
 
4988
+ // src/commands/te-analysis/dashboard-report/get.ts
4989
+ var dashboardReportGet = createAnalysisCapabilityCommand({
4990
+ resource: "dashboard-report",
4991
+ command: "get",
4992
+ capabilityId: "analysis.dashboard_report.get",
4993
+ description: "Get an event report card presentation on one analysis dashboard, not the source report definition.",
4994
+ flags: [
4995
+ projectIdFlag,
4996
+ { name: "dashboard-id", type: "number", required: true, desc: "Dashboard containing the report card." },
4997
+ { name: "report-id", type: "number", required: true, desc: "Existing event report ID on that dashboard." }
4998
+ ],
4999
+ risk: "read",
5000
+ buildInput: (ctx) => ({
5001
+ ...projectInput(ctx),
5002
+ dashboard_id: ctx.num("dashboard-id"),
5003
+ report_id: ctx.num("report-id")
5004
+ })
5005
+ });
5006
+
5007
+ // src/commands/te-analysis/dashboard-report/update.ts
5008
+ var dashboardReportUpdate = createAnalysisCapabilityCommand({
5009
+ resource: "dashboard-report",
5010
+ command: "update",
5011
+ capabilityId: "analysis.dashboard_report.update",
5012
+ description: "Update one event report card presentation without changing the source report definition or other dashboards.",
5013
+ flags: [
5014
+ projectIdFlag,
5015
+ { name: "dashboard-id", type: "number", required: true, desc: "Dashboard containing the report card." },
5016
+ { name: "report-id", type: "number", required: true, desc: "Existing event report ID on that dashboard." },
5017
+ { name: "chart-type", type: "string", required: false, desc: "Card chart type: line, combo, bar, stacked, cumulative, pie, or table. Combo inherits existing source-report series; this command cannot edit series. A pure line card requires resetting source combo first. Gateway validates compatibility with the saved event definition." },
5018
+ { name: "table-layout", type: "string", required: false, desc: "Table layout: date, event, or group. Omit to preserve it." },
5019
+ { name: "date-outside", type: "boolean", required: false, desc: "Show dates outside the table. True requires a grouped table with a non-date layout; also choose event/group layout when inherited. Pass false to clear, omit to preserve." }
5020
+ ],
5021
+ risk: "write",
5022
+ validate: (ctx) => {
5023
+ const chartType = optionalString(ctx, "chart-type");
5024
+ const tableLayout = optionalString(ctx, "table-layout");
5025
+ const dateOutside = optionalBoolean(ctx, "date-outside");
5026
+ if (chartType === void 0 && tableLayout === void 0 && dateOutside === void 0) {
5027
+ throw new Error("At least one of --chart-type, --table-layout, or --date-outside is required.");
5028
+ }
5029
+ if (chartType !== void 0 && !["line", "combo", "bar", "stacked", "cumulative", "pie", "table"].includes(chartType)) {
5030
+ throw new Error("--chart-type must be line, combo, bar, stacked, cumulative, pie, or table.");
5031
+ }
5032
+ if (tableLayout !== void 0 && !["date", "event", "group"].includes(tableLayout)) {
5033
+ throw new Error("--table-layout must be date, event, or group.");
5034
+ }
5035
+ },
5036
+ buildInput: (ctx) => ({
5037
+ ...projectInput(ctx),
5038
+ dashboard_id: ctx.num("dashboard-id"),
5039
+ report_id: ctx.num("report-id"),
5040
+ presentation: compactInput({
5041
+ chart_type: optionalString(ctx, "chart-type"),
5042
+ table_layout: optionalString(ctx, "table-layout"),
5043
+ date_outside: optionalBoolean(ctx, "date-outside")
5044
+ })
5045
+ })
5046
+ });
5047
+
4130
5048
  // src/commands/te-analysis/dashboard-report/index.ts
4131
5049
  var commands20 = [
4132
- dashboardReportAdd
5050
+ dashboardReportAdd,
5051
+ dashboardReportGet,
5052
+ dashboardReportUpdate
4133
5053
  ];
4134
5054
  var dashboard_report_default = commands20;
4135
5055
 
@@ -4176,14 +5096,13 @@ var dashboardReportDataExport = createAnalysisCapabilityCommand({
4176
5096
  clusterQueryScopeFlag,
4177
5097
  slaveClusterIdFlag,
4178
5098
  { name: "zone-offset", type: "number", required: false, desc: reportDataZoneOffsetDescription },
4179
- { name: "use-cache", type: "boolean", required: false, desc: "Whether to use cache. Default: true." },
4180
5099
  { name: "request-id", type: "string", required: false, desc: "Optional cli_<32 lowercase hex> request ID. Generated when omitted." },
4181
5100
  asyncTimeoutSecondsFlag,
4182
5101
  { name: "artifact-format", type: "string", required: false, desc: "Artifact format. Only jsonl is supported." }
4183
5102
  ],
4184
5103
  risk: "read",
4185
5104
  validate: validateClusterQueryRouting,
4186
- buildInput: dashboardReportDataInput
5105
+ buildInput: (ctx) => dashboardReportDataInput(ctx, false)
4187
5106
  });
4188
5107
 
4189
5108
  // src/commands/te-analysis/dashboard-report-data/index.ts
@@ -4548,7 +5467,7 @@ var adhocRun = createAnalysisCapabilityCommand({
4548
5467
  resource: "adhoc",
4549
5468
  command: "run",
4550
5469
  capabilityId: "analysis.adhoc.run",
4551
- description: `Run one unified ad-hoc analysis from an AI-facing model definition. Supports 12 AI-facing models: 9 common models plus 3 scenario models. Tags and cohorts/clusters are separate capabilities, not ad-hoc model_type values. Returns query_context_id for Redis-backed query follow-ups. ${analysisDataRunRoutingHelp}`,
5470
+ description: `Run one unified ad-hoc analysis from an AI-facing model definition. Supports 13 AI-facing models: 10 common models plus 3 scenario models. Tags and cohorts/clusters are separate capabilities, not ad-hoc model_type values. Returns query_context_id for Redis-backed query follow-ups. ${analysisDataRunRoutingHelp}`,
4552
5471
  flags: [
4553
5472
  ...adhocRunFlags,
4554
5473
  syncTimeoutSecondsFlag
@@ -5797,6 +6716,54 @@ var drilldownUserEventsRun = createAnalysisCapabilityCommand({
5797
6716
  var commands40 = [drilldownUserEventsRun, drilldownUserEventsExport];
5798
6717
  var drilldown_user_events_default = commands40;
5799
6718
 
6719
+ // src/commands/te-analysis/drilldown-session-details/run.ts
6720
+ var queryContextIdFlag3 = {
6721
+ name: "query-context-id",
6722
+ type: "string",
6723
+ required: true,
6724
+ desc: "query_context_id returned by a synchronous session-analysis preview. Analysis exports never create one."
6725
+ };
6726
+ var sessionPreviewRowsFlag = {
6727
+ name: "preview-rows",
6728
+ type: "number",
6729
+ required: false,
6730
+ desc: "Maximum session or step detail rows returned. Default: 100, max: 1000. 1000 is also the backend session-detail ceiling, so a larger population cannot be completed by paging.",
6731
+ min: 1,
6732
+ max: 1e3
6733
+ };
6734
+ var sessionDetailsRoutingHelp = "Routing: --preview-rows bounds returned detail rows; agents should normally pass 100. There is no export variant, so rows beyond the limit are unreachable; narrow the analysis itself and re-run the preview.";
6735
+ var drilldownSessionDetailsRun = createAnalysisCapabilityCommand({
6736
+ resource: "drilldown-session-details",
6737
+ command: "run",
6738
+ capabilityId: "analysis.query.drilldown_session_details",
6739
+ description: `Preview the individual sessions or steps behind one session-analysis session-count or step-count cell. Session-user and step-user columns drill down with analysis drilldown-entities run instead. ${sessionDetailsRoutingHelp}`,
6740
+ flags: [
6741
+ projectIdFlag,
6742
+ queryContextIdFlag3,
6743
+ sourceFlag,
6744
+ coordinateFlag,
6745
+ requestIdFlag,
6746
+ useCacheFlag,
6747
+ sessionPreviewRowsFlag,
6748
+ syncTimeoutSecondsFlag
6749
+ ],
6750
+ risk: "read",
6751
+ buildInput: (ctx) => compactInput({
6752
+ project_id: ctx.num("project-id"),
6753
+ query_context_id: ctx.str("query-context-id"),
6754
+ source: optionalJson(ctx, "source"),
6755
+ coordinate: ctx.json("coordinate"),
6756
+ request_id: optionalString(ctx, "request-id"),
6757
+ use_cache: optionalBoolean(ctx, "use-cache"),
6758
+ preview_rows: optionalNumber(ctx, "preview-rows"),
6759
+ timeout_seconds: optionalNumber(ctx, "timeout-seconds")
6760
+ })
6761
+ });
6762
+
6763
+ // src/commands/te-analysis/drilldown-session-details/index.ts
6764
+ var commands41 = [drilldownSessionDetailsRun];
6765
+ var drilldown_session_details_default = commands41;
6766
+
5800
6767
  // src/commands/te-analysis/user/index.ts
5801
6768
  import { existsSync, statSync as statSync2 } from "fs";
5802
6769
  var authenticatedOnlyFlag = {
@@ -6308,7 +7275,7 @@ var memberExportFlags = [
6308
7275
  memberArtifactFormatFlag,
6309
7276
  asyncTimeoutSecondsFlag
6310
7277
  ];
6311
- var commands41 = [
7278
+ var commands42 = [
6312
7279
  capability(
6313
7280
  "user-cluster",
6314
7281
  "list",
@@ -6563,7 +7530,7 @@ var commands41 = [
6563
7530
  ...memberExportFlags
6564
7531
  ], "read", (ctx) => historyTagDataDrilldownInput(ctx, false), { asyncArtifact: true })
6565
7532
  ];
6566
- var user_default = commands41;
7533
+ var user_default = commands42;
6567
7534
 
6568
7535
  // src/commands/te-analysis/query-cluster/list.ts
6569
7536
  var queryClusterList = createAnalysisCapabilityCommand({
@@ -6577,8 +7544,8 @@ var queryClusterList = createAnalysisCapabilityCommand({
6577
7544
  });
6578
7545
 
6579
7546
  // src/commands/te-analysis/query-cluster/index.ts
6580
- var commands42 = [queryClusterList];
6581
- var query_cluster_default = commands42;
7547
+ var commands43 = [queryClusterList];
7548
+ var query_cluster_default = commands43;
6582
7549
 
6583
7550
  // src/commands/te-analysis/sql-table/columns.ts
6584
7551
  var sqlTableColumns = createAnalysisCapabilityCommand({
@@ -6592,7 +7559,7 @@ var sqlTableColumns = createAnalysisCapabilityCommand({
6592
7559
  name: "table-ref",
6593
7560
  type: "string",
6594
7561
  required: true,
6595
- desc: "Exact table_ref returned by analysis sql-table list; a unique table-only reference is also accepted."
7562
+ desc: "Exact table_ref or quoted sql_reference returned by analysis sql-table list; a unique table-only reference is also accepted."
6596
7563
  },
6597
7564
  sqlTableUsageFlag
6598
7565
  ],
@@ -6609,7 +7576,7 @@ var sqlTableList = createAnalysisCapabilityCommand({
6609
7576
  resource: "sql-table",
6610
7577
  command: "list",
6611
7578
  capabilityId: "analysis.sql_table.list",
6612
- description: "List server-authoritative SQL table references queryable by the current user in a project.",
7579
+ description: "List server-authoritative SQL table references queryable by the current user in a project, including authorized space tables. Use sql_reference when copying a table into SQL.",
6613
7580
  flags: [projectIdFlag, queriesFlag, directoryLimitFlag, directoryOffsetFlag, sqlTableUsageFlag],
6614
7581
  risk: "read",
6615
7582
  validate: validateQueriesFlag,
@@ -6623,8 +7590,8 @@ var sqlTableList = createAnalysisCapabilityCommand({
6623
7590
  });
6624
7591
 
6625
7592
  // src/commands/te-analysis/sql-table/index.ts
6626
- var commands43 = [sqlTableList, sqlTableColumns];
6627
- var sql_table_default = commands43;
7593
+ var commands44 = [sqlTableList, sqlTableColumns];
7594
+ var sql_table_default = commands44;
6628
7595
 
6629
7596
  // src/commands/te-analysis/entity/id-import-options.ts
6630
7597
  var entityIdImportOptions = createAnalysisCapabilityCommand({
@@ -6649,8 +7616,8 @@ var entityIdImportOptions = createAnalysisCapabilityCommand({
6649
7616
  });
6650
7617
 
6651
7618
  // src/commands/te-analysis/entity/index.ts
6652
- var commands44 = [entityIdImportOptions];
6653
- var entity_default = commands44;
7619
+ var commands45 = [entityIdImportOptions];
7620
+ var entity_default = commands45;
6654
7621
 
6655
7622
  // src/commands/te-analysis/input-file/inspect.ts
6656
7623
  var inputFileInspect = {
@@ -6733,8 +7700,8 @@ var inputFileUpload = {
6733
7700
  };
6734
7701
 
6735
7702
  // src/commands/te-analysis/input-file/index.ts
6736
- var commands45 = [inputFileUpload, inputFileInspect, inputFilePurposeList];
6737
- var input_file_default = commands45;
7703
+ var commands46 = [inputFileUpload, inputFileInspect, inputFilePurposeList];
7704
+ var input_file_default = commands46;
6738
7705
 
6739
7706
  // src/commands/te-analysis/project/access-detail/get.ts
6740
7707
  var projectAccessDetailGet = createAnalysisCapabilityCommand({
@@ -6752,10 +7719,10 @@ var projectAccessDetailGet = createAnalysisCapabilityCommand({
6752
7719
  });
6753
7720
 
6754
7721
  // src/commands/te-analysis/project/access-detail/index.ts
6755
- var commands46 = [
7722
+ var commands47 = [
6756
7723
  projectAccessDetailGet
6757
7724
  ];
6758
- var access_detail_default = commands46;
7725
+ var access_detail_default = commands47;
6759
7726
 
6760
7727
  // src/commands/te-analysis/project/data-power/delete.ts
6761
7728
  var projectDataPowerDelete = createAnalysisCapabilityCommand({
@@ -6827,13 +7794,13 @@ var projectDataPowerUpsert = createAnalysisCapabilityCommand({
6827
7794
  });
6828
7795
 
6829
7796
  // src/commands/te-analysis/project/data-power/index.ts
6830
- var commands47 = [
7797
+ var commands48 = [
6831
7798
  projectDataPowerDelete,
6832
7799
  projectDataPowerGet,
6833
7800
  projectDataPowerList,
6834
7801
  projectDataPowerUpsert
6835
7802
  ];
6836
- var data_power_default = commands47;
7803
+ var data_power_default = commands48;
6837
7804
 
6838
7805
  // src/commands/te-analysis/project/entity/create.ts
6839
7806
  var projectEntityCreate = createAnalysisCapabilityCommand({
@@ -6944,14 +7911,14 @@ var projectEntityUpdate = createAnalysisCapabilityCommand({
6944
7911
  });
6945
7912
 
6946
7913
  // src/commands/te-analysis/project/entity/index.ts
6947
- var commands48 = [
7914
+ var commands49 = [
6948
7915
  projectEntityCreate,
6949
7916
  projectEntityDelete,
6950
7917
  projectEntityGet,
6951
7918
  projectEntityList,
6952
7919
  projectEntityUpdate
6953
7920
  ];
6954
- var entity_default2 = commands48;
7921
+ var entity_default2 = commands49;
6955
7922
 
6956
7923
  // src/commands/te-analysis/project/entity-event/list.ts
6957
7924
  var projectEntityEventList = createAnalysisCapabilityCommand({
@@ -6971,10 +7938,10 @@ var projectEntityEventList = createAnalysisCapabilityCommand({
6971
7938
  });
6972
7939
 
6973
7940
  // src/commands/te-analysis/project/entity-event/index.ts
6974
- var commands49 = [
7941
+ var commands50 = [
6975
7942
  projectEntityEventList
6976
7943
  ];
6977
- var entity_event_default = commands49;
7944
+ var entity_event_default = commands50;
6978
7945
 
6979
7946
  // src/commands/te-analysis/project/function/list.ts
6980
7947
  var projectFunctionList = createAnalysisCapabilityCommand({
@@ -6994,10 +7961,10 @@ var projectFunctionList = createAnalysisCapabilityCommand({
6994
7961
  });
6995
7962
 
6996
7963
  // src/commands/te-analysis/project/function/index.ts
6997
- var commands50 = [
7964
+ var commands51 = [
6998
7965
  projectFunctionList
6999
7966
  ];
7000
- var function_default = commands50;
7967
+ var function_default = commands51;
7001
7968
 
7002
7969
  // src/commands/te-analysis/project/info/create.ts
7003
7970
  var projectInfoCreate = createAnalysisCapabilityCommand({
@@ -7092,14 +8059,14 @@ var projectInfoUpdate = createAnalysisCapabilityCommand({
7092
8059
  });
7093
8060
 
7094
8061
  // src/commands/te-analysis/project/info/index.ts
7095
- var commands51 = [
8062
+ var commands52 = [
7096
8063
  projectInfoCreate,
7097
8064
  projectInfoDelete,
7098
8065
  projectInfoGet,
7099
8066
  projectInfoList,
7100
8067
  projectInfoUpdate
7101
8068
  ];
7102
- var info_default = commands51;
8069
+ var info_default = commands52;
7103
8070
 
7104
8071
  // src/commands/te-analysis/project/mark-time/create.ts
7105
8072
  var projectMarkTimeCreate = createAnalysisCapabilityCommand({
@@ -7193,13 +8160,13 @@ var projectMarkTimeUpdate = createAnalysisCapabilityCommand({
7193
8160
  });
7194
8161
 
7195
8162
  // src/commands/te-analysis/project/mark-time/index.ts
7196
- var commands52 = [
8163
+ var commands53 = [
7197
8164
  projectMarkTimeCreate,
7198
8165
  projectMarkTimeDelete,
7199
8166
  projectMarkTimeList,
7200
8167
  projectMarkTimeUpdate
7201
8168
  ];
7202
- var mark_time_default = commands52;
8169
+ var mark_time_default = commands53;
7203
8170
 
7204
8171
  // src/commands/te-analysis/project/member/add.ts
7205
8172
  var projectMemberAdd = createAnalysisCapabilityCommand({
@@ -7315,7 +8282,7 @@ var projectMemberUpdate = createAnalysisCapabilityCommand({
7315
8282
  });
7316
8283
 
7317
8284
  // src/commands/te-analysis/project/member/index.ts
7318
- var commands53 = [
8285
+ var commands54 = [
7319
8286
  projectMemberAdd,
7320
8287
  projectMemberBatchUpdate,
7321
8288
  projectMemberImport,
@@ -7323,7 +8290,7 @@ var commands53 = [
7323
8290
  projectMemberRemove,
7324
8291
  projectMemberUpdate
7325
8292
  ];
7326
- var member_default = commands53;
8293
+ var member_default = commands54;
7327
8294
 
7328
8295
  // src/commands/te-analysis/project/member-candidate/list.ts
7329
8296
  var projectMemberCandidateList = createAnalysisCapabilityCommand({
@@ -7355,10 +8322,10 @@ var projectMemberCandidateList = createAnalysisCapabilityCommand({
7355
8322
  });
7356
8323
 
7357
8324
  // src/commands/te-analysis/project/member-candidate/index.ts
7358
- var commands54 = [
8325
+ var commands55 = [
7359
8326
  projectMemberCandidateList
7360
8327
  ];
7361
- var member_candidate_default = commands54;
8328
+ var member_candidate_default = commands55;
7362
8329
 
7363
8330
  // src/commands/te-analysis/project/member-handover/export.ts
7364
8331
  var projectMemberHandoverExport = createAnalysisCapabilityCommand({
@@ -7399,11 +8366,11 @@ var projectMemberHandoverRun = createAnalysisCapabilityCommand({
7399
8366
  });
7400
8367
 
7401
8368
  // src/commands/te-analysis/project/member-handover/index.ts
7402
- var commands55 = [
8369
+ var commands56 = [
7403
8370
  projectMemberHandoverExport,
7404
8371
  projectMemberHandoverRun
7405
8372
  ];
7406
- var member_handover_default = commands55;
8373
+ var member_handover_default = commands56;
7407
8374
 
7408
8375
  // src/commands/te-analysis/project/member-receiver/list.ts
7409
8376
  var projectMemberReceiverList = createAnalysisCapabilityCommand({
@@ -7421,10 +8388,10 @@ var projectMemberReceiverList = createAnalysisCapabilityCommand({
7421
8388
  });
7422
8389
 
7423
8390
  // src/commands/te-analysis/project/member-receiver/index.ts
7424
- var commands56 = [
8391
+ var commands57 = [
7425
8392
  projectMemberReceiverList
7426
8393
  ];
7427
- var member_receiver_default = commands56;
8394
+ var member_receiver_default = commands57;
7428
8395
 
7429
8396
  // src/commands/te-analysis/project/owner/update.ts
7430
8397
  var projectOwnerUpdate = createAnalysisCapabilityCommand({
@@ -7450,10 +8417,10 @@ var projectOwnerUpdate = createAnalysisCapabilityCommand({
7450
8417
  });
7451
8418
 
7452
8419
  // src/commands/te-analysis/project/owner/index.ts
7453
- var commands57 = [
8420
+ var commands58 = [
7454
8421
  projectOwnerUpdate
7455
8422
  ];
7456
- var owner_default = commands57;
8423
+ var owner_default = commands58;
7457
8424
 
7458
8425
  // src/commands/te-analysis/project/permission-binding/list.ts
7459
8426
  var projectPermissionBindingList = createAnalysisCapabilityCommand({
@@ -7475,10 +8442,10 @@ var projectPermissionBindingList = createAnalysisCapabilityCommand({
7475
8442
  });
7476
8443
 
7477
8444
  // src/commands/te-analysis/project/permission-binding/index.ts
7478
- var commands58 = [
8445
+ var commands59 = [
7479
8446
  projectPermissionBindingList
7480
8447
  ];
7481
- var permission_binding_default = commands58;
8448
+ var permission_binding_default = commands59;
7482
8449
 
7483
8450
  // src/commands/te-analysis/project/receive-status/update.ts
7484
8451
  var projectReceiveStatusUpdate = createAnalysisCapabilityCommand({
@@ -7499,10 +8466,10 @@ var projectReceiveStatusUpdate = createAnalysisCapabilityCommand({
7499
8466
  });
7500
8467
 
7501
8468
  // src/commands/te-analysis/project/receive-status/index.ts
7502
- var commands59 = [
8469
+ var commands60 = [
7503
8470
  projectReceiveStatusUpdate
7504
8471
  ];
7505
- var receive_status_default = commands59;
8472
+ var receive_status_default = commands60;
7506
8473
 
7507
8474
  // src/commands/te-analysis/project/role/delete.ts
7508
8475
  var projectRoleDelete = createAnalysisCapabilityCommand({
@@ -7594,13 +8561,13 @@ var projectRoleUpsert = createAnalysisCapabilityCommand({
7594
8561
  });
7595
8562
 
7596
8563
  // src/commands/te-analysis/project/role/index.ts
7597
- var commands60 = [
8564
+ var commands61 = [
7598
8565
  projectRoleDelete,
7599
8566
  projectRoleGet,
7600
8567
  projectRoleList,
7601
8568
  projectRoleUpsert
7602
8569
  ];
7603
- var role_default = commands60;
8570
+ var role_default = commands61;
7604
8571
 
7605
8572
  // src/commands/te-analysis/project/role-function/list.ts
7606
8573
  var projectRoleFunctionList = createAnalysisCapabilityCommand({
@@ -7626,10 +8593,10 @@ var projectRoleFunctionList = createAnalysisCapabilityCommand({
7626
8593
  });
7627
8594
 
7628
8595
  // src/commands/te-analysis/project/role-function/index.ts
7629
- var commands61 = [
8596
+ var commands62 = [
7630
8597
  projectRoleFunctionList
7631
8598
  ];
7632
- var role_function_default = commands61;
8599
+ var role_function_default = commands62;
7633
8600
 
7634
8601
  // src/commands/te-analysis/project/role-user/list.ts
7635
8602
  var projectRoleUserList = createAnalysisCapabilityCommand({
@@ -7649,10 +8616,10 @@ var projectRoleUserList = createAnalysisCapabilityCommand({
7649
8616
  });
7650
8617
 
7651
8618
  // src/commands/te-analysis/project/role-user/index.ts
7652
- var commands62 = [
8619
+ var commands63 = [
7653
8620
  projectRoleUserList
7654
8621
  ];
7655
- var role_user_default = commands62;
8622
+ var role_user_default = commands63;
7656
8623
 
7657
8624
  // src/commands/te-analysis/project/timezone/get.ts
7658
8625
  var projectTimezoneGet = createAnalysisCapabilityCommand({
@@ -7790,12 +8757,12 @@ function isObject(value) {
7790
8757
  }
7791
8758
 
7792
8759
  // src/commands/te-analysis/project/timezone/index.ts
7793
- var commands63 = [
8760
+ var commands64 = [
7794
8761
  projectTimezoneGet,
7795
8762
  projectTimezoneOverview,
7796
8763
  projectTimezoneUpdate
7797
8764
  ];
7798
- var timezone_default = commands63;
8765
+ var timezone_default = commands64;
7799
8766
 
7800
8767
  // src/commands/te-analysis/project/user-id-items/update.ts
7801
8768
  var projectUserIdItemsUpdate = createAnalysisCapabilityCommand({
@@ -7815,13 +8782,13 @@ var projectUserIdItemsUpdate = createAnalysisCapabilityCommand({
7815
8782
  });
7816
8783
 
7817
8784
  // src/commands/te-analysis/project/user-id-items/index.ts
7818
- var commands64 = [
8785
+ var commands65 = [
7819
8786
  projectUserIdItemsUpdate
7820
8787
  ];
7821
- var user_id_items_default = commands64;
8788
+ var user_id_items_default = commands65;
7822
8789
 
7823
8790
  // src/commands/te-analysis/project/index.ts
7824
- var commands65 = [
8791
+ var commands66 = [
7825
8792
  ...access_detail_default,
7826
8793
  ...data_power_default,
7827
8794
  ...entity_default2,
@@ -7842,7 +8809,7 @@ var commands65 = [
7842
8809
  ...timezone_default,
7843
8810
  ...user_id_items_default
7844
8811
  ];
7845
- var project_default = commands65;
8812
+ var project_default = commands66;
7846
8813
 
7847
8814
  // src/commands/te-analysis/tracking/shared.ts
7848
8815
  function createTrackingCapabilityCommand(config) {
@@ -8573,7 +9540,7 @@ function counts(plan, value) {
8573
9540
  }
8574
9541
 
8575
9542
  // src/commands/te-analysis/tracking/plan/index.ts
8576
- var commands66 = [
9543
+ var commands67 = [
8577
9544
  trackingPlanGet,
8578
9545
  trackingPlanSaveItems,
8579
9546
  trackingPlanDeleteItems,
@@ -8583,7 +9550,7 @@ var commands66 = [
8583
9550
  trackingPlanSyncFromMeta,
8584
9551
  trackingPlanSyncDisplayNames
8585
9552
  ];
8586
- var plan_default = commands66;
9553
+ var plan_default = commands67;
8587
9554
 
8588
9555
  // src/commands/te-analysis/tracking/sdk-sample/generate.ts
8589
9556
  var trackingSdkSampleGenerate = createTrackingCapabilityCommand({
@@ -8597,10 +9564,10 @@ var trackingSdkSampleGenerate = createTrackingCapabilityCommand({
8597
9564
  });
8598
9565
 
8599
9566
  // src/commands/te-analysis/tracking/sdk-sample/index.ts
8600
- var commands67 = [
9567
+ var commands68 = [
8601
9568
  trackingSdkSampleGenerate
8602
9569
  ];
8603
- var sdk_sample_default = commands67;
9570
+ var sdk_sample_default = commands68;
8604
9571
 
8605
9572
  // src/commands/te-analysis/tracking/plan-change-log/list.ts
8606
9573
  var trackingPlanChangeLogList = createTrackingCapabilityCommand({
@@ -8626,11 +9593,11 @@ var trackingPlanChangeLogExport = createTrackingCapabilityCommand({
8626
9593
  });
8627
9594
 
8628
9595
  // src/commands/te-analysis/tracking/plan-change-log/index.ts
8629
- var commands68 = [
9596
+ var commands69 = [
8630
9597
  trackingPlanChangeLogList,
8631
9598
  trackingPlanChangeLogExport
8632
9599
  ];
8633
- var plan_change_log_default = commands68;
9600
+ var plan_change_log_default = commands69;
8634
9601
 
8635
9602
  // src/commands/te-analysis/tracking/check/run.ts
8636
9603
  var trackingCheckRun = createTrackingCapabilityCommand({
@@ -8704,7 +9671,7 @@ var trackingCheckExport = createTrackingCapabilityCommand({
8704
9671
  });
8705
9672
 
8706
9673
  // src/commands/te-analysis/tracking/check/index.ts
8707
- var commands69 = [
9674
+ var commands70 = [
8708
9675
  trackingCheckRun,
8709
9676
  trackingCheckList,
8710
9677
  trackingCheckGet,
@@ -8712,7 +9679,7 @@ var commands69 = [
8712
9679
  trackingCheckDelete,
8713
9680
  trackingCheckExport
8714
9681
  ];
8715
- var check_default = commands69;
9682
+ var check_default = commands70;
8716
9683
 
8717
9684
  // src/commands/te-analysis/tracking/ingest/summary.ts
8718
9685
  var trackingIngestSummary = createTrackingCapabilityCommand({
@@ -8726,10 +9693,10 @@ var trackingIngestSummary = createTrackingCapabilityCommand({
8726
9693
  });
8727
9694
 
8728
9695
  // src/commands/te-analysis/tracking/ingest/index.ts
8729
- var commands70 = [
9696
+ var commands71 = [
8730
9697
  trackingIngestSummary
8731
9698
  ];
8732
- var ingest_default = commands70;
9699
+ var ingest_default = commands71;
8733
9700
 
8734
9701
  // src/commands/te-analysis/tracking/ingest-error/list.ts
8735
9702
  var trackingIngestErrorList = createTrackingCapabilityCommand({
@@ -8743,10 +9710,10 @@ var trackingIngestErrorList = createTrackingCapabilityCommand({
8743
9710
  });
8744
9711
 
8745
9712
  // src/commands/te-analysis/tracking/ingest-error/index.ts
8746
- var commands71 = [
9713
+ var commands72 = [
8747
9714
  trackingIngestErrorList
8748
9715
  ];
8749
- var ingest_error_default = commands71;
9716
+ var ingest_error_default = commands72;
8750
9717
 
8751
9718
  // src/commands/te-analysis/tracking/live-data/list.ts
8752
9719
  var trackingLiveDataList = createTrackingCapabilityCommand({
@@ -8772,11 +9739,11 @@ var trackingLiveDataExport = createTrackingCapabilityCommand({
8772
9739
  });
8773
9740
 
8774
9741
  // src/commands/te-analysis/tracking/live-data/index.ts
8775
- var commands72 = [
9742
+ var commands73 = [
8776
9743
  trackingLiveDataList,
8777
9744
  trackingLiveDataExport
8778
9745
  ];
8779
- var live_data_default = commands72;
9746
+ var live_data_default = commands73;
8780
9747
 
8781
9748
  // src/commands/te-analysis/tracking/event-blacklist/list.ts
8782
9749
  var trackingEventBlacklistList = createTrackingCapabilityCommand({
@@ -8812,12 +9779,12 @@ var trackingEventBlacklistUpdate = createTrackingCapabilityCommand({
8812
9779
  });
8813
9780
 
8814
9781
  // src/commands/te-analysis/tracking/event-blacklist/index.ts
8815
- var commands73 = [
9782
+ var commands74 = [
8816
9783
  trackingEventBlacklistList,
8817
9784
  trackingEventBlacklistAdd,
8818
9785
  trackingEventBlacklistUpdate
8819
9786
  ];
8820
- var event_blacklist_default = commands73;
9787
+ var event_blacklist_default = commands74;
8821
9788
 
8822
9789
  // src/commands/te-analysis/tracking/debug-device/add.ts
8823
9790
  var trackingDebugDeviceAdd = createTrackingCapabilityCommand({
@@ -8860,12 +9827,12 @@ var trackingDebugDeviceSelect = createTrackingCapabilityCommand({
8860
9827
  });
8861
9828
 
8862
9829
  // src/commands/te-analysis/tracking/debug-device/index.ts
8863
- var commands74 = [
9830
+ var commands75 = [
8864
9831
  trackingDebugDeviceList,
8865
9832
  trackingDebugDeviceAdd,
8866
9833
  trackingDebugDeviceSelect
8867
9834
  ];
8868
- var debug_device_default = commands74;
9835
+ var debug_device_default = commands75;
8869
9836
 
8870
9837
  // src/commands/te-analysis/tracking/debug-data/list.ts
8871
9838
  var debugStartTimeFlag = {
@@ -8924,11 +9891,11 @@ function isRecord3(value) {
8924
9891
  }
8925
9892
 
8926
9893
  // src/commands/te-analysis/tracking/debug-data/index.ts
8927
- var commands75 = [trackingDebugDataList];
8928
- var debug_data_default = commands75;
9894
+ var commands76 = [trackingDebugDataList];
9895
+ var debug_data_default = commands76;
8929
9896
 
8930
9897
  // src/commands/te-analysis/tracking/index.ts
8931
- var commands76 = [
9898
+ var commands77 = [
8932
9899
  ...plan_default,
8933
9900
  ...sdk_sample_default,
8934
9901
  ...plan_change_log_default,
@@ -8940,7 +9907,7 @@ var commands76 = [
8940
9907
  ...debug_device_default,
8941
9908
  ...debug_data_default
8942
9909
  ];
8943
- var tracking_default = commands76;
9910
+ var tracking_default = commands77;
8944
9911
 
8945
9912
  // src/commands/te-analysis/alert/shared.ts
8946
9913
  var alertIdFlag = {
@@ -9053,7 +10020,7 @@ var analysisAlertStop = createAnalysisCapabilityCommand({
9053
10020
  });
9054
10021
 
9055
10022
  // src/commands/te-analysis/alert/index.ts
9056
- var commands77 = [
10023
+ var commands78 = [
9057
10024
  analysisAlertList,
9058
10025
  analysisAlertGet,
9059
10026
  analysisAlertCreate,
@@ -9062,7 +10029,7 @@ var commands77 = [
9062
10029
  analysisAlertStart,
9063
10030
  analysisAlertStop
9064
10031
  ];
9065
- var alert_default = commands77;
10032
+ var alert_default = commands78;
9066
10033
 
9067
10034
  // src/commands/te-analysis/alert-detail/list.ts
9068
10035
  var analysisAlertDetailList = createAnalysisCapabilityCommand({
@@ -9076,10 +10043,10 @@ var analysisAlertDetailList = createAnalysisCapabilityCommand({
9076
10043
  });
9077
10044
 
9078
10045
  // src/commands/te-analysis/alert-detail/index.ts
9079
- var commands78 = [
10046
+ var commands79 = [
9080
10047
  analysisAlertDetailList
9081
10048
  ];
9082
- var alert_detail_default = commands78;
10049
+ var alert_detail_default = commands79;
9083
10050
 
9084
10051
  // src/commands/te-analysis/alert-job/list.ts
9085
10052
  var analysisAlertJobList = createAnalysisCapabilityCommand({
@@ -9093,10 +10060,10 @@ var analysisAlertJobList = createAnalysisCapabilityCommand({
9093
10060
  });
9094
10061
 
9095
10062
  // src/commands/te-analysis/alert-job/index.ts
9096
- var commands79 = [
10063
+ var commands80 = [
9097
10064
  analysisAlertJobList
9098
10065
  ];
9099
- var alert_job_default = commands79;
10066
+ var alert_job_default = commands80;
9100
10067
 
9101
10068
  // src/commands/te-analysis/alert-notice-config/list.ts
9102
10069
  var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
@@ -9110,10 +10077,10 @@ var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
9110
10077
  });
9111
10078
 
9112
10079
  // src/commands/te-analysis/alert-notice-config/index.ts
9113
- var commands80 = [
10080
+ var commands81 = [
9114
10081
  analysisAlertNoticeConfigList
9115
10082
  ];
9116
- var alert_notice_config_default = commands80;
10083
+ var alert_notice_config_default = commands81;
9117
10084
 
9118
10085
  // src/commands/te-analysis/system/shared.ts
9119
10086
  import { readFileSync as readFileSync3, statSync as statSync3 } from "fs";
@@ -9773,14 +10740,14 @@ var monitorTimeFields = [
9773
10740
  type: "string",
9774
10741
  required: true,
9775
10742
  pattern: "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
9776
- desc: "Inclusive query range start, yyyy-MM-dd HH:mm:ss."
10743
+ desc: "Inclusive completion-time range start, yyyy-MM-dd HH:mm:ss."
9777
10744
  },
9778
10745
  {
9779
10746
  flag: "end-time",
9780
10747
  type: "string",
9781
10748
  required: true,
9782
10749
  pattern: "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",
9783
- desc: "Inclusive query range end, yyyy-MM-dd HH:mm:ss."
10750
+ desc: "Inclusive completion-time range end, including the entire second, yyyy-MM-dd HH:mm:ss."
9784
10751
  }
9785
10752
  ];
9786
10753
  function validateTaskQueryInput(input) {
@@ -9844,6 +10811,27 @@ var systemMonitoringCommands = [
9844
10811
  ],
9845
10812
  validate: (_ctx, input) => validateTaskQueryInput(input)
9846
10813
  }),
10814
+ defineSystemCommand({
10815
+ resource: "query-task",
10816
+ command: "realtime-list",
10817
+ capabilityId: "system.query_task.realtime_list",
10818
+ description: "List a bounded realtime query-monitor snapshot; use query-task list for historical logs.",
10819
+ risk: "read",
10820
+ fields: [
10821
+ { flag: "duration-minutes", type: "number", min: 1, max: 30, desc: "Realtime window in minutes. Default: 30." },
10822
+ ...monitorScopeFields,
10823
+ { flag: "cluster-names", type: "json", required: true, array: true, desc: "Query cluster-name JSON array." },
10824
+ { flag: "status-codes", type: "json", array: true, desc: "Optional task status-code JSON array." },
10825
+ { flag: "limit", type: "number", min: 1, max: 200, desc: "Maximum returned tasks. Default: 100, max: 200." }
10826
+ ],
10827
+ validate: (_ctx, input) => {
10828
+ validateMonitorScope(input);
10829
+ requireAtLeastOne(input, ["cluster_names"], "--cluster-names must be a non-empty JSON array.");
10830
+ if (input.status_codes !== void 0) {
10831
+ requireAtLeastOne(input, ["status_codes"], "--status-codes must be a non-empty JSON array.");
10832
+ }
10833
+ }
10834
+ }),
9847
10835
  defineSystemCommand({
9848
10836
  resource: "query-task",
9849
10837
  command: "get",
@@ -10177,14 +11165,97 @@ var systemUsageCommands = [
10177
11165
  ];
10178
11166
 
10179
11167
  // src/commands/te-analysis/system/index.ts
10180
- var commands81 = [
11168
+ var commands82 = [
10181
11169
  ...systemUsageCommands,
10182
11170
  ...systemIdentityCommands,
10183
11171
  ...systemSecurityCommands,
10184
11172
  ...systemMonitoringCommands,
10185
11173
  ...systemConfigurationCommands
10186
11174
  ];
10187
- var system_default = commands81;
11175
+ var system_default = commands82;
11176
+
11177
+ // src/commands/te-analysis/feedback/submit.ts
11178
+ import { createHash as createHash4, randomUUID as randomUUID2 } from "crypto";
11179
+ var analysisQueryCapabilities = /* @__PURE__ */ new Set([
11180
+ "analysis.adhoc.run",
11181
+ "analysis.adhoc.export",
11182
+ "analysis.report_data.run",
11183
+ "analysis.report_data.export",
11184
+ "analysis.dashboard_report_data.run",
11185
+ "analysis.dashboard_report_data.export",
11186
+ "analysis.bi_panel_page_data.run",
11187
+ "analysis.bi_panel_page_data.export",
11188
+ "analysis.event_detail.run",
11189
+ "analysis.event_detail.export",
11190
+ "analysis.entity_detail.run",
11191
+ "analysis.entity_detail.export",
11192
+ "analysis.query.drilldown_events",
11193
+ "analysis.query.drilldown_events_export",
11194
+ "analysis.query.drilldown_entities",
11195
+ "analysis.query.drilldown_entities_export",
11196
+ "analysis.query.drilldown_user_events",
11197
+ "analysis.query.drilldown_user_events_export",
11198
+ "analysis.query.drilldown_session_details"
11199
+ ]);
11200
+ function analysisFeedbackInput(ctx) {
11201
+ if (!ctx.bool("query-completed")) throw new CliValidationError("Feedback requires a completed data query and final analysis answer.");
11202
+ const queryCapabilityId = ctx.str("query-capability-id");
11203
+ if (!analysisQueryCapabilities.has(queryCapabilityId)) throw new CliValidationError("query-capability-id must identify an executed analysis data query.");
11204
+ const ratings = ["satisfied", "partially_satisfied", "dissatisfied", "unable_to_judge"];
11205
+ const satisfaction = ctx.str("satisfaction");
11206
+ if (!ratings.includes(satisfaction)) throw new CliValidationError("satisfaction must be an explicit user feedback category.");
11207
+ const feedbackText = ctx.str("feedback-text");
11208
+ if (!feedbackText.trim() || feedbackText.length > 2048) throw new CliValidationError("feedback-text must contain original user feedback up to 2048 characters.");
11209
+ const context = readCliAgentContext();
11210
+ if (!context.agent_session_id) throw new CliValidationError("The Agent context file must contain the evaluated agent_session_id.");
11211
+ const turns = ctx.json("target-turn-ids") ?? [];
11212
+ if (!Array.isArray(turns) || turns.length > 32 || turns.some((id) => typeof id !== "string" || !id.trim() || id.length > 191)) {
11213
+ throw new CliValidationError("target-turn-ids must be an array of at most 32 nonblank existing turn IDs.");
11214
+ }
11215
+ if (turns.includes(context.agent_turn_id)) throw new CliValidationError("target-turn-ids must reference analysis turns, not the feedback turn.");
11216
+ const targetTurns = [...new Set(turns)];
11217
+ const suppliedId = ctx.str("feedback-id");
11218
+ const feedbackId = suppliedId || (context.agent_turn_id ? createHash4("sha256").update(JSON.stringify([context.agent_session_id, context.agent_turn_id, targetTurns, queryCapabilityId, satisfaction, feedbackText])).digest("hex") : randomUUID2());
11219
+ if (!feedbackId.trim() || feedbackId.length > 128) throw new CliValidationError("feedback-id must be a nonblank string up to 128 characters.");
11220
+ const routeSummary = ctx.str("route-summary");
11221
+ if (routeSummary.length > 2048) throw new CliValidationError("route-summary must be at most 2048 characters.");
11222
+ const projectId = ctx.optionalNum("project-id");
11223
+ if (projectId !== void 0 && (!Number.isInteger(projectId) || projectId <= 0)) {
11224
+ throw new CliValidationError("project-id must be a positive integer.");
11225
+ }
11226
+ return {
11227
+ feedback_id: feedbackId,
11228
+ agent_session_id: context.agent_session_id,
11229
+ target_turn_ids: targetTurns,
11230
+ query_completed: true,
11231
+ query_capability_id: queryCapabilityId,
11232
+ satisfaction,
11233
+ feedback_text: feedbackText,
11234
+ ...projectId !== void 0 ? { project_id: projectId } : {},
11235
+ ...routeSummary.trim() ? { route_summary: routeSummary } : {}
11236
+ };
11237
+ }
11238
+ var analysisFeedbackSubmit = createAnalysisCapabilityCommand({
11239
+ resource: "feedback",
11240
+ command: "submit",
11241
+ capabilityId: "analysis.feedback.submit",
11242
+ risk: "write",
11243
+ description: "Submit explicit user feedback after a completed analysis data query and final answer. Reuses Agent session and analysis turn IDs; never submits an answer body.",
11244
+ flags: [
11245
+ { name: "query-completed", type: "boolean", desc: "Confirm that query results and the final analysis answer have been delivered." },
11246
+ { name: "query-capability-id", type: "string", required: true, desc: "Executed analysis data-query capability ID in the evaluated turns." },
11247
+ { name: "satisfaction", type: "string", required: true, desc: "Explicit rating: satisfied, partially_satisfied, dissatisfied, or unable_to_judge." },
11248
+ { name: "feedback-text", type: "string", required: true, sensitive: true, desc: "Original user feedback, up to 2048 characters. No answer content." },
11249
+ { name: "target-turn-ids", type: "json", desc: "JSON array of evaluated analysis turn IDs; omit only when unknown." },
11250
+ { name: "route-summary", type: "string", sensitive: true, desc: "Optional brief verifiable route and asset-selection rationale. No answer content." },
11251
+ { name: "feedback-id", type: "string", desc: "Stable feedback ID for retries; defaults to current session/feedback-turn fingerprint when available." },
11252
+ { name: "project-id", type: "number", desc: "Evaluated analysis project ID when available." }
11253
+ ],
11254
+ buildInput: analysisFeedbackInput
11255
+ });
11256
+
11257
+ // src/commands/te-analysis/feedback/index.ts
11258
+ var feedback_default = [analysisFeedbackSubmit];
10188
11259
 
10189
11260
  // src/commands/te-analysis/index.ts
10190
11261
  registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
@@ -10221,6 +11292,7 @@ var baseCommands = [
10221
11292
  ...drilldown_events_default,
10222
11293
  ...drilldown_entities_default,
10223
11294
  ...drilldown_user_events_default,
11295
+ ...drilldown_session_details_default,
10224
11296
  ...user_default,
10225
11297
  ...sql_table_default,
10226
11298
  ...query_cluster_default,
@@ -10232,10 +11304,11 @@ var baseCommands = [
10232
11304
  ...alert_detail_default,
10233
11305
  ...alert_job_default,
10234
11306
  ...alert_notice_config_default,
10235
- ...system_default
11307
+ ...system_default,
11308
+ ...feedback_default
10236
11309
  ];
10237
- var commands82 = [...baseCommands];
10238
- var te_analysis_default = commands82;
11310
+ var commands83 = [...baseCommands];
11311
+ var te_analysis_default = commands83;
10239
11312
  export {
10240
11313
  baseCommands,
10241
11314
  te_analysis_default as default