@thinkingai/ae-cli 6.0.58 → 6.0.60

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 (253) hide show
  1. package/README.md +10 -5
  2. package/README.zh.md +10 -5
  3. package/bin/ai-monitor.js +2 -0
  4. package/dist/ai-monitor-FCXSLHAP.js +32 -0
  5. package/dist/ai-monitor.js +135 -0
  6. package/dist/{auth-A5OO4VS4.js → auth-ATK2SLEV.js} +10 -9
  7. package/dist/{automation-FD2QZUP6.js → automation-FLCPFMN4.js} +4 -4
  8. package/dist/{capability-SKI4GHF4.js → capability-6KTSOI7L.js} +31 -35
  9. package/dist/{chunk-UYJMEHAF.js → chunk-2ETRY2CU.js} +15 -15
  10. package/dist/{chunk-QWSA3EOD.js → chunk-5E7MTTFN.js} +2 -2
  11. package/dist/{chunk-JSBLCLFE.js → chunk-5M5LBRR3.js} +1 -1
  12. package/dist/chunk-6M7ZEDT2.js +182 -0
  13. package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
  14. package/dist/chunk-AXTO4FTM.js +1285 -0
  15. package/dist/{chunk-HQCY3QCA.js → chunk-BEYLCUZX.js} +17 -12
  16. package/dist/chunk-CF6JTT2U.js +64 -0
  17. package/dist/{chunk-VDICGXCY.js → chunk-F2VFZUGG.js} +2 -2
  18. package/dist/{chunk-K2Z7QHDR.js → chunk-HSZAIPUX.js} +47 -12
  19. package/dist/{chunk-SOSFRU3O.js → chunk-HTZ2MLYA.js} +47 -21
  20. package/dist/{chunk-AWVZTN2B.js → chunk-HVMCPKOZ.js} +1 -1
  21. package/dist/{chunk-E25OSZLJ.js → chunk-KTJXD27G.js} +2 -2
  22. package/dist/{chunk-GBSACKFB.js → chunk-LOR4IA26.js} +564 -314
  23. package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
  24. package/dist/{chunk-EEARZNHE.js → chunk-SDKW6LYE.js} +88 -36
  25. package/dist/{chunk-WMDO53YK.js → chunk-VJUXKVRE.js} +1 -1
  26. package/dist/chunk-VRMGHQKE.js +556 -0
  27. package/dist/{compat-check-WFEKVLTH.js → compat-check-XD2U7PZ2.js} +2 -2
  28. package/dist/{config-U4I7X25P.js → config-U3GDWU6E.js} +25 -12
  29. package/dist/{context-CDB5H5PD.js → context-YAQG6YQC.js} +2 -2
  30. package/dist/{evaluation-LR4YDYWL.js → evaluation-2JSF4V47.js} +13 -158
  31. package/dist/index.js +84 -579
  32. package/dist/{memory-SNFR5M23.js → memory-WEB27VI6.js} +7 -7
  33. package/dist/{metadata-6QM6EED5.js → metadata-7FYE4234.js} +7 -7
  34. package/dist/{model-KEVCEXWD.js → model-T7H7Q6BG.js} +2 -2
  35. package/dist/{personal-semantic-preference-7VXQPP2N.js → personal-semantic-preference-O6VXM74A.js} +6 -6
  36. package/dist/{project-semantic-PSEPYH2L.js → project-semantic-2GGFJWW6.js} +15 -13
  37. package/dist/{sync-22ACDK5Z.js → sync-ULBB7WO5.js} +4 -4
  38. package/dist/{te-agent-BJ36B4QI.js → te-agent-6RMF7LUV.js} +5 -5
  39. package/dist/{te-analysis-WQ6D6YG4.js → te-analysis-HSYC7GNV.js} +382 -193
  40. package/dist/{te-community-VRWMFGI6.js → te-community-FLKZGQKB.js} +9 -9
  41. package/dist/{te-dataops-YTLFTTW7.js → te-dataops-OQQGTCUA.js} +3 -3
  42. package/dist/{te-engage-V2QW7TIC.js → te-engage-RIEBHL5T.js} +9 -9
  43. package/dist/{te-kb-4AQLISDR.js → te-kb-4HG2FMHJ.js} +18 -9
  44. package/dist/{te-system-CYWSK3UN.js → te-system-AL4B4XZL.js} +2 -2
  45. package/dist/{te-team-6ELNGBWT.js → te-team-5O4UVUWE.js} +5 -5
  46. package/dist/{things-HFWLGCUH.js → things-TSJ64GBT.js} +5 -5
  47. package/dist/{update-3CRVVHV5.js → update-Q5LURAWV.js} +3 -3
  48. package/dist/{workspace-2CKQX2XL.js → workspace-FF2HXJGR.js} +4 -4
  49. package/package.json +8 -6
  50. package/skills/ae-ai-monitor/SKILL.md +179 -0
  51. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  52. package/skills/ae-analysis/SKILL.md +10 -4
  53. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  54. package/skills/ae-analysis/references/ai_models.md +1 -0
  55. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  56. package/skills/ae-analysis/references/asset_search.md +1 -1
  57. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  58. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  59. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  60. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  61. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  62. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  63. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  64. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  65. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  66. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  67. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  68. package/skills/ae-analysis/references/catalog_list.md +2 -0
  69. package/skills/ae-analysis/references/command_index.md +38 -29
  70. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  71. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  72. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  73. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  74. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  75. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  76. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  77. package/skills/ae-analysis/references/folder_share.md +8 -2
  78. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  79. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  80. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  81. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  82. package/skills/ae-analysis/references/project_member_add.md +3 -1
  83. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  84. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  85. package/skills/ae-analysis/references/project_member_update.md +3 -1
  86. package/skills/ae-analysis/references/project_owner_update.md +3 -1
  87. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  88. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  89. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  90. package/skills/ae-analysis/references/project_space_share.md +8 -2
  91. package/skills/ae-analysis/references/property_get.md +2 -0
  92. package/skills/ae-analysis/references/public_link_list.md +3 -1
  93. package/skills/ae-analysis/references/query_cancel.md +4 -1
  94. package/skills/ae-analysis/references/report_data_run.md +1 -1
  95. package/skills/ae-analysis/references/report_list.md +3 -3
  96. package/skills/ae-analysis/references/scenario_append.md +2 -2
  97. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  98. package/skills/ae-analysis/references/scenario_list.md +2 -1
  99. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  100. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  101. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  102. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  103. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  104. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  105. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  106. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  107. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  108. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  109. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  110. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  111. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  112. package/skills/ae-automation/SKILL.md +4 -2
  113. package/skills/ae-capability/SKILL.md +9 -5
  114. package/skills/ae-community/SKILL.md +1 -0
  115. package/skills/ae-dataops/SKILL.md +1 -0
  116. package/skills/ae-engage/SKILL.md +1 -0
  117. package/skills/ae-evaluation/SKILL.md +17 -2
  118. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  119. package/skills/ae-kb/SKILL.md +5 -3
  120. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  121. package/skills/ae-kb/references/query-workflow.md +3 -1
  122. package/skills/ae-kb/references/versions.md +1 -1
  123. package/skills/ae-metadata/SKILL.md +1 -0
  124. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  125. package/skills/ae-team/SKILL.md +1 -1
  126. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  127. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  128. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  129. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  130. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  131. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  132. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  133. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  134. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  135. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  136. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  137. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  138. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  139. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  140. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  141. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  142. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  143. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  144. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  145. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  146. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  147. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  148. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  149. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  150. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  151. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  152. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  153. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  154. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  155. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  156. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  157. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  158. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  159. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  160. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  161. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  162. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  163. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  164. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  165. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  166. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  167. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  168. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  169. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  170. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  171. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  172. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  173. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  174. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  175. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  176. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  177. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  178. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  179. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  180. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  181. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  182. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  183. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  184. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  185. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  186. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  187. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  188. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  189. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  190. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  191. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  192. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  193. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  194. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  195. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  196. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  197. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  198. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  199. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  200. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  201. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  202. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  203. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  204. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  205. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  206. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  207. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  208. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  209. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  210. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  211. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  212. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  213. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  214. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  215. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  216. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  217. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  218. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  219. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  220. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  221. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  222. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  223. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  224. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  225. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  226. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  227. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  228. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  229. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  230. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  231. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  232. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  233. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  234. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  235. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  236. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  237. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  238. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  239. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  240. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  241. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  242. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  243. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  244. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  245. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  246. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  247. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  248. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  249. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  250. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  251. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  252. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  253. package/dist/chunk-AMBFK2K3.js +0 -28
@@ -7,16 +7,26 @@ import {
7
7
  waitForAnalysisRun,
8
8
  withAsyncArtifactLifecycle,
9
9
  withInterruptSignal
10
- } from "./chunk-EEARZNHE.js";
10
+ } from "./chunk-SDKW6LYE.js";
11
+ import {
12
+ evalApi
13
+ } from "./chunk-6M7ZEDT2.js";
14
+ import {
15
+ EvalApiError
16
+ } from "./chunk-P7QDCWJ6.js";
11
17
  import {
12
18
  createCapabilityCommand,
13
19
  definitionIntentSnapshotFlag,
14
20
  modelDefinitionIntentSnapshotFlag
15
- } from "./chunk-HQCY3QCA.js";
21
+ } from "./chunk-BEYLCUZX.js";
16
22
  import {
17
23
  registerCapabilityGatewayRoute,
18
24
  resolveGatewayDomain
19
- } from "./chunk-KPQY44JQ.js";
25
+ } from "./chunk-AWW2T2WL.js";
26
+ import {
27
+ unwrapOutputData,
28
+ withOutputMetadata
29
+ } from "./chunk-VJUXKVRE.js";
20
30
  import {
21
31
  CapabilityGatewayError,
22
32
  buildCapabilityGatewayUrl,
@@ -30,15 +40,12 @@ import {
30
40
  uploadInputFile,
31
41
  validateCapability,
32
42
  validateCapabilityWithEnvelope
33
- } from "./chunk-UYJMEHAF.js";
34
- import {
35
- withOutputMetadata
36
- } from "./chunk-WMDO53YK.js";
43
+ } from "./chunk-2ETRY2CU.js";
37
44
  import "./chunk-Y74WTIKJ.js";
38
- import "./chunk-GBSACKFB.js";
45
+ import "./chunk-LOR4IA26.js";
39
46
  import {
40
47
  getCliToken
41
- } from "./chunk-SOSFRU3O.js";
48
+ } from "./chunk-HTZ2MLYA.js";
42
49
  import "./chunk-4PSTYEG5.js";
43
50
  import {
44
51
  CliValidationError
@@ -51,12 +58,12 @@ var analysisDataExportRoutingHelp = "Routing: use export for full, unknown-size,
51
58
  function createAnalysisCapabilityCommand(config) {
52
59
  const cliPath = resolveAnalysisGatewayCliPath(config);
53
60
  const { asyncArtifact, ...coreConfig } = config;
54
- const command = createCapabilityCommand({
61
+ const command2 = createCapabilityCommand({
55
62
  ...coreConfig,
56
63
  ...cliPath,
57
64
  gatewayDomain: "analysis"
58
65
  });
59
- return asyncArtifact ? withAsyncArtifactLifecycle(command, typeof asyncArtifact === "object" ? asyncArtifact : void 0) : command;
66
+ return asyncArtifact ? withAsyncArtifactLifecycle(command2, typeof asyncArtifact === "object" ? asyncArtifact : void 0) : command2;
60
67
  }
61
68
  function resolveAnalysisGatewayCliPath(config) {
62
69
  const [capabilityService, capabilityResource, capabilityAction, ...extraSegments] = config.capabilityId.split(".");
@@ -73,32 +80,32 @@ function resolveAnalysisGatewayCliPath(config) {
73
80
  );
74
81
  }
75
82
  const resource = capabilityResource.replaceAll("_", "-");
76
- const command = capabilityAction.replaceAll("_", "-");
83
+ const command2 = capabilityAction.replaceAll("_", "-");
77
84
  const expectedLegacyResource = `${capabilityService} ${resource}`;
78
- if (config.resource !== expectedLegacyResource || config.command !== command) {
85
+ if (config.resource !== expectedLegacyResource || config.command !== command2) {
79
86
  throw new Error(
80
- `Capability '${config.capabilityId}' must map to ae-cli ${capabilityService} ${resource} ${command}.`
87
+ `Capability '${config.capabilityId}' must map to ae-cli ${capabilityService} ${resource} ${command2}.`
81
88
  );
82
89
  }
83
- return { cliService: capabilityService, resource, command };
90
+ return { cliService: capabilityService, resource, command: command2 };
84
91
  }
85
92
  function createAnalysisMetaCapabilityCommand(config) {
86
93
  const { asyncArtifact, ...coreConfig } = config;
87
- const command = createCapabilityCommand({
94
+ const command2 = createCapabilityCommand({
88
95
  ...coreConfig,
89
96
  cliService: "analysis-meta",
90
97
  gatewayDomain: "analysis"
91
98
  });
92
- return asyncArtifact ? withAsyncArtifactLifecycle(command, typeof asyncArtifact === "object" ? asyncArtifact : void 0) : command;
99
+ return asyncArtifact ? withAsyncArtifactLifecycle(command2, typeof asyncArtifact === "object" ? asyncArtifact : void 0) : command2;
93
100
  }
94
101
  function createAnalysisGovernanceCapabilityCommand(config) {
95
102
  const { asyncArtifact, ...coreConfig } = config;
96
- const command = createCapabilityCommand({
103
+ const command2 = createCapabilityCommand({
97
104
  ...coreConfig,
98
105
  cliService: "analysis-governance",
99
106
  gatewayDomain: "analysis"
100
107
  });
101
- return asyncArtifact ? withAsyncArtifactLifecycle(command, typeof asyncArtifact === "object" ? asyncArtifact : void 0) : command;
108
+ return asyncArtifact ? withAsyncArtifactLifecycle(command2, typeof asyncArtifact === "object" ? asyncArtifact : void 0) : command2;
102
109
  }
103
110
  var projectIdFlag = {
104
111
  name: "project-id",
@@ -184,6 +191,12 @@ var directoryOffsetFlag = {
184
191
  alias: "o",
185
192
  min: 0
186
193
  };
194
+ var manageableOnlyFlag = {
195
+ name: "manageable-only",
196
+ type: "boolean",
197
+ required: false,
198
+ desc: "Restrict the list to assets the current user can edit or manage. Defaults to all readable assets."
199
+ };
187
200
  var certificationScopeFlag = {
188
201
  name: "certification-scope",
189
202
  type: "string",
@@ -281,6 +294,7 @@ function reportListInput(ctx) {
281
294
  return compactInput({
282
295
  ...listInput(ctx),
283
296
  model_types: optionalJson(ctx, "model-types"),
297
+ manageable_only: optionalBoolean(ctx, "manageable-only"),
284
298
  certification_scope: certificationScopeInput(ctx)
285
299
  });
286
300
  }
@@ -816,7 +830,7 @@ var metadataEventUpdate = createAnalysisMetaCapabilityCommand({
816
830
  { name: "remark", type: "string", required: false, desc: "Event remark." }
817
831
  ],
818
832
  risk: "write",
819
- buildInput: (ctx) => compactInput({ ...projectInput(ctx), event_name: ctx.str("event-name"), event_desc: optionalString(ctx, "event-desc"), remark: optionalString(ctx, "remark") })
833
+ buildInput: (ctx) => compactInput({ ...projectInput(ctx), event_name: ctx.str("event-name"), event_desc: optionalString(ctx, "event-desc"), remark: optionalStringPreserveEmpty(ctx, "remark") })
820
834
  });
821
835
 
822
836
  // src/commands/te-analysis/meta/event/relation-update.ts
@@ -1015,7 +1029,7 @@ var metadataPropertyUpdate = createAnalysisMetaCapabilityCommand({
1015
1029
  { name: "prop-remark", type: "string", required: false, desc: "Property remark." }
1016
1030
  ],
1017
1031
  risk: "write",
1018
- buildInput: (ctx) => compactInput({ ...projectInput(ctx), table_type: ctx.str("table-type"), prop_name: ctx.str("prop-name"), prop_desc: optionalString(ctx, "prop-desc"), prop_remark: optionalString(ctx, "prop-remark") })
1032
+ buildInput: (ctx) => compactInput({ ...projectInput(ctx), table_type: ctx.str("table-type"), prop_name: ctx.str("prop-name"), prop_desc: optionalString(ctx, "prop-desc"), prop_remark: optionalStringPreserveEmpty(ctx, "prop-remark") })
1019
1033
  });
1020
1034
 
1021
1035
  // src/commands/te-analysis/meta/property/relation-update.ts
@@ -1223,7 +1237,7 @@ var metadataVirtualPropertyCreate = createAnalysisMetaCapabilityCommand({
1223
1237
  { name: "properties", type: "json", required: false, desc: "Dependent property JSON array." },
1224
1238
  { name: "sql-event-relation-type", type: "string", required: false, desc: "relation_default, relation_always, or relation_by_setting." },
1225
1239
  { name: "related-events", type: "json", required: false, desc: "Related events JSON array when using relation_by_setting." },
1226
- { name: "tag-date-policies", type: "json", required: false, desc: "Optional tag date policies JSON array." },
1240
+ { name: "tag-date-policies", type: "json", required: false, desc: "Event SQL tag policies: [{tag_name,cluster_date_policy,specified_cluster_date?}]. LATEST or AUTO omit the date; SPECIFIED requires yyyy-MM-dd." },
1227
1241
  { name: "replace-remark", type: "string", required: false, desc: "Replacement remark." },
1228
1242
  { name: "replace-suggestion", type: "string", required: false, desc: "Replacement suggestion." }
1229
1243
  ],
@@ -1275,7 +1289,7 @@ var metadataVirtualPropertySqlRuleUpdate = createAnalysisMetaCapabilityCommand({
1275
1289
  { name: "properties", type: "json", required: false, desc: "Dependent property JSON array." },
1276
1290
  { name: "sql-event-relation-type", type: "string", required: false, desc: "relation_default, relation_always, or relation_by_setting." },
1277
1291
  { name: "related-events", type: "json", required: false, desc: "Related events JSON array when using relation_by_setting." },
1278
- { name: "tag-date-policies", type: "json", required: false, desc: "Optional tag date policies JSON array." },
1292
+ { name: "tag-date-policies", type: "json", required: false, desc: "Event SQL tag policies: [{tag_name,cluster_date_policy,specified_cluster_date?}]. LATEST or AUTO omit the date; SPECIFIED requires yyyy-MM-dd." },
1279
1293
  { name: "replace-remark", type: "string", required: false, desc: "Replacement remark." },
1280
1294
  { name: "replace-suggestion", type: "string", required: false, desc: "Replacement suggestion." }
1281
1295
  ],
@@ -1462,7 +1476,7 @@ var metadataMetricUpdate = createAnalysisMetaCapabilityCommand({
1462
1476
  metric_id: ctx.num("metric-id"),
1463
1477
  metric_name: optionalString(ctx, "metric-name"),
1464
1478
  metric_desc: optionalString(ctx, "metric-desc"),
1465
- metric_remark: optionalString(ctx, "metric-remark"),
1479
+ metric_remark: optionalStringPreserveEmpty(ctx, "metric-remark"),
1466
1480
  metric_mode: optionalMetricMode(ctx),
1467
1481
  metric_events: optionalJson(ctx, "metric-events"),
1468
1482
  metric_params: optionalJson(ctx, "metric-params")
@@ -2459,12 +2473,12 @@ async function planBoundedExpansion(ctx, input) {
2459
2473
  let finalExport = {};
2460
2474
  let finalLimit = DEFAULT_LIMIT;
2461
2475
  let stopReason = "top_100_inspected";
2462
- for (const limit of EXPANSION_LIMITS) {
2463
- const exported = await exportRecommendationMaterial(ctx, input, limit);
2476
+ for (const limit2 of EXPANSION_LIMITS) {
2477
+ const exported = await exportRecommendationMaterial(ctx, input, limit2);
2464
2478
  finalExport = exported.data;
2465
- const summary = summarizeExport(exported.data, limit);
2479
+ const summary = summarizeExport(exported.data, limit2);
2466
2480
  attempts.push(summary);
2467
- finalLimit = limit;
2481
+ finalLimit = limit2;
2468
2482
  const pendingAssets = numberValue(summary.pending_asset_candidates);
2469
2483
  const pendingWorkUnits = numberValue(summary.pending_work_units);
2470
2484
  const hasMore = summary.has_more === true;
@@ -2492,12 +2506,12 @@ async function planBoundedExpansion(ctx, input) {
2492
2506
  finalExport
2493
2507
  };
2494
2508
  }
2495
- function exportRecommendationMaterial(ctx, input, limit) {
2509
+ function exportRecommendationMaterial(ctx, input, limit2) {
2496
2510
  return executeCapabilityWithEnvelope(
2497
2511
  ctx.host(),
2498
2512
  gatewayDomain(),
2499
2513
  EXPORT_CAPABILITY_ID,
2500
- compactInput({ ...input, limit, include_completed: false })
2514
+ compactInput({ ...input, limit: limit2, include_completed: false })
2501
2515
  );
2502
2516
  }
2503
2517
  function summarizeExport(result, requestedLimit) {
@@ -2520,12 +2534,12 @@ function countPendingAssetCandidates(workUnits) {
2520
2534
  const seen = /* @__PURE__ */ new Set();
2521
2535
  for (const unit of workUnits) {
2522
2536
  for (const candidate of array(record(unit).asset_candidates)) {
2523
- const item = record(candidate);
2524
- if (item.actionable !== true || item.action_state !== "PENDING") {
2537
+ const item2 = record(candidate);
2538
+ if (item2.actionable !== true || item2.action_state !== "PENDING") {
2525
2539
  continue;
2526
2540
  }
2527
- const type = stringValue(item.resource_type);
2528
- const key = stringValue(item.resource_key);
2541
+ const type = stringValue(item2.resource_type);
2542
+ const key = stringValue(item2.resource_key);
2529
2543
  if (type && key) {
2530
2544
  seen.add(`${type}|${key}`);
2531
2545
  }
@@ -2629,13 +2643,13 @@ function autoReviewReason(reason) {
2629
2643
  }
2630
2644
  function autoReviewItemsWithDisplayReason(items) {
2631
2645
  return array(items).map((value) => {
2632
- const item = record(value);
2646
+ const item2 = record(value);
2633
2647
  const copy = {
2634
- ...item,
2635
- semantic_duplicate_targets: semanticDuplicateTargetsFromReason(stringValue(item.reason) ?? "")
2648
+ ...item2,
2649
+ semantic_duplicate_targets: semanticDuplicateTargetsFromReason(stringValue(item2.reason) ?? "")
2636
2650
  };
2637
- if (item.decision !== "APPROVE") {
2638
- copy.display_reason = autoReviewDisplayReason(item);
2651
+ if (item2.decision !== "APPROVE") {
2652
+ copy.display_reason = autoReviewDisplayReason(item2);
2639
2653
  }
2640
2654
  return copy;
2641
2655
  });
@@ -2754,7 +2768,7 @@ function semanticDuplicateTargetsFromReason(reason) {
2754
2768
  return array(decodeReasonPayload(encoded).targets);
2755
2769
  }
2756
2770
  function listIncludes(value, expected) {
2757
- return array(value).some((item) => item === expected);
2771
+ return array(value).some((item2) => item2 === expected);
2758
2772
  }
2759
2773
  function buildManualReviewHandoff(autoReviewResult, exportResult) {
2760
2774
  const result = record(autoReviewResult);
@@ -2800,7 +2814,7 @@ function buildManualReviewHandoff(autoReviewResult, exportResult) {
2800
2814
  });
2801
2815
  }
2802
2816
  const pageReviewItems = buildPageReviewItems(handoffItems, candidates, relations, decisions);
2803
- const pageReviewIds = new Set(pageReviewItems.map((item) => stringValue(item.client_item_id)).filter(Boolean));
2817
+ const pageReviewIds = new Set(pageReviewItems.map((item2) => stringValue(item2.client_item_id)).filter(Boolean));
2804
2818
  return {
2805
2819
  schema_version: "1.0",
2806
2820
  handoff_type: "auto_review_uncertified_assets_to_page_review",
@@ -2816,10 +2830,10 @@ function buildManualReviewHandoff(autoReviewResult, exportResult) {
2816
2830
  skipped: result.skipped,
2817
2831
  overflow: result.overflow,
2818
2832
  approved_items: autoCertifiedItems,
2819
- skipped_items: handoffItems.map((item) => ({
2820
- target_ref: record(item.target_ref),
2821
- display_name: item.display_name,
2822
- manual_review_reason: item.manual_review_reason
2833
+ skipped_items: handoffItems.map((item2) => ({
2834
+ target_ref: record(item2.target_ref),
2835
+ display_name: item2.display_name,
2836
+ manual_review_reason: item2.manual_review_reason
2823
2837
  }))
2824
2838
  },
2825
2839
  auto_certified_items: autoCertifiedItems,
@@ -2848,8 +2862,8 @@ function buildPageReviewItems(handoffItems, candidates, relations, decisions) {
2848
2862
  const id = stringValue(candidate.client_item_id);
2849
2863
  if (id) byId.set(id, candidate);
2850
2864
  }
2851
- for (const item of handoffItems) {
2852
- const id = stringValue(item.client_item_id);
2865
+ for (const item2 of handoffItems) {
2866
+ const id = stringValue(item2.client_item_id);
2853
2867
  if (id) requiredIds.add(id);
2854
2868
  }
2855
2869
  let changed = true;
@@ -2864,7 +2878,7 @@ function buildPageReviewItems(handoffItems, candidates, relations, decisions) {
2864
2878
  }
2865
2879
  }
2866
2880
  }
2867
- const handoffById = new Map(handoffItems.map((item) => [stringValue(item.client_item_id), item]).filter((entry) => !!entry[0]));
2881
+ const handoffById = new Map(handoffItems.map((item2) => [stringValue(item2.client_item_id), item2]).filter((entry) => !!entry[0]));
2868
2882
  return candidates.map(record).filter((candidate) => {
2869
2883
  const id = stringValue(candidate.client_item_id);
2870
2884
  return id !== void 0 && requiredIds.has(id);
@@ -2880,15 +2894,15 @@ function buildPageReviewItems(handoffItems, candidates, relations, decisions) {
2880
2894
  });
2881
2895
  }
2882
2896
  function markContextCandidate(candidate, decision) {
2883
- const item = { ...candidate };
2884
- item.manual_review_context = true;
2885
- 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";
2897
+ const item2 = { ...candidate };
2898
+ item2.manual_review_context = true;
2899
+ item2.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";
2886
2900
  if (decision?.decision === "APPROVE" && decision.landing_status === "APPLIED") {
2887
- item.auto_review_decision = decision.raw;
2888
- item.auto_review_context_reason = autoReviewDisplayReason(decision.raw, candidate);
2889
- item.evidence_snapshot = markEvidenceAuthenticated(record(candidate.evidence_snapshot));
2901
+ item2.auto_review_decision = decision.raw;
2902
+ item2.auto_review_context_reason = autoReviewDisplayReason(decision.raw, candidate);
2903
+ item2.evidence_snapshot = markEvidenceAuthenticated(record(candidate.evidence_snapshot));
2890
2904
  }
2891
- return item;
2905
+ return item2;
2892
2906
  }
2893
2907
  function markEvidenceAuthenticated(evidence) {
2894
2908
  const snapshot = { ...evidence };
@@ -2901,21 +2915,21 @@ function markEvidenceAuthenticated(evidence) {
2901
2915
  function decisionsByAsset(value) {
2902
2916
  const result = /* @__PURE__ */ new Map();
2903
2917
  for (const itemValue of array(value)) {
2904
- const item = record(itemValue);
2905
- if (item.item_type !== "asset") {
2918
+ const item2 = record(itemValue);
2919
+ if (item2.item_type !== "asset") {
2906
2920
  continue;
2907
2921
  }
2908
- const type = stringValue(item.resource_type);
2909
- const key = stringValue(item.resource_key);
2922
+ const type = stringValue(item2.resource_type);
2923
+ const key = stringValue(item2.resource_key);
2910
2924
  if (!type || !key) {
2911
2925
  continue;
2912
2926
  }
2913
2927
  const assetKey = `${type}|${key}`;
2914
2928
  result.set(assetKey, {
2915
2929
  assetKey,
2916
- decision: stringValue(item.decision) ?? "",
2917
- landing_status: stringValue(item.landing_status) ?? "",
2918
- raw: item
2930
+ decision: stringValue(item2.decision) ?? "",
2931
+ landing_status: stringValue(item2.landing_status) ?? "",
2932
+ raw: item2
2919
2933
  });
2920
2934
  }
2921
2935
  return result;
@@ -3253,8 +3267,8 @@ var agentReviewSubmitToPage = createAnalysisMetaCapabilityCommand({
3253
3267
  });
3254
3268
  function validateInput(input) {
3255
3269
  const items = array2(input.items, "items").map((value) => {
3256
- const item = object(value, "items[]");
3257
- fields(item, [
3270
+ const item2 = object(value, "items[]");
3271
+ fields(item2, [
3258
3272
  "client_item_id",
3259
3273
  "target_ref",
3260
3274
  "action_type",
@@ -3264,10 +3278,10 @@ function validateInput(input) {
3264
3278
  "source_link",
3265
3279
  "evidence_links"
3266
3280
  ], "items[]");
3267
- if (typeof item.client_item_id !== "string" || !item.client_item_id.trim()) {
3281
+ if (typeof item2.client_item_id !== "string" || !item2.client_item_id.trim()) {
3268
3282
  throw new Error("items[].client_item_id must be a nonempty string.");
3269
3283
  }
3270
- const target = object(item.target_ref, "items[].target_ref");
3284
+ const target = object(item2.target_ref, "items[].target_ref");
3271
3285
  const targetType = typeof target.type === "string" ? target.type.trim() : "";
3272
3286
  const targetKey = typeof target.key === "string" ? target.key.trim() : "";
3273
3287
  if (!targetType || !targetKey) {
@@ -3276,21 +3290,21 @@ function validateInput(input) {
3276
3290
  if (!supportedTargetTypes.has(targetType)) {
3277
3291
  throw new Error("items[].target_ref.type must be one of dashboard, report, event, event_prop, user_prop, user_tag, user_cluster, metric.");
3278
3292
  }
3279
- const proposal = object(item.proposal_payload, "items[].proposal_payload");
3293
+ const proposal = object(item2.proposal_payload, "items[].proposal_payload");
3280
3294
  fields(proposal, ["authentication_status"], "items[].proposal_payload");
3281
- if (item.action_type !== "CERTIFY" || proposal.authentication_status !== 1) {
3295
+ if (item2.action_type !== "CERTIFY" || proposal.authentication_status !== 1) {
3282
3296
  throw new Error("Only CERTIFY with authentication_status=1 is supported by the review page.");
3283
3297
  }
3284
- const aiSummary = object(item.ai_summary, "items[].ai_summary");
3285
- const evidenceSnapshot = object(item.evidence_snapshot, "items[].evidence_snapshot");
3286
- validateItemAiSummary(aiSummary, `items[${String(item.client_item_id)}].ai_summary`);
3298
+ const aiSummary = object(item2.ai_summary, "items[].ai_summary");
3299
+ const evidenceSnapshot = object(item2.evidence_snapshot, "items[].evidence_snapshot");
3300
+ validateItemAiSummary(aiSummary, `items[${String(item2.client_item_id)}].ai_summary`);
3287
3301
  if (targetType === "report") {
3288
- validateReportAnalysis(aiSummary, evidenceSnapshot, `items[${String(item.client_item_id)}]`);
3302
+ validateReportAnalysis(aiSummary, evidenceSnapshot, `items[${String(item2.client_item_id)}]`);
3289
3303
  }
3290
- validateEvidenceLinks(item);
3291
- return item;
3304
+ validateEvidenceLinks(item2);
3305
+ return item2;
3292
3306
  });
3293
- unique(items.map((item) => item.client_item_id), "client_item_id");
3307
+ unique(items.map((item2) => item2.client_item_id), "client_item_id");
3294
3308
  fields(input, [
3295
3309
  "project_id",
3296
3310
  "review_type",
@@ -3305,7 +3319,7 @@ function validateInput(input) {
3305
3319
  "items"
3306
3320
  ], "submit-to-page input");
3307
3321
  object(input.ai_summary, "ai_summary");
3308
- validatePresentation(object(input.presentation_snapshot, "presentation_snapshot"), new Set(items.map((item) => item.client_item_id)));
3322
+ validatePresentation(object(input.presentation_snapshot, "presentation_snapshot"), new Set(items.map((item2) => item2.client_item_id)));
3309
3323
  if (input.review_type !== "ASSET_GOVERNANCE" || input.schema_version !== "1.0") {
3310
3324
  throw new Error("submit-to-page input requires review_type=ASSET_GOVERNANCE and schema_version=1.0.");
3311
3325
  }
@@ -3365,11 +3379,11 @@ function resolvesAnalysisPath(analysis, path) {
3365
3379
  }
3366
3380
  return index === suffix.length;
3367
3381
  }
3368
- function validateEvidenceLinks(item) {
3369
- const sourceLink = typeof item.source_link === "string" && item.source_link.trim();
3382
+ function validateEvidenceLinks(item2) {
3383
+ const sourceLink = typeof item2.source_link === "string" && item2.source_link.trim();
3370
3384
  let evidenceLink = false;
3371
- if ("evidence_links" in item) {
3372
- evidenceLink = array2(item.evidence_links, "items[].evidence_links").some((value) => {
3385
+ if ("evidence_links" in item2) {
3386
+ evidenceLink = array2(item2.evidence_links, "items[].evidence_links").some((value) => {
3373
3387
  const link = object(value, "items[].evidence_links[]");
3374
3388
  return typeof link.url === "string" && !!link.url.trim();
3375
3389
  });
@@ -3393,16 +3407,16 @@ function validatePresentation(presentation, itemIds) {
3393
3407
  throw new Error("presentation_snapshot.topics[].groups[] requires nonempty string id and name.");
3394
3408
  }
3395
3409
  for (const itemValue of array2(group.items, "presentation_snapshot.topics[].groups[].items")) {
3396
- const item = object(itemValue, "presentation_snapshot.topics[].groups[].items[]");
3397
- if (typeof item.id !== "string" || !item.id.trim()) {
3410
+ const item2 = object(itemValue, "presentation_snapshot.topics[].groups[].items[]");
3411
+ if (typeof item2.id !== "string" || !item2.id.trim()) {
3398
3412
  throw new Error("presentation_snapshot display items require nonempty string id.");
3399
3413
  }
3400
- if (!itemIds.has(item.id)) {
3414
+ if (!itemIds.has(item2.id)) {
3401
3415
  throw new Error("presentation_snapshot references an unknown client_item_id.");
3402
3416
  }
3403
- displayed.add(item.id);
3404
- topicItemIds.add(item.id);
3405
- groupItemIds.add(item.id);
3417
+ displayed.add(item2.id);
3418
+ topicItemIds.add(item2.id);
3419
+ groupItemIds.add(item2.id);
3406
3420
  }
3407
3421
  if (group.semantic_basis !== void 0) {
3408
3422
  const basis = object(group.semantic_basis, "presentation_snapshot.topics[].groups[].semantic_basis");
@@ -3538,9 +3552,9 @@ var agentReviewList = createAnalysisMetaCapabilityCommand({
3538
3552
  risk: "read",
3539
3553
  flags: [projectFlag, { name: "limit", type: "number", min: 1, max: 500, default: 20, desc: "Maximum recent batches, from 1 to 500. Default: 20." }],
3540
3554
  buildInput: (ctx) => {
3541
- const limit = ctx.str("limit") === "" ? 20 : ctx.num("limit");
3542
- if (!Number.isInteger(limit) || limit < 1 || limit > 500) throw new Error("--limit must be an integer from 1 to 500.");
3543
- return { ...projectInput2(ctx), limit };
3555
+ const limit2 = ctx.str("limit") === "" ? 20 : ctx.num("limit");
3556
+ if (!Number.isInteger(limit2) || limit2 < 1 || limit2 > 500) throw new Error("--limit must be an integer from 1 to 500.");
3557
+ return { ...projectInput2(ctx), limit: limit2 };
3544
3558
  }
3545
3559
  });
3546
3560
  var agentReviewDetail = createAnalysisMetaCapabilityCommand({
@@ -4048,7 +4062,7 @@ function normalizeRef(value, index) {
4048
4062
  function validateStringArray(ctx, name, allowed) {
4049
4063
  const value = optionalJson(ctx, name);
4050
4064
  if (value === void 0) return;
4051
- if (!Array.isArray(value) || value.length === 0 || value.some((item) => typeof item !== "string" || !allowed.has(item))) {
4065
+ if (!Array.isArray(value) || value.length === 0 || value.some((item2) => typeof item2 !== "string" || !allowed.has(item2))) {
4052
4066
  throw new CliValidationError(`--${name} must be a non-empty JSON array of supported values`);
4053
4067
  }
4054
4068
  }
@@ -4179,10 +4193,11 @@ var reportList = createAnalysisCapabilityCommand({
4179
4193
  resource: "report",
4180
4194
  command: "list",
4181
4195
  capabilityId: "analysis.report.list",
4182
- description: "List analysis reports the current user can edit or manage. Read-only reports are excluded; use analysis asset search for readable asset discovery.",
4196
+ description: "List readable reports. For management workflows use --manageable-only. Use analysis asset search for asset discovery.",
4183
4197
  flags: [
4184
4198
  projectIdFlag,
4185
4199
  queriesFlag,
4200
+ manageableOnlyFlag,
4186
4201
  fieldsFlag,
4187
4202
  reportModelTypesFlag,
4188
4203
  reportListLimitFlag,
@@ -4258,7 +4273,7 @@ var REPORT_WRITE_MODEL_TYPE_VALUES = [
4258
4273
  "tag"
4259
4274
  ];
4260
4275
  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.`;
4261
- 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.';
4276
+ 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 and groups, put the policy beside field. For tags, AUTO and SPECIFIED require has_history_versions=true from analysis-meta catalog list. Only local SPECIFIED dates must match user-tag get --include-history-dates true. 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.';
4262
4277
  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.`;
4263
4278
  function aiModelTypeFlag(required) {
4264
4279
  return {
@@ -4285,7 +4300,7 @@ function validateFunnelStepFilters(modelType, definition) {
4285
4300
  if (!Array.isArray(filter.items) || filter.items.length === 0) {
4286
4301
  errors.push(`${location}.items: use a non-empty array of event-property filters or nested groups.`);
4287
4302
  } else {
4288
- filter.items.forEach((item, index) => visit(item, `${location}.items[${index}]`));
4303
+ filter.items.forEach((item2, index) => visit(item2, `${location}.items[${index}]`));
4289
4304
  }
4290
4305
  return;
4291
4306
  }
@@ -4385,12 +4400,12 @@ function validateReportPresentation(ctx) {
4385
4400
  function validateSeries(value) {
4386
4401
  if (!Array.isArray(value)) throw new Error("--presentation.series must be an array; [] resets all series.");
4387
4402
  const indexes = /* @__PURE__ */ new Set();
4388
- for (const [position, item] of value.entries()) {
4403
+ for (const [position, item2] of value.entries()) {
4389
4404
  const path = `--presentation.series[${position}]`;
4390
- if (!item || typeof item !== "object" || Array.isArray(item) || Object.keys(item).length !== 3 || Object.keys(item).some((key) => !["metric_index", "type", "axis"].includes(key))) {
4405
+ if (!item2 || typeof item2 !== "object" || Array.isArray(item2) || Object.keys(item2).length !== 3 || Object.keys(item2).some((key) => !["metric_index", "type", "axis"].includes(key))) {
4391
4406
  throw new Error(`${path} requires only metric_index, type, and axis, all three required.`);
4392
4407
  }
4393
- const series = item;
4408
+ const series = item2;
4394
4409
  if (typeof series.metric_index !== "number" || !Number.isInteger(series.metric_index) || series.metric_index < 1) {
4395
4410
  throw new Error(`${path}.metric_index must be a positive 1-based integer position in definition.metrics.`);
4396
4411
  }
@@ -4548,12 +4563,12 @@ async function withSqlSelectorRuntimeErrorHint(operation) {
4548
4563
  throw enrichSqlSelectorRuntimeError(error);
4549
4564
  }
4550
4565
  }
4551
- function withSqlSelectorRuntimeDiagnostics(command) {
4552
- const validateInput2 = command.validateInput;
4553
- const dryRun = command.dryRun;
4554
- const execute = command.execute;
4566
+ function withSqlSelectorRuntimeDiagnostics(command2) {
4567
+ const validateInput2 = command2.validateInput;
4568
+ const dryRun = command2.dryRun;
4569
+ const execute = command2.execute;
4555
4570
  return {
4556
- ...command,
4571
+ ...command2,
4557
4572
  ...validateInput2 ? { validateInput: (ctx) => withSqlSelectorRuntimeErrorHint(() => validateInput2(ctx)) } : {},
4558
4573
  ...dryRun ? { dryRun: (ctx) => withSqlSelectorRuntimeErrorHint(() => dryRun(ctx)) } : {},
4559
4574
  execute: (ctx) => withSqlSelectorRuntimeErrorHint(() => execute(ctx))
@@ -4739,10 +4754,11 @@ var dashboardList = createAnalysisCapabilityCommand({
4739
4754
  resource: "dashboard",
4740
4755
  command: "list",
4741
4756
  capabilityId: "analysis.dashboard.list",
4742
- description: "List dashboards the current user can update or manage. Read-only dashboards are excluded; use analysis asset search for readable asset discovery.",
4757
+ description: "List readable dashboards. For management workflows use --manageable-only. Use analysis asset search for asset discovery.",
4743
4758
  flags: [
4744
4759
  projectIdFlag,
4745
4760
  queriesFlag,
4761
+ manageableOnlyFlag,
4746
4762
  {
4747
4763
  name: "fields",
4748
4764
  type: "json",
@@ -4758,6 +4774,7 @@ var dashboardList = createAnalysisCapabilityCommand({
4758
4774
  validate: validateQueriesFlag,
4759
4775
  buildInput: (ctx) => compactInput({
4760
4776
  ...listInput(ctx),
4777
+ manageable_only: optionalBoolean(ctx, "manageable-only"),
4761
4778
  certification_scope: certificationScopeInput(ctx)
4762
4779
  })
4763
4780
  });
@@ -4824,7 +4841,7 @@ var dashboardUpdate = createAnalysisCapabilityCommand({
4824
4841
  { name: "note-id", type: "number", required: false, desc: "Dashboard note ID. Omit to create a new note attached to the dashboard." },
4825
4842
  { name: "note-title", type: "string", required: false, desc: "Dashboard note title. Defaults to empty on create; omitted values are preserved on update." },
4826
4843
  { name: "description", type: "string", required: false, desc: "Dashboard note description. Defaults to empty on create; omitted values are preserved on update." },
4827
- { name: "ui-config", type: "string", required: false, desc: "Dashboard or note UI config string. Omitted note style is preserved on update." },
4844
+ { name: "ui-config", type: "string", required: false, desc: "Note UI config string. Omitted note style is preserved on update. Retained as a deprecated no-op for settings." },
4828
4845
  { name: "filter-name", type: "string", required: false, desc: "Saved filter name. Required with --operation default-filter or personal-default-filter." },
4829
4846
  { name: "filter", type: "json", required: false, desc: 'Saved filter in snake_case QP form: root junction_kind (and/or) and ta_filters array; SIMPLE conditions use filter_type="SIMPLE", column_name, table_type ("0" event, "1" user, "2" cluster/tag), select_type, calcu_symbol (C00 equals), and ftv. Do not use metadata table names or property_name/values. Common validates the QP format; ae-cli forwards it without local QP validation. Required with --operation default-filter, personal-default-filter, or business-filter. Pass {"junction_kind":"and","ta_filters":[]} to clear a business filter.' },
4830
4847
  payloadFlag
@@ -4875,7 +4892,7 @@ var dashboardShare = createAnalysisCapabilityCommand({
4875
4892
  { name: "member-authorities", type: "json", required: false, desc: 'Complete user authority map: {"<numeric_user_id>":"READ|EDIT|CREATOR|MAINTAIN"}. An empty object removes all directly shared users.' },
4876
4893
  payloadFlag
4877
4894
  ],
4878
- risk: "write",
4895
+ risk: "high-risk-write",
4879
4896
  buildInput: (ctx) => compactInput({
4880
4897
  ...projectInput(ctx),
4881
4898
  dashboard_id: ctx.num("dashboard-id"),
@@ -4909,7 +4926,7 @@ var dashboardHandover = createAnalysisCapabilityCommand({
4909
4926
  { name: "dashboard-ids", type: "json", required: true, desc: "Dashboard ID array." },
4910
4927
  { name: "to-user-id", type: "number", required: true, desc: "Target user ID." }
4911
4928
  ],
4912
- risk: "write",
4929
+ risk: "high-risk-write",
4913
4930
  buildInput: (ctx) => ({
4914
4931
  ...projectInput(ctx),
4915
4932
  dashboard_ids: jsonArray(ctx, "dashboard-ids"),
@@ -5211,13 +5228,14 @@ var dashboardReportDataExport = createAnalysisCapabilityCommand({
5211
5228
  clusterQueryScopeFlag,
5212
5229
  slaveClusterIdFlag,
5213
5230
  { name: "zone-offset", type: "number", required: false, desc: reportDataZoneOffsetDescription },
5231
+ { name: "use-cache", type: "boolean", required: false, desc: "Deprecated compatibility no-op. Exports always bypass query cache; true and false are accepted without changing execution." },
5214
5232
  { name: "request-id", type: "string", required: false, desc: "Optional cli_<32 lowercase hex> request ID. Generated when omitted." },
5215
5233
  asyncTimeoutSecondsFlag,
5216
5234
  { name: "artifact-format", type: "string", required: false, desc: "Artifact format. Only jsonl is supported." }
5217
5235
  ],
5218
5236
  risk: "read",
5219
5237
  validate: validateClusterQueryRouting,
5220
- buildInput: (ctx) => dashboardReportDataInput(ctx, false)
5238
+ buildInput: dashboardReportDataInput
5221
5239
  });
5222
5240
 
5223
5241
  // src/commands/te-analysis/dashboard-report-data/index.ts
@@ -5237,7 +5255,7 @@ var queryCancel = createAnalysisCapabilityCommand({
5237
5255
  { name: "run-id", type: "string", required: true, desc: "Async run ID returned by an export capability." },
5238
5256
  { name: "reason", type: "string", required: false, desc: "Optional cancellation reason." }
5239
5257
  ],
5240
- risk: "write",
5258
+ risk: "high-risk-write",
5241
5259
  buildInput: (ctx) => compactInput({
5242
5260
  run_id: ctx.str("run-id"),
5243
5261
  reason: optionalString(ctx, "reason")
@@ -5572,7 +5590,7 @@ var adhocRunFlags = [
5572
5590
  analysisModelPreviewRowsFlag
5573
5591
  ];
5574
5592
  var adhocExportFlags = [
5575
- ...adhocBaseFlags,
5593
+ ...adhocBaseFlags.map((flag) => flag.name === "use-cache" ? { ...flag, desc: "Deprecated compatibility no-op. Exports always bypass query cache; true and false are accepted without changing execution." } : flag),
5576
5594
  artifactFormatFlag,
5577
5595
  asyncTimeoutSecondsFlag
5578
5596
  ];
@@ -5758,7 +5776,7 @@ function dailyReportUpdateFlags() {
5758
5776
  { name: "enable-slack", type: "boolean", required: false, desc: "Whether scheduled Slack delivery is enabled." },
5759
5777
  ...destinationFlags,
5760
5778
  { name: "send-date", type: "string", required: false, desc: "Scheduled weekdays, comma-separated 1..7." },
5761
- { name: "send-time", type: "string", required: false, desc: "Scheduled send time, HH:mm." },
5779
+ { name: "send-time", type: "string", required: false, desc: "Scheduled whole hours: hour or HH:00, optionally comma-separated, for example 9 or 09:00,18:00." },
5762
5780
  { name: "enable-send", type: "boolean", required: false, desc: "Whether scheduled sending is enabled." }
5763
5781
  ];
5764
5782
  }
@@ -5957,7 +5975,7 @@ var biPanelShare = createAnalysisCapabilityCommand({
5957
5975
  capabilityId: "analysis.bi_panel.share",
5958
5976
  description: "Modify BI panel sharing members.",
5959
5977
  flags: [projectIdFlag, { name: "panel-id", type: "number", required: true, desc: "BI panel ID." }, payloadFlag],
5960
- risk: "write",
5978
+ risk: "high-risk-write",
5961
5979
  buildInput: (ctx) => compactInput({
5962
5980
  ...projectInput(ctx),
5963
5981
  panel_id: ctx.num("panel-id"),
@@ -6933,6 +6951,12 @@ var autoRefreshCronFlag = {
6933
6951
  desc: "Optional Quartz cron expression for an existing enabled auto-refresh schedule. This does not enable auto refresh."
6934
6952
  };
6935
6953
  var tagAutoRefreshFlags = [
6954
+ {
6955
+ name: "enable-history-tag-backup",
6956
+ type: "boolean",
6957
+ required: false,
6958
+ desc: "Save historical tag versions during scheduled refresh. Enabling requires periodic refresh. Omit on update to preserve the setting."
6959
+ },
6936
6960
  {
6937
6961
  name: "enable-auto-refresh",
6938
6962
  type: "boolean",
@@ -7053,10 +7077,10 @@ var groupColFlag = {
7053
7077
  required: true,
7054
7078
  desc: "Exact statistic value or bucket from history-tag-data results to drill down into."
7055
7079
  };
7056
- function capability(resource, command, capabilityId, description, flags, risk, buildInput2, options = {}) {
7080
+ function capability(resource, command2, capabilityId, description, flags, risk, buildInput2, options = {}) {
7057
7081
  return createAnalysisCapabilityCommand({
7058
7082
  resource,
7059
- command,
7083
+ command: command2,
7060
7084
  capabilityId,
7061
7085
  description,
7062
7086
  flags,
@@ -7065,14 +7089,14 @@ function capability(resource, command, capabilityId, description, flags, risk, b
7065
7089
  ...options
7066
7090
  });
7067
7091
  }
7068
- function idImportCapability(command) {
7069
- const originalValidate = command.validate;
7070
- const originalValidateInput = command.validateInput;
7071
- const originalDryRun = command.dryRun;
7072
- const originalExecute = command.execute;
7092
+ function idImportCapability(command2) {
7093
+ const originalValidate = command2.validate;
7094
+ const originalValidateInput = command2.validateInput;
7095
+ const originalDryRun = command2.dryRun;
7096
+ const originalExecute = command2.execute;
7073
7097
  return {
7074
- ...command,
7075
- flags: command.flags.flatMap((flag) => flag.name === "input-file-id" ? [inputFileFlag, flag] : [flag]),
7098
+ ...command2,
7099
+ flags: command2.flags.flatMap((flag) => flag.name === "input-file-id" ? [inputFileFlag, flag] : [flag]),
7076
7100
  validate: (ctx) => {
7077
7101
  originalValidate?.(ctx);
7078
7102
  const sources = ["input-file", "input-file-id", "file-content"].filter((name) => ctx.str(name).trim() !== "");
@@ -7103,7 +7127,7 @@ function idImportCapability(command) {
7103
7127
  },
7104
7128
  {
7105
7129
  method: "POST",
7106
- url: `${ctx.host()}/api/cli/${resolveGatewayDomain("analysis")}/v1/capabilities/${command.capabilityId}/dry-run`,
7130
+ url: buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `capabilities/${command2.capabilityId}/dry-run`),
7107
7131
  body: {
7108
7132
  input_file_id: "<input_file_id returned by upload step>",
7109
7133
  note: "The remaining command flags are sent unchanged after upload."
@@ -7198,6 +7222,7 @@ function clusterWriteInput(ctx, create) {
7198
7222
  function tagWriteInput(ctx, create) {
7199
7223
  const definitionRequest = optionalJson(ctx, "definition-request");
7200
7224
  validateDefinitionRequest(create, definitionRequest);
7225
+ const backup = optionalBoolean(ctx, "enable-history-tag-backup");
7201
7226
  const enabled = optionalBoolean(ctx, "enable-auto-refresh");
7202
7227
  const cron = optionalString(ctx, "auto-refresh-cron");
7203
7228
  const schedule = optionalJson(ctx, "auto-refresh-schedule");
@@ -7207,6 +7232,9 @@ function tagWriteInput(ctx, create) {
7207
7232
  if (enabled === false && (cron !== void 0 || schedule !== void 0)) {
7208
7233
  throw new Error("Cannot set a schedule with --enable-auto-refresh false");
7209
7234
  }
7235
+ if (backup === true && (enabled === false || create && schedule === void 0 && cron === void 0)) {
7236
+ throw new Error("Enabling history tag backup requires periodic refresh with a schedule");
7237
+ }
7210
7238
  if (create && enabled === true && cron === void 0 && schedule === void 0) {
7211
7239
  throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule or --auto-refresh-cron");
7212
7240
  }
@@ -7219,6 +7247,7 @@ function tagWriteInput(ctx, create) {
7219
7247
  remark: create ? void 0 : optionalString(ctx, "remark"),
7220
7248
  zone_offset: optionalNumber(ctx, "zone-offset"),
7221
7249
  enable_auto_refresh: enabled,
7250
+ enable_history_tag_backup: backup,
7222
7251
  auto_refresh_cron: cron,
7223
7252
  auto_refresh_schedule: schedule,
7224
7253
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
@@ -7461,10 +7490,12 @@ var commands41 = [
7461
7490
  ),
7462
7491
  capability("user-tag", "get", "analysis.user_tag.get", "Get user tag details by exact tag_name values.", [
7463
7492
  projectIdFlag,
7493
+ { name: "include-history-dates", type: "boolean", desc: "Include selectable local dates. Cross-source dates are not enumerated." },
7464
7494
  { name: "tag-names", type: "json", required: true, desc: "JSON array of exact tag_name values." }
7465
7495
  ], "read", (ctx) => ({
7466
7496
  project_id: ctx.num("project-id"),
7467
- tag_names: ctx.json("tag-names")
7497
+ tag_names: ctx.json("tag-names"),
7498
+ ...compactInput({ include_history_dates: optionalBoolean(ctx, "include-history-dates") })
7468
7499
  })),
7469
7500
  capability("user-tag-member", "list", "analysis.user_tag_member.list", `Run a bounded user tag member query. ${memberDataRunRoutingHelp}`, [
7470
7501
  tagNameFlag,
@@ -7483,7 +7514,10 @@ var commands41 = [
7483
7514
  tagDefinitionRequestFlag,
7484
7515
  authenticatedOnlyFlag,
7485
7516
  zoneOffsetFlag2,
7486
- entityIdFlag,
7517
+ {
7518
+ ...entityIdFlag,
7519
+ desc: "For SQL tags, explicitly pass the project entity that receives the tag. Resolve it with project entity list/get and verify the first SQL column identifies that entity. Matching SQL types alone are insufficient."
7520
+ },
7487
7521
  ...tagAutoRefreshFlags
7488
7522
  ], "write", (ctx) => tagWriteInput(ctx, true)),
7489
7523
  capability("user-tag", "update", "analysis.user_tag.update", "Update a user tag. Pass only fields that should change.", [
@@ -7698,7 +7732,7 @@ var inputFileInspect = {
7698
7732
  risk: "read",
7699
7733
  dryRun: (ctx) => ({
7700
7734
  method: "GET",
7701
- url: `${ctx.host()}/api/cli/${resolveGatewayDomain("analysis")}/v1/input-files/${ctx.str("input-file-id")}`
7735
+ url: buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `input-files/${ctx.str("input-file-id")}`)
7702
7736
  }),
7703
7737
  execute: async (ctx) => {
7704
7738
  const inputFileId = ctx.str("input-file-id");
@@ -7709,7 +7743,7 @@ var inputFileInspect = {
7709
7743
  );
7710
7744
  return {
7711
7745
  ...result,
7712
- inspect_path: `/api/cli/analysis/v1/input-files/${inputFileId}`,
7746
+ inspect_path: new URL(buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `input-files/${inputFileId}`)).pathname,
7713
7747
  inspect_command: `ae-cli analysis input-file inspect --input-file-id ${inputFileId}`
7714
7748
  };
7715
7749
  }
@@ -7760,7 +7794,7 @@ var inputFileUpload = {
7760
7794
  const inputFileId = result?.input_file_id ?? result?.inputFileId;
7761
7795
  return {
7762
7796
  ...result,
7763
- inspect_path: typeof inputFileId === "string" ? `/api/cli/analysis/v1/input-files/${inputFileId}` : result?.inspect_path,
7797
+ inspect_path: typeof inputFileId === "string" ? new URL(buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `input-files/${inputFileId}`)).pathname : result?.inspect_path,
7764
7798
  inspect_command: typeof inputFileId === "string" ? `ae-cli analysis input-file inspect --input-file-id ${inputFileId}` : void 0
7765
7799
  };
7766
7800
  }
@@ -7853,7 +7887,7 @@ var projectDataPowerUpsert = createAnalysisCapabilityCommand({
7853
7887
  projectIdFlag,
7854
7888
  requiredPayloadFlag
7855
7889
  ],
7856
- risk: "write",
7890
+ risk: "high-risk-write",
7857
7891
  buildInput: (ctx) => compactInput({
7858
7892
  project_id: ctx.num("project-id"),
7859
7893
  payload: ctx.json("payload")
@@ -8144,8 +8178,8 @@ var projectMarkTimeCreate = createAnalysisCapabilityCommand({
8144
8178
  flags: [
8145
8179
  projectIdFlag,
8146
8180
  { name: "marked-at", type: "string", required: true, desc: "Marker timestamp, for example yyyy-MM-dd HH:mm." },
8147
- { name: "zone-offset", type: "number", required: false, desc: "Marker time zone offset." },
8148
- { name: "content", type: "string", required: true, desc: "Marker content." },
8181
+ { name: "zone-offset", type: "number", required: false, desc: "Marker time zone offset. When project time zones are enabled, fixed offsets are -12..14 and 99 preserves stored local time. Omit for the project default." },
8182
+ { name: "content", type: "string", required: true, desc: "Marker content, at most 200 characters." },
8149
8183
  { name: "is-visible", type: "number", required: false, desc: "Whether the marker is visible. 1 visible, 0 hidden." }
8150
8184
  ],
8151
8185
  risk: "write",
@@ -8211,8 +8245,8 @@ var projectMarkTimeUpdate = createAnalysisCapabilityCommand({
8211
8245
  projectIdFlag,
8212
8246
  { name: "mark-time-id", type: "number", required: true, desc: "Date marker ID." },
8213
8247
  { name: "marked-at", type: "string", required: true, desc: "Marker timestamp, for example yyyy-MM-dd HH:mm." },
8214
- { name: "zone-offset", type: "number", required: false, desc: "Marker time zone offset." },
8215
- { name: "content", type: "string", required: true, desc: "Marker content." },
8248
+ { name: "zone-offset", type: "number", required: false, desc: "Marker time zone offset. When project time zones are enabled, fixed offsets are -12..14 and 99 preserves stored local time. Omit for the project default." },
8249
+ { name: "content", type: "string", required: true, desc: "Marker content, at most 200 characters." },
8216
8250
  { name: "is-visible", type: "number", required: false, desc: "Whether the marker is visible. 1 visible, 0 hidden." }
8217
8251
  ],
8218
8252
  risk: "write",
@@ -8251,7 +8285,7 @@ var projectMemberAdd = createAnalysisCapabilityCommand({
8251
8285
  desc: "Member add type: 0 creates a company member from project management; 1 adds an existing company member. Type 0 may be disabled by company configuration."
8252
8286
  }
8253
8287
  ],
8254
- risk: "write",
8288
+ risk: "high-risk-write",
8255
8289
  buildInput: (ctx) => compactInput({
8256
8290
  project_id: ctx.num("project-id"),
8257
8291
  payload: ctx.json("payload"),
@@ -8269,7 +8303,7 @@ var projectMemberBatchUpdate = createAnalysisCapabilityCommand({
8269
8303
  projectIdFlag,
8270
8304
  requiredPayloadFlag
8271
8305
  ],
8272
- risk: "write",
8306
+ risk: "high-risk-write",
8273
8307
  buildInput: (ctx) => compactInput({
8274
8308
  project_id: ctx.num("project-id"),
8275
8309
  payload: ctx.json("payload")
@@ -8340,7 +8374,7 @@ var projectMemberUpdate = createAnalysisCapabilityCommand({
8340
8374
  requiredPayloadFlag,
8341
8375
  { name: "target-user-id", type: "number", required: true, desc: "Target user ID." }
8342
8376
  ],
8343
- risk: "write",
8377
+ risk: "high-risk-write",
8344
8378
  buildInput: (ctx) => compactInput({
8345
8379
  project_id: ctx.num("project-id"),
8346
8380
  payload: ctx.json("payload"),
@@ -8584,7 +8618,7 @@ var projectMemberHandoverRun = createAnalysisCapabilityCommand({
8584
8618
  projectIdFlag,
8585
8619
  requiredPayloadFlag
8586
8620
  ],
8587
- risk: "write",
8621
+ risk: "high-risk-write",
8588
8622
  buildInput: (ctx) => compactInput({
8589
8623
  project_id: ctx.num("project-id"),
8590
8624
  payload: ctx.json("payload")
@@ -8632,7 +8666,7 @@ var projectOwnerUpdate = createAnalysisCapabilityCommand({
8632
8666
  { name: "project-name", type: "string", required: false, desc: "Optional project name update." },
8633
8667
  { name: "project-remark", type: "string", required: false, desc: "Optional project remark update." }
8634
8668
  ],
8635
- risk: "write",
8669
+ risk: "high-risk-write",
8636
8670
  buildInput: (ctx) => compactInput({
8637
8671
  project_id: ctx.num("project-id"),
8638
8672
  company_id: ctx.num("company-id"),
@@ -8779,7 +8813,7 @@ var projectRoleUpsert = createAnalysisCapabilityCommand({
8779
8813
  desc: "Role payload with role_func_list object items containing function_name and has_power (0 or 1)."
8780
8814
  }
8781
8815
  ],
8782
- risk: "write",
8816
+ risk: "high-risk-write",
8783
8817
  buildInput: (ctx) => compactInput({
8784
8818
  project_id: ctx.num("project-id"),
8785
8819
  payload: ctx.json("payload")
@@ -8900,78 +8934,78 @@ var projectTimezoneUpdate = createAnalysisCapabilityCommand({
8900
8934
  ],
8901
8935
  risk: "write",
8902
8936
  buildInput: (ctx) => {
8903
- const item = ctx.str("item").toLowerCase();
8937
+ const item2 = ctx.str("item").toLowerCase();
8904
8938
  const payload = ctx.json("payload");
8905
- validateTimezonePayload(item, payload);
8939
+ validateTimezonePayload(item2, payload);
8906
8940
  return compactInput({
8907
8941
  project_id: ctx.num("project-id"),
8908
8942
  payload,
8909
- item
8943
+ item: item2
8910
8944
  });
8911
8945
  }
8912
8946
  });
8913
- function validateTimezonePayload(item, payload) {
8914
- if (!TIMEZONE_ITEMS.includes(item)) {
8947
+ function validateTimezonePayload(item2, payload) {
8948
+ if (!TIMEZONE_ITEMS.includes(item2)) {
8915
8949
  throw new CliValidationError(
8916
8950
  "--item must be timezone_toggle, zone_offset, user_timezone, or project_timezone_display.",
8917
8951
  { code: "INVALID_TIMEZONE_ITEM" }
8918
8952
  );
8919
8953
  }
8920
8954
  if (!isObject(payload)) {
8921
- throw invalidPayload(item, "must be a JSON object");
8955
+ throw invalidPayload(item2, "must be a JSON object");
8922
8956
  }
8923
- switch (item) {
8957
+ switch (item2) {
8924
8958
  case "timezone_toggle":
8925
8959
  if (typeof payload.toggle !== "boolean") {
8926
- throw invalidPayload(item, "requires boolean field toggle", '{"toggle":true}');
8960
+ throw invalidPayload(item2, "requires boolean field toggle", '{"toggle":true}');
8927
8961
  }
8928
- allowOnly(payload, item, ["toggle"]);
8962
+ allowOnly(payload, item2, ["toggle"]);
8929
8963
  return;
8930
8964
  case "zone_offset":
8931
8965
  if (typeof payload.column_name !== "string") {
8932
- throw invalidPayload(item, "requires string field column_name", '{"column_name":"#zone_offset"}');
8966
+ throw invalidPayload(item2, "requires string field column_name", '{"column_name":"#zone_offset"}');
8933
8967
  }
8934
- allowOnly(payload, item, ["column_name"]);
8968
+ allowOnly(payload, item2, ["column_name"]);
8935
8969
  return;
8936
8970
  case "user_timezone":
8937
8971
  if (typeof payload.column_name !== "string" || payload.column_name.length === 0) {
8938
- throw invalidPayload(item, "requires non-empty string field column_name", '{"column_name":"user_timezone"}');
8972
+ throw invalidPayload(item2, "requires non-empty string field column_name", '{"column_name":"user_timezone"}');
8939
8973
  }
8940
8974
  if (payload.codetable !== void 0 && typeof payload.codetable !== "string") {
8941
- throw invalidPayload(item, "optional field codetable must be a string", '{"column_name":"user_timezone","codetable":"timezone_code_table"}');
8975
+ throw invalidPayload(item2, "optional field codetable must be a string", '{"column_name":"user_timezone","codetable":"timezone_code_table"}');
8942
8976
  }
8943
- allowOnly(payload, item, ["column_name", "codetable"]);
8977
+ allowOnly(payload, item2, ["column_name", "codetable"]);
8944
8978
  return;
8945
8979
  case "project_timezone_display":
8946
- validateDisplayTimezones(payload.display_timezones, item);
8947
- allowOnly(payload, item, ["display_timezones"]);
8980
+ validateDisplayTimezones(payload.display_timezones, item2);
8981
+ allowOnly(payload, item2, ["display_timezones"]);
8948
8982
  }
8949
8983
  }
8950
- function validateDisplayTimezones(value, item) {
8984
+ function validateDisplayTimezones(value, item2) {
8951
8985
  if (!Array.isArray(value) || value.length === 0) {
8952
- throw invalidPayload(item, "requires non-empty array field display_timezones", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
8986
+ throw invalidPayload(item2, "requires non-empty array field display_timezones", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
8953
8987
  }
8954
8988
  for (const entry of value) {
8955
8989
  if (!isObject(entry)) {
8956
- throw invalidPayload(item, "display_timezones entries must be objects", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
8990
+ throw invalidPayload(item2, "display_timezones entries must be objects", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
8957
8991
  }
8958
- allowOnly(entry, item, ["timezone", "is_default"]);
8992
+ allowOnly(entry, item2, ["timezone", "is_default"]);
8959
8993
  if (!Number.isInteger(entry.timezone) || !(entry.timezone >= -12 && entry.timezone <= 14 || entry.timezone === 99)) {
8960
- throw invalidPayload(item, "display_timezones[].timezone must be an integer from -12 through 14, or 99 for no fixed display timezone");
8994
+ throw invalidPayload(item2, "display_timezones[].timezone must be an integer from -12 through 14, or 99 for no fixed display timezone");
8961
8995
  }
8962
8996
  if (entry.is_default !== void 0 && typeof entry.is_default !== "boolean") {
8963
- throw invalidPayload(item, "display_timezones[].is_default must be a boolean when provided");
8997
+ throw invalidPayload(item2, "display_timezones[].is_default must be a boolean when provided");
8964
8998
  }
8965
8999
  }
8966
9000
  }
8967
- function allowOnly(payload, item, fields2) {
9001
+ function allowOnly(payload, item2, fields2) {
8968
9002
  if (Object.keys(payload).some((field) => !fields2.includes(field))) {
8969
- throw invalidPayload(item, `supports only fields ${fields2.join(", ")}`);
9003
+ throw invalidPayload(item2, `supports only fields ${fields2.join(", ")}`);
8970
9004
  }
8971
9005
  }
8972
- function invalidPayload(item, reason, example) {
9006
+ function invalidPayload(item2, reason, example) {
8973
9007
  return new CliValidationError(
8974
- `--payload for --item ${item} ${reason}.`,
9008
+ `--payload for --item ${item2} ${reason}.`,
8975
9009
  {
8976
9010
  code: "INVALID_TIMEZONE_PAYLOAD",
8977
9011
  hint: example === void 0 ? void 0 : `Use: --payload '${example}'`
@@ -9041,12 +9075,12 @@ var project_default = commands66;
9041
9075
  // src/commands/te-analysis/tracking/shared.ts
9042
9076
  function createTrackingCapabilityCommand(config) {
9043
9077
  const { asyncArtifact, ...coreConfig } = config;
9044
- const command = createCapabilityCommand({
9078
+ const command2 = createCapabilityCommand({
9045
9079
  ...coreConfig,
9046
9080
  cliService: "tracking",
9047
9081
  gatewayDomain: "analysis"
9048
9082
  });
9049
- return asyncArtifact ? withAsyncArtifactLifecycle(command) : command;
9083
+ return asyncArtifact ? withAsyncArtifactLifecycle(command2) : command2;
9050
9084
  }
9051
9085
  var eventsFlag = {
9052
9086
  name: "events",
@@ -9510,20 +9544,20 @@ function definitions(candidates, kind) {
9510
9544
  function existingDefinitions(value, nameField, displayNameField) {
9511
9545
  if (!Array.isArray(value)) return [];
9512
9546
  const rows = [];
9513
- for (const item of value) {
9514
- if (!isRecord2(item)) continue;
9515
- const name = nonEmptyString(item[nameField]);
9547
+ for (const item2 of value) {
9548
+ if (!isRecord2(item2)) continue;
9549
+ const name = nonEmptyString(item2[nameField]);
9516
9550
  if (!name) continue;
9517
9551
  rows.push({
9518
9552
  name,
9519
- displayName: nonEmptyString(item[displayNameField])
9553
+ displayName: nonEmptyString(item2[displayNameField])
9520
9554
  });
9521
9555
  }
9522
9556
  return rows;
9523
9557
  }
9524
9558
  function buildGroup(type, source, existing) {
9525
9559
  const existingByName = new Map(
9526
- existing.map((item) => [item.name, item.displayName])
9560
+ existing.map((item2) => [item2.name, item2.displayName])
9527
9561
  );
9528
9562
  const items = [];
9529
9563
  const skippedExisting = [];
@@ -10312,6 +10346,26 @@ var alert_notice_config_default = commands81;
10312
10346
  // src/commands/te-analysis/system/shared.ts
10313
10347
  import { readFileSync as readFileSync3, statSync as statSync3 } from "fs";
10314
10348
  var secretValues = /* @__PURE__ */ new WeakMap();
10349
+ var backendConfirmationCapabilities = /* @__PURE__ */ new Set([
10350
+ "system.member_status.update",
10351
+ "system.member_project.batch_update",
10352
+ "system.member_password.reset",
10353
+ "system.member.delete",
10354
+ "system.role.upsert",
10355
+ "system.role.delete",
10356
+ "system.admin.upsert",
10357
+ "system.admin_function.update",
10358
+ "system.admin.remove",
10359
+ "system.seat.update",
10360
+ "system.mfa.update",
10361
+ "system.member_mfa.unbind",
10362
+ "system.query_task.cancel",
10363
+ "system.query_alert_rule.update",
10364
+ "system.ops_alert_contact.delete",
10365
+ "system.smtp.delete",
10366
+ "system.receiver_address.delete",
10367
+ "system.third_party_login.disable"
10368
+ ]);
10315
10369
  var companyIdField = {
10316
10370
  flag: "company-id",
10317
10371
  input: "company_id",
@@ -10360,7 +10414,7 @@ function defineSystemCommand(spec) {
10360
10414
  risk: spec.risk,
10361
10415
  validate: (ctx) => {
10362
10416
  validateSecretSources(ctx, secrets);
10363
- const input = buildSystemInput(ctx, fields2, [], spec.risk);
10417
+ const input = buildSystemInput(ctx, fields2, [], spec.capabilityId);
10364
10418
  for (const secret of secrets) {
10365
10419
  if (ctx.str(`${secret.flag}-file`) || ctx.bool(`${secret.flag}-stdin`)) {
10366
10420
  input[secret.input] = "<provided>";
@@ -10370,7 +10424,7 @@ function defineSystemCommand(spec) {
10370
10424
  spec.validate?.(ctx, input);
10371
10425
  },
10372
10426
  buildInput: (ctx) => {
10373
- const input = buildSystemInput(ctx, fields2, secrets, spec.risk);
10427
+ const input = buildSystemInput(ctx, fields2, secrets, spec.capabilityId);
10374
10428
  validateFields(fields2, input);
10375
10429
  validateSecretSources(ctx, secrets);
10376
10430
  spec.validate?.(ctx, input);
@@ -10407,7 +10461,7 @@ function secretFlags(secret) {
10407
10461
  }
10408
10462
  ];
10409
10463
  }
10410
- function buildSystemInput(ctx, fields2, secrets, risk) {
10464
+ function buildSystemInput(ctx, fields2, secrets, capabilityId) {
10411
10465
  const input = {};
10412
10466
  for (const field of fields2) {
10413
10467
  const value = fieldValue(ctx, field);
@@ -10417,7 +10471,7 @@ function buildSystemInput(ctx, fields2, secrets, risk) {
10417
10471
  const value = secretValue(ctx, secret);
10418
10472
  if (value !== void 0) input[secret.input] = secret.transform ? secret.transform(value) : value;
10419
10473
  }
10420
- if (risk === "high-risk-write") input.yes = true;
10474
+ if (backendConfirmationCapabilities.has(capabilityId)) input.yes = true;
10421
10475
  return compactInput(input);
10422
10476
  }
10423
10477
  function fieldValue(ctx, field) {
@@ -10501,12 +10555,12 @@ function requireArrayObjects(input, name, requiredKeys) {
10501
10555
  const value = input[name];
10502
10556
  if (value === void 0) return;
10503
10557
  if (!Array.isArray(value)) throw validation(`${snakeToFlag(name)} must be a JSON array.`);
10504
- value.forEach((item, index) => {
10505
- if (!item || typeof item !== "object" || Array.isArray(item)) {
10558
+ value.forEach((item2, index) => {
10559
+ if (!item2 || typeof item2 !== "object" || Array.isArray(item2)) {
10506
10560
  throw validation(`${snakeToFlag(name)} item ${index + 1} must be an object.`);
10507
10561
  }
10508
10562
  for (const key of requiredKeys) {
10509
- if (!(key in item)) {
10563
+ if (!(key in item2)) {
10510
10564
  throw validation(`${snakeToFlag(name)} item ${index + 1} is missing ${key}.`);
10511
10565
  }
10512
10566
  }
@@ -10693,7 +10747,7 @@ var systemConfigurationCommands = [
10693
10747
  command: "upsert",
10694
10748
  capabilityId: "system.third_party_login.upsert",
10695
10749
  description: "Create or update a third-party login configuration using protected secret sources.",
10696
- risk: "write",
10750
+ risk: "high-risk-write",
10697
10751
  fields: [
10698
10752
  loginType,
10699
10753
  { flag: "app-id", type: "string", required: true, desc: "Provider application ID." },
@@ -10730,7 +10784,7 @@ var systemConfigurationCommands = [
10730
10784
  command: "update",
10731
10785
  capabilityId: "system.oauth2.update",
10732
10786
  description: "Enable or disable company OAuth2 login.",
10733
- risk: "write",
10787
+ risk: "high-risk-write",
10734
10788
  fields: [
10735
10789
  { flag: "enable-oauth2", type: "boolean", required: true, desc: "Target OAuth2 login state." }
10736
10790
  ]
@@ -11148,17 +11202,17 @@ var systemMonitoringCommands = [
11148
11202
  throw validation("--delete-ids must contain positive integers.");
11149
11203
  }
11150
11204
  const upserts = input.upserts;
11151
- for (const [index, item] of (upserts ?? []).entries()) {
11152
- const metric = Number(item.metric_content);
11153
- const wheelMinutes = Number(item.wheel_minutes);
11154
- const wheelInterval = Number(item.wheel_interval);
11155
- const threshold = Number(item.threshold);
11205
+ for (const [index, item2] of (upserts ?? []).entries()) {
11206
+ const metric = Number(item2.metric_content);
11207
+ const wheelMinutes = Number(item2.wheel_minutes);
11208
+ const wheelInterval = Number(item2.wheel_interval);
11209
+ const threshold = Number(item2.threshold);
11156
11210
  if (![1, 2, 3].includes(metric) || !Number.isInteger(wheelMinutes) || wheelMinutes < 1 || wheelMinutes > 1440 || !Number.isInteger(wheelInterval) || wheelInterval < 1 || wheelInterval > 1e3 || !Number.isFinite(threshold) || threshold < 0) {
11157
11211
  throw validation(`--upserts item ${index + 1} contains an invalid metric/window/threshold.`);
11158
11212
  }
11159
11213
  }
11160
11214
  const deleted = new Set((deleteIds ?? []).map(Number));
11161
- if ((upserts ?? []).some((item) => item.rule_id !== void 0 && deleted.has(Number(item.rule_id)))) {
11215
+ if ((upserts ?? []).some((item2) => item2.rule_id !== void 0 && deleted.has(Number(item2.rule_id)))) {
11162
11216
  throw validation("The same rule_id cannot appear in both --upserts and --delete-ids.");
11163
11217
  }
11164
11218
  }
@@ -11194,7 +11248,7 @@ var systemMonitoringCommands = [
11194
11248
  if (input.on_status === void 0) throw validation("--on-status is required when creating a contact.");
11195
11249
  requireAtLeastOne(
11196
11250
  input,
11197
- ["mail_address", "mobile", ...contactWebhookSecrets.map((item) => item.input)],
11251
+ ["mail_address", "mobile", ...contactWebhookSecrets.map((item2) => item2.input)],
11198
11252
  "Provide at least one delivery target when creating a contact."
11199
11253
  );
11200
11254
  }
@@ -11553,11 +11607,11 @@ var commonFlags2 = [
11553
11607
  { 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." },
11554
11608
  { name: "project-id", type: "number", desc: "Source analysis project. Collection is skipped if omitted or the project has not explicitly enabled scenario samples." }
11555
11609
  ];
11556
- function withProjectCollectionPolicy(command) {
11610
+ function withProjectCollectionPolicy(command2) {
11557
11611
  return {
11558
- ...command,
11612
+ ...command2,
11559
11613
  execute: async (ctx) => {
11560
- const input = scenarioInput(ctx, command.command === "append");
11614
+ const input = scenarioInput(ctx, command2.command === "append");
11561
11615
  const skipped = (reason) => withOutputMetadata({
11562
11616
  accepted: false,
11563
11617
  skipped: true,
@@ -11566,9 +11620,9 @@ function withProjectCollectionPolicy(command) {
11566
11620
  ...input.answer_id ? { answer_id: input.answer_id } : {},
11567
11621
  ...input.entry_id ? { entry_id: input.entry_id } : {},
11568
11622
  ...input.target_answer_id ? { target_answer_id: input.target_answer_id } : {},
11569
- event_name: command.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
11623
+ event_name: command2.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
11570
11624
  delivery: "best_effort"
11571
- }, { capability_id: command.capabilityId });
11625
+ }, { capability_id: command2.capabilityId });
11572
11626
  if (input.project_id === void 0) return skipped("PROJECT_REQUIRED");
11573
11627
  try {
11574
11628
  const policy = await executeCapabilityWithEnvelope(ctx.host(), "analysis", "project.info.get", {
@@ -11580,7 +11634,7 @@ function withProjectCollectionPolicy(command) {
11580
11634
  } catch {
11581
11635
  return skipped("PROJECT_COLLECTION_CONFIG_UNAVAILABLE");
11582
11636
  }
11583
- return command.execute(ctx);
11637
+ return command2.execute(ctx);
11584
11638
  }
11585
11639
  };
11586
11640
  }
@@ -11669,7 +11723,7 @@ var scenarioList = createAnalysisCapabilityCommand({
11669
11723
  buildInput: scenarioListInput
11670
11724
  });
11671
11725
  function scenarioGetInput(ctx) {
11672
- const { limit, offset, ...input } = scenarioListInput(ctx);
11726
+ const { limit: limit2, offset, ...input } = scenarioListInput(ctx);
11673
11727
  for (const key of ["open-id", "agent-session-id", "question-id"]) {
11674
11728
  input[key.replaceAll("-", "_")] = text2(ctx.str(key), key, 191);
11675
11729
  }
@@ -11691,6 +11745,140 @@ var scenarioGet = createAnalysisCapabilityCommand({
11691
11745
  });
11692
11746
  var scenario_default = [scenarioBegin, scenarioCollect, scenarioAppend, scenarioList, scenarioGet];
11693
11747
 
11748
+ // src/commands/te-analysis/bad-case/evaluation-sync.ts
11749
+ async function syncBadCaseEvaluation(ctx, projectId, value) {
11750
+ const item2 = value;
11751
+ if (!item2?.evaluation || !["PENDING", "ERROR"].includes(item2.evaluation.state)) return value;
11752
+ const common = (action, input = {}) => executeCapability(ctx.host(), "analysis", `analysis.bad_case.${action}`, { project_id: projectId, ...input });
11753
+ let report;
11754
+ try {
11755
+ const config = await common("evaluation_config");
11756
+ if (!config?.initialized || config.te_project_id !== String(projectId) || !config.dataset_id)
11757
+ throw new EvalApiError("Initialize this project evaluation configuration first.", { code: "NOT_INITIALIZED", httpStatus: 0 });
11758
+ const version = Number(item2.version);
11759
+ if (!Number.isSafeInteger(version) || version <= 0)
11760
+ throw new EvalApiError("Invalid source version.", { code: "INVALID_RESPONSE", httpStatus: 0 });
11761
+ const active = item2.review_state === "APPROVED";
11762
+ const result = await evalApi(
11763
+ ctx,
11764
+ "PUT",
11765
+ `/semantic-evaluation/datasets/${encodeURIComponent(config.dataset_id)}/cases/${encodeURIComponent(item2.id)}`,
11766
+ void 0,
11767
+ {
11768
+ version,
11769
+ active,
11770
+ question: item2.evidence_snapshot.question,
11771
+ answer: item2.evidence_snapshot.answer,
11772
+ reason: item2.ai_summary.reason,
11773
+ supplement: item2.review?.supplement || ""
11774
+ },
11775
+ { teProjectId: String(projectId) }
11776
+ );
11777
+ if (result?.source_version !== version || typeof result.case_id !== "string" || (active ? !/^[0-9a-f]{8}(-[0-9a-f]{4}){3}-[0-9a-f]{12}$/.test(result.case_id) : result.case_id !== ""))
11778
+ throw new EvalApiError("Invalid synchronization response.", { code: "INVALID_RESPONSE", httpStatus: 0 });
11779
+ report = { state: "SYNCED", case_id: result.case_id };
11780
+ } catch (error) {
11781
+ const code = error instanceof EvalApiError ? error.code : "";
11782
+ report = { state: "ERROR", error_code: ["NOT_INITIALIZED", "INVALID_RESPONSE"].includes(code) ? code : error instanceof EvalApiError && error.httpStatus === 403 ? "FORBIDDEN" : error instanceof EvalApiError && (error.httpStatus === 401 || code === "EVAL_ACCESS_TOKEN_MISSING") ? "UNAUTHORIZED" : "AE_SYNC_FAILED" };
11783
+ }
11784
+ try {
11785
+ return await common("evaluation_result", { item_id: item2.id, version: item2.version, ...report });
11786
+ } catch {
11787
+ try {
11788
+ return await common("get", { item_id: item2.id });
11789
+ } catch {
11790
+ return { ...item2, evaluation: { state: "PENDING" } };
11791
+ }
11792
+ }
11793
+ }
11794
+
11795
+ // src/commands/te-analysis/bad-case/index.ts
11796
+ import { readFileSync as readFileSync4 } from "fs";
11797
+ var project = { name: "project-id", type: "number", required: true, desc: "Project owner or administrator access is required." };
11798
+ var request = { name: "client-request-id", type: "string", required: true, desc: "Stable request ID; preserve on retries." };
11799
+ var item = { name: "item-id", type: "string", required: true, desc: "Bad Case item ID as a decimal string." };
11800
+ var batch = { name: "batch-id", type: "string", required: true, desc: "Discovery batch ID returned by begin." };
11801
+ var limit = { name: "limit", type: "number", desc: "Page size, 1..100. Follow pagination until complete." };
11802
+ function badCaseInput(action, flags, ctx) {
11803
+ const input = {};
11804
+ for (const flag of flags) {
11805
+ if (flag.name === "input-file") continue;
11806
+ const value = ctx.str(flag.name);
11807
+ if (!value && !flag.required) continue;
11808
+ if (!value && flag.required) throw new CliValidationError(`${flag.name} is required.`);
11809
+ if (flag.type === "number") {
11810
+ const number = Number(value);
11811
+ const minimum = flag.name === "offset" ? 0 : 1;
11812
+ const maximum = flag.name === "limit" ? 100 : 2147483647;
11813
+ if (!Number.isInteger(number) || number < minimum || number > maximum) throw new CliValidationError(`${flag.name} must be an integer between ${minimum} and ${maximum}.`);
11814
+ input[flag.name.replaceAll("-", "_")] = number;
11815
+ } else if (flag.type === "boolean") {
11816
+ if (!["true", "false"].includes(value)) throw new CliValidationError(`${flag.name} must be true or false.`);
11817
+ input[flag.name.replaceAll("-", "_")] = value === "true";
11818
+ } else {
11819
+ if (["item-id", "batch-id", "after-id", "version"].includes(flag.name) && (!/^\d+$/.test(value) || BigInt(value) > 9223372036854775807n)) throw new CliValidationError(`${flag.name} must be a nonnegative 64-bit integer string.`);
11820
+ input[flag.name.replaceAll("-", "_")] = value;
11821
+ }
11822
+ }
11823
+ if (action === "review" && !["APPROVE", "REJECT", "REVOKE"].includes(String(input.decision))) throw new CliValidationError("decision must be APPROVE, REJECT or REVOKE.");
11824
+ if (action === "run" && !["HEARTBEAT", "FAILED"].includes(String(input.action))) throw new CliValidationError("action must be HEARTBEAT or FAILED.");
11825
+ if (action === "submit") {
11826
+ let packet;
11827
+ try {
11828
+ packet = JSON.parse(readFileSync4(ctx.str("input-file"), "utf8"));
11829
+ } catch {
11830
+ throw new CliValidationError("input-file must be a readable JSON file.");
11831
+ }
11832
+ if (!packet || typeof packet !== "object" || Array.isArray(packet) || Object.keys(packet).some((key) => key !== "candidates") || !("candidates" in packet) || !Array.isArray(packet.candidates) || packet.candidates.length > 200) {
11833
+ throw new CliValidationError("The file must contain only candidates: an array of at most 200 occurrences. Empty batches are allowed.");
11834
+ }
11835
+ const seen = /* @__PURE__ */ new Set();
11836
+ const roots = /* @__PURE__ */ new Set();
11837
+ for (const candidate of packet.candidates) {
11838
+ if (!candidate || typeof candidate !== "object" || !candidate.candidate_id || seen.has(candidate.candidate_id)) throw new CliValidationError("Every occurrence needs a unique candidate_id.");
11839
+ seen.add(candidate.candidate_id);
11840
+ if (candidate.duplicate_of) {
11841
+ if (candidate.duplicate_item_id || !roots.has(candidate.duplicate_of) || !candidate.dedup_reason) throw new CliValidationError("duplicate_of needs an earlier canonical candidate and dedup_reason.");
11842
+ } else {
11843
+ roots.add(candidate.candidate_id);
11844
+ if (candidate.duplicate_item_id ? !candidate.dedup_reason : !["INCORRECT", "INCOMPLETE"].includes(candidate.issue_type) || !candidate.reason) throw new CliValidationError("Provide a supported issue_type and reason, or a historical duplicate_item_id and dedup_reason.");
11845
+ }
11846
+ if (!candidate.source || ["open_id", "agent_session_id", "question_id", "answer_id", "days", "end_time"].some((key) => !candidate.source[key])) throw new CliValidationError("Each source must preserve the exact scenario identity and scan window.");
11847
+ }
11848
+ input.candidates = packet.candidates;
11849
+ }
11850
+ return input;
11851
+ }
11852
+ function command(action, description, flags, read = false) {
11853
+ return createAnalysisCapabilityCommand({
11854
+ resource: "bad-case",
11855
+ command: action,
11856
+ capabilityId: `analysis.bad_case.${action.replaceAll("-", "_")}`,
11857
+ description,
11858
+ risk: read ? "read" : "write",
11859
+ flags: [project, ...flags],
11860
+ buildInput: (ctx) => badCaseInput(action, [project, ...flags], ctx),
11861
+ ...action === "review" ? { postProcess: (result, input, ctx) => syncBadCaseEvaluation(ctx, Number(input.project_id), result) } : {}
11862
+ });
11863
+ }
11864
+ var badCaseBegin = command("begin", "Begin a project-serialized discovery batch. Renew its 15-minute lease every minute; preserve request ID on retry.", [request, { name: "source-task-id", type: "string", desc: "Actual scheduled task ID, if known." }]);
11865
+ var badCaseRun = command("run", "Heartbeat or fail the current discovery. Failure never deletes earlier cases.", [batch, { name: "action", type: "string", required: true, desc: "HEARTBEAT or FAILED." }]);
11866
+ var badCaseHistory = command("history", "Read all historical cases for Agent semantic deduplication, including pending, approved, rejected and CLI-only cases.", [limit, { name: "after-id", type: "string", desc: "Follow next_after_id until has_more=false. Default 0." }], true);
11867
+ var badCaseSubmit = command("submit", "Submit Agent-assessed and semantically deduplicated occurrences from a JSON file. Saves a batch even when all occurrences are duplicates. Never approves.", [batch, { name: "input-file", type: "string", required: true, desc: "JSON file containing {candidates:[...]}; follow bad_case_review.md for new and duplicate occurrence shapes." }, { name: "submit-to-page", type: "boolean", desc: "Explicitly publish new and reused pending cases for page review. Default false for the CLI-only workflow." }]);
11868
+ var badCaseList = command("list", "List saved Bad Cases across all batches, including CLI-only cases.", [limit, { name: "offset", type: "number", desc: "Zero-based offset; default 0." }, { name: "query", type: "string", desc: "Search question or discovery reason." }, { name: "state", type: "string", desc: "PENDING, APPROVED or REJECTED; omit for all." }], true);
11869
+ var badCaseGet = command("get", "Read the reviewed question, answer, CLI calls and optional human supplement.", [item], true);
11870
+ var badCaseReview = command("review", "Record an explicit human decision, then synchronize the saved case directly with AE. A saved review remains successful if synchronization fails; inspect evaluation.state and retry with sync-evaluation.", [item, request, { name: "version", type: "string", required: true, desc: "Exact version returned by get." }, { name: "decision", type: "string", required: true, desc: "APPROVE or REJECT a pending case; REVOKE an approved or rejected case to PENDING. Only as explicitly directed by the human." }, { name: "supplement", type: "string", sensitive: true, desc: "Optional correct answer, evidence or caveats. Omit when revoking rejection to preserve its supplement." }]);
11871
+ var badCaseSubmitToPage = command("submit-to-page", "Publish an existing pending case for page review without copying it or changing its review state.", [item, request]);
11872
+ var badCaseSyncEvaluation = {
11873
+ ...badCaseGet,
11874
+ command: "sync-evaluation",
11875
+ capabilityId: void 0,
11876
+ risk: "write",
11877
+ description: "Retry AE synchronization using the latest saved review. Does not change the review decision; reports synchronization state.",
11878
+ execute: async (ctx) => syncBadCaseEvaluation(ctx, Number(ctx.str("project-id")), unwrapOutputData(await badCaseGet.execute(ctx)))
11879
+ };
11880
+ var bad_case_default = [badCaseBegin, badCaseRun, badCaseHistory, badCaseSubmit, badCaseList, badCaseGet, badCaseReview, badCaseSubmitToPage, badCaseSyncEvaluation];
11881
+
11694
11882
  // src/commands/te-analysis/index.ts
11695
11883
  registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
11696
11884
  registerCapabilityGatewayRoute("project", { gatewayDomain: "analysis" });
@@ -11739,7 +11927,8 @@ var baseCommands = [
11739
11927
  ...alert_notice_config_default,
11740
11928
  ...system_default,
11741
11929
  ...feedback_default,
11742
- ...scenario_default
11930
+ ...scenario_default,
11931
+ ...bad_case_default
11743
11932
  ];
11744
11933
  var commands83 = [...baseCommands];
11745
11934
  var te_analysis_default = commands83;