xkzoom 1.5.2 → 1.5.4
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.
- package/README.md +87 -43
- package/dist/{chunk-UANVP2AV.mjs → chunk-27BXVTXH.mjs} +1 -1
- package/dist/{chunk-PY7W2X6W.mjs → chunk-2DR5RT3I.mjs} +52 -45
- package/dist/{chunk-YILSXMZI.mjs → chunk-2IQAT3PE.mjs} +1 -1
- package/dist/{chunk-IXYH42YO.mjs → chunk-2VSERWT6.mjs} +1 -1
- package/dist/{chunk-BSQF7NF4.mjs → chunk-3KJHUTOO.mjs} +2 -2
- package/dist/{chunk-URF75O5Z.mjs → chunk-3VA3YDYL.mjs} +1 -1
- package/dist/{chunk-RTANSWHW.mjs → chunk-3ZH273T7.mjs} +27 -27
- package/dist/{chunk-EQNHKW6L.mjs → chunk-4JXTPCOE.mjs} +1 -1
- package/dist/{chunk-WJIY3BIA.mjs → chunk-5SE4JOKE.mjs} +38 -10
- package/dist/{chunk-JD5NPIMO.mjs → chunk-5YEFG7BF.mjs} +25 -25
- package/dist/{chunk-LTBQWMAJ.mjs → chunk-6W4W5JLG.mjs} +1 -1
- package/dist/{chunk-CDLS44GZ.mjs → chunk-76MFE24I.mjs} +1 -1
- package/dist/{chunk-IPIV4NGB.mjs → chunk-76TKUYY3.mjs} +2 -2
- package/dist/{chunk-T4LPE43H.mjs → chunk-7LEEVP5O.mjs} +1 -1
- package/dist/{chunk-A5DUSLHF.mjs → chunk-DCSERRXG.mjs} +1 -1
- package/dist/{chunk-ASIBETCT.mjs → chunk-E2TTUY6R.mjs} +2 -2
- package/dist/chunk-E5LABIPO.mjs +201 -0
- package/dist/{chunk-KYTJH3R3.mjs → chunk-EE3NRJLQ.mjs} +1 -1
- package/dist/{chunk-SIIEMWE3.mjs → chunk-F35EHL5U.mjs} +3 -3
- package/dist/{chunk-K4RHLREV.mjs → chunk-FG6QCRVN.mjs} +1 -1
- package/dist/{chunk-HJN232FK.mjs → chunk-FLVJABFP.mjs} +1 -1
- package/dist/{chunk-ZM23SMRO.mjs → chunk-GIC2RBVM.mjs} +1 -1
- package/dist/{chunk-HTU5W436.mjs → chunk-GZJMFCRG.mjs} +2 -2
- package/dist/{chunk-JG3EPJ32.mjs → chunk-HAI7DJD2.mjs} +3 -3
- package/dist/{chunk-OB4JJLDC.mjs → chunk-HYSOWPIC.mjs} +2 -2
- package/dist/{chunk-G5ZU7562.mjs → chunk-IDQ5B572.mjs} +6 -6
- package/dist/{chunk-GGWUDW5W.mjs → chunk-IGDJGBAI.mjs} +1 -1
- package/dist/{chunk-A23OTVH2.mjs → chunk-J5AXFEDQ.mjs} +18 -18
- package/dist/{chunk-4DYFM3EC.mjs → chunk-JBKRS62W.mjs} +3 -3
- package/dist/{chunk-OCQUSYRP.mjs → chunk-JFFBD5TV.mjs} +14 -14
- package/dist/{chunk-VPRVZWF3.mjs → chunk-JI67TW4E.mjs} +1 -1
- package/dist/{chunk-GBG4AJON.mjs → chunk-JJKRD5DL.mjs} +1 -1
- package/dist/{chunk-7AZVQS2H.mjs → chunk-JXDHNASC.mjs} +12 -12
- package/dist/{chunk-W4MKSQGZ.mjs → chunk-K7RZQIPZ.mjs} +1 -1
- package/dist/{chunk-J5HTLG3V.mjs → chunk-KPDVZFJY.mjs} +1 -1
- package/dist/{chunk-S7FQBXOO.mjs → chunk-L252ASZW.mjs} +1 -1
- package/dist/{chunk-Z7GTU7KF.mjs → chunk-LESS4N25.mjs} +1 -1
- package/dist/{chunk-5DMSAPS2.mjs → chunk-M3ISDSQP.mjs} +7 -7
- package/dist/{chunk-HR43WO4Q.mjs → chunk-M5IU6U3O.mjs} +2 -2
- package/dist/{chunk-BV76CMVR.mjs → chunk-MBOWNG3A.mjs} +1 -1
- package/dist/{chunk-CCCPWU2O.mjs → chunk-MDZUWIBH.mjs} +4 -4
- package/dist/{chunk-YAD4VG2K.mjs → chunk-MKYCBV3H.mjs} +36 -6
- package/dist/{chunk-CORUFGMR.mjs → chunk-MPGMU75K.mjs} +4 -4
- package/dist/{chunk-7FLALKSN.mjs → chunk-MQKREMOB.mjs} +2 -2
- package/dist/{chunk-H5TJYSTV.mjs → chunk-MRTQWCNC.mjs} +1 -1
- package/dist/{chunk-CNHOCDRM.mjs → chunk-NHICONJ3.mjs} +1 -1
- package/dist/{chunk-5JGUBBXN.mjs → chunk-NIU6GWKB.mjs} +2 -2
- package/dist/{chunk-Q6XX6X24.mjs → chunk-OBYPZT2S.mjs} +6 -6
- package/dist/{chunk-Y6SJUTY6.mjs → chunk-P262PAGZ.mjs} +15 -2
- package/dist/{chunk-YPAQRMUI.mjs → chunk-PETWGCGB.mjs} +1 -1
- package/dist/{chunk-Q4XUEIOE.mjs → chunk-PW3ULDNL.mjs} +1 -1
- package/dist/{chunk-EGWLJJY7.mjs → chunk-RKZ56GST.mjs} +2 -2
- package/dist/{chunk-QUXUHJZW.mjs → chunk-TADSGGK2.mjs} +7 -7
- package/dist/{chunk-ILROJZBI.mjs → chunk-TQBVFKCT.mjs} +37 -9
- package/dist/{chunk-M52HZV6R.mjs → chunk-TVH4LII3.mjs} +1 -1
- package/dist/{chunk-GUADF3KN.mjs → chunk-ULXTQSV6.mjs} +4 -0
- package/dist/{chunk-H5DIQHEQ.mjs → chunk-UXEZFEB3.mjs} +37 -8
- package/dist/{chunk-XHO73X2N.mjs → chunk-VNEPNUBZ.mjs} +13 -13
- package/dist/{chunk-NYG3IUXK.mjs → chunk-W75Z6CZR.mjs} +1 -1
- package/dist/{chunk-PG5CHH66.mjs → chunk-YPKHMAO4.mjs} +1 -1
- package/dist/index.js +336 -31
- package/dist/index.mjs +104 -103
- package/dist/mobile/action-planner.js +21 -1
- package/dist/mobile/action-planner.mjs +60 -59
- package/dist/mobile/agent-capabilities.js +21 -1
- package/dist/mobile/agent-capabilities.mjs +60 -59
- package/dist/mobile/anthropic-incremental-deliver.js +19 -0
- package/dist/mobile/anthropic-incremental-deliver.mjs +3 -2
- package/dist/mobile/anthropic-messages-turn-runner.js +224 -8
- package/dist/mobile/anthropic-messages-turn-runner.mjs +69 -68
- package/dist/mobile/anthropic-owned-tool-executor.js +21 -1
- package/dist/mobile/anthropic-owned-tool-executor.mjs +68 -67
- package/dist/mobile/api.mjs +31 -31
- package/dist/mobile/context-compact/compact-artifact-enrich.js +19 -0
- package/dist/mobile/context-compact/compact-artifact-enrich.mjs +8 -7
- package/dist/mobile/context-compact/compact-orchestrator.js +21 -1
- package/dist/mobile/context-compact/compact-orchestrator.mjs +12 -11
- package/dist/mobile/context-compact/compact-summarizer-engine-artifact.js +19 -0
- package/dist/mobile/context-compact/compact-summarizer-engine-artifact.mjs +8 -7
- package/dist/mobile/context-compact/compact-summarizer-llm-request.js +19 -0
- package/dist/mobile/context-compact/compact-summarizer-llm-request.mjs +5 -4
- package/dist/mobile/context-compact/compact-summarizer-llm.js +19 -0
- package/dist/mobile/context-compact/compact-summarizer-llm.mjs +6 -5
- package/dist/mobile/context-compact/compact-summarizer.js +19 -0
- package/dist/mobile/context-compact/compact-summarizer.mjs +7 -6
- package/dist/mobile/context-compact/context-budget-gate.js +14 -2
- package/dist/mobile/context-compact/context-budget-gate.mjs +2 -2
- package/dist/mobile/context-compact/runtime-compact-hook.js +33 -2
- package/dist/mobile/context-compact/runtime-compact-hook.mjs +64 -63
- package/dist/mobile/group/conductor-llm.js +19 -0
- package/dist/mobile/group/conductor-llm.mjs +7 -6
- package/dist/mobile/group/conductor-plan-llm.js +19 -0
- package/dist/mobile/group/conductor-plan-llm.mjs +7 -6
- package/dist/mobile/group/floor-scheduler.mjs +2 -2
- package/dist/mobile/group/group-api-handlers.mjs +21 -21
- package/dist/mobile/group/group-session.mjs +5 -5
- package/dist/mobile/group/index.mjs +16 -16
- package/dist/mobile/group/memory-supplement.mjs +4 -4
- package/dist/mobile/group/orchestrator.mjs +15 -15
- package/dist/mobile/group/plan-runtime.mjs +4 -4
- package/dist/mobile/group/relation-distill.mjs +3 -3
- package/dist/mobile/group/runtime-integration.mjs +19 -19
- package/dist/mobile/group/team-memory-runtime.mjs +3 -3
- package/dist/mobile/index.js +336 -31
- package/dist/mobile/index.mjs +101 -100
- package/dist/mobile/interrupted-turn.js +5 -0
- package/dist/mobile/interrupted-turn.mjs +3 -1
- package/dist/mobile/memory-contract-r1-prefetch.mjs +5 -5
- package/dist/mobile/memory-contract-r5-empty-result.mjs +6 -6
- package/dist/mobile/memory-runtime-v2/eval-runner.mjs +8 -8
- package/dist/mobile/memory-runtime-v2/evidence-plan.mjs +11 -11
- package/dist/mobile/memory-runtime-v2/index.mjs +31 -31
- package/dist/mobile/memory-runtime-v2/local-source-import.mjs +3 -3
- package/dist/mobile/memory-runtime-v2/memory-control-plane.mjs +11 -11
- package/dist/mobile/memory-runtime-v2/memory-readiness.mjs +11 -11
- package/dist/mobile/memory-runtime-v2/orchestrator.mjs +4 -4
- package/dist/mobile/memory-runtime-v2/project-tool-event.mjs +2 -2
- package/dist/mobile/memory-runtime-v2/public-api.mjs +12 -12
- package/dist/mobile/memory-runtime-v2/retrieval.mjs +2 -2
- package/dist/mobile/model-context-window-budget.js +16 -2
- package/dist/mobile/model-context-window-budget.mjs +3 -1
- package/dist/mobile/native-anthropic-messages-stream.js +223 -7
- package/dist/mobile/native-anthropic-messages-stream.mjs +4 -3
- package/dist/mobile/native-anthropic-turn-errors.mjs +2 -2
- package/dist/mobile/native-openai-text-stream.js +223 -6
- package/dist/mobile/native-openai-text-stream.mjs +2 -1
- package/dist/mobile/native-reply-route.js +19 -0
- package/dist/mobile/native-reply-route.mjs +5 -4
- package/dist/mobile/native-reply-system-prompt-layers.js +21 -1
- package/dist/mobile/native-reply-system-prompt-layers.mjs +61 -60
- package/dist/mobile/native-request-diagnostics.js +230 -0
- package/dist/mobile/native-request-diagnostics.mjs +17 -0
- package/dist/mobile/native-stream-block-emit.js +19 -0
- package/dist/mobile/native-stream-block-emit.mjs +2 -1
- package/dist/mobile/openai-completions-turn-runner.js +224 -8
- package/dist/mobile/openai-completions-turn-runner.mjs +69 -68
- package/dist/mobile/runtime.js +336 -31
- package/dist/mobile/runtime.mjs +100 -99
- package/dist/mobile/stream-inbound/mobile-text-stream-pipeline.mjs +4 -4
- package/dist/mobile/tool-use-input-normalize.js +21 -1
- package/dist/mobile/tool-use-input-normalize.mjs +63 -62
- package/dist/mobile/tools/mobile-compact-tool-bridge.js +21 -1
- package/dist/mobile/tools/mobile-compact-tool-bridge.mjs +63 -62
- package/dist/org/dept-context.mjs +2 -2
- package/dist/org/index.mjs +8 -8
- package/dist/owned-tools/ceo-confirm-requirements.mjs +3 -3
- package/dist/owned-tools/ceo-decision.mjs +4 -4
- package/dist/owned-tools/ceo-ops-brief.mjs +3 -3
- package/dist/owned-tools/ceo-redirect.mjs +20 -20
- package/dist/owned-tools/commit-stack-lesson.mjs +4 -4
- package/dist/owned-tools/compact/execute.js +21 -1
- package/dist/owned-tools/compact/execute.mjs +61 -60
- package/dist/owned-tools/compact/gateway-tool-factory.js +21 -1
- package/dist/owned-tools/compact/gateway-tool-factory.mjs +62 -61
- package/dist/owned-tools/compact/registry.js +21 -1
- package/dist/owned-tools/compact/registry.mjs +60 -59
- package/dist/owned-tools/context-compact.js +21 -1
- package/dist/owned-tools/context-compact.mjs +25 -24
- package/dist/owned-tools/handoff.mjs +3 -3
- package/dist/owned-tools/memory-control.mjs +13 -13
- package/dist/owned-tools/memory-runtime-eval.mjs +12 -12
- package/dist/owned-tools/register-owned-providers.mjs +3 -3
- package/dist/owned-tools/registry.js +21 -1
- package/dist/owned-tools/registry.mjs +59 -58
- package/dist/owned-tools/router.js +21 -1
- package/dist/owned-tools/router.mjs +60 -59
- package/dist/owned-tools/runtime-bridge.js +21 -1
- package/dist/owned-tools/runtime-bridge.mjs +61 -60
- package/dist/owned-tools/tool-contract-prompt.js +21 -1
- package/dist/owned-tools/tool-contract-prompt.mjs +60 -59
- package/dist/owned-tools/tool-result-envelope.js +21 -1
- package/dist/owned-tools/tool-result-envelope.mjs +62 -61
- package/dist/owned-tools/tool-usage-guide.js +21 -1
- package/dist/owned-tools/tool-usage-guide.mjs +59 -58
- package/dist/owned-tools/tts.mjs +2 -2
- package/dist/project-pipeline/handlers.mjs +20 -20
- package/dist/project-pipeline/index.mjs +20 -20
- package/dist/project-pipeline/post-close-skill-evolution.mjs +3 -3
- package/package.json +2 -2
- package/dist/{chunk-KCZIK3TH.mjs → chunk-2QCX6RPN.mjs} +3 -3
- package/dist/{chunk-2BGXTBZX.mjs → chunk-D3N7EHB2.mjs} +8 -8
- package/dist/{chunk-JIY7IOQ5.mjs → chunk-DRY7AJMM.mjs} +3 -3
- package/dist/{chunk-VS2URZFN.mjs → chunk-HWGRW6YP.mjs} +3 -3
- package/dist/{chunk-Q7NYATKS.mjs → chunk-UR6LPERL.mjs} +3 -3
- package/dist/{chunk-TAQQSDJN.mjs → chunk-WPMJCKI2.mjs} +3 -3
- package/dist/{chunk-2TBXT3PD.mjs → chunk-XNQJRIGR.mjs} +9 -9
- package/dist/{chunk-BHMWYAVS.mjs → chunk-YYDDQEY4.mjs} +3 -3
|
@@ -21,7 +21,7 @@ import {
|
|
|
21
21
|
provider_acceleration,
|
|
22
22
|
run_ledger,
|
|
23
23
|
skill_lifecycle
|
|
24
|
-
} from "../../chunk-
|
|
24
|
+
} from "../../chunk-VNEPNUBZ.mjs";
|
|
25
25
|
import {
|
|
26
26
|
MemoryMaintenanceScheduler,
|
|
27
27
|
drainMemoryMaintenanceQueue,
|
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
handleMemoryProductControlPlaneRoute,
|
|
48
48
|
readLastMemoryReadinessGate,
|
|
49
49
|
readLastMemoryReadinessReport
|
|
50
|
-
} from "../../chunk-
|
|
50
|
+
} from "../../chunk-OBYPZT2S.mjs";
|
|
51
51
|
import {
|
|
52
52
|
REQUIRED_SOAK_SCENARIOS,
|
|
53
53
|
buildMemorySoakEvidenceSummary,
|
|
@@ -62,6 +62,11 @@ import {
|
|
|
62
62
|
requiredDurationHoursForSoakScenario,
|
|
63
63
|
startMemorySoakSession
|
|
64
64
|
} from "../../chunk-XQUKAHWK.mjs";
|
|
65
|
+
import {
|
|
66
|
+
exportMemoryPortabilitySnapshot,
|
|
67
|
+
importMemoryPortabilitySnapshot,
|
|
68
|
+
verifyMemoryPortabilitySnapshot
|
|
69
|
+
} from "../../chunk-6SJTUWEO.mjs";
|
|
65
70
|
import {
|
|
66
71
|
REQUIRED_PRODUCT_ACCEPTANCE_FLOWS,
|
|
67
72
|
REQUIRED_PRODUCT_ACCEPTANCE_SURFACES,
|
|
@@ -82,15 +87,10 @@ import {
|
|
|
82
87
|
suppressMemoryRecords,
|
|
83
88
|
updateMemoryRecordVisibility
|
|
84
89
|
} from "../../chunk-ZZLJUAEK.mjs";
|
|
85
|
-
import {
|
|
86
|
-
exportMemoryPortabilitySnapshot,
|
|
87
|
-
importMemoryPortabilitySnapshot,
|
|
88
|
-
verifyMemoryPortabilitySnapshot
|
|
89
|
-
} from "../../chunk-6SJTUWEO.mjs";
|
|
90
90
|
import {
|
|
91
91
|
readLastMemoryRuntimeEvalReport,
|
|
92
92
|
runMemoryRuntimeV2SelfEval
|
|
93
|
-
} from "../../chunk-
|
|
93
|
+
} from "../../chunk-JXDHNASC.mjs";
|
|
94
94
|
import {
|
|
95
95
|
beginToolSideEffect,
|
|
96
96
|
completeToolSideEffect,
|
|
@@ -100,11 +100,11 @@ import {
|
|
|
100
100
|
} from "../../chunk-UAQDS6V2.mjs";
|
|
101
101
|
import {
|
|
102
102
|
buildContextPackForTurn
|
|
103
|
-
} from "../../chunk-
|
|
103
|
+
} from "../../chunk-MPGMU75K.mjs";
|
|
104
104
|
import {
|
|
105
105
|
formatRetrievedMemoryEvidenceBlock,
|
|
106
106
|
retrieveMemoryEvidence
|
|
107
|
-
} from "../../chunk-
|
|
107
|
+
} from "../../chunk-HWGRW6YP.mjs";
|
|
108
108
|
import {
|
|
109
109
|
SKILL_REGISTRY_REPORT_SCHEMA_VERSION,
|
|
110
110
|
SKILL_REGISTRY_VIEW_SCHEMA_VERSION,
|
|
@@ -134,10 +134,16 @@ import {
|
|
|
134
134
|
readProjectMemoryMap,
|
|
135
135
|
upsertProjectMemoryMap
|
|
136
136
|
} from "../../chunk-TSIQCRWD.mjs";
|
|
137
|
+
import {
|
|
138
|
+
buildContextPack,
|
|
139
|
+
buildContextPackFromRuntimeBlocks,
|
|
140
|
+
renderContextPack,
|
|
141
|
+
renderContextPackStablePrefixForProviderCache
|
|
142
|
+
} from "../../chunk-XL3MUGFG.mjs";
|
|
137
143
|
import {
|
|
138
144
|
LOCAL_SOURCE_IMPORT_REPORT_SCHEMA_VERSION,
|
|
139
145
|
importLocalMemorySources
|
|
140
|
-
} from "../../chunk-
|
|
146
|
+
} from "../../chunk-2QCX6RPN.mjs";
|
|
141
147
|
import {
|
|
142
148
|
assessLongRunToolCall,
|
|
143
149
|
deriveRunLedgerToolArgsHash,
|
|
@@ -166,33 +172,17 @@ import {
|
|
|
166
172
|
evaluateRunLedgerCheckpoint,
|
|
167
173
|
maybeCheckpointRunLedger
|
|
168
174
|
} from "../../chunk-EL6TOIFZ.mjs";
|
|
169
|
-
import {
|
|
170
|
-
executeRegisteredContextCompact,
|
|
171
|
-
registerContextCompactExecutor
|
|
172
|
-
} from "../../chunk-UH6VXWMV.mjs";
|
|
173
|
-
import {
|
|
174
|
-
buildContextPack,
|
|
175
|
-
buildContextPackFromRuntimeBlocks,
|
|
176
|
-
renderContextPack,
|
|
177
|
-
renderContextPackStablePrefixForProviderCache
|
|
178
|
-
} from "../../chunk-XL3MUGFG.mjs";
|
|
179
175
|
import {
|
|
180
176
|
formatRunLedgerBlock,
|
|
181
177
|
readRunLedger,
|
|
182
178
|
readRunLedgerEvents,
|
|
183
179
|
updateRunLedger
|
|
184
180
|
} from "../../chunk-4WWT6OC2.mjs";
|
|
185
|
-
import "../../chunk-Q7NYATKS.mjs";
|
|
186
|
-
import {
|
|
187
|
-
runMemoryConsolidation
|
|
188
|
-
} from "../../chunk-M2GS2K6H.mjs";
|
|
189
181
|
import {
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
writeMemoryIndex
|
|
195
|
-
} from "../../chunk-24ASGNQU.mjs";
|
|
182
|
+
executeRegisteredContextCompact,
|
|
183
|
+
registerContextCompactExecutor
|
|
184
|
+
} from "../../chunk-UH6VXWMV.mjs";
|
|
185
|
+
import "../../chunk-UR6LPERL.mjs";
|
|
196
186
|
import {
|
|
197
187
|
buildMemoryEvidenceBlock,
|
|
198
188
|
ingestMemoryEvent,
|
|
@@ -204,6 +194,16 @@ import {
|
|
|
204
194
|
readMemoryWritePolicy,
|
|
205
195
|
updateMemoryWritePolicy
|
|
206
196
|
} from "../../chunk-2NY5IEPV.mjs";
|
|
197
|
+
import {
|
|
198
|
+
runMemoryConsolidation
|
|
199
|
+
} from "../../chunk-M2GS2K6H.mjs";
|
|
200
|
+
import {
|
|
201
|
+
buildAndWriteMemoryIndexForScope,
|
|
202
|
+
buildMemoryIndexFromRecords,
|
|
203
|
+
readMemoryIndex,
|
|
204
|
+
tokenizeMemoryText,
|
|
205
|
+
writeMemoryIndex
|
|
206
|
+
} from "../../chunk-24ASGNQU.mjs";
|
|
207
207
|
import {
|
|
208
208
|
applyMemoryControlToRecords,
|
|
209
209
|
buildMemoryControlSnapshotFromEvents,
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
LOCAL_SOURCE_IMPORT_REPORT_SCHEMA_VERSION,
|
|
3
3
|
importLocalMemorySources
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-M2GS2K6H.mjs";
|
|
6
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
4
|
+
} from "../../chunk-2QCX6RPN.mjs";
|
|
7
5
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
8
6
|
import "../../chunk-2NY5IEPV.mjs";
|
|
7
|
+
import "../../chunk-M2GS2K6H.mjs";
|
|
8
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
9
9
|
import "../../chunk-6D7J5WJS.mjs";
|
|
10
10
|
import "../../chunk-DSSVZ47P.mjs";
|
|
11
11
|
import "../../chunk-SBBPQQYS.mjs";
|
|
@@ -3,34 +3,34 @@ import {
|
|
|
3
3
|
buildMemoryProductControlPlaneManifest,
|
|
4
4
|
buildMemoryProductControlPlaneOverview,
|
|
5
5
|
handleMemoryProductControlPlaneRoute
|
|
6
|
-
} from "../../chunk-
|
|
6
|
+
} from "../../chunk-OBYPZT2S.mjs";
|
|
7
7
|
import "../../chunk-XQUKAHWK.mjs";
|
|
8
|
+
import "../../chunk-6SJTUWEO.mjs";
|
|
8
9
|
import "../../chunk-DDD2BA7K.mjs";
|
|
9
10
|
import "../../chunk-DDNZWJII.mjs";
|
|
10
11
|
import "../../chunk-ZZLJUAEK.mjs";
|
|
11
|
-
import "../../chunk-
|
|
12
|
-
import "../../chunk-7AZVQS2H.mjs";
|
|
12
|
+
import "../../chunk-JXDHNASC.mjs";
|
|
13
13
|
import "../../chunk-UAQDS6V2.mjs";
|
|
14
|
-
import "../../chunk-
|
|
15
|
-
import "../../chunk-
|
|
14
|
+
import "../../chunk-MPGMU75K.mjs";
|
|
15
|
+
import "../../chunk-HWGRW6YP.mjs";
|
|
16
16
|
import "../../chunk-J72V5GVI.mjs";
|
|
17
17
|
import "../../chunk-2AHSYECT.mjs";
|
|
18
18
|
import "../../chunk-LWCO2YNI.mjs";
|
|
19
19
|
import "../../chunk-TSIQCRWD.mjs";
|
|
20
|
-
import "../../chunk-
|
|
20
|
+
import "../../chunk-XL3MUGFG.mjs";
|
|
21
|
+
import "../../chunk-2QCX6RPN.mjs";
|
|
21
22
|
import "../../chunk-NJAPWQ4D.mjs";
|
|
22
23
|
import "../../chunk-5Z5IS4XG.mjs";
|
|
23
24
|
import "../../chunk-73SN5UQC.mjs";
|
|
24
25
|
import "../../chunk-DUB3FBYX.mjs";
|
|
25
26
|
import "../../chunk-EL6TOIFZ.mjs";
|
|
26
|
-
import "../../chunk-UH6VXWMV.mjs";
|
|
27
|
-
import "../../chunk-XL3MUGFG.mjs";
|
|
28
27
|
import "../../chunk-4WWT6OC2.mjs";
|
|
29
|
-
import "../../chunk-
|
|
30
|
-
import "../../chunk-
|
|
31
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
28
|
+
import "../../chunk-UH6VXWMV.mjs";
|
|
29
|
+
import "../../chunk-UR6LPERL.mjs";
|
|
32
30
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
33
31
|
import "../../chunk-2NY5IEPV.mjs";
|
|
32
|
+
import "../../chunk-M2GS2K6H.mjs";
|
|
33
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
34
34
|
import "../../chunk-6D7J5WJS.mjs";
|
|
35
35
|
import "../../chunk-WRZWEAMN.mjs";
|
|
36
36
|
import "../../chunk-IKQPTA2J.mjs";
|
|
@@ -4,34 +4,34 @@ import {
|
|
|
4
4
|
evaluateMemoryReadinessGate,
|
|
5
5
|
readLastMemoryReadinessGate,
|
|
6
6
|
readLastMemoryReadinessReport
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-OBYPZT2S.mjs";
|
|
8
8
|
import "../../chunk-XQUKAHWK.mjs";
|
|
9
|
+
import "../../chunk-6SJTUWEO.mjs";
|
|
9
10
|
import "../../chunk-DDD2BA7K.mjs";
|
|
10
11
|
import "../../chunk-DDNZWJII.mjs";
|
|
11
12
|
import "../../chunk-ZZLJUAEK.mjs";
|
|
12
|
-
import "../../chunk-
|
|
13
|
-
import "../../chunk-7AZVQS2H.mjs";
|
|
13
|
+
import "../../chunk-JXDHNASC.mjs";
|
|
14
14
|
import "../../chunk-UAQDS6V2.mjs";
|
|
15
|
-
import "../../chunk-
|
|
16
|
-
import "../../chunk-
|
|
15
|
+
import "../../chunk-MPGMU75K.mjs";
|
|
16
|
+
import "../../chunk-HWGRW6YP.mjs";
|
|
17
17
|
import "../../chunk-J72V5GVI.mjs";
|
|
18
18
|
import "../../chunk-2AHSYECT.mjs";
|
|
19
19
|
import "../../chunk-LWCO2YNI.mjs";
|
|
20
20
|
import "../../chunk-TSIQCRWD.mjs";
|
|
21
|
-
import "../../chunk-
|
|
21
|
+
import "../../chunk-XL3MUGFG.mjs";
|
|
22
|
+
import "../../chunk-2QCX6RPN.mjs";
|
|
22
23
|
import "../../chunk-NJAPWQ4D.mjs";
|
|
23
24
|
import "../../chunk-5Z5IS4XG.mjs";
|
|
24
25
|
import "../../chunk-73SN5UQC.mjs";
|
|
25
26
|
import "../../chunk-DUB3FBYX.mjs";
|
|
26
27
|
import "../../chunk-EL6TOIFZ.mjs";
|
|
27
|
-
import "../../chunk-UH6VXWMV.mjs";
|
|
28
|
-
import "../../chunk-XL3MUGFG.mjs";
|
|
29
28
|
import "../../chunk-4WWT6OC2.mjs";
|
|
30
|
-
import "../../chunk-
|
|
31
|
-
import "../../chunk-
|
|
32
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
29
|
+
import "../../chunk-UH6VXWMV.mjs";
|
|
30
|
+
import "../../chunk-UR6LPERL.mjs";
|
|
33
31
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
34
32
|
import "../../chunk-2NY5IEPV.mjs";
|
|
33
|
+
import "../../chunk-M2GS2K6H.mjs";
|
|
34
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
35
35
|
import "../../chunk-6D7J5WJS.mjs";
|
|
36
36
|
import "../../chunk-WRZWEAMN.mjs";
|
|
37
37
|
import "../../chunk-IKQPTA2J.mjs";
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildContextPackForTurn
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-MPGMU75K.mjs";
|
|
4
|
+
import "../../chunk-HWGRW6YP.mjs";
|
|
5
5
|
import "../../chunk-J72V5GVI.mjs";
|
|
6
6
|
import "../../chunk-2AHSYECT.mjs";
|
|
7
7
|
import "../../chunk-TSIQCRWD.mjs";
|
|
8
|
+
import "../../chunk-XL3MUGFG.mjs";
|
|
8
9
|
import "../../chunk-5Z5IS4XG.mjs";
|
|
9
10
|
import "../../chunk-73SN5UQC.mjs";
|
|
10
11
|
import "../../chunk-DUB3FBYX.mjs";
|
|
11
|
-
import "../../chunk-XL3MUGFG.mjs";
|
|
12
12
|
import "../../chunk-4WWT6OC2.mjs";
|
|
13
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
14
13
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
15
14
|
import "../../chunk-2NY5IEPV.mjs";
|
|
15
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
16
16
|
import "../../chunk-6D7J5WJS.mjs";
|
|
17
17
|
import "../../chunk-WRZWEAMN.mjs";
|
|
18
18
|
import "../../chunk-IKQPTA2J.mjs";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
import "../../chunk-IHH6JKPK.mjs";
|
|
6
6
|
import "../../chunk-UJHGVFHZ.mjs";
|
|
7
7
|
import "../../chunk-TSIQCRWD.mjs";
|
|
8
|
-
import "../../chunk-M2GS2K6H.mjs";
|
|
9
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
10
8
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
11
9
|
import "../../chunk-2NY5IEPV.mjs";
|
|
10
|
+
import "../../chunk-M2GS2K6H.mjs";
|
|
11
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
12
12
|
import "../../chunk-6D7J5WJS.mjs";
|
|
13
13
|
import "../../chunk-FXJGKIYT.mjs";
|
|
14
14
|
import "../../chunk-DSSVZ47P.mjs";
|
|
@@ -17,39 +17,39 @@ import {
|
|
|
17
17
|
provider_acceleration,
|
|
18
18
|
run_ledger,
|
|
19
19
|
skill_lifecycle
|
|
20
|
-
} from "../../chunk-
|
|
20
|
+
} from "../../chunk-VNEPNUBZ.mjs";
|
|
21
21
|
import "../../chunk-IHH6JKPK.mjs";
|
|
22
22
|
import "../../chunk-UJHGVFHZ.mjs";
|
|
23
|
-
import "../../chunk-
|
|
23
|
+
import "../../chunk-OBYPZT2S.mjs";
|
|
24
24
|
import "../../chunk-XQUKAHWK.mjs";
|
|
25
|
+
import "../../chunk-6SJTUWEO.mjs";
|
|
25
26
|
import "../../chunk-DDD2BA7K.mjs";
|
|
26
27
|
import "../../chunk-DDNZWJII.mjs";
|
|
27
28
|
import "../../chunk-ZZLJUAEK.mjs";
|
|
28
|
-
import "../../chunk-
|
|
29
|
-
import "../../chunk-7AZVQS2H.mjs";
|
|
29
|
+
import "../../chunk-JXDHNASC.mjs";
|
|
30
30
|
import "../../chunk-UAQDS6V2.mjs";
|
|
31
|
-
import "../../chunk-
|
|
32
|
-
import "../../chunk-
|
|
31
|
+
import "../../chunk-MPGMU75K.mjs";
|
|
32
|
+
import "../../chunk-HWGRW6YP.mjs";
|
|
33
33
|
import "../../chunk-J72V5GVI.mjs";
|
|
34
34
|
import "../../chunk-2AHSYECT.mjs";
|
|
35
35
|
import "../../chunk-LWCO2YNI.mjs";
|
|
36
36
|
import "../../chunk-TSIQCRWD.mjs";
|
|
37
|
-
import "../../chunk-
|
|
37
|
+
import "../../chunk-XL3MUGFG.mjs";
|
|
38
|
+
import "../../chunk-2QCX6RPN.mjs";
|
|
38
39
|
import "../../chunk-NJAPWQ4D.mjs";
|
|
39
40
|
import "../../chunk-5Z5IS4XG.mjs";
|
|
40
41
|
import "../../chunk-73SN5UQC.mjs";
|
|
41
42
|
import "../../chunk-DUB3FBYX.mjs";
|
|
42
43
|
import "../../chunk-EL6TOIFZ.mjs";
|
|
44
|
+
import "../../chunk-4WWT6OC2.mjs";
|
|
43
45
|
import {
|
|
44
46
|
registerContextCompactExecutor
|
|
45
47
|
} from "../../chunk-UH6VXWMV.mjs";
|
|
46
|
-
import "../../chunk-
|
|
47
|
-
import "../../chunk-4WWT6OC2.mjs";
|
|
48
|
-
import "../../chunk-Q7NYATKS.mjs";
|
|
49
|
-
import "../../chunk-M2GS2K6H.mjs";
|
|
50
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
48
|
+
import "../../chunk-UR6LPERL.mjs";
|
|
51
49
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
52
50
|
import "../../chunk-2NY5IEPV.mjs";
|
|
51
|
+
import "../../chunk-M2GS2K6H.mjs";
|
|
52
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
53
53
|
import "../../chunk-6D7J5WJS.mjs";
|
|
54
54
|
import "../../chunk-WRZWEAMN.mjs";
|
|
55
55
|
import "../../chunk-IKQPTA2J.mjs";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
formatRetrievedMemoryEvidenceBlock,
|
|
3
3
|
retrieveMemoryEvidence
|
|
4
|
-
} from "../../chunk-
|
|
5
|
-
import "../../chunk-24ASGNQU.mjs";
|
|
4
|
+
} from "../../chunk-HWGRW6YP.mjs";
|
|
6
5
|
import "../../chunk-EZ2UKNOZ.mjs";
|
|
7
6
|
import "../../chunk-2NY5IEPV.mjs";
|
|
7
|
+
import "../../chunk-24ASGNQU.mjs";
|
|
8
8
|
import "../../chunk-6D7J5WJS.mjs";
|
|
9
9
|
import "../../chunk-DSSVZ47P.mjs";
|
|
10
10
|
import "../../chunk-SBBPQQYS.mjs";
|
|
@@ -20,6 +20,7 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
20
20
|
// src/mobile/model-context-window-budget.ts
|
|
21
21
|
var model_context_window_budget_exports = {};
|
|
22
22
|
__export(model_context_window_budget_exports, {
|
|
23
|
+
DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES: () => DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES,
|
|
23
24
|
buildNativeTranscriptBudgetForContextWindow: () => buildNativeTranscriptBudgetForContextWindow,
|
|
24
25
|
resolveTranscriptBudgetBytesForContextWindow: () => resolveTranscriptBudgetBytesForContextWindow
|
|
25
26
|
});
|
|
@@ -27,13 +28,25 @@ module.exports = __toCommonJS(model_context_window_budget_exports);
|
|
|
27
28
|
var TRANSCRIPT_BUDGET_BYTES_PER_TOKEN = 4;
|
|
28
29
|
var TRANSCRIPT_CONTEXT_WINDOW_RATIO = 0.35;
|
|
29
30
|
var MIN_TRANSCRIPT_BUDGET_BYTES = 64 * 1024;
|
|
30
|
-
var
|
|
31
|
+
var DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES = 128 * 1024;
|
|
32
|
+
var HARD_MAX_TRANSCRIPT_BUDGET_BYTES = 4 * 1024 * 1024;
|
|
31
33
|
function positiveInteger(value) {
|
|
32
34
|
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
33
35
|
return void 0;
|
|
34
36
|
}
|
|
35
37
|
return Math.trunc(value);
|
|
36
38
|
}
|
|
39
|
+
function readMaxTranscriptBudgetBytes(env = process.env) {
|
|
40
|
+
const raw = env.XKZOOM_NATIVE_TRANSCRIPT_MAX_REQUEST_BYTES?.trim();
|
|
41
|
+
if (!raw) {
|
|
42
|
+
return DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES;
|
|
43
|
+
}
|
|
44
|
+
const parsed = Number.parseInt(raw, 10);
|
|
45
|
+
if (!Number.isFinite(parsed) || parsed <= 0) {
|
|
46
|
+
return DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES;
|
|
47
|
+
}
|
|
48
|
+
return Math.min(HARD_MAX_TRANSCRIPT_BUDGET_BYTES, Math.max(MIN_TRANSCRIPT_BUDGET_BYTES, parsed));
|
|
49
|
+
}
|
|
37
50
|
function resolveTranscriptBudgetBytesForContextWindow(contextWindowTokens) {
|
|
38
51
|
const tokens = positiveInteger(contextWindowTokens);
|
|
39
52
|
if (tokens === void 0) {
|
|
@@ -43,7 +56,7 @@ function resolveTranscriptBudgetBytesForContextWindow(contextWindowTokens) {
|
|
|
43
56
|
tokens * TRANSCRIPT_CONTEXT_WINDOW_RATIO * TRANSCRIPT_BUDGET_BYTES_PER_TOKEN
|
|
44
57
|
);
|
|
45
58
|
return Math.min(
|
|
46
|
-
|
|
59
|
+
readMaxTranscriptBudgetBytes(),
|
|
47
60
|
Math.max(MIN_TRANSCRIPT_BUDGET_BYTES, estimated)
|
|
48
61
|
);
|
|
49
62
|
}
|
|
@@ -53,6 +66,7 @@ function buildNativeTranscriptBudgetForContextWindow(contextWindowTokens) {
|
|
|
53
66
|
}
|
|
54
67
|
// Annotate the CommonJS export names for ESM import in node:
|
|
55
68
|
0 && (module.exports = {
|
|
69
|
+
DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES,
|
|
56
70
|
buildNativeTranscriptBudgetForContextWindow,
|
|
57
71
|
resolveTranscriptBudgetBytesForContextWindow
|
|
58
72
|
});
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
|
+
DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES,
|
|
2
3
|
buildNativeTranscriptBudgetForContextWindow,
|
|
3
4
|
resolveTranscriptBudgetBytesForContextWindow
|
|
4
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-P262PAGZ.mjs";
|
|
5
6
|
import "../chunk-HEBXNMVQ.mjs";
|
|
6
7
|
export {
|
|
8
|
+
DEFAULT_MAX_NATIVE_TRANSCRIPT_BUDGET_BYTES,
|
|
7
9
|
buildNativeTranscriptBudgetForContextWindow,
|
|
8
10
|
resolveTranscriptBudgetBytesForContextWindow
|
|
9
11
|
};
|
|
@@ -1287,6 +1287,199 @@ var minimaxOpenAiCompletionsAdapter = {
|
|
|
1287
1287
|
id: "minimax"
|
|
1288
1288
|
};
|
|
1289
1289
|
|
|
1290
|
+
// src/mobile/native-request-diagnostics.ts
|
|
1291
|
+
function compactLogValue(value, maxLen = 180) {
|
|
1292
|
+
const text = String(value ?? "").replace(/\s+/g, " ").trim();
|
|
1293
|
+
if (!text) {
|
|
1294
|
+
return "";
|
|
1295
|
+
}
|
|
1296
|
+
return text.length > maxLen ? `${text.slice(0, maxLen)}...` : text;
|
|
1297
|
+
}
|
|
1298
|
+
function readErrorProp(value, key) {
|
|
1299
|
+
return value && typeof value === "object" ? value[key] : void 0;
|
|
1300
|
+
}
|
|
1301
|
+
function positiveInteger(value) {
|
|
1302
|
+
if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) {
|
|
1303
|
+
return void 0;
|
|
1304
|
+
}
|
|
1305
|
+
return Math.trunc(value);
|
|
1306
|
+
}
|
|
1307
|
+
function formatNativeFetchErrorForLog(error) {
|
|
1308
|
+
const parts = [];
|
|
1309
|
+
let current = error;
|
|
1310
|
+
for (let depth = 0; depth < 4 && current !== null && current !== void 0; depth += 1) {
|
|
1311
|
+
const prefix = depth === 0 ? "error" : `cause${depth}`;
|
|
1312
|
+
const name = compactLogValue(readErrorProp(current, "name"));
|
|
1313
|
+
const message = current instanceof Error ? compactLogValue(current.message) : compactLogValue(readErrorProp(current, "message") ?? current);
|
|
1314
|
+
const code = compactLogValue(readErrorProp(current, "code"));
|
|
1315
|
+
const errno = compactLogValue(readErrorProp(current, "errno"));
|
|
1316
|
+
if (name) parts.push(`${prefix}Name=${name}`);
|
|
1317
|
+
if (message) parts.push(`${prefix}Message=${message}`);
|
|
1318
|
+
if (code) parts.push(`${prefix}Code=${code}`);
|
|
1319
|
+
if (errno) parts.push(`${prefix}Errno=${errno}`);
|
|
1320
|
+
current = readErrorProp(current, "cause");
|
|
1321
|
+
}
|
|
1322
|
+
return parts.join(" ") || "error=unknown";
|
|
1323
|
+
}
|
|
1324
|
+
function applyConfiguredMaxTokens(requestBody, maxTokens) {
|
|
1325
|
+
const configured = positiveInteger(maxTokens);
|
|
1326
|
+
if (configured === void 0) {
|
|
1327
|
+
return;
|
|
1328
|
+
}
|
|
1329
|
+
const existing = positiveInteger(requestBody.max_tokens);
|
|
1330
|
+
requestBody.max_tokens = existing === void 0 ? configured : Math.min(existing, configured);
|
|
1331
|
+
}
|
|
1332
|
+
function stringifyJsonRequestBody(requestBody) {
|
|
1333
|
+
const bodyText = JSON.stringify(requestBody);
|
|
1334
|
+
return {
|
|
1335
|
+
bodyText,
|
|
1336
|
+
bodyBytes: Buffer.byteLength(bodyText, "utf8")
|
|
1337
|
+
};
|
|
1338
|
+
}
|
|
1339
|
+
function formatRequestShape(input) {
|
|
1340
|
+
const messageCount = Array.isArray(input.messages) ? input.messages.length : 0;
|
|
1341
|
+
const toolCount = Array.isArray(input.tools) ? input.tools.length : 0;
|
|
1342
|
+
const maxTokens = positiveInteger(input.maxTokens);
|
|
1343
|
+
return `bodyBytes=${input.bodyBytes} messages=${messageCount} tools=${toolCount} max_tokens=${maxTokens ?? "n/a"}`;
|
|
1344
|
+
}
|
|
1345
|
+
var DEFAULT_PROVIDER_FETCH_MAX_ATTEMPTS = 2;
|
|
1346
|
+
var HARD_PROVIDER_FETCH_MAX_ATTEMPTS = 4;
|
|
1347
|
+
var DEFAULT_PROVIDER_FETCH_RETRY_BASE_MS = 350;
|
|
1348
|
+
var HARD_PROVIDER_FETCH_RETRY_BASE_MS = 5e3;
|
|
1349
|
+
var RETRYABLE_NATIVE_FETCH_RE = new RegExp(
|
|
1350
|
+
[
|
|
1351
|
+
"fetch failed",
|
|
1352
|
+
"UND_ERR_CONNECT_TIMEOUT",
|
|
1353
|
+
"UND_ERR_HEADERS_TIMEOUT",
|
|
1354
|
+
"UND_ERR_SOCKET",
|
|
1355
|
+
"ECONNRESET",
|
|
1356
|
+
"ETIMEDOUT",
|
|
1357
|
+
"ECONNREFUSED",
|
|
1358
|
+
"ENOTFOUND",
|
|
1359
|
+
"EAI_AGAIN",
|
|
1360
|
+
"socket hang up",
|
|
1361
|
+
"network connection lost",
|
|
1362
|
+
"network request failed"
|
|
1363
|
+
].join("|"),
|
|
1364
|
+
"i"
|
|
1365
|
+
);
|
|
1366
|
+
function readClampedPositiveEnvInt(env, key, fallback, max) {
|
|
1367
|
+
const raw = (env[key] ?? "").trim();
|
|
1368
|
+
const n = Number.parseInt(raw, 10);
|
|
1369
|
+
if (!Number.isFinite(n) || n <= 0) {
|
|
1370
|
+
return fallback;
|
|
1371
|
+
}
|
|
1372
|
+
return Math.min(Math.trunc(n), max);
|
|
1373
|
+
}
|
|
1374
|
+
function readClampedNonNegativeEnvInt(env, key, fallback, max) {
|
|
1375
|
+
const raw = (env[key] ?? "").trim();
|
|
1376
|
+
const n = Number.parseInt(raw, 10);
|
|
1377
|
+
if (!Number.isFinite(n) || n < 0) {
|
|
1378
|
+
return fallback;
|
|
1379
|
+
}
|
|
1380
|
+
return Math.min(Math.trunc(n), max);
|
|
1381
|
+
}
|
|
1382
|
+
function readProviderFetchMaxAttempts(env) {
|
|
1383
|
+
return readClampedPositiveEnvInt(
|
|
1384
|
+
env,
|
|
1385
|
+
"XKZOOM_NATIVE_PROVIDER_FETCH_MAX_ATTEMPTS",
|
|
1386
|
+
DEFAULT_PROVIDER_FETCH_MAX_ATTEMPTS,
|
|
1387
|
+
HARD_PROVIDER_FETCH_MAX_ATTEMPTS
|
|
1388
|
+
);
|
|
1389
|
+
}
|
|
1390
|
+
function readProviderFetchRetryBaseMs(env) {
|
|
1391
|
+
return readClampedNonNegativeEnvInt(
|
|
1392
|
+
env,
|
|
1393
|
+
"XKZOOM_NATIVE_PROVIDER_FETCH_RETRY_BASE_MS",
|
|
1394
|
+
DEFAULT_PROVIDER_FETCH_RETRY_BASE_MS,
|
|
1395
|
+
HARD_PROVIDER_FETCH_RETRY_BASE_MS
|
|
1396
|
+
);
|
|
1397
|
+
}
|
|
1398
|
+
function isAbortLikeFetchError(error) {
|
|
1399
|
+
const name = compactLogValue(readErrorProp(error, "name"));
|
|
1400
|
+
return name === "AbortError";
|
|
1401
|
+
}
|
|
1402
|
+
function collectFetchErrorText(error) {
|
|
1403
|
+
const parts = [];
|
|
1404
|
+
let current = error;
|
|
1405
|
+
for (let depth = 0; depth < 4 && current !== null && current !== void 0; depth += 1) {
|
|
1406
|
+
parts.push(
|
|
1407
|
+
compactLogValue(readErrorProp(current, "name")),
|
|
1408
|
+
current instanceof Error ? compactLogValue(current.message) : compactLogValue(readErrorProp(current, "message") ?? current),
|
|
1409
|
+
compactLogValue(readErrorProp(current, "code")),
|
|
1410
|
+
compactLogValue(readErrorProp(current, "errno"))
|
|
1411
|
+
);
|
|
1412
|
+
current = readErrorProp(current, "cause");
|
|
1413
|
+
}
|
|
1414
|
+
return parts.filter(Boolean).join(" ");
|
|
1415
|
+
}
|
|
1416
|
+
function isRetryableNativeProviderFetchError(error) {
|
|
1417
|
+
return !isAbortLikeFetchError(error) && RETRYABLE_NATIVE_FETCH_RE.test(collectFetchErrorText(error));
|
|
1418
|
+
}
|
|
1419
|
+
function formatProviderRetryContext(context) {
|
|
1420
|
+
const parts = [
|
|
1421
|
+
`provider=${context.providerId}`,
|
|
1422
|
+
`model=${context.model}`,
|
|
1423
|
+
context.adapter ? `adapter=${context.adapter}` : "",
|
|
1424
|
+
typeof context.iteration === "number" ? `iteration=${context.iteration}` : ""
|
|
1425
|
+
];
|
|
1426
|
+
return parts.filter(Boolean).join(" ");
|
|
1427
|
+
}
|
|
1428
|
+
function asAbortSignal(signal) {
|
|
1429
|
+
if (signal && typeof signal === "object" && "aborted" in signal) {
|
|
1430
|
+
return signal;
|
|
1431
|
+
}
|
|
1432
|
+
return void 0;
|
|
1433
|
+
}
|
|
1434
|
+
async function waitForProviderFetchRetryDelay(delayMs, signal) {
|
|
1435
|
+
if (delayMs <= 0) {
|
|
1436
|
+
return;
|
|
1437
|
+
}
|
|
1438
|
+
if (signal?.aborted) {
|
|
1439
|
+
throw new DOMException("Aborted", "AbortError");
|
|
1440
|
+
}
|
|
1441
|
+
await new Promise((resolve, reject) => {
|
|
1442
|
+
const timer = setTimeout(() => {
|
|
1443
|
+
signal?.removeEventListener("abort", onAbort);
|
|
1444
|
+
resolve();
|
|
1445
|
+
}, delayMs);
|
|
1446
|
+
const onAbort = () => {
|
|
1447
|
+
clearTimeout(timer);
|
|
1448
|
+
reject(new DOMException("Aborted", "AbortError"));
|
|
1449
|
+
};
|
|
1450
|
+
signal?.addEventListener("abort", onAbort, { once: true });
|
|
1451
|
+
});
|
|
1452
|
+
}
|
|
1453
|
+
async function fetchNativeProviderWithRetry(url, init, context, env = process.env) {
|
|
1454
|
+
const maxAttempts = readProviderFetchMaxAttempts(env);
|
|
1455
|
+
const retryBaseMs = readProviderFetchRetryBaseMs(env);
|
|
1456
|
+
const signal = asAbortSignal(init.signal);
|
|
1457
|
+
for (let attempt = 1; attempt <= maxAttempts; attempt += 1) {
|
|
1458
|
+
try {
|
|
1459
|
+
return await fetch(url, init);
|
|
1460
|
+
} catch (error) {
|
|
1461
|
+
const retry = attempt < maxAttempts && !signal?.aborted && isRetryableNativeProviderFetchError(error);
|
|
1462
|
+
context.log(
|
|
1463
|
+
`[XKZOOM][native-reply][${context.label}] fetch_failed ${url} ${formatProviderRetryContext(context)} attempt=${attempt}/${maxAttempts} retry=${retry ? 1 : 0} ${formatRequestShape({
|
|
1464
|
+
bodyBytes: context.bodyBytes,
|
|
1465
|
+
messages: context.messages,
|
|
1466
|
+
tools: context.tools,
|
|
1467
|
+
maxTokens: context.maxTokens
|
|
1468
|
+
})} ${formatNativeFetchErrorForLog(error)}`
|
|
1469
|
+
);
|
|
1470
|
+
if (!retry) {
|
|
1471
|
+
throw error;
|
|
1472
|
+
}
|
|
1473
|
+
const delayMs = retryBaseMs * attempt;
|
|
1474
|
+
context.log(
|
|
1475
|
+
`[XKZOOM][native-reply][${context.label}] fetch_retry ${url} ${formatProviderRetryContext(context)} nextAttempt=${attempt + 1}/${maxAttempts} delayMs=${delayMs}`
|
|
1476
|
+
);
|
|
1477
|
+
await waitForProviderFetchRetryDelay(delayMs, signal);
|
|
1478
|
+
}
|
|
1479
|
+
}
|
|
1480
|
+
throw new Error(`native provider fetch retry exhausted: ${url}`);
|
|
1481
|
+
}
|
|
1482
|
+
|
|
1290
1483
|
// src/mobile/native-openai-text-stream.ts
|
|
1291
1484
|
function mergeOpenAiCompatibleStreamChunk(fullSoFar, incoming) {
|
|
1292
1485
|
if (incoming.length === 0) {
|
|
@@ -2216,7 +2409,8 @@ async function runNativeAnthropicMessagesStreamToDispatcher(params) {
|
|
|
2216
2409
|
if (params.providerAccelerationPlan || providerAcceleration.application.applied || providerAcceleration.application.warnings.length > 0) {
|
|
2217
2410
|
params.log(formatProviderAccelerationApplication(providerAcceleration.application));
|
|
2218
2411
|
}
|
|
2219
|
-
const
|
|
2412
|
+
const adapter = selectAnthropicAdapterByBaseUrl(cfg.baseUrl);
|
|
2413
|
+
const thinkingForBody = adapter.resolveThinkingForBody({
|
|
2220
2414
|
reasoningMode: params.reasoningMode,
|
|
2221
2415
|
model: cfg.model,
|
|
2222
2416
|
configuredThinking: requestBody.thinking
|
|
@@ -2224,12 +2418,34 @@ async function runNativeAnthropicMessagesStreamToDispatcher(params) {
|
|
|
2224
2418
|
if (thinkingForBody !== void 0) {
|
|
2225
2419
|
requestBody.thinking = thinkingForBody;
|
|
2226
2420
|
}
|
|
2227
|
-
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2231
|
-
|
|
2232
|
-
|
|
2421
|
+
applyConfiguredMaxTokens(requestBody, cfg.maxTokens);
|
|
2422
|
+
const { bodyText, bodyBytes } = stringifyJsonRequestBody(requestBody);
|
|
2423
|
+
params.log(
|
|
2424
|
+
`[XKZOOM][native-reply][anthropic-messages] request_shape ${formatRequestShape({
|
|
2425
|
+
bodyBytes,
|
|
2426
|
+
messages: transcriptMessages,
|
|
2427
|
+
maxTokens: requestBody.max_tokens
|
|
2428
|
+
})}`
|
|
2429
|
+
);
|
|
2430
|
+
const res = await fetchNativeProviderWithRetry(
|
|
2431
|
+
url,
|
|
2432
|
+
{
|
|
2433
|
+
method: "POST",
|
|
2434
|
+
headers: buildNativeAnthropicRequestHeaders(cfg),
|
|
2435
|
+
body: bodyText,
|
|
2436
|
+
signal: params.signal
|
|
2437
|
+
},
|
|
2438
|
+
{
|
|
2439
|
+
label: "anthropic-messages",
|
|
2440
|
+
providerId: cfg.providerId,
|
|
2441
|
+
model: cfg.model,
|
|
2442
|
+
adapter: adapter.id,
|
|
2443
|
+
bodyBytes,
|
|
2444
|
+
messages: transcriptMessages,
|
|
2445
|
+
maxTokens: requestBody.max_tokens,
|
|
2446
|
+
log: params.log
|
|
2447
|
+
}
|
|
2448
|
+
);
|
|
2233
2449
|
if (!res.ok) {
|
|
2234
2450
|
const t = await res.text();
|
|
2235
2451
|
throw new Error(`native anthropic-messages HTTP ${res.status}: ${t.slice(0, 500)}`);
|