@cortexkit/opencode-magic-context 0.49.40 → 0.49.41
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/{compaction-marker-candidates-5p1qkve9.js → compaction-marker-candidates-5c44h1m9.js} +1 -1
- package/dist/compaction-marker-candidates-worker.js +1 -1
- package/dist/{context-8ktz4j2b.js → context-3szg46w6.js} +5 -5
- package/dist/features/magic-context/compaction-marker-candidates.d.ts +1 -1
- package/dist/features/magic-context/compaction-marker-candidates.d.ts.map +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts +1 -1
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -1
- package/dist/{index-gfd41hm4.js → index-216tae7b.js} +5 -5
- package/dist/{index-850vthn3.js → index-3w1pbn85.js} +9 -4
- package/dist/{index-m8v7nqgp.js → index-aed5qpyv.js} +1 -1
- package/dist/{index-hf771sk4.js → index-bgxpadsx.js} +1 -1
- package/dist/{index-wk7x13qv.js → index-j8gv6ajw.js} +2 -2
- package/dist/{index-tr6vcwt0.js → index-q9gamh8e.js} +121 -22
- package/dist/index.js +9 -9
- package/dist/{recomp-orchestrator-34mh19vm.js → recomp-orchestrator-7v52khmf.js} +3 -3
- package/dist/{transform-postprocess-phase-61f7t9xq.js → transform-postprocess-phase-6fpgz12m.js} +3 -3
- package/dist/v2/{compaction-marker-candidates-yeb2ky46.js → compaction-marker-candidates-jy65jt49.js} +1 -1
- package/dist/v2/compaction-marker-candidates-worker.js +1 -1
- package/dist/v2/{context-rdch08me.js → context-eq5bhf40.js} +4 -4
- package/dist/v2/{recomp-orchestrator-x0r6sy3a.js → recomp-orchestrator-kep59sph.js} +2 -2
- package/dist/v2/{server-r4430x9m.js → server-dwpgzm0t.js} +9 -4
- package/dist/v2/{server-405ap0b0.js → server-hewk7z3z.js} +121 -22
- package/dist/v2/server.js +2 -2
- package/dist/v2/{wrapup-orchestrator-f8w3kcjf.js → wrapup-orchestrator-1mgx1nym.js} +2 -2
- package/dist/{wrapup-orchestrator-7dxwer1p.js → wrapup-orchestrator-yy0n9mxy.js} +4 -4
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
7
7
|
port.postMessage({ kind: "accepted" });
|
|
8
8
|
const [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
|
|
9
9
|
import("./sqlite-zdgm52sv.js"),
|
|
10
|
-
import("./compaction-marker-candidates-
|
|
10
|
+
import("./compaction-marker-candidates-5c44h1m9.js")
|
|
11
11
|
]);
|
|
12
12
|
let db;
|
|
13
13
|
let reply;
|
|
@@ -37,7 +37,7 @@ import {
|
|
|
37
37
|
rebaseSessionCoordinatesAsync,
|
|
38
38
|
resolveOpenCodeProtectedTailBoundary,
|
|
39
39
|
getActiveCompartmentRun
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-q9gamh8e.js";
|
|
41
41
|
import"./index-sd3egckz.js";
|
|
42
42
|
import {
|
|
43
43
|
getHarness2
|
|
@@ -131,7 +131,7 @@ import {
|
|
|
131
131
|
applyJsonSchemaParameterDescriptions,
|
|
132
132
|
MagicContextRpcServer,
|
|
133
133
|
subagentTemperature
|
|
134
|
-
} from "./index-
|
|
134
|
+
} from "./index-216tae7b.js";
|
|
135
135
|
import {
|
|
136
136
|
resolveHistorianModel2
|
|
137
137
|
} from "./index-5kym00ag.js";
|
|
@@ -282,8 +282,8 @@ import {
|
|
|
282
282
|
EmergencyFailClosedError,
|
|
283
283
|
DegradedPassRefusalError,
|
|
284
284
|
isSyntheticHeadMessage2
|
|
285
|
-
} from "./index-
|
|
286
|
-
import"./index-
|
|
285
|
+
} from "./index-bgxpadsx.js";
|
|
286
|
+
import"./index-3w1pbn85.js";
|
|
287
287
|
import"./index-qt1qqasc.js";
|
|
288
288
|
import {
|
|
289
289
|
retainProjectEmbedding2
|
|
@@ -304,7 +304,7 @@ import {
|
|
|
304
304
|
import"./index-fw42ms3m.js";
|
|
305
305
|
import"./index-ae1ar4v1.js";
|
|
306
306
|
import"./index-j5qma52p.js";
|
|
307
|
-
import"./index-
|
|
307
|
+
import"./index-aed5qpyv.js";
|
|
308
308
|
import"./index-gp3kcpc4.js";
|
|
309
309
|
import {
|
|
310
310
|
detectConflicts
|
|
@@ -30,7 +30,7 @@ export type MarkerCandidateReply = {
|
|
|
30
30
|
export declare const MARKER_CERTIFICATION_SQL = "SELECT\n (SELECT rowid FROM message WHERE id = ?) AS previousRowid,\n (SELECT rowid FROM message ORDER BY rowid DESC LIMIT 1) AS newestRowid,\n (SELECT id FROM message ORDER BY rowid DESC LIMIT 1) AS newestId,\n EXISTS(SELECT 1 FROM message\n WHERE rowid > ? AND +session_id = ? AND json_valid(data)\n AND COALESCE(json_extract(data, '$.summary'), 0) = 1) AS newSummary";
|
|
31
31
|
export declare function isMarkerCandidateBasisCurrent(db: Database, basis: MarkerCandidateBasis): boolean;
|
|
32
32
|
export declare function invalidateMarkerCandidateBasis(db: Database, sessionId: string): void;
|
|
33
|
-
export declare function readMarkerCandidateBasis(db: Database, sessionId: string): MarkerCandidateBasis | undefined;
|
|
33
|
+
export declare function readMarkerCandidateBasis(db: Database, sessionId: string, readConnection?: Database): MarkerCandidateBasis | undefined;
|
|
34
34
|
/** Discover summary IDs off-thread. Defer cleanup if a new summary appears or the
|
|
35
35
|
* last scanned row is deleted or assigned a different rowid. Ordinary message
|
|
36
36
|
* updates and appends do not invalidate the discovered summary IDs. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-marker-candidates.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compaction-marker-candidates.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,qBAAqB,CAAC;AAG3E,UAAU,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,EAAE,CAAC;IACd,QAAQ,EAAE,cAAc,GAAG,IAAI,CAAC;CACnC;AACD,MAAM,WAAW,oBAAqB,SAAQ,uBAAuB;IACjE,UAAU,EAAE,QAAQ,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,gBAAgB,EAAE,MAAM,CAAC;CAC5B;AACD,MAAM,WAAW,iCAAiC;IAC9C,KAAK,CAAC,EAAE,GAAG,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,MAAM,MAAM,oBAAoB,GAC1B;IAAE,IAAI,EAAE,UAAU,CAAA;CAAE,GACpB;IAAE,IAAI,EAAE,YAAY,CAAC;IAAC,QAAQ,EAAE,uBAAuB,CAAA;CAAE,GACzD;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAkBvC,eAAO,MAAM,wBAAwB,8YAMuC,CAAC;AAE7E,wBAAgB,6BAA6B,CAAC,EAAE,EAAE,QAAQ,EAAE,KAAK,EAAE,oBAAoB,GAAG,OAAO,CA+ChG;AAED,wBAAgB,8BAA8B,CAAC,EAAE,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,CAOpF;AACD,wBAAgB,wBAAwB,CACpC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,
|
|
1
|
+
{"version":3,"file":"compaction-marker-candidates.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compaction-marker-candidates.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,KAAK,QAAQ,EAAyB,MAAM,qBAAqB,CAAC;AAG3E,UAAU,cAAc;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,EAAE,EAAE,MAAM,CAAC;CACd;AACD,MAAM,WAAW,uBAAuB;IACpC,GAAG,EAAE,MAAM,EAAE,CAAC;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BAAgB,2BAA2B,CACvC,EAAE,EAAE,QAAQ,EACZ,SAAS,EAAE,MAAM,GAClB,uBAAuB,CAczB"}
|
|
@@ -99,7 +99,7 @@ export declare function planCompactionMarker(args: InjectCompactionMarkerArgs, b
|
|
|
99
99
|
* and no surviving marker-owned rows, including partial remnants. */
|
|
100
100
|
export declare function isCompactionMarkerIntentAbsent(marker: CompactionMarkerState, targetEndMessageId: string | null): boolean;
|
|
101
101
|
/** Serialize recovery and intent staging with host writers, without changing host rows. */
|
|
102
|
-
export declare function withCompactionMarkerPublicationLock<T>(operation: () => T): T;
|
|
102
|
+
export declare function withCompactionMarkerPublicationLock<T>(operation: () => T, sessionId: string): T;
|
|
103
103
|
export type MarkerPublicationInspection = {
|
|
104
104
|
kind: "deferred";
|
|
105
105
|
} | {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-marker.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compaction-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAaH,OAAO,EAIH,KAAK,iCAAiC,EAGzC,MAAM,gCAAgC,CAAC;AAqCxC,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,QAAQ,SAAK,GAAG,MAAM,CAE1F;AAED,wBAAgB,cAAc,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,EAAE,QAAQ,SAAK,GAAG,MAAM,CAEvF;AAID,wBAAgB,iBAAiB,IAAI,MAAM,CAE1C;
|
|
1
|
+
{"version":3,"file":"compaction-marker.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/compaction-marker.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AAaH,OAAO,EAIH,KAAK,iCAAiC,EAGzC,MAAM,gCAAgC,CAAC;AAqCxC,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,EAAE,OAAO,SAAK,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;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,8BAA8B,CAC1C,SAAS,EAAE,MAAM,EACjB,WAAW,EAAE,MAAM,GACpB,0BAA0B,CAwN5B;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAgB5E"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"compaction-marker-publication.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compaction-marker-publication.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,kCAAkC,EAIvC,KAAK,0BAA0B,EAMlC,MAAM,gDAAgD,CAAC;AAcxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAWpD;;;;GAIG;AACH,wBAAgB,kCAAkC,CAC9C,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,0BAA0B,EAChC,eAAe,EAAE,MAAM,OAAO,GAC/B,kCAAkC,
|
|
1
|
+
{"version":3,"file":"compaction-marker-publication.d.ts","sourceRoot":"","sources":["../../../src/hooks/magic-context/compaction-marker-publication.ts"],"names":[],"mappings":"AAAA,OAAO,EACH,KAAK,kCAAkC,EAIvC,KAAK,0BAA0B,EAMlC,MAAM,gDAAgD,CAAC;AAcxD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAWpD;;;;GAIG;AACH,wBAAgB,kCAAkC,CAC9C,EAAE,EAAE,QAAQ,EACZ,IAAI,EAAE,0BAA0B,EAChC,eAAe,EAAE,MAAM,OAAO,GAC/B,kCAAkC,CA+MpC"}
|
|
@@ -191,7 +191,7 @@ import {
|
|
|
191
191
|
snapRangeToCompartments,
|
|
192
192
|
getActiveCompartmentRun,
|
|
193
193
|
startCompartmentAgent
|
|
194
|
-
} from "./index-
|
|
194
|
+
} from "./index-q9gamh8e.js";
|
|
195
195
|
import {
|
|
196
196
|
hasTrustedAbsoluteWall,
|
|
197
197
|
applyProvenInputFloor,
|
|
@@ -707,7 +707,7 @@ import {
|
|
|
707
707
|
import {
|
|
708
708
|
setRecompStarting2,
|
|
709
709
|
setRecompTerminal2
|
|
710
|
-
} from "./index-
|
|
710
|
+
} from "./index-aed5qpyv.js";
|
|
711
711
|
import {
|
|
712
712
|
makeToolCompositeKey,
|
|
713
713
|
searchMessageHistoryOffThread,
|
|
@@ -772,7 +772,7 @@ import {
|
|
|
772
772
|
abortSessionFailClosed2,
|
|
773
773
|
evaluateEmergencyFailClosed2,
|
|
774
774
|
runPostTransformPhase2
|
|
775
|
-
} from "./index-
|
|
775
|
+
} from "./index-bgxpadsx.js";
|
|
776
776
|
import {
|
|
777
777
|
ANNOUNCEMENT_VERSION2,
|
|
778
778
|
ANNOUNCEMENT_FEATURES2,
|
|
@@ -16418,7 +16418,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16418
16418
|
const db = readDatabase();
|
|
16419
16419
|
if (!db)
|
|
16420
16420
|
return { ok: false, error: "db unavailable" };
|
|
16421
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
16421
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-7v52khmf.js"));
|
|
16422
16422
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-14p3yje4.js"));
|
|
16423
16423
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
16424
16424
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -16503,7 +16503,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
16503
16503
|
const db = readDatabase();
|
|
16504
16504
|
if (!db)
|
|
16505
16505
|
return { ok: false, error: "db unavailable" };
|
|
16506
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
16506
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-yy0n9mxy.js"));
|
|
16507
16507
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
16508
16508
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
16509
16509
|
const ctx = {
|
|
@@ -43,7 +43,7 @@ function isMarkerCandidateBasisCurrent2(db, basis) {
|
|
|
43
43
|
if (basis.connection !== db || ownWriteRevisions.get(basis.revisionKey) !== basis.ownWriteRevision)
|
|
44
44
|
return false;
|
|
45
45
|
try {
|
|
46
|
-
const current = db.prepare(MARKER_CERTIFICATION_SQL).
|
|
46
|
+
const current = db.prepare(MARKER_CERTIFICATION_SQL).all(basis.frontier?.id ?? null, basis.frontier?.rowid ?? 0, basis.sessionId)[0];
|
|
47
47
|
if (current.newSummary || basis.frontier && (current.previousRowid !== basis.frontier.rowid || current.newestRowid === null || current.newestRowid < basis.frontier.rowid))
|
|
48
48
|
return false;
|
|
49
49
|
if (current.newestRowid !== null && (!Number.isSafeInteger(current.newestRowid) || current.newestId === null))
|
|
@@ -64,10 +64,15 @@ function invalidateMarkerCandidateBasis2(db, sessionId) {
|
|
|
64
64
|
if (revision !== undefined)
|
|
65
65
|
ownWriteRevisions.set(key, revision + 1);
|
|
66
66
|
}
|
|
67
|
-
function readMarkerCandidateBasis2(db, sessionId) {
|
|
67
|
+
function readMarkerCandidateBasis2(db, sessionId, readConnection = db) {
|
|
68
68
|
const basis = candidates.get(db)?.get(sessionId);
|
|
69
|
-
if (basis
|
|
70
|
-
|
|
69
|
+
if (basis) {
|
|
70
|
+
const snapshot = readConnection === db ? basis : { ...basis, connection: readConnection };
|
|
71
|
+
if (isMarkerCandidateBasisCurrent2(readConnection, snapshot)) {
|
|
72
|
+
basis.frontier = snapshot.frontier;
|
|
73
|
+
return readConnection === db ? basis : { ...snapshot, connection: db };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
71
76
|
candidates.get(db)?.delete(sessionId);
|
|
72
77
|
return;
|
|
73
78
|
}
|
|
@@ -32,14 +32,14 @@ import {
|
|
|
32
32
|
getActiveCompartmentRun,
|
|
33
33
|
markActiveCompartmentRunPublished,
|
|
34
34
|
registerActiveCompartmentRun
|
|
35
|
-
} from "./index-
|
|
35
|
+
} from "./index-q9gamh8e.js";
|
|
36
36
|
import {
|
|
37
37
|
sendStatusNotification2
|
|
38
38
|
} from "./index-ae1ar4v1.js";
|
|
39
39
|
import {
|
|
40
40
|
setRecompStarting2,
|
|
41
41
|
setRecompTerminal2
|
|
42
|
-
} from "./index-
|
|
42
|
+
} from "./index-aed5qpyv.js";
|
|
43
43
|
|
|
44
44
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
|
45
45
|
import * as crypto from "node:crypto";
|
|
@@ -297,7 +297,7 @@ import {
|
|
|
297
297
|
invalidateMarkerCandidateBasis2,
|
|
298
298
|
readMarkerCandidateBasis2,
|
|
299
299
|
prepareMarkerCandidateBasis2
|
|
300
|
-
} from "./index-
|
|
300
|
+
} from "./index-3w1pbn85.js";
|
|
301
301
|
import {
|
|
302
302
|
sendStatusNotification2
|
|
303
303
|
} from "./index-ae1ar4v1.js";
|
|
@@ -8055,6 +8055,7 @@ function getOpenCodeDbPath() {
|
|
|
8055
8055
|
}
|
|
8056
8056
|
var cachedWriteDb = null;
|
|
8057
8057
|
var cachedRemovalDb = null;
|
|
8058
|
+
var cachedSnapshotDb = null;
|
|
8058
8059
|
var MARKER_BUSY_TIMEOUT_MS = 250;
|
|
8059
8060
|
var MARKER_REMOVAL_BUSY_TIMEOUT_MS = 5000;
|
|
8060
8061
|
function runMarkerRemovalTransaction(db, operation) {
|
|
@@ -8088,7 +8089,7 @@ function runMarkerWriteTransaction(db, site, operation) {
|
|
|
8088
8089
|
try {
|
|
8089
8090
|
log2(`[magic-context] sqlite writer site=${site} db=opencode acquire_ms=${Math.round(acquireMs)} hold_ms=${Math.round(holdMs)} work_ms=${Math.round(workMs)} end_ms=${Math.round(endMs)} outcome=${acquiredAt === undefined ? "not_acquired" : committed ? "committed" : "failed"}`);
|
|
8090
8091
|
if (finishedAt - startedAt > 100) {
|
|
8091
|
-
const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").
|
|
8092
|
+
const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").all()[0];
|
|
8092
8093
|
log2(`[magic-context] compaction-marker slow writer site=${site} acquire_ms=${acquireMs.toFixed(1)} statements_ms=${workMs.toFixed(1)} ${committed ? "commit" : "rollback"}_ms=${endMs.toFixed(1)} wal_autocheckpoint=${autoCheckpoint.wal_autocheckpoint} wal_pages_before=${walBefore ?? "unknown"} wal_pages_after=${markerWalPages(db) ?? "unknown"}`);
|
|
8093
8094
|
}
|
|
8094
8095
|
} catch {}
|
|
@@ -8096,7 +8097,7 @@ function runMarkerWriteTransaction(db, site, operation) {
|
|
|
8096
8097
|
}
|
|
8097
8098
|
function markerWalPages(db) {
|
|
8098
8099
|
try {
|
|
8099
|
-
const row = db.prepare("PRAGMA page_size").
|
|
8100
|
+
const row = db.prepare("PRAGMA page_size").all()[0];
|
|
8100
8101
|
const bytes = statSync5(`${getOpenCodeDbPath()}-wal`).size;
|
|
8101
8102
|
return Math.max(0, Math.floor((bytes - 32) / (row.page_size + 24)));
|
|
8102
8103
|
} catch {
|
|
@@ -8268,8 +8269,18 @@ function isCompactionMarkerIntentAbsent(marker, targetEndMessageId) {
|
|
|
8268
8269
|
return !db.prepare(`SELECT 1 FROM message WHERE id IN (?, ?)
|
|
8269
8270
|
UNION ALL SELECT 1 FROM part WHERE id IN (?, ?) LIMIT 1`).get(targetEndMessageId, marker.summaryMessageId, marker.compactionPartId, marker.summaryPartId);
|
|
8270
8271
|
}
|
|
8271
|
-
function withCompactionMarkerPublicationLock(operation) {
|
|
8272
|
-
|
|
8272
|
+
function withCompactionMarkerPublicationLock(operation, sessionId) {
|
|
8273
|
+
const db = getWritableOpenCodeDb();
|
|
8274
|
+
const snapshot = prepareMarkerReplacementSnapshot(db, sessionId);
|
|
8275
|
+
return runMarkerWriteTransaction(db, "compaction-marker-replace", () => {
|
|
8276
|
+
if (snapshot)
|
|
8277
|
+
activeMarkerReplacementSnapshots.set(db, snapshot);
|
|
8278
|
+
try {
|
|
8279
|
+
return operation();
|
|
8280
|
+
} finally {
|
|
8281
|
+
activeMarkerReplacementSnapshots.delete(db);
|
|
8282
|
+
}
|
|
8283
|
+
});
|
|
8273
8284
|
}
|
|
8274
8285
|
function inspectCompactionMarkerPublication(sessionId, recognized, summaryText, targetBoundaryMessageId, preferred) {
|
|
8275
8286
|
const db = getWritableOpenCodeDb();
|
|
@@ -8429,6 +8440,11 @@ function injectCompactionMarkerFromBasis(args, validatedBasis, preserveExistingL
|
|
|
8429
8440
|
summaryMessageId: summaryMsgId,
|
|
8430
8441
|
compactionPartId
|
|
8431
8442
|
});
|
|
8443
|
+
const discovered = markerReplacementSnapshots.get(db)?.get(args.sessionId);
|
|
8444
|
+
if (discovered && !discovered.partIds.includes(compactionPartId))
|
|
8445
|
+
discovered.partIds.push(compactionPartId);
|
|
8446
|
+
if (discovered && !discovered.messageIds.includes(summaryMsgId))
|
|
8447
|
+
discovered.messageIds.push(summaryMsgId);
|
|
8432
8448
|
db.prepare(`INSERT INTO part (id, message_id, session_id, time_created, time_updated, data)
|
|
8433
8449
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
8434
8450
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -8470,6 +8486,100 @@ function injectCompactionMarkerFromBasis(args, validatedBasis, preserveExistingL
|
|
|
8470
8486
|
|
|
8471
8487
|
class MarkerCandidateUnavailableError extends Error {
|
|
8472
8488
|
}
|
|
8489
|
+
var activeMarkerReplacementSnapshots = new WeakMap;
|
|
8490
|
+
var markerReplacementSnapshots = new WeakMap;
|
|
8491
|
+
var MARKER_TAIL_REFERENCE_COLUMNS = `id,
|
|
8492
|
+
CASE WHEN data LIKE '%tail_start_id%' THEN json_extract(data, '$.tail_start_id') END AS direct,
|
|
8493
|
+
CASE WHEN data LIKE '%tail_start_id%' THEN json_extract(data, '$.compaction.tail_start_id') END AS nested`;
|
|
8494
|
+
function readMarkerReferenceRows(db, sessionId, table, highestId) {
|
|
8495
|
+
return db.prepare(`SELECT ${MARKER_TAIL_REFERENCE_COLUMNS} FROM ${table}
|
|
8496
|
+
WHERE ${highestId === undefined ? "session_id = ?" : "id > ? AND +session_id = ?"}
|
|
8497
|
+
AND ${table === "part" ? "data LIKE '%compaction%' AND json_valid(data) AND json_extract(data, '$.type') = 'compaction'" : "(data LIKE '%compaction%' OR data LIKE '%tail_start_id%') AND json_valid(data) AND (json_type(data, '$.compaction') IS NOT NULL OR json_type(data, '$.tail_start_id') IS NOT NULL)"}`).all(...highestId === undefined ? [sessionId] : [highestId, sessionId]);
|
|
8498
|
+
}
|
|
8499
|
+
function readKnownMarkerReferenceRows(db, sessionId, table, ids) {
|
|
8500
|
+
const byId = db.prepare(`SELECT ${MARKER_TAIL_REFERENCE_COLUMNS} FROM ${table} WHERE id = ? AND session_id = ?`);
|
|
8501
|
+
return ids.flatMap((id) => byId.all(id, sessionId));
|
|
8502
|
+
}
|
|
8503
|
+
function prepareMarkerReplacementSnapshot(db, sessionId) {
|
|
8504
|
+
const sessions = markerReplacementSnapshots.get(db) ?? new Map;
|
|
8505
|
+
markerReplacementSnapshots.set(db, sessions);
|
|
8506
|
+
if (db.inTransaction) {
|
|
8507
|
+
sessions.delete(sessionId);
|
|
8508
|
+
return;
|
|
8509
|
+
}
|
|
8510
|
+
try {
|
|
8511
|
+
if (cachedSnapshotDb?.writer !== db) {
|
|
8512
|
+
if (cachedSnapshotDb)
|
|
8513
|
+
closeQuietly(cachedSnapshotDb.db);
|
|
8514
|
+
const reader = new Database2(getOpenCodeDbPath(), {
|
|
8515
|
+
readonly: true,
|
|
8516
|
+
fileMustExist: true
|
|
8517
|
+
});
|
|
8518
|
+
reader.exec(`PRAGMA busy_timeout=${MARKER_BUSY_TIMEOUT_MS}`);
|
|
8519
|
+
cachedSnapshotDb = { writer: db, db: reader };
|
|
8520
|
+
}
|
|
8521
|
+
const reader = cachedSnapshotDb.db;
|
|
8522
|
+
reader.exec("BEGIN");
|
|
8523
|
+
let snapshot;
|
|
8524
|
+
try {
|
|
8525
|
+
const basis = readMarkerCandidateBasis2(db, sessionId, reader);
|
|
8526
|
+
if (!basis) {
|
|
8527
|
+
sessions.delete(sessionId);
|
|
8528
|
+
return;
|
|
8529
|
+
}
|
|
8530
|
+
const previous = sessions.get(sessionId);
|
|
8531
|
+
const highestId = (table) => reader.prepare(`SELECT id FROM ${table} ORDER BY id DESC LIMIT 1`).all()[0]?.id ?? "";
|
|
8532
|
+
const discover = (table, ids, highest) => previous ? [
|
|
8533
|
+
...new Map([
|
|
8534
|
+
...readKnownMarkerReferenceRows(reader, sessionId, table, ids),
|
|
8535
|
+
...readMarkerReferenceRows(reader, sessionId, table, highest)
|
|
8536
|
+
].map((row) => [row.id, row])).values()
|
|
8537
|
+
] : readMarkerReferenceRows(reader, sessionId, table);
|
|
8538
|
+
const parts = discover("part", previous?.partIds ?? [], previous?.highestPartId ?? "");
|
|
8539
|
+
const messages = discover("message", previous?.messageIds ?? [], previous?.highestMessageId ?? "");
|
|
8540
|
+
snapshot = {
|
|
8541
|
+
sessionId,
|
|
8542
|
+
basis,
|
|
8543
|
+
partIds: parts.map((row) => row.id),
|
|
8544
|
+
messageIds: messages.map((row) => row.id),
|
|
8545
|
+
highestPartId: highestId("part"),
|
|
8546
|
+
highestMessageId: highestId("message"),
|
|
8547
|
+
references: [...parts, ...messages]
|
|
8548
|
+
};
|
|
8549
|
+
} finally {
|
|
8550
|
+
reader.exec("ROLLBACK");
|
|
8551
|
+
}
|
|
8552
|
+
sessions.set(sessionId, snapshot);
|
|
8553
|
+
return snapshot;
|
|
8554
|
+
} catch (error) {
|
|
8555
|
+
markerReplacementSnapshots.delete(db);
|
|
8556
|
+
if (cachedSnapshotDb?.writer === db) {
|
|
8557
|
+
closeQuietly(cachedSnapshotDb.db);
|
|
8558
|
+
cachedSnapshotDb = null;
|
|
8559
|
+
}
|
|
8560
|
+
throw error;
|
|
8561
|
+
}
|
|
8562
|
+
}
|
|
8563
|
+
function markerRowsAreReferenced(db, snapshot, existing) {
|
|
8564
|
+
const deleted = new Set([
|
|
8565
|
+
existing.summaryMessageId,
|
|
8566
|
+
existing.summaryPartId,
|
|
8567
|
+
existing.compactionPartId
|
|
8568
|
+
]);
|
|
8569
|
+
const referencesDeleted = (row) => !deleted.has(row.id) && [row.direct, row.nested].some((id) => typeof id === "string" && deleted.has(id));
|
|
8570
|
+
if (snapshot.references.some(referencesDeleted))
|
|
8571
|
+
throw new Error("a surviving tail_start_id references a recorded marker row; marker unchanged");
|
|
8572
|
+
for (const [table, ids, highestId] of [
|
|
8573
|
+
["part", snapshot.partIds, snapshot.highestPartId],
|
|
8574
|
+
["message", snapshot.messageIds, snapshot.highestMessageId]
|
|
8575
|
+
]) {
|
|
8576
|
+
if (readKnownMarkerReferenceRows(db, snapshot.sessionId, table, ids).some(referencesDeleted))
|
|
8577
|
+
return true;
|
|
8578
|
+
if (readMarkerReferenceRows(db, snapshot.sessionId, table, highestId).some(referencesDeleted))
|
|
8579
|
+
return true;
|
|
8580
|
+
}
|
|
8581
|
+
return false;
|
|
8582
|
+
}
|
|
8473
8583
|
function replaceCompactionMarker(existing, args, preserveExistingLineages = false) {
|
|
8474
8584
|
let connection;
|
|
8475
8585
|
let entered = false;
|
|
@@ -8477,32 +8587,21 @@ function replaceCompactionMarker(existing, args, preserveExistingLineages = fals
|
|
|
8477
8587
|
try {
|
|
8478
8588
|
const db = getWritableOpenCodeDb();
|
|
8479
8589
|
connection = db;
|
|
8480
|
-
const
|
|
8481
|
-
if (!
|
|
8590
|
+
const snapshot = activeMarkerReplacementSnapshots.get(db) ?? prepareMarkerReplacementSnapshot(db, args.sessionId);
|
|
8591
|
+
if (!snapshot || snapshot.sessionId !== args.sessionId) {
|
|
8482
8592
|
return {
|
|
8483
8593
|
kind: "deferred",
|
|
8484
8594
|
error: new Error("marker candidate preparation pending; marker unchanged")
|
|
8485
8595
|
};
|
|
8486
8596
|
}
|
|
8597
|
+
const { basis } = snapshot;
|
|
8487
8598
|
const marker = runMarkerWriteTransaction(db, "compaction-marker-replace", () => {
|
|
8488
8599
|
entered = true;
|
|
8489
8600
|
if (!isMarkerCandidateBasisCurrent2(db, basis))
|
|
8490
8601
|
throw new MarkerCandidateUnavailableError("host store changed after marker candidate preparation; marker unchanged");
|
|
8491
8602
|
if (existing) {
|
|
8492
|
-
|
|
8493
|
-
|
|
8494
|
-
AND id NOT IN (SELECT id FROM deleted)
|
|
8495
|
-
AND json_extract(data, '$.type') = 'compaction'
|
|
8496
|
-
UNION ALL
|
|
8497
|
-
SELECT data FROM message WHERE session_id = ?
|
|
8498
|
-
AND id NOT IN (SELECT id FROM deleted)
|
|
8499
|
-
)
|
|
8500
|
-
SELECT 1 FROM surviving
|
|
8501
|
-
WHERE json_extract(data, '$.tail_start_id') IN (SELECT id FROM deleted)
|
|
8502
|
-
OR json_extract(data, '$.compaction.tail_start_id') IN (SELECT id FROM deleted)
|
|
8503
|
-
LIMIT 1`).get(existing.summaryMessageId, existing.summaryPartId, existing.compactionPartId, args.sessionId, args.sessionId);
|
|
8504
|
-
if (referenced)
|
|
8505
|
-
throw new Error("a surviving tail_start_id references a recorded marker row; marker unchanged");
|
|
8603
|
+
if (markerRowsAreReferenced(db, snapshot, existing))
|
|
8604
|
+
throw new MarkerCandidateUnavailableError("a surviving tail_start_id references a recorded marker row; marker unchanged");
|
|
8506
8605
|
db.prepare("DELETE FROM part WHERE id = ?").run(existing.summaryPartId);
|
|
8507
8606
|
db.prepare("DELETE FROM message WHERE id = ?").run(existing.summaryMessageId);
|
|
8508
8607
|
db.prepare("DELETE FROM part WHERE id = ?").run(existing.compactionPartId);
|
|
@@ -8878,7 +8977,7 @@ function publishRecoverableCompactionMarker(db, args, targetIsCurrent) {
|
|
|
8878
8977
|
if (replacement.kind !== "committed")
|
|
8879
8978
|
cut = replacement.kind === "uncertain" ? "uncertain" : "definitely-no-cut";
|
|
8880
8979
|
return replacement;
|
|
8881
|
-
});
|
|
8980
|
+
}, sessionId);
|
|
8882
8981
|
if (result.kind === "committed") {
|
|
8883
8982
|
if (!intended)
|
|
8884
8983
|
throw new Error("committed marker has no publication intent");
|
package/dist/index.js
CHANGED
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
checkCompactionMarkerConsistency,
|
|
85
85
|
clearInjectionCache,
|
|
86
86
|
clearNoteNudgeTriggerOnly
|
|
87
|
-
} from "./index-
|
|
87
|
+
} from "./index-q9gamh8e.js";
|
|
88
88
|
import"./index-sd3egckz.js";
|
|
89
89
|
import {
|
|
90
90
|
hasTrustedAbsoluteWall,
|
|
@@ -171,7 +171,7 @@ import {
|
|
|
171
171
|
parameterDescriptionsFor,
|
|
172
172
|
MagicContextRpcServer,
|
|
173
173
|
applyHiddenSubagentTemperature
|
|
174
|
-
} from "./index-
|
|
174
|
+
} from "./index-216tae7b.js";
|
|
175
175
|
import {
|
|
176
176
|
resolveOpenCodeDbPath,
|
|
177
177
|
openCodeDbPathExists,
|
|
@@ -311,7 +311,7 @@ import"./index-4dhv7mqz.js";
|
|
|
311
311
|
import"./index-ty4vhe4n.js";
|
|
312
312
|
import"./index-jjvbk92s.js";
|
|
313
313
|
import"./index-xnm0wq1r.js";
|
|
314
|
-
import"./index-
|
|
314
|
+
import"./index-3w1pbn85.js";
|
|
315
315
|
import {
|
|
316
316
|
createTagger,
|
|
317
317
|
cavemanWordRulesForLanguage,
|
|
@@ -319,13 +319,13 @@ import {
|
|
|
319
319
|
clearToolPermissionDenied,
|
|
320
320
|
collectForeignTextParts,
|
|
321
321
|
resetDegradedCacheCount2
|
|
322
|
-
} from "./index-
|
|
322
|
+
} from "./index-bgxpadsx.js";
|
|
323
323
|
import {
|
|
324
324
|
scheduleClearAndReindex
|
|
325
325
|
} from "./index-hb76vdmm.js";
|
|
326
326
|
import {
|
|
327
327
|
runManagedRecomp2
|
|
328
|
-
} from "./index-
|
|
328
|
+
} from "./index-aed5qpyv.js";
|
|
329
329
|
import {
|
|
330
330
|
isValidSemver,
|
|
331
331
|
compareSemverCore
|
|
@@ -333,7 +333,7 @@ import {
|
|
|
333
333
|
import"./index-fmsr7v69.js";
|
|
334
334
|
import {
|
|
335
335
|
runManagedWrapup2
|
|
336
|
-
} from "./index-
|
|
336
|
+
} from "./index-j8gv6ajw.js";
|
|
337
337
|
import"./index-j105mf16.js";
|
|
338
338
|
import"./index-kaqs6h31.js";
|
|
339
339
|
import"./index-z7etaphs.js";
|
|
@@ -8205,7 +8205,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
8205
8205
|
// package.json
|
|
8206
8206
|
var package_default = {
|
|
8207
8207
|
name: "@cortexkit/opencode-magic-context",
|
|
8208
|
-
version: "0.49.
|
|
8208
|
+
version: "0.49.41",
|
|
8209
8209
|
type: "module",
|
|
8210
8210
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
8211
8211
|
main: "dist/index.js",
|
|
@@ -12059,7 +12059,7 @@ async function setup(context) {
|
|
|
12059
12059
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
12060
12060
|
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.`);
|
|
12061
12061
|
}
|
|
12062
|
-
const { registerContext } = await import("./context-
|
|
12062
|
+
const { registerContext } = await import("./context-3szg46w6.js");
|
|
12063
12063
|
setHarness2("opencode2");
|
|
12064
12064
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
12065
12065
|
const duties = await registerContext(context);
|
|
@@ -12532,7 +12532,7 @@ var server = async (ctx) => {
|
|
|
12532
12532
|
rustReplayParticipant: () => magicContextRuntime.magicContext?.getRustReplayParticipant?.() ?? null,
|
|
12533
12533
|
onStorageBusyRefusal: async (sessionId, message) => {
|
|
12534
12534
|
const { sendStatusNotification } = await importPluginModule(() => import("./send-session-notification-14p3yje4.js"));
|
|
12535
|
-
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-
|
|
12535
|
+
const { abortSessionFailClosed } = await importPluginModule(() => import("./transform-postprocess-phase-6fpgz12m.js"));
|
|
12536
12536
|
await sendStatusNotification(ctx.client, sessionId, message, {
|
|
12537
12537
|
toastDurationMs: 15000
|
|
12538
12538
|
});
|
|
@@ -7,9 +7,9 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
10
|
+
} from "./index-aed5qpyv.js";
|
|
11
|
+
import"./index-q9gamh8e.js";
|
|
12
|
+
import"./index-3w1pbn85.js";
|
|
13
13
|
import"./index-sd3egckz.js";
|
|
14
14
|
import"./index-xnm0wq1r.js";
|
|
15
15
|
import"./index-ty4vhe4n.js";
|
package/dist/{transform-postprocess-phase-61f7t9xq.js → transform-postprocess-phase-6fpgz12m.js}
RENAMED
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
finalizeMessageRepresentation2,
|
|
20
20
|
runPostTransformPhase2,
|
|
21
21
|
checkM0MutationDriftAndSignal2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-bgxpadsx.js";
|
|
23
23
|
import"./index-hb76vdmm.js";
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-
|
|
24
|
+
import"./index-q9gamh8e.js";
|
|
25
|
+
import"./index-3w1pbn85.js";
|
|
26
26
|
import"./index-sd3egckz.js";
|
|
27
27
|
import"./index-xnm0wq1r.js";
|
|
28
28
|
import"./index-ty4vhe4n.js";
|
|
@@ -7,7 +7,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
7
7
|
port.postMessage({ kind: "accepted" });
|
|
8
8
|
const [{ Database }, { scanMarkerCandidateSnapshot }] = await Promise.all([
|
|
9
9
|
import("./sqlite-zdgm52sv.js"),
|
|
10
|
-
import("./compaction-marker-candidates-
|
|
10
|
+
import("./compaction-marker-candidates-jy65jt49.js")
|
|
11
11
|
]);
|
|
12
12
|
let db;
|
|
13
13
|
let reply;
|
|
@@ -209,7 +209,7 @@ import {
|
|
|
209
209
|
startCompartmentAgent,
|
|
210
210
|
setRecompStarting2,
|
|
211
211
|
setRecompTerminal2
|
|
212
|
-
} from "./server-
|
|
212
|
+
} from "./server-hewk7z3z.js";
|
|
213
213
|
import {
|
|
214
214
|
resolveHistorianModel2
|
|
215
215
|
} from "./server-5kym00ag.js";
|
|
@@ -833,7 +833,7 @@ import {
|
|
|
833
833
|
resolveHistorianProducerLimits2,
|
|
834
834
|
resolveHistorianContextLimit2
|
|
835
835
|
} from "./server-sd8hvzte.js";
|
|
836
|
-
import"./server-
|
|
836
|
+
import"./server-dwpgzm0t.js";
|
|
837
837
|
import {
|
|
838
838
|
isEmbeddingHostBusy2
|
|
839
839
|
} from "./server-qt1qqasc.js";
|
|
@@ -24320,7 +24320,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
24320
24320
|
const db = readDatabase();
|
|
24321
24321
|
if (!db)
|
|
24322
24322
|
return { ok: false, error: "db unavailable" };
|
|
24323
|
-
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-
|
|
24323
|
+
const { runManagedRecomp } = await importPluginModule(() => import("./recomp-orchestrator-kep59sph.js"));
|
|
24324
24324
|
const { sendIgnoredMessage } = await importPluginModule(() => import("./send-session-notification-kxp47tsw.js"));
|
|
24325
24325
|
log2(`[rpc] recomp requested for session ${sessionId}`);
|
|
24326
24326
|
if (!args.client && !args.hiddenCompletionExecutor) {
|
|
@@ -24405,7 +24405,7 @@ function registerRpcHandlers(rpcServer, args) {
|
|
|
24405
24405
|
const db = readDatabase();
|
|
24406
24406
|
if (!db)
|
|
24407
24407
|
return { ok: false, error: "db unavailable" };
|
|
24408
|
-
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-
|
|
24408
|
+
const { runManagedWrapup } = await importPluginModule(() => import("./wrapup-orchestrator-1mgx1nym.js"));
|
|
24409
24409
|
const model = liveSessionState.liveModelBySession.get(sessionId);
|
|
24410
24410
|
const contextLimit = model ? resolveContextLimit(model.providerID, model.modelID, { db, sessionID: sessionId }) : 128000;
|
|
24411
24411
|
const ctx = {
|
|
@@ -7,8 +7,8 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./server-
|
|
11
|
-
import"./server-
|
|
10
|
+
} from "./server-hewk7z3z.js";
|
|
11
|
+
import"./server-dwpgzm0t.js";
|
|
12
12
|
import"./server-nq3cb7be.js";
|
|
13
13
|
import"./server-gkse1wyz.js";
|
|
14
14
|
import"./server-jjvbk92s.js";
|
|
@@ -43,7 +43,7 @@ function isMarkerCandidateBasisCurrent2(db, basis) {
|
|
|
43
43
|
if (basis.connection !== db || ownWriteRevisions.get(basis.revisionKey) !== basis.ownWriteRevision)
|
|
44
44
|
return false;
|
|
45
45
|
try {
|
|
46
|
-
const current = db.prepare(MARKER_CERTIFICATION_SQL).
|
|
46
|
+
const current = db.prepare(MARKER_CERTIFICATION_SQL).all(basis.frontier?.id ?? null, basis.frontier?.rowid ?? 0, basis.sessionId)[0];
|
|
47
47
|
if (current.newSummary || basis.frontier && (current.previousRowid !== basis.frontier.rowid || current.newestRowid === null || current.newestRowid < basis.frontier.rowid))
|
|
48
48
|
return false;
|
|
49
49
|
if (current.newestRowid !== null && (!Number.isSafeInteger(current.newestRowid) || current.newestId === null))
|
|
@@ -64,10 +64,15 @@ function invalidateMarkerCandidateBasis2(db, sessionId) {
|
|
|
64
64
|
if (revision !== undefined)
|
|
65
65
|
ownWriteRevisions.set(key, revision + 1);
|
|
66
66
|
}
|
|
67
|
-
function readMarkerCandidateBasis2(db, sessionId) {
|
|
67
|
+
function readMarkerCandidateBasis2(db, sessionId, readConnection = db) {
|
|
68
68
|
const basis = candidates.get(db)?.get(sessionId);
|
|
69
|
-
if (basis
|
|
70
|
-
|
|
69
|
+
if (basis) {
|
|
70
|
+
const snapshot = readConnection === db ? basis : { ...basis, connection: readConnection };
|
|
71
|
+
if (isMarkerCandidateBasisCurrent2(readConnection, snapshot)) {
|
|
72
|
+
basis.frontier = snapshot.frontier;
|
|
73
|
+
return readConnection === db ? basis : { ...snapshot, connection: db };
|
|
74
|
+
}
|
|
75
|
+
}
|
|
71
76
|
candidates.get(db)?.delete(sessionId);
|
|
72
77
|
return;
|
|
73
78
|
}
|
|
@@ -225,7 +225,7 @@ import {
|
|
|
225
225
|
invalidateMarkerCandidateBasis2,
|
|
226
226
|
readMarkerCandidateBasis2,
|
|
227
227
|
prepareMarkerCandidateBasis2
|
|
228
|
-
} from "./server-
|
|
228
|
+
} from "./server-dwpgzm0t.js";
|
|
229
229
|
import {
|
|
230
230
|
shouldSkipHomeProjectMemory,
|
|
231
231
|
resolveProjectIdentity
|
|
@@ -1350,6 +1350,7 @@ function getOpenCodeDbPath() {
|
|
|
1350
1350
|
}
|
|
1351
1351
|
var cachedWriteDb = null;
|
|
1352
1352
|
var cachedRemovalDb = null;
|
|
1353
|
+
var cachedSnapshotDb = null;
|
|
1353
1354
|
var MARKER_BUSY_TIMEOUT_MS = 250;
|
|
1354
1355
|
var MARKER_REMOVAL_BUSY_TIMEOUT_MS = 5000;
|
|
1355
1356
|
function runMarkerRemovalTransaction(db, operation) {
|
|
@@ -1383,7 +1384,7 @@ function runMarkerWriteTransaction(db, site, operation) {
|
|
|
1383
1384
|
try {
|
|
1384
1385
|
log2(`[magic-context] sqlite writer site=${site} db=opencode acquire_ms=${Math.round(acquireMs)} hold_ms=${Math.round(holdMs)} work_ms=${Math.round(workMs)} end_ms=${Math.round(endMs)} outcome=${acquiredAt === undefined ? "not_acquired" : committed ? "committed" : "failed"}`);
|
|
1385
1386
|
if (finishedAt - startedAt > 100) {
|
|
1386
|
-
const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").
|
|
1387
|
+
const autoCheckpoint = db.prepare("PRAGMA wal_autocheckpoint").all()[0];
|
|
1387
1388
|
log2(`[magic-context] compaction-marker slow writer site=${site} acquire_ms=${acquireMs.toFixed(1)} statements_ms=${workMs.toFixed(1)} ${committed ? "commit" : "rollback"}_ms=${endMs.toFixed(1)} wal_autocheckpoint=${autoCheckpoint.wal_autocheckpoint} wal_pages_before=${walBefore ?? "unknown"} wal_pages_after=${markerWalPages(db) ?? "unknown"}`);
|
|
1388
1389
|
}
|
|
1389
1390
|
} catch {}
|
|
@@ -1391,7 +1392,7 @@ function runMarkerWriteTransaction(db, site, operation) {
|
|
|
1391
1392
|
}
|
|
1392
1393
|
function markerWalPages(db) {
|
|
1393
1394
|
try {
|
|
1394
|
-
const row = db.prepare("PRAGMA page_size").
|
|
1395
|
+
const row = db.prepare("PRAGMA page_size").all()[0];
|
|
1395
1396
|
const bytes = statSync2(`${getOpenCodeDbPath()}-wal`).size;
|
|
1396
1397
|
return Math.max(0, Math.floor((bytes - 32) / (row.page_size + 24)));
|
|
1397
1398
|
} catch {
|
|
@@ -1563,8 +1564,18 @@ function isCompactionMarkerIntentAbsent(marker, targetEndMessageId) {
|
|
|
1563
1564
|
return !db.prepare(`SELECT 1 FROM message WHERE id IN (?, ?)
|
|
1564
1565
|
UNION ALL SELECT 1 FROM part WHERE id IN (?, ?) LIMIT 1`).get(targetEndMessageId, marker.summaryMessageId, marker.compactionPartId, marker.summaryPartId);
|
|
1565
1566
|
}
|
|
1566
|
-
function withCompactionMarkerPublicationLock(operation) {
|
|
1567
|
-
|
|
1567
|
+
function withCompactionMarkerPublicationLock(operation, sessionId) {
|
|
1568
|
+
const db = getWritableOpenCodeDb();
|
|
1569
|
+
const snapshot = prepareMarkerReplacementSnapshot(db, sessionId);
|
|
1570
|
+
return runMarkerWriteTransaction(db, "compaction-marker-replace", () => {
|
|
1571
|
+
if (snapshot)
|
|
1572
|
+
activeMarkerReplacementSnapshots.set(db, snapshot);
|
|
1573
|
+
try {
|
|
1574
|
+
return operation();
|
|
1575
|
+
} finally {
|
|
1576
|
+
activeMarkerReplacementSnapshots.delete(db);
|
|
1577
|
+
}
|
|
1578
|
+
});
|
|
1568
1579
|
}
|
|
1569
1580
|
function inspectCompactionMarkerPublication(sessionId, recognized, summaryText, targetBoundaryMessageId, preferred) {
|
|
1570
1581
|
const db = getWritableOpenCodeDb();
|
|
@@ -1724,6 +1735,11 @@ function injectCompactionMarkerFromBasis(args, validatedBasis, preserveExistingL
|
|
|
1724
1735
|
summaryMessageId: summaryMsgId,
|
|
1725
1736
|
compactionPartId
|
|
1726
1737
|
});
|
|
1738
|
+
const discovered = markerReplacementSnapshots.get(db)?.get(args.sessionId);
|
|
1739
|
+
if (discovered && !discovered.partIds.includes(compactionPartId))
|
|
1740
|
+
discovered.partIds.push(compactionPartId);
|
|
1741
|
+
if (discovered && !discovered.messageIds.includes(summaryMsgId))
|
|
1742
|
+
discovered.messageIds.push(summaryMsgId);
|
|
1727
1743
|
db.prepare(`INSERT INTO part (id, message_id, session_id, time_created, time_updated, data)
|
|
1728
1744
|
VALUES (?, ?, ?, ?, ?, ?)
|
|
1729
1745
|
ON CONFLICT(id) DO UPDATE SET
|
|
@@ -1765,6 +1781,100 @@ function injectCompactionMarkerFromBasis(args, validatedBasis, preserveExistingL
|
|
|
1765
1781
|
|
|
1766
1782
|
class MarkerCandidateUnavailableError extends Error {
|
|
1767
1783
|
}
|
|
1784
|
+
var activeMarkerReplacementSnapshots = new WeakMap;
|
|
1785
|
+
var markerReplacementSnapshots = new WeakMap;
|
|
1786
|
+
var MARKER_TAIL_REFERENCE_COLUMNS = `id,
|
|
1787
|
+
CASE WHEN data LIKE '%tail_start_id%' THEN json_extract(data, '$.tail_start_id') END AS direct,
|
|
1788
|
+
CASE WHEN data LIKE '%tail_start_id%' THEN json_extract(data, '$.compaction.tail_start_id') END AS nested`;
|
|
1789
|
+
function readMarkerReferenceRows(db, sessionId, table, highestId) {
|
|
1790
|
+
return db.prepare(`SELECT ${MARKER_TAIL_REFERENCE_COLUMNS} FROM ${table}
|
|
1791
|
+
WHERE ${highestId === undefined ? "session_id = ?" : "id > ? AND +session_id = ?"}
|
|
1792
|
+
AND ${table === "part" ? "data LIKE '%compaction%' AND json_valid(data) AND json_extract(data, '$.type') = 'compaction'" : "(data LIKE '%compaction%' OR data LIKE '%tail_start_id%') AND json_valid(data) AND (json_type(data, '$.compaction') IS NOT NULL OR json_type(data, '$.tail_start_id') IS NOT NULL)"}`).all(...highestId === undefined ? [sessionId] : [highestId, sessionId]);
|
|
1793
|
+
}
|
|
1794
|
+
function readKnownMarkerReferenceRows(db, sessionId, table, ids) {
|
|
1795
|
+
const byId = db.prepare(`SELECT ${MARKER_TAIL_REFERENCE_COLUMNS} FROM ${table} WHERE id = ? AND session_id = ?`);
|
|
1796
|
+
return ids.flatMap((id) => byId.all(id, sessionId));
|
|
1797
|
+
}
|
|
1798
|
+
function prepareMarkerReplacementSnapshot(db, sessionId) {
|
|
1799
|
+
const sessions = markerReplacementSnapshots.get(db) ?? new Map;
|
|
1800
|
+
markerReplacementSnapshots.set(db, sessions);
|
|
1801
|
+
if (db.inTransaction) {
|
|
1802
|
+
sessions.delete(sessionId);
|
|
1803
|
+
return;
|
|
1804
|
+
}
|
|
1805
|
+
try {
|
|
1806
|
+
if (cachedSnapshotDb?.writer !== db) {
|
|
1807
|
+
if (cachedSnapshotDb)
|
|
1808
|
+
closeQuietly(cachedSnapshotDb.db);
|
|
1809
|
+
const reader = new Database2(getOpenCodeDbPath(), {
|
|
1810
|
+
readonly: true,
|
|
1811
|
+
fileMustExist: true
|
|
1812
|
+
});
|
|
1813
|
+
reader.exec(`PRAGMA busy_timeout=${MARKER_BUSY_TIMEOUT_MS}`);
|
|
1814
|
+
cachedSnapshotDb = { writer: db, db: reader };
|
|
1815
|
+
}
|
|
1816
|
+
const reader = cachedSnapshotDb.db;
|
|
1817
|
+
reader.exec("BEGIN");
|
|
1818
|
+
let snapshot;
|
|
1819
|
+
try {
|
|
1820
|
+
const basis = readMarkerCandidateBasis2(db, sessionId, reader);
|
|
1821
|
+
if (!basis) {
|
|
1822
|
+
sessions.delete(sessionId);
|
|
1823
|
+
return;
|
|
1824
|
+
}
|
|
1825
|
+
const previous = sessions.get(sessionId);
|
|
1826
|
+
const highestId = (table) => reader.prepare(`SELECT id FROM ${table} ORDER BY id DESC LIMIT 1`).all()[0]?.id ?? "";
|
|
1827
|
+
const discover = (table, ids, highest) => previous ? [
|
|
1828
|
+
...new Map([
|
|
1829
|
+
...readKnownMarkerReferenceRows(reader, sessionId, table, ids),
|
|
1830
|
+
...readMarkerReferenceRows(reader, sessionId, table, highest)
|
|
1831
|
+
].map((row) => [row.id, row])).values()
|
|
1832
|
+
] : readMarkerReferenceRows(reader, sessionId, table);
|
|
1833
|
+
const parts = discover("part", previous?.partIds ?? [], previous?.highestPartId ?? "");
|
|
1834
|
+
const messages = discover("message", previous?.messageIds ?? [], previous?.highestMessageId ?? "");
|
|
1835
|
+
snapshot = {
|
|
1836
|
+
sessionId,
|
|
1837
|
+
basis,
|
|
1838
|
+
partIds: parts.map((row) => row.id),
|
|
1839
|
+
messageIds: messages.map((row) => row.id),
|
|
1840
|
+
highestPartId: highestId("part"),
|
|
1841
|
+
highestMessageId: highestId("message"),
|
|
1842
|
+
references: [...parts, ...messages]
|
|
1843
|
+
};
|
|
1844
|
+
} finally {
|
|
1845
|
+
reader.exec("ROLLBACK");
|
|
1846
|
+
}
|
|
1847
|
+
sessions.set(sessionId, snapshot);
|
|
1848
|
+
return snapshot;
|
|
1849
|
+
} catch (error) {
|
|
1850
|
+
markerReplacementSnapshots.delete(db);
|
|
1851
|
+
if (cachedSnapshotDb?.writer === db) {
|
|
1852
|
+
closeQuietly(cachedSnapshotDb.db);
|
|
1853
|
+
cachedSnapshotDb = null;
|
|
1854
|
+
}
|
|
1855
|
+
throw error;
|
|
1856
|
+
}
|
|
1857
|
+
}
|
|
1858
|
+
function markerRowsAreReferenced(db, snapshot, existing) {
|
|
1859
|
+
const deleted = new Set([
|
|
1860
|
+
existing.summaryMessageId,
|
|
1861
|
+
existing.summaryPartId,
|
|
1862
|
+
existing.compactionPartId
|
|
1863
|
+
]);
|
|
1864
|
+
const referencesDeleted = (row) => !deleted.has(row.id) && [row.direct, row.nested].some((id) => typeof id === "string" && deleted.has(id));
|
|
1865
|
+
if (snapshot.references.some(referencesDeleted))
|
|
1866
|
+
throw new Error("a surviving tail_start_id references a recorded marker row; marker unchanged");
|
|
1867
|
+
for (const [table, ids, highestId] of [
|
|
1868
|
+
["part", snapshot.partIds, snapshot.highestPartId],
|
|
1869
|
+
["message", snapshot.messageIds, snapshot.highestMessageId]
|
|
1870
|
+
]) {
|
|
1871
|
+
if (readKnownMarkerReferenceRows(db, snapshot.sessionId, table, ids).some(referencesDeleted))
|
|
1872
|
+
return true;
|
|
1873
|
+
if (readMarkerReferenceRows(db, snapshot.sessionId, table, highestId).some(referencesDeleted))
|
|
1874
|
+
return true;
|
|
1875
|
+
}
|
|
1876
|
+
return false;
|
|
1877
|
+
}
|
|
1768
1878
|
function replaceCompactionMarker(existing, args, preserveExistingLineages = false) {
|
|
1769
1879
|
let connection;
|
|
1770
1880
|
let entered = false;
|
|
@@ -1772,32 +1882,21 @@ function replaceCompactionMarker(existing, args, preserveExistingLineages = fals
|
|
|
1772
1882
|
try {
|
|
1773
1883
|
const db = getWritableOpenCodeDb();
|
|
1774
1884
|
connection = db;
|
|
1775
|
-
const
|
|
1776
|
-
if (!
|
|
1885
|
+
const snapshot = activeMarkerReplacementSnapshots.get(db) ?? prepareMarkerReplacementSnapshot(db, args.sessionId);
|
|
1886
|
+
if (!snapshot || snapshot.sessionId !== args.sessionId) {
|
|
1777
1887
|
return {
|
|
1778
1888
|
kind: "deferred",
|
|
1779
1889
|
error: new Error("marker candidate preparation pending; marker unchanged")
|
|
1780
1890
|
};
|
|
1781
1891
|
}
|
|
1892
|
+
const { basis } = snapshot;
|
|
1782
1893
|
const marker = runMarkerWriteTransaction(db, "compaction-marker-replace", () => {
|
|
1783
1894
|
entered = true;
|
|
1784
1895
|
if (!isMarkerCandidateBasisCurrent2(db, basis))
|
|
1785
1896
|
throw new MarkerCandidateUnavailableError("host store changed after marker candidate preparation; marker unchanged");
|
|
1786
1897
|
if (existing) {
|
|
1787
|
-
|
|
1788
|
-
|
|
1789
|
-
AND id NOT IN (SELECT id FROM deleted)
|
|
1790
|
-
AND json_extract(data, '$.type') = 'compaction'
|
|
1791
|
-
UNION ALL
|
|
1792
|
-
SELECT data FROM message WHERE session_id = ?
|
|
1793
|
-
AND id NOT IN (SELECT id FROM deleted)
|
|
1794
|
-
)
|
|
1795
|
-
SELECT 1 FROM surviving
|
|
1796
|
-
WHERE json_extract(data, '$.tail_start_id') IN (SELECT id FROM deleted)
|
|
1797
|
-
OR json_extract(data, '$.compaction.tail_start_id') IN (SELECT id FROM deleted)
|
|
1798
|
-
LIMIT 1`).get(existing.summaryMessageId, existing.summaryPartId, existing.compactionPartId, args.sessionId, args.sessionId);
|
|
1799
|
-
if (referenced)
|
|
1800
|
-
throw new Error("a surviving tail_start_id references a recorded marker row; marker unchanged");
|
|
1898
|
+
if (markerRowsAreReferenced(db, snapshot, existing))
|
|
1899
|
+
throw new MarkerCandidateUnavailableError("a surviving tail_start_id references a recorded marker row; marker unchanged");
|
|
1801
1900
|
db.prepare("DELETE FROM part WHERE id = ?").run(existing.summaryPartId);
|
|
1802
1901
|
db.prepare("DELETE FROM message WHERE id = ?").run(existing.summaryMessageId);
|
|
1803
1902
|
db.prepare("DELETE FROM part WHERE id = ?").run(existing.compactionPartId);
|
|
@@ -4487,7 +4586,7 @@ function publishRecoverableCompactionMarker(db, args, targetIsCurrent) {
|
|
|
4487
4586
|
if (replacement.kind !== "committed")
|
|
4488
4587
|
cut = replacement.kind === "uncertain" ? "uncertain" : "definitely-no-cut";
|
|
4489
4588
|
return replacement;
|
|
4490
|
-
});
|
|
4589
|
+
}, sessionId);
|
|
4491
4590
|
if (result.kind === "committed") {
|
|
4492
4591
|
if (!intended)
|
|
4493
4592
|
throw new Error("committed marker has no publication intent");
|
package/dist/v2/server.js
CHANGED
|
@@ -7875,7 +7875,7 @@ var require_src2 = __commonJS(function(exports, module) {
|
|
|
7875
7875
|
// package.json
|
|
7876
7876
|
var package_default = {
|
|
7877
7877
|
name: "@cortexkit/opencode-magic-context",
|
|
7878
|
-
version: "0.49.
|
|
7878
|
+
version: "0.49.41",
|
|
7879
7879
|
type: "module",
|
|
7880
7880
|
description: "OpenCode plugin for Magic Context — cross-session memory and context management",
|
|
7881
7881
|
main: "dist/index.js",
|
|
@@ -8196,7 +8196,7 @@ async function setup(context) {
|
|
|
8196
8196
|
if (claimStorageBackupWarningCheck() && isMagicContextStorageOutsideEngram(storageDir)) {
|
|
8197
8197
|
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.`);
|
|
8198
8198
|
}
|
|
8199
|
-
const { registerContext } = await import("./context-
|
|
8199
|
+
const { registerContext } = await import("./context-eq5bhf40.js");
|
|
8200
8200
|
setHarness2("opencode2");
|
|
8201
8201
|
bindStaleBuildNotice({}, import.meta.url, "opencode2");
|
|
8202
8202
|
const duties = await registerContext(context);
|
|
@@ -52,7 +52,7 @@ import"./server-ypf1ap0v.js";
|
|
|
52
52
|
import {
|
|
53
53
|
pushNotification2
|
|
54
54
|
} from "./server-x8a7jmkh.js";
|
|
55
|
-
import"./server-
|
|
55
|
+
import"./server-dwpgzm0t.js";
|
|
56
56
|
import {
|
|
57
57
|
describeBoundaryDiagnostics,
|
|
58
58
|
resolveWrapupProtectedTailBoundary,
|
|
@@ -63,7 +63,7 @@ import {
|
|
|
63
63
|
registerActiveCompartmentRun,
|
|
64
64
|
setRecompStarting2,
|
|
65
65
|
setRecompTerminal2
|
|
66
|
-
} from "./server-
|
|
66
|
+
} from "./server-hewk7z3z.js";
|
|
67
67
|
import"./server-qt1qqasc.js";
|
|
68
68
|
import"./server-7acq7815.js";
|
|
69
69
|
import"./server-dcws5831.js";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
runManagedWrapup2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
5
|
-
import"./index-
|
|
6
|
-
import"./index-
|
|
3
|
+
} from "./index-j8gv6ajw.js";
|
|
4
|
+
import"./index-aed5qpyv.js";
|
|
5
|
+
import"./index-q9gamh8e.js";
|
|
6
|
+
import"./index-3w1pbn85.js";
|
|
7
7
|
import"./index-sd3egckz.js";
|
|
8
8
|
import"./index-xnm0wq1r.js";
|
|
9
9
|
import"./index-ty4vhe4n.js";
|
package/package.json
CHANGED