@thinkingai/ae-cli 6.1.27 → 6.1.29

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 (177) hide show
  1. package/README.md +52 -6
  2. package/README.zh.md +52 -6
  3. package/bin/ae-cli.js +5 -0
  4. package/bin/runtime-capabilities.json +5 -0
  5. package/cli-installation-guide.md +24 -3
  6. package/dist/{auth-WA7YGGRT.js → auth-OBQ5KVQM.js} +175 -45
  7. package/dist/{automation-VAAQBM7Y.js → automation-NAR5DDGL.js} +94 -38
  8. package/dist/{capability-GAAYJ3IQ.js → capability-LFSVNI5B.js} +57 -28
  9. package/dist/chunk-2UW3Y463.js +2289 -0
  10. package/dist/{chunk-VZZNLV3I.js → chunk-3SDHJOCR.js} +68 -18
  11. package/dist/chunk-6HAUVWOQ.js +132 -0
  12. package/dist/{chunk-5XJYLEVC.js → chunk-72NJKS7O.js} +4 -4
  13. package/dist/{chunk-Q5US7JC5.js → chunk-7JAVT5TK.js} +3 -3
  14. package/dist/{chunk-7KU2WNQE.js → chunk-CVCTFLSO.js} +37 -15
  15. package/dist/{chunk-GHXZK54S.js → chunk-H3K5UGYC.js} +41 -13
  16. package/dist/{chunk-OP44TT4H.js → chunk-IN7KKL6K.js} +4 -2
  17. package/dist/{chunk-S6M42KND.js → chunk-JEUXDY3B.js} +1 -1
  18. package/dist/{chunk-ZL7SGNIA.js → chunk-JNVVJ273.js} +58 -46
  19. package/dist/chunk-N6XBLRB7.js +105 -0
  20. package/dist/{chunk-AP7YP2NX.js → chunk-OAWPT7VP.js} +2 -2
  21. package/dist/{chunk-AQJPNWZF.js → chunk-PWXDWMCW.js} +7 -7
  22. package/dist/{chunk-CT7QDJS6.js → chunk-QVRIDN42.js} +2 -2
  23. package/dist/chunk-QZLRHGVH.js +222 -0
  24. package/dist/{chunk-RPBOAQQQ.js → chunk-QZUVLFNR.js} +1 -1
  25. package/dist/{chunk-3YVEAZUN.js → chunk-RJHGDWSC.js} +32 -21
  26. package/dist/{chunk-MWIA43UJ.js → chunk-VCZE3IWO.js} +10 -8
  27. package/dist/chunk-YVG6QD3V.js +233 -0
  28. package/dist/{chunk-WNGFSIOB.js → chunk-Z3Q2AEIN.js} +237 -86
  29. package/dist/{community-report-client-PEERQCX2.js → community-report-client-TJVCLZ3K.js} +1 -1
  30. package/dist/compat-check-CII6B74E.js +32 -0
  31. package/dist/{config-JOD5DOPE.js → config-YZ6O2UQ2.js} +40 -7
  32. package/dist/{context-NGVFPCBK.js → context-F6FCGTF3.js} +4 -4
  33. package/dist/{data-integration-BCLQFTGU.js → data-integration-6UAZO4GG.js} +207 -24
  34. package/dist/evaluation-4LO2O4AF.js +3714 -0
  35. package/dist/index.js +352 -81
  36. package/dist/{local-data-upload-client-TWMHFLUA.js → local-data-upload-client-KCMG6J62.js} +1 -1
  37. package/dist/{memory-CQKH2JAV.js → memory-HHPX3NF2.js} +6 -6
  38. package/dist/{metadata-NR3PHR23.js → metadata-TIFY24LW.js} +17 -9
  39. package/dist/{model-VX5M2CJ6.js → model-7UHGWYVR.js} +4 -4
  40. package/dist/{personal-semantic-preference-2RAI36P3.js → personal-semantic-preference-WKJEGPTM.js} +7 -6
  41. package/dist/{project-semantic-3BUGP3ZM.js → project-semantic-EIQVZNHW.js} +11 -10
  42. package/dist/{sync-RZIAV37C.js → sync-RV3OPCTI.js} +8 -7
  43. package/dist/{te-agent-AORRE2FM.js → te-agent-5ENVZJUH.js} +757 -94
  44. package/dist/{te-analysis-GP7DSQ7Q.js → te-analysis-USIK6ZZG.js} +584 -100
  45. package/dist/{te-community-42M7ICDO.js → te-community-WE2UU4XV.js} +722 -228
  46. package/dist/{te-dataops-BNKNZ4F2.js → te-dataops-XNMO7MBF.js} +9 -6
  47. package/dist/{te-engage-2CO6LRCX.js → te-engage-6C3HCFQR.js} +13 -12
  48. package/dist/{te-experiment-652CLXMU.js → te-experiment-LVTRI3QK.js} +55 -21
  49. package/dist/{te-kb-ULATOTQ3.js → te-kb-TUPGMVBY.js} +409 -85
  50. package/dist/{te-system-UGHVKBVV.js → te-system-YM657FKO.js} +6 -6
  51. package/dist/{te-team-YA6SNOJ3.js → te-team-G4VEJJNL.js} +64 -41
  52. package/dist/{things-DTCOQIQB.js → things-22KQWC23.js} +7 -7
  53. package/dist/{update-ESNYKUVR.js → update-XX4ILU7X.js} +11 -7
  54. package/dist/{workspace-JEOHKFPX.js → workspace-LYDAP647.js} +6 -6
  55. package/package.json +26 -11
  56. package/skills/ae-agent/SKILL.md +22 -3
  57. package/skills/ae-agent/references/command_index.md +8 -0
  58. package/skills/ae-agent/references/resource-package.md +57 -0
  59. package/skills/ae-analysis/SKILL.md +23 -10
  60. package/skills/ae-analysis/references/adhoc_export.md +1 -1
  61. package/skills/ae-analysis/references/agent_review_preflight.md +55 -10
  62. package/skills/ae-analysis/references/agent_review_priorities_comparisons.md +5 -3
  63. package/skills/ae-analysis/references/agent_review_submit_to_page.md +60 -24
  64. package/skills/ae-analysis/references/ai_models/event.md +58 -2
  65. package/skills/ae-analysis/references/ai_models/rank_list.md +1 -0
  66. package/skills/ae-analysis/references/ai_models/retention.md +2 -0
  67. package/skills/ae-analysis/references/ai_models/revenue.md +2 -0
  68. package/skills/ae-analysis/references/analysis_data_export.md +11 -1
  69. package/skills/ae-analysis/references/asset_batch_info_export.md +2 -2
  70. package/skills/ae-analysis/references/asset_batch_sql_export.md +2 -2
  71. package/skills/ae-analysis/references/asset_export.md +1 -1
  72. package/skills/ae-analysis/references/bi_panel_page_data_export.md +1 -1
  73. package/skills/ae-analysis/references/check_export.md +1 -1
  74. package/skills/ae-analysis/references/command_index.md +39 -26
  75. package/skills/ae-analysis/references/dashboard_report_data_export.md +2 -0
  76. package/skills/ae-analysis/references/dashboard_report_get.md +6 -2
  77. package/skills/ae-analysis/references/dashboard_report_update.md +24 -5
  78. package/skills/ae-analysis/references/feedback_submit.md +1 -1
  79. package/skills/ae-analysis/references/governance_recommendation_export.md +40 -18
  80. package/skills/ae-analysis/references/governance_recommendation_run_update.md +13 -0
  81. package/skills/ae-analysis/references/live_data_export.md +1 -1
  82. package/skills/ae-analysis/references/metric_create.md +29 -0
  83. package/skills/ae-analysis/references/metric_get.md +2 -0
  84. package/skills/ae-analysis/references/metric_update.md +2 -0
  85. package/skills/ae-analysis/references/operation_record_export.md +1 -1
  86. package/skills/ae-analysis/references/plan_change_log_export.md +1 -1
  87. package/skills/ae-analysis/references/plan_export.md +1 -1
  88. package/skills/ae-analysis/references/project_info_get.md +4 -0
  89. package/skills/ae-analysis/references/project_member_group_add_members.md +35 -0
  90. package/skills/ae-analysis/references/project_member_group_create.md +25 -0
  91. package/skills/ae-analysis/references/project_member_group_delete.md +34 -0
  92. package/skills/ae-analysis/references/project_member_group_list.md +29 -0
  93. package/skills/ae-analysis/references/project_member_group_members.md +28 -0
  94. package/skills/ae-analysis/references/project_member_group_remove_members.md +35 -0
  95. package/skills/ae-analysis/references/project_member_group_rename.md +26 -0
  96. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +9 -1
  97. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +6 -1
  98. package/skills/ae-analysis/references/report_data_export.md +1 -1
  99. package/skills/ae-analysis/references/scenario_append.md +31 -0
  100. package/skills/ae-analysis/references/scenario_begin.md +11 -0
  101. package/skills/ae-analysis/references/scenario_collect.md +43 -0
  102. package/skills/ae-analysis/references/scenario_evaluation.md +18 -0
  103. package/skills/ae-analysis/references/scenario_get.md +15 -0
  104. package/skills/ae-analysis/references/scenario_list.md +64 -0
  105. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +73 -4
  106. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +14 -1
  107. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +5 -1
  108. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/execution-contract.mjs +173 -0
  109. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +109 -64
  110. package/skills/ae-automation/SKILL.md +2 -2
  111. package/skills/ae-automation/references/cli.md +18 -1
  112. package/skills/ae-capability/SKILL.md +7 -3
  113. package/skills/ae-community/SKILL.md +77 -27
  114. package/skills/ae-community/references/community-analyzing-theme-comment.md +10 -8
  115. package/skills/ae-community/references/community-data-quality.md +68 -0
  116. package/skills/ae-community/references/community-query-evidence.md +85 -0
  117. package/skills/ae-community/references/community-scenario-capabilities.md +137 -0
  118. package/skills/ae-community/references/community-weekly-report.md +6 -3
  119. package/skills/ae-community/references/get_channel_info.md +7 -4
  120. package/skills/ae-community/references/get_comment_tag_analysis.md +3 -3
  121. package/skills/ae-community/references/get_comments_summary.md +4 -4
  122. package/skills/ae-community/references/get_corpus_tags.md +3 -3
  123. package/skills/ae-community/references/get_daily_summary.md +3 -3
  124. package/skills/ae-community/references/get_hot_topics.md +3 -3
  125. package/skills/ae-community/references/get_livestream_analysis.md +3 -3
  126. package/skills/ae-community/references/get_livestream_detail.md +4 -4
  127. package/skills/ae-community/references/get_livestream_list.md +3 -3
  128. package/skills/ae-community/references/get_livestream_overview.md +3 -3
  129. package/skills/ae-community/references/get_livestream_room_metrics.md +3 -3
  130. package/skills/ae-community/references/get_livestream_rooms.md +3 -3
  131. package/skills/ae-community/references/get_overview_metrics.md +3 -3
  132. package/skills/ae-community/references/get_post_detail.md +4 -4
  133. package/skills/ae-community/references/get_risk_content.md +5 -5
  134. package/skills/ae-community/references/get_sentiment_overview.md +4 -4
  135. package/skills/ae-community/references/get_tag_trends.md +3 -3
  136. package/skills/ae-community/references/get_topic_detail.md +3 -3
  137. package/skills/ae-community/references/list_sources.md +28 -0
  138. package/skills/ae-community/references/list_spaces.md +39 -0
  139. package/skills/ae-community/references/search_posts.md +21 -7
  140. package/skills/ae-data-integration/SKILL.md +6 -4
  141. package/skills/ae-data-integration/references/error-handling.md +1 -0
  142. package/skills/ae-data-integration/references/handoff.md +1 -1
  143. package/skills/ae-data-integration/references/sink-upload.md +11 -0
  144. package/skills/ae-data-integration/references/source-inspect.md +2 -1
  145. package/skills/ae-data-integration/references/transform.md +1 -1
  146. package/skills/ae-data-integration/references/ue-mapping.md +1 -1
  147. package/skills/ae-evaluation/SKILL.md +83 -0
  148. package/skills/ae-evaluation/references/access-and-members.md +55 -0
  149. package/skills/ae-evaluation/references/connections.md +78 -0
  150. package/skills/ae-evaluation/references/datasets.md +57 -0
  151. package/skills/ae-evaluation/references/evaluators.md +81 -0
  152. package/skills/ae-evaluation/references/files.md +33 -0
  153. package/skills/ae-evaluation/references/integrations.md +39 -0
  154. package/skills/ae-evaluation/references/runs.md +160 -0
  155. package/skills/ae-evaluation/references/schedules.md +31 -0
  156. package/skills/ae-experiment/SKILL.md +7 -1
  157. package/skills/ae-experiment/references/manage_experiment.md +18 -1
  158. package/skills/ae-experiment/references/query_experiment_detail.md +7 -0
  159. package/skills/ae-experiment/references/save_experiment.md +76 -2
  160. package/skills/ae-experiment/references/save_submit_experiment.md +7 -0
  161. package/skills/ae-kb/SKILL.md +33 -7
  162. package/skills/ae-kb/references/publication.md +81 -0
  163. package/skills/ae-kb/references/query-workflow.md +14 -1
  164. package/skills/ae-metadata/SKILL.md +3 -2
  165. package/skills/ae-metadata/references/metadata_data_table_download.md +7 -1
  166. package/skills/ae-metadata/references/metadata_data_table_get.md +37 -0
  167. package/skills/ae-system/SKILL.md +1 -1
  168. package/skills/ae-team/SKILL.md +2 -2
  169. package/skills/ae-team/references/run-start.md +1 -0
  170. package/skills/ae-team/references/run-watch.md +7 -5
  171. package/skills/ae-things/SKILL.md +53 -51
  172. package/skills/ae-things/references/cli.md +56 -54
  173. package/skills/ae-things-progress/SKILL.md +20 -20
  174. package/skills/ae-things-review/SKILL.md +19 -19
  175. package/skills/ae-workspace/SKILL.md +1 -1
  176. package/dist/chunk-6VNIR4AP.js +0 -1422
  177. package/dist/chunk-CI24BDR2.js +0 -43
@@ -7,12 +7,19 @@ import {
7
7
  waitForAnalysisRun,
8
8
  withAsyncArtifactLifecycle,
9
9
  withInterruptSignal
10
- } from "./chunk-AQJPNWZF.js";
10
+ } from "./chunk-PWXDWMCW.js";
11
11
  import {
12
12
  createCapabilityCommand,
13
13
  definitionIntentSnapshotFlag,
14
14
  modelDefinitionIntentSnapshotFlag
15
- } from "./chunk-MWIA43UJ.js";
15
+ } from "./chunk-VCZE3IWO.js";
16
+ import {
17
+ registerCapabilityGatewayRoute,
18
+ resolveGatewayDomain
19
+ } from "./chunk-KPQY44JQ.js";
20
+ import {
21
+ withOutputMetadata
22
+ } from "./chunk-QZLRHGVH.js";
16
23
  import {
17
24
  CapabilityGatewayError,
18
25
  buildCapabilityGatewayUrl,
@@ -26,22 +33,16 @@ import {
26
33
  uploadInputFile,
27
34
  validateCapability,
28
35
  validateCapabilityWithEnvelope
29
- } from "./chunk-VZZNLV3I.js";
30
- import {
31
- registerCapabilityGatewayRoute,
32
- resolveGatewayDomain
33
- } from "./chunk-KPQY44JQ.js";
34
- import {
35
- withOutputMetadata
36
- } from "./chunk-6VNIR4AP.js";
36
+ } from "./chunk-3SDHJOCR.js";
37
37
  import "./chunk-Y74WTIKJ.js";
38
+ import "./chunk-2UW3Y463.js";
38
39
  import {
39
40
  getCliToken
40
- } from "./chunk-GHXZK54S.js";
41
- import "./chunk-ZL7SGNIA.js";
41
+ } from "./chunk-H3K5UGYC.js";
42
+ import "./chunk-JNVVJ273.js";
42
43
  import {
43
44
  CliValidationError
44
- } from "./chunk-WNGFSIOB.js";
45
+ } from "./chunk-Z3Q2AEIN.js";
45
46
 
46
47
  // src/commands/te-analysis/capability-shared.ts
47
48
  var ANALYSIS_GATEWAY_CLI_SERVICES = /* @__PURE__ */ new Set(["project", "system"]);
@@ -229,7 +230,7 @@ var asyncTimeoutSecondsFlag = {
229
230
  name: "timeout-seconds",
230
231
  type: "number",
231
232
  required: false,
232
- desc: "Async runtime in seconds. Default and max: 21600 (6 hours); cancel earlier with analysis query cancel --run-id <run_id>.",
233
+ desc: "Async runtime in seconds. Omit to use the server default (usually 21600 / 6 hours). This CLI accepts explicit values up to 21600; inspect the capability for the server default/max and use capability run for larger allowed values. Cancel with analysis query cancel --run-id <run_id>.",
233
234
  min: 1,
234
235
  max: 21600
235
236
  };
@@ -1647,7 +1648,7 @@ var recordIdFlag = { name: "record-id", type: "number", required: false, desc: "
1647
1648
  var governanceExportFlags = (format) => [
1648
1649
  requestIdFlag,
1649
1650
  { ...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
+ { ...asyncTimeoutSecondsFlag, max: 7200, desc: "Async export runtime in seconds. Omit to use the server-provided default. This CLI accepts explicit values up to 7200; inspect the capability for the server default/max and use capability run for larger allowed values." }
1651
1652
  ];
1652
1653
  var governanceExportFields = ["request_id", "format", "timeout_seconds"];
1653
1654
  var readers = {
@@ -2120,6 +2121,33 @@ var metadataCatalogList = createAnalysisMetaCapabilityCommand({
2120
2121
  var commands10 = [metadataCatalogList, metadataCatalogExport];
2121
2122
  var catalog_default = commands10;
2122
2123
 
2124
+ // src/commands/te-analysis/meta/governance-recommendation/run-update.ts
2125
+ var metadataGovernanceRecommendationRunUpdate = createAnalysisMetaCapabilityCommand({
2126
+ resource: "governance-recommendation",
2127
+ command: "run-update",
2128
+ capabilityId: "metadata.governance_recommendation.run_update",
2129
+ description: "Renew or finish your tracked recommendation workflow; it does not cancel Agent execution.",
2130
+ risk: "write",
2131
+ flags: [
2132
+ projectIdFlag,
2133
+ { name: "run-id", type: "string", required: true, desc: "Exact run_id returned by the tracked export." },
2134
+ { name: "status", type: "string", required: true, desc: "HEARTBEAT, SUCCEEDED, FAILED or CANCELLED. Finish only after the actual workflow has ended." },
2135
+ { name: "reason", type: "string", required: false, desc: "Short non-sensitive result or failure reason; never include credentials or raw logs." }
2136
+ ],
2137
+ buildInput: (ctx) => {
2138
+ const status = ctx.str("status");
2139
+ if (!["HEARTBEAT", "SUCCEEDED", "FAILED", "CANCELLED"].includes(status)) {
2140
+ throw new Error("--status must be HEARTBEAT, SUCCEEDED, FAILED or CANCELLED.");
2141
+ }
2142
+ return {
2143
+ ...projectInput(ctx),
2144
+ run_id: ctx.str("run-id"),
2145
+ status,
2146
+ ...ctx.str("reason") ? { reason: ctx.str("reason") } : {}
2147
+ };
2148
+ }
2149
+ });
2150
+
2123
2151
  // src/commands/te-analysis/meta/governance-recommendation/export.ts
2124
2152
  var windowDaysFlag = {
2125
2153
  name: "window-days",
@@ -2154,7 +2182,9 @@ var GOVERNANCE_RECOMMENDATION_EXPORT_HELP = [
2154
2182
  "- The Agent turns that package into a submit-to-page draft with batch ai_summary, presentation_snapshot, per-item ai_summary/reasons, copied evidence_snapshot, copied source links, and relations.",
2155
2183
  "- work_units are deterministic evidence containers from Common. They are not final page groups; the Agent clusters selected assets into one or more business-domain topics.",
2156
2184
  "- For report and SQL items, use packaged evidence_snapshot.analysis first. Call analysis-meta agent-review evidence only for explicit definition/analysis gaps or draft validation.",
2157
- "- For real page-review submission, start with --limit 20, filter out completed/rejected/deferred/in-flight items, and expand to --limit 50 then --limit 100 only when the remaining pending review assets or visible business domains are too few.",
2185
+ "- Ordinary recommendations need concise reasons, a core evidence-backed report measure/calculation, business-domain/subtopic grouping, and a focused page-material review. Full definition audits, per-item comparisons and exhaustive SQL explanations are not the default; use them only for explicit audit intent or affected risk items.",
2186
+ "- For real page-review submission, start with --limit 20, select currently uncertified assets by business value and evidence, and expand to --limit 50 then --limit 100 only when the remaining pending review assets or visible business domains are too few.",
2187
+ "- Do not query review history to select candidates. Previously recommended, pending, rejected, or deferred proposals do not exclude a currently uncertified asset from manual recommendation.",
2158
2188
  "- Expansion increases business-domain coverage; it must not submit every pending asset found. Keep a daily review capacity target such as 20-50 pending assets, hard cap around 80, and select about 3-6 visible domains.",
2159
2189
  "- When candidates exceed the cap, rank by impact, heat, user count, dependency breadth, and under-covered domains; keep only direct context needed for selected pending assets and report overflow for later batches.",
2160
2190
  "- Draft only business domains with pending review assets. Completed/authenticated assets are necessary context under those visible domains, not standalone work and not a reason to display a zero-pending domain.",
@@ -2167,14 +2197,28 @@ var metadataGovernanceRecommendationExport = createAnalysisMetaCapabilityCommand
2167
2197
  capabilityId: "metadata.governance_recommendation.export",
2168
2198
  description: "Export the material package for CLI Agent asset-authentication and metric-recommendation review.",
2169
2199
  helpText: GOVERNANCE_RECOMMENDATION_EXPORT_HELP,
2170
- flags: [projectIdFlag, windowDaysFlag, limitFlag2, includeCompletedFlag],
2200
+ flags: [
2201
+ projectIdFlag,
2202
+ windowDaysFlag,
2203
+ limitFlag2,
2204
+ includeCompletedFlag,
2205
+ { name: "track-run", type: "boolean", required: false, desc: "Track the complete recommendation workflow through page submission or explicit run-update. Default: false for compatibility." },
2206
+ { name: "run-id", type: "string", required: false, desc: "Continue the same tracked workflow when expanding evidence. Requires --track-run true." }
2207
+ ],
2171
2208
  risk: "read",
2172
- buildInput: (ctx) => compactInput({
2173
- ...projectInput(ctx),
2174
- window_days: optionalNumber(ctx, "window-days"),
2175
- limit: optionalNumber(ctx, "limit"),
2176
- include_completed: optionalBoolean(ctx, "include-completed")
2177
- }),
2209
+ buildInput: (ctx) => {
2210
+ if (ctx.str("run-id") && optionalBoolean(ctx, "track-run") !== true) {
2211
+ throw new Error("--run-id requires --track-run true.");
2212
+ }
2213
+ return compactInput({
2214
+ ...projectInput(ctx),
2215
+ window_days: optionalNumber(ctx, "window-days"),
2216
+ limit: optionalNumber(ctx, "limit"),
2217
+ include_completed: optionalBoolean(ctx, "include-completed"),
2218
+ track_run: optionalBoolean(ctx, "track-run"),
2219
+ run_id: ctx.str("run-id") || void 0
2220
+ });
2221
+ },
2178
2222
  postProcess: (result, _input, ctx) => {
2179
2223
  normalizeResourceUrlFields(result, resolvePublicWebHost(ctx.host()), ctx.host());
2180
2224
  return result;
@@ -3003,6 +3047,7 @@ var metadataGovernanceRecommendationDecisions = createAnalysisMetaCapabilityComm
3003
3047
 
3004
3048
  // src/commands/te-analysis/meta/governance-recommendation/index.ts
3005
3049
  var commands11 = [
3050
+ metadataGovernanceRecommendationRunUpdate,
3006
3051
  metadataGovernanceRecommendationExport,
3007
3052
  metadataGovernanceRecommendationSubmit,
3008
3053
  metadataGovernanceRecommendationAutoReview,
@@ -3089,22 +3134,26 @@ var SUBMIT_TO_PAGE_HELP = [
3089
3134
  "- This command creates an asset certification review draft for humans. It never approves, certifies, retries, or creates metrics.",
3090
3135
  "- Use --input-file for real drafts. The file is JSON; --project-id and --client-request-id come from CLI flags so replays keep one stable operation key.",
3091
3136
  "- Build the file from review_material_package, preserving candidate assets, heat evidence, source_link/evidence_links, relations, report/AI-model definitions, target_revision, and hashes.",
3092
- "- For dashboard items, preserve optional space_id/space_name from the material package into evidence_snapshot.definition.config when present. Not every dashboard has a space; do not invent or require one.",
3137
+ "- For dashboard items, preserve optional space_id/space_name only from the authoritative packaged evidence_snapshot.definition.config, together with target_revision. Never synthesize or patch definition from space display facts. For older exports missing dashboard definition/revision, fetch analysis-meta agent-review evidence first. Not every dashboard has a space; do not invent or require one.",
3093
3138
  "- For recurring recommendation jobs, build the draft from the latest sufficient export: start at top-20 hot dashboards, expand to top-50/top-100 only when filtering leaves too few pending review assets or visible business domains, and record the final scope in batch ai_summary.",
3139
+ "- Do not query review history to select candidates. Select currently uncertified assets by business value and evidence, regardless of earlier recommendations or review decisions. Submission creates human review material only.",
3094
3140
  "- Expansion is for coverage, not unlimited workload. Target about 20-50 pending assets per daily batch, cap around 80, and balance roughly 3-6 visible domains with per-domain quotas before adding context.",
3095
3141
  "- If more pending candidates exist, submit the ranked slice and record overflow counts/domains in batch ai_summary for later batches.",
3096
3142
  "- presentation_snapshot should display only business-domain topics that contain pending review assets. Authenticated/completed assets may appear as context under those topics, but must not create standalone zero-pending topics.",
3097
3143
  "- Do not author long page-visible AI summaries for hidden topics or pure authenticated context. Copy evidence, links, signals, and relations for context; spend Agent interpretation on visible domains and pending review assets.",
3098
3144
  "- Scripts may assemble transport JSON and copy evidence, but page-visible ai_summary and analysis_explanation text must be Agent-written interpretation from verified evidence, not generated boilerplate.",
3099
- "- Follow agent_review_preflight.md: independent Agent review, at most 3 corrections, then submit with unresolved-quality warnings only when already authorized. LOCAL_ONLY never submits. Business meaning and visible-text quality are Agent review responsibilities; this command enforces only transport structure and evidence references.",
3100
- "- Follow agent_review_priorities_comparisons.md: item ai_summary includes recommendation.priority/priority_reason/evidence_refs, classified comparisons with both-side evidence, and comparison_review coverage. LOW is review urgency, not a defer decision; only POSSIBLE_CONFLICT merits a conflict badge. These assessments share the same 3-correction budget.",
3145
+ "- Ordinary recommendations use concise item reasons and core report meaning. Follow agent_review_preflight.md for one focused independent review of every business topic/subtopic and identified risks, plus whole-packet programmatic evidence checks. Do not repeat a full definition audit or polish copy through routine correction rounds. Full audits require explicit audit intent; LOCAL_ONLY never submits.",
3146
+ "- Priorities are optional for ordinary recommendations. Load agent_review_priorities_comparisons.md only for a priority request, concrete comparison/conflict clues, or a full audit. Do not require comparisons or comparison_review for unexamined ordinary items; absence never proves no conflict. Supplied comparisons retain both-side evidence and classification; only POSSIBLE_CONFLICT merits a conflict badge.",
3147
+ "- Each new topic and second-level business subtopic must include semantic_basis with business_question, grouping_reason, and evidence_item_ids from that topic or group respectively. These are Agent-authored interpretations; legacy packets without these optional fields remain accepted.",
3148
+ "- Follow the Business Topics and Subtopics contract in agent_review_submit_to_page.md: business domain -> business subtopic -> dashboards -> reports -> metadata. Group dashboards answering the same subtopic question together; never create one group per source dashboard by iteration or just rename those groups. Single-dashboard groups need a definition-based reason, not a minimum-count workaround.",
3101
3149
  "- presentation_snapshot.topics is one or more business-domain topics. Each topic must use groups[].items; do not use top-level topics[].items or raw Common work_units as the page grouping.",
3102
3150
  "- 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.",
3103
3151
  "- Each submitted item must keep source_link or evidence_links[].url so reviewers can jump to source evidence.",
3104
3152
  "- 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
3153
  "- 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.",
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.",
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.",
3154
+ "- For ordinary reports, one concise, factual core measure or calculation with resolvable evidence_snapshot.analysis refs is sufficient. Preserve packaged analysis and target_revision; do not require exhaustive SQL projection explanations. A purpose-only summary is incomplete and is rejected locally before dispatch.",
3155
+ "- Write concise business Chinese describing purpose, recommendation basis, core meaning and known material risks; metadata dependencies need only their role and specific risks. Keep raw SQL and implementation details in evidence_snapshot. Complete field-by-field explanations remain available for explicitly requested full audits.",
3156
+ "- Run local structure/evidence checks once, then submit once and read detail once. Remote --validate or --dry-run remains available for uncertain inputs or new contracts, not a routine extra step. Authorization, source links, identity, and core report evidence checks remain enforced.",
3108
3157
  "- 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.",
3109
3158
  "",
3110
3159
  "Input-file JSON shape:",
@@ -3124,8 +3173,9 @@ var SUBMIT_TO_PAGE_HELP = [
3124
3173
  ' "name": "<business-domain-name>",',
3125
3174
  ' "groups": [{',
3126
3175
  ' "id": "<second-level-group-id>",',
3127
- ' "name": "<second-level group or source dashboard>",',
3128
- ' "items": [{ "id": "<client_item_id>" }]',
3176
+ ' "name": "<business-subtopic-name>",',
3177
+ ' "semantic_basis": { "business_question": "<specific business question>", "grouping_reason": "<shared meaning and boundary from sibling subtopics>", "evidence_item_ids": ["<supporting item id in this group>"] },',
3178
+ ' "items": [{ "id": "<dashboard item id>" }, { "id": "<another related dashboard item id>" }, { "id": "<report item id>" }]',
3129
3179
  " }]",
3130
3180
  " }],",
3131
3181
  ' "relations": [{ "parent": "<dashboard item id>", "child": "<report item id>", "type": "contains" }, { "parent": "<report item id>", "child": "<metadata item id>", "type": "uses" }],',
@@ -3332,11 +3382,13 @@ function validatePresentation(presentation, itemIds) {
3332
3382
  const displayed = /* @__PURE__ */ new Set();
3333
3383
  for (const topicValue of array2(presentation.topics, "presentation_snapshot.topics")) {
3334
3384
  const topic = object(topicValue, "presentation_snapshot.topics[]");
3385
+ const topicItemIds = /* @__PURE__ */ new Set();
3335
3386
  if ("items" in topic) {
3336
3387
  throw new Error("presentation_snapshot.topics[] must use groups[].items, not top-level items.");
3337
3388
  }
3338
3389
  for (const groupValue of array2(topic.groups, "presentation_snapshot.topics[].groups")) {
3339
3390
  const group = object(groupValue, "presentation_snapshot.topics[].groups[]");
3391
+ const groupItemIds = /* @__PURE__ */ new Set();
3340
3392
  if (typeof group.id !== "string" || !group.id.trim() || typeof group.name !== "string" || !group.name.trim()) {
3341
3393
  throw new Error("presentation_snapshot.topics[].groups[] requires nonempty string id and name.");
3342
3394
  }
@@ -3349,6 +3401,32 @@ function validatePresentation(presentation, itemIds) {
3349
3401
  throw new Error("presentation_snapshot references an unknown client_item_id.");
3350
3402
  }
3351
3403
  displayed.add(item.id);
3404
+ topicItemIds.add(item.id);
3405
+ groupItemIds.add(item.id);
3406
+ }
3407
+ if (group.semantic_basis !== void 0) {
3408
+ const basis = object(group.semantic_basis, "presentation_snapshot.topics[].groups[].semantic_basis");
3409
+ for (const field of ["business_question", "grouping_reason"]) {
3410
+ if (typeof basis[field] !== "string" || !basis[field].trim()) {
3411
+ throw new Error(`group.semantic_basis.${field} must explain the business meaning of this subtopic.`);
3412
+ }
3413
+ }
3414
+ const references = array2(basis.evidence_item_ids, "group.semantic_basis.evidence_item_ids");
3415
+ if (!references.length || references.some((id) => typeof id !== "string" || !groupItemIds.has(id))) {
3416
+ throw new Error("group.semantic_basis.evidence_item_ids must reference items displayed in the same group.");
3417
+ }
3418
+ }
3419
+ }
3420
+ if (topic.semantic_basis !== void 0) {
3421
+ const basis = object(topic.semantic_basis, "presentation_snapshot.topics[].semantic_basis");
3422
+ for (const field of ["business_question", "grouping_reason"]) {
3423
+ if (typeof basis[field] !== "string" || !String(basis[field]).trim()) {
3424
+ throw new Error(`semantic_basis.${field} must explain the business meaning of this topic.`);
3425
+ }
3426
+ }
3427
+ const references = array2(basis.evidence_item_ids, "semantic_basis.evidence_item_ids");
3428
+ if (!references.length || references.some((id) => typeof id !== "string" || !topicItemIds.has(id))) {
3429
+ throw new Error("semantic_basis.evidence_item_ids must reference items displayed in the same topic.");
3352
3430
  }
3353
3431
  }
3354
3432
  }
@@ -4990,11 +5068,11 @@ var dashboardReportGet = createAnalysisCapabilityCommand({
4990
5068
  resource: "dashboard-report",
4991
5069
  command: "get",
4992
5070
  capabilityId: "analysis.dashboard_report.get",
4993
- description: "Get an event report card presentation on one analysis dashboard, not the source report definition.",
5071
+ description: "Get one analysis-board report card frame size, saved grid position, dashboard layout version, and event presentation; not the source report definition.",
4994
5072
  flags: [
4995
5073
  projectIdFlag,
4996
5074
  { 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." }
5075
+ { name: "report-id", type: "number", required: true, desc: "Existing report ID on that dashboard. Event cards also return chart and table presentation." }
4998
5076
  ],
4999
5077
  risk: "read",
5000
5078
  buildInput: (ctx) => ({
@@ -5009,11 +5087,15 @@ var dashboardReportUpdate = createAnalysisCapabilityCommand({
5009
5087
  resource: "dashboard-report",
5010
5088
  command: "update",
5011
5089
  capabilityId: "analysis.dashboard_report.update",
5012
- description: "Update one event report card presentation without changing the source report definition or other dashboards.",
5090
+ description: "Update one analysis-board report card frame size or grid position, or an event card presentation, without changing its source definition or other dashboards.",
5013
5091
  flags: [
5014
5092
  projectIdFlag,
5015
5093
  { 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." },
5094
+ { name: "report-id", type: "number", required: true, desc: "Existing report ID on that dashboard. Chart and table settings require an event report." },
5095
+ { name: "frame-size", type: "string", required: false, desc: "Card frame size: medium or large. Omit to preserve. Requires the current --reports-version from dashboard-report get." },
5096
+ { name: "position-x", type: "number", required: false, desc: "Zero-based horizontal grid coordinate, 0..19 on a 20-column board. Supply with --position-y and --reports-version. Must fit the saved card width; occupied destinations are rejected." },
5097
+ { name: "position-y", type: "number", required: false, desc: "Zero-based vertical grid coordinate, 0..10000, not pixels. Supply with --position-x and --reports-version. Requires an initialized saved board layout; the page may vertically compact gaps." },
5098
+ { name: "reports-version", type: "number", required: false, desc: "Fresh dashboard layout version from dashboard-report get. Required for frame-size or position changes; stale versions are rejected without partial writes. This is not the source report version." },
5017
5099
  { 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
5100
  { name: "table-layout", type: "string", required: false, desc: "Table layout: date, event, or group. Omit to preserve it." },
5019
5101
  { 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." }
@@ -5023,8 +5105,35 @@ var dashboardReportUpdate = createAnalysisCapabilityCommand({
5023
5105
  const chartType = optionalString(ctx, "chart-type");
5024
5106
  const tableLayout = optionalString(ctx, "table-layout");
5025
5107
  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.");
5108
+ const frameSize = optionalString(ctx, "frame-size");
5109
+ const x = optionalNumber(ctx, "position-x");
5110
+ const y = optionalNumber(ctx, "position-y");
5111
+ const version = optionalNumber(ctx, "reports-version");
5112
+ if (frameSize !== void 0 && !["medium", "large"].includes(frameSize)) {
5113
+ throw new Error("--frame-size must be medium or large.");
5114
+ }
5115
+ if (x === void 0 !== (y === void 0)) {
5116
+ throw new Error("--position-x and --position-y must be supplied together.");
5117
+ }
5118
+ for (const [name, value] of [["position-x", x], ["position-y", y], ["reports-version", version]]) {
5119
+ if (value !== void 0 && (!Number.isSafeInteger(value) || value < 0)) {
5120
+ throw new Error(`--${name} must be a non-negative safe integer.`);
5121
+ }
5122
+ }
5123
+ if (x !== void 0 && x >= 20) {
5124
+ throw new Error("--position-x must be between 0 and 19 and fit the saved card width.");
5125
+ }
5126
+ if (y !== void 0 && y > 1e4) {
5127
+ throw new Error("--position-y must be between 0 and 10000.");
5128
+ }
5129
+ if (version === Number.MAX_SAFE_INTEGER) {
5130
+ throw new Error("--reports-version must be safely incrementable; reread the dashboard version.");
5131
+ }
5132
+ if ((frameSize !== void 0 || x !== void 0) && version === void 0) {
5133
+ throw new Error("--reports-version from dashboard-report get is required for frame-size or position changes.");
5134
+ }
5135
+ if (chartType === void 0 && tableLayout === void 0 && dateOutside === void 0 && frameSize === void 0 && x === void 0) {
5136
+ throw new Error("At least one of --chart-type, --table-layout, --date-outside, --frame-size, or --position-x/--position-y is required.");
5028
5137
  }
5029
5138
  if (chartType !== void 0 && !["line", "combo", "bar", "stacked", "cumulative", "pie", "table"].includes(chartType)) {
5030
5139
  throw new Error("--chart-type must be line, combo, bar, stacked, cumulative, pie, or table.");
@@ -5033,16 +5142,23 @@ var dashboardReportUpdate = createAnalysisCapabilityCommand({
5033
5142
  throw new Error("--table-layout must be date, event, or group.");
5034
5143
  }
5035
5144
  },
5036
- buildInput: (ctx) => ({
5037
- ...projectInput(ctx),
5038
- dashboard_id: ctx.num("dashboard-id"),
5039
- report_id: ctx.num("report-id"),
5040
- presentation: compactInput({
5145
+ buildInput: (ctx) => {
5146
+ const presentation = compactInput({
5041
5147
  chart_type: optionalString(ctx, "chart-type"),
5042
5148
  table_layout: optionalString(ctx, "table-layout"),
5043
5149
  date_outside: optionalBoolean(ctx, "date-outside")
5044
- })
5045
- })
5150
+ });
5151
+ const x = optionalNumber(ctx, "position-x");
5152
+ return compactInput({
5153
+ ...projectInput(ctx),
5154
+ dashboard_id: ctx.num("dashboard-id"),
5155
+ report_id: ctx.num("report-id"),
5156
+ frame_size: optionalString(ctx, "frame-size"),
5157
+ position: x === void 0 ? void 0 : { x, y: optionalNumber(ctx, "position-y") },
5158
+ reports_version: optionalNumber(ctx, "reports-version"),
5159
+ presentation: Object.keys(presentation).length === 0 ? void 0 : presentation
5160
+ });
5161
+ }
5046
5162
  });
5047
5163
 
5048
5164
  // src/commands/te-analysis/dashboard-report/index.ts
@@ -8327,6 +8443,165 @@ var commands55 = [
8327
8443
  ];
8328
8444
  var member_candidate_default = commands55;
8329
8445
 
8446
+ // src/commands/te-analysis/project/member-group/shared.ts
8447
+ var MAX_ID = 2147483647;
8448
+ var memberGroupProjectIdFlag = { ...projectIdFlag, min: 1, max: MAX_ID };
8449
+ var memberGroupIdFlag = {
8450
+ name: "group-id",
8451
+ type: "number",
8452
+ required: true,
8453
+ min: 1,
8454
+ max: MAX_ID,
8455
+ desc: "Project member-group ID from project member-group list."
8456
+ };
8457
+ var memberGroupNameFlag = {
8458
+ name: "group-name",
8459
+ type: "string",
8460
+ required: true,
8461
+ desc: "Member-group name, from 1 to 80 characters."
8462
+ };
8463
+ var memberGroupUserIdsFlag = {
8464
+ name: "user-ids",
8465
+ type: "json",
8466
+ required: true,
8467
+ desc: "JSON array of 1 to 1000 positive user IDs. Verify IDs with project member list or member-group members. Changes only these group memberships."
8468
+ };
8469
+ var memberGroupPaginationFlags = [
8470
+ { name: "limit", type: "number", min: 1, max: 1e3, desc: "Page size, from 1 to 1000. Default: 100." },
8471
+ { name: "offset", type: "number", min: 0, desc: "Zero-based row offset. Default: 0." }
8472
+ ];
8473
+ function integer(ctx, flag, min, max = MAX_ID) {
8474
+ const value = ctx.num(flag);
8475
+ if (!Number.isSafeInteger(value) || value < min || value > max) {
8476
+ throw new CliValidationError(`--${flag} must be an integer between ${min} and ${max}.`);
8477
+ }
8478
+ return value;
8479
+ }
8480
+ function memberGroupProjectInput(ctx) {
8481
+ return { project_id: integer(ctx, "project-id", 1) };
8482
+ }
8483
+ function memberGroupInput(ctx) {
8484
+ return { ...memberGroupProjectInput(ctx), group_id: integer(ctx, "group-id", 1) };
8485
+ }
8486
+ function memberGroupPaginationInput(ctx) {
8487
+ return {
8488
+ ...ctx.str("limit") ? { limit: integer(ctx, "limit", 1, 1e3) } : {},
8489
+ ...ctx.str("offset") ? { offset: integer(ctx, "offset", 0) } : {}
8490
+ };
8491
+ }
8492
+ function memberGroupNameInput(ctx) {
8493
+ const name = ctx.str("group-name");
8494
+ if (!name.trim() || name.length > 80) {
8495
+ throw new CliValidationError("--group-name must contain 1 to 80 characters and must not be blank.");
8496
+ }
8497
+ return { group_name: name };
8498
+ }
8499
+ function memberGroupChangeInput(ctx) {
8500
+ const input = memberGroupInput(ctx);
8501
+ let userIds;
8502
+ try {
8503
+ userIds = ctx.json("user-ids");
8504
+ } catch {
8505
+ throw new CliValidationError("--user-ids must be a JSON array of positive user IDs.");
8506
+ }
8507
+ if (!Array.isArray(userIds) || userIds.length === 0 || userIds.length > 1e3 || userIds.some((id) => !Number.isSafeInteger(id) || id < 1 || id > MAX_ID)) {
8508
+ throw new CliValidationError("--user-ids must contain 1 to 1000 positive integer user IDs.");
8509
+ }
8510
+ return { ...input, user_ids: userIds, yes: true };
8511
+ }
8512
+
8513
+ // src/commands/te-analysis/project/member-group/add-members.ts
8514
+ var projectMemberGroupAddMembers = createAnalysisCapabilityCommand({
8515
+ resource: "project member-group",
8516
+ command: "add-members",
8517
+ capabilityId: "project.member_group.add_members",
8518
+ description: "Add existing project members to a member group while preserving its other members and settings.",
8519
+ helpText: "Group membership can grant access to shared assets. Discover user IDs with project member list and review --dry-run before confirming with --yes.",
8520
+ flags: [memberGroupProjectIdFlag, memberGroupIdFlag, memberGroupUserIdsFlag],
8521
+ risk: "high-risk-write",
8522
+ buildInput: memberGroupChangeInput
8523
+ });
8524
+
8525
+ // src/commands/te-analysis/project/member-group/create.ts
8526
+ var projectMemberGroupCreate = createAnalysisCapabilityCommand({
8527
+ resource: "project member-group",
8528
+ command: "create",
8529
+ capabilityId: "project.member_group.create",
8530
+ description: "Create an empty project member group without automatic enrollment of new project members.",
8531
+ flags: [memberGroupProjectIdFlag, memberGroupNameFlag],
8532
+ risk: "write",
8533
+ buildInput: (ctx) => ({ ...memberGroupProjectInput(ctx), ...memberGroupNameInput(ctx) })
8534
+ });
8535
+
8536
+ // src/commands/te-analysis/project/member-group/delete.ts
8537
+ var projectMemberGroupDelete = createAnalysisCapabilityCommand({
8538
+ resource: "project member-group",
8539
+ command: "delete",
8540
+ capabilityId: "project.member_group.delete",
8541
+ description: "Delete a project member group while retaining its company and project members.",
8542
+ helpText: "Deleting a member group can revoke access to shared assets. Review --dry-run before confirming with --yes.",
8543
+ flags: [memberGroupProjectIdFlag, memberGroupIdFlag],
8544
+ risk: "high-risk-write",
8545
+ buildInput: (ctx) => ({ ...memberGroupInput(ctx), yes: true })
8546
+ });
8547
+
8548
+ // src/commands/te-analysis/project/member-group/list.ts
8549
+ var projectMemberGroupList = createAnalysisCapabilityCommand({
8550
+ resource: "project member-group",
8551
+ command: "list",
8552
+ capabilityId: "project.member_group.list",
8553
+ description: "List project member groups, their default-join settings, and member counts.",
8554
+ flags: [memberGroupProjectIdFlag, ...memberGroupPaginationFlags],
8555
+ risk: "read",
8556
+ buildInput: (ctx) => ({ ...memberGroupProjectInput(ctx), ...memberGroupPaginationInput(ctx) })
8557
+ });
8558
+
8559
+ // src/commands/te-analysis/project/member-group/members.ts
8560
+ var projectMemberGroupMembers = createAnalysisCapabilityCommand({
8561
+ resource: "project member-group",
8562
+ command: "members",
8563
+ capabilityId: "project.member_group.members",
8564
+ description: "List members of one project member group with pagination.",
8565
+ flags: [memberGroupProjectIdFlag, memberGroupIdFlag, ...memberGroupPaginationFlags],
8566
+ risk: "read",
8567
+ buildInput: (ctx) => ({ ...memberGroupInput(ctx), ...memberGroupPaginationInput(ctx) })
8568
+ });
8569
+
8570
+ // src/commands/te-analysis/project/member-group/remove-members.ts
8571
+ var projectMemberGroupRemoveMembers = createAnalysisCapabilityCommand({
8572
+ resource: "project member-group",
8573
+ command: "remove-members",
8574
+ capabilityId: "project.member_group.remove_members",
8575
+ description: "Remove selected members from a member group while preserving its other members and settings.",
8576
+ helpText: "Group membership can grant access to shared assets. This removes group memberships only; project and company accounts are retained. Review --dry-run before confirming with --yes.",
8577
+ flags: [memberGroupProjectIdFlag, memberGroupIdFlag, memberGroupUserIdsFlag],
8578
+ risk: "high-risk-write",
8579
+ buildInput: memberGroupChangeInput
8580
+ });
8581
+
8582
+ // src/commands/te-analysis/project/member-group/rename.ts
8583
+ var projectMemberGroupRename = createAnalysisCapabilityCommand({
8584
+ resource: "project member-group",
8585
+ command: "rename",
8586
+ capabilityId: "project.member_group.rename",
8587
+ description: "Rename a project member group while preserving all members and default-join settings.",
8588
+ flags: [memberGroupProjectIdFlag, memberGroupIdFlag, memberGroupNameFlag],
8589
+ risk: "write",
8590
+ buildInput: (ctx) => ({ ...memberGroupInput(ctx), ...memberGroupNameInput(ctx) })
8591
+ });
8592
+
8593
+ // src/commands/te-analysis/project/member-group/index.ts
8594
+ var commands56 = [
8595
+ projectMemberGroupAddMembers,
8596
+ projectMemberGroupCreate,
8597
+ projectMemberGroupDelete,
8598
+ projectMemberGroupList,
8599
+ projectMemberGroupMembers,
8600
+ projectMemberGroupRemoveMembers,
8601
+ projectMemberGroupRename
8602
+ ];
8603
+ var member_group_default = commands56;
8604
+
8330
8605
  // src/commands/te-analysis/project/member-handover/export.ts
8331
8606
  var projectMemberHandoverExport = createAnalysisCapabilityCommand({
8332
8607
  resource: "project member-handover",
@@ -8366,11 +8641,11 @@ var projectMemberHandoverRun = createAnalysisCapabilityCommand({
8366
8641
  });
8367
8642
 
8368
8643
  // src/commands/te-analysis/project/member-handover/index.ts
8369
- var commands56 = [
8644
+ var commands57 = [
8370
8645
  projectMemberHandoverExport,
8371
8646
  projectMemberHandoverRun
8372
8647
  ];
8373
- var member_handover_default = commands56;
8648
+ var member_handover_default = commands57;
8374
8649
 
8375
8650
  // src/commands/te-analysis/project/member-receiver/list.ts
8376
8651
  var projectMemberReceiverList = createAnalysisCapabilityCommand({
@@ -8388,10 +8663,10 @@ var projectMemberReceiverList = createAnalysisCapabilityCommand({
8388
8663
  });
8389
8664
 
8390
8665
  // src/commands/te-analysis/project/member-receiver/index.ts
8391
- var commands57 = [
8666
+ var commands58 = [
8392
8667
  projectMemberReceiverList
8393
8668
  ];
8394
- var member_receiver_default = commands57;
8669
+ var member_receiver_default = commands58;
8395
8670
 
8396
8671
  // src/commands/te-analysis/project/owner/update.ts
8397
8672
  var projectOwnerUpdate = createAnalysisCapabilityCommand({
@@ -8417,10 +8692,10 @@ var projectOwnerUpdate = createAnalysisCapabilityCommand({
8417
8692
  });
8418
8693
 
8419
8694
  // src/commands/te-analysis/project/owner/index.ts
8420
- var commands58 = [
8695
+ var commands59 = [
8421
8696
  projectOwnerUpdate
8422
8697
  ];
8423
- var owner_default = commands58;
8698
+ var owner_default = commands59;
8424
8699
 
8425
8700
  // src/commands/te-analysis/project/permission-binding/list.ts
8426
8701
  var projectPermissionBindingList = createAnalysisCapabilityCommand({
@@ -8442,10 +8717,10 @@ var projectPermissionBindingList = createAnalysisCapabilityCommand({
8442
8717
  });
8443
8718
 
8444
8719
  // src/commands/te-analysis/project/permission-binding/index.ts
8445
- var commands59 = [
8720
+ var commands60 = [
8446
8721
  projectPermissionBindingList
8447
8722
  ];
8448
- var permission_binding_default = commands59;
8723
+ var permission_binding_default = commands60;
8449
8724
 
8450
8725
  // src/commands/te-analysis/project/receive-status/update.ts
8451
8726
  var projectReceiveStatusUpdate = createAnalysisCapabilityCommand({
@@ -8466,10 +8741,10 @@ var projectReceiveStatusUpdate = createAnalysisCapabilityCommand({
8466
8741
  });
8467
8742
 
8468
8743
  // src/commands/te-analysis/project/receive-status/index.ts
8469
- var commands60 = [
8744
+ var commands61 = [
8470
8745
  projectReceiveStatusUpdate
8471
8746
  ];
8472
- var receive_status_default = commands60;
8747
+ var receive_status_default = commands61;
8473
8748
 
8474
8749
  // src/commands/te-analysis/project/role/delete.ts
8475
8750
  var projectRoleDelete = createAnalysisCapabilityCommand({
@@ -8561,13 +8836,13 @@ var projectRoleUpsert = createAnalysisCapabilityCommand({
8561
8836
  });
8562
8837
 
8563
8838
  // src/commands/te-analysis/project/role/index.ts
8564
- var commands61 = [
8839
+ var commands62 = [
8565
8840
  projectRoleDelete,
8566
8841
  projectRoleGet,
8567
8842
  projectRoleList,
8568
8843
  projectRoleUpsert
8569
8844
  ];
8570
- var role_default = commands61;
8845
+ var role_default = commands62;
8571
8846
 
8572
8847
  // src/commands/te-analysis/project/role-function/list.ts
8573
8848
  var projectRoleFunctionList = createAnalysisCapabilityCommand({
@@ -8593,10 +8868,10 @@ var projectRoleFunctionList = createAnalysisCapabilityCommand({
8593
8868
  });
8594
8869
 
8595
8870
  // src/commands/te-analysis/project/role-function/index.ts
8596
- var commands62 = [
8871
+ var commands63 = [
8597
8872
  projectRoleFunctionList
8598
8873
  ];
8599
- var role_function_default = commands62;
8874
+ var role_function_default = commands63;
8600
8875
 
8601
8876
  // src/commands/te-analysis/project/role-user/list.ts
8602
8877
  var projectRoleUserList = createAnalysisCapabilityCommand({
@@ -8616,10 +8891,10 @@ var projectRoleUserList = createAnalysisCapabilityCommand({
8616
8891
  });
8617
8892
 
8618
8893
  // src/commands/te-analysis/project/role-user/index.ts
8619
- var commands63 = [
8894
+ var commands64 = [
8620
8895
  projectRoleUserList
8621
8896
  ];
8622
- var role_user_default = commands63;
8897
+ var role_user_default = commands64;
8623
8898
 
8624
8899
  // src/commands/te-analysis/project/timezone/get.ts
8625
8900
  var projectTimezoneGet = createAnalysisCapabilityCommand({
@@ -8757,12 +9032,12 @@ function isObject(value) {
8757
9032
  }
8758
9033
 
8759
9034
  // src/commands/te-analysis/project/timezone/index.ts
8760
- var commands64 = [
9035
+ var commands65 = [
8761
9036
  projectTimezoneGet,
8762
9037
  projectTimezoneOverview,
8763
9038
  projectTimezoneUpdate
8764
9039
  ];
8765
- var timezone_default = commands64;
9040
+ var timezone_default = commands65;
8766
9041
 
8767
9042
  // src/commands/te-analysis/project/user-id-items/update.ts
8768
9043
  var projectUserIdItemsUpdate = createAnalysisCapabilityCommand({
@@ -8782,13 +9057,13 @@ var projectUserIdItemsUpdate = createAnalysisCapabilityCommand({
8782
9057
  });
8783
9058
 
8784
9059
  // src/commands/te-analysis/project/user-id-items/index.ts
8785
- var commands65 = [
9060
+ var commands66 = [
8786
9061
  projectUserIdItemsUpdate
8787
9062
  ];
8788
- var user_id_items_default = commands65;
9063
+ var user_id_items_default = commands66;
8789
9064
 
8790
9065
  // src/commands/te-analysis/project/index.ts
8791
- var commands66 = [
9066
+ var commands67 = [
8792
9067
  ...access_detail_default,
8793
9068
  ...data_power_default,
8794
9069
  ...entity_default2,
@@ -8798,6 +9073,7 @@ var commands66 = [
8798
9073
  ...mark_time_default,
8799
9074
  ...member_default,
8800
9075
  ...member_candidate_default,
9076
+ ...member_group_default,
8801
9077
  ...member_handover_default,
8802
9078
  ...member_receiver_default,
8803
9079
  ...owner_default,
@@ -8809,7 +9085,7 @@ var commands66 = [
8809
9085
  ...timezone_default,
8810
9086
  ...user_id_items_default
8811
9087
  ];
8812
- var project_default = commands66;
9088
+ var project_default = commands67;
8813
9089
 
8814
9090
  // src/commands/te-analysis/tracking/shared.ts
8815
9091
  function createTrackingCapabilityCommand(config) {
@@ -9540,7 +9816,7 @@ function counts(plan, value) {
9540
9816
  }
9541
9817
 
9542
9818
  // src/commands/te-analysis/tracking/plan/index.ts
9543
- var commands67 = [
9819
+ var commands68 = [
9544
9820
  trackingPlanGet,
9545
9821
  trackingPlanSaveItems,
9546
9822
  trackingPlanDeleteItems,
@@ -9550,7 +9826,7 @@ var commands67 = [
9550
9826
  trackingPlanSyncFromMeta,
9551
9827
  trackingPlanSyncDisplayNames
9552
9828
  ];
9553
- var plan_default = commands67;
9829
+ var plan_default = commands68;
9554
9830
 
9555
9831
  // src/commands/te-analysis/tracking/sdk-sample/generate.ts
9556
9832
  var trackingSdkSampleGenerate = createTrackingCapabilityCommand({
@@ -9564,10 +9840,10 @@ var trackingSdkSampleGenerate = createTrackingCapabilityCommand({
9564
9840
  });
9565
9841
 
9566
9842
  // src/commands/te-analysis/tracking/sdk-sample/index.ts
9567
- var commands68 = [
9843
+ var commands69 = [
9568
9844
  trackingSdkSampleGenerate
9569
9845
  ];
9570
- var sdk_sample_default = commands68;
9846
+ var sdk_sample_default = commands69;
9571
9847
 
9572
9848
  // src/commands/te-analysis/tracking/plan-change-log/list.ts
9573
9849
  var trackingPlanChangeLogList = createTrackingCapabilityCommand({
@@ -9593,11 +9869,11 @@ var trackingPlanChangeLogExport = createTrackingCapabilityCommand({
9593
9869
  });
9594
9870
 
9595
9871
  // src/commands/te-analysis/tracking/plan-change-log/index.ts
9596
- var commands69 = [
9872
+ var commands70 = [
9597
9873
  trackingPlanChangeLogList,
9598
9874
  trackingPlanChangeLogExport
9599
9875
  ];
9600
- var plan_change_log_default = commands69;
9876
+ var plan_change_log_default = commands70;
9601
9877
 
9602
9878
  // src/commands/te-analysis/tracking/check/run.ts
9603
9879
  var trackingCheckRun = createTrackingCapabilityCommand({
@@ -9671,7 +9947,7 @@ var trackingCheckExport = createTrackingCapabilityCommand({
9671
9947
  });
9672
9948
 
9673
9949
  // src/commands/te-analysis/tracking/check/index.ts
9674
- var commands70 = [
9950
+ var commands71 = [
9675
9951
  trackingCheckRun,
9676
9952
  trackingCheckList,
9677
9953
  trackingCheckGet,
@@ -9679,7 +9955,7 @@ var commands70 = [
9679
9955
  trackingCheckDelete,
9680
9956
  trackingCheckExport
9681
9957
  ];
9682
- var check_default = commands70;
9958
+ var check_default = commands71;
9683
9959
 
9684
9960
  // src/commands/te-analysis/tracking/ingest/summary.ts
9685
9961
  var trackingIngestSummary = createTrackingCapabilityCommand({
@@ -9693,10 +9969,10 @@ var trackingIngestSummary = createTrackingCapabilityCommand({
9693
9969
  });
9694
9970
 
9695
9971
  // src/commands/te-analysis/tracking/ingest/index.ts
9696
- var commands71 = [
9972
+ var commands72 = [
9697
9973
  trackingIngestSummary
9698
9974
  ];
9699
- var ingest_default = commands71;
9975
+ var ingest_default = commands72;
9700
9976
 
9701
9977
  // src/commands/te-analysis/tracking/ingest-error/list.ts
9702
9978
  var trackingIngestErrorList = createTrackingCapabilityCommand({
@@ -9710,10 +9986,10 @@ var trackingIngestErrorList = createTrackingCapabilityCommand({
9710
9986
  });
9711
9987
 
9712
9988
  // src/commands/te-analysis/tracking/ingest-error/index.ts
9713
- var commands72 = [
9989
+ var commands73 = [
9714
9990
  trackingIngestErrorList
9715
9991
  ];
9716
- var ingest_error_default = commands72;
9992
+ var ingest_error_default = commands73;
9717
9993
 
9718
9994
  // src/commands/te-analysis/tracking/live-data/list.ts
9719
9995
  var trackingLiveDataList = createTrackingCapabilityCommand({
@@ -9739,11 +10015,11 @@ var trackingLiveDataExport = createTrackingCapabilityCommand({
9739
10015
  });
9740
10016
 
9741
10017
  // src/commands/te-analysis/tracking/live-data/index.ts
9742
- var commands73 = [
10018
+ var commands74 = [
9743
10019
  trackingLiveDataList,
9744
10020
  trackingLiveDataExport
9745
10021
  ];
9746
- var live_data_default = commands73;
10022
+ var live_data_default = commands74;
9747
10023
 
9748
10024
  // src/commands/te-analysis/tracking/event-blacklist/list.ts
9749
10025
  var trackingEventBlacklistList = createTrackingCapabilityCommand({
@@ -9779,12 +10055,12 @@ var trackingEventBlacklistUpdate = createTrackingCapabilityCommand({
9779
10055
  });
9780
10056
 
9781
10057
  // src/commands/te-analysis/tracking/event-blacklist/index.ts
9782
- var commands74 = [
10058
+ var commands75 = [
9783
10059
  trackingEventBlacklistList,
9784
10060
  trackingEventBlacklistAdd,
9785
10061
  trackingEventBlacklistUpdate
9786
10062
  ];
9787
- var event_blacklist_default = commands74;
10063
+ var event_blacklist_default = commands75;
9788
10064
 
9789
10065
  // src/commands/te-analysis/tracking/debug-device/add.ts
9790
10066
  var trackingDebugDeviceAdd = createTrackingCapabilityCommand({
@@ -9827,12 +10103,12 @@ var trackingDebugDeviceSelect = createTrackingCapabilityCommand({
9827
10103
  });
9828
10104
 
9829
10105
  // src/commands/te-analysis/tracking/debug-device/index.ts
9830
- var commands75 = [
10106
+ var commands76 = [
9831
10107
  trackingDebugDeviceList,
9832
10108
  trackingDebugDeviceAdd,
9833
10109
  trackingDebugDeviceSelect
9834
10110
  ];
9835
- var debug_device_default = commands75;
10111
+ var debug_device_default = commands76;
9836
10112
 
9837
10113
  // src/commands/te-analysis/tracking/debug-data/list.ts
9838
10114
  var debugStartTimeFlag = {
@@ -9891,11 +10167,11 @@ function isRecord3(value) {
9891
10167
  }
9892
10168
 
9893
10169
  // src/commands/te-analysis/tracking/debug-data/index.ts
9894
- var commands76 = [trackingDebugDataList];
9895
- var debug_data_default = commands76;
10170
+ var commands77 = [trackingDebugDataList];
10171
+ var debug_data_default = commands77;
9896
10172
 
9897
10173
  // src/commands/te-analysis/tracking/index.ts
9898
- var commands77 = [
10174
+ var commands78 = [
9899
10175
  ...plan_default,
9900
10176
  ...sdk_sample_default,
9901
10177
  ...plan_change_log_default,
@@ -9907,7 +10183,7 @@ var commands77 = [
9907
10183
  ...debug_device_default,
9908
10184
  ...debug_data_default
9909
10185
  ];
9910
- var tracking_default = commands77;
10186
+ var tracking_default = commands78;
9911
10187
 
9912
10188
  // src/commands/te-analysis/alert/shared.ts
9913
10189
  var alertIdFlag = {
@@ -10020,7 +10296,7 @@ var analysisAlertStop = createAnalysisCapabilityCommand({
10020
10296
  });
10021
10297
 
10022
10298
  // src/commands/te-analysis/alert/index.ts
10023
- var commands78 = [
10299
+ var commands79 = [
10024
10300
  analysisAlertList,
10025
10301
  analysisAlertGet,
10026
10302
  analysisAlertCreate,
@@ -10029,7 +10305,7 @@ var commands78 = [
10029
10305
  analysisAlertStart,
10030
10306
  analysisAlertStop
10031
10307
  ];
10032
- var alert_default = commands78;
10308
+ var alert_default = commands79;
10033
10309
 
10034
10310
  // src/commands/te-analysis/alert-detail/list.ts
10035
10311
  var analysisAlertDetailList = createAnalysisCapabilityCommand({
@@ -10043,10 +10319,10 @@ var analysisAlertDetailList = createAnalysisCapabilityCommand({
10043
10319
  });
10044
10320
 
10045
10321
  // src/commands/te-analysis/alert-detail/index.ts
10046
- var commands79 = [
10322
+ var commands80 = [
10047
10323
  analysisAlertDetailList
10048
10324
  ];
10049
- var alert_detail_default = commands79;
10325
+ var alert_detail_default = commands80;
10050
10326
 
10051
10327
  // src/commands/te-analysis/alert-job/list.ts
10052
10328
  var analysisAlertJobList = createAnalysisCapabilityCommand({
@@ -10060,10 +10336,10 @@ var analysisAlertJobList = createAnalysisCapabilityCommand({
10060
10336
  });
10061
10337
 
10062
10338
  // src/commands/te-analysis/alert-job/index.ts
10063
- var commands80 = [
10339
+ var commands81 = [
10064
10340
  analysisAlertJobList
10065
10341
  ];
10066
- var alert_job_default = commands80;
10342
+ var alert_job_default = commands81;
10067
10343
 
10068
10344
  // src/commands/te-analysis/alert-notice-config/list.ts
10069
10345
  var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
@@ -10077,10 +10353,10 @@ var analysisAlertNoticeConfigList = createAnalysisCapabilityCommand({
10077
10353
  });
10078
10354
 
10079
10355
  // src/commands/te-analysis/alert-notice-config/index.ts
10080
- var commands81 = [
10356
+ var commands82 = [
10081
10357
  analysisAlertNoticeConfigList
10082
10358
  ];
10083
- var alert_notice_config_default = commands81;
10359
+ var alert_notice_config_default = commands82;
10084
10360
 
10085
10361
  // src/commands/te-analysis/system/shared.ts
10086
10362
  import { readFileSync as readFileSync3, statSync as statSync3 } from "fs";
@@ -11165,14 +11441,14 @@ var systemUsageCommands = [
11165
11441
  ];
11166
11442
 
11167
11443
  // src/commands/te-analysis/system/index.ts
11168
- var commands82 = [
11444
+ var commands83 = [
11169
11445
  ...systemUsageCommands,
11170
11446
  ...systemIdentityCommands,
11171
11447
  ...systemSecurityCommands,
11172
11448
  ...systemMonitoringCommands,
11173
11449
  ...systemConfigurationCommands
11174
11450
  ];
11175
- var system_default = commands82;
11451
+ var system_default = commands83;
11176
11452
 
11177
11453
  // src/commands/te-analysis/feedback/submit.ts
11178
11454
  import { createHash as createHash4, randomUUID as randomUUID2 } from "crypto";
@@ -11257,6 +11533,213 @@ var analysisFeedbackSubmit = createAnalysisCapabilityCommand({
11257
11533
  // src/commands/te-analysis/feedback/index.ts
11258
11534
  var feedback_default = [analysisFeedbackSubmit];
11259
11535
 
11536
+ // src/commands/te-analysis/scenario/index.ts
11537
+ function text2(value, field, max) {
11538
+ if (typeof value !== "string" || !value.trim() || value.length > max) throw new CliValidationError(`${field} must be nonblank and at most ${max} characters.`);
11539
+ return value;
11540
+ }
11541
+ function scenarioInput(ctx, append = false) {
11542
+ const agent = readCliAgentContext();
11543
+ const session = text2(agent.agent_session_id ?? "", "agent_session_id", 191);
11544
+ const questionId = text2(ctx.str("question-id") || (!append ? agent.agent_turn_id ?? "" : ""), "question-id", 191);
11545
+ const projectId = ctx.optionalNum("project-id");
11546
+ if (projectId !== void 0 && (!Number.isInteger(projectId) || projectId <= 0)) throw new CliValidationError("project-id must be a positive integer.");
11547
+ const input = {
11548
+ agent_session_id: session,
11549
+ question_id: questionId,
11550
+ ...projectId !== void 0 ? { project_id: projectId } : {}
11551
+ };
11552
+ const entryType = append ? text2(ctx.str("entry-type"), "entry-type", 32) : "answer";
11553
+ if (!["answer", "user_feedback", "answer_revision"].includes(entryType) || append && entryType === "answer") {
11554
+ throw new CliValidationError("entry-type must be user_feedback or answer_revision.");
11555
+ }
11556
+ if (append) {
11557
+ input.entry_type = entryType;
11558
+ input.entry_id = text2(ctx.str("entry-id") || (agent.agent_turn_id ? `${agent.agent_turn_id}:${entryType}` : ""), "entry-id", 191);
11559
+ input.target_answer_id = text2(ctx.str("target-answer-id"), "target-answer-id", 191);
11560
+ input.text = text2(ctx.str("text"), "text", entryType === "user_feedback" ? 4096 : 16384);
11561
+ } else {
11562
+ input.question = text2(ctx.str("question"), "question", 8192);
11563
+ input.answer = text2(ctx.str("answer"), "answer", 16384);
11564
+ }
11565
+ if (entryType !== "user_feedback") {
11566
+ if (append && ctx.str("user-message")) input.user_message = text2(ctx.str("user-message"), "user-message", 4096);
11567
+ input.answer_id = text2(ctx.str("answer-id") || (agent.agent_turn_id ? `answer:${agent.agent_turn_id}` : ""), "answer-id", 191);
11568
+ if (input.answer_id === input.target_answer_id) throw new CliValidationError("A revision requires a new answer-id; target-answer-id must preserve the previous answer.");
11569
+ const path = ctx.json("query-path");
11570
+ if (!Array.isArray(path) || !path.length || path.length > 64) throw new CliValidationError("query-path must contain 1..64 ordered CLI call references.");
11571
+ for (const step of path) {
11572
+ if (!step || typeof step !== "object" || Array.isArray(step) || Object.keys(step).some((key) => !["capability_id", "invocation_id", "client_request_id", "purpose"].includes(key)) || typeof step.capability_id !== "string" || !/^[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*\.[a-z][a-z0-9_]*$/.test(step.capability_id) || ["analysis.scenario.collect", "analysis.scenario.append", "analysis.feedback.submit"].includes(step.capability_id) || step.invocation_id === void 0 && step.client_request_id === void 0) {
11573
+ throw new CliValidationError("Each query-path step requires a capability_id and an existing invocation_id or client_request_id; only optional purpose is accepted. Do not include query inputs or results.");
11574
+ }
11575
+ for (const key of ["invocation_id", "client_request_id"]) if (step[key] !== void 0) text2(step[key], key, 191);
11576
+ if (step.purpose !== void 0) text2(step.purpose, "purpose", 256);
11577
+ }
11578
+ if (!path.some((step) => analysisQueryCapabilities.has(step.capability_id))) throw new CliValidationError("query-path must reference at least one attempted analysis data query.");
11579
+ if (JSON.stringify(path).length > 2e4) throw new CliValidationError("query-path must be at most 20000 characters.");
11580
+ input.query_path = path;
11581
+ const started = ctx.str("start-time");
11582
+ if (started) input.duration_ms = scenarioDuration(started);
11583
+ } else if (ctx.json("query-path") !== void 0 || ctx.str("answer-id") || ctx.str("user-message") || ctx.str("start-time")) {
11584
+ throw new CliValidationError("user_feedback records user text and its target only; do not attach an answer or query path.");
11585
+ }
11586
+ return input;
11587
+ }
11588
+ function scenarioTransportInput(ctx, append = false) {
11589
+ const input = scenarioInput(ctx, append);
11590
+ const field = append ? "text" : "answer";
11591
+ const original = input[field];
11592
+ const bytes = Buffer.from(original, "utf8");
11593
+ if (bytes.toString("utf8") !== original) {
11594
+ throw new CliValidationError(`${field} must contain valid Unicode text.`);
11595
+ }
11596
+ return { ...input, [field]: bytes.toString("base64"), content_encoding: "base64" };
11597
+ }
11598
+ var commonFlags2 = [
11599
+ { name: "start-time", type: "string", desc: "Exact start_time returned by scenario begin for this answer. CLI computes one question-to-answer duration; omit if not captured." },
11600
+ { name: "question-id", type: "string", desc: "Stable original scenario turn ID. Collect defaults to current turn; append must reuse the original ID." },
11601
+ { name: "answer-id", type: "string", desc: "Actual answer identifier; defaults to answer:<current-turn-id>. Revisions need a new ID." },
11602
+ { name: "query-path", type: "json", desc: "1..64 ordered references: [{capability_id,invocation_id?,client_request_id?,purpose?}]. Prefer only returned meta.invocation_id; fallback to returned gateway meta.client_request_id, never business request_id. One analysis data-query step required. Inputs/status/timing come from existing call telemetry. Never include query results." },
11603
+ { name: "project-id", type: "number", desc: "Source analysis project. Collection is skipped if omitted or the project has not explicitly enabled scenario samples." }
11604
+ ];
11605
+ function withProjectCollectionPolicy(command) {
11606
+ return {
11607
+ ...command,
11608
+ execute: async (ctx) => {
11609
+ const input = scenarioInput(ctx, command.command === "append");
11610
+ const skipped = (reason) => withOutputMetadata({
11611
+ accepted: false,
11612
+ skipped: true,
11613
+ reason,
11614
+ question_id: input.question_id,
11615
+ ...input.answer_id ? { answer_id: input.answer_id } : {},
11616
+ ...input.entry_id ? { entry_id: input.entry_id } : {},
11617
+ ...input.target_answer_id ? { target_answer_id: input.target_answer_id } : {},
11618
+ event_name: command.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
11619
+ delivery: "best_effort"
11620
+ }, { capability_id: command.capabilityId });
11621
+ if (input.project_id === void 0) return skipped("PROJECT_REQUIRED");
11622
+ try {
11623
+ const policy = await executeCapabilityWithEnvelope(ctx.host(), "analysis", "project.info.get", {
11624
+ project_id: input.project_id
11625
+ });
11626
+ if (policy.data?.analysis_scenario_collection_enabled !== true) {
11627
+ return skipped("PROJECT_COLLECTION_DISABLED");
11628
+ }
11629
+ } catch {
11630
+ return skipped("PROJECT_COLLECTION_CONFIG_UNAVAILABLE");
11631
+ }
11632
+ return command.execute(ctx);
11633
+ }
11634
+ };
11635
+ }
11636
+ var scenarioCollect = withProjectCollectionPolicy(createAnalysisCapabilityCommand({
11637
+ resource: "scenario",
11638
+ command: "collect",
11639
+ capabilityId: "analysis.scenario.collect",
11640
+ risk: "write",
11641
+ description: "Collect one whole scenario question, exact final answer and ordered CLI call references. Multiple CLI calls belong to one question_id. No self-evaluation.",
11642
+ flags: [
11643
+ ...commonFlags2,
11644
+ { name: "question", type: "string", required: true, sensitive: true, desc: "Original user scenario question and confirmed clarifications; up to 8192 characters." },
11645
+ { name: "answer", type: "string", required: true, sensitive: true, desc: "Exact answer text to deliver, not a summary. Up to 16384 characters. Deliver the same text after collection." }
11646
+ ],
11647
+ buildInput: (ctx) => scenarioTransportInput(ctx)
11648
+ }));
11649
+ var scenarioAppend = withProjectCollectionPolicy(createAnalysisCapabilityCommand({
11650
+ resource: "scenario",
11651
+ command: "append",
11652
+ capabilityId: "analysis.scenario.append",
11653
+ risk: "write",
11654
+ description: "Append verbatim user feedback or the exact substantive follow-up answer, including a recheck with unchanged conclusions, preserving earlier answers. This is not a new scenario.",
11655
+ flags: [
11656
+ ...commonFlags2,
11657
+ { name: "entry-type", type: "string", required: true, desc: "user_feedback or answer_revision." },
11658
+ { name: "target-answer-id", type: "string", required: true, desc: "Existing answer being questioned or revised. Never overwrite it." },
11659
+ { name: "text", type: "string", required: true, sensitive: true, desc: "Verbatim user feedback (up to 4096) or exact revised answer (up to 16384); no judgment of whether feedback is right." },
11660
+ { name: "entry-id", type: "string", desc: "Stable append ID; defaults to current-turn-id:entry-type. Preserve on retries, independent of text edits." },
11661
+ { name: "user-message", type: "string", sensitive: true, desc: "For answer_revision only: exact triggering follow-up request, up to 4096 characters, when not already captured as user_feedback. Preserve scope changes without inventing negative feedback." }
11662
+ ],
11663
+ buildInput: (ctx) => scenarioTransportInput(ctx, true)
11664
+ }));
11665
+ function scenarioDuration(start, now = Date.now()) {
11666
+ const millis = Date.parse(start);
11667
+ if (!/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/.test(start) || !Number.isFinite(millis) || !(/* @__PURE__ */ new Date(`${start.slice(0, 10)}T00:00:00Z`)).toISOString().startsWith(start.slice(0, 10)) || millis > now || now - millis > 7776e6) {
11668
+ throw new CliValidationError("start-time must be a real ISO-8601 timestamp within the last 90 days, copied from scenario begin.");
11669
+ }
11670
+ return now - millis;
11671
+ }
11672
+ var scenarioBegin = {
11673
+ service: "analysis",
11674
+ resource: "scenario",
11675
+ command: "begin",
11676
+ risk: "read",
11677
+ usesAeHost: false,
11678
+ description: "Capture the start of this question locally. No network request or file write. Reuse start_time when collecting the ready answer.",
11679
+ flags: [],
11680
+ execute: async () => ({ start_time: (/* @__PURE__ */ new Date()).toISOString() })
11681
+ };
11682
+ function scenarioListInput(ctx) {
11683
+ const input = {};
11684
+ for (const [flag, min, max, fallback] of [
11685
+ ["project-id", 1, 2147483647, void 0],
11686
+ ["days", 1, 90, 7],
11687
+ ["limit", 1, 50, 20],
11688
+ ["offset", 0, 2147483647, 0]
11689
+ ]) {
11690
+ const value = ctx.str(flag) === "" ? fallback : Number(ctx.str(flag));
11691
+ if (value === void 0 || !Number.isInteger(value) || value < min || value > max) {
11692
+ throw new CliValidationError(`${flag} must be an integer between ${min} and ${max}.`);
11693
+ }
11694
+ input[flag.replaceAll("-", "_")] = value;
11695
+ }
11696
+ const end = ctx.str("end-time");
11697
+ if (end) {
11698
+ if (!/^\d{4}-\d{2}-\d{2}T.*(?:Z|[+-]\d{2}:\d{2})$/.test(end) || !Number.isFinite(Date.parse(end)) || !(/* @__PURE__ */ new Date(`${end.slice(0, 10)}T00:00:00Z`)).toISOString().startsWith(end.slice(0, 10))) {
11699
+ throw new CliValidationError("end-time must be an ISO-8601 timestamp with a timezone.");
11700
+ }
11701
+ input.end_time = end;
11702
+ }
11703
+ return input;
11704
+ }
11705
+ var scenarioList = createAnalysisCapabilityCommand({
11706
+ resource: "scenario",
11707
+ command: "list",
11708
+ capabilityId: "analysis.scenario.list",
11709
+ risk: "read",
11710
+ description: "Read archived scenario questions with optional answer duration, exact answers, feedback and revisions. Follow the scenario review Skill for semantic deduplication and badcase assessment.",
11711
+ flags: [
11712
+ { name: "project-id", type: "number", required: true, desc: "Project to review. Requires project configuration permission to read collected content." },
11713
+ { name: "days", type: "number", desc: "Recent calendar days including today in the deployment timezone. Default 7; range 1..90." },
11714
+ { name: "limit", type: "number", desc: "Complete scenarios per page. Default 20; range 1..50." },
11715
+ { name: "offset", type: "number", desc: "Scenario offset. Default 0; follow meta.next_offset until meta.has_more is false." },
11716
+ { name: "end-time", type: "string", desc: "Exclusive ISO-8601 snapshot boundary. Reuse the first response meta.end_time and the same days on every subsequent page." }
11717
+ ],
11718
+ buildInput: scenarioListInput
11719
+ });
11720
+ function scenarioGetInput(ctx) {
11721
+ const { limit, offset, ...input } = scenarioListInput(ctx);
11722
+ for (const key of ["open-id", "agent-session-id", "question-id"]) {
11723
+ input[key.replaceAll("-", "_")] = text2(ctx.str(key), key, 191);
11724
+ }
11725
+ return input;
11726
+ }
11727
+ var scenarioGet = createAnalysisCapabilityCommand({
11728
+ resource: "scenario",
11729
+ command: "get",
11730
+ capabilityId: "analysis.scenario.get",
11731
+ risk: "read",
11732
+ description: "Read one archived question with answer duration and linked CLI inputs, execution results, costs and errors. Missing evidence stays explicit.",
11733
+ flags: [
11734
+ ...scenarioList.flags.filter((flag) => !["limit", "offset"].includes(flag.name)),
11735
+ { name: "open-id", type: "string", required: true, desc: "Exact initial.open_id from scenario list. Project configuration permission is still required." },
11736
+ { name: "agent-session-id", type: "string", required: true, desc: "Exact initial.agent_session_id from scenario list." },
11737
+ { name: "question-id", type: "string", required: true, desc: "Exact initial.question_id from scenario list." }
11738
+ ],
11739
+ buildInput: scenarioGetInput
11740
+ });
11741
+ var scenario_default = [scenarioBegin, scenarioCollect, scenarioAppend, scenarioList, scenarioGet];
11742
+
11260
11743
  // src/commands/te-analysis/index.ts
11261
11744
  registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
11262
11745
  registerCapabilityGatewayRoute("project", { gatewayDomain: "analysis" });
@@ -11305,10 +11788,11 @@ var baseCommands = [
11305
11788
  ...alert_job_default,
11306
11789
  ...alert_notice_config_default,
11307
11790
  ...system_default,
11308
- ...feedback_default
11791
+ ...feedback_default,
11792
+ ...scenario_default
11309
11793
  ];
11310
- var commands83 = [...baseCommands];
11311
- var te_analysis_default = commands83;
11794
+ var commands84 = [...baseCommands];
11795
+ var te_analysis_default = commands84;
11312
11796
  export {
11313
11797
  baseCommands,
11314
11798
  te_analysis_default as default