@thinkingai/ae-cli 6.1.30 → 6.1.33

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 (294) hide show
  1. package/README.md +16 -7
  2. package/README.zh.md +18 -7
  3. package/bin/ai-monitor.js +2 -0
  4. package/bin/runtime-capabilities.json +1 -1
  5. package/dist/ai-monitor-OHTSU6SV.js +33 -0
  6. package/dist/ai-monitor.js +136 -0
  7. package/dist/{auth-ADZHUIJR.js → auth-2MOK4OI6.js} +24 -14
  8. package/dist/{automation-FD2QZUP6.js → automation-6L6IAYRK.js} +6 -7
  9. package/dist/{capability-QXFRJYZD.js → capability-EMIHQJA3.js} +31 -34
  10. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  11. package/dist/{chunk-HRUOV6EQ.js → chunk-4IQYPWCX.js} +22 -21
  12. package/dist/{chunk-EUFP4M2A.js → chunk-7DHSB3FL.js} +85 -33
  13. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  14. package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
  15. package/dist/chunk-BQFLABJQ.js +186 -0
  16. package/dist/{chunk-E25OSZLJ.js → chunk-COOMXFUG.js} +3 -3
  17. package/dist/{chunk-AVXDJAFC.js → chunk-DWAG2QJM.js} +52 -15
  18. package/dist/{chunk-CG773QXN.js → chunk-E3ONSFUN.js} +528 -299
  19. package/dist/chunk-EFGUBGA6.js +64 -0
  20. package/dist/chunk-EWVEAERM.js +563 -0
  21. package/dist/{chunk-VDICGXCY.js → chunk-HIMOBNEY.js} +2 -2
  22. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  23. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  24. package/dist/{chunk-TFORY6WY.js → chunk-KD5UC33N.js} +23 -9
  25. package/dist/{chunk-YVG6QD3V.js → chunk-LFJ7N36I.js} +103 -8
  26. package/dist/chunk-NNK3JBH4.js +60 -0
  27. package/dist/{chunk-YULUBP3R.js → chunk-O45NOIWR.js} +2 -2
  28. package/dist/{chunk-SOSFRU3O.js → chunk-PLNS5J33.js} +58 -26
  29. package/dist/chunk-PUSFEC6B.js +29 -0
  30. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  31. package/dist/{chunk-Y3AM6LIO.js → chunk-RC3PPCYD.js} +16 -11
  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-72NJKS7O.js → chunk-XZDKAR4N.js} +4 -4
  36. package/dist/chunk-YE6MJB5V.js +1285 -0
  37. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  38. package/dist/{compat-check-HERBTQZN.js → compat-check-CADG7GND.js} +5 -4
  39. package/dist/{config-E3KANXMK.js → config-PFD3KWQG.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 +95 -593
  44. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  45. package/dist/{memory-SNFR5M23.js → memory-HKNGUIPK.js} +6 -7
  46. package/dist/{metadata-EXQYDZTH.js → metadata-GFWR5ZHC.js} +11 -10
  47. package/dist/{model-KEVCEXWD.js → model-NAKQWK4W.js} +4 -5
  48. package/dist/{personal-semantic-preference-ETY3KU2O.js → personal-semantic-preference-JCTKXLC3.js} +46 -15
  49. package/dist/{project-semantic-UHRMVOJF.js → project-semantic-B2NWQOKK.js} +19 -16
  50. package/dist/{sync-XKEBXESC.js → sync-UQH4J4BD.js} +9 -9
  51. package/dist/{te-agent-S6UQR4IE.js → te-agent-L6EYFQCC.js} +303 -17
  52. package/dist/{te-analysis-WOFFCIBC.js → te-analysis-U7NNOY66.js} +397 -203
  53. package/dist/{te-community-R7B6QYOO.js → te-community-3UQEW3KD.js} +14 -12
  54. package/dist/{te-dataops-KPILYVHA.js → te-dataops-SUNYXF5G.js} +13 -11
  55. package/dist/{te-engage-IAUM6ONX.js → te-engage-KMXZJ2KN.js} +10 -9
  56. package/dist/{te-experiment-TMLRA7B3.js → te-experiment-IEYKP6VC.js} +477 -45
  57. package/dist/{te-kb-GKWPSLSY.js → te-kb-MT3V5ZMH.js} +78 -18
  58. package/dist/{te-system-CYWSK3UN.js → te-system-F4ZU2HRQ.js} +6 -7
  59. package/dist/{te-team-ISN52YNG.js → te-team-M6E6XQ5H.js} +9 -8
  60. package/dist/{things-DDQ52Z3Q.js → things-FRLBZV2Z.js} +9 -8
  61. package/dist/{update-CTLNTX35.js → update-NULYHVE6.js} +8 -6
  62. package/dist/{workspace-2CKQX2XL.js → workspace-Z7L33OBQ.js} +6 -7
  63. package/package.json +13 -8
  64. package/skills/ae-agent/SKILL.md +19 -5
  65. package/skills/ae-agent/references/a2a.md +103 -0
  66. package/skills/ae-agent/references/command_index.md +11 -0
  67. package/skills/ae-ai-monitor/SKILL.md +179 -0
  68. package/skills/ae-ai-monitor/references/read-commands.md +866 -0
  69. package/skills/ae-analysis/SKILL.md +43 -25
  70. package/skills/ae-analysis/references/adhoc_export.md +3 -1
  71. package/skills/ae-analysis/references/ai_models/path.md +5 -6
  72. package/skills/ae-analysis/references/ai_models.md +1 -0
  73. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  74. package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
  75. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  76. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  77. package/skills/ae-analysis/references/asset_search.md +1 -1
  78. package/skills/ae-analysis/references/bad_case_begin.md +12 -0
  79. package/skills/ae-analysis/references/bad_case_get.md +12 -0
  80. package/skills/ae-analysis/references/bad_case_history.md +12 -0
  81. package/skills/ae-analysis/references/bad_case_list.md +12 -0
  82. package/skills/ae-analysis/references/bad_case_review.md +51 -0
  83. package/skills/ae-analysis/references/bad_case_run.md +12 -0
  84. package/skills/ae-analysis/references/bad_case_submit.md +12 -0
  85. package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
  86. package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
  87. package/skills/ae-analysis/references/bi_panel_list.md +1 -1
  88. package/skills/ae-analysis/references/bi_panel_share.md +3 -1
  89. package/skills/ae-analysis/references/catalog_list.md +2 -0
  90. package/skills/ae-analysis/references/command_index.md +44 -35
  91. package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
  92. package/skills/ae-analysis/references/dashboard_handover.md +3 -1
  93. package/skills/ae-analysis/references/dashboard_list.md +3 -3
  94. package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
  95. package/skills/ae-analysis/references/dashboard_share.md +3 -1
  96. package/skills/ae-analysis/references/dashboard_update.md +3 -2
  97. package/skills/ae-analysis/references/filter_value_list.md +2 -0
  98. package/skills/ae-analysis/references/folder_share.md +8 -2
  99. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  100. package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
  101. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  102. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  103. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  104. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  105. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  106. package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
  107. package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
  108. package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
  109. package/skills/ae-analysis/references/project_member_add.md +3 -1
  110. package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
  111. package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
  112. package/skills/ae-analysis/references/project_member_update.md +3 -1
  113. package/skills/ae-analysis/references/project_owner_update.md +8 -2
  114. package/skills/ae-analysis/references/project_role_upsert.md +5 -3
  115. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
  116. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
  117. package/skills/ae-analysis/references/project_space_share.md +8 -2
  118. package/skills/ae-analysis/references/property_get.md +2 -0
  119. package/skills/ae-analysis/references/public_link_list.md +3 -1
  120. package/skills/ae-analysis/references/query_cancel.md +4 -1
  121. package/skills/ae-analysis/references/report_data_run.md +1 -1
  122. package/skills/ae-analysis/references/report_list.md +3 -3
  123. package/skills/ae-analysis/references/scenario_append.md +2 -2
  124. package/skills/ae-analysis/references/scenario_collect.md +15 -4
  125. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  126. package/skills/ae-analysis/references/scenario_list.md +7 -7
  127. package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
  128. package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
  129. package/skills/ae-analysis/references/user_tag_create.md +4 -1
  130. package/skills/ae-analysis/references/user_tag_get.md +2 -0
  131. package/skills/ae-analysis/references/user_tag_models.md +8 -2
  132. package/skills/ae-analysis/references/user_tag_update.md +5 -2
  133. package/skills/ae-analysis/references/virtual_property_create.md +12 -1
  134. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
  135. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
  136. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
  137. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
  138. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
  139. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
  140. package/skills/ae-automation/SKILL.md +4 -2
  141. package/skills/ae-capability/SKILL.md +16 -8
  142. package/skills/ae-community/SKILL.md +1 -0
  143. package/skills/ae-dataops/SKILL.md +1 -0
  144. package/skills/ae-engage/SKILL.md +1 -0
  145. package/skills/ae-evaluation/SKILL.md +17 -2
  146. package/skills/ae-experiment/SKILL.md +69 -13
  147. package/skills/ae-experiment/references/experiment_approval.md +229 -0
  148. package/skills/ae-experiment/references/manage_experiment.md +15 -2
  149. package/skills/ae-experiment/references/manage_traffic_domains.md +131 -0
  150. package/skills/ae-experiment/references/query_experiment_detail.md +8 -0
  151. package/skills/ae-experiment/references/query_experiment_list.md +6 -0
  152. package/skills/ae-experiment/references/save_experiment.md +56 -10
  153. package/skills/ae-experiment/references/save_metric.md +29 -2
  154. package/skills/ae-experiment/references/save_submit_experiment.md +22 -3
  155. package/skills/ae-experiment/references/save_submit_external_experiment.md +59 -3
  156. package/skills/ae-experiment/references/save_traffic_layer.md +17 -1
  157. package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
  158. package/skills/ae-kb/SKILL.md +8 -4
  159. package/skills/ae-kb/references/analysis-workflow.md +11 -2
  160. package/skills/ae-kb/references/publication.md +45 -0
  161. package/skills/ae-kb/references/query-workflow.md +3 -1
  162. package/skills/ae-kb/references/versions.md +1 -1
  163. package/skills/ae-metadata/SKILL.md +1 -0
  164. package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
  165. package/skills/ae-team/SKILL.md +1 -1
  166. package/skills/ae-tracking-matrix/SKILL.md +170 -0
  167. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  168. package/skills/ae-tracking-matrix/i18n.yaml +12 -0
  169. package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
  170. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
  171. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
  172. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
  173. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
  174. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
  175. package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
  176. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
  177. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
  178. package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
  179. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
  180. package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
  181. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
  182. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
  183. package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
  184. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
  185. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
  186. package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
  187. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
  188. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
  189. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
  190. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
  191. package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
  192. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
  193. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
  194. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
  195. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
  196. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
  197. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
  198. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
  199. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
  200. package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
  201. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
  202. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
  203. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
  204. package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
  205. package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
  206. package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
  207. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
  208. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
  209. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
  210. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
  211. package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
  212. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
  213. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
  214. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
  215. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
  216. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
  217. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
  218. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
  219. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
  220. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
  221. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
  222. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
  223. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
  224. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
  225. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
  226. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
  227. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
  228. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
  229. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
  230. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
  231. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
  232. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
  233. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
  234. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
  235. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
  236. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
  237. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
  238. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
  239. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
  240. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
  241. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
  242. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
  243. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
  244. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
  245. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
  246. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
  247. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
  248. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
  249. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
  250. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
  251. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
  252. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
  253. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
  254. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
  255. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
  256. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
  257. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
  258. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
  259. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
  260. package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
  261. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
  262. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
  263. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
  264. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
  265. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
  266. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
  267. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
  268. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
  269. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
  270. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
  271. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
  272. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
  273. package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
  274. package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
  275. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
  276. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
  277. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
  278. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
  279. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
  280. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
  281. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
  282. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
  283. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
  284. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
  285. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
  286. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
  287. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
  288. package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
  289. package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
  290. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
  291. package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
  292. package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
  293. package/dist/chunk-AMBFK2K3.js +0 -28
  294. package/dist/chunk-Y74WTIKJ.js +0 -10
@@ -1,21 +1,23 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  CapabilityGatewayError
4
- } from "./chunk-HRUOV6EQ.js";
4
+ } from "./chunk-4IQYPWCX.js";
5
5
  import {
6
6
  SecureStoreAuthError,
7
- getCliToken
8
- } from "./chunk-SOSFRU3O.js";
7
+ getCliToken,
8
+ internalCallSourceHeaders
9
+ } from "./chunk-PLNS5J33.js";
9
10
  import {
10
11
  safeJsonParse
11
- } from "./chunk-4PSTYEG5.js";
12
+ } from "./chunk-AMURHMS3.js";
12
13
  import {
13
14
  PermissionError,
14
15
  externalCliTokenRequestOptions,
15
16
  isKbQueryPath,
16
17
  kbReadHeaders,
18
+ readExternalCliToken,
17
19
  readKbExecutionContext
18
- } from "./chunk-Z3Q2AEIN.js";
20
+ } from "./chunk-R2SVAO4G.js";
19
21
 
20
22
  // src/core/mcp-access.ts
21
23
  function buildUrl(host, path, params = {}) {
@@ -174,6 +176,7 @@ function parseKbResponse(resp, text, options = {}) {
174
176
  async function fetchWithCliToken(input, init, cliToken, options = {}) {
175
177
  const headers = new Headers(init.headers);
176
178
  headers.set("cli-token", cliToken);
179
+ for (const [name, value] of Object.entries(internalCallSourceHeaders())) headers.set(name, value);
177
180
  const resp = await fetch(input, { ...init, headers, ...externalCliTokenRequestOptions(input) });
178
181
  if (options.responseType === "empty" && resp.status === 204) return null;
179
182
  if (options.responseType === "bytes" && resp.ok) {
@@ -218,19 +221,20 @@ async function requestWithCliToken(host, input, init, options) {
218
221
  }
219
222
  async function getAuthHeaders(ctx) {
220
223
  const cliToken = await getCliToken(ctx.host());
221
- return { "cli-token": cliToken };
224
+ return { "cli-token": cliToken, ...internalCallSourceHeaders() };
222
225
  }
223
226
  async function kbApi(ctx, method, path, params = {}, body, options = {}) {
224
227
  const upperMethod = method.toUpperCase();
228
+ const isAsk = upperMethod === "POST" && /^\/(?:agent\/)?api\/external\/knowledge-bases\/ask$/.test(path);
225
229
  const isQuery = isKbQueryPath(upperMethod, path);
226
230
  const execution = isQuery ? readKbExecutionContext() : void 0;
227
231
  const host = execution ? ctx.hostOverride?.() || execution.origin : ctx.host();
228
232
  const selectedHost = execution && !ctx.hostOverride ? ctx.host() : host;
229
233
  const url = buildUrl(selectedHost, path, params);
230
- const queryHeaders = isQuery ? kbReadHeaders(url, ctx.str("read-context")) : void 0;
234
+ const queryHeaders = isQuery || isAsk && ctx.str("read-context") ? kbReadHeaders(url, ctx.str("read-context")) : void 0;
231
235
  const init = {
232
236
  method: upperMethod,
233
- headers: { "Content-Type": "application/json", ...queryHeaders },
237
+ headers: { "Content-Type": "application/json", ...queryHeaders, ...internalCallSourceHeaders() },
234
238
  body: upperMethod === "GET" ? void 0 : JSON.stringify(body ?? {})
235
239
  };
236
240
  if (execution) {
@@ -240,13 +244,23 @@ async function kbApi(ctx, method, path, params = {}, body, options = {}) {
240
244
  let code = "KB_READ_CONTEXT_REQUEST_FAILED";
241
245
  try {
242
246
  const value = responseErrorMetadata(safeJsonParse(text)).code;
243
- if (value?.startsWith("KB_READ_CONTEXT_")) code = value;
247
+ if (value && /^KB_(READ_CONTEXT|CANDIDATE)_/.test(value)) code = value;
244
248
  } catch {
245
249
  }
246
250
  throw new KbHttpError(code, code, response.status);
247
251
  }
248
252
  return parseKbResponse(response, text, { ...options, redactErrorDetails: true });
249
253
  }
254
+ if (upperMethod === "POST" && /^\/(?:agent\/)?api\/external\/knowledge-bases\/(read|grep|index)$/.test(path)) {
255
+ const task = readExternalCliToken(host)?.taskContext;
256
+ if (task) init.headers = {
257
+ ...init.headers,
258
+ "X-Task-CLI-Grant": task.grant,
259
+ "X-Task-CLI-Execution": task.executionId,
260
+ "X-Task-CLI-Company": task.companyId,
261
+ "X-Task-CLI-Sandbox": task.sandboxId
262
+ };
263
+ }
250
264
  return requestWithCliToken(
251
265
  host,
252
266
  url,
@@ -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
@@ -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-CG773QXN.js";
5
+ } from "./chunk-E3ONSFUN.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";
@@ -6,14 +6,19 @@ import {
6
6
  readSandboxCliTokenEntry,
7
7
  safeJsonParse,
8
8
  safeReadJsonFile
9
- } from "./chunk-4PSTYEG5.js";
9
+ } from "./chunk-AMURHMS3.js";
10
10
  import {
11
11
  PermissionError,
12
12
  externalCliTokenRequestOptions,
13
13
  logger,
14
14
  normalizeUrl,
15
15
  readExternalCliToken
16
- } from "./chunk-Z3Q2AEIN.js";
16
+ } from "./chunk-R2SVAO4G.js";
17
+
18
+ // src/core/internal-call-source.ts
19
+ function internalCallSourceHeaders() {
20
+ return {};
21
+ }
17
22
 
18
23
  // src/core/secure-store.ts
19
24
  import crypto from "crypto";
@@ -658,7 +663,7 @@ async function generateCliToken(hostUrl, accessToken) {
658
663
  const url = `${hostUrl.replace(/\/+$/, "")}${CLI_TOKEN_GENERATE_PATH}`;
659
664
  const resp = await fetch(url, {
660
665
  method: "GET",
661
- headers: { Authorization: `bearer ${accessToken}` }
666
+ headers: { Authorization: `bearer ${accessToken}`, ...internalCallSourceHeaders() }
662
667
  });
663
668
  if (!resp.ok) {
664
669
  if (resp.status === 403) {
@@ -699,7 +704,7 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
699
704
  try {
700
705
  resp = await fetch(url, {
701
706
  method: "GET",
702
- headers: { Accept: "application/json", "cli-token": cliToken },
707
+ headers: { Accept: "application/json", "cli-token": cliToken, ...internalCallSourceHeaders() },
703
708
  ...externalCliTokenRequestOptions(url)
704
709
  });
705
710
  } catch (error) {
@@ -738,13 +743,14 @@ async function validateCliTokenOnServer(hostUrl, cliToken) {
738
743
  ...cliTokenExpiresAt ? { cliTokenExpiresAt } : {}
739
744
  };
740
745
  }
741
- async function renewCliTokenOnServer(hostUrl, cliToken, external = false) {
746
+ async function renewCliTokenOnServer(hostUrl, cliToken, external = false, signal) {
742
747
  const url = new URL(`${hostUrl.replace(/\/+$/, "")}${CLI_TOKEN_RENEW_PATH}`);
743
748
  if (!external) url.searchParams.set("cli-token", cliToken);
744
749
  const resp = await fetch(url.toString(), {
745
750
  method: "GET",
746
- headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {} },
747
- ...externalCliTokenRequestOptions(url.toString())
751
+ headers: { Accept: "application/json", ...external ? { "cli-token": cliToken } : {}, ...internalCallSourceHeaders() },
752
+ ...externalCliTokenRequestOptions(url.toString()),
753
+ signal
748
754
  });
749
755
  const text = await resp.text();
750
756
  let data;
@@ -758,29 +764,51 @@ async function renewCliTokenOnServer(hostUrl, cliToken, external = false) {
758
764
  throw new Error(`CLI token renew error: ${data.return_message || "unknown"} (code: ${data.return_code})`);
759
765
  }
760
766
  }
761
- async function maybeRenewCliTokenDaily(hostUrl, cliToken, external = false) {
767
+ async function maybeRenewCliTokenDaily(hostUrl, cliToken, external = false, signal) {
768
+ signal?.throwIfAborted();
762
769
  const key = renewKey(hostUrl, cliToken);
763
770
  const today = localRenewDate();
764
771
  if (renewedLocalDate.get(key) === today || !external && persistedRenewDate(hostUrl, cliToken) === today) {
765
772
  renewedLocalDate.set(key, today);
766
773
  return;
767
774
  }
768
- const existing = renewInFlight.get(key);
769
- if (existing) return existing;
770
- const attempt = (async () => {
771
- try {
772
- await renewCliTokenOnServer(hostUrl, cliToken, external);
773
- if (external) renewedLocalDate.set(key, today);
774
- else markRenewSucceeded(hostUrl, cliToken, today);
775
- logger.info(`cli-token: renewed for ${normalizeUrl(hostUrl)} (local day ${today})`);
776
- } catch (error) {
777
- logger.warn(`cli-token: renew failed for ${normalizeUrl(hostUrl)}${external ? "" : `: ${error?.message || error}`}; business call proceeds`);
778
- } finally {
779
- renewInFlight.delete(key);
775
+ let attempt = renewInFlight.get(key);
776
+ if (!attempt || attempt.controller.signal.aborted) {
777
+ const current = { controller: new AbortController(), promise: Promise.resolve(), waiters: 0 };
778
+ current.promise = (async () => {
779
+ try {
780
+ await renewCliTokenOnServer(hostUrl, cliToken, external, current.controller.signal);
781
+ current.controller.signal.throwIfAborted();
782
+ if (external) renewedLocalDate.set(key, today);
783
+ else markRenewSucceeded(hostUrl, cliToken, today);
784
+ logger.info(`cli-token: renewed for ${normalizeUrl(hostUrl)} (local day ${today})`);
785
+ } catch (error) {
786
+ if (!current.controller.signal.aborted) {
787
+ logger.warn(`cli-token: renew failed for ${normalizeUrl(hostUrl)}${external ? "" : `: ${error?.message || error}`}; business call proceeds`);
788
+ }
789
+ } finally {
790
+ if (renewInFlight.get(key) === current) renewInFlight.delete(key);
791
+ }
792
+ })();
793
+ renewInFlight.set(key, current);
794
+ attempt = current;
795
+ }
796
+ attempt.waiters++;
797
+ let onAbort = () => void 0;
798
+ try {
799
+ const aborted = signal && new Promise((_resolve, reject) => {
800
+ onAbort = () => reject(signal.reason ?? new DOMException("The operation was aborted", "AbortError"));
801
+ if (signal.aborted) onAbort();
802
+ else signal.addEventListener("abort", onAbort, { once: true });
803
+ });
804
+ await (aborted ? Promise.race([attempt.promise, aborted]) : attempt.promise);
805
+ } finally {
806
+ signal?.removeEventListener("abort", onAbort);
807
+ if (--attempt.waiters === 0) {
808
+ if (renewInFlight.get(key) === attempt) renewInFlight.delete(key);
809
+ attempt.controller.abort();
780
810
  }
781
- })();
782
- renewInFlight.set(key, attempt);
783
- await attempt;
811
+ }
784
812
  }
785
813
  function peekCliToken(hostOverride) {
786
814
  const external = readExternalCliToken(hostOverride);
@@ -802,10 +830,12 @@ function peekCliToken(hostOverride) {
802
830
  }
803
831
  return cliTokenCache.get(normalizedHost) || getFallbackCliToken(normalizedHost) || void 0;
804
832
  }
805
- async function getCliToken(hostOverride) {
833
+ async function getCliToken(hostOverride, signal) {
834
+ signal?.throwIfAborted();
806
835
  const external = readExternalCliToken(hostOverride);
807
836
  if (external) {
808
- await maybeRenewCliTokenDaily(external.url, external.token, true);
837
+ await maybeRenewCliTokenDaily(external.url, external.token, true, signal);
838
+ signal?.throwIfAborted();
809
839
  return external.token;
810
840
  }
811
841
  if (process.env.TE_AGENT_CLI_CONFIG_DIR !== void 0) {
@@ -822,7 +852,8 @@ async function getCliToken(hostOverride) {
822
852
  throw new SecureStoreAuthError(`No stored CLI token for ${hostUrl}. Run: ae-cli auth login --host ${hostUrl}`);
823
853
  }
824
854
  cliTokenCache.set(hostUrl, token);
825
- await maybeRenewCliTokenDaily(hostUrl, token);
855
+ await maybeRenewCliTokenDaily(hostUrl, token, false, signal);
856
+ signal?.throwIfAborted();
826
857
  return token;
827
858
  }
828
859
  function sessionCliToken(hostOverride) {
@@ -839,6 +870,7 @@ async function mintCliToken(hostUrl, accessToken) {
839
870
  }
840
871
 
841
872
  export {
873
+ internalCallSourceHeaders,
842
874
  assertCredentialsReadable,
843
875
  getActiveCredential,
844
876
  listCredentials,
@@ -0,0 +1,29 @@
1
+ import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
+
3
+ // src/core/package-info.ts
4
+ import fs from "fs";
5
+ import path from "path";
6
+ import { fileURLToPath } from "url";
7
+ function getLocalCliPackageInfo() {
8
+ let dir = path.dirname(fileURLToPath(import.meta.url));
9
+ for (let i = 0; i < 8; i += 1) {
10
+ const candidate = path.join(dir, "package.json");
11
+ try {
12
+ if (fs.existsSync(candidate)) {
13
+ const pkg = JSON.parse(fs.readFileSync(candidate, "utf8"));
14
+ if (pkg.name && pkg.version && String(pkg.name).includes("ae-cli")) {
15
+ return { name: pkg.name, version: pkg.version, root: dir };
16
+ }
17
+ }
18
+ } catch {
19
+ }
20
+ const parent = path.dirname(dir);
21
+ if (parent === dir) break;
22
+ dir = parent;
23
+ }
24
+ return { name: "@tant/ae-cli", version: "0.0.0", root: "" };
25
+ }
26
+
27
+ export {
28
+ getLocalCliPackageInfo
29
+ };
@@ -232,15 +232,27 @@ function readExternalCliToken(hostOverride) {
232
232
  let data;
233
233
  try {
234
234
  const stat = fs2.statSync(file);
235
- if (!stat.isFile() || stat.size > 64 * 1024) throw new Error();
235
+ if (!stat.isFile() || stat.size > 96 * 1024) throw new Error();
236
236
  data = JSON.parse(fs2.readFileSync(file, "utf8"));
237
237
  } catch {
238
- throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than 64 KiB.");
238
+ throw new ExternalCliTokenError("The external CLI token file must be a readable JSON file no larger than 96 KiB.");
239
239
  }
240
240
  if (!data || typeof data !== "object" || Array.isArray(data)) {
241
241
  throw new ExternalCliTokenError("The external CLI token file must contain an object with url and token.");
242
242
  }
243
+ if (data.blocked !== void 0) {
244
+ const code = ["PI_CLI_NOT_READY", "PI_CLI_AUTH_REQUIRED", "PI_CLI_PERMISSION_DENIED", "PI_CLI_TIMEOUT"].includes(data.blocked) ? data.blocked : "PI_CLI_NOT_READY";
245
+ throw new ExternalCliTokenError("The runtime could not prepare CLI credentials for this execution.", code);
246
+ }
243
247
  entry = credential(data.url, data.token ?? data["cli-token"], "file-cli-token");
248
+ if (data.taskContext !== void 0) {
249
+ const context = data.taskContext;
250
+ if (!context || typeof context !== "object" || Array.isArray(context) || context.version !== 1 || typeof context.grant !== "string" || context.grant.length > 65536 || !/^[A-Za-z0-9_-]+\.[A-Za-z0-9_-]+$/.test(context.grant) || ["executionId", "sandboxId", "companyId"].some((key) => typeof context[key] !== "string" || !/^[^\s\x00-\x1f\x7f]{1,191}$/.test(context[key]))) {
251
+ throw new ExternalCliTokenError("The runtime CLI context is invalid.");
252
+ }
253
+ entry.taskContext = { version: 1, grant: context.grant, executionId: context.executionId, sandboxId: context.sandboxId, companyId: context.companyId };
254
+ diagnosticSecrets.add(context.grant);
255
+ }
244
256
  } else if (process.env.AE_CLI_TOKEN !== void 0) {
245
257
  entry = credential(process.env.AE_CLI_TOKEN_HOST, process.env.AE_CLI_TOKEN, "environment-cli-token");
246
258
  } else if (process.env.AE_CLI_TOKEN_HOST !== void 0) {
@@ -1,18 +1,18 @@
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";
4
+ } from "./chunk-AWW2T2WL.js";
5
5
  import {
6
6
  withOutputMetadata
7
- } from "./chunk-YULUBP3R.js";
7
+ } from "./chunk-O45NOIWR.js";
8
8
  import {
9
- dryRunCapability,
9
+ dryRunCapabilityWithEnvelope,
10
10
  executeCapabilityWithEnvelope,
11
- validateCapability
12
- } from "./chunk-HRUOV6EQ.js";
11
+ validateCapabilityWithEnvelope
12
+ } from "./chunk-4IQYPWCX.js";
13
13
  import {
14
14
  CliValidationError
15
- } from "./chunk-Z3Q2AEIN.js";
15
+ } from "./chunk-R2SVAO4G.js";
16
16
 
17
17
  // src/core/capability-command.ts
18
18
  import { randomBytes } from "crypto";
@@ -107,27 +107,32 @@ function createCapabilityCommand(config) {
107
107
  const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
108
108
  const requestHost = config.requestHost ?? ctx.host();
109
109
  const input = withLifecycleRequestId(config, config.buildInput(ctx));
110
+ const preparedInput = config.prepareInput ? await config.prepareInput(ctx, input) : input;
110
111
  const evidence = config.intentConsistency ? verifyDefinitionIntent(ctx, config.intentConsistency) : void 0;
111
112
  const intentMeta = evidence ? { intent_consistency: evidence } : void 0;
112
- return withOutputMetadata(await validateCapability(requestHost, gatewayDomain, config.capabilityId, input), intentMeta);
113
+ const result = await validateCapabilityWithEnvelope(requestHost, gatewayDomain, config.capabilityId, preparedInput);
114
+ return withOutputMetadata(result.data, { ...result.meta, ...intentMeta });
113
115
  },
114
116
  dryRun: async (ctx) => {
115
117
  const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
116
118
  const requestHost = config.requestHost ?? ctx.host();
117
119
  const input = withLifecycleRequestId(config, config.buildInput(ctx));
120
+ const preparedInput = config.prepareInput ? await config.prepareInput(ctx, input) : input;
118
121
  const evidence = config.intentConsistency ? verifyDefinitionIntent(ctx, config.intentConsistency) : void 0;
119
122
  const intentMeta = evidence ? { intent_consistency: evidence } : void 0;
120
- return withOutputMetadata(await dryRunCapability(requestHost, gatewayDomain, config.capabilityId, input), intentMeta);
123
+ const result = await dryRunCapabilityWithEnvelope(requestHost, gatewayDomain, config.capabilityId, preparedInput);
124
+ return withOutputMetadata(result.data, { ...result.meta, ...intentMeta });
121
125
  },
122
126
  execute: async (ctx) => {
123
127
  const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
124
128
  const requestHost = config.requestHost ?? ctx.host();
125
129
  const input = withLifecycleRequestId(config, config.buildInput(ctx));
130
+ const preparedInput = config.prepareInput ? await config.prepareInput(ctx, input) : input;
126
131
  const evidence = config.intentConsistency ? verifyDefinitionIntent(ctx, config.intentConsistency) : void 0;
127
132
  const intentMeta = evidence ? { intent_consistency: evidence } : void 0;
128
- announceDispatch(config.capabilityId, input);
129
- const result = await executeCapabilityWithEnvelope(requestHost, gatewayDomain, config.capabilityId, input);
130
- const data = config.postProcess ? await config.postProcess(result.data, input, ctx) : result.data;
133
+ announceDispatch(config.capabilityId, preparedInput);
134
+ const result = await executeCapabilityWithEnvelope(requestHost, gatewayDomain, config.capabilityId, preparedInput);
135
+ const data = config.postProcess ? await config.postProcess(result.data, preparedInput, ctx) : result.data;
131
136
  return withOutputMetadata(data, { ...result.meta, ...intentMeta });
132
137
  }
133
138
  };
@@ -3,7 +3,7 @@ import {
3
3
  getAgentApi,
4
4
  patchAgentApi,
5
5
  postAgentApi
6
- } from "./chunk-VDICGXCY.js";
6
+ } from "./chunk-HIMOBNEY.js";
7
7
 
8
8
  // src/commands/memory/cli-client.ts
9
9
  var DEFAULT_TE_CLAUDE_BASE_PATH = "/agent";