@cortexkit/opencode-magic-context 0.49.104 → 0.49.106
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 +3 -3
- package/dist/chunk-embedding-write-worker.js +8 -5
- package/dist/{context-7hbmnpe8.js → context-ywdwfzg5.js} +116 -136
- package/dist/{embedding-backfill-aratv25b.js → embedding-backfill-kqwx0vhj.js} +4 -4
- package/dist/features/magic-context/chunk-embedding-write-worker-install-failure.fixture.d.ts +2 -0
- package/dist/features/magic-context/chunk-embedding-write-worker-install-failure.fixture.d.ts.map +1 -0
- package/dist/features/magic-context/chunk-scope-repair-revision.d.ts +16 -1
- package/dist/features/magic-context/chunk-scope-repair-revision.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/task-executor.d.ts.map +1 -1
- package/dist/features/magic-context/dreamer/verify-checkout.d.ts +2 -0
- package/dist/features/magic-context/dreamer/verify-checkout.d.ts.map +1 -0
- package/dist/features/magic-context/memory/embedding-worker-observer.fixture.d.ts +26 -0
- package/dist/features/magic-context/memory/embedding-worker-observer.fixture.d.ts.map +1 -0
- package/dist/features/magic-context/message-fts-rowid-map-startup-worker-test-support.d.ts +2 -0
- package/dist/features/magic-context/message-fts-rowid-map-startup-worker-test-support.d.ts.map +1 -0
- 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/search-pool-fixture.d.ts +15 -0
- package/dist/features/magic-context/search-pool-fixture.d.ts.map +1 -1
- package/dist/features/magic-context/storage-db.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 +4 -1
- package/dist/hooks/magic-context/compartment-runner-types.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner.d.ts.map +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +7 -2
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/hook.d.ts +1 -0
- package/dist/hooks/magic-context/hook.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-persist.d.ts +1 -0
- package/dist/hooks/magic-context/lkg-persist.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +7 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts +1 -0
- package/dist/hooks/magic-context/transform-compartment-phase.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform.d.ts +3 -0
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-8gzmeyae.js → index-20e7w8v8.js} +3 -3
- package/dist/{index-a9wn0d9h.js → index-3p08zzfq.js} +3 -3
- package/dist/{index-fd3hkyk1.js → index-42fsf88t.js} +1 -1
- package/dist/{index-tvh3y650.js → index-5phmpcme.js} +5 -5
- package/dist/{index-8yj4vd7k.js → index-92p5yfpp.js} +1 -1
- package/dist/{index-mwjvjn0p.js → index-a3t1ck7g.js} +6 -6
- package/dist/{index-4ba3zp54.js → index-as8bg7eh.js} +365 -113
- package/dist/{index-8eke8yh2.js → index-cxh5g5bt.js} +1 -1
- package/dist/{index-vegw385y.js → index-cy5fn70d.js} +89 -1
- package/dist/{index-4dywj733.js → index-dzb1yc9w.js} +1 -1
- package/dist/{index-3rp2b482.js → index-e4szqthq.js} +299 -37
- package/dist/{index-jjxpmypb.js → index-e7awy9eb.js} +1 -1
- package/dist/{index-ke0mkz7g.js → index-g1h1efr0.js} +1 -1
- package/dist/{index-f455a0g3.js → index-k37h4yrb.js} +5 -3
- package/dist/{index-3nxhxeeg.js → index-sfgz2h7y.js} +4 -4
- package/dist/{index-sqvkh5d0.js → index-xa8jgw6w.js} +20 -7
- package/dist/{index-hyvxmz3e.js → index-y1875y4h.js} +1 -1
- package/dist/{index-4v50y0jr.js → index-ydevzvfs.js} +1 -1
- package/dist/{index-4536jdzj.js → index-ze1t940p.js} +68 -25
- package/dist/{index-ab86c21b.js → index-zj0ra8vs.js} +1 -1
- package/dist/index.js +50 -59
- package/dist/migration-worker.js +3 -3
- package/dist/plugin/hooks/create-session-hooks.d.ts +2 -0
- package/dist/plugin/hooks/create-session-hooks.d.ts.map +1 -1
- package/dist/{project-embedding-registry-1n4cexsv.js → project-embedding-registry-0z0nd73p.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{recomp-orchestrator-16rs8aty.js → recomp-orchestrator-7sf94073.js} +12 -12
- package/dist/{render-f32trg2t.js → render-93qzv0vk.js} +6 -6
- package/dist/{search-v9ywqb4f.js → search-7e1rcqb7.js} +9 -9
- package/dist/{search-archive-yh6xtvrx.js → search-archive-dv483a5c.js} +2 -2
- package/dist/shared/sqlite-busy-test-support.d.ts +21 -0
- package/dist/shared/sqlite-busy-test-support.d.ts.map +1 -0
- package/dist/shared/sqlite-write-locker-test-support.d.ts +12 -0
- package/dist/shared/sqlite-write-locker-test-support.d.ts.map +1 -1
- package/dist/{store-wpx314rk.js → store-4eeezg83.js} +2 -2
- package/dist/{store-reader-c5fwa9qx.js → store-reader-g8w2wp88.js} +1 -1
- package/dist/{transform-postprocess-phase-yef4mxk3.js → transform-postprocess-phase-vd9rckyd.js} +13 -13
- package/dist/v2/auto-search-worker.js +3 -3
- package/dist/v2/chunk-embedding-write-worker.js +8 -5
- package/dist/v2/{context-mk2h2ven.js → context-6g9j3tq9.js} +248 -160
- package/dist/v2/{embedding-backfill-kyn5sv0f.js → embedding-backfill-e44pv5db.js} +4 -4
- package/dist/v2/event-subscription.fixture.d.ts +9 -0
- package/dist/v2/event-subscription.fixture.d.ts.map +1 -0
- package/dist/v2/hidden-model-activity.d.ts +13 -0
- package/dist/v2/hidden-model-activity.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +1 -0
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/dream-trigger.d.ts +2 -1
- package/dist/v2/hooks/dream-trigger.d.ts.map +1 -1
- package/dist/v2/hooks/event-subscription-worker.d.ts +11 -0
- package/dist/v2/hooks/event-subscription-worker.d.ts.map +1 -0
- package/dist/v2/hooks/types.d.ts +1 -0
- package/dist/v2/hooks/types.d.ts.map +1 -1
- package/dist/v2/hooks/update-check.d.ts +1 -0
- package/dist/v2/hooks/update-check.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-j1sxtefe.js → message-index-bounded-nwqfb1p5.js} +3 -3
- package/dist/v2/migration-worker.js +3 -3
- package/dist/v2/{project-embedding-registry-1jv2rxhb.js → project-embedding-registry-rhzjnypp.js} +3 -3
- package/dist/v2/raw-ordinal-warmup-worker.js +4 -4
- package/dist/v2/{read-session-chunk-p6z3kmdj.js → read-session-chunk-brqatg83.js} +2 -2
- package/dist/v2/{recomp-orchestrator-5t2csd46.js → recomp-orchestrator-j84xfa80.js} +14 -14
- package/dist/v2/{render-jpj43axy.js → render-tzs5r2pg.js} +10 -10
- package/dist/v2/{search-archive-wbhxp0p1.js → search-archive-31dpm5zs.js} +5 -5
- package/dist/v2/{search-w9m2fd5c.js → search-sffewrs4.js} +12 -12
- package/dist/v2/{server-47ajg9xc.js → server-16115spd.js} +1 -1
- package/dist/v2/server-28jqb7s0.js +6 -0
- package/dist/v2/{server-qg8jyfxa.js → server-5xx10mqe.js} +1 -1
- package/dist/v2/{server-t45hgcsg.js → server-7jw608jk.js} +2 -2
- package/dist/v2/{server-3mb205v9.js → server-83rjf4df.js} +1 -1
- package/dist/v2/{server-xpy46ddq.js → server-af25mmb6.js} +3 -3
- package/dist/v2/{server-ga6y57vh.js → server-c32505fr.js} +6 -4
- package/dist/v2/{server-qdpd8h27.js → server-fn6k1ack.js} +1 -1
- package/dist/v2/{server-8m5wk6aq.js → server-ggs7sxp6.js} +5 -5
- package/dist/v2/{server-zsbc0n4v.js → server-ghb2q1z9.js} +1 -1
- package/dist/v2/{server-af51b1zg.js → server-hqcdvs2n.js} +11 -11
- package/dist/v2/{server-9ms9b75c.js → server-j00jprwm.js} +4 -6
- package/dist/v2/{server-8f92sd2r.js → server-jqk6g663.js} +72 -27
- package/dist/v2/{server-b01a7dhj.js → server-kk2kbzq3.js} +1 -1
- package/dist/v2/{server-mc5t7k8v.js → server-ma0qhqg9.js} +1 -1
- package/dist/v2/{server-x22jtpna.js → server-n3bfqd0j.js} +4 -2
- package/dist/v2/{server-wmpgvvc4.js → server-pjvqyg6g.js} +365 -113
- package/dist/v2/{server-jrs4gny6.js → server-qtajgx1e.js} +89 -1
- package/dist/v2/server-t104h957.js +177 -0
- package/dist/v2/{server-j09jx1n9.js → server-v2r04xds.js} +1 -1
- package/dist/v2/{server-3gnpqjez.js → server-v60f6dk3.js} +26 -11
- package/dist/v2/{server-7c5p0bh1.js → server-z77hman6.js} +1 -1
- package/dist/v2/server.js +31 -40
- package/dist/v2/{storage-tags-s7nvvyg8.js → storage-tags-ee72g2zv.js} +1 -1
- package/dist/v2/{store-mba47sxn.js → store-9rsrj5pt.js} +2 -2
- package/dist/v2/{store-reader-w7w8vfsy.js → store-reader-tb0f9621.js} +1 -1
- package/dist/v2/store-reader.d.ts +1 -1
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/v2/tui/index.d.ts.map +1 -1
- package/dist/v2/{v2-archive-reader-5njmg3a3.js → v2-archive-reader-7vrma2dm.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-ykgx8hw8.js → wrapup-orchestrator-m1ymvccg.js} +14 -14
- package/dist/{v2-archive-reader-y38khjax.js → v2-archive-reader-aqck4zea.js} +1 -1
- package/dist/{wrapup-orchestrator-a9tshrp4.js → wrapup-orchestrator-k7azmnym.js} +13 -13
- package/package.json +1 -1
- package/src/config/migrate-config-location.test.ts +41 -29
- package/src/shared/model-suggestion-retry.test.ts +137 -90
- package/src/shared/off-thread-migration-clock.test.ts +19 -9
- package/src/shared/prompt-async-transport.test.ts +125 -42
- package/src/shared/rpc-async-probes.test.ts +56 -36
- package/src/shared/rpc-client.test.ts +51 -18
- package/src/shared/sqlite-acquisition-routing.test.ts +79 -22
- package/src/shared/sqlite-busy-budget-review.test.ts +129 -111
- package/src/shared/sqlite-busy-test-support.ts +154 -0
- package/src/shared/sqlite-foreground-wait.test.ts +213 -156
- package/src/shared/sqlite-pass-scope.test.ts +142 -105
- package/src/shared/sqlite-turn-deadline.test.ts +149 -124
- package/src/shared/sqlite-write-locker-test-support.ts +44 -12
- package/src/shared/stable-json-linear.test.ts +29 -11
- package/src/shared/startup-maintenance-policy.test.ts +72 -2
- package/src/shared/storage-busy.test.ts +45 -18
- package/src/shared/storage-file-mutex-review.test.ts +65 -51
- package/src/shared/tui-preferences.test.ts +15 -5
- package/src/shared/worker-shutdown.test.ts +26 -20
- package/src/tui/data/notification-socket.test.ts +220 -108
- package/src/v2/tui/index.ts +5 -1
- package/src/v2/tui/status-dialog-fallback.test.ts +23 -1
- package/dist/v2/server-84w6rvvf.js +0 -14
|
@@ -152,7 +152,7 @@ function decode(row) {
|
|
|
152
152
|
}
|
|
153
153
|
function fileIdentity(path) {
|
|
154
154
|
const stat = statSync(path);
|
|
155
|
-
return `${stat.
|
|
155
|
+
return `${stat.ino}:${stat.birthtimeMs}`;
|
|
156
156
|
}
|
|
157
157
|
function openConfirmed(path, identity) {
|
|
158
158
|
const db = new Database2(path, { readonly: true, fileMustExist: true });
|
|
@@ -12,8 +12,9 @@ import {
|
|
|
12
12
|
withPrivilegedWriter2
|
|
13
13
|
} from "./index-gzy5w8ya.js";
|
|
14
14
|
import {
|
|
15
|
-
scheduleAfterBootQuiet
|
|
16
|
-
|
|
15
|
+
scheduleAfterBootQuiet,
|
|
16
|
+
tryInstallChunkScopeRepairTriggers
|
|
17
|
+
} from "./index-cy5fn70d.js";
|
|
17
18
|
import {
|
|
18
19
|
getHarness2,
|
|
19
20
|
harnessOwnsOpenCodeStore2
|
|
@@ -65,7 +66,7 @@ import {
|
|
|
65
66
|
hasPendingMigrations,
|
|
66
67
|
getMainThreadMigrationBodyCount,
|
|
67
68
|
runMigrations
|
|
68
|
-
} from "./index-
|
|
69
|
+
} from "./index-y1875y4h.js";
|
|
69
70
|
import {
|
|
70
71
|
installTagIdentityRevisionTrigger,
|
|
71
72
|
ensureColumn,
|
|
@@ -1063,6 +1064,7 @@ function finishDatabaseOpen(db, dbPath, explicitDbPath, latestSupportedVersion)
|
|
|
1063
1064
|
closeQuietly(db);
|
|
1064
1065
|
return null;
|
|
1065
1066
|
}
|
|
1067
|
+
tryInstallChunkScopeRepairTriggers(db);
|
|
1066
1068
|
healWedgedChannel2Claims(db);
|
|
1067
1069
|
if (!explicitDbPath && scheduleStartupMaintenanceOnOpen) {
|
|
1068
1070
|
const readsOpenCodeStore = harnessOwnsOpenCodeStore2();
|
|
@@ -137,11 +137,11 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
137
137
|
{ createV2RecoveryAttachments }
|
|
138
138
|
] = await Promise.all([
|
|
139
139
|
import("./sqlite-zdgm52sv.js"),
|
|
140
|
-
import("./store-reader-
|
|
141
|
-
import("./store-
|
|
140
|
+
import("./store-reader-g8w2wp88.js"),
|
|
141
|
+
import("./store-4eeezg83.js"),
|
|
142
142
|
import("./read-session-chunk-wwg20mte.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-93qzv0vk.js"),
|
|
144
|
+
import("./search-archive-dv483a5c.js"),
|
|
145
145
|
import("./expand-attachments-h33jbgyz.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -116,13 +116,13 @@ import {
|
|
|
116
116
|
import {
|
|
117
117
|
shouldSkipHomeProjectMemory,
|
|
118
118
|
resolveProjectIdentity
|
|
119
|
-
} from "./index-
|
|
119
|
+
} from "./index-cy5fn70d.js";
|
|
120
120
|
import {
|
|
121
121
|
getSchemaFenceRejection,
|
|
122
122
|
LATEST_SUPPORTED_VERSION,
|
|
123
123
|
getPersistedSchemaVersion,
|
|
124
124
|
openDatabase
|
|
125
|
-
} from "./index-
|
|
125
|
+
} from "./index-k37h4yrb.js";
|
|
126
126
|
import {
|
|
127
127
|
areRustHistorianSyntheticParts2,
|
|
128
128
|
isStrictGapHealingMessage2,
|
|
@@ -139,7 +139,7 @@ import {
|
|
|
139
139
|
resolveStoredPathWorkspaceIdentity,
|
|
140
140
|
sourceNameForMemory,
|
|
141
141
|
computeWorkspaceEpochFingerprint
|
|
142
|
-
} from "./index-
|
|
142
|
+
} from "./index-y1875y4h.js";
|
|
143
143
|
import {
|
|
144
144
|
BoundedSessionMap
|
|
145
145
|
} from "./index-xtv4d4hv.js";
|
|
@@ -214,7 +214,7 @@ import {
|
|
|
214
214
|
getProjectState,
|
|
215
215
|
recordSubagentInvocation,
|
|
216
216
|
getLatestHistorianInvocationId
|
|
217
|
-
} from "./index-
|
|
217
|
+
} from "./index-ze1t940p.js";
|
|
218
218
|
import {
|
|
219
219
|
clearCompressionDepth,
|
|
220
220
|
clearCompressionDepthRange,
|
|
@@ -282,7 +282,7 @@ import {
|
|
|
282
282
|
getSessionNotes,
|
|
283
283
|
getReadySmartNotes,
|
|
284
284
|
insertPrimerCandidates
|
|
285
|
-
} from "./index-
|
|
285
|
+
} from "./index-zj0ra8vs.js";
|
|
286
286
|
import {
|
|
287
287
|
pushNotification2
|
|
288
288
|
} from "./index-y14pawe1.js";
|
|
@@ -300,13 +300,13 @@ import {
|
|
|
300
300
|
getProjectChunkEmbeddingModelId2,
|
|
301
301
|
getProjectEmbeddingMaxInputTokens2,
|
|
302
302
|
embedItemsWindowBounded2
|
|
303
|
-
} from "./index-
|
|
303
|
+
} from "./index-as8bg7eh.js";
|
|
304
304
|
import {
|
|
305
305
|
renderUserFacingFailure,
|
|
306
306
|
userFacingFailureCode,
|
|
307
307
|
promoteSessionFactsDurable,
|
|
308
308
|
embedPromotedFacts
|
|
309
|
-
} from "./index-
|
|
309
|
+
} from "./index-92p5yfpp.js";
|
|
310
310
|
import {
|
|
311
311
|
isMarkerCandidateBasisCurrent2,
|
|
312
312
|
invalidateMarkerCandidateBasis2,
|
|
@@ -18112,6 +18112,10 @@ async function runCompartmentAgent(deps) {
|
|
|
18112
18112
|
const producerKey = (typeof deps.model === "string" ? deps.model : deps.model?.model) ?? deps.fallbackModelId;
|
|
18113
18113
|
const historianChunkTokens = producerSourceLocalBudget2(providerHistorianChunkTokens, producerKey);
|
|
18114
18114
|
const ordinalsReady = await prepareRawSessionOrdinals2(sessionId);
|
|
18115
|
+
if (deps.isHistorianInstanceDisposed?.()) {
|
|
18116
|
+
updateSessionMeta(db, sessionId, { compartmentInProgress: false });
|
|
18117
|
+
return;
|
|
18118
|
+
}
|
|
18115
18119
|
let completedSuccessfully = false;
|
|
18116
18120
|
let publishCommitted = false;
|
|
18117
18121
|
let retainDrainReservationForRetryThrottle = false;
|
|
@@ -18300,6 +18304,11 @@ async function runCompartmentAgent(deps) {
|
|
|
18300
18304
|
}
|
|
18301
18305
|
throw error;
|
|
18302
18306
|
}
|
|
18307
|
+
if (deps.isHistorianInstanceDisposed?.()) {
|
|
18308
|
+
telemetry.status = "noop";
|
|
18309
|
+
telemetry.failureReason = "hidden_instance_disposed";
|
|
18310
|
+
return;
|
|
18311
|
+
}
|
|
18303
18312
|
if (checked.kind === "not-ready") {
|
|
18304
18313
|
deferUntilOrdinalsReady(`boundary validation ${checked.reason}`);
|
|
18305
18314
|
return;
|
|
@@ -19927,6 +19936,10 @@ function startBackgroundCompartmentAgent(deps, runAgent, prepareBoundary) {
|
|
|
19927
19936
|
}
|
|
19928
19937
|
});
|
|
19929
19938
|
const promise = new Promise((resolve) => setTimeout(resolve, 0)).then(() => withRawSessionMessageCache2(() => {
|
|
19939
|
+
if (deps.isHistorianInstanceDisposed?.()) {
|
|
19940
|
+
updateSessionMeta(deps.db, deps.sessionId, { compartmentInProgress: false });
|
|
19941
|
+
return;
|
|
19942
|
+
}
|
|
19930
19943
|
const snapshot = deps.boundarySnapshot;
|
|
19931
19944
|
try {
|
|
19932
19945
|
primeTailRawMessageCache2({
|
|
@@ -75,7 +75,7 @@ import {
|
|
|
75
75
|
import {
|
|
76
76
|
layoutLkgPrefix,
|
|
77
77
|
assembleLkgPrefix
|
|
78
|
-
} from "./index-
|
|
78
|
+
} from "./index-y1875y4h.js";
|
|
79
79
|
import {
|
|
80
80
|
ensurePrivateStorageDirectorySync,
|
|
81
81
|
writeStorageFileSync,
|
|
@@ -86,7 +86,7 @@ import {
|
|
|
86
86
|
import {
|
|
87
87
|
gaDatabasePath2,
|
|
88
88
|
V2StoreReader2
|
|
89
|
-
} from "./index-
|
|
89
|
+
} from "./index-g1h1efr0.js";
|
|
90
90
|
import {
|
|
91
91
|
markHostInstructionRow,
|
|
92
92
|
hostInstructionRowID,
|
|
@@ -2114,30 +2114,18 @@ function slotFingerprint(slot, metadata = serializeSlotMetadata(slot)) {
|
|
|
2114
2114
|
].join(`
|
|
2115
2115
|
`)).digest("hex");
|
|
2116
2116
|
}
|
|
2117
|
-
function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
2117
|
+
function persistLkgSlot(db, sessionId, slot, publishMetadata, onlyIfNewer) {
|
|
2118
2118
|
const metadata = serializeSlotMetadata(slot);
|
|
2119
2119
|
const fingerprint = slotFingerprint(slot, metadata);
|
|
2120
2120
|
if (!publishMetadata && persistedFingerprints.get(db)?.get(sessionId) === fingerprint) {
|
|
2121
2121
|
const durable = loadPersistedLkgSlot(db, sessionId);
|
|
2122
2122
|
if (durable && slotFingerprint(durable) === fingerprint)
|
|
2123
|
-
return
|
|
2123
|
+
return "committed";
|
|
2124
2124
|
}
|
|
2125
2125
|
const layout = layoutLkgPrefix(slot.jsonPrefix);
|
|
2126
2126
|
try {
|
|
2127
|
-
db.transaction(() => {
|
|
2128
|
-
const
|
|
2129
|
-
for (const row of db.prepare("SELECT chunk, hash FROM lkg_slot_chunks WHERE session_id = ?").all(sessionId)) {
|
|
2130
|
-
storedHashes.set(row.chunk, row.hash);
|
|
2131
|
-
}
|
|
2132
|
-
const upsertChunk = db.prepare(`INSERT INTO lkg_slot_chunks (session_id, chunk, hash, body) VALUES (?, ?, ?, ?)
|
|
2133
|
-
ON CONFLICT(session_id, chunk) DO UPDATE SET hash = excluded.hash, body = excluded.body`);
|
|
2134
|
-
for (let index = 0;index < layout.chunks.length; index += 1) {
|
|
2135
|
-
if (storedHashes.get(index) === layout.chunkHashes[index])
|
|
2136
|
-
continue;
|
|
2137
|
-
upsertChunk.run(sessionId, index, layout.chunkHashes[index], layout.chunks[index]);
|
|
2138
|
-
}
|
|
2139
|
-
db.prepare("DELETE FROM lkg_slot_chunks WHERE session_id = ? AND chunk >= ?").run(sessionId, layout.chunks.length);
|
|
2140
|
-
db.prepare(`INSERT INTO lkg_slots (
|
|
2127
|
+
const committed = db.transaction(() => {
|
|
2128
|
+
const writeSlotRow = () => db.prepare(`INSERT INTO lkg_slots (
|
|
2141
2129
|
session_id, json_prefix_chars, json_prefix_chunks, json_prefix_hash,
|
|
2142
2130
|
input_id_seq, input_content_digests, input_content_signatures,
|
|
2143
2131
|
last_input_message_id, model_key, provider_key,
|
|
@@ -2155,26 +2143,53 @@ function persistLkgSlot(db, sessionId, slot, publishMetadata) {
|
|
|
2155
2143
|
provider_key = excluded.provider_key,
|
|
2156
2144
|
captured_at = excluded.captured_at,
|
|
2157
2145
|
row_version = excluded.row_version,
|
|
2158
|
-
capture_sequence = excluded.capture_sequence`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, metadata.inputIdSeq, metadata.inputContentDigests, metadata.inputContentSignatures, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
|
|
2146
|
+
capture_sequence = excluded.capture_sequence${onlyIfNewer ? " WHERE lkg_slots.captured_at < excluded.captured_at" : ""}`).run(sessionId, layout.chars, layout.chunks.length, layout.hash, metadata.inputIdSeq, metadata.inputContentDigests, metadata.inputContentSignatures, slot.lastInputMessageId, slot.modelKey, slot.providerKey, slot.capturedAt, slot.rowVersion ?? null, slot.captureSequence ?? null);
|
|
2147
|
+
if (onlyIfNewer && writeSlotRow().changes === 0)
|
|
2148
|
+
return false;
|
|
2149
|
+
const storedHashes = new Map;
|
|
2150
|
+
for (const row of db.prepare("SELECT chunk, hash FROM lkg_slot_chunks WHERE session_id = ?").all(sessionId)) {
|
|
2151
|
+
storedHashes.set(row.chunk, row.hash);
|
|
2152
|
+
}
|
|
2153
|
+
const upsertChunk = db.prepare(`INSERT INTO lkg_slot_chunks (session_id, chunk, hash, body) VALUES (?, ?, ?, ?)
|
|
2154
|
+
ON CONFLICT(session_id, chunk) DO UPDATE SET hash = excluded.hash, body = excluded.body`);
|
|
2155
|
+
for (let index = 0;index < layout.chunks.length; index += 1) {
|
|
2156
|
+
if (storedHashes.get(index) === layout.chunkHashes[index])
|
|
2157
|
+
continue;
|
|
2158
|
+
upsertChunk.run(sessionId, index, layout.chunkHashes[index], layout.chunks[index]);
|
|
2159
|
+
}
|
|
2160
|
+
db.prepare("DELETE FROM lkg_slot_chunks WHERE session_id = ? AND chunk >= ?").run(sessionId, layout.chunks.length);
|
|
2161
|
+
if (!onlyIfNewer)
|
|
2162
|
+
writeSlotRow();
|
|
2159
2163
|
publishMetadata?.();
|
|
2164
|
+
return true;
|
|
2160
2165
|
}).immediate();
|
|
2166
|
+
if (!committed)
|
|
2167
|
+
return "skipped";
|
|
2161
2168
|
rememberFingerprint(db, sessionId, fingerprint);
|
|
2162
|
-
return
|
|
2169
|
+
return "committed";
|
|
2163
2170
|
} catch (error) {
|
|
2171
|
+
if (onlyIfNewer)
|
|
2172
|
+
throw error;
|
|
2164
2173
|
if (!publishMetadata)
|
|
2165
2174
|
sessionLog2(sessionId, "LKG snapshot persistence failed (in-memory slot retained):", error);
|
|
2166
|
-
return
|
|
2175
|
+
return "failed";
|
|
2167
2176
|
}
|
|
2168
2177
|
}
|
|
2169
2178
|
function saveLkgSlotToDb(db, sessionId, slot, publishMetadata, fence = {}) {
|
|
2170
|
-
const { isLoadDeadline, ...publicationFence } = fence;
|
|
2171
|
-
|
|
2179
|
+
const { isLoadDeadline, onlyIfNewer = false, ...publicationFence } = fence;
|
|
2180
|
+
let skipped = false;
|
|
2181
|
+
const committed = commitLkgWithRecoveryFence({
|
|
2172
2182
|
sessionId,
|
|
2173
2183
|
slot,
|
|
2174
2184
|
...publicationFence,
|
|
2175
2185
|
load: () => loadPersistedLkgSlot(db, sessionId, true, isLoadDeadline),
|
|
2176
|
-
commit: () =>
|
|
2186
|
+
commit: () => {
|
|
2187
|
+
const result = persistLkgSlot(db, sessionId, slot, publishMetadata, onlyIfNewer);
|
|
2188
|
+
skipped = result === "skipped";
|
|
2189
|
+
return result === "committed";
|
|
2190
|
+
}
|
|
2177
2191
|
});
|
|
2192
|
+
return committed || skipped;
|
|
2178
2193
|
}
|
|
2179
2194
|
function clearPersistedLkgSlot(db, sessionId) {
|
|
2180
2195
|
try {
|
|
@@ -3653,6 +3668,7 @@ class MagicContextLkgHeapHolder {
|
|
|
3653
3668
|
entries = new Map;
|
|
3654
3669
|
}
|
|
3655
3670
|
var lkgHeapHolder = new MagicContextLkgHeapHolder;
|
|
3671
|
+
var pendingCaptureGenerations = new Map;
|
|
3656
3672
|
var totalBytes = 0;
|
|
3657
3673
|
var hydrationPassBySession = new BoundedSessionMap(1000);
|
|
3658
3674
|
var hydrationAttemptBySession = new BoundedSessionMap(1000);
|
|
@@ -3666,6 +3682,28 @@ function beginLkgPass(sessionId) {
|
|
|
3666
3682
|
const next = (hydrationPassBySession.peek(sessionId) ?? 0) + 1;
|
|
3667
3683
|
hydrationPassBySession.set(sessionId, next);
|
|
3668
3684
|
}
|
|
3685
|
+
function advanceCaptureGeneration(sessionId) {
|
|
3686
|
+
const active = pendingCaptureGenerations.get(sessionId);
|
|
3687
|
+
if (active)
|
|
3688
|
+
active.generation++;
|
|
3689
|
+
}
|
|
3690
|
+
function holdLkgCaptureGeneration(sessionId) {
|
|
3691
|
+
let active = pendingCaptureGenerations.get(sessionId);
|
|
3692
|
+
if (!active) {
|
|
3693
|
+
active = { generation: 0, pending: 0 };
|
|
3694
|
+
pendingCaptureGenerations.set(sessionId, active);
|
|
3695
|
+
}
|
|
3696
|
+
const state = active;
|
|
3697
|
+
const { generation } = state;
|
|
3698
|
+
state.pending++;
|
|
3699
|
+
return {
|
|
3700
|
+
isCurrent: () => state.generation === generation && pendingCaptureGenerations.get(sessionId) === state,
|
|
3701
|
+
release: () => {
|
|
3702
|
+
if (--state.pending === 0 && pendingCaptureGenerations.get(sessionId) === state)
|
|
3703
|
+
pendingCaptureGenerations.delete(sessionId);
|
|
3704
|
+
}
|
|
3705
|
+
};
|
|
3706
|
+
}
|
|
3669
3707
|
function slotBytes(slot) {
|
|
3670
3708
|
const digestBytes = slot.inputContentDigests.reduce((total, digest) => total + 2 * digest.length, 0);
|
|
3671
3709
|
const ownershipBytes = slot.piOutputEntryIds?.reduce((total, id) => total + (id?.length ?? 0) * 2 + 8, 0) ?? 0;
|
|
@@ -4027,6 +4065,7 @@ function captureSlot(sessionId, slot) {
|
|
|
4027
4065
|
bytes
|
|
4028
4066
|
};
|
|
4029
4067
|
lkgHeapHolder.entries.set(sessionId, entry);
|
|
4068
|
+
advanceCaptureGeneration(sessionId);
|
|
4030
4069
|
totalBytes += bytes;
|
|
4031
4070
|
hydrationAttemptBySession.delete(sessionId);
|
|
4032
4071
|
noteLkgCapturedPrefix(sessionId);
|
|
@@ -4102,6 +4141,9 @@ function getInMemorySlot(sessionId) {
|
|
|
4102
4141
|
const entry = lkgHeapHolder.entries.get(sessionId);
|
|
4103
4142
|
return entry ? copySlotForRead(entry.slot) : undefined;
|
|
4104
4143
|
}
|
|
4144
|
+
function getInMemorySlotIdentity(sessionId) {
|
|
4145
|
+
return lkgHeapHolder.entries.get(sessionId);
|
|
4146
|
+
}
|
|
4105
4147
|
function getSlot(sessionId) {
|
|
4106
4148
|
const entry = lkgHeapHolder.entries.get(sessionId);
|
|
4107
4149
|
if (!entry) {
|
|
@@ -4125,6 +4167,7 @@ function forgetInMemorySlot(sessionId) {
|
|
|
4125
4167
|
}
|
|
4126
4168
|
}
|
|
4127
4169
|
function dropSlot(sessionId, _reason) {
|
|
4170
|
+
advanceCaptureGeneration(sessionId);
|
|
4128
4171
|
clearCapturedLkgMeasurement(sessionId);
|
|
4129
4172
|
forgetInMemorySlot(sessionId);
|
|
4130
4173
|
const backend = persistenceBackend;
|
|
@@ -5354,4 +5397,4 @@ var ERROR_CLASSES = new Set([
|
|
|
5354
5397
|
"permission_denied",
|
|
5355
5398
|
"unknown"
|
|
5356
5399
|
]);
|
|
5357
|
-
export { advanceSessionActivity, observeSessionActivity, backfillSessionActivity, COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, readSummaryCoverage, markHistoryGapAfterCoverageChange, settleHistoryGapAfterReplacement, readHistoryGapMark, clearHistoryGapMark, claimHistoryGapCheck, recordHistoryGapAdmission, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getNewestCompartmentIds, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, cachedHistoryCoversLatestCompartment, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, hasExplicitRefreshRequest, clearPendingMaterialization, clearReclaimedMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginServedRequest, noteServedPassPermission, noteServedModel, noteServedReplay, noteServedHostInput, noteServedRefusal, countServedRefusal, dropServedRecord, forgetServedRecord, commitServedRequest, lkgInputIdentity, registerLkgPersistence, beginLkgPass, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, getRecentFailedHistorianRunTimes, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
|
5400
|
+
export { advanceSessionActivity, observeSessionActivity, backfillSessionActivity, COMPARTMENT_LEASE_RENEWAL_MS, getCompartmentLeaseBlocker, acquireCompartmentLease, renewCompartmentLease, releaseCompartmentLease, releaseCompartmentLeaseBestEffort, isCompartmentLeaseHeld, readSummaryCoverage, markHistoryGapAfterCoverageChange, settleHistoryGapAfterReplacement, readHistoryGapMark, clearHistoryGapMark, claimHistoryGapCheck, recordHistoryGapAdmission, isNoContentCompartment, queueM0Mutation, getMaxM0MutationId, getCompartments, getNewestCompartmentIds, getLastCompartmentEndMessage, getLastCompartmentEndMessageId, cachedHistoryCoversLatestCompartment, getCompartmentsByEndMessageId, appendCompartments, buildCompartmentBlock, saveRecompStagingPass, getRecompStaging, clearRecompStaging, getRecompPartialRange, setRecompPartialRange, escapeXmlAttr, escapeXmlContent, getUncoveredCompartmentEndsThrough, isPartialCompartmentEnd, readProjectDocsCanonical, readServerFallbackUsage, providerResponseFailed, isSuccessfulProviderCompletion, LkgRecoveryFenceError, lkgServedArrayDigest, hasCleanLkgRecoveryFence, dirtyLkgRecoveryRevision, ownsLkgDirtyFence, invalidateCleanLkgRecoveryFence, prepareLkgCaptureFence, certifyCommittedLkgCapture, markLkgRecoveryDirty, rememberUnpublishedAutoSearchNoHint, getUnpublishedAutoSearchNoHint, forgetUnpublishedAutoSearchNoHint, registerAutoSearchWork, cancelAutoSearchWork, readSessionMeta, getOrCreateSessionMeta, updateSessionMeta, advanceToolReclaimWatermark, markSessionCleanupPending, retryPendingSessionCleanups, retryPendingRustSessionCleanupsForProject, clearSession, requestPendingMaterialization, pendingMaterializationOrigin, hasPendingMaterializationOrigin, hasExplicitRefreshRequest, clearPendingMaterialization, clearReclaimedMaterialization, clearPendingMaterializationOrigin, recordSystemPromptForRequest, recordHeldHeadForRequest, bindSystemPromptResponse, isHeldHeadForRequest, deferDeliveredSystemRefresh, retirePendingSystemPromptDelivery, lkgProviderInputTotal, beginV2LkgRequest, claimLkgRequestIdentity, currentLkgRequestIdentity, noteCapturedLkgRequest, noteLkgProviderResponse, measuredLkgPrefix, clearLkgMeasuredRequest, saveLkgSlotToDb, clearPersistedLkgSlotStrict, loadPersistedLkgSlot, drainStaleLkgSlots, createDbLkgPersistence, resolveLkgModelKeys, createLkgEntryProjector, captureLkgSlot, validateAnthropicReasoningRuns, validateLkgSeam, replayLkg, coldStartRawServedIndex, coldStartUncapturedReplay, noteUncertifiedNormalLkg, hasProcessLocalLkgProof, lkgDirtyRevision, rememberLkgDirtyRevision, readPersistedLkgUntaggedInputIds, persistLkgUntaggedInputIds, noteLkgRecoveryPrefix, readLkgRecoveryPrefix, noteLkgHealthyPrefix, lkgRecoveryReplayUnproven, lkgRecoveryEntryUnproven, beginServedRequest, noteServedPassPermission, noteServedModel, noteServedReplay, noteServedHostInput, noteServedRefusal, countServedRefusal, dropServedRecord, forgetServedRecord, commitServedRequest, lkgInputIdentity, registerLkgPersistence, beginLkgPass, holdLkgCaptureGeneration, visitMessageContentFields, contentSnapshotValue, messageContentFields, signatureForFields, exactReusablePrefix, incrementalLkgContentDigests, lkgContentDigest, lkgSlotRejection, captureSlot, getInMemorySlot, getInMemorySlotIdentity, getSlot, forgetInMemorySlot, dropSlot, noteEntry, getLkgSlotHeapStats, TOOL_SWEEP_SCOPED_MARKER, useScopedToolSweep, createPreAdoptionToolSweepResolver, copySessionStateForClone, externalHistorianFailureReason, getRecentFailedHistorianRunTimes, recordHistorianRun, summarizeImportance, tallyFactsByCategory, MEMORY_VISIBILITY_MUTATION_CATEGORY, queueMemoryMutation, getMemoryMutationsForRender, getMemoryMutationsForRenderByProjects, getMaxMemoryMutationId, getMaxMemoryMutationIdForProjects, GLOBAL_USER_PROFILE_PROJECT_PATH, getProjectState, bumpProjectUserProfileVersion, saveSourceContent, replaceSourceContent, getSourceContents, recordSubagentInvocation, getLatestHistorianInvocationId };
|
package/dist/index.js
CHANGED
|
@@ -47,7 +47,7 @@ import {
|
|
|
47
47
|
checkCompactionMarkerConsistency,
|
|
48
48
|
clearInjectionCache,
|
|
49
49
|
clearNoteNudgeTriggerOnly
|
|
50
|
-
} from "./index-
|
|
50
|
+
} from "./index-xa8jgw6w.js";
|
|
51
51
|
import {
|
|
52
52
|
withContentLanguageDirective,
|
|
53
53
|
string,
|
|
@@ -147,8 +147,9 @@ import {
|
|
|
147
147
|
createCtxSearchTools,
|
|
148
148
|
parameterDescriptionsFor,
|
|
149
149
|
MagicContextRpcServer,
|
|
150
|
-
applyHiddenSubagentTemperature
|
|
151
|
-
|
|
150
|
+
applyHiddenSubagentTemperature,
|
|
151
|
+
startEventSubscriptionWorker
|
|
152
|
+
} from "./index-e4szqthq.js";
|
|
152
153
|
import {
|
|
153
154
|
resolveOpenCodeDbPath,
|
|
154
155
|
openCodeDbPathExists,
|
|
@@ -175,7 +176,7 @@ import {
|
|
|
175
176
|
beginBootQuietPeriod,
|
|
176
177
|
bootQuietRemainingMs,
|
|
177
178
|
scheduleAfterBootQuiet
|
|
178
|
-
} from "./index-
|
|
179
|
+
} from "./index-cy5fn70d.js";
|
|
179
180
|
import {
|
|
180
181
|
BoundedSessionMap,
|
|
181
182
|
deleteTemporalDecision,
|
|
@@ -202,10 +203,10 @@ import {
|
|
|
202
203
|
dropServedRecord,
|
|
203
204
|
registerLkgPersistence,
|
|
204
205
|
dropSlot
|
|
205
|
-
} from "./index-
|
|
206
|
+
} from "./index-ze1t940p.js";
|
|
206
207
|
import {
|
|
207
208
|
recordSessionProjectIdentity
|
|
208
|
-
} from "./index-
|
|
209
|
+
} from "./index-42fsf88t.js";
|
|
209
210
|
import"./index-fb3zxn06.js";
|
|
210
211
|
import {
|
|
211
212
|
startBootDeadline,
|
|
@@ -216,7 +217,7 @@ import {
|
|
|
216
217
|
openDatabaseAsync,
|
|
217
218
|
isDatabasePersisted,
|
|
218
219
|
getDatabasePersistenceError
|
|
219
|
-
} from "./index-
|
|
220
|
+
} from "./index-k37h4yrb.js";
|
|
220
221
|
import {
|
|
221
222
|
registerExitAbort,
|
|
222
223
|
unregisterExitAbort
|
|
@@ -227,7 +228,7 @@ import {
|
|
|
227
228
|
forgetRawSessionOrdinalWatermark2
|
|
228
229
|
} from "./index-jsbgw33b.js";
|
|
229
230
|
import"./index-geph2sa6.js";
|
|
230
|
-
import"./index-
|
|
231
|
+
import"./index-y1875y4h.js";
|
|
231
232
|
import"./index-fr0wbhdn.js";
|
|
232
233
|
import {
|
|
233
234
|
preloadTokenizer,
|
|
@@ -237,7 +238,7 @@ import"./index-gcf2x04k.js";
|
|
|
237
238
|
import {
|
|
238
239
|
getDefaultSubcConnectionFile,
|
|
239
240
|
SubcModuleTransport
|
|
240
|
-
} from "./index-
|
|
241
|
+
} from "./index-a3t1ck7g.js";
|
|
241
242
|
import"./index-qt1qqasc.js";
|
|
242
243
|
import"./index-y5f5yg5a.js";
|
|
243
244
|
import {
|
|
@@ -314,18 +315,18 @@ import"./index-1vv1ka4a.js";
|
|
|
314
315
|
import {
|
|
315
316
|
deleteIndexedMessage
|
|
316
317
|
} from "./index-p8nc9axh.js";
|
|
317
|
-
import"./index-
|
|
318
|
-
import"./index-
|
|
318
|
+
import"./index-g1h1efr0.js";
|
|
319
|
+
import"./index-zj0ra8vs.js";
|
|
319
320
|
import {
|
|
320
321
|
pushNotification2
|
|
321
322
|
} from "./index-y14pawe1.js";
|
|
322
323
|
import"./index-p5ey52j9.js";
|
|
323
324
|
import {
|
|
324
325
|
getEmbeddingCoverageStatus2
|
|
325
|
-
} from "./index-
|
|
326
|
+
} from "./index-as8bg7eh.js";
|
|
326
327
|
import"./index-6xg55350.js";
|
|
327
|
-
import"./index-
|
|
328
|
-
import"./index-
|
|
328
|
+
import"./index-92p5yfpp.js";
|
|
329
|
+
import"./index-cxh5g5bt.js";
|
|
329
330
|
import"./index-srpghrje.js";
|
|
330
331
|
import"./index-qxzk5s30.js";
|
|
331
332
|
import {
|
|
@@ -348,13 +349,13 @@ import {
|
|
|
348
349
|
armBindingRecoverySafely,
|
|
349
350
|
collectForeignTextParts,
|
|
350
351
|
resetDegradedCacheCount2
|
|
351
|
-
} from "./index-
|
|
352
|
+
} from "./index-5phmpcme.js";
|
|
352
353
|
import {
|
|
353
354
|
scheduleClearAndReindex
|
|
354
|
-
} from "./index-
|
|
355
|
+
} from "./index-ydevzvfs.js";
|
|
355
356
|
import {
|
|
356
357
|
runManagedRecomp2
|
|
357
|
-
} from "./index-
|
|
358
|
+
} from "./index-3p08zzfq.js";
|
|
358
359
|
import {
|
|
359
360
|
isValidSemver,
|
|
360
361
|
compareSemverCore
|
|
@@ -362,11 +363,11 @@ import {
|
|
|
362
363
|
import"./index-fmsr7v69.js";
|
|
363
364
|
import {
|
|
364
365
|
runManagedWrapup2
|
|
365
|
-
} from "./index-
|
|
366
|
+
} from "./index-20e7w8v8.js";
|
|
366
367
|
import"./index-zh683xh2.js";
|
|
367
368
|
import"./index-6gd9akdt.js";
|
|
368
|
-
import"./index-
|
|
369
|
-
import"./index-
|
|
369
|
+
import"./index-sfgz2h7y.js";
|
|
370
|
+
import"./index-e7awy9eb.js";
|
|
370
371
|
import {
|
|
371
372
|
__toESM,
|
|
372
373
|
__commonJS
|
|
@@ -8222,7 +8223,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
8222
8223
|
// package.json
|
|
8223
8224
|
var package_default = {
|
|
8224
8225
|
name: "@cortexkit/opencode-magic-context",
|
|
8225
|
-
version: "0.49.
|
|
8226
|
+
version: "0.49.106",
|
|
8226
8227
|
type: "module",
|
|
8227
8228
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
8228
8229
|
main: "dist/index.js",
|
|
@@ -11971,7 +11972,7 @@ async function sendOpenCodeRefusal(client, sessionId, message, refusal) {
|
|
|
11971
11972
|
sessionLog2(sessionId, "refusal notice skipped: no terminal viewing the session", refusal.name);
|
|
11972
11973
|
}
|
|
11973
11974
|
if (storageBusy) {
|
|
11974
|
-
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-
|
|
11975
|
+
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-vd9rckyd.js"));
|
|
11975
11976
|
await abortSessionFailClosed(client, sessionId);
|
|
11976
11977
|
}
|
|
11977
11978
|
}
|
|
@@ -12155,6 +12156,7 @@ function registerStandalonePluginMarker(version) {
|
|
|
12155
12156
|
import { existsSync as existsSync8, readFileSync as readFileSync7 } from "node:fs";
|
|
12156
12157
|
import { dirname as dirname4, join as join10 } from "node:path";
|
|
12157
12158
|
import { fileURLToPath as fileURLToPath2 } from "node:url";
|
|
12159
|
+
var UPDATE_EVENT_TYPES = ["session.execution.succeeded"];
|
|
12158
12160
|
var cachedPackageInfo;
|
|
12159
12161
|
function packageInfo() {
|
|
12160
12162
|
if (cachedPackageInfo)
|
|
@@ -12183,45 +12185,34 @@ function formatUpdateAvailableMessage(latest, current) {
|
|
|
12183
12185
|
function startUpdateChecks(context, check = (signal) => {
|
|
12184
12186
|
return packageInfo().development ? Promise.resolve(null) : getLatestVersion("latest", { signal });
|
|
12185
12187
|
}) {
|
|
12186
|
-
const controller = new AbortController;
|
|
12187
12188
|
let lastCheckAt;
|
|
12188
12189
|
let loaded = false;
|
|
12189
|
-
|
|
12190
|
-
|
|
12191
|
-
|
|
12192
|
-
|
|
12193
|
-
|
|
12194
|
-
|
|
12195
|
-
|
|
12196
|
-
|
|
12197
|
-
|
|
12198
|
-
|
|
12199
|
-
|
|
12200
|
-
|
|
12201
|
-
|
|
12202
|
-
|
|
12203
|
-
|
|
12204
|
-
|
|
12205
|
-
|
|
12206
|
-
|
|
12207
|
-
|
|
12208
|
-
|
|
12209
|
-
|
|
12210
|
-
|
|
12211
|
-
|
|
12212
|
-
}
|
|
12213
|
-
} catch (error) {
|
|
12214
|
-
if (!controller.signal.aborted)
|
|
12215
|
-
log2("[magic-context] v2 update check unavailable", error);
|
|
12216
|
-
}
|
|
12217
|
-
})();
|
|
12218
|
-
return {
|
|
12219
|
-
done,
|
|
12220
|
-
async dispose() {
|
|
12221
|
-
controller.abort();
|
|
12222
|
-
await done;
|
|
12190
|
+
return startEventSubscriptionWorker(context.event, UPDATE_EVENT_TYPES, {
|
|
12191
|
+
subscriptionEnded: (error) => log2("[magic-context] v2 update event subscription ended; retrying", error),
|
|
12192
|
+
handlerFailed: (error) => log2("[magic-context] v2 update check unavailable", error)
|
|
12193
|
+
}, async (value, signal) => {
|
|
12194
|
+
if (value?.type !== UPDATE_EVENT_TYPES[0])
|
|
12195
|
+
return false;
|
|
12196
|
+
if (loaded && typeof lastCheckAt === "number" && Date.now() - lastCheckAt < 60 * 60 * 1000)
|
|
12197
|
+
return false;
|
|
12198
|
+
lastCheckAt = await context.storage.get("version-check-at");
|
|
12199
|
+
loaded = true;
|
|
12200
|
+
if (typeof lastCheckAt === "number" && Date.now() - lastCheckAt < 60 * 60 * 1000)
|
|
12201
|
+
return true;
|
|
12202
|
+
const now = Date.now();
|
|
12203
|
+
await context.storage.set("version-check-at", now);
|
|
12204
|
+
lastCheckAt = now;
|
|
12205
|
+
const latest = await check(signal);
|
|
12206
|
+
const current = packageInfo().version;
|
|
12207
|
+
const comparison = latest ? compareSemverCore(latest, current) : null;
|
|
12208
|
+
if (latest && !signal.aborted && comparison !== null && comparison > 0) {
|
|
12209
|
+
pushNotification2("toast", {
|
|
12210
|
+
message: formatUpdateAvailableMessage(latest, current),
|
|
12211
|
+
variant: "info"
|
|
12212
|
+
});
|
|
12223
12213
|
}
|
|
12224
|
-
|
|
12214
|
+
return true;
|
|
12215
|
+
});
|
|
12225
12216
|
}
|
|
12226
12217
|
|
|
12227
12218
|
// src/v2/server.ts
|
|
@@ -12241,7 +12232,7 @@ async function setup(context) {
|
|
|
12241
12232
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
12242
12233
|
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.`);
|
|
12243
12234
|
}
|
|
12244
|
-
const { registerContext } = await import("./context-
|
|
12235
|
+
const { registerContext } = await import("./context-ywdwfzg5.js");
|
|
12245
12236
|
setHarness2("opencode2");
|
|
12246
12237
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
12247
12238
|
const duties = await registerContext(context);
|
package/dist/migration-worker.js
CHANGED
|
@@ -9,17 +9,17 @@ import {
|
|
|
9
9
|
import"./index-fr0wbhdn.js";
|
|
10
10
|
import {
|
|
11
11
|
runMigrationsWithRetry
|
|
12
|
-
} from "./index-
|
|
12
|
+
} from "./index-y1875y4h.js";
|
|
13
13
|
import"./index-xtv4d4hv.js";
|
|
14
14
|
import"./index-58e3y90n.js";
|
|
15
15
|
import"./index-abhmtj00.js";
|
|
16
16
|
import"./index-t7st85f5.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-cy5fn70d.js";
|
|
18
18
|
import"./index-fb3zxn06.js";
|
|
19
19
|
import {
|
|
20
20
|
setSqlitePragmaConfig,
|
|
21
21
|
initializeDatabase
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-k37h4yrb.js";
|
|
23
23
|
import"./index-8k9qpyjf.js";
|
|
24
24
|
import"./index-v0p37hm2.js";
|
|
25
25
|
import"./index-96ztjvkn.js";
|
|
@@ -136,6 +136,7 @@ export declare function createSessionHooks(args: {
|
|
|
136
136
|
limit: number;
|
|
137
137
|
}) => Promise<void>) & {
|
|
138
138
|
clearSessionLogState: (sessionId: string) => void;
|
|
139
|
+
disposeLastGood(): void;
|
|
139
140
|
invalidateRustWireState(sessionId: string): void;
|
|
140
141
|
clearRustSession(sessionId: string): Promise<void>;
|
|
141
142
|
disposeRust(): void;
|
|
@@ -212,6 +213,7 @@ export declare function createSessionHooksAsync(args: {
|
|
|
212
213
|
limit: number;
|
|
213
214
|
}) => Promise<void>) & {
|
|
214
215
|
clearSessionLogState: (sessionId: string) => void;
|
|
216
|
+
disposeLastGood(): void;
|
|
215
217
|
invalidateRustWireState(sessionId: string): void;
|
|
216
218
|
clearRustSession(sessionId: string): Promise<void>;
|
|
217
219
|
disposeRust(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAGnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,wBAAwB;;;;;;;;;;;;;mBAcK,CAAC;aAE3E,CAAC;aAA2B,CAAC;eAA6B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;2BA+Go/zC,CAAC;;;;eAA8iB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA3G3m1C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC/C
|
|
1
|
+
{"version":3,"file":"create-session-hooks.d.ts","sourceRoot":"","sources":["../../../src/plugin/hooks/create-session-hooks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,cAAc,CAAC;AAE7D,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAKnE,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,yCAAyC,CAAC;AAGnF,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,8CAA8C,CAAC;AACrF,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,+CAA+C,CAAC;AAC1F,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,qCAAqC,CAAC;AAChF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C;;;;;;GAMG;AACH,wBAAgB,2BAA2B,CAAC,YAAY,EAAE,wBAAwB;;;;;;;;;;;;;mBAcK,CAAC;aAE3E,CAAC;aAA2B,CAAC;eAA6B,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;2BA+Go/zC,CAAC;;;;eAA8iB,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EA3G3m1C;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IACrC,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;CAC/C;;;;;;;;;;;;;;;;;qBAkG8uJ,CAAC;8BAAwC,CAAC;iBAA8C,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;;;;;;;;qBAAhkG,CAAC;mBAA6B,CAAC;iBAA2B,CAAC;iBAA2B,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;iBAA2D,CAAC;;oBAA4D,CAAC;uBAAiC,CAAC;yBAAoC,CAAC;;;;;;0BAA2m8C,CAAC;;;;;;;;;;;;;;;;EAvD5sgD;AAED,wBAAsB,uBAAuB,CAAC,IAAI,EAAE;IAChD,GAAG,EAAE,aAAa,CAAC;IACnB,YAAY,EAAE,wBAAwB,CAAC;IACvC,gBAAgB,CAAC,EAAE,gBAAgB,CAAC,wBAAwB,CAAC,CAAC;IAC9D,gBAAgB,EAAE,gBAAgB,CAAC;IACnC,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,oBAAoB,CAAC,EAAE,oBAAoB,CAAC;IAC5C,oBAAoB,CAAC,EAAE,CAAC,OAAO,EAAE,mBAAmB,KAAK,IAAI,CAAC;CACjE;;;;;;;;;;;;;;;;;qBA6C8uJ,CAAC;8BAAwC,CAAC;iBAA8C,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;;;;;;;;;;;qBAAhkG,CAAC;mBAA6B,CAAC;iBAA2B,CAAC;iBAA2B,CAAC;0BAAc,CAAC;uBAAiB,CAAC;;;iBAA2D,CAAC;;oBAA4D,CAAC;uBAAiC,CAAC;yBAAoC,CAAC;;;;;;0BAA2m8C,CAAC;;;;;;;;;;;;;;;;GAD5sgD"}
|