@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
package/dist/v2/{send-session-notification-z5mcjdea.js → send-session-notification-8ghn9tnv.js}
RENAMED
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
clearIgnoredMessages2,
|
|
9
9
|
observeIgnoredNotificationEvent2,
|
|
10
10
|
sendStatusNotification2
|
|
11
|
-
} from "./server-
|
|
11
|
+
} from "./server-vbe4se57.js";
|
|
12
12
|
import"./server-qt1qqasc.js";
|
|
13
|
-
import"./server-
|
|
14
|
-
import"./server-
|
|
15
|
-
import"./server-bx59ezg6.js";
|
|
13
|
+
import"./server-d8tj10db.js";
|
|
14
|
+
import"./server-prg55b7k.js";
|
|
16
15
|
import"./server-51779zs2.js";
|
|
16
|
+
import"./server-h0410h0v.js";
|
|
17
17
|
import"./server-2ra6pwf3.js";
|
|
18
18
|
import"./server-wafzvyhg.js";
|
|
19
|
-
import"./server-
|
|
19
|
+
import"./server-f2xf5gcb.js";
|
|
20
20
|
import"./server-pavzsdc6.js";
|
|
21
21
|
export {
|
|
22
22
|
MAX_QUEUED_IGNORED_NOTIFICATIONS2 as MAX_QUEUED_IGNORED_NOTIFICATIONS,
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
// src/config/agent-disable.ts
|
|
2
|
+
var COMPACTION_ENABLED_PATH = `compaction${"."}enabled`;
|
|
3
|
+
function isDreamerRunnable(config) {
|
|
4
|
+
return !!config.dreamer && config.dreamer.disable !== true;
|
|
5
|
+
}
|
|
6
|
+
function isSmartNoteSurfaceAvailable(config) {
|
|
7
|
+
return config.smart_notes?.enabled !== false && isDreamerRunnable(config);
|
|
8
|
+
}
|
|
9
|
+
function isCompactionEnabled(config) {
|
|
10
|
+
return config.compaction?.enabled !== false;
|
|
11
|
+
}
|
|
12
|
+
function clonePlainObject(value) {
|
|
13
|
+
if (typeof value !== "object" || value === null || Array.isArray(value)) {
|
|
14
|
+
return;
|
|
15
|
+
}
|
|
16
|
+
return { ...value };
|
|
17
|
+
}
|
|
18
|
+
function migrateLegacyEnabledForAgent(args) {
|
|
19
|
+
const agent = clonePlainObject(args.patched[args.agentName]);
|
|
20
|
+
if (!agent || !("enabled" in agent))
|
|
21
|
+
return;
|
|
22
|
+
const enabled = agent.enabled;
|
|
23
|
+
const disable = agent.disable;
|
|
24
|
+
delete agent.enabled;
|
|
25
|
+
if (args.agentName === "historian") {
|
|
26
|
+
args.warnings.push('Removed invalid "historian.enabled" in-memory (run doctor to persist).');
|
|
27
|
+
args.patched.historian = agent;
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
if (disable !== true && enabled === false) {
|
|
31
|
+
agent.disable = true;
|
|
32
|
+
args.warnings.push('Migrated "dreamer.enabled=false" → "dreamer.disable=true" in-memory (run doctor to persist). This now also disables manual /ctx-dream; for manual-only remove disable and set schedule="".');
|
|
33
|
+
}
|
|
34
|
+
args.patched.dreamer = agent;
|
|
35
|
+
}
|
|
36
|
+
function migrateLegacyAgentEnabledInMemory(rawConfig, warnings) {
|
|
37
|
+
const shouldPatch = ["dreamer", "historian"].some((key) => {
|
|
38
|
+
const agent = rawConfig[key];
|
|
39
|
+
return typeof agent === "object" && agent !== null && !Array.isArray(agent) && "enabled" in agent;
|
|
40
|
+
});
|
|
41
|
+
if (!shouldPatch)
|
|
42
|
+
return rawConfig;
|
|
43
|
+
const patched = { ...rawConfig };
|
|
44
|
+
migrateLegacyEnabledForAgent({ patched, agentName: "dreamer", warnings });
|
|
45
|
+
migrateLegacyEnabledForAgent({ patched, agentName: "historian", warnings });
|
|
46
|
+
return patched;
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
export { COMPACTION_ENABLED_PATH, isDreamerRunnable, isSmartNoteSurfaceAvailable, isCompactionEnabled, migrateLegacyAgentEnabledInMemory };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
log2
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-f2xf5gcb.js";
|
|
4
4
|
import {
|
|
5
5
|
getSdkWindowGeometry,
|
|
6
6
|
getSdkContextLimit,
|
|
7
7
|
getSdkInputLimit
|
|
8
|
-
} from "./server-
|
|
8
|
+
} from "./server-tbe1femw.js";
|
|
9
9
|
import {
|
|
10
10
|
localBudget,
|
|
11
11
|
calibrationForModelKey
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
import {
|
|
2
|
+
getHarness2
|
|
3
|
+
} from "./server-pavzsdc6.js";
|
|
4
|
+
import {
|
|
5
|
+
isUserHomeDirectory
|
|
6
|
+
} from "./server-gvkm8xaj.js";
|
|
7
|
+
import {
|
|
8
|
+
logSlowWriteTransaction
|
|
9
|
+
} from "./server-6pmqg9m4.js";
|
|
10
|
+
|
|
11
|
+
// src/features/magic-context/git-commits/sweep-coordinator.ts
|
|
12
|
+
var GIT_SWEEP_COOLDOWN_MS = 10 * 60 * 1000;
|
|
13
|
+
var GIT_SWEEP_LEASE_TTL_MS = 5 * 60 * 1000;
|
|
14
|
+
var GIT_SWEEP_NON_INDEXABLE_REPROBE_MS = 24 * 60 * 60 * 1000;
|
|
15
|
+
var GIT_SWEEP_LEASE_RENEWAL_MS = 60 * 1000;
|
|
16
|
+
function runImmediate(db, body) {
|
|
17
|
+
db.exec("BEGIN IMMEDIATE");
|
|
18
|
+
const transactionStartedAt = performance.now();
|
|
19
|
+
let committed = false;
|
|
20
|
+
try {
|
|
21
|
+
const result = body();
|
|
22
|
+
db.exec("COMMIT");
|
|
23
|
+
committed = true;
|
|
24
|
+
logSlowWriteTransaction("git_sweep_lease", transactionStartedAt);
|
|
25
|
+
return result;
|
|
26
|
+
} finally {
|
|
27
|
+
if (!committed) {
|
|
28
|
+
try {
|
|
29
|
+
db.exec("ROLLBACK");
|
|
30
|
+
} catch {}
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
function rowToState(row) {
|
|
35
|
+
return {
|
|
36
|
+
projectPath: row.project_path,
|
|
37
|
+
leaseHolder: row.lease_holder,
|
|
38
|
+
leaseExpiresAt: row.lease_expires_at,
|
|
39
|
+
lastSweptAt: row.last_swept_at
|
|
40
|
+
};
|
|
41
|
+
}
|
|
42
|
+
function getGitSweepCoordinatorState(db, projectPath) {
|
|
43
|
+
const row = db.prepare(`SELECT project_path, lease_holder, lease_expires_at, last_swept_at
|
|
44
|
+
FROM git_sweep_coordinator
|
|
45
|
+
WHERE project_path = ?`).get(projectPath);
|
|
46
|
+
return row ? rowToState(row) : null;
|
|
47
|
+
}
|
|
48
|
+
function acquireGitSweepLease(db, projectPath, holderId, options = {}) {
|
|
49
|
+
const cooldownMs = options.cooldownMs ?? GIT_SWEEP_COOLDOWN_MS;
|
|
50
|
+
const leaseTtlMs = options.leaseTtlMs ?? GIT_SWEEP_LEASE_TTL_MS;
|
|
51
|
+
return runImmediate(db, () => {
|
|
52
|
+
const now = Date.now();
|
|
53
|
+
const row = getGitSweepCoordinatorState(db, projectPath);
|
|
54
|
+
if (row?.leaseHolder && row.leaseExpiresAt !== null && row.leaseExpiresAt > now) {
|
|
55
|
+
return {
|
|
56
|
+
acquired: false,
|
|
57
|
+
projectPath,
|
|
58
|
+
reason: "lease_active",
|
|
59
|
+
leaseHolder: row.leaseHolder,
|
|
60
|
+
leaseExpiresAt: row.leaseExpiresAt,
|
|
61
|
+
lastSweptAt: row.lastSweptAt,
|
|
62
|
+
nextAllowedAt: null
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
if (!options.ignoreCooldown && row?.lastSweptAt !== null && row?.lastSweptAt !== undefined) {
|
|
66
|
+
const nextAllowedAt = row.lastSweptAt + cooldownMs;
|
|
67
|
+
if (nextAllowedAt > now) {
|
|
68
|
+
return {
|
|
69
|
+
acquired: false,
|
|
70
|
+
projectPath,
|
|
71
|
+
reason: "cooldown_active",
|
|
72
|
+
leaseHolder: row.leaseHolder,
|
|
73
|
+
leaseExpiresAt: row.leaseExpiresAt,
|
|
74
|
+
lastSweptAt: row.lastSweptAt,
|
|
75
|
+
nextAllowedAt
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
const leaseExpiresAt = now + leaseTtlMs;
|
|
80
|
+
db.prepare(`INSERT INTO git_sweep_coordinator (
|
|
81
|
+
project_path,
|
|
82
|
+
lease_holder,
|
|
83
|
+
lease_expires_at,
|
|
84
|
+
last_swept_at
|
|
85
|
+
) VALUES (?, ?, ?, NULL)
|
|
86
|
+
ON CONFLICT(project_path) DO UPDATE SET
|
|
87
|
+
lease_holder = excluded.lease_holder,
|
|
88
|
+
lease_expires_at = excluded.lease_expires_at`).run(projectPath, holderId, leaseExpiresAt);
|
|
89
|
+
return {
|
|
90
|
+
acquired: true,
|
|
91
|
+
projectPath,
|
|
92
|
+
holderId,
|
|
93
|
+
acquiredAt: now,
|
|
94
|
+
leaseExpiresAt
|
|
95
|
+
};
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function renewGitSweepLease(db, projectPath, holderId, leaseTtlMs = GIT_SWEEP_LEASE_TTL_MS) {
|
|
99
|
+
return runImmediate(db, () => {
|
|
100
|
+
const now = Date.now();
|
|
101
|
+
const leaseExpiresAt = now + leaseTtlMs;
|
|
102
|
+
const result = db.prepare(`UPDATE git_sweep_coordinator
|
|
103
|
+
SET lease_expires_at = ?
|
|
104
|
+
WHERE project_path = ?
|
|
105
|
+
AND lease_holder = ?
|
|
106
|
+
AND lease_expires_at > ?`).run(leaseExpiresAt, projectPath, holderId, now);
|
|
107
|
+
return result.changes === 1;
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
function markGitSweepSuccessAndRelease(db, projectPath, holderId) {
|
|
111
|
+
return runImmediate(db, () => {
|
|
112
|
+
const now = Date.now();
|
|
113
|
+
const result = db.prepare(`UPDATE git_sweep_coordinator
|
|
114
|
+
SET lease_holder = NULL,
|
|
115
|
+
lease_expires_at = NULL,
|
|
116
|
+
last_swept_at = ?
|
|
117
|
+
WHERE project_path = ?
|
|
118
|
+
AND lease_holder = ?
|
|
119
|
+
AND lease_expires_at > ?`).run(now, projectPath, holderId, now);
|
|
120
|
+
return result.changes === 1;
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
function parkGitSweepNonIndexable(db, projectPath, holderId, reprobeMs = GIT_SWEEP_NON_INDEXABLE_REPROBE_MS) {
|
|
124
|
+
return runImmediate(db, () => {
|
|
125
|
+
const now = Date.now();
|
|
126
|
+
const sweptAt = now + reprobeMs - GIT_SWEEP_COOLDOWN_MS;
|
|
127
|
+
const result = db.prepare(`UPDATE git_sweep_coordinator
|
|
128
|
+
SET lease_holder = NULL,
|
|
129
|
+
lease_expires_at = NULL,
|
|
130
|
+
last_swept_at = ?
|
|
131
|
+
WHERE project_path = ?
|
|
132
|
+
AND lease_holder = ?
|
|
133
|
+
AND lease_expires_at > ?`).run(sweptAt, projectPath, holderId, now);
|
|
134
|
+
return result.changes === 1;
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
function releaseGitSweepLease(db, projectPath, holderId) {
|
|
138
|
+
runImmediate(db, () => {
|
|
139
|
+
db.prepare(`UPDATE git_sweep_coordinator
|
|
140
|
+
SET lease_holder = NULL,
|
|
141
|
+
lease_expires_at = NULL
|
|
142
|
+
WHERE project_path = ?
|
|
143
|
+
AND lease_holder = ?`).run(projectPath, holderId);
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
|
|
147
|
+
// src/features/magic-context/session-project-storage.ts
|
|
148
|
+
var SESSION_CHUNK_REPAIR_BATCH_SIZE = 100;
|
|
149
|
+
var upsertSessionProjectStatements = new WeakMap;
|
|
150
|
+
var repairSessionChunkProjectStatements = new WeakMap;
|
|
151
|
+
var misScopedProjectChunkStatements = new WeakMap;
|
|
152
|
+
var MIS_SCOPED_PROJECT_CHUNK_IDS_SQL = `
|
|
153
|
+
SELECT e.id FROM compartment_chunk_embeddings e
|
|
154
|
+
JOIN session_projects sp ON sp.session_id = e.session_id AND sp.harness = e.harness
|
|
155
|
+
WHERE e.project_path = ? AND sp.project_path <> e.project_path
|
|
156
|
+
UNION ALL
|
|
157
|
+
SELECT e.id FROM session_projects sp
|
|
158
|
+
JOIN compartment_chunk_embeddings e ON e.session_id = sp.session_id
|
|
159
|
+
WHERE sp.project_path = ? AND e.harness = sp.harness AND e.project_path <> sp.project_path`;
|
|
160
|
+
function getUpsertSessionProjectStatement(db) {
|
|
161
|
+
let stmt = upsertSessionProjectStatements.get(db);
|
|
162
|
+
if (!stmt) {
|
|
163
|
+
stmt = db.prepare(`INSERT INTO session_projects (session_id, harness, project_path, updated_at)
|
|
164
|
+
VALUES (?, ?, ?, ?)
|
|
165
|
+
ON CONFLICT(session_id, harness) DO UPDATE SET
|
|
166
|
+
project_path = excluded.project_path,
|
|
167
|
+
updated_at = excluded.updated_at
|
|
168
|
+
WHERE session_projects.project_path <> excluded.project_path`);
|
|
169
|
+
upsertSessionProjectStatements.set(db, stmt);
|
|
170
|
+
}
|
|
171
|
+
return stmt;
|
|
172
|
+
}
|
|
173
|
+
function getRepairSessionChunkProjectStatement(db) {
|
|
174
|
+
let stmt = repairSessionChunkProjectStatements.get(db);
|
|
175
|
+
if (!stmt) {
|
|
176
|
+
stmt = db.prepare(`UPDATE compartment_chunk_embeddings
|
|
177
|
+
SET project_path = ?
|
|
178
|
+
WHERE id IN (
|
|
179
|
+
SELECT id
|
|
180
|
+
FROM compartment_chunk_embeddings
|
|
181
|
+
WHERE session_id = ?
|
|
182
|
+
AND harness = ?
|
|
183
|
+
AND project_path <> ?
|
|
184
|
+
LIMIT ?
|
|
185
|
+
)`);
|
|
186
|
+
repairSessionChunkProjectStatements.set(db, stmt);
|
|
187
|
+
}
|
|
188
|
+
return stmt;
|
|
189
|
+
}
|
|
190
|
+
function findMisScopedCompartmentChunkEmbeddingIdsForProject(db, projectPath) {
|
|
191
|
+
return db.prepare(`SELECT id FROM (${MIS_SCOPED_PROJECT_CHUNK_IDS_SQL}) LIMIT 25`).all(projectPath, projectPath).map(({ id }) => id);
|
|
192
|
+
}
|
|
193
|
+
function recordSessionProjectIdentity(db, sessionId, projectPath) {
|
|
194
|
+
if (!sessionId || !projectPath)
|
|
195
|
+
return;
|
|
196
|
+
if (!projectPath.startsWith("git:") && !projectPath.startsWith("dir:") && isUserHomeDirectory(projectPath))
|
|
197
|
+
return;
|
|
198
|
+
const harness = getHarness2();
|
|
199
|
+
const now = Date.now();
|
|
200
|
+
let previousProjectPath;
|
|
201
|
+
db.transaction(() => {
|
|
202
|
+
const existing = db.prepare("SELECT project_path FROM session_projects WHERE session_id = ? AND harness = ?").get(sessionId, harness);
|
|
203
|
+
previousProjectPath = existing?.project_path;
|
|
204
|
+
getUpsertSessionProjectStatement(db).run(sessionId, harness, projectPath, now);
|
|
205
|
+
getRepairSessionChunkProjectStatement(db).run(projectPath, sessionId, harness, projectPath, SESSION_CHUNK_REPAIR_BATCH_SIZE);
|
|
206
|
+
}).immediate();
|
|
207
|
+
return previousProjectPath === projectPath ? undefined : { previousProjectPath, projectPath };
|
|
208
|
+
}
|
|
209
|
+
function hasRecordedSessionProjectIdentity(db, sessionId) {
|
|
210
|
+
const row = db.prepare("SELECT 1 AS found FROM session_projects WHERE session_id = ? AND harness = ?").get(sessionId, getHarness2());
|
|
211
|
+
return row?.found === 1;
|
|
212
|
+
}
|
|
213
|
+
function repairMisScopedCompartmentChunkEmbeddingsForProject(db, projectPath, ids = findMisScopedCompartmentChunkEmbeddingIdsForProject(db, projectPath)) {
|
|
214
|
+
if (!projectPath || ids.length === 0)
|
|
215
|
+
return 0;
|
|
216
|
+
return db.prepare(`UPDATE compartment_chunk_embeddings
|
|
217
|
+
SET project_path = (SELECT sp.project_path FROM session_projects sp
|
|
218
|
+
WHERE sp.session_id = compartment_chunk_embeddings.session_id
|
|
219
|
+
AND sp.harness = compartment_chunk_embeddings.harness)
|
|
220
|
+
WHERE id IN (${ids.map(() => "?").join(",")}) AND EXISTS (
|
|
221
|
+
SELECT 1 FROM session_projects sp
|
|
222
|
+
WHERE sp.session_id = compartment_chunk_embeddings.session_id
|
|
223
|
+
AND sp.harness = compartment_chunk_embeddings.harness
|
|
224
|
+
AND sp.project_path <> compartment_chunk_embeddings.project_path
|
|
225
|
+
AND (sp.project_path = ? OR compartment_chunk_embeddings.project_path = ?)
|
|
226
|
+
)`).run(...ids, projectPath, projectPath).changes;
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
export { GIT_SWEEP_LEASE_RENEWAL_MS, acquireGitSweepLease, renewGitSweepLease, markGitSweepSuccessAndRelease, parkGitSweepNonIndexable, releaseGitSweepLease, findMisScopedCompartmentChunkEmbeddingIdsForProject, recordSessionProjectIdentity, hasRecordedSessionProjectIdentity, repairMisScopedCompartmentChunkEmbeddingsForProject };
|
|
@@ -11,13 +11,13 @@ import {
|
|
|
11
11
|
import {
|
|
12
12
|
sanitizeDiagnosticText,
|
|
13
13
|
sessionLog2
|
|
14
|
-
} from "./server-
|
|
14
|
+
} from "./server-f2xf5gcb.js";
|
|
15
15
|
import {
|
|
16
16
|
managedAuthorityNoteRow
|
|
17
|
-
} from "./server-
|
|
17
|
+
} from "./server-k2bzedxk.js";
|
|
18
18
|
import {
|
|
19
19
|
embedTextForProject2
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-hek6z3w6.js";
|
|
21
21
|
import {
|
|
22
22
|
saveEmbeddingIfHashMatches
|
|
23
23
|
} from "./server-4dhv7mqz.js";
|