@cortexkit/pi-magic-context 0.49.81 → 0.49.83
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 +4 -4
- package/dist/{embedding-backfill-arvg2p6f.js → embedding-backfill-yh10bmx5.js} +4 -4
- package/dist/{index-0bmsfzqf.js → index-3g1wy4z9.js} +2 -2
- package/dist/{index-pz85rpzf.js → index-47g3pgzk.js} +10 -5
- package/dist/{index-q1yc6bs0.js → index-7thk2cwt.js} +15 -4
- package/dist/{index-gavj3e6h.js → index-e0zdn1p3.js} +1 -1
- package/dist/{index-79xfn84y.js → index-gdy08gn6.js} +1 -1
- package/dist/{index-453s1hj6.js → index-hna2sxy8.js} +1 -1
- package/dist/{index-5tkveh4p.js → index-k8xz22jc.js} +1 -1
- package/dist/{index-k7a8x7ba.js → index-nmmge3j6.js} +1 -1
- package/dist/{index-nvh6d3bz.js → index-qky62xze.js} +34 -2
- package/dist/{index-6crdakkm.js → index-qz43gkqe.js} +31 -12
- package/dist/{index-hnvq96j6.js → index-wtqv3vha.js} +4 -4
- package/dist/{index-0th11rhf.js → index-xz5b9t4g.js} +2 -2
- package/dist/{index-5009ew3c.js → index-y573dt51.js} +21 -20
- package/dist/index.js +372 -217
- package/dist/migration-worker.js +3 -3
- package/dist/{project-embedding-registry-zgzq9ehw.js → project-embedding-registry-3sss39rx.js} +3 -3
- package/dist/raw-ordinal-warmup-worker.js +2 -2
- package/dist/{render-fhrce5g6.js → render-9xgp0jka.js} +6 -6
- package/dist/{rpc-notifications-gm1mdpwh.js → rpc-notifications-889zvhn2.js} +3 -1
- package/dist/{search-archive-661vc3fb.js → search-archive-wr38qtkw.js} +1 -1
- package/dist/{search-vw6ps2me.js → search-dh4ryftv.js} +7 -7
- package/dist/{store-reader-mmfw2h48.js → store-reader-8j41p18c.js} +1 -1
- package/dist/{store-e9ve3qzt.js → store-xg9ez6jn.js} +1 -1
- package/dist/subagent-entry.js +12 -12
- package/dist/tag-snapshot-worker-pi.js +3 -3
- package/dist/{v2-archive-reader-zndhp4c4.js → v2-archive-reader-8m9mw6sv.js} +1 -1
- package/package.json +1 -1
|
@@ -27,11 +27,11 @@ serveWorkerJobs(async (initial, port) => {
|
|
|
27
27
|
{ Database, registerSqliteDiagnosticSink },
|
|
28
28
|
{ log }
|
|
29
29
|
] = await Promise.all([
|
|
30
|
-
import("./embedding-backfill-
|
|
30
|
+
import("./embedding-backfill-yh10bmx5.js"),
|
|
31
31
|
import("./embedding-cache-7rp4gqzr.js"),
|
|
32
32
|
import("./storage-memory-0ndn65fm.js"),
|
|
33
|
-
import("./project-embedding-registry-
|
|
34
|
-
import("./search-
|
|
33
|
+
import("./project-embedding-registry-3sss39rx.js"),
|
|
34
|
+
import("./search-dh4ryftv.js"),
|
|
35
35
|
import("./compartment-chunk-embedding-avkyp2df.js"),
|
|
36
36
|
import("./embedding-activity-ew6dshfd.js"),
|
|
37
37
|
import("./harness-9872e0ym.js"),
|
|
@@ -30,14 +30,14 @@ import {
|
|
|
30
30
|
acquireGitSweepLease,
|
|
31
31
|
renewGitSweepLease,
|
|
32
32
|
releaseGitSweepLease
|
|
33
|
-
} from "./index-
|
|
34
|
-
import"./index-
|
|
33
|
+
} from "./index-gdy08gn6.js";
|
|
34
|
+
import"./index-hna2sxy8.js";
|
|
35
35
|
import {
|
|
36
36
|
LATEST_SUPPORTED_VERSION,
|
|
37
37
|
enforceSchemaFence
|
|
38
|
-
} from "./index-
|
|
38
|
+
} from "./index-xz5b9t4g.js";
|
|
39
39
|
import"./index-3bb24eb6.js";
|
|
40
|
-
import"./index-
|
|
40
|
+
import"./index-e0zdn1p3.js";
|
|
41
41
|
import"./index-jhmz9tgv.js";
|
|
42
42
|
import"./index-135e8hvg.js";
|
|
43
43
|
import"./index-n0zjvs3h.js";
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ensureMemoryEmbeddings2
|
|
3
|
-
} from "./index-
|
|
4
|
-
import"./index-
|
|
3
|
+
} from "./index-k8xz22jc.js";
|
|
4
|
+
import"./index-3g1wy4z9.js";
|
|
5
5
|
import"./index-9p40dgkm.js";
|
|
6
6
|
import"./index-hgd00nas.js";
|
|
7
7
|
import"./index-yhzhdp3m.js";
|
|
8
|
-
import"./index-
|
|
8
|
+
import"./index-gdy08gn6.js";
|
|
9
9
|
import"./index-cxczethe.js";
|
|
10
10
|
import"./index-txcs0vnj.js";
|
|
11
11
|
import"./index-5rcjs14a.js";
|
|
12
12
|
import"./index-vcegxfwg.js";
|
|
13
|
-
import"./index-
|
|
13
|
+
import"./index-hna2sxy8.js";
|
|
14
14
|
import"./index-ghp32f9m.js";
|
|
15
15
|
import"./index-xjhq27z9.js";
|
|
16
16
|
import"./index-wfqysrwq.js";
|
|
@@ -67,7 +67,7 @@ import {
|
|
|
67
67
|
} from "./index-hgd00nas.js";
|
|
68
68
|
import {
|
|
69
69
|
setBootQuietPeriodForTests
|
|
70
|
-
} from "./index-
|
|
70
|
+
} from "./index-hna2sxy8.js";
|
|
71
71
|
import {
|
|
72
72
|
isEmbeddingHostBusy2
|
|
73
73
|
} from "./index-9p40dgkm.js";
|
|
@@ -78,7 +78,7 @@ import {
|
|
|
78
78
|
acquireGitSweepLease,
|
|
79
79
|
renewGitSweepLease,
|
|
80
80
|
releaseGitSweepLease
|
|
81
|
-
} from "./index-
|
|
81
|
+
} from "./index-gdy08gn6.js";
|
|
82
82
|
import {
|
|
83
83
|
saveEmbeddingIfHashMatches,
|
|
84
84
|
getMemoryEmbedCoverage,
|
|
@@ -56,20 +56,20 @@ import {
|
|
|
56
56
|
getProjectEmbeddingSnapshot2,
|
|
57
57
|
embedTextForProject2,
|
|
58
58
|
embedItemsForProject2
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-3g1wy4z9.js";
|
|
60
60
|
import {
|
|
61
61
|
recordEmbeddingMeasurement
|
|
62
62
|
} from "./index-hgd00nas.js";
|
|
63
63
|
import {
|
|
64
64
|
scheduleAfterBootQuiet
|
|
65
|
-
} from "./index-
|
|
65
|
+
} from "./index-hna2sxy8.js";
|
|
66
66
|
import {
|
|
67
67
|
saveEmbeddingIfHashMatches,
|
|
68
68
|
getProjectEmbeddings2
|
|
69
69
|
} from "./index-yhzhdp3m.js";
|
|
70
70
|
import {
|
|
71
71
|
ensureMemoryEmbeddings2
|
|
72
|
-
} from "./index-
|
|
72
|
+
} from "./index-k8xz22jc.js";
|
|
73
73
|
import {
|
|
74
74
|
getMemorySelectColumns2,
|
|
75
75
|
isMemoryRow2,
|
|
@@ -108,11 +108,11 @@ import {
|
|
|
108
108
|
expandWorkspaceIdentitySetWithAliases,
|
|
109
109
|
resolveStoredPathWorkspaceIdentity,
|
|
110
110
|
sourceNameForMemory
|
|
111
|
-
} from "./index-
|
|
111
|
+
} from "./index-e0zdn1p3.js";
|
|
112
112
|
import {
|
|
113
113
|
getNotes,
|
|
114
114
|
getActivePrimers
|
|
115
|
-
} from "./index-
|
|
115
|
+
} from "./index-nmmge3j6.js";
|
|
116
116
|
import {
|
|
117
117
|
computeNormalizedHash
|
|
118
118
|
} from "./index-9x1f96r8.js";
|
|
@@ -132,6 +132,11 @@ var USER_FACING_FAILURES = {
|
|
|
132
132
|
sentence: "History compression is paused because this session's saved summaries no longer line up with its messages.",
|
|
133
133
|
action: "Run /ctx-recomp to rebuild them."
|
|
134
134
|
},
|
|
135
|
+
fork_history_gap: {
|
|
136
|
+
code: "MC-H09",
|
|
137
|
+
sentence: "This fork's saved history has a gap.",
|
|
138
|
+
action: "Run /ctx-recomp to rebuild its history."
|
|
139
|
+
},
|
|
135
140
|
history_boundary_unresolved: {
|
|
136
141
|
code: "MC-H04",
|
|
137
142
|
sentence: "This request was not sent: it is larger than the model's context window, and Magic Context could not cut the already-summarized history out of it.",
|
|
@@ -15,9 +15,20 @@ function notificationMatchesSink(notification, sink) {
|
|
|
15
15
|
return notification.sessionId === sink.sessionId;
|
|
16
16
|
return sink.protocol !== 2;
|
|
17
17
|
}
|
|
18
|
-
function
|
|
18
|
+
function pushLiveNotification2(type, payload, sessionId) {
|
|
19
19
|
const notification = { id: nextNotificationId++, type, payload, sessionId };
|
|
20
|
-
|
|
20
|
+
for (const sink of sinks) {
|
|
21
|
+
if (sink.sessionId !== sessionId)
|
|
22
|
+
continue;
|
|
23
|
+
try {
|
|
24
|
+
sink.send(notification);
|
|
25
|
+
} catch {}
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
function pushNotification2(type, payload, sessionId, options) {
|
|
29
|
+
const notification = { id: nextNotificationId++, type, payload, sessionId };
|
|
30
|
+
if (!options?.liveOnly)
|
|
31
|
+
queue.push(notification);
|
|
21
32
|
for (const sink of sinks) {
|
|
22
33
|
if (!notificationMatchesSink(notification, sink))
|
|
23
34
|
continue;
|
|
@@ -25,7 +36,7 @@ function pushNotification2(type, payload, sessionId) {
|
|
|
25
36
|
sink.send(notification);
|
|
26
37
|
} catch {}
|
|
27
38
|
}
|
|
28
|
-
if (queue.length > 100) {
|
|
39
|
+
if (!options?.liveOnly && queue.length > 100) {
|
|
29
40
|
const reservedIds = new Set;
|
|
30
41
|
const reservedScopes = new Set;
|
|
31
42
|
for (let i = queue.length - 1;i >= 0 && reservedScopes.size < 25; i -= 1) {
|
|
@@ -101,4 +112,4 @@ function isTuiConnected2(sessionId) {
|
|
|
101
112
|
return false;
|
|
102
113
|
}
|
|
103
114
|
|
|
104
|
-
export { registerNotificationSink2, pushNotification2, acknowledgeNotifications2, __resetNotificationStateForTests2, drainNotifications2, isTuiConnected2 };
|
|
115
|
+
export { registerNotificationSink2, pushLiveNotification2, pushNotification2, acknowledgeNotifications2, __resetNotificationStateForTests2, drainNotifications2, isTuiConnected2 };
|
|
@@ -696,4 +696,4 @@ function setBootQuietPeriodForTests(startAtMs) {
|
|
|
696
696
|
bootQuietUntilMs = startAtMs === null ? 0 : startAtMs + BOOT_QUIET_MS;
|
|
697
697
|
}
|
|
698
698
|
|
|
699
|
-
export { pruneMissingProjectIdentities, setHomeProjectPermission, ProjectIdentityError, resolveProjectIdentityStrict, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
|
|
699
|
+
export { pruneMissingProjectIdentities, setHomeProjectPermission, ProjectIdentityError, directoryFallback, resolveProjectIdentityStrict, isUserHomeDirectory, resolveProjectIdentity, directoryHasGitMetadata, isUsableProjectIdentity, resolveProjectIdentityForSession, normalizeStoredProjectPath, storedPathBelongsToIdentity, beginBootQuietPeriod, scheduleAfterBootQuiet, setBootQuietPeriodForTests };
|
|
@@ -439,7 +439,7 @@ class V2StoreReader2 {
|
|
|
439
439
|
const order = columns.has("time_updated") ? "time_updated DESC, id DESC" : "id DESC";
|
|
440
440
|
const page = this.prepare(`SELECT id, COALESCE(directory, '') AS directory FROM session_v2
|
|
441
441
|
WHERE parent_id IS NULL${archived}
|
|
442
|
-
AND COALESCE(json_extract(metadata, '$.magic_context'), '')
|
|
442
|
+
AND COALESCE(json_extract(metadata, '$.magic_context'), '') NOT IN ('hidden-run', 'background-holder')
|
|
443
443
|
ORDER BY ${order} LIMIT ? OFFSET ?`);
|
|
444
444
|
const pageSize = 500;
|
|
445
445
|
for (let offset = 0;; offset += pageSize) {
|
|
@@ -460,7 +460,7 @@ class V2StoreReader2 {
|
|
|
460
460
|
WHERE session_id = session_v2.id AND type = 'user'
|
|
461
461
|
) AS time FROM session_v2
|
|
462
462
|
WHERE parent_id IS NULL
|
|
463
|
-
AND COALESCE(json_extract(metadata, '$.magic_context'), '')
|
|
463
|
+
AND COALESCE(json_extract(metadata, '$.magic_context'), '') NOT IN ('hidden-run', 'background-holder')
|
|
464
464
|
AND id IN (${chunk.map(() => "?").join(",")})`).all(...chunk);
|
|
465
465
|
for (const row of rows)
|
|
466
466
|
if (row.time !== null)
|
|
@@ -746,6 +746,38 @@ class V2StoreReader2 {
|
|
|
746
746
|
return this.prepare(`SELECT id, type, seq, time_created FROM session_message
|
|
747
747
|
WHERE session_id = ? AND seq <= ? ORDER BY seq ASC`).all(sessionID, throughSeq);
|
|
748
748
|
}
|
|
749
|
+
matchingForkBodies(parentID, forkID, throughSeq) {
|
|
750
|
+
const matchParts = this.hasPartTable() ? `
|
|
751
|
+
AND NOT EXISTS (
|
|
752
|
+
SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = p.id
|
|
753
|
+
EXCEPT SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = f.id
|
|
754
|
+
) AND NOT EXISTS (
|
|
755
|
+
SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = f.id
|
|
756
|
+
EXCEPT SELECT ordinal, type, call_id, data FROM session_part WHERE message_id = p.id
|
|
757
|
+
)` : "";
|
|
758
|
+
const rows = this.prepare(`SELECT p.id AS parentId, f.id AS forkId FROM session_message p JOIN session_message f ON f.seq = p.seq
|
|
759
|
+
WHERE p.session_id = ? AND f.session_id = ? AND p.seq <= ?
|
|
760
|
+
AND p.type = f.type AND p.time_created = f.time_created AND p.data = f.data${matchParts}`).all(parentID, forkID, throughSeq);
|
|
761
|
+
return new Map(rows.map(({ parentId, forkId }) => [parentId, forkId]));
|
|
762
|
+
}
|
|
763
|
+
*iterateRawMessageRange(sessionID, from, to) {
|
|
764
|
+
if (!Number.isSafeInteger(from) || !Number.isSafeInteger(to) || from < 1 || to < from)
|
|
765
|
+
return;
|
|
766
|
+
let anchor;
|
|
767
|
+
for (let after = from - 1;after < to; after += 1) {
|
|
768
|
+
const [row] = this.messagePage(sessionID, after, 1, to, anchor);
|
|
769
|
+
if (!row)
|
|
770
|
+
return;
|
|
771
|
+
anchor = { id: row.id, timeCreated: row.time_created ?? 0 };
|
|
772
|
+
yield row;
|
|
773
|
+
}
|
|
774
|
+
}
|
|
775
|
+
messageCountAndNewestId(sessionID) {
|
|
776
|
+
const row = this.prepare(`SELECT COUNT(*) AS count, (
|
|
777
|
+
SELECT id FROM session_message WHERE session_id = ? ORDER BY seq DESC LIMIT 1
|
|
778
|
+
) AS newestId FROM session_message WHERE session_id = ?`).get(sessionID, sessionID);
|
|
779
|
+
return [row.count, row.newestId];
|
|
780
|
+
}
|
|
749
781
|
latestSequenceForIds(sessionID, ids) {
|
|
750
782
|
let latest = -1;
|
|
751
783
|
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
@@ -61,7 +61,7 @@ import {
|
|
|
61
61
|
import {
|
|
62
62
|
isPidAlive,
|
|
63
63
|
readProcessStartTime
|
|
64
|
-
} from "./index-
|
|
64
|
+
} from "./index-xz5b9t4g.js";
|
|
65
65
|
import {
|
|
66
66
|
withReadOnlySessionDb,
|
|
67
67
|
expandToolPart,
|
|
@@ -71,7 +71,7 @@ import {
|
|
|
71
71
|
import {
|
|
72
72
|
gaDatabasePath2,
|
|
73
73
|
V2StoreReader2
|
|
74
|
-
} from "./index-
|
|
74
|
+
} from "./index-qky62xze.js";
|
|
75
75
|
import {
|
|
76
76
|
deleteUnmappedMessageFtsRows2
|
|
77
77
|
} from "./index-ghp32f9m.js";
|
|
@@ -85,7 +85,7 @@ import {
|
|
|
85
85
|
import {
|
|
86
86
|
layoutLkgPrefix,
|
|
87
87
|
assembleLkgPrefix
|
|
88
|
-
} from "./index-
|
|
88
|
+
} from "./index-e0zdn1p3.js";
|
|
89
89
|
import {
|
|
90
90
|
logSlowWriteTransaction
|
|
91
91
|
} from "./index-1ts77n1b.js";
|
|
@@ -3951,9 +3951,10 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
3951
3951
|
const compartmentColumns = db.prepare("PRAGMA table_info(compartments)").all();
|
|
3952
3952
|
const hasBlockIndices = ["start_block_index", "end_block_index"].every((name) => compartmentColumns.some((column) => column.name === name));
|
|
3953
3953
|
const blockProjection = hasBlockIndices ? "start_block_index, end_block_index" : "NULL AS start_block_index, NULL AS end_block_index";
|
|
3954
|
+
const rebaseProjection = compartmentColumns.some(({ name }) => name === "rebase_status") ? "rebase_status" : "NULL AS rebase_status";
|
|
3954
3955
|
const sourceCompartments = db.prepare(`SELECT sequence, start_message, end_message, start_message_id, end_message_id,
|
|
3955
3956
|
title, content, p1, p2, p3, p4, importance, episode_type, legacy,
|
|
3956
|
-
created_at, harness, ${blockProjection}
|
|
3957
|
+
created_at, harness, ${blockProjection}, ${rebaseProjection}
|
|
3957
3958
|
FROM compartments WHERE session_id = ? ORDER BY sequence ASC`).all(sourceSessionId);
|
|
3958
3959
|
const insertCompartment = db.prepare(`INSERT INTO compartments
|
|
3959
3960
|
(session_id, sequence, start_message, end_message, start_message_id,
|
|
@@ -3961,18 +3962,31 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
3961
3962
|
episode_type, legacy, created_at, harness${hasBlockIndices ? ", start_block_index, end_block_index" : ""})
|
|
3962
3963
|
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?${hasBlockIndices ? ", ?, ?" : ""})`);
|
|
3963
3964
|
const copiedCompartments = [];
|
|
3965
|
+
const selected = filter.selectCompartments?.(sourceCompartments.map((row) => ({
|
|
3966
|
+
sequence: row.sequence,
|
|
3967
|
+
startMessage: row.start_message,
|
|
3968
|
+
endMessage: row.end_message,
|
|
3969
|
+
startMessageId: row.start_message_id,
|
|
3970
|
+
endMessageId: row.end_message_id,
|
|
3971
|
+
rebaseStatus: row.rebase_status
|
|
3972
|
+
})));
|
|
3964
3973
|
for (const row of sourceCompartments) {
|
|
3965
|
-
const
|
|
3966
|
-
|
|
3974
|
+
const mapped = selected?.get(row.sequence);
|
|
3975
|
+
if (selected && !mapped)
|
|
3976
|
+
continue;
|
|
3977
|
+
const startMessage = mapped?.startMessage ?? filter.resolveBoundaryOrdinal(row.start_message_id);
|
|
3978
|
+
const endMessage = mapped?.endMessage ?? filter.resolveBoundaryOrdinal(row.end_message_id);
|
|
3967
3979
|
if (startMessage === undefined || endMessage === undefined)
|
|
3968
3980
|
continue;
|
|
3969
|
-
|
|
3981
|
+
const startMessageId = mapped?.startMessageId ?? mapMessageId(filter, row.start_message_id);
|
|
3982
|
+
const endMessageId = mapped?.endMessageId ?? mapMessageId(filter, row.end_message_id);
|
|
3983
|
+
insertCompartment.run(destinationSessionId, row.sequence, startMessage, endMessage, startMessageId, endMessageId, row.title, row.content, row.p1, row.p2, row.p3, row.p4, row.importance, row.episode_type, row.legacy, row.created_at, row.harness, ...hasBlockIndices ? [row.start_block_index, row.end_block_index] : []);
|
|
3970
3984
|
copiedCompartments.push({
|
|
3971
3985
|
sequence: row.sequence,
|
|
3972
3986
|
startMessage,
|
|
3973
3987
|
endMessage,
|
|
3974
|
-
startMessageId:
|
|
3975
|
-
endMessageId:
|
|
3988
|
+
startMessageId: startMessageId ?? row.start_message_id,
|
|
3989
|
+
endMessageId: endMessageId ?? row.end_message_id
|
|
3976
3990
|
});
|
|
3977
3991
|
}
|
|
3978
3992
|
const sourceTags = db.prepare(`SELECT id, message_id, type, status, byte_size, tag_number, harness,
|
|
@@ -4050,7 +4064,8 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4050
4064
|
if (pendingMarker === null)
|
|
4051
4065
|
clearedMarker = getPendingPiCompactionMarkerState(db, destinationSessionId);
|
|
4052
4066
|
const todoAnchor = meta?.todo_synthetic_anchor_message_id ?? "";
|
|
4053
|
-
const
|
|
4067
|
+
const replayFilter = filter.includeReplayMessageId ? { ...filter, includeMessageId: filter.includeReplayMessageId } : filter;
|
|
4068
|
+
const migrateTodo = todoAnchor.length > 0 && replayFilter.includeMessageId(todoAnchor);
|
|
4054
4069
|
db.prepare(`INSERT INTO session_meta
|
|
4055
4070
|
(session_id, harness, counter, cleared_reasoning_through_tag,
|
|
4056
4071
|
tool_reclaim_watermark, pi_stable_id_scheme, stripped_placeholder_ids,
|
|
@@ -4075,11 +4090,15 @@ function copySessionStateForClone(db, sourceSessionId, destinationSessionId, fil
|
|
|
4075
4090
|
todo_synthetic_anchor_message_id = excluded.todo_synthetic_anchor_message_id,
|
|
4076
4091
|
todo_synthetic_state_json = excluded.todo_synthetic_state_json,
|
|
4077
4092
|
cached_m0_bytes = NULL,
|
|
4078
|
-
cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null,
|
|
4093
|
+
cached_m1_bytes = NULL`).run(destinationSessionId, getHarness2(), maxCopiedTag, clampWatermark(meta?.cleared_reasoning_through_tag ?? null, maxCopiedTag), clampWatermark(meta?.tool_reclaim_watermark ?? null, maxCopiedTag), typeof meta?.pi_stable_id_scheme === "number" && Number.isFinite(meta.pi_stable_id_scheme) ? meta.pi_stable_id_scheme : null, filterStrippedPlaceholderBlob(meta?.stripped_placeholder_ids ?? null, replayFilter), filterIdBlob(meta?.stale_reduce_stripped_ids ?? null, replayFilter), filterProcessedImageBlob(meta?.processed_image_stripped_ids ?? null, replayFilter), clonePiContentDecisions(meta?.merged_reasoning_stripped_ids ?? null, replayFilter), pendingMarker, migrateTodo ? meta?.last_todo_state ?? "" : "", migrateTodo ? meta?.todo_synthetic_call_id ?? "" : "", migrateTodo ? mapMessageId(filter, todoAnchor) ?? "" : "", migrateTodo ? meta?.todo_synthetic_state_json ?? "" : "");
|
|
4094
|
+
const inheritedGaps = filter.inheritedCoordinateGaps?.() ?? [];
|
|
4095
|
+
if (inheritedGaps.length > 0) {
|
|
4096
|
+
db.prepare("UPDATE session_meta SET coordinate_rebase_notice = ? WHERE session_id = ?").run(JSON.stringify({ generation: "v2", inheritedGaps }), destinationSessionId);
|
|
4097
|
+
}
|
|
4079
4098
|
const metaColumnRows = db.prepare("PRAGMA table_info(session_meta)").all();
|
|
4080
4099
|
const metaColumns = new Set(metaColumnRows.map((column) => column.name));
|
|
4081
4100
|
if (metaColumns.has("trailing_blank_decisions")) {
|
|
4082
|
-
const replayDocument = cloneReplayDocument(db, sourceSessionId, copiedToolCallIds,
|
|
4101
|
+
const replayDocument = cloneReplayDocument(db, sourceSessionId, copiedToolCallIds, replayFilter);
|
|
4083
4102
|
writeReplayDocument(db, destinationSessionId, replayDocument);
|
|
4084
4103
|
}
|
|
4085
4104
|
const pendingOpsRow = db.prepare("SELECT COUNT(*) AS count FROM pending_ops WHERE session_id = ?").get(destinationSessionId);
|
|
@@ -137,11 +137,11 @@ async function serveV2ArchiveReads2(port, openConnections) {
|
|
|
137
137
|
{ createV2RecoveryAttachments }
|
|
138
138
|
] = await Promise.all([
|
|
139
139
|
import("./sqlite-v89bj0yy.js"),
|
|
140
|
-
import("./store-reader-
|
|
141
|
-
import("./store-
|
|
140
|
+
import("./store-reader-8j41p18c.js"),
|
|
141
|
+
import("./store-xg9ez6jn.js"),
|
|
142
142
|
import("./read-session-chunk-wek7gb7j.js"),
|
|
143
|
-
import("./render-
|
|
144
|
-
import("./search-archive-
|
|
143
|
+
import("./render-9xgp0jka.js"),
|
|
144
|
+
import("./search-archive-wr38qtkw.js"),
|
|
145
145
|
import("./expand-attachments-8sxeyj26.js")
|
|
146
146
|
]);
|
|
147
147
|
const pool = new V2StoreReaderPool;
|
|
@@ -24,7 +24,7 @@ import {
|
|
|
24
24
|
} from "./index-2qtx0q6h.js";
|
|
25
25
|
import {
|
|
26
26
|
scheduleAfterBootQuiet
|
|
27
|
-
} from "./index-
|
|
27
|
+
} from "./index-hna2sxy8.js";
|
|
28
28
|
import {
|
|
29
29
|
configureContextDatabasePragmas2
|
|
30
30
|
} from "./index-fapenpch.js";
|
|
@@ -46,7 +46,7 @@ import {
|
|
|
46
46
|
hasPendingMigrations,
|
|
47
47
|
getMainThreadMigrationBodyCount,
|
|
48
48
|
runMigrations
|
|
49
|
-
} from "./index-
|
|
49
|
+
} from "./index-e0zdn1p3.js";
|
|
50
50
|
import {
|
|
51
51
|
setDatabase,
|
|
52
52
|
loadToolDefinitionMeasurements,
|
|
@@ -56,7 +56,7 @@ import {
|
|
|
56
56
|
import {
|
|
57
57
|
piHarnessKindFromExecutable,
|
|
58
58
|
getErrorMessage
|
|
59
|
-
} from "./index-
|
|
59
|
+
} from "./index-xz5b9t4g.js";
|
|
60
60
|
import {
|
|
61
61
|
getOrCreateSessionMeta,
|
|
62
62
|
updateSessionMeta,
|
|
@@ -70,7 +70,7 @@ import {
|
|
|
70
70
|
renderMessageByOrdinal2,
|
|
71
71
|
renderVerboseRange2,
|
|
72
72
|
renderItemByTag2
|
|
73
|
-
} from "./index-
|
|
73
|
+
} from "./index-qz43gkqe.js";
|
|
74
74
|
import {
|
|
75
75
|
getLastIndexedOrdinal
|
|
76
76
|
} from "./index-0t9xfj3x.js";
|
|
@@ -129,20 +129,20 @@ import {
|
|
|
129
129
|
unregisterProjectEmbedding2,
|
|
130
130
|
getProjectEmbeddingSnapshot2,
|
|
131
131
|
embedTextForProject2
|
|
132
|
-
} from "./index-
|
|
132
|
+
} from "./index-3g1wy4z9.js";
|
|
133
133
|
import {
|
|
134
134
|
directoryHasGitMetadata,
|
|
135
135
|
resolveProjectIdentityForSession,
|
|
136
136
|
normalizeStoredProjectPath,
|
|
137
137
|
storedPathBelongsToIdentity
|
|
138
|
-
} from "./index-
|
|
138
|
+
} from "./index-hna2sxy8.js";
|
|
139
139
|
import {
|
|
140
140
|
createUnifiedSearchDiagnostics2,
|
|
141
141
|
parseIdShapedQuery2,
|
|
142
142
|
resolveMemoriesByIdsForSearch2,
|
|
143
143
|
unifiedSearch2,
|
|
144
144
|
formatSearchResults2
|
|
145
|
-
} from "./index-
|
|
145
|
+
} from "./index-47g3pgzk.js";
|
|
146
146
|
import {
|
|
147
147
|
resolveOpenCodeDbPath,
|
|
148
148
|
assertOpenCodeStoreGeneration
|
|
@@ -159,7 +159,7 @@ import {
|
|
|
159
159
|
resolveStoredPathWorkspaceIdentity,
|
|
160
160
|
storedPathBelongsToWorkspace,
|
|
161
161
|
sourceNameForMemory
|
|
162
|
-
} from "./index-
|
|
162
|
+
} from "./index-e0zdn1p3.js";
|
|
163
163
|
import {
|
|
164
164
|
getNoteByIdInScope,
|
|
165
165
|
getNotes,
|
|
@@ -170,7 +170,7 @@ import {
|
|
|
170
170
|
updateNote,
|
|
171
171
|
dismissNotes,
|
|
172
172
|
dismissNote
|
|
173
|
-
} from "./index-
|
|
173
|
+
} from "./index-nmmge3j6.js";
|
|
174
174
|
import {
|
|
175
175
|
isMarkerCandidateBasisCurrent2,
|
|
176
176
|
invalidateMarkerCandidateBasis2,
|
|
@@ -2928,7 +2928,7 @@ import { dirname as dirname4, isAbsolute as isAbsolute3, resolve as resolve2 } f
|
|
|
2928
2928
|
var CTX_REDUCE_LIGHT_DESCRIPTION = `Stamp an item as no longer needed for the work ahead. Not a delete: stamping QUEUES it, the item stays readable until Magic Context clears stamped items in one sweep, newest tags are protected, and a cleared item goes to the archive (recent: a [dropped §N§] placeholder; older: removed) recoverable via ctx_expand(tag=N). The question is "does this need to stay on my desk for what comes next?" — a file you keep editing stays, the grep that found it goes. Stamp used reads/searches/outputs, acted-on build/test output, redundant dumps, extracted pasted payloads; keep user messages, your own text, unresolved errors, raw evidence, exact wording that may matter. Look at each tag; never blanket-stamp "1-50". Grammar: "3-5", "1,2,9", "1-5,8,12-15".`;
|
|
2929
2929
|
var CTX_EXPAND_LIGHT_DESCRIPTION = "Recover one item with tag=N (a §N§ or dropped placeholder number), not a message ordinal; text or one tool call with full input/output. message=N and start/end are whole-message ordinals from history/search, never tag numbers. Recover raw conversation behind a <session-history> heading or around a ctx_search hit: ctx_expand(start, end) returns [N] U:/A: lines (~15K-token cap; oversized ranges return the head and where to continue). verbose=true lists messages with per-part previews to pick one; message=N returns that message in full, including a tool output released with ctx_reduce. Ranges after the last compartment are your live tail, not expandable.";
|
|
2930
2930
|
var CTX_NOTE_LIGHT_DESCRIPTION = 'Session notes are pending intentions: work you intend to return to, with findings attached ("take a note" always qualifies). Not active steps, an executing plan, or restart insurance; a record of how things stand (world-state, a design at a point in time) with nothing you intend to do about it — that goes stale silently; a fact worth keeping is memory, the rest is nothing. First line = title (<80 chars). write saves; read lists rows (note_ids for bodies); update changes one; dismiss retires 1–50. Dismiss a note when its work lands or is abandoned; a queue you never dismiss from stops being read. surface_condition parks it until an outside check against repo files, git, GitHub or the web holds.';
|
|
2931
|
-
var CTX_MEMORY_LIGHT_DESCRIPTION = "Durable facts about this project, shared with every agent
|
|
2931
|
+
var CTX_MEMORY_LIGHT_DESCRIPTION = "Durable facts about this project, shared with every agent and kept for the months this work lasts; active ones are already in <project-memory> as `#id: fact`. Write one standalone fact you must not have to find again — a rule, an architecture fact, a constraint, a config value, a naming convention — especially what cost you turns. A pending intention with evidence is ctx_note, not memory. write (content + category); update one id (content + category); archive one or more ids (reason optional); merge 2+ distinct same-category ids (content); get 1–20 ids in any status.";
|
|
2932
2932
|
var CTX_SEARCH_LIGHT_DESCRIPTION = 'Search the archive — everything that ever happened here that is not on your desk: memories not in <project-memory>, compacted conversation, commits, notes. Phrase query as a natural-language question carrying the exact terms you expect ("where is the opencode source code path?", "why did we choose SQLite over postgres?", "how does the dreamer lease work?") — a keyword stack finds less. Sources (omit for all): memory (rules, conventions), message (compacted conversation; hits carry ordinals for ctx_expand), git_commit (when did this change), primer (reusable project Q&A the dreamer distils from recurring questions), note (parked follow-ups). Memory ids alone (`#7234`) resolve directly. from/to restrict every source to an inclusive UTC date range.';
|
|
2933
2933
|
|
|
2934
2934
|
// ../plugin/src/shared/prompt-surface-runtime.ts
|
|
@@ -7971,9 +7971,9 @@ var FULL_PARAMETER_DESCRIPTIONS = {
|
|
|
7971
7971
|
},
|
|
7972
7972
|
ctx_memory: {
|
|
7973
7973
|
action: "write | update | archive | merge | get",
|
|
7974
|
-
content: "
|
|
7975
|
-
category: "
|
|
7976
|
-
ids: "
|
|
7974
|
+
content: "Send on every call — the memory text for write, update and merge; pass an empty string for archive and get.",
|
|
7975
|
+
category: "Send on every call — the fact's kind for write; on update/merge, the memory's current category to keep it; archive and get ignore it, so pass any valid category.",
|
|
7976
|
+
ids: "Send on every call — one id for update, one or more for archive, two or more distinct ids of memories in the same category for merge, 1–20 for get; write takes an empty list.",
|
|
7977
7977
|
reason: "Why it is being archived (optional)."
|
|
7978
7978
|
},
|
|
7979
7979
|
ctx_search: {
|
|
@@ -8006,9 +8006,9 @@ var LIGHT_PARAMETER_DESCRIPTIONS = {
|
|
|
8006
8006
|
},
|
|
8007
8007
|
ctx_memory: {
|
|
8008
8008
|
action: "write | update | archive | merge | get",
|
|
8009
|
-
content: "
|
|
8010
|
-
category: "
|
|
8011
|
-
ids: "
|
|
8009
|
+
content: "Send on every call: the fact (write, update, merge); empty string for archive/get.",
|
|
8010
|
+
category: "Send on every call: kind for write; current category for update/merge; any category for archive/get (ignored).",
|
|
8011
|
+
ids: "Send on every call: one id for update, 1+ for archive, 2+ distinct same-category ids for merge, 1–20 for get; write: empty list.",
|
|
8012
8012
|
reason: "Why it is archived (optional)."
|
|
8013
8013
|
},
|
|
8014
8014
|
ctx_search: {
|
|
@@ -8677,10 +8677,11 @@ Your active memories are already in <project-memory> as \`#id: fact\` lines. Wri
|
|
|
8677
8677
|
|
|
8678
8678
|
Actions:
|
|
8679
8679
|
- write: new memory (content + category).
|
|
8680
|
-
- update: rewrite one memory whose fact changed (ids: [one], content; category
|
|
8680
|
+
- update: rewrite one memory whose fact changed (ids: [one], content; category: the current one to keep, a new one to recategorize).
|
|
8681
8681
|
- archive: retire wrong or obsolete memories (ids: [one or more], optional reason).
|
|
8682
|
-
- merge: collapse duplicates into one (ids: [two or more], content).
|
|
8682
|
+
- merge: collapse duplicates into one (ids: [two or more distinct ids of memories in the same category], content).
|
|
8683
8683
|
- get: fetch by id (ids: 1–20), readable in every status.
|
|
8684
|
+
The call form that works on every host sends action, content, category and ids every time: argument-dropping providers only emit required fields. For get and archive pass content="" and any valid category; for write pass ids=[].
|
|
8684
8685
|
Examples: category="CONFIG_VALUES", content="OpenCode source is at ~/Work/OSS/opencode" · category="CONSTRAINTS", content="Dashboard Tauri build needs RGBA PNGs, not grayscale"`;
|
|
8685
8686
|
|
|
8686
8687
|
// ../plugin/src/tools/ctx-memory/verification-recording.ts
|
|
@@ -8709,13 +8710,13 @@ var ParamsShape = {
|
|
|
8709
8710
|
description: "write | update | archive | merge | get"
|
|
8710
8711
|
}),
|
|
8711
8712
|
content: String2({
|
|
8712
|
-
description: "
|
|
8713
|
+
description: "Send on every call — the memory text for write, update and merge; pass an empty string for archive and get."
|
|
8713
8714
|
}),
|
|
8714
8715
|
category: Union(V2_MEMORY_CATEGORIES.map((c) => Literal(c)), {
|
|
8715
|
-
description: "
|
|
8716
|
+
description: "Send on every call — the fact's kind for write; on update/merge, the memory's current category to keep it; archive and get ignore it, so pass any valid category."
|
|
8716
8717
|
}),
|
|
8717
8718
|
ids: _Array_(Number2(), {
|
|
8718
|
-
description: "
|
|
8719
|
+
description: "Send on every call — one id for update, one or more for archive, two or more distinct ids of memories in the same category for merge, 1–20 for get; write takes an empty list."
|
|
8719
8720
|
}),
|
|
8720
8721
|
reason: Optional(String2({
|
|
8721
8722
|
description: "Why it is being archived (optional)."
|
|
@@ -8723,7 +8724,7 @@ var ParamsShape = {
|
|
|
8723
8724
|
};
|
|
8724
8725
|
var ListParamsSchema = _Object_({
|
|
8725
8726
|
category: Optional(Union(V2_MEMORY_CATEGORIES.map((category) => Literal(category)), {
|
|
8726
|
-
description: "
|
|
8727
|
+
description: "Filter listed memories to this category (optional)."
|
|
8727
8728
|
})),
|
|
8728
8729
|
limit: Optional(Number2({ description: "Max results for list (default 10)." }))
|
|
8729
8730
|
}, { additionalProperties: true });
|