@cortexkit/opencode-magic-context 0.49.7 → 0.49.8
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 +6 -6
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/{compaction-marker-candidates-a0edbqrr.js → compaction-marker-candidates-xxz35vwp.js} +3 -3
- package/dist/{conflict-warning-hook-myk5hbt9.js → conflict-warning-hook-w3crzrar.js} +8 -8
- package/dist/{context-ffr7e0g7.js → context-x0ccfv0f.js} +65 -42
- package/dist/{derive-budgets-j4ry8j8n.js → derive-budgets-3nbxsyss.js} +2 -2
- package/dist/embedding-backfill-3h2m5n0q.js +21 -0
- package/dist/embedding-worker-process.js +6 -2
- package/dist/embedding-worker.js +6 -5
- package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/cron.d.ts +2 -0
- package/dist/features/magic-context/dreamer/cron.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts +1 -0
- package/dist/features/magic-context/dreamer/provider-output-failure.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-local.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/migration-worker-client.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/smart-notes/wake-plane.d.ts.map +1 -1
- package/dist/features/magic-context/transform-decision-log.d.ts.map +1 -1
- package/dist/history-owner-ty29fz0f.js +244 -0
- package/dist/hooks/auto-update-checker/checker.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-recomp.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/edit-marker.d.ts +2 -0
- package/dist/hooks/magic-context/edit-marker.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/module-transport.d.ts +1 -0
- package/dist/hooks/magic-context/module-transport.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +8 -4
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +1 -0
- package/dist/hooks/magic-context/rust-mode-transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-refusal-recovery.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/unresolved-history-boundary.d.ts +5 -1
- package/dist/hooks/magic-context/unresolved-history-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-g8qbdb03.js → index-0jz47061.js} +6 -3
- package/dist/{index-4mjhqadz.js → index-150zz6fh.js} +1 -1
- package/dist/{index-j58gqrn2.js → index-2rw244rh.js} +31 -24
- package/dist/{index-0gyq3djm.js → index-4hb8nt93.js} +3 -3
- package/dist/{index-ax2jhztn.js → index-7bjgyaj1.js} +4 -4
- package/dist/{index-h2wc01qk.js → index-8kk7yh6m.js} +2 -2
- package/dist/{index-n5a170gs.js → index-9g1c4bt9.js} +81 -58
- package/dist/{index-w6bd03dc.js → index-a43xq1pg.js} +5 -5
- package/dist/{index-tqf7yg27.js → index-a4b0gbyg.js} +1 -1
- package/dist/{index-37q80veb.js → index-angx1s0k.js} +4 -3
- package/dist/{index-wq16ahsn.js → index-b4gcb3rk.js} +8 -8
- package/dist/{index-z1tjp257.js → index-b64n4d0h.js} +1 -1
- package/dist/{index-1bt88epp.js → index-bd9cjab3.js} +1 -1
- package/dist/{index-gbmqa9x9.js → index-bmwfzz28.js} +9 -6
- package/dist/{index-qx53vezw.js → index-gjvjh960.js} +1 -1
- package/dist/{index-ebnngykq.js → index-gzg9ekc1.js} +19 -18
- package/dist/{index-5tbvdff4.js → index-hxrvx6cy.js} +79 -40
- package/dist/{index-w23dh319.js → index-jw4gbfkv.js} +1 -1
- package/dist/index-knvkbfvh.js +25 -0
- package/dist/{index-vkbqdnkj.js → index-kvw6xew3.js} +6 -3
- package/dist/{index-rzmjkdd6.js → index-mp2kghkv.js} +3 -27
- package/dist/{index-nsjyysj0.js → index-mvvephtj.js} +5 -1
- package/dist/{index-9yyqq3mm.js → index-n78avt2p.js} +1 -1
- package/dist/{index-vt4sf4ep.js → index-pgy3h49n.js} +4 -4
- package/dist/{index-w6vr754t.js → index-pjgzdezw.js} +13 -9
- package/dist/{v2/server-1rfgbjfn.js → index-q28hsbpg.js} +15 -3
- package/dist/{index-a8acx4gc.js → index-q76br5zn.js} +3 -3
- package/dist/{index-j5hce1ab.js → index-qgp5vnt4.js} +5 -5
- package/dist/{index-sf94at64.js → index-rg1cezmj.js} +22 -22
- package/dist/{index-sh91t19a.js → index-s178h9z8.js} +4 -3
- package/dist/{index-tagss15p.js → index-w1ejb9qr.js} +105 -58
- package/dist/{index-k6xvbj2e.js → index-w28y7d0z.js} +2 -0
- package/dist/{index-j8epsc0g.js → index-wafzvyhg.js} +33 -10
- package/dist/{index-rwmpkss5.js → index-xf6k8szp.js} +4 -4
- package/dist/{index-tmtty2x5.js → index-xpn05jxq.js} +4 -4
- package/dist/{index-n7kwfw2r.js → index-ydjgz36f.js} +7 -7
- package/dist/{index-4btknbqh.js → index-zf9nydbd.js} +48 -38
- package/dist/index.js +51 -50
- package/dist/{logger-ewak5q1s.js → logger-wn328tfg.js} +1 -1
- package/dist/{message-index-bounded-04rycpx4.js → message-index-bounded-hxjp56qk.js} +16 -16
- package/dist/{message-index-rqtse28y.js → message-index-zs882h8e.js} +16 -16
- package/dist/{message-time-backfill-a5ytnp53.js → message-time-backfill-nb5hhnrt.js} +3 -3
- package/dist/migration-worker.js +11 -11
- package/dist/plugin/boot-quiet.d.ts.map +1 -1
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/rpc-handlers.d.ts +2 -0
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{project-embedding-registry-k0sd9k7v.js → project-embedding-registry-vy7sv9jt.js} +11 -11
- package/dist/raw-ordinal-warmup-worker.js +6 -6
- package/dist/{read-session-chunk-h1btx938.js → read-session-chunk-t9r7r0sg.js} +11 -11
- package/dist/{read-session-raw-vdf4wh78.js → read-session-raw-gm6xj30v.js} +3 -3
- package/dist/recomp-orchestrator-gr36zvd2.js +60 -0
- package/dist/{safe-notification-target-q0cyrx3x.js → safe-notification-target-jdynm677.js} +2 -2
- package/dist/{search-3rbdx6hw.js → search-qjen1pmz.js} +24 -24
- package/dist/{send-session-notification-2tp44tfa.js → send-session-notification-q8ngbap3.js} +6 -6
- package/dist/shared/history-owner.d.ts +12 -0
- package/dist/shared/history-owner.d.ts.map +1 -0
- package/dist/shared/off-thread-migration-clock.d.ts +8 -1
- package/dist/shared/off-thread-migration-clock.d.ts.map +1 -1
- package/dist/shared/redaction.d.ts.map +1 -1
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/sqlite.d.ts +2 -0
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +2 -2
- package/dist/{sqlite-j3tvg8r0.js → sqlite-4pqyynrs.js} +3 -1
- package/dist/{storage-memory-8168bgef.js → storage-memory-j3v3hc83.js} +2 -2
- package/dist/{storage-tags-61z5j2f9.js → storage-tags-a513rkj3.js} +5 -5
- package/dist/{transform-postprocess-phase-7qts7h54.js → transform-postprocess-phase-yv463b7y.js} +30 -30
- package/dist/v2/auto-search-worker.js +6 -6
- package/dist/v2/{compaction-marker-candidates-6nypjkpf.js → compaction-marker-candidates-a15w3mqh.js} +3 -3
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/{context-xq4rtywr.js → context-wd82v9z6.js} +137 -68
- package/dist/v2/{derive-budgets-enckmg7y.js → derive-budgets-0rmpmxjw.js} +3 -3
- package/dist/v2/embedding-backfill-vr7wdtrf.js +20 -0
- package/dist/v2/embedding-worker-process.js +6 -2
- package/dist/v2/embedding-worker.js +6 -5
- package/dist/v2/hidden-completion.d.ts.map +1 -1
- package/dist/v2/history-owner-2cr9py37.js +243 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts +1 -0
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/{logger-pj02s7sr.js → logger-te6e1j72.js} +1 -1
- package/dist/v2/{message-index-bounded-5vh1h2g7.js → message-index-bounded-madg2kfr.js} +16 -16
- package/dist/v2/{message-index-8e5z2xx8.js → message-index-yd94vt9n.js} +16 -16
- package/dist/v2/{message-time-backfill-2z365239.js → message-time-backfill-rz1pnpaj.js} +3 -3
- package/dist/v2/migration-worker.js +11 -11
- package/dist/v2/{project-embedding-registry-b77awytr.js → project-embedding-registry-ja23aygk.js} +11 -11
- package/dist/v2/raw-ordinal-warmup-worker.js +6 -6
- package/dist/v2/{read-session-chunk-4sat83cx.js → read-session-chunk-7qs791f3.js} +11 -11
- package/dist/v2/{read-session-raw-a3hw9jsp.js → read-session-raw-h4azh85b.js} +3 -3
- package/dist/v2/recomp-orchestrator-ee91r9s6.js +59 -0
- package/dist/v2/{safe-notification-target-y3p1hce9.js → safe-notification-target-936374xx.js} +2 -2
- package/dist/v2/search-pn15rr52.js +46 -0
- package/dist/v2/{send-session-notification-ppgc8qdz.js → send-session-notification-6n7chhyp.js} +6 -6
- package/dist/v2/{server-v4fwha43.js → server-08k4zkfk.js} +48 -38
- package/dist/v2/{server-ras2sxnc.js → server-44ryn9rb.js} +9 -6
- package/dist/v2/{server-fw31krgq.js → server-4easnf78.js} +19 -19
- package/dist/v2/{server-hcvcxzx7.js → server-4gz0xkrc.js} +5 -5
- package/dist/v2/{server-d6g4whc2.js → server-4qr18rfg.js} +3 -3
- package/dist/v2/{server-sy4b1sra.js → server-4rs8sm06.js} +5 -5
- package/dist/v2/{server-brhj8qtd.js → server-63ha7f0f.js} +3 -27
- package/dist/v2/{server-3t0q2cqx.js → server-7dv9wt9r.js} +1 -1
- package/dist/v2/{server-cw6521wn.js → server-7e087rvk.js} +2 -0
- package/dist/v2/{server-hb6xhh9q.js → server-988cqjme.js} +6 -3
- package/dist/v2/{server-fpqe39as.js → server-9a6bwc12.js} +4 -4
- package/dist/v2/{server-t4k4qexw.js → server-9e5r8y60.js} +5 -1
- package/dist/v2/{server-7ekna9zs.js → server-adfte03x.js} +2 -2
- package/dist/v2/{server-qcw43339.js → server-ak7w74j9.js} +4 -4
- package/dist/v2/{server-dd0nja67.js → server-bx59ezg6.js} +4 -3
- package/dist/v2/{server-676xw7at.js → server-ckrb5rm8.js} +1 -1
- package/dist/{index-w4mw92w3.js → v2/server-cxsr0ng6.js} +15 -3
- package/dist/v2/{server-t528t8qm.js → server-hn9fb3v0.js} +2 -2
- package/dist/v2/{server-7srtwsa4.js → server-j3dm74ey.js} +9 -9
- package/dist/v2/{server-w3zeywp1.js → server-jjsf29aq.js} +4 -4
- package/dist/v2/server-knvkbfvh.js +25 -0
- package/dist/v2/{server-9yyqq3mm.js → server-n78avt2p.js} +1 -1
- package/dist/v2/{server-kdrezdy0.js → server-njnx39q2.js} +6 -3
- package/dist/v2/{server-x08d1xf3.js → server-npm52h2q.js} +4 -3
- package/dist/v2/{server-vb7pbd9p.js → server-nveratm5.js} +1 -1
- package/dist/v2/{server-mv1w7t6z.js → server-q360kdb8.js} +77 -38
- package/dist/v2/{server-kzns2hbz.js → server-s6jqh8bj.js} +1 -1
- package/dist/v2/{server-6byqfbqf.js → server-shme41gj.js} +1 -1
- package/dist/v2/{server-j8epsc0g.js → server-wafzvyhg.js} +33 -10
- package/dist/v2/{server-gtv9wbhq.js → server-xj4mewze.js} +81 -58
- package/dist/v2/{server-nfan6zb6.js → server-y5g32dhq.js} +31 -24
- package/dist/v2/{server-jdwd03ep.js → server-yak3sxya.js} +7 -7
- package/dist/v2/{server-wkdgjjch.js → server-zrwaj29a.js} +2 -2
- package/dist/v2/server.js +7 -6
- package/dist/v2/{sqlite-j3tvg8r0.js → sqlite-4pqyynrs.js} +3 -1
- package/dist/v2/{storage-memory-8168bgef.js → storage-memory-j3v3hc83.js} +2 -2
- package/dist/v2/{storage-tags-j2fzq3sw.js → storage-tags-spa92sgj.js} +5 -5
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-s92ebfzv.js → wrapup-orchestrator-5wxy1ggv.js} +38 -35
- package/dist/wrapup-orchestrator-gv08c6f9.js +47 -0
- package/package.json +1 -1
- package/src/config/compaction-accessor-guard.test.ts +3 -0
- package/src/features/magic-context/dreamer/cron.ts +8 -0
- package/src/shared/history-owner.test.ts +60 -0
- package/src/shared/history-owner.ts +43 -0
- package/src/shared/host-stall-profiler-node.ts +3 -1
- package/src/shared/host-stall-profiler.ts +3 -1
- package/src/shared/off-thread-migration-clock.test.ts +80 -10
- package/src/shared/off-thread-migration-clock.ts +37 -13
- package/src/shared/redaction.test.ts +16 -0
- package/src/shared/redaction.ts +8 -1
- package/src/shared/root-async-context.probe.mjs +36 -0
- package/src/shared/root-async-context.test.ts +49 -0
- package/src/shared/rpc-server.ts +27 -23
- package/src/shared/sqlite-busy-budget-review.test.ts +291 -0
- package/src/shared/sqlite-foreground-wait.test.ts +253 -1
- package/src/shared/sqlite.ts +55 -14
- package/src/shared/user-facing-codes.ts +2 -2
- package/dist/embedding-backfill-re16xncd.js +0 -21
- package/dist/recomp-orchestrator-trcgmm23.js +0 -60
- package/dist/v2/embedding-backfill-xd9ygzgd.js +0 -20
- package/dist/v2/recomp-orchestrator-n11zv1f1.js +0 -59
- package/dist/v2/search-mvgqtkkz.js +0 -46
- package/dist/wrapup-orchestrator-df61jmz9.js +0 -47
|
@@ -15,7 +15,7 @@ import {
|
|
|
15
15
|
log2,
|
|
16
16
|
sessionLog2,
|
|
17
17
|
getLoggerDiagnostics2
|
|
18
|
-
} from "./index-
|
|
18
|
+
} from "./index-mvvephtj.js";
|
|
19
19
|
import {
|
|
20
20
|
resolveOpenCodeDbPath,
|
|
21
21
|
assertOpenCodeStoreGeneration,
|
|
@@ -28,6 +28,7 @@ import {
|
|
|
28
28
|
claimOpenCodeDbDiagnosticOnce
|
|
29
29
|
} from "./index-58e3y90n.js";
|
|
30
30
|
import {
|
|
31
|
+
inRootAsyncContext2,
|
|
31
32
|
Database2,
|
|
32
33
|
getSqliteDatabasePath2,
|
|
33
34
|
getSqliteMemoryStats2,
|
|
@@ -38,7 +39,7 @@ import {
|
|
|
38
39
|
SqliteAcquisitionBusyError2,
|
|
39
40
|
withAsyncPrivilegedWriter2,
|
|
40
41
|
indexCoordinationInput2
|
|
41
|
-
} from "./index-
|
|
42
|
+
} from "./index-wafzvyhg.js";
|
|
42
43
|
import {
|
|
43
44
|
shouldSkipHomeProjectMemory,
|
|
44
45
|
ProjectIdentityError,
|
|
@@ -53,7 +54,7 @@ import {
|
|
|
53
54
|
storedPathBelongsToIdentity,
|
|
54
55
|
beginBootQuietPeriod,
|
|
55
56
|
scheduleAfterBootQuiet
|
|
56
|
-
} from "./index-
|
|
57
|
+
} from "./index-0jz47061.js";
|
|
57
58
|
import {
|
|
58
59
|
recordSessionProjectIdentity,
|
|
59
60
|
hasRecordedSessionProjectIdentity,
|
|
@@ -80,7 +81,7 @@ import {
|
|
|
80
81
|
drainCommitBacklogForProject2,
|
|
81
82
|
embedSessionCompartmentChunks2,
|
|
82
83
|
getEmbeddingCoverageStatus2
|
|
83
|
-
} from "./index-
|
|
84
|
+
} from "./index-rg1cezmj.js";
|
|
84
85
|
import {
|
|
85
86
|
hasTrustedAbsoluteWall,
|
|
86
87
|
applyProvenInputFloor,
|
|
@@ -92,7 +93,7 @@ import {
|
|
|
92
93
|
deriveTriggerBudget2,
|
|
93
94
|
resolveKnownHistorianContextLimit2,
|
|
94
95
|
resolveHistorianProducerLimits2
|
|
95
|
-
} from "./index-
|
|
96
|
+
} from "./index-jw4gbfkv.js";
|
|
96
97
|
import {
|
|
97
98
|
resolveModelCalibration,
|
|
98
99
|
calibrateBuckets,
|
|
@@ -106,7 +107,7 @@ import {
|
|
|
106
107
|
estimateTokens,
|
|
107
108
|
estimateFixedPromptTokens,
|
|
108
109
|
normalizeText
|
|
109
|
-
} from "./index-
|
|
110
|
+
} from "./index-gjvjh960.js";
|
|
110
111
|
import {
|
|
111
112
|
protectedToolTokenCount,
|
|
112
113
|
peelLeadingMcTagNotation,
|
|
@@ -143,11 +144,11 @@ import {
|
|
|
143
144
|
getDroppedTagsByNumbers2,
|
|
144
145
|
getMaxDroppedTagNumber2,
|
|
145
146
|
getTagById2
|
|
146
|
-
} from "./index-
|
|
147
|
+
} from "./index-xpn05jxq.js";
|
|
147
148
|
import {
|
|
148
149
|
observeTemporalDecisions,
|
|
149
150
|
stableStringify
|
|
150
|
-
} from "./index-
|
|
151
|
+
} from "./index-bd9cjab3.js";
|
|
151
152
|
import {
|
|
152
153
|
withContentLanguageDirective,
|
|
153
154
|
parseCron,
|
|
@@ -160,13 +161,13 @@ import {
|
|
|
160
161
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
161
162
|
DEFAULT_LOCAL_EMBEDDING_MODEL,
|
|
162
163
|
DREAM_TASK_PROMOTION_DEFAULTS
|
|
163
|
-
} from "./index-
|
|
164
|
+
} from "./index-w28y7d0z.js";
|
|
164
165
|
import {
|
|
165
166
|
isRawCompactionSummaryInfo2,
|
|
166
167
|
extractInMemoryMessageViews2,
|
|
167
168
|
buildInMemoryTailRawMessages2,
|
|
168
169
|
runSessionWarmupWorker
|
|
169
|
-
} from "./index-
|
|
170
|
+
} from "./index-angx1s0k.js";
|
|
170
171
|
import {
|
|
171
172
|
openCodeDbExists,
|
|
172
173
|
withReadOnlySessionDb,
|
|
@@ -174,7 +175,7 @@ import {
|
|
|
174
175
|
latestPersistedMessageForRecovery,
|
|
175
176
|
latestRealUserTurnIdFromOpenCodeDb,
|
|
176
177
|
findLastAssistantModelFromOpenCodeDb
|
|
177
|
-
} from "./index-
|
|
178
|
+
} from "./index-q76br5zn.js";
|
|
178
179
|
import {
|
|
179
180
|
expandToolPart,
|
|
180
181
|
estimateTrueRawMessageTokens,
|
|
@@ -291,13 +292,14 @@ import {
|
|
|
291
292
|
readRawSessionMessageIdOrdinalsForRange2,
|
|
292
293
|
readRawSessionMessagePartsById2,
|
|
293
294
|
readRawSessionBoundaryEndpoints2,
|
|
295
|
+
hasRawSessionMessageById2,
|
|
294
296
|
readRawSessionMessageById2,
|
|
295
297
|
readSessionChunk2,
|
|
296
298
|
readRawSessionSeedTail2
|
|
297
|
-
} from "./index-
|
|
299
|
+
} from "./index-9g1c4bt9.js";
|
|
298
300
|
import {
|
|
299
301
|
getMeasuredToolDefinitionTokens
|
|
300
|
-
} from "./index-
|
|
302
|
+
} from "./index-8kk7yh6m.js";
|
|
301
303
|
import {
|
|
302
304
|
CANONICAL_DREAM_TASKS,
|
|
303
305
|
DREAM_TASK_CAPABILITIES,
|
|
@@ -325,20 +327,17 @@ import {
|
|
|
325
327
|
runSqliteOptimize,
|
|
326
328
|
openDatabase,
|
|
327
329
|
openCurrentDatabase
|
|
328
|
-
} from "./index-
|
|
330
|
+
} from "./index-zf9nydbd.js";
|
|
329
331
|
import {
|
|
330
332
|
registerOwnRpcServerInstance,
|
|
331
333
|
rpcPortDir,
|
|
332
334
|
rpcPortFilePath,
|
|
333
335
|
parseRpcPortFile,
|
|
334
336
|
inspectProcessesAsync
|
|
335
|
-
} from "./index-
|
|
337
|
+
} from "./index-q28hsbpg.js";
|
|
336
338
|
import {
|
|
337
339
|
configureContextDatabasePragmas2
|
|
338
340
|
} from "./index-fb3zxn06.js";
|
|
339
|
-
import {
|
|
340
|
-
canonicalProjectDirectory
|
|
341
|
-
} from "./index-rzmjkdd6.js";
|
|
342
341
|
import {
|
|
343
342
|
unescapeXml,
|
|
344
343
|
resolveWorkspaceShareCategories,
|
|
@@ -347,7 +346,7 @@ import {
|
|
|
347
346
|
resolveStoredPathWorkspaceIdentity,
|
|
348
347
|
storedPathBelongsToWorkspace,
|
|
349
348
|
computeWorkspaceEpochFingerprint
|
|
350
|
-
} from "./index-
|
|
349
|
+
} from "./index-qgp5vnt4.js";
|
|
351
350
|
import {
|
|
352
351
|
V2_MEMORY_CATEGORIES,
|
|
353
352
|
CATEGORY_PRIORITY
|
|
@@ -521,7 +520,7 @@ import {
|
|
|
521
520
|
snapRangeToCompartments,
|
|
522
521
|
getActiveCompartmentRun,
|
|
523
522
|
startCompartmentAgent
|
|
524
|
-
} from "./index-
|
|
523
|
+
} from "./index-hxrvx6cy.js";
|
|
525
524
|
import {
|
|
526
525
|
SubcClient,
|
|
527
526
|
connectionFileExists,
|
|
@@ -529,7 +528,7 @@ import {
|
|
|
529
528
|
toSynapseLaneDescriptor,
|
|
530
529
|
formatSynapseLaneDescriptor,
|
|
531
530
|
SynapseEmbeddingProvider
|
|
532
|
-
} from "./index-
|
|
531
|
+
} from "./index-kvw6xew3.js";
|
|
533
532
|
import {
|
|
534
533
|
BoundedSessionMap,
|
|
535
534
|
LkgRecoveryFenceError,
|
|
@@ -550,7 +549,7 @@ import {
|
|
|
550
549
|
indexSingleMessage2,
|
|
551
550
|
indexMessagesAfterOrdinal2,
|
|
552
551
|
sweepOrphanedOpenCodeMessageIndexes2
|
|
553
|
-
} from "./index-
|
|
552
|
+
} from "./index-b4gcb3rk.js";
|
|
554
553
|
import {
|
|
555
554
|
renderUserFacingFailure,
|
|
556
555
|
userFacingFailureCode,
|
|
@@ -594,7 +593,7 @@ import {
|
|
|
594
593
|
readGitFileChangeTimesSince,
|
|
595
594
|
verificationFileExists,
|
|
596
595
|
normalizeVerificationFiles
|
|
597
|
-
} from "./index-
|
|
596
|
+
} from "./index-ydjgz36f.js";
|
|
598
597
|
import {
|
|
599
598
|
registerNotificationSink2,
|
|
600
599
|
pushNotification2,
|
|
@@ -604,7 +603,7 @@ import {
|
|
|
604
603
|
} from "./index-x8a7jmkh.js";
|
|
605
604
|
import {
|
|
606
605
|
getLocalEmbeddingNativeMemoryStats
|
|
607
|
-
} from "./index-
|
|
606
|
+
} from "./index-bmwfzz28.js";
|
|
608
607
|
import {
|
|
609
608
|
saveEmbeddingIfHashMatches,
|
|
610
609
|
invalidateProject2,
|
|
@@ -612,7 +611,7 @@ import {
|
|
|
612
611
|
} from "./index-4dhv7mqz.js";
|
|
613
612
|
import {
|
|
614
613
|
cosineSimilarity
|
|
615
|
-
} from "./index-
|
|
614
|
+
} from "./index-a43xq1pg.js";
|
|
616
615
|
import {
|
|
617
616
|
computeCueContentHash,
|
|
618
617
|
hasMuralCueColumns,
|
|
@@ -637,7 +636,7 @@ import {
|
|
|
637
636
|
mergeMemoryStats2,
|
|
638
637
|
archiveMemory2,
|
|
639
638
|
getMemoryCountsByStatus2
|
|
640
|
-
} from "./index-
|
|
639
|
+
} from "./index-n78avt2p.js";
|
|
641
640
|
import {
|
|
642
641
|
renderSingleStoreMigrationRequiredRefusal,
|
|
643
642
|
SingleStoreMigrationRequiredError,
|
|
@@ -659,17 +658,17 @@ import {
|
|
|
659
658
|
resolveMemoriesByIdsForSearch2,
|
|
660
659
|
unifiedSearch2,
|
|
661
660
|
formatSearchResults2
|
|
662
|
-
} from "./index-
|
|
661
|
+
} from "./index-2rw244rh.js";
|
|
663
662
|
import {
|
|
664
663
|
flushIgnoredMessages2,
|
|
665
664
|
clearIgnoredMessages2,
|
|
666
665
|
observeIgnoredNotificationEvent2,
|
|
667
666
|
sendStatusNotification2
|
|
668
|
-
} from "./index-
|
|
667
|
+
} from "./index-pgy3h49n.js";
|
|
669
668
|
import {
|
|
670
669
|
setRecompStarting2,
|
|
671
670
|
setRecompTerminal2
|
|
672
|
-
} from "./index-
|
|
671
|
+
} from "./index-xf6k8szp.js";
|
|
673
672
|
import {
|
|
674
673
|
makeToolCompositeKey,
|
|
675
674
|
searchMessageHistoryOffThread,
|
|
@@ -720,7 +719,7 @@ import {
|
|
|
720
719
|
abortSessionFailClosed2,
|
|
721
720
|
evaluateEmergencyFailClosed2,
|
|
722
721
|
runPostTransformPhase2
|
|
723
|
-
} from "./index-
|
|
722
|
+
} from "./index-gzg9ekc1.js";
|
|
724
723
|
import {
|
|
725
724
|
ANNOUNCEMENT_VERSION2,
|
|
726
725
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -737,6 +736,9 @@ import {
|
|
|
737
736
|
import {
|
|
738
737
|
computeNormalizedHash
|
|
739
738
|
} from "./index-2bvekkfy.js";
|
|
739
|
+
import {
|
|
740
|
+
canonicalProjectDirectory
|
|
741
|
+
} from "./index-knvkbfvh.js";
|
|
740
742
|
import {
|
|
741
743
|
getErrorMessage,
|
|
742
744
|
describeError
|
|
@@ -759,7 +761,7 @@ import {
|
|
|
759
761
|
} from "./index-8ajstryz.js";
|
|
760
762
|
import {
|
|
761
763
|
logSlowWriteTransaction
|
|
762
|
-
} from "./index-
|
|
764
|
+
} from "./index-150zz6fh.js";
|
|
763
765
|
|
|
764
766
|
// src/features/magic-context/dreamer/open-opencode-db.ts
|
|
765
767
|
function openOpenCodeDb() {
|
|
@@ -1524,7 +1526,7 @@ function startLeaseHeartbeat(db, holderId, leaseKey, onLost, intervalOrAcquisiti
|
|
|
1524
1526
|
}
|
|
1525
1527
|
};
|
|
1526
1528
|
beat();
|
|
1527
|
-
const timer = lost ? undefined : setInterval(() => withSqliteBackgroundWriter2(beat), intervalMs);
|
|
1529
|
+
const timer = lost ? undefined : inRootAsyncContext2(() => setInterval(() => withSqliteBackgroundWriter2(beat), intervalMs));
|
|
1528
1530
|
return {
|
|
1529
1531
|
stop: () => {
|
|
1530
1532
|
if (timer)
|
|
@@ -5984,10 +5986,10 @@ async function probeWakePlaneCatalog() {
|
|
|
5984
5986
|
if (!await connectionFileExists(file)) {
|
|
5985
5987
|
throw new Error("subc connection is not configured");
|
|
5986
5988
|
}
|
|
5987
|
-
const client = await SubcClient.connect({
|
|
5989
|
+
const client = await inRootAsyncContext2(() => SubcClient.connect({
|
|
5988
5990
|
connectionFile: file,
|
|
5989
5991
|
handshakeTimeoutMs: WAKE_PLANE_HANDSHAKE_TIMEOUT_MS
|
|
5990
|
-
});
|
|
5992
|
+
}));
|
|
5991
5993
|
try {
|
|
5992
5994
|
return await client.catalogList();
|
|
5993
5995
|
} finally {
|
|
@@ -11120,10 +11122,10 @@ async function sourceReady(source, sessionId) {
|
|
|
11120
11122
|
function defer(fn) {
|
|
11121
11123
|
const immediate = globalThis.setImmediate;
|
|
11122
11124
|
if (typeof immediate === "function") {
|
|
11123
|
-
immediate(fn);
|
|
11125
|
+
inRootAsyncContext2(() => immediate(fn));
|
|
11124
11126
|
return;
|
|
11125
11127
|
}
|
|
11126
|
-
setTimeout(fn, 0);
|
|
11128
|
+
inRootAsyncContext2(() => setTimeout(fn, 0));
|
|
11127
11129
|
}
|
|
11128
11130
|
function yieldToEventLoop() {
|
|
11129
11131
|
return new Promise((resolve) => defer(resolve));
|
|
@@ -11207,14 +11209,14 @@ function scheduleReconciliation(db, sessionId, readMessages) {
|
|
|
11207
11209
|
reconcileSessionIndex(db, sessionId, readMessages).then((ran) => {
|
|
11208
11210
|
if (ran)
|
|
11209
11211
|
return;
|
|
11210
|
-
setTimeout(() => {
|
|
11212
|
+
inRootAsyncContext2(() => setTimeout(() => {
|
|
11211
11213
|
heapHolder.reconciliationScheduledSessions.delete(sessionId);
|
|
11212
11214
|
scheduleReconciliation(db, sessionId, readMessages);
|
|
11213
|
-
}, PREPARE_RETRY_MS).unref?.();
|
|
11215
|
+
}, PREPARE_RETRY_MS)).unref?.();
|
|
11214
11216
|
}).catch((error) => {
|
|
11215
11217
|
logIndexingError(sessionId, "reconciliation", error);
|
|
11216
11218
|
if (isDatabaseLockedError(error))
|
|
11217
|
-
setTimeout(() => scheduleReconciliation(db, sessionId, readMessages), 1000).unref();
|
|
11219
|
+
inRootAsyncContext2(() => setTimeout(() => scheduleReconciliation(db, sessionId, readMessages), 1000)).unref();
|
|
11218
11220
|
}).finally(() => {
|
|
11219
11221
|
heapHolder.reconciliationScheduledSessions.delete(sessionId);
|
|
11220
11222
|
});
|
|
@@ -11229,7 +11231,7 @@ function scheduleIncrementalIndex(db, sessionId, messageId, messageSource) {
|
|
|
11229
11231
|
const activeTimer = heapHolder.incrementalTimers.get(schedulingKey);
|
|
11230
11232
|
if (activeTimer)
|
|
11231
11233
|
clearTimeout(activeTimer);
|
|
11232
|
-
const timer = setTimeout(() => {
|
|
11234
|
+
const timer = inRootAsyncContext2(() => setTimeout(() => {
|
|
11233
11235
|
heapHolder.incrementalTimers.delete(schedulingKey);
|
|
11234
11236
|
heapHolder.pendingIncrementalKeys.add(schedulingKey);
|
|
11235
11237
|
const indexMessage = async () => {
|
|
@@ -11273,7 +11275,7 @@ function scheduleIncrementalIndex(db, sessionId, messageId, messageSource) {
|
|
|
11273
11275
|
if ((sessionEpochs.get(sessionId) ?? 0) === epoch)
|
|
11274
11276
|
heapHolder.pendingIncrementalKeys.delete(schedulingKey);
|
|
11275
11277
|
});
|
|
11276
|
-
}, INCREMENTAL_DEBOUNCE_MS);
|
|
11278
|
+
}, INCREMENTAL_DEBOUNCE_MS));
|
|
11277
11279
|
heapHolder.incrementalTimers.set(schedulingKey, timer);
|
|
11278
11280
|
}
|
|
11279
11281
|
async function indexSingleMessageOffThread(db, sessionId, message) {
|
|
@@ -11490,7 +11492,7 @@ async function startDreamScheduleTimer(args) {
|
|
|
11490
11492
|
startupTickTimer = null;
|
|
11491
11493
|
runTick("startup");
|
|
11492
11494
|
});
|
|
11493
|
-
const timer = setInterval(() => runTick("interval"), DREAM_TIMER_INTERVAL_MS);
|
|
11495
|
+
const timer = inRootAsyncContext2(() => setInterval(() => runTick("interval"), DREAM_TIMER_INTERVAL_MS));
|
|
11494
11496
|
if (typeof timer === "object" && "unref" in timer) {
|
|
11495
11497
|
timer.unref();
|
|
11496
11498
|
}
|
|
@@ -11786,7 +11788,7 @@ async function runCompiledSmartNoteSweep(reg, db) {
|
|
|
11786
11788
|
}
|
|
11787
11789
|
}
|
|
11788
11790
|
function startGitSweepLeaseRenewal(db, projectIdentity, holderId) {
|
|
11789
|
-
const timer = setInterval(() => {
|
|
11791
|
+
const timer = inRootAsyncContext2(() => setInterval(() => {
|
|
11790
11792
|
try {
|
|
11791
11793
|
if (!renewGitSweepLease(db, projectIdentity, holderId)) {
|
|
11792
11794
|
log2(`[git-commits] sweep lease renewal failed for ${projectIdentity}`);
|
|
@@ -11794,7 +11796,7 @@ function startGitSweepLeaseRenewal(db, projectIdentity, holderId) {
|
|
|
11794
11796
|
} catch (error) {
|
|
11795
11797
|
log2(`[git-commits] sweep lease renewal errored for ${projectIdentity}: ${error instanceof Error ? error.message : String(error)}`);
|
|
11796
11798
|
}
|
|
11797
|
-
}, GIT_SWEEP_LEASE_RENEWAL_MS);
|
|
11799
|
+
}, GIT_SWEEP_LEASE_RENEWAL_MS));
|
|
11798
11800
|
timer.unref?.();
|
|
11799
11801
|
return () => clearInterval(timer);
|
|
11800
11802
|
}
|
|
@@ -15835,7 +15837,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
15835
15837
|
const sessionId = String(params.sessionId ?? "");
|
|
15836
15838
|
if (!sessionId)
|
|
15837
15839
|
return { owner: false };
|
|
15838
|
-
const sessionDirectory =
|
|
15840
|
+
const sessionDirectory = args.readSessionDirectory ? await args.readSessionDirectory(sessionId) : await readHostSessionDirectory(args.client, sessionId) ?? liveSessionState.sessionDirectoryBySession.get(sessionId);
|
|
15839
15841
|
if (!sessionDirectory)
|
|
15840
15842
|
return { owner: false };
|
|
15841
15843
|
return {
|
|
@@ -15906,7 +15908,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
15906
15908
|
return { count: buildCompartmentCount(db, sessionId, moduleStatus) };
|
|
15907
15909
|
});
|
|
15908
15910
|
const buildManagedCtx = async (db) => {
|
|
15909
|
-
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-
|
|
15911
|
+
const { deriveHistorianChunkTokens, resolveHistorianContextLimit } = await importPluginModule(() => import("./derive-budgets-3nbxsyss.js"));
|
|
15910
15912
|
const { resolveHistorianModel } = await importPluginModule(() => import("./model-resolution-nx97z3x7.js"));
|
|
15911
15913
|
const { userMemoryCollectionEnabled } = await importPluginModule(() => import("./task-config-cgpg0nvh.js"));
|
|
15912
15914
|
const DEFAULT_HISTORIAN_TIMEOUT_MS = 10 * 60 * 1000;
|
|
@@ -15921,6 +15923,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
15921
15923
|
directory,
|
|
15922
15924
|
historianChunkTokens: deriveHistorianChunkTokens(resolveHistorianContextLimit(historianModel.primary?.model)),
|
|
15923
15925
|
historianTimeoutMs: runConfig.historian_timeout_ms ?? DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
15926
|
+
historianMaxOutputTokens: runConfig.historian?.maxTokens,
|
|
15924
15927
|
memoryEnabled: config.memory?.enabled ?? true,
|
|
15925
15928
|
autoPromote: runConfig.memory?.auto_promote ?? true,
|
|
15926
15929
|
historianModel: historianModel.primary,
|
|
@@ -15935,6 +15938,20 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
15935
15938
|
const sessionId = String(params.sessionId ?? "");
|
|
15936
15939
|
if (!sessionId)
|
|
15937
15940
|
return { ok: false, error: "no session" };
|
|
15941
|
+
const readDirectory = args.readSessionDirectory;
|
|
15942
|
+
if (readDirectory) {
|
|
15943
|
+
const { handoffHistoryWork } = await import("./history-owner-ty29fz0f.js");
|
|
15944
|
+
const handed = await handoffHistoryWork({
|
|
15945
|
+
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
15946
|
+
directory,
|
|
15947
|
+
sessionId,
|
|
15948
|
+
method: "recomp",
|
|
15949
|
+
params,
|
|
15950
|
+
readDirectory: () => readDirectory(sessionId)
|
|
15951
|
+
});
|
|
15952
|
+
if (handed)
|
|
15953
|
+
return handed;
|
|
15954
|
+
}
|
|
15938
15955
|
const dir = String(params.directory ?? directory);
|
|
15939
15956
|
if (config.transform_mode === "rust") {
|
|
15940
15957
|
return executeRustRecompRpc(rustModeModuleClient, sessionId, dir);
|
|
@@ -15942,8 +15959,8 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
15942
15959
|
const db = readDatabase();
|
|
15943
15960
|
if (!db)
|
|
15944
15961
|
return { ok: false, error: "db unavailable" };
|
|
15945
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
15946
|
-
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-
|
|
15962
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-gr36zvd2.js"));
|
|
15963
|
+
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-q8ngbap3.js"));
|
|
15947
15964
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
15948
15965
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
15949
15966
|
return {
|
|
@@ -15999,6 +16016,21 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
15999
16016
|
return { ok: true, message };
|
|
16000
16017
|
});
|
|
16001
16018
|
rpcServer.handle("wrapup", async (params) => {
|
|
16019
|
+
const readDirectory = args.readSessionDirectory;
|
|
16020
|
+
if (readDirectory && params.sessionId) {
|
|
16021
|
+
const { handoffHistoryWork } = await import("./history-owner-ty29fz0f.js");
|
|
16022
|
+
const sessionId = String(params.sessionId);
|
|
16023
|
+
const handed = await handoffHistoryWork({
|
|
16024
|
+
storageDir: args.storageDir ?? getMagicContextStorageDir(),
|
|
16025
|
+
directory,
|
|
16026
|
+
sessionId,
|
|
16027
|
+
method: "wrapup",
|
|
16028
|
+
params,
|
|
16029
|
+
readDirectory: () => readDirectory(sessionId)
|
|
16030
|
+
});
|
|
16031
|
+
if (handed)
|
|
16032
|
+
return handed;
|
|
16033
|
+
}
|
|
16002
16034
|
const sessionId = String(params.sessionId ?? "");
|
|
16003
16035
|
if (!sessionId)
|
|
16004
16036
|
return { ok: false, error: "no session" };
|
|
@@ -16012,7 +16044,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16012
16044
|
const db = readDatabase();
|
|
16013
16045
|
if (!db)
|
|
16014
16046
|
return { ok: false, error: "db unavailable" };
|
|
16015
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16047
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-gv08c6f9.js"));
|
|
16016
16048
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16017
16049
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16018
16050
|
const ctx = {
|
|
@@ -16203,7 +16235,7 @@ function scheduleOpenCodeTransformDecisionWrite(args) {
|
|
|
16203
16235
|
lastBoundMessageIdBySession.set(args.sessionId, args.messageId);
|
|
16204
16236
|
pendingDecisionBySession.delete(args.sessionId);
|
|
16205
16237
|
const token = addScheduledWriteToken(args.sessionId);
|
|
16206
|
-
setTimeout(() => {
|
|
16238
|
+
inRootAsyncContext2(() => setTimeout(() => {
|
|
16207
16239
|
try {
|
|
16208
16240
|
if (!hasScheduledWriteToken(args.sessionId, token))
|
|
16209
16241
|
return;
|
|
@@ -16217,7 +16249,7 @@ function scheduleOpenCodeTransformDecisionWrite(args) {
|
|
|
16217
16249
|
} finally {
|
|
16218
16250
|
deleteScheduledWriteToken(args.sessionId, token);
|
|
16219
16251
|
}
|
|
16220
|
-
}, 0);
|
|
16252
|
+
}, 0));
|
|
16221
16253
|
return true;
|
|
16222
16254
|
}
|
|
16223
16255
|
function addScheduledWriteToken(sessionId) {
|
|
@@ -19927,16 +19959,19 @@ function rustCaptureDigests(inputs, prior, acceptedInputs) {
|
|
|
19927
19959
|
} : undefined);
|
|
19928
19960
|
return { ...incremental, inputContentSignatures };
|
|
19929
19961
|
}
|
|
19962
|
+
var contentSnapshotFieldVisitObserverForTests;
|
|
19930
19963
|
function messageMatchesContentSnapshot(message, snapshot) {
|
|
19931
19964
|
let fieldIndex = 0;
|
|
19932
19965
|
const matched = visitMessageContentFields(contentSnapshotValue(message), {
|
|
19933
19966
|
field(value) {
|
|
19967
|
+
contentSnapshotFieldVisitObserverForTests?.();
|
|
19934
19968
|
if (!Object.is(value, snapshot.fields[fieldIndex]))
|
|
19935
19969
|
return false;
|
|
19936
19970
|
fieldIndex += 1;
|
|
19937
19971
|
return true;
|
|
19938
19972
|
},
|
|
19939
19973
|
beginObject() {
|
|
19974
|
+
contentSnapshotFieldVisitObserverForTests?.();
|
|
19940
19975
|
const expectedCount = snapshot.fields[fieldIndex];
|
|
19941
19976
|
if (typeof expectedCount !== "number")
|
|
19942
19977
|
return;
|
|
@@ -23282,15 +23317,27 @@ class UnmanagedOverWindowError extends Error {
|
|
|
23282
23317
|
}
|
|
23283
23318
|
|
|
23284
23319
|
// src/hooks/magic-context/unresolved-history-boundary.ts
|
|
23320
|
+
function storedHistoryBoundaryPresence(db, sessionId) {
|
|
23321
|
+
try {
|
|
23322
|
+
const row = db.prepare("SELECT cached_m0_last_baseline_end_message_id AS id FROM session_meta WHERE session_id = ?").get(sessionId);
|
|
23323
|
+
return row?.id ? hasRawSessionMessageById2(sessionId, row.id) : undefined;
|
|
23324
|
+
} catch {
|
|
23325
|
+
return;
|
|
23326
|
+
}
|
|
23327
|
+
}
|
|
23328
|
+
|
|
23285
23329
|
class UnresolvedHistoryBoundaryError extends Error {
|
|
23286
23330
|
estimatedTokens;
|
|
23287
23331
|
contextLimitTokens;
|
|
23332
|
+
boundaryPresent;
|
|
23288
23333
|
code = "UNRESOLVED_HISTORY_BOUNDARY";
|
|
23289
23334
|
recoverable = true;
|
|
23290
|
-
constructor(estimatedTokens, contextLimitTokens) {
|
|
23291
|
-
|
|
23335
|
+
constructor(estimatedTokens, contextLimitTokens, boundaryPresent) {
|
|
23336
|
+
const reason = boundaryPresent === true ? "The boundary row is present in the host store but out of order relative to the loaded history. " : boundaryPresent === false ? "The boundary row is missing from the host store. " : "";
|
|
23337
|
+
super(reason + renderUserFacingFailure("history_boundary_unresolved", "plain"));
|
|
23292
23338
|
this.estimatedTokens = estimatedTokens;
|
|
23293
23339
|
this.contextLimitTokens = contextLimitTokens;
|
|
23340
|
+
this.boundaryPresent = boundaryPresent;
|
|
23294
23341
|
this.name = "UnresolvedHistoryBoundaryError";
|
|
23295
23342
|
}
|
|
23296
23343
|
}
|
|
@@ -24456,7 +24503,7 @@ Historian previously failed ${historianFailureState.failureCount} time(s), so Ma
|
|
|
24456
24503
|
});
|
|
24457
24504
|
if (untrimmed.tokens > boundaryContextLimit) {
|
|
24458
24505
|
sessionLog2(sessionId, `history boundary unresolved: prefix trim refused and the untrimmed request estimate ${untrimmed.tokens} (trusted=${untrimmed.trusted}) exceeds the context limit ${boundaryContextLimit}; not sending it`);
|
|
24459
|
-
throw new UnresolvedHistoryBoundaryError(untrimmed.tokens, boundaryContextLimit);
|
|
24506
|
+
throw new UnresolvedHistoryBoundaryError(untrimmed.tokens, boundaryContextLimit, storedHistoryBoundaryPresence(db, sessionId));
|
|
24460
24507
|
}
|
|
24461
24508
|
}
|
|
24462
24509
|
if (unmanagedOverWindowPass) {
|
|
@@ -24854,12 +24901,12 @@ function createRustRefusalRecovery(options) {
|
|
|
24854
24901
|
watchers.delete(sessionId);
|
|
24855
24902
|
};
|
|
24856
24903
|
const schedule = (sessionId, watcher) => {
|
|
24857
|
-
watcher.timer = setTimeout(() => void poll(sessionId, watcher), pollIntervalMs);
|
|
24904
|
+
watcher.timer = inRootAsyncContext2(() => setTimeout(() => void poll(sessionId, watcher), pollIntervalMs));
|
|
24858
24905
|
};
|
|
24859
24906
|
const probe = async (watcher, sessionId) => {
|
|
24860
24907
|
const controller = new AbortController;
|
|
24861
24908
|
const timeoutError = new Error("rust refusal recovery probe timed out");
|
|
24862
|
-
const timer = setTimeout(() => controller.abort(timeoutError), probeTimeoutMs);
|
|
24909
|
+
const timer = inRootAsyncContext2(() => setTimeout(() => controller.abort(timeoutError), probeTimeoutMs));
|
|
24863
24910
|
try {
|
|
24864
24911
|
await Promise.race([
|
|
24865
24912
|
options.moduleClient.call({
|
|
@@ -28264,7 +28311,7 @@ class MagicContextRpcServer {
|
|
|
28264
28311
|
}
|
|
28265
28312
|
this.startedAt = Date.now();
|
|
28266
28313
|
const self = this;
|
|
28267
|
-
const server = Bun.serve({
|
|
28314
|
+
const server = inRootAsyncContext2(() => Bun.serve({
|
|
28268
28315
|
port: 0,
|
|
28269
28316
|
hostname: "127.0.0.1",
|
|
28270
28317
|
fetch(req, srv) {
|
|
@@ -28287,7 +28334,7 @@ class MagicContextRpcServer {
|
|
|
28287
28334
|
self.sockets.delete(ws);
|
|
28288
28335
|
}
|
|
28289
28336
|
}
|
|
28290
|
-
});
|
|
28337
|
+
}));
|
|
28291
28338
|
this.server = server;
|
|
28292
28339
|
this.port = server.port ?? 0;
|
|
28293
28340
|
try {
|
|
@@ -4947,6 +4947,7 @@ var FIELDS = [
|
|
|
4947
4947
|
];
|
|
4948
4948
|
var MINUTE_MS = 60000;
|
|
4949
4949
|
var MAX_SEARCH_MS = 4 * 366 * 24 * 60 * MINUTE_MS;
|
|
4950
|
+
var candidateVisitsForTests;
|
|
4950
4951
|
function parseField(token, spec) {
|
|
4951
4952
|
const values = new Set;
|
|
4952
4953
|
const normalize = (n) => spec.name === "day-of-week" && n === 7 ? 0 : n;
|
|
@@ -5066,6 +5067,7 @@ function nextOccurrence(cron, after, excludeCivilMinute, maxSearchMs = MAX_SEARC
|
|
|
5066
5067
|
let cursorMs = Math.floor(afterMs / MINUTE_MS) * MINUTE_MS + MINUTE_MS;
|
|
5067
5068
|
const capMs = afterMs + Math.max(0, Math.min(MAX_SEARCH_MS, maxSearchMs));
|
|
5068
5069
|
while (cursorMs <= capMs) {
|
|
5070
|
+
candidateVisitsForTests?.();
|
|
5069
5071
|
const candidate = new Date(cursorMs);
|
|
5070
5072
|
if (matchesCron(cron, candidate)) {
|
|
5071
5073
|
if (!excludeCivilMinute || civilMinuteKey(candidate) !== excludeCivilMinute) {
|
|
@@ -1,6 +1,10 @@
|
|
|
1
1
|
// src/shared/sqlite.ts
|
|
2
|
-
import { AsyncLocalStorage } from "node:async_hooks";
|
|
2
|
+
import { AsyncLocalStorage, AsyncResource } from "node:async_hooks";
|
|
3
3
|
import { statSync } from "node:fs";
|
|
4
|
+
var resourceRoot = new AsyncResource("magic-context:root");
|
|
5
|
+
function inRootAsyncContext2(operation) {
|
|
6
|
+
return resourceRoot.runInAsyncScope(operation);
|
|
7
|
+
}
|
|
4
8
|
var reportSlowPrivilegedWrite;
|
|
5
9
|
function registerSlowWriteReporter2(reporter) {
|
|
6
10
|
reportSlowPrivilegedWrite = reporter;
|
|
@@ -191,7 +195,7 @@ function installTransactionRouting(db, readonly) {
|
|
|
191
195
|
return endWriterTransaction(db, () => nativeExec(sql), sql);
|
|
192
196
|
if (!/^\s*(?:SELECT|EXPLAIN|PRAGMA|COMMIT|END|ROLLBACK|SAVEPOINT|RELEASE)\b/i.test(sql)) {
|
|
193
197
|
try {
|
|
194
|
-
return withAutocommitTimeout(db, () => nativeExec(sql));
|
|
198
|
+
return withAutocommitTimeout(db, () => nativeExec(sql), false);
|
|
195
199
|
} finally {
|
|
196
200
|
if (mayChangeTagIdentity(sql))
|
|
197
201
|
tagIdentityWriteGeneration += 1;
|
|
@@ -333,7 +337,7 @@ function trackSqliteConnection(db, filename, options) {
|
|
|
333
337
|
}
|
|
334
338
|
var TrackedDatabase = new Proxy(DatabaseImpl, {
|
|
335
339
|
construct(target, args) {
|
|
336
|
-
const db = Reflect.construct(target, args, target);
|
|
340
|
+
const db = inRootAsyncContext2(() => Reflect.construct(target, args, target));
|
|
337
341
|
return trackSqliteConnection(db, args[0], args[1]);
|
|
338
342
|
}
|
|
339
343
|
});
|
|
@@ -577,29 +581,48 @@ function foregroundWaitLease() {
|
|
|
577
581
|
const lease = transformPassScope.getStore();
|
|
578
582
|
return lease?.active && !admissionScope.getStore() && !backgroundWriterScope.getStore() ? lease : undefined;
|
|
579
583
|
}
|
|
580
|
-
function withAutocommitTimeout(db, operation) {
|
|
584
|
+
function withAutocommitTimeout(db, operation, singleStatement = true) {
|
|
581
585
|
assertTransformWrite2();
|
|
582
586
|
const lease = foregroundWaitLease();
|
|
583
587
|
if (isInTransaction(db))
|
|
584
588
|
return operation();
|
|
585
589
|
const scoped = lease || backgroundWriterScope.getStore();
|
|
586
590
|
const previous = scoped ? pragmaNumber(db, "busy_timeout") : null;
|
|
587
|
-
if (scoped)
|
|
588
|
-
db.exec(`PRAGMA busy_timeout=${lease ? Math.floor(Math.min(lease.remainingWaitMs, lease.guard?.remainingMs() ?? Infinity)) : SHORT_BUSY_TIMEOUT_MS}`);
|
|
589
591
|
const started = performance.now();
|
|
590
592
|
let completed = false;
|
|
591
|
-
|
|
593
|
+
const execute = () => {
|
|
592
594
|
const result = operation();
|
|
593
595
|
completed = true;
|
|
594
596
|
return result;
|
|
597
|
+
};
|
|
598
|
+
try {
|
|
599
|
+
if (!scoped)
|
|
600
|
+
return execute();
|
|
601
|
+
if (singleStatement) {
|
|
602
|
+
db.exec("PRAGMA busy_timeout=0");
|
|
603
|
+
try {
|
|
604
|
+
return execute();
|
|
605
|
+
} catch (error) {
|
|
606
|
+
if (!isTransientSqliteError2(error) || isInTransaction(db))
|
|
607
|
+
throw error;
|
|
608
|
+
}
|
|
609
|
+
assertTransformWrite2();
|
|
610
|
+
}
|
|
611
|
+
const timeout = Math.floor(Math.min(lease?.remainingWaitMs ?? SHORT_BUSY_TIMEOUT_MS, lease?.guard?.remainingMs() ?? Infinity));
|
|
612
|
+
db.exec(`PRAGMA busy_timeout=${timeout}`);
|
|
613
|
+
const waitStarted = performance.now();
|
|
614
|
+
try {
|
|
615
|
+
return execute();
|
|
616
|
+
} finally {
|
|
617
|
+
if (lease)
|
|
618
|
+
lease.remainingWaitMs = Math.max(0, lease.remainingWaitMs - (performance.now() - waitStarted));
|
|
619
|
+
}
|
|
595
620
|
} catch (error) {
|
|
596
621
|
if (lease && isTransientSqliteError2(error))
|
|
597
622
|
throw new SqliteAcquisitionBusyError2(error, "autocommit");
|
|
598
623
|
throw error;
|
|
599
624
|
} finally {
|
|
600
625
|
const elapsed = performance.now() - started;
|
|
601
|
-
if (lease)
|
|
602
|
-
lease.remainingWaitMs = Math.max(0, lease.remainingWaitMs - elapsed);
|
|
603
626
|
if (previous !== null)
|
|
604
627
|
db.exec(`PRAGMA busy_timeout=${previous}`);
|
|
605
628
|
if (elapsed >= SLOW_WRITER_LOG_MS)
|
|
@@ -859,4 +882,4 @@ async function yieldIndexChunk2() {
|
|
|
859
882
|
await yieldIndexTurn();
|
|
860
883
|
}
|
|
861
884
|
|
|
862
|
-
export { registerSlowWriteReporter2, registerSqliteDiagnosticSink2, detectSqliteRuntime2, getTagIdentityWriteGeneration2, Database2, getSqliteDatabasePath2, getSqliteMemoryStats2, prepareCachedStatement2, withSqliteBackgroundWriter2, withSqliteTransformPass2, withoutSqliteTransformPass2, assertTransformWrite2, isTransientSqliteError2, SqliteAcquisitionBusyError2, beginSqliteWriterAsync2, withAsyncPrivilegedWriter2, withPrivilegedWriter2, indexCoordinationInput2, releaseIndexOwner2, withIndexChunk2, yieldIndexChunk2 };
|
|
885
|
+
export { inRootAsyncContext2, registerSlowWriteReporter2, registerSqliteDiagnosticSink2, detectSqliteRuntime2, getTagIdentityWriteGeneration2, Database2, getSqliteDatabasePath2, getSqliteMemoryStats2, prepareCachedStatement2, withSqliteBackgroundWriter2, withSqliteTransformPass2, withoutSqliteTransformPass2, assertTransformWrite2, isTransientSqliteError2, SqliteAcquisitionBusyError2, beginSqliteWriterAsync2, withAsyncPrivilegedWriter2, withPrivilegedWriter2, indexCoordinationInput2, releaseIndexOwner2, withIndexChunk2, yieldIndexChunk2 };
|
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import {
|
|
2
2
|
sessionLog2
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-mvvephtj.js";
|
|
4
4
|
import {
|
|
5
5
|
clearEmergencyRecovery
|
|
6
|
-
} from "./index-
|
|
6
|
+
} from "./index-9g1c4bt9.js";
|
|
7
7
|
import {
|
|
8
8
|
requestPendingMaterialization,
|
|
9
9
|
dropSlot,
|
|
10
10
|
executeContextRecomp
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-hxrvx6cy.js";
|
|
12
12
|
import {
|
|
13
13
|
renderUserFacingFailure,
|
|
14
14
|
userFacingFailureCode
|
|
15
|
-
} from "./index-
|
|
15
|
+
} from "./index-ydjgz36f.js";
|
|
16
16
|
|
|
17
17
|
// src/hooks/magic-context/recomp-orchestrator.ts
|
|
18
18
|
function resolveLiveModelKey(liveSessionState, sessionId) {
|