@thinkingai/ae-cli 6.1.20 → 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 (338) hide show
  1. package/README.md +2 -1
  2. package/README.zh.md +2 -1
  3. package/dist/{auth-FUM37MHF.js → auth-XZNXFRJS.js} +5 -5
  4. package/dist/{capability-AXFQW5WM.js → capability-FYTU3X6L.js} +42 -12
  5. package/dist/{chunk-LNZBEQXW.js → chunk-4NRCTUZJ.js} +27041 -474
  6. package/dist/{chunk-VXNMYUXU.js → chunk-57RRFUEZ.js} +23 -7
  7. package/dist/{chunk-WZ6YVQSF.js → chunk-7FTTULED.js} +1 -1
  8. package/dist/{chunk-ATSM5XAW.js → chunk-7XGFSUOM.js} +2 -2
  9. package/dist/chunk-CCS66K4K.js +155 -0
  10. package/dist/{chunk-I4WQAEYB.js → chunk-DVMLWQD4.js} +8 -186
  11. package/dist/{chunk-CZU3V3DQ.js → chunk-DX5CDO34.js} +27 -6
  12. package/dist/chunk-EQ255HKO.js +38248 -0
  13. package/dist/{chunk-BBEFP4SB.js → chunk-HBGADCKA.js} +3 -3
  14. package/dist/{chunk-QJQZH5GQ.js → chunk-HFGZGYCG.js} +10 -6
  15. package/dist/{chunk-ECBLHAZO.js → chunk-JOCDD4ON.js} +1 -1
  16. package/dist/{chunk-TKHSULJT.js → chunk-KPQY44JQ.js} +6 -0
  17. package/dist/{chunk-4P355ZWB.js → chunk-MAPZ7VB6.js} +21 -1
  18. package/dist/chunk-V2NUHPXF.js +196 -0
  19. package/dist/{chunk-RSG4ONOI.js → chunk-VYXXOKYS.js} +5 -5
  20. package/dist/{community-report-client-XXWGSBSD.js → community-report-client-CU22W53K.js} +1 -1
  21. package/dist/{config-EXUGQN5T.js → config-XO3LI3SA.js} +4 -4
  22. package/dist/context-IFJI3LIT.js +46 -0
  23. package/dist/{data-integration-4NZ53OMT.js → data-integration-HNGUKFIC.js} +44 -35
  24. package/dist/index.js +101 -64
  25. package/dist/{local-data-upload-client-KYOKVYZV.js → local-data-upload-client-GTRIT64F.js} +3 -2
  26. package/dist/{memory-ATNKZNW5.js → memory-QGPSNCQS.js} +4 -4
  27. package/dist/{metadata-VZVC7YMH.js → metadata-DI5BMYFU.js} +8 -8
  28. package/dist/{model-E4JMQ4V2.js → model-RNPQXIBI.js} +4 -4
  29. package/dist/{personal-semantic-preference-7S2SQ3UV.js → personal-semantic-preference-5C3WUXFI.js} +11 -8
  30. package/dist/{project-semantic-2SZP2OPO.js → project-semantic-3LF6Q6JZ.js} +27 -21
  31. package/dist/{sync-YV3E66IF.js → sync-O45NXEQY.js} +7 -6
  32. package/dist/{te-agent-JB5T3PO7.js → te-agent-K5MSPNHJ.js} +5 -5
  33. package/dist/{te-analysis-3YJAAT2D.js → te-analysis-AISWCOOZ.js} +1086 -354
  34. package/dist/{te-community-UDBI672N.js → te-community-4OYU3BDA.js} +4 -4
  35. package/dist/{te-dataops-ZLYOCXZ4.js → te-dataops-NFIPB6FX.js} +5 -5
  36. package/dist/{te-engage-4XG6OJML.js → te-engage-BAM3GBFX.js} +7 -7
  37. package/dist/{te-experiment-VXUWPINJ.js → te-experiment-GUTZXZ5Z.js} +132 -14
  38. package/dist/{te-kb-WYQWHFSC.js → te-kb-3TS73NO6.js} +454 -194
  39. package/dist/{te-system-7G6F2LJA.js → te-system-STMHLS5J.js} +12 -7
  40. package/dist/{te-team-E7FBBXMQ.js → te-team-3I5AOX3N.js} +6 -6
  41. package/dist/{update-D47BUG25.js → update-RZXLPCRH.js} +4 -4
  42. package/package.json +21 -14
  43. package/skills/ae-analysis/SKILL.md +91 -78
  44. package/skills/ae-analysis/references/adhoc_export.md +11 -18
  45. package/skills/ae-analysis/references/adhoc_run.md +15 -7
  46. package/skills/ae-analysis/references/agent_review_detail.md +11 -0
  47. package/skills/ae-analysis/references/agent_review_evidence.md +46 -0
  48. package/skills/ae-analysis/references/agent_review_list.md +9 -0
  49. package/skills/ae-analysis/references/agent_review_preflight.md +96 -0
  50. package/skills/ae-analysis/references/agent_review_priorities_comparisons.md +76 -0
  51. package/skills/ae-analysis/references/agent_review_records.md +9 -0
  52. package/skills/ae-analysis/references/agent_review_retry.md +12 -0
  53. package/skills/ae-analysis/references/agent_review_review.md +16 -0
  54. package/skills/ae-analysis/references/agent_review_submit_to_page.md +184 -0
  55. package/skills/ae-analysis/references/ai_models/attribution.md +29 -0
  56. package/skills/ae-analysis/references/ai_models/distribution.md +40 -0
  57. package/skills/ae-analysis/references/ai_models/event.md +108 -0
  58. package/skills/ae-analysis/references/ai_models/funnel.md +46 -0
  59. package/skills/ae-analysis/references/ai_models/heat_map.md +26 -0
  60. package/skills/ae-analysis/references/ai_models/interval.md +20 -0
  61. package/skills/ae-analysis/references/ai_models/path.md +38 -0
  62. package/skills/ae-analysis/references/ai_models/prop_analysis.md +39 -0
  63. package/skills/ae-analysis/references/ai_models/rank_list.md +25 -0
  64. package/skills/ae-analysis/references/ai_models/retention.md +70 -0
  65. package/skills/ae-analysis/references/ai_models/revenue.md +28 -0
  66. package/skills/ae-analysis/references/ai_models/sql.md +74 -0
  67. package/skills/ae-analysis/references/ai_models/tag.md +19 -0
  68. package/skills/ae-analysis/references/ai_models.md +32 -473
  69. package/skills/ae-analysis/references/alert_create.md +7 -7
  70. package/skills/ae-analysis/references/alert_delete.md +4 -6
  71. package/skills/ae-analysis/references/alert_detail_list.md +7 -9
  72. package/skills/ae-analysis/references/alert_get.md +5 -7
  73. package/skills/ae-analysis/references/alert_job_list.md +4 -6
  74. package/skills/ae-analysis/references/alert_list.md +6 -8
  75. package/skills/ae-analysis/references/alert_notice_config_list.md +4 -6
  76. package/skills/ae-analysis/references/alert_start.md +5 -7
  77. package/skills/ae-analysis/references/alert_stop.md +5 -7
  78. package/skills/ae-analysis/references/alert_update.md +8 -8
  79. package/skills/ae-analysis/references/analysis_data_export.md +72 -0
  80. package/skills/ae-analysis/references/analysis_data_retrieval.md +32 -196
  81. package/skills/ae-analysis/references/analysis_gateway_assets.md +23 -180
  82. package/skills/ae-analysis/references/analysis_interpretation.md +37 -17
  83. package/skills/ae-analysis/references/asset_abnormal_get.md +0 -1
  84. package/skills/ae-analysis/references/asset_abnormal_list.md +0 -1
  85. package/skills/ae-analysis/references/asset_authentication_export.md +4 -0
  86. package/skills/ae-analysis/references/asset_authentication_list.md +7 -1
  87. package/skills/ae-analysis/references/asset_authentication_update.md +5 -1
  88. package/skills/ae-analysis/references/asset_batch_dashboard_schedule_freeze.md +8 -6
  89. package/skills/ae-analysis/references/asset_batch_delete.md +6 -6
  90. package/skills/ae-analysis/references/asset_batch_disable_auto_backup.md +4 -5
  91. package/skills/ae-analysis/references/asset_batch_disable_auto_update.md +5 -6
  92. package/skills/ae-analysis/references/asset_batch_handover.md +4 -5
  93. package/skills/ae-analysis/references/asset_batch_info_export.md +4 -5
  94. package/skills/ae-analysis/references/asset_batch_sql_export.md +5 -6
  95. package/skills/ae-analysis/references/asset_dependency_list.md +4 -5
  96. package/skills/ae-analysis/references/asset_export.md +4 -5
  97. package/skills/ae-analysis/references/asset_impact_list.md +5 -9
  98. package/skills/ae-analysis/references/asset_lineage_get.md +5 -6
  99. package/skills/ae-analysis/references/asset_list.md +4 -5
  100. package/skills/ae-analysis/references/asset_query_history_list.md +4 -8
  101. package/skills/ae-analysis/references/asset_recent_list.md +0 -1
  102. package/skills/ae-analysis/references/asset_search.md +12 -9
  103. package/skills/ae-analysis/references/asset_url_get.md +3 -4
  104. package/skills/ae-analysis/references/bi_panel_copy.md +2 -2
  105. package/skills/ae-analysis/references/bi_panel_page_data_export.md +4 -12
  106. package/skills/ae-analysis/references/bi_panel_page_data_run.md +2 -0
  107. package/skills/ae-analysis/references/catalog_export.md +4 -17
  108. package/skills/ae-analysis/references/catalog_list.md +4 -4
  109. package/skills/ae-analysis/references/check_delete.md +5 -7
  110. package/skills/ae-analysis/references/check_export.md +11 -11
  111. package/skills/ae-analysis/references/check_get.md +8 -10
  112. package/skills/ae-analysis/references/check_list.md +4 -6
  113. package/skills/ae-analysis/references/check_retry.md +8 -10
  114. package/skills/ae-analysis/references/check_run.md +2 -4
  115. package/skills/ae-analysis/references/command_index.md +44 -26
  116. package/skills/ae-analysis/references/dashboard_report_data_export.md +5 -13
  117. package/skills/ae-analysis/references/dashboard_report_data_run.md +1 -1
  118. package/skills/ae-analysis/references/dashboard_update.md +14 -3
  119. package/skills/ae-analysis/references/datatable_columns_get.md +0 -1
  120. package/skills/ae-analysis/references/datatable_influence_list.md +0 -1
  121. package/skills/ae-analysis/references/datatable_version_get.md +0 -1
  122. package/skills/ae-analysis/references/datatable_version_list.md +0 -1
  123. package/skills/ae-analysis/references/debug_device_add.md +1 -2
  124. package/skills/ae-analysis/references/drilldown_entities_export.md +3 -3
  125. package/skills/ae-analysis/references/drilldown_events_export.md +3 -2
  126. package/skills/ae-analysis/references/drilldown_user_events_export.md +2 -2
  127. package/skills/ae-analysis/references/entity_detail_export.md +3 -2
  128. package/skills/ae-analysis/references/entity_detail_run.md +1 -0
  129. package/skills/ae-analysis/references/event_blacklist_add.md +5 -7
  130. package/skills/ae-analysis/references/event_blacklist_list.md +4 -6
  131. package/skills/ae-analysis/references/event_blacklist_update.md +6 -8
  132. package/skills/ae-analysis/references/event_changelog_list.md +0 -1
  133. package/skills/ae-analysis/references/event_create.md +0 -1
  134. package/skills/ae-analysis/references/event_detail_export.md +3 -2
  135. package/skills/ae-analysis/references/event_detail_run.md +1 -0
  136. package/skills/ae-analysis/references/event_export.md +0 -1
  137. package/skills/ae-analysis/references/event_get.md +0 -1
  138. package/skills/ae-analysis/references/event_hide_update.md +0 -1
  139. package/skills/ae-analysis/references/event_influence_list.md +0 -1
  140. package/skills/ae-analysis/references/event_list.md +0 -1
  141. package/skills/ae-analysis/references/event_property_bundle_export.md +5 -14
  142. package/skills/ae-analysis/references/event_property_bundle_import.md +2 -6
  143. package/skills/ae-analysis/references/event_relation_update.md +0 -1
  144. package/skills/ae-analysis/references/event_update.md +0 -1
  145. package/skills/ae-analysis/references/exchange_config_update.md +0 -1
  146. package/skills/ae-analysis/references/exchange_rate_refresh.md +0 -1
  147. package/skills/ae-analysis/references/exchange_rule_list.md +0 -1
  148. package/skills/ae-analysis/references/exchange_rule_update.md +0 -1
  149. package/skills/ae-analysis/references/exchange_rule_validate.md +0 -1
  150. package/skills/ae-analysis/references/governance_recommendation_decisions.md +23 -0
  151. package/skills/ae-analysis/references/governance_recommendation_export.md +108 -0
  152. package/skills/ae-analysis/references/governance_recommendation_submit.md +41 -0
  153. package/skills/ae-analysis/references/history_tag_data_drilldown_export.md +4 -4
  154. package/skills/ae-analysis/references/history_tag_data_export.md +3 -3
  155. package/skills/ae-analysis/references/ingest_error_list.md +7 -9
  156. package/skills/ae-analysis/references/ingest_summary.md +6 -8
  157. package/skills/ae-analysis/references/live_data_export.md +10 -10
  158. package/skills/ae-analysis/references/live_data_list.md +7 -9
  159. package/skills/ae-analysis/references/metadata_resolution.md +78 -0
  160. package/skills/ae-analysis/references/metric_export.md +0 -1
  161. package/skills/ae-analysis/references/metric_get.md +0 -1
  162. package/skills/ae-analysis/references/metric_list.md +4 -5
  163. package/skills/ae-analysis/references/metric_update.md +0 -1
  164. package/skills/ae-analysis/references/operation_record_export.md +4 -5
  165. package/skills/ae-analysis/references/operation_record_list.md +4 -5
  166. package/skills/ae-analysis/references/personal_semantic_preference_list.md +18 -1
  167. package/skills/ae-analysis/references/plan_change_log_export.md +10 -10
  168. package/skills/ae-analysis/references/plan_change_log_list.md +4 -6
  169. package/skills/ae-analysis/references/plan_delete_items.md +2 -4
  170. package/skills/ae-analysis/references/plan_export.md +9 -9
  171. package/skills/ae-analysis/references/plan_generate.md +2 -4
  172. package/skills/ae-analysis/references/plan_get.md +4 -6
  173. package/skills/ae-analysis/references/plan_import_excel.md +6 -8
  174. package/skills/ae-analysis/references/plan_save_items.md +2 -4
  175. package/skills/ae-analysis/references/plan_sync_from_meta.md +4 -6
  176. package/skills/ae-analysis/references/project_access_detail_get.md +0 -1
  177. package/skills/ae-analysis/references/project_data_power_get.md +0 -1
  178. package/skills/ae-analysis/references/project_data_power_list.md +0 -1
  179. package/skills/ae-analysis/references/project_data_power_upsert.md +0 -1
  180. package/skills/ae-analysis/references/project_entity_create.md +0 -1
  181. package/skills/ae-analysis/references/project_entity_event_list.md +0 -1
  182. package/skills/ae-analysis/references/project_entity_get.md +0 -1
  183. package/skills/ae-analysis/references/project_entity_list.md +0 -1
  184. package/skills/ae-analysis/references/project_entity_update.md +0 -1
  185. package/skills/ae-analysis/references/project_function_list.md +0 -1
  186. package/skills/ae-analysis/references/project_info_get.md +0 -1
  187. package/skills/ae-analysis/references/project_info_list.md +0 -1
  188. package/skills/ae-analysis/references/project_info_update.md +0 -1
  189. package/skills/ae-analysis/references/project_mark_time_create.md +0 -1
  190. package/skills/ae-analysis/references/project_mark_time_list.md +0 -1
  191. package/skills/ae-analysis/references/project_mark_time_update.md +0 -1
  192. package/skills/ae-analysis/references/project_member_add.md +6 -5
  193. package/skills/ae-analysis/references/project_member_batch_update.md +0 -1
  194. package/skills/ae-analysis/references/project_member_candidate_list.md +4 -3
  195. package/skills/ae-analysis/references/project_member_handover_run.md +2 -3
  196. package/skills/ae-analysis/references/project_member_list.md +0 -1
  197. package/skills/ae-analysis/references/project_member_receiver_list.md +0 -1
  198. package/skills/ae-analysis/references/project_member_update.md +0 -1
  199. package/skills/ae-analysis/references/project_owner_update.md +0 -1
  200. package/skills/ae-analysis/references/project_permission_binding_list.md +0 -1
  201. package/skills/ae-analysis/references/project_role_function_list.md +0 -1
  202. package/skills/ae-analysis/references/project_role_get.md +0 -1
  203. package/skills/ae-analysis/references/project_role_list.md +0 -1
  204. package/skills/ae-analysis/references/project_role_upsert.md +32 -2
  205. package/skills/ae-analysis/references/project_role_user_list.md +0 -1
  206. package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +214 -0
  207. package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +93 -0
  208. package/skills/ae-analysis/references/project_timezone_get.md +0 -1
  209. package/skills/ae-analysis/references/project_timezone_overview.md +0 -1
  210. package/skills/ae-analysis/references/project_timezone_update.md +0 -1
  211. package/skills/ae-analysis/references/project_user_id_items_update.md +0 -1
  212. package/skills/ae-analysis/references/property_changelog_list.md +0 -1
  213. package/skills/ae-analysis/references/property_create.md +0 -1
  214. package/skills/ae-analysis/references/property_export.md +0 -1
  215. package/skills/ae-analysis/references/property_get.md +0 -1
  216. package/skills/ae-analysis/references/property_hide_update.md +0 -1
  217. package/skills/ae-analysis/references/property_influence_list.md +0 -1
  218. package/skills/ae-analysis/references/property_list.md +3 -4
  219. package/skills/ae-analysis/references/property_related_events.md +0 -1
  220. package/skills/ae-analysis/references/property_relation_update.md +0 -1
  221. package/skills/ae-analysis/references/property_update.md +0 -1
  222. package/skills/ae-analysis/references/report_create.md +4 -2
  223. package/skills/ae-analysis/references/report_data_export.md +11 -9
  224. package/skills/ae-analysis/references/report_data_run.md +14 -7
  225. package/skills/ae-analysis/references/report_get.md +5 -3
  226. package/skills/ae-analysis/references/report_list.md +2 -0
  227. package/skills/ae-analysis/references/report_update.md +5 -3
  228. package/skills/ae-analysis/references/rule_create.md +5 -6
  229. package/skills/ae-analysis/references/rule_delete.md +5 -5
  230. package/skills/ae-analysis/references/rule_list.md +3 -4
  231. package/skills/ae-analysis/references/rule_schema.md +3 -4
  232. package/skills/ae-analysis/references/rule_update.md +5 -6
  233. package/skills/ae-analysis/references/sdk_sample_generate.md +2 -4
  234. package/skills/ae-analysis/references/sql_table_columns.md +1 -1
  235. package/skills/ae-analysis/references/super_metadata_batch_create.md +1 -1
  236. package/skills/ae-analysis/references/super_metadata_batch_edit.md +1 -1
  237. package/skills/ae-analysis/references/system_member_add.md +1 -2
  238. package/skills/ae-analysis/references/system_member_status_update.md +1 -1
  239. package/skills/ae-analysis/references/system_ops_alert_contact_list.md +1 -1
  240. package/skills/ae-analysis/references/system_ops_alert_contact_test.md +0 -1
  241. package/skills/ae-analysis/references/system_query_monitor_overview.md +3 -3
  242. package/skills/ae-analysis/references/system_query_task_export.md +4 -14
  243. package/skills/ae-analysis/references/system_query_task_get.md +1 -1
  244. package/skills/ae-analysis/references/system_query_task_list.md +5 -6
  245. package/skills/ae-analysis/references/system_receiver_address_upsert.md +3 -3
  246. package/skills/ae-analysis/references/system_receiver_detection_get.md +1 -1
  247. package/skills/ae-analysis/references/system_third_party_login_disable.md +1 -1
  248. package/skills/ae-analysis/references/system_usage_trend_export.md +3 -12
  249. package/skills/ae-analysis/references/user_cluster_list.md +1 -1
  250. package/skills/ae-analysis/references/user_cluster_member_export.md +4 -4
  251. package/skills/ae-analysis/references/user_tag_list.md +1 -1
  252. package/skills/ae-analysis/references/user_tag_member_export.md +4 -4
  253. package/skills/ae-analysis/references/virtual_event_create.md +10 -5
  254. package/skills/ae-analysis/references/virtual_event_get.md +0 -1
  255. package/skills/ae-analysis/references/virtual_property_create.md +0 -1
  256. package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +0 -1
  257. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +1054 -0
  258. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +112 -0
  259. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +30 -0
  260. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/generate-build-ir.mjs +2735 -0
  261. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/package-wiki-source-zip.mjs +376 -0
  262. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/plan-kb-source-sync.mjs +264 -0
  263. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/precompiled-source.mjs +49 -0
  264. package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/upload-kb-sources-concurrently.mjs +200 -0
  265. package/skills/ae-analysis/scripts/read_results.py +197 -0
  266. package/skills/ae-analysis-global/SKILL.md +1 -1
  267. package/skills/ae-capability/SKILL.md +1 -1
  268. package/skills/ae-community/SKILL.md +1 -1
  269. package/skills/ae-current-context/SKILL.md +53 -0
  270. package/skills/ae-data-integration/SKILL.md +5 -4
  271. package/skills/ae-data-integration/references/lark-bitable-source.md +288 -0
  272. package/skills/ae-data-integration/references/lark-sheet-source.md +130 -0
  273. package/skills/ae-data-integration/references/manual-export-source.md +83 -0
  274. package/skills/ae-data-integration/references/reuse.md +2 -0
  275. package/skills/ae-data-integration/references/sink-upload.md +32 -0
  276. package/skills/ae-data-integration/references/tracking-plan.md +4 -1
  277. package/skills/ae-data-integration/references/ue-mapping.md +2 -2
  278. package/skills/ae-data-integration-helper/SKILL.md +5 -5
  279. package/skills/ae-data-integration-helper/references/android_sdk_faq.md +3 -3
  280. package/skills/ae-data-integration-helper/references/c_sdk_faq.md +3 -3
  281. package/skills/ae-data-integration-helper/references/cocoscreator_sdk_faq.md +1 -1
  282. package/skills/ae-data-integration-helper/references/cpp_server_sdk_faq.md +3 -3
  283. package/skills/ae-data-integration-helper/references/ios_sdk_faq.md +1 -1
  284. package/skills/ae-data-integration-helper/references/java_sdk_faq.md +3 -3
  285. package/skills/ae-data-integration-helper/references/javascript_sdk_faq.md +1 -1
  286. package/skills/ae-data-integration-helper/references/logbus2_guide.md +1 -1
  287. package/skills/ae-data-integration-helper/references/logbus2_parser_plugin.md +2 -2
  288. package/skills/ae-data-integration-helper/references/minigame_sdk_faq.md +2 -2
  289. package/skills/ae-data-integration-helper/references/miniprogram_sdk_faq.md +1 -1
  290. package/skills/ae-data-integration-helper/references/python_sdk_faq.md +2 -2
  291. package/skills/ae-data-integration-helper/references/restful_api_notes.md +2 -2
  292. package/skills/ae-data-integration-helper/references/sdk_log_guide.md +3 -3
  293. package/skills/ae-data-integration-helper/references/sdk_usage_notes.md +11 -11
  294. package/skills/ae-data-integration-helper/references/unity_sdk_faq.md +1 -1
  295. package/skills/ae-dataops/SKILL.md +1 -1
  296. package/skills/ae-engage/SKILL.md +4 -3
  297. package/skills/ae-engage/references/build-task-save-guide.md +3 -0
  298. package/skills/ae-engage/references/flow-metric-update.md +115 -1
  299. package/skills/ae-engage/references/save-flow.md +3 -0
  300. package/skills/ae-engage/references/save-task.md +21 -0
  301. package/skills/ae-engage/references/task-metric-update.md +151 -0
  302. package/skills/ae-experiment/SKILL.md +14 -7
  303. package/skills/ae-experiment/references/save_submit_external_experiment.md +52 -0
  304. package/skills/ae-experiment-design/SKILL.md +3 -3
  305. package/skills/ae-experiment-design/references/platform-operations.md +1 -1
  306. package/skills/ae-experiment-insight/SKILL.md +2 -2
  307. package/skills/ae-experiment-insight/references/platform-operations.md +1 -1
  308. package/skills/ae-generate-tracking-code/SKILL.md +2 -1
  309. package/skills/ae-generate-tracking-code/references/client-sdk-insert.md +1 -1
  310. package/skills/ae-generate-tracking-code/references/datax-config.md +1 -1
  311. package/skills/ae-generate-tracking-code/references/logbus-config.md +1 -1
  312. package/skills/ae-generate-tracking-code/references/modes.md +1 -1
  313. package/skills/ae-generate-tracking-code/references/server-sdk-insert.md +5 -5
  314. package/skills/ae-generate-tracking-code/references/snippet-delivery.md +3 -3
  315. package/skills/ae-generate-tracking-plan/SKILL.md +2 -2
  316. package/skills/ae-generate-tracking-plan/references/te-api.md +1 -0
  317. package/skills/ae-generate-tracking-plan/references/xlsx-schema.md +3 -2
  318. package/skills/ae-kb/SKILL.md +41 -2
  319. package/skills/ae-kb/references/analysis-workflow.md +292 -0
  320. package/skills/ae-kb/references/source-mutations.md +95 -0
  321. package/skills/ae-kb-discovery/SKILL.md +5 -1
  322. package/skills/ae-metadata/SKILL.md +1 -1
  323. package/skills/ae-migrate-tracking-code/SKILL.md +195 -0
  324. package/skills/ae-migrate-tracking-code/references/ae-preset-properties.md +76 -0
  325. package/skills/ae-migrate-tracking-code/references/ir.md +167 -0
  326. package/skills/ae-migrate-tracking-code/references/mapping-framework.md +112 -0
  327. package/skills/ae-migrate-tracking-code/references/providers/README.md +58 -0
  328. package/skills/ae-migrate-tracking-code/references/providers/amplitude.md +208 -0
  329. package/skills/ae-migrate-tracking-code/references/providers/firebase.md +160 -0
  330. package/skills/ae-migrate-tracking-code/references/providers/ga4.md +92 -0
  331. package/skills/ae-migrate-tracking-code/references/providers/mixpanel.md +150 -0
  332. package/skills/ae-migrate-tracking-code/references/providers/sensors-data.md +146 -0
  333. package/skills/ae-project-semantic/SKILL.md +1 -1
  334. package/skills/ae-system/SKILL.md +4 -4
  335. package/skills/ae-team/SKILL.md +2 -2
  336. package/skills/ae-use-agent/references/local-agent.md +1 -1
  337. package/dist/chunk-TAL6CZH6.js +0 -72
  338. package/skills/ae-analysis/metadata_resolution.md +0 -184
@@ -2,28 +2,23 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  kbApi,
4
4
  kbUpload
5
- } from "./chunk-VXNMYUXU.js";
5
+ } from "./chunk-57RRFUEZ.js";
6
6
  import {
7
7
  TeAgentApiError
8
- } from "./chunk-BBEFP4SB.js";
8
+ } from "./chunk-HBGADCKA.js";
9
9
  import {
10
10
  CapabilityGatewayError
11
- } from "./chunk-QJQZH5GQ.js";
11
+ } from "./chunk-HFGZGYCG.js";
12
12
  import {
13
13
  printError
14
- } from "./chunk-CZU3V3DQ.js";
14
+ } from "./chunk-DX5CDO34.js";
15
15
  import "./chunk-Y74WTIKJ.js";
16
- import "./chunk-ATSM5XAW.js";
17
- import "./chunk-WZ6YVQSF.js";
16
+ import "./chunk-7XGFSUOM.js";
17
+ import "./chunk-7FTTULED.js";
18
18
  import {
19
19
  CliValidationError,
20
20
  PermissionError
21
- } from "./chunk-4P355ZWB.js";
22
-
23
- // src/commands/te-kb/add.ts
24
- import { promises as fs } from "fs";
25
- import * as path from "path";
26
- import TurndownService from "turndown";
21
+ } from "./chunk-MAPZ7VB6.js";
27
22
 
28
23
  // src/commands/te-kb/target-scope.ts
29
24
  function getExternalKnowledgeBaseTargetScope(ctx) {
@@ -35,8 +30,235 @@ function getExternalKnowledgeBaseTargetScope(ctx) {
35
30
  );
36
31
  }
37
32
 
33
+ // src/commands/te-kb/source-check-updates.ts
34
+ var API_PATH = "/agent/api/external/knowledge-bases/sources/check-updates";
35
+ function body(ctx) {
36
+ const scope = getExternalKnowledgeBaseTargetScope(ctx);
37
+ return { name: ctx.str("name").trim(), sourceId: ctx.str("id").trim(), ...scope ? { scope } : {} };
38
+ }
39
+ var sourceCheckUpdates = {
40
+ service: "kb",
41
+ resource: "source",
42
+ command: "check-updates",
43
+ risk: "write",
44
+ description: "Check one compiled Feishu URL source for updates using the scheduled detector. Marks changes without compiling. Existing pending changes are preserved; updated=0 does not prove identical content.",
45
+ flags: [
46
+ { name: "name", type: "string", required: true, minLength: 1, maxLength: 200, desc: "Knowledge base name" },
47
+ { name: "id", type: "string", required: true, minLength: 1, maxLength: 191, desc: "Stable Feishu source ID from kb +list-sources" },
48
+ { name: "scope", type: "string", desc: "Exact scope: personal | company (omit for personal then company lookup)" }
49
+ ],
50
+ validate: (ctx) => {
51
+ for (const [flag, max] of [["name", 200], ["id", 191]]) {
52
+ const value = ctx.str(flag).trim();
53
+ if (!value || value.length > max) throw new CliValidationError(`Invalid --${flag}: expected 1-${max} characters.`);
54
+ }
55
+ getExternalKnowledgeBaseTargetScope(ctx);
56
+ },
57
+ dryRun: (ctx) => ({ method: "POST", url: `${ctx.host().replace(/\/$/, "")}${API_PATH}`, body: body(ctx) }),
58
+ execute: async (ctx) => {
59
+ try {
60
+ return await kbApi(ctx, "POST", API_PATH, {}, body(ctx), { preserveErrorMetadata: true });
61
+ } catch (error) {
62
+ const hint = "Read kb +list-sources to confirm the current source state before retrying.";
63
+ if (error instanceof PermissionError) {
64
+ throw new PermissionError("Source write permission is required for this knowledge base.", error.code, "Request source write access; signing in again does not grant permission.");
65
+ }
66
+ if (error instanceof CapabilityGatewayError) {
67
+ const messages = {
68
+ INVALID_REQUEST: "Invalid source update-check parameters.",
69
+ KB_NOT_FOUND: "The knowledge base was not found or is not accessible.",
70
+ SOURCE_NOT_FOUND: "The source was not found in the selected knowledge base.",
71
+ SOURCE_NOT_FEISHU: "Only Feishu URL sources support update checks.",
72
+ SOURCE_NOT_COMPILED: "The source must finish compilation before checking for updates.",
73
+ SOURCE_CHECK_FAILED: "The Feishu source update check failed. Check server detection logs.",
74
+ SOURCE_CHECK_UNAVAILABLE: "The source changed or could not be selected for detection.",
75
+ SOURCE_CHECK_INTERNAL_ERROR: "The Feishu source update check could not complete."
76
+ };
77
+ throw new CapabilityGatewayError(messages[error.code ?? ""] ?? "The source update-check request failed.", error.code, error.httpStatus, hint, error.meta);
78
+ }
79
+ if (error instanceof Error && /[^\x00-\x7f]/.test(error.message)) {
80
+ error.message = "The source update-check request failed. Check credentials, rate limits and server logs.";
81
+ }
82
+ throw error;
83
+ }
84
+ }
85
+ };
86
+
87
+ // src/commands/te-kb/source-mutation.ts
88
+ import { promises as fs } from "fs";
89
+ import path from "path";
90
+ var API = "/agent/api/external/knowledge-bases";
91
+ var apiOptions = { preserveErrorMetadata: true };
92
+ var maxBytes = 50 * 1024 * 1024;
93
+ var fileExtensions = /* @__PURE__ */ new Set([".md", ".markdown", ".txt", ".csv", ".pdf", ".doc", ".docx", ".xls", ".xlsx", ".ppt", ".pptx", ".jpg", ".jpeg", ".png", ".gif", ".webp", ".bmp", ".svg"]);
94
+ var identityFlags = [
95
+ { name: "name", type: "string", required: true, desc: "Exact knowledge base name from kb +list" },
96
+ { name: "scope", type: "string", required: true, desc: "Exact knowledge base scope: personal or company" },
97
+ { name: "id", type: "string", required: true, desc: "Current stable source ID from kb +list-sources" }
98
+ ];
99
+ var typeFlag = { name: "source-type", type: "string", required: true, desc: "Current source type from kb +list-sources: file or zip" };
100
+ var revisionFlag = { name: "expected-revision", type: "number", required: true, min: 1, max: 2147483647, desc: "Current contentRevision from kb +list-sources; never automatically retry a conflict" };
101
+ var previewFlag = { name: "preview-id", type: "string", required: true, desc: "Exact previewId returned by ZIP replace or restore" };
102
+ function validateIdentity(ctx) {
103
+ for (const [flag, max] of [["name", 200], ["id", 191], ["preview-id", 191]]) {
104
+ const value = ctx.str(flag);
105
+ if ((flag !== "preview-id" || value) && (!value.trim() || value.length > max || /[\x00-\x1f\x7f]/.test(value))) {
106
+ throw new CliValidationError(`--${flag} must contain 1 to ${max} characters without control characters.`);
107
+ }
108
+ }
109
+ if (!["personal", "company"].includes(ctx.str("scope"))) throw new CliValidationError("--scope must be personal or company.");
110
+ }
111
+ function positiveInteger(ctx, flag) {
112
+ const value = ctx.num(flag);
113
+ if (!Number.isSafeInteger(value) || value < 1 || value > 2147483647) throw new CliValidationError(`--${flag} must be an integer from 1 to 2147483647.`);
114
+ }
115
+ function validateMutation(ctx) {
116
+ validateIdentity(ctx);
117
+ positiveInteger(ctx, "expected-revision");
118
+ if (!["file", "zip"].includes(ctx.str("source-type"))) throw new CliValidationError("--source-type must be file or zip; URL sources cannot be replaced or restored.");
119
+ }
120
+ function query(ctx) {
121
+ return { name: ctx.str("name").trim(), scope: ctx.str("scope") };
122
+ }
123
+ function sourceEndpoint(ctx, suffix) {
124
+ return `${API}/sources/${encodeURIComponent(ctx.str("id").trim())}/${suffix}`;
125
+ }
126
+ function previewEndpoint(ctx) {
127
+ return sourceEndpoint(ctx, `directory/previews/${encodeURIComponent(ctx.str("preview-id").trim())}`);
128
+ }
129
+ function dryRequest(ctx, method, endpoint2, body2) {
130
+ return { method, url: `${ctx.host().replace(/\/$/, "")}${endpoint2}`, params: query(ctx), ...body2 === void 0 ? {} : { body: body2 } };
131
+ }
132
+ async function replacementFile(ctx, read) {
133
+ const file = path.resolve(ctx.str("file"));
134
+ const extension = path.extname(file).toLowerCase();
135
+ if (ctx.str("source-type") === "zip" ? extension !== ".zip" : !fileExtensions.has(extension)) {
136
+ throw new CliValidationError("--file must be a ZIP for a ZIP source, or a supported non-ZIP file for a file source. File sources must keep their original format.");
137
+ }
138
+ const handle = await fs.open(file, "r");
139
+ try {
140
+ const stat = await handle.stat();
141
+ if (!stat.isFile() || stat.size > maxBytes) throw new CliValidationError("--file must be a regular file of at most 50 MB.");
142
+ const content = read ? await handle.readFile() : void 0;
143
+ if (content && content.length > maxBytes) throw new CliValidationError("--file exceeds 50 MB.");
144
+ return { file, filename: path.basename(file), sizeBytes: content?.length ?? stat.size, content };
145
+ } finally {
146
+ await handle.close();
147
+ }
148
+ }
149
+ function replaceEndpoint(ctx) {
150
+ return sourceEndpoint(ctx, ctx.str("source-type") === "zip" ? "directory/previews" : "raw");
151
+ }
152
+ function replaceFields(ctx) {
153
+ return { expectedRevision: ctx.num("expected-revision"), ...ctx.str("source-type") === "zip" ? { mode: "archive" } : {} };
154
+ }
155
+ var sourceReplace = {
156
+ service: "kb",
157
+ resource: "source",
158
+ command: "replace",
159
+ risk: "write",
160
+ description: "Replace a file source draft, or prepare a ZIP archive replacement preview. ZIP changes require source commit. Does not compile or publish.",
161
+ flags: [...identityFlags, typeFlag, revisionFlag, { name: "file", type: "string", required: true, desc: "Local replacement file, at most 50 MB; same format, different filename allowed" }],
162
+ validate: (ctx) => {
163
+ validateMutation(ctx);
164
+ if (!ctx.str("file").trim()) throw new CliValidationError("--file is required.");
165
+ },
166
+ dryRun: async (ctx) => {
167
+ const { file, filename, sizeBytes } = await replacementFile(ctx, false);
168
+ return { ...dryRequest(ctx, ctx.str("source-type") === "zip" ? "POST" : "PUT", replaceEndpoint(ctx), replaceFields(ctx)), multipart: { file, filename, sizeBytes, content: "<redacted>" } };
169
+ },
170
+ execute: async (ctx) => {
171
+ const file = await replacementFile(ctx, true);
172
+ const form = new FormData();
173
+ form.append("file", new Blob([new Uint8Array(file.content)]), file.filename);
174
+ for (const [key, value] of Object.entries(replaceFields(ctx))) form.append(key, String(value));
175
+ return kbUpload(ctx, replaceEndpoint(ctx), form, query(ctx), { ...apiOptions, method: ctx.str("source-type") === "zip" ? "POST" : "PUT" });
176
+ }
177
+ };
178
+ function restoreEndpoint(ctx) {
179
+ return `${API}/versions/${ctx.num("version")}/sources/${encodeURIComponent(ctx.str("id").trim())}/restore`;
180
+ }
181
+ function restoreBody(ctx) {
182
+ return { expectedRevision: ctx.num("expected-revision"), ...ctx.str("source-type") === "zip" ? ctx.str("path") ? { target: "file", path: ctx.str("path") } : { target: "source" } : {} };
183
+ }
184
+ var sourceRestore = {
185
+ service: "kb",
186
+ resource: "source",
187
+ command: "restore",
188
+ risk: "write",
189
+ description: "Restore one current source draft from a published version. File sources restore immediately; ZIP source or child restores return a preview. Does not roll back the whole knowledge base or publish.",
190
+ flags: [
191
+ ...identityFlags,
192
+ typeFlag,
193
+ revisionFlag,
194
+ { name: "version", type: "number", required: true, min: 1, max: 2147483647, desc: "Published version number from kb +versions; use the latest number to discard unpublished changes" },
195
+ { name: "path", type: "string", desc: "Optional exact historical ZIP child file path from kb +version-tree; omit to restore the entire ZIP source" }
196
+ ],
197
+ validate: (ctx) => {
198
+ validateMutation(ctx);
199
+ positiveInteger(ctx, "version");
200
+ const value = ctx.str("path");
201
+ if (value && (ctx.str("source-type") !== "zip" || value.length > 1024 || /[\\\x00-\x1f\x7f]/.test(value) || /^[A-Za-z]:/.test(value) || value.split("/").some((p) => !p || p === "." || p === ".."))) {
202
+ throw new CliValidationError("--path is only valid for a ZIP child and must be a normalized relative file path.");
203
+ }
204
+ },
205
+ dryRun: (ctx) => dryRequest(ctx, "POST", restoreEndpoint(ctx), restoreBody(ctx)),
206
+ execute: (ctx) => kbApi(ctx, "POST", restoreEndpoint(ctx), query(ctx), restoreBody(ctx), apiOptions)
207
+ };
208
+ var sourcePreview = {
209
+ service: "kb",
210
+ resource: "source",
211
+ command: "preview",
212
+ risk: "read",
213
+ description: "Read one page of a ZIP replacement or restore preview, including additions, modifications and deletions.",
214
+ flags: [
215
+ ...identityFlags,
216
+ previewFlag,
217
+ { name: "cursor", type: "string", desc: "Opaque nextCursor returned by the previous preview page" },
218
+ { name: "limit", type: "number", default: 100, min: 1, max: 200, desc: "Preview page size from 1 to 200" }
219
+ ],
220
+ validate: (ctx) => {
221
+ validateIdentity(ctx);
222
+ if (!Number.isInteger(ctx.num("limit")) || ctx.num("limit") < 1 || ctx.num("limit") > 200) throw new CliValidationError("--limit must be an integer from 1 to 200.");
223
+ if (ctx.str("cursor").length > 4096) throw new CliValidationError("--cursor must be at most 4096 characters.");
224
+ },
225
+ dryRun: (ctx) => ({ ...dryRequest(ctx, "GET", previewEndpoint(ctx)), params: { ...query(ctx), limit: ctx.num("limit"), ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {} } }),
226
+ execute: (ctx) => kbApi(ctx, "GET", previewEndpoint(ctx), { ...query(ctx), limit: ctx.num("limit"), ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {} }, void 0, apiOptions)
227
+ };
228
+ var sourceCommit = {
229
+ service: "kb",
230
+ resource: "source",
231
+ command: "commit",
232
+ risk: "high-risk-write",
233
+ description: "Confirm a reviewed ZIP replacement or restore preview. May delete missing files; changes only the draft. On uncertain outcome, inspect state before any retry.",
234
+ flags: [...identityFlags, previewFlag, revisionFlag],
235
+ validate: (ctx) => {
236
+ validateIdentity(ctx);
237
+ positiveInteger(ctx, "expected-revision");
238
+ },
239
+ dryRun: (ctx) => dryRequest(ctx, "POST", `${previewEndpoint(ctx)}/commit`, { expectedRevision: ctx.num("expected-revision"), confirmed: true }),
240
+ execute: (ctx) => kbApi(ctx, "POST", `${previewEndpoint(ctx)}/commit`, query(ctx), { expectedRevision: ctx.num("expected-revision"), confirmed: true }, apiOptions)
241
+ };
242
+ var sourceCancel = {
243
+ service: "kb",
244
+ resource: "source",
245
+ command: "cancel",
246
+ risk: "high-risk-write",
247
+ description: "Discard an uncommitted ZIP replacement or restore preview; leaves the source draft unchanged.",
248
+ flags: [...identityFlags, previewFlag],
249
+ validate: validateIdentity,
250
+ dryRun: (ctx) => dryRequest(ctx, "DELETE", previewEndpoint(ctx)),
251
+ execute: async (ctx) => {
252
+ await kbApi(ctx, "DELETE", previewEndpoint(ctx), query(ctx), void 0, { ...apiOptions, responseType: "empty" });
253
+ return { previewId: ctx.str("preview-id"), cancelled: true };
254
+ }
255
+ };
256
+
38
257
  // src/commands/te-kb/add.ts
39
- var API_PATH = "/agent/api/external/knowledge-bases/sources/upload";
258
+ import { promises as fs2 } from "fs";
259
+ import * as path2 from "path";
260
+ import TurndownService from "turndown";
261
+ var API_PATH2 = "/agent/api/external/knowledge-bases/sources/upload";
40
262
  var SUPPORTED_EXTENSIONS = /* @__PURE__ */ new Set([
41
263
  ".zip",
42
264
  ".md",
@@ -83,7 +305,7 @@ function sanitizeFilename(name) {
83
305
  return cleaned || "document";
84
306
  }
85
307
  function getMimeType(filename) {
86
- const ext = path.extname(filename).toLowerCase();
308
+ const ext = path2.extname(filename).toLowerCase();
87
309
  switch (ext) {
88
310
  case ".zip":
89
311
  return "application/zip";
@@ -126,23 +348,23 @@ function getMimeType(filename) {
126
348
  }
127
349
  }
128
350
  async function readLocalFile(filePath) {
129
- const ext = path.extname(filePath).toLowerCase();
351
+ const ext = path2.extname(filePath).toLowerCase();
130
352
  if (!SUPPORTED_EXTENSIONS.has(ext)) {
131
353
  throw new Error(`Unsupported file extension (${ext || "none"}): ${filePath}`);
132
354
  }
133
- const content = await fs.readFile(filePath);
134
- const filename = path.basename(filePath);
355
+ const content = await fs2.readFile(filePath);
356
+ const filename = path2.basename(filePath);
135
357
  return { filename, content, mimeType: getMimeType(filename), origin: "file", source: filePath };
136
358
  }
137
359
  async function readDirectory(dir) {
138
- const entries = await fs.readdir(dir, { withFileTypes: true });
360
+ const entries = await fs2.readdir(dir, { withFileTypes: true });
139
361
  const files = [];
140
362
  for (const entry of entries) {
141
363
  if (!entry.isFile()) continue;
142
- const ext = path.extname(entry.name).toLowerCase();
364
+ const ext = path2.extname(entry.name).toLowerCase();
143
365
  if (!SUPPORTED_EXTENSIONS.has(ext)) continue;
144
- const full = path.join(dir, entry.name);
145
- const content = await fs.readFile(full);
366
+ const full = path2.join(dir, entry.name);
367
+ const content = await fs2.readFile(full);
146
368
  files.push({ filename: entry.name, content, mimeType: getMimeType(entry.name), origin: "dir", source: full });
147
369
  }
148
370
  if (files.length === 0) {
@@ -177,10 +399,10 @@ async function fetchAsMarkdown(rawUrl) {
177
399
  };
178
400
  }
179
401
  async function resolveLocalPath(p) {
180
- const abs = path.resolve(p);
402
+ const abs = path2.resolve(p);
181
403
  let stat;
182
404
  try {
183
- stat = await fs.stat(abs);
405
+ stat = await fs2.stat(abs);
184
406
  } catch {
185
407
  throw new Error(`Path not found: ${p}`);
186
408
  }
@@ -216,7 +438,7 @@ function dedupeByFilename(files) {
216
438
  const count = used.get(f.filename) ?? 0;
217
439
  used.set(f.filename, count + 1);
218
440
  if (count === 0) return f;
219
- const ext = path.extname(f.filename);
441
+ const ext = path2.extname(f.filename);
220
442
  const stem = f.filename.slice(0, f.filename.length - ext.length);
221
443
  return { ...f, filename: `${stem}-${count}${ext}` };
222
444
  });
@@ -251,17 +473,17 @@ var add = {
251
473
  },
252
474
  dryRun: (ctx) => {
253
475
  const items = normalizeFilesInput(ctx.json("files"));
254
- const body = {
476
+ const body2 = {
255
477
  name: ctx.str("name")
256
478
  };
257
479
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
258
- if (scope) body.scope = scope;
259
- body.files = items.map((item) => ({ value: item, type: classifyInput(item) }));
260
- body.contentType = "multipart/form-data";
480
+ if (scope) body2.scope = scope;
481
+ body2.files = items.map((item) => ({ value: item, type: classifyInput(item) }));
482
+ body2.contentType = "multipart/form-data";
261
483
  return {
262
484
  method: "POST",
263
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH}`,
264
- body
485
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH2}`,
486
+ body: body2
265
487
  };
266
488
  },
267
489
  execute: async (ctx) => {
@@ -269,7 +491,7 @@ var add = {
269
491
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
270
492
  const files = await collectFiles(ctx);
271
493
  const form = buildForm(name, scope, files);
272
- const result = await kbUpload(ctx, API_PATH, form);
494
+ const result = await kbUpload(ctx, API_PATH2, form);
273
495
  return {
274
496
  uploaded: files.map((f) => ({ filename: f.filename, origin: f.origin, source: f.source })),
275
497
  result
@@ -278,7 +500,7 @@ var add = {
278
500
  };
279
501
 
280
502
  // src/commands/te-kb/compile.ts
281
- var API_PATH2 = "/agent/api/external/knowledge-bases/compile";
503
+ var API_PATH3 = "/agent/api/external/knowledge-bases/compile";
282
504
  var VALID_MODES = /* @__PURE__ */ new Set(["incremental", "full"]);
283
505
  function getMode(ctx) {
284
506
  const mode = ctx.str("mode") || "incremental";
@@ -288,15 +510,15 @@ function getMode(ctx) {
288
510
  return mode;
289
511
  }
290
512
  function buildBody(ctx) {
291
- const body = {
513
+ const body2 = {
292
514
  name: ctx.str("name"),
293
515
  mode: getMode(ctx)
294
516
  };
295
517
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
296
- if (scope) body.scope = scope;
518
+ if (scope) body2.scope = scope;
297
519
  const model = ctx.str("model");
298
- if (model) body.model = model;
299
- return body;
520
+ if (model) body2.model = model;
521
+ return body2;
300
522
  }
301
523
  var compile = {
302
524
  service: "kb",
@@ -315,19 +537,19 @@ var compile = {
315
537
  },
316
538
  dryRun: (ctx) => ({
317
539
  method: "POST",
318
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH2}`,
540
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH3}`,
319
541
  body: buildBody(ctx)
320
542
  }),
321
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH2, {}, buildBody(ctx))
543
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH3, {}, buildBody(ctx))
322
544
  };
323
545
 
324
546
  // src/commands/te-kb/remove.ts
325
- var API_PATH3 = "/agent/api/external/knowledge-bases";
547
+ var API_PATH4 = "/agent/api/external/knowledge-bases";
326
548
  function buildBody2(ctx) {
327
- const body = { name: ctx.str("name") };
549
+ const body2 = { name: ctx.str("name") };
328
550
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
329
- if (scope) body.scope = scope;
330
- return body;
551
+ if (scope) body2.scope = scope;
552
+ return body2;
331
553
  }
332
554
  var remove = {
333
555
  service: "kb",
@@ -343,14 +565,14 @@ var remove = {
343
565
  },
344
566
  dryRun: (ctx) => ({
345
567
  method: "DELETE",
346
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH3}`,
568
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH4}`,
347
569
  body: buildBody2(ctx)
348
570
  }),
349
- execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH3, {}, buildBody2(ctx))
571
+ execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH4, {}, buildBody2(ctx))
350
572
  };
351
573
 
352
574
  // src/commands/te-kb/create.ts
353
- var API_PATH4 = "/agent/api/external/knowledge-bases/create";
575
+ var API_PATH5 = "/agent/api/external/knowledge-bases/create";
354
576
  var VALID_SCOPES = /* @__PURE__ */ new Set(["personal", "company"]);
355
577
  function getScope(ctx) {
356
578
  const scope = ctx.str("scope") || "company";
@@ -378,19 +600,19 @@ function normalizeTags(raw) {
378
600
  return tags;
379
601
  }
380
602
  function buildBody3(ctx) {
381
- const body = {
603
+ const body2 = {
382
604
  scope: getScope(ctx),
383
605
  name: ctx.str("name")
384
606
  };
385
607
  const description = ctx.str("description");
386
- if (description) body.description = description;
608
+ if (description) body2.description = description;
387
609
  const tags = normalizeTags(ctx.json("tags"));
388
- if (tags && tags.length > 0) body.tags = tags;
610
+ if (tags && tags.length > 0) body2.tags = tags;
389
611
  const projectId = ctx.str("project-id");
390
- if (projectId) body.projectId = projectId;
612
+ if (projectId) body2.projectId = projectId;
391
613
  const projectName = ctx.str("project-name");
392
- if (projectName) body.projectName = projectName;
393
- return body;
614
+ if (projectName) body2.projectName = projectName;
615
+ return body2;
394
616
  }
395
617
  var create = {
396
618
  service: "kb",
@@ -411,14 +633,14 @@ var create = {
411
633
  },
412
634
  dryRun: (ctx) => ({
413
635
  method: "POST",
414
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH4}`,
636
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH5}`,
415
637
  body: buildBody3(ctx)
416
638
  }),
417
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH4, {}, buildBody3(ctx))
639
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH5, {}, buildBody3(ctx))
418
640
  };
419
641
 
420
642
  // src/commands/te-kb/rm-source.ts
421
- var API_PATH5 = "/agent/api/external/knowledge-bases/sources";
643
+ var API_PATH6 = "/agent/api/external/knowledge-bases/sources";
422
644
  function sourceSelector(ctx) {
423
645
  const id = ctx.str("id").trim();
424
646
  if (id) return { id };
@@ -427,12 +649,12 @@ function sourceSelector(ctx) {
427
649
  throw new CliValidationError("One of --id or --display-name is required.");
428
650
  }
429
651
  function buildBody4(ctx) {
430
- const body = {
652
+ const body2 = {
431
653
  name: ctx.str("name")
432
654
  };
433
655
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
434
- if (scope) body.scope = scope;
435
- return { ...body, ...sourceSelector(ctx) };
656
+ if (scope) body2.scope = scope;
657
+ return { ...body2, ...sourceSelector(ctx) };
436
658
  }
437
659
  var rmSource = {
438
660
  service: "kb",
@@ -451,31 +673,49 @@ var rmSource = {
451
673
  },
452
674
  dryRun: (ctx) => ({
453
675
  method: "DELETE",
454
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH5}`,
676
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH6}`,
455
677
  body: buildBody4(ctx)
456
678
  }),
457
- execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH5, {}, buildBody4(ctx), {
679
+ execute: async (ctx) => kbApi(ctx, "DELETE", API_PATH6, {}, buildBody4(ctx), {
458
680
  preserveErrorMetadata: true
459
681
  })
460
682
  };
461
683
 
462
684
  // src/commands/te-kb/schema.ts
463
- var API_PATH6 = "/agent/api/external/knowledge-bases/schema";
685
+ import fs3 from "fs";
686
+ import path3 from "path";
687
+ var API_PATH7 = "/agent/api/external/knowledge-bases/schema";
688
+ var MAX_CUSTOM_INSTRUCTIONS_CHARS = 1e4;
689
+ function getCustomInstructions(ctx) {
690
+ const inline = ctx.str("custom-instructions");
691
+ const file = ctx.str("custom-instructions-file");
692
+ if (inline && file) {
693
+ throw new Error("Use either --custom-instructions or --custom-instructions-file, not both.");
694
+ }
695
+ const content = file ? fs3.readFileSync(path3.resolve(file), "utf8") : inline;
696
+ if (file && !content.trim()) {
697
+ throw new Error("--custom-instructions-file is empty.");
698
+ }
699
+ if ([...content].length > MAX_CUSTOM_INSTRUCTIONS_CHARS) {
700
+ throw new Error("Custom instructions exceed 10000 characters.");
701
+ }
702
+ return content;
703
+ }
464
704
  function buildBody5(ctx) {
465
- const body = {
705
+ const body2 = {
466
706
  name: ctx.str("name")
467
707
  };
468
708
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
469
- if (scope) body.scope = scope;
470
- if (ctx.bool("force")) body.force = true;
709
+ if (scope) body2.scope = scope;
710
+ if (ctx.bool("force")) body2.force = true;
471
711
  const model = ctx.str("model");
472
- if (model) body.model = model;
473
- const customInstructions = ctx.str("custom-instructions");
474
- if (customInstructions) body.customInstructions = customInstructions;
475
- return body;
712
+ if (model) body2.model = model;
713
+ const customInstructions = getCustomInstructions(ctx);
714
+ if (customInstructions) body2.customInstructions = customInstructions;
715
+ return body2;
476
716
  }
477
717
  async function executeSchema(ctx, api = kbApi) {
478
- return api(ctx, "POST", API_PATH6, {}, buildBody5(ctx), {
718
+ return api(ctx, "POST", API_PATH7, {}, buildBody5(ctx), {
479
719
  preserveBusinessErrorCode: true
480
720
  });
481
721
  }
@@ -494,29 +734,37 @@ var schema = {
494
734
  required: false,
495
735
  sensitive: true,
496
736
  desc: "Optional per-run instructions for generating this knowledge base schema"
737
+ },
738
+ {
739
+ name: "custom-instructions-file",
740
+ type: "string",
741
+ required: false,
742
+ sensitive: true,
743
+ desc: "Read optional per-run schema generation instructions from a UTF-8 text file"
497
744
  }
498
745
  ],
499
746
  risk: "write",
500
747
  validate: (ctx) => {
501
748
  getExternalKnowledgeBaseTargetScope(ctx);
749
+ getCustomInstructions(ctx);
502
750
  },
503
751
  dryRun: (ctx) => ({
504
752
  method: "POST",
505
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH6}`,
753
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH7}`,
506
754
  body: buildBody5(ctx)
507
755
  }),
508
756
  execute: executeSchema
509
757
  };
510
758
 
511
759
  // src/commands/te-kb/status.ts
512
- var API_PATH7 = "/agent/api/external/knowledge-bases/status";
760
+ var API_PATH8 = "/agent/api/external/knowledge-bases/status";
513
761
  function buildBody6(ctx) {
514
- const body = {
762
+ const body2 = {
515
763
  name: ctx.str("name")
516
764
  };
517
765
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
518
- if (scope) body.scope = scope;
519
- return body;
766
+ if (scope) body2.scope = scope;
767
+ return body2;
520
768
  }
521
769
  var status = {
522
770
  service: "kb",
@@ -532,21 +780,21 @@ var status = {
532
780
  },
533
781
  dryRun: (ctx) => ({
534
782
  method: "POST",
535
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH7}`,
783
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH8}`,
536
784
  body: buildBody6(ctx)
537
785
  }),
538
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH7, {}, buildBody6(ctx))
786
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH8, {}, buildBody6(ctx))
539
787
  };
540
788
 
541
789
  // src/commands/te-kb/kb-index.ts
542
- var API_PATH8 = "/agent/api/external/knowledge-bases/index";
790
+ var API_PATH9 = "/agent/api/external/knowledge-bases/index";
543
791
  function buildBody7(ctx) {
544
- const body = {};
792
+ const body2 = {};
545
793
  const sources = ctx.json("sources");
546
- if (sources) body.sources = sources;
794
+ if (sources) body2.sources = sources;
547
795
  const locale = ctx.str("locale");
548
- if (locale) body.locale = locale;
549
- return body;
796
+ if (locale) body2.locale = locale;
797
+ return body2;
550
798
  }
551
799
  var kbIndex = {
552
800
  service: "kb",
@@ -564,14 +812,14 @@ var kbIndex = {
564
812
  risk: "read",
565
813
  dryRun: (ctx) => ({
566
814
  method: "POST",
567
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH8}`,
815
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH9}`,
568
816
  body: buildBody7(ctx)
569
817
  }),
570
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH8, {}, buildBody7(ctx))
818
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH9, {}, buildBody7(ctx))
571
819
  };
572
820
 
573
821
  // src/commands/te-kb/kb-list.ts
574
- var API_PATH9 = "/agent/api/external/knowledge-bases/list";
822
+ var API_PATH10 = "/agent/api/external/knowledge-bases/list";
575
823
  var DEFAULT_BUILD_STATUS = "compiled";
576
824
  var VALID_BUILD_STATUSES = ["idle", "pending", "compiling", "compiled", "failed"];
577
825
  function getBuildStatus(ctx) {
@@ -588,12 +836,12 @@ function validateBuildStatus(ctx) {
588
836
  }
589
837
  }
590
838
  function buildBody8(ctx) {
591
- const body = {
839
+ const body2 = {
592
840
  buildStatus: getBuildStatus(ctx)
593
841
  };
594
842
  const locale = ctx.str("locale");
595
- if (locale) body.locale = locale;
596
- return body;
843
+ if (locale) body2.locale = locale;
844
+ return body2;
597
845
  }
598
846
  var kbList = {
599
847
  service: "kb",
@@ -615,20 +863,20 @@ var kbList = {
615
863
  },
616
864
  dryRun: (ctx) => ({
617
865
  method: "POST",
618
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH9}`,
866
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH10}`,
619
867
  body: buildBody8(ctx)
620
868
  }),
621
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH9, {}, buildBody8(ctx))
869
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH10, {}, buildBody8(ctx))
622
870
  };
623
871
 
624
872
  // src/commands/te-kb/list-sources.ts
625
- var API_PATH10 = "/agent/api/external/knowledge-bases/sources";
873
+ var API_PATH11 = "/agent/api/external/knowledge-bases/sources";
626
874
  var MAX_KNOWLEDGE_BASE_NAME_LENGTH = 200;
627
875
  function knowledgeBaseName(ctx) {
628
876
  return ctx.str("name").trim();
629
877
  }
630
878
  function buildUrl(ctx) {
631
- const url2 = new URL(`${ctx.host().replace(/\/$/, "")}${API_PATH10}`);
879
+ const url2 = new URL(`${ctx.host().replace(/\/$/, "")}${API_PATH11}`);
632
880
  url2.searchParams.set("name", knowledgeBaseName(ctx));
633
881
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
634
882
  if (scope) url2.searchParams.set("scope", scope);
@@ -675,26 +923,26 @@ var listSources = {
675
923
  const params = { name: knowledgeBaseName(ctx) };
676
924
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
677
925
  if (scope) params.scope = scope;
678
- return kbApi(ctx, "GET", API_PATH10, params, void 0, {
926
+ return kbApi(ctx, "GET", API_PATH11, params, void 0, {
679
927
  preserveErrorMetadata: true,
680
- retryUnauthorized: true
928
+ retryUnauthorized: false
681
929
  });
682
930
  }
683
931
  };
684
932
 
685
933
  // src/commands/te-kb/kb-grep.ts
686
- var API_PATH11 = "/agent/api/external/knowledge-bases/grep";
934
+ var API_PATH12 = "/agent/api/external/knowledge-bases/grep";
687
935
  function buildBody9(ctx) {
688
- const body = {
936
+ const body2 = {
689
937
  query: ctx.str("query"),
690
938
  sources: ctx.json("sources"),
691
939
  paths: ctx.json("paths")
692
940
  };
693
941
  const topK = ctx.optionalNum("top-k");
694
- if (topK !== void 0) body.topK = topK;
942
+ if (topK !== void 0) body2.topK = topK;
695
943
  const locale = ctx.str("locale");
696
- if (locale) body.locale = locale;
697
- return body;
944
+ if (locale) body2.locale = locale;
945
+ return body2;
698
946
  }
699
947
  var kbGrep = {
700
948
  service: "kb",
@@ -726,14 +974,14 @@ var kbGrep = {
726
974
  risk: "read",
727
975
  dryRun: (ctx) => ({
728
976
  method: "POST",
729
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH11}`,
977
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH12}`,
730
978
  body: buildBody9(ctx)
731
979
  }),
732
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH11, {}, buildBody9(ctx))
980
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH12, {}, buildBody9(ctx))
733
981
  };
734
982
 
735
983
  // src/commands/te-kb/kb-read.ts
736
- var API_PATH12 = "/agent/api/external/knowledge-bases/read";
984
+ var API_PATH13 = "/agent/api/external/knowledge-bases/read";
737
985
  var VALID_EXPAND_MODES = /* @__PURE__ */ new Set(["block", "none"]);
738
986
  var MAX_READ_LIMIT = 2e3;
739
987
  function readExpand(ctx) {
@@ -757,20 +1005,20 @@ function readLimit(ctx) {
757
1005
  return limit;
758
1006
  }
759
1007
  function buildBody10(ctx) {
760
- const body = {
1008
+ const body2 = {
761
1009
  source: ctx.json("source"),
762
1010
  path: ctx.str("path")
763
1011
  };
764
1012
  const offset = ctx.optionalNum("offset");
765
- if (offset !== void 0) body.offset = offset;
1013
+ if (offset !== void 0) body2.offset = offset;
766
1014
  const limit = ctx.optionalNum("limit");
767
- if (limit !== void 0) body.limit = limit;
1015
+ if (limit !== void 0) body2.limit = limit;
768
1016
  const expand = readExpand(ctx);
769
- if (expand) body.expand = expand;
770
- if (ctx.bool("outline")) body.outline = true;
1017
+ if (expand) body2.expand = expand;
1018
+ if (ctx.bool("outline")) body2.outline = true;
771
1019
  const locale = ctx.str("locale");
772
- if (locale) body.locale = locale;
773
- return body;
1020
+ if (locale) body2.locale = locale;
1021
+ return body2;
774
1022
  }
775
1023
  var kbRead = {
776
1024
  service: "kb",
@@ -811,10 +1059,10 @@ var kbRead = {
811
1059
  },
812
1060
  dryRun: (ctx) => ({
813
1061
  method: "POST",
814
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH12}`,
1062
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH13}`,
815
1063
  body: buildBody10(ctx)
816
1064
  }),
817
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH12, {}, buildBody10(ctx))
1065
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH13, {}, buildBody10(ctx))
818
1066
  };
819
1067
 
820
1068
  // src/commands/te-kb/ask-shared.ts
@@ -895,16 +1143,16 @@ function validateLocale(locale) {
895
1143
  }
896
1144
  }
897
1145
  function buildBody11(ctx) {
898
- const body = {
1146
+ const body2 = {
899
1147
  question: ctx.str("question")
900
1148
  };
901
1149
  const sources = ctx.json("sources");
902
- if (sources) body.sources = sources;
1150
+ if (sources) body2.sources = sources;
903
1151
  const modelId = ctx.str("model-id");
904
- if (modelId) body.modelId = modelId;
1152
+ if (modelId) body2.modelId = modelId;
905
1153
  const locale = ctx.str("locale");
906
- if (locale) body.locale = locale;
907
- return body;
1154
+ if (locale) body2.locale = locale;
1155
+ return body2;
908
1156
  }
909
1157
  var ask = {
910
1158
  service: "kb",
@@ -1024,24 +1272,24 @@ var askStatus = {
1024
1272
  };
1025
1273
 
1026
1274
  // src/commands/te-kb/url.ts
1027
- var API_PATH13 = "/agent/api/external/knowledge-bases/sources/url";
1275
+ var API_PATH14 = "/agent/api/external/knowledge-bases/sources/url";
1028
1276
  function validateUrl(url2) {
1029
1277
  if (!/^https?:\/\//i.test(url2)) {
1030
1278
  throw new Error(`Invalid --url: ${url2}. Must be an http(s) URL`);
1031
1279
  }
1032
1280
  }
1033
1281
  function buildBody12(ctx) {
1034
- const body = {
1282
+ const body2 = {
1035
1283
  name: ctx.str("name"),
1036
1284
  url: ctx.str("url")
1037
1285
  };
1038
1286
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
1039
- if (scope) body.scope = scope;
1287
+ if (scope) body2.scope = scope;
1040
1288
  const displayName = ctx.str("display-name");
1041
- if (displayName) body.displayName = displayName;
1289
+ if (displayName) body2.displayName = displayName;
1042
1290
  const parseInstruction = ctx.str("parse-instruction");
1043
- if (parseInstruction) body.parseInstruction = parseInstruction;
1044
- return body;
1291
+ if (parseInstruction) body2.parseInstruction = parseInstruction;
1292
+ return body2;
1045
1293
  }
1046
1294
  var url = {
1047
1295
  service: "kb",
@@ -1061,16 +1309,16 @@ var url = {
1061
1309
  },
1062
1310
  dryRun: (ctx) => ({
1063
1311
  method: "POST",
1064
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH13}`,
1312
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH14}`,
1065
1313
  body: buildBody12(ctx)
1066
1314
  }),
1067
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH13, {}, buildBody12(ctx))
1315
+ execute: async (ctx) => kbApi(ctx, "POST", API_PATH14, {}, buildBody12(ctx))
1068
1316
  };
1069
1317
 
1070
1318
  // src/commands/te-kb/import.ts
1071
- import { promises as fs2 } from "fs";
1072
- import path2 from "path";
1073
- var API_PATH14 = "/agent/api/external/knowledge-bases/import";
1319
+ import { promises as fs4 } from "fs";
1320
+ import path4 from "path";
1321
+ var API_PATH15 = "/agent/api/external/knowledge-bases/import";
1074
1322
  var MAX_SNAPSHOT_ARCHIVE_BYTES = 50 * 1024 * 1024;
1075
1323
  var VALID_SCOPES2 = /* @__PURE__ */ new Set(["personal", "company"]);
1076
1324
  function getScope2(ctx) {
@@ -1106,16 +1354,16 @@ function normalizeTags2(raw) {
1106
1354
  return tags;
1107
1355
  }
1108
1356
  function validateArchivePath(filePath) {
1109
- if (path2.extname(filePath).toLocaleLowerCase("en-US") !== ".zip") {
1357
+ if (path4.extname(filePath).toLocaleLowerCase("en-US") !== ".zip") {
1110
1358
  throw new Error("--file must point to a .zip archive");
1111
1359
  }
1112
1360
  }
1113
1361
  async function readArchive(filePath) {
1114
1362
  validateArchivePath(filePath);
1115
- const absolutePath = path2.resolve(filePath);
1363
+ const absolutePath = path4.resolve(filePath);
1116
1364
  let stat;
1117
1365
  try {
1118
- stat = await fs2.stat(absolutePath);
1366
+ stat = await fs4.stat(absolutePath);
1119
1367
  } catch {
1120
1368
  throw new Error(`File not found: ${filePath}`);
1121
1369
  }
@@ -1125,7 +1373,7 @@ async function readArchive(filePath) {
1125
1373
  if (stat.size > MAX_SNAPSHOT_ARCHIVE_BYTES) {
1126
1374
  throw new Error("--file must not exceed 50 MB");
1127
1375
  }
1128
- return { absolutePath, bytes: await fs2.readFile(absolutePath) };
1376
+ return { absolutePath, bytes: await fs4.readFile(absolutePath) };
1129
1377
  }
1130
1378
  function appendOptionalFields(ctx, form) {
1131
1379
  const description = ctx.str("description").trim();
@@ -1192,7 +1440,7 @@ var importSnapshot = {
1192
1440
  form.append(
1193
1441
  "file",
1194
1442
  new Blob([Uint8Array.from(archive.bytes)], { type: "application/zip" }),
1195
- path2.basename(archive.absolutePath)
1443
+ path4.basename(archive.absolutePath)
1196
1444
  );
1197
1445
  form.append("name", ctx.str("name").trim());
1198
1446
  form.append("scope", getScope2(ctx));
@@ -1200,7 +1448,7 @@ var importSnapshot = {
1200
1448
  try {
1201
1449
  return await kbUpload(
1202
1450
  ctx,
1203
- API_PATH14,
1451
+ API_PATH15,
1204
1452
  form,
1205
1453
  { scope: getScope2(ctx) },
1206
1454
  { preserveErrorMetadata: true, retryUnauthorized: true }
@@ -1229,7 +1477,7 @@ var importSnapshot = {
1229
1477
  };
1230
1478
 
1231
1479
  // src/commands/te-kb/import-status.ts
1232
- var API_PATH15 = "/agent/api/external/knowledge-bases/import";
1480
+ var API_PATH16 = "/agent/api/external/knowledge-bases/import";
1233
1481
  var MAX_REQUEST_ID_LENGTH = 191;
1234
1482
  function requestIdFrom(ctx) {
1235
1483
  return ctx.str("request-id").trim();
@@ -1260,7 +1508,7 @@ var importStatus = {
1260
1508
  },
1261
1509
  dryRun: (ctx) => ({
1262
1510
  method: "GET",
1263
- url: `${ctx.host().replace(/\/$/, "")}${API_PATH15}?requestId=${encodeURIComponent(requestIdFrom(ctx))}`
1511
+ url: `${ctx.host().replace(/\/$/, "")}${API_PATH16}?requestId=${encodeURIComponent(requestIdFrom(ctx))}`
1264
1512
  }),
1265
1513
  execute: async (ctx) => {
1266
1514
  const hint = "Verify the request ID and that the server supports kb +import-status. Do not retry the import until its status is known.";
@@ -1268,10 +1516,10 @@ var importStatus = {
1268
1516
  return await kbApi(
1269
1517
  ctx,
1270
1518
  "GET",
1271
- API_PATH15,
1519
+ API_PATH16,
1272
1520
  { requestId: requestIdFrom(ctx) },
1273
1521
  void 0,
1274
- { preserveErrorMetadata: true }
1522
+ { preserveErrorMetadata: true, retryUnauthorized: true }
1275
1523
  );
1276
1524
  } catch (error) {
1277
1525
  if (error instanceof PermissionError) {
@@ -1299,23 +1547,23 @@ var importStatus = {
1299
1547
  };
1300
1548
 
1301
1549
  // src/commands/te-kb/source-directory.ts
1302
- import { promises as fs3 } from "fs";
1303
- import path3 from "path";
1550
+ import { promises as fs5 } from "fs";
1551
+ import path5 from "path";
1304
1552
  var sourceFlags = [
1305
1553
  { name: "name", type: "string", required: true, desc: "Knowledge base name (personal then company)" },
1306
1554
  { name: "id", type: "string", required: true, desc: "ZIP source ID copied from +list-sources" }
1307
1555
  ];
1308
1556
  var pathFlag = { name: "path", type: "string", required: true, desc: "Exact path relative to the ZIP source root" };
1309
- var revisionFlag = {
1557
+ var revisionFlag2 = {
1310
1558
  name: "expected-revision",
1311
1559
  type: "number",
1312
1560
  required: true,
1313
1561
  min: 1,
1314
1562
  desc: "Revision returned by +source-ls; a conflict requires a fresh read and explicit retry"
1315
1563
  };
1316
- var apiOptions = { preserveErrorMetadata: true, retryUnauthorized: true };
1564
+ var apiOptions2 = { preserveErrorMetadata: true, retryUnauthorized: false };
1317
1565
  var maxFileBytes = 50 * 1024 * 1024;
1318
- function validateIdentity(ctx) {
1566
+ function validateIdentity2(ctx) {
1319
1567
  for (const [flag, max] of [["name", 200], ["id", 191]]) {
1320
1568
  const value = ctx.str(flag).trim();
1321
1569
  if (!value || value.length > max) throw new CliValidationError(`Invalid --${flag}.`);
@@ -1329,8 +1577,8 @@ function relativePath(ctx, allowRoot = false) {
1329
1577
  }
1330
1578
  return value;
1331
1579
  }
1332
- function validateMutation(ctx) {
1333
- validateIdentity(ctx);
1580
+ function validateMutation2(ctx) {
1581
+ validateIdentity2(ctx);
1334
1582
  relativePath(ctx);
1335
1583
  if (!Number.isSafeInteger(ctx.num("expected-revision")) || ctx.num("expected-revision") < 1) {
1336
1584
  throw new CliValidationError("--expected-revision must be a positive safe integer.");
@@ -1339,11 +1587,11 @@ function validateMutation(ctx) {
1339
1587
  function endpoint(ctx, suffix = "directory") {
1340
1588
  return `/agent/api/external/knowledge-bases/sources/${encodeURIComponent(ctx.str("id").trim())}/${suffix}`;
1341
1589
  }
1342
- function query(ctx) {
1590
+ function query2(ctx) {
1343
1591
  return { name: ctx.str("name").trim(), path: ctx.str("path") };
1344
1592
  }
1345
- function preview(ctx, method, suffix = "directory", body) {
1346
- return { method, url: `${ctx.host().replace(/\/$/, "")}${endpoint(ctx, suffix)}`, ...body ? { body } : { params: query(ctx) } };
1593
+ function preview(ctx, method, suffix = "directory", body2) {
1594
+ return { method, url: `${ctx.host().replace(/\/$/, "")}${endpoint(ctx, suffix)}`, ...body2 ? { body: body2 } : { params: query2(ctx) } };
1347
1595
  }
1348
1596
  function mutationBody(ctx, operation) {
1349
1597
  return { name: ctx.str("name").trim(), expectedRevision: ctx.num("expected-revision"), operations: [operation] };
@@ -1360,18 +1608,18 @@ var sourceLs = {
1360
1608
  { name: "limit", type: "number", default: 100, min: 1, max: 200, desc: "Page size (1-200)" }
1361
1609
  ],
1362
1610
  validate: (ctx) => {
1363
- validateIdentity(ctx);
1611
+ validateIdentity2(ctx);
1364
1612
  relativePath(ctx, true);
1365
1613
  if (!Number.isInteger(ctx.num("limit")) || ctx.num("limit") < 1 || ctx.num("limit") > 200) {
1366
1614
  throw new CliValidationError("--limit must be an integer from 1 to 200.");
1367
1615
  }
1368
1616
  },
1369
- dryRun: (ctx) => ({ ...preview(ctx, "GET"), params: { ...query(ctx), limit: ctx.num("limit"), ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {} } }),
1617
+ dryRun: (ctx) => ({ ...preview(ctx, "GET"), params: { ...query2(ctx), limit: ctx.num("limit"), ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {} } }),
1370
1618
  execute: (ctx) => kbApi(ctx, "GET", endpoint(ctx), {
1371
- ...query(ctx),
1619
+ ...query2(ctx),
1372
1620
  limit: ctx.num("limit"),
1373
1621
  ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {}
1374
- }, void 0, apiOptions)
1622
+ }, void 0, apiOptions2)
1375
1623
  };
1376
1624
  var sourceRead = {
1377
1625
  service: "kb",
@@ -1385,18 +1633,18 @@ var sourceRead = {
1385
1633
  { name: "output", type: "string", desc: "Save original bytes to this local path; existing files are never overwritten" }
1386
1634
  ],
1387
1635
  validate: (ctx) => {
1388
- validateIdentity(ctx);
1636
+ validateIdentity2(ctx);
1389
1637
  relativePath(ctx);
1390
1638
  if (!["utf8", "base64"].includes(ctx.str("encoding"))) throw new CliValidationError("--encoding must be utf8 or base64.");
1391
1639
  },
1392
1640
  dryRun: (ctx) => preview(ctx, "GET", "raw"),
1393
1641
  execute: async (ctx) => {
1394
- const result = await kbApi(ctx, "GET", endpoint(ctx, "raw"), query(ctx), void 0, { ...apiOptions, responseType: "bytes" });
1642
+ const result = await kbApi(ctx, "GET", endpoint(ctx, "raw"), query2(ctx), void 0, { ...apiOptions2, responseType: "bytes" });
1395
1643
  const bytes = Buffer.from(result.bytes);
1396
1644
  const metadata = { path: ctx.str("path"), sizeBytes: bytes.length, contentType: result.contentType };
1397
1645
  if (ctx.str("output")) {
1398
- const output = path3.resolve(ctx.str("output"));
1399
- await fs3.writeFile(output, bytes, { flag: "wx" });
1646
+ const output = path5.resolve(ctx.str("output"));
1647
+ await fs5.writeFile(output, bytes, { flag: "wx" });
1400
1648
  return { ...metadata, output };
1401
1649
  }
1402
1650
  if (ctx.str("encoding") === "base64") return { ...metadata, encoding: "base64", content: bytes.toString("base64") };
@@ -1408,8 +1656,8 @@ var sourceRead = {
1408
1656
  }
1409
1657
  };
1410
1658
  async function fileOperation(ctx, dryRun) {
1411
- const file = path3.resolve(ctx.str("file"));
1412
- const handle = await fs3.open(file, "r");
1659
+ const file = path5.resolve(ctx.str("file"));
1660
+ const handle = await fs5.open(file, "r");
1413
1661
  try {
1414
1662
  const stat = await handle.stat();
1415
1663
  if (!stat.isFile() || stat.size > maxFileBytes) throw new CliValidationError("--file must be a regular file of at most 50 MB.");
@@ -1434,17 +1682,17 @@ var sourcePut = {
1434
1682
  flags: [
1435
1683
  ...sourceFlags,
1436
1684
  pathFlag,
1437
- revisionFlag,
1685
+ revisionFlag2,
1438
1686
  { name: "file", type: "string", required: true, desc: "Local file to upload (at most 50 MB)" },
1439
1687
  { name: "action", type: "string", default: "add", desc: "add rejects an existing path; replace explicitly overwrites an existing file" }
1440
1688
  ],
1441
1689
  validate: (ctx) => {
1442
- validateMutation(ctx);
1690
+ validateMutation2(ctx);
1443
1691
  if (!ctx.str("file").trim()) throw new CliValidationError("--file must be non-empty.");
1444
1692
  if (!["add", "replace"].includes(ctx.str("action"))) throw new CliValidationError("--action must be add or replace.");
1445
1693
  },
1446
1694
  dryRun: async (ctx) => preview(ctx, "POST", "directory", mutationBody(ctx, await fileOperation(ctx, true))),
1447
- execute: async (ctx) => kbApi(ctx, "POST", endpoint(ctx), {}, mutationBody(ctx, await fileOperation(ctx, false)), apiOptions)
1695
+ execute: async (ctx) => kbApi(ctx, "POST", endpoint(ctx), {}, mutationBody(ctx, await fileOperation(ctx, false)), apiOptions2)
1448
1696
  };
1449
1697
  function deleteOperation(ctx) {
1450
1698
  return { action: "delete", path: ctx.str("path"), confirmed: true, ...ctx.bool("recursive") ? { recursive: true } : {} };
@@ -1457,19 +1705,19 @@ var sourceRm = {
1457
1705
  flags: [
1458
1706
  ...sourceFlags,
1459
1707
  pathFlag,
1460
- revisionFlag,
1708
+ revisionFlag2,
1461
1709
  { name: "recursive", type: "boolean", desc: "Explicitly allow recursive directory deletion" }
1462
1710
  ],
1463
- validate: validateMutation,
1711
+ validate: validateMutation2,
1464
1712
  dryRun: (ctx) => preview(ctx, "POST", "directory", mutationBody(ctx, deleteOperation(ctx))),
1465
- execute: (ctx) => kbApi(ctx, "POST", endpoint(ctx), {}, mutationBody(ctx, deleteOperation(ctx)), apiOptions)
1713
+ execute: (ctx) => kbApi(ctx, "POST", endpoint(ctx), {}, mutationBody(ctx, deleteOperation(ctx)), apiOptions2)
1466
1714
  };
1467
1715
 
1468
1716
  // src/commands/te-kb/version-management.ts
1469
- import { promises as fs4 } from "fs";
1470
- import path4 from "path";
1471
- var API = "/agent/api/external/knowledge-bases/versions";
1472
- var apiOptions2 = { preserveErrorMetadata: true, retryUnauthorized: true };
1717
+ import { promises as fs6 } from "fs";
1718
+ import path6 from "path";
1719
+ var API2 = "/agent/api/external/knowledge-bases/versions";
1720
+ var apiOptions3 = { preserveErrorMetadata: true, retryUnauthorized: false };
1473
1721
  var targetFlags = [
1474
1722
  { name: "name", type: "string", required: true, minLength: 1, maxLength: 200, desc: "Exact knowledge base name copied from +list" },
1475
1723
  { name: "scope", type: "string", desc: "Exact personal or company scope; omit for personal then company lookup" }
@@ -1481,7 +1729,7 @@ var pagingFlags = [
1481
1729
  { name: "limit", type: "number", default: 100, min: 1, max: 200, desc: "Page size from 1 to 200" }
1482
1730
  ];
1483
1731
  var pathFlag2 = { name: "path", type: "string", desc: "Exact path relative to the historical source directory" };
1484
- function positiveInteger(ctx, flag) {
1732
+ function positiveInteger2(ctx, flag) {
1485
1733
  const value = ctx.num(flag);
1486
1734
  if (!Number.isSafeInteger(value) || value < 1 || value > 2147483647) throw new CliValidationError(`--${flag} must be a positive integer no greater than 2147483647.`);
1487
1735
  return value;
@@ -1493,7 +1741,7 @@ function validateTarget(ctx) {
1493
1741
  }
1494
1742
  function validateVersion(ctx) {
1495
1743
  validateTarget(ctx);
1496
- positiveInteger(ctx, "version");
1744
+ positiveInteger2(ctx, "version");
1497
1745
  }
1498
1746
  function validateSource(ctx) {
1499
1747
  validateVersion(ctx);
@@ -1512,21 +1760,21 @@ function validatePath(ctx, required = false) {
1512
1760
  throw new CliValidationError("--path must be a normalized relative path inside the historical source.");
1513
1761
  }
1514
1762
  }
1515
- function query2(ctx) {
1763
+ function query3(ctx) {
1516
1764
  const scope = getExternalKnowledgeBaseTargetScope(ctx);
1517
1765
  return { name: ctx.str("name").trim(), ...scope ? { scope } : {} };
1518
1766
  }
1519
1767
  function pageQuery(ctx) {
1520
- return { ...query2(ctx), limit: ctx.num("limit"), ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {} };
1768
+ return { ...query3(ctx), limit: ctx.num("limit"), ...ctx.str("cursor") ? { cursor: ctx.str("cursor") } : {} };
1521
1769
  }
1522
1770
  function versionEndpoint(ctx, suffix = "") {
1523
- return `${API}/${positiveInteger(ctx, "version")}${suffix}`;
1771
+ return `${API2}/${positiveInteger2(ctx, "version")}${suffix}`;
1524
1772
  }
1525
- function sourceEndpoint(ctx, action) {
1773
+ function sourceEndpoint2(ctx, action) {
1526
1774
  return versionEndpoint(ctx, `/sources/${encodeURIComponent(ctx.str("id").trim())}/${action}`);
1527
1775
  }
1528
- function preview2(ctx, endpoint2, params, body) {
1529
- return { method: body ? "POST" : "GET", url: `${ctx.host().replace(/\/$/, "")}${endpoint2}`, params, ...body ? { body } : {} };
1776
+ function preview2(ctx, endpoint2, params, body2) {
1777
+ return { method: body2 ? "POST" : "GET", url: `${ctx.host().replace(/\/$/, "")}${endpoint2}`, params, ...body2 ? { body: body2 } : {} };
1530
1778
  }
1531
1779
  var versions = {
1532
1780
  service: "kb",
@@ -1539,8 +1787,8 @@ var versions = {
1539
1787
  validatePage(ctx);
1540
1788
  if (ctx.str("cursor") && (!/^[1-9][0-9]*$/.test(ctx.str("cursor")) || Number(ctx.str("cursor")) > 2147483647)) throw new CliValidationError("--cursor must be a version number returned as nextCursor.");
1541
1789
  },
1542
- dryRun: (ctx) => preview2(ctx, API, pageQuery(ctx)),
1543
- execute: (ctx) => kbApi(ctx, "GET", API, pageQuery(ctx), void 0, apiOptions2)
1790
+ dryRun: (ctx) => preview2(ctx, API2, pageQuery(ctx)),
1791
+ execute: (ctx) => kbApi(ctx, "GET", API2, pageQuery(ctx), void 0, apiOptions3)
1544
1792
  };
1545
1793
  var versionShow = {
1546
1794
  service: "kb",
@@ -1549,8 +1797,8 @@ var versionShow = {
1549
1797
  description: "Read one published version summary without reading current sources.",
1550
1798
  flags: [...targetFlags, versionFlag],
1551
1799
  validate: validateVersion,
1552
- dryRun: (ctx) => preview2(ctx, versionEndpoint(ctx), query2(ctx)),
1553
- execute: (ctx) => kbApi(ctx, "GET", versionEndpoint(ctx), query2(ctx), void 0, apiOptions2)
1800
+ dryRun: (ctx) => preview2(ctx, versionEndpoint(ctx), query3(ctx)),
1801
+ execute: (ctx) => kbApi(ctx, "GET", versionEndpoint(ctx), query3(ctx), void 0, apiOptions3)
1554
1802
  };
1555
1803
  var versionSources = {
1556
1804
  service: "kb",
@@ -1564,7 +1812,7 @@ var versionSources = {
1564
1812
  if (ctx.str("source-type") && !["file", "url", "zip"].includes(ctx.str("source-type"))) throw new CliValidationError("--source-type must be file, url, or zip.");
1565
1813
  },
1566
1814
  dryRun: (ctx) => preview2(ctx, versionEndpoint(ctx, "/sources"), { ...pageQuery(ctx), ...ctx.str("source-type") ? { sourceType: ctx.str("source-type") } : {} }),
1567
- execute: (ctx) => kbApi(ctx, "GET", versionEndpoint(ctx, "/sources"), { ...pageQuery(ctx), ...ctx.str("source-type") ? { sourceType: ctx.str("source-type") } : {} }, void 0, apiOptions2)
1815
+ execute: (ctx) => kbApi(ctx, "GET", versionEndpoint(ctx, "/sources"), { ...pageQuery(ctx), ...ctx.str("source-type") ? { sourceType: ctx.str("source-type") } : {} }, void 0, apiOptions3)
1568
1816
  };
1569
1817
  var versionDiff = {
1570
1818
  service: "kb",
@@ -1574,11 +1822,11 @@ var versionDiff = {
1574
1822
  flags: [...targetFlags, { ...versionFlag, name: "from", desc: "Before version number" }, { ...versionFlag, name: "to", desc: "After version number" }],
1575
1823
  validate: (ctx) => {
1576
1824
  validateTarget(ctx);
1577
- positiveInteger(ctx, "from");
1578
- positiveInteger(ctx, "to");
1825
+ positiveInteger2(ctx, "from");
1826
+ positiveInteger2(ctx, "to");
1579
1827
  },
1580
- dryRun: (ctx) => preview2(ctx, `${API}/compare`, { ...query2(ctx), from: ctx.num("from"), to: ctx.num("to") }),
1581
- execute: (ctx) => kbApi(ctx, "GET", `${API}/compare`, { ...query2(ctx), from: ctx.num("from"), to: ctx.num("to") }, void 0, apiOptions2)
1828
+ dryRun: (ctx) => preview2(ctx, `${API2}/compare`, { ...query3(ctx), from: ctx.num("from"), to: ctx.num("to") }),
1829
+ execute: (ctx) => kbApi(ctx, "GET", `${API2}/compare`, { ...query3(ctx), from: ctx.num("from"), to: ctx.num("to") }, void 0, apiOptions3)
1582
1830
  };
1583
1831
  var versionTree = {
1584
1832
  service: "kb",
@@ -1591,8 +1839,8 @@ var versionTree = {
1591
1839
  validatePath(ctx);
1592
1840
  validatePage(ctx);
1593
1841
  },
1594
- dryRun: (ctx) => preview2(ctx, sourceEndpoint(ctx, "tree"), { ...pageQuery(ctx), path: ctx.str("path") }),
1595
- execute: (ctx) => kbApi(ctx, "GET", sourceEndpoint(ctx, "tree"), { ...pageQuery(ctx), path: ctx.str("path") }, void 0, apiOptions2)
1842
+ dryRun: (ctx) => preview2(ctx, sourceEndpoint2(ctx, "tree"), { ...pageQuery(ctx), path: ctx.str("path") }),
1843
+ execute: (ctx) => kbApi(ctx, "GET", sourceEndpoint2(ctx, "tree"), { ...pageQuery(ctx), path: ctx.str("path") }, void 0, apiOptions3)
1596
1844
  };
1597
1845
  var versionRead = {
1598
1846
  service: "kb",
@@ -1604,8 +1852,8 @@ var versionRead = {
1604
1852
  validateSource(ctx);
1605
1853
  validatePath(ctx, true);
1606
1854
  },
1607
- dryRun: (ctx) => preview2(ctx, sourceEndpoint(ctx, "file"), { ...query2(ctx), path: ctx.str("path") }),
1608
- execute: (ctx) => kbApi(ctx, "GET", sourceEndpoint(ctx, "file"), { ...query2(ctx), path: ctx.str("path") }, void 0, apiOptions2)
1855
+ dryRun: (ctx) => preview2(ctx, sourceEndpoint2(ctx, "file"), { ...query3(ctx), path: ctx.str("path") }),
1856
+ execute: (ctx) => kbApi(ctx, "GET", sourceEndpoint2(ctx, "file"), { ...query3(ctx), path: ctx.str("path") }, void 0, apiOptions3)
1609
1857
  };
1610
1858
  var versionDownload = {
1611
1859
  service: "kb",
@@ -1617,12 +1865,12 @@ var versionDownload = {
1617
1865
  validateSource(ctx);
1618
1866
  if (!ctx.str("output").trim()) throw new CliValidationError("--output is required.");
1619
1867
  },
1620
- dryRun: (ctx) => ({ ...preview2(ctx, sourceEndpoint(ctx, "raw"), query2(ctx)), output: path4.resolve(ctx.str("output")) }),
1868
+ dryRun: (ctx) => ({ ...preview2(ctx, sourceEndpoint2(ctx, "raw"), query3(ctx)), output: path6.resolve(ctx.str("output")) }),
1621
1869
  execute: async (ctx) => {
1622
- const result = await kbApi(ctx, "GET", sourceEndpoint(ctx, "raw"), query2(ctx), void 0, { ...apiOptions2, responseType: "bytes" });
1623
- const output = path4.resolve(ctx.str("output"));
1870
+ const result = await kbApi(ctx, "GET", sourceEndpoint2(ctx, "raw"), query3(ctx), void 0, { ...apiOptions3, responseType: "bytes" });
1871
+ const output = path6.resolve(ctx.str("output"));
1624
1872
  const bytes = Buffer.from(result.bytes);
1625
- await fs4.writeFile(output, bytes, { flag: "wx" });
1873
+ await fs6.writeFile(output, bytes, { flag: "wx" });
1626
1874
  return { versionNumber: ctx.num("version"), sourceId: ctx.str("id").trim(), sizeBytes: String(bytes.length), output };
1627
1875
  }
1628
1876
  };
@@ -1646,8 +1894,8 @@ var rollback = {
1646
1894
  const latest = ctx.str("expected-latest-version-id");
1647
1895
  if (!latest || latest.length > 191) throw new CliValidationError("--expected-latest-version-id must contain 1 to 191 characters.");
1648
1896
  },
1649
- dryRun: (ctx) => preview2(ctx, versionEndpoint(ctx, "/rollback"), query2(ctx), rollbackBody(ctx)),
1650
- execute: (ctx) => kbApi(ctx, "POST", versionEndpoint(ctx, "/rollback"), query2(ctx), rollbackBody(ctx), apiOptions2)
1897
+ dryRun: (ctx) => preview2(ctx, versionEndpoint(ctx, "/rollback"), query3(ctx), rollbackBody(ctx)),
1898
+ execute: (ctx) => kbApi(ctx, "POST", versionEndpoint(ctx, "/rollback"), query3(ctx), rollbackBody(ctx), apiOptions3)
1651
1899
  };
1652
1900
  var rollbackStatus = {
1653
1901
  service: "kb",
@@ -1659,12 +1907,18 @@ var rollbackStatus = {
1659
1907
  validateTarget(ctx);
1660
1908
  if (!ctx.str("operation-id").trim() || ctx.str("operation-id").length > 191) throw new CliValidationError("--operation-id must contain 1 to 191 characters.");
1661
1909
  },
1662
- dryRun: (ctx) => preview2(ctx, `${API}/operations/${encodeURIComponent(ctx.str("operation-id").trim())}`, query2(ctx)),
1663
- execute: (ctx) => kbApi(ctx, "GET", `${API}/operations/${encodeURIComponent(ctx.str("operation-id").trim())}`, query2(ctx), void 0, apiOptions2)
1910
+ dryRun: (ctx) => preview2(ctx, `${API2}/operations/${encodeURIComponent(ctx.str("operation-id").trim())}`, query3(ctx)),
1911
+ execute: (ctx) => kbApi(ctx, "GET", `${API2}/operations/${encodeURIComponent(ctx.str("operation-id").trim())}`, query3(ctx), void 0, apiOptions3)
1664
1912
  };
1665
1913
 
1666
1914
  // src/commands/te-kb/index.ts
1667
1915
  var commands = [
1916
+ sourceCheckUpdates,
1917
+ sourceReplace,
1918
+ sourceRestore,
1919
+ sourcePreview,
1920
+ sourceCommit,
1921
+ sourceCancel,
1668
1922
  versions,
1669
1923
  versionShow,
1670
1924
  versionSources,
@@ -1716,9 +1970,15 @@ export {
1716
1970
  rollback,
1717
1971
  rollbackStatus,
1718
1972
  schema,
1973
+ sourceCancel,
1974
+ sourceCheckUpdates,
1975
+ sourceCommit,
1719
1976
  sourceLs,
1977
+ sourcePreview,
1720
1978
  sourcePut,
1721
1979
  sourceRead,
1980
+ sourceReplace,
1981
+ sourceRestore,
1722
1982
  sourceRm,
1723
1983
  status,
1724
1984
  url,