@thinkingai/ae-cli 6.1.29 → 6.1.32

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 (265) hide show
  1. package/README.md +11 -5
  2. package/README.zh.md +11 -5
  3. package/bin/ai-monitor.js +2 -0
  4. package/dist/ai-monitor-MKMHSSNI.js +32 -0
  5. package/dist/ai-monitor.js +135 -0
  6. package/dist/{auth-OBQ5KVQM.js → auth-CZHHPZOQ.js} +12 -11
  7. package/dist/{automation-NAR5DDGL.js → automation-FLCPFMN4.js} +5 -5
  8. package/dist/{capability-LFSVNI5B.js → capability-64KVJFIA.js} +28 -32
  9. package/dist/{chunk-IN7KKL6K.js → chunk-2F64AZYH.js} +1 -1
  10. package/dist/{chunk-QZLRHGVH.js → chunk-3ULDJJTZ.js} +1 -1
  11. package/dist/{chunk-JNVVJ273.js → chunk-4PSTYEG5.js} +5 -10
  12. package/dist/{chunk-3SDHJOCR.js → chunk-4XKTRCRK.js} +16 -16
  13. package/dist/{chunk-RJHGDWSC.js → chunk-5M5LBRR3.js} +2 -2
  14. package/dist/chunk-6M7ZEDT2.js +182 -0
  15. package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
  16. package/dist/chunk-BNBCMCYN.js +563 -0
  17. package/dist/chunk-CF6JTT2U.js +64 -0
  18. package/dist/{chunk-2UW3Y463.js → chunk-DWBYNGSR.js} +565 -315
  19. package/dist/{chunk-N6XBLRB7.js → chunk-F2VFZUGG.js} +2 -2
  20. package/dist/{chunk-CVCTFLSO.js → chunk-FCAA7I2D.js} +3 -3
  21. package/dist/{chunk-H3K5UGYC.js → chunk-HTZ2MLYA.js} +48 -22
  22. package/dist/{chunk-QZUVLFNR.js → chunk-HVMCPKOZ.js} +1 -1
  23. package/dist/chunk-IDDWEZ7F.js +1285 -0
  24. package/dist/{chunk-7JAVT5TK.js → chunk-KTJXD27G.js} +2 -2
  25. package/dist/{chunk-6HAUVWOQ.js → chunk-NLEXY2TM.js} +48 -13
  26. package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
  27. package/dist/{chunk-PWXDWMCW.js → chunk-T7WF4HYW.js} +84 -32
  28. package/dist/{chunk-VCZE3IWO.js → chunk-TMQGS4TO.js} +15 -10
  29. package/dist/{compat-check-CII6B74E.js → compat-check-ZJNCMNQV.js} +3 -3
  30. package/dist/{config-YZ6O2UQ2.js → config-FSH2NMNZ.js} +26 -13
  31. package/dist/{context-F6FCGTF3.js → context-YAQG6YQC.js} +3 -3
  32. package/dist/{data-integration-6UAZO4GG.js → data-integration-QE37EQ3A.js} +1 -1
  33. package/dist/{evaluation-4LO2O4AF.js → evaluation-2JSF4V47.js} +13 -158
  34. package/dist/index.js +84 -586
  35. package/dist/{memory-HHPX3NF2.js → memory-VEZZVAAP.js} +5 -5
  36. package/dist/{metadata-TIFY24LW.js → metadata-3IWHX3V4.js} +8 -8
  37. package/dist/{model-7UHGWYVR.js → model-T7H7Q6BG.js} +3 -3
  38. package/dist/{personal-semantic-preference-WKJEGPTM.js → personal-semantic-preference-YITU23SA.js} +7 -7
  39. package/dist/{project-semantic-EIQVZNHW.js → project-semantic-MHEXJF3C.js} +16 -14
  40. package/dist/{sync-RV3OPCTI.js → sync-AQHVCSPI.js} +5 -5
  41. package/dist/{te-agent-5ENVZJUH.js → te-agent-RXI7WOH4.js} +6 -6
  42. package/dist/{te-analysis-USIK6ZZG.js → te-analysis-CZY74HVF.js} +381 -192
  43. package/dist/{te-community-WE2UU4XV.js → te-community-DKCYUBCM.js} +7 -7
  44. package/dist/{te-dataops-XNMO7MBF.js → te-dataops-QEH6VE56.js} +5 -5
  45. package/dist/{te-engage-6C3HCFQR.js → te-engage-WK7WKDKF.js} +7 -7
  46. package/dist/{te-experiment-LVTRI3QK.js → te-experiment-LH3RPIOE.js} +275 -30
  47. package/dist/{te-kb-TUPGMVBY.js → te-kb-UPORIOVN.js} +17 -8
  48. package/dist/{te-system-YM657FKO.js → te-system-AL4B4XZL.js} +3 -3
  49. package/dist/{te-team-G4VEJJNL.js → te-team-LLVTO2G4.js} +6 -6
  50. package/dist/{things-22KQWC23.js → things-XLMLBYQR.js} +6 -6
  51. package/dist/{update-XX4ILU7X.js → update-7J5UQHSK.js} +4 -4
  52. package/dist/{workspace-LYDAP647.js → workspace-FF2HXJGR.js} +5 -5
  53. package/package.json +9 -7
  54. package/skills/ae-ai-monitor/SKILL.md +179 -0
  55. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  56. package/skills/ae-analysis/SKILL.md +10 -4
  57. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  58. package/skills/ae-analysis/references/ai_models/path.md +5 -6
  59. package/skills/ae-analysis/references/ai_models.md +1 -0
  60. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  61. package/skills/ae-analysis/references/asset_search.md +1 -1
  62. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  63. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  64. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  65. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  66. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  67. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  68. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  69. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  70. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  71. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  72. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  73. package/skills/ae-analysis/references/catalog_list.md +2 -0
  74. package/skills/ae-analysis/references/command_index.md +38 -29
  75. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  76. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  77. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  78. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  79. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  80. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  81. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  82. package/skills/ae-analysis/references/folder_share.md +8 -2
  83. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  84. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  85. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  86. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  87. package/skills/ae-analysis/references/project_member_add.md +3 -1
  88. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  89. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  90. package/skills/ae-analysis/references/project_member_update.md +3 -1
  91. package/skills/ae-analysis/references/project_owner_update.md +3 -1
  92. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  93. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  94. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  95. package/skills/ae-analysis/references/project_space_share.md +8 -2
  96. package/skills/ae-analysis/references/property_get.md +2 -0
  97. package/skills/ae-analysis/references/public_link_list.md +3 -1
  98. package/skills/ae-analysis/references/query_cancel.md +4 -1
  99. package/skills/ae-analysis/references/report_data_run.md +1 -1
  100. package/skills/ae-analysis/references/report_list.md +3 -3
  101. package/skills/ae-analysis/references/scenario_append.md +2 -2
  102. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  103. package/skills/ae-analysis/references/scenario_list.md +2 -1
  104. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  105. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  106. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  107. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  108. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  109. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  110. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  111. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  112. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  113. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  114. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  115. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  116. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  117. package/skills/ae-automation/SKILL.md +4 -2
  118. package/skills/ae-capability/SKILL.md +9 -5
  119. package/skills/ae-community/SKILL.md +1 -0
  120. package/skills/ae-dataops/SKILL.md +1 -0
  121. package/skills/ae-engage/SKILL.md +1 -0
  122. package/skills/ae-evaluation/SKILL.md +17 -2
  123. package/skills/ae-experiment/SKILL.md +38 -11
  124. package/skills/ae-experiment/references/experiment_approval.md +171 -0
  125. package/skills/ae-experiment/references/manage_experiment.md +11 -2
  126. package/skills/ae-experiment/references/save_experiment.md +28 -8
  127. package/skills/ae-experiment/references/save_submit_experiment.md +18 -3
  128. package/skills/ae-experiment/references/save_submit_external_experiment.md +57 -3
  129. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  130. package/skills/ae-kb/SKILL.md +9 -5
  131. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  132. package/skills/ae-kb/references/query-workflow.md +9 -6
  133. package/skills/ae-kb/references/versions.md +1 -1
  134. package/skills/ae-kb-discovery/SKILL.md +15 -6
  135. package/skills/ae-metadata/SKILL.md +1 -0
  136. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  137. package/skills/ae-team/SKILL.md +1 -1
  138. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  139. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  140. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  141. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  142. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  143. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  144. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  145. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  146. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  147. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  148. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  149. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  150. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  151. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  152. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  153. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  154. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  155. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  156. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  157. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  158. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  159. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  160. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  161. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  162. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  163. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  164. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  165. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  166. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  167. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  168. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  169. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  170. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  171. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  172. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  173. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  174. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  175. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  176. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  177. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  178. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  179. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  180. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  181. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  182. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  183. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  184. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  185. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  186. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  187. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  188. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  189. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  190. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  191. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  192. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  193. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  194. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  195. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  196. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  197. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  198. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  199. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  200. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  201. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  202. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  203. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  204. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  205. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  206. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  207. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  208. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  209. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  210. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  211. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  212. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  213. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  214. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  215. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  216. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  217. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  218. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  219. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  220. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  221. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  222. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  223. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  224. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  225. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  226. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  227. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  228. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  229. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  230. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  231. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  232. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  233. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  234. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  235. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  236. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  237. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  238. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  239. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  240. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  241. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  242. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  243. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  244. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  245. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  246. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  247. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  248. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  249. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  250. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  251. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  252. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  253. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  254. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  255. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  256. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  257. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  258. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  259. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  260. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  261. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  262. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  263. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  264. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  265. package/dist/chunk-AMBFK2K3.js +0 -28
@@ -1,4 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ evalApi
4
+ } from "./chunk-6M7ZEDT2.js";
2
5
  import {
3
6
  assertOutputPathAvailable,
4
7
  clientWaitTimeoutSeconds,
@@ -7,19 +10,23 @@ import {
7
10
  waitForAnalysisRun,
8
11
  withAsyncArtifactLifecycle,
9
12
  withInterruptSignal
10
- } from "./chunk-PWXDWMCW.js";
13
+ } from "./chunk-T7WF4HYW.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-VCZE3IWO.js";
21
+ } from "./chunk-TMQGS4TO.js";
16
22
  import {
17
23
  registerCapabilityGatewayRoute,
18
24
  resolveGatewayDomain
19
- } from "./chunk-KPQY44JQ.js";
25
+ } from "./chunk-AWW2T2WL.js";
20
26
  import {
27
+ unwrapOutputData,
21
28
  withOutputMetadata
22
- } from "./chunk-QZLRHGVH.js";
29
+ } from "./chunk-3ULDJJTZ.js";
23
30
  import {
24
31
  CapabilityGatewayError,
25
32
  buildCapabilityGatewayUrl,
@@ -33,13 +40,13 @@ import {
33
40
  uploadInputFile,
34
41
  validateCapability,
35
42
  validateCapabilityWithEnvelope
36
- } from "./chunk-3SDHJOCR.js";
43
+ } from "./chunk-4XKTRCRK.js";
37
44
  import "./chunk-Y74WTIKJ.js";
38
- import "./chunk-2UW3Y463.js";
45
+ import "./chunk-DWBYNGSR.js";
39
46
  import {
40
47
  getCliToken
41
- } from "./chunk-H3K5UGYC.js";
42
- import "./chunk-JNVVJ273.js";
48
+ } from "./chunk-HTZ2MLYA.js";
49
+ import "./chunk-4PSTYEG5.js";
43
50
  import {
44
51
  CliValidationError
45
52
  } from "./chunk-Z3Q2AEIN.js";
@@ -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,
@@ -4259,7 +4274,7 @@ var REPORT_WRITE_MODEL_TYPE_VALUES = [
4259
4274
  "tag"
4260
4275
  ];
4261
4276
  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.`;
4262
- var AI_DEFINITION_DESCRIPTION = 'Event metrics: omit optional display_name unless the target command schema explicitly supports it. Funnel step filters use event_property_name (not field) and string-array values, including "true"/"false" for boolean properties. For tag/cluster filters, cluster_date_policy accepts LATEST (default), AUTO (match the computed result for each analysis date), or SPECIFIED (requires specified_cluster_date in yyyy-MM-dd format). AI-facing model definition JSON. Do not pass raw QP, events, event_view, visual_view, or analysis_query. Distribution filters must be attached to the corresponding distribution_metrics[].filters; do not use top-level filters or relation. For path definitions, global filters support user_property, cluster, and tag only; event_property is not supported. session_unit accepts second (1..999), minute (1..999), or hour (1..24). Do not use day; express one day as session_interval=24 and session_unit=hour. Session analysis is a different model: it cuts sessions with session_interval plus interval_unit (second and minute 1..999, hour 1..24), required unless cut_mode=session_id, and its metrics must match view_mode. For SQL, a simple query is {"sql":"select ..."}; raw variables use ${name}, while typed params use ${Text:name}, ${Selector:name}, or ${PartDate:name}. PartDate expands to a complete predicate, so write WHERE ${PartDate:d}, not a column followed by the placeholder. A part_date parameter may set boolean use_timezone; it defaults to false and controls whether that parameter uses the query effective timezone. Selector value must match one options[].value. Trino identifiers containing #, $, @, spaces, punctuation, or a reserved word must be delimited with double quotes, for example SELECT "#user_id", "$part_event", "end" FROM ...; single quotes are string literals. For multiline SQL JSON, the decoded sql value must contain a real line break; do not submit a literal \\n sequence outside quoted SQL text. Queries against an event table must include a date-partition predicate on the quoted "$part_date" column, for example WHERE "$part_date" BETWEEN \'2026-07-01\' AND \'2026-07-07\'; the backend rejects event-table SQL without it. The CLI preserves SQL text and never auto-quotes identifiers.';
4277
+ 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_interval must be a positive integer; session_unit accepts second (1..3600), minute (1..1440), hour (1..168), or day (1..180). Session analysis is a different model: it cuts sessions with session_interval plus interval_unit (second and minute 1..999, hour 1..24), required unless cut_mode=session_id, and its metrics must match view_mode. For SQL, a simple query is {"sql":"select ..."}; raw variables use ${name}, while typed params use ${Text:name}, ${Selector:name}, or ${PartDate:name}. PartDate expands to a complete predicate, so write WHERE ${PartDate:d}, not a column followed by the placeholder. A part_date parameter may set boolean use_timezone; it defaults to false and controls whether that parameter uses the query effective timezone. Selector value must match one options[].value. Trino identifiers containing #, $, @, spaces, punctuation, or a reserved word must be delimited with double quotes, for example SELECT "#user_id", "$part_event", "end" FROM ...; single quotes are string literals. For multiline SQL JSON, the decoded sql value must contain a real line break; do not submit a literal \\n sequence outside quoted SQL text. Queries against an event table must include a date-partition predicate on the quoted "$part_date" column, for example WHERE "$part_date" BETWEEN \'2026-07-01\' AND \'2026-07-07\'; the backend rejects event-table SQL without it. The CLI preserves SQL text and never auto-quotes identifiers.';
4263
4278
  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.`;
4264
4279
  function aiModelTypeFlag(required) {
4265
4280
  return {
@@ -4286,7 +4301,7 @@ function validateFunnelStepFilters(modelType, definition) {
4286
4301
  if (!Array.isArray(filter.items) || filter.items.length === 0) {
4287
4302
  errors.push(`${location}.items: use a non-empty array of event-property filters or nested groups.`);
4288
4303
  } else {
4289
- filter.items.forEach((item, index) => visit(item, `${location}.items[${index}]`));
4304
+ filter.items.forEach((item2, index) => visit(item2, `${location}.items[${index}]`));
4290
4305
  }
4291
4306
  return;
4292
4307
  }
@@ -4386,12 +4401,12 @@ function validateReportPresentation(ctx) {
4386
4401
  function validateSeries(value) {
4387
4402
  if (!Array.isArray(value)) throw new Error("--presentation.series must be an array; [] resets all series.");
4388
4403
  const indexes = /* @__PURE__ */ new Set();
4389
- for (const [position, item] of value.entries()) {
4404
+ for (const [position, item2] of value.entries()) {
4390
4405
  const path = `--presentation.series[${position}]`;
4391
- if (!item || typeof item !== "object" || Array.isArray(item) || Object.keys(item).length !== 3 || Object.keys(item).some((key) => !["metric_index", "type", "axis"].includes(key))) {
4406
+ if (!item2 || typeof item2 !== "object" || Array.isArray(item2) || Object.keys(item2).length !== 3 || Object.keys(item2).some((key) => !["metric_index", "type", "axis"].includes(key))) {
4392
4407
  throw new Error(`${path} requires only metric_index, type, and axis, all three required.`);
4393
4408
  }
4394
- const series = item;
4409
+ const series = item2;
4395
4410
  if (typeof series.metric_index !== "number" || !Number.isInteger(series.metric_index) || series.metric_index < 1) {
4396
4411
  throw new Error(`${path}.metric_index must be a positive 1-based integer position in definition.metrics.`);
4397
4412
  }
@@ -4549,12 +4564,12 @@ async function withSqlSelectorRuntimeErrorHint(operation) {
4549
4564
  throw enrichSqlSelectorRuntimeError(error);
4550
4565
  }
4551
4566
  }
4552
- function withSqlSelectorRuntimeDiagnostics(command) {
4553
- const validateInput2 = command.validateInput;
4554
- const dryRun = command.dryRun;
4555
- const execute = command.execute;
4567
+ function withSqlSelectorRuntimeDiagnostics(command2) {
4568
+ const validateInput2 = command2.validateInput;
4569
+ const dryRun = command2.dryRun;
4570
+ const execute = command2.execute;
4556
4571
  return {
4557
- ...command,
4572
+ ...command2,
4558
4573
  ...validateInput2 ? { validateInput: (ctx) => withSqlSelectorRuntimeErrorHint(() => validateInput2(ctx)) } : {},
4559
4574
  ...dryRun ? { dryRun: (ctx) => withSqlSelectorRuntimeErrorHint(() => dryRun(ctx)) } : {},
4560
4575
  execute: (ctx) => withSqlSelectorRuntimeErrorHint(() => execute(ctx))
@@ -4740,10 +4755,11 @@ var dashboardList = createAnalysisCapabilityCommand({
4740
4755
  resource: "dashboard",
4741
4756
  command: "list",
4742
4757
  capabilityId: "analysis.dashboard.list",
4743
- description: "List dashboards the current user can update or manage. Read-only dashboards are excluded; use analysis asset search for readable asset discovery.",
4758
+ description: "List readable dashboards. For management workflows use --manageable-only. Use analysis asset search for asset discovery.",
4744
4759
  flags: [
4745
4760
  projectIdFlag,
4746
4761
  queriesFlag,
4762
+ manageableOnlyFlag,
4747
4763
  {
4748
4764
  name: "fields",
4749
4765
  type: "json",
@@ -4759,6 +4775,7 @@ var dashboardList = createAnalysisCapabilityCommand({
4759
4775
  validate: validateQueriesFlag,
4760
4776
  buildInput: (ctx) => compactInput({
4761
4777
  ...listInput(ctx),
4778
+ manageable_only: optionalBoolean(ctx, "manageable-only"),
4762
4779
  certification_scope: certificationScopeInput(ctx)
4763
4780
  })
4764
4781
  });
@@ -4825,7 +4842,7 @@ var dashboardUpdate = createAnalysisCapabilityCommand({
4825
4842
  { name: "note-id", type: "number", required: false, desc: "Dashboard note ID. Omit to create a new note attached to the dashboard." },
4826
4843
  { name: "note-title", type: "string", required: false, desc: "Dashboard note title. Defaults to empty on create; omitted values are preserved on update." },
4827
4844
  { name: "description", type: "string", required: false, desc: "Dashboard note description. Defaults to empty on create; omitted values are preserved on update." },
4828
- { name: "ui-config", type: "string", required: false, desc: "Dashboard or note UI config string. Omitted note style is preserved on update." },
4845
+ { 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." },
4829
4846
  { name: "filter-name", type: "string", required: false, desc: "Saved filter name. Required with --operation default-filter or personal-default-filter." },
4830
4847
  { 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.' },
4831
4848
  payloadFlag
@@ -4876,7 +4893,7 @@ var dashboardShare = createAnalysisCapabilityCommand({
4876
4893
  { 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.' },
4877
4894
  payloadFlag
4878
4895
  ],
4879
- risk: "write",
4896
+ risk: "high-risk-write",
4880
4897
  buildInput: (ctx) => compactInput({
4881
4898
  ...projectInput(ctx),
4882
4899
  dashboard_id: ctx.num("dashboard-id"),
@@ -4910,7 +4927,7 @@ var dashboardHandover = createAnalysisCapabilityCommand({
4910
4927
  { name: "dashboard-ids", type: "json", required: true, desc: "Dashboard ID array." },
4911
4928
  { name: "to-user-id", type: "number", required: true, desc: "Target user ID." }
4912
4929
  ],
4913
- risk: "write",
4930
+ risk: "high-risk-write",
4914
4931
  buildInput: (ctx) => ({
4915
4932
  ...projectInput(ctx),
4916
4933
  dashboard_ids: jsonArray(ctx, "dashboard-ids"),
@@ -5212,13 +5229,14 @@ var dashboardReportDataExport = createAnalysisCapabilityCommand({
5212
5229
  clusterQueryScopeFlag,
5213
5230
  slaveClusterIdFlag,
5214
5231
  { name: "zone-offset", type: "number", required: false, desc: reportDataZoneOffsetDescription },
5232
+ { 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." },
5215
5233
  { name: "request-id", type: "string", required: false, desc: "Optional cli_<32 lowercase hex> request ID. Generated when omitted." },
5216
5234
  asyncTimeoutSecondsFlag,
5217
5235
  { name: "artifact-format", type: "string", required: false, desc: "Artifact format. Only jsonl is supported." }
5218
5236
  ],
5219
5237
  risk: "read",
5220
5238
  validate: validateClusterQueryRouting,
5221
- buildInput: (ctx) => dashboardReportDataInput(ctx, false)
5239
+ buildInput: dashboardReportDataInput
5222
5240
  });
5223
5241
 
5224
5242
  // src/commands/te-analysis/dashboard-report-data/index.ts
@@ -5238,7 +5256,7 @@ var queryCancel = createAnalysisCapabilityCommand({
5238
5256
  { name: "run-id", type: "string", required: true, desc: "Async run ID returned by an export capability." },
5239
5257
  { name: "reason", type: "string", required: false, desc: "Optional cancellation reason." }
5240
5258
  ],
5241
- risk: "write",
5259
+ risk: "high-risk-write",
5242
5260
  buildInput: (ctx) => compactInput({
5243
5261
  run_id: ctx.str("run-id"),
5244
5262
  reason: optionalString(ctx, "reason")
@@ -5573,7 +5591,7 @@ var adhocRunFlags = [
5573
5591
  analysisModelPreviewRowsFlag
5574
5592
  ];
5575
5593
  var adhocExportFlags = [
5576
- ...adhocBaseFlags,
5594
+ ...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),
5577
5595
  artifactFormatFlag,
5578
5596
  asyncTimeoutSecondsFlag
5579
5597
  ];
@@ -5759,7 +5777,7 @@ function dailyReportUpdateFlags() {
5759
5777
  { name: "enable-slack", type: "boolean", required: false, desc: "Whether scheduled Slack delivery is enabled." },
5760
5778
  ...destinationFlags,
5761
5779
  { name: "send-date", type: "string", required: false, desc: "Scheduled weekdays, comma-separated 1..7." },
5762
- { name: "send-time", type: "string", required: false, desc: "Scheduled send time, HH:mm." },
5780
+ { 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." },
5763
5781
  { name: "enable-send", type: "boolean", required: false, desc: "Whether scheduled sending is enabled." }
5764
5782
  ];
5765
5783
  }
@@ -5958,7 +5976,7 @@ var biPanelShare = createAnalysisCapabilityCommand({
5958
5976
  capabilityId: "analysis.bi_panel.share",
5959
5977
  description: "Modify BI panel sharing members.",
5960
5978
  flags: [projectIdFlag, { name: "panel-id", type: "number", required: true, desc: "BI panel ID." }, payloadFlag],
5961
- risk: "write",
5979
+ risk: "high-risk-write",
5962
5980
  buildInput: (ctx) => compactInput({
5963
5981
  ...projectInput(ctx),
5964
5982
  panel_id: ctx.num("panel-id"),
@@ -6982,6 +7000,12 @@ var autoRefreshCronFlag = {
6982
7000
  desc: "Optional Quartz cron expression for an existing enabled auto-refresh schedule. This does not enable auto refresh."
6983
7001
  };
6984
7002
  var tagAutoRefreshFlags = [
7003
+ {
7004
+ name: "enable-history-tag-backup",
7005
+ type: "boolean",
7006
+ required: false,
7007
+ desc: "Save historical tag versions during scheduled refresh. Enabling requires periodic refresh. Omit on update to preserve the setting."
7008
+ },
6985
7009
  {
6986
7010
  name: "enable-auto-refresh",
6987
7011
  type: "boolean",
@@ -7102,10 +7126,10 @@ var groupColFlag = {
7102
7126
  required: true,
7103
7127
  desc: "Exact statistic value or bucket from history-tag-data results to drill down into."
7104
7128
  };
7105
- function capability(resource, command, capabilityId, description, flags, risk, buildInput2, options = {}) {
7129
+ function capability(resource, command2, capabilityId, description, flags, risk, buildInput2, options = {}) {
7106
7130
  return createAnalysisCapabilityCommand({
7107
7131
  resource,
7108
- command,
7132
+ command: command2,
7109
7133
  capabilityId,
7110
7134
  description,
7111
7135
  flags,
@@ -7114,14 +7138,14 @@ function capability(resource, command, capabilityId, description, flags, risk, b
7114
7138
  ...options
7115
7139
  });
7116
7140
  }
7117
- function idImportCapability(command) {
7118
- const originalValidate = command.validate;
7119
- const originalValidateInput = command.validateInput;
7120
- const originalDryRun = command.dryRun;
7121
- const originalExecute = command.execute;
7141
+ function idImportCapability(command2) {
7142
+ const originalValidate = command2.validate;
7143
+ const originalValidateInput = command2.validateInput;
7144
+ const originalDryRun = command2.dryRun;
7145
+ const originalExecute = command2.execute;
7122
7146
  return {
7123
- ...command,
7124
- flags: command.flags.flatMap((flag) => flag.name === "input-file-id" ? [inputFileFlag, flag] : [flag]),
7147
+ ...command2,
7148
+ flags: command2.flags.flatMap((flag) => flag.name === "input-file-id" ? [inputFileFlag, flag] : [flag]),
7125
7149
  validate: (ctx) => {
7126
7150
  originalValidate?.(ctx);
7127
7151
  const sources = ["input-file", "input-file-id", "file-content"].filter((name) => ctx.str(name).trim() !== "");
@@ -7152,7 +7176,7 @@ function idImportCapability(command) {
7152
7176
  },
7153
7177
  {
7154
7178
  method: "POST",
7155
- url: `${ctx.host()}/api/cli/${resolveGatewayDomain("analysis")}/v1/capabilities/${command.capabilityId}/dry-run`,
7179
+ url: buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `capabilities/${command2.capabilityId}/dry-run`),
7156
7180
  body: {
7157
7181
  input_file_id: "<input_file_id returned by upload step>",
7158
7182
  note: "The remaining command flags are sent unchanged after upload."
@@ -7247,6 +7271,7 @@ function clusterWriteInput(ctx, create) {
7247
7271
  function tagWriteInput(ctx, create) {
7248
7272
  const definitionRequest = optionalJson(ctx, "definition-request");
7249
7273
  validateDefinitionRequest(create, definitionRequest);
7274
+ const backup = optionalBoolean(ctx, "enable-history-tag-backup");
7250
7275
  const enabled = optionalBoolean(ctx, "enable-auto-refresh");
7251
7276
  const cron = optionalString(ctx, "auto-refresh-cron");
7252
7277
  const schedule = optionalJson(ctx, "auto-refresh-schedule");
@@ -7256,6 +7281,9 @@ function tagWriteInput(ctx, create) {
7256
7281
  if (enabled === false && (cron !== void 0 || schedule !== void 0)) {
7257
7282
  throw new Error("Cannot set a schedule with --enable-auto-refresh false");
7258
7283
  }
7284
+ if (backup === true && (enabled === false || create && schedule === void 0 && cron === void 0)) {
7285
+ throw new Error("Enabling history tag backup requires periodic refresh with a schedule");
7286
+ }
7259
7287
  if (create && enabled === true && cron === void 0 && schedule === void 0) {
7260
7288
  throw new Error("Enabling auto refresh on create requires --auto-refresh-schedule or --auto-refresh-cron");
7261
7289
  }
@@ -7268,6 +7296,7 @@ function tagWriteInput(ctx, create) {
7268
7296
  remark: create ? void 0 : optionalString(ctx, "remark"),
7269
7297
  zone_offset: optionalNumber(ctx, "zone-offset"),
7270
7298
  enable_auto_refresh: enabled,
7299
+ enable_history_tag_backup: backup,
7271
7300
  auto_refresh_cron: cron,
7272
7301
  auto_refresh_schedule: schedule,
7273
7302
  entity_id: create ? optionalNumber(ctx, "entity-id") : void 0
@@ -7510,10 +7539,12 @@ var commands42 = [
7510
7539
  ),
7511
7540
  capability("user-tag", "get", "analysis.user_tag.get", "Get user tag details by exact tag_name values.", [
7512
7541
  projectIdFlag,
7542
+ { name: "include-history-dates", type: "boolean", desc: "Include selectable local dates. Cross-source dates are not enumerated." },
7513
7543
  { name: "tag-names", type: "json", required: true, desc: "JSON array of exact tag_name values." }
7514
7544
  ], "read", (ctx) => ({
7515
7545
  project_id: ctx.num("project-id"),
7516
- tag_names: ctx.json("tag-names")
7546
+ tag_names: ctx.json("tag-names"),
7547
+ ...compactInput({ include_history_dates: optionalBoolean(ctx, "include-history-dates") })
7517
7548
  })),
7518
7549
  capability("user-tag-member", "list", "analysis.user_tag_member.list", `Run a bounded user tag member query. ${memberDataRunRoutingHelp}`, [
7519
7550
  tagNameFlag,
@@ -7532,7 +7563,10 @@ var commands42 = [
7532
7563
  tagDefinitionRequestFlag,
7533
7564
  authenticatedOnlyFlag,
7534
7565
  zoneOffsetFlag2,
7535
- entityIdFlag,
7566
+ {
7567
+ ...entityIdFlag,
7568
+ 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."
7569
+ },
7536
7570
  ...tagAutoRefreshFlags
7537
7571
  ], "write", (ctx) => tagWriteInput(ctx, true)),
7538
7572
  capability("user-tag", "update", "analysis.user_tag.update", "Update a user tag. Pass only fields that should change.", [
@@ -7747,7 +7781,7 @@ var inputFileInspect = {
7747
7781
  risk: "read",
7748
7782
  dryRun: (ctx) => ({
7749
7783
  method: "GET",
7750
- url: `${ctx.host()}/api/cli/${resolveGatewayDomain("analysis")}/v1/input-files/${ctx.str("input-file-id")}`
7784
+ url: buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `input-files/${ctx.str("input-file-id")}`)
7751
7785
  }),
7752
7786
  execute: async (ctx) => {
7753
7787
  const inputFileId = ctx.str("input-file-id");
@@ -7758,7 +7792,7 @@ var inputFileInspect = {
7758
7792
  );
7759
7793
  return {
7760
7794
  ...result,
7761
- inspect_path: `/api/cli/analysis/v1/input-files/${inputFileId}`,
7795
+ inspect_path: new URL(buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `input-files/${inputFileId}`)).pathname,
7762
7796
  inspect_command: `ae-cli analysis input-file inspect --input-file-id ${inputFileId}`
7763
7797
  };
7764
7798
  }
@@ -7809,7 +7843,7 @@ var inputFileUpload = {
7809
7843
  const inputFileId = result?.input_file_id ?? result?.inputFileId;
7810
7844
  return {
7811
7845
  ...result,
7812
- inspect_path: typeof inputFileId === "string" ? `/api/cli/analysis/v1/input-files/${inputFileId}` : result?.inspect_path,
7846
+ inspect_path: typeof inputFileId === "string" ? new URL(buildCapabilityGatewayUrl(ctx.host(), resolveGatewayDomain("analysis"), `input-files/${inputFileId}`)).pathname : result?.inspect_path,
7813
7847
  inspect_command: typeof inputFileId === "string" ? `ae-cli analysis input-file inspect --input-file-id ${inputFileId}` : void 0
7814
7848
  };
7815
7849
  }
@@ -7902,7 +7936,7 @@ var projectDataPowerUpsert = createAnalysisCapabilityCommand({
7902
7936
  projectIdFlag,
7903
7937
  requiredPayloadFlag
7904
7938
  ],
7905
- risk: "write",
7939
+ risk: "high-risk-write",
7906
7940
  buildInput: (ctx) => compactInput({
7907
7941
  project_id: ctx.num("project-id"),
7908
7942
  payload: ctx.json("payload")
@@ -8193,8 +8227,8 @@ var projectMarkTimeCreate = createAnalysisCapabilityCommand({
8193
8227
  flags: [
8194
8228
  projectIdFlag,
8195
8229
  { name: "marked-at", type: "string", required: true, desc: "Marker timestamp, for example yyyy-MM-dd HH:mm." },
8196
- { name: "zone-offset", type: "number", required: false, desc: "Marker time zone offset." },
8197
- { name: "content", type: "string", required: true, desc: "Marker content." },
8230
+ { 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." },
8231
+ { name: "content", type: "string", required: true, desc: "Marker content, at most 200 characters." },
8198
8232
  { name: "is-visible", type: "number", required: false, desc: "Whether the marker is visible. 1 visible, 0 hidden." }
8199
8233
  ],
8200
8234
  risk: "write",
@@ -8260,8 +8294,8 @@ var projectMarkTimeUpdate = createAnalysisCapabilityCommand({
8260
8294
  projectIdFlag,
8261
8295
  { name: "mark-time-id", type: "number", required: true, desc: "Date marker ID." },
8262
8296
  { name: "marked-at", type: "string", required: true, desc: "Marker timestamp, for example yyyy-MM-dd HH:mm." },
8263
- { name: "zone-offset", type: "number", required: false, desc: "Marker time zone offset." },
8264
- { name: "content", type: "string", required: true, desc: "Marker content." },
8297
+ { 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." },
8298
+ { name: "content", type: "string", required: true, desc: "Marker content, at most 200 characters." },
8265
8299
  { name: "is-visible", type: "number", required: false, desc: "Whether the marker is visible. 1 visible, 0 hidden." }
8266
8300
  ],
8267
8301
  risk: "write",
@@ -8300,7 +8334,7 @@ var projectMemberAdd = createAnalysisCapabilityCommand({
8300
8334
  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."
8301
8335
  }
8302
8336
  ],
8303
- risk: "write",
8337
+ risk: "high-risk-write",
8304
8338
  buildInput: (ctx) => compactInput({
8305
8339
  project_id: ctx.num("project-id"),
8306
8340
  payload: ctx.json("payload"),
@@ -8318,7 +8352,7 @@ var projectMemberBatchUpdate = createAnalysisCapabilityCommand({
8318
8352
  projectIdFlag,
8319
8353
  requiredPayloadFlag
8320
8354
  ],
8321
- risk: "write",
8355
+ risk: "high-risk-write",
8322
8356
  buildInput: (ctx) => compactInput({
8323
8357
  project_id: ctx.num("project-id"),
8324
8358
  payload: ctx.json("payload")
@@ -8389,7 +8423,7 @@ var projectMemberUpdate = createAnalysisCapabilityCommand({
8389
8423
  requiredPayloadFlag,
8390
8424
  { name: "target-user-id", type: "number", required: true, desc: "Target user ID." }
8391
8425
  ],
8392
- risk: "write",
8426
+ risk: "high-risk-write",
8393
8427
  buildInput: (ctx) => compactInput({
8394
8428
  project_id: ctx.num("project-id"),
8395
8429
  payload: ctx.json("payload"),
@@ -8633,7 +8667,7 @@ var projectMemberHandoverRun = createAnalysisCapabilityCommand({
8633
8667
  projectIdFlag,
8634
8668
  requiredPayloadFlag
8635
8669
  ],
8636
- risk: "write",
8670
+ risk: "high-risk-write",
8637
8671
  buildInput: (ctx) => compactInput({
8638
8672
  project_id: ctx.num("project-id"),
8639
8673
  payload: ctx.json("payload")
@@ -8681,7 +8715,7 @@ var projectOwnerUpdate = createAnalysisCapabilityCommand({
8681
8715
  { name: "project-name", type: "string", required: false, desc: "Optional project name update." },
8682
8716
  { name: "project-remark", type: "string", required: false, desc: "Optional project remark update." }
8683
8717
  ],
8684
- risk: "write",
8718
+ risk: "high-risk-write",
8685
8719
  buildInput: (ctx) => compactInput({
8686
8720
  project_id: ctx.num("project-id"),
8687
8721
  company_id: ctx.num("company-id"),
@@ -8828,7 +8862,7 @@ var projectRoleUpsert = createAnalysisCapabilityCommand({
8828
8862
  desc: "Role payload with role_func_list object items containing function_name and has_power (0 or 1)."
8829
8863
  }
8830
8864
  ],
8831
- risk: "write",
8865
+ risk: "high-risk-write",
8832
8866
  buildInput: (ctx) => compactInput({
8833
8867
  project_id: ctx.num("project-id"),
8834
8868
  payload: ctx.json("payload")
@@ -8949,78 +8983,78 @@ var projectTimezoneUpdate = createAnalysisCapabilityCommand({
8949
8983
  ],
8950
8984
  risk: "write",
8951
8985
  buildInput: (ctx) => {
8952
- const item = ctx.str("item").toLowerCase();
8986
+ const item2 = ctx.str("item").toLowerCase();
8953
8987
  const payload = ctx.json("payload");
8954
- validateTimezonePayload(item, payload);
8988
+ validateTimezonePayload(item2, payload);
8955
8989
  return compactInput({
8956
8990
  project_id: ctx.num("project-id"),
8957
8991
  payload,
8958
- item
8992
+ item: item2
8959
8993
  });
8960
8994
  }
8961
8995
  });
8962
- function validateTimezonePayload(item, payload) {
8963
- if (!TIMEZONE_ITEMS.includes(item)) {
8996
+ function validateTimezonePayload(item2, payload) {
8997
+ if (!TIMEZONE_ITEMS.includes(item2)) {
8964
8998
  throw new CliValidationError(
8965
8999
  "--item must be timezone_toggle, zone_offset, user_timezone, or project_timezone_display.",
8966
9000
  { code: "INVALID_TIMEZONE_ITEM" }
8967
9001
  );
8968
9002
  }
8969
9003
  if (!isObject(payload)) {
8970
- throw invalidPayload(item, "must be a JSON object");
9004
+ throw invalidPayload(item2, "must be a JSON object");
8971
9005
  }
8972
- switch (item) {
9006
+ switch (item2) {
8973
9007
  case "timezone_toggle":
8974
9008
  if (typeof payload.toggle !== "boolean") {
8975
- throw invalidPayload(item, "requires boolean field toggle", '{"toggle":true}');
9009
+ throw invalidPayload(item2, "requires boolean field toggle", '{"toggle":true}');
8976
9010
  }
8977
- allowOnly(payload, item, ["toggle"]);
9011
+ allowOnly(payload, item2, ["toggle"]);
8978
9012
  return;
8979
9013
  case "zone_offset":
8980
9014
  if (typeof payload.column_name !== "string") {
8981
- throw invalidPayload(item, "requires string field column_name", '{"column_name":"#zone_offset"}');
9015
+ throw invalidPayload(item2, "requires string field column_name", '{"column_name":"#zone_offset"}');
8982
9016
  }
8983
- allowOnly(payload, item, ["column_name"]);
9017
+ allowOnly(payload, item2, ["column_name"]);
8984
9018
  return;
8985
9019
  case "user_timezone":
8986
9020
  if (typeof payload.column_name !== "string" || payload.column_name.length === 0) {
8987
- throw invalidPayload(item, "requires non-empty string field column_name", '{"column_name":"user_timezone"}');
9021
+ throw invalidPayload(item2, "requires non-empty string field column_name", '{"column_name":"user_timezone"}');
8988
9022
  }
8989
9023
  if (payload.codetable !== void 0 && typeof payload.codetable !== "string") {
8990
- throw invalidPayload(item, "optional field codetable must be a string", '{"column_name":"user_timezone","codetable":"timezone_code_table"}');
9024
+ throw invalidPayload(item2, "optional field codetable must be a string", '{"column_name":"user_timezone","codetable":"timezone_code_table"}');
8991
9025
  }
8992
- allowOnly(payload, item, ["column_name", "codetable"]);
9026
+ allowOnly(payload, item2, ["column_name", "codetable"]);
8993
9027
  return;
8994
9028
  case "project_timezone_display":
8995
- validateDisplayTimezones(payload.display_timezones, item);
8996
- allowOnly(payload, item, ["display_timezones"]);
9029
+ validateDisplayTimezones(payload.display_timezones, item2);
9030
+ allowOnly(payload, item2, ["display_timezones"]);
8997
9031
  }
8998
9032
  }
8999
- function validateDisplayTimezones(value, item) {
9033
+ function validateDisplayTimezones(value, item2) {
9000
9034
  if (!Array.isArray(value) || value.length === 0) {
9001
- throw invalidPayload(item, "requires non-empty array field display_timezones", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
9035
+ throw invalidPayload(item2, "requires non-empty array field display_timezones", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
9002
9036
  }
9003
9037
  for (const entry of value) {
9004
9038
  if (!isObject(entry)) {
9005
- throw invalidPayload(item, "display_timezones entries must be objects", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
9039
+ throw invalidPayload(item2, "display_timezones entries must be objects", '{"display_timezones":[{"timezone":8,"is_default":true}]}');
9006
9040
  }
9007
- allowOnly(entry, item, ["timezone", "is_default"]);
9041
+ allowOnly(entry, item2, ["timezone", "is_default"]);
9008
9042
  if (!Number.isInteger(entry.timezone) || !(entry.timezone >= -12 && entry.timezone <= 14 || entry.timezone === 99)) {
9009
- throw invalidPayload(item, "display_timezones[].timezone must be an integer from -12 through 14, or 99 for no fixed display timezone");
9043
+ throw invalidPayload(item2, "display_timezones[].timezone must be an integer from -12 through 14, or 99 for no fixed display timezone");
9010
9044
  }
9011
9045
  if (entry.is_default !== void 0 && typeof entry.is_default !== "boolean") {
9012
- throw invalidPayload(item, "display_timezones[].is_default must be a boolean when provided");
9046
+ throw invalidPayload(item2, "display_timezones[].is_default must be a boolean when provided");
9013
9047
  }
9014
9048
  }
9015
9049
  }
9016
- function allowOnly(payload, item, fields2) {
9050
+ function allowOnly(payload, item2, fields2) {
9017
9051
  if (Object.keys(payload).some((field) => !fields2.includes(field))) {
9018
- throw invalidPayload(item, `supports only fields ${fields2.join(", ")}`);
9052
+ throw invalidPayload(item2, `supports only fields ${fields2.join(", ")}`);
9019
9053
  }
9020
9054
  }
9021
- function invalidPayload(item, reason, example) {
9055
+ function invalidPayload(item2, reason, example) {
9022
9056
  return new CliValidationError(
9023
- `--payload for --item ${item} ${reason}.`,
9057
+ `--payload for --item ${item2} ${reason}.`,
9024
9058
  {
9025
9059
  code: "INVALID_TIMEZONE_PAYLOAD",
9026
9060
  hint: example === void 0 ? void 0 : `Use: --payload '${example}'`
@@ -9090,12 +9124,12 @@ var project_default = commands67;
9090
9124
  // src/commands/te-analysis/tracking/shared.ts
9091
9125
  function createTrackingCapabilityCommand(config) {
9092
9126
  const { asyncArtifact, ...coreConfig } = config;
9093
- const command = createCapabilityCommand({
9127
+ const command2 = createCapabilityCommand({
9094
9128
  ...coreConfig,
9095
9129
  cliService: "tracking",
9096
9130
  gatewayDomain: "analysis"
9097
9131
  });
9098
- return asyncArtifact ? withAsyncArtifactLifecycle(command) : command;
9132
+ return asyncArtifact ? withAsyncArtifactLifecycle(command2) : command2;
9099
9133
  }
9100
9134
  var eventsFlag = {
9101
9135
  name: "events",
@@ -9559,20 +9593,20 @@ function definitions(candidates, kind) {
9559
9593
  function existingDefinitions(value, nameField, displayNameField) {
9560
9594
  if (!Array.isArray(value)) return [];
9561
9595
  const rows = [];
9562
- for (const item of value) {
9563
- if (!isRecord2(item)) continue;
9564
- const name = nonEmptyString(item[nameField]);
9596
+ for (const item2 of value) {
9597
+ if (!isRecord2(item2)) continue;
9598
+ const name = nonEmptyString(item2[nameField]);
9565
9599
  if (!name) continue;
9566
9600
  rows.push({
9567
9601
  name,
9568
- displayName: nonEmptyString(item[displayNameField])
9602
+ displayName: nonEmptyString(item2[displayNameField])
9569
9603
  });
9570
9604
  }
9571
9605
  return rows;
9572
9606
  }
9573
9607
  function buildGroup(type, source, existing) {
9574
9608
  const existingByName = new Map(
9575
- existing.map((item) => [item.name, item.displayName])
9609
+ existing.map((item2) => [item2.name, item2.displayName])
9576
9610
  );
9577
9611
  const items = [];
9578
9612
  const skippedExisting = [];
@@ -10361,6 +10395,26 @@ var alert_notice_config_default = commands82;
10361
10395
  // src/commands/te-analysis/system/shared.ts
10362
10396
  import { readFileSync as readFileSync3, statSync as statSync3 } from "fs";
10363
10397
  var secretValues = /* @__PURE__ */ new WeakMap();
10398
+ var backendConfirmationCapabilities = /* @__PURE__ */ new Set([
10399
+ "system.member_status.update",
10400
+ "system.member_project.batch_update",
10401
+ "system.member_password.reset",
10402
+ "system.member.delete",
10403
+ "system.role.upsert",
10404
+ "system.role.delete",
10405
+ "system.admin.upsert",
10406
+ "system.admin_function.update",
10407
+ "system.admin.remove",
10408
+ "system.seat.update",
10409
+ "system.mfa.update",
10410
+ "system.member_mfa.unbind",
10411
+ "system.query_task.cancel",
10412
+ "system.query_alert_rule.update",
10413
+ "system.ops_alert_contact.delete",
10414
+ "system.smtp.delete",
10415
+ "system.receiver_address.delete",
10416
+ "system.third_party_login.disable"
10417
+ ]);
10364
10418
  var companyIdField = {
10365
10419
  flag: "company-id",
10366
10420
  input: "company_id",
@@ -10409,7 +10463,7 @@ function defineSystemCommand(spec) {
10409
10463
  risk: spec.risk,
10410
10464
  validate: (ctx) => {
10411
10465
  validateSecretSources(ctx, secrets);
10412
- const input = buildSystemInput(ctx, fields2, [], spec.risk);
10466
+ const input = buildSystemInput(ctx, fields2, [], spec.capabilityId);
10413
10467
  for (const secret of secrets) {
10414
10468
  if (ctx.str(`${secret.flag}-file`) || ctx.bool(`${secret.flag}-stdin`)) {
10415
10469
  input[secret.input] = "<provided>";
@@ -10419,7 +10473,7 @@ function defineSystemCommand(spec) {
10419
10473
  spec.validate?.(ctx, input);
10420
10474
  },
10421
10475
  buildInput: (ctx) => {
10422
- const input = buildSystemInput(ctx, fields2, secrets, spec.risk);
10476
+ const input = buildSystemInput(ctx, fields2, secrets, spec.capabilityId);
10423
10477
  validateFields(fields2, input);
10424
10478
  validateSecretSources(ctx, secrets);
10425
10479
  spec.validate?.(ctx, input);
@@ -10456,7 +10510,7 @@ function secretFlags(secret) {
10456
10510
  }
10457
10511
  ];
10458
10512
  }
10459
- function buildSystemInput(ctx, fields2, secrets, risk) {
10513
+ function buildSystemInput(ctx, fields2, secrets, capabilityId) {
10460
10514
  const input = {};
10461
10515
  for (const field of fields2) {
10462
10516
  const value = fieldValue(ctx, field);
@@ -10466,7 +10520,7 @@ function buildSystemInput(ctx, fields2, secrets, risk) {
10466
10520
  const value = secretValue(ctx, secret);
10467
10521
  if (value !== void 0) input[secret.input] = secret.transform ? secret.transform(value) : value;
10468
10522
  }
10469
- if (risk === "high-risk-write") input.yes = true;
10523
+ if (backendConfirmationCapabilities.has(capabilityId)) input.yes = true;
10470
10524
  return compactInput(input);
10471
10525
  }
10472
10526
  function fieldValue(ctx, field) {
@@ -10550,12 +10604,12 @@ function requireArrayObjects(input, name, requiredKeys) {
10550
10604
  const value = input[name];
10551
10605
  if (value === void 0) return;
10552
10606
  if (!Array.isArray(value)) throw validation(`${snakeToFlag(name)} must be a JSON array.`);
10553
- value.forEach((item, index) => {
10554
- if (!item || typeof item !== "object" || Array.isArray(item)) {
10607
+ value.forEach((item2, index) => {
10608
+ if (!item2 || typeof item2 !== "object" || Array.isArray(item2)) {
10555
10609
  throw validation(`${snakeToFlag(name)} item ${index + 1} must be an object.`);
10556
10610
  }
10557
10611
  for (const key of requiredKeys) {
10558
- if (!(key in item)) {
10612
+ if (!(key in item2)) {
10559
10613
  throw validation(`${snakeToFlag(name)} item ${index + 1} is missing ${key}.`);
10560
10614
  }
10561
10615
  }
@@ -10742,7 +10796,7 @@ var systemConfigurationCommands = [
10742
10796
  command: "upsert",
10743
10797
  capabilityId: "system.third_party_login.upsert",
10744
10798
  description: "Create or update a third-party login configuration using protected secret sources.",
10745
- risk: "write",
10799
+ risk: "high-risk-write",
10746
10800
  fields: [
10747
10801
  loginType,
10748
10802
  { flag: "app-id", type: "string", required: true, desc: "Provider application ID." },
@@ -10779,7 +10833,7 @@ var systemConfigurationCommands = [
10779
10833
  command: "update",
10780
10834
  capabilityId: "system.oauth2.update",
10781
10835
  description: "Enable or disable company OAuth2 login.",
10782
- risk: "write",
10836
+ risk: "high-risk-write",
10783
10837
  fields: [
10784
10838
  { flag: "enable-oauth2", type: "boolean", required: true, desc: "Target OAuth2 login state." }
10785
10839
  ]
@@ -11197,17 +11251,17 @@ var systemMonitoringCommands = [
11197
11251
  throw validation("--delete-ids must contain positive integers.");
11198
11252
  }
11199
11253
  const upserts = input.upserts;
11200
- for (const [index, item] of (upserts ?? []).entries()) {
11201
- const metric = Number(item.metric_content);
11202
- const wheelMinutes = Number(item.wheel_minutes);
11203
- const wheelInterval = Number(item.wheel_interval);
11204
- const threshold = Number(item.threshold);
11254
+ for (const [index, item2] of (upserts ?? []).entries()) {
11255
+ const metric = Number(item2.metric_content);
11256
+ const wheelMinutes = Number(item2.wheel_minutes);
11257
+ const wheelInterval = Number(item2.wheel_interval);
11258
+ const threshold = Number(item2.threshold);
11205
11259
  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) {
11206
11260
  throw validation(`--upserts item ${index + 1} contains an invalid metric/window/threshold.`);
11207
11261
  }
11208
11262
  }
11209
11263
  const deleted = new Set((deleteIds ?? []).map(Number));
11210
- if ((upserts ?? []).some((item) => item.rule_id !== void 0 && deleted.has(Number(item.rule_id)))) {
11264
+ if ((upserts ?? []).some((item2) => item2.rule_id !== void 0 && deleted.has(Number(item2.rule_id)))) {
11211
11265
  throw validation("The same rule_id cannot appear in both --upserts and --delete-ids.");
11212
11266
  }
11213
11267
  }
@@ -11243,7 +11297,7 @@ var systemMonitoringCommands = [
11243
11297
  if (input.on_status === void 0) throw validation("--on-status is required when creating a contact.");
11244
11298
  requireAtLeastOne(
11245
11299
  input,
11246
- ["mail_address", "mobile", ...contactWebhookSecrets.map((item) => item.input)],
11300
+ ["mail_address", "mobile", ...contactWebhookSecrets.map((item2) => item2.input)],
11247
11301
  "Provide at least one delivery target when creating a contact."
11248
11302
  );
11249
11303
  }
@@ -11602,11 +11656,11 @@ var commonFlags2 = [
11602
11656
  { name: "query-path", type: "json", desc: "1..64 ordered references: [{capability_id,invocation_id?,client_request_id?,purpose?}]. Prefer only returned meta.invocation_id; fallback to returned gateway meta.client_request_id, never business request_id. One analysis data-query step required. Inputs/status/timing come from existing call telemetry. Never include query results." },
11603
11657
  { name: "project-id", type: "number", desc: "Source analysis project. Collection is skipped if omitted or the project has not explicitly enabled scenario samples." }
11604
11658
  ];
11605
- function withProjectCollectionPolicy(command) {
11659
+ function withProjectCollectionPolicy(command2) {
11606
11660
  return {
11607
- ...command,
11661
+ ...command2,
11608
11662
  execute: async (ctx) => {
11609
- const input = scenarioInput(ctx, command.command === "append");
11663
+ const input = scenarioInput(ctx, command2.command === "append");
11610
11664
  const skipped = (reason) => withOutputMetadata({
11611
11665
  accepted: false,
11612
11666
  skipped: true,
@@ -11615,9 +11669,9 @@ function withProjectCollectionPolicy(command) {
11615
11669
  ...input.answer_id ? { answer_id: input.answer_id } : {},
11616
11670
  ...input.entry_id ? { entry_id: input.entry_id } : {},
11617
11671
  ...input.target_answer_id ? { target_answer_id: input.target_answer_id } : {},
11618
- event_name: command.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
11672
+ event_name: command2.command === "append" ? "cli_analysis_scenario_entry" : "cli_analysis_scenario",
11619
11673
  delivery: "best_effort"
11620
- }, { capability_id: command.capabilityId });
11674
+ }, { capability_id: command2.capabilityId });
11621
11675
  if (input.project_id === void 0) return skipped("PROJECT_REQUIRED");
11622
11676
  try {
11623
11677
  const policy = await executeCapabilityWithEnvelope(ctx.host(), "analysis", "project.info.get", {
@@ -11629,7 +11683,7 @@ function withProjectCollectionPolicy(command) {
11629
11683
  } catch {
11630
11684
  return skipped("PROJECT_COLLECTION_CONFIG_UNAVAILABLE");
11631
11685
  }
11632
- return command.execute(ctx);
11686
+ return command2.execute(ctx);
11633
11687
  }
11634
11688
  };
11635
11689
  }
@@ -11718,7 +11772,7 @@ var scenarioList = createAnalysisCapabilityCommand({
11718
11772
  buildInput: scenarioListInput
11719
11773
  });
11720
11774
  function scenarioGetInput(ctx) {
11721
- const { limit, offset, ...input } = scenarioListInput(ctx);
11775
+ const { limit: limit2, offset, ...input } = scenarioListInput(ctx);
11722
11776
  for (const key of ["open-id", "agent-session-id", "question-id"]) {
11723
11777
  input[key.replaceAll("-", "_")] = text2(ctx.str(key), key, 191);
11724
11778
  }
@@ -11740,6 +11794,140 @@ var scenarioGet = createAnalysisCapabilityCommand({
11740
11794
  });
11741
11795
  var scenario_default = [scenarioBegin, scenarioCollect, scenarioAppend, scenarioList, scenarioGet];
11742
11796
 
11797
+ // src/commands/te-analysis/bad-case/evaluation-sync.ts
11798
+ async function syncBadCaseEvaluation(ctx, projectId, value) {
11799
+ const item2 = value;
11800
+ if (!item2?.evaluation || !["PENDING", "ERROR"].includes(item2.evaluation.state)) return value;
11801
+ const common = (action, input = {}) => executeCapability(ctx.host(), "analysis", `analysis.bad_case.${action}`, { project_id: projectId, ...input });
11802
+ let report;
11803
+ try {
11804
+ const config = await common("evaluation_config");
11805
+ if (!config?.initialized || config.te_project_id !== String(projectId) || !config.dataset_id)
11806
+ throw new EvalApiError("Initialize this project evaluation configuration first.", { code: "NOT_INITIALIZED", httpStatus: 0 });
11807
+ const version = Number(item2.version);
11808
+ if (!Number.isSafeInteger(version) || version <= 0)
11809
+ throw new EvalApiError("Invalid source version.", { code: "INVALID_RESPONSE", httpStatus: 0 });
11810
+ const active = item2.review_state === "APPROVED";
11811
+ const result = await evalApi(
11812
+ ctx,
11813
+ "PUT",
11814
+ `/semantic-evaluation/datasets/${encodeURIComponent(config.dataset_id)}/cases/${encodeURIComponent(item2.id)}`,
11815
+ void 0,
11816
+ {
11817
+ version,
11818
+ active,
11819
+ question: item2.evidence_snapshot.question,
11820
+ answer: item2.evidence_snapshot.answer,
11821
+ reason: item2.ai_summary.reason,
11822
+ supplement: item2.review?.supplement || ""
11823
+ },
11824
+ { teProjectId: String(projectId) }
11825
+ );
11826
+ 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 !== ""))
11827
+ throw new EvalApiError("Invalid synchronization response.", { code: "INVALID_RESPONSE", httpStatus: 0 });
11828
+ report = { state: "SYNCED", case_id: result.case_id };
11829
+ } catch (error) {
11830
+ const code = error instanceof EvalApiError ? error.code : "";
11831
+ 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" };
11832
+ }
11833
+ try {
11834
+ return await common("evaluation_result", { item_id: item2.id, version: item2.version, ...report });
11835
+ } catch {
11836
+ try {
11837
+ return await common("get", { item_id: item2.id });
11838
+ } catch {
11839
+ return { ...item2, evaluation: { state: "PENDING" } };
11840
+ }
11841
+ }
11842
+ }
11843
+
11844
+ // src/commands/te-analysis/bad-case/index.ts
11845
+ import { readFileSync as readFileSync4 } from "fs";
11846
+ var project = { name: "project-id", type: "number", required: true, desc: "Project owner or administrator access is required." };
11847
+ var request = { name: "client-request-id", type: "string", required: true, desc: "Stable request ID; preserve on retries." };
11848
+ var item = { name: "item-id", type: "string", required: true, desc: "Bad Case item ID as a decimal string." };
11849
+ var batch = { name: "batch-id", type: "string", required: true, desc: "Discovery batch ID returned by begin." };
11850
+ var limit = { name: "limit", type: "number", desc: "Page size, 1..100. Follow pagination until complete." };
11851
+ function badCaseInput(action, flags, ctx) {
11852
+ const input = {};
11853
+ for (const flag of flags) {
11854
+ if (flag.name === "input-file") continue;
11855
+ const value = ctx.str(flag.name);
11856
+ if (!value && !flag.required) continue;
11857
+ if (!value && flag.required) throw new CliValidationError(`${flag.name} is required.`);
11858
+ if (flag.type === "number") {
11859
+ const number = Number(value);
11860
+ const minimum = flag.name === "offset" ? 0 : 1;
11861
+ const maximum = flag.name === "limit" ? 100 : 2147483647;
11862
+ if (!Number.isInteger(number) || number < minimum || number > maximum) throw new CliValidationError(`${flag.name} must be an integer between ${minimum} and ${maximum}.`);
11863
+ input[flag.name.replaceAll("-", "_")] = number;
11864
+ } else if (flag.type === "boolean") {
11865
+ if (!["true", "false"].includes(value)) throw new CliValidationError(`${flag.name} must be true or false.`);
11866
+ input[flag.name.replaceAll("-", "_")] = value === "true";
11867
+ } else {
11868
+ 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.`);
11869
+ input[flag.name.replaceAll("-", "_")] = value;
11870
+ }
11871
+ }
11872
+ if (action === "review" && !["APPROVE", "REJECT", "REVOKE"].includes(String(input.decision))) throw new CliValidationError("decision must be APPROVE, REJECT or REVOKE.");
11873
+ if (action === "run" && !["HEARTBEAT", "FAILED"].includes(String(input.action))) throw new CliValidationError("action must be HEARTBEAT or FAILED.");
11874
+ if (action === "submit") {
11875
+ let packet;
11876
+ try {
11877
+ packet = JSON.parse(readFileSync4(ctx.str("input-file"), "utf8"));
11878
+ } catch {
11879
+ throw new CliValidationError("input-file must be a readable JSON file.");
11880
+ }
11881
+ 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) {
11882
+ throw new CliValidationError("The file must contain only candidates: an array of at most 200 occurrences. Empty batches are allowed.");
11883
+ }
11884
+ const seen = /* @__PURE__ */ new Set();
11885
+ const roots = /* @__PURE__ */ new Set();
11886
+ for (const candidate of packet.candidates) {
11887
+ if (!candidate || typeof candidate !== "object" || !candidate.candidate_id || seen.has(candidate.candidate_id)) throw new CliValidationError("Every occurrence needs a unique candidate_id.");
11888
+ seen.add(candidate.candidate_id);
11889
+ if (candidate.duplicate_of) {
11890
+ 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.");
11891
+ } else {
11892
+ roots.add(candidate.candidate_id);
11893
+ 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.");
11894
+ }
11895
+ 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.");
11896
+ }
11897
+ input.candidates = packet.candidates;
11898
+ }
11899
+ return input;
11900
+ }
11901
+ function command(action, description, flags, read = false) {
11902
+ return createAnalysisCapabilityCommand({
11903
+ resource: "bad-case",
11904
+ command: action,
11905
+ capabilityId: `analysis.bad_case.${action.replaceAll("-", "_")}`,
11906
+ description,
11907
+ risk: read ? "read" : "write",
11908
+ flags: [project, ...flags],
11909
+ buildInput: (ctx) => badCaseInput(action, [project, ...flags], ctx),
11910
+ ...action === "review" ? { postProcess: (result, input, ctx) => syncBadCaseEvaluation(ctx, Number(input.project_id), result) } : {}
11911
+ });
11912
+ }
11913
+ 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." }]);
11914
+ 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." }]);
11915
+ 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);
11916
+ 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." }]);
11917
+ 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);
11918
+ var badCaseGet = command("get", "Read the reviewed question, answer, CLI calls and optional human supplement.", [item], true);
11919
+ 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." }]);
11920
+ var badCaseSubmitToPage = command("submit-to-page", "Publish an existing pending case for page review without copying it or changing its review state.", [item, request]);
11921
+ var badCaseSyncEvaluation = {
11922
+ ...badCaseGet,
11923
+ command: "sync-evaluation",
11924
+ capabilityId: void 0,
11925
+ risk: "write",
11926
+ description: "Retry AE synchronization using the latest saved review. Does not change the review decision; reports synchronization state.",
11927
+ execute: async (ctx) => syncBadCaseEvaluation(ctx, Number(ctx.str("project-id")), unwrapOutputData(await badCaseGet.execute(ctx)))
11928
+ };
11929
+ var bad_case_default = [badCaseBegin, badCaseRun, badCaseHistory, badCaseSubmit, badCaseList, badCaseGet, badCaseReview, badCaseSubmitToPage, badCaseSyncEvaluation];
11930
+
11743
11931
  // src/commands/te-analysis/index.ts
11744
11932
  registerCapabilityGatewayRoute("analysis", { gatewayDomain: "analysis" });
11745
11933
  registerCapabilityGatewayRoute("project", { gatewayDomain: "analysis" });
@@ -11789,7 +11977,8 @@ var baseCommands = [
11789
11977
  ...alert_notice_config_default,
11790
11978
  ...system_default,
11791
11979
  ...feedback_default,
11792
- ...scenario_default
11980
+ ...scenario_default,
11981
+ ...bad_case_default
11793
11982
  ];
11794
11983
  var commands84 = [...baseCommands];
11795
11984
  var te_analysis_default = commands84;