@cortexkit/opencode-magic-context 0.49.16 → 0.49.18
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 +76 -63
- package/dist/chunk-embedding-write-worker.js +11 -11
- package/dist/{compaction-marker-candidates-v5c6997n.js → compaction-marker-candidates-n4krhat4.js} +2 -2
- package/dist/compaction-marker-candidates-worker.js +2 -2
- package/dist/config/schema/magic-context.d.ts +394 -394
- package/dist/{conflict-warning-hook-znry4j76.js → conflict-warning-hook-4pmz879v.js} +5 -5
- package/dist/{context-3znk23va.js → context-m897gfp9.js} +304 -145
- package/dist/{embedding-backfill-q4n8dend.js → embedding-backfill-fmz50tsy.js} +11 -11
- package/dist/embedding-worker-process.js +1 -1
- package/dist/embedding-worker.js +4 -4
- 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/git-commits/indexer.d.ts.map +1 -1
- package/dist/features/magic-context/memory/embedding-openai.d.ts.map +1 -1
- package/dist/features/magic-context/memory/project-identity-cache.d.ts +2 -0
- package/dist/features/magic-context/memory/project-identity-cache.d.ts.map +1 -1
- package/dist/features/magic-context/message-index-async.d.ts +1 -1
- package/dist/features/magic-context/message-index-async.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +5 -0
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/search.d.ts +6 -1
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-host-instruction-retention.d.ts +11 -0
- package/dist/features/magic-context/storage-host-instruction-retention.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-session.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-shared.d.ts +2 -2
- package/dist/features/magic-context/storage-meta-shared.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts +9 -1
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-deadline.d.ts +2 -1
- package/dist/hooks/magic-context/auto-search-deadline.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-hint.d.ts +3 -0
- package/dist/hooks/magic-context/auto-search-hint.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +10 -2
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts +22 -1
- package/dist/hooks/magic-context/cache-busting-signals.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts +2 -0
- package/dist/hooks/magic-context/compartment-runner-historian.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts +4 -2
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/file-token-coverage.d.ts +11 -0
- package/dist/hooks/magic-context/file-token-coverage.d.ts.map +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +9 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-host-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/host-served-rows.d.ts +25 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts +7 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-fence.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/pass-outcome.d.ts +2 -0
- package/dist/hooks/magic-context/pass-outcome.d.ts.map +1 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts +2 -1
- package/dist/hooks/magic-context/protected-tail-boundary.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/signed-thinking-hold.d.ts +59 -0
- package/dist/hooks/magic-context/signed-thinking-hold.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-diagnostics.d.ts +8 -0
- package/dist/hooks/magic-context/system-prompt-diagnostics.d.ts.map +1 -0
- package/dist/hooks/magic-context/system-prompt-hash.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-content-primitives.d.ts.map +1 -1
- package/dist/hooks/magic-context/tag-messages.d.ts +6 -1
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/todo-view.d.ts +2 -2
- package/dist/hooks/magic-context/tool-drop-target.d.ts +3 -2
- package/dist/hooks/magic-context/tool-drop-target.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +6 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-context-state.d.ts +19 -0
- package/dist/hooks/magic-context/transform-context-state.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +19 -0
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-stage-logger.d.ts +3 -0
- package/dist/hooks/magic-context/transform-stage-logger.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +1 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-9nkg2dzk.js → index-24fezq97.js} +3 -3
- package/dist/{index-v9asb16b.js → index-24jbw52d.js} +5 -5
- package/dist/{index-a8bvhwqs.js → index-2vxtcb95.js} +32 -3
- package/dist/{index-f71thw8j.js → index-4s3t0nd0.js} +1 -1
- package/dist/{index-6a6dq53h.js → index-6s5941tm.js} +5 -5
- package/dist/{index-fkx2qnvw.js → index-6x57ar45.js} +2 -2
- package/dist/{index-ek1yxvvz.js → index-936py2wm.js} +361 -70
- package/dist/{index-dqe8pq4x.js → index-a6mc0v4d.js} +6 -3
- package/dist/{index-hehkf6zm.js → index-b5vqckbw.js} +12 -6
- package/dist/{v2/server-wafzvyhg.js → index-beht37jy.js} +8 -0
- package/dist/{index-7b2cfmaz.js → index-bjcnntmz.js} +2 -2
- package/dist/{index-hqkczed7.js → index-c5pytzne.js} +22 -2
- package/dist/{index-nd7m2a5a.js → index-cf74k5ak.js} +27 -5
- package/dist/{index-kn4t1haw.js → index-e4xv8890.js} +531 -253
- package/dist/{index-cj9g0j7a.js → index-fgncb0ng.js} +7 -7
- package/dist/{index-5mwk1nek.js → index-jn12fvvh.js} +1 -1
- package/dist/{index-n6m03s3n.js → index-ke416mdc.js} +1 -1
- package/dist/{index-mtw9e71a.js → index-kq82mtg0.js} +2 -2
- package/dist/{index-n78avt2p.js → index-n37sebck.js} +1 -1
- package/dist/{index-wk0n1cgt.js → index-qn7xstt2.js} +2 -2
- package/dist/{index-v63beg1z.js → index-r4nkrs05.js} +3 -3
- package/dist/{index-j6zw70pf.js → index-rmwykbbb.js} +60 -21
- package/dist/{index-saews2s3.js → index-rr2bb45z.js} +1 -1
- package/dist/{index-ayym1x7f.js → index-s1ex9y6p.js} +195 -748
- package/dist/{index-7pa32z07.js → index-s734jcsr.js} +1 -1
- package/dist/{index-b17m64g9.js → index-s74zqahq.js} +1 -1
- package/dist/{index-4qfy7v57.js → index-s7j8tvhv.js} +31 -20
- package/dist/{index-wv9n2zcq.js → index-v8awdgvd.js} +4 -4
- package/dist/{index-p4vde22c.js → index-x4njr8df.js} +965 -77
- package/dist/{index-qrahzcqv.js → index-ze7mvk54.js} +10 -7
- package/dist/index.js +39 -39
- package/dist/{message-fts-rowid-map-yvx5a9jw.js → message-fts-rowid-map-17s0dfn4.js} +5 -3
- package/dist/{message-index-t4pz7akd.js → message-index-66jv6fh4.js} +13 -13
- package/dist/{message-index-bounded-6th8djy9.js → message-index-bounded-n1frdn85.js} +17 -17
- package/dist/{message-time-backfill-8egzkd3z.js → message-time-backfill-73mmm76q.js} +1 -1
- package/dist/migration-worker.js +8 -8
- package/dist/plugin/dream-timer.d.ts +11 -0
- package/dist/plugin/dream-timer.d.ts.map +1 -1
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-2dea0a77.js → project-embedding-registry-z74mhqkf.js} +10 -10
- package/dist/raw-ordinal-warmup-worker.js +10 -10
- package/dist/{read-session-chunk-4pwqxm5a.js → read-session-chunk-v06g3vka.js} +7 -7
- package/dist/{read-session-raw-5ar8se5v.js → read-session-raw-rsc8c7qy.js} +2 -2
- package/dist/{recomp-orchestrator-tjcaj5x7.js → recomp-orchestrator-ghpk2dtq.js} +24 -24
- package/dist/{search-archive-02jws7hw.js → search-archive-4d53y23e.js} +8 -8
- package/dist/{search-rb01n29x.js → search-nkf271d4.js} +20 -20
- package/dist/{send-session-notification-2x9edkrp.js → send-session-notification-6ve0e8p4.js} +4 -4
- package/dist/shared/historian-cache.d.ts +8 -0
- package/dist/shared/historian-cache.d.ts.map +1 -0
- package/dist/shared/model-suggestion-retry.d.ts +2 -0
- package/dist/shared/model-suggestion-retry.d.ts.map +1 -1
- package/dist/shared/rpc-discovery-cleanup.d.ts +3 -0
- package/dist/shared/rpc-discovery-cleanup.d.ts.map +1 -0
- package/dist/shared/rpc-server.d.ts +2 -0
- package/dist/shared/rpc-server.d.ts.map +1 -1
- package/dist/shared/search-text.d.ts +8 -0
- package/dist/shared/search-text.d.ts.map +1 -0
- package/dist/shared/sqlite.d.ts +4 -2
- package/dist/shared/sqlite.d.ts.map +1 -1
- package/dist/shared/storage-file-mutex.d.ts.map +1 -1
- package/dist/shared/subagent-runner.d.ts +2 -0
- package/dist/shared/subagent-runner.d.ts.map +1 -1
- package/dist/shared/system-directive.d.ts +2 -0
- package/dist/shared/system-directive.d.ts.map +1 -1
- package/dist/{sqlite-4pqyynrs.js → sqlite-zf72c52d.js} +1 -1
- package/dist/{storage-memory-j3v3hc83.js → storage-memory-y3qmy00r.js} +2 -2
- package/dist/{storage-tags-4z1w27xa.js → storage-tags-r7k9tjcv.js} +8 -4
- package/dist/{transform-postprocess-phase-xaw5c3xp.js → transform-postprocess-phase-zpgav0h7.js} +24 -24
- package/dist/v2/auto-search-worker.js +76 -63
- package/dist/v2/chunk-embedding-write-worker.js +11 -11
- package/dist/v2/{compaction-marker-candidates-1vqwr3s5.js → compaction-marker-candidates-ebx3388k.js} +2 -2
- package/dist/v2/compaction-marker-candidates-worker.js +2 -2
- package/dist/v2/{context-acw1nhv8.js → context-f2xh7ba4.js} +1171 -448
- package/dist/v2/embedding-backfill-7c7yr69y.js +23 -0
- package/dist/v2/embedding-worker-process.js +1 -1
- package/dist/v2/embedding-worker.js +4 -4
- package/dist/v2/fold/native-replay.d.ts +11 -2
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/policy.d.ts.map +1 -1
- package/dist/v2/fold/restore.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/hidden-child.d.ts +8 -0
- package/dist/v2/hooks/hidden-child.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/hooks/types.d.ts +17 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/{message-fts-rowid-map-8vf0v7cr.js → message-fts-rowid-map-wfx67gfd.js} +5 -3
- package/dist/v2/{message-index-e6qzw477.js → message-index-48f7hw7a.js} +13 -13
- package/dist/v2/{message-index-bounded-dsrf49y7.js → message-index-bounded-w3hfm29z.js} +17 -17
- package/dist/v2/{message-time-backfill-q5pgxf0d.js → message-time-backfill-04t0km1z.js} +1 -1
- package/dist/v2/migration-worker.js +8 -8
- package/dist/v2/{project-embedding-registry-rek75aqw.js → project-embedding-registry-gnkj56xp.js} +10 -10
- package/dist/v2/raw-ordinal-warmup-worker.js +10 -10
- package/dist/v2/{read-session-chunk-7bpygfv2.js → read-session-chunk-zpgmxwte.js} +7 -7
- package/dist/v2/{read-session-raw-pw2n1qgc.js → read-session-raw-yaegtjzh.js} +2 -2
- package/dist/v2/{recomp-orchestrator-hzpgg06e.js → recomp-orchestrator-4vfxej9t.js} +24 -24
- package/dist/v2/{search-archive-fn4wy8sx.js → search-archive-vv48s2aa.js} +8 -8
- package/dist/v2/{search-sf2vg5pk.js → search-kza414f0.js} +20 -20
- package/dist/v2/{send-session-notification-hmr7q0nt.js → send-session-notification-3pxn658x.js} +4 -4
- package/dist/v2/{server-n5q841qn.js → server-1nyybqan.js} +31 -20
- package/dist/v2/{server-785mb90s.js → server-1wy7b9de.js} +6 -3
- package/dist/v2/{server-0mzjjw3s.js → server-27gq4mfz.js} +27 -5
- package/dist/v2/{server-g59aatsz.js → server-2ehj0bw7.js} +965 -77
- package/dist/v2/{server-kqpawe1a.js → server-46neh5fa.js} +12 -6
- package/dist/v2/{server-rrqpvwqd.js → server-6tmj0s7j.js} +2 -2
- package/dist/v2/{server-kr2kc9dz.js → server-8by8qfec.js} +10 -7
- package/dist/v2/{server-r9gjxcte.js → server-a2eqhkxr.js} +7 -7
- package/dist/v2/{server-vbe4se57.js → server-a9xqj88f.js} +1 -1
- package/dist/{index-wafzvyhg.js → v2/server-beht37jy.js} +8 -0
- package/dist/v2/{server-6fyp0v67.js → server-bfpda1tb.js} +195 -749
- package/dist/v2/{server-05xjtq6c.js → server-d04vrx0j.js} +1 -1
- package/dist/v2/{server-zs8d0s3b.js → server-g3qma5c0.js} +1 -1
- package/dist/v2/{server-00hx04yn.js → server-gpvay0xz.js} +2 -2
- package/dist/v2/{server-gha9x4qq.js → server-h1v0pyxb.js} +2 -2
- package/dist/v2/{server-hgg55hde.js → server-hy3d3vsx.js} +1 -1
- package/dist/v2/{server-vgpab6rd.js → server-my7k4eds.js} +4 -4
- package/dist/v2/{server-d8tj10db.js → server-n1prf1g6.js} +1 -1
- package/dist/v2/{server-n78avt2p.js → server-n37sebck.js} +1 -1
- package/dist/v2/{server-y5pznjt9.js → server-nj659894.js} +5 -5
- package/dist/v2/{server-zyw55ygv.js → server-qv7f0hhe.js} +5 -5
- package/dist/v2/{server-e3ftpk7v.js → server-rmygf5pn.js} +32 -3
- package/dist/v2/{server-0ppsweh6.js → server-tgnbmwah.js} +22 -2
- package/dist/v2/{server-1hcbw661.js → server-xhab8jx8.js} +60 -21
- package/dist/v2/{server-6714jebr.js → server-xj136kt8.js} +1 -1
- package/dist/v2/{server-aavz8pm6.js → server-zzkj2fch.js} +3 -3
- package/dist/v2/server.js +4 -4
- package/dist/v2/{sqlite-4pqyynrs.js → sqlite-zf72c52d.js} +1 -1
- package/dist/v2/{storage-memory-j3v3hc83.js → storage-memory-y3qmy00r.js} +2 -2
- package/dist/v2/{storage-tags-hkwtbp3g.js → storage-tags-3wdb8zph.js} +8 -4
- package/dist/v2/store-reader.d.ts +8 -0
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/{wrapup-orchestrator-x4xj1782.js → wrapup-orchestrator-psqz7yh0.js} +24 -24
- package/dist/wrapup-orchestrator-s9zc5b00.js +48 -0
- package/package.json +1 -1
- package/src/config/latch-permanence-guard.test.ts +4 -0
- package/src/shared/historian-cache.test.ts +69 -0
- package/src/shared/historian-cache.ts +55 -0
- package/src/shared/model-suggestion-retry.ts +2 -0
- package/src/shared/rpc-discovery-cleanup.test.ts +57 -0
- package/src/shared/rpc-discovery-cleanup.ts +57 -0
- package/src/shared/rpc-server.ts +36 -13
- package/src/shared/search-text.test.ts +47 -0
- package/src/shared/search-text.ts +63 -0
- package/src/shared/sqlite.test.ts +56 -0
- package/src/shared/sqlite.ts +51 -2
- package/src/shared/storage-file-mutex-review.test.ts +22 -2
- package/src/shared/storage-file-mutex.ts +11 -1
- package/src/shared/subagent-runner.ts +2 -0
- package/src/shared/system-directive.ts +19 -1
- package/src/shared/tag-transcript.ts +12 -4
- package/dist/v2/embedding-backfill-jyd6492b.js +0 -23
- package/dist/wrapup-orchestrator-vj2tbp22.js +0 -48
|
@@ -16,11 +16,11 @@ import {
|
|
|
16
16
|
} from "./server-2ra6pwf3.js";
|
|
17
17
|
import {
|
|
18
18
|
Database2
|
|
19
|
-
} from "./server-
|
|
19
|
+
} from "./server-beht37jy.js";
|
|
20
20
|
import {
|
|
21
21
|
normalizeStoredProjectPath,
|
|
22
22
|
storedPathBelongsToIdentity
|
|
23
|
-
} from "./server-
|
|
23
|
+
} from "./server-rmygf5pn.js";
|
|
24
24
|
import {
|
|
25
25
|
logSlowWriteTransaction
|
|
26
26
|
} from "./server-6pmqg9m4.js";
|
|
@@ -11,10 +11,10 @@ import {
|
|
|
11
11
|
} from "./server-f2xf5gcb.js";
|
|
12
12
|
import {
|
|
13
13
|
getSynapseLaneIdentity
|
|
14
|
-
} from "./server-
|
|
14
|
+
} from "./server-6tmj0s7j.js";
|
|
15
15
|
import {
|
|
16
16
|
inRootAsyncContext2
|
|
17
|
-
} from "./server-
|
|
17
|
+
} from "./server-beht37jy.js";
|
|
18
18
|
import {
|
|
19
19
|
computeNormalizedHash
|
|
20
20
|
} from "./server-2bvekkfy.js";
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./server-pavzsdc6.js";
|
|
4
4
|
import {
|
|
5
5
|
isTransientSqliteError2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-beht37jy.js";
|
|
7
7
|
import {
|
|
8
8
|
PROMOTABLE_CATEGORIES,
|
|
9
9
|
CATEGORY_DEFAULT_TTL
|
|
@@ -14,10 +14,10 @@ import {
|
|
|
14
14
|
} from "./server-f2xf5gcb.js";
|
|
15
15
|
import {
|
|
16
16
|
managedAuthorityNoteRow
|
|
17
|
-
} from "./server-
|
|
17
|
+
} from "./server-gpvay0xz.js";
|
|
18
18
|
import {
|
|
19
19
|
embedTextForProject2
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-8by8qfec.js";
|
|
21
21
|
import {
|
|
22
22
|
saveEmbeddingIfHashMatches
|
|
23
23
|
} from "./server-4dhv7mqz.js";
|
|
@@ -30,7 +30,7 @@ import {
|
|
|
30
30
|
buildWorkspaceMemorySqlFilter2,
|
|
31
31
|
getMemoryById2,
|
|
32
32
|
updateMemorySeenCount2
|
|
33
|
-
} from "./server-
|
|
33
|
+
} from "./server-n37sebck.js";
|
|
34
34
|
import {
|
|
35
35
|
computeNormalizedHash
|
|
36
36
|
} from "./server-2bvekkfy.js";
|
|
@@ -805,7 +805,7 @@ function parse(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
|
805
805
|
visit(text, visitor, options);
|
|
806
806
|
return currentParent[0];
|
|
807
807
|
}
|
|
808
|
-
function
|
|
808
|
+
function parseTree2(text, errors = [], options = ParseOptions.DEFAULT) {
|
|
809
809
|
let currentParent = { type: "array", offset: -1, length: -1, children: [], parent: undefined };
|
|
810
810
|
function ensurePropertyComplete(endOffset) {
|
|
811
811
|
if (currentParent.type === "property") {
|
|
@@ -1193,7 +1193,7 @@ function getNodeType(value) {
|
|
|
1193
1193
|
function setProperty(text, originalPath, value, options) {
|
|
1194
1194
|
const path = originalPath.slice();
|
|
1195
1195
|
const errors = [];
|
|
1196
|
-
const root =
|
|
1196
|
+
const root = parseTree2(text, errors);
|
|
1197
1197
|
let parent = undefined;
|
|
1198
1198
|
let lastSegment = undefined;
|
|
1199
1199
|
while (path.length > 0) {
|
|
@@ -1366,7 +1366,7 @@ var SyntaxKind;
|
|
|
1366
1366
|
SyntaxKind[SyntaxKind["EOF"] = 17] = "EOF";
|
|
1367
1367
|
})(SyntaxKind || (SyntaxKind = {}));
|
|
1368
1368
|
var parse2 = parse;
|
|
1369
|
-
var
|
|
1369
|
+
var parseTree = parseTree2;
|
|
1370
1370
|
var findNodeAtLocation2 = findNodeAtLocation;
|
|
1371
1371
|
var getNodeValue2 = getNodeValue;
|
|
1372
1372
|
var ParseErrorCode;
|
|
@@ -1667,7 +1667,7 @@ var TOKEN_COMMA = 5;
|
|
|
1667
1667
|
var TOKEN_EOF = 17;
|
|
1668
1668
|
function parseDocument(text) {
|
|
1669
1669
|
const errors = [];
|
|
1670
|
-
const root =
|
|
1670
|
+
const root = parseTree(text, errors, { allowTrailingComma: true });
|
|
1671
1671
|
if (!root || errors.length > 0) {
|
|
1672
1672
|
throw new Error("Cannot edit invalid JSONC");
|
|
1673
1673
|
}
|
|
@@ -3843,4 +3843,4 @@ function loadPluginConfigDetailed(directory, applyRuntimeGlobals = true) {
|
|
|
3843
3843
|
};
|
|
3844
3844
|
}
|
|
3845
3845
|
|
|
3846
|
-
export { getMagicContextBuiltinCommands, parseJsoncRecovering, readJsoncFile, detectConfigFile, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, resolveLegacyConfigSourcesForHarness, getProtectedTokensTierOverrides, loadPluginConfigDetailed };
|
|
3846
|
+
export { getMagicContextBuiltinCommands, parseTree, parseJsoncRecovering, readJsoncFile, detectConfigFile, cortexKitUserConfigBasePath, cortexKitProjectConfigBasePath, resolveLegacyConfigSources, resolveLegacyConfigSourcesForHarness, getProtectedTokensTierOverrides, loadPluginConfigDetailed };
|
|
@@ -3,21 +3,21 @@ import {
|
|
|
3
3
|
} from "./server-kaqs6h31.js";
|
|
4
4
|
import {
|
|
5
5
|
getSqliteDatabasePath2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-beht37jy.js";
|
|
7
7
|
import {
|
|
8
8
|
runSessionWarmupWorker
|
|
9
|
-
} from "./server-
|
|
9
|
+
} from "./server-xj136kt8.js";
|
|
10
10
|
import {
|
|
11
11
|
estimateTokens
|
|
12
|
-
} from "./server-
|
|
12
|
+
} from "./server-tgnbmwah.js";
|
|
13
13
|
import {
|
|
14
14
|
openCodeDbExists,
|
|
15
15
|
withReadOnlySessionDb
|
|
16
|
-
} from "./server-
|
|
16
|
+
} from "./server-n1prf1g6.js";
|
|
17
17
|
import {
|
|
18
18
|
hasRawMessageProvider2,
|
|
19
19
|
readRawSessionMessageIdOrdinalsForRange2
|
|
20
|
-
} from "./server-
|
|
20
|
+
} from "./server-xhab8jx8.js";
|
|
21
21
|
|
|
22
22
|
// src/tools/ctx-expand/search-archive.ts
|
|
23
23
|
var archiveReadsOnThisThread = 0;
|
|
@@ -4,7 +4,7 @@ import {
|
|
|
4
4
|
} from "./server-f2xf5gcb.js";
|
|
5
5
|
import {
|
|
6
6
|
inRootAsyncContext2
|
|
7
|
-
} from "./server-
|
|
7
|
+
} from "./server-beht37jy.js";
|
|
8
8
|
import {
|
|
9
9
|
projectDirectoryKey
|
|
10
10
|
} from "./server-knvkbfvh.js";
|
|
@@ -21,7 +21,7 @@ import path3 from "node:path";
|
|
|
21
21
|
|
|
22
22
|
// src/features/magic-context/memory/project-identity-cache.ts
|
|
23
23
|
import { createHash } from "node:crypto";
|
|
24
|
-
import { readFileSync } from "node:fs";
|
|
24
|
+
import { promises as fs, readFileSync } from "node:fs";
|
|
25
25
|
import path from "node:path";
|
|
26
26
|
function cachePath(directory, storageDir = getMagicContextStorageDir()) {
|
|
27
27
|
const hash = createHash("sha256").update(projectDirectoryKey(directory)).digest("hex");
|
|
@@ -41,6 +41,35 @@ function readRememberedGitIdentity(directory, storageDir) {
|
|
|
41
41
|
} catch {}
|
|
42
42
|
return;
|
|
43
43
|
}
|
|
44
|
+
async function pruneMissingProjectIdentities(storageDir = getMagicContextStorageDir()) {
|
|
45
|
+
const directory = path.join(storageDir, "project-identities");
|
|
46
|
+
let removed = 0;
|
|
47
|
+
let entries;
|
|
48
|
+
try {
|
|
49
|
+
entries = await fs.readdir(directory);
|
|
50
|
+
} catch {
|
|
51
|
+
return 0;
|
|
52
|
+
}
|
|
53
|
+
for (const entry of entries) {
|
|
54
|
+
if (!/^[0-9a-f]{64}\.json$/.test(entry))
|
|
55
|
+
continue;
|
|
56
|
+
const file = path.join(directory, entry);
|
|
57
|
+
try {
|
|
58
|
+
const record = JSON.parse(await fs.readFile(file, "utf8"));
|
|
59
|
+
if (typeof record.directory !== "string" || !path.isAbsolute(record.directory) || cachePath(record.directory, storageDir) !== file || !/^git:[0-9a-f]{7,64}$/.test(record.identity))
|
|
60
|
+
continue;
|
|
61
|
+
try {
|
|
62
|
+
await fs.stat(record.directory);
|
|
63
|
+
} catch (error) {
|
|
64
|
+
if (error.code !== "ENOENT")
|
|
65
|
+
continue;
|
|
66
|
+
await fs.unlink(file);
|
|
67
|
+
removed++;
|
|
68
|
+
}
|
|
69
|
+
} catch {}
|
|
70
|
+
}
|
|
71
|
+
return removed;
|
|
72
|
+
}
|
|
44
73
|
|
|
45
74
|
// src/features/magic-context/memory/unborn-head.ts
|
|
46
75
|
import { readFileSync as readFileSync2, realpathSync, statSync } from "node:fs";
|
|
@@ -708,4 +737,4 @@ function setBootQuietPeriodForTests(startAtMs) {
|
|
|
708
737
|
bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
|
|
709
738
|
}
|
|
710
739
|
|
|
711
|
-
export { setHomeProjectPermission, shouldSkipHomeProjectMemory, ProjectIdentityError, takeDubiousOwnershipProjectIdentityWarning, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, describeUnresolvedProjectIdentity, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
|
|
740
|
+
export { pruneMissingProjectIdentities, setHomeProjectPermission, shouldSkipHomeProjectMemory, ProjectIdentityError, takeDubiousOwnershipProjectIdentityWarning, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, describeUnresolvedProjectIdentity, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
|
|
@@ -29,7 +29,27 @@ function isSystemDirective(text) {
|
|
|
29
29
|
return text.trimStart().startsWith(SYSTEM_DIRECTIVE_PREFIX);
|
|
30
30
|
}
|
|
31
31
|
function removeSystemReminders(text) {
|
|
32
|
-
return text
|
|
32
|
+
return removeNestedBlocks(text, ["system-reminder"]).trim();
|
|
33
|
+
}
|
|
34
|
+
function removeNestedBlocks(text, names) {
|
|
35
|
+
const tags = new RegExp(`<(/?)(${names.join("|")})(?:\\s[^<>]*?)?\\s*(/?)>`, "gi");
|
|
36
|
+
const stack = [];
|
|
37
|
+
let end = 0;
|
|
38
|
+
let result = "";
|
|
39
|
+
for (const match of text.matchAll(tags)) {
|
|
40
|
+
if (stack.length === 0)
|
|
41
|
+
result += text.slice(end, match.index);
|
|
42
|
+
const name = match[2].toLowerCase();
|
|
43
|
+
if (match[1]) {
|
|
44
|
+
if (stack[stack.length - 1] === name)
|
|
45
|
+
stack.pop();
|
|
46
|
+
} else if (!match[3])
|
|
47
|
+
stack.push(name);
|
|
48
|
+
end = match.index + match[0].length;
|
|
49
|
+
}
|
|
50
|
+
if (stack.length === 0)
|
|
51
|
+
result += text.slice(end);
|
|
52
|
+
return result;
|
|
33
53
|
}
|
|
34
54
|
|
|
35
55
|
// src/hooks/magic-context/token-count-exact.ts
|
|
@@ -730,4 +750,4 @@ function mergeCommitHashes(existing, next) {
|
|
|
730
750
|
return merged;
|
|
731
751
|
}
|
|
732
752
|
|
|
733
|
-
export { textMentionsRecentCommit, OMO_INTERNAL_INITIATOR_MARKER, isSystemDirective, removeSystemReminders, hasMeaningfulUserText2, extractTexts2, extractToolResultBodyTokens, extractToolCallSummaries, getTokenizerNativeMemoryStats, preloadTokenizer, getTokenEstimatorFingerprint, hasTokenizerForFit, tokenCountUsesByteBound, estimateTokens, createTokenCountMemo, estimateFixedPromptTokens, normalizeText, compactRole, formatBlock, compactTextForSummary, mergeCommitHashes };
|
|
753
|
+
export { textMentionsRecentCommit, OMO_INTERNAL_INITIATOR_MARKER, isSystemDirective, removeSystemReminders, removeNestedBlocks, hasMeaningfulUserText2, extractTexts2, extractToolResultBodyTokens, extractToolCallSummaries, getTokenizerNativeMemoryStats, preloadTokenizer, getTokenEstimatorFingerprint, hasTokenizerForFit, tokenCountUsesByteBound, estimateTokens, createTokenCountMemo, estimateFixedPromptTokens, normalizeText, compactRole, formatBlock, compactTextForSummary, mergeCommitHashes };
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
} from "./server-pavzsdc6.js";
|
|
4
4
|
import {
|
|
5
5
|
prepareCachedStatement2
|
|
6
|
-
} from "./server-
|
|
6
|
+
} from "./server-beht37jy.js";
|
|
7
7
|
import {
|
|
8
8
|
UNKNOWN_FIT_RATIO,
|
|
9
9
|
resolveDecisionCalibration,
|
|
@@ -23,10 +23,11 @@ import {
|
|
|
23
23
|
TAG_SELECT_COLUMNS2,
|
|
24
24
|
getCandidateToolOwners2,
|
|
25
25
|
pickNearestPriorOwner2
|
|
26
|
-
} from "./server-
|
|
26
|
+
} from "./server-27gq4mfz.js";
|
|
27
27
|
import {
|
|
28
28
|
OMO_INTERNAL_INITIATOR_MARKER,
|
|
29
29
|
isSystemDirective,
|
|
30
|
+
removeSystemReminders,
|
|
30
31
|
hasMeaningfulUserText2,
|
|
31
32
|
extractTexts2,
|
|
32
33
|
extractToolResultBodyTokens,
|
|
@@ -40,7 +41,7 @@ import {
|
|
|
40
41
|
formatBlock,
|
|
41
42
|
compactTextForSummary,
|
|
42
43
|
mergeCommitHashes
|
|
43
|
-
} from "./server-
|
|
44
|
+
} from "./server-tgnbmwah.js";
|
|
44
45
|
import {
|
|
45
46
|
sessionLog2
|
|
46
47
|
} from "./server-f2xf5gcb.js";
|
|
@@ -68,18 +69,18 @@ import {
|
|
|
68
69
|
readRawSeedTailFromDb2,
|
|
69
70
|
readRawSessionBoundaryEndpointsFromDb2,
|
|
70
71
|
prewarmRawSessionOrdinalsForDb
|
|
71
|
-
} from "./server-
|
|
72
|
+
} from "./server-xj136kt8.js";
|
|
72
73
|
import {
|
|
73
74
|
openCodeDbExists,
|
|
74
75
|
withReadOnlySessionDb,
|
|
75
76
|
getRawSessionMessageCountFromDb,
|
|
76
77
|
getMessageTimesFromOpenCodeDb
|
|
77
|
-
} from "./server-
|
|
78
|
+
} from "./server-n1prf1g6.js";
|
|
78
79
|
import {
|
|
79
80
|
getToolDefinitionMeasurementSignature,
|
|
80
81
|
getLargestMeasuredToolDefinitionTokens,
|
|
81
82
|
getMeasuredToolDefinitionTokens
|
|
82
|
-
} from "./server-
|
|
83
|
+
} from "./server-g3qma5c0.js";
|
|
83
84
|
import {
|
|
84
85
|
canonicalModelIdentity,
|
|
85
86
|
piModelRefToCanonical
|
|
@@ -439,7 +440,7 @@ function isSessionMetaRow(row) {
|
|
|
439
440
|
if (row === null || typeof row !== "object")
|
|
440
441
|
return false;
|
|
441
442
|
const r = row;
|
|
442
|
-
return typeof r.session_id === "string" && isNumberOrNull(r.last_response_time) && isStringOrNull(r.cache_ttl) && typeof r.counter === "number" && typeof r.last_nudge_tokens === "number" && isStringOrNull(r.last_nudge_band) && isStringOrNull(r.last_transform_error) &&
|
|
443
|
+
return typeof r.session_id === "string" && isNumberOrNull(r.last_response_time) && isStringOrNull(r.cache_ttl) && typeof r.counter === "number" && typeof r.last_nudge_tokens === "number" && isStringOrNull(r.last_nudge_band) && isStringOrNull(r.last_transform_error) && isNumberOrNull(r.is_subagent) && typeof r.last_context_percentage === "number" && typeof r.last_input_tokens === "number" && isNumberOrNull(r.observed_safe_input_tokens) && isNumberOrNull(r.cache_alert_sent) && isNumberOrNull(r.times_execute_threshold_reached) && isNumberOrNull(r.compartment_in_progress) && (r.system_prompt_hash === null || typeof r.system_prompt_hash === "string" || typeof r.system_prompt_hash === "number") && isNumberOrNull(r.system_prompt_tokens) && isNumberOrNull(r.conversation_tokens) && isNumberOrNull(r.tool_call_tokens) && isNumberOrNull(r.cleared_reasoning_through_tag) && isStringOrNull(r.last_todo_state) && isBlobOrNull(r.cached_m0_bytes) && isStringOrNull(r.cached_m0_mural_data_url) && isStringOrNull(r.cached_m0_mural_hash) && isBlobOrNull(r.cached_m1_bytes) && isNumberOrNull(r.cached_m0_project_memory_epoch) && isStringOrNull(r.cached_m0_workspace_fingerprint) && isNumberOrNull(r.cached_m0_project_user_profile_version) && isNumberOrNull(r.cached_m0_max_compartment_seq) && isNumberOrNull(r.cached_m0_max_memory_id) && isNumberOrNull(r.cached_m0_max_mutation_id) && isNumberOrNull(r.cached_m0_max_memory_mutation_id) && isStringOrNull(r.cached_m0_project_docs_hash) && isNumberOrNull(r.cached_m0_materialized_at) && isNumberOrNull(r.cached_m0_session_facts_version) && isStringOrNull(r.cached_m0_upgrade_state) && isStringOrNull(r.cached_m0_system_hash) && isStringOrNull(r.cached_m0_tool_set_hash) && isStringOrNull(r.cached_m0_model_key) && isStringOrNull(r.cached_m0_project_identity) && isStringOrNull(r.last_observed_model_key) && isNumberOrNull(r.last_usage_context_limit) && isNumberOrNull(r.prior_boundary_ordinal) && isNumberOrNull(r.protected_tail_policy_version) && isNumberOrNull(r.protected_tail_drain_window_started_at) && isNumberOrNull(r.protected_tail_drain_tokens) && isNumberOrNull(r.recovery_no_eligible_head_count) && isNumberOrNull(r.force_emergency_bypass_window_start) && isNumberOrNull(r.force_emergency_bypass_used) && isNumberOrNull(r.upgrade_reminded_at) && isNumberOrNull(r.upgrade_reminder_last_sent_at) && isNumberOrNull(r.upgrade_reminder_count) && isNumberOrNull(r.pi_stable_id_scheme) && isNumberOrNull(r.tool_reclaim_watermark);
|
|
443
444
|
}
|
|
444
445
|
function getDefaultSessionMeta(sessionId) {
|
|
445
446
|
return {
|
|
@@ -499,7 +500,7 @@ function getDefaultSessionMeta(sessionId) {
|
|
|
499
500
|
};
|
|
500
501
|
}
|
|
501
502
|
var sessionMetaExistsStatements = new WeakMap;
|
|
502
|
-
function ensureSessionMetaRow(db, sessionId, initialIsSubagent = false) {
|
|
503
|
+
function ensureSessionMetaRow(db, sessionId, initialIsSubagent = getHarness2() === "opencode2" ? null : false) {
|
|
503
504
|
let exists = sessionMetaExistsStatements.get(db);
|
|
504
505
|
if (!exists) {
|
|
505
506
|
exists = prepareCachedStatement2(db, "SELECT 1 FROM session_meta WHERE session_id = ?");
|
|
@@ -508,7 +509,7 @@ function ensureSessionMetaRow(db, sessionId, initialIsSubagent = false) {
|
|
|
508
509
|
if (exists.get(sessionId))
|
|
509
510
|
return;
|
|
510
511
|
const defaults = getDefaultSessionMeta(sessionId);
|
|
511
|
-
db.prepare("INSERT OR IGNORE INTO session_meta (session_id, harness, last_response_time, cache_ttl, counter, last_nudge_tokens, last_nudge_band, last_transform_error, is_subagent, last_context_percentage, last_input_tokens, observed_safe_input_tokens, cache_alert_sent, times_execute_threshold_reached, compartment_in_progress, system_prompt_hash, cleared_reasoning_through_tag) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(sessionId, getHarness2(), defaults.lastResponseTime, defaults.cacheTtl, defaults.counter, defaults.lastNudgeTokens, defaults.lastNudgeBand ?? "", defaults.lastTransformError ?? "", initialIsSubagent ? 1 : 0, defaults.lastContextPercentage, defaults.lastInputTokens, defaults.observedSafeInputTokens, defaults.cacheAlertSent ? 1 : 0, defaults.timesExecuteThresholdReached, defaults.compartmentInProgress ? 1 : 0, defaults.systemPromptHash ?? "", defaults.clearedReasoningThroughTag);
|
|
512
|
+
db.prepare("INSERT OR IGNORE INTO session_meta (session_id, harness, last_response_time, cache_ttl, counter, last_nudge_tokens, last_nudge_band, last_transform_error, is_subagent, last_context_percentage, last_input_tokens, observed_safe_input_tokens, cache_alert_sent, times_execute_threshold_reached, compartment_in_progress, system_prompt_hash, cleared_reasoning_through_tag) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)").run(sessionId, getHarness2(), defaults.lastResponseTime, defaults.cacheTtl, defaults.counter, defaults.lastNudgeTokens, defaults.lastNudgeBand ?? "", defaults.lastTransformError ?? "", initialIsSubagent === null ? null : initialIsSubagent ? 1 : 0, defaults.lastContextPercentage, defaults.lastInputTokens, defaults.observedSafeInputTokens, defaults.cacheAlertSent ? 1 : 0, defaults.timesExecuteThresholdReached, defaults.compartmentInProgress ? 1 : 0, defaults.systemPromptHash ?? "", defaults.clearedReasoningThroughTag);
|
|
512
513
|
}
|
|
513
514
|
function toSessionMeta(row) {
|
|
514
515
|
const nudgeBandRaw = typeof row.last_nudge_band === "string" ? row.last_nudge_band : "";
|
|
@@ -639,6 +640,9 @@ function clearCachedM0M1(db, sessionId) {
|
|
|
639
640
|
return;
|
|
640
641
|
db.prepare(`UPDATE session_meta SET ${setClauses.join(", ")} WHERE session_id = ?`).run(...values, sessionId);
|
|
641
642
|
}
|
|
643
|
+
function clearCachedM0(db, sessionId) {
|
|
644
|
+
clearCachedM0M1(db, sessionId);
|
|
645
|
+
}
|
|
642
646
|
// src/shared/historian-tool-defaults.json
|
|
643
647
|
var historian_tool_defaults_default = {
|
|
644
648
|
ctx_note: "Note ${input.action} ${input.note_ids}: ${input.content} → ${output.truncate(160)}",
|
|
@@ -771,6 +775,35 @@ function isHostRenderedSystemMessage(message) {
|
|
|
771
775
|
const id = message.info.id;
|
|
772
776
|
return (typeof id !== "string" || id.length === 0) && message.info.role === "system";
|
|
773
777
|
}
|
|
778
|
+
var COVERED_INSTRUCTION_ROW = "coveredInstructionRow";
|
|
779
|
+
function markCoveredInstructionRow(target) {
|
|
780
|
+
Object.defineProperty(target, COVERED_INSTRUCTION_ROW, {
|
|
781
|
+
value: true,
|
|
782
|
+
enumerable: false,
|
|
783
|
+
configurable: true
|
|
784
|
+
});
|
|
785
|
+
return target;
|
|
786
|
+
}
|
|
787
|
+
function isCoveredInstructionRow(value) {
|
|
788
|
+
return typeof value === "object" && value !== null && value[COVERED_INSTRUCTION_ROW] === true;
|
|
789
|
+
}
|
|
790
|
+
function takeCoveredInstructionRows(messages) {
|
|
791
|
+
const taken = messages.filter((message) => isCoveredInstructionRow(message.info));
|
|
792
|
+
if (taken.length > 0) {
|
|
793
|
+
const kept = messages.filter((message) => !isCoveredInstructionRow(message.info));
|
|
794
|
+
messages.splice(0, messages.length, ...kept);
|
|
795
|
+
}
|
|
796
|
+
return taken;
|
|
797
|
+
}
|
|
798
|
+
function cloneKeepingCoveredInstructionMarks(messages) {
|
|
799
|
+
const copy = structuredClone(messages);
|
|
800
|
+
messages.forEach((message, index) => {
|
|
801
|
+
const copied = copy[index];
|
|
802
|
+
if (copied && isCoveredInstructionRow(message.info))
|
|
803
|
+
markCoveredInstructionRow(copied.info);
|
|
804
|
+
});
|
|
805
|
+
return copy;
|
|
806
|
+
}
|
|
774
807
|
|
|
775
808
|
// src/hooks/magic-context/read-session-true-raw-tokens.ts
|
|
776
809
|
function completedToolArcCrossesBoundary(invOrdinal, resOrdinal, boundary) {
|
|
@@ -1419,11 +1452,6 @@ function isFilePart(part) {
|
|
|
1419
1452
|
const p = part;
|
|
1420
1453
|
return p.type === "file" && typeof p.url === "string";
|
|
1421
1454
|
}
|
|
1422
|
-
function buildFileSourceContent(parts) {
|
|
1423
|
-
const content = parts.filter(isTextPart).map((part) => stripTagPrefix(part.text)).join(`
|
|
1424
|
-
`).trim();
|
|
1425
|
-
return content.length > 0 ? content : null;
|
|
1426
|
-
}
|
|
1427
1455
|
|
|
1428
1456
|
// src/shared/user-answer.ts
|
|
1429
1457
|
function hasUserAnswerMetadata(value) {
|
|
@@ -5619,6 +5647,12 @@ function estimateFinalWireInputTokens(input) {
|
|
|
5619
5647
|
prose: messageTokens.conversation
|
|
5620
5648
|
};
|
|
5621
5649
|
const tokens = providerMass(rawComponents, calibration, true);
|
|
5650
|
+
const pressureToolDefinitions = measuredToolDefinitions ?? largestToolDefinitions ?? 0;
|
|
5651
|
+
const pressureTokens = providerMass({
|
|
5652
|
+
system: rawComponents.system,
|
|
5653
|
+
tools: pressureToolDefinitions + messageTokens.toolCall,
|
|
5654
|
+
prose: rawComponents.prose
|
|
5655
|
+
}, calibration);
|
|
5622
5656
|
const complete = Number.isFinite(tokens) && tokens > 0 && Number.isFinite(input.systemPromptTokens) && input.systemPromptTokens > 0 && toolDefinitions !== undefined && input.messages.every(hasCountableParts);
|
|
5623
5657
|
const refusalGrade = complete && hasTokenizerForFit() && measuredToolDefinitions !== undefined && hasMeasuredDecisionCalibration(calibration) && input.messages.every(hasRefusalCountableParts);
|
|
5624
5658
|
const measured = input.measuredPrefix;
|
|
@@ -5641,6 +5675,7 @@ function estimateFinalWireInputTokens(input) {
|
|
|
5641
5675
|
refusalBasis: refusalGrade ? useMeasured ? "provider-prefix" : "calibrated" : undefined,
|
|
5642
5676
|
rawTokens: rawComponents.system + rawComponents.tools + rawComponents.prose,
|
|
5643
5677
|
rawComponents,
|
|
5678
|
+
pressureTokens,
|
|
5644
5679
|
completeness: complete ? "complete" : "partial",
|
|
5645
5680
|
componentsComplete: toolDefinitions !== undefined && input.messages.every(hasCountableParts),
|
|
5646
5681
|
messageTokens,
|
|
@@ -5969,7 +6004,7 @@ class ToolMutationBatch {
|
|
|
5969
6004
|
this.partsToRemove.add(servedPart(occurrence));
|
|
5970
6005
|
this.affectedMessages.add(occurrence.message);
|
|
5971
6006
|
}
|
|
5972
|
-
wouldStrandConversationEnd(occurrences) {
|
|
6007
|
+
wouldStrandConversationEnd(occurrences, plannedRemovals) {
|
|
5973
6008
|
const served = this.servedMessages ?? this.messages;
|
|
5974
6009
|
let end;
|
|
5975
6010
|
for (let i = served.length - 1;i >= 0 && end === undefined; i -= 1) {
|
|
@@ -5979,7 +6014,7 @@ class ToolMutationBatch {
|
|
|
5979
6014
|
if (!end || !occurrences.some((occurrence) => occurrence.message === end))
|
|
5980
6015
|
return false;
|
|
5981
6016
|
const leaving = new Set(occurrences.map(servedPart));
|
|
5982
|
-
const survives = (part) => !leaving.has(part) && !this.partsToRemove.has(part);
|
|
6017
|
+
const survives = (part) => !leaving.has(part) && !this.partsToRemove.has(part) && !plannedRemovals?.has(part);
|
|
5983
6018
|
return end.info.role === "assistant" ? !end.parts.some((part) => partHasCompletedResult(part) && survives(part)) : !end.parts.some((part) => hasMeaningfulPart(part) && survives(part));
|
|
5984
6019
|
}
|
|
5985
6020
|
finalize() {
|
|
@@ -6153,11 +6188,16 @@ function createToolDropTarget(compositeKey, thinkingParts, index, batch, tagId)
|
|
|
6153
6188
|
return null;
|
|
6154
6189
|
return toolInputStringBytes(readRawInput());
|
|
6155
6190
|
},
|
|
6156
|
-
wouldStrandConversationEnd: () => {
|
|
6191
|
+
wouldStrandConversationEnd: (plannedRemovals) => {
|
|
6157
6192
|
const entry = index.get(compositeKey);
|
|
6158
6193
|
if (!entry || entry.occurrences.length === 0)
|
|
6159
6194
|
return false;
|
|
6160
|
-
return batch.wouldStrandConversationEnd(entry.occurrences);
|
|
6195
|
+
return batch.wouldStrandConversationEnd(entry.occurrences, plannedRemovals);
|
|
6196
|
+
},
|
|
6197
|
+
notePlannedRemoval: (plannedRemovals) => {
|
|
6198
|
+
for (const occurrence of index.get(compositeKey)?.occurrences ?? []) {
|
|
6199
|
+
plannedRemovals.add(servedPart(occurrence));
|
|
6200
|
+
}
|
|
6161
6201
|
},
|
|
6162
6202
|
prepareDrop: () => {
|
|
6163
6203
|
const entry = index.get(compositeKey);
|
|
@@ -6264,9 +6304,8 @@ function withRawMessageProvider2(sessionId, provider, fn) {
|
|
|
6264
6304
|
cleanup();
|
|
6265
6305
|
return result;
|
|
6266
6306
|
}
|
|
6267
|
-
var SYSTEM_REMINDER_BLOCK_REGEX = /<system-reminder>[\s\S]*?<\/system-reminder>/gi;
|
|
6268
6307
|
function cleanUserText2(text) {
|
|
6269
|
-
return stripOutsideSteeringWrappers(text, (segment) => segment
|
|
6308
|
+
return stripOutsideSteeringWrappers(text, (segment) => removeSystemReminders(segment).replace(OMO_INTERNAL_INITIATOR_MARKER, "")).trim();
|
|
6270
6309
|
}
|
|
6271
6310
|
function hasMeaningfulChunkUserText(parts) {
|
|
6272
6311
|
for (const part of parts) {
|
|
@@ -7158,4 +7197,4 @@ function readRawSessionSeedTail2(sessionId, boundaryId, onQuery) {
|
|
|
7158
7197
|
});
|
|
7159
7198
|
}
|
|
7160
7199
|
|
|
7161
|
-
export { detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, expandToolPart, markHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, stripSystemInjection, isTextPart, isToolPartWithOutput, isFilePart,
|
|
7200
|
+
export { detectLatestTurnThinkingMismatch, isPrefixBoundThinkingModel, detectOverflow, SESSION_META_SELECT_COLUMNS, META_COLUMNS, BOOLEAN_META_KEYS, NULL_BIND_META_KEYS, isSessionMetaRow, getDefaultSessionMeta, ensureSessionMetaRow, toSessionMeta, persistCachedM0, clearCachedM0M1, clearCachedM0, expandToolPart, markHostUnservedRow, retreatPastHostUnservedRows, snapTerminalCompartmentToServedRow, isHostRenderedSystemMessage, markCoveredInstructionRow, isCoveredInstructionRow, takeCoveredInstructionRows, cloneKeepingCoveredInstructionMarks, completedToolArcCrossesBoundary, estimateTrueRawMessageTokens, buildToolArcs, fenceBoundaryForCompletedToolArcs, fenceBoundaryForToolArcs, buildTrueRawTokenIndex, computeRawRangeFingerprint, stripSystemInjection, isTextPart, isToolPartWithOutput, isFilePart, toolPartHasUserAnswer, DreamTokenBudgetExceeded, TOKEN_BUDGET_FINALIZE_MESSAGE, registerBudgetFinalizeChild, releaseBudgetFinalizeChild, createDreamTokenBudget, TOOL_USE_DISABLED, needsBlockedRead, withBlockedReadInstruction, rememberV1HiddenRun, recordToolParameters, createDroppedInputGuard, assertExecutableToolInput, isEditTool, MERGED_REASONING_PARTS_PREFIX, decodeMergedReasoningParts, MAX_EXECUTE_THRESHOLD, escalationBands, HYGIENE_PROVIDER_UNITS_VERSION, sessionDecisionCalibration, transitionSessionHygieneUnits, readEpochFloorSnapshot, getProtectionWindowForSession, withReplayEnvelopeSnapshot, invalidateReplayEnvelopeSnapshot, isRustMarkerAdmissionFenced, setRustMarkerAdmissionFence, ReplayDocumentError, readReplayEnvelope, readReplayDocument, updateReplayDocument, writeReplayDocument, isEmergencyRecoveryArmed, isProviderOverflowReconfirmed, isProviderOverflowFailClosedProven, getEmergencyRecoveryArmedAt, describeProtectedTailDrainBudgetSkip, loadPersistedUsage, loadProtectedTailMeta, markProtectedTailPolicyV3Seeded, recordProtectedTailPublicationFloor, recordProtectedTailNoEligibleHead, resetProtectedTailNoEligibleHead, getWrapupInProgressState, isWrapupInProgress, acquireWrapupInProgress, updateWrapupInProgress, releaseWrapupInProgress, resolveCompactionModeRecord, getCompactionModeRecord, setCompactionModeRecord, getProtectedTailDrainBudgetSkip, reserveProtectedTailDrainTokens, clearEmergencyDrainLatch, recordHistorianDrainFailure, clearHistorianDrainFailure, rollbackProtectedTailDrainReservation, clearPersistedReasoningWatermark, getEmergencyInputSample, setEmergencyDropSample, clearEmergencyDropSample, getLastNudgeUndropped, setLastNudgeUndropped, getChannel1NudgeState, setChannel1NudgeState, markChannel1PostReduceGracePending, captureChannel1PostReduceGraceBaseline, getChannel2NudgeState, setChannel2NudgeState, casChannel2NudgeState, claimChannel2NudgeState, casChannel2NudgeClaim, getPersistedNoteNudge, setPersistedNoteNudgeTrigger, setPersistedNoteNudgeTriggerMessageId, getNoteNudgeAnchors, getAutoSearchHintDecisions, deliverNoteNudgeAtomic, appendAutoSearchHintDecision, pruneNoteNudgeAnchors, queueAutoSearchHintDecisionRetirement, flushAutoSearchHintDecisionRetirement, getPersistedTodoPermissionDenied, setPersistedTodoPermissionDenied, getPersistedTodoSyntheticAnchor, setPersistedTodoSyntheticAnchor, clearPersistedTodoSyntheticAnchor, getNoteLastReadAt, setNoteLastReadAt, getHistorianFailureState, incrementHistorianFailure, clearHistorianFailureState, getOverflowState, loadTransformPassStateSnapshot, recordOverflowDetected, recordDetectedContextLimit, clearEmergencyRecovery, clearDetectedContextLimit, getPersistedCompactionMarkerState, setPersistedCompactionMarkerState, getDeferredClearedCompactionMarkerState, retireDeferredClearedCompactionMarkerState, parseStrippedPlaceholderState, serializeStrippedPlaceholderState, getStrippedPlaceholderIds, applyStrippedPlaceholderDelta, THINKING_BINDING_RECOVERY_FROZEN_PREFIX, THINKING_BINDING_STRIP_ORDER_END_MARKER, thinkingBindingRecoveryFrozenId, getThinkingBindingRecoveryTarget, clearThinkingBindingRecoveryIf, getMergedReasoningStrippedIds, addMergedReasoningStrippedIds, getTrailingBlankDecisions, addTrailingBlankDecisions, demoteTrailingBlankKeepDecisions, getStaleReduceStrippedIds, addStaleReduceStrippedIds, getProcessedImageStrippedIds, parseProcessedImageMarkers, serializeProcessedImageMarkers, getProcessedImageMarkers, addProcessedImageStrippedIds, getPendingCompactionMarkerState, getCompactionMarkerHealth, loadPostprocessReplaySnapshot, setPendingCompactionMarkerState, replacePendingCompactionMarkerStateIf, clearPendingCompactionMarkerStateIf, getPendingPiCompactionMarkerState, clearPendingPiCompactionMarkerStateIf, logPiCompactionMarkerClear, setSessionWorkMetrics, getObservedEpochFloor, resolveEpochFloorForPass, getReasoningRemovalState, addRemovedReasoningIds, markDropLeavesReasoning, modelAcceptsEmptyContent, isAnthropicFamilyRoute, neutralizeDroppedReasoningPart, restoreNeutralizedReasoningPart, isNeutralizedReasoningPart, variantChangeBustsProviderCache, makeSentinel, makeWholeMessageSentinel, isSentinel, replaySentinelByMessageIds, isInActiveAnthropicTurn, activeAnthropicTurnStart, hasAnthropicReasoning, stripSystemInjectedMessages, stripDroppedPlaceholderMessages, replayClearedReasoning, replayStrippedInlineThinking, clearOldReasoning, stripClearedReasoning, stripInlineThinking, findReasoningBearingAssistantIds, findLatestAssistantReasoningMutationExemptMessage, snapshotTrailingBlankSourceDecisions, findTrailingBlankDecisionCandidates, applyFrozenTrailingBlankDecisions, stripReasoningFromAssistantIds, findMergedReasoningStripDecisions, stripReasoningFromMergedAssistants, getEmptyImageParts, stripProcessedImages, projectOpencodeReasoningBudgetCutoff, DEFAULT_KEEP_REASONING_TOKENS, resolveKeepReasoningTokens, reasoningStepCost, reasoningBudgetCutoff, reasoningTextAndOpaque, opencodeReasoningBudgetCutoff, describeFinalWireTail, estimatePartImageTokens, estimateMessageTokens, wireContentBytes, createFinalWireUsageTracker, estimateFinalWireInputTokens, estimateAppendedWireTokens, SKELETON_REAL_INPUT_MAX_BYTES, partHasCompletedResult, extractToolCallObservation, ToolMutationBatch, createToolDropTarget, resolveHostServedBoundaryId2, hasRawMessageProvider2, setRawMessageProvider2, setBoundedRawMessageProvider2, withRawMessageProvider2, cleanUserText2, withRawSessionMessageCache2, readRawSessionMessages2, readRawSessionMessagePage2, getRawSessionMessageOrdinalCount2, RAW_MESSAGE_VISIT_PAGE_SIZE2, visitRawSessionMessages2, visitRawSessionMessagesAsync2, readRawSessionMessageRange2, prepareRawSessionOrdinals2, primeTailRawMessageCache2, getCachedAbsoluteMessageCount2, primeInMemoryTailRawMessageCache2, readRawSessionMessageOrdinalPage2, getRawSessionStoredMessageCount2, readRawSessionMessageIdOrdinalsForRange2, readRawSessionMessageIdOrdinals2, readRawSessionMessagePartsById2, readRawSessionBoundaryEndpoints2, hasRawSessionMessageById2, readRawSessionMessageOrdinalById2, compareRawSessionMessageOrder2, readRawSessionMessageById2, getRawSessionMessageCount2, RAW_SESSION_TAG_KEY_PAGE_SIZE2, getRawSessionTagKeysThrough2, getLegacyProtectedTailStartOrdinal2, getProtectedTailStartOrdinal2, readSessionChunk2, getRawSessionMessageIdsThrough2, readRawSessionSeedTail2 };
|
|
@@ -7,15 +7,15 @@ import {
|
|
|
7
7
|
import {
|
|
8
8
|
isSynapseEmbeddingTruncated,
|
|
9
9
|
SynapseEmbeddingProvider
|
|
10
|
-
} from "./server-
|
|
10
|
+
} from "./server-6tmj0s7j.js";
|
|
11
11
|
import {
|
|
12
12
|
LocalEmbeddingProvider
|
|
13
|
-
} from "./server-
|
|
13
|
+
} from "./server-h1v0pyxb.js";
|
|
14
14
|
import {
|
|
15
15
|
OpenAICompatibleEmbeddingProvider,
|
|
16
16
|
getProjectEmbeddingSnapshot2,
|
|
17
17
|
embedBatchForProject2
|
|
18
|
-
} from "./server-
|
|
18
|
+
} from "./server-8by8qfec.js";
|
|
19
19
|
import {
|
|
20
20
|
isEmbeddingHostBusy2
|
|
21
21
|
} from "./server-qt1qqasc.js";
|
package/dist/v2/server.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadPluginConfigDetailed
|
|
3
|
-
} from "./server-
|
|
3
|
+
} from "./server-nj659894.js";
|
|
4
4
|
import {
|
|
5
5
|
setHarness2
|
|
6
6
|
} from "./server-pavzsdc6.js";
|
|
@@ -25,7 +25,7 @@ import {
|
|
|
25
25
|
import {
|
|
26
26
|
pushNotification2
|
|
27
27
|
} from "./server-x8a7jmkh.js";
|
|
28
|
-
import"./server-
|
|
28
|
+
import"./server-beht37jy.js";
|
|
29
29
|
import {
|
|
30
30
|
compareSemverCore
|
|
31
31
|
} from "./server-84w6rvvf.js";
|
|
@@ -7874,7 +7874,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7874
7874
|
// package.json
|
|
7875
7875
|
var package_default = {
|
|
7876
7876
|
name: "@cortexkit/opencode-magic-context",
|
|
7877
|
-
version: "0.49.
|
|
7877
|
+
version: "0.49.18",
|
|
7878
7878
|
type: "module",
|
|
7879
7879
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7880
7880
|
main: "dist/index.js",
|
|
@@ -8195,7 +8195,7 @@ async function setup(context) {
|
|
|
8195
8195
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8196
8196
|
log2(`[magic-context] Magic Context storage is at ${storageDir}, outside the folder Engram backs up (~/.local/share/cortexkit/magic-context). It is not included in CortexKit backups.`);
|
|
8197
8197
|
}
|
|
8198
|
-
const { registerContext } = await import("./context-
|
|
8198
|
+
const { registerContext } = await import("./context-f2xh7ba4.js");
|
|
8199
8199
|
setHarness2("opencode2");
|
|
8200
8200
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8201
8201
|
const duties = await registerContext(context);
|
|
@@ -31,10 +31,10 @@ import {
|
|
|
31
31
|
deleteMemory2,
|
|
32
32
|
getMemoryCount2,
|
|
33
33
|
getMemoryCountsByStatus2
|
|
34
|
-
} from "./server-
|
|
34
|
+
} from "./server-n37sebck.js";
|
|
35
35
|
import"./server-4dhv7mqz.js";
|
|
36
36
|
import"./server-fr0wbhdn.js";
|
|
37
|
-
import"./server-
|
|
37
|
+
import"./server-beht37jy.js";
|
|
38
38
|
export {
|
|
39
39
|
COLUMN_MAP2 as COLUMN_MAP,
|
|
40
40
|
ModuleMemoryAuthorityError2 as ModuleMemoryAuthorityError,
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
updateTagByteSize2,
|
|
2
3
|
getRecentTagOwnerMessageIds2,
|
|
3
4
|
getActiveTagTokenAggregate2,
|
|
4
5
|
AGE_RECLAIM_MIN_TOKENS2,
|
|
@@ -6,6 +7,7 @@ import {
|
|
|
6
7
|
getActiveToolTagsForAgeReclaim2,
|
|
7
8
|
getTriggerTagTokenUpperBound2,
|
|
8
9
|
getActiveTagTokenTotalsByMessage2,
|
|
10
|
+
updateTagTokenCount2,
|
|
9
11
|
getPersistedToolTagAccounting2,
|
|
10
12
|
getAllStatusTagTokenTotalsFlat2,
|
|
11
13
|
getReasoningTokenEstimatesByMessage2,
|
|
@@ -61,11 +63,11 @@ import {
|
|
|
61
63
|
adoptNullOwnerToolTag2,
|
|
62
64
|
getCandidateToolOwners2,
|
|
63
65
|
pickNearestPriorOwner2
|
|
64
|
-
} from "./server-
|
|
66
|
+
} from "./server-27gq4mfz.js";
|
|
65
67
|
import"./server-1zx87sdm.js";
|
|
66
68
|
import"./server-pwv4ezb0.js";
|
|
67
|
-
import"./server-
|
|
68
|
-
import"./server-
|
|
69
|
+
import"./server-tgnbmwah.js";
|
|
70
|
+
import"./server-beht37jy.js";
|
|
69
71
|
import"./server-f2xf5gcb.js";
|
|
70
72
|
import"./server-pavzsdc6.js";
|
|
71
73
|
export {
|
|
@@ -128,7 +130,9 @@ export {
|
|
|
128
130
|
tagTokenCountIsNull2 as tagTokenCountIsNull,
|
|
129
131
|
tryGetReasoningTokenEstimatesByMessage2 as tryGetReasoningTokenEstimatesByMessage,
|
|
130
132
|
updateCavemanDepth2 as updateCavemanDepth,
|
|
133
|
+
updateTagByteSize2 as updateTagByteSize,
|
|
131
134
|
updateTagDropMode2 as updateTagDropMode,
|
|
132
135
|
updateTagMessageId2 as updateTagMessageId,
|
|
133
|
-
updateTagStatus2 as updateTagStatus
|
|
136
|
+
updateTagStatus2 as updateTagStatus,
|
|
137
|
+
updateTagTokenCount2 as updateTagTokenCount
|
|
134
138
|
};
|