@thinkingai/ae-cli 6.0.30 → 6.0.31

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 (397) hide show
  1. package/README.md +5 -7
  2. package/README.zh.md +5 -7
  3. package/dist/{auth-7TQRGLBC.js → auth-7H3HAAJ3.js} +10 -10
  4. package/dist/{capability-KVA55RMK.js → capability-SEH3JWLN.js} +49 -10
  5. package/dist/{capability-LKHLZQPD.js → capability-SQ2IWKP3.js} +49 -10
  6. package/dist/{chunk-GWZ5MYWE.js → chunk-6LEYLOV3.js} +25 -4
  7. package/dist/{chunk-THBBNYXI.js → chunk-DYOS6YY7.js} +100 -62
  8. package/dist/{chunk-CWZUGF2J.js → chunk-HL2AJQ4Q.js} +15 -0
  9. package/dist/{chunk-OJR23CIK.js → chunk-I4A62X3N.js} +100 -61
  10. package/dist/chunk-N2QORU5D.js +68 -0
  11. package/dist/{chunk-7QQ4233A.js → chunk-PKRD2IEM.js} +25 -4
  12. package/dist/chunk-TKQJQXWT.js +68 -0
  13. package/dist/{chunk-ZAOL36CG.js → chunk-TNW2CI4W.js} +46 -30
  14. package/dist/{config-ZVPARN4R.js → config-7UZWDE74.js} +25 -25
  15. package/dist/index.js +143 -46
  16. package/dist/{metadata-6CCFV4K5.js → metadata-W6JFFMBA.js} +6 -43
  17. package/dist/{metadata-PDOIWH5O.js → metadata-X62TKIVK.js} +6 -43
  18. package/dist/{raw-OHSUK42D.js → raw-CN542NGT.js} +8 -6
  19. package/dist/{sync-ULT5SECP.js → sync-ERNHDPB5.js} +1 -1
  20. package/dist/{te-agent-FAIBM3SA.js → te-agent-FCCWUDTJ.js} +1 -1
  21. package/dist/te-analysis-NJGNWZFC.js +4530 -0
  22. package/dist/te-analysis-YGV5V5EX.js +4530 -0
  23. package/dist/{te-common-SDB3O2QG.js → te-common-5NJLF3XG.js} +1 -1
  24. package/dist/{te-common-CFGQXTFV.js → te-common-7VTJZPII.js} +1 -1
  25. package/dist/{te-community-6A7LKYUH.js → te-community-PEZ2VEF7.js} +1 -1
  26. package/dist/{te-community-GMWFGILT.js → te-community-TSKJ652U.js} +1 -1
  27. package/dist/{te-dataops-Z53CTG2U.js → te-dataops-F36T656A.js} +32 -12
  28. package/dist/{te-dataops-6LIPYNGH.js → te-dataops-ZNJBQ6VT.js} +33 -12
  29. package/dist/{te-engage-M7JQSJDP.js → te-engage-BUWVSSSK.js} +398 -11
  30. package/dist/{te-engage-545HJL6J.js → te-engage-EPE3QKDE.js} +398 -11
  31. package/dist/{te-meta-FADFLTDM.js → te-meta-MAAUHFQO.js} +9 -9
  32. package/dist/{te-meta-PKT27OTN.js → te-meta-VKWNAWO4.js} +9 -9
  33. package/dist/{te-team-RG75PR5D.js → te-team-OKCOX7OE.js} +5 -5
  34. package/package.json +15 -7
  35. package/skills/ae-agent/SKILL.md +6 -8
  36. package/skills/ae-agent/references/accept-skill-share.md +2 -2
  37. package/skills/ae-agent/references/add-attachment.md +3 -3
  38. package/skills/ae-agent/references/add-mcp.md +2 -3
  39. package/skills/ae-agent/references/add-model.md +3 -5
  40. package/skills/ae-agent/references/add-skill.md +2 -3
  41. package/skills/ae-agent/references/approve-skill.md +2 -2
  42. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +3 -3
  43. package/skills/ae-agent/references/cancel-skill-submission.md +2 -2
  44. package/skills/ae-agent/references/copy-skill.md +3 -3
  45. package/skills/ae-agent/references/create-agent.md +3 -4
  46. package/skills/ae-agent/references/create-automation.md +5 -9
  47. package/skills/ae-agent/references/del-agent.md +3 -2
  48. package/skills/ae-agent/references/del-attachment.md +3 -2
  49. package/skills/ae-agent/references/del-mcp.md +3 -2
  50. package/skills/ae-agent/references/del-model.md +3 -2
  51. package/skills/ae-agent/references/del-skill-asset.md +3 -3
  52. package/skills/ae-agent/references/del-skill-reference.md +3 -3
  53. package/skills/ae-agent/references/del-skill-script.md +3 -3
  54. package/skills/ae-agent/references/del-skill.md +3 -2
  55. package/skills/ae-agent/references/edit-skill.md +4 -4
  56. package/skills/ae-agent/references/mcp-auth-disconnect.md +2 -2
  57. package/skills/ae-agent/references/mcp-auth-start.md +3 -3
  58. package/skills/ae-agent/references/reject-skill-share.md +2 -2
  59. package/skills/ae-agent/references/reject-skill.md +2 -2
  60. package/skills/ae-agent/references/rescan-skills.md +2 -2
  61. package/skills/ae-agent/references/set-mcp-credential.md +3 -3
  62. package/skills/ae-agent/references/set-mcp-meta.md +2 -2
  63. package/skills/ae-agent/references/set-skill-meta.md +2 -2
  64. package/skills/ae-agent/references/share-skill.md +3 -3
  65. package/skills/ae-agent/references/submit-skill.md +3 -3
  66. package/skills/ae-agent/references/toggle-mcp.md +3 -3
  67. package/skills/ae-agent/references/toggle-model.md +3 -3
  68. package/skills/ae-agent/references/toggle-skill.md +3 -3
  69. package/skills/ae-agent/references/update-agent.md +2 -2
  70. package/skills/ae-agent/references/update-automation.md +6 -8
  71. package/skills/ae-agent/references/update-mcp.md +4 -4
  72. package/skills/ae-agent/references/update-model.md +2 -3
  73. package/skills/ae-agent/references/upload-skill-asset.md +3 -3
  74. package/skills/ae-agent/references/upload-skill-reference.md +3 -3
  75. package/skills/ae-agent/references/upload-skill-script.md +3 -3
  76. package/skills/ae-agent/references/upload-skill.md +6 -7
  77. package/skills/ae-analysis/SKILL.md +105 -512
  78. package/skills/ae-analysis/references/adhoc_export.md +71 -0
  79. package/skills/ae-analysis/references/adhoc_run.md +58 -0
  80. package/skills/ae-analysis/references/ai_models.md +459 -0
  81. package/skills/ae-analysis/references/analysis_data_retrieval.md +101 -0
  82. package/skills/ae-analysis/references/analysis_gateway_assets.md +72 -12
  83. package/skills/ae-analysis/references/analysis_interpretation.md +38 -0
  84. package/skills/ae-analysis/references/artifact_download.md +13 -7
  85. package/skills/ae-analysis/references/asset_abnormal_get.md +5 -5
  86. package/skills/ae-analysis/references/asset_abnormal_list.md +5 -5
  87. package/skills/ae-analysis/references/asset_authentication_list.md +5 -5
  88. package/skills/ae-analysis/references/asset_authentication_update.md +6 -6
  89. package/skills/ae-analysis/references/asset_batch_dashboard_schedule_freeze.md +26 -0
  90. package/skills/ae-analysis/references/asset_batch_delete.md +26 -0
  91. package/skills/ae-analysis/references/asset_batch_disable_auto_backup.md +26 -0
  92. package/skills/ae-analysis/references/asset_batch_disable_auto_update.md +26 -0
  93. package/skills/ae-analysis/references/asset_batch_handover.md +26 -0
  94. package/skills/ae-analysis/references/asset_batch_info_export.md +25 -0
  95. package/skills/ae-analysis/references/asset_batch_sql_export.md +25 -0
  96. package/skills/ae-analysis/references/asset_dependency_list.md +30 -0
  97. package/skills/ae-analysis/references/asset_export.md +30 -0
  98. package/skills/ae-analysis/references/asset_impact_list.md +30 -0
  99. package/skills/ae-analysis/references/asset_lineage_get.md +25 -0
  100. package/skills/ae-analysis/references/asset_list.md +30 -0
  101. package/skills/ae-analysis/references/asset_query_history_list.md +30 -0
  102. package/skills/ae-analysis/references/asset_recent_list.md +4 -4
  103. package/skills/ae-analysis/references/asset_search.md +4 -4
  104. package/skills/ae-analysis/references/asset_url_get.md +28 -0
  105. package/skills/ae-analysis/references/audience_models.md +42 -0
  106. package/skills/ae-analysis/references/batch_create_metadata.md +5 -1
  107. package/skills/ae-analysis/references/batch_edit_metadata.md +4 -1
  108. package/skills/ae-analysis/references/bi_panel_copy.md +1 -1
  109. package/skills/ae-analysis/references/bi_panel_create.md +1 -1
  110. package/skills/ae-analysis/references/bi_panel_delete.md +2 -0
  111. package/skills/ae-analysis/references/bi_panel_list.md +4 -2
  112. package/skills/ae-analysis/references/bi_panel_page_data_export.md +8 -4
  113. package/skills/ae-analysis/references/bi_panel_page_data_run.md +7 -3
  114. package/skills/ae-analysis/references/bi_panel_share.md +1 -1
  115. package/skills/ae-analysis/references/bi_panel_update.md +1 -1
  116. package/skills/ae-analysis/references/bi_panel_version_publish.md +1 -1
  117. package/skills/ae-analysis/references/cancel_query.md +4 -4
  118. package/skills/ae-analysis/references/command_index.md +209 -0
  119. package/skills/ae-analysis/references/create_alert.md +1 -1
  120. package/skills/ae-analysis/references/create_entity.md +1 -1
  121. package/skills/ae-analysis/references/create_metric.md +11 -15
  122. package/skills/ae-analysis/references/create_project_mark_time.md +2 -1
  123. package/skills/ae-analysis/references/create_virtual_event.md +10 -14
  124. package/skills/ae-analysis/references/create_virtual_property.md +1 -1
  125. package/skills/ae-analysis/references/dashboard_copy.md +1 -1
  126. package/skills/ae-analysis/references/dashboard_create.md +1 -1
  127. package/skills/ae-analysis/references/dashboard_daily_report_send.md +1 -1
  128. package/skills/ae-analysis/references/dashboard_daily_report_update.md +1 -1
  129. package/skills/ae-analysis/references/dashboard_definition_import.md +1 -1
  130. package/skills/ae-analysis/references/dashboard_delete.md +2 -0
  131. package/skills/ae-analysis/references/dashboard_freeze.md +1 -1
  132. package/skills/ae-analysis/references/dashboard_handover.md +1 -1
  133. package/skills/ae-analysis/references/dashboard_list.md +4 -2
  134. package/skills/ae-analysis/references/dashboard_report_add.md +15 -0
  135. package/skills/ae-analysis/references/dashboard_report_data_export.md +15 -7
  136. package/skills/ae-analysis/references/dashboard_report_data_run.md +15 -7
  137. package/skills/ae-analysis/references/dashboard_share.md +11 -2
  138. package/skills/ae-analysis/references/dashboard_update.md +12 -3
  139. package/skills/ae-analysis/references/datatable_columns_get.md +2 -2
  140. package/skills/ae-analysis/references/datatable_influence_list.md +2 -2
  141. package/skills/ae-analysis/references/datatable_version_get.md +2 -2
  142. package/skills/ae-analysis/references/datatable_version_list.md +2 -2
  143. package/skills/ae-analysis/references/delete_alert.md +8 -3
  144. package/skills/ae-analysis/references/delete_metric.md +8 -3
  145. package/skills/ae-analysis/references/delete_project_mark_times.md +5 -3
  146. package/skills/ae-analysis/references/delete_track_items.md +4 -3
  147. package/skills/ae-analysis/references/drilldown_user_events_export.md +20 -0
  148. package/skills/ae-analysis/references/drilldown_user_events_run.md +34 -0
  149. package/skills/ae-analysis/references/drilldown_users_export.md +17 -0
  150. package/skills/ae-analysis/references/drilldown_users_run.md +61 -0
  151. package/skills/ae-analysis/references/entity_detail_export.md +31 -0
  152. package/skills/ae-analysis/references/entity_detail_run.md +50 -0
  153. package/skills/ae-analysis/references/entity_id_import_options.md +20 -0
  154. package/skills/ae-analysis/references/event_changelog_list.md +2 -2
  155. package/skills/ae-analysis/references/event_create.md +4 -4
  156. package/skills/ae-analysis/references/event_delete.md +5 -4
  157. package/skills/ae-analysis/references/event_detail_export.md +31 -0
  158. package/skills/ae-analysis/references/event_detail_run.md +58 -0
  159. package/skills/ae-analysis/references/event_get.md +2 -2
  160. package/skills/ae-analysis/references/event_hide_update.md +3 -3
  161. package/skills/ae-analysis/references/event_influence_list.md +2 -2
  162. package/skills/ae-analysis/references/event_list.md +2 -2
  163. package/skills/ae-analysis/references/{super_metadata_export.md → event_property_bundle_export.md} +7 -7
  164. package/skills/ae-analysis/references/event_property_bundle_import.md +25 -0
  165. package/skills/ae-analysis/references/event_relation_update.md +4 -4
  166. package/skills/ae-analysis/references/event_update.md +2 -2
  167. package/skills/ae-analysis/references/exchange_config_update.md +2 -2
  168. package/skills/ae-analysis/references/exchange_rate_refresh.md +2 -2
  169. package/skills/ae-analysis/references/exchange_rule_list.md +2 -2
  170. package/skills/ae-analysis/references/exchange_rule_update.md +4 -4
  171. package/skills/ae-analysis/references/exchange_rule_validate.md +4 -4
  172. package/skills/ae-analysis/references/favorite_add.md +1 -1
  173. package/skills/ae-analysis/references/favorite_remove.md +1 -1
  174. package/skills/ae-analysis/references/folder_create.md +2 -3
  175. package/skills/ae-analysis/references/folder_share.md +2 -3
  176. package/skills/ae-analysis/references/generate_track_program.md +2 -1
  177. package/skills/ae-analysis/references/generate_track_sdk_sample.md +2 -1
  178. package/skills/ae-analysis/references/get_alert.md +4 -0
  179. package/skills/ae-analysis/references/get_alert_definition_schema.md +1 -0
  180. package/skills/ae-analysis/references/get_metric.md +4 -4
  181. package/skills/ae-analysis/references/get_project_config.md +1 -0
  182. package/skills/ae-analysis/references/get_resource_url.md +1 -0
  183. package/skills/ae-analysis/references/get_track_program.md +3 -0
  184. package/skills/ae-analysis/references/history_tag_batch_refresh.md +19 -0
  185. package/skills/ae-analysis/references/history_tag_clear.md +13 -0
  186. package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +15 -0
  187. package/skills/ae-analysis/references/history_tag_data_drilldown_run.md +13 -0
  188. package/skills/ae-analysis/references/history_tag_data_export.md +15 -0
  189. package/skills/ae-analysis/references/history_tag_data_run.md +15 -0
  190. package/skills/ae-analysis/references/history_tag_list.md +11 -0
  191. package/skills/ae-analysis/references/history_tag_refresh.md +11 -0
  192. package/skills/ae-analysis/references/input_file_inspect.md +9 -0
  193. package/skills/ae-analysis/references/input_file_purpose_list.md +9 -0
  194. package/skills/ae-analysis/references/input_file_upload.md +11 -0
  195. package/skills/ae-analysis/references/list_alerts.md +3 -2
  196. package/skills/ae-analysis/references/list_entities.md +3 -2
  197. package/skills/ae-analysis/references/list_events.md +5 -5
  198. package/skills/ae-analysis/references/list_metrics.md +5 -5
  199. package/skills/ae-analysis/references/list_project_mark_times.md +2 -1
  200. package/skills/ae-analysis/references/list_project_users.md +1 -0
  201. package/skills/ae-analysis/references/list_properties.md +5 -5
  202. package/skills/ae-analysis/references/load_filters.md +3 -0
  203. package/skills/ae-analysis/references/metric_create.md +11 -6
  204. package/skills/ae-analysis/references/metric_delete.md +5 -4
  205. package/skills/ae-analysis/references/metric_get.md +2 -2
  206. package/skills/ae-analysis/references/metric_list.md +2 -2
  207. package/skills/ae-analysis/references/metric_update.md +12 -6
  208. package/skills/ae-analysis/references/operation_record_export.md +25 -0
  209. package/skills/ae-analysis/references/operation_record_list.md +31 -0
  210. package/skills/ae-analysis/references/project_space_create.md +2 -3
  211. package/skills/ae-analysis/references/project_space_list.md +3 -1
  212. package/skills/ae-analysis/references/project_space_share.md +2 -3
  213. package/skills/ae-analysis/references/property_changelog_list.md +2 -2
  214. package/skills/ae-analysis/references/property_create.md +4 -4
  215. package/skills/ae-analysis/references/property_delete.md +5 -4
  216. package/skills/ae-analysis/references/property_get.md +2 -2
  217. package/skills/ae-analysis/references/property_hide_update.md +3 -3
  218. package/skills/ae-analysis/references/property_influence_list.md +2 -2
  219. package/skills/ae-analysis/references/property_list.md +2 -2
  220. package/skills/ae-analysis/references/property_related_events.md +2 -2
  221. package/skills/ae-analysis/references/property_relation_update.md +4 -4
  222. package/skills/ae-analysis/references/property_update.md +2 -2
  223. package/skills/ae-analysis/references/public_link_create.md +1 -1
  224. package/skills/ae-analysis/references/public_link_delete.md +2 -0
  225. package/skills/ae-analysis/references/public_link_list.md +3 -1
  226. package/skills/ae-analysis/references/public_link_offline.md +1 -1
  227. package/skills/ae-analysis/references/public_link_update.md +1 -1
  228. package/skills/ae-analysis/references/query_cancel.md +1 -1
  229. package/skills/ae-analysis/references/query_create_result_cluster.md +47 -0
  230. package/skills/ae-analysis/references/report_abnormal_get.md +15 -0
  231. package/skills/ae-analysis/references/report_change_log_get.md +15 -0
  232. package/skills/ae-analysis/references/report_change_log_list.md +15 -0
  233. package/skills/ae-analysis/references/report_create.md +29 -0
  234. package/skills/ae-analysis/references/report_data_export.md +37 -0
  235. package/skills/ae-analysis/references/report_data_run.md +45 -0
  236. package/skills/ae-analysis/references/report_delete.md +17 -0
  237. package/skills/ae-analysis/references/report_get.md +21 -0
  238. package/skills/ae-analysis/references/report_list.md +17 -0
  239. package/skills/ae-analysis/references/report_list_export.md +15 -0
  240. package/skills/ae-analysis/references/report_update.md +22 -0
  241. package/skills/ae-analysis/references/report_version_rollback.md +15 -0
  242. package/skills/ae-analysis/references/rule_create.md +27 -0
  243. package/skills/ae-analysis/references/rule_delete.md +26 -0
  244. package/skills/ae-analysis/references/rule_list.md +24 -0
  245. package/skills/ae-analysis/references/rule_schema.md +24 -0
  246. package/skills/ae-analysis/references/rule_update.md +28 -0
  247. package/skills/ae-analysis/references/run_inspect.md +10 -4
  248. package/skills/ae-analysis/references/save_track_items.md +4 -1
  249. package/skills/ae-analysis/references/sql_table_columns.md +20 -0
  250. package/skills/ae-analysis/references/sql_table_list.md +33 -0
  251. package/skills/ae-analysis/references/update_alert.md +1 -1
  252. package/skills/ae-analysis/references/update_metric.md +11 -14
  253. package/skills/ae-analysis/references/update_project_mark_time.md +4 -3
  254. package/skills/ae-analysis/references/user_cluster_create.md +15 -0
  255. package/skills/ae-analysis/references/user_cluster_create_id.md +15 -0
  256. package/skills/ae-analysis/references/user_cluster_delete.md +13 -0
  257. package/skills/ae-analysis/references/user_cluster_get.md +11 -0
  258. package/skills/ae-analysis/references/user_cluster_list.md +15 -0
  259. package/skills/ae-analysis/references/user_cluster_member_export.md +15 -0
  260. package/skills/ae-analysis/references/user_cluster_member_list.md +19 -0
  261. package/skills/ae-analysis/references/user_cluster_models.md +87 -0
  262. package/skills/ae-analysis/references/user_cluster_refresh.md +11 -0
  263. package/skills/ae-analysis/references/user_cluster_update.md +13 -0
  264. package/skills/ae-analysis/references/user_cluster_update_id.md +15 -0
  265. package/skills/ae-analysis/references/user_tag_create.md +15 -0
  266. package/skills/ae-analysis/references/user_tag_create_id.md +15 -0
  267. package/skills/ae-analysis/references/user_tag_delete.md +13 -0
  268. package/skills/ae-analysis/references/user_tag_get.md +11 -0
  269. package/skills/ae-analysis/references/user_tag_list.md +17 -0
  270. package/skills/ae-analysis/references/user_tag_member_export.md +15 -0
  271. package/skills/ae-analysis/references/user_tag_member_list.md +19 -0
  272. package/skills/ae-analysis/references/user_tag_models.md +54 -0
  273. package/skills/ae-analysis/references/user_tag_refresh.md +11 -0
  274. package/skills/ae-analysis/references/user_tag_update.md +13 -0
  275. package/skills/ae-analysis/references/user_tag_update_id.md +15 -0
  276. package/skills/ae-analysis/references/virtual_event_create.md +4 -4
  277. package/skills/ae-analysis/references/virtual_event_delete.md +5 -4
  278. package/skills/ae-analysis/references/virtual_event_get.md +2 -2
  279. package/skills/ae-analysis/references/virtual_property_create.md +13 -6
  280. package/skills/ae-analysis/references/virtual_property_sql_rule_delete.md +5 -4
  281. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +13 -6
  282. package/skills/ae-analysis-global/SKILL.md +6 -8
  283. package/skills/ae-analysis-global/references/list_query_clusters.md +7 -6
  284. package/skills/ae-capability/SKILL.md +68 -15
  285. package/skills/ae-community/SKILL.md +2 -2
  286. package/skills/ae-dataops/SKILL.md +1 -1
  287. package/skills/ae-engage/SKILL.md +38 -10
  288. package/skills/ae-engage/references/build-task-save-guide.md +11 -9
  289. package/skills/ae-engage/references/channel_touch_limits_list.md +29 -0
  290. package/skills/ae-engage/references/group-list.md +13 -0
  291. package/skills/ae-engage/references/operation-log-query.md +11 -0
  292. package/skills/ae-engage/references/ops-delete.md +14 -0
  293. package/skills/ae-engage/references/push-record-query.md +26 -0
  294. package/skills/ae-engage/references/save-flow.md +5 -4
  295. package/skills/ae-engage/references/save-task.md +24 -20
  296. package/skills/ae-engage/references/segment-list-query.md +18 -0
  297. package/skills/ae-engage/references/task-operation-log-query.md +23 -0
  298. package/skills/ae-engage/references/version-list.md +18 -0
  299. package/skills/ae-generate-tracking-code/SKILL.md +1 -1
  300. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +2 -2
  301. package/skills/ae-generate-tracking-plan/SKILL.md +17 -12
  302. package/skills/ae-generate-tracking-plan/references/te-api.md +2 -1
  303. package/skills/ae-kb/SKILL.md +1 -1
  304. package/skills/ae-metadata/SKILL.md +9 -8
  305. package/skills/ae-metadata/references/metadata_data_table_csv_delete.md +1 -0
  306. package/skills/ae-metadata/references/metadata_data_table_csv_write.md +6 -6
  307. package/skills/ae-metadata/references/metadata_data_table_property_bindings_update.md +2 -2
  308. package/skills/ae-metadata/references/metadata_data_table_sql_delete.md +1 -0
  309. package/skills/ae-metadata/references/metadata_data_table_sql_write.md +21 -7
  310. package/skills/ae-metadata/references/metadata_property_dimension_table_bind_existing.md +3 -3
  311. package/skills/ae-metadata/references/metadata_property_dimension_table_create_and_bind_csv.md +4 -4
  312. package/skills/ae-team/SKILL.md +9 -9
  313. package/skills/ae-team/references/create.md +2 -2
  314. package/skills/ae-team/references/delete.md +3 -3
  315. package/skills/ae-team/references/run-cancel.md +3 -3
  316. package/skills/ae-team/references/run-chat.md +4 -4
  317. package/skills/ae-team/references/run-reply.md +3 -3
  318. package/skills/ae-team/references/run-start.md +4 -5
  319. package/skills/ae-team/references/run-watch.md +1 -1
  320. package/skills/ae-team/references/update.md +2 -2
  321. package/dist/chunk-P2JRP6HJ.js +0 -42
  322. package/dist/chunk-S5XN6KEX.js +0 -42
  323. package/dist/te-analysis-DDXGM7WM.js +0 -3188
  324. package/dist/te-analysis-HCDNYI7E.js +0 -3188
  325. package/dist/te-audience-ECFS4GF4.js +0 -600
  326. package/dist/te-audience-WO377T2J.js +0 -600
  327. package/skills/ae-analysis/references/build_attribution_analysis_qp.md +0 -62
  328. package/skills/ae-analysis/references/build_cluster_definition.md +0 -62
  329. package/skills/ae-analysis/references/build_distribution_analysis_qp.md +0 -67
  330. package/skills/ae-analysis/references/build_entity_details_sql.md +0 -58
  331. package/skills/ae-analysis/references/build_event_analysis_qp.md +0 -134
  332. package/skills/ae-analysis/references/build_event_details_sql.md +0 -61
  333. package/skills/ae-analysis/references/build_funnel_analysis_qp.md +0 -145
  334. package/skills/ae-analysis/references/build_heat_map_analysis_qp.md +0 -54
  335. package/skills/ae-analysis/references/build_interval_analysis_qp.md +0 -60
  336. package/skills/ae-analysis/references/build_path_analysis_qp.md +0 -53
  337. package/skills/ae-analysis/references/build_prop_analysis_qp.md +0 -124
  338. package/skills/ae-analysis/references/build_rank_list_analysis_qp.md +0 -63
  339. package/skills/ae-analysis/references/build_retention_analysis_qp.md +0 -143
  340. package/skills/ae-analysis/references/build_tag_definition.md +0 -65
  341. package/skills/ae-analysis/references/copy_dashboard.md +0 -33
  342. package/skills/ae-analysis/references/create_cluster.md +0 -69
  343. package/skills/ae-analysis/references/create_dashboard.md +0 -49
  344. package/skills/ae-analysis/references/create_id_cluster.md +0 -40
  345. package/skills/ae-analysis/references/create_id_tag.md +0 -39
  346. package/skills/ae-analysis/references/create_or_update_dashboard_note.md +0 -39
  347. package/skills/ae-analysis/references/create_public_access_link.md +0 -43
  348. package/skills/ae-analysis/references/create_report.md +0 -60
  349. package/skills/ae-analysis/references/create_result_cluster.md +0 -73
  350. package/skills/ae-analysis/references/create_space.md +0 -34
  351. package/skills/ae-analysis/references/create_tag.md +0 -61
  352. package/skills/ae-analysis/references/delete_cluster.md +0 -27
  353. package/skills/ae-analysis/references/delete_dashboard.md +0 -30
  354. package/skills/ae-analysis/references/delete_report.md +0 -27
  355. package/skills/ae-analysis/references/delete_tag.md +0 -27
  356. package/skills/ae-analysis/references/drilldown_user_events.md +0 -74
  357. package/skills/ae-analysis/references/drilldown_users.md +0 -80
  358. package/skills/ae-analysis/references/freeze_dashboards.md +0 -29
  359. package/skills/ae-analysis/references/get_analysis_query_schema.md +0 -71
  360. package/skills/ae-analysis/references/get_bi_panel_detail.md +0 -35
  361. package/skills/ae-analysis/references/get_cluster_definition_schema.md +0 -53
  362. package/skills/ae-analysis/references/get_clusters_by_name.md +0 -69
  363. package/skills/ae-analysis/references/get_filter_schema.md +0 -33
  364. package/skills/ae-analysis/references/get_groupby_schema.md +0 -33
  365. package/skills/ae-analysis/references/get_report_definition.md +0 -37
  366. package/skills/ae-analysis/references/get_table_columns.md +0 -37
  367. package/skills/ae-analysis/references/get_tag_definition_schema.md +0 -49
  368. package/skills/ae-analysis/references/get_tags_by_name.md +0 -69
  369. package/skills/ae-analysis/references/list_bi_panels.md +0 -35
  370. package/skills/ae-analysis/references/list_cluster_members.md +0 -45
  371. package/skills/ae-analysis/references/list_clusters.md +0 -46
  372. package/skills/ae-analysis/references/list_dashboards.md +0 -43
  373. package/skills/ae-analysis/references/list_public_access_links.md +0 -41
  374. package/skills/ae-analysis/references/list_reports.md +0 -43
  375. package/skills/ae-analysis/references/list_spaces.md +0 -27
  376. package/skills/ae-analysis/references/list_tag_members.md +0 -46
  377. package/skills/ae-analysis/references/list_tags.md +0 -44
  378. package/skills/ae-analysis/references/move_dashboard.md +0 -33
  379. package/skills/ae-analysis/references/query_adhoc.md +0 -141
  380. package/skills/ae-analysis/references/query_bi_panel_data.md +0 -58
  381. package/skills/ae-analysis/references/query_dashboard_detail.md +0 -35
  382. package/skills/ae-analysis/references/query_dashboard_report_data.md +0 -63
  383. package/skills/ae-analysis/references/query_entity_details.md +0 -63
  384. package/skills/ae-analysis/references/query_event_details.md +0 -66
  385. package/skills/ae-analysis/references/query_report_data.md +0 -99
  386. package/skills/ae-analysis/references/refresh_cluster.md +0 -31
  387. package/skills/ae-analysis/references/refresh_tag.md +0 -31
  388. package/skills/ae-analysis/references/super_metadata_import.md +0 -24
  389. package/skills/ae-analysis/references/update_cluster.md +0 -61
  390. package/skills/ae-analysis/references/update_dashboard.md +0 -45
  391. package/skills/ae-analysis/references/update_id_cluster.md +0 -36
  392. package/skills/ae-analysis/references/update_id_tag.md +0 -37
  393. package/skills/ae-analysis/references/update_public_access_link.md +0 -41
  394. package/skills/ae-analysis/references/update_report.md +0 -35
  395. package/skills/ae-analysis/references/update_tag.md +0 -61
  396. package/skills/ae-analysis-intent/SKILL.md +0 -132
  397. package/skills/ae-metadata/references/metadata_input_file_upload.md +0 -29
@@ -14,16 +14,18 @@ import {
14
14
  import { readFile } from "fs/promises";
15
15
  import { basename } from "path";
16
16
  var CapabilityGatewayError = class extends Error {
17
- constructor(message, code, httpStatus, hint) {
17
+ constructor(message, code, httpStatus, hint, meta) {
18
18
  super(message);
19
19
  this.code = code;
20
20
  this.httpStatus = httpStatus;
21
21
  this.hint = hint;
22
+ this.meta = meta;
22
23
  this.name = "CapabilityGatewayError";
23
24
  }
24
25
  code;
25
26
  httpStatus;
26
27
  hint;
28
+ meta;
27
29
  };
28
30
  function buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams = {}) {
29
31
  const base = host.replace(/\/+$/, "");
@@ -59,25 +61,41 @@ function parseCapabilityResponse(text) {
59
61
  return text;
60
62
  }
61
63
  }
62
- function unwrapCapabilityEnvelope(body) {
64
+ function parseCapabilityEnvelope(body) {
63
65
  if (body == null) {
64
66
  throw new CapabilityGatewayError("Empty capability gateway response");
65
67
  }
66
68
  if (typeof body.ok === "boolean") {
67
69
  if (body.ok) {
68
- return body.data;
70
+ return {
71
+ ok: true,
72
+ data: body.data,
73
+ ...isRecord(body.meta) ? { meta: body.meta } : {}
74
+ };
69
75
  }
70
76
  const err = body.error ?? {};
71
77
  const code = nonEmptyString(err.code);
72
78
  const message = nonEmptyString(err.message) ?? code ?? "Capability gateway request failed";
73
79
  const hint = nonEmptyString(err.hint);
74
- throw new CapabilityGatewayError(message, code, err.http_status ?? err.httpStatus, hint);
80
+ throw new CapabilityGatewayError(
81
+ message,
82
+ code,
83
+ err.http_status ?? err.httpStatus,
84
+ hint,
85
+ isRecord(body.meta) ? body.meta : void 0
86
+ );
75
87
  }
76
- return body;
88
+ return { ok: true, data: body };
89
+ }
90
+ function unwrapCapabilityEnvelope(body) {
91
+ return parseCapabilityEnvelope(body).data;
77
92
  }
78
93
  function nonEmptyString(value) {
79
94
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
80
95
  }
96
+ function isRecord(value) {
97
+ return value !== null && typeof value === "object" && !Array.isArray(value);
98
+ }
81
99
  function buildCapabilityHttpError(resp, body) {
82
100
  const fallback = `Capability gateway HTTP error: ${resp.status} ${resp.statusText}`.trim();
83
101
  if (body && typeof body === "object") {
@@ -87,7 +105,13 @@ function buildCapabilityHttpError(resp, body) {
87
105
  const hint = nonEmptyString(err.hint) ?? nonEmptyString(body.hint);
88
106
  const details = [code, message, hint ? `Hint: ${hint}` : void 0].filter(Boolean);
89
107
  if (details.length > 0) {
90
- return new CapabilityGatewayError(message ?? fallback, code, resp.status, hint);
108
+ return new CapabilityGatewayError(
109
+ message ?? fallback,
110
+ code,
111
+ resp.status,
112
+ hint,
113
+ isRecord(body.meta) ? body.meta : void 0
114
+ );
91
115
  }
92
116
  }
93
117
  if (typeof body === "string" && body.trim()) {
@@ -99,10 +123,10 @@ async function throwCapabilityHttpError(resp) {
99
123
  const body = parseCapabilityResponse(await resp.text());
100
124
  throw buildCapabilityHttpError(resp, body);
101
125
  }
102
- async function requestOnce(url, method, token, body) {
126
+ async function requestOnce(url, method, token, body, accept = "application/json") {
103
127
  const headers = {
104
128
  "cli-token": token,
105
- "Accept": "application/json",
129
+ "Accept": accept,
106
130
  "X-Source": "ae-cli"
107
131
  };
108
132
  const init = { method, headers };
@@ -123,17 +147,10 @@ async function requestMultipartOnce(url, token, form) {
123
147
  body: form
124
148
  });
125
149
  }
126
- async function requestDownloadOnce(url, token) {
127
- return fetch(url, {
128
- method: "GET",
129
- headers: {
130
- "cli-token": token,
131
- "Accept": "*/*",
132
- "X-Source": "ae-cli"
133
- }
134
- });
135
- }
136
150
  async function callGateway(host, domain, pathAfterV1, method, body) {
151
+ return (await callGatewayWithEnvelope(host, domain, pathAfterV1, method, body)).data;
152
+ }
153
+ async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body) {
137
154
  const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
138
155
  const token = await getCliToken(host);
139
156
  let resp = await requestOnce(url, method, token, body);
@@ -160,8 +177,41 @@ async function callGateway(host, domain, pathAfterV1, method, body) {
160
177
  } else if (!resp.ok) {
161
178
  await throwCapabilityHttpError(resp);
162
179
  }
180
+ return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
181
+ }
182
+ async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json") {
183
+ const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
184
+ const token = await getCliToken(host);
185
+ let resp = await requestOnce(url, method, token, body, accept);
186
+ if (resp.status === 403) {
187
+ throw new PermissionError(await permissionMessage(resp));
188
+ }
189
+ if (resp.status === 401) {
190
+ logger.warn(`Capability gateway request failed (HTTP 401) for ${host}, refreshing CLI token`);
191
+ clearCliToken(host);
192
+ const newToken = await getCliToken(host);
193
+ process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
194
+ `);
195
+ resp = await requestOnce(url, method, newToken, body, accept);
196
+ if (resp.status === 403) {
197
+ throw new PermissionError(await permissionMessage(resp));
198
+ }
199
+ if (!resp.ok) {
200
+ await throwCapabilityHttpError(resp);
201
+ }
202
+ } else if (!resp.ok) {
203
+ await throwCapabilityHttpError(resp);
204
+ }
205
+ return resp;
206
+ }
207
+ async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body) {
208
+ const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
163
209
  return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
164
210
  }
211
+ async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body) {
212
+ const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
213
+ return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
214
+ }
165
215
  async function listCapabilities(host, domain) {
166
216
  return callGateway(host, domain, "capabilities", "GET");
167
217
  }
@@ -171,12 +221,37 @@ async function inspectCapability(host, domain, capabilityId) {
171
221
  async function executeCapability(host, domain, capabilityId, input = {}) {
172
222
  return callGateway(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
173
223
  }
224
+ async function executeCapabilityWithEnvelope(host, domain, capabilityId, input = {}) {
225
+ return callGatewayWithEnvelope(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
226
+ }
174
227
  async function dryRunCapability(host, domain, capabilityId, input = {}) {
175
228
  return callGateway(host, domain, `capabilities/${capabilityId}/dry-run`, "POST", { input });
176
229
  }
230
+ async function validateCapability(host, domain, capabilityId, input = {}) {
231
+ return callGateway(host, domain, `capabilities/${capabilityId}/validate`, "POST", { input });
232
+ }
177
233
  async function uploadInputFile(host, domain, projectId, purpose, filePath) {
178
234
  const fileBytes = await readFile(filePath);
179
- return uploadInputFileBytes(host, domain, projectId, purpose, fileBytes, basename(filePath));
235
+ const filename = basename(filePath);
236
+ return uploadInputFileBytes(
237
+ host,
238
+ domain,
239
+ projectId,
240
+ purpose,
241
+ fileBytes,
242
+ filename,
243
+ inputFileContentType(filename)
244
+ );
245
+ }
246
+ function inputFileContentType(filename) {
247
+ const lower = filename.toLowerCase();
248
+ if (lower.endsWith(".csv")) return "text/csv";
249
+ if (lower.endsWith(".xlsx")) {
250
+ return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
251
+ }
252
+ if (lower.endsWith(".json")) return "application/json";
253
+ if (lower.endsWith(".txt")) return "text/plain";
254
+ return "application/octet-stream";
180
255
  }
181
256
  async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, filename, contentType = "application/octet-stream") {
182
257
  const url = buildCapabilityGatewayUrl(host, domain, "input-files");
@@ -211,56 +286,19 @@ async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, fil
211
286
  }
212
287
  return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
213
288
  }
214
- async function downloadCapabilityArtifact(host, domain, runId, artifactId) {
215
- const url = buildCapabilityGatewayUrl(
216
- host,
217
- domain,
218
- `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`
219
- );
220
- const token = await getCliToken(host);
221
- let resp = await requestDownloadOnce(url, token);
222
- if (resp.status === 403) {
223
- throw new PermissionError(await permissionMessage(resp));
224
- }
225
- if (resp.status === 401) {
226
- logger.warn(`Capability gateway artifact download failed (HTTP 401) for ${host}, refreshing CLI token`);
227
- clearCliToken(host);
228
- const newToken = await getCliToken(host);
229
- process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
230
- `);
231
- resp = await requestDownloadOnce(url, newToken);
232
- if (resp.status === 403) {
233
- throw new PermissionError(await permissionMessage(resp));
234
- }
235
- if (!resp.ok) {
236
- await throwCapabilityHttpError(resp);
237
- }
238
- } else if (!resp.ok) {
239
- await throwCapabilityHttpError(resp);
240
- }
241
- return {
242
- bytes: Buffer.from(await resp.arrayBuffer()),
243
- contentType: resp.headers.get("content-type") ?? void 0,
244
- contentDisposition: resp.headers.get("content-disposition") ?? void 0
245
- };
246
- }
247
- async function callCapabilityApi(host, domain, action, method = "POST", params = {}) {
248
- const isGet = method === "GET";
249
- if (isGet) {
250
- return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), "GET");
251
- }
252
- return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), method, params);
253
- }
254
289
 
255
290
  export {
256
291
  CapabilityGatewayError,
257
292
  buildCapabilityGatewayUrl,
293
+ fetchCapabilityGateway,
294
+ requestCapabilityGateway,
295
+ requestCapabilityGatewayWithEnvelope,
258
296
  listCapabilities,
259
297
  inspectCapability,
260
298
  executeCapability,
299
+ executeCapabilityWithEnvelope,
261
300
  dryRunCapability,
301
+ validateCapability,
262
302
  uploadInputFile,
263
- uploadInputFileBytes,
264
- downloadCapabilityArtifact,
265
- callCapabilityApi
303
+ uploadInputFileBytes
266
304
  };
@@ -1,5 +1,16 @@
1
1
  // src/core/capability-routing.ts
2
2
  var cliServiceRoutes = /* @__PURE__ */ new Map();
3
+ function envGatewayDomain(cliService) {
4
+ const normalized = cliService.replace(/[^a-zA-Z0-9]/g, "_").toUpperCase();
5
+ const serviceKey = `AE_CLI_CAPABILITY_GATEWAY_DOMAIN_${normalized}`;
6
+ if (Object.prototype.hasOwnProperty.call(process.env, serviceKey)) {
7
+ return process.env[serviceKey] ?? "";
8
+ }
9
+ if (Object.prototype.hasOwnProperty.call(process.env, "AE_CLI_CAPABILITY_GATEWAY_DOMAIN")) {
10
+ return process.env.AE_CLI_CAPABILITY_GATEWAY_DOMAIN ?? "";
11
+ }
12
+ return void 0;
13
+ }
3
14
  function registerCapabilityGatewayRoute(cliService, route) {
4
15
  cliServiceRoutes.set(cliService, route);
5
16
  }
@@ -10,6 +21,10 @@ function resolveGatewayDomain(cliService, override) {
10
21
  if (override !== void 0) {
11
22
  return override;
12
23
  }
24
+ const envDomain = envGatewayDomain(cliService);
25
+ if (envDomain !== void 0) {
26
+ return envDomain;
27
+ }
13
28
  const route = cliServiceRoutes.get(cliService);
14
29
  if (!route) {
15
30
  throw new Error(
@@ -14,16 +14,18 @@ import {
14
14
  import { readFile } from "fs/promises";
15
15
  import { basename } from "path";
16
16
  var CapabilityGatewayError = class extends Error {
17
- constructor(message, code, httpStatus, hint) {
17
+ constructor(message, code, httpStatus, hint, meta) {
18
18
  super(message);
19
19
  this.code = code;
20
20
  this.httpStatus = httpStatus;
21
21
  this.hint = hint;
22
+ this.meta = meta;
22
23
  this.name = "CapabilityGatewayError";
23
24
  }
24
25
  code;
25
26
  httpStatus;
26
27
  hint;
28
+ meta;
27
29
  };
28
30
  function buildCapabilityGatewayUrl(host, domain, pathAfterV1, queryParams = {}) {
29
31
  const base = host.replace(/\/+$/, "");
@@ -59,25 +61,41 @@ function parseCapabilityResponse(text) {
59
61
  return text;
60
62
  }
61
63
  }
62
- function unwrapCapabilityEnvelope(body) {
64
+ function parseCapabilityEnvelope(body) {
63
65
  if (body == null) {
64
66
  throw new CapabilityGatewayError("Empty capability gateway response");
65
67
  }
66
68
  if (typeof body.ok === "boolean") {
67
69
  if (body.ok) {
68
- return body.data;
70
+ return {
71
+ ok: true,
72
+ data: body.data,
73
+ ...isRecord(body.meta) ? { meta: body.meta } : {}
74
+ };
69
75
  }
70
76
  const err = body.error ?? {};
71
77
  const code = nonEmptyString(err.code);
72
78
  const message = nonEmptyString(err.message) ?? code ?? "Capability gateway request failed";
73
79
  const hint = nonEmptyString(err.hint);
74
- throw new CapabilityGatewayError(message, code, err.http_status ?? err.httpStatus, hint);
80
+ throw new CapabilityGatewayError(
81
+ message,
82
+ code,
83
+ err.http_status ?? err.httpStatus,
84
+ hint,
85
+ isRecord(body.meta) ? body.meta : void 0
86
+ );
75
87
  }
76
- return body;
88
+ return { ok: true, data: body };
89
+ }
90
+ function unwrapCapabilityEnvelope(body) {
91
+ return parseCapabilityEnvelope(body).data;
77
92
  }
78
93
  function nonEmptyString(value) {
79
94
  return typeof value === "string" && value.trim() ? value.trim() : void 0;
80
95
  }
96
+ function isRecord(value) {
97
+ return value !== null && typeof value === "object" && !Array.isArray(value);
98
+ }
81
99
  function buildCapabilityHttpError(resp, body) {
82
100
  const fallback = `Capability gateway HTTP error: ${resp.status} ${resp.statusText}`.trim();
83
101
  if (body && typeof body === "object") {
@@ -87,7 +105,13 @@ function buildCapabilityHttpError(resp, body) {
87
105
  const hint = nonEmptyString(err.hint) ?? nonEmptyString(body.hint);
88
106
  const details = [code, message, hint ? `Hint: ${hint}` : void 0].filter(Boolean);
89
107
  if (details.length > 0) {
90
- return new CapabilityGatewayError(message ?? fallback, code, resp.status, hint);
108
+ return new CapabilityGatewayError(
109
+ message ?? fallback,
110
+ code,
111
+ resp.status,
112
+ hint,
113
+ isRecord(body.meta) ? body.meta : void 0
114
+ );
91
115
  }
92
116
  }
93
117
  if (typeof body === "string" && body.trim()) {
@@ -99,10 +123,10 @@ async function throwCapabilityHttpError(resp) {
99
123
  const body = parseCapabilityResponse(await resp.text());
100
124
  throw buildCapabilityHttpError(resp, body);
101
125
  }
102
- async function requestOnce(url, method, token, body) {
126
+ async function requestOnce(url, method, token, body, accept = "application/json") {
103
127
  const headers = {
104
128
  "cli-token": token,
105
- "Accept": "application/json"
129
+ "Accept": accept
106
130
  };
107
131
  const init = { method, headers };
108
132
  if (body !== void 0 && method !== "GET") {
@@ -121,16 +145,10 @@ async function requestMultipartOnce(url, token, form) {
121
145
  body: form
122
146
  });
123
147
  }
124
- async function requestDownloadOnce(url, token) {
125
- return fetch(url, {
126
- method: "GET",
127
- headers: {
128
- "cli-token": token,
129
- "Accept": "*/*"
130
- }
131
- });
132
- }
133
148
  async function callGateway(host, domain, pathAfterV1, method, body) {
149
+ return (await callGatewayWithEnvelope(host, domain, pathAfterV1, method, body)).data;
150
+ }
151
+ async function callGatewayWithEnvelope(host, domain, pathAfterV1, method, body) {
134
152
  const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
135
153
  const token = await getCliToken(host);
136
154
  let resp = await requestOnce(url, method, token, body);
@@ -157,8 +175,41 @@ async function callGateway(host, domain, pathAfterV1, method, body) {
157
175
  } else if (!resp.ok) {
158
176
  await throwCapabilityHttpError(resp);
159
177
  }
178
+ return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
179
+ }
180
+ async function fetchCapabilityGateway(host, domain, pathAfterV1, method = "GET", body, accept = "application/json") {
181
+ const url = buildCapabilityGatewayUrl(host, domain, pathAfterV1);
182
+ const token = await getCliToken(host);
183
+ let resp = await requestOnce(url, method, token, body, accept);
184
+ if (resp.status === 403) {
185
+ throw new PermissionError(await permissionMessage(resp));
186
+ }
187
+ if (resp.status === 401) {
188
+ logger.warn(`Capability gateway request failed (HTTP 401) for ${host}, refreshing CLI token`);
189
+ clearCliToken(host);
190
+ const newToken = await getCliToken(host);
191
+ process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
192
+ `);
193
+ resp = await requestOnce(url, method, newToken, body, accept);
194
+ if (resp.status === 403) {
195
+ throw new PermissionError(await permissionMessage(resp));
196
+ }
197
+ if (!resp.ok) {
198
+ await throwCapabilityHttpError(resp);
199
+ }
200
+ } else if (!resp.ok) {
201
+ await throwCapabilityHttpError(resp);
202
+ }
203
+ return resp;
204
+ }
205
+ async function requestCapabilityGateway(host, domain, pathAfterV1, method = "GET", body) {
206
+ const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
160
207
  return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
161
208
  }
209
+ async function requestCapabilityGatewayWithEnvelope(host, domain, pathAfterV1, method = "GET", body) {
210
+ const resp = await fetchCapabilityGateway(host, domain, pathAfterV1, method, body);
211
+ return parseCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
212
+ }
162
213
  async function listCapabilities(host, domain) {
163
214
  return callGateway(host, domain, "capabilities", "GET");
164
215
  }
@@ -168,12 +219,37 @@ async function inspectCapability(host, domain, capabilityId) {
168
219
  async function executeCapability(host, domain, capabilityId, input = {}) {
169
220
  return callGateway(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
170
221
  }
222
+ async function executeCapabilityWithEnvelope(host, domain, capabilityId, input = {}) {
223
+ return callGatewayWithEnvelope(host, domain, `capabilities/${capabilityId}/execute`, "POST", { input });
224
+ }
171
225
  async function dryRunCapability(host, domain, capabilityId, input = {}) {
172
226
  return callGateway(host, domain, `capabilities/${capabilityId}/dry-run`, "POST", { input });
173
227
  }
228
+ async function validateCapability(host, domain, capabilityId, input = {}) {
229
+ return callGateway(host, domain, `capabilities/${capabilityId}/validate`, "POST", { input });
230
+ }
174
231
  async function uploadInputFile(host, domain, projectId, purpose, filePath) {
175
232
  const fileBytes = await readFile(filePath);
176
- return uploadInputFileBytes(host, domain, projectId, purpose, fileBytes, basename(filePath));
233
+ const filename = basename(filePath);
234
+ return uploadInputFileBytes(
235
+ host,
236
+ domain,
237
+ projectId,
238
+ purpose,
239
+ fileBytes,
240
+ filename,
241
+ inputFileContentType(filename)
242
+ );
243
+ }
244
+ function inputFileContentType(filename) {
245
+ const lower = filename.toLowerCase();
246
+ if (lower.endsWith(".csv")) return "text/csv";
247
+ if (lower.endsWith(".xlsx")) {
248
+ return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
249
+ }
250
+ if (lower.endsWith(".json")) return "application/json";
251
+ if (lower.endsWith(".txt")) return "text/plain";
252
+ return "application/octet-stream";
177
253
  }
178
254
  async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, filename, contentType = "application/octet-stream") {
179
255
  const url = buildCapabilityGatewayUrl(host, domain, "input-files");
@@ -208,56 +284,19 @@ async function uploadInputFileBytes(host, domain, projectId, purpose, bytes, fil
208
284
  }
209
285
  return unwrapCapabilityEnvelope(parseCapabilityResponse(await resp.text()));
210
286
  }
211
- async function downloadCapabilityArtifact(host, domain, runId, artifactId) {
212
- const url = buildCapabilityGatewayUrl(
213
- host,
214
- domain,
215
- `runs/${encodeURIComponent(runId)}/artifacts/${encodeURIComponent(artifactId)}/download`
216
- );
217
- const token = await getCliToken(host);
218
- let resp = await requestDownloadOnce(url, token);
219
- if (resp.status === 403) {
220
- throw new PermissionError(await permissionMessage(resp));
221
- }
222
- if (resp.status === 401) {
223
- logger.warn(`Capability gateway artifact download failed (HTTP 401) for ${host}, refreshing CLI token`);
224
- clearCliToken(host);
225
- const newToken = await getCliToken(host);
226
- process.stderr.write(`[ae-cli] CLI token refreshed for ${host}
227
- `);
228
- resp = await requestDownloadOnce(url, newToken);
229
- if (resp.status === 403) {
230
- throw new PermissionError(await permissionMessage(resp));
231
- }
232
- if (!resp.ok) {
233
- await throwCapabilityHttpError(resp);
234
- }
235
- } else if (!resp.ok) {
236
- await throwCapabilityHttpError(resp);
237
- }
238
- return {
239
- bytes: Buffer.from(await resp.arrayBuffer()),
240
- contentType: resp.headers.get("content-type") ?? void 0,
241
- contentDisposition: resp.headers.get("content-disposition") ?? void 0
242
- };
243
- }
244
- async function callCapabilityApi(host, domain, action, method = "POST", params = {}) {
245
- const isGet = method === "GET";
246
- if (isGet) {
247
- return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), "GET");
248
- }
249
- return callGateway(host, domain, action.replace(/^\/+|\/+$/g, ""), method, params);
250
- }
251
287
 
252
288
  export {
253
289
  CapabilityGatewayError,
254
290
  buildCapabilityGatewayUrl,
291
+ fetchCapabilityGateway,
292
+ requestCapabilityGateway,
293
+ requestCapabilityGatewayWithEnvelope,
255
294
  listCapabilities,
256
295
  inspectCapability,
257
296
  executeCapability,
297
+ executeCapabilityWithEnvelope,
258
298
  dryRunCapability,
299
+ validateCapability,
259
300
  uploadInputFile,
260
- uploadInputFileBytes,
261
- downloadCapabilityArtifact,
262
- callCapabilityApi
301
+ uploadInputFileBytes
263
302
  };
@@ -0,0 +1,68 @@
1
+ import {
2
+ resolveGatewayDomain
3
+ } from "./chunk-HL2AJQ4Q.js";
4
+ import {
5
+ dryRunCapability,
6
+ executeCapabilityWithEnvelope,
7
+ validateCapability
8
+ } from "./chunk-DYOS6YY7.js";
9
+ import {
10
+ withOutputMetadata
11
+ } from "./chunk-TNW2CI4W.js";
12
+
13
+ // src/core/capability-command.ts
14
+ import { randomBytes } from "crypto";
15
+ function createCapabilityCommand(config) {
16
+ return {
17
+ service: config.cliService,
18
+ resource: config.resource,
19
+ command: config.command,
20
+ capabilityId: config.capabilityId,
21
+ description: config.description,
22
+ flags: config.flags,
23
+ risk: config.risk,
24
+ validate: config.validate,
25
+ validateInput: async (ctx) => {
26
+ const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
27
+ const requestHost = config.requestHost ?? ctx.host();
28
+ const input = config.buildInput(ctx);
29
+ return validateCapability(requestHost, gatewayDomain, config.capabilityId, input);
30
+ },
31
+ dryRun: async (ctx) => {
32
+ const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
33
+ const requestHost = config.requestHost ?? ctx.host();
34
+ const input = config.buildInput(ctx);
35
+ return dryRunCapability(requestHost, gatewayDomain, config.capabilityId, input);
36
+ },
37
+ execute: async (ctx) => {
38
+ const gatewayDomain = resolveGatewayDomain(config.cliService, config.gatewayDomain);
39
+ const requestHost = config.requestHost ?? ctx.host();
40
+ const input = withLifecycleRequestId(config, config.buildInput(ctx));
41
+ announceDispatch(config.capabilityId, input);
42
+ const result = await executeCapabilityWithEnvelope(requestHost, gatewayDomain, config.capabilityId, input);
43
+ const data = config.postProcess ? config.postProcess(result.data, input) : result.data;
44
+ return withOutputMetadata(data, result.meta);
45
+ }
46
+ };
47
+ }
48
+ function withLifecycleRequestId(config, input) {
49
+ if (!config.flags.some((flag) => flag.name === "request-id")) {
50
+ return input;
51
+ }
52
+ const supplied = input.request_id;
53
+ const requestId = typeof supplied === "string" && supplied.length > 0 ? supplied : `cli_${randomBytes(16).toString("hex")}`;
54
+ return { ...input, request_id: requestId };
55
+ }
56
+ function announceDispatch(capabilityId, input) {
57
+ if (typeof input.request_id !== "string") {
58
+ return;
59
+ }
60
+ process.stderr.write(
61
+ `[ae-cli] dispatching capability=${capabilityId} request_id=${input.request_id}
62
+ `
63
+ );
64
+ }
65
+
66
+ export {
67
+ createCapabilityCommand
68
+ };
@@ -167,6 +167,16 @@ async function callMcpTool(url, toolName, args = {}, hostOverride) {
167
167
  };
168
168
  }
169
169
  function parseMcpResult(result) {
170
+ if (result.isError) {
171
+ const firstText = result.content.find((item) => item.type === "text")?.text || "";
172
+ let errorMessage = firstText.trim() || "MCP tool call failed";
173
+ try {
174
+ const parsed = safeJsonParse(firstText);
175
+ errorMessage = mcpResultErrorMessage(parsed) || errorMessage;
176
+ } catch {
177
+ }
178
+ throwMcpError(errorMessage);
179
+ }
170
180
  if (result.content.length > 0 && result.content[0].type === "text") {
171
181
  const text = result.content[0].text || "";
172
182
  let parsed;
@@ -177,10 +187,7 @@ function parseMcpResult(result) {
177
187
  }
178
188
  const errMsg = mcpResultErrorMessage(parsed);
179
189
  if (errMsg !== null) {
180
- if (/no_auth|auth_error|permission|forbidden|unauthor|\u65e0\u6743/i.test(errMsg)) {
181
- throw new PermissionError(errMsg);
182
- }
183
- throw new Error(errMsg);
190
+ throwMcpError(errMsg);
184
191
  }
185
192
  return parsed;
186
193
  }
@@ -189,6 +196,7 @@ function parseMcpResult(result) {
189
196
  function mcpResultErrorMessage(parsed) {
190
197
  if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) return null;
191
198
  if (parsed.success === true || parsed.ok === true) return null;
199
+ const explicitlyFailed = parsed.success === false || parsed.ok === false;
192
200
  const e = parsed.error;
193
201
  if (typeof e === "string" && e.trim()) return e;
194
202
  if (e && typeof e === "object") {
@@ -197,8 +205,21 @@ function mcpResultErrorMessage(parsed) {
197
205
  if (msg && code) return `${code}: ${msg}`;
198
206
  if (msg || code) return msg || code;
199
207
  }
208
+ if (explicitlyFailed) {
209
+ const msg = typeof parsed.message === "string" && parsed.message.trim() ? parsed.message.trim() : void 0;
210
+ const codeValue = parsed.errorCode ?? parsed.error_code ?? parsed.code;
211
+ const code = typeof codeValue === "string" && codeValue.trim() ? codeValue.trim() : void 0;
212
+ if (msg && code) return `${code}: ${msg}`;
213
+ return msg || code || "MCP tool call failed";
214
+ }
200
215
  return null;
201
216
  }
217
+ function throwMcpError(message) {
218
+ if (/no_auth|auth_error|permission|forbidden|unauthor|\u65e0\u6743/i.test(message)) {
219
+ throw new PermissionError(message);
220
+ }
221
+ throw new Error(message);
222
+ }
202
223
 
203
224
  export {
204
225
  registerMcpMappings,