xkzoom 1.5.1 → 1.5.3

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 (228) hide show
  1. package/README.md +125 -55
  2. package/dist/{chunk-VPRVZWF3.mjs → chunk-37LYF6K2.mjs} +1 -1
  3. package/dist/{chunk-OCQUSYRP.mjs → chunk-3EV63LAA.mjs} +12 -12
  4. package/dist/{chunk-W4MKSQGZ.mjs → chunk-3FF266OG.mjs} +1 -1
  5. package/dist/{chunk-J5HTLG3V.mjs → chunk-3LR4CLDE.mjs} +1 -1
  6. package/dist/{chunk-CDLS44GZ.mjs → chunk-3TTLV2GM.mjs} +1 -1
  7. package/dist/{chunk-JG3EPJ32.mjs → chunk-54GVKP6B.mjs} +6 -6
  8. package/dist/{chunk-M52HZV6R.mjs → chunk-5VR6UOGC.mjs} +1 -1
  9. package/dist/{chunk-GBG4AJON.mjs → chunk-6EI5MFLD.mjs} +4 -4
  10. package/dist/{chunk-A23OTVH2.mjs → chunk-6LKZYMIW.mjs} +30 -30
  11. package/dist/{chunk-TAQQSDJN.mjs → chunk-6SYECCCG.mjs} +6 -6
  12. package/dist/{chunk-24GJWXMG.mjs → chunk-7MOQ462O.mjs} +1 -1
  13. package/dist/{chunk-LFZAVCVW.mjs → chunk-AJNXWGX2.mjs} +1 -1
  14. package/dist/{chunk-5DMSAPS2.mjs → chunk-APQRVOZQ.mjs} +5 -5
  15. package/dist/{chunk-YAD4VG2K.mjs → chunk-BHT6B2TV.mjs} +36 -6
  16. package/dist/{chunk-BV76CMVR.mjs → chunk-BN273XTH.mjs} +1 -1
  17. package/dist/{chunk-IXYH42YO.mjs → chunk-C5VQPAOA.mjs} +1 -1
  18. package/dist/{chunk-PY7W2X6W.mjs → chunk-CQAQRU4P.mjs} +114 -107
  19. package/dist/{chunk-Q4XUEIOE.mjs → chunk-CVIZMDMZ.mjs} +1 -1
  20. package/dist/{chunk-SIIEMWE3.mjs → chunk-DB4XTPJF.mjs} +7 -7
  21. package/dist/{chunk-URF75O5Z.mjs → chunk-DBYEZK64.mjs} +1 -1
  22. package/dist/{chunk-GIAML5K5.mjs → chunk-DQ7J7RST.mjs} +1 -1
  23. package/dist/{chunk-BHMWYAVS.mjs → chunk-DXPZNBSQ.mjs} +3 -3
  24. package/dist/chunk-E5LABIPO.mjs +201 -0
  25. package/dist/{chunk-A5DUSLHF.mjs → chunk-ED4H2DM7.mjs} +1 -1
  26. package/dist/{chunk-KYTJH3R3.mjs → chunk-EE3NRJLQ.mjs} +1 -1
  27. package/dist/{chunk-T4LPE43H.mjs → chunk-ESYRDWFO.mjs} +11 -11
  28. package/dist/{chunk-CQUISJWG.mjs → chunk-EYK3W2NV.mjs} +1 -1
  29. package/dist/{chunk-Z7GTU7KF.mjs → chunk-FAJHYXNU.mjs} +5 -5
  30. package/dist/{chunk-XHO73X2N.mjs → chunk-FKCGJ3BF.mjs} +2 -2
  31. package/dist/{chunk-HJN232FK.mjs → chunk-FLVJABFP.mjs} +1 -1
  32. package/dist/{chunk-H5DIQHEQ.mjs → chunk-FZ7NLBVP.mjs} +45 -16
  33. package/dist/{chunk-HTU5W436.mjs → chunk-G5LQ2PQ6.mjs} +2 -2
  34. package/dist/{chunk-LTBQWMAJ.mjs → chunk-GSIZ5FR6.mjs} +2 -2
  35. package/dist/{chunk-UANVP2AV.mjs → chunk-H4BNL7XG.mjs} +1 -1
  36. package/dist/{chunk-Q6XX6X24.mjs → chunk-I4LMW3IM.mjs} +1 -1
  37. package/dist/{chunk-VIZQURO5.mjs → chunk-IGJFAE72.mjs} +9 -9
  38. package/dist/{chunk-7AZVQS2H.mjs → chunk-IVR74IXK.mjs} +7 -7
  39. package/dist/{chunk-YILSXMZI.mjs → chunk-KI7AMK7P.mjs} +3 -3
  40. package/dist/{chunk-EQNHKW6L.mjs → chunk-LJF6JSJB.mjs} +1 -1
  41. package/dist/{chunk-JD5NPIMO.mjs → chunk-LSQ47CLM.mjs} +27 -27
  42. package/dist/{chunk-IPIV4NGB.mjs → chunk-LXEKUNXI.mjs} +6 -6
  43. package/dist/{chunk-HR43WO4Q.mjs → chunk-M6VHS3HQ.mjs} +2 -2
  44. package/dist/{chunk-4DYFM3EC.mjs → chunk-MI6GFOCU.mjs} +4 -4
  45. package/dist/{chunk-CFZVBILR.mjs → chunk-MIXYB6BH.mjs} +1 -1
  46. package/dist/{chunk-K4RHLREV.mjs → chunk-MVKCMXBY.mjs} +1 -1
  47. package/dist/{chunk-JG3K4N5B.mjs → chunk-NIV5GVCE.mjs} +1 -1
  48. package/dist/{chunk-ZTKJR7OC.mjs → chunk-OWIXULFQ.mjs} +1 -1
  49. package/dist/{chunk-Y6SJUTY6.mjs → chunk-P262PAGZ.mjs} +15 -2
  50. package/dist/{chunk-5JGUBBXN.mjs → chunk-PBBRBETA.mjs} +4 -4
  51. package/dist/{chunk-EGWLJJY7.mjs → chunk-QSHIFD37.mjs} +2 -2
  52. package/dist/{chunk-WJIY3BIA.mjs → chunk-QSQ274C6.mjs} +44 -16
  53. package/dist/{chunk-H5TJYSTV.mjs → chunk-QSUD6TNR.mjs} +5 -5
  54. package/dist/{chunk-YPAQRMUI.mjs → chunk-QYXYVBTO.mjs} +2 -2
  55. package/dist/{chunk-OB4JJLDC.mjs → chunk-RVW5XO4A.mjs} +4 -4
  56. package/dist/{chunk-CNHOCDRM.mjs → chunk-RYSPXH7G.mjs} +2 -2
  57. package/dist/{chunk-CCCPWU2O.mjs → chunk-RZW4EEPW.mjs} +22 -22
  58. package/dist/{chunk-GGWUDW5W.mjs → chunk-S5ROBD7X.mjs} +2 -2
  59. package/dist/{chunk-QUXUHJZW.mjs → chunk-SQHTVHQ7.mjs} +7 -7
  60. package/dist/{chunk-ZM23SMRO.mjs → chunk-T5ZCLYLJ.mjs} +1 -1
  61. package/dist/{chunk-NYG3IUXK.mjs → chunk-TER7DFHP.mjs} +1 -1
  62. package/dist/{chunk-RTANSWHW.mjs → chunk-THN36GA5.mjs} +27 -27
  63. package/dist/{chunk-GUADF3KN.mjs → chunk-ULXTQSV6.mjs} +4 -0
  64. package/dist/{chunk-PG5CHH66.mjs → chunk-VHRFLCMY.mjs} +1 -1
  65. package/dist/{chunk-BSQF7NF4.mjs → chunk-W7OJPFTN.mjs} +2 -2
  66. package/dist/{chunk-S7FQBXOO.mjs → chunk-WGLYR2YT.mjs} +1 -1
  67. package/dist/{chunk-G5ZU7562.mjs → chunk-WNI5ZPQY.mjs} +7 -7
  68. package/dist/{chunk-7FLALKSN.mjs → chunk-WRRJFJ2N.mjs} +7 -7
  69. package/dist/{chunk-ILROJZBI.mjs → chunk-WV6OKJ4J.mjs} +37 -9
  70. package/dist/{chunk-ASIBETCT.mjs → chunk-X7P6B2LK.mjs} +10 -10
  71. package/dist/{chunk-MWRQORKQ.mjs → chunk-XF4EURDX.mjs} +1 -1
  72. package/dist/{chunk-ETD5LGJY.mjs → chunk-Z3COATFF.mjs} +1 -1
  73. package/dist/index.js +336 -31
  74. package/dist/index.mjs +169 -168
  75. package/dist/mobile/action-planner.js +21 -1
  76. package/dist/mobile/action-planner.mjs +95 -94
  77. package/dist/mobile/agent-capabilities.js +21 -1
  78. package/dist/mobile/agent-capabilities.mjs +96 -95
  79. package/dist/mobile/agent-shop/handlers.mjs +3 -3
  80. package/dist/mobile/anthropic-incremental-deliver.js +19 -0
  81. package/dist/mobile/anthropic-incremental-deliver.mjs +3 -2
  82. package/dist/mobile/anthropic-messages-turn-runner.js +224 -8
  83. package/dist/mobile/anthropic-messages-turn-runner.mjs +104 -103
  84. package/dist/mobile/anthropic-owned-tool-executor.js +21 -1
  85. package/dist/mobile/anthropic-owned-tool-executor.mjs +103 -102
  86. package/dist/mobile/api.mjs +49 -49
  87. package/dist/mobile/context-compact/compact-artifact-enrich.js +19 -0
  88. package/dist/mobile/context-compact/compact-artifact-enrich.mjs +16 -15
  89. package/dist/mobile/context-compact/compact-artifact-writer.mjs +4 -4
  90. package/dist/mobile/context-compact/compact-engine-artifacts.mjs +5 -5
  91. package/dist/mobile/context-compact/compact-memory-distill-job.mjs +3 -3
  92. package/dist/mobile/context-compact/compact-message-collector.mjs +2 -2
  93. package/dist/mobile/context-compact/compact-orchestrator.js +21 -1
  94. package/dist/mobile/context-compact/compact-orchestrator.mjs +34 -33
  95. package/dist/mobile/context-compact/compact-resume-prefetch.mjs +4 -4
  96. package/dist/mobile/context-compact/compact-summarizer-engine-artifact.js +19 -0
  97. package/dist/mobile/context-compact/compact-summarizer-engine-artifact.mjs +18 -17
  98. package/dist/mobile/context-compact/compact-summarizer-llm-request.js +19 -0
  99. package/dist/mobile/context-compact/compact-summarizer-llm-request.mjs +10 -9
  100. package/dist/mobile/context-compact/compact-summarizer-llm.js +19 -0
  101. package/dist/mobile/context-compact/compact-summarizer-llm.mjs +11 -10
  102. package/dist/mobile/context-compact/compact-summarizer.js +19 -0
  103. package/dist/mobile/context-compact/compact-summarizer.mjs +15 -14
  104. package/dist/mobile/context-compact/compact-write-verifier.mjs +2 -2
  105. package/dist/mobile/context-compact/context-budget-gate.js +14 -2
  106. package/dist/mobile/context-compact/context-budget-gate.mjs +2 -2
  107. package/dist/mobile/context-compact/runtime-compact-hook.js +33 -2
  108. package/dist/mobile/context-compact/runtime-compact-hook.mjs +99 -98
  109. package/dist/mobile/group/conductor-llm.js +19 -0
  110. package/dist/mobile/group/conductor-llm.mjs +13 -12
  111. package/dist/mobile/group/conductor-plan-llm.js +19 -0
  112. package/dist/mobile/group/conductor-plan-llm.mjs +19 -18
  113. package/dist/mobile/group/delivery-verification.mjs +4 -4
  114. package/dist/mobile/group/direct-chat-group-context.mjs +1 -1
  115. package/dist/mobile/group/execution-plan.mjs +5 -5
  116. package/dist/mobile/group/floor-scheduler.mjs +7 -7
  117. package/dist/mobile/group/floor-state-store.mjs +6 -6
  118. package/dist/mobile/group/group-api-handlers.mjs +38 -38
  119. package/dist/mobile/group/group-peer-private-context.mjs +1 -1
  120. package/dist/mobile/group/group-session.mjs +19 -19
  121. package/dist/mobile/group/index.mjs +32 -32
  122. package/dist/mobile/group/memory-supplement.mjs +10 -10
  123. package/dist/mobile/group/orchestrator.mjs +30 -30
  124. package/dist/mobile/group/pipeline-ceo-dept-mention-parse.mjs +3 -3
  125. package/dist/mobile/group/pipeline-handoff-verification.mjs +3 -3
  126. package/dist/mobile/group/pipeline-turn-outcome.mjs +2 -2
  127. package/dist/mobile/group/plan-runtime.mjs +18 -18
  128. package/dist/mobile/group/relation-distill.mjs +8 -8
  129. package/dist/mobile/group/runtime-integration.mjs +36 -36
  130. package/dist/mobile/index.js +336 -31
  131. package/dist/mobile/index.mjs +164 -163
  132. package/dist/mobile/interrupted-turn.js +5 -0
  133. package/dist/mobile/interrupted-turn.mjs +3 -1
  134. package/dist/mobile/memory-contract-r1-prefetch.mjs +11 -11
  135. package/dist/mobile/memory-contract-r5-empty-result.mjs +12 -12
  136. package/dist/mobile/memory-runtime-v2/eval-runner.mjs +4 -4
  137. package/dist/mobile/memory-runtime-v2/evidence-plan.mjs +5 -5
  138. package/dist/mobile/memory-runtime-v2/index.mjs +15 -15
  139. package/dist/mobile/memory-runtime-v2/memory-control-plane.mjs +5 -5
  140. package/dist/mobile/memory-runtime-v2/memory-readiness.mjs +5 -5
  141. package/dist/mobile/memory-runtime-v2/orchestrator.mjs +3 -3
  142. package/dist/mobile/memory-runtime-v2/public-api.mjs +6 -6
  143. package/dist/mobile/model-context-window-budget.js +16 -2
  144. package/dist/mobile/model-context-window-budget.mjs +3 -1
  145. package/dist/mobile/native-anthropic-messages-stream.js +223 -7
  146. package/dist/mobile/native-anthropic-messages-stream.mjs +11 -10
  147. package/dist/mobile/native-anthropic-turn-errors.mjs +2 -2
  148. package/dist/mobile/native-openai-text-stream.js +223 -6
  149. package/dist/mobile/native-openai-text-stream.mjs +2 -1
  150. package/dist/mobile/native-reply-route.js +19 -0
  151. package/dist/mobile/native-reply-route.mjs +10 -9
  152. package/dist/mobile/native-reply-system-prompt-layers.js +21 -1
  153. package/dist/mobile/native-reply-system-prompt-layers.mjs +96 -95
  154. package/dist/mobile/native-request-diagnostics.js +230 -0
  155. package/dist/mobile/native-request-diagnostics.mjs +17 -0
  156. package/dist/mobile/native-stream-block-emit.js +19 -0
  157. package/dist/mobile/native-stream-block-emit.mjs +2 -1
  158. package/dist/mobile/openai-completions-turn-runner.js +224 -8
  159. package/dist/mobile/openai-completions-turn-runner.mjs +104 -103
  160. package/dist/mobile/reply-dispatch-warmup.mjs +2 -2
  161. package/dist/mobile/runtime.js +336 -31
  162. package/dist/mobile/runtime.mjs +161 -160
  163. package/dist/mobile/stream-inbound/mobile-text-stream-pipeline.mjs +3 -3
  164. package/dist/mobile/tool-use-input-normalize.js +21 -1
  165. package/dist/mobile/tool-use-input-normalize.mjs +98 -97
  166. package/dist/mobile/tools/mobile-compact-tool-bridge.js +21 -1
  167. package/dist/mobile/tools/mobile-compact-tool-bridge.mjs +98 -97
  168. package/dist/org/dept-context.mjs +4 -4
  169. package/dist/org/index.mjs +14 -14
  170. package/dist/owned-tools/ceo-confirm-requirements.mjs +12 -12
  171. package/dist/owned-tools/ceo-decision.mjs +18 -18
  172. package/dist/owned-tools/ceo-ops-brief.mjs +12 -12
  173. package/dist/owned-tools/ceo-redirect.mjs +37 -37
  174. package/dist/owned-tools/commit-stack-lesson.mjs +13 -13
  175. package/dist/owned-tools/compact/execute.js +21 -1
  176. package/dist/owned-tools/compact/execute.mjs +96 -95
  177. package/dist/owned-tools/compact/gateway-tool-factory.js +21 -1
  178. package/dist/owned-tools/compact/gateway-tool-factory.mjs +97 -96
  179. package/dist/owned-tools/compact/registry.js +21 -1
  180. package/dist/owned-tools/compact/registry.mjs +95 -94
  181. package/dist/owned-tools/context-compact.js +21 -1
  182. package/dist/owned-tools/context-compact.mjs +42 -41
  183. package/dist/owned-tools/groups-history.mjs +1 -1
  184. package/dist/owned-tools/handoff.mjs +17 -17
  185. package/dist/owned-tools/memory-control.mjs +7 -7
  186. package/dist/owned-tools/memory-runtime-eval.mjs +6 -6
  187. package/dist/owned-tools/message.mjs +2 -2
  188. package/dist/owned-tools/models-list.mjs +2 -2
  189. package/dist/owned-tools/register-owned-providers.mjs +5 -5
  190. package/dist/owned-tools/registry.js +21 -1
  191. package/dist/owned-tools/registry.mjs +94 -93
  192. package/dist/owned-tools/router.js +21 -1
  193. package/dist/owned-tools/router.mjs +95 -94
  194. package/dist/owned-tools/runtime-bridge.js +21 -1
  195. package/dist/owned-tools/runtime-bridge.mjs +96 -95
  196. package/dist/owned-tools/session-status.mjs +1 -1
  197. package/dist/owned-tools/sessions-history-resolver.mjs +2 -2
  198. package/dist/owned-tools/sessions-history.mjs +1 -1
  199. package/dist/owned-tools/sessions-send.mjs +1 -1
  200. package/dist/owned-tools/subagents.mjs +1 -1
  201. package/dist/owned-tools/tool-contract-prompt.js +21 -1
  202. package/dist/owned-tools/tool-contract-prompt.mjs +95 -94
  203. package/dist/owned-tools/tool-result-envelope.js +21 -1
  204. package/dist/owned-tools/tool-result-envelope.mjs +97 -96
  205. package/dist/owned-tools/tool-usage-guide.js +21 -1
  206. package/dist/owned-tools/tool-usage-guide.mjs +94 -93
  207. package/dist/owned-tools/tts.mjs +4 -4
  208. package/dist/owned-tools/web-smoke.mjs +6 -6
  209. package/dist/project/file-tool-scope-default.mjs +6 -6
  210. package/dist/project-pipeline/handlers.mjs +37 -37
  211. package/dist/project-pipeline/index.mjs +40 -40
  212. package/dist/project-pipeline/pipeline-routing.mjs +2 -2
  213. package/dist/project-pipeline/post-close-skill-evolution.mjs +5 -5
  214. package/dist/project-pipeline/project-store.mjs +5 -5
  215. package/gateway-core/README.md +6 -0
  216. package/package.json +5 -2
  217. package/dist/{chunk-UNZ3D3B3.mjs → chunk-3OXBG4OP.mjs} +5 -5
  218. package/dist/{chunk-NRJWLPTI.mjs → chunk-6AY6OPO5.mjs} +3 -3
  219. package/dist/{chunk-JA65ZG3H.mjs → chunk-6ZWKLMY3.mjs} +4 -4
  220. package/dist/{chunk-T23H5D4O.mjs → chunk-AINHKBJW.mjs} +3 -3
  221. package/dist/{chunk-2BGXTBZX.mjs → chunk-D3N7EHB2.mjs} +8 -8
  222. package/dist/{chunk-JIY7IOQ5.mjs → chunk-DRY7AJMM.mjs} +3 -3
  223. package/dist/{chunk-QM7MTC5Q.mjs → chunk-H6LMX5G5.mjs} +3 -3
  224. package/dist/{chunk-2TBXT3PD.mjs → chunk-J74WVZGF.mjs} +6 -6
  225. package/dist/{chunk-WPLDZLAL.mjs → chunk-L7PMYQN5.mjs} +3 -3
  226. package/dist/{chunk-CORUFGMR.mjs → chunk-N3YQ5IL6.mjs} +7 -7
  227. package/dist/{chunk-5LUTMHVL.mjs → chunk-NXKHSX4M.mjs} +3 -3
  228. package/dist/{chunk-MGWYJD5Q.mjs → chunk-QCSNRVL2.mjs} +8 -8
@@ -6,7 +6,7 @@ import {
6
6
  } from "./chunk-TKW3XDFP.mjs";
7
7
  import {
8
8
  MobileTextStreamPipeline
9
- } from "./chunk-2TBXT3PD.mjs";
9
+ } from "./chunk-J74WVZGF.mjs";
10
10
  import {
11
11
  MobileStreamRoundToolFlight
12
12
  } from "./chunk-6B2OT7ND.mjs";
@@ -18,33 +18,41 @@ import {
18
18
  } from "./chunk-LGNLS7ZN.mjs";
19
19
  import {
20
20
  callPostAgentIntentLlm
21
- } from "./chunk-PG5CHH66.mjs";
21
+ } from "./chunk-VHRFLCMY.mjs";
22
22
  import {
23
23
  callConductorPlanLlm
24
- } from "./chunk-YPAQRMUI.mjs";
24
+ } from "./chunk-QYXYVBTO.mjs";
25
25
  import {
26
26
  buildRunningSummaryContextBlock
27
27
  } from "./chunk-42NDWKUN.mjs";
28
28
  import {
29
29
  detectCompactDoneFromAssistantText,
30
30
  evaluateAndMaybeRunContextCompact
31
- } from "./chunk-SIIEMWE3.mjs";
31
+ } from "./chunk-DB4XTPJF.mjs";
32
+ import {
33
+ createFinalTraceLogger,
34
+ previewFinalTraceText
35
+ } from "./chunk-5PZJDP37.mjs";
32
36
  import {
33
37
  inferMobileUpstreamDispatchFailureMeta
34
38
  } from "./chunk-7L46MOG4.mjs";
35
39
  import {
36
40
  registerXreBucketGatewayBridge
37
41
  } from "./chunk-PJKLQF3K.mjs";
38
- import {
39
- createFinalTraceLogger,
40
- previewFinalTraceText
41
- } from "./chunk-5PZJDP37.mjs";
42
42
  import {
43
43
  resolveDefaultFileToolScopeForTurn
44
- } from "./chunk-JG3K4N5B.mjs";
44
+ } from "./chunk-NIV5GVCE.mjs";
45
45
  import {
46
46
  applyStateRootHygiene
47
47
  } from "./chunk-BAS4J57E.mjs";
48
+ import {
49
+ detectToolChoicePolicyForTurn
50
+ } from "./chunk-O6YH4BTO.mjs";
51
+ import {
52
+ buildToolResultMediaUrlList,
53
+ mapRawSourcePerDeliveredPart,
54
+ slimDeliveredPartForToolResult
55
+ } from "./chunk-BIEZNK2B.mjs";
48
56
  import {
49
57
  getMobileWebSocketServer
50
58
  } from "./chunk-ZMQ3UOGP.mjs";
@@ -52,6 +60,12 @@ import {
52
60
  resolveWorkspaceStartupBlock,
53
61
  shouldAttachWorkspaceStartup
54
62
  } from "./chunk-WQSQXDUL.mjs";
63
+ import {
64
+ sliceSessionMessagesV2Page
65
+ } from "./chunk-M2WHIUNH.mjs";
66
+ import {
67
+ settleMobileReasoningDeliverAfterInboundIdle
68
+ } from "./chunk-GSWQMKOE.mjs";
55
69
  import {
56
70
  buildMobileSystemPromptSnapshot
57
71
  } from "./chunk-AP4WVS6L.mjs";
@@ -60,13 +74,12 @@ import {
60
74
  healStaleToolCallsAfterStreamFinalize
61
75
  } from "./chunk-ZNRN6DTK.mjs";
62
76
  import {
63
- detectToolChoicePolicyForTurn
64
- } from "./chunk-O6YH4BTO.mjs";
77
+ detectFakeProviderImageUrl,
78
+ rehostRemoteImageUrlIfNeeded
79
+ } from "./chunk-E6MVUDMP.mjs";
65
80
  import {
66
- buildToolResultMediaUrlList,
67
- mapRawSourcePerDeliveredPart,
68
- slimDeliveredPartForToolResult
69
- } from "./chunk-BIEZNK2B.mjs";
81
+ createOwnedReplyTextCapture
82
+ } from "./chunk-EOWUJO75.mjs";
70
83
  import {
71
84
  ensureReplyDispatchWarmupComplete,
72
85
  startReplyDispatchWarmup
@@ -75,21 +88,12 @@ import {
75
88
  resolveWebchatSendSessionKeyFromSessions
76
89
  } from "./chunk-BD3VJKX4.mjs";
77
90
  import {
78
- sliceSessionMessagesV2Page
79
- } from "./chunk-M2WHIUNH.mjs";
80
- import {
81
- settleMobileReasoningDeliverAfterInboundIdle
82
- } from "./chunk-GSWQMKOE.mjs";
91
+ appendMobileOfflineBatchGatewayTranscriptMaybe,
92
+ offlineSyncPartToGatewayPlainText
93
+ } from "./chunk-CYVEZZL5.mjs";
83
94
  import {
84
95
  runNativeOpenAiCompletionsTurnToDispatcher
85
- } from "./chunk-ILROJZBI.mjs";
86
- import {
87
- detectFakeProviderImageUrl,
88
- rehostRemoteImageUrlIfNeeded
89
- } from "./chunk-E6MVUDMP.mjs";
90
- import {
91
- createOwnedReplyTextCapture
92
- } from "./chunk-EOWUJO75.mjs";
96
+ } from "./chunk-WV6OKJ4J.mjs";
93
97
  import {
94
98
  promoteExactOutboundPathTextToNativeReply
95
99
  } from "./chunk-IWVFK6JY.mjs";
@@ -99,37 +103,26 @@ import {
99
103
  resolveNativeReplyRoute,
100
104
  resolveNativeReplyRouteAsync,
101
105
  shouldResolveNativeReplyRouteAsync
102
- } from "./chunk-HTU5W436.mjs";
106
+ } from "./chunk-G5LQ2PQ6.mjs";
103
107
  import {
104
108
  buildNativeAnthropicTurnToolBlocks,
105
109
  buildNativeOpenAiTurnToolBlocks,
106
110
  buildNativeReplyRuntimeContextBlocks,
107
111
  buildOwnedNativeReplyChildTurnBlocks
108
- } from "./chunk-EQNHKW6L.mjs";
112
+ } from "./chunk-LJF6JSJB.mjs";
109
113
  import {
110
114
  composeNativeReplySystemPrompt
111
115
  } from "./chunk-3STOFADV.mjs";
112
116
  import {
113
- appendMobileOfflineBatchGatewayTranscriptMaybe,
114
- offlineSyncPartToGatewayPlainText
115
- } from "./chunk-CYVEZZL5.mjs";
117
+ buildMobileReasoningReplyOptions
118
+ } from "./chunk-46TY43IV.mjs";
116
119
  import {
117
120
  formatNativeAnthropicTurnUserMessage
118
- } from "./chunk-KYTJH3R3.mjs";
121
+ } from "./chunk-EE3NRJLQ.mjs";
119
122
  import {
120
123
  isMobileSuppressFinalBlockAssistTextDeliverEnabled,
121
124
  shouldSuppressAssistTextFromNativeDeliver
122
125
  } from "./chunk-ZJEZUSIG.mjs";
123
- import {
124
- MOBILE_PLUGIN_HTTP_ROUTE_DEFS
125
- } from "./chunk-VMM5GYS2.mjs";
126
- import {
127
- buildMobileReasoningReplyOptions
128
- } from "./chunk-46TY43IV.mjs";
129
- import {
130
- buildMemoryContractR1ExtraSystemPrompt,
131
- shouldAttachMemoryContractR1Prompt
132
- } from "./chunk-6MOIFLPP.mjs";
133
126
  import {
134
127
  buildMemoryContractR3StrongDeliveryHint,
135
128
  buildR3AuditNote,
@@ -138,43 +131,20 @@ import {
138
131
  } from "./chunk-CTOIVB2P.mjs";
139
132
  import {
140
133
  runR5EmptyResultInvestigation
141
- } from "./chunk-UANVP2AV.mjs";
142
- import {
143
- prefetchMemoryR1Block
144
- } from "./chunk-Q4XUEIOE.mjs";
145
- import {
146
- rehydrateChatMessageForClient,
147
- rehydrateChatMessagesForClient
148
- } from "./chunk-USRORWYS.mjs";
149
- import {
150
- resolveOutboundLocalMediaAbsolutePath
151
- } from "./chunk-I77V2ROO.mjs";
152
- import {
153
- tryInlineLocalImageAsDataUrl
154
- } from "./chunk-JOT5IE27.mjs";
155
- import {
156
- deriveFileMetaFromUrlOrPath,
157
- parseAnyDataUrlPayload,
158
- tryInlineLocalMediaAsDataUrl
159
- } from "./chunk-5HQXZCIX.mjs";
134
+ } from "./chunk-H4BNL7XG.mjs";
160
135
  import {
161
- buildInterruptedTurnResumeContextBlock,
162
- classifyTurnTimeoutKind,
163
- createInterruptedTurnSnapshot,
164
- extractLastToolNameFromError,
165
- extractTurnMetricFromError,
166
- findActiveInterruptedTurnSnapshotBefore,
167
- isInterruptedTurnResumeRequest
168
- } from "./chunk-GUADF3KN.mjs";
136
+ MOBILE_PLUGIN_HTTP_ROUTE_DEFS
137
+ } from "./chunk-VMM5GYS2.mjs";
169
138
  import {
170
139
  expandMediaUrlWildcards
171
140
  } from "./chunk-RXRZEWNK.mjs";
172
141
  import {
173
- mergeComposerContextUsageForFinalize
174
- } from "./chunk-37TO75LW.mjs";
142
+ prefetchMemoryR1Block
143
+ } from "./chunk-CVIZMDMZ.mjs";
175
144
  import {
176
- tryExtractContextUsageRatioFromDeliverPayload
177
- } from "./chunk-OCARTQYW.mjs";
145
+ buildMemoryContractR1ExtraSystemPrompt,
146
+ shouldAttachMemoryContractR1Prompt
147
+ } from "./chunk-6MOIFLPP.mjs";
178
148
  import {
179
149
  extractMobileReplyPayload
180
150
  } from "./chunk-4OUQZDQG.mjs";
@@ -198,9 +168,30 @@ import {
198
168
  tryParseGatewayChatAbortContext
199
169
  } from "./chunk-CI47MU64.mjs";
200
170
  import {
201
- createEmptyMobileBodyHuntRoundTrace,
202
- formatBodyHuntPreview
203
- } from "./chunk-3T3BHHE7.mjs";
171
+ rehydrateChatMessageForClient,
172
+ rehydrateChatMessagesForClient
173
+ } from "./chunk-USRORWYS.mjs";
174
+ import {
175
+ resolveOutboundLocalMediaAbsolutePath
176
+ } from "./chunk-I77V2ROO.mjs";
177
+ import {
178
+ tryInlineLocalImageAsDataUrl
179
+ } from "./chunk-JOT5IE27.mjs";
180
+ import {
181
+ deriveFileMetaFromUrlOrPath,
182
+ parseAnyDataUrlPayload,
183
+ tryInlineLocalMediaAsDataUrl
184
+ } from "./chunk-5HQXZCIX.mjs";
185
+ import {
186
+ buildInterruptedTurnResumeContextBlock,
187
+ classifyTurnTimeoutKind,
188
+ createInterruptedTurnSnapshot,
189
+ extractLastToolNameFromError,
190
+ extractTurnMetricFromError,
191
+ findActiveInterruptedTurnSnapshotBefore,
192
+ hasInterruptedTurnRecoveryEvidence,
193
+ isInterruptedTurnResumeRequest
194
+ } from "./chunk-ULXTQSV6.mjs";
204
195
  import {
205
196
  MOBILE_CHANNEL_ID,
206
197
  isMobileChannelEnabled,
@@ -208,11 +199,14 @@ import {
208
199
  resolveMobileRouteAgent
209
200
  } from "./chunk-B4YKXZ5W.mjs";
210
201
  import {
211
- runNativeAnthropicMessagesTurnToDispatcher
212
- } from "./chunk-WJIY3BIA.mjs";
202
+ mergeComposerContextUsageForFinalize
203
+ } from "./chunk-37TO75LW.mjs";
204
+ import {
205
+ tryExtractContextUsageRatioFromDeliverPayload
206
+ } from "./chunk-OCARTQYW.mjs";
213
207
  import {
214
208
  createMobileApiRequestHandler
215
- } from "./chunk-4DYFM3EC.mjs";
209
+ } from "./chunk-MI6GFOCU.mjs";
216
210
  import {
217
211
  consumeInboundMobileUploadRef,
218
212
  looksLikeXkzoomMediaRefV1
@@ -220,14 +214,21 @@ import {
220
214
  import {
221
215
  resolveMobileAuthConfig
222
216
  } from "./chunk-FU5NWQEP.mjs";
217
+ import {
218
+ createEmptyMobileBodyHuntRoundTrace,
219
+ formatBodyHuntPreview
220
+ } from "./chunk-3T3BHHE7.mjs";
223
221
  import {
224
222
  buildAgentCapabilities
225
- } from "./chunk-Z7GTU7KF.mjs";
223
+ } from "./chunk-FAJHYXNU.mjs";
224
+ import {
225
+ runNativeAnthropicMessagesTurnToDispatcher
226
+ } from "./chunk-QSQ274C6.mjs";
226
227
  import {
227
228
  OWNED_TURN_TOOL_NAMES,
228
229
  buildOwnedToolsCatalog,
229
230
  buildOwnedTurnToolSchemas
230
- } from "./chunk-RTANSWHW.mjs";
231
+ } from "./chunk-THN36GA5.mjs";
231
232
  import {
232
233
  buildSessionTranscriptMeterFromMessages
233
234
  } from "./chunk-4IWTTXQE.mjs";
@@ -244,10 +245,13 @@ import {
244
245
  } from "./chunk-4ELPLFOH.mjs";
245
246
  import {
246
247
  buildNativeTranscriptBudgetForContextWindow
247
- } from "./chunk-Y6SJUTY6.mjs";
248
+ } from "./chunk-P262PAGZ.mjs";
248
249
  import {
249
250
  runNativeAnthropicMessagesStreamToDispatcher
250
- } from "./chunk-H5DIQHEQ.mjs";
251
+ } from "./chunk-FZ7NLBVP.mjs";
252
+ import {
253
+ enforceR6IndexAfterWrite
254
+ } from "./chunk-GOSSEVA6.mjs";
251
255
  import {
252
256
  MemoryContractR1Tracker,
253
257
  MemoryContractR2Tracker,
@@ -260,32 +264,15 @@ import {
260
264
  import {
261
265
  enforceR2Write
262
266
  } from "./chunk-GU4CQC5I.mjs";
263
- import {
264
- enforceR6IndexAfterWrite
265
- } from "./chunk-GOSSEVA6.mjs";
266
267
  import {
267
268
  buildRecentDiaryContextBlock,
268
269
  buildRecentDiaryInjectSummary
269
270
  } from "./chunk-BW737ZQN.mjs";
270
- import {
271
- runNativeOpenAiTextStreamToDispatcher
272
- } from "./chunk-YAD4VG2K.mjs";
273
- import {
274
- diagnoseNativeReplyRouteMiss,
275
- formatNativeReplyRouteMissMessage
276
- } from "./chunk-NEDXMES6.mjs";
277
- import {
278
- applyModelOverrideToGatewayConfig,
279
- gatewayAgentWantsFullToolLoop,
280
- init_native_gateway_config,
281
- normalizeModelOverrideKey,
282
- resolveGatewayAgentToolsProfile
283
- } from "./chunk-LR5GC3NZ.mjs";
284
271
  import {
285
272
  dispatchGroupSessionMessage,
286
273
  forceStopGroupFloorState,
287
274
  initGroupCollaborationEngine
288
- } from "./chunk-OCQUSYRP.mjs";
275
+ } from "./chunk-3EV63LAA.mjs";
289
276
  import {
290
277
  buildGroupPeerTranscriptProjection
291
278
  } from "./chunk-BSG6WLML.mjs";
@@ -298,7 +285,7 @@ import {
298
285
  } from "./chunk-4POYX4AW.mjs";
299
286
  import {
300
287
  buildContextPackForTurn
301
- } from "./chunk-CORUFGMR.mjs";
288
+ } from "./chunk-N3YQ5IL6.mjs";
302
289
  import {
303
290
  maybeCheckpointRunLedger
304
291
  } from "./chunk-EL6TOIFZ.mjs";
@@ -320,14 +307,14 @@ import {
320
307
  import {
321
308
  SessionIdAgentConflictError
322
309
  } from "./chunk-KPJOJH6H.mjs";
323
- import {
324
- registerMobileOutboundBridge
325
- } from "./chunk-LCR7EVVU.mjs";
326
310
  import {
327
311
  buildNativeReplyOpenAiMessages,
328
312
  buildNativeReplyTranscriptMessages,
329
313
  findFirstVisibleUserMessage
330
314
  } from "./chunk-6ZVXCJTG.mjs";
315
+ import {
316
+ registerMobileOutboundBridge
317
+ } from "./chunk-LCR7EVVU.mjs";
331
318
  import {
332
319
  extractLegacyDeliveryConversationIdFromSessionKey
333
320
  } from "./chunk-GEXTQELG.mjs";
@@ -336,6 +323,20 @@ import {
336
323
  MOBILE_SOURCE,
337
324
  XKZOOM_CHAT_CHANNEL_ID
338
325
  } from "./chunk-PS6X3CND.mjs";
326
+ import {
327
+ runNativeOpenAiTextStreamToDispatcher
328
+ } from "./chunk-BHT6B2TV.mjs";
329
+ import {
330
+ diagnoseNativeReplyRouteMiss,
331
+ formatNativeReplyRouteMissMessage
332
+ } from "./chunk-NEDXMES6.mjs";
333
+ import {
334
+ applyModelOverrideToGatewayConfig,
335
+ gatewayAgentWantsFullToolLoop,
336
+ init_native_gateway_config,
337
+ normalizeModelOverrideKey,
338
+ resolveGatewayAgentToolsProfile
339
+ } from "./chunk-LR5GC3NZ.mjs";
339
340
  import {
340
341
  init_state_dir,
341
342
  resolveXkzoomStateDirForProcess
@@ -3451,6 +3452,12 @@ ${inbound.bodyText}` : inbound.bodyText;
3451
3452
  lastToolName: params.lastToolName ?? lastToolNameForInterruptedTurn,
3452
3453
  error: params.error
3453
3454
  });
3455
+ if (!hasInterruptedTurnRecoveryEvidence(snapshot)) {
3456
+ this.logInfo(
3457
+ `[XKZOOM][turn-timeout][snapshot] skipped session=${session.id} conversationId=${identity.conversationId ?? "none"} userMessage=${userMessage.id} targetMessage=${target.id} assistantMessage=${assistantMessage?.id ?? "none"} turn_timeout_kind=${snapshot.turn_timeout_kind} recoverableEvidence=0 visibleTextLength=${snapshot.visibleTextLength}`
3458
+ );
3459
+ return null;
3460
+ }
3454
3461
  target.interruptedTurn = snapshot;
3455
3462
  this.store.persistMessage(session.id, target.id);
3456
3463
  this.logInfo(
@@ -3,7 +3,7 @@ import {
3
3
  } from "./chunk-X7ZWYPCN.mjs";
4
4
  import {
5
5
  buildGroupCollaborationMemorySupplement
6
- } from "./chunk-5DMSAPS2.mjs";
6
+ } from "./chunk-APQRVOZQ.mjs";
7
7
 
8
8
  // src/mobile/memory-contract-r1-prefetch.ts
9
9
  var MAX_SNIPPET_CHARS = 480;
@@ -1,31 +1,31 @@
1
1
  import {
2
2
  isCompactOwnedToolName
3
- } from "./chunk-M52HZV6R.mjs";
3
+ } from "./chunk-5VR6UOGC.mjs";
4
4
  import {
5
5
  collectRecentMessagesForCompact,
6
6
  formatRecentMessagesForPrompt
7
7
  } from "./chunk-X3BY5KPX.mjs";
8
8
  import {
9
9
  runCompactPipeline
10
- } from "./chunk-CCCPWU2O.mjs";
10
+ } from "./chunk-RZW4EEPW.mjs";
11
11
  import {
12
12
  evaluateContextBudgetGate,
13
13
  requestGatewayCompaction
14
- } from "./chunk-HJN232FK.mjs";
14
+ } from "./chunk-FLVJABFP.mjs";
15
15
  import {
16
16
  scheduleMemoryMaintenance
17
17
  } from "./chunk-IHH6JKPK.mjs";
18
18
  import {
19
19
  shouldSuppressR1PrefetchOnResume
20
20
  } from "./chunk-3UZNL3V3.mjs";
21
- import {
22
- init_native_gateway_config,
23
- resolveModelRuntimeMetadataFromGatewayConfig
24
- } from "./chunk-LR5GC3NZ.mjs";
25
21
  import {
26
22
  visibleAssistantText,
27
23
  visibleUserText
28
24
  } from "./chunk-VE2NKY44.mjs";
25
+ import {
26
+ init_native_gateway_config,
27
+ resolveModelRuntimeMetadataFromGatewayConfig
28
+ } from "./chunk-LR5GC3NZ.mjs";
29
29
 
30
30
  // src/mobile/context-compact/runtime-compact-hook.ts
31
31
  init_native_gateway_config();
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  mergeRunningSummary
3
- } from "./chunk-H5TJYSTV.mjs";
3
+ } from "./chunk-QSUD6TNR.mjs";
4
4
 
5
5
  // src/mobile/context-compact/compact-artifact-enrich.ts
6
6
  function normalizeForCompare(text) {
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  resolveDynamicDeptLead
3
- } from "./chunk-JA65ZG3H.mjs";
3
+ } from "./chunk-6ZWKLMY3.mjs";
4
4
  import {
5
5
  listPipelineDeptMentionOptions
6
6
  } from "./chunk-KHQZ35IL.mjs";
@@ -17,12 +17,12 @@ import {
17
17
  getTeamTaskBoard,
18
18
  isTeamTaskBoardComplete
19
19
  } from "./chunk-BHA3SMKH.mjs";
20
+ import {
21
+ getOrgProjectByTeamId
22
+ } from "./chunk-3OXBG4OP.mjs";
20
23
  import {
21
24
  readPeerRelationNote
22
25
  } from "./chunk-OJYZLNSD.mjs";
23
- import {
24
- getOrgProjectByTeamId
25
- } from "./chunk-UNZ3D3B3.mjs";
26
26
  import {
27
27
  activeDepartmentForPhase
28
28
  } from "./chunk-LREFRIQQ.mjs";
@@ -0,0 +1,201 @@
1
+ // src/mobile/native-request-diagnostics.ts
2
+ function compactLogValue(value, maxLen = 180) {
3
+ const text = String(value ?? "").replace(/\s+/g, " ").trim();
4
+ if (!text) {
5
+ return "";
6
+ }
7
+ return text.length > maxLen ? `${text.slice(0, maxLen)}...` : text;
8
+ }
9
+ function readErrorProp(value, key) {
10
+ return value && typeof value === "object" ? value[key] : void 0;
11
+ }
12
+ function positiveInteger(value) {
13
+ if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
14
+ return void 0;
15
+ }
16
+ return Math.trunc(value);
17
+ }
18
+ function formatNativeFetchErrorForLog(error) {
19
+ const parts = [];
20
+ let current = error;
21
+ for (let depth = 0; depth < 4 && current !== null && current !== void 0; depth += 1) {
22
+ const prefix = depth === 0 ? "error" : `cause${depth}`;
23
+ const name = compactLogValue(readErrorProp(current, "name"));
24
+ const message = current instanceof Error ? compactLogValue(current.message) : compactLogValue(readErrorProp(current, "message") ?? current);
25
+ const code = compactLogValue(readErrorProp(current, "code"));
26
+ const errno = compactLogValue(readErrorProp(current, "errno"));
27
+ if (name) parts.push(`${prefix}Name=${name}`);
28
+ if (message) parts.push(`${prefix}Message=${message}`);
29
+ if (code) parts.push(`${prefix}Code=${code}`);
30
+ if (errno) parts.push(`${prefix}Errno=${errno}`);
31
+ current = readErrorProp(current, "cause");
32
+ }
33
+ return parts.join(" ") || "error=unknown";
34
+ }
35
+ function applyConfiguredMaxTokens(requestBody, maxTokens) {
36
+ const configured = positiveInteger(maxTokens);
37
+ if (configured === void 0) {
38
+ return;
39
+ }
40
+ const existing = positiveInteger(requestBody.max_tokens);
41
+ requestBody.max_tokens = existing === void 0 ? configured : Math.min(existing, configured);
42
+ }
43
+ function stringifyJsonRequestBody(requestBody) {
44
+ const bodyText = JSON.stringify(requestBody);
45
+ return {
46
+ bodyText,
47
+ bodyBytes: Buffer.byteLength(bodyText, "utf8")
48
+ };
49
+ }
50
+ function formatRequestShape(input) {
51
+ const messageCount = Array.isArray(input.messages) ? input.messages.length : 0;
52
+ const toolCount = Array.isArray(input.tools) ? input.tools.length : 0;
53
+ const maxTokens = positiveInteger(input.maxTokens);
54
+ return `bodyBytes=${input.bodyBytes} messages=${messageCount} tools=${toolCount} max_tokens=${maxTokens ?? "n/a"}`;
55
+ }
56
+ var DEFAULT_PROVIDER_FETCH_MAX_ATTEMPTS = 2;
57
+ var HARD_PROVIDER_FETCH_MAX_ATTEMPTS = 4;
58
+ var DEFAULT_PROVIDER_FETCH_RETRY_BASE_MS = 350;
59
+ var HARD_PROVIDER_FETCH_RETRY_BASE_MS = 5e3;
60
+ var RETRYABLE_NATIVE_FETCH_RE = new RegExp(
61
+ [
62
+ "fetch failed",
63
+ "UND_ERR_CONNECT_TIMEOUT",
64
+ "UND_ERR_HEADERS_TIMEOUT",
65
+ "UND_ERR_SOCKET",
66
+ "ECONNRESET",
67
+ "ETIMEDOUT",
68
+ "ECONNREFUSED",
69
+ "ENOTFOUND",
70
+ "EAI_AGAIN",
71
+ "socket hang up",
72
+ "network connection lost",
73
+ "network request failed"
74
+ ].join("|"),
75
+ "i"
76
+ );
77
+ function readClampedPositiveEnvInt(env, key, fallback, max) {
78
+ const raw = (env[key] ?? "").trim();
79
+ const n = Number.parseInt(raw, 10);
80
+ if (!Number.isFinite(n) || n <= 0) {
81
+ return fallback;
82
+ }
83
+ return Math.min(Math.trunc(n), max);
84
+ }
85
+ function readClampedNonNegativeEnvInt(env, key, fallback, max) {
86
+ const raw = (env[key] ?? "").trim();
87
+ const n = Number.parseInt(raw, 10);
88
+ if (!Number.isFinite(n) || n < 0) {
89
+ return fallback;
90
+ }
91
+ return Math.min(Math.trunc(n), max);
92
+ }
93
+ function readProviderFetchMaxAttempts(env) {
94
+ return readClampedPositiveEnvInt(
95
+ env,
96
+ "XKZOOM_NATIVE_PROVIDER_FETCH_MAX_ATTEMPTS",
97
+ DEFAULT_PROVIDER_FETCH_MAX_ATTEMPTS,
98
+ HARD_PROVIDER_FETCH_MAX_ATTEMPTS
99
+ );
100
+ }
101
+ function readProviderFetchRetryBaseMs(env) {
102
+ return readClampedNonNegativeEnvInt(
103
+ env,
104
+ "XKZOOM_NATIVE_PROVIDER_FETCH_RETRY_BASE_MS",
105
+ DEFAULT_PROVIDER_FETCH_RETRY_BASE_MS,
106
+ HARD_PROVIDER_FETCH_RETRY_BASE_MS
107
+ );
108
+ }
109
+ function isAbortLikeFetchError(error) {
110
+ const name = compactLogValue(readErrorProp(error, "name"));
111
+ return name === "AbortError";
112
+ }
113
+ function collectFetchErrorText(error) {
114
+ const parts = [];
115
+ let current = error;
116
+ for (let depth = 0; depth < 4 && current !== null && current !== void 0; depth += 1) {
117
+ parts.push(
118
+ compactLogValue(readErrorProp(current, "name")),
119
+ current instanceof Error ? compactLogValue(current.message) : compactLogValue(readErrorProp(current, "message") ?? current),
120
+ compactLogValue(readErrorProp(current, "code")),
121
+ compactLogValue(readErrorProp(current, "errno"))
122
+ );
123
+ current = readErrorProp(current, "cause");
124
+ }
125
+ return parts.filter(Boolean).join(" ");
126
+ }
127
+ function isRetryableNativeProviderFetchError(error) {
128
+ return !isAbortLikeFetchError(error) && RETRYABLE_NATIVE_FETCH_RE.test(collectFetchErrorText(error));
129
+ }
130
+ function formatProviderRetryContext(context) {
131
+ const parts = [
132
+ `provider=${context.providerId}`,
133
+ `model=${context.model}`,
134
+ context.adapter ? `adapter=${context.adapter}` : "",
135
+ typeof context.iteration === "number" ? `iteration=${context.iteration}` : ""
136
+ ];
137
+ return parts.filter(Boolean).join(" ");
138
+ }
139
+ function asAbortSignal(signal) {
140
+ if (signal && typeof signal === "object" && "aborted" in signal) {
141
+ return signal;
142
+ }
143
+ return void 0;
144
+ }
145
+ async function waitForProviderFetchRetryDelay(delayMs, signal) {
146
+ if (delayMs <= 0) {
147
+ return;
148
+ }
149
+ if (signal?.aborted) {
150
+ throw new DOMException("Aborted", "AbortError");
151
+ }
152
+ await new Promise((resolve, reject) => {
153
+ const timer = setTimeout(() => {
154
+ signal?.removeEventListener("abort", onAbort);
155
+ resolve();
156
+ }, delayMs);
157
+ const onAbort = () => {
158
+ clearTimeout(timer);
159
+ reject(new DOMException("Aborted", "AbortError"));
160
+ };
161
+ signal?.addEventListener("abort", onAbort, { once: true });
162
+ });
163
+ }
164
+ async function fetchNativeProviderWithRetry(url, init, context, env = process.env) {
165
+ const maxAttempts = readProviderFetchMaxAttempts(env);
166
+ const retryBaseMs = readProviderFetchRetryBaseMs(env);
167
+ const signal = asAbortSignal(init.signal);
168
+ for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
169
+ try {
170
+ return await fetch(url, init);
171
+ } catch (error) {
172
+ const retry = attempt < maxAttempts && !signal?.aborted && isRetryableNativeProviderFetchError(error);
173
+ context.log(
174
+ `[XKZOOM][native-reply][${context.label}] fetch_failed ${url} ${formatProviderRetryContext(context)} attempt=${attempt}/${maxAttempts} retry=${retry ? 1 : 0} ${formatRequestShape({
175
+ bodyBytes: context.bodyBytes,
176
+ messages: context.messages,
177
+ tools: context.tools,
178
+ maxTokens: context.maxTokens
179
+ })} ${formatNativeFetchErrorForLog(error)}`
180
+ );
181
+ if (!retry) {
182
+ throw error;
183
+ }
184
+ const delayMs = retryBaseMs * attempt;
185
+ context.log(
186
+ `[XKZOOM][native-reply][${context.label}] fetch_retry ${url} ${formatProviderRetryContext(context)} nextAttempt=${attempt + 1}/${maxAttempts} delayMs=${delayMs}`
187
+ );
188
+ await waitForProviderFetchRetryDelay(delayMs, signal);
189
+ }
190
+ }
191
+ throw new Error(`native provider fetch retry exhausted: ${url}`);
192
+ }
193
+
194
+ export {
195
+ formatNativeFetchErrorForLog,
196
+ applyConfiguredMaxTokens,
197
+ stringifyJsonRequestBody,
198
+ formatRequestShape,
199
+ isRetryableNativeProviderFetchError,
200
+ fetchNativeProviderWithRetry
201
+ };
@@ -5,7 +5,7 @@ import {
5
5
  import {
6
6
  isOrgPipelineCharter,
7
7
  resolvePipelineDeptLead
8
- } from "./chunk-TAQQSDJN.mjs";
8
+ } from "./chunk-6SYECCCG.mjs";
9
9
  import {
10
10
  loadTeamCharter
11
11
  } from "./chunk-KDZWHGGN.mjs";
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  classifyTurnTimeoutKind,
3
3
  formatTurnTimeoutKindForUser
4
- } from "./chunk-GUADF3KN.mjs";
4
+ } from "./chunk-ULXTQSV6.mjs";
5
5
 
6
6
  // src/mobile/native-anthropic-turn-errors.ts
7
7
  function isPlainUpstreamConnectionFailure(message, kind) {