@thinkingai/ae-cli 6.1.19 → 6.1.21

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 (370) hide show
  1. package/README.md +96 -38
  2. package/README.zh.md +96 -38
  3. package/dist/{auth-QPEVVBKT.js → auth-XZNXFRJS.js} +236 -127
  4. package/dist/{capability-ASI62I4A.js → capability-FYTU3X6L.js} +80 -37
  5. package/dist/{chunk-QL6R6TSK.js → chunk-4NRCTUZJ.js} +27045 -477
  6. package/dist/{chunk-JYMGHGCE.js → chunk-57RRFUEZ.js} +42 -15
  7. package/dist/chunk-6ZIQV5GW.js +26 -0
  8. package/dist/{chunk-KZ6ZHF5J.js → chunk-7FTTULED.js} +14 -14
  9. package/dist/chunk-7XGFSUOM.js +623 -0
  10. package/dist/chunk-CCS66K4K.js +155 -0
  11. package/dist/{chunk-B5HMQAOM.js → chunk-DVMLWQD4.js} +8 -186
  12. package/dist/{chunk-KEWVSO64.js → chunk-DX5CDO34.js} +28 -18
  13. package/dist/chunk-EQ255HKO.js +38248 -0
  14. package/dist/{chunk-6QK7SYYY.js → chunk-HBGADCKA.js} +29 -37
  15. package/dist/{chunk-GJXRF7Y6.js → chunk-HFGZGYCG.js} +54 -81
  16. package/dist/chunk-JOCDD4ON.js +15 -0
  17. package/dist/{chunk-TKHSULJT.js → chunk-KPQY44JQ.js} +6 -0
  18. package/dist/{chunk-FR2EDAQM.js → chunk-MAPZ7VB6.js} +90 -2
  19. package/dist/chunk-V2NUHPXF.js +196 -0
  20. package/dist/{chunk-S5PONFBM.js → chunk-VYXXOKYS.js} +9 -9
  21. package/dist/{community-report-client-6OL6GBQW.js → community-report-client-CU22W53K.js} +2 -4
  22. package/dist/{config-XNMACCKX.js → config-XO3LI3SA.js} +8 -9
  23. package/dist/context-IFJI3LIT.js +46 -0
  24. package/dist/{data-integration-4NZGZ45E.js → data-integration-HNGUKFIC.js} +55 -44
  25. package/dist/index.js +122 -112
  26. package/dist/{local-data-upload-client-EFHDLXFG.js → local-data-upload-client-GTRIT64F.js} +4 -5
  27. package/dist/{memory-HBJQ2GC5.js → memory-QGPSNCQS.js} +4 -6
  28. package/dist/{metadata-62EWBEIG.js → metadata-DI5BMYFU.js} +8 -10
  29. package/dist/{model-BHLJ2QMT.js → model-RNPQXIBI.js} +4 -6
  30. package/dist/{personal-semantic-preference-JBVMAI7L.js → personal-semantic-preference-5C3WUXFI.js} +11 -10
  31. package/dist/{project-semantic-BQ4MPUS5.js → project-semantic-3LF6Q6JZ.js} +29 -25
  32. package/dist/{sync-MUWPRM5I.js → sync-O45NXEQY.js} +7 -8
  33. package/dist/{te-agent-WQZTMEK4.js → te-agent-K5MSPNHJ.js} +393 -90
  34. package/dist/{te-analysis-MNCG65LU.js → te-analysis-AISWCOOZ.js} +1175 -377
  35. package/dist/{te-community-BNE6KREL.js → te-community-4OYU3BDA.js} +10 -33
  36. package/dist/{te-dataops-TXLKM2W6.js → te-dataops-NFIPB6FX.js} +19 -20
  37. package/dist/{te-engage-TPKLRVTL.js → te-engage-BAM3GBFX.js} +13 -15
  38. package/dist/{te-experiment-6BYKTCY7.js → te-experiment-GUTZXZ5Z.js} +132 -16
  39. package/dist/te-kb-3TS73NO6.js +1992 -0
  40. package/dist/{te-system-44LZJDTQ.js → te-system-STMHLS5J.js} +12 -9
  41. package/dist/{te-team-XMP47YXE.js → te-team-3I5AOX3N.js} +6 -8
  42. package/dist/{update-UODFOZ4P.js → update-RZXLPCRH.js} +7 -8
  43. package/package.json +29 -19
  44. package/skills/ae-agent/SKILL.md +30 -13
  45. package/skills/ae-agent/references/agent-distribution.md +94 -0
  46. package/skills/ae-agent/references/approval-request.md +4 -0
  47. package/skills/ae-agent/references/command_index.md +9 -2
  48. package/skills/ae-agent/references/create-automation.md +20 -2
  49. package/skills/ae-agent/references/get-agent-context.md +70 -0
  50. package/skills/ae-agent/references/list-automations.md +18 -3
  51. package/skills/ae-agent/references/list-mcp-credentials.md +1 -1
  52. package/skills/ae-agent/references/mcp-token.md +3 -3
  53. package/skills/ae-agent/references/set-mcp-credential.md +0 -1
  54. package/skills/ae-agent/references/update-automation.md +18 -0
  55. package/skills/ae-analysis/SKILL.md +101 -79
  56. package/skills/ae-analysis/references/adhoc_export.md +11 -18
  57. package/skills/ae-analysis/references/adhoc_run.md +17 -7
  58. package/skills/ae-analysis/references/agent_review_detail.md +11 -0
  59. package/skills/ae-analysis/references/agent_review_evidence.md +46 -0
  60. package/skills/ae-analysis/references/agent_review_list.md +9 -0
  61. package/skills/ae-analysis/references/agent_review_preflight.md +96 -0
  62. package/skills/ae-analysis/references/agent_review_priorities_comparisons.md +76 -0
  63. package/skills/ae-analysis/references/agent_review_records.md +9 -0
  64. package/skills/ae-analysis/references/agent_review_retry.md +12 -0
  65. package/skills/ae-analysis/references/agent_review_review.md +16 -0
  66. package/skills/ae-analysis/references/agent_review_submit_to_page.md +184 -0
  67. package/skills/ae-analysis/references/ai_models/attribution.md +29 -0
  68. package/skills/ae-analysis/references/ai_models/distribution.md +40 -0
  69. package/skills/ae-analysis/references/ai_models/event.md +108 -0
  70. package/skills/ae-analysis/references/ai_models/funnel.md +46 -0
  71. package/skills/ae-analysis/references/ai_models/heat_map.md +26 -0
  72. package/skills/ae-analysis/references/ai_models/interval.md +20 -0
  73. package/skills/ae-analysis/references/ai_models/path.md +38 -0
  74. package/skills/ae-analysis/references/ai_models/prop_analysis.md +39 -0
  75. package/skills/ae-analysis/references/ai_models/rank_list.md +25 -0
  76. package/skills/ae-analysis/references/ai_models/retention.md +70 -0
  77. package/skills/ae-analysis/references/ai_models/revenue.md +28 -0
  78. package/skills/ae-analysis/references/ai_models/sql.md +74 -0
  79. package/skills/ae-analysis/references/ai_models/tag.md +19 -0
  80. package/skills/ae-analysis/references/ai_models.md +32 -453
  81. package/skills/ae-analysis/references/alert_create.md +7 -7
  82. package/skills/ae-analysis/references/alert_delete.md +4 -6
  83. package/skills/ae-analysis/references/alert_detail_list.md +7 -9
  84. package/skills/ae-analysis/references/alert_get.md +5 -7
  85. package/skills/ae-analysis/references/alert_job_list.md +4 -6
  86. package/skills/ae-analysis/references/alert_list.md +6 -8
  87. package/skills/ae-analysis/references/alert_notice_config_list.md +4 -6
  88. package/skills/ae-analysis/references/alert_start.md +5 -7
  89. package/skills/ae-analysis/references/alert_stop.md +5 -7
  90. package/skills/ae-analysis/references/alert_update.md +8 -8
  91. package/skills/ae-analysis/references/analysis_data_export.md +72 -0
  92. package/skills/ae-analysis/references/analysis_data_retrieval.md +32 -196
  93. package/skills/ae-analysis/references/analysis_gateway_assets.md +23 -180
  94. package/skills/ae-analysis/references/analysis_interpretation.md +37 -17
  95. package/skills/ae-analysis/references/asset_abnormal_get.md +0 -1
  96. package/skills/ae-analysis/references/asset_abnormal_list.md +0 -1
  97. package/skills/ae-analysis/references/asset_authentication_export.md +4 -0
  98. package/skills/ae-analysis/references/asset_authentication_list.md +7 -1
  99. package/skills/ae-analysis/references/asset_authentication_update.md +5 -1
  100. package/skills/ae-analysis/references/asset_batch_dashboard_schedule_freeze.md +8 -6
  101. package/skills/ae-analysis/references/asset_batch_delete.md +6 -6
  102. package/skills/ae-analysis/references/asset_batch_disable_auto_backup.md +4 -5
  103. package/skills/ae-analysis/references/asset_batch_disable_auto_update.md +5 -6
  104. package/skills/ae-analysis/references/asset_batch_handover.md +4 -5
  105. package/skills/ae-analysis/references/asset_batch_info_export.md +4 -5
  106. package/skills/ae-analysis/references/asset_batch_sql_export.md +5 -6
  107. package/skills/ae-analysis/references/asset_dependency_list.md +4 -5
  108. package/skills/ae-analysis/references/asset_export.md +4 -5
  109. package/skills/ae-analysis/references/asset_impact_list.md +5 -9
  110. package/skills/ae-analysis/references/asset_lineage_get.md +5 -6
  111. package/skills/ae-analysis/references/asset_list.md +4 -5
  112. package/skills/ae-analysis/references/asset_query_history_list.md +4 -8
  113. package/skills/ae-analysis/references/asset_recent_list.md +0 -1
  114. package/skills/ae-analysis/references/asset_search.md +12 -9
  115. package/skills/ae-analysis/references/asset_url_get.md +3 -4
  116. package/skills/ae-analysis/references/bi_panel_copy.md +2 -2
  117. package/skills/ae-analysis/references/bi_panel_page_data_export.md +4 -12
  118. package/skills/ae-analysis/references/bi_panel_page_data_run.md +2 -0
  119. package/skills/ae-analysis/references/catalog_export.md +4 -17
  120. package/skills/ae-analysis/references/catalog_list.md +4 -4
  121. package/skills/ae-analysis/references/check_delete.md +5 -7
  122. package/skills/ae-analysis/references/check_export.md +11 -11
  123. package/skills/ae-analysis/references/check_get.md +8 -10
  124. package/skills/ae-analysis/references/check_list.md +4 -6
  125. package/skills/ae-analysis/references/check_retry.md +8 -10
  126. package/skills/ae-analysis/references/check_run.md +2 -4
  127. package/skills/ae-analysis/references/command_index.md +46 -28
  128. package/skills/ae-analysis/references/cross_source_config.md +84 -0
  129. package/skills/ae-analysis/references/dashboard_report_data_export.md +5 -13
  130. package/skills/ae-analysis/references/dashboard_report_data_run.md +1 -1
  131. package/skills/ae-analysis/references/dashboard_update.md +15 -4
  132. package/skills/ae-analysis/references/datatable_columns_get.md +0 -1
  133. package/skills/ae-analysis/references/datatable_influence_list.md +0 -1
  134. package/skills/ae-analysis/references/datatable_version_get.md +0 -1
  135. package/skills/ae-analysis/references/datatable_version_list.md +0 -1
  136. package/skills/ae-analysis/references/debug_device_add.md +1 -2
  137. package/skills/ae-analysis/references/drilldown_entities_export.md +3 -3
  138. package/skills/ae-analysis/references/drilldown_events_export.md +3 -2
  139. package/skills/ae-analysis/references/drilldown_user_events_export.md +2 -2
  140. package/skills/ae-analysis/references/entity_detail_export.md +3 -2
  141. package/skills/ae-analysis/references/entity_detail_run.md +1 -0
  142. package/skills/ae-analysis/references/event_blacklist_add.md +5 -7
  143. package/skills/ae-analysis/references/event_blacklist_list.md +4 -6
  144. package/skills/ae-analysis/references/event_blacklist_update.md +6 -8
  145. package/skills/ae-analysis/references/event_changelog_list.md +0 -1
  146. package/skills/ae-analysis/references/event_create.md +0 -1
  147. package/skills/ae-analysis/references/event_detail_export.md +3 -2
  148. package/skills/ae-analysis/references/event_detail_run.md +1 -0
  149. package/skills/ae-analysis/references/event_export.md +0 -1
  150. package/skills/ae-analysis/references/event_get.md +0 -1
  151. package/skills/ae-analysis/references/event_hide_update.md +0 -1
  152. package/skills/ae-analysis/references/event_influence_list.md +0 -1
  153. package/skills/ae-analysis/references/event_list.md +0 -1
  154. package/skills/ae-analysis/references/event_property_bundle_export.md +5 -14
  155. package/skills/ae-analysis/references/event_property_bundle_import.md +2 -6
  156. package/skills/ae-analysis/references/event_relation_update.md +0 -1
  157. package/skills/ae-analysis/references/event_update.md +0 -1
  158. package/skills/ae-analysis/references/exchange_config_update.md +0 -1
  159. package/skills/ae-analysis/references/exchange_rate_refresh.md +0 -1
  160. package/skills/ae-analysis/references/exchange_rule_list.md +0 -1
  161. package/skills/ae-analysis/references/exchange_rule_update.md +0 -1
  162. package/skills/ae-analysis/references/exchange_rule_validate.md +0 -1
  163. package/skills/ae-analysis/references/governance_recommendation_decisions.md +23 -0
  164. package/skills/ae-analysis/references/governance_recommendation_export.md +108 -0
  165. package/skills/ae-analysis/references/governance_recommendation_submit.md +41 -0
  166. package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -4
  167. package/skills/ae-analysis/references/history_tag_data_export.md +3 -3
  168. package/skills/ae-analysis/references/ingest_error_list.md +7 -9
  169. package/skills/ae-analysis/references/ingest_summary.md +6 -8
  170. package/skills/ae-analysis/references/live_data_export.md +10 -10
  171. package/skills/ae-analysis/references/live_data_list.md +7 -9
  172. package/skills/ae-analysis/references/metadata_resolution.md +78 -0
  173. package/skills/ae-analysis/references/metric_export.md +0 -1
  174. package/skills/ae-analysis/references/metric_get.md +0 -1
  175. package/skills/ae-analysis/references/metric_list.md +4 -5
  176. package/skills/ae-analysis/references/metric_update.md +0 -1
  177. package/skills/ae-analysis/references/operation_record_export.md +4 -5
  178. package/skills/ae-analysis/references/operation_record_list.md +4 -5
  179. package/skills/ae-analysis/references/personal_semantic_preference_list.md +18 -1
  180. package/skills/ae-analysis/references/plan_change_log_export.md +10 -10
  181. package/skills/ae-analysis/references/plan_change_log_list.md +4 -6
  182. package/skills/ae-analysis/references/plan_delete_items.md +2 -4
  183. package/skills/ae-analysis/references/plan_export.md +9 -9
  184. package/skills/ae-analysis/references/plan_generate.md +2 -4
  185. package/skills/ae-analysis/references/plan_get.md +4 -6
  186. package/skills/ae-analysis/references/plan_import_excel.md +6 -8
  187. package/skills/ae-analysis/references/plan_save_items.md +2 -4
  188. package/skills/ae-analysis/references/plan_sync_from_meta.md +4 -6
  189. package/skills/ae-analysis/references/project_access_detail_get.md +0 -1
  190. package/skills/ae-analysis/references/project_data_power_get.md +0 -1
  191. package/skills/ae-analysis/references/project_data_power_list.md +0 -1
  192. package/skills/ae-analysis/references/project_data_power_upsert.md +0 -1
  193. package/skills/ae-analysis/references/project_entity_create.md +0 -1
  194. package/skills/ae-analysis/references/project_entity_event_list.md +0 -1
  195. package/skills/ae-analysis/references/project_entity_get.md +0 -1
  196. package/skills/ae-analysis/references/project_entity_list.md +0 -1
  197. package/skills/ae-analysis/references/project_entity_update.md +0 -1
  198. package/skills/ae-analysis/references/project_function_list.md +0 -1
  199. package/skills/ae-analysis/references/project_info_get.md +0 -1
  200. package/skills/ae-analysis/references/project_info_list.md +0 -1
  201. package/skills/ae-analysis/references/project_info_update.md +0 -1
  202. package/skills/ae-analysis/references/project_mark_time_create.md +0 -1
  203. package/skills/ae-analysis/references/project_mark_time_list.md +0 -1
  204. package/skills/ae-analysis/references/project_mark_time_update.md +0 -1
  205. package/skills/ae-analysis/references/project_member_add.md +6 -5
  206. package/skills/ae-analysis/references/project_member_batch_update.md +0 -1
  207. package/skills/ae-analysis/references/project_member_candidate_list.md +4 -3
  208. package/skills/ae-analysis/references/project_member_handover_run.md +2 -3
  209. package/skills/ae-analysis/references/project_member_list.md +0 -1
  210. package/skills/ae-analysis/references/project_member_receiver_list.md +0 -1
  211. package/skills/ae-analysis/references/project_member_update.md +0 -1
  212. package/skills/ae-analysis/references/project_owner_update.md +0 -1
  213. package/skills/ae-analysis/references/project_permission_binding_list.md +0 -1
  214. package/skills/ae-analysis/references/project_role_function_list.md +0 -1
  215. package/skills/ae-analysis/references/project_role_get.md +0 -1
  216. package/skills/ae-analysis/references/project_role_list.md +0 -1
  217. package/skills/ae-analysis/references/project_role_upsert.md +32 -2
  218. package/skills/ae-analysis/references/project_role_user_list.md +0 -1
  219. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +214 -0
  220. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +93 -0
  221. package/skills/ae-analysis/references/project_timezone_get.md +0 -1
  222. package/skills/ae-analysis/references/project_timezone_overview.md +0 -1
  223. package/skills/ae-analysis/references/project_timezone_update.md +0 -1
  224. package/skills/ae-analysis/references/project_user_id_items_update.md +0 -1
  225. package/skills/ae-analysis/references/property_changelog_list.md +0 -1
  226. package/skills/ae-analysis/references/property_create.md +0 -1
  227. package/skills/ae-analysis/references/property_export.md +0 -1
  228. package/skills/ae-analysis/references/property_get.md +0 -1
  229. package/skills/ae-analysis/references/property_hide_update.md +0 -1
  230. package/skills/ae-analysis/references/property_influence_list.md +0 -1
  231. package/skills/ae-analysis/references/property_list.md +3 -4
  232. package/skills/ae-analysis/references/property_related_events.md +0 -1
  233. package/skills/ae-analysis/references/property_relation_update.md +0 -1
  234. package/skills/ae-analysis/references/property_update.md +0 -1
  235. package/skills/ae-analysis/references/report_create.md +4 -2
  236. package/skills/ae-analysis/references/report_data_export.md +11 -9
  237. package/skills/ae-analysis/references/report_data_run.md +14 -7
  238. package/skills/ae-analysis/references/report_get.md +5 -3
  239. package/skills/ae-analysis/references/report_list.md +2 -0
  240. package/skills/ae-analysis/references/report_update.md +5 -3
  241. package/skills/ae-analysis/references/rule_create.md +5 -6
  242. package/skills/ae-analysis/references/rule_delete.md +5 -5
  243. package/skills/ae-analysis/references/rule_list.md +3 -4
  244. package/skills/ae-analysis/references/rule_schema.md +3 -4
  245. package/skills/ae-analysis/references/rule_update.md +5 -6
  246. package/skills/ae-analysis/references/sdk_sample_generate.md +2 -4
  247. package/skills/ae-analysis/references/sql_table_columns.md +1 -1
  248. package/skills/ae-analysis/references/super_metadata_batch_create.md +1 -1
  249. package/skills/ae-analysis/references/super_metadata_batch_edit.md +1 -1
  250. package/skills/ae-analysis/references/system_member_add.md +1 -2
  251. package/skills/ae-analysis/references/system_member_status_update.md +1 -1
  252. package/skills/ae-analysis/references/system_ops_alert_contact_list.md +1 -1
  253. package/skills/ae-analysis/references/system_ops_alert_contact_test.md +0 -1
  254. package/skills/ae-analysis/references/system_query_monitor_overview.md +3 -3
  255. package/skills/ae-analysis/references/system_query_task_export.md +4 -14
  256. package/skills/ae-analysis/references/system_query_task_get.md +1 -1
  257. package/skills/ae-analysis/references/system_query_task_list.md +5 -6
  258. package/skills/ae-analysis/references/system_receiver_address_upsert.md +3 -3
  259. package/skills/ae-analysis/references/system_receiver_detection_get.md +1 -1
  260. package/skills/ae-analysis/references/system_third_party_login_disable.md +1 -1
  261. package/skills/ae-analysis/references/system_usage_trend_export.md +3 -12
  262. package/skills/ae-analysis/references/user_cluster_list.md +1 -1
  263. package/skills/ae-analysis/references/user_cluster_member_export.md +4 -4
  264. package/skills/ae-analysis/references/user_tag_create.md +23 -1
  265. package/skills/ae-analysis/references/user_tag_list.md +1 -1
  266. package/skills/ae-analysis/references/user_tag_member_export.md +4 -4
  267. package/skills/ae-analysis/references/user_tag_models.md +9 -1
  268. package/skills/ae-analysis/references/user_tag_update.md +14 -2
  269. package/skills/ae-analysis/references/virtual_event_create.md +10 -5
  270. package/skills/ae-analysis/references/virtual_event_get.md +0 -1
  271. package/skills/ae-analysis/references/virtual_property_create.md +0 -1
  272. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +0 -1
  273. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +1054 -0
  274. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +112 -0
  275. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +30 -0
  276. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +2735 -0
  277. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +376 -0
  278. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +264 -0
  279. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +49 -0
  280. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/upload-kb-sources-concurrently.mjs +200 -0
  281. package/skills/ae-analysis/scripts/read_results.py +197 -0
  282. package/skills/ae-analysis-global/SKILL.md +1 -1
  283. package/skills/ae-capability/SKILL.md +1 -1
  284. package/skills/ae-community/SKILL.md +1 -1
  285. package/skills/ae-current-context/SKILL.md +53 -0
  286. package/skills/ae-data-integration/SKILL.md +6 -4
  287. package/skills/ae-data-integration/references/dimension-routing.md +36 -0
  288. package/skills/ae-data-integration/references/lark-bitable-source.md +288 -0
  289. package/skills/ae-data-integration/references/lark-sheet-source.md +130 -0
  290. package/skills/ae-data-integration/references/local-analysis.md +2 -0
  291. package/skills/ae-data-integration/references/manual-export-source.md +83 -0
  292. package/skills/ae-data-integration/references/reuse.md +2 -0
  293. package/skills/ae-data-integration/references/sink-upload.md +32 -0
  294. package/skills/ae-data-integration/references/source-inspect.md +1 -1
  295. package/skills/ae-data-integration/references/tracking-plan.md +5 -2
  296. package/skills/ae-data-integration/references/transform.md +1 -1
  297. package/skills/ae-data-integration/references/ue-mapping.md +7 -4
  298. package/skills/ae-data-integration/references/ue-routing.md +17 -1
  299. package/skills/ae-data-integration-helper/SKILL.md +5 -5
  300. package/skills/ae-data-integration-helper/references/android_sdk_faq.md +3 -3
  301. package/skills/ae-data-integration-helper/references/c_sdk_faq.md +3 -3
  302. package/skills/ae-data-integration-helper/references/cocoscreator_sdk_faq.md +1 -1
  303. package/skills/ae-data-integration-helper/references/cpp_server_sdk_faq.md +3 -3
  304. package/skills/ae-data-integration-helper/references/ios_sdk_faq.md +1 -1
  305. package/skills/ae-data-integration-helper/references/java_sdk_faq.md +3 -3
  306. package/skills/ae-data-integration-helper/references/javascript_sdk_faq.md +1 -1
  307. package/skills/ae-data-integration-helper/references/logbus2_guide.md +1 -1
  308. package/skills/ae-data-integration-helper/references/logbus2_parser_plugin.md +2 -2
  309. package/skills/ae-data-integration-helper/references/minigame_sdk_faq.md +2 -2
  310. package/skills/ae-data-integration-helper/references/miniprogram_sdk_faq.md +1 -1
  311. package/skills/ae-data-integration-helper/references/python_sdk_faq.md +2 -2
  312. package/skills/ae-data-integration-helper/references/restful_api_notes.md +2 -2
  313. package/skills/ae-data-integration-helper/references/sdk_log_guide.md +3 -3
  314. package/skills/ae-data-integration-helper/references/sdk_usage_notes.md +11 -11
  315. package/skills/ae-data-integration-helper/references/unity_sdk_faq.md +1 -1
  316. package/skills/ae-dataops/SKILL.md +1 -1
  317. package/skills/ae-engage/SKILL.md +4 -3
  318. package/skills/ae-engage/references/build-task-save-guide.md +3 -0
  319. package/skills/ae-engage/references/flow-metric-update.md +115 -1
  320. package/skills/ae-engage/references/save-flow.md +3 -0
  321. package/skills/ae-engage/references/save-task.md +21 -0
  322. package/skills/ae-engage/references/task-metric-update.md +151 -0
  323. package/skills/ae-experiment/SKILL.md +14 -7
  324. package/skills/ae-experiment/references/save_submit_external_experiment.md +52 -0
  325. package/skills/ae-experiment-design/SKILL.md +3 -3
  326. package/skills/ae-experiment-design/references/platform-operations.md +1 -1
  327. package/skills/ae-experiment-insight/SKILL.md +2 -2
  328. package/skills/ae-experiment-insight/references/platform-operations.md +1 -1
  329. package/skills/ae-generate-tracking-code/SKILL.md +2 -1
  330. package/skills/ae-generate-tracking-code/references/client-sdk-insert.md +1 -1
  331. package/skills/ae-generate-tracking-code/references/datax-config.md +1 -1
  332. package/skills/ae-generate-tracking-code/references/logbus-config.md +1 -1
  333. package/skills/ae-generate-tracking-code/references/modes.md +1 -1
  334. package/skills/ae-generate-tracking-code/references/server-sdk-insert.md +5 -5
  335. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +3 -3
  336. package/skills/ae-generate-tracking-plan/SKILL.md +27 -15
  337. package/skills/ae-generate-tracking-plan/references/business-dimension-mapping.md +1 -1
  338. package/skills/ae-generate-tracking-plan/references/te-api.md +1 -0
  339. package/skills/ae-generate-tracking-plan/references/xlsx-schema.md +3 -2
  340. package/skills/ae-kb/SKILL.md +147 -37
  341. package/skills/ae-kb/references/analysis-workflow.md +292 -0
  342. package/skills/ae-kb/references/query-workflow.md +59 -29
  343. package/skills/ae-kb/references/source-mutations.md +95 -0
  344. package/skills/ae-kb/references/versions.md +46 -0
  345. package/skills/ae-kb-discovery/SKILL.md +5 -1
  346. package/skills/ae-metadata/SKILL.md +1 -1
  347. package/skills/ae-migrate-tracking-code/SKILL.md +195 -0
  348. package/skills/ae-migrate-tracking-code/references/ae-preset-properties.md +76 -0
  349. package/skills/ae-migrate-tracking-code/references/ir.md +167 -0
  350. package/skills/ae-migrate-tracking-code/references/mapping-framework.md +112 -0
  351. package/skills/ae-migrate-tracking-code/references/providers/README.md +58 -0
  352. package/skills/ae-migrate-tracking-code/references/providers/amplitude.md +208 -0
  353. package/skills/ae-migrate-tracking-code/references/providers/firebase.md +160 -0
  354. package/skills/ae-migrate-tracking-code/references/providers/ga4.md +92 -0
  355. package/skills/ae-migrate-tracking-code/references/providers/mixpanel.md +150 -0
  356. package/skills/ae-migrate-tracking-code/references/providers/sensors-data.md +146 -0
  357. package/skills/ae-project-semantic/SKILL.md +1 -1
  358. package/skills/ae-system/SKILL.md +5 -5
  359. package/skills/ae-team/SKILL.md +2 -2
  360. package/skills/ae-use-agent/SKILL.md +42 -0
  361. package/skills/ae-use-agent/references/local-agent.md +114 -0
  362. package/dist/auth-UMJAA72O.js +0 -15
  363. package/dist/chunk-533JK3YX.js +0 -72
  364. package/dist/chunk-DKEXH6Q5.js +0 -72
  365. package/dist/chunk-O6K2ODUE.js +0 -318
  366. package/dist/chunk-RWXIXOZG.js +0 -326
  367. package/dist/client-N7NGZUNI.js +0 -204
  368. package/dist/te-kb-BUD6N3NI.js +0 -1222
  369. package/skills/ae-agent/references/auto-provision-mcp-credentials.md +0 -57
  370. package/skills/ae-analysis/metadata_resolution.md +0 -184
@@ -1,1222 +0,0 @@
1
- import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
- import {
3
- kbApi,
4
- kbUpload
5
- } from "./chunk-JYMGHGCE.js";
6
- import {
7
- printError
8
- } from "./chunk-KEWVSO64.js";
9
- import {
10
- CapabilityGatewayError
11
- } from "./chunk-GJXRF7Y6.js";
12
- import "./chunk-Y74WTIKJ.js";
13
- import "./chunk-RWXIXOZG.js";
14
- import "./chunk-O6K2ODUE.js";
15
- import "./chunk-KZ6ZHF5J.js";
16
- import {
17
- CliValidationError,
18
- PermissionError
19
- } from "./chunk-533JK3YX.js";
20
- import "./chunk-FR2EDAQM.js";
21
-
22
- // src/commands/te-kb/add.ts
23
- import { promises as fs } from "fs";
24
- import * as path from "path";
25
- import TurndownService from "turndown";
26
- var API_PATH = "/agent/api/external/knowledge-bases/sources/upload";
27
- var SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Set([
28
- ".md",
29
- ".markdown",
30
- ".txt",
31
- ".csv",
32
- ".pdf",
33
- ".doc",
34
- ".docx",
35
- ".xls",
36
- ".xlsx",
37
- ".ppt",
38
- ".pptx",
39
- ".jpg",
40
- ".jpeg",
41
- ".png",
42
- ".gif",
43
- ".webp",
44
- ".bmp",
45
- ".svg"
46
- ]);
47
- function normalizeFilesInput(raw) {
48
- if (!Array.isArray(raw)) {
49
- throw new Error(`--files must be a JSON array of strings, e.g. '["./a.md","./docs","https://example.com/page"]'`);
50
- }
51
- const items = [];
52
- for (const v of raw) {
53
- if (typeof v !== "string") {
54
- throw new Error(`--files entries must be strings (got: ${JSON.stringify(v)})`);
55
- }
56
- const trimmed = v.trim();
57
- if (trimmed) items.push(trimmed);
58
- }
59
- return items;
60
- }
61
- function isUrl(s) {
62
- return /^https?:\/\//i.test(s);
63
- }
64
- function classifyInput(item) {
65
- return isUrl(item) ? "url" : "path";
66
- }
67
- function sanitizeFilename(name) {
68
- const cleaned = name.replace(/[\\/:*?"<>|\s]+/g, "-").replace(/^-+|-+$/g, "");
69
- return cleaned || "document";
70
- }
71
- function getMimeType(filename) {
72
- const ext = path.extname(filename).toLowerCase();
73
- switch (ext) {
74
- case ".md":
75
- case ".markdown":
76
- return "text/markdown";
77
- case ".txt":
78
- return "text/plain";
79
- case ".csv":
80
- return "text/csv";
81
- case ".pdf":
82
- return "application/pdf";
83
- case ".doc":
84
- return "application/msword";
85
- case ".docx":
86
- return "application/vnd.openxmlformats-officedocument.wordprocessingml.document";
87
- case ".xls":
88
- return "application/vnd.ms-excel";
89
- case ".xlsx":
90
- return "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";
91
- case ".ppt":
92
- return "application/vnd.ms-powerpoint";
93
- case ".pptx":
94
- return "application/vnd.openxmlformats-officedocument.presentationml.presentation";
95
- case ".jpg":
96
- case ".jpeg":
97
- return "image/jpeg";
98
- case ".png":
99
- return "image/png";
100
- case ".gif":
101
- return "image/gif";
102
- case ".webp":
103
- return "image/webp";
104
- case ".bmp":
105
- return "image/bmp";
106
- case ".svg":
107
- return "image/svg+xml";
108
- default:
109
- return "application/octet-stream";
110
- }
111
- }
112
- async function readLocalFile(filePath) {
113
- const ext = path.extname(filePath).toLowerCase();
114
- if (!SUPPORTED_EXTENSIONS.has(ext)) {
115
- throw new Error(`Unsupported file extension (${ext || "none"}): ${filePath}`);
116
- }
117
- const content = await fs.readFile(filePath);
118
- const filename = path.basename(filePath);
119
- return { filename, content, mimeType: getMimeType(filename), origin: "file", source: filePath };
120
- }
121
- async function readDirectory(dir) {
122
- const entries = await fs.readdir(dir, { withFileTypes: true });
123
- const files = [];
124
- for (const entry of entries) {
125
- if (!entry.isFile()) continue;
126
- const ext = path.extname(entry.name).toLowerCase();
127
- if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
128
- const full = path.join(dir, entry.name);
129
- const content = await fs.readFile(full);
130
- files.push({ filename: entry.name, content, mimeType: getMimeType(entry.name), origin: "dir", source: full });
131
- }
132
- if (files.length === 0) {
133
- throw new Error(`No supported files found in directory: ${dir}`);
134
- }
135
- return files;
136
- }
137
- function deriveFilenameFromUrl(rawUrl) {
138
- try {
139
- const u = new URL(rawUrl);
140
- const lastSeg = u.pathname.split("/").filter(Boolean).pop();
141
- const base = lastSeg ? lastSeg.replace(/\.[^.]+$/, "") : u.hostname;
142
- return `${sanitizeFilename(base)}.md`;
143
- } catch {
144
- return `${sanitizeFilename(rawUrl)}.md`;
145
- }
146
- }
147
- async function fetchAsMarkdown(rawUrl) {
148
- const resp = await fetch(rawUrl);
149
- if (!resp.ok) {
150
- throw new Error(`Failed to fetch ${rawUrl}: HTTP ${resp.status}`);
151
- }
152
- const html = await resp.text();
153
- const turndown = new TurndownService({ headingStyle: "atx", codeBlockStyle: "fenced" });
154
- const markdown = turndown.turndown(html);
155
- return {
156
- filename: deriveFilenameFromUrl(rawUrl),
157
- content: markdown,
158
- mimeType: "text/markdown",
159
- origin: "url",
160
- source: rawUrl
161
- };
162
- }
163
- async function resolveLocalPath(p) {
164
- const abs = path.resolve(p);
165
- let stat;
166
- try {
167
- stat = await fs.stat(abs);
168
- } catch {
169
- throw new Error(`Path not found: ${p}`);
170
- }
171
- if (stat.isDirectory()) {
172
- return readDirectory(abs);
173
- }
174
- if (stat.isFile()) {
175
- return [await readLocalFile(abs)];
176
- }
177
- throw new Error(`Unsupported path (not file or directory): ${p}`);
178
- }
179
- async function collectFiles(ctx) {
180
- const items = normalizeFilesInput(ctx.json("files"));
181
- if (items.length === 0) {
182
- throw new Error("--files must contain at least one entry");
183
- }
184
- const collected = [];
185
- for (const item of items) {
186
- if (classifyInput(item) === "url") {
187
- collected.push(await fetchAsMarkdown(item));
188
- } else {
189
- collected.push(...await resolveLocalPath(item));
190
- }
191
- }
192
- if (collected.length === 0) {
193
- throw new Error("No supported files collected from the given inputs");
194
- }
195
- return dedupeByFilename(collected);
196
- }
197
- function dedupeByFilename(files) {
198
- const used = /* @__PURE__ */ new Map();
199
- return files.map((f) => {
200
- const count = used.get(f.filename) ?? 0;
201
- used.set(f.filename, count + 1);
202
- if (count === 0) return f;
203
- const ext = path.extname(f.filename);
204
- const stem = f.filename.slice(0, f.filename.length - ext.length);
205
- return { ...f, filename: `${stem}-${count}${ext}` };
206
- });
207
- }
208
- function buildForm(name, files) {
209
- const form = new FormData();
210
- form.append("name", name);
211
- for (const f of files) {
212
- form.append("files", new Blob([f.content], { type: f.mimeType }), f.filename);
213
- }
214
- return form;
215
- }
216
- var add = {
217
- service: "kb",
218
- command: "+add",
219
- description: "Upload sources to a knowledge. --files accepts a JSON array; each entry can be a supported file path, a directory path (supported files inside, non-recursive), or an http(s) URL (HTML auto-converted to markdown).",
220
- flags: [
221
- { name: "name", type: "string", required: true, desc: "Knowledge base name" },
222
- {
223
- name: "files",
224
- type: "json",
225
- required: true,
226
- desc: `JSON array of strings. Each entry can be a supported file path, a directory path, or an http(s) URL. Example: '["./a.md","./docs","https://example.com/page"]'`
227
- }
228
- ],
229
- risk: "write",
230
- validate: (ctx) => {
231
- normalizeFilesInput(ctx.json("files"));
232
- },
233
- dryRun: (ctx) => {
234
- const items = normalizeFilesInput(ctx.json("files"));
235
- return {
236
- method: "POST",
237
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH}`,
238
- body: {
239
- name: ctx.str("name"),
240
- files: items.map((item) => ({ value: item, type: classifyInput(item) })),
241
- contentType: "multipart/form-data"
242
- }
243
- };
244
- },
245
- execute: async (ctx) => {
246
- const name = ctx.str("name");
247
- const files = await collectFiles(ctx);
248
- const form = buildForm(name, files);
249
- const result = await kbUpload(ctx, API_PATH, form);
250
- return {
251
- uploaded: files.map((f) => ({ filename: f.filename, origin: f.origin, source: f.source })),
252
- result
253
- };
254
- }
255
- };
256
-
257
- // src/commands/te-kb/compile.ts
258
- var API_PATH2 = "/agent/api/external/knowledge-bases/compile";
259
- var VALID_MODES = /* @__PURE__ */ new Set(["incremental", "full"]);
260
- function getMode(ctx) {
261
- const mode = ctx.str("mode") || "incremental";
262
- if (!VALID_MODES.has(mode)) {
263
- throw new Error(`Invalid --mode: ${mode}. Must be one of: incremental | full`);
264
- }
265
- return mode;
266
- }
267
- function buildBody(ctx) {
268
- return {
269
- name: ctx.str("name"),
270
- mode: getMode(ctx)
271
- };
272
- }
273
- var compile = {
274
- service: "kb",
275
- command: "+compile",
276
- description: "Compile a knowledge.",
277
- flags: [
278
- { name: "name", type: "string", required: true, desc: "Knowledge base name" },
279
- { name: "mode", type: "string", required: false, default: "incremental", desc: "Compile mode: incremental | full (default: incremental)" }
280
- ],
281
- risk: "write",
282
- validate: (ctx) => {
283
- getMode(ctx);
284
- },
285
- dryRun: (ctx) => ({
286
- method: "POST",
287
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH2}`,
288
- body: buildBody(ctx)
289
- }),
290
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH2, {}, buildBody(ctx))
291
- };
292
-
293
- // src/commands/te-kb/remove.ts
294
- var API_PATH3 = "/agent/api/external/knowledge-bases";
295
- function buildBody2(ctx) {
296
- return { name: ctx.str("name") };
297
- }
298
- var remove = {
299
- service: "kb",
300
- command: "+remove",
301
- description: "Delete an entire knowledge.",
302
- flags: [
303
- { name: "name", type: "string", required: true, desc: "Knowledge base name to delete" }
304
- ],
305
- risk: "high-risk-write",
306
- dryRun: (ctx) => ({
307
- method: "DELETE",
308
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH3}`,
309
- body: buildBody2(ctx)
310
- }),
311
- execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH3, {}, buildBody2(ctx))
312
- };
313
-
314
- // src/commands/te-kb/create.ts
315
- var API_PATH4 = "/agent/api/external/knowledge-bases/create";
316
- var VALID_SCOPES = /* @__PURE__ */ new Set(["personal", "company"]);
317
- function getScope(ctx) {
318
- const scope = ctx.str("scope") || "company";
319
- validateScope(scope);
320
- return scope;
321
- }
322
- function validateScope(scope) {
323
- if (!VALID_SCOPES.has(scope)) {
324
- throw new Error(`Invalid --scope: ${scope}. Must be one of: personal | company`);
325
- }
326
- }
327
- function normalizeTags(raw) {
328
- if (raw === void 0 || raw === null) return void 0;
329
- if (!Array.isArray(raw)) {
330
- throw new Error(`--tags must be a JSON array of strings, e.g. '["t1","t2"]'`);
331
- }
332
- const tags = [];
333
- for (const v of raw) {
334
- if (typeof v !== "string") {
335
- throw new Error(`--tags entries must be strings (got: ${JSON.stringify(v)})`);
336
- }
337
- const t = v.trim();
338
- if (t) tags.push(t);
339
- }
340
- return tags;
341
- }
342
- function buildBody3(ctx) {
343
- const body = {
344
- scope: getScope(ctx),
345
- name: ctx.str("name")
346
- };
347
- const description = ctx.str("description");
348
- if (description) body.description = description;
349
- const tags = normalizeTags(ctx.json("tags"));
350
- if (tags && tags.length > 0) body.tags = tags;
351
- const projectId = ctx.str("project-id");
352
- if (projectId) body.projectId = projectId;
353
- const projectName = ctx.str("project-name");
354
- if (projectName) body.projectName = projectName;
355
- return body;
356
- }
357
- var create = {
358
- service: "kb",
359
- command: "+new",
360
- description: "Create a new knowledge.",
361
- flags: [
362
- { name: "scope", type: "string", required: false, default: "company", desc: "Knowledge base scope: personal | company (default: company)" },
363
- { name: "name", type: "string", required: true, desc: "Knowledge base name (\u226430 chars, unique per scope)" },
364
- { name: "description", type: "string", required: false, desc: "Optional description (\u2264200 chars)" },
365
- { name: "tags", type: "json", required: false, desc: `Optional JSON array of tags (max 2, each \u226415 chars). Example: '["t1","t2"]'` },
366
- { name: "project-id", type: "string", required: false, desc: "Optional project ID to bind" },
367
- { name: "project-name", type: "string", required: false, desc: "Optional project display name" }
368
- ],
369
- risk: "write",
370
- validate: (ctx) => {
371
- getScope(ctx);
372
- normalizeTags(ctx.json("tags"));
373
- },
374
- dryRun: (ctx) => ({
375
- method: "POST",
376
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH4}`,
377
- body: buildBody3(ctx)
378
- }),
379
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH4, {}, buildBody3(ctx))
380
- };
381
-
382
- // src/commands/te-kb/rm-source.ts
383
- var API_PATH5 = "/agent/api/external/knowledge-bases/sources";
384
- function sourceSelector(ctx) {
385
- const id = ctx.str("id").trim();
386
- if (id) return { id };
387
- const displayName = ctx.str("display-name").trim();
388
- if (displayName) return { displayName };
389
- throw new CliValidationError("One of --id or --display-name is required.");
390
- }
391
- function buildBody4(ctx) {
392
- return {
393
- name: ctx.str("name"),
394
- ...sourceSelector(ctx)
395
- };
396
- }
397
- var rmSource = {
398
- service: "kb",
399
- command: "+rm-source",
400
- description: "Delete one source from a knowledge base by ID or exact display name.",
401
- flags: [
402
- { name: "name", type: "string", required: true, desc: "Knowledge base name (looked up personal \u2192 company)" },
403
- { name: "id", type: "string", required: false, desc: "Source ID copied from +list-sources (preferred)" },
404
- { name: "display-name", type: "string", required: false, desc: "Exact source display name for legacy compatibility" }
405
- ],
406
- risk: "high-risk-write",
407
- validate: (ctx) => {
408
- sourceSelector(ctx);
409
- },
410
- dryRun: (ctx) => ({
411
- method: "DELETE",
412
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH5}`,
413
- body: buildBody4(ctx)
414
- }),
415
- execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH5, {}, buildBody4(ctx), {
416
- preserveErrorMetadata: true,
417
- retryUnauthorized: true
418
- })
419
- };
420
-
421
- // src/commands/te-kb/schema.ts
422
- var API_PATH6 = "/agent/api/external/knowledge-bases/schema";
423
- function buildBody5(ctx) {
424
- const body = {
425
- name: ctx.str("name")
426
- };
427
- if (ctx.bool("force")) body.force = true;
428
- const model = ctx.str("model");
429
- if (model) body.model = model;
430
- const customInstructions = ctx.str("custom-instructions");
431
- if (customInstructions) body.customInstructions = customInstructions;
432
- return body;
433
- }
434
- async function executeSchema(ctx, api = kbApi) {
435
- return api(ctx, "POST", API_PATH6, {}, buildBody5(ctx), {
436
- preserveBusinessErrorCode: true
437
- });
438
- }
439
- var schema = {
440
- service: "kb",
441
- command: "+schema",
442
- description: "Generate the compile schema for a knowledge base via POST /agent/api/external/knowledge-bases/schema.",
443
- flags: [
444
- { name: "name", type: "string", required: true, desc: "Knowledge base name (looked up personal \u2192 company)" },
445
- { name: "force", type: "boolean", required: false, desc: "Preempt generation even when status is `generating` (use only for stuck recovery)" },
446
- { name: "model", type: "string", required: false, desc: "Optional model displayName to use for schema generation" },
447
- {
448
- name: "custom-instructions",
449
- type: "string",
450
- required: false,
451
- sensitive: true,
452
- desc: "Optional per-run instructions for generating this knowledge base schema"
453
- }
454
- ],
455
- risk: "write",
456
- dryRun: (ctx) => ({
457
- method: "POST",
458
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH6}`,
459
- body: buildBody5(ctx)
460
- }),
461
- execute: executeSchema
462
- };
463
-
464
- // src/commands/te-kb/status.ts
465
- var API_PATH7 = "/agent/api/external/knowledge-bases/status";
466
- function buildBody6(ctx) {
467
- return {
468
- name: ctx.str("name")
469
- };
470
- }
471
- var status = {
472
- service: "kb",
473
- command: "+status",
474
- description: "Query knowledge base status.",
475
- flags: [
476
- { name: "name", type: "string", required: true, desc: "Knowledge base name" }
477
- ],
478
- risk: "read",
479
- dryRun: (ctx) => ({
480
- method: "POST",
481
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH7}`,
482
- body: buildBody6(ctx)
483
- }),
484
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH7, {}, buildBody6(ctx))
485
- };
486
-
487
- // src/commands/te-kb/kb-index.ts
488
- var API_PATH8 = "/agent/api/external/knowledge-bases/index";
489
- function buildBody7(ctx) {
490
- const body = {};
491
- const sources = ctx.json("sources");
492
- if (sources) body.sources = sources;
493
- const locale = ctx.str("locale");
494
- if (locale) body.locale = locale;
495
- return body;
496
- }
497
- var kbIndex = {
498
- service: "kb",
499
- command: "+index",
500
- description: "List accessible knowledge bases and their index.md navigation maps via POST /agent/api/external/knowledge-bases/index. Call this first to see the layout, then use +grep to locate and +read to open pages.",
501
- flags: [
502
- {
503
- name: "sources",
504
- type: "json",
505
- required: false,
506
- desc: 'Optional JSON array of knowledge base refs to scope the index, e.g. [{"scope":"company","name":"engineering-handbook"}]. Omit to list all accessible knowledge bases.'
507
- },
508
- { name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
509
- ],
510
- risk: "read",
511
- dryRun: (ctx) => ({
512
- method: "POST",
513
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH8}`,
514
- body: buildBody7(ctx)
515
- }),
516
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH8, {}, buildBody7(ctx))
517
- };
518
-
519
- // src/commands/te-kb/kb-list.ts
520
- var API_PATH9 = "/agent/api/external/knowledge-bases/list";
521
- var DEFAULT_BUILD_STATUS = "compiled";
522
- var VALID_BUILD_STATUSES = ["idle", "pending", "compiling", "compiled", "failed"];
523
- function getBuildStatus(ctx) {
524
- return ctx.str("build-status") || DEFAULT_BUILD_STATUS;
525
- }
526
- function validateBuildStatus(ctx) {
527
- const value = ctx.str("build-status");
528
- if (value && !VALID_BUILD_STATUSES.includes(value)) {
529
- printError(
530
- "validation",
531
- `Invalid --build-status: ${value}. Valid values: ${VALID_BUILD_STATUSES.join(" | ")} (omit to default to ${DEFAULT_BUILD_STATUS}).`
532
- );
533
- process.exit(1);
534
- }
535
- }
536
- function buildBody8(ctx) {
537
- const body = {
538
- buildStatus: getBuildStatus(ctx)
539
- };
540
- const locale = ctx.str("locale");
541
- if (locale) body.locale = locale;
542
- return body;
543
- }
544
- var kbList = {
545
- service: "kb",
546
- command: "+list",
547
- description: "List accessible knowledge bases via POST /agent/api/external/knowledge-bases/list. Filters by buildStatus (default: compiled). Returns KB metadata including buildStatus, without index.md navigation maps.",
548
- flags: [
549
- {
550
- name: "build-status",
551
- type: "string",
552
- required: false,
553
- default: DEFAULT_BUILD_STATUS,
554
- desc: `Filter by knowledge base build status: ${VALID_BUILD_STATUSES.join(" | ")} (default: ${DEFAULT_BUILD_STATUS} when omitted)`
555
- },
556
- { name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
557
- ],
558
- risk: "read",
559
- validate: (ctx) => {
560
- validateBuildStatus(ctx);
561
- },
562
- dryRun: (ctx) => ({
563
- method: "POST",
564
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH9}`,
565
- body: buildBody8(ctx)
566
- }),
567
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH9, {}, buildBody8(ctx))
568
- };
569
-
570
- // src/commands/te-kb/list-sources.ts
571
- var API_PATH10 = "/agent/api/external/knowledge-bases/sources";
572
- var MAX_KNOWLEDGE_BASE_NAME_LENGTH = 200;
573
- function knowledgeBaseName(ctx) {
574
- return ctx.str("name").trim();
575
- }
576
- function buildUrl(ctx) {
577
- const url2 = new URL(`${ctx.host().replace(/\/$/, "")}${API_PATH10}`);
578
- url2.searchParams.set("name", knowledgeBaseName(ctx));
579
- return url2.toString();
580
- }
581
- var listSources = {
582
- service: "kb",
583
- command: "+list-sources",
584
- description: "List source metadata for a knowledge base via GET /agent/api/external/knowledge-bases/sources?name=<name>. Copy the stable source ID from this output before using +rm-source.",
585
- flags: [
586
- {
587
- name: "name",
588
- type: "string",
589
- required: true,
590
- minLength: 1,
591
- maxLength: MAX_KNOWLEDGE_BASE_NAME_LENGTH,
592
- desc: "Knowledge base name"
593
- }
594
- ],
595
- risk: "read",
596
- validate: (ctx) => {
597
- const name = knowledgeBaseName(ctx);
598
- if (!name) {
599
- throw new CliValidationError("Invalid --name: must be non-empty.");
600
- }
601
- if (name.length > MAX_KNOWLEDGE_BASE_NAME_LENGTH) {
602
- throw new CliValidationError(
603
- `Invalid --name length: ${name.length}. Must be at most ${MAX_KNOWLEDGE_BASE_NAME_LENGTH} characters.`
604
- );
605
- }
606
- },
607
- dryRun: (ctx) => ({
608
- method: "GET",
609
- url: buildUrl(ctx)
610
- }),
611
- execute: async (ctx) => kbApi(
612
- ctx,
613
- "GET",
614
- API_PATH10,
615
- { name: knowledgeBaseName(ctx) },
616
- void 0,
617
- { preserveErrorMetadata: true, retryUnauthorized: true }
618
- )
619
- };
620
-
621
- // src/commands/te-kb/kb-grep.ts
622
- var API_PATH11 = "/agent/api/external/knowledge-bases/grep";
623
- function buildBody9(ctx) {
624
- const body = {
625
- query: ctx.str("query"),
626
- sources: ctx.json("sources"),
627
- paths: ctx.json("paths")
628
- };
629
- const topK = ctx.num("top-k");
630
- if (topK) body.topK = topK;
631
- const locale = ctx.str("locale");
632
- if (locale) body.locale = locale;
633
- return body;
634
- }
635
- var kbGrep = {
636
- service: "kb",
637
- command: "+grep",
638
- description: "Keyword-search knowledge base pages via POST /agent/api/external/knowledge-bases/grep. Returns matched lines with path, line number, breadcrumb, context snippet, and the section line range (sectionStartLine/sectionEndLine) of each hit. Copy --paths from +index (wiki pages or subdirectories). Use +read with the hit range to open the section.",
639
- flags: [
640
- {
641
- name: "query",
642
- type: "string",
643
- required: true,
644
- alias: "q",
645
- desc: "Keywords to search across the knowledge bases"
646
- },
647
- {
648
- name: "sources",
649
- type: "json",
650
- required: true,
651
- desc: 'JSON array of knowledge base refs, e.g. [{"scope":"company","name":"engineering-handbook"}]'
652
- },
653
- {
654
- name: "paths",
655
- type: "json",
656
- required: true,
657
- desc: 'JSON array of wiki pages or subdirectories copied from +index, e.g. ["wiki/sandbox.md"] or ["wiki/guides"]'
658
- },
659
- { name: "top-k", type: "number", required: false, desc: "Max number of hits to return (1-50, default 10)" },
660
- { name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
661
- ],
662
- risk: "read",
663
- dryRun: (ctx) => ({
664
- method: "POST",
665
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH11}`,
666
- body: buildBody9(ctx)
667
- }),
668
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH11, {}, buildBody9(ctx))
669
- };
670
-
671
- // src/commands/te-kb/kb-read.ts
672
- var API_PATH12 = "/agent/api/external/knowledge-bases/read";
673
- function buildBody10(ctx) {
674
- const body = {
675
- source: ctx.json("source"),
676
- path: ctx.str("path")
677
- };
678
- const offset = ctx.num("offset");
679
- if (offset) body.offset = offset;
680
- const limit = ctx.num("limit");
681
- if (limit) body.limit = limit;
682
- if (ctx.bool("outline")) body.outline = true;
683
- const locale = ctx.str("locale");
684
- if (locale) body.locale = locale;
685
- return body;
686
- }
687
- var kbRead = {
688
- service: "kb",
689
- command: "+read",
690
- description: "Read a full knowledge base page (or a line window) via POST /agent/api/external/knowledge-bases/read. Use after +index / +grep locate a candidate page. Pass --outline to get only the page heading tree (no content) and pick a section to read.",
691
- flags: [
692
- {
693
- name: "source",
694
- type: "json",
695
- required: true,
696
- desc: 'Knowledge base ref pointing to exactly one base, e.g. {"scope":"company","name":"engineering-handbook"}'
697
- },
698
- {
699
- name: "path",
700
- type: "string",
701
- required: true,
702
- desc: "Page path relative to the knowledge base root, e.g. wiki/concepts/data-model.md or index.md"
703
- },
704
- { name: "offset", type: "number", required: false, desc: "Start line (1-based). Omit to read from the beginning." },
705
- { name: "limit", type: "number", required: false, desc: "Max number of lines to return (1-10000)." },
706
- {
707
- name: "outline",
708
- type: "boolean",
709
- required: false,
710
- desc: "Return only the page outline (headings with line numbers), no content. Use it to decide which section to read on long pages."
711
- },
712
- { name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
713
- ],
714
- risk: "read",
715
- dryRun: (ctx) => ({
716
- method: "POST",
717
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH12}`,
718
- body: buildBody10(ctx)
719
- }),
720
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH12, {}, buildBody10(ctx))
721
- };
722
-
723
- // src/commands/te-kb/ask-shared.ts
724
- var ASK_API_PATH = "/agent/api/external/knowledge-bases/ask";
725
- var ASK_POLL_INTERVAL_MS = 5e3;
726
- var ASK_POLL_TIMEOUT_MS = 10 * 60 * 1e3;
727
- var ASK_MAX_TRANSIENT_POLL_FAILURES = 3;
728
- function isTransientAskPollError(error) {
729
- if (error instanceof PermissionError) return false;
730
- if (error instanceof TypeError) return true;
731
- if (!(error instanceof Error)) return false;
732
- if (/KB MCP token auth failed|unauthorized|Invalid access token/i.test(error.message)) {
733
- return false;
734
- }
735
- return /fetch|network|socket|ECONNRESET|ETIMEDOUT|EAI_AGAIN|ENOTFOUND|timeout/i.test(
736
- error.message
737
- );
738
- }
739
- async function pollUntilSettled(getStatus, executionId, options = {}) {
740
- const intervalMs = options.intervalMs ?? ASK_POLL_INTERVAL_MS;
741
- const timeoutMs = options.timeoutMs ?? ASK_POLL_TIMEOUT_MS;
742
- const maxTransientFailures = options.maxTransientFailures ?? ASK_MAX_TRANSIENT_POLL_FAILURES;
743
- const now = options.now ?? Date.now;
744
- const sleep = options.sleep ?? ((ms) => new Promise((resolve2) => setTimeout(resolve2, ms)));
745
- const startTime = now();
746
- let transientFailures = 0;
747
- while (true) {
748
- const elapsed = now() - startTime;
749
- if (elapsed > timeoutMs) {
750
- throw new Error(
751
- `Ask execution timeout after ${Math.floor(elapsed / 1e3)} seconds (executionId: ${executionId})`
752
- );
753
- }
754
- let response;
755
- try {
756
- response = await getStatus(executionId);
757
- transientFailures = 0;
758
- } catch (err) {
759
- if (!isTransientAskPollError(err) || ++transientFailures >= maxTransientFailures) {
760
- throw err;
761
- }
762
- await sleep(intervalMs);
763
- continue;
764
- }
765
- if (response.status !== "running") {
766
- return response;
767
- }
768
- await sleep(intervalMs);
769
- }
770
- }
771
- function transformCompletedResponse(response) {
772
- const result = {
773
- executionId: response.executionId,
774
- answer: response.answer ?? "",
775
- sources: response.sources ?? []
776
- };
777
- if (response.modelId !== void 0) result.modelId = response.modelId;
778
- if (response.modelUsage !== void 0) result.modelUsage = response.modelUsage;
779
- if (response.toolCallCount !== void 0) result.toolCallCount = response.toolCallCount;
780
- if (response.maxTurns !== void 0) result.maxTurns = response.maxTurns;
781
- return result;
782
- }
783
- function buildFailedMessage(response) {
784
- const type = response.error?.type || "unknown";
785
- const message = response.error?.message || "Ask execution failed";
786
- return `[${type}] ${message} (executionId: ${response.executionId})`;
787
- }
788
-
789
- // src/commands/te-kb/ask.ts
790
- var VALID_LOCALES = /* @__PURE__ */ new Set(["zh", "en", "ja", "ko"]);
791
- var MIN_QUESTION_LEN = 1;
792
- var MAX_QUESTION_LEN = 2e3;
793
- var MIN_MAX_TURNS = 1;
794
- var MAX_MAX_TURNS = 100;
795
- function validateQuestion(question) {
796
- const len = question.length;
797
- if (len < MIN_QUESTION_LEN || len > MAX_QUESTION_LEN) {
798
- throw new Error(
799
- `Invalid --question length: ${len}. Must be between ${MIN_QUESTION_LEN} and ${MAX_QUESTION_LEN} characters.`
800
- );
801
- }
802
- }
803
- function validateLocale(locale) {
804
- if (locale && !VALID_LOCALES.has(locale)) {
805
- throw new Error(`Invalid --locale: ${locale}. Must be one of: zh | en | ja | ko`);
806
- }
807
- }
808
- function validateMaxTurns(maxTurns) {
809
- if (maxTurns !== 0 && (maxTurns < MIN_MAX_TURNS || maxTurns > MAX_MAX_TURNS)) {
810
- throw new Error(
811
- `Invalid --max-turns: ${maxTurns}. Must be between ${MIN_MAX_TURNS} and ${MAX_MAX_TURNS}.`
812
- );
813
- }
814
- }
815
- function buildBody11(ctx) {
816
- const body = {
817
- question: ctx.str("question")
818
- };
819
- const sources = ctx.json("sources");
820
- if (sources) body.sources = sources;
821
- const modelId = ctx.str("model-id");
822
- if (modelId) body.modelId = modelId;
823
- const maxTurns = ctx.num("max-turns");
824
- if (maxTurns) body.maxTurns = maxTurns;
825
- const locale = ctx.str("locale");
826
- if (locale) body.locale = locale;
827
- return body;
828
- }
829
- var ask = {
830
- service: "kb",
831
- command: "+ask",
832
- description: "Ask knowledge bases via LLM-powered retrieval (POST /agent/api/external/knowledge-bases/ask). Consumes platform tokens. Prefer +index -> +grep -> +read for deterministic, token-free lookup. By default, polls for completion; use --no-wait to return immediately with executionId.",
833
- flags: [
834
- {
835
- name: "question",
836
- type: "string",
837
- required: true,
838
- alias: "q",
839
- desc: "Natural-language question (1-2000 characters). Required."
840
- },
841
- {
842
- name: "sources",
843
- type: "json",
844
- required: false,
845
- desc: 'Optional JSON array of knowledge base refs to scope the search, e.g. [{"scope":"company","name":"engineering-handbook"}]. Omit to search all accessible knowledge bases.'
846
- },
847
- {
848
- name: "model-id",
849
- type: "string",
850
- required: false,
851
- desc: "Optional LLM model ID (e.g. claude-sonnet-4-6). Omit to use the platform default model."
852
- },
853
- {
854
- name: "max-turns",
855
- type: "number",
856
- required: false,
857
- desc: "Optional agent turn limit (1-100, default 50 on server when omitted)."
858
- },
859
- { name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" },
860
- {
861
- name: "no-wait",
862
- type: "boolean",
863
- required: false,
864
- desc: "Return immediately after submission with executionId, without polling for completion."
865
- }
866
- ],
867
- risk: "read",
868
- validate: (ctx) => {
869
- validateQuestion(ctx.str("question"));
870
- validateLocale(ctx.str("locale"));
871
- validateMaxTurns(ctx.num("max-turns"));
872
- },
873
- dryRun: (ctx) => ({
874
- method: "POST",
875
- url: `${ctx.host().replace(/\/$/, "")}${ASK_API_PATH}`,
876
- body: buildBody11(ctx)
877
- }),
878
- execute: async (ctx) => {
879
- const noWait = ctx.bool("no-wait");
880
- const submitResponse = await kbApi(ctx, "POST", ASK_API_PATH, {}, buildBody11(ctx));
881
- if (!submitResponse.executionId) {
882
- throw new Error("Invalid submit response: missing executionId");
883
- }
884
- const executionId = submitResponse.executionId;
885
- if (noWait) {
886
- return {
887
- executionId,
888
- status: submitResponse.status
889
- };
890
- }
891
- const finalResponse = await pollUntilSettled(
892
- (id) => kbApi(ctx, "GET", ASK_API_PATH, { executionId: id }),
893
- executionId
894
- );
895
- if (finalResponse.status === "completed") {
896
- return transformCompletedResponse(finalResponse);
897
- }
898
- if (finalResponse.status === "failed") {
899
- throw new Error(buildFailedMessage(finalResponse));
900
- }
901
- throw new Error(`Unexpected execution status: ${finalResponse.status}`);
902
- }
903
- };
904
-
905
- // src/commands/te-kb/ask-status.ts
906
- var MAX_EXECUTION_ID_LEN = 64;
907
- function executionIdFrom(ctx) {
908
- return ctx.str("execution-id").trim();
909
- }
910
- var askStatus = {
911
- service: "kb",
912
- command: "+ask-status",
913
- description: "Query the status of an in-progress or completed knowledge base ask execution (GET /agent/api/external/knowledge-bases/ask?executionId=<id>). Does not poll; returns the current state.",
914
- flags: [
915
- {
916
- name: "execution-id",
917
- type: "string",
918
- required: true,
919
- minLength: 1,
920
- maxLength: MAX_EXECUTION_ID_LEN,
921
- desc: "The execution ID returned by kb +ask submission."
922
- }
923
- ],
924
- risk: "read",
925
- validate: (ctx) => {
926
- const executionId = executionIdFrom(ctx);
927
- if (!executionId) {
928
- throw new Error("Invalid --execution-id: must be non-empty.");
929
- }
930
- if (executionId.length > MAX_EXECUTION_ID_LEN) {
931
- throw new Error(
932
- `Invalid --execution-id length: ${executionId.length}. Must be at most ${MAX_EXECUTION_ID_LEN} characters.`
933
- );
934
- }
935
- },
936
- dryRun: (ctx) => ({
937
- method: "GET",
938
- url: `${ctx.host().replace(/\/$/, "")}${ASK_API_PATH}?executionId=${encodeURIComponent(executionIdFrom(ctx))}`
939
- }),
940
- execute: async (ctx) => {
941
- const executionId = executionIdFrom(ctx);
942
- return await kbApi(ctx, "GET", ASK_API_PATH, { executionId });
943
- }
944
- };
945
-
946
- // src/commands/te-kb/url.ts
947
- var API_PATH13 = "/agent/api/external/knowledge-bases/sources/url";
948
- function validateUrl(url2) {
949
- if (!/^https?:\/\//i.test(url2)) {
950
- throw new Error(`Invalid --url: ${url2}. Must be an http(s) URL`);
951
- }
952
- }
953
- function buildBody12(ctx) {
954
- const body = {
955
- name: ctx.str("name"),
956
- url: ctx.str("url")
957
- };
958
- const displayName = ctx.str("display-name");
959
- if (displayName) body.displayName = displayName;
960
- const parseInstruction = ctx.str("parse-instruction");
961
- if (parseInstruction) body.parseInstruction = parseInstruction;
962
- return body;
963
- }
964
- var url = {
965
- service: "kb",
966
- command: "+url",
967
- description: "Upload a URL source to a knowledge base.",
968
- flags: [
969
- { name: "name", type: "string", required: true, desc: "Knowledge base name" },
970
- { name: "url", type: "string", required: true, desc: "Source URL to upload" },
971
- { name: "display-name", type: "string", required: false, desc: "Optional display name for the URL source" },
972
- { name: "parse-instruction", type: "string", required: false, desc: "Optional parsing instruction for the URL source; ignored for Lark/Feishu doc URLs (the server applies its own Feishu parsing)" }
973
- ],
974
- risk: "write",
975
- validate: (ctx) => {
976
- validateUrl(ctx.str("url"));
977
- },
978
- dryRun: (ctx) => ({
979
- method: "POST",
980
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH13}`,
981
- body: buildBody12(ctx)
982
- }),
983
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH13, {}, buildBody12(ctx))
984
- };
985
-
986
- // src/commands/te-kb/import.ts
987
- import { promises as fs2 } from "fs";
988
- import path2 from "path";
989
- var API_PATH14 = "/agent/api/external/knowledge-bases/import";
990
- var MAX_SNAPSHOT_ARCHIVE_BYTES = 50 * 1024 * 1024;
991
- function normalizeTags2(raw) {
992
- if (raw === void 0 || raw === null) return [];
993
- if (!Array.isArray(raw)) {
994
- throw new Error(
995
- `--tags must be a JSON array of strings, e.g. '["docs","product"]'`
996
- );
997
- }
998
- const tags = [];
999
- for (const value of raw) {
1000
- if (typeof value !== "string") {
1001
- throw new Error(
1002
- `--tags entries must be strings (got: ${JSON.stringify(value)})`
1003
- );
1004
- }
1005
- const tag = value.trim();
1006
- if (tag && !tags.includes(tag)) tags.push(tag);
1007
- }
1008
- if (tags.length > 2) throw new Error("--tags accepts at most 2 unique tags");
1009
- if (tags.some((tag) => tag.length > 15)) {
1010
- throw new Error("--tags entries must be at most 15 characters");
1011
- }
1012
- return tags;
1013
- }
1014
- function validateArchivePath(filePath) {
1015
- if (path2.extname(filePath).toLocaleLowerCase("en-US") !== ".zip") {
1016
- throw new Error("--file must point to a .zip archive");
1017
- }
1018
- }
1019
- async function readArchive(filePath) {
1020
- validateArchivePath(filePath);
1021
- const absolutePath = path2.resolve(filePath);
1022
- let stat;
1023
- try {
1024
- stat = await fs2.stat(absolutePath);
1025
- } catch {
1026
- throw new Error(`File not found: ${filePath}`);
1027
- }
1028
- if (!stat.isFile())
1029
- throw new Error(`--file must point to a file: ${filePath}`);
1030
- if (stat.size === 0) throw new Error(`ZIP archive is empty: ${filePath}`);
1031
- if (stat.size > MAX_SNAPSHOT_ARCHIVE_BYTES) {
1032
- throw new Error("--file must not exceed 50 MB");
1033
- }
1034
- return { absolutePath, bytes: await fs2.readFile(absolutePath) };
1035
- }
1036
- function appendOptionalFields(ctx, form) {
1037
- const description = ctx.str("description").trim();
1038
- if (description) form.append("description", description);
1039
- for (const tag of normalizeTags2(ctx.json("tags"))) form.append("tags", tag);
1040
- const projectId = ctx.str("project-id").trim();
1041
- if (projectId) form.append("projectId", projectId);
1042
- }
1043
- var importSnapshot = {
1044
- service: "kb",
1045
- command: "+import",
1046
- description: "Import a compiled Markdown ZIP snapshot as a personal read-only knowledge base.",
1047
- flags: [
1048
- {
1049
- name: "file",
1050
- type: "string",
1051
- required: true,
1052
- desc: "Local .zip snapshot containing root index.md and wiki/**/*.md"
1053
- },
1054
- {
1055
- name: "name",
1056
- type: "string",
1057
- required: true,
1058
- maxLength: 30,
1059
- desc: "Personal knowledge base name (max 30 characters)"
1060
- },
1061
- {
1062
- name: "description",
1063
- type: "string",
1064
- required: false,
1065
- maxLength: 200,
1066
- desc: "Optional description (max 200 characters)"
1067
- },
1068
- {
1069
- name: "tags",
1070
- type: "json",
1071
- required: false,
1072
- desc: "Optional JSON array of tags (max 2, each max 15 characters)"
1073
- },
1074
- {
1075
- name: "project-id",
1076
- type: "string",
1077
- required: false,
1078
- maxLength: 128,
1079
- desc: "Optional project ID to bind"
1080
- }
1081
- ],
1082
- risk: "write",
1083
- validate: (ctx) => {
1084
- validateArchivePath(ctx.str("file"));
1085
- normalizeTags2(ctx.json("tags"));
1086
- },
1087
- execute: async (ctx) => {
1088
- const archive = await readArchive(ctx.str("file"));
1089
- const form = new FormData();
1090
- form.append(
1091
- "file",
1092
- new Blob([Uint8Array.from(archive.bytes)], { type: "application/zip" }),
1093
- path2.basename(archive.absolutePath)
1094
- );
1095
- form.append("name", ctx.str("name").trim());
1096
- appendOptionalFields(ctx, form);
1097
- try {
1098
- return await kbUpload(
1099
- ctx,
1100
- API_PATH14,
1101
- form,
1102
- {},
1103
- { preserveErrorMetadata: true, retryUnauthorized: true }
1104
- );
1105
- } catch (error) {
1106
- const hint = "If a requestId was returned, run ae-cli kb +import-status --request-id <requestId>; otherwise run ae-cli kb +list before retrying the same name.";
1107
- if (error instanceof CapabilityGatewayError) {
1108
- throw new CapabilityGatewayError(
1109
- `${error.message} ${hint}`,
1110
- error.code,
1111
- error.httpStatus,
1112
- error.hint ?? hint,
1113
- error.meta
1114
- );
1115
- }
1116
- if (error instanceof Error) {
1117
- error.message = `${error.message} ${hint}`;
1118
- throw error;
1119
- }
1120
- throw new Error(`${String(error)} ${hint}`);
1121
- }
1122
- }
1123
- };
1124
-
1125
- // src/commands/te-kb/import-status.ts
1126
- var API_PATH15 = "/agent/api/external/knowledge-bases/import";
1127
- var MAX_REQUEST_ID_LENGTH = 191;
1128
- function requestIdFrom(ctx) {
1129
- return ctx.str("request-id").trim();
1130
- }
1131
- var importStatus = {
1132
- service: "kb",
1133
- command: "+import-status",
1134
- description: "Query one asynchronous knowledge-base snapshot import by its request ID without polling.",
1135
- flags: [
1136
- {
1137
- name: "request-id",
1138
- type: "string",
1139
- required: true,
1140
- minLength: 1,
1141
- maxLength: MAX_REQUEST_ID_LENGTH,
1142
- desc: "The requestId returned by kb +import."
1143
- }
1144
- ],
1145
- risk: "read",
1146
- validate: (ctx) => {
1147
- const requestId = requestIdFrom(ctx);
1148
- if (!requestId) throw new Error("Invalid --request-id: must be non-empty.");
1149
- if (requestId.length > MAX_REQUEST_ID_LENGTH) {
1150
- throw new Error(
1151
- `Invalid --request-id length: ${requestId.length}. Must be at most ${MAX_REQUEST_ID_LENGTH} characters.`
1152
- );
1153
- }
1154
- },
1155
- dryRun: (ctx) => ({
1156
- method: "GET",
1157
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH15}?requestId=${encodeURIComponent(requestIdFrom(ctx))}`
1158
- }),
1159
- execute: async (ctx) => {
1160
- try {
1161
- return await kbApi(
1162
- ctx,
1163
- "GET",
1164
- API_PATH15,
1165
- { requestId: requestIdFrom(ctx) },
1166
- void 0,
1167
- { preserveErrorMetadata: true, retryUnauthorized: true }
1168
- );
1169
- } catch (error) {
1170
- if (!(error instanceof CapabilityGatewayError) || error.hint) throw error;
1171
- throw new CapabilityGatewayError(
1172
- error.message,
1173
- error.code,
1174
- error.httpStatus,
1175
- "Verify the request ID and that the server supports kb +import-status. Do not retry the import until its status is known.",
1176
- error.meta
1177
- );
1178
- }
1179
- }
1180
- };
1181
-
1182
- // src/commands/te-kb/index.ts
1183
- var commands = [
1184
- ask,
1185
- askStatus,
1186
- add,
1187
- url,
1188
- compile,
1189
- remove,
1190
- create,
1191
- listSources,
1192
- rmSource,
1193
- schema,
1194
- status,
1195
- kbList,
1196
- kbIndex,
1197
- kbGrep,
1198
- kbRead,
1199
- importSnapshot,
1200
- importStatus
1201
- ];
1202
- var te_kb_default = commands;
1203
- export {
1204
- add,
1205
- ask,
1206
- askStatus,
1207
- compile,
1208
- create,
1209
- te_kb_default as default,
1210
- importSnapshot,
1211
- importStatus,
1212
- kbGrep,
1213
- kbIndex,
1214
- kbList,
1215
- kbRead,
1216
- listSources,
1217
- remove,
1218
- rmSource,
1219
- schema,
1220
- status,
1221
- url
1222
- };