@cortexkit/opencode-magic-context 0.49.6 → 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 +10 -7
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/{compaction-marker-candidates-cz72pm1t.js → compaction-marker-candidates-xxz35vwp.js} +3 -3
- package/dist/{conflict-warning-hook-1jq1rxx7.js → conflict-warning-hook-w3crzrar.js} +8 -8
- package/dist/{context-ae3gxdye.js → context-x0ccfv0f.js} +88 -53
- 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/compaction-marker.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/hidden-single-shot.d.ts +6 -3
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts +7 -1
- package/dist/features/magic-context/dreamer/map-memories-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +2 -2
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/primer-seed.d.ts +2 -0
- package/dist/features/magic-context/dreamer/primer-seed.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/dreamer/refresh-primers.d.ts +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.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/storage-clone.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +10 -3
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-replay-document.d.ts +4 -0
- package/dist/features/magic-context/storage-replay-document.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/apply-operations.d.ts +7 -0
- package/dist/hooks/magic-context/apply-operations.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/heuristic-cleanup.d.ts.map +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.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/note-nudger.d.ts +5 -3
- package/dist/hooks/magic-context/note-nudger.d.ts.map +1 -1
- package/dist/hooks/magic-context/postprocess-read-cache.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 +15 -4
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/replay-committed-drops.d.ts +9 -0
- package/dist/hooks/magic-context/replay-committed-drops.d.ts.map +1 -0
- package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts +2 -2
- package/dist/hooks/magic-context/rust-lkg-freeze-registry.d.ts.map +1 -1
- package/dist/hooks/magic-context/rust-mode-transform.d.ts +4 -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/rust-served-raw.d.ts +29 -0
- package/dist/hooks/magic-context/rust-served-raw.d.ts.map +1 -0
- package/dist/hooks/magic-context/strip-content.d.ts +23 -24
- package/dist/hooks/magic-context/strip-content.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/tool-drop-target.d.ts +2 -0
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.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-g9exahnx.js → index-0jz47061.js} +6 -3
- package/dist/{index-4mjhqadz.js → index-150zz6fh.js} +1 -1
- package/dist/{index-ch08qwgd.js → index-2rw244rh.js} +88 -81
- package/dist/{index-6q5h70h2.js → index-4hb8nt93.js} +3 -3
- package/dist/{index-j55vn694.js → index-7bjgyaj1.js} +4 -4
- package/dist/{index-h2wc01qk.js → index-8kk7yh6m.js} +2 -2
- package/dist/{index-vztbgcdk.js → index-9g1c4bt9.js} +304 -92
- package/dist/{index-7q1m1qjk.js → index-a43xq1pg.js} +5 -5
- package/dist/{index-tqf7yg27.js → index-a4b0gbyg.js} +1 -1
- package/dist/{index-vnjhmkwk.js → index-angx1s0k.js} +4 -3
- package/dist/{index-1xaw2pq8.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-zgzdm6dg.js → index-gzg9ekc1.js} +155 -103
- package/dist/{index-vh3e2mvr.js → index-hxrvx6cy.js} +121 -51
- 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-bg5qqene.js → index-mp2kghkv.js} +3 -27
- package/dist/{index-nsjyysj0.js → index-mvvephtj.js} +5 -1
- package/dist/{index-cm4hmxyk.js → index-n78avt2p.js} +1 -1
- package/dist/{index-hr64sth2.js → index-pgy3h49n.js} +4 -4
- package/dist/{index-a796ct3s.js → index-pjgzdezw.js} +13 -9
- package/dist/{index-9m7bn21d.js → index-q28hsbpg.js} +15 -3
- package/dist/{index-ab3bgm2m.js → index-q76br5zn.js} +3 -3
- package/dist/{index-xqyj5c85.js → index-qgp5vnt4.js} +5 -5
- package/dist/{index-9s58tq95.js → index-rg1cezmj.js} +22 -22
- package/dist/{index-f3dnvnw6.js → index-s178h9z8.js} +4 -3
- package/dist/{index-mj1fgfrk.js → index-w1ejb9qr.js} +939 -160
- package/dist/{index-k6xvbj2e.js → index-w28y7d0z.js} +2 -0
- package/dist/{index-0nnd4bry.js → index-wafzvyhg.js} +63 -19
- package/dist/{index-ck6y3td2.js → index-xf6k8szp.js} +4 -4
- package/dist/{index-1j8jcjpa.js → index-xpn05jxq.js} +4 -4
- package/dist/{index-s0gsmthp.js → index-ydjgz36f.js} +7 -7
- package/dist/{index-besxhcsh.js → index-zf9nydbd.js} +50 -39
- package/dist/index.js +53 -52
- package/dist/{logger-ewak5q1s.js → logger-wn328tfg.js} +1 -1
- package/dist/{message-index-bounded-630j53ps.js → message-index-bounded-hxjp56qk.js} +16 -16
- package/dist/{message-index-c84wm2g0.js → message-index-zs882h8e.js} +16 -16
- package/dist/{message-time-backfill-8kj57qe3.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/messages-transform.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-vv59t7ah.js → project-embedding-registry-vy7sv9jt.js} +11 -11
- package/dist/raw-ordinal-warmup-worker.js +17 -15
- package/dist/{read-session-chunk-t3vjd0h0.js → read-session-chunk-t9r7r0sg.js} +13 -11
- package/dist/{read-session-raw-gf7eytnm.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-kth2p6cc.js → search-qjen1pmz.js} +24 -24
- package/dist/{send-session-notification-3j6krd4w.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/processed-image-eligibility.d.ts +22 -0
- package/dist/shared/processed-image-eligibility.d.ts.map +1 -0
- package/dist/shared/recovery-reasoning-prefix.d.ts +9 -0
- package/dist/shared/recovery-reasoning-prefix.d.ts.map +1 -0
- 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 +3 -1
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/tag-transcript.d.ts +9 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/user-facing-codes.d.ts +2 -2
- package/dist/{sqlite-d7edbk1s.js → sqlite-4pqyynrs.js} +3 -1
- package/dist/{storage-memory-af5zdz98.js → storage-memory-j3v3hc83.js} +2 -2
- package/dist/{storage-tags-dyj7mmbq.js → storage-tags-a513rkj3.js} +5 -5
- package/dist/tools/ctx-expand/search-archive.d.ts +4 -0
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-bv3kb5s1.js → transform-postprocess-phase-yv463b7y.js} +30 -30
- package/dist/v2/auto-search-worker.js +10 -7
- package/dist/v2/{compaction-marker-candidates-6gqp5wrc.js → compaction-marker-candidates-a15w3mqh.js} +3 -3
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/{context-p8f2shp1.js → context-wd82v9z6.js} +1133 -278
- 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/payload.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-yzxmf6vp.js → message-index-bounded-madg2kfr.js} +16 -16
- package/dist/v2/{message-index-3ws17x1g.js → message-index-yd94vt9n.js} +16 -16
- package/dist/v2/{message-time-backfill-5nf10c65.js → message-time-backfill-rz1pnpaj.js} +3 -3
- package/dist/v2/migration-worker.js +11 -11
- package/dist/v2/{project-embedding-registry-rsnf2263.js → project-embedding-registry-ja23aygk.js} +11 -11
- package/dist/v2/raw-ordinal-warmup-worker.js +17 -15
- package/dist/v2/{read-session-chunk-vtb0w2kd.js → read-session-chunk-7qs791f3.js} +13 -11
- package/dist/v2/{read-session-raw-gpcddemt.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-5aj2j7vf.js → send-session-notification-6n7chhyp.js} +6 -6
- package/dist/v2/{server-09g9pkvx.js → server-08k4zkfk.js} +50 -39
- package/dist/v2/{server-ras2sxnc.js → server-44ryn9rb.js} +9 -6
- package/dist/v2/{server-158ehmk2.js → server-4easnf78.js} +19 -19
- package/dist/v2/{server-ww9nr8pe.js → server-4gz0xkrc.js} +5 -5
- package/dist/v2/{server-d6g4whc2.js → server-4qr18rfg.js} +3 -3
- package/dist/v2/{server-f9py7s7a.js → server-4rs8sm06.js} +5 -5
- package/dist/v2/{server-yezz0cp2.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-keswwkvv.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-9zqewm6g.js → server-ak7w74j9.js} +4 -4
- package/dist/v2/{server-387vkhjq.js → server-bx59ezg6.js} +4 -3
- package/dist/v2/{server-676xw7at.js → server-ckrb5rm8.js} +1 -1
- package/dist/v2/{server-wrem2nmz.js → server-cxsr0ng6.js} +15 -3
- package/dist/v2/{server-t528t8qm.js → server-hn9fb3v0.js} +2 -2
- package/dist/v2/{server-qn23p4h7.js → server-j3dm74ey.js} +9 -9
- package/dist/v2/{server-yd01snxq.js → server-jjsf29aq.js} +4 -4
- package/dist/v2/server-knvkbfvh.js +25 -0
- package/dist/v2/{server-cm4hmxyk.js → server-n78avt2p.js} +1 -1
- package/dist/v2/{server-btgnsv7w.js → server-njnx39q2.js} +6 -3
- package/dist/v2/{server-6a9mxnb2.js → server-npm52h2q.js} +4 -3
- package/dist/v2/{server-vb7pbd9p.js → server-nveratm5.js} +1 -1
- package/dist/v2/{server-7skbfb81.js → server-q360kdb8.js} +121 -51
- 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-0nnd4bry.js → server-wafzvyhg.js} +63 -19
- package/dist/v2/{server-fby0cxbq.js → server-xj4mewze.js} +304 -92
- package/dist/v2/{server-aa9w15cs.js → server-y5g32dhq.js} +88 -81
- package/dist/v2/{server-x2r63c0x.js → server-yak3sxya.js} +7 -7
- package/dist/v2/{server-4tn95znb.js → server-zrwaj29a.js} +2 -2
- package/dist/v2/server.js +9 -8
- package/dist/v2/{sqlite-d7edbk1s.js → sqlite-4pqyynrs.js} +3 -1
- package/dist/v2/{storage-memory-af5zdz98.js → storage-memory-j3v3hc83.js} +2 -2
- package/dist/v2/{storage-tags-d47bpaqa.js → storage-tags-spa92sgj.js} +5 -5
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-cahk37n7.js → wrapup-orchestrator-5wxy1ggv.js} +38 -35
- package/dist/wrapup-orchestrator-gv08c6f9.js +47 -0
- package/package.json +3 -3
- 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/processed-image-eligibility.test.ts +68 -0
- package/src/shared/processed-image-eligibility.ts +41 -0
- package/src/shared/processed-image-position-review.json +20 -0
- package/src/shared/processed-image-position-review.test.ts +19 -0
- package/src/shared/recovery-reasoning-prefix.test.ts +34 -0
- package/src/shared/recovery-reasoning-prefix.ts +35 -0
- 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-writer-diagnostics.test.ts +31 -0
- package/src/shared/sqlite.ts +112 -30
- package/src/shared/tag-transcript.ts +118 -0
- package/src/shared/user-facing-codes.ts +2 -2
- package/dist/embedding-backfill-dtjmyktb.js +0 -21
- package/dist/recomp-orchestrator-1d08g57a.js +0 -60
- package/dist/v2/embedding-backfill-cg4rv90f.js +0 -20
- package/dist/v2/recomp-orchestrator-v64r4s4r.js +0 -59
- package/dist/v2/search-bpa4fxq1.js +0 -46
- package/dist/wrapup-orchestrator-mqp0v195.js +0 -47
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
sanitizeDiagnosticText,
|
|
10
10
|
log2,
|
|
11
11
|
sessionLog2
|
|
12
|
-
} from "./server-
|
|
12
|
+
} from "./server-9e5r8y60.js";
|
|
13
13
|
import {
|
|
14
14
|
parseJsoncRecovering,
|
|
15
15
|
detectConfigFile,
|
|
@@ -17,34 +17,32 @@ import {
|
|
|
17
17
|
cortexKitProjectConfigBasePath,
|
|
18
18
|
resolveLegacyConfigSourcesForHarness,
|
|
19
19
|
loadPluginConfigDetailed
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-4qr18rfg.js";
|
|
21
21
|
import {
|
|
22
22
|
catalogOutputReserve,
|
|
23
23
|
getSdkContextLimit,
|
|
24
24
|
modelSupportsVision,
|
|
25
25
|
getSdkOutputLimit
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-nveratm5.js";
|
|
27
27
|
import {
|
|
28
28
|
withContentLanguageDirective,
|
|
29
29
|
buildPrimaryLanguageDirective,
|
|
30
30
|
resolvePromptSurface,
|
|
31
31
|
DEFAULT_HISTORIAN_TIMEOUT_MS,
|
|
32
32
|
LIVE_RELOAD_CONFIG_PATHS
|
|
33
|
-
} from "./server-
|
|
33
|
+
} from "./server-7e087rvk.js";
|
|
34
34
|
import {
|
|
35
35
|
hasMeaningfulUserText2,
|
|
36
36
|
estimateTokens,
|
|
37
37
|
estimateFixedPromptTokens
|
|
38
|
-
} from "./server-
|
|
38
|
+
} from "./server-s6jqh8bj.js";
|
|
39
39
|
import {
|
|
40
|
+
inRootAsyncContext2,
|
|
40
41
|
Database2,
|
|
41
42
|
withSqliteBackgroundWriter2,
|
|
42
43
|
withoutSqliteTransformPass2,
|
|
43
44
|
beginSqliteWriterAsync2
|
|
44
|
-
} from "./server-
|
|
45
|
-
import {
|
|
46
|
-
sameProjectDirectory
|
|
47
|
-
} from "./server-yezz0cp2.js";
|
|
45
|
+
} from "./server-wafzvyhg.js";
|
|
48
46
|
import {
|
|
49
47
|
buildCanonicalChunkTextFromFts,
|
|
50
48
|
buildCompartmentSummaryFallbackText,
|
|
@@ -54,10 +52,10 @@ import {
|
|
|
54
52
|
replaceCompartmentChunkEmbeddings,
|
|
55
53
|
deleteChunkEmbedBackoffForSession,
|
|
56
54
|
chunkWindowSourceKey
|
|
57
|
-
} from "./server-
|
|
55
|
+
} from "./server-9a6bwc12.js";
|
|
58
56
|
import {
|
|
59
57
|
isPidAlive
|
|
60
|
-
} from "./server-
|
|
58
|
+
} from "./server-cxsr0ng6.js";
|
|
61
59
|
import {
|
|
62
60
|
BoundedSessionMap,
|
|
63
61
|
clearCompressionDepth,
|
|
@@ -72,7 +70,7 @@ import {
|
|
|
72
70
|
toMessageIndexSource2,
|
|
73
71
|
clearIndexedMessagesInTransaction2,
|
|
74
72
|
indexSourcesAfterOrdinal2
|
|
75
|
-
} from "./server-
|
|
73
|
+
} from "./server-j3dm74ey.js";
|
|
76
74
|
import {
|
|
77
75
|
detectOverflow,
|
|
78
76
|
SESSION_META_SELECT_COLUMNS,
|
|
@@ -138,9 +136,13 @@ import {
|
|
|
138
136
|
THINKING_BINDING_STRIP_ORDER_END_MARKER,
|
|
139
137
|
getMergedReasoningStrippedIds,
|
|
140
138
|
addMergedReasoningStrippedIds,
|
|
139
|
+
parseProcessedImageMarkers,
|
|
140
|
+
serializeProcessedImageMarkers,
|
|
141
141
|
getPendingCompactionMarkerState,
|
|
142
142
|
setPendingCompactionMarkerState,
|
|
143
143
|
clearPendingCompactionMarkerStateIf,
|
|
144
|
+
getPendingPiCompactionMarkerState,
|
|
145
|
+
logPiCompactionMarkerClear,
|
|
144
146
|
resolveHostServedBoundaryId2,
|
|
145
147
|
hasRawMessageProvider2,
|
|
146
148
|
withRawSessionMessageCache2,
|
|
@@ -157,17 +159,17 @@ import {
|
|
|
157
159
|
getRawSessionTagKeysThrough2,
|
|
158
160
|
getLegacyProtectedTailStartOrdinal2,
|
|
159
161
|
readSessionChunk2
|
|
160
|
-
} from "./server-
|
|
162
|
+
} from "./server-xj4mewze.js";
|
|
161
163
|
import {
|
|
162
164
|
getTableColumnNames
|
|
163
|
-
} from "./server-
|
|
165
|
+
} from "./server-shme41gj.js";
|
|
164
166
|
import {
|
|
165
167
|
FAIL_CLOSED_DOCTOR_COMMAND,
|
|
166
168
|
getSchemaFenceRejection,
|
|
167
169
|
LATEST_SUPPORTED_VERSION,
|
|
168
170
|
getPersistedSchemaVersion,
|
|
169
171
|
openDatabase
|
|
170
|
-
} from "./server-
|
|
172
|
+
} from "./server-08k4zkfk.js";
|
|
171
173
|
import {
|
|
172
174
|
providerMass,
|
|
173
175
|
calibrationForModelKey,
|
|
@@ -185,11 +187,11 @@ import {
|
|
|
185
187
|
foldShrunkPartTags2,
|
|
186
188
|
getTagNumberByMessageId2,
|
|
187
189
|
getActiveTagsBySession2
|
|
188
|
-
} from "./server-
|
|
190
|
+
} from "./server-jjsf29aq.js";
|
|
189
191
|
import {
|
|
190
192
|
isStrictGapHealingMessage2,
|
|
191
193
|
noteRawSessionSummaryRowWritten2
|
|
192
|
-
} from "./server-
|
|
194
|
+
} from "./server-bx59ezg6.js";
|
|
193
195
|
import {
|
|
194
196
|
resolveOpenCodeDbPath,
|
|
195
197
|
assertOpenCodeStoreGeneration,
|
|
@@ -199,10 +201,10 @@ import {
|
|
|
199
201
|
import {
|
|
200
202
|
withReadOnlySessionDb,
|
|
201
203
|
getMessageTimesFromOpenCodeDb
|
|
202
|
-
} from "./server-
|
|
204
|
+
} from "./server-zrwaj29a.js";
|
|
203
205
|
import {
|
|
204
206
|
getMeasuredToolDefinitionTokens
|
|
205
|
-
} from "./server-
|
|
207
|
+
} from "./server-adfte03x.js";
|
|
206
208
|
import {
|
|
207
209
|
V2_MEMORY_CATEGORIES,
|
|
208
210
|
CATEGORY_PRIORITY,
|
|
@@ -218,11 +220,11 @@ import {
|
|
|
218
220
|
resolveStoredPathWorkspaceIdentity,
|
|
219
221
|
sourceNameForMemory,
|
|
220
222
|
computeWorkspaceEpochFingerprint
|
|
221
|
-
} from "./server-
|
|
223
|
+
} from "./server-4gz0xkrc.js";
|
|
222
224
|
import {
|
|
223
225
|
shouldSkipHomeProjectMemory,
|
|
224
226
|
resolveProjectIdentity
|
|
225
|
-
} from "./server-
|
|
227
|
+
} from "./server-njnx39q2.js";
|
|
226
228
|
import {
|
|
227
229
|
drainBackgroundBatches,
|
|
228
230
|
contentSha2562,
|
|
@@ -230,7 +232,7 @@ import {
|
|
|
230
232
|
getProjectChunkEmbeddingModelId2,
|
|
231
233
|
getProjectEmbeddingMaxInputTokens2,
|
|
232
234
|
embedItemsForProject2
|
|
233
|
-
} from "./server-
|
|
235
|
+
} from "./server-4easnf78.js";
|
|
234
236
|
import {
|
|
235
237
|
getSessionNotes,
|
|
236
238
|
getReadySmartNotes,
|
|
@@ -239,13 +241,13 @@ import {
|
|
|
239
241
|
userFacingFailureCode,
|
|
240
242
|
promoteSessionFactsDurable,
|
|
241
243
|
embedPromotedFacts
|
|
242
|
-
} from "./server-
|
|
244
|
+
} from "./server-yak3sxya.js";
|
|
243
245
|
import {
|
|
244
246
|
isMarkerCandidateBasisCurrent2,
|
|
245
247
|
invalidateMarkerCandidateBasis2,
|
|
246
248
|
readMarkerCandidateBasis2,
|
|
247
249
|
prepareMarkerCandidateBasis2
|
|
248
|
-
} from "./server-
|
|
250
|
+
} from "./server-npm52h2q.js";
|
|
249
251
|
import {
|
|
250
252
|
computeCueContentHash,
|
|
251
253
|
getMuralCueState,
|
|
@@ -253,7 +255,7 @@ import {
|
|
|
253
255
|
getMemoriesByProject2,
|
|
254
256
|
getMemoriesByProjects2,
|
|
255
257
|
getMaxMemoryIdForProjects2
|
|
256
|
-
} from "./server-
|
|
258
|
+
} from "./server-n78avt2p.js";
|
|
257
259
|
import {
|
|
258
260
|
pushNotification2
|
|
259
261
|
} from "./server-x8a7jmkh.js";
|
|
@@ -261,10 +263,13 @@ import {
|
|
|
261
263
|
deriveTriggerBudget2,
|
|
262
264
|
resolveHistorianProducerLimits2,
|
|
263
265
|
producerSourceLocalBudget2
|
|
264
|
-
} from "./server-
|
|
266
|
+
} from "./server-hn9fb3v0.js";
|
|
265
267
|
import {
|
|
266
268
|
sendStatusNotification2
|
|
267
|
-
} from "./server-
|
|
269
|
+
} from "./server-ak7w74j9.js";
|
|
270
|
+
import {
|
|
271
|
+
sameProjectDirectory
|
|
272
|
+
} from "./server-knvkbfvh.js";
|
|
268
273
|
import {
|
|
269
274
|
getErrorMessage,
|
|
270
275
|
describeError
|
|
@@ -278,7 +283,7 @@ import {
|
|
|
278
283
|
import {
|
|
279
284
|
logSlowWriteTransaction,
|
|
280
285
|
WriteTransactionSteps
|
|
281
|
-
} from "./server-
|
|
286
|
+
} from "./server-7dv9wt9r.js";
|
|
282
287
|
|
|
283
288
|
// src/config/live-snapshot.ts
|
|
284
289
|
import { createHash } from "node:crypto";
|
|
@@ -1107,7 +1112,7 @@ var V2_MESSAGE_PAGE_SQL = `WITH bounds AS (
|
|
|
1107
1112
|
SELECT seq FROM session_message
|
|
1108
1113
|
WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
|
|
1109
1114
|
ORDER BY seq ASC LIMIT 1 OFFSET ?
|
|
1110
|
-
), -1) END AS after_seq,
|
|
1115
|
+
), (SELECT MAX(seq) FROM session_message WHERE session_id = ?), -1) END AS after_seq,
|
|
1111
1116
|
COALESCE((
|
|
1112
1117
|
SELECT seq FROM session_message
|
|
1113
1118
|
WHERE session_id = ? AND type IN (${RAW_MESSAGE_TYPE_PARAMETERS})
|
|
@@ -1368,7 +1373,7 @@ class V2StoreReader {
|
|
|
1368
1373
|
}
|
|
1369
1374
|
}
|
|
1370
1375
|
const maximumSeq = Number.MAX_SAFE_INTEGER;
|
|
1371
|
-
const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
|
|
1376
|
+
const rows = this.prepare(V2_MESSAGE_PAGE_SQL).all(afterOrdinal, sessionID, ...RAW_MESSAGE_TYPES, Math.max(0, afterOrdinal - 1), sessionID, sessionID, ...RAW_MESSAGE_TYPES, finalWatermark - 1, maximumSeq, sessionID, ...RAW_MESSAGE_TYPES, pageSize);
|
|
1372
1377
|
return rows.map(decode);
|
|
1373
1378
|
});
|
|
1374
1379
|
}
|
|
@@ -1882,13 +1887,17 @@ async function retryPendingRustSessionCleanupsForProject(db, projectPath, delete
|
|
|
1882
1887
|
function clearSession(db, sessionId, rustModuleCleanupAcknowledged = false, permanentlyDeleted = false) {
|
|
1883
1888
|
cancelAutoSearchWork(sessionId);
|
|
1884
1889
|
let transactionStartedAt = 0;
|
|
1890
|
+
let clearedMarker = null;
|
|
1885
1891
|
withoutSqliteTransformPass2(() => withSqliteBackgroundWriter2(() => db.transaction(() => {
|
|
1886
1892
|
transactionStartedAt = performance.now();
|
|
1893
|
+
clearedMarker = getPendingPiCompactionMarkerState(db, sessionId);
|
|
1887
1894
|
deleteSessionScopedRows(db, [sessionId], undefined, {
|
|
1888
1895
|
rustModuleCleanupAcknowledged,
|
|
1889
1896
|
preserveTagRevisionTombstones: !permanentlyDeleted
|
|
1890
1897
|
});
|
|
1891
1898
|
}).immediate()));
|
|
1899
|
+
if (clearedMarker)
|
|
1900
|
+
logPiCompactionMarkerClear(sessionId, clearedMarker, "session-reset");
|
|
1892
1901
|
clearUnpublishedAutoSearchNoHints(sessionId);
|
|
1893
1902
|
logSlowWriteTransaction("clear-session", transactionStartedAt);
|
|
1894
1903
|
}
|
|
@@ -2278,6 +2287,9 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
|
2278
2287
|
}
|
|
2279
2288
|
const layout = layoutLkgPrefix(slot.jsonPrefix);
|
|
2280
2289
|
try {
|
|
2290
|
+
const inputIdSeq = JSON.stringify(slot.piOutputEntryIds ? { version: 1, inputIds: slot.inputIdSeq, piOutputEntryIds: slot.piOutputEntryIds } : slot.inputIdSeq);
|
|
2291
|
+
const inputContentDigests = JSON.stringify(slot.inputContentDigests);
|
|
2292
|
+
const inputContentSignatures = slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null;
|
|
2281
2293
|
db.transaction(() => {
|
|
2282
2294
|
const storedHashes = new Map;
|
|
2283
2295
|
for (const row of db.prepare("SELECT chunk, hash FROM lkg_slot_chunks WHERE session_id = ?").all(sessionId)) {
|
|
@@ -2309,11 +2321,7 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
|
2309
2321
|
provider_key = excluded.provider_key,
|
|
2310
2322
|
captured_at = excluded.captured_at,
|
|
2311
2323
|
row_version = excluded.row_version,
|
|
2312
|
-
capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash,
|
|
2313
|
-
version: 1,
|
|
2314
|
-
inputIds: slot.inputIdSeq,
|
|
2315
|
-
piOutputEntryIds: slot.piOutputEntryIds
|
|
2316
|
-
} : slot.inputIdSeq), JSON.stringify(slot.inputContentDigests), slot.inputContentSignatures ? JSON.stringify(slot.inputContentSignatures) : null, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
|
|
2324
|
+
capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, inputIdSeq, inputContentDigests, inputContentSignatures, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
|
|
2317
2325
|
publishMetadata?.();
|
|
2318
2326
|
}).immediate();
|
|
2319
2327
|
rememberFingerprint(db, sessionId, fingerprint);
|
|
@@ -4227,6 +4235,9 @@ function filterIdBlob(raw, filter) {
|
|
|
4227
4235
|
return "";
|
|
4228
4236
|
}
|
|
4229
4237
|
}
|
|
4238
|
+
function filterProcessedImageBlob(raw, filter) {
|
|
4239
|
+
return serializeProcessedImageMarkers(new Map([...parseProcessedImageMarkers(raw)].filter(([id]) => filter.includeMessageId(id)).map(([id, marker]) => [mapMessageId(filter, id) ?? id, marker])));
|
|
4240
|
+
}
|
|
4230
4241
|
function filterStrippedPlaceholderBlob(raw, filter) {
|
|
4231
4242
|
const state = parseStrippedPlaceholderState(raw);
|
|
4232
4243
|
const keep = (ids) => ids.filter((id) => filter.includeMessageId(id)).map((id) => mapMessageId(filter, id) ?? id);
|
|
@@ -4308,7 +4319,8 @@ function clampWatermark(value, maxCopiedTag) {
|
|
|
4308
4319
|
return Math.min(Math.floor(value), maxCopiedTag);
|
|
4309
4320
|
}
|
|
4310
4321
|
function copySessionStateForClone(db, sourceSessionId, destinationSessionId, filter) {
|
|
4311
|
-
|
|
4322
|
+
let clearedMarker = null;
|
|
4323
|
+
const result = runImmediate(db, () => {
|
|
4312
4324
|
const hasTemporalDecisions = tableExists(db, "temporal_decisions");
|
|
4313
4325
|
if (filter.requireEmptyDestinationMeta === true && countRows(db, "session_meta", destinationSessionId) > 0 || countRows(db, "compartments", destinationSessionId) > 0 || countRows(db, "tags", destinationSessionId) > 0 || hasTemporalDecisions && countRows(db, "temporal_decisions", destinationSessionId) > 0 || filter.copySessionNotesAndFacts === true && (tableExists(db, "notes") && countRows(db, "notes", destinationSessionId) > 0 || tableExists(db, "session_facts") && countRows(db, "session_facts", destinationSessionId) > 0)) {
|
|
4314
4326
|
return {
|
|
@@ -4420,6 +4432,8 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4420
4432
|
FROM session_meta WHERE session_id = ?`).get(sourceSessionId);
|
|
4421
4433
|
const maxCopiedTag = copiedTagNumbers.reduce((max, value) => Math.max(max, value), 0);
|
|
4422
4434
|
const pendingMarker = filter.selectPendingPiMarker(meta?.pending_pi_compaction_marker_state ?? null, copiedCompartments);
|
|
4435
|
+
if (pendingMarker === null)
|
|
4436
|
+
clearedMarker = getPendingPiCompactionMarkerState(db, destinationSessionId);
|
|
4423
4437
|
const todoAnchor = meta?.todo_synthetic_anchor_message_id ?? "";
|
|
4424
4438
|
const migrateTodo = todoAnchor.length > 0 && filter.includeMessageId(todoAnchor);
|
|
4425
4439
|
db.prepare(`INSERT INTO session_meta
|
|
@@ -4446,7 +4460,7 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4446
4460
|
todo_synthetic_anchor_message_id = excluded.todo_synthetic_anchor_message_id,
|
|
4447
4461
|
todo_synthetic_state_json = excluded.todo_synthetic_state_json,
|
|
4448
4462
|
cached_m0_bytes = NULL,
|
|
4449
|
-
cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter),
|
|
4463
|
+
cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, filter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, filter), filterProcessedImageBlob(meta?.processed_image_stripped_ids ?? null, filter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, filter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
|
|
4450
4464
|
const metaColumnRows = db.prepare("PRAGMA table_info(session_meta)").all();
|
|
4451
4465
|
const metaColumns = new Set(metaColumnRows.map((column) => column.name));
|
|
4452
4466
|
if (metaColumns.has("trailing_blank_decisions")) {
|
|
@@ -4464,6 +4478,9 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4464
4478
|
pendingMarkerMigrated: pendingMarker !== null
|
|
4465
4479
|
};
|
|
4466
4480
|
});
|
|
4481
|
+
if (clearedMarker)
|
|
4482
|
+
logPiCompactionMarkerClear(destinationSessionId, clearedMarker, "clone-replaced");
|
|
4483
|
+
return result;
|
|
4467
4484
|
}
|
|
4468
4485
|
// src/features/magic-context/historian-failure-reason.ts
|
|
4469
4486
|
var MAX_HISTORIAN_FAILURE_REASON_LENGTH = 512;
|
|
@@ -5507,7 +5524,7 @@ class HiddenCompletionRefusal extends Error {
|
|
|
5507
5524
|
|
|
5508
5525
|
// src/features/magic-context/compaction-marker.ts
|
|
5509
5526
|
import { createHash as createHash7 } from "node:crypto";
|
|
5510
|
-
import { existsSync } from "node:fs";
|
|
5527
|
+
import { existsSync, statSync as statSync4 } from "node:fs";
|
|
5511
5528
|
var BASE62_CHARS = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
|
|
5512
5529
|
var ID_PREFIX_HEX_LENGTH = 12;
|
|
5513
5530
|
var ID_SUFFIX_LENGTH = 14;
|
|
@@ -5545,6 +5562,7 @@ function runMarkerRemovalTransaction(db, operation) {
|
|
|
5545
5562
|
function runMarkerWriteTransaction(db, site, operation) {
|
|
5546
5563
|
if (db.inTransaction)
|
|
5547
5564
|
return db.transaction(operation).immediate();
|
|
5565
|
+
const walBefore = markerWalPages(db);
|
|
5548
5566
|
const startedAt = performance.now();
|
|
5549
5567
|
let acquiredAt;
|
|
5550
5568
|
let workFinishedAt;
|
|
@@ -5568,9 +5586,22 @@ function runMarkerWriteTransaction(db, site, operation) {
|
|
|
5568
5586
|
const endMs = workFinishedAt === undefined ? 0 : finishedAt - workFinishedAt;
|
|
5569
5587
|
try {
|
|
5570
5588
|
log2(`[magic-context] sqlite writer site=${site} db=opencode acquire_ms=${Math.round(acquireMs)} hold_ms=${Math.round(holdMs)} work_ms=${Math.round(workMs)} end_ms=${Math.round(endMs)} outcome=${acquiredAt === undefined ? "not_acquired" : committed ? "committed" : "failed"}`);
|
|
5589
|
+
if (finishedAt - startedAt > 100) {
|
|
5590
|
+
const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").get();
|
|
5591
|
+
log2(`[magic-context] compaction-marker slow writer site=${site} acquire_ms=${acquireMs.toFixed(1)} statements_ms=${workMs.toFixed(1)} ${committed ? "commit" : "rollback"}_ms=${endMs.toFixed(1)} wal_autocheckpoint=${autoCheckpoint.wal_autocheckpoint} wal_pages_before=${walBefore ?? "unknown"} wal_pages_after=${markerWalPages(db) ?? "unknown"}`);
|
|
5592
|
+
}
|
|
5571
5593
|
} catch {}
|
|
5572
5594
|
}
|
|
5573
5595
|
}
|
|
5596
|
+
function markerWalPages(db) {
|
|
5597
|
+
try {
|
|
5598
|
+
const row = db.prepare("PRAGMA page_size").get();
|
|
5599
|
+
const bytes = statSync4(`${getOpenCodeDbPath()}-wal`).size;
|
|
5600
|
+
return Math.max(0, Math.floor((bytes - 32) / (row.page_size + 24)));
|
|
5601
|
+
} catch {
|
|
5602
|
+
return null;
|
|
5603
|
+
}
|
|
5604
|
+
}
|
|
5574
5605
|
var REQUIRED_MESSAGE_COLUMNS = ["id", "session_id", "time_created", "time_updated", "data"];
|
|
5575
5606
|
var REQUIRED_PART_COLUMNS = [
|
|
5576
5607
|
"id",
|
|
@@ -5631,6 +5662,7 @@ function getWritableOpenCodeDb(purpose = "publication") {
|
|
|
5631
5662
|
const timeoutMs = purpose === "removal" ? MARKER_REMOVAL_BUSY_TIMEOUT_MS : MARKER_BUSY_TIMEOUT_MS;
|
|
5632
5663
|
db.exec(`PRAGMA busy_timeout=${timeoutMs}`);
|
|
5633
5664
|
db.exec("PRAGMA journal_mode=WAL");
|
|
5665
|
+
db.exec("PRAGMA wal_autocheckpoint=0");
|
|
5634
5666
|
if (purpose === "removal")
|
|
5635
5667
|
cachedRemovalDb = { path: dbPath, db };
|
|
5636
5668
|
else
|
|
@@ -7837,7 +7869,7 @@ async function promptAsyncAndWaitForIdle(client, request, options = {}) {
|
|
|
7837
7869
|
}
|
|
7838
7870
|
}
|
|
7839
7871
|
// src/shared/prompt-surface-runtime.ts
|
|
7840
|
-
import { existsSync as existsSync2, readFileSync as readFileSync3, statSync as
|
|
7872
|
+
import { existsSync as existsSync2, readFileSync as readFileSync3, statSync as statSync5 } from "node:fs";
|
|
7841
7873
|
import { dirname, isAbsolute, resolve as resolve2 } from "node:path";
|
|
7842
7874
|
|
|
7843
7875
|
// src/tools/light-descriptions.ts
|
|
@@ -7901,7 +7933,7 @@ function createPromptSurfaceRuntime(options) {
|
|
|
7901
7933
|
const path = isAbsolute(configuredPath) ? configuredPath : resolve2(userConfigDirectory, configuredPath);
|
|
7902
7934
|
let content;
|
|
7903
7935
|
try {
|
|
7904
|
-
if (!
|
|
7936
|
+
if (!statSync5(path).isFile()) {
|
|
7905
7937
|
warnOnce(`guidance-not-file:${path}`, `prompt_surface.guidance_override_path (${path}) is not a file; using built-in guidance.`);
|
|
7906
7938
|
return;
|
|
7907
7939
|
}
|
|
@@ -12960,6 +12992,37 @@ function capturePrefixTrimSourceOrder(messages) {
|
|
|
12960
12992
|
invalidReason
|
|
12961
12993
|
});
|
|
12962
12994
|
}
|
|
12995
|
+
function reanchorStoredBoundary(options, boundary) {
|
|
12996
|
+
if (!options.messages)
|
|
12997
|
+
return;
|
|
12998
|
+
const source = options.prefixTrimSourceOrder ?? capturePrefixTrimSourceOrder(options.messages);
|
|
12999
|
+
if (source.invalidReason)
|
|
13000
|
+
return;
|
|
13001
|
+
try {
|
|
13002
|
+
if (compareRawSessionMessageOrder2(options.sessionId, boundary, boundary) !== 0)
|
|
13003
|
+
return;
|
|
13004
|
+
const messageIds = [...source.messageIds];
|
|
13005
|
+
let previous;
|
|
13006
|
+
let insertion = messageIds.length;
|
|
13007
|
+
for (const [index, id] of messageIds.entries()) {
|
|
13008
|
+
if (previous) {
|
|
13009
|
+
const increasing = compareRawSessionMessageOrder2(options.sessionId, previous, id);
|
|
13010
|
+
if (increasing === null || !Number.isFinite(increasing) || increasing >= 0)
|
|
13011
|
+
return;
|
|
13012
|
+
}
|
|
13013
|
+
const order = compareRawSessionMessageOrder2(options.sessionId, boundary, id);
|
|
13014
|
+
if (order === null || !Number.isFinite(order) || order === 0)
|
|
13015
|
+
return;
|
|
13016
|
+
if (order < 0 && insertion === messageIds.length)
|
|
13017
|
+
insertion = index;
|
|
13018
|
+
previous = id;
|
|
13019
|
+
}
|
|
13020
|
+
messageIds.splice(insertion, 0, boundary);
|
|
13021
|
+
return { ...source, messageIds };
|
|
13022
|
+
} catch {
|
|
13023
|
+
return;
|
|
13024
|
+
}
|
|
13025
|
+
}
|
|
12963
13026
|
function trimToPreparedPrefix(options, prepared) {
|
|
12964
13027
|
if (options.compactionOff || !options.messages)
|
|
12965
13028
|
return "not-attempted";
|
|
@@ -12984,7 +13047,8 @@ function trimToPreparedPrefix(options, prepared) {
|
|
|
12984
13047
|
});
|
|
12985
13048
|
const boundaryPosition = sourcePosition.get(boundary) ?? sourcePosition.get(resolveHostServedBoundaryId2(options.sessionId, boundary));
|
|
12986
13049
|
if (boundaryPosition === undefined) {
|
|
12987
|
-
|
|
13050
|
+
const reanchored = reanchorStoredBoundary(options, boundary);
|
|
13051
|
+
status = reanchored ? trimToPreparedPrefix({ ...options, prefixTrimSourceOrder: reanchored }, prepared) : refuse("boundary absent from immutable source order");
|
|
12988
13052
|
} else {
|
|
12989
13053
|
let lastSourcePosition = -1;
|
|
12990
13054
|
let sawPersistedRow = false;
|
|
@@ -12995,8 +13059,7 @@ function trimToPreparedPrefix(options, prepared) {
|
|
|
12995
13059
|
for (const [index, message] of options.messages.entries()) {
|
|
12996
13060
|
const id = message.info.id;
|
|
12997
13061
|
if (isHostRenderedSystemMessage(message)) {
|
|
12998
|
-
|
|
12999
|
-
retained.push(message);
|
|
13062
|
+
retained.push(message);
|
|
13000
13063
|
continue;
|
|
13001
13064
|
}
|
|
13002
13065
|
if (typeof id !== "string" || id.length === 0) {
|
|
@@ -13039,12 +13102,19 @@ function trimToPreparedPrefix(options, prepared) {
|
|
|
13039
13102
|
} else {
|
|
13040
13103
|
const index = findBoundaryIndex(options.sessionId, options.messages, boundary);
|
|
13041
13104
|
if (index >= 0) {
|
|
13042
|
-
const
|
|
13105
|
+
const cut = index + (isPartialCompartmentEnd(options.db, options.sessionId, boundary) ? 0 : 1);
|
|
13106
|
+
const unplaced = options.messages.slice(0, cut).filter(isHostRenderedSystemMessage);
|
|
13107
|
+
const removed = options.messages.splice(0, cut, ...unplaced);
|
|
13043
13108
|
retireDecisions(removed.map((message) => message.info.id).filter((id) => typeof id === "string"));
|
|
13044
13109
|
resetPrefixTrimFallbackState(options.sessionId);
|
|
13045
13110
|
status = "applied";
|
|
13046
13111
|
} else {
|
|
13047
|
-
|
|
13112
|
+
const reanchored = reanchorStoredBoundary(options, boundary);
|
|
13113
|
+
if (reanchored && reanchored.messageIds[0] !== boundary) {
|
|
13114
|
+
status = trimToPreparedPrefix({ ...options, prefixTrimSourceOrder: reanchored }, prepared);
|
|
13115
|
+
} else {
|
|
13116
|
+
status = classifyAbsentBoundary(options, options.messages, boundary);
|
|
13117
|
+
}
|
|
13048
13118
|
}
|
|
13049
13119
|
}
|
|
13050
13120
|
}
|
|
@@ -16071,7 +16141,7 @@ function observeNoteNudgeServe(args) {
|
|
|
16071
16141
|
sessions.set(args.sessionId, seen);
|
|
16072
16142
|
return {
|
|
16073
16143
|
isFirstServe: warm && args.isLiveTail && firstServe,
|
|
16074
|
-
|
|
16144
|
+
prefixRewriteCoversAnchor: args.anchorMessageId !== null && args.prefixRewriteCoversAnchor
|
|
16075
16145
|
};
|
|
16076
16146
|
}
|
|
16077
16147
|
var NOTE_NUDGE_COOLDOWN_MS = 15 * 60 * 1000;
|
|
@@ -16110,7 +16180,7 @@ function peekNoteNudgeText(db, sessionId, currentUserMessageId, projectIdentity,
|
|
|
16110
16180
|
const state = getPersistedNoteNudge(db, sessionId);
|
|
16111
16181
|
if (!state.triggerPending)
|
|
16112
16182
|
return null;
|
|
16113
|
-
if (eligibility && !eligibility.isFirstServe && !eligibility.
|
|
16183
|
+
if (eligibility && !eligibility.isFirstServe && !eligibility.prefixRewriteCoversAnchor) {
|
|
16114
16184
|
sessionLog2(sessionId, "note-nudge: deferring — user already served or first serve unproven");
|
|
16115
16185
|
return null;
|
|
16116
16186
|
}
|
|
@@ -17979,6 +18049,7 @@ Historian pass ${passCount + 1}, attempt ${passAttempt} started for messages ${c
|
|
|
17979
18049
|
sequenceOffset: candidateCompartments.length,
|
|
17980
18050
|
dumpLabelBase: `recomp-${sessionId}-${chunk.startIndex}-${chunk.endIndex}-pass-${passCount + 1}`,
|
|
17981
18051
|
timeoutMs: historianTimeoutMs,
|
|
18052
|
+
maxOutputTokens: deps.historianMaxOutputTokens,
|
|
17982
18053
|
model: deps.model,
|
|
17983
18054
|
fallbackModelId: deps.fallbackModelId,
|
|
17984
18055
|
fallbackModels: deps.fallbackModels,
|
|
@@ -18493,7 +18564,6 @@ ${renderUserFacingFailure("recomp_unavailable")}`;
|
|
|
18493
18564
|
}
|
|
18494
18565
|
}
|
|
18495
18566
|
}
|
|
18496
|
-
|
|
18497
18567
|
// src/hooks/magic-context/compartment-runner.ts
|
|
18498
18568
|
var activeRuns = new Map;
|
|
18499
18569
|
function getActiveCompartmentRun(sessionId) {
|
|
@@ -18529,7 +18599,7 @@ function withPublishedCallback(deps) {
|
|
|
18529
18599
|
};
|
|
18530
18600
|
}
|
|
18531
18601
|
function startLeaseRenewal(deps, holderId) {
|
|
18532
|
-
return setInterval(() => {
|
|
18602
|
+
return inRootAsyncContext2(() => setInterval(() => {
|
|
18533
18603
|
try {
|
|
18534
18604
|
if (!renewCompartmentLease(deps.db, deps.sessionId, holderId)) {
|
|
18535
18605
|
sessionLog2(deps.sessionId, "compartment lease renewal failed; publish will be skipped if holder is stale");
|
|
@@ -18537,7 +18607,7 @@ function startLeaseRenewal(deps, holderId) {
|
|
|
18537
18607
|
} catch (err) {
|
|
18538
18608
|
sessionLog2(deps.sessionId, `compartment lease renewal threw; publish will be skipped if holder is stale (${err instanceof Error ? err.message : String(err)})`);
|
|
18539
18609
|
}
|
|
18540
|
-
}, COMPARTMENT_LEASE_RENEWAL_MS);
|
|
18610
|
+
}, COMPARTMENT_LEASE_RENEWAL_MS));
|
|
18541
18611
|
}
|
|
18542
18612
|
function startCompartmentAgent(deps, runAgent = runCompartmentAgent, prepareBoundary) {
|
|
18543
18613
|
withoutSqliteTransformPass2(() => startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary));
|
|
@@ -18798,4 +18868,4 @@ ${failure}`;
|
|
|
18798
18868
|
}
|
|
18799
18869
|
}
|
|
18800
18870
|
|
|
18801
|
-
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, embedPauseBySession, embedRunStateBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|
|
18871
|
+
export { historianRunConfig, dreamerRunConfig, pluginConfigReader, currentPluginConfigReader, withLiveDreamerOutputCap, embedPauseBySession, embedRunStateBySession, invalidateAutoEmbedSession, getEmbedDrainUiStatus, COMPARTMENT_LEASE_RENEWAL_MS, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, queueM0Mutation, getMaxM0MutationId, getCompartments, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, getUncoveredCompartmentEndsThrough, providerResponseFailed, isSuccessfulProviderCompletion, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, gaDatabasePath, RAW_MESSAGE_TYPES, V2StoreReaderPool, V2StoreReader, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, clearPendingMaterialization, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, queueMemoryMutation, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, readCoordinateGeneration, rebaseSessionCoordinatesAsync, HiddenCompletionRefusal, getOpenCodeDbPath, compareOpenCodeMessagesByCanonicalOrder, prepareCompactionMarkerCandidates, removeMcOwnedCompactionMarkers, getCompartmentEvents, USER_MEMORY_CANDIDATE_TTL_MS, insertUserMemoryCandidates, getUserMemoryCandidates, deleteUserMemoryCandidates, pruneExpiredUserMemoryCandidates, insertUserMemory, getActiveUserMemories, updateUserMemoryContent, dismissUserMemory, DreamerProviderOutputFailureError, withDreamerModelCooldown, providerOutputFailureFromInvalidManifest, DREAMER_AGENT, DREAMER_RETROSPECTIVE_AGENT, DREAMER_PRIMER_INVESTIGATOR_AGENT, DREAMER_MEMORY_MAPPER_AGENT, DREAMER_CLASSIFIER_AGENT, DREAMER_DOCS_AGENT, DREAMER_REVIEWER_AGENT, HIDDEN_HISTORIAN_AGENT, HIDDEN_DREAMER_AGENT, HIDDEN_CURATE_AGENT, hiddenAgentFor, hiddenToolLoop, hiddenChildPermissions, registerHiddenChildAgents, hiddenToolCallRefusal, HiddenAgentStepLimit, HiddenChildHook, extractLatestAssistantText, hasLengthCappedOutput, parseProviderModel, modelBodyField, toModelEntry, isPromptTimeoutError, getPromptFailureDetail, promptSyncWithValidatedOutputRetry, normalizeSDKResponse, failedInvocationStatus, recordChildInvocation, createPromptAsyncTransport, CTX_NOTE_LIGHT_DESCRIPTION, ACTIVE_TOOL_IDS, promptSurfaceHashMaterial, createPromptSurfaceRuntime, createPromptSurfaceGuidanceEpochCache, MARKER_SUMMARY_TEXT, markerUpdateDefinitelyDidNotCut, applyDeferredCompactionMarker, teardownChildSession, runTokenLog, formatRunTokenLog, createChildSessionWithFence, buildMagicContextSection, getMuralIdentity, getMural, modelKeyAcceptsImages, resolveMuralWire, extractM0Block, formatDate, TEMPORAL_MARKER_REPLAY_PATTERN, collectTemporalCandidates, injectTemporalMarkers, clearInjectionCache, getVisibleMemoryIds, selectHiddenMessagesAtCompactionSeam, prepareCompartmentInjection, renderCompartmentInjection, MaterializeContentionError, mustMaterialize, trimMemoriesToBudgetV2, renderMemoryBlockV2, materializeM0, hydrateCachedM0Mural, resetPrefixTrimFallbackState, findHostCompactionWindow, capturePrefixTrimSourceOrder, prepareCachedM0M1Replay, hasCompleteCachedM0M1, injectM0M1, clampProducerAtomChars, producerInputTokenLimit, historianProducerReserve, producerPromptFailureReason, resolveHiddenCompletionExecutor, createV1HiddenCompletionExecutor, EMPTY_READ_REPLY, noteTouchedAt, renderGlance, renderNotesById, formatWriteReply, observeNoteNudgeServe, onNoteTrigger, peekNoteNudgeText, markNoteNudgeDelivered, clearNoteNudgeTriggerAndCooldown, describeBoundaryDiagnostics, RECOVERY_NO_HEAD_LIMIT, deriveProtectedTailTokenTarget, selectPerRunCap, resolveOpenCodeProtectedTailBoundary, resolveWrapupProtectedTailBoundary, getRawHistoryEligibility, hasRunnableCompartmentWindow, recordHighPressureNoEligibleHead, runCompartmentAgent, getActiveCompartmentRun, markActiveCompartmentRunPublished, registerActiveCompartmentRun, startCompartmentAgent, isRecompFailure2, isRecompSkip2, extractRecompReason2, setRecompStarting2, setRecompNote2, setRecompTerminal2, buildRecompDeps2, runManagedRecomp2 };
|