@thinkingai/ae-cli 6.0.58 → 6.0.61

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 (281) hide show
  1. package/README.md +14 -6
  2. package/README.zh.md +16 -6
  3. package/bin/ai-monitor.js +2 -0
  4. package/bin/runtime-capabilities.json +1 -1
  5. package/dist/ai-monitor-NUKSJPLE.js +33 -0
  6. package/dist/ai-monitor.js +136 -0
  7. package/dist/{auth-A5OO4VS4.js → auth-MVAEBGBP.js} +24 -15
  8. package/dist/{automation-FD2QZUP6.js → automation-6L6IAYRK.js} +6 -7
  9. package/dist/{capability-SKI4GHF4.js → capability-74N7AN5X.js} +35 -38
  10. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  11. package/dist/{chunk-QWSA3EOD.js → chunk-7WBCSJL6.js} +23 -9
  12. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  13. package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
  14. package/dist/chunk-BQFLABJQ.js +186 -0
  15. package/dist/{chunk-E25OSZLJ.js → chunk-COOMXFUG.js} +3 -3
  16. package/dist/chunk-EFGUBGA6.js +64 -0
  17. package/dist/{chunk-HQCY3QCA.js → chunk-H35VDOAE.js} +18 -13
  18. package/dist/{chunk-VDICGXCY.js → chunk-HIMOBNEY.js} +2 -2
  19. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  20. package/dist/chunk-HRFYYEXR.js +1285 -0
  21. package/dist/{chunk-UYJMEHAF.js → chunk-JZY6WWAP.js} +22 -21
  22. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  23. package/dist/{chunk-YVG6QD3V.js → chunk-LFJ7N36I.js} +103 -8
  24. package/dist/{chunk-EEARZNHE.js → chunk-LPKIMGIU.js} +89 -37
  25. package/dist/chunk-NNK3JBH4.js +60 -0
  26. package/dist/{chunk-WMDO53YK.js → chunk-OTZ4JQDU.js} +2 -2
  27. package/dist/{chunk-SOSFRU3O.js → chunk-PLNS5J33.js} +58 -26
  28. package/dist/chunk-PUSFEC6B.js +29 -0
  29. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  30. package/dist/{chunk-K2Z7QHDR.js → chunk-RB26WNLM.js} +52 -15
  31. package/dist/chunk-SVNED423.js +556 -0
  32. package/dist/{chunk-AWVZTN2B.js → chunk-THTROEGD.js} +1 -1
  33. package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
  34. package/dist/{chunk-JSBLCLFE.js → chunk-VLOGOM7N.js} +13 -7
  35. package/dist/{chunk-GBSACKFB.js → chunk-XPARQSYS.js} +528 -299
  36. package/dist/{chunk-72NJKS7O.js → chunk-XZDKAR4N.js} +4 -4
  37. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  38. package/dist/{compat-check-WFEKVLTH.js → compat-check-W4XC27RG.js} +5 -4
  39. package/dist/{config-U4I7X25P.js → config-264GB6C7.js} +28 -14
  40. package/dist/{context-CDB5H5PD.js → context-SOQDFZIB.js} +8 -6
  41. package/dist/{data-integration-QE37EQ3A.js → data-integration-UNJ7EPW2.js} +6 -6
  42. package/dist/{evaluation-LR4YDYWL.js → evaluation-Q3AIGFOG.js} +14 -159
  43. package/dist/index.js +98 -589
  44. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  45. package/dist/{memory-SNFR5M23.js → memory-ZLTTULZK.js} +9 -10
  46. package/dist/{metadata-6QM6EED5.js → metadata-EN2IWCDI.js} +11 -10
  47. package/dist/{model-KEVCEXWD.js → model-NAKQWK4W.js} +4 -5
  48. package/dist/{personal-semantic-preference-7VXQPP2N.js → personal-semantic-preference-UGN67KTN.js} +46 -15
  49. package/dist/{project-semantic-PSEPYH2L.js → project-semantic-5OP3YPZD.js} +19 -16
  50. package/dist/{sync-22ACDK5Z.js → sync-LDJQZRQH.js} +9 -9
  51. package/dist/{te-agent-BJ36B4QI.js → te-agent-WNNAD4AJ.js} +303 -17
  52. package/dist/{te-analysis-WQ6D6YG4.js → te-analysis-KIMH6AGU.js} +399 -205
  53. package/dist/{te-community-VRWMFGI6.js → te-community-P7NNBVCS.js} +17 -15
  54. package/dist/{te-dataops-YTLFTTW7.js → te-dataops-ZRKSG4R7.js} +13 -11
  55. package/dist/{te-engage-V2QW7TIC.js → te-engage-PVBVNRSU.js} +13 -12
  56. package/dist/{te-kb-4AQLISDR.js → te-kb-W7PRC7QN.js} +80 -20
  57. package/dist/{te-system-CYWSK3UN.js → te-system-F4ZU2HRQ.js} +6 -7
  58. package/dist/{te-team-6ELNGBWT.js → te-team-5ONMRGKF.js} +9 -8
  59. package/dist/{things-HFWLGCUH.js → things-PFENSIF4.js} +9 -8
  60. package/dist/{update-3CRVVHV5.js → update-EUZ4GNND.js} +8 -6
  61. package/dist/{workspace-2CKQX2XL.js → workspace-Z7L33OBQ.js} +6 -7
  62. package/package.json +12 -7
  63. package/skills/ae-agent/SKILL.md +19 -5
  64. package/skills/ae-agent/references/a2a.md +103 -0
  65. package/skills/ae-agent/references/command_index.md +11 -0
  66. package/skills/ae-ai-monitor/SKILL.md +179 -0
  67. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  68. package/skills/ae-analysis/SKILL.md +43 -25
  69. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  70. package/skills/ae-analysis/references/ai_models.md +1 -0
  71. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  72. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  73. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  74. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  75. package/skills/ae-analysis/references/asset_search.md +1 -1
  76. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  77. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  78. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  79. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  80. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  81. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  82. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  83. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  84. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  85. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  86. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  87. package/skills/ae-analysis/references/catalog_list.md +2 -0
  88. package/skills/ae-analysis/references/command_index.md +44 -35
  89. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  90. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  91. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  92. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  93. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  94. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  95. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  96. package/skills/ae-analysis/references/folder_share.md +8 -2
  97. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  98. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  99. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  100. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  101. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  102. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  103. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  104. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  105. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  106. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  107. package/skills/ae-analysis/references/project_member_add.md +3 -1
  108. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  109. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  110. package/skills/ae-analysis/references/project_member_update.md +3 -1
  111. package/skills/ae-analysis/references/project_owner_update.md +8 -2
  112. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  113. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  114. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  115. package/skills/ae-analysis/references/project_space_share.md +8 -2
  116. package/skills/ae-analysis/references/property_get.md +2 -0
  117. package/skills/ae-analysis/references/public_link_list.md +3 -1
  118. package/skills/ae-analysis/references/query_cancel.md +4 -1
  119. package/skills/ae-analysis/references/report_data_run.md +1 -1
  120. package/skills/ae-analysis/references/report_list.md +3 -3
  121. package/skills/ae-analysis/references/scenario_append.md +2 -2
  122. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  123. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  124. package/skills/ae-analysis/references/scenario_list.md +7 -7
  125. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  126. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  127. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  128. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  129. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  130. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  131. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  132. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  133. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  134. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  135. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  136. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  137. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  138. package/skills/ae-automation/SKILL.md +4 -2
  139. package/skills/ae-capability/SKILL.md +16 -8
  140. package/skills/ae-community/SKILL.md +1 -0
  141. package/skills/ae-dataops/SKILL.md +1 -0
  142. package/skills/ae-engage/SKILL.md +1 -0
  143. package/skills/ae-evaluation/SKILL.md +17 -2
  144. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  145. package/skills/ae-kb/SKILL.md +8 -4
  146. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  147. package/skills/ae-kb/references/publication.md +45 -0
  148. package/skills/ae-kb/references/query-workflow.md +3 -1
  149. package/skills/ae-kb/references/versions.md +1 -1
  150. package/skills/ae-metadata/SKILL.md +1 -0
  151. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  152. package/skills/ae-team/SKILL.md +1 -1
  153. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  154. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  155. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  156. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  157. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  158. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  159. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  160. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  161. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  162. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  163. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  164. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  165. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  166. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  167. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  168. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  169. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  170. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  171. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  172. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  173. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  174. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  175. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  176. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  177. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  178. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  179. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  180. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  181. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  182. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  183. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  184. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  185. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  186. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  187. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  188. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  189. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  190. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  191. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  192. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  193. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  194. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  195. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  196. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  197. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  198. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  199. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  200. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  201. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  202. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  203. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  204. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  205. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  206. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  207. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  208. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  209. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  210. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  211. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  212. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  213. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  214. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  215. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  216. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  217. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  218. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  219. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  220. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  221. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  222. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  223. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  224. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  225. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  226. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  227. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  228. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  229. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  230. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  231. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  232. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  233. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  234. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  235. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  236. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  237. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  238. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  239. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  240. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  241. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  242. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  243. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  244. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  245. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  246. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  247. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  248. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  249. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  250. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  251. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  252. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  253. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  254. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  255. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  256. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  257. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  258. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  259. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  260. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  261. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  262. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  263. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  264. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  265. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  266. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  267. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  268. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  269. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  270. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  271. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  272. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  273. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  274. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  275. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  276. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  277. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  278. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  279. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  280. package/dist/chunk-AMBFK2K3.js +0 -28
  281. package/dist/chunk-Y74WTIKJ.js +0 -10
@@ -1,20 +1,21 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
- internalCallSourceHeaders
4
- } from "./chunk-Y74WTIKJ.js";
3
+ sourceLoggedFetch
4
+ } from "./chunk-NNK3JBH4.js";
5
5
  import {
6
6
  SecureStoreAuthError,
7
7
  clearCliTokenCache,
8
- getCliToken
9
- } from "./chunk-SOSFRU3O.js";
8
+ getCliToken,
9
+ internalCallSourceHeaders
10
+ } from "./chunk-PLNS5J33.js";
10
11
  import {
11
12
  safeJsonParse,
12
13
  stringifyJsonRequest
13
- } from "./chunk-4PSTYEG5.js";
14
+ } from "./chunk-AMURHMS3.js";
14
15
  import {
15
16
  PermissionError,
16
17
  externalCliTokenRequestOptions
17
- } from "./chunk-Z3Q2AEIN.js";
18
+ } from "./chunk-R2SVAO4G.js";
18
19
 
19
20
  // src/core/cli-agent-context.ts
20
21
  import { readFileSync, statSync } from "fs";
@@ -283,7 +284,7 @@ function buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams = {},
283
284
  const base = host.replace(/\/+$/, "");
284
285
  const cleanDomain = domain.replace(/^\/+|\/+$/g, "");
285
286
  const cleanPath = pathAfterV1.replace(/^\/+|\/+$/g, "");
286
- const gatewayPrefix = cleanDomain === "" ? `/api/cli/${apiVersion}` : `/api/cli/${cleanDomain}/${apiVersion}`;
287
+ const gatewayPrefix = cleanDomain === "ai-monitor" ? "/ai-monitor/api/cli/v1" : cleanDomain === "" ? `/api/cli/${apiVersion}` : `/api/cli/${cleanDomain}/${apiVersion}`;
287
288
  const url = new URL(`${base}${gatewayPrefix}/${cleanPath}`);
288
289
  for (const [key, value] of Object.entries(queryParams)) {
289
290
  if (value !== void 0 && value !== null) {
@@ -422,7 +423,7 @@ async function throwCapabilityHttpError(resp) {
422
423
  }
423
424
  throw error;
424
425
  }
425
- async function requestOnce(url, method, token, body, accept = "application/json", includeClientContextInBody = true) {
426
+ async function requestOnce(url, method, token, body, accept = "application/json", includeClientContextInBody = true, signal) {
426
427
  const agentContext = readCliAgentContext();
427
428
  const headers = {
428
429
  "cli-token": token,
@@ -435,10 +436,10 @@ async function requestOnce(url, method, token, body, accept = "application/json"
435
436
  headers["Content-Type"] = "application/json";
436
437
  init.body = stringifyJsonRequest(includeClientContextInBody ? withCliAgentContextBody(body, agentContext) : body);
437
438
  }
438
- return fetch(url, { ...init, ...externalCliTokenRequestOptions(url) });
439
+ return sourceLoggedFetch(url, { ...init, ...externalCliTokenRequestOptions(url), signal });
439
440
  }
440
441
  async function requestMultipartOnce(url, token, form) {
441
- return fetch(url, {
442
+ return sourceLoggedFetch(url, {
442
443
  method: "POST",
443
444
  ...externalCliTokenRequestOptions(url),
444
445
  headers: {
@@ -454,12 +455,12 @@ async function callGateway(host, domain, pathAfterV1, method, body, queryParams
454
455
  }
455
456
  async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body, queryParams = {}, options = {}) {
456
457
  const url = buildCapabilityGatewayUrl(options.apiBaseUrl ?? host, domain, pathAfterV1, queryParams, options.apiVersion);
457
- const token = await getCliToken(host);
458
- let resp = await requestOnce(url, method, token, body, "application/json", options.includeClientContextInBody);
458
+ const token = await getCliToken(host, options.signal);
459
+ let resp = await requestOnce(url, method, token, body, "application/json", options.includeClientContextInBody, options.signal);
459
460
  if (resp.status === 401 && options.retryOnUnauthorized === true) {
460
461
  await resp.body?.cancel();
461
462
  clearCliTokenCache(host);
462
- resp = await requestOnce(url, method, await getCliToken(host), body, "application/json", options.includeClientContextInBody);
463
+ resp = await requestOnce(url, method, await getCliToken(host, options.signal), body, "application/json", options.includeClientContextInBody, options.signal);
463
464
  }
464
465
  if (resp.status === 403) {
465
466
  const error = await permissionError(resp);
@@ -478,10 +479,10 @@ async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body,
478
479
  isCommunityGatewayRequest(domain, pathAfterV1)
479
480
  );
480
481
  }
481
- async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json") {
482
- const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
483
- const token = await getCliToken(host);
484
- const resp = await requestOnce(url, method, token, body, accept);
482
+ async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json", options = {}) {
483
+ const url = buildCapabilityGatewayUrl(options.apiBaseUrl ?? host, domain, pathAfterV1, {}, options.apiVersion);
484
+ const token = await getCliToken(host, options.signal);
485
+ const resp = await requestOnce(url, method, token, body, accept, options.includeClientContextInBody, options.signal);
485
486
  if (resp.status === 403) {
486
487
  const error = await permissionError(resp);
487
488
  if (isInvalidCliTokenMessage(error.message)) {
@@ -494,15 +495,15 @@ async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET",
494
495
  }
495
496
  return resp;
496
497
  }
497
- async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body) {
498
- const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
498
+ async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, options = {}) {
499
+ const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body, "application/json", options);
499
500
  return unwrapCapabilityEnvelope(
500
501
  parseCapabilityResponse(await resp.text()),
501
502
  isCommunityGatewayRequest(domain, pathAfterV1)
502
503
  );
503
504
  }
504
- async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body) {
505
- const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
505
+ async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body, options = {}) {
506
+ const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body, "application/json", options);
506
507
  return parseCapabilityEnvelope(
507
508
  parseCapabilityResponse(await resp.text()),
508
509
  isCommunityGatewayRequest(domain, pathAfterV1)
@@ -1,10 +1,10 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  getActiveHost
4
- } from "./chunk-4PSTYEG5.js";
4
+ } from "./chunk-AMURHMS3.js";
5
5
  import {
6
6
  normalizeUrl
7
- } from "./chunk-Z3Q2AEIN.js";
7
+ } from "./chunk-R2SVAO4G.js";
8
8
 
9
9
  // src/core/auth.ts
10
10
  function resolveHost(hostOverride) {
@@ -1,8 +1,11 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ internalCallSourceHeaders
4
+ } from "./chunk-PLNS5J33.js";
2
5
  import {
3
6
  CliValidationError,
4
7
  logger
5
- } from "./chunk-Z3Q2AEIN.js";
8
+ } from "./chunk-R2SVAO4G.js";
6
9
 
7
10
  // src/core/eval-endpoint.ts
8
11
  function resolveEvaluationHost(host) {
@@ -31,6 +34,64 @@ function resolveEvaluationHost(host) {
31
34
  return endpoint.toString().replace(/\/+$/, "").replace(/\/agent$/, "");
32
35
  }
33
36
 
37
+ // src/core/eval-onboarding.ts
38
+ function evaluationResponseStatus(httpStatus, contentType, body, source = "api") {
39
+ const error = body && typeof body === "object" ? body.error : void 0;
40
+ const code = error && typeof error === "object" ? error.code : void 0;
41
+ const businessError = typeof code === "string" && /^[A-Z][A-Z0-9_]{0,127}$/.test(code);
42
+ const html = contentType?.toLowerCase().includes("text/html");
43
+ if (httpStatus === 403) return "access_not_granted";
44
+ if (httpStatus === 404 && !businessError) {
45
+ return source === "session" ? "availability_unknown" : "module_not_detected";
46
+ }
47
+ if (httpStatus >= 500) return "availability_unknown";
48
+ if (html && httpStatus >= 200 && httpStatus < 300) {
49
+ return source === "session" ? "availability_unknown" : "module_not_detected";
50
+ }
51
+ return void 0;
52
+ }
53
+ function buildEvaluationOnboardingPayload(status, host) {
54
+ const nextSteps = {
55
+ module_not_detected: [
56
+ "The evaluation API was not detected. This optional module may be absent, or its route may be misconfigured; installation is not confirmed.",
57
+ "Contact your ThinkingData service representative (Customer Success Manager or Technical Support) to verify deployment and routing, install AI Evaluation Center if needed, and enable access.",
58
+ "After activation, open AI Evaluation Center from the app launcher and ask an administrator to assign the required project role."
59
+ ],
60
+ access_not_granted: [
61
+ "This request was denied. The denial may come from the gateway, module access policy, or the selected project; it does not establish cluster-wide installation or access.",
62
+ "Ask your system administrator or ThinkingData support to check the denied request and grant the required module access or target project role (READER / EDITOR / ADMIN).",
63
+ "Stop only the denied operation; independent authorized operations may continue. Stop a whole project or module only when that access scope is confirmed. Do not reinstall the module or refresh credentials solely because of HTTP 403."
64
+ ],
65
+ token_missing: [
66
+ "AE_EVAL_ACCESS_TOKEN is unset. No evaluation request was sent; module availability and service health have not been checked.",
67
+ "If AI Evaluation Center is available in the app launcher, obtain a session token through its web console or POST /agenteval/api/v1/auth/session and set AE_EVAL_ACCESS_TOKEN securely.",
68
+ "If the module entry is unavailable, contact your administrator or ThinkingData support to verify deployment and enable module access and the required project role."
69
+ ],
70
+ availability_unknown: [
71
+ "Evaluation availability could not be confirmed. A gateway outage, missing sandbox session route, login page, or invalid response does not prove the module is uninstalled.",
72
+ "Check the selected --host and network path; ask your administrator or ThinkingData support to verify evaluation service health and gateway/session routing.",
73
+ "A failed write response leaves the write result unconfirmed; the server may already have accepted it. Do not resubmit the write blindly. Once connectivity is restored, use authorized read-only status checks to reconcile the result before deciding whether to retry.",
74
+ "Do not rotate credentials or request installation based only on this response."
75
+ ]
76
+ };
77
+ return {
78
+ status,
79
+ host: resolveEvaluationHost(host),
80
+ module_name: "AI Evaluation Center (Agent Evaluation Platform)",
81
+ tagline: "Repeatable, traceable, reusable Agent quality evaluation before release and during iteration.",
82
+ highlights: [
83
+ { pillar: "Datasets", summary: "Manage single/multi-turn cases and immutable versions; import CSV/JSON or convert AI Monitor traces into datasets." },
84
+ { pillar: "Evaluators", summary: "Use scoring templates or custom LLM judges, calibrate against human labels, and optimize evaluator prompts." },
85
+ { pillar: "Evaluation Runs", summary: "Test live Agents or score preset outputs, schedule regression runs, export low-score cases, and inspect execution traces." }
86
+ ],
87
+ next_steps: nextSteps[status],
88
+ agent_instruction: [
89
+ status === "access_not_granted" ? "Stop only the denied operation. Independent authorized operations may continue. Do not probe other commands to bypass the denial; stop a whole project or module only when that access scope is confirmed." : status === "availability_unknown" ? "Stop blind retries of the failed operation and alternate flags. For a write, report that its result is unconfirmed: the server may already have accepted it. Do not resubmit blindly. Once connectivity is restored, use authorized read-only status checks to reconcile the result before deciding whether to retry." : "Stop evaluation commands for the affected host until the reported condition changes. Do not try alternate commands or flags.",
90
+ "Continue independent local work; save generated CSV/JSON and confirm its actual path before saying it is saved. Explain the evidence and uncertainty in the user's language, briefly relate the three capabilities to their task, and present the relevant next steps. Never ask the user to paste a token into chat."
91
+ ].join(" ")
92
+ };
93
+ }
94
+
34
95
  // src/core/eval-client.ts
35
96
  import { open, unlink } from "fs/promises";
36
97
  import { resolve } from "path";
@@ -40,6 +101,7 @@ var EvalApiError = class extends Error {
40
101
  httpStatus;
41
102
  hint;
42
103
  details;
104
+ onboarding;
43
105
  constructor(message, options) {
44
106
  const redact = evaluationErrorRedactor([
45
107
  ...options.sensitiveValues ?? [],
@@ -51,6 +113,7 @@ var EvalApiError = class extends Error {
51
113
  this.httpStatus = options.httpStatus;
52
114
  this.hint = options.hint === void 0 ? void 0 : redact(options.hint);
53
115
  this.details = options.details === void 0 ? void 0 : redact(options.details);
116
+ this.onboarding = options.onboarding === void 0 ? void 0 : redact(options.onboarding);
54
117
  }
55
118
  };
56
119
  function evaluationErrorRedactor(secrets) {
@@ -80,6 +143,7 @@ async function evalRequest(options) {
80
143
  const timeout = setTimeout(() => controller.abort(), timeoutMs);
81
144
  const headers = {
82
145
  ...options.headers,
146
+ ...internalCallSourceHeaders(),
83
147
  Accept: options.responseType === "bytes" ? "application/octet-stream, application/json" : "application/json"
84
148
  };
85
149
  const isMultipart = options.body instanceof FormData;
@@ -100,7 +164,7 @@ async function evalRequest(options) {
100
164
  redirect: "error",
101
165
  signal: controller.signal
102
166
  });
103
- if (response.ok && options.responseType === "bytes") {
167
+ if (response.ok && options.responseType === "bytes" && !response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
104
168
  bytes = new Uint8Array(await response.arrayBuffer());
105
169
  } else {
106
170
  responseText = await response.text();
@@ -112,20 +176,41 @@ async function evalRequest(options) {
112
176
  throw new EvalApiError(`Evaluation API request timed out after ${timeoutMs} ms.`, {
113
177
  code: "EVAL_API_TIMEOUT",
114
178
  httpStatus: 0,
115
- hint: "Verify the evaluation platform is reachable at the configured endpoint."
179
+ hint: "Verify the evaluation platform is reachable at the configured endpoint.",
180
+ onboarding: buildEvaluationOnboardingPayload("availability_unknown", options.baseUrl)
116
181
  });
117
182
  }
118
183
  throw new EvalApiError("Evaluation API request failed before a response was received.", {
119
184
  code: "EVAL_API_NETWORK_ERROR",
120
185
  httpStatus: 0,
121
- hint: "Verify the --endpoint URL and network path."
186
+ hint: "Verify the --host URL and network path.",
187
+ onboarding: buildEvaluationOnboardingPayload("availability_unknown", options.baseUrl)
122
188
  });
123
189
  } finally {
124
190
  clearTimeout(timeout);
125
191
  }
126
192
  logEvalRequest(options.method, url, response.status);
127
193
  if (bytes !== void 0) return bytes;
128
- const responseBody = parseEvalResponseBody(responseText, response.status);
194
+ let responseBody;
195
+ try {
196
+ if (response.headers.get("content-type")?.toLowerCase().includes("text/html")) {
197
+ throw new EvalApiError("Evaluation API returned an HTML response instead of the requested API data.", {
198
+ code: "EVAL_API_INVALID_RESPONSE",
199
+ httpStatus: response.status
200
+ });
201
+ }
202
+ responseBody = parseEvalResponseBody(responseText, response.status);
203
+ } catch (error) {
204
+ if (!(error instanceof EvalApiError)) throw error;
205
+ const status = evaluationResponseStatus(response.status, response.headers.get("content-type"), void 0);
206
+ throw new EvalApiError(error.message, {
207
+ code: error.code,
208
+ httpStatus: error.httpStatus,
209
+ hint: error.hint,
210
+ sensitiveValues: Object.values(options.headers).flatMap((value) => [value, value.replace(/^Bearer\s+/i, "")]),
211
+ onboarding: buildEvaluationOnboardingPayload(status ?? "availability_unknown", options.baseUrl)
212
+ });
213
+ }
129
214
  if (!response.ok) {
130
215
  const sensitiveValues = Object.values(options.headers).flatMap((value) => [value, value.replace(/^Bearer\s+/i, "")]);
131
216
  if (isRecord(options.body)) {
@@ -133,7 +218,13 @@ async function evalRequest(options) {
133
218
  if (typeof options.body[key] === "string") sensitiveValues.push(options.body[key]);
134
219
  }
135
220
  }
136
- throw evalErrorFromBody(responseBody, response.status, sensitiveValues);
221
+ const status = evaluationResponseStatus(response.status, response.headers.get("content-type"), responseBody);
222
+ throw evalErrorFromBody(
223
+ responseBody,
224
+ response.status,
225
+ sensitiveValues,
226
+ status ? buildEvaluationOnboardingPayload(status, options.baseUrl) : void 0
227
+ );
137
228
  }
138
229
  return responseBody;
139
230
  }
@@ -189,7 +280,7 @@ function parseEvalResponseBody(text, httpStatus) {
189
280
  });
190
281
  }
191
282
  }
192
- function evalErrorFromBody(body, httpStatus, sensitiveValues) {
283
+ function evalErrorFromBody(body, httpStatus, sensitiveValues, onboarding) {
193
284
  const error = body?.error;
194
285
  if (isRecord(error) && typeof error.message === "string" && error.message.trim()) {
195
286
  return new EvalApiError(error.message.trim(), {
@@ -197,12 +288,14 @@ function evalErrorFromBody(body, httpStatus, sensitiveValues) {
197
288
  httpStatus,
198
289
  hint: typeof error.details === "string" ? error.details : void 0,
199
290
  details: isRecord(error.details) ? error.details : void 0,
200
- sensitiveValues
291
+ sensitiveValues,
292
+ onboarding
201
293
  });
202
294
  }
203
295
  return new EvalApiError(`Evaluation API returned HTTP ${httpStatus}.`, {
204
296
  code: `EVAL_API_HTTP_${httpStatus}`,
205
297
  httpStatus,
298
+ onboarding,
206
299
  hint: httpStatus >= 500 ? "The server response was suppressed. Check the evaluation platform logs; the CLI did not retry." : void 0
207
300
  });
208
301
  }
@@ -227,6 +320,8 @@ function redactEvalLogUrl(url) {
227
320
 
228
321
  export {
229
322
  resolveEvaluationHost,
323
+ evaluationResponseStatus,
324
+ buildEvaluationOnboardingPayload,
230
325
  EvalApiError,
231
326
  evalRequest,
232
327
  evalDownloadFile
@@ -1,20 +1,20 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  resolveGatewayDomain
4
- } from "./chunk-KPQY44JQ.js";
5
- import {
6
- CapabilityGatewayError,
7
- fetchCapabilityGateway,
8
- requestCapabilityGateway
9
- } from "./chunk-UYJMEHAF.js";
4
+ } from "./chunk-AWW2T2WL.js";
10
5
  import {
11
6
  readOutputMetadata,
12
7
  unwrapOutputData,
13
8
  withOutputMetadata
14
- } from "./chunk-WMDO53YK.js";
9
+ } from "./chunk-OTZ4JQDU.js";
10
+ import {
11
+ CapabilityGatewayError,
12
+ fetchCapabilityGateway,
13
+ requestCapabilityGateway
14
+ } from "./chunk-JZY6WWAP.js";
15
15
  import {
16
16
  PermissionError
17
- } from "./chunk-Z3Q2AEIN.js";
17
+ } from "./chunk-R2SVAO4G.js";
18
18
 
19
19
  // src/core/analysis-async-artifact.ts
20
20
  import { randomBytes } from "crypto";
@@ -141,16 +141,59 @@ async function waitForAnalysisRun(host, runId, options = {}) {
141
141
  let lastState = "";
142
142
  let materializationStartedAt;
143
143
  let descriptor = options.initialDescriptor;
144
+ let lastDescriptor = descriptor;
145
+ const lifecycleDeadline = () => materializationStartedAt === void 0 ? deadline : Math.min(deadline, materializationStartedAt + MATERIALIZATION_GRACE_MS);
146
+ const checkWaitBoundary = () => {
147
+ throwIfAborted(options.signal, runId);
148
+ if (now() < Math.min(clientDeadline, lifecycleDeadline())) return;
149
+ if (clientDeadline <= lifecycleDeadline()) {
150
+ throw waitError(
151
+ `Stopped waiting after ${waitTimeoutSeconds} seconds for run ${runId}. The remote run was not canceled.`,
152
+ "ASYNC_WAIT_TIMEOUT",
153
+ runId,
154
+ void 0,
155
+ lastDescriptor,
156
+ { wait_timeout_seconds: waitTimeoutSeconds }
157
+ );
158
+ }
159
+ throw waitError(
160
+ `Stopped waiting because the server-declared deadline for run ${runId} was reached. The remote run was not canceled.`,
161
+ "ASYNC_WAIT_DEADLINE_REACHED",
162
+ runId,
163
+ void 0,
164
+ lastDescriptor
165
+ );
166
+ };
144
167
  while (true) {
145
168
  throwIfAborted(options.signal, runId);
146
169
  if (descriptor !== void 0 && descriptorRunStatus(descriptor) === void 0) {
147
170
  descriptor = void 0;
148
171
  }
149
172
  if (descriptor === void 0) {
173
+ checkWaitBoundary();
174
+ const controller = new AbortController();
175
+ const onAbort = () => controller.abort(options.signal?.reason);
176
+ options.signal?.addEventListener("abort", onAbort, { once: true });
177
+ if (options.signal?.aborted) onAbort();
178
+ const signal = controller.signal;
179
+ const timer = setTimeout(() => controller.abort(), Math.max(1, Math.ceil(Math.min(clientDeadline, lifecycleDeadline()) - now())));
150
180
  try {
151
- descriptor = asDescriptor(await inspect(host, runId));
181
+ descriptor = asDescriptor(await abortableRequest(inspect(host, runId, signal), signal));
182
+ checkWaitBoundary();
183
+ lastDescriptor = descriptor;
152
184
  transientFailures = 0;
153
185
  } catch (error) {
186
+ checkWaitBoundary();
187
+ if (controller.signal.aborted) {
188
+ throw waitError(
189
+ "The local inspect wait ended. The remote run was not canceled.",
190
+ clientDeadline <= lifecycleDeadline() ? "ASYNC_WAIT_TIMEOUT" : "ASYNC_WAIT_DEADLINE_REACHED",
191
+ runId,
192
+ error,
193
+ lastDescriptor,
194
+ clientDeadline <= lifecycleDeadline() ? { wait_timeout_seconds: waitTimeoutSeconds } : {}
195
+ );
196
+ }
154
197
  if (error instanceof PermissionError) throw error;
155
198
  if (error instanceof CapabilityGatewayError && error.httpStatus === 404) {
156
199
  throw new CapabilityGatewayError(
@@ -169,9 +212,13 @@ async function waitForAnalysisRun(host, runId, options = {}) {
169
212
  error
170
213
  );
171
214
  }
172
- await sleep(delayMs, options.signal);
215
+ await sleep(Math.min(delayMs, Math.max(0, Math.min(clientDeadline, lifecycleDeadline()) - now())), options.signal);
216
+ checkWaitBoundary();
173
217
  delayMs = nextDelay(delayMs);
174
218
  continue;
219
+ } finally {
220
+ clearTimeout(timer);
221
+ options.signal?.removeEventListener("abort", onAbort);
175
222
  }
176
223
  }
177
224
  deadline = Math.min(deadline, deriveDeadline(descriptor, startedAt));
@@ -217,27 +264,8 @@ async function waitForAnalysisRun(host, runId, options = {}) {
217
264
  if (runStatus === "SUCCEEDED" && materializationStartedAt === void 0) {
218
265
  materializationStartedAt = now();
219
266
  }
220
- const lifecycleDeadline = materializationStartedAt === void 0 ? deadline : Math.min(deadline, materializationStartedAt + MATERIALIZATION_GRACE_MS);
221
- const effectiveDeadline = Math.min(clientDeadline, lifecycleDeadline);
222
- if (now() >= effectiveDeadline) {
223
- if (clientDeadline <= lifecycleDeadline) {
224
- throw waitError(
225
- `Stopped waiting after ${waitTimeoutSeconds} seconds for run ${runId}. The remote run was not canceled.`,
226
- "ASYNC_WAIT_TIMEOUT",
227
- runId,
228
- void 0,
229
- descriptor,
230
- { wait_timeout_seconds: waitTimeoutSeconds }
231
- );
232
- }
233
- throw waitError(
234
- `Stopped waiting because the server-declared deadline for run ${runId} was reached. The remote run was not canceled.`,
235
- "ASYNC_WAIT_DEADLINE_REACHED",
236
- runId,
237
- void 0,
238
- descriptor
239
- );
240
- }
267
+ checkWaitBoundary();
268
+ const effectiveDeadline = Math.min(clientDeadline, lifecycleDeadline());
241
269
  await sleep(Math.min(delayMs, Math.max(0, effectiveDeadline - now())), options.signal);
242
270
  delayMs = nextDelay(delayMs);
243
271
  descriptor = void 0;
@@ -247,7 +275,13 @@ async function downloadAnalysisArtifact(host, runId, artifactId, output, options
247
275
  const outputPath = resolve(output);
248
276
  await assertOutputPathAvailable(outputPath, options.force, { run_id: runId, artifact_id: artifactId });
249
277
  if (options.ensureReady !== false) {
250
- const descriptor = await inspectAnalysisRun(host, runId);
278
+ let descriptor;
279
+ try {
280
+ descriptor = await abortableRequest(inspectAnalysisRun(host, runId, options.signal), options.signal);
281
+ } catch (error) {
282
+ throwIfAborted(options.signal, runId);
283
+ throw error;
284
+ }
251
285
  ensureCompletedDescriptor(descriptor, runId, artifactId);
252
286
  }
253
287
  await mkdir(dirname(outputPath), { recursive: true });
@@ -258,7 +292,7 @@ async function downloadAnalysisArtifact(host, runId, artifactId, output, options
258
292
  let tempPresent = false;
259
293
  try {
260
294
  throwIfAborted(options.signal, runId);
261
- const response = await fetchArtifact(host, runId, artifactId);
295
+ const response = await abortableRequest(fetchArtifact(host, runId, artifactId, options.signal), options.signal);
262
296
  if (!response.body) {
263
297
  throw protocolError("Artifact download response has no body.", runId);
264
298
  }
@@ -363,11 +397,14 @@ async function withInterruptSignal(operation, runId) {
363
397
  process.removeListener("SIGINT", onInterrupt);
364
398
  }
365
399
  }
366
- async function inspectAnalysisRun(host, runId) {
400
+ async function inspectAnalysisRun(host, runId, signal) {
367
401
  return asDescriptor(await requestCapabilityGateway(
368
402
  host,
369
403
  resolveGatewayDomain("analysis"),
370
- `runs/${encodeURIComponent(runId)}`
404
+ `runs/${encodeURIComponent(runId)}`,
405
+ "GET",
406
+ void 0,
407
+ { signal }
371
408
  ));
372
409
  }
373
410
  function ensureCompletedDescriptor(descriptor, runId, artifactId) {
@@ -508,6 +545,20 @@ function isTransientPollError(error) {
508
545
  function throwIfAborted(signal, runId) {
509
546
  if (signal?.aborted) throw interruptedError(runId);
510
547
  }
548
+ async function abortableRequest(request, signal) {
549
+ if (!signal) return request;
550
+ let onAbort = () => void 0;
551
+ const aborted = new Promise((_resolve, reject) => {
552
+ onAbort = () => reject(signal.reason ?? new DOMException("The operation was aborted", "AbortError"));
553
+ if (signal.aborted) onAbort();
554
+ else signal.addEventListener("abort", onAbort, { once: true });
555
+ });
556
+ try {
557
+ return await Promise.race([request, aborted]);
558
+ } finally {
559
+ signal.removeEventListener("abort", onAbort);
560
+ }
561
+ }
511
562
  async function abortableSleep(milliseconds, signal) {
512
563
  if (milliseconds <= 0) return;
513
564
  await new Promise((resolveSleep, reject) => {
@@ -538,14 +589,15 @@ async function pathExists(path) {
538
589
  function artifactPath(runId, artifactId) {
539
590
  return `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`;
540
591
  }
541
- function fetchArtifact(host, runId, artifactId) {
592
+ function fetchArtifact(host, runId, artifactId, signal) {
542
593
  return fetchCapabilityGateway(
543
594
  host,
544
595
  resolveGatewayDomain("analysis"),
545
596
  artifactPath(runId, artifactId),
546
597
  "GET",
547
598
  void 0,
548
- "application/octet-stream"
599
+ "application/octet-stream",
600
+ { signal }
549
601
  );
550
602
  }
551
603
 
@@ -0,0 +1,60 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+ import {
3
+ getLocalCliPackageInfo
4
+ } from "./chunk-PUSFEC6B.js";
5
+ import {
6
+ getAeSandboxDetectionReason
7
+ } from "./chunk-AMURHMS3.js";
8
+ import {
9
+ logger
10
+ } from "./chunk-R2SVAO4G.js";
11
+
12
+ // src/core/source-logged-fetch.ts
13
+ import { randomUUID } from "crypto";
14
+ var CLI_REQUEST_ID_HEADER = "X-TA-CLI-Request-Id";
15
+ var localPackage = getLocalCliPackageInfo();
16
+ var MAX_LOG_VALUE_LENGTH = 256;
17
+ function bounded(value) {
18
+ return value.length > MAX_LOG_VALUE_LENGTH ? `${value.slice(0, MAX_LOG_VALUE_LENGTH)}...[truncated]` : value;
19
+ }
20
+ function sourceLoggedFetch(url, init) {
21
+ const requestId = randomUUID();
22
+ let headers;
23
+ if (init.headers instanceof Headers) {
24
+ headers = new Headers(init.headers);
25
+ headers.set(CLI_REQUEST_ID_HEADER, requestId);
26
+ } else if (Array.isArray(init.headers)) {
27
+ headers = [
28
+ ...init.headers.filter(([name]) => name.toLowerCase() !== CLI_REQUEST_ID_HEADER.toLowerCase()),
29
+ [CLI_REQUEST_ID_HEADER, requestId]
30
+ ];
31
+ } else {
32
+ headers = Object.fromEntries(Object.entries(init.headers ?? {}).filter(([name]) => name.toLowerCase() !== CLI_REQUEST_ID_HEADER.toLowerCase()));
33
+ headers[CLI_REQUEST_ID_HEADER] = requestId;
34
+ }
35
+ const request = { ...init, headers };
36
+ try {
37
+ const target = new URL(url);
38
+ const actualHeaders = new Headers(headers);
39
+ const source = actualHeaders.get("X-Source");
40
+ const sandboxDetection = getAeSandboxDetectionReason();
41
+ logger.info(`CLI_SOURCE_SEND ${JSON.stringify({
42
+ request_id: requestId,
43
+ method: init.method ?? "GET",
44
+ host: bounded(target.host),
45
+ path: bounded(target.pathname),
46
+ source: source === null ? null : bounded(source),
47
+ source_state: source === null ? "missing" : source === "" ? "empty" : source.includes(",") ? "multiple" : "present",
48
+ cli_package: localPackage.name,
49
+ cli_version: localPackage.version,
50
+ sandbox_detected: sandboxDetection !== "not_detected",
51
+ sandbox_detection: sandboxDetection
52
+ })}`);
53
+ } catch {
54
+ }
55
+ return fetch(url, request);
56
+ }
57
+
58
+ export {
59
+ sourceLoggedFetch
60
+ };
@@ -2,11 +2,11 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  getPendingHostCompatNotice,
4
4
  getPendingUpdateNotice
5
- } from "./chunk-GBSACKFB.js";
5
+ } from "./chunk-XPARQSYS.js";
6
6
  import {
7
7
  logger,
8
8
  redactExternalCliToken
9
- } from "./chunk-Z3Q2AEIN.js";
9
+ } from "./chunk-R2SVAO4G.js";
10
10
 
11
11
  // src/framework/output.ts
12
12
  import Table from "cli-table3";