@thinkingai/ae-cli 6.0.60 → 6.0.62

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 (221) hide show
  1. package/README.md +6 -1
  2. package/README.zh.md +8 -1
  3. package/bin/runtime-capabilities.json +1 -1
  4. package/dist/{ai-monitor-FCXSLHAP.js → ai-monitor-X5GL44JT.js} +10 -9
  5. package/dist/ai-monitor.js +14 -13
  6. package/dist/{auth-ATK2SLEV.js → auth-SPQ46XQ3.js} +18 -10
  7. package/dist/{automation-FLCPFMN4.js → automation-7XC3VBZI.js} +87 -12
  8. package/dist/{capability-6KTSOI7L.js → capability-JZP4KXZC.js} +10 -9
  9. package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
  10. package/dist/{chunk-VRMGHQKE.js → chunk-2VKMHNUU.js} +11 -11
  11. package/dist/{chunk-2ETRY2CU.js → chunk-6HOM2FOJ.js} +19 -9
  12. package/dist/{chunk-KTJXD27G.js → chunk-AAN6KBUK.js} +3 -3
  13. package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
  14. package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
  15. package/dist/{chunk-BEYLCUZX.js → chunk-E457FREE.js} +3 -3
  16. package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
  17. package/dist/{chunk-5M5LBRR3.js → chunk-ETQXIZFP.js} +15 -8
  18. package/dist/{chunk-72NJKS7O.js → chunk-F36ORPI6.js} +7 -32
  19. package/dist/{chunk-5E7MTTFN.js → chunk-F7TCQPQX.js} +23 -9
  20. package/dist/{chunk-AXTO4FTM.js → chunk-FGGEF7MI.js} +3 -3
  21. package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
  22. package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
  23. package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
  24. package/dist/chunk-N2MAYIRU.js +32 -0
  25. package/dist/chunk-NNK3JBH4.js +60 -0
  26. package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
  27. package/dist/{chunk-HSZAIPUX.js → chunk-PRCHMOWT.js} +7 -5
  28. package/dist/chunk-PUSFEC6B.js +29 -0
  29. package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
  30. package/dist/{chunk-SDKW6LYE.js → chunk-RYY5NJK3.js} +3 -3
  31. package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
  32. package/dist/{chunk-VJUXKVRE.js → chunk-VR2D54AA.js} +2 -2
  33. package/dist/{chunk-HVMCPKOZ.js → chunk-YIG3L4RC.js} +1 -1
  34. package/dist/{chunk-LOR4IA26.js → chunk-YJYC5PLL.js} +166 -188
  35. package/dist/{chunk-F2VFZUGG.js → chunk-ZVUXAHEV.js} +2 -2
  36. package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
  37. package/dist/{compat-check-XD2U7PZ2.js → compat-check-JD5D77ET.js} +5 -4
  38. package/dist/{config-U3GDWU6E.js → config-IIMRATTP.js} +7 -6
  39. package/dist/{context-YAQG6YQC.js → context-BXHIPIIX.js} +8 -6
  40. package/dist/{data-integration-QE37EQ3A.js → data-integration-VRJQ3HVK.js} +7 -6
  41. package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
  42. package/dist/index.js +49 -43
  43. package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
  44. package/dist/{memory-WEB27VI6.js → memory-B44LY27L.js} +6 -7
  45. package/dist/{metadata-7FYE4234.js → metadata-ZVPG2MIA.js} +10 -9
  46. package/dist/{model-T7H7Q6BG.js → model-ANZBYVST.js} +4 -5
  47. package/dist/{personal-semantic-preference-O6VXM74A.js → personal-semantic-preference-YNCV4QG3.js} +45 -14
  48. package/dist/{project-semantic-2GGFJWW6.js → project-semantic-E7ZAQL5S.js} +9 -8
  49. package/dist/{sync-ULBB7WO5.js → sync-Y4OZRQAY.js} +9 -9
  50. package/dist/{te-agent-6RMF7LUV.js → te-agent-RKAUTYJZ.js} +303 -17
  51. package/dist/{te-analysis-HSYC7GNV.js → te-analysis-7N5VC4JB.js} +25 -20
  52. package/dist/{te-community-FLKZGQKB.js → te-community-SIA2UHTS.js} +13 -11
  53. package/dist/{te-dataops-OQQGTCUA.js → te-dataops-5MJQCODU.js} +13 -11
  54. package/dist/{te-engage-RIEBHL5T.js → te-engage-ZTLOMKO3.js} +73 -20
  55. package/dist/{te-kb-4HG2FMHJ.js → te-kb-LDL3MF2Y.js} +107 -25
  56. package/dist/{te-system-AL4B4XZL.js → te-system-473I5O53.js} +6 -7
  57. package/dist/{te-team-5O4UVUWE.js → te-team-JOWHCMZA.js} +92 -10
  58. package/dist/{things-TSJ64GBT.js → things-DOQ2L3O2.js} +9 -8
  59. package/dist/{update-Q5LURAWV.js → update-KUS6TCPB.js} +8 -6
  60. package/dist/{workspace-FF2HXJGR.js → workspace-MJFPIV7C.js} +6 -7
  61. package/package.json +6 -3
  62. package/skills/ae-agent/SKILL.md +19 -5
  63. package/skills/ae-agent/references/a2a.md +103 -0
  64. package/skills/ae-agent/references/command_index.md +11 -0
  65. package/skills/ae-analysis/SKILL.md +35 -23
  66. package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
  67. package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
  68. package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
  69. package/skills/ae-analysis/references/bad_case_review.md +4 -4
  70. package/skills/ae-analysis/references/command_index.md +7 -7
  71. package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
  72. package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
  73. package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
  74. package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
  75. package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
  76. package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
  77. package/skills/ae-analysis/references/project_owner_update.md +5 -1
  78. package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
  79. package/skills/ae-analysis/references/scenario_list.md +5 -6
  80. package/skills/ae-automation/SKILL.md +6 -2
  81. package/skills/ae-automation/references/cli.md +9 -3
  82. package/skills/ae-capability/SKILL.md +8 -4
  83. package/skills/ae-engage/SKILL.md +6 -1
  84. package/skills/ae-engage/references/common-metric.md +47 -1
  85. package/skills/ae-engage/references/flow-metric-update.md +1 -1
  86. package/skills/ae-engage/references/task-metric-update.md +1 -1
  87. package/skills/ae-kb/SKILL.md +11 -7
  88. package/skills/ae-kb/references/publication.md +45 -0
  89. package/skills/ae-kb/references/query-workflow.md +5 -1
  90. package/skills/ae-team/SKILL.md +7 -3
  91. package/skills/ae-team/references/copy-to-personal.md +7 -0
  92. package/skills/ae-team/references/promote.md +7 -0
  93. package/skills/ae-team/references/update.md +3 -3
  94. package/dist/chunk-Y74WTIKJ.js +0 -10
  95. package/skills/ae-tracking-matrix/SKILL.md +0 -170
  96. package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
  97. package/skills/ae-tracking-matrix/i18n.yaml +0 -12
  98. package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
  99. package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
  100. package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
  101. package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
  102. package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
  103. package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
  104. package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
  105. package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
  106. package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
  107. package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
  108. package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
  109. package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
  110. package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
  111. package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
  112. package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
  113. package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
  114. package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
  115. package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
  116. package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
  117. package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
  118. package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
  119. package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
  120. package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
  121. package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
  122. package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
  123. package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
  124. package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
  125. package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
  126. package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
  127. package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
  128. package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
  129. package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
  130. package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
  131. package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
  132. package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
  133. package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
  134. package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
  135. package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
  136. package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
  137. package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
  138. package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
  139. package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
  140. package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
  141. package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
  142. package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
  143. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
  144. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
  145. package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
  146. package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
  147. package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
  148. package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
  149. package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
  150. package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
  151. package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
  152. package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
  153. package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
  154. package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
  155. package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
  156. package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
  157. package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
  158. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
  159. package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
  160. package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
  161. package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
  162. package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
  163. package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
  164. package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
  165. package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
  166. package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
  167. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
  168. package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
  169. package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
  170. package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
  171. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
  172. package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
  173. package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
  174. package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
  175. package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
  176. package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
  177. package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
  178. package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
  179. package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
  180. package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
  181. package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
  182. package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
  183. package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
  184. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
  185. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
  186. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
  187. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
  188. package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
  189. package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
  190. package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
  191. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
  192. package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
  193. package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
  194. package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
  195. package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
  196. package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
  197. package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
  198. package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
  199. package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
  200. package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
  201. package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
  202. package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
  203. package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
  204. package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
  205. package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
  206. package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
  207. package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
  208. package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
  209. package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
  210. package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
  211. package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
  212. package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
  213. package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
  214. package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
  215. package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
  216. package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
  217. package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
  218. package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
  219. package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
  220. package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
  221. package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
@@ -1,28 +1,30 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  resolveHost
4
- } from "./chunk-2F64AZYH.js";
4
+ } from "./chunk-KA5WKR5P.js";
5
5
  import {
6
6
  printError
7
- } from "./chunk-VJUXKVRE.js";
7
+ } from "./chunk-VR2D54AA.js";
8
8
  import {
9
- internalCallSourceHeaders
10
- } from "./chunk-Y74WTIKJ.js";
11
- import "./chunk-LOR4IA26.js";
9
+ sourceLoggedFetch
10
+ } from "./chunk-NNK3JBH4.js";
11
+ import "./chunk-YJYC5PLL.js";
12
+ import "./chunk-PUSFEC6B.js";
12
13
  import {
13
14
  SecureStoreAuthError,
14
- getCliToken
15
- } from "./chunk-HTZ2MLYA.js";
15
+ getCliToken,
16
+ internalCallSourceHeaders
17
+ } from "./chunk-PLNS5J33.js";
16
18
  import {
17
19
  safeJsonParse
18
- } from "./chunk-4PSTYEG5.js";
20
+ } from "./chunk-AMURHMS3.js";
19
21
  import {
20
22
  CliApiError,
21
23
  CliValidationError,
22
24
  PermissionError,
23
25
  externalCliTokenRequestOptions,
24
26
  logger
25
- } from "./chunk-Z3Q2AEIN.js";
27
+ } from "./chunk-R2SVAO4G.js";
26
28
 
27
29
  // src/commands/te-dataops/shared.ts
28
30
  import { randomBytes } from "crypto";
@@ -172,7 +174,7 @@ async function downloadDataopsApi(ctx, path, params, targetPath) {
172
174
  const host = resolveHost(ctx.host());
173
175
  const token = await getCliToken(host);
174
176
  const url = buildUrl(host, path, compactArgs(params));
175
- const resp = await fetch(url, {
177
+ const resp = await sourceLoggedFetch(url, {
176
178
  method: "GET",
177
179
  ...externalCliTokenRequestOptions(url),
178
180
  headers: {
@@ -231,7 +233,7 @@ async function dataopsRequest(ctx, method, path, params = {}, body) {
231
233
  if (method !== "GET") {
232
234
  options.body = JSON.stringify(body ?? {});
233
235
  }
234
- const resp = await fetch(url, { ...options, ...externalCliTokenRequestOptions(url) });
236
+ const resp = await sourceLoggedFetch(url, { ...options, ...externalCliTokenRequestOptions(url) });
235
237
  const text = await resp.text();
236
238
  const data = parseResponseBody(text, url, resp.status, !resp.ok);
237
239
  logger.api(method, url, resp.status, body, data);
@@ -1,7 +1,7 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  createCapabilityCommand
4
- } from "./chunk-BEYLCUZX.js";
4
+ } from "./chunk-E457FREE.js";
5
5
  import {
6
6
  registerCapabilityGatewayRoute,
7
7
  resolveGatewayDomain
@@ -9,21 +9,22 @@ import {
9
9
  import {
10
10
  printError,
11
11
  withOutputMetadata
12
- } from "./chunk-VJUXKVRE.js";
12
+ } from "./chunk-VR2D54AA.js";
13
13
  import {
14
14
  CapabilityGatewayError,
15
15
  buildCapabilityGatewayUrl,
16
16
  fetchCapabilityGateway,
17
17
  requestCapabilityGateway,
18
18
  requestCapabilityGatewayWithEnvelope
19
- } from "./chunk-2ETRY2CU.js";
20
- import "./chunk-Y74WTIKJ.js";
21
- import "./chunk-LOR4IA26.js";
22
- import "./chunk-HTZ2MLYA.js";
23
- import "./chunk-4PSTYEG5.js";
19
+ } from "./chunk-6HOM2FOJ.js";
20
+ import "./chunk-NNK3JBH4.js";
21
+ import "./chunk-YJYC5PLL.js";
22
+ import "./chunk-PUSFEC6B.js";
23
+ import "./chunk-PLNS5J33.js";
24
+ import "./chunk-AMURHMS3.js";
24
25
  import {
25
26
  CliValidationError
26
- } from "./chunk-Z3Q2AEIN.js";
27
+ } from "./chunk-R2SVAO4G.js";
27
28
 
28
29
  // src/commands/te-engage/shared.ts
29
30
  function createEngageCapabilityCommand(cliService, config) {
@@ -1747,19 +1748,58 @@ var commonMetricGet = createEngageSettingCapabilityCommand({
1747
1748
  });
1748
1749
 
1749
1750
  // src/commands/te-engage/engage-setting/common-metric/metric-qp-validation.ts
1750
- var VALID_WINDOW_TIME_UNITS = /* @__PURE__ */ new Set(["minute", "hour", "day"]);
1751
+ var VALID_WINDOW_TIME_UNITS = /* @__PURE__ */ new Set(["minute", "hour", "day", "week", "month"]);
1751
1752
  function validateMetricDefinitionFlag(definition) {
1752
1753
  validateSemanticMetricDefinition(definition, "--metric-definition");
1753
1754
  }
1754
- function validateMetricWindowTimeUnitFlag(unit) {
1755
- if (VALID_WINDOW_TIME_UNITS.has(unit)) {
1755
+ function validateMetricWindowFlags(unit, num, cycle, update = false) {
1756
+ if (!VALID_WINDOW_TIME_UNITS.has(unit)) {
1757
+ invalidWindow("--metric-window-time-unit must be one of: minute, hour, day, week, month.");
1758
+ }
1759
+ if (!Number.isInteger(num) || num < 1) {
1760
+ invalidWindow("--metric-window-num must be a positive integer.");
1761
+ }
1762
+ if (cycle === void 0 && update) {
1763
+ if ((unit === "week" || unit === "month") && num !== 1) {
1764
+ invalidWindow("Natural week/month windows require --metric-window-num 1.");
1765
+ }
1756
1766
  return;
1757
1767
  }
1758
- printError(
1759
- "validation",
1760
- "--metric-window-time-unit must be one of: minute, hour, day.",
1761
- "Use lowercase values matching the Engage console / TimeUnitEnum."
1762
- );
1768
+ if (cycle === void 0 || cycle === null) {
1769
+ if (unit === "week" || unit === "month") {
1770
+ invalidWindow("Week/month windows require a non-null --time-cycle-def.");
1771
+ }
1772
+ return;
1773
+ }
1774
+ if (typeof cycle !== "object" || Array.isArray(cycle)) {
1775
+ invalidWindow("--time-cycle-def must be an object or null.");
1776
+ }
1777
+ const def = cycle;
1778
+ if (Object.keys(def).some((key) => key !== "start_day" && key !== "start_time")) {
1779
+ invalidWindow("--time-cycle-def accepts only start_day and start_time.");
1780
+ }
1781
+ if (num !== 1 || !["day", "week", "month"].includes(unit)) {
1782
+ invalidWindow("Natural windows require --metric-window-num 1 and unit day, week, or month.");
1783
+ }
1784
+ if (unit === "day" && "start_day" in def) {
1785
+ invalidWindow("Natural day windows must omit start_day.");
1786
+ }
1787
+ if (unit === "week" || unit === "month") {
1788
+ const max = unit === "week" ? 7 : 28;
1789
+ if (!Number.isInteger(def.start_day) || def.start_day < 1 || def.start_day > max) {
1790
+ invalidWindow(`Natural ${unit} start_day must be an integer from 1 to ${max}.`);
1791
+ }
1792
+ }
1793
+ if (unit === "month") {
1794
+ if ("start_time" in def && def.start_time !== "00:00") {
1795
+ invalidWindow("Natural month start_time must be omitted or 00:00.");
1796
+ }
1797
+ } else if (typeof def.start_time !== "string" || !/^([01][0-9]|2[0-3]):[0-5][0-9]$/.test(def.start_time)) {
1798
+ invalidWindow("Natural day/week start_time must use HH:mm (00:00-23:59).");
1799
+ }
1800
+ }
1801
+ function invalidWindow(message) {
1802
+ printError("validation", message, "Omit --time-cycle-def on update to preserve it; pass null to use a rolling window.");
1763
1803
  process.exit(1);
1764
1804
  }
1765
1805
  function validatePresetMetricTypeFlag(metricType) {
@@ -1790,8 +1830,9 @@ var writeFlags = [
1790
1830
  name: "metric-window-time-unit",
1791
1831
  type: "string",
1792
1832
  required: true,
1793
- desc: "Metric window time unit (minute/hour/day)."
1833
+ desc: "Rolling unit: minute/hour/day; natural cycle unit: day/week/month."
1794
1834
  },
1835
+ { name: "time-cycle-def", type: "json", required: false, desc: "Natural cycle {start_day?, start_time?}. Omit on update to preserve; null selects a rolling window." },
1795
1836
  { name: "display-name", type: "string", required: true, desc: "Display name of the metric." },
1796
1837
  { name: "note", type: "string", required: false, desc: "Metric note/remark." },
1797
1838
  { name: "order-id", type: "number", required: false, desc: "Sort order id." },
@@ -1805,6 +1846,7 @@ var buildWriteInput = (ctx) => ({
1805
1846
  metric_definition: ctx.json("metric-definition"),
1806
1847
  metric_window_num: ctx.num("metric-window-num"),
1807
1848
  metric_window_time_unit: ctx.str("metric-window-time-unit"),
1849
+ time_cycle_def: ctx.json("time-cycle-def"),
1808
1850
  display_name: ctx.str("display-name"),
1809
1851
  note: ctx.str("note") || void 0,
1810
1852
  order_id: ctx.optionalNum("order-id"),
@@ -1821,7 +1863,11 @@ var commonMetricCreate = createEngageSettingCapabilityCommand({
1821
1863
  validate: (ctx) => {
1822
1864
  validatePresetMetricTypeFlag(ctx.num("metric-type"));
1823
1865
  validateMetricDefinitionFlag(ctx.json("metric-definition"));
1824
- validateMetricWindowTimeUnitFlag(ctx.str("metric-window-time-unit"));
1866
+ validateMetricWindowFlags(
1867
+ ctx.str("metric-window-time-unit"),
1868
+ ctx.num("metric-window-num"),
1869
+ ctx.json("time-cycle-def")
1870
+ );
1825
1871
  },
1826
1872
  buildInput: buildWriteInput
1827
1873
  });
@@ -1842,8 +1888,9 @@ var writeFlags2 = [
1842
1888
  name: "metric-window-time-unit",
1843
1889
  type: "string",
1844
1890
  required: true,
1845
- desc: "Metric window time unit (minute/hour/day)."
1891
+ desc: "Rolling unit: minute/hour/day; natural cycle unit: day/week/month."
1846
1892
  },
1893
+ { name: "time-cycle-def", type: "json", required: false, desc: "Natural cycle {start_day?, start_time?}. Omit on update to preserve; null selects a rolling window." },
1847
1894
  { name: "display-name", type: "string", required: true, desc: "Display name of the metric." },
1848
1895
  { name: "note", type: "string", required: false, desc: "Metric note/remark." },
1849
1896
  { name: "order-id", type: "number", required: false, desc: "Sort order id." },
@@ -1857,6 +1904,7 @@ var buildWriteInput2 = (ctx) => ({
1857
1904
  metric_definition: ctx.json("metric-definition"),
1858
1905
  metric_window_num: ctx.num("metric-window-num"),
1859
1906
  metric_window_time_unit: ctx.str("metric-window-time-unit"),
1907
+ time_cycle_def: ctx.json("time-cycle-def"),
1860
1908
  display_name: ctx.str("display-name"),
1861
1909
  note: ctx.str("note") || void 0,
1862
1910
  order_id: ctx.optionalNum("order-id"),
@@ -1872,7 +1920,12 @@ var commonMetricUpdate = createEngageSettingCapabilityCommand({
1872
1920
  risk: "write",
1873
1921
  validate: (ctx) => {
1874
1922
  validateMetricDefinitionFlag(ctx.json("metric-definition"));
1875
- validateMetricWindowTimeUnitFlag(ctx.str("metric-window-time-unit"));
1923
+ validateMetricWindowFlags(
1924
+ ctx.str("metric-window-time-unit"),
1925
+ ctx.num("metric-window-num"),
1926
+ ctx.json("time-cycle-def"),
1927
+ true
1928
+ );
1876
1929
  },
1877
1930
  buildInput: buildWriteInput2
1878
1931
  });
@@ -2,26 +2,27 @@ import { createRequire as __createRequire } from 'node:module'; const require =
2
2
  import {
3
3
  kbApi,
4
4
  kbUpload
5
- } from "./chunk-5E7MTTFN.js";
5
+ } from "./chunk-F7TCQPQX.js";
6
6
  import {
7
7
  TeAgentApiError
8
- } from "./chunk-5M5LBRR3.js";
8
+ } from "./chunk-ETQXIZFP.js";
9
9
  import {
10
10
  printError
11
- } from "./chunk-VJUXKVRE.js";
11
+ } from "./chunk-VR2D54AA.js";
12
12
  import {
13
13
  CapabilityGatewayError
14
- } from "./chunk-2ETRY2CU.js";
15
- import "./chunk-Y74WTIKJ.js";
16
- import "./chunk-LOR4IA26.js";
17
- import "./chunk-HTZ2MLYA.js";
18
- import "./chunk-4PSTYEG5.js";
14
+ } from "./chunk-6HOM2FOJ.js";
15
+ import "./chunk-NNK3JBH4.js";
16
+ import "./chunk-YJYC5PLL.js";
17
+ import "./chunk-PUSFEC6B.js";
18
+ import "./chunk-PLNS5J33.js";
19
+ import "./chunk-AMURHMS3.js";
19
20
  import {
20
21
  CliApiError,
21
22
  CliValidationError,
22
23
  PermissionError,
23
24
  kbExecutionContextRequired
24
- } from "./chunk-Z3Q2AEIN.js";
25
+ } from "./chunk-R2SVAO4G.js";
25
26
 
26
27
  // src/commands/te-kb/project-target.ts
27
28
  var API_PATH = "/agent/api/project-semantic-target";
@@ -221,7 +222,15 @@ function createBody(ctx) {
221
222
  (source) => !source || !["personal", "company", "system"].includes(source.scope) || typeof source.name !== "string" || !source.name || Object.keys(source).some((key) => !["name", "scope"].includes(key))
222
223
  )))
223
224
  throw new CliValidationError("--sources must be an array of {scope,name}");
225
+ const candidateId = ctx.str("candidate");
226
+ if (candidateId || ctx.has?.("candidate")) {
227
+ if (!/^[A-Za-z0-9_-]{1,191}$/.test(candidateId))
228
+ throw new CliValidationError("Invalid --candidate");
229
+ if (!Array.isArray(sources) || sources.length !== 1 || sources[0].scope !== "company")
230
+ throw new CliValidationError("--candidate requires exactly one company KB in --sources");
231
+ }
224
232
  return {
233
+ ...candidateId ? { candidateId } : {},
225
234
  ...sources ? { sources } : {},
226
235
  ...ctx.str("locale") ? { locale: ctx.str("locale") } : {}
227
236
  };
@@ -231,13 +240,14 @@ var readContextCreate = {
231
240
  resource: "read-context",
232
241
  command: "create",
233
242
  risk: "read",
234
- description: "Pin the current authorized formal KB views for subsequent reads (15 minutes).",
243
+ description: "Pin authorized formal KB views or one pending candidate for subsequent reads (15 minutes).",
235
244
  flags: [
236
245
  {
237
246
  name: "sources",
238
247
  type: "json",
239
248
  desc: "Optional array of {scope,name}; omit to discover authorized published KBs"
240
249
  },
250
+ { ...candidate, required: false },
241
251
  { name: "locale", type: "string", desc: "zh | en | ja | ko" }
242
252
  ],
243
253
  validate: (ctx) => {
@@ -248,7 +258,16 @@ var readContextCreate = {
248
258
  url: ctx.host().replace(/\/$/, "") + `${root}/read-contexts`,
249
259
  body: createBody(ctx)
250
260
  }),
251
- execute: (ctx) => kbApi(ctx, "POST", `${root}/read-contexts`, {}, createBody(ctx), options)
261
+ execute: async (ctx) => {
262
+ const body4 = createBody(ctx);
263
+ const result = await kbApi(ctx, "POST", `${root}/read-contexts`, {}, body4, options);
264
+ if (body4.candidateId && (!result?.readContextId || !Array.isArray(result.views) || result.views.length !== 1 || result.views[0]?.viewKind !== "candidate" || result.views[0]?.candidateId !== body4.candidateId))
265
+ throw new CliApiError("This server did not return the requested candidate read context.", {
266
+ code: "KB_CANDIDATE_READ_CONTEXT_UNSUPPORTED",
267
+ hint: "Use a Host that supports candidate read contexts."
268
+ });
269
+ return result;
270
+ }
252
271
  };
253
272
  var readContextRelease = {
254
273
  service: "kb",
@@ -1093,6 +1112,29 @@ var add = {
1093
1112
  }
1094
1113
  };
1095
1114
 
1115
+ // src/commands/te-kb/content-language.ts
1116
+ function requestedContentLanguage(ctx) {
1117
+ const value = ctx.str("content-language");
1118
+ if (!value) return void 0;
1119
+ if (!/^[A-Za-z]{2,8}$/.test(value.trim())) {
1120
+ throw new Error("--content-language must be a BCP-47 primary language subtag, such as ko.");
1121
+ }
1122
+ return value.trim().toLowerCase();
1123
+ }
1124
+ async function requestWithContentLanguage(ctx, path9, body4, api = kbApi, preserveBusinessErrorCode = false) {
1125
+ try {
1126
+ if (preserveBusinessErrorCode) {
1127
+ return await api(ctx, "POST", path9, {}, body4, { preserveBusinessErrorCode: true });
1128
+ }
1129
+ return await api(ctx, "POST", path9, {}, body4);
1130
+ } catch (error) {
1131
+ if (body4.contentLanguage && error instanceof Error && /^body:\s/.test(error.message)) {
1132
+ throw new Error("The server does not support the requested knowledge-base language option.", { cause: error });
1133
+ }
1134
+ throw error;
1135
+ }
1136
+ }
1137
+
1096
1138
  // src/commands/te-kb/compile.ts
1097
1139
  var API_PATH5 = "/agent/api/external/knowledge-bases/compile";
1098
1140
  var VALID_MODES = /* @__PURE__ */ new Set(["incremental", "full"]);
@@ -1112,6 +1154,8 @@ function buildBody(ctx) {
1112
1154
  if (scope) body4.scope = scope;
1113
1155
  const model = ctx.str("model");
1114
1156
  if (model) body4.model = model;
1157
+ const contentLanguage = requestedContentLanguage(ctx);
1158
+ if (contentLanguage) body4.contentLanguage = contentLanguage;
1115
1159
  return body4;
1116
1160
  }
1117
1161
  var compile = {
@@ -1119,6 +1163,7 @@ var compile = {
1119
1163
  command: "+compile",
1120
1164
  description: "Compile a knowledge.",
1121
1165
  flags: [
1166
+ { name: "content-language", type: "string", required: false, desc: "Require the working guidelines to declare this language before compilation." },
1122
1167
  { name: "name", type: "string", required: true, desc: "Knowledge base name" },
1123
1168
  { name: "mode", type: "string", required: false, default: "incremental", desc: "Compile mode: incremental | full (default: incremental)" },
1124
1169
  { name: "scope", type: "string", required: false, desc: "Exact knowledge base scope: personal | company (omit for personal \u2192 company fallback)" },
@@ -1126,15 +1171,14 @@ var compile = {
1126
1171
  ],
1127
1172
  risk: "write",
1128
1173
  validate: (ctx) => {
1129
- getMode(ctx);
1130
- getExternalKnowledgeBaseTargetScope(ctx);
1174
+ buildBody(ctx);
1131
1175
  },
1132
1176
  dryRun: (ctx) => ({
1133
1177
  method: "POST",
1134
1178
  url: `${ctx.host().replace(/\/$/, "")}${API_PATH5}`,
1135
1179
  body: buildBody(ctx)
1136
1180
  }),
1137
- execute: async (ctx) => kbApi(ctx, "POST", API_PATH5, {}, buildBody(ctx))
1181
+ execute: async (ctx) => requestWithContentLanguage(ctx, API_PATH5, buildBody(ctx))
1138
1182
  };
1139
1183
 
1140
1184
  // src/commands/te-kb/remove.ts
@@ -1320,18 +1364,24 @@ function buildBody5(ctx) {
1320
1364
  if (model) body4.model = model;
1321
1365
  const customInstructions = getCustomInstructions(ctx);
1322
1366
  if (customInstructions) body4.customInstructions = customInstructions;
1367
+ const contentLanguage = requestedContentLanguage(ctx);
1368
+ if (contentLanguage) body4.contentLanguage = contentLanguage;
1369
+ if (ctx.bool("rewrite-language")) {
1370
+ if (!contentLanguage) throw new Error("--rewrite-language requires --content-language.");
1371
+ body4.schemaMode = "rewrite-language";
1372
+ }
1323
1373
  return body4;
1324
1374
  }
1325
1375
  async function executeSchema(ctx, api = kbApi) {
1326
- return api(ctx, "POST", API_PATH9, {}, buildBody5(ctx), {
1327
- preserveBusinessErrorCode: true
1328
- });
1376
+ return requestWithContentLanguage(ctx, API_PATH9, buildBody5(ctx), api, true);
1329
1377
  }
1330
1378
  var schema = {
1331
1379
  service: "kb",
1332
1380
  command: "+schema",
1333
1381
  description: "Generate the compile schema for a knowledge base via POST /agent/api/external/knowledge-bases/schema.",
1334
1382
  flags: [
1383
+ { name: "content-language", type: "string", required: false, desc: "Set the knowledge-base content language while generating the guidelines." },
1384
+ { name: "rewrite-language", type: "boolean", required: false, desc: "Rewrite the language of the existing guidelines while preserving their rules." },
1335
1385
  { name: "name", type: "string", required: true, desc: "Knowledge base name (looked up personal \u2192 company)" },
1336
1386
  { name: "scope", type: "string", required: false, desc: "Exact knowledge base scope: personal | company (omit for personal \u2192 company fallback)" },
1337
1387
  { name: "force", type: "boolean", required: false, desc: "Preempt generation even when status is `generating` (use only for stuck recovery)" },
@@ -1354,7 +1404,7 @@ var schema = {
1354
1404
  risk: "write",
1355
1405
  validate: (ctx) => {
1356
1406
  getExternalKnowledgeBaseTargetScope(ctx);
1357
- getCustomInstructions(ctx);
1407
+ buildBody5(ctx);
1358
1408
  },
1359
1409
  dryRun: (ctx) => ({
1360
1410
  method: "POST",
@@ -1664,7 +1714,7 @@ var kbGrep = {
1664
1714
  name: "paths",
1665
1715
  type: "json",
1666
1716
  required: true,
1667
- desc: 'JSON array of wiki pages or subdirectories copied from +index, e.g. ["wiki/sandbox.md"] or ["wiki/guides"]'
1717
+ desc: 'JSON array of files or subdirectories strictly under wiki/, copied from returned navigation, e.g. ["wiki/sandbox.md"] or ["wiki/guides"]. The roots "wiki" and "wiki/", index.md, raw/, absolute paths and paths escaping wiki/ are invalid. If navigation provides no usable paths, skip +grep; never use the wiki root as a fallback.'
1668
1718
  },
1669
1719
  { name: "top-k", type: "number", required: false, min: 1, max: 50, desc: "Max number of pages to return (1-50, default 10)" },
1670
1720
  { name: "locale", type: "string", required: false, desc: "Optional locale: zh | en | ja | ko" }
@@ -1764,6 +1814,26 @@ var kbRead = {
1764
1814
  execute: async (ctx) => kbApi(ctx, "POST", API_PATH16, {}, buildBody10(ctx))
1765
1815
  };
1766
1816
 
1817
+ // src/commands/te-kb/ask-identity.ts
1818
+ function askIdentity(value) {
1819
+ function invalid() {
1820
+ throw new CliValidationError("Ask response is missing or has inconsistent readViews. This host may not support explicit contexts.", { code: "KB_READ_CONTEXT_MISMATCH" });
1821
+ }
1822
+ if (!Array.isArray(value) || !value.length || value.length > 100) return invalid();
1823
+ const identities = value.map((view) => {
1824
+ if (!view || typeof view !== "object") return invalid();
1825
+ const text = (key) => typeof view[key] === "string" && view[key].trim().length > 0;
1826
+ if (!text("resourceKey") || !text("readIdentity")) return invalid();
1827
+ if (view.viewKind === "candidate") {
1828
+ if (view.consistency !== "candidate_pinned" || !text("candidateId") || !(view.baseVersion === null || text("baseVersion")) || view.versionId !== null || view.versionNumber !== null)
1829
+ return invalid();
1830
+ } else if (view.viewKind !== "snapshot" || view.consistency !== "version_pinned" || !text("versionId") || !Number.isSafeInteger(view.versionNumber) || view.versionNumber < 1) return invalid();
1831
+ return ["resourceKey", "viewKind", "consistency", "readIdentity", "versionId", "versionNumber", "candidateId", "baseVersion"].map((key) => view[key] ?? null);
1832
+ });
1833
+ if (new Set(identities.map((view) => view[0])).size !== identities.length) return invalid();
1834
+ return JSON.stringify(identities.sort((a, b) => String(a[0]).localeCompare(String(b[0]))));
1835
+ }
1836
+
1767
1837
  // src/commands/te-kb/ask-shared.ts
1768
1838
  var ASK_API_PATH = "/agent/api/external/knowledge-bases/ask";
1769
1839
  var ASK_POLL_INTERVAL_MS = 5e3;
@@ -1818,6 +1888,7 @@ function transformCompletedResponse(response) {
1818
1888
  answer: response.answer ?? "",
1819
1889
  sources: response.sources ?? []
1820
1890
  };
1891
+ if (response.readViews !== void 0) result.readViews = response.readViews;
1821
1892
  if (response.modelId !== void 0) result.modelId = response.modelId;
1822
1893
  if (response.modelUsage !== void 0) result.modelUsage = response.modelUsage;
1823
1894
  if (response.toolCallCount !== void 0) result.toolCallCount = response.toolCallCount;
@@ -1858,6 +1929,7 @@ var ask = {
1858
1929
  command: "+ask",
1859
1930
  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.",
1860
1931
  flags: [
1932
+ { name: "read-context", type: "string", required: false, desc: "Use an existing formal snapshot or pending candidate context. Omit for existing published Ask behavior." },
1861
1933
  {
1862
1934
  name: "question",
1863
1935
  type: "string",
@@ -1893,23 +1965,31 @@ var ask = {
1893
1965
  dryRun: (ctx) => ({
1894
1966
  method: "POST",
1895
1967
  url: `${ctx.host().replace(/\/$/, "")}${ASK_API_PATH}`,
1896
- body: buildBody11(ctx)
1968
+ body: buildBody11(ctx),
1969
+ ...ctx.str("read-context") ? { headers: { "X-KB-Read-Context": ctx.str("read-context") } } : {}
1897
1970
  }),
1898
1971
  execute: async (ctx) => {
1899
1972
  const noWait = ctx.bool("no-wait");
1900
- const submitResponse = await kbApi(ctx, "POST", ASK_API_PATH, {}, buildBody11(ctx));
1973
+ const submitResponse = await kbApi(ctx, "POST", ASK_API_PATH, {}, buildBody11(ctx), ctx.str("read-context") ? { preserveErrorMetadata: true } : {});
1901
1974
  if (!submitResponse.executionId) {
1902
1975
  throw new Error("Invalid submit response: missing executionId");
1903
1976
  }
1904
1977
  const executionId = submitResponse.executionId;
1978
+ const identity = ctx.str("read-context") ? askIdentity(submitResponse.readViews) : void 0;
1905
1979
  if (noWait) {
1906
1980
  return {
1907
1981
  executionId,
1908
- status: submitResponse.status
1982
+ status: submitResponse.status,
1983
+ ...identity ? { readViews: submitResponse.readViews } : {}
1909
1984
  };
1910
1985
  }
1911
1986
  const finalResponse = await pollUntilSettled(
1912
- (id) => kbApi(ctx, "GET", ASK_API_PATH, { executionId: id }),
1987
+ async (id) => {
1988
+ const response = await kbApi(ctx, "GET", ASK_API_PATH, { executionId: id }, void 0, identity ? { preserveErrorMetadata: true } : {});
1989
+ if (identity && askIdentity(response.readViews) !== identity)
1990
+ throw new CliValidationError("Ask response changed its version identity.", { code: "KB_READ_CONTEXT_MISMATCH" });
1991
+ return response;
1992
+ },
1913
1993
  executionId
1914
1994
  );
1915
1995
  if (finalResponse.status === "completed") {
@@ -1984,10 +2064,12 @@ var askStatus = {
1984
2064
  { code: "KB_READ_CONTEXT_REFERENCE_FORBIDDEN" }
1985
2065
  );
1986
2066
  }
1987
- return kbApi(ctx, "GET", ASK_API_PATH, {
2067
+ const result = await kbApi(ctx, "GET", ASK_API_PATH, {
1988
2068
  executionId,
1989
2069
  ...sourceIndex !== void 0 ? { sourceIndex } : {}
1990
- });
2070
+ }, void 0, { preserveErrorMetadata: true });
2071
+ if (result.readViews !== void 0) askIdentity(result.readViews);
2072
+ return result;
1991
2073
  }
1992
2074
  };
1993
2075
 
@@ -1,8 +1,8 @@
1
1
  import { createRequire as __createRequire } from 'node:module'; const require = __createRequire(import.meta.url);
2
2
  import {
3
3
  require_archiver
4
- } from "./chunk-OAWPT7VP.js";
5
- import "./chunk-JEUXDY3B.js";
4
+ } from "./chunk-2I5SZ5DS.js";
5
+ import "./chunk-HQED4YB4.js";
6
6
  import {
7
7
  TeAgentApiError,
8
8
  deleteFromMainApp,
@@ -12,19 +12,18 @@ import {
12
12
  postToMainApp,
13
13
  putToMainApp,
14
14
  uploadToMainApp
15
- } from "./chunk-5M5LBRR3.js";
16
- import "./chunk-Y74WTIKJ.js";
17
- import "./chunk-HTZ2MLYA.js";
15
+ } from "./chunk-ETQXIZFP.js";
16
+ import "./chunk-PLNS5J33.js";
18
17
  import {
19
18
  isAeSandboxRuntime,
20
19
  readSandboxCliTokenEntry,
21
20
  safeJsonParse
22
- } from "./chunk-4PSTYEG5.js";
21
+ } from "./chunk-AMURHMS3.js";
23
22
  import {
24
23
  CliValidationError,
25
24
  PermissionError,
26
25
  __toESM
27
- } from "./chunk-Z3Q2AEIN.js";
26
+ } from "./chunk-R2SVAO4G.js";
28
27
 
29
28
  // src/commands/te-system/shared.ts
30
29
  import { readFileSync } from "fs";