@cortexkit/opencode-magic-context 0.49.40 → 0.49.42
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 +1 -1
- package/dist/chunk-embedding-write-worker.js +1 -1
- 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-zf1yj1g0.js} +168 -48
- 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/hooks/magic-context/host-served-rows.d.ts +17 -0
- package/dist/hooks/magic-context/host-served-rows.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts +2 -0
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/transform-postprocess-phase.d.ts +2 -0
- package/dist/hooks/magic-context/transform-postprocess-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-wk7x13qv.js → index-1zv08avf.js} +4 -4
- package/dist/{index-4y35msh5.js → index-29gd1zcx.js} +1 -1
- package/dist/{index-850vthn3.js → index-3w1pbn85.js} +9 -4
- package/dist/{index-m8v7nqgp.js → index-5m2azs6v.js} +3 -3
- package/dist/{index-gfd41hm4.js → index-adt3jghq.js} +16 -15
- package/dist/{index-hf771sk4.js → index-ayk4we2k.js} +11 -5
- package/dist/{index-j5qma52p.js → index-fas76dft.js} +2 -2
- package/dist/{index-9z4d2ha0.js → index-gsqz39wk.js} +1 -1
- package/dist/{index-9fgmkfaf.js → index-kfsqk1q7.js} +1 -1
- package/dist/{index-z7etaphs.js → index-n8bsqg7b.js} +4 -4
- package/dist/{index-hb76vdmm.js → index-p2e7j9p1.js} +1 -1
- package/dist/{index-72czy45z.js → index-rdx17j04.js} +36 -8
- package/dist/{v2/server-z9zygwse.js → index-s9x93tfs.js} +32 -1
- package/dist/{index-j105mf16.js → index-xjw9rres.js} +1 -1
- package/dist/{index-tr6vcwt0.js → index-xmqj3cf5.js} +126 -27
- package/dist/{index-ryz4pdvf.js → index-z6v8086q.js} +2 -2
- package/dist/{index-tn9drm1a.js → index-zqsp3z0d.js} +1 -1
- package/dist/index.js +18 -18
- package/dist/{message-index-bounded-jqm3ezva.js → message-index-bounded-5mj8p6nq.js} +2 -2
- package/dist/migration-worker.js +1 -1
- package/dist/raw-ordinal-warmup-worker.js +3 -3
- package/dist/{read-session-chunk-26yrrhyz.js → read-session-chunk-k70bhfjm.js} +1 -1
- package/dist/{recomp-orchestrator-34mh19vm.js → recomp-orchestrator-2q4rmerf.js} +7 -7
- package/dist/{render-gqdq6t7f.js → render-36fvvwz6.js} +5 -5
- package/dist/{search-vqkmmy9c.js → search-6v2na3af.js} +4 -4
- package/dist/{search-archive-kfwpk73t.js → search-archive-jwb2ctnq.js} +3 -3
- package/dist/{store-s3eykdjt.js → store-pd1e9hnr.js} +1 -1
- package/dist/{transform-postprocess-phase-61f7t9xq.js → transform-postprocess-phase-0ms3ga4h.js} +8 -8
- package/dist/v2/auto-search-worker.js +1 -1
- package/dist/v2/chunk-embedding-write-worker.js +1 -1
- 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-2xr6vbt2.js} +176 -51
- package/dist/v2/fold/code-mode-catalog.d.ts +10 -0
- package/dist/v2/fold/code-mode-catalog.d.ts.map +1 -1
- package/dist/v2/fold/instruction-supersession.d.ts +9 -0
- package/dist/v2/fold/instruction-supersession.d.ts.map +1 -0
- package/dist/v2/fold/native-replay.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/payload.d.ts +2 -1
- package/dist/v2/hooks/payload.d.ts.map +1 -1
- package/dist/v2/{message-index-bounded-dgd8a2x1.js → message-index-bounded-5341qsqd.js} +2 -2
- package/dist/v2/migration-worker.js +1 -1
- package/dist/v2/raw-ordinal-warmup-worker.js +3 -3
- package/dist/v2/{read-session-chunk-tqnh1ret.js → read-session-chunk-dgmq3ntm.js} +1 -1
- package/dist/v2/{recomp-orchestrator-x0r6sy3a.js → recomp-orchestrator-2vmyhtst.js} +6 -6
- package/dist/v2/{render-yyv8nv4p.js → render-kz0f40ws.js} +5 -5
- package/dist/v2/{search-cb1kdgqw.js → search-a9hwy1sw.js} +3 -3
- package/dist/v2/{search-archive-gagdnrb3.js → search-archive-wajxd01m.js} +3 -3
- package/dist/v2/{server-g3gqq4ac.js → server-09td1wgc.js} +1 -1
- package/dist/v2/{server-dt9b00ja.js → server-3m7p4g9w.js} +1 -1
- package/dist/v2/{server-405ap0b0.js → server-5ydn39x3.js} +126 -27
- package/dist/v2/{server-t8y64xj7.js → server-7qc9tk6z.js} +36 -8
- package/dist/v2/{server-r4mmc670.js → server-dqs8e4yt.js} +1 -1
- package/dist/v2/{server-r4430x9m.js → server-dwpgzm0t.js} +9 -4
- package/dist/v2/{server-jd7vzwn4.js → server-kqrpt2ht.js} +1 -1
- package/dist/v2/{server-qjyp27vf.js → server-p78wdf43.js} +1 -1
- package/dist/v2/{server-2d01821b.js → server-qehn6btp.js} +2 -2
- package/dist/{index-z9zygwse.js → v2/server-s9x93tfs.js} +32 -1
- package/dist/v2/{server-2tp6y1qs.js → server-sfcp13bn.js} +4 -4
- package/dist/v2/{server-6emy0v9a.js → server-ymn9w46x.js} +1 -1
- package/dist/v2/server.js +2 -2
- package/dist/v2/{store-z3qe67cg.js → store-pebs9m52.js} +1 -1
- package/dist/v2/{v2-archive-reader-2rv5dz7k.js → v2-archive-reader-ag6sk771.js} +1 -1
- package/dist/v2/{wrapup-orchestrator-f8w3kcjf.js → wrapup-orchestrator-2a077zew.js} +6 -6
- package/dist/{v2-archive-reader-4hz9pnmy.js → v2-archive-reader-chk95syc.js} +1 -1
- package/dist/{wrapup-orchestrator-7dxwer1p.js → wrapup-orchestrator-rhs675kj.js} +8 -8
- package/package.json +1 -1
|
@@ -72,7 +72,7 @@ import {
|
|
|
72
72
|
getRawSessionTagKeysThrough2,
|
|
73
73
|
getLegacyProtectedTailStartOrdinal2,
|
|
74
74
|
readSessionChunk2
|
|
75
|
-
} from "./index-
|
|
75
|
+
} from "./index-zqsp3z0d.js";
|
|
76
76
|
import {
|
|
77
77
|
getHarness2,
|
|
78
78
|
harnessOwnsOpenCodeStore2
|
|
@@ -153,7 +153,7 @@ import {
|
|
|
153
153
|
LATEST_SUPPORTED_VERSION,
|
|
154
154
|
getPersistedSchemaVersion,
|
|
155
155
|
openDatabase
|
|
156
|
-
} from "./index-
|
|
156
|
+
} from "./index-kfsqk1q7.js";
|
|
157
157
|
import {
|
|
158
158
|
areRustHistorianSyntheticParts2,
|
|
159
159
|
isStrictGapHealingMessage2,
|
|
@@ -239,14 +239,14 @@ import {
|
|
|
239
239
|
getProjectState,
|
|
240
240
|
recordSubagentInvocation,
|
|
241
241
|
getLatestHistorianInvocationId
|
|
242
|
-
} from "./index-
|
|
242
|
+
} from "./index-rdx17j04.js";
|
|
243
243
|
import {
|
|
244
244
|
clearCompressionDepth,
|
|
245
245
|
clearCompressionDepthRange,
|
|
246
246
|
toMessageIndexSource,
|
|
247
247
|
clearIndexedMessagesInTransaction,
|
|
248
248
|
indexSourcesAfterOrdinal
|
|
249
|
-
} from "./index-
|
|
249
|
+
} from "./index-gsqz39wk.js";
|
|
250
250
|
import {
|
|
251
251
|
stripWellFormedLeadingTagPrefix,
|
|
252
252
|
peelLeadingMcTagNotation,
|
|
@@ -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";
|
|
@@ -310,7 +310,7 @@ import {
|
|
|
310
310
|
snapTerminalCompartmentToServedRow,
|
|
311
311
|
isHostRenderedSystemMessage,
|
|
312
312
|
markCoveredInstructionRow
|
|
313
|
-
} from "./index-
|
|
313
|
+
} from "./index-s9x93tfs.js";
|
|
314
314
|
import {
|
|
315
315
|
piModelRefToCanonical
|
|
316
316
|
} from "./index-avwt563y.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");
|
|
@@ -19,10 +19,10 @@ import {
|
|
|
19
19
|
rawMessageWorkerSource2,
|
|
20
20
|
rawMessageOffThreadRangeReader2,
|
|
21
21
|
readRawSessionMessageIdOrdinalsForRange2
|
|
22
|
-
} from "./index-
|
|
22
|
+
} from "./index-zqsp3z0d.js";
|
|
23
23
|
import {
|
|
24
24
|
readV2ArchiveOffThread2
|
|
25
|
-
} from "./index-
|
|
25
|
+
} from "./index-n8bsqg7b.js";
|
|
26
26
|
|
|
27
27
|
// src/tools/ctx-expand/search-archive.ts
|
|
28
28
|
var archiveReadsOnThisThread = 0;
|
package/dist/index.js
CHANGED
|
@@ -28,7 +28,7 @@ import {
|
|
|
28
28
|
detectOverflow,
|
|
29
29
|
isAnthropicFamilyRoute,
|
|
30
30
|
readRawSessionMessages2
|
|
31
|
-
} from "./index-
|
|
31
|
+
} from "./index-zqsp3z0d.js";
|
|
32
32
|
import {
|
|
33
33
|
setHarness2
|
|
34
34
|
} from "./index-pavzsdc6.js";
|
|
@@ -84,7 +84,7 @@ import {
|
|
|
84
84
|
checkCompactionMarkerConsistency,
|
|
85
85
|
clearInjectionCache,
|
|
86
86
|
clearNoteNudgeTriggerOnly
|
|
87
|
-
} from "./index-
|
|
87
|
+
} from "./index-xmqj3cf5.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-adt3jghq.js";
|
|
175
175
|
import {
|
|
176
176
|
resolveOpenCodeDbPath,
|
|
177
177
|
openCodeDbPathExists,
|
|
@@ -219,7 +219,7 @@ import {
|
|
|
219
219
|
createDbLkgPersistence,
|
|
220
220
|
registerLkgPersistence,
|
|
221
221
|
dropSlot
|
|
222
|
-
} from "./index-
|
|
222
|
+
} from "./index-rdx17j04.js";
|
|
223
223
|
import {
|
|
224
224
|
recordSessionProjectIdentity
|
|
225
225
|
} from "./index-jz5bk7xd.js";
|
|
@@ -234,7 +234,7 @@ import {
|
|
|
234
234
|
openDatabaseAsync,
|
|
235
235
|
isDatabasePersisted,
|
|
236
236
|
getDatabasePersistenceError
|
|
237
|
-
} from "./index-
|
|
237
|
+
} from "./index-kfsqk1q7.js";
|
|
238
238
|
import {
|
|
239
239
|
registerExitAbort,
|
|
240
240
|
unregisterExitAbort
|
|
@@ -259,7 +259,7 @@ import"./index-g4t7850m.js";
|
|
|
259
259
|
import {
|
|
260
260
|
getDefaultSubcConnectionFile,
|
|
261
261
|
SubcModuleTransport
|
|
262
|
-
} from "./index-
|
|
262
|
+
} from "./index-fas76dft.js";
|
|
263
263
|
import"./index-qt1qqasc.js";
|
|
264
264
|
import"./index-fw42ms3m.js";
|
|
265
265
|
import {
|
|
@@ -297,7 +297,7 @@ import {
|
|
|
297
297
|
import"./index-dcjkw41m.js";
|
|
298
298
|
import {
|
|
299
299
|
deleteIndexedMessage
|
|
300
|
-
} from "./index-
|
|
300
|
+
} from "./index-gsqz39wk.js";
|
|
301
301
|
import"./index-66a50f3e.js";
|
|
302
302
|
import"./index-2qbtqg1w.js";
|
|
303
303
|
import {
|
|
@@ -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-ayk4we2k.js";
|
|
323
323
|
import {
|
|
324
324
|
scheduleClearAndReindex
|
|
325
|
-
} from "./index-
|
|
325
|
+
} from "./index-p2e7j9p1.js";
|
|
326
326
|
import {
|
|
327
327
|
runManagedRecomp2
|
|
328
|
-
} from "./index-
|
|
328
|
+
} from "./index-5m2azs6v.js";
|
|
329
329
|
import {
|
|
330
330
|
isValidSemver,
|
|
331
331
|
compareSemverCore
|
|
@@ -333,11 +333,11 @@ import {
|
|
|
333
333
|
import"./index-fmsr7v69.js";
|
|
334
334
|
import {
|
|
335
335
|
runManagedWrapup2
|
|
336
|
-
} from "./index-
|
|
337
|
-
import"./index-
|
|
336
|
+
} from "./index-1zv08avf.js";
|
|
337
|
+
import"./index-xjw9rres.js";
|
|
338
338
|
import"./index-kaqs6h31.js";
|
|
339
|
-
import"./index-
|
|
340
|
-
import"./index-
|
|
339
|
+
import"./index-n8bsqg7b.js";
|
|
340
|
+
import"./index-z6v8086q.js";
|
|
341
341
|
import {
|
|
342
342
|
isDreamerRunnable,
|
|
343
343
|
isSmartNoteSurfaceAvailable,
|
|
@@ -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.42",
|
|
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-zf1yj1g0.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-0ms3ga4h.js"));
|
|
12536
12536
|
await sendStatusNotification(ctx.client, sessionId, message, {
|
|
12537
12537
|
toastDurationMs: 15000
|
|
12538
12538
|
});
|
|
@@ -18,7 +18,7 @@ import"./index-1d042x6w.js";
|
|
|
18
18
|
import"./index-r2epb000.js";
|
|
19
19
|
import"./index-58e3y90n.js";
|
|
20
20
|
import"./index-vd2ywmfe.js";
|
|
21
|
-
import"./index-
|
|
21
|
+
import"./index-zqsp3z0d.js";
|
|
22
22
|
import"./index-jkanybgq.js";
|
|
23
23
|
import {
|
|
24
24
|
MESSAGE_INDEX_MAX_FTS_BYTES,
|
|
@@ -27,7 +27,7 @@ import {
|
|
|
27
27
|
markMessageIndexDirty,
|
|
28
28
|
getIndexableContent,
|
|
29
29
|
indexSingleMessage
|
|
30
|
-
} from "./index-
|
|
30
|
+
} from "./index-gsqz39wk.js";
|
|
31
31
|
import"./index-b1ydbp95.js";
|
|
32
32
|
import"./index-fxbk7gk3.js";
|
|
33
33
|
|
package/dist/migration-worker.js
CHANGED
|
@@ -19,7 +19,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
19
19
|
await main();
|
|
20
20
|
async function main() {
|
|
21
21
|
if (input.v2ArchiveReader) {
|
|
22
|
-
const { serveV2ArchiveReads } = await import("./v2-archive-reader-
|
|
22
|
+
const { serveV2ArchiveReads } = await import("./v2-archive-reader-chk95syc.js");
|
|
23
23
|
await serveV2ArchiveReads(port, openConnections);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
@@ -51,7 +51,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
51
51
|
await runMessageFtsRowidMapBackfill(db);
|
|
52
52
|
reply = { kind: "fts-rowid-backfill" };
|
|
53
53
|
} else if (input.searchArchive) {
|
|
54
|
-
const { renderSearchArchive } = await import("./search-archive-
|
|
54
|
+
const { renderSearchArchive } = await import("./search-archive-jwb2ctnq.js");
|
|
55
55
|
const { readRawSessionMessageIdOrdinalsForRangeFromDb } = await import("./read-session-raw-j7c9w57v.js");
|
|
56
56
|
const archive = input.searchArchive;
|
|
57
57
|
let raw;
|
|
@@ -81,7 +81,7 @@ serveWorkerJobs(async (input, port) => {
|
|
|
81
81
|
const { setHarness } = await import("./harness-e4avh192.js");
|
|
82
82
|
setHarness(input.harness ?? "opencode");
|
|
83
83
|
const [{ indexMessageInShortChunks }, { configureContextDatabasePragmas }] = await Promise.all([
|
|
84
|
-
import("./message-index-bounded-
|
|
84
|
+
import("./message-index-bounded-5mj8p6nq.js"),
|
|
85
85
|
import("./sqlite-context-pragmas-mv9jqwjh.js")
|
|
86
86
|
]);
|
|
87
87
|
configureContextDatabasePragmas(db);
|
|
@@ -7,24 +7,24 @@ import {
|
|
|
7
7
|
setRecompTerminal2,
|
|
8
8
|
buildRecompDeps2,
|
|
9
9
|
runManagedRecomp2
|
|
10
|
-
} from "./index-
|
|
11
|
-
import"./index-
|
|
12
|
-
import"./index-
|
|
10
|
+
} from "./index-5m2azs6v.js";
|
|
11
|
+
import"./index-xmqj3cf5.js";
|
|
12
|
+
import"./index-3w1pbn85.js";
|
|
13
13
|
import"./index-sd3egckz.js";
|
|
14
14
|
import"./index-xnm0wq1r.js";
|
|
15
15
|
import"./index-ty4vhe4n.js";
|
|
16
16
|
import"./index-jjvbk92s.js";
|
|
17
17
|
import"./index-21fgrfrf.js";
|
|
18
18
|
import"./index-4dhv7mqz.js";
|
|
19
|
-
import"./index-
|
|
19
|
+
import"./index-rdx17j04.js";
|
|
20
20
|
import"./index-2qbtqg1w.js";
|
|
21
|
-
import"./index-
|
|
21
|
+
import"./index-gsqz39wk.js";
|
|
22
22
|
import"./index-2amn2s73.js";
|
|
23
23
|
import"./index-66a50f3e.js";
|
|
24
24
|
import"./index-dnqqqc5f.js";
|
|
25
25
|
import"./index-ae1ar4v1.js";
|
|
26
26
|
import"./index-qt1qqasc.js";
|
|
27
|
-
import"./index-
|
|
27
|
+
import"./index-zqsp3z0d.js";
|
|
28
28
|
import"./index-8jjjmhab.js";
|
|
29
29
|
import"./index-1zx87sdm.js";
|
|
30
30
|
import"./index-vd2ywmfe.js";
|
|
@@ -35,7 +35,7 @@ import"./index-c5dzns43.js";
|
|
|
35
35
|
import"./index-jz5bk7xd.js";
|
|
36
36
|
import"./index-dcjkw41m.js";
|
|
37
37
|
import"./index-g4t7850m.js";
|
|
38
|
-
import"./index-
|
|
38
|
+
import"./index-kfsqk1q7.js";
|
|
39
39
|
import"./index-fb3zxn06.js";
|
|
40
40
|
import"./index-nj360hcs.js";
|
|
41
41
|
import"./index-fr0wbhdn.js";
|
|
@@ -2,20 +2,20 @@ import {
|
|
|
2
2
|
renderMessageByOrdinal2,
|
|
3
3
|
renderVerboseRangeForTool2,
|
|
4
4
|
renderItemByTag2
|
|
5
|
-
} from "./index-
|
|
6
|
-
import"./index-
|
|
5
|
+
} from "./index-xjw9rres.js";
|
|
6
|
+
import"./index-rdx17j04.js";
|
|
7
7
|
import"./index-2qbtqg1w.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-gsqz39wk.js";
|
|
9
9
|
import"./index-2amn2s73.js";
|
|
10
10
|
import"./index-66a50f3e.js";
|
|
11
|
-
import"./index-
|
|
11
|
+
import"./index-zqsp3z0d.js";
|
|
12
12
|
import"./index-8jjjmhab.js";
|
|
13
13
|
import"./index-1zx87sdm.js";
|
|
14
14
|
import"./index-vd2ywmfe.js";
|
|
15
15
|
import"./index-c5dzns43.js";
|
|
16
16
|
import"./index-dcjkw41m.js";
|
|
17
17
|
import"./index-g4t7850m.js";
|
|
18
|
-
import"./index-
|
|
18
|
+
import"./index-kfsqk1q7.js";
|
|
19
19
|
import"./index-fb3zxn06.js";
|
|
20
20
|
import"./index-nj360hcs.js";
|
|
21
21
|
import"./index-fr0wbhdn.js";
|
|
@@ -5,8 +5,8 @@ import {
|
|
|
5
5
|
resolveMemoriesByIdsForSearch2,
|
|
6
6
|
unifiedSearch2,
|
|
7
7
|
formatSearchResults2
|
|
8
|
-
} from "./index-
|
|
9
|
-
import"./index-
|
|
8
|
+
} from "./index-fas76dft.js";
|
|
9
|
+
import"./index-p2e7j9p1.js";
|
|
10
10
|
import"./index-kaqs6h31.js";
|
|
11
11
|
import"./index-xnm0wq1r.js";
|
|
12
12
|
import"./index-ty4vhe4n.js";
|
|
@@ -14,10 +14,10 @@ import"./index-jjvbk92s.js";
|
|
|
14
14
|
import"./index-21fgrfrf.js";
|
|
15
15
|
import"./index-4dhv7mqz.js";
|
|
16
16
|
import"./index-2qbtqg1w.js";
|
|
17
|
-
import"./index-
|
|
17
|
+
import"./index-gsqz39wk.js";
|
|
18
18
|
import"./index-2amn2s73.js";
|
|
19
19
|
import"./index-qt1qqasc.js";
|
|
20
|
-
import"./index-
|
|
20
|
+
import"./index-zqsp3z0d.js";
|
|
21
21
|
import"./index-8jjjmhab.js";
|
|
22
22
|
import"./index-1zx87sdm.js";
|
|
23
23
|
import"./index-vd2ywmfe.js";
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
renderSearchArchive2,
|
|
3
3
|
renderSearchArchiveOffThread2
|
|
4
|
-
} from "./index-
|
|
5
|
-
import"./index-
|
|
4
|
+
} from "./index-z6v8086q.js";
|
|
5
|
+
import"./index-n8bsqg7b.js";
|
|
6
6
|
import"./index-kaqs6h31.js";
|
|
7
|
-
import"./index-
|
|
7
|
+
import"./index-zqsp3z0d.js";
|
|
8
8
|
import"./index-8jjjmhab.js";
|
|
9
9
|
import"./index-1zx87sdm.js";
|
|
10
10
|
import"./index-vd2ywmfe.js";
|
package/dist/{transform-postprocess-phase-61f7t9xq.js → transform-postprocess-phase-0ms3ga4h.js}
RENAMED
|
@@ -19,25 +19,25 @@ import {
|
|
|
19
19
|
finalizeMessageRepresentation2,
|
|
20
20
|
runPostTransformPhase2,
|
|
21
21
|
checkM0MutationDriftAndSignal2
|
|
22
|
-
} from "./index-
|
|
23
|
-
import"./index-
|
|
24
|
-
import"./index-
|
|
25
|
-
import"./index-
|
|
22
|
+
} from "./index-ayk4we2k.js";
|
|
23
|
+
import"./index-p2e7j9p1.js";
|
|
24
|
+
import"./index-xmqj3cf5.js";
|
|
25
|
+
import"./index-3w1pbn85.js";
|
|
26
26
|
import"./index-sd3egckz.js";
|
|
27
27
|
import"./index-xnm0wq1r.js";
|
|
28
28
|
import"./index-ty4vhe4n.js";
|
|
29
29
|
import"./index-jjvbk92s.js";
|
|
30
30
|
import"./index-21fgrfrf.js";
|
|
31
31
|
import"./index-4dhv7mqz.js";
|
|
32
|
-
import"./index-
|
|
32
|
+
import"./index-rdx17j04.js";
|
|
33
33
|
import"./index-2qbtqg1w.js";
|
|
34
|
-
import"./index-
|
|
34
|
+
import"./index-gsqz39wk.js";
|
|
35
35
|
import"./index-2amn2s73.js";
|
|
36
36
|
import"./index-66a50f3e.js";
|
|
37
37
|
import"./index-dnqqqc5f.js";
|
|
38
38
|
import"./index-ae1ar4v1.js";
|
|
39
39
|
import"./index-qt1qqasc.js";
|
|
40
|
-
import"./index-
|
|
40
|
+
import"./index-zqsp3z0d.js";
|
|
41
41
|
import"./index-8jjjmhab.js";
|
|
42
42
|
import"./index-1zx87sdm.js";
|
|
43
43
|
import"./index-vd2ywmfe.js";
|
|
@@ -48,7 +48,7 @@ import"./index-c5dzns43.js";
|
|
|
48
48
|
import"./index-jz5bk7xd.js";
|
|
49
49
|
import"./index-dcjkw41m.js";
|
|
50
50
|
import"./index-g4t7850m.js";
|
|
51
|
-
import"./index-
|
|
51
|
+
import"./index-kfsqk1q7.js";
|
|
52
52
|
import"./index-fb3zxn06.js";
|
|
53
53
|
import"./index-nj360hcs.js";
|
|
54
54
|
import"./index-fr0wbhdn.js";
|
|
@@ -31,7 +31,7 @@ serveWorkerJobs(async (initial, port) => {
|
|
|
31
31
|
import("./embedding-cache-mgyr73ef.js"),
|
|
32
32
|
import("./storage-memory-e6a7mb0k.js"),
|
|
33
33
|
import("./project-embedding-registry-jqq2qeqb.js"),
|
|
34
|
-
import("./search-
|
|
34
|
+
import("./search-a9hwy1sw.js"),
|
|
35
35
|
import("./compartment-chunk-embedding-qfk791bd.js"),
|
|
36
36
|
import("./embedding-activity-g1dhes6g.js"),
|
|
37
37
|
import("./harness-e4avh192.js"),
|