@cortexkit/opencode-magic-context 0.49.91 → 0.49.93
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/dist/auto-search-worker.js +3 -3
- package/dist/chunk-embedding-write-worker.js +2 -2
- package/dist/{conflict-warning-hook-kbq6ppjf.js → conflict-warning-hook-exf96bpt.js} +3 -3
- package/dist/{context-6qq5e1ry.js → context-jpxthqxg.js} +98 -77
- package/dist/{embedding-backfill-w0yq71q2.js → embedding-backfill-6wzc4p2n.js} +4 -4
- package/dist/embedding-worker.js +2 -2
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts +3 -0
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/overflow-detection.d.ts +7 -1
- package/dist/features/magic-context/overflow-detection.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +13 -3
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-parser.d.ts +2 -0
- package/dist/hooks/magic-context/compartment-parser.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +5 -5
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +3 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +2 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-handler.d.ts +4 -0
- package/dist/hooks/magic-context/event-handler.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts +5 -0
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-drain-gate.d.ts +15 -0
- package/dist/hooks/magic-context/historian-drain-gate.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts +1 -1
- package/dist/hooks/magic-context/historian-prompt.generated.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts +5 -0
- package/dist/hooks/magic-context/historian-publish-stage-logger.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts +1 -0
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts +1 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/provider-overflow-notice.d.ts +8 -0
- package/dist/hooks/magic-context/provider-overflow-notice.d.ts.map +1 -0
- package/dist/hooks/magic-context/read-session-db.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +5 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-czz0w2c4.js → index-01h7tqe3.js} +11 -0
- package/dist/{index-r6r2eh90.js → index-1kem0xxx.js} +4 -4
- package/dist/{index-f25ha337.js → index-5zrzg8r1.js} +1 -1
- package/dist/{index-6zewd2n5.js → index-9ffntwyr.js} +1 -1
- package/dist/{index-mq97qmb8.js → index-dr6bd4c8.js} +3 -3
- package/dist/{index-83qd3n7s.js → index-et39x9k3.js} +1 -1
- package/dist/{index-nmkv8yvs.js → index-fpjnjxyx.js} +2 -2
- package/dist/{index-ran2b3fn.js → index-g5c67kay.js} +75 -67
- package/dist/{index-7rgnh11t.js → index-g6y2wk32.js} +5 -5
- package/dist/{index-e8my7q6m.js → index-g9qtxv87.js} +8 -8
- package/dist/{index-5wgdbj2h.js → index-gqfy38m9.js} +2 -2
- package/dist/{index-3yw525kb.js → index-hee64h6k.js} +6 -6
- package/dist/{index-xn9efn18.js → index-hes3k87g.js} +12 -5
- package/dist/{index-sr8dmp7p.js → index-j2w79s9r.js} +76 -6
- package/dist/{index-qna2ra0s.js → index-jba6ny4m.js} +27 -3
- package/dist/{index-dva352qe.js → index-kty5k23y.js} +1 -1
- package/dist/{index-ywgv1xcb.js → index-mjy2k9jr.js} +1 -1
- package/dist/{index-3n376ann.js → index-n9kd68vc.js} +2 -2
- package/dist/{index-capcna4r.js → index-pnawfv4e.js} +1 -1
- package/dist/{index-6t7jvp76.js → index-rz47hf2m.js} +3 -3
- package/dist/{index-x40zr813.js → index-sp5pvs95.js} +9 -1
- package/dist/{index-ydhymf0b.js → index-ttdk2w0z.js} +3 -3
- package/dist/{index-gqhebzxx.js → index-xr1t0fxb.js} +90 -25
- package/dist/{index-m6vhxsce.js → index-y2vshk67.js} +92 -70
- package/dist/{index-6nqz8hsz.js → index-y915t3ey.js} +1 -1
- package/dist/{index-wfahebsc.js → index-yqha238s.js} +47 -26
- package/dist/{index-febyth5n.js → index-za1yx1m4.js} +1375 -1310
- package/dist/index.js +83 -46
- package/dist/{message-index-bounded-wvnp6fcp.js → message-index-bounded-vjrnptar.js} +5 -5
- package/dist/migration-worker.js +2 -2
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-8je0xg18.js → project-embedding-registry-m8zcmrsg.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +4 -4
- package/dist/{read-session-chunk-j4hjc1pk.js → read-session-chunk-zkzdc0e5.js} +4 -4
- package/dist/{recomp-orchestrator-ps1c8c5h.js → recomp-orchestrator-qb2hymj5.js} +17 -17
- package/dist/{render-nfj7280n.js → render-34p0kek8.js} +11 -11
- package/dist/{search-archive-1etwnve4.js → search-archive-08ppk0q5.js} +6 -6
- package/dist/{search-3r8b0jfa.js → search-e9bb9hpx.js} +13 -13
- package/dist/{send-session-notification-gzxz88vq.js → send-session-notification-0779tyd9.js} +2 -2
- package/dist/{storage-tags-nh2ftqhx.js → storage-tags-gk7gjkqt.js} +2 -2
- package/dist/{store-reader-a2v34xnh.js → store-reader-qbq6q4v0.js} +1 -1
- package/dist/{store-019k3ek7.js → store-yr443ye8.js} +2 -2
- package/dist/{transform-postprocess-phase-tqp968w4.js → transform-postprocess-phase-neds90e3.js} +18 -18
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +2 -2
- package/dist/v2/{context-d57v8c10.js → context-ctsd80vc.js} +168 -121
- package/dist/v2/{embedding-backfill-95m72gxa.js → embedding-backfill-40g0anxh.js} +4 -4
- package/dist/v2/embedding-worker.js +2 -2
- package/dist/v2/fold/host-media.d.ts.map +1 -1
- package/dist/v2/fold/native-replay.d.ts +1 -0
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts +15 -0
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hidden-child-native.d.ts.map +1 -1
- package/dist/v2/hidden-run-holder.d.ts +4 -4
- package/dist/v2/hooks/overflow-recovery.d.ts +6 -0
- package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-2nhbwry6.js → message-index-bounded-1vew9c37.js} +5 -5
- package/dist/v2/migration-worker.js +2 -2
- package/dist/v2/{project-embedding-registry-fcxf4qht.js → project-embedding-registry-je5jam7y.js} +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-jrrhwxgx.js → read-session-chunk-09sre4xv.js} +4 -4
- package/dist/v2/{recomp-orchestrator-n79hdd7n.js → recomp-orchestrator-mgcty3we.js} +17 -17
- package/dist/v2/{render-7emcjdt1.js → render-ygcmyn9x.js} +11 -11
- package/dist/v2/{search-archive-fpjbmxcx.js → search-archive-nrsqqmk5.js} +6 -6
- package/dist/v2/{search-vz2cpgr0.js → search-gmye6n25.js} +12 -12
- package/dist/v2/{send-session-notification-zazaxxpf.js → send-session-notification-v69y04f5.js} +2 -2
- package/dist/v2/{server-vsqmkvxc.js → server-00adcfjd.js} +1 -1
- package/dist/v2/{server-kwsqytwj.js → server-2xm0gxke.js} +1 -1
- package/dist/v2/{server-r4816kwv.js → server-4ecpanyn.js} +47 -26
- package/dist/v2/{server-7e89a2kf.js → server-6chcnnhq.js} +12 -5
- package/dist/v2/{server-hgfd6c3e.js → server-6x40bnb7.js} +2 -2
- package/dist/v2/{server-vfa7byfa.js → server-bnkc9kph.js} +5 -5
- package/dist/v2/{server-n431vzn5.js → server-btgnkr9z.js} +2 -2
- package/dist/v2/{server-4axv6kq6.js → server-cvp9w5gs.js} +1375 -1310
- package/dist/v2/{server-4bfk1sky.js → server-dgsjamm4.js} +3 -3
- package/dist/v2/{server-rz6g5xne.js → server-e6xneh68.js} +1 -1
- package/dist/v2/{server-q2ap5cty.js → server-g53asaqt.js} +3 -3
- package/dist/v2/{server-6250cxzs.js → server-gs2251jr.js} +1 -1
- package/dist/v2/{server-8r32etq0.js → server-jkj1dq6j.js} +27 -3
- package/dist/v2/{server-b4efn08m.js → server-k1xc2bw1.js} +1 -1
- package/dist/v2/{server-3z8rhacq.js → server-myp4pc6x.js} +7 -7
- package/dist/v2/{server-72k2r3kt.js → server-pcarsvj2.js} +2 -2
- package/dist/v2/{server-0h875f56.js → server-rkj44mez.js} +76 -6
- package/dist/v2/{server-8ps3717t.js → server-vc5fta6s.js} +3 -3
- package/dist/v2/{server-j9cm1czj.js → server-vtgeyhq6.js} +11 -0
- package/dist/v2/{server-xmgvy3cq.js → server-x69fqsvz.js} +1 -1
- package/dist/v2/{server-q104czn6.js → server-z9czv2vb.js} +90 -25
- package/dist/v2/server.js +4 -4
- package/dist/v2/{storage-tags-t0f9njdp.js → storage-tags-nccqr0kr.js} +2 -2
- package/dist/v2/{store-q3ef5rvz.js → store-enef5jcn.js} +2 -2
- package/dist/v2/{store-reader-wc01y2rc.js → store-reader-jbaqv1yp.js} +1 -1
- package/dist/v2/store-reader.d.ts +16 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{v2-archive-reader-9p84yzk5.js → v2-archive-reader-7vmng8q7.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-acebazx8.js → wrapup-orchestrator-7r4y0bf6.js} +17 -17
- package/dist/{v2-archive-reader-w1bbaqe8.js → v2-archive-reader-7s90gfax.js} +1 -1
- package/dist/{wrapup-orchestrator-fwbe0mvm.js → wrapup-orchestrator-m2p89973.js} +18 -18
- package/package.json +1 -1
- package/src/config/schema/magic-context.ts +1 -1
- package/src/shared/models-dev-cache.test.ts +15 -0
- /package/dist/v2/{server-3ap5dmhc.js → server-5hwf5c7r.js} +0 -0
|
@@ -3,19 +3,19 @@ import {
|
|
|
3
3
|
} from "./index-ywrz4wy2.js";
|
|
4
4
|
import {
|
|
5
5
|
clearEmergencyRecovery
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-xr1t0fxb.js";
|
|
7
7
|
import {
|
|
8
8
|
requestPendingMaterialization,
|
|
9
9
|
dropSlot
|
|
10
|
-
} from "./index-
|
|
10
|
+
} from "./index-yqha238s.js";
|
|
11
11
|
import {
|
|
12
12
|
pausedRecompReason,
|
|
13
13
|
executeContextRecomp
|
|
14
|
-
} from "./index-
|
|
14
|
+
} from "./index-za1yx1m4.js";
|
|
15
15
|
import {
|
|
16
16
|
renderUserFacingFailure,
|
|
17
17
|
userFacingFailureCode
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-ttdk2w0z.js";
|
|
19
19
|
|
|
20
20
|
// src/hooks/magic-context/recomp-orchestrator.ts
|
|
21
21
|
function resolveLiveModelKey(liveSessionState, sessionId) {
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
estimateMessageTokens,
|
|
10
10
|
getCandidateToolOwners2,
|
|
11
11
|
pickNearestPriorOwner2
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-xr1t0fxb.js";
|
|
13
13
|
import {
|
|
14
14
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
15
15
|
isSystemDirective,
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
} from "./index-mg9s2rc3.js";
|
|
31
31
|
import {
|
|
32
32
|
renderToolTemplate
|
|
33
|
-
} from "./index-
|
|
33
|
+
} from "./index-y915t3ey.js";
|
|
34
34
|
import {
|
|
35
35
|
readRawSessionMessagesFromDb2,
|
|
36
36
|
readRawSessionMessagePageFromDb2,
|
|
@@ -53,7 +53,7 @@ import {
|
|
|
53
53
|
withReadOnlySessionDb,
|
|
54
54
|
getRawSessionMessageCountFromDb,
|
|
55
55
|
getMessageTimesFromOpenCodeDb
|
|
56
|
-
} from "./index-
|
|
56
|
+
} from "./index-sp5pvs95.js";
|
|
57
57
|
import {
|
|
58
58
|
markHostUnservedRow,
|
|
59
59
|
isHostUnservedRow
|
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./index-s7460efs.js";
|
|
4
4
|
import {
|
|
5
5
|
getTagById2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-xr1t0fxb.js";
|
|
7
7
|
import {
|
|
8
8
|
expandToolPart,
|
|
9
9
|
visitRawSessionMessages2,
|
|
10
10
|
readRawSessionMessageById2
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-dr6bd4c8.js";
|
|
12
12
|
|
|
13
13
|
// src/tools/ctx-expand/render.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
@@ -1,61 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
getHarness2
|
|
3
|
-
} from "./index-pavzsdc6.js";
|
|
4
|
-
import {
|
|
5
|
-
getMagicContextStorageDir,
|
|
6
|
-
log2,
|
|
7
|
-
sessionLog2
|
|
8
|
-
} from "./index-ywrz4wy2.js";
|
|
9
|
-
import {
|
|
10
|
-
textMentionsRecentCommit,
|
|
11
|
-
hasMeaningfulUserText2,
|
|
12
|
-
estimateTokens
|
|
13
|
-
} from "./index-s7460efs.js";
|
|
14
|
-
import {
|
|
15
|
-
inRootAsyncContext2,
|
|
16
|
-
getTagIdentityWriteGeneration2,
|
|
17
|
-
getSqliteDatabasePath2,
|
|
18
|
-
assertTransformWrite2,
|
|
19
|
-
isTransientSqliteError2
|
|
20
|
-
} from "./index-gzy5w8ya.js";
|
|
21
|
-
import {
|
|
22
|
-
reuseWorker
|
|
23
|
-
} from "./index-96ztjvkn.js";
|
|
24
|
-
import {
|
|
25
|
-
createWorkerShutdown
|
|
26
|
-
} from "./index-1d042x6w.js";
|
|
27
|
-
import {
|
|
28
|
-
runSessionWarmupWorker
|
|
29
|
-
} from "./index-q7q6qp1f.js";
|
|
30
|
-
import {
|
|
31
|
-
getMaxM0MutationId,
|
|
32
|
-
getLastCompartmentEndMessage,
|
|
33
|
-
providerResponseFailed,
|
|
34
|
-
rememberUnpublishedAutoSearchNoHint,
|
|
35
|
-
getUnpublishedAutoSearchNoHint,
|
|
36
|
-
forgetUnpublishedAutoSearchNoHint,
|
|
37
|
-
registerAutoSearchWork,
|
|
38
|
-
cancelAutoSearchWork,
|
|
39
|
-
getOrCreateSessionMeta,
|
|
40
|
-
updateSessionMeta,
|
|
41
|
-
advanceToolReclaimWatermark,
|
|
42
|
-
requestPendingMaterialization,
|
|
43
|
-
pendingMaterializationOrigin,
|
|
44
|
-
hasPendingMaterializationOrigin,
|
|
45
|
-
hasExplicitRefreshRequest,
|
|
46
|
-
clearReclaimedMaterialization,
|
|
47
|
-
clearPendingMaterializationOrigin,
|
|
48
|
-
noteServedPassPermission,
|
|
49
|
-
dropSlot,
|
|
50
|
-
TOOL_SWEEP_SCOPED_MARKER,
|
|
51
|
-
saveSourceContent,
|
|
52
|
-
replaceSourceContent,
|
|
53
|
-
getSourceContents
|
|
54
|
-
} from "./index-wfahebsc.js";
|
|
55
|
-
import {
|
|
56
|
-
cleanSearchText,
|
|
57
|
-
matchedSearchSnippet
|
|
58
|
-
} from "./index-capcna4r.js";
|
|
59
1
|
import {
|
|
60
2
|
protectedToolTagNumbers,
|
|
61
3
|
stripPersistedAssistantText,
|
|
@@ -138,6 +80,7 @@ import {
|
|
|
138
80
|
detectThinkingBindingMismatch,
|
|
139
81
|
detectLatestTurnThinkingMismatch,
|
|
140
82
|
isPrefixBoundThinkingModel,
|
|
83
|
+
overflowLimitToStore,
|
|
141
84
|
modelAcceptsEmptyContent,
|
|
142
85
|
isAnthropicFamilyRoute,
|
|
143
86
|
neutralizeDroppedReasoningPart,
|
|
@@ -221,7 +164,65 @@ import {
|
|
|
221
164
|
adoptNullOwnerToolTag2,
|
|
222
165
|
getCandidateToolOwners2,
|
|
223
166
|
pickNearestPriorOwner2
|
|
224
|
-
} from "./index-
|
|
167
|
+
} from "./index-xr1t0fxb.js";
|
|
168
|
+
import {
|
|
169
|
+
getHarness2
|
|
170
|
+
} from "./index-pavzsdc6.js";
|
|
171
|
+
import {
|
|
172
|
+
getMagicContextStorageDir,
|
|
173
|
+
log2,
|
|
174
|
+
sessionLog2
|
|
175
|
+
} from "./index-ywrz4wy2.js";
|
|
176
|
+
import {
|
|
177
|
+
textMentionsRecentCommit,
|
|
178
|
+
hasMeaningfulUserText2,
|
|
179
|
+
estimateTokens
|
|
180
|
+
} from "./index-s7460efs.js";
|
|
181
|
+
import {
|
|
182
|
+
inRootAsyncContext2,
|
|
183
|
+
getTagIdentityWriteGeneration2,
|
|
184
|
+
getSqliteDatabasePath2,
|
|
185
|
+
assertTransformWrite2,
|
|
186
|
+
isTransientSqliteError2
|
|
187
|
+
} from "./index-gzy5w8ya.js";
|
|
188
|
+
import {
|
|
189
|
+
reuseWorker
|
|
190
|
+
} from "./index-96ztjvkn.js";
|
|
191
|
+
import {
|
|
192
|
+
createWorkerShutdown
|
|
193
|
+
} from "./index-1d042x6w.js";
|
|
194
|
+
import {
|
|
195
|
+
runSessionWarmupWorker
|
|
196
|
+
} from "./index-q7q6qp1f.js";
|
|
197
|
+
import {
|
|
198
|
+
getMaxM0MutationId,
|
|
199
|
+
getLastCompartmentEndMessage,
|
|
200
|
+
providerResponseFailed,
|
|
201
|
+
rememberUnpublishedAutoSearchNoHint,
|
|
202
|
+
getUnpublishedAutoSearchNoHint,
|
|
203
|
+
forgetUnpublishedAutoSearchNoHint,
|
|
204
|
+
registerAutoSearchWork,
|
|
205
|
+
cancelAutoSearchWork,
|
|
206
|
+
getOrCreateSessionMeta,
|
|
207
|
+
updateSessionMeta,
|
|
208
|
+
advanceToolReclaimWatermark,
|
|
209
|
+
requestPendingMaterialization,
|
|
210
|
+
pendingMaterializationOrigin,
|
|
211
|
+
hasPendingMaterializationOrigin,
|
|
212
|
+
hasExplicitRefreshRequest,
|
|
213
|
+
clearReclaimedMaterialization,
|
|
214
|
+
clearPendingMaterializationOrigin,
|
|
215
|
+
noteServedPassPermission,
|
|
216
|
+
dropSlot,
|
|
217
|
+
TOOL_SWEEP_SCOPED_MARKER,
|
|
218
|
+
saveSourceContent,
|
|
219
|
+
replaceSourceContent,
|
|
220
|
+
getSourceContents
|
|
221
|
+
} from "./index-yqha238s.js";
|
|
222
|
+
import {
|
|
223
|
+
cleanSearchText,
|
|
224
|
+
matchedSearchSnippet
|
|
225
|
+
} from "./index-pnawfv4e.js";
|
|
225
226
|
import {
|
|
226
227
|
BoundedSessionMap,
|
|
227
228
|
tagRevisionKey,
|
|
@@ -235,13 +236,13 @@ import {
|
|
|
235
236
|
resolveModelConfigValue,
|
|
236
237
|
normalizeProtectedToolName,
|
|
237
238
|
mergeProtectedTools
|
|
238
|
-
} from "./index-
|
|
239
|
+
} from "./index-y915t3ey.js";
|
|
239
240
|
import {
|
|
240
241
|
openCodeDbExists,
|
|
241
242
|
withReadOnlySessionDb,
|
|
242
243
|
getMessageTimesFromOpenCodeDb,
|
|
243
244
|
findLastAssistantModelFromOpenCodeDb
|
|
244
|
-
} from "./index-
|
|
245
|
+
} from "./index-sp5pvs95.js";
|
|
245
246
|
import {
|
|
246
247
|
stripSystemInjection,
|
|
247
248
|
isTextPart,
|
|
@@ -254,7 +255,7 @@ import {
|
|
|
254
255
|
extractToolCallObservation,
|
|
255
256
|
ToolMutationBatch,
|
|
256
257
|
createToolDropTarget
|
|
257
|
-
} from "./index-
|
|
258
|
+
} from "./index-dr6bd4c8.js";
|
|
258
259
|
import {
|
|
259
260
|
hasTrustedAbsoluteWall,
|
|
260
261
|
applyProvenInputFloor,
|
|
@@ -266,18 +267,18 @@ import {
|
|
|
266
267
|
getProjectEmbeddingSnapshot2,
|
|
267
268
|
embedTextForProject2,
|
|
268
269
|
embedBatchForProject2
|
|
269
|
-
} from "./index-
|
|
270
|
+
} from "./index-n9kd68vc.js";
|
|
270
271
|
import {
|
|
271
272
|
isEmbeddingHostBusy2
|
|
272
273
|
} from "./index-qt1qqasc.js";
|
|
273
274
|
import {
|
|
274
275
|
userFacingFailureCode
|
|
275
|
-
} from "./index-
|
|
276
|
+
} from "./index-ttdk2w0z.js";
|
|
276
277
|
import {
|
|
277
278
|
getMessageIndexEpoch,
|
|
278
279
|
isMessageIndexSearchable,
|
|
279
280
|
createAutoSearchDiagnostics
|
|
280
|
-
} from "./index-
|
|
281
|
+
} from "./index-kty5k23y.js";
|
|
281
282
|
import {
|
|
282
283
|
compareOpenCodeMessagesByCanonicalOrder,
|
|
283
284
|
startCompactionMarkerCandidatePreparation,
|
|
@@ -299,7 +300,7 @@ import {
|
|
|
299
300
|
peekNoteNudgeText,
|
|
300
301
|
markNoteNudgeDelivered,
|
|
301
302
|
getActiveCompartmentRun
|
|
302
|
-
} from "./index-
|
|
303
|
+
} from "./index-za1yx1m4.js";
|
|
303
304
|
import {
|
|
304
305
|
canonicalModelIdentity,
|
|
305
306
|
piModelRefToCanonical,
|
|
@@ -524,6 +525,13 @@ function resolveTrustedContextLimit(providerID, modelID, ctx) {
|
|
|
524
525
|
const persisted = modelMatchedPersistedUsage(ctx?.db, ctx?.sessionID, modelKey);
|
|
525
526
|
return isSaneLimit(persisted?.lastUsageContextLimit) ? persisted.lastUsageContextLimit : undefined;
|
|
526
527
|
}
|
|
528
|
+
function resolveOpenCodeOverflowLimit(detection, providerID, modelID, ctx) {
|
|
529
|
+
return overflowLimitToStore(detection, () => {
|
|
530
|
+
if (!providerID || !modelID)
|
|
531
|
+
return;
|
|
532
|
+
return resolveContextWindowGeometry(providerID, modelID, ctx)?.usableSoft ?? resolveTrustedContextLimit(providerID, modelID, ctx);
|
|
533
|
+
});
|
|
534
|
+
}
|
|
527
535
|
var WRAPUP_WINDOW_UNAVAILABLE = "Cannot run /ctx-wrapup: the model's context window is unknown. Select a model with a configured context window or send a message with that model, then retry.";
|
|
528
536
|
function readPersistedWrapupWindow(db, sessionId, modelKey) {
|
|
529
537
|
const { lastUsageContextLimit, lastObservedModelKey } = getOrCreateSessionMeta(db, sessionId);
|
|
@@ -9232,4 +9240,4 @@ function checkM0MutationDriftAndSignal2(args) {
|
|
|
9232
9240
|
return false;
|
|
9233
9241
|
}
|
|
9234
9242
|
|
|
9235
|
-
export { resolveModelCacheTtl, recordOpenCodeProvenInputFloor, resolveOpenCodeProvenInputFloor, resolveContextWindowGeometry, resolveContextLimit, resolveTrustedContextLimit, WRAPUP_WINDOW_UNAVAILABLE, resolveOpenCodeWrapupWindow, resolveExecuteThresholdDetail, resolveExecuteThreshold, resolveModelKey, resolveSessionId, historyBudgetPolicyIdentity, parseCacheTtl, createScheduler, computeHardCacheExpired, makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, removeReasoningParts, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, retainedActiveThinkingParts, armLatestThinkingRecovery, LATEST_TURN_THINKING_REMOVED_REASON, prepareLatestThinkingRecovery, endLatestThinkingRecoveryAfterReset, restoredTurnMessages, captureLatestTurnOriginals, armBindingRecoverySafely, armLatestThinkingRecoveryFromError, armThinkingBindingRecoveryFromError, hostInstructionRetentionEnabled, isHostInstructionRetentionOn, recordHostInstructionDecisions, replayCavemanCompression, describeDegradedPassFailure, DegradedPassRefusalError, degradedPassError, servedHeadChanged, noteHostCheckpointCommit, revertHostCheckpointPass, forgetHostCheckpointPass, forceBandConfirmed, pressureBands, forceRide, heuristicsRunOnPass, routineCleanupRunsOnPass, heuristicsAlreadyRanThisTurn, routinePressureAlreadyApplied, safeReasoningCutoff, isStructuralNoiseSentinel, stripStructuralNoise, prepareStructuralSentinelChoices, renderDroppedText, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, collectForeignTextParts, isLegacyForeignTextTag, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
|
|
9243
|
+
export { resolveModelCacheTtl, recordOpenCodeProvenInputFloor, resolveOpenCodeProvenInputFloor, resolveContextWindowGeometry, resolveContextLimit, resolveTrustedContextLimit, resolveOpenCodeOverflowLimit, WRAPUP_WINDOW_UNAVAILABLE, resolveOpenCodeWrapupWindow, resolveExecuteThresholdDetail, resolveExecuteThreshold, resolveModelKey, resolveSessionId, historyBudgetPolicyIdentity, parseCacheTtl, createScheduler, computeHardCacheExpired, makeToolCompositeKey, createTagger, cavemanWordRulesForLanguage, searchMessageHistoryOffThread, findSessionId, findLastUserMessageId, clearAutoSearchForSession, setCtxReduceRegisteredGlobally, resolveCtxReduceAvailabilityFromMessages, resolveCtxReduceAvailability, primeCtxReduceSpawnPermission, ctxReduceSpawnPermissionReadNeeded, spawnAgentFromMessages, spawnAgentFromOpenCodeDb, todowritePermissionDenied, cachedToolPermissionDenied, clearToolPermissionDenied, resolveTodowriteAvailabilityFromMessages, resolveTodowriteAvailability, diagnosticStateChanged, clearDiagnosticLogState, canConsumeDeferredOnThisPass, hasReclaimRide, reclaimRidePermitted, reclaimRideLabel, pendingDropEligibilityKey, createPendingDropEligibilityCache, readExecuteReclaimState, writeExecuteReclaimState, maintainExecuteFloorMark, captureOpencodeReasoningBudgetStatus, reasoningBudgetStatusLine, ENGINE_RECONNECTING_USER_MESSAGE, ENGINE_BUSY_USER_MESSAGE, SIGNED_THINKING_RESET_FENCE_FAILED, contextRefusalError, protectedToolRefusal, outgoingContextRefusal, signedTurnContextRefusal, EmergencyFailClosedError, removeReasoningParts, latestAssistantTurnStart, latestAssistantTurnMessages, hasActiveAnthropicThinkingTurn, retainedActiveThinkingParts, armLatestThinkingRecovery, LATEST_TURN_THINKING_REMOVED_REASON, prepareLatestThinkingRecovery, endLatestThinkingRecoveryAfterReset, restoredTurnMessages, captureLatestTurnOriginals, armBindingRecoverySafely, armLatestThinkingRecoveryFromError, armThinkingBindingRecoveryFromError, hostInstructionRetentionEnabled, isHostInstructionRetentionOn, recordHostInstructionDecisions, replayCavemanCompression, describeDegradedPassFailure, DegradedPassRefusalError, degradedPassError, servedHeadChanged, noteHostCheckpointCommit, revertHostCheckpointPass, forgetHostCheckpointPass, forceBandConfirmed, pressureBands, forceRide, heuristicsRunOnPass, routineCleanupRunsOnPass, heuristicsAlreadyRanThisTurn, routinePressureAlreadyApplied, safeReasoningCutoff, isStructuralNoiseSentinel, stripStructuralNoise, prepareStructuralSentinelChoices, renderDroppedText, applyFlushedStatuses, prewarmTagOwners, waitForTagOwners, collectForeignTextParts, isLegacyForeignTextTag, withTransformTimingSummary, logTransformTiming, hasRecentAssistantCommit, tagMessages, resetDegradedCacheCount2, isSyntheticHeadMessage2, applyTodoSynthesis2, freezeReasoningOnBustingPass2, servesThinkingBlock2, firstServedDivergenceIndex2, rustModeServedKeyAfterPersistedStrips2, replayRustModeBindingMismatchStrips2, RUST_MARKER_LOCK_SKIP_LOG2, applyRustModeDeferredCompactionMarker2, clearRustModeBoundaryRecord2, runRustModePostprocess2, reconcileMarkerRepresentation2, clearPendingCompactionMarkerAfterSuccessfulDrain2, defaultCompactionMarkerStrategy2, abortSessionFailClosed2, evaluateEmergencyFailClosed2, finalizeMessageRepresentation2, runPostTransformPhase2, checkM0MutationDriftAndSignal2 };
|
|
@@ -137,11 +137,11 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
137
137
|
{ createV2RecoveryAttachments }
|
|
138
138
|
] = await Promise.all([
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
|
-
import("./store-reader-
|
|
141
|
-
import("./store-
|
|
142
|
-
import("./read-session-chunk-
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
140
|
+
import("./store-reader-qbq6q4v0.js"),
|
|
141
|
+
import("./store-yr443ye8.js"),
|
|
142
|
+
import("./read-session-chunk-zkzdc0e5.js"),
|
|
143
|
+
import("./render-34p0kek8.js"),
|
|
144
|
+
import("./search-archive-08ppk0q5.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -39,7 +39,7 @@ import {
|
|
|
39
39
|
enqueueShadowEmbeddingItems2,
|
|
40
40
|
getProjectEmbeddingSnapshot2,
|
|
41
41
|
embedItemsForProject2
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-n9kd68vc.js";
|
|
43
43
|
import {
|
|
44
44
|
recordEmbeddingMeasurement
|
|
45
45
|
} from "./index-2amn2s73.js";
|
|
@@ -55,7 +55,7 @@ import {
|
|
|
55
55
|
sanitizeFtsQuery,
|
|
56
56
|
searchMemoriesFTS,
|
|
57
57
|
searchMemoriesFTSUnion
|
|
58
|
-
} from "./index-
|
|
58
|
+
} from "./index-ttdk2w0z.js";
|
|
59
59
|
import {
|
|
60
60
|
ModuleMemoryAuthorityError2,
|
|
61
61
|
getMemoriesByProject2,
|
|
@@ -65,35 +65,35 @@ import {
|
|
|
65
65
|
import {
|
|
66
66
|
matchedSearchSnippet,
|
|
67
67
|
getIndexedMessageCorpusSize
|
|
68
|
-
} from "./index-
|
|
68
|
+
} from "./index-pnawfv4e.js";
|
|
69
69
|
import {
|
|
70
70
|
getMessageIndexEpoch,
|
|
71
71
|
isMessageIndexSearchable,
|
|
72
72
|
withMemoryHintContent,
|
|
73
73
|
autoSearchRelevance,
|
|
74
74
|
recordAutoSearchLane
|
|
75
|
-
} from "./index-
|
|
75
|
+
} from "./index-kty5k23y.js";
|
|
76
76
|
import {
|
|
77
77
|
ensureMemoryEmbeddings2
|
|
78
|
-
} from "./index-
|
|
78
|
+
} from "./index-5zrzg8r1.js";
|
|
79
79
|
import {
|
|
80
80
|
MESSAGE_FTS_SESSION_FILTER_SQL,
|
|
81
81
|
withMessageFtsSessionFilter
|
|
82
82
|
} from "./index-52x68mj4.js";
|
|
83
83
|
import {
|
|
84
84
|
isRecord
|
|
85
|
-
} from "./index-
|
|
85
|
+
} from "./index-xr1t0fxb.js";
|
|
86
86
|
import {
|
|
87
87
|
resolveWorkspaceShareCategories,
|
|
88
88
|
resolveWorkspaceIdentitySet,
|
|
89
89
|
expandWorkspaceIdentitySetWithAliases,
|
|
90
90
|
resolveStoredPathWorkspaceIdentity,
|
|
91
91
|
sourceNameForMemory
|
|
92
|
-
} from "./index-
|
|
92
|
+
} from "./index-jba6ny4m.js";
|
|
93
93
|
import {
|
|
94
94
|
getNotes,
|
|
95
95
|
getActivePrimers
|
|
96
|
-
} from "./index-
|
|
96
|
+
} from "./index-mjy2k9jr.js";
|
|
97
97
|
import {
|
|
98
98
|
isKnownAutocommit
|
|
99
99
|
} from "./index-8ajstryz.js";
|
|
@@ -65,7 +65,7 @@ import {
|
|
|
65
65
|
hasPendingMigrations,
|
|
66
66
|
getMainThreadMigrationBodyCount,
|
|
67
67
|
runMigrations
|
|
68
|
-
} from "./index-
|
|
68
|
+
} from "./index-jba6ny4m.js";
|
|
69
69
|
import {
|
|
70
70
|
installTagIdentityRevisionTrigger,
|
|
71
71
|
ensureColumn,
|
|
@@ -1084,7 +1084,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1084
1084
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1085
1085
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1086
1086
|
return;
|
|
1087
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1087
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-zkzdc0e5.js"));
|
|
1088
1088
|
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-pz5981mf.js"));
|
|
1089
1089
|
if (signal.aborted)
|
|
1090
1090
|
return;
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
getCompartments,
|
|
10
10
|
getLastCompartmentEndMessage,
|
|
11
11
|
requestPendingMaterialization
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-yqha238s.js";
|
|
13
13
|
import {
|
|
14
14
|
inRootAsyncContext2
|
|
15
15
|
} from "./index-gzy5w8ya.js";
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
releaseWrapupInProgress,
|
|
21
21
|
getHistorianFailureState,
|
|
22
22
|
clearEmergencyRecovery
|
|
23
|
-
} from "./index-
|
|
23
|
+
} from "./index-xr1t0fxb.js";
|
|
24
24
|
import {
|
|
25
25
|
prepareRawSessionOrdinals2
|
|
26
|
-
} from "./index-
|
|
26
|
+
} from "./index-dr6bd4c8.js";
|
|
27
27
|
import {
|
|
28
28
|
pushNotification2
|
|
29
29
|
} from "./index-y14pawe1.js";
|
|
@@ -35,14 +35,14 @@ import {
|
|
|
35
35
|
getActiveCompartmentRun,
|
|
36
36
|
markActiveCompartmentRunPublished,
|
|
37
37
|
registerActiveCompartmentRun
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-za1yx1m4.js";
|
|
39
39
|
import {
|
|
40
40
|
sendStatusNotification2
|
|
41
|
-
} from "./index-
|
|
41
|
+
} from "./index-9ffntwyr.js";
|
|
42
42
|
import {
|
|
43
43
|
setRecompStarting2,
|
|
44
44
|
setRecompTerminal2
|
|
45
|
-
} from "./index-
|
|
45
|
+
} from "./index-1kem0xxx.js";
|
|
46
46
|
|
|
47
47
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
48
48
|
import * as crypto from "node:crypto";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
DEFAULT_LOCAL_EMBEDDING_MODEL
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-y915t3ey.js";
|
|
4
4
|
import {
|
|
5
5
|
getSynapseLaneIdentity
|
|
6
6
|
} from "./index-6r99v53h.js";
|
|
@@ -795,6 +795,11 @@ async function prepareNativeOnnxTelemetry() {
|
|
|
795
795
|
}
|
|
796
796
|
|
|
797
797
|
// src/features/magic-context/memory/embedding-worker-client.ts
|
|
798
|
+
class EmbeddingRequestAbortedError extends Error {
|
|
799
|
+
constructor() {
|
|
800
|
+
super("embedding request aborted");
|
|
801
|
+
}
|
|
802
|
+
}
|
|
798
803
|
var warnedWindowsTelemetry = false;
|
|
799
804
|
var EMBEDDING_WORKER_STOP_GRACE_MS = 5000;
|
|
800
805
|
var EMBEDDING_WORKER_FORCED_EXIT_WAIT_MS = 2000;
|
|
@@ -968,7 +973,7 @@ class EmbeddingWorkerClient {
|
|
|
968
973
|
}
|
|
969
974
|
async request(texts, signal) {
|
|
970
975
|
if (signal?.aborted)
|
|
971
|
-
|
|
976
|
+
throw new EmbeddingRequestAbortedError;
|
|
972
977
|
this.activeRequests++;
|
|
973
978
|
this.clearIdleTimer();
|
|
974
979
|
try {
|
|
@@ -998,7 +1003,7 @@ class EmbeddingWorkerClient {
|
|
|
998
1003
|
if (this.disposed)
|
|
999
1004
|
throw new Error("embedding worker disposed");
|
|
1000
1005
|
if (signal?.aborted)
|
|
1001
|
-
throw new
|
|
1006
|
+
throw new EmbeddingRequestAbortedError;
|
|
1002
1007
|
return new Promise((resolve, reject) => {
|
|
1003
1008
|
const id = this.nextId++;
|
|
1004
1009
|
const timer = setTimeout(() => {
|
|
@@ -1008,7 +1013,7 @@ class EmbeddingWorkerClient {
|
|
|
1008
1013
|
clearTimeout(timer);
|
|
1009
1014
|
this.pending.delete(id);
|
|
1010
1015
|
signal?.removeEventListener("abort", abort);
|
|
1011
|
-
reject(new
|
|
1016
|
+
reject(new EmbeddingRequestAbortedError);
|
|
1012
1017
|
if (this.pending.size === 0) {
|
|
1013
1018
|
worker.unref();
|
|
1014
1019
|
if (!(worker instanceof Worker))
|
|
@@ -1729,7 +1734,9 @@ class LocalEmbeddingProvider {
|
|
|
1729
1734
|
this.recordWorkerReply(reply);
|
|
1730
1735
|
return reply.vectors ?? texts.map(() => null);
|
|
1731
1736
|
} catch (error) {
|
|
1732
|
-
|
|
1737
|
+
if (!(signal?.aborted && error instanceof EmbeddingRequestAbortedError)) {
|
|
1738
|
+
this.recordWorkerFailure(error);
|
|
1739
|
+
}
|
|
1733
1740
|
return texts.map(() => null);
|
|
1734
1741
|
}
|
|
1735
1742
|
}
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./index-wh9fxds5.js";
|
|
4
4
|
import {
|
|
5
5
|
RAW_MESSAGE_TYPES2
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-01h7tqe3.js";
|
|
7
7
|
import {
|
|
8
8
|
markHostUnservedRow
|
|
9
9
|
} from "./index-s9x93tfs.js";
|
|
@@ -166,6 +166,8 @@ function hostMediaFromEncoded(value) {
|
|
|
166
166
|
return "bytes media has no JSON codec payload";
|
|
167
167
|
encoded.source.data = new Uint8Array(Buffer.from(encoded.source.data, "base64"));
|
|
168
168
|
}
|
|
169
|
+
if (encoded.source.type === "base64" && typeof encoded.source.data !== "string")
|
|
170
|
+
return "base64 media has no payload";
|
|
169
171
|
if (!["bytes", "base64", "url", "ref"].includes(String(encoded.source.type)))
|
|
170
172
|
return "unknown Media.Asset source";
|
|
171
173
|
let first = "no Media.Asset seen in this process";
|
|
@@ -190,13 +192,80 @@ function hostMediaFromEncoded(value) {
|
|
|
190
192
|
|
|
191
193
|
// src/v2/fold/restore.ts
|
|
192
194
|
var HOST_RESTORE_MEDIA = { asset: hostMediaAsset, unavailable: () => {} };
|
|
195
|
+
function readerRestoreMedia(reader, unavailable = () => {}) {
|
|
196
|
+
return { asset: hostMediaAsset, unavailable, blob: (hash) => reader.mediaBlob(hash) };
|
|
197
|
+
}
|
|
193
198
|
function unavailableAttachmentNote(name, mediaType) {
|
|
194
199
|
return `[Attachment ${name ? `"${name}" ` : ""}(${mediaType}) is not available in this restored history]`;
|
|
195
200
|
}
|
|
201
|
+
function hostMissingMediaText(mediaType, name) {
|
|
202
|
+
return `[media unavailable: ${name === undefined ? mediaType : `${name} (${mediaType})`}]`;
|
|
203
|
+
}
|
|
204
|
+
var BLOB_HASH = /^[0-9a-f]{64}$/;
|
|
205
|
+
function readBlob(uri, media) {
|
|
206
|
+
const hash = uri.slice("media:".length);
|
|
207
|
+
if (!BLOB_HASH.test(hash))
|
|
208
|
+
return { kind: "unavailable", reason: "malformed media blob reference" };
|
|
209
|
+
if (!media.blob)
|
|
210
|
+
return { kind: "unavailable", reason: "payload is stored in the host's media blob table" };
|
|
211
|
+
const data = media.blob(hash);
|
|
212
|
+
if (data === undefined)
|
|
213
|
+
return { kind: "unavailable", reason: "the host's store has no media blob table" };
|
|
214
|
+
return data === null ? { kind: "missing" } : { kind: "found", data };
|
|
215
|
+
}
|
|
216
|
+
function withPayload(file, media) {
|
|
217
|
+
if (typeof file.data === "string")
|
|
218
|
+
return { kind: "payload", file };
|
|
219
|
+
if (!file.uri?.startsWith("media:"))
|
|
220
|
+
return { kind: "unavailable", reason: "attachment has no payload" };
|
|
221
|
+
const read = readBlob(file.uri, media);
|
|
222
|
+
if (read.kind === "unavailable")
|
|
223
|
+
return read;
|
|
224
|
+
const { uri: _uri, ...inline } = file;
|
|
225
|
+
if (read.kind === "found")
|
|
226
|
+
return { kind: "payload", file: { ...inline, data: read.data } };
|
|
227
|
+
return {
|
|
228
|
+
kind: "payload",
|
|
229
|
+
file: {
|
|
230
|
+
...inline,
|
|
231
|
+
data: Buffer.from(hostMissingMediaText(file.mime, file.name)).toString("base64"),
|
|
232
|
+
mime: "text/plain"
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
}
|
|
236
|
+
var isBlobFile = (entry) => typeof entry === "object" && entry !== null && entry.type === "file" && typeof entry.uri === "string" && entry.uri.startsWith("media:");
|
|
237
|
+
function toolContentWithPayloads(content, rowID, media) {
|
|
238
|
+
if (!Array.isArray(content) || !content.some(isBlobFile))
|
|
239
|
+
return content;
|
|
240
|
+
return content.map((entry) => {
|
|
241
|
+
if (!isBlobFile(entry))
|
|
242
|
+
return entry;
|
|
243
|
+
const mime = String(entry.mime);
|
|
244
|
+
const name = typeof entry.name === "string" ? entry.name : undefined;
|
|
245
|
+
const read = readBlob(entry.uri, media);
|
|
246
|
+
if (read.kind === "missing")
|
|
247
|
+
return { type: "text", text: hostMissingMediaText(mime, name) };
|
|
248
|
+
if (read.kind === "found")
|
|
249
|
+
return { ...entry, uri: `data:${mime};base64,${read.data}` };
|
|
250
|
+
media.unavailable({ rowID, name, mediaType: mime, reason: read.reason });
|
|
251
|
+
return { type: "text", text: unavailableAttachmentNote(name, mime) };
|
|
252
|
+
});
|
|
253
|
+
}
|
|
196
254
|
var imageMimes = new Set(["image/png", "image/jpeg", "image/gif", "image/webp"]);
|
|
197
255
|
function attachmentParts(files, rowID, media) {
|
|
198
256
|
const seen = new Map;
|
|
199
|
-
return files.flatMap((
|
|
257
|
+
return files.flatMap((stored) => {
|
|
258
|
+
const result = withPayload(stored, media);
|
|
259
|
+
if (result.kind === "unavailable") {
|
|
260
|
+
media.unavailable({
|
|
261
|
+
rowID,
|
|
262
|
+
name: stored.name,
|
|
263
|
+
mediaType: stored.mime,
|
|
264
|
+
reason: result.reason
|
|
265
|
+
});
|
|
266
|
+
return [{ type: "text", text: unavailableAttachmentNote(stored.name, stored.mime) }];
|
|
267
|
+
}
|
|
268
|
+
const file = result.file;
|
|
200
269
|
if (imageMimes.has(file.mime) && file.source.type === "inline" && file.mention?.text) {
|
|
201
270
|
const key = JSON.stringify([
|
|
202
271
|
file.mime,
|
|
@@ -205,9 +274,10 @@ function attachmentParts(files, rowID, media) {
|
|
|
205
274
|
file.mention.text
|
|
206
275
|
]);
|
|
207
276
|
const payloads = seen.get(key) ?? new Set;
|
|
208
|
-
|
|
277
|
+
const payload = typeof stored.data === "string" ? stored.data : String(stored.uri);
|
|
278
|
+
if (payloads.has(payload))
|
|
209
279
|
return [];
|
|
210
|
-
payloads.add(
|
|
280
|
+
payloads.add(payload);
|
|
211
281
|
seen.set(key, payloads);
|
|
212
282
|
}
|
|
213
283
|
const uri = file.source.type === "uri" ? file.source.uri : undefined;
|
|
@@ -360,7 +430,7 @@ ${data.output?.output ?? ""}`
|
|
|
360
430
|
});
|
|
361
431
|
if (!completed)
|
|
362
432
|
continue;
|
|
363
|
-
const toolContent = state.content ?? [];
|
|
433
|
+
const toolContent = toolContentWithPayloads(state.content ?? [], row.id, media);
|
|
364
434
|
const single = toolContent.length === 1 ? toolContent[0] : undefined;
|
|
365
435
|
const result = {
|
|
366
436
|
type: "tool-result",
|
|
@@ -688,4 +758,4 @@ function createV2RawMessageProvider2(reader, sessionID) {
|
|
|
688
758
|
};
|
|
689
759
|
}
|
|
690
760
|
|
|
691
|
-
export { STORAGE_NOTICE_PREFIX, formatStorageRefusalNotice, formatStorageRecoveryNotice, isCopiedStorageNotice, hasStorageNoticeShape, dropStorageNotices, storageNoticeHasNewInput, rememberHostMedia, hostMediaAsset, hostMediaFromEncoded,
|
|
761
|
+
export { STORAGE_NOTICE_PREFIX, formatStorageRefusalNotice, formatStorageRecoveryNotice, isCopiedStorageNotice, hasStorageNoticeShape, dropStorageNotices, storageNoticeHasNewInput, rememberHostMedia, hostMediaAsset, hostMediaFromEncoded, readerRestoreMedia, restoreRow, isToolError, toolErrorText, toolStateContent, rawMessagePage2, readV2MessageRange2, iterateV2MessageRange2, servedBoundaryRow2, resolveV2BoundaryUserMessage2, readAllV2RawMessagesForConversion2, readV2RawMessagePagesForConversion2, createV2RawMessageReader2, createV2RawMessageProvider2 };
|