@cortexkit/opencode-magic-context 0.49.11 → 0.49.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts +28 -0
- package/dist/agents/smart-notes-dreamer-gate.fixture.d.ts.map +1 -0
- package/dist/{announcement-hdbkt8v5.js → announcement-g789dmt6.js} +2 -2
- package/dist/auto-search-worker.js +4 -4
- package/dist/chunk-embedding-write-worker.js +89 -0
- package/dist/{compaction-marker-candidates-xxz35vwp.js → compaction-marker-candidates-v5c6997n.js} +3 -3
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/config/agent-disable.d.ts +14 -0
- package/dist/config/agent-disable.d.ts.map +1 -1
- package/dist/config/dependency-notes.d.ts +34 -0
- package/dist/config/dependency-notes.d.ts.map +1 -0
- package/dist/config/schema/agent-overrides.d.ts +12 -12
- package/dist/config/schema/magic-context.d.ts +88 -88
- package/dist/config/schema/magic-context.d.ts.map +1 -1
- package/dist/{conflict-warning-hook-xwkfncav.js → conflict-warning-hook-mgq17yr3.js} +8 -8
- package/dist/{context-twz3s0cg.js → context-azqk0vfd.js} +121 -145
- package/dist/{derive-budgets-3nbxsyss.js → derive-budgets-zn7yzd2d.js} +3 -3
- package/dist/embedding-backfill-5e1t5wha.js +22 -0
- package/dist/embedding-worker-process.js +2 -2
- package/dist/embedding-worker.js +6 -6
- package/dist/features/magic-context/chunk-embedding-write-worker.d.ts +2 -0
- package/dist/features/magic-context/chunk-embedding-write-worker.d.ts.map +1 -0
- package/dist/features/magic-context/chunk-embedding-writer.d.ts +48 -0
- package/dist/features/magic-context/chunk-embedding-writer.d.ts.map +1 -0
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts +1 -1
- package/dist/features/magic-context/compartment-chunk-embedding.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts +3 -2
- package/dist/features/magic-context/dreamer/hidden-single-shot.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts +8 -1
- package/dist/features/magic-context/dreamer/map-memories.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts +2 -0
- package/dist/features/magic-context/dreamer/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts +5 -0
- package/dist/features/magic-context/dreamer/storage-dream-runs.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-config.d.ts +22 -4
- package/dist/features/magic-context/dreamer/task-config.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-registry.d.ts +22 -0
- package/dist/features/magic-context/dreamer/task-registry.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts +4 -1
- package/dist/features/magic-context/dreamer/task-scheduler.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts +6 -1
- package/dist/features/magic-context/dreamer/verify-prompt.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify.d.ts +25 -11
- package/dist/features/magic-context/dreamer/verify.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts +32 -0
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity.d.ts +1 -0
- package/dist/features/magic-context/memory/project-identity.d.ts.map +1 -1
- package/dist/features/magic-context/memory/unborn-head.d.ts +34 -0
- package/dist/features/magic-context/memory/unborn-head.d.ts.map +1 -0
- package/dist/features/magic-context/mural/compress-cues.d.ts +3 -0
- package/dist/features/magic-context/mural/compress-cues.d.ts.map +1 -1
- package/dist/features/magic-context/project-embedding-registry.d.ts +5 -0
- package/dist/features/magic-context/project-embedding-registry.d.ts.map +1 -1
- package/dist/features/magic-context/storage-tags.d.ts +2 -0
- package/dist/features/magic-context/storage-tags.d.ts.map +1 -1
- package/dist/{history-owner-ty29fz0f.js → history-owner-xp3pngv7.js} +3 -3
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-embed-session.d.ts +10 -0
- package/dist/hooks/magic-context/auto-embed-session.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts +6 -0
- package/dist/hooks/magic-context/compartment-prompt.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts +3 -0
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger-error.d.ts +12 -0
- package/dist/hooks/magic-context/compartment-trigger-error.d.ts.map +1 -0
- package/dist/hooks/magic-context/embed-session-state.d.ts +8 -1
- package/dist/hooks/magic-context/embed-session-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts +2 -0
- package/dist/hooks/magic-context/historian-prompt-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +3 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/pending-materialization.d.ts +2 -0
- package/dist/hooks/magic-context/pending-materialization.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +12 -0
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-exact-ordinal-read.d.ts +58 -0
- package/dist/hooks/magic-context/raw-exact-ordinal-read.d.ts.map +1 -0
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +7 -0
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +19 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts +2 -0
- package/dist/hooks/magic-context/recomp-orchestrator.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +2 -0
- package/dist/hooks/magic-context/transform-compartment-phase.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 +4 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/hooks/magic-context/wrapup-orchestrator.d.ts.map +1 -1
- package/dist/{index-bzp9s8z2.js → index-1d289pq2.js} +2 -2
- package/dist/{index-w28y7d0z.js → index-1sarmj9z.js} +15 -15
- package/dist/{index-z7avx6rw.js → index-2jr1smmh.js} +280 -160
- package/dist/{index-4ccdr7yw.js → index-3kdm78zp.js} +5 -5
- package/dist/{index-9159kk15.js → index-3kx0kg0f.js} +64 -7
- package/dist/{index-0jz47061.js → index-a8bvhwqs.js} +190 -30
- package/dist/{index-84j7jq8a.js → index-aw1bh90w.js} +10 -10
- package/dist/{index-qr1mkc2y.js → index-b16gpywn.js} +9 -9
- package/dist/{index-g7jkrz0x.js → index-bp5083x2.js} +1 -1
- package/dist/{index-yhrrx7qa.js → index-bxdg2nbt.js} +3 -3
- package/dist/{index-0abg88h2.js → index-dgs16axy.js} +4 -4
- package/dist/{index-mp2kghkv.js → index-dyvbsvga.js} +1 -1
- package/dist/{index-bmwfzz28.js → index-e20m7284.js} +4 -4
- package/dist/{index-4jkhhpn1.js → index-e4dsjj1p.js} +3 -3
- package/dist/{index-s178h9z8.js → index-f71thw8j.js} +1 -1
- package/dist/{index-kvw6xew3.js → index-fkx2qnvw.js} +2 -2
- package/dist/{index-f8cn4xqa.js → index-fwefky9w.js} +18 -5
- package/dist/{index-0sahzkwr.js → index-g2q4htwp.js} +46 -2
- package/dist/{index-mw7c950g.js → index-gp3kcpc4.js} +1 -1
- package/dist/{index-g40wgxxt.js → index-hnm8raee.js} +4 -4
- package/dist/{index-gjvjh960.js → index-hqkczed7.js} +1 -1
- package/dist/{index-mvvephtj.js → index-j75v2476.js} +1 -1
- package/dist/{index-150zz6fh.js → index-k29z4aqh.js} +1 -1
- package/dist/{index-b64n4d0h.js → index-kee4kn5j.js} +1 -1
- package/dist/index-ksdyrrav.js +52 -0
- package/dist/{index-angx1s0k.js → index-mmfa86mt.js} +16 -6
- package/dist/{index-9jvab89d.js → index-n6m03s3n.js} +2 -2
- package/dist/{index-q28hsbpg.js → index-nj7yykkx.js} +1 -1
- package/dist/{index-ghc9f0n7.js → index-p5y3k4g7.js} +29 -1
- package/dist/{index-xztdf9t7.js → index-qkd9zz0p.js} +17 -17
- package/dist/index-saews2s3.js +229 -0
- package/dist/{index-kkvxnbt8.js → index-sj89f3b0.js} +62 -33
- package/dist/{index-jw4gbfkv.js → index-v10f1rjv.js} +5 -5
- package/dist/{index-0j6crjgh.js → index-v13skev1.js} +13 -13
- package/dist/{index-hqnggmxn.js → index-wj6ht7nm.js} +547 -179
- package/dist/{index-a865mj02.js → index-wk0n1cgt.js} +4 -4
- package/dist/{index-q3qck7j2.js → index-wz6mzzb1.js} +6 -5
- package/dist/{index-se1w3v2m.js → index-y1qysm3q.js} +332 -256
- package/dist/{index-a4b0gbyg.js → index-y9f76s3f.js} +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +119 -129
- package/dist/{logger-wn328tfg.js → logger-jm3sqqzr.js} +2 -2
- package/dist/{message-index-bounded-0rbbg9rd.js → message-index-bounded-vm64mqpq.js} +16 -16
- package/dist/{message-index-ct5x2kwa.js → message-index-seaqpb7c.js} +16 -16
- package/dist/{message-time-backfill-nb5hhnrt.js → message-time-backfill-qjge9044.js} +3 -3
- package/dist/migration-worker.js +11 -11
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/plugin/tool-registry.d.ts.map +1 -1
- package/dist/{project-embedding-registry-ft9gh2e2.js → project-embedding-registry-x45bv3qr.js} +12 -11
- package/dist/raw-ordinal-warmup-worker.js +12 -7
- package/dist/{read-session-chunk-y3hhsbzw.js → read-session-chunk-ax05f7gr.js} +11 -11
- package/dist/{read-session-raw-gm6xj30v.js → read-session-raw-m56hc7v2.js} +7 -3
- package/dist/recomp-orchestrator-dmbeadwt.js +61 -0
- package/dist/{safe-notification-target-jdynm677.js → safe-notification-target-1szv1k5k.js} +3 -3
- package/dist/{search-jd8xh721.js → search-5yd5ytzs.js} +25 -24
- package/dist/{send-session-notification-vzhj8bsg.js → send-session-notification-24r4esbh.js} +6 -6
- package/dist/shared/data-path.d.ts +4 -0
- package/dist/shared/data-path.d.ts.map +1 -1
- package/dist/shared/model-suggestion-retry.d.ts +2 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/prompt-async-transport.d.ts.map +1 -1
- package/dist/{storage-tags-35m4gms2.js → storage-tags-yygfb9c8.js} +7 -5
- package/dist/{task-config-cgpg0nvh.js → task-config-x3qmayd2.js} +6 -2
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/{transform-postprocess-phase-pmqxfq4q.js → transform-postprocess-phase-72v86syx.js} +32 -31
- package/dist/v2/auto-search-worker.js +4 -4
- package/dist/v2/chunk-embedding-write-worker.js +88 -0
- package/dist/v2/{compaction-marker-candidates-a15w3mqh.js → compaction-marker-candidates-1vqwr3s5.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{context-p1zfcw41.js → context-w055w17c.js} +628 -255
- package/dist/v2/{derive-budgets-0rmpmxjw.js → derive-budgets-2zh4gm2c.js} +3 -3
- package/dist/v2/embedding-backfill-jmaf8zrr.js +21 -0
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +5 -5
- package/dist/v2/{history-owner-2cr9py37.js → history-owner-42e16w0n.js} +2 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-manual.d.ts.map +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/transform-features.d.ts +3 -2
- package/dist/v2/hooks/transform-features.d.ts.map +1 -1
- package/dist/v2/{logger-te6e1j72.js → logger-7qt02bnb.js} +1 -1
- package/dist/v2/{message-index-bounded-7wcbp975.js → message-index-bounded-wepg5723.js} +15 -15
- package/dist/v2/{message-index-cjhv92m2.js → message-index-gcmd0ng0.js} +15 -15
- package/dist/v2/{message-time-backfill-rz1pnpaj.js → message-time-backfill-bsteyc4d.js} +2 -2
- package/dist/v2/migration-worker.js +10 -10
- package/dist/v2/{project-embedding-registry-g34gcf74.js → project-embedding-registry-0msp56p8.js} +11 -10
- package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
- package/dist/v2/{read-session-chunk-8d3v87vr.js → read-session-chunk-hr3w5bjk.js} +10 -10
- package/dist/v2/{read-session-raw-h4azh85b.js → read-session-raw-b3tf6ra1.js} +6 -2
- package/dist/v2/recomp-orchestrator-ca7qt75a.js +60 -0
- package/dist/v2/retrospective-raw-provider.d.ts.map +1 -1
- package/dist/v2/{safe-notification-target-936374xx.js → safe-notification-target-qg7n2s77.js} +2 -2
- package/dist/v2/{search-a1acjwf8.js → search-c86dcv14.js} +24 -23
- package/dist/v2/{send-session-notification-z5mcjdea.js → send-session-notification-8ghn9tnv.js} +5 -5
- package/dist/v2/{server-npm52h2q.js → server-05xjtq6c.js} +1 -1
- package/dist/v2/{server-s6jqh8bj.js → server-0ppsweh6.js} +1 -1
- package/dist/v2/server-0s95v3en.js +49 -0
- package/dist/v2/{server-hn9fb3v0.js → server-34kwfsr4.js} +2 -2
- package/dist/v2/server-4gn3z5an.js +229 -0
- package/dist/v2/{server-kn7skz9r.js → server-6cdy4rc0.js} +3 -3
- package/dist/v2/{server-7dv9wt9r.js → server-6pmqg9m4.js} +1 -1
- package/dist/v2/{server-7fvmt15t.js → server-b81w6sw3.js} +273 -107
- package/dist/v2/{server-kmapq3v0.js → server-bxpwy6fy.js} +18 -5
- package/dist/v2/{server-d6t16r89.js → server-d8tj10db.js} +1 -1
- package/dist/v2/{server-cxsr0ng6.js → server-da07v4xp.js} +1 -1
- package/dist/v2/{server-rxcq4t50.js → server-ef89gdsx.js} +5 -5
- package/dist/v2/{server-9e5r8y60.js → server-f2xf5gcb.js} +46 -2
- package/dist/v2/{server-83d71zab.js → server-g10mdym6.js} +3 -3
- package/dist/v2/{server-njnx39q2.js → server-gvkm8xaj.js} +189 -29
- package/dist/v2/{server-ckrb5rm8.js → server-h0410h0v.js} +1 -1
- package/dist/v2/{server-sg68np13.js → server-hek6z3w6.js} +330 -254
- package/dist/v2/{server-f27he3j1.js → server-k2bzedxk.js} +4 -4
- package/dist/v2/{server-wkhfyzpg.js → server-m97brnat.js} +9 -9
- package/dist/v2/{server-erfp0xb6.js → server-n8ch9683.js} +16 -16
- package/dist/v2/{server-bx59ezg6.js → server-prg55b7k.js} +16 -6
- package/dist/v2/{server-89fcbe37.js → server-pwv4ezb0.js} +1 -1
- package/dist/v2/{server-r5p3b1wy.js → server-qd11g795.js} +29 -1
- package/dist/v2/{server-ewqshbs8.js → server-qhfvvfxj.js} +64 -7
- package/dist/v2/{server-988cqjme.js → server-rrqpvwqd.js} +2 -2
- package/dist/v2/{server-d3f4g62c.js → server-t4prcjc1.js} +13 -13
- package/dist/v2/{server-nveratm5.js → server-tbe1femw.js} +4 -4
- package/dist/v2/{server-jc8v585p.js → server-th4y11y7.js} +15 -15
- package/dist/v2/{server-h3wc20sv.js → server-vbe4se57.js} +4 -4
- package/dist/v2/{server-pbpp8r8h.js → server-xh7jar6k.js} +9 -9
- package/dist/v2/{server-63ha7f0f.js → server-yrvqaswb.js} +1 -1
- package/dist/v2/{server-5x7kmyz8.js → server-zc3e54vy.js} +10 -51
- package/dist/v2/{server-xqf2d2mg.js → server-zs8d0s3b.js} +2 -2
- package/dist/v2/server.d.ts.map +1 -1
- package/dist/v2/server.js +18 -10
- package/dist/v2/{storage-tags-c4zfcxv4.js → storage-tags-a2gq6dw7.js} +6 -4
- package/dist/v2/store-reader.d.ts +1 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{task-config-x0hq3qfd.js → task-config-nvz8mapa.js} +6 -2
- package/dist/v2/{wrapup-orchestrator-87q9d5e2.js → wrapup-orchestrator-e1a2w6jh.js} +31 -29
- package/dist/wrapup-orchestrator-2051r6qm.js +48 -0
- package/package.json +6 -5
- package/src/agents/smart-notes-dreamer-gate.fixture.ts +171 -0
- package/src/agents/smart-notes-dreamer-gate.golden.json +245 -0
- package/src/agents/smart-notes-dreamer-gate.test.ts +161 -0
- package/src/config/agent-disable.ts +13 -0
- package/src/config/dependency-notes.test.ts +114 -0
- package/src/config/dependency-notes.ts +80 -0
- package/src/config/schema/magic-context.ts +23 -14
- package/src/features/magic-context/dreamer/task-registry.ts +40 -0
- package/src/shared/data-path.test.ts +35 -1
- package/src/shared/data-path.ts +57 -1
- package/src/shared/model-suggestion-retry.test.ts +34 -0
- package/src/shared/model-suggestion-retry.ts +23 -3
- package/src/shared/prompt-async-transport.test.ts +1 -1
- package/src/shared/prompt-async-transport.ts +16 -3
- package/dist/embedding-backfill-fjbfh1dt.js +0 -21
- package/dist/recomp-orchestrator-67k45s0b.js +0 -60
- package/dist/v2/embedding-backfill-xcw3t6hp.js +0 -20
- package/dist/v2/recomp-orchestrator-n0pq36f0.js +0 -59
- package/dist/wrapup-orchestrator-jqapepw0.js +0 -47
- /package/dist/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
- /package/dist/v2/{index-e6xnpach.js → index-b7p25tm0.js} +0 -0
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
} from "./server-fr0wbhdn.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-f2xf5gcb.js";
|
|
7
7
|
import {
|
|
8
8
|
ensureColumn,
|
|
9
9
|
healAllNullColumns,
|
|
10
10
|
installV95PerfSchema
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-pwv4ezb0.js";
|
|
12
12
|
import {
|
|
13
13
|
resolveOpenCodeDbPath,
|
|
14
14
|
openCodeDbPathExists,
|
|
@@ -20,10 +20,10 @@ import {
|
|
|
20
20
|
import {
|
|
21
21
|
normalizeStoredProjectPath,
|
|
22
22
|
storedPathBelongsToIdentity
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-gvkm8xaj.js";
|
|
24
24
|
import {
|
|
25
25
|
logSlowWriteTransaction
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-6pmqg9m4.js";
|
|
27
27
|
|
|
28
28
|
// src/features/magic-context/migrations.ts
|
|
29
29
|
import { isMainThread } from "node:worker_threads";
|
|
@@ -23,7 +23,7 @@ import {
|
|
|
23
23
|
TAG_SELECT_COLUMNS2,
|
|
24
24
|
getCandidateToolOwners2,
|
|
25
25
|
pickNearestPriorOwner2
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-bxpwy6fy.js";
|
|
27
27
|
import {
|
|
28
28
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
29
29
|
isSystemDirective,
|
|
@@ -40,18 +40,18 @@ import {
|
|
|
40
40
|
formatBlock,
|
|
41
41
|
compactTextForSummary,
|
|
42
42
|
mergeCommitHashes
|
|
43
|
-
} from "./server-
|
|
43
|
+
} from "./server-0ppsweh6.js";
|
|
44
44
|
import {
|
|
45
45
|
sessionLog2
|
|
46
|
-
} from "./server-
|
|
46
|
+
} from "./server-f2xf5gcb.js";
|
|
47
47
|
import {
|
|
48
48
|
stableStringify
|
|
49
|
-
} from "./server-
|
|
49
|
+
} from "./server-pwv4ezb0.js";
|
|
50
50
|
import {
|
|
51
51
|
renderToolTemplate,
|
|
52
52
|
resolveModelConfigValue,
|
|
53
53
|
deriveDefaultProtectedTokens
|
|
54
|
-
} from "./server-
|
|
54
|
+
} from "./server-th4y11y7.js";
|
|
55
55
|
import {
|
|
56
56
|
readRawSessionMessagesFromDb2,
|
|
57
57
|
readRawSessionMessagePageFromDb2,
|
|
@@ -68,25 +68,25 @@ import {
|
|
|
68
68
|
readRawSeedTailFromDb2,
|
|
69
69
|
readRawSessionBoundaryEndpointsFromDb2,
|
|
70
70
|
prewarmRawSessionOrdinalsForDb
|
|
71
|
-
} from "./server-
|
|
71
|
+
} from "./server-prg55b7k.js";
|
|
72
72
|
import {
|
|
73
73
|
openCodeDbExists,
|
|
74
74
|
withReadOnlySessionDb,
|
|
75
75
|
getRawSessionMessageCountFromDb,
|
|
76
76
|
getMessageTimesFromOpenCodeDb
|
|
77
|
-
} from "./server-
|
|
77
|
+
} from "./server-d8tj10db.js";
|
|
78
78
|
import {
|
|
79
79
|
getToolDefinitionMeasurementSignature,
|
|
80
80
|
getLargestMeasuredToolDefinitionTokens,
|
|
81
81
|
getMeasuredToolDefinitionTokens
|
|
82
|
-
} from "./server-
|
|
82
|
+
} from "./server-zs8d0s3b.js";
|
|
83
83
|
import {
|
|
84
84
|
canonicalModelIdentity,
|
|
85
85
|
piModelRefToCanonical
|
|
86
86
|
} from "./server-avwt563y.js";
|
|
87
87
|
import {
|
|
88
88
|
logSlowWriteTransaction
|
|
89
|
-
} from "./server-
|
|
89
|
+
} from "./server-6pmqg9m4.js";
|
|
90
90
|
|
|
91
91
|
// src/features/magic-context/overflow-detection.ts
|
|
92
92
|
var OVERFLOW_PATTERNS = [
|
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
import {
|
|
13
13
|
bootQuietRemainingMs,
|
|
14
14
|
scheduleAfterBootQuiet
|
|
15
|
-
} from "./server-
|
|
15
|
+
} from "./server-gvkm8xaj.js";
|
|
16
16
|
import {
|
|
17
17
|
getHarness2,
|
|
18
18
|
harnessOwnsOpenCodeStore2
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
importPluginModule,
|
|
25
25
|
writeForwardedLogLine2,
|
|
26
26
|
log2
|
|
27
|
-
} from "./server-
|
|
27
|
+
} from "./server-f2xf5gcb.js";
|
|
28
28
|
import {
|
|
29
29
|
isOwnRpcServerRecord,
|
|
30
30
|
isPidAlive,
|
|
@@ -35,13 +35,13 @@ import {
|
|
|
35
35
|
parseRpcPortFile,
|
|
36
36
|
inspectProcessesAsync,
|
|
37
37
|
inspectWindowsProcessesSync
|
|
38
|
-
} from "./server-
|
|
38
|
+
} from "./server-da07v4xp.js";
|
|
39
39
|
import {
|
|
40
40
|
configureContextDatabasePragmas2
|
|
41
41
|
} from "./server-fb3zxn06.js";
|
|
42
42
|
import {
|
|
43
43
|
startMessageFtsRowidMapBackfill
|
|
44
|
-
} from "./server-
|
|
44
|
+
} from "./server-yrvqaswb.js";
|
|
45
45
|
import {
|
|
46
46
|
LKG_SLOT_CHUNKS_DDL,
|
|
47
47
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -51,12 +51,12 @@ import {
|
|
|
51
51
|
hasPendingMigrations,
|
|
52
52
|
getMainThreadMigrationBodyCount,
|
|
53
53
|
runMigrations
|
|
54
|
-
} from "./server-
|
|
54
|
+
} from "./server-k2bzedxk.js";
|
|
55
55
|
import {
|
|
56
56
|
ensureColumn,
|
|
57
57
|
installV95PerfSchema,
|
|
58
58
|
installTagIdentityRevisionTrigger
|
|
59
|
-
} from "./server-
|
|
59
|
+
} from "./server-pwv4ezb0.js";
|
|
60
60
|
import {
|
|
61
61
|
resolveOpenCodeDbPath,
|
|
62
62
|
hasV1MessageTables
|
|
@@ -64,10 +64,16 @@ import {
|
|
|
64
64
|
import {
|
|
65
65
|
setDatabase,
|
|
66
66
|
loadToolDefinitionMeasurements
|
|
67
|
-
} from "./server-
|
|
67
|
+
} from "./server-zs8d0s3b.js";
|
|
68
68
|
import {
|
|
69
69
|
getErrorMessage
|
|
70
70
|
} from "./server-y8v6yerm.js";
|
|
71
|
+
import {
|
|
72
|
+
closeQuietly
|
|
73
|
+
} from "./server-8ajstryz.js";
|
|
74
|
+
import {
|
|
75
|
+
logSlowWriteTransaction
|
|
76
|
+
} from "./server-6pmqg9m4.js";
|
|
71
77
|
import {
|
|
72
78
|
shouldEnforcePrivateStoragePermissions,
|
|
73
79
|
ensureStorageDirectorySync,
|
|
@@ -76,12 +82,6 @@ import {
|
|
|
76
82
|
copyStorageTreeSync,
|
|
77
83
|
tightenStorageTreeSync
|
|
78
84
|
} from "./server-fvnzcnww.js";
|
|
79
|
-
import {
|
|
80
|
-
closeQuietly
|
|
81
|
-
} from "./server-8ajstryz.js";
|
|
82
|
-
import {
|
|
83
|
-
logSlowWriteTransaction
|
|
84
|
-
} from "./server-7dv9wt9r.js";
|
|
85
85
|
|
|
86
86
|
// src/features/magic-context/storage-db.ts
|
|
87
87
|
import {
|
|
@@ -1212,8 +1212,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1212
1212
|
startMessageFtsRowidMapBackfill(db).then(async () => {
|
|
1213
1213
|
if (!readsOpenCodeStore)
|
|
1214
1214
|
return;
|
|
1215
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1216
|
-
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-
|
|
1215
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-hr3w5bjk.js"));
|
|
1216
|
+
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-bsteyc4d.js"));
|
|
1217
1217
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
1218
1218
|
readPage: readRawSessionMessagePage
|
|
1219
1219
|
}));
|
|
@@ -2704,4 +2704,4 @@ function getDatabasePersistenceError(db) {
|
|
|
2704
2704
|
return persistenceErrorByDatabase.get(db) ?? null;
|
|
2705
2705
|
}
|
|
2706
2706
|
|
|
2707
|
-
export { FAIL_CLOSED_DOCTOR_COMMAND, formatFailClosedBlockingMessage, formatFailClosedBlockingSummary, createFailClosedBlockingError, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getDatabasePath, getPersistedSchemaVersion, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
|
|
2707
|
+
export { FAIL_CLOSED_DOCTOR_COMMAND, formatFailClosedBlockingMessage, formatFailClosedBlockingSummary, createFailClosedBlockingError, isFailClosedBlockingError, shouldBypassFailClosedBlock, resolveAgentNameFromMessages, startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getDatabasePath, getPersistedSchemaVersion, enforceSchemaFence, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./server-51779zs2.js";
|
|
4
4
|
import {
|
|
5
5
|
log2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-f2xf5gcb.js";
|
|
7
7
|
import {
|
|
8
8
|
inRootAsyncContext2,
|
|
9
9
|
getSqliteDatabasePath2,
|
|
@@ -175,7 +175,7 @@ function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWaterma
|
|
|
175
175
|
const skip = anchor === after && after ? 0 : ordinal - (floor?.ordinal ?? 0);
|
|
176
176
|
if (skip > ORDINAL_LOOKUP_LIMIT) {
|
|
177
177
|
prewarmRawSessionOrdinalsForDb(db, sessionId);
|
|
178
|
-
throw new
|
|
178
|
+
throw new RawOrdinalsNotReady2;
|
|
179
179
|
}
|
|
180
180
|
const rawLimit = skip + pageSize + ORDINAL_LOOKUP_LIMIT;
|
|
181
181
|
const rows = db.prepare(`SELECT id, data, time_created, time_updated, ${EXCLUDED_ROW_SQL} AS excluded
|
|
@@ -188,7 +188,7 @@ function readRawMessagePageRows(db, sessionId, afterOrdinal, limit, finalWaterma
|
|
|
188
188
|
const eligible = rows.filter((row) => row.excluded !== 1);
|
|
189
189
|
if (eligible.length <= skip && rows.length === rawLimit) {
|
|
190
190
|
prewarmRawSessionOrdinalsForDb(db, sessionId);
|
|
191
|
-
throw new
|
|
191
|
+
throw new RawOrdinalsNotReady2;
|
|
192
192
|
}
|
|
193
193
|
return eligible.slice(skip, skip + pageSize).filter(isRawMessageRow).map((row, index) => ({
|
|
194
194
|
...row,
|
|
@@ -276,11 +276,13 @@ function countRawSessionMessageOrdinalsFromDb2(db, sessionId) {
|
|
|
276
276
|
)`).get(sessionId);
|
|
277
277
|
return typeof row?.count === "number" ? row.count : 0;
|
|
278
278
|
}
|
|
279
|
+
var exactOrdinalScansOnThisThread = 0;
|
|
279
280
|
function readRawSessionMessageIdOrdinalsForRangeFromDb2(db, sessionId, fromOrdinal, toOrdinal) {
|
|
280
281
|
const from = Math.max(1, Math.floor(fromOrdinal));
|
|
281
282
|
const to = Math.floor(toOrdinal);
|
|
282
283
|
if (to < from)
|
|
283
284
|
return new Map;
|
|
285
|
+
exactOrdinalScansOnThisThread += 1;
|
|
284
286
|
const rows = db.prepare(`
|
|
285
287
|
SELECT id, data FROM message WHERE session_id = ?
|
|
286
288
|
AND CASE WHEN json_valid(data) THEN NOT (
|
|
@@ -296,6 +298,12 @@ function readRawSessionMessageIdOrdinalsForRangeFromDb2(db, sessionId, fromOrdin
|
|
|
296
298
|
}
|
|
297
299
|
return result;
|
|
298
300
|
}
|
|
301
|
+
function readRawSessionMessageIdsAtOrdinalsFromDb2(db, sessionId, ordinals) {
|
|
302
|
+
return withReadSnapshot(db, () => ordinals.map((ordinal) => [
|
|
303
|
+
ordinal,
|
|
304
|
+
readRawSessionMessageIdOrdinalsForRangeFromDb2(db, sessionId, ordinal, ordinal).keys().next().value ?? null
|
|
305
|
+
]));
|
|
306
|
+
}
|
|
299
307
|
function readRawSessionMessageOrdinalPageFromDb2(db, sessionId, after, limit) {
|
|
300
308
|
const pageSize = Math.max(1, Math.floor(limit));
|
|
301
309
|
const rows = (after ? db.prepare(`SELECT id, data, time_created
|
|
@@ -604,7 +612,7 @@ function extendOrdinalCheckpoints(db, sessionId, scan, limit) {
|
|
|
604
612
|
return true;
|
|
605
613
|
}
|
|
606
614
|
|
|
607
|
-
class
|
|
615
|
+
class RawOrdinalsNotReady2 extends Error {
|
|
608
616
|
constructor() {
|
|
609
617
|
super("canonical ordinals are warming off-thread; retry after preparation");
|
|
610
618
|
}
|
|
@@ -653,7 +661,7 @@ function boundedOrdinalPrefix(db, sessionId, through) {
|
|
|
653
661
|
ordinalJsonRowsRead += rows.length;
|
|
654
662
|
if (rows.length > ORDINAL_LOOKUP_LIMIT) {
|
|
655
663
|
prewarmRawSessionOrdinalsForDb(db, sessionId);
|
|
656
|
-
throw new
|
|
664
|
+
throw new RawOrdinalsNotReady2;
|
|
657
665
|
}
|
|
658
666
|
return (floor?.ordinal ?? 0) + rows.reduce((sum, row) => sum + (row.excluded === 1 ? 0 : 1), 0);
|
|
659
667
|
}
|
|
@@ -1193,6 +1201,8 @@ function runSessionWarmupWorker(input, options) {
|
|
|
1193
1201
|
finish({ inserted: reply.inserted, measurements: reply.measurements });
|
|
1194
1202
|
else if (reply.kind === "orphan-sweep")
|
|
1195
1203
|
finish({ orphanSweep: reply.result });
|
|
1204
|
+
else if (reply.kind === "exact-ordinal-ids")
|
|
1205
|
+
finish({ exactOrdinalIds: reply.ids });
|
|
1196
1206
|
else
|
|
1197
1207
|
finish({ failure: "worker-error", detail: reply.error });
|
|
1198
1208
|
});
|
|
@@ -1257,4 +1267,4 @@ function recordFailure(key, sessionId, failure, detail) {
|
|
|
1257
1267
|
log2(`[magic-context] WARN canonical ordinal warm-up failed for ${sessionId} (${failure}: ${detail}); counts remain bounded and callers must defer or retry`);
|
|
1258
1268
|
}
|
|
1259
1269
|
|
|
1260
|
-
export { isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
|
|
1270
|
+
export { isStrictGapHealingMessage2, isRawCompactionSummaryInfo2, readRawSessionMessagesFromDb2, readRawSessionMessagePageFromDb2, readRawSessionMessageSummaryPageFromDb2, countRawSessionMessageOrdinalsFromDb2, readRawSessionMessageIdOrdinalsForRangeFromDb2, readRawSessionMessageIdsAtOrdinalsFromDb2, readRawSessionMessageOrdinalPageFromDb2, countStoredRawSessionMessagesFromDb2, readRawSessionTailFromDb2, extractInMemoryMessageViews2, buildInMemoryTailRawMessages2, readRawSessionMessagePartsByIdFromDb2, forgetRawSessionOrdinalWatermark2, forgetRawSessionSummaryRows2, noteRawSessionSummaryRowWritten2, RawOrdinalsNotReady2, rawOrdinalSummarySeed2, scanRawSessionSummaryRows2, getRawSessionSummaryEpoch2, installRawSessionSummaryScan2, isRawSessionSummaryWarm2, readRawSessionMessageOrdinalByIdFromDb2, readRawSessionMessageByIdFromDb2, hasRawSessionMessageByIdFromDb2, readRawSeedTailFromDb2, readRawSessionBoundaryEndpointsFromDb2, runSessionWarmupWorker, prewarmRawSessionOrdinalsForDb };
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
resolveDreamerTaskModel2
|
|
3
3
|
} from "./server-8cd2j99z.js";
|
|
4
|
+
import {
|
|
5
|
+
isDreamerRunnable
|
|
6
|
+
} from "./server-0s95v3en.js";
|
|
4
7
|
|
|
5
8
|
// src/features/magic-context/dreamer/task-registry.ts
|
|
6
9
|
var CANONICAL_DREAM_TASKS = [
|
|
@@ -106,6 +109,25 @@ var MEMORY_DOMAIN_TASKS = [
|
|
|
106
109
|
"refresh-primers"
|
|
107
110
|
];
|
|
108
111
|
var MEMORY_DOMAIN_SET = new Set(MEMORY_DOMAIN_TASKS);
|
|
112
|
+
var PROJECT_MEMORY_DREAM_TASKS = [
|
|
113
|
+
"map-memories",
|
|
114
|
+
"verify",
|
|
115
|
+
"verify-broad",
|
|
116
|
+
"curate",
|
|
117
|
+
"compress-cues",
|
|
118
|
+
"classify-memories",
|
|
119
|
+
"retrospective",
|
|
120
|
+
"promote-primers",
|
|
121
|
+
"refresh-primers"
|
|
122
|
+
];
|
|
123
|
+
var PROJECT_MEMORY_DREAM_TASK_SET = new Set(PROJECT_MEMORY_DREAM_TASKS);
|
|
124
|
+
function dreamTaskAllowedBySettings(task, settings) {
|
|
125
|
+
if (PROJECT_MEMORY_DREAM_TASK_SET.has(task))
|
|
126
|
+
return settings.projectMemoryEnabled !== false;
|
|
127
|
+
if (task === "evaluate-smart-notes")
|
|
128
|
+
return settings.smartNotesEnabled !== false;
|
|
129
|
+
return true;
|
|
130
|
+
}
|
|
109
131
|
function leaseKindFor(task) {
|
|
110
132
|
if (MEMORY_DOMAIN_SET.has(task))
|
|
111
133
|
return "memory";
|
|
@@ -161,6 +183,12 @@ function userMemoryCollectionEnabled2(dreamer) {
|
|
|
161
183
|
const schedule = dreamer?.tasks?.["review-user-memories"]?.schedule;
|
|
162
184
|
return typeof schedule === "string" && schedule.trim() !== "";
|
|
163
185
|
}
|
|
186
|
+
function userObservationCollectionEnabled2(dreamer) {
|
|
187
|
+
return userObservationsRequested2(dreamer) && userMemoryCollectionEnabled2(dreamer);
|
|
188
|
+
}
|
|
189
|
+
function userObservationsRequested2(dreamer) {
|
|
190
|
+
return isDreamerRunnable({ dreamer });
|
|
191
|
+
}
|
|
164
192
|
function userMemoryPromotionThreshold2(dreamer) {
|
|
165
193
|
return dreamer?.tasks?.["review-user-memories"]?.promotion_threshold ?? 3;
|
|
166
194
|
}
|
|
@@ -180,4 +208,4 @@ function summarizeDreamSchedule2(dreamer, smartNotesEnabled = true) {
|
|
|
180
208
|
return enabled.map((t) => `${t} ${dreamer?.tasks[t]?.schedule}`).join(", ");
|
|
181
209
|
}
|
|
182
210
|
|
|
183
|
-
export { CANONICAL_DREAM_TASKS, DREAM_TASK_CAPABILITIES, toolLoopDreamTasks, formatUnsupportedDreamTasks, formatDreamTaskBacklogs, processedDreamTaskItems, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2, userMemoryPromotionThreshold2, dreamTaskScheduled2, enabledDreamTasks2, summarizeDreamSchedule2 };
|
|
211
|
+
export { CANONICAL_DREAM_TASKS, DREAM_TASK_CAPABILITIES, toolLoopDreamTasks, formatUnsupportedDreamTasks, formatDreamTaskBacklogs, processedDreamTaskItems, PROJECT_MEMORY_DREAM_TASKS, dreamTaskAllowedBySettings, leaseKindFor, leaseKeyFor, isCanonicalDreamTask, compareTaskOrder, buildDreamTaskRuntimeConfigs2, userMemoryCollectionEnabled2, userObservationCollectionEnabled2, userObservationsRequested2, userMemoryPromotionThreshold2, dreamTaskScheduled2, enabledDreamTasks2, summarizeDreamSchedule2 };
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getTokenEstimatorFingerprint,
|
|
3
3
|
estimateTokens
|
|
4
|
-
} from "./server-
|
|
4
|
+
} from "./server-0ppsweh6.js";
|
|
5
5
|
import {
|
|
6
6
|
getHarness2
|
|
7
7
|
} from "./server-pavzsdc6.js";
|
|
8
8
|
import {
|
|
9
9
|
log2
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-f2xf5gcb.js";
|
|
11
11
|
import {
|
|
12
12
|
isSynapseEmbeddingTruncated
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-rrqpvwqd.js";
|
|
14
14
|
import {
|
|
15
15
|
messageFtsOrdinalRangeIsMapped
|
|
16
|
-
} from "./server-
|
|
16
|
+
} from "./server-yrvqaswb.js";
|
|
17
17
|
|
|
18
18
|
// src/features/magic-context/compartment-chunk-embedding.ts
|
|
19
19
|
import { createHash } from "node:crypto";
|
|
@@ -858,13 +858,17 @@ function loadUnembeddedShadowChunkCandidates(db, projectPath, primaryModelId, sh
|
|
|
858
858
|
const rows = getShadowBackfillCandidateStatement(db).all(projectPath, projectPath, primaryModelId);
|
|
859
859
|
return selectHashIncompleteChunkCandidates(db, projectPath, shadowModelId, mapBackfillCandidateRows(rows), Math.max(1, limit), shadowMaxInputTokens);
|
|
860
860
|
}
|
|
861
|
-
async function loadUnembeddedCompartmentChunkCandidatesPolite(db, projectPath, modelId, limit, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS, leaseHeldRenumber = false) {
|
|
861
|
+
async function loadUnembeddedCompartmentChunkCandidatesPolite(db, projectPath, modelId, limit, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS, leaseHeldRenumber = false, isEligible) {
|
|
862
862
|
const rows = getBackfillCandidateStatement(db).all(projectPath);
|
|
863
863
|
const candidates = mapBackfillCandidateRows(rows);
|
|
864
864
|
const missing = [];
|
|
865
865
|
const stale = [];
|
|
866
866
|
let sliceStarted = performance.now();
|
|
867
867
|
for (const candidate of candidates) {
|
|
868
|
+
if (isEligible && !isEligible(candidate)) {
|
|
869
|
+
sliceStarted = await yieldCoverageSlice(sliceStarted);
|
|
870
|
+
continue;
|
|
871
|
+
}
|
|
868
872
|
const classification = classifyChunkCoverageDefect(db, projectPath, modelId, candidate, maxInputTokens);
|
|
869
873
|
if (classification.defect === "missing")
|
|
870
874
|
missing.push(candidate);
|
|
@@ -1019,7 +1023,7 @@ function memoizedCoverageWindows(candidate, canonicalText, sourceKey, modelId, m
|
|
|
1019
1023
|
return windows;
|
|
1020
1024
|
}
|
|
1021
1025
|
async function yieldCoverageSlice(started) {
|
|
1022
|
-
if (performance.now() - started <
|
|
1026
|
+
if (performance.now() - started < 8)
|
|
1023
1027
|
return started;
|
|
1024
1028
|
await new Promise((resolve) => setTimeout(resolve, 0));
|
|
1025
1029
|
return performance.now();
|
|
@@ -1093,6 +1097,47 @@ function selectHashIncompleteChunkCandidates(db, projectPath, modelId, candidate
|
|
|
1093
1097
|
return [...missing, ...stale].slice(0, limit);
|
|
1094
1098
|
}
|
|
1095
1099
|
var sessionBackfillCandidateStatements = new WeakMap;
|
|
1100
|
+
function loadUnembeddedSessionChunkCandidates(db, projectPath, sessionId, modelId, limit, excludeIds, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS, leaseHeldRenumber = false) {
|
|
1101
|
+
const exclusions = excludeIds && excludeIds.length > 0 ? excludeIds : [];
|
|
1102
|
+
const exclusionSql = exclusions.length > 0 ? `AND c.id NOT IN (${exclusions.map(() => "?").join(", ")})` : "";
|
|
1103
|
+
const stmt = exclusions.length > 0 ? db.prepare(`SELECT c.id AS id,
|
|
1104
|
+
c.session_id AS sessionId,
|
|
1105
|
+
c.start_message AS startMessage,
|
|
1106
|
+
c.end_message AS endMessage,
|
|
1107
|
+
c.title AS title
|
|
1108
|
+
FROM compartments c
|
|
1109
|
+
JOIN session_projects sp
|
|
1110
|
+
ON sp.session_id = c.session_id
|
|
1111
|
+
AND sp.harness = c.harness
|
|
1112
|
+
AND sp.project_path = ?
|
|
1113
|
+
WHERE c.session_id = ?
|
|
1114
|
+
AND c.start_message IS NOT NULL
|
|
1115
|
+
AND c.end_message IS NOT NULL
|
|
1116
|
+
${exclusionSql}
|
|
1117
|
+
ORDER BY c.start_message ASC, c.id ASC`) : (() => {
|
|
1118
|
+
let cached = sessionBackfillCandidateStatements.get(db);
|
|
1119
|
+
if (!cached) {
|
|
1120
|
+
cached = db.prepare(`SELECT c.id AS id,
|
|
1121
|
+
c.session_id AS sessionId,
|
|
1122
|
+
c.start_message AS startMessage,
|
|
1123
|
+
c.end_message AS endMessage,
|
|
1124
|
+
c.title AS title
|
|
1125
|
+
FROM compartments c
|
|
1126
|
+
JOIN session_projects sp
|
|
1127
|
+
ON sp.session_id = c.session_id
|
|
1128
|
+
AND sp.harness = c.harness
|
|
1129
|
+
AND sp.project_path = ?
|
|
1130
|
+
WHERE c.session_id = ?
|
|
1131
|
+
AND c.start_message IS NOT NULL
|
|
1132
|
+
AND c.end_message IS NOT NULL
|
|
1133
|
+
ORDER BY c.start_message ASC, c.id ASC`);
|
|
1134
|
+
sessionBackfillCandidateStatements.set(db, cached);
|
|
1135
|
+
}
|
|
1136
|
+
return cached;
|
|
1137
|
+
})();
|
|
1138
|
+
const rows = stmt.all(projectPath, sessionId, ...exclusions);
|
|
1139
|
+
return selectHashIncompleteChunkCandidates(db, projectPath, modelId, mapBackfillCandidateRows(rows), Math.max(1, limit), maxInputTokens, leaseHeldRenumber);
|
|
1140
|
+
}
|
|
1096
1141
|
async function loadUnembeddedSessionChunkCandidatesPolite(db, projectPath, sessionId, modelId, limit, excludeIds = [], maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS, leaseHeldRenumber = false) {
|
|
1097
1142
|
const excluded = new Set(excludeIds);
|
|
1098
1143
|
const missing = [];
|
|
@@ -1109,10 +1154,22 @@ async function loadUnembeddedSessionChunkCandidatesPolite(db, projectPath, sessi
|
|
|
1109
1154
|
else if (leaseHeldRenumber) {
|
|
1110
1155
|
applyLeaseHeldCoverageRepair(db, candidate, projectPath, modelId, classification);
|
|
1111
1156
|
}
|
|
1157
|
+
if (missing.length >= Math.max(1, limit))
|
|
1158
|
+
return missing;
|
|
1112
1159
|
started = await yieldCoverageSlice(started);
|
|
1113
1160
|
}
|
|
1114
1161
|
return [...missing, ...stale].slice(0, Math.max(1, limit));
|
|
1115
1162
|
}
|
|
1163
|
+
function countUnembeddedSessionCompartments(db, projectPath, sessionId, modelId, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS) {
|
|
1164
|
+
const rows = getSessionBackfillRows(db, projectPath, sessionId);
|
|
1165
|
+
let count = 0;
|
|
1166
|
+
for (const candidate of rows) {
|
|
1167
|
+
const { defect } = classifyChunkCoverageDefect(db, projectPath, modelId, candidate, maxInputTokens);
|
|
1168
|
+
if (defect === "missing" || defect === "stale")
|
|
1169
|
+
count++;
|
|
1170
|
+
}
|
|
1171
|
+
return count;
|
|
1172
|
+
}
|
|
1116
1173
|
function countSessionCompartmentEmbedCoverage(db, projectPath, sessionId, modelId, maxInputTokens = DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS) {
|
|
1117
1174
|
const candidates = getSessionBackfillRows(db, projectPath, sessionId);
|
|
1118
1175
|
let embedded = 0;
|
|
@@ -1165,4 +1222,4 @@ async function countUnembeddedSessionCompartmentsPolite(db, projectPath, session
|
|
|
1165
1222
|
return count;
|
|
1166
1223
|
}
|
|
1167
1224
|
|
|
1168
|
-
export { CHUNK_WINDOW_SAFETY_RATIO, normalizeCompartmentChunkMaxInputTokens, buildCanonicalChunkTextFromFts, buildCompartmentSummaryFallbackText, canonicalizeInMemoryChunkTextForEmbedding, chunkCanonicalText, chunkEmbeddingWindowsAreCurrent, replaceCompartmentChunkEmbeddings, loadCompartmentChunkEmbeddingsForSearch, loadUnembeddedShadowChunkCandidates, loadUnembeddedCompartmentChunkCandidatesPolite, deleteChunkEmbedBackoffForSession, recordChunkEmbedBackoff, chunkWindowSourceKey, loadUnembeddedSessionChunkCandidatesPolite, countSessionCompartmentEmbedCoverage, countSessionCompartmentEmbedCoveragePolite, countUnembeddedSessionCompartmentsPolite };
|
|
1225
|
+
export { DEFAULT_COMPARTMENT_CHUNK_MAX_INPUT_TOKENS, CHUNK_WINDOW_SAFETY_RATIO, normalizeCompartmentChunkMaxInputTokens, buildCanonicalChunkTextFromFts, buildCompartmentSummaryFallbackText, canonicalizeInMemoryChunkTextForEmbedding, chunkCanonicalText, chunkEmbeddingWindowsAreCurrent, replaceCompartmentChunkEmbeddings, loadCompartmentChunkEmbeddingsForSearch, loadUnembeddedShadowChunkCandidates, loadUnembeddedCompartmentChunkCandidatesPolite, deleteChunkEmbedBackoffForSession, recordChunkEmbedBackoff, chunkWindowSourceKey, loadUnembeddedSessionChunkCandidates, loadUnembeddedSessionChunkCandidatesPolite, countUnembeddedSessionCompartments, countSessionCompartmentEmbedCoverage, countSessionCompartmentEmbedCoveragePolite, countUnembeddedSessionCompartmentsPolite };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-0ppsweh6.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./server-pavzsdc6.js";
|
|
7
7
|
import {
|
|
8
8
|
log2
|
|
9
|
-
} from "./server-
|
|
9
|
+
} from "./server-f2xf5gcb.js";
|
|
10
10
|
import {
|
|
11
11
|
inRootAsyncContext2
|
|
12
12
|
} from "./server-wafzvyhg.js";
|
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
removeSystemReminders,
|
|
6
6
|
hasMeaningfulUserText2,
|
|
7
7
|
extractTexts2
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-0ppsweh6.js";
|
|
9
9
|
import {
|
|
10
10
|
getMagicContextStorageDir
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-f2xf5gcb.js";
|
|
12
12
|
import {
|
|
13
13
|
withSqliteBackgroundWriter2,
|
|
14
14
|
withoutSqliteTransformPass2
|
|
@@ -20,23 +20,29 @@ import {
|
|
|
20
20
|
tagRevisionKey,
|
|
21
21
|
tagIdentityRevisionKey,
|
|
22
22
|
deleteTagIdentityRevisions
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-pwv4ezb0.js";
|
|
24
24
|
import {
|
|
25
25
|
cleanUserText2
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-m97brnat.js";
|
|
27
27
|
import {
|
|
28
28
|
recordMessageFtsRowid,
|
|
29
29
|
recordIndexedMessageTime,
|
|
30
30
|
messageFtsOrdinalRangeIsMapped,
|
|
31
31
|
deleteUnmappedMessageFtsRows
|
|
32
|
-
} from "./server-
|
|
32
|
+
} from "./server-yrvqaswb.js";
|
|
33
33
|
import {
|
|
34
34
|
isPidAlive,
|
|
35
35
|
readProcessStartTime
|
|
36
|
-
} from "./server-
|
|
36
|
+
} from "./server-da07v4xp.js";
|
|
37
37
|
import {
|
|
38
38
|
deleteChunkEmbedBackoffForSession
|
|
39
|
-
} from "./server-
|
|
39
|
+
} from "./server-qhfvvfxj.js";
|
|
40
|
+
import {
|
|
41
|
+
closeQuietly
|
|
42
|
+
} from "./server-8ajstryz.js";
|
|
43
|
+
import {
|
|
44
|
+
logSlowWriteTransaction
|
|
45
|
+
} from "./server-6pmqg9m4.js";
|
|
40
46
|
import {
|
|
41
47
|
ensurePrivateStorageDirectorySync,
|
|
42
48
|
writeStorageFileSync,
|
|
@@ -44,12 +50,6 @@ import {
|
|
|
44
50
|
syncStorageDirectorySync,
|
|
45
51
|
writeStorageFileDurableAtomicSync
|
|
46
52
|
} from "./server-fvnzcnww.js";
|
|
47
|
-
import {
|
|
48
|
-
closeQuietly
|
|
49
|
-
} from "./server-8ajstryz.js";
|
|
50
|
-
import {
|
|
51
|
-
logSlowWriteTransaction
|
|
52
|
-
} from "./server-7dv9wt9r.js";
|
|
53
53
|
|
|
54
54
|
// src/shared/bounded-session-map.ts
|
|
55
55
|
class BoundedSessionMap {
|
|
@@ -4,13 +4,13 @@ import {
|
|
|
4
4
|
import {
|
|
5
5
|
getMagicContextStorageDir,
|
|
6
6
|
sessionLog2
|
|
7
|
-
} from "./server-
|
|
8
|
-
import {
|
|
9
|
-
writeStorageFileAtomicSync
|
|
10
|
-
} from "./server-fvnzcnww.js";
|
|
7
|
+
} from "./server-f2xf5gcb.js";
|
|
11
8
|
import {
|
|
12
9
|
modelRefLookupOrder
|
|
13
10
|
} from "./server-avwt563y.js";
|
|
11
|
+
import {
|
|
12
|
+
writeStorageFileAtomicSync
|
|
13
|
+
} from "./server-fvnzcnww.js";
|
|
14
14
|
|
|
15
15
|
// src/shared/models-dev-cache.ts
|
|
16
16
|
import { readFileSync } from "node:fs";
|