@cortexkit/opencode-magic-context 0.49.33 → 0.49.35
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 +11 -6
- package/dist/chunk-embedding-write-worker.js +16 -14
- package/dist/{compaction-marker-candidates-31h86ph0.js → compaction-marker-candidates-g0p67ced.js} +3 -2
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{compartment-chunk-embedding-5q5gj67r.js → compartment-chunk-embedding-y4136are.js} +8 -7
- package/dist/{conflict-warning-hook-xgskea1v.js → conflict-warning-hook-hhw8z5ak.js} +9 -8
- package/dist/{context-jyzkstnr.js → context-fk8e3h9p.js} +1400 -701
- package/dist/{derive-budgets-pqybnx09.js → derive-budgets-htj16n4x.js} +3 -2
- package/dist/embedding-backfill-q6n72sy0.js +27 -0
- package/dist/embedding-worker-process.js +2 -1
- package/dist/embedding-worker.js +5 -4
- package/dist/expand-attachments-h33jbgyz.js +21 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts +21 -0
- package/dist/features/magic-context/auto-search-diagnostics.d.ts.map +1 -0
- package/dist/features/magic-context/compaction-marker.d.ts +22 -6
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- 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/search.d.ts +4 -0
- package/dist/features/magic-context/search.d.ts.map +1 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts +7 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/store-generation-rebase-labels.d.ts +6 -0
- package/dist/features/magic-context/store-generation-rebase-labels.d.ts.map +1 -0
- package/dist/features/magic-context/store-generation-rebase.d.ts.map +1 -1
- package/dist/{history-owner-36wp3mkb.js → history-owner-0z620wgz.js} +3 -2
- package/dist/hooks/magic-context/apply-operations.d.ts +20 -3
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-observation.d.ts +13 -0
- package/dist/hooks/magic-context/auto-search-observation.d.ts.map +1 -0
- package/dist/hooks/magic-context/auto-search-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts +5 -1
- package/dist/hooks/magic-context/auto-search-worker-client.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +5 -5
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts +9 -0
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-commit-hashes.d.ts +4 -0
- package/dist/hooks/magic-context/compartment-commit-hashes.d.ts.map +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts +1 -0
- package/dist/hooks/magic-context/compartment-runner-validation.d.ts.map +1 -1
- package/dist/hooks/magic-context/event-resolvers.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-completeness.d.ts +15 -0
- package/dist/hooks/magic-context/final-wire-completeness.d.ts.map +1 -0
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts +1 -0
- package/dist/hooks/magic-context/raw-ordinal-warmup.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts +11 -0
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-formatting.d.ts +2 -0
- package/dist/hooks/magic-context/read-session-formatting.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-as2amvn3.js → index-0c7p8mq5.js} +6 -531
- package/dist/{index-51rdvtkz.js → index-1rhgxqs8.js} +2 -2
- package/dist/index-2amn2s73.js +123 -0
- package/dist/{index-c7phnbvk.js → index-2p37txes.js} +1 -1
- package/dist/index-2qbtqg1w.js +529 -0
- package/dist/{index-waktfbjy.js → index-2v6nvy3k.js} +4 -4
- package/dist/{index-dq5xzeb9.js → index-3d3872c6.js} +7 -5
- package/dist/{index-qr2mb02j.js → index-3j9t1v4n.js} +55 -21
- package/dist/{index-2xh37qn5.js → index-4bgk5ztz.js} +576 -5524
- package/dist/{index-b88dwwrh.js → index-4xyjr62e.js} +1 -1
- package/dist/index-66a50f3e.js +777 -0
- package/dist/{index-94ef0qe2.js → index-87ctnzz9.js} +33 -5
- package/dist/{index-xrnsygfq.js → index-9wnbnx8f.js} +1 -1
- package/dist/{index-3fkk2gwj.js → index-b6xz3qbe.js} +246 -420
- package/dist/{index-0fe4q77z.js → index-brg2w6qc.js} +146 -134
- package/dist/{index-spwjbkc7.js → index-dnqqqc5f.js} +1 -1
- package/dist/index-dy7w6wm4.js +194 -0
- package/dist/{index-3jmx3fae.js → index-ezv6dz3y.js} +37 -7
- package/dist/index-f297z1n8.js +4557 -0
- package/dist/{index-qgh1qwjj.js → index-f9b3vtt1.js} +1 -1
- package/dist/{index-v15ne3a3.js → index-faxb7mck.js} +2 -2
- package/dist/{index-rrv26qjz.js → index-fw42ms3m.js} +1 -1
- package/dist/{index-t5pck3ss.js → index-fxbk7gk3.js} +1 -1
- package/dist/{index-wfybj1dw.js → index-g4t7850m.js} +2 -2
- package/dist/{index-hbt0sbv2.js → index-gyaa159j.js} +18 -276
- package/dist/{index-4pnsgvfk.js → index-hacf2tyx.js} +1 -1
- package/dist/{index-s1n8dd2n.js → index-jkanybgq.js} +2 -2
- package/dist/{index-2743x98y.js → index-jn0ddrhp.js} +29 -138
- package/dist/{index-h7tgn49j.js → index-jrfre9ah.js} +5 -222
- package/dist/{index-kfyb3k6n.js → index-jz5bk7xd.js} +2 -2
- package/dist/{index-np3rgfw4.js → index-ksv0a31x.js} +3 -3
- package/dist/{index-7kkphb6c.js → index-nj360hcs.js} +4 -4
- package/dist/{index-gkee6p4g.js → index-p56dszfp.js} +3 -3
- package/dist/{index-4s4zq97n.js → index-pq0dpwrc.js} +4 -4
- package/dist/{index-rfxzazzy.js → index-pswsyf1w.js} +4 -4
- package/dist/{index-y1qwzvxn.js → index-pztqab6k.js} +2 -2
- package/dist/{index-rverk2vz.js → index-qncw9hey.js} +1 -1
- package/dist/index-qx8j6kds.js +270 -0
- package/dist/{index-kq5w68dp.js → index-txs8tce6.js} +1 -1
- package/dist/index-vzhhr1ht.js +532 -0
- package/dist/index-wh9fxds5.js +265 -0
- package/dist/{index-b7w46fp2.js → index-x2mrq5xv.js} +170 -48
- package/dist/{index-43vqx0za.js → index-xwwsbsd3.js} +15 -13
- package/dist/index-z4p0ry94.js +222 -0
- package/dist/index-z9zygwse.js +89 -0
- package/dist/{index-v7287tzq.js → index-zhqwda72.js} +19 -8
- package/dist/index.js +83 -72
- package/dist/{logger-94kew5wm.js → logger-qwnbcfj9.js} +2 -1
- package/dist/{message-fts-rowid-map-va36knh4.js → message-fts-rowid-map-xg7hr0mk.js} +5 -4
- package/dist/{message-index-bounded-zq7a5nm6.js → message-index-bounded-narw7bnz.js} +12 -11
- package/dist/{message-time-backfill-4qva0b4f.js → message-time-backfill-39bm498k.js} +3 -2
- package/dist/migration-worker.js +13 -11
- package/dist/{project-embedding-registry-6yex0r9f.js → project-embedding-registry-tdz7985n.js} +13 -11
- package/dist/raw-ordinal-warmup-worker.js +12 -7
- package/dist/{read-session-chunk-1ndphmb8.js → read-session-chunk-vmg1zjg0.js} +15 -10
- package/dist/{read-session-raw-b2sd67v4.js → read-session-raw-mncmzbm9.js} +3 -2
- package/dist/recomp-orchestrator-qyyhnc9b.js +68 -0
- package/dist/render-c5p0k846.js +43 -0
- package/dist/{safe-notification-target-mkr9yzvr.js → safe-notification-target-wztd7bgk.js} +3 -2
- package/dist/{search-archive-sr07c6aj.js → search-archive-0ny7p3bw.js} +13 -11
- package/dist/{search-040pac3a.js → search-f6hwvcxk.js} +26 -23
- package/dist/{send-session-notification-vz86nt79.js → send-session-notification-0gwcz3fw.js} +7 -6
- package/dist/{storage-tags-6hvkk01c.js → storage-tags-zx1023km.js} +5 -4
- package/dist/store-620rjzt9.js +21 -0
- package/dist/store-reader-yh19h38c.js +14 -0
- package/dist/tools/ctx-expand/render.d.ts +5 -3
- package/dist/tools/ctx-expand/render.d.ts.map +1 -1
- package/dist/tools/ctx-expand/search-archive.d.ts.map +1 -1
- package/dist/tools/ctx-expand/tools.d.ts +2 -0
- package/dist/tools/ctx-expand/tools.d.ts.map +1 -1
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts +33 -0
- package/dist/tools/ctx-expand/v2-archive-reader.d.ts.map +1 -0
- package/dist/{transform-postprocess-phase-zx1peqma.js → transform-postprocess-phase-807ff6t2.js} +36 -30
- package/dist/v2/auto-search-worker.js +11 -6
- package/dist/v2/chunk-embedding-write-worker.js +16 -14
- package/dist/v2/{compaction-marker-candidates-m4vmye3w.js → compaction-marker-candidates-t1aq6gsj.js} +3 -2
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{compartment-chunk-embedding-rc31e6md.js → compartment-chunk-embedding-ncsk0r9e.js} +8 -7
- package/dist/v2/{context-3c4z2wj5.js → context-znqfkap4.js} +1725 -1095
- package/dist/v2/{derive-budgets-knf763tt.js → derive-budgets-sa0v7bz0.js} +4 -3
- package/dist/v2/embedding-backfill-11j425e0.js +26 -0
- package/dist/v2/embedding-worker-process.js +2 -1
- package/dist/v2/embedding-worker.js +5 -4
- package/dist/v2/expand-attachments-h33jbgyz.js +21 -0
- package/dist/v2/fold/idle.d.ts +15 -0
- package/dist/v2/fold/idle.d.ts.map +1 -0
- package/dist/v2/fold/native-replay-v3.d.ts +68 -0
- package/dist/v2/fold/native-replay-v3.d.ts.map +1 -0
- package/dist/v2/fold/native-replay.d.ts +58 -2
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/fold/policy.d.ts +2 -1
- package/dist/v2/fold/policy.d.ts.map +1 -1
- package/dist/v2/{history-owner-ad0crnrn.js → history-owner-fpka43cn.js} +3 -2
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/expand-attachments.d.ts +8 -0
- package/dist/v2/hooks/expand-attachments.d.ts.map +1 -0
- package/dist/v2/hooks/overflow-recovery.d.ts +45 -0
- package/dist/v2/hooks/overflow-recovery.d.ts.map +1 -0
- package/dist/v2/hooks/store.d.ts +7 -2
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/{logger-p34mjtja.js → logger-4cj6d03m.js} +2 -1
- package/dist/v2/{message-fts-rowid-map-78awh03v.js → message-fts-rowid-map-rmk571mb.js} +5 -4
- package/dist/v2/{message-index-bounded-jvgz7vk9.js → message-index-bounded-620bppw7.js} +12 -11
- package/dist/v2/{message-time-backfill-zvthw6xb.js → message-time-backfill-0c4h7sg6.js} +3 -2
- package/dist/v2/migration-worker.js +13 -11
- package/dist/v2/ordinal-range.fixture.d.ts +7 -0
- package/dist/v2/ordinal-range.fixture.d.ts.map +1 -0
- package/dist/v2/{project-embedding-registry-1x5qe2fy.js → project-embedding-registry-bm5fe1a8.js} +13 -11
- package/dist/v2/raw-ordinal-warmup-worker.js +12 -7
- package/dist/v2/{read-session-chunk-djzgm4jg.js → read-session-chunk-qfwv1k71.js} +15 -10
- package/dist/v2/{read-session-raw-5x088amc.js → read-session-raw-q294t8xs.js} +3 -2
- package/dist/v2/recomp-orchestrator-fcnjref7.js +67 -0
- package/dist/v2/render-98a1qv0b.js +42 -0
- package/dist/v2/{safe-notification-target-khnzg57c.js → safe-notification-target-gphhast7.js} +3 -2
- package/dist/v2/{search-archive-n3dhns4r.js → search-archive-r0y1bafr.js} +13 -11
- package/dist/v2/{search-q3wkpe8t.js → search-z1zqzsmh.js} +25 -22
- package/dist/v2/{send-session-notification-x5nzy34v.js → send-session-notification-fst6hkg7.js} +7 -6
- package/dist/v2/{server-rb8m4vry.js → server-1xesqm5h.js} +146 -134
- package/dist/v2/server-2amn2s73.js +123 -0
- package/dist/v2/{server-6g98c227.js → server-3schkz95.js} +4 -4
- package/dist/v2/server-468mya5v.js +209 -0
- package/dist/v2/server-55v5hpth.js +270 -0
- package/dist/v2/server-5jp38p98.js +532 -0
- package/dist/v2/{server-qjvk4a9t.js → server-69m30b21.js} +1 -1
- package/dist/v2/{server-d01pe8q5.js → server-7ccxt4nq.js} +14 -216
- package/dist/v2/{server-3mz2qh5a.js → server-969cdpmg.js} +1 -1
- package/dist/v2/{server-835q39kd.js → server-9k0mjef7.js} +2 -2
- package/dist/v2/{server-qc915kw2.js → server-bez34e60.js} +4 -4
- package/dist/v2/{server-nxas8v1d.js → server-bpvsvtph.js} +3 -3
- package/dist/v2/{server-ab8017gw.js → server-bxpz2dcn.js} +29 -138
- package/dist/v2/{server-bsgd4dk1.js → server-dcws5831.js} +2 -2
- package/dist/v2/server-ef1mskas.js +777 -0
- package/dist/v2/{server-1bw1wcbp.js → server-f0j864ma.js} +1 -1
- package/dist/v2/{server-aqbm9c8d.js → server-fqj6ddpr.js} +632 -5540
- package/dist/v2/{server-rr4cbkr0.js → server-hnknwaz8.js} +37 -7
- package/dist/v2/{server-h1byrhwx.js → server-hsf0qsn5.js} +19 -8
- package/dist/v2/{server-6495nmn9.js → server-jb6tjyeb.js} +5 -222
- package/dist/v2/{server-2aasmpsp.js → server-kkxzwa6w.js} +4 -4
- package/dist/v2/{server-a7x00tw8.js → server-mfn1yf9d.js} +1 -1
- package/dist/v2/{server-tkdabx8q.js → server-q0z2q2dx.js} +5 -530
- package/dist/v2/{server-n14edf07.js → server-qa74bj91.js} +77 -17
- package/dist/v2/server-qf2kzsh2.js +4513 -0
- package/dist/v2/{server-gyy4k6mf.js → server-qmmkhz2z.js} +1 -1
- package/dist/v2/{server-29qp8nz4.js → server-qxzbmtqt.js} +1 -1
- package/dist/v2/{server-hwag0khr.js → server-r3chnxs5.js} +4 -4
- package/dist/v2/{server-vr4szghm.js → server-rktnzs89.js} +2 -2
- package/dist/v2/{server-6vd2n183.js → server-s9xgyyj9.js} +1 -1
- package/dist/v2/{server-53eh1r8r.js → server-sd8hvzte.js} +2 -2
- package/dist/v2/{server-k3t06fxr.js → server-sefxj8k1.js} +1 -1
- package/dist/v2/{server-v77xa5wj.js → server-tpt7bwq8.js} +1 -1
- package/dist/v2/{server-awr8qa4c.js → server-ws5exe6q.js} +2 -2
- package/dist/v2/server-x4m6xcn4.js +194 -0
- package/dist/v2/{server-806rzhs6.js → server-xbtw0p9t.js} +1 -1
- package/dist/v2/{server-cqjvxyrp.js → server-xy7w7hrd.js} +2 -2
- package/dist/v2/server-ypf1ap0v.js +529 -0
- package/dist/v2/server-z4p0ry94.js +222 -0
- package/dist/v2/server-z9zygwse.js +89 -0
- package/dist/v2/{server-ab1g0wn9.js → server-zzgtgqmd.js} +2 -2
- package/dist/v2/server.js +6 -5
- package/dist/v2/{storage-tags-18nbaanf.js → storage-tags-19s0ebf0.js} +5 -4
- package/dist/v2/store-reader-cgx47zkp.js +14 -0
- package/dist/v2/store-reader.d.ts +9 -2
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/store-vdm8v3jd.js +21 -0
- package/dist/v2/v2-archive-reader-t2c0eypn.js +11 -0
- package/dist/v2/{wrapup-orchestrator-ga5vfmwr.js → wrapup-orchestrator-aqpqsveg.js} +46 -39
- package/dist/v2-archive-reader-tm2eayp2.js +11 -0
- package/dist/wrapup-orchestrator-k5yp19a6.js +55 -0
- package/package.json +1 -1
- package/src/shared/sqlite-transaction-mode-guard.test.ts +4 -0
- package/dist/embedding-backfill-0jgtqxen.js +0 -25
- package/dist/recomp-orchestrator-skqzzvby.js +0 -62
- package/dist/v2/embedding-backfill-f43hd8y6.js +0 -24
- package/dist/v2/recomp-orchestrator-qfqdvbta.js +0 -61
- package/dist/wrapup-orchestrator-dy8r3gp8.js +0 -49
|
@@ -5,10 +5,10 @@ import {
|
|
|
5
5
|
} from "./index-gzy5w8ya.js";
|
|
6
6
|
import {
|
|
7
7
|
runSessionWarmupWorker
|
|
8
|
-
} from "./index-
|
|
8
|
+
} from "./index-qncw9hey.js";
|
|
9
9
|
import {
|
|
10
10
|
logSlowWriteTransaction
|
|
11
|
-
} from "./index-
|
|
11
|
+
} from "./index-fxbk7gk3.js";
|
|
12
12
|
|
|
13
13
|
// src/features/magic-context/message-fts-rowid-map.ts
|
|
14
14
|
import { createHash } from "node:crypto";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
estimateTokens
|
|
3
|
-
} from "./index-
|
|
3
|
+
} from "./index-4xyjr62e.js";
|
|
4
4
|
import {
|
|
5
5
|
getHarness2
|
|
6
6
|
} from "./index-pavzsdc6.js";
|
|
7
7
|
import {
|
|
8
8
|
log2
|
|
9
|
-
} from "./index-
|
|
9
|
+
} from "./index-jrfre9ah.js";
|
|
10
10
|
import {
|
|
11
11
|
inRootAsyncContext2
|
|
12
12
|
} from "./index-gzy5w8ya.js";
|
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
sanitizeDiagnosticText,
|
|
3
|
-
importPluginModule,
|
|
4
|
-
writeForwardedLogLine2,
|
|
5
|
-
log2
|
|
6
|
-
} from "./index-h7tgn49j.js";
|
|
7
1
|
import {
|
|
8
2
|
inRootAsyncContext2,
|
|
9
3
|
registerSlowWriteReporter2,
|
|
@@ -19,7 +13,7 @@ import {
|
|
|
19
13
|
} from "./index-gzy5w8ya.js";
|
|
20
14
|
import {
|
|
21
15
|
scheduleAfterBootQuiet
|
|
22
|
-
} from "./index-
|
|
16
|
+
} from "./index-txs8tce6.js";
|
|
23
17
|
import {
|
|
24
18
|
getHarness2,
|
|
25
19
|
harnessOwnsOpenCodeStore2
|
|
@@ -28,6 +22,11 @@ import {
|
|
|
28
22
|
getMagicContextStorageDir,
|
|
29
23
|
getLegacyOpenCodeMagicContextStorageDir
|
|
30
24
|
} from "./index-g2q4htwp.js";
|
|
25
|
+
import {
|
|
26
|
+
importPluginModule,
|
|
27
|
+
writeForwardedLogLine2,
|
|
28
|
+
log2
|
|
29
|
+
} from "./index-jrfre9ah.js";
|
|
31
30
|
import {
|
|
32
31
|
isOwnRpcServerRecord,
|
|
33
32
|
isPidAlive,
|
|
@@ -38,13 +37,16 @@ import {
|
|
|
38
37
|
parseRpcPortFile,
|
|
39
38
|
inspectProcessesAsync,
|
|
40
39
|
inspectWindowsProcessesSync
|
|
41
|
-
} from "./index-
|
|
40
|
+
} from "./index-2p37txes.js";
|
|
42
41
|
import {
|
|
43
42
|
configureContextDatabasePragmas2
|
|
44
43
|
} from "./index-fb3zxn06.js";
|
|
44
|
+
import {
|
|
45
|
+
attachFailClosedBlockingProcessEvidence
|
|
46
|
+
} from "./index-wh9fxds5.js";
|
|
45
47
|
import {
|
|
46
48
|
startMessageFtsRowidMapBackfill2
|
|
47
|
-
} from "./index-
|
|
49
|
+
} from "./index-faxb7mck.js";
|
|
48
50
|
import {
|
|
49
51
|
LKG_SLOT_CHUNKS_DDL,
|
|
50
52
|
SESSION_REPLAY_DECISIONS_DDL,
|
|
@@ -54,12 +56,12 @@ import {
|
|
|
54
56
|
hasPendingMigrations,
|
|
55
57
|
getMainThreadMigrationBodyCount,
|
|
56
58
|
runMigrations
|
|
57
|
-
} from "./index-
|
|
59
|
+
} from "./index-nj360hcs.js";
|
|
58
60
|
import {
|
|
59
61
|
installTagIdentityRevisionTrigger,
|
|
60
62
|
ensureColumn,
|
|
61
63
|
installV95PerfSchema
|
|
62
|
-
} from "./index-
|
|
64
|
+
} from "./index-9wnbnx8f.js";
|
|
63
65
|
import {
|
|
64
66
|
resolveOpenCodeDbPath,
|
|
65
67
|
hasV1MessageTables
|
|
@@ -67,7 +69,7 @@ import {
|
|
|
67
69
|
import {
|
|
68
70
|
setDatabase,
|
|
69
71
|
loadToolDefinitionMeasurements
|
|
70
|
-
} from "./index-
|
|
72
|
+
} from "./index-jkanybgq.js";
|
|
71
73
|
import {
|
|
72
74
|
getErrorMessage
|
|
73
75
|
} from "./index-y8v6yerm.js";
|
|
@@ -76,7 +78,7 @@ import {
|
|
|
76
78
|
} from "./index-8ajstryz.js";
|
|
77
79
|
import {
|
|
78
80
|
logSlowWriteTransaction
|
|
79
|
-
} from "./index-
|
|
81
|
+
} from "./index-fxbk7gk3.js";
|
|
80
82
|
import {
|
|
81
83
|
shouldEnforcePrivateStoragePermissions,
|
|
82
84
|
ensureStorageDirectorySync,
|
|
@@ -86,266 +88,6 @@ import {
|
|
|
86
88
|
tightenStorageTreeSync
|
|
87
89
|
} from "./index-fvnzcnww.js";
|
|
88
90
|
|
|
89
|
-
// src/features/magic-context/fail-closed-block.ts
|
|
90
|
-
var FAIL_CLOSED_DOCTOR_COMMAND = "npx @cortexkit/magic-context@latest doctor";
|
|
91
|
-
var FAIL_CLOSED_REPROBE_EVERY_N = 5;
|
|
92
|
-
function attachFailClosedBlockingProcessEvidence(process2, evidence) {
|
|
93
|
-
Object.defineProperties(process2, {
|
|
94
|
-
startTime: { configurable: true, value: evidence.startTime },
|
|
95
|
-
commandLine: { configurable: true, value: evidence.commandLine }
|
|
96
|
-
});
|
|
97
|
-
return process2;
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
class FailClosedBlockingError extends Error {
|
|
101
|
-
code = "FAIL_CLOSED_BLOCKING";
|
|
102
|
-
reason;
|
|
103
|
-
constructor(message, reason, options) {
|
|
104
|
-
super(message, options);
|
|
105
|
-
this.name = "FailClosedBlockingError";
|
|
106
|
-
this.reason = reason;
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
var OPENCODE_INTERNAL_AGENT_NAMES = new Set(["title", "summary", "compaction"]);
|
|
110
|
-
function isMagicContextHiddenAgentName(agent) {
|
|
111
|
-
if (agent === "smart-note-compiler" || agent.startsWith("smart-note-")) {
|
|
112
|
-
return true;
|
|
113
|
-
}
|
|
114
|
-
if (agent === "historian" || agent.startsWith("historian-"))
|
|
115
|
-
return true;
|
|
116
|
-
if (agent === "dreamer" || agent.startsWith("dreamer-"))
|
|
117
|
-
return true;
|
|
118
|
-
return false;
|
|
119
|
-
}
|
|
120
|
-
var MAX_FORMATTED_BLOCKING_PROCESSES = 8;
|
|
121
|
-
var MAX_FORMATTED_COMMAND_LINE_LENGTH = 80;
|
|
122
|
-
function normalizeFailClosedProcessKind(process2) {
|
|
123
|
-
switch (process2.kind) {
|
|
124
|
-
case "OpenCode server":
|
|
125
|
-
case "OpenCode instance (TUI/CLI)":
|
|
126
|
-
case "Pi":
|
|
127
|
-
case "process":
|
|
128
|
-
return process2.kind;
|
|
129
|
-
}
|
|
130
|
-
switch (process2.harness?.trim().toLowerCase()) {
|
|
131
|
-
case "opencode server":
|
|
132
|
-
return "OpenCode server";
|
|
133
|
-
case "opencode instance (tui/cli)":
|
|
134
|
-
case "opencode instance":
|
|
135
|
-
return "OpenCode instance (TUI/CLI)";
|
|
136
|
-
case "pi":
|
|
137
|
-
case "pi harness":
|
|
138
|
-
case "omp":
|
|
139
|
-
return "Pi";
|
|
140
|
-
default:
|
|
141
|
-
return "process";
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
function formatFailClosedProcessStartTime(startTime) {
|
|
145
|
-
if (!Number.isFinite(startTime) || startTime <= 0)
|
|
146
|
-
return "unverified";
|
|
147
|
-
try {
|
|
148
|
-
const parts = new Intl.DateTimeFormat("en-US", {
|
|
149
|
-
day: "numeric",
|
|
150
|
-
hour: "2-digit",
|
|
151
|
-
minute: "2-digit",
|
|
152
|
-
month: "short",
|
|
153
|
-
hour12: false
|
|
154
|
-
}).formatToParts(new Date(startTime));
|
|
155
|
-
const values = Object.fromEntries(parts.map(({ type, value }) => [type, value]));
|
|
156
|
-
if (!values.month || !values.day || !values.hour || !values.minute)
|
|
157
|
-
return "unverified";
|
|
158
|
-
return `${values.month} ${values.day} ${values.hour}:${values.minute}`;
|
|
159
|
-
} catch {
|
|
160
|
-
return "unverified";
|
|
161
|
-
}
|
|
162
|
-
}
|
|
163
|
-
function formatFailClosedCommandLine(commandLine) {
|
|
164
|
-
if (typeof commandLine !== "string" || commandLine.trim().length === 0)
|
|
165
|
-
return "unverified";
|
|
166
|
-
try {
|
|
167
|
-
const normalized = commandLine.replaceAll("\x00", " ").replace(/\s+/g, " ").trim();
|
|
168
|
-
if (normalized.length === 0)
|
|
169
|
-
return "unverified";
|
|
170
|
-
const sanitized = sanitizeDiagnosticText(normalized).trim();
|
|
171
|
-
if (sanitized.length === 0)
|
|
172
|
-
return "unverified";
|
|
173
|
-
return sanitized.length > MAX_FORMATTED_COMMAND_LINE_LENGTH ? `${sanitized.slice(0, MAX_FORMATTED_COMMAND_LINE_LENGTH - 3)}...` : sanitized;
|
|
174
|
-
} catch {
|
|
175
|
-
return "unverified";
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
function formatFailClosedBlockingProcesses(processes) {
|
|
179
|
-
const uniqueProcesses = new Map;
|
|
180
|
-
for (const process2 of processes) {
|
|
181
|
-
if (!Number.isInteger(process2.pid) || process2.pid <= 0)
|
|
182
|
-
continue;
|
|
183
|
-
const candidate = {
|
|
184
|
-
kind: normalizeFailClosedProcessKind(process2),
|
|
185
|
-
pid: process2.pid,
|
|
186
|
-
startTime: process2.startTime,
|
|
187
|
-
commandLine: process2.commandLine
|
|
188
|
-
};
|
|
189
|
-
const previous = uniqueProcesses.get(process2.pid);
|
|
190
|
-
if (!previous || previous.kind === "process" && candidate.kind !== "process") {
|
|
191
|
-
uniqueProcesses.set(process2.pid, candidate);
|
|
192
|
-
} else {
|
|
193
|
-
uniqueProcesses.set(process2.pid, {
|
|
194
|
-
...previous,
|
|
195
|
-
startTime: previous.startTime ?? candidate.startTime,
|
|
196
|
-
commandLine: previous.commandLine ?? candidate.commandLine
|
|
197
|
-
});
|
|
198
|
-
}
|
|
199
|
-
}
|
|
200
|
-
const entries = [...uniqueProcesses.values()];
|
|
201
|
-
const visible = entries.slice(0, MAX_FORMATTED_BLOCKING_PROCESSES);
|
|
202
|
-
const rendered = visible.map(({ kind, pid }) => `${kind} (PID ${pid})`);
|
|
203
|
-
const omitted = entries.length - visible.length;
|
|
204
|
-
if (omitted > 0)
|
|
205
|
-
rendered.push(`${omitted} more blocking process(es)`);
|
|
206
|
-
if (rendered.length === 0)
|
|
207
|
-
return "a live process";
|
|
208
|
-
const summary = rendered.length === 1 ? rendered[0] : `${rendered.slice(0, -1).join(", ")}, and ${rendered.at(-1)}`;
|
|
209
|
-
const evidence = entries.map(({ kind, pid, startTime, commandLine }) => `- PID ${pid}: ${kind}, started ${formatFailClosedProcessStartTime(startTime)}, cmd: ${formatFailClosedCommandLine(commandLine)}`).join(`
|
|
210
|
-
`);
|
|
211
|
-
return `${summary}
|
|
212
|
-
Blocking process evidence:
|
|
213
|
-
${evidence}`;
|
|
214
|
-
}
|
|
215
|
-
function formatFailClosedBlockingMessage(reason) {
|
|
216
|
-
if (reason.kind === "migration_guard") {
|
|
217
|
-
if (reason.unreadableFile) {
|
|
218
|
-
const arm = reason.unreadableArm ?? "io";
|
|
219
|
-
const recovery = arm === "io" ? `If none of these processes are running, it is safe to delete ${reason.unreadableFile} and retry.` : `The file may be a recent incomplete write; retry after the file is older than the ten-minute grace window, or stop the relevant process before deleting it.`;
|
|
220
|
-
return [
|
|
221
|
-
`Magic Context cannot migrate the shared database because RPC discovery file ${reason.unreadableFile} is uncertain (${arm} arm), so the absence of a live process cannot be proven.`,
|
|
222
|
-
recovery,
|
|
223
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
224
|
-
].join(" ");
|
|
225
|
-
}
|
|
226
|
-
return [
|
|
227
|
-
`Magic Context cannot migrate the shared database (one database serves every project on this machine) because ${formatFailClosedBlockingProcesses(reason.blockingProcesses)} may be running an older Magic Context build that would fail against the migrated database.`,
|
|
228
|
-
`The database is at upstream migration v${reason.persistedVersion}; this build needs v${reason.supportedVersion}.`,
|
|
229
|
-
"Restart the blocking process — even one from a different project — and it will pick up the new build and migrate on start; or shut it down and retry.",
|
|
230
|
-
"If that host loads a pinned or cached older Magic Context build, a restart alone is not enough: stop it or update its Magic Context build, then start this host once so it migrates the database with nothing older attached.",
|
|
231
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
232
|
-
].join(" ");
|
|
233
|
-
}
|
|
234
|
-
if (reason.kind === "schema_fence") {
|
|
235
|
-
return [
|
|
236
|
-
`Magic Context cannot operate: this Magic Context build is older than the database; upgrade/restart this harness (upstream migration lane v${reason.persistedVersion}, build supports through v${reason.supportedVersion}).`,
|
|
237
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
238
|
-
].join(" ");
|
|
239
|
-
}
|
|
240
|
-
const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
|
|
241
|
-
return [
|
|
242
|
-
`Magic Context cannot operate: persistent storage failed (${cause}).`,
|
|
243
|
-
"The plugin will not silently degrade to native compaction while enabled.",
|
|
244
|
-
`Recovery: ${FAIL_CLOSED_DOCTOR_COMMAND}`
|
|
245
|
-
].join(" ");
|
|
246
|
-
}
|
|
247
|
-
function formatFailClosedBlockingSummary(reason) {
|
|
248
|
-
if (reason.kind === "migration_guard") {
|
|
249
|
-
if (reason.unreadableFile) {
|
|
250
|
-
return `Magic Context cannot migrate the shared database from v${reason.persistedVersion} to v${reason.supportedVersion}: RPC discovery file ${reason.unreadableFile} could not be read, so an older host may still be attached.`;
|
|
251
|
-
}
|
|
252
|
-
const blockers = reason.blockingProcesses.filter((process2) => Number.isInteger(process2.pid) && process2.pid > 0).map((process2) => `${normalizeFailClosedProcessKind(process2)} (PID ${process2.pid})`);
|
|
253
|
-
const named = blockers.length > 0 ? blockers.join(", ") : "a live process";
|
|
254
|
-
return `Magic Context cannot migrate the shared database from v${reason.persistedVersion} to v${reason.supportedVersion} while ${named} may still run an older Magic Context build. Stop or update that host, then start this one once.`;
|
|
255
|
-
}
|
|
256
|
-
if (reason.kind === "schema_fence") {
|
|
257
|
-
return `Magic Context cannot operate: the shared database is at v${reason.persistedVersion}, newer than this build supports (v${reason.supportedVersion}). Update and restart this host.`;
|
|
258
|
-
}
|
|
259
|
-
const cause = reason.cause.trim().length > 0 ? reason.cause.trim() : "unknown storage error";
|
|
260
|
-
return `Magic Context cannot operate: persistent storage failed (${cause}).`;
|
|
261
|
-
}
|
|
262
|
-
function createFailClosedBlockingError(reason, options) {
|
|
263
|
-
return new FailClosedBlockingError(formatFailClosedBlockingMessage(reason), reason, options);
|
|
264
|
-
}
|
|
265
|
-
function isFailClosedBlockingError(error) {
|
|
266
|
-
return error instanceof FailClosedBlockingError || typeof error === "object" && error !== null && error.name === "FailClosedBlockingError" && error.code === "FAIL_CLOSED_BLOCKING";
|
|
267
|
-
}
|
|
268
|
-
function shouldBypassFailClosedBlock(input) {
|
|
269
|
-
if (input.isPiSubagentEnv === true)
|
|
270
|
-
return true;
|
|
271
|
-
if (input.isInternalChildSession === true)
|
|
272
|
-
return true;
|
|
273
|
-
const agent = typeof input.agent === "string" ? input.agent.trim() : "";
|
|
274
|
-
if (agent.length === 0)
|
|
275
|
-
return false;
|
|
276
|
-
if (OPENCODE_INTERNAL_AGENT_NAMES.has(agent))
|
|
277
|
-
return true;
|
|
278
|
-
if (isMagicContextHiddenAgentName(agent))
|
|
279
|
-
return true;
|
|
280
|
-
return false;
|
|
281
|
-
}
|
|
282
|
-
function resolveAgentNameFromMessages(messages) {
|
|
283
|
-
for (let i = messages.length - 1;i >= 0; i -= 1) {
|
|
284
|
-
const info = messages[i]?.info;
|
|
285
|
-
if (!info || typeof info !== "object")
|
|
286
|
-
continue;
|
|
287
|
-
const agent = info.agent;
|
|
288
|
-
if (typeof agent === "string" && agent.length > 0)
|
|
289
|
-
return agent;
|
|
290
|
-
}
|
|
291
|
-
return;
|
|
292
|
-
}
|
|
293
|
-
function createFailClosedController(options) {
|
|
294
|
-
const reprobeEveryN = Math.max(1, options?.reprobeEveryN ?? FAIL_CLOSED_REPROBE_EVERY_N);
|
|
295
|
-
let reason = null;
|
|
296
|
-
let blockedPassCount = 0;
|
|
297
|
-
return {
|
|
298
|
-
arm(next) {
|
|
299
|
-
reason = next;
|
|
300
|
-
blockedPassCount = 0;
|
|
301
|
-
},
|
|
302
|
-
clear() {
|
|
303
|
-
reason = null;
|
|
304
|
-
blockedPassCount = 0;
|
|
305
|
-
},
|
|
306
|
-
isArmed() {
|
|
307
|
-
return reason !== null;
|
|
308
|
-
},
|
|
309
|
-
getReason() {
|
|
310
|
-
return reason;
|
|
311
|
-
},
|
|
312
|
-
async enforce(input) {
|
|
313
|
-
if (!reason)
|
|
314
|
-
return;
|
|
315
|
-
if (!input.blockingEnabled)
|
|
316
|
-
return;
|
|
317
|
-
if (input.exempt)
|
|
318
|
-
return;
|
|
319
|
-
blockedPassCount += 1;
|
|
320
|
-
const shouldReprobe = typeof input.tryReopen === "function" && (blockedPassCount === 1 || blockedPassCount % reprobeEveryN === 0);
|
|
321
|
-
if (shouldReprobe) {
|
|
322
|
-
try {
|
|
323
|
-
const healed = await input.tryReopen?.();
|
|
324
|
-
if (healed) {
|
|
325
|
-
reason = null;
|
|
326
|
-
blockedPassCount = 0;
|
|
327
|
-
return;
|
|
328
|
-
}
|
|
329
|
-
} catch {}
|
|
330
|
-
}
|
|
331
|
-
const blockedReason = reason;
|
|
332
|
-
if (!blockedReason)
|
|
333
|
-
return;
|
|
334
|
-
throw createFailClosedBlockingError(blockedReason);
|
|
335
|
-
}
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
var lastHookInitFailure = null;
|
|
339
|
-
function recordHookInitFailure(failure) {
|
|
340
|
-
lastHookInitFailure = failure;
|
|
341
|
-
}
|
|
342
|
-
function clearHookInitFailure() {
|
|
343
|
-
lastHookInitFailure = null;
|
|
344
|
-
}
|
|
345
|
-
function getLastHookInitFailure() {
|
|
346
|
-
return lastHookInitFailure;
|
|
347
|
-
}
|
|
348
|
-
|
|
349
91
|
// src/features/magic-context/storage-db.ts
|
|
350
92
|
import {
|
|
351
93
|
existsSync as existsSync2,
|
|
@@ -1279,8 +1021,8 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1279
1021
|
state.running = startMessageFtsRowidMapBackfill2(db, signal).then(async () => {
|
|
1280
1022
|
if (signal.aborted || !readsOpenCodeStore)
|
|
1281
1023
|
return;
|
|
1282
|
-
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-
|
|
1283
|
-
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-
|
|
1024
|
+
const { readRawSessionMessagePage, readRawSessionMessages } = await importPluginModule(() => import("./read-session-chunk-vmg1zjg0.js"));
|
|
1025
|
+
const { startMessageTimeBackfill } = await importPluginModule(() => import("./message-time-backfill-39bm498k.js"));
|
|
1284
1026
|
if (signal.aborted)
|
|
1285
1027
|
return;
|
|
1286
1028
|
await startMessageTimeBackfill(db, Object.assign(readRawSessionMessages, {
|
|
@@ -2784,4 +2526,4 @@ function getDatabasePersistenceError(db) {
|
|
|
2784
2526
|
return persistenceErrorByDatabase.get(db) ?? null;
|
|
2785
2527
|
}
|
|
2786
2528
|
|
|
2787
|
-
export {
|
|
2529
|
+
export { startBootDeadline, getUnconfirmedMigrationHolders, getSchemaFenceRejection, getMigrationOnOpenRefusal, LATEST_SUPPORTED_VERSION, BOOT_SQLITE_BUSY_TIMEOUT_MS, getDatabasePath, getPersistedSchemaVersion, enforceSchemaFence, setSqlitePragmaConfig, runSqliteOptimize, initializeDatabase, openDatabase, openCurrentDatabase, openDatabaseAsync, isDatabasePersisted, getDatabasePersistenceError };
|