@retaw106/mmc-oc 2.5.0 → 2.6.0
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/{context-xx09sh1g.js → context-cfbjrr0n.js} +418 -166
- package/dist/features/magic-context/compaction-marker.d.ts +34 -6
- package/dist/features/magic-context/compaction-marker.d.ts.map +1 -1
- package/dist/features/magic-context/message-index.d.ts +1 -24
- package/dist/features/magic-context/message-index.d.ts.map +1 -1
- package/dist/features/magic-context/session-decision-calibration.d.ts.map +1 -1
- package/dist/features/magic-context/session-retention.fixture.d.ts +4 -0
- package/dist/features/magic-context/session-retention.fixture.d.ts.map +1 -0
- package/dist/features/magic-context/storage-meta-persisted.d.ts +21 -1
- package/dist/features/magic-context/storage-meta-persisted.d.ts.map +1 -1
- package/dist/features/magic-context/storage-native-replay.d.ts +2 -0
- package/dist/features/magic-context/storage-native-replay.d.ts.map +1 -1
- package/dist/features/magic-context/storage-session-tables.d.ts +4 -11
- package/dist/features/magic-context/storage-session-tables.d.ts.map +1 -1
- package/dist/features/magic-context/tool-definition-tokens.d.ts +113 -58
- package/dist/features/magic-context/tool-definition-tokens.d.ts.map +1 -1
- package/dist/features/magic-context/work-metrics.d.ts +5 -3
- package/dist/features/magic-context/work-metrics.d.ts.map +1 -1
- package/dist/hooks/magic-context/apply-operations.d.ts +32 -0
- package/dist/hooks/magic-context/apply-operations.d.ts.map +1 -1
- package/dist/hooks/magic-context/ask-answer-notice.d.ts +25 -0
- package/dist/hooks/magic-context/ask-answer-notice.d.ts.map +1 -0
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts +5 -5
- package/dist/hooks/magic-context/compaction-marker-manager.d.ts.map +1 -1
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts +14 -0
- package/dist/hooks/magic-context/compaction-marker-publication.d.ts.map +1 -0
- package/dist/hooks/magic-context/compaction-off-transition.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts +11 -0
- package/dist/hooks/magic-context/compartment-runner-incremental.d.ts.map +1 -1
- package/dist/hooks/magic-context/compartment-trigger.d.ts.map +1 -1
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts +11 -3
- package/dist/hooks/magic-context/final-wire-token-estimate.d.ts.map +1 -1
- package/dist/hooks/magic-context/historian-history-wait.d.ts +16 -0
- package/dist/hooks/magic-context/historian-history-wait.d.ts.map +1 -0
- package/dist/hooks/magic-context/history-boundary-repair.d.ts +1 -1
- package/dist/hooks/magic-context/history-boundary-repair.d.ts.map +1 -1
- package/dist/hooks/magic-context/inject-compartments.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-measured-request.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts +3 -1
- package/dist/hooks/magic-context/lkg-recovery-prefix.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay-fit.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-replay.d.ts.map +1 -1
- package/dist/hooks/magic-context/lkg-slot.d.ts +2 -0
- package/dist/hooks/magic-context/lkg-slot.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-chunk.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-db.d.ts +8 -2
- package/dist/hooks/magic-context/read-session-db.d.ts.map +1 -1
- package/dist/hooks/magic-context/read-session-raw.d.ts +20 -0
- package/dist/hooks/magic-context/read-session-raw.d.ts.map +1 -1
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts +42 -0
- package/dist/hooks/magic-context/signed-thinking-fit-snapshot.d.ts.map +1 -0
- package/dist/hooks/magic-context/tag-messages.d.ts +2 -0
- package/dist/hooks/magic-context/tag-messages.d.ts.map +1 -1
- package/dist/hooks/magic-context/todo-view.d.ts +2 -2
- package/dist/hooks/magic-context/transform.d.ts.map +1 -1
- package/dist/{index-mjf0p7yq.js → index-1np16gxq.js} +1 -1
- package/dist/{index-bpjjcdy9.js → index-8rmt6s4f.js} +77 -31
- package/dist/{index-k25thxq7.js → index-s3ebcy63.js} +1 -1
- package/dist/{index-1vxffj5j.js → index-t0zx3tgz.js} +408 -89
- package/dist/{index-0d40b4q8.js → index-xk1dz6q9.js} +9322 -9215
- package/dist/index.js +2 -2
- package/dist/plugin/rpc-handlers.d.ts.map +1 -1
- package/dist/{read-session-chunk-eb3fy45y.js → read-session-chunk-2s8x6xps.js} +2 -2
- package/dist/{recomp-orchestrator-mmpy5cb7.js → recomp-orchestrator-51xyaexp.js} +5 -5
- package/dist/{send-session-notification-zpqs213d.js → send-session-notification-vdppp5x6.js} +2 -2
- package/dist/shared/tag-transcript.d.ts +2 -0
- package/dist/shared/tag-transcript.d.ts.map +1 -1
- package/dist/shared/transcript.d.ts +3 -1
- package/dist/shared/transcript.d.ts.map +1 -1
- package/dist/tools/ctx-memory/tools.d.ts.map +1 -1
- package/dist/tools/ctx-note/tools.d.ts.map +1 -1
- package/dist/tools/parameter-descriptions.d.ts +6 -6
- package/dist/tools/parameter-descriptions.d.ts.map +1 -1
- package/dist/v2/hooks/context.d.ts +5 -1
- package/dist/v2/hooks/context.d.ts.map +1 -1
- package/dist/v2/hooks/store.d.ts.map +1 -1
- package/dist/v2/message-times.d.ts +17 -0
- package/dist/v2/message-times.d.ts.map +1 -0
- package/dist/v2/server.js +12923 -12197
- package/dist/v2/store-reader.d.ts +14 -4
- package/dist/v2/store-reader.d.ts.map +1 -1
- package/dist/web/main.js +85 -11
- package/dist/{wrapup-orchestrator-jq589pgr.js → wrapup-orchestrator-g0mww1h4.js} +5 -5
- package/package.json +1 -1
- package/src/config/latch-permanence-guard.test.ts +0 -5
- package/src/shared/prompt-surface-a1-golden.md +6 -7
- package/src/shared/sqlite-transaction-mode-guard.test.ts +2 -0
- package/src/shared/tag-transcript.ts +47 -4
- package/src/shared/transcript.ts +1 -1
- package/src/shared/write-transaction-attribution.test.ts +1 -6
- package/dist/features/magic-context/message-index-sweep.d.ts +0 -11
- package/dist/features/magic-context/message-index-sweep.d.ts.map +0 -1
|
@@ -148,7 +148,14 @@ export declare class V2StoreReaderPool {
|
|
|
148
148
|
closeWhenIdle(timeoutMs: number): Promise<boolean>;
|
|
149
149
|
private finishClose;
|
|
150
150
|
}
|
|
151
|
-
export declare function messageTimesQuery(count: number): string;
|
|
151
|
+
export declare function messageTimesQuery(count: number, withVersions?: boolean): string;
|
|
152
|
+
export interface V2MessageTimeVersion {
|
|
153
|
+
id: string;
|
|
154
|
+
type: string;
|
|
155
|
+
seq: number;
|
|
156
|
+
created: number | null;
|
|
157
|
+
updated: number | null;
|
|
158
|
+
}
|
|
152
159
|
/** Opens an existing store read-only; missing/corrupt stores propagate errors, never an empty history. */
|
|
153
160
|
export declare class V2StoreReader {
|
|
154
161
|
private readonly path;
|
|
@@ -199,8 +206,6 @@ export declare class V2StoreReader {
|
|
|
199
206
|
latestMessageTime(sessionID: string): number | undefined;
|
|
200
207
|
/** Parent links are recorded by the host before a child's first context pass. */
|
|
201
208
|
isSubagent(sessionID: string): boolean | null;
|
|
202
|
-
/** Authoritative liveness snapshot for background orphan cleanup. */
|
|
203
|
-
sessionIds(): string[];
|
|
204
209
|
/** Count session_message rows after a sequence. This counts stored rows, not
|
|
205
210
|
* model messages: it includes idle rows (OpenCode's marker that a run finished)
|
|
206
211
|
* and compaction rows (checkpoints), and one stored assistant row can render as
|
|
@@ -209,7 +214,12 @@ export declare class V2StoreReader {
|
|
|
209
214
|
storedRowsAfter(sessionID: string, after: number): number;
|
|
210
215
|
storedMessageCount(sessionID: string): number;
|
|
211
216
|
messageById(sessionID: string, id: string): StoreRow | null;
|
|
212
|
-
|
|
217
|
+
/** Check membership and row revisions without loading or parsing message data. */
|
|
218
|
+
messageTimeVersions(sessionID: string, ids: readonly string[], span?: {
|
|
219
|
+
first: number;
|
|
220
|
+
last: number;
|
|
221
|
+
}): Map<string, V2MessageTimeVersion>;
|
|
222
|
+
messageTimes(sessionID: string, ids: readonly string[], versions?: Map<string, V2MessageTimeVersion>): Map<string, {
|
|
213
223
|
created?: number;
|
|
214
224
|
completed?: number;
|
|
215
225
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"store-reader.d.ts","sourceRoot":"","sources":["../../src/v2/store-reader.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAChD,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAMvF,OAAO,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE5C,yFAAyF;AACzF,wBAAgB,sBAAsB,CAClC,OAAO,EAAE,MAAM,EACf,GAAG,GAAE,MAAM,CAAC,UAAwB,GACrC,MAAM,CAER;AAED,0EAA0E;AAC1E,wBAAgB,cAAc,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,SAAW,EAClB,GAAG,GAAE,MAAM,CAAC,UAAwB,GACrC,MAAM,CAER;AAGD,MAAM,MAAM,WAAW,GACjB,gBAAgB,GAChB,gBAAgB,GAChB,mBAAmB,GACnB,MAAM,GACN,WAAW,GACX,QAAQ,GACR,OAAO,GACP,OAAO,GACP,WAAW,GACX,YAAY,GACZ,MAAM,CAAC;AAEb,eAAO,MAAM,iBAAiB,yEAOa,CAAC;AAI5C,eAAO,MAAM,mBAAmB,QAkBP,CAAC;AAC1B,MAAM,WAAW,WAAW;IACxB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;IACvB,OAAO,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,CAAC;IACzC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,WAAW,GAAG,QAAQ,GAAG,aAAa,CAAC;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,KAAK,CAAC,EAAE;QAAE,EAAE,EAAE,MAAM,CAAC;QAAC,UAAU,EAAE,MAAM,CAAC;QAAC,OAAO,CA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AO,CAAC,GAAG;CAcd"}
|
package/dist/web/main.js
CHANGED
|
@@ -1359,12 +1359,58 @@ var init_read_session_formatting = __esm(() => {
|
|
|
1359
1359
|
promptTokenCounts = new Map;
|
|
1360
1360
|
PROMPT_TOKEN_COUNT_BYTES = 8 * 1024 * 1024;
|
|
1361
1361
|
});
|
|
1362
|
+
|
|
1363
|
+
// src/shared/bounded-session-map.ts
|
|
1364
|
+
class BoundedSessionMap {
|
|
1365
|
+
maxEntries;
|
|
1366
|
+
store = new Map;
|
|
1367
|
+
constructor(maxEntries) {
|
|
1368
|
+
if (!Number.isFinite(maxEntries) || maxEntries < 1) {
|
|
1369
|
+
throw new Error(`BoundedSessionMap: maxEntries must be >= 1, got ${maxEntries}`);
|
|
1370
|
+
}
|
|
1371
|
+
this.maxEntries = maxEntries;
|
|
1372
|
+
}
|
|
1373
|
+
get(sessionId) {
|
|
1374
|
+
const value = this.store.get(sessionId);
|
|
1375
|
+
if (value === undefined)
|
|
1376
|
+
return;
|
|
1377
|
+
this.store.delete(sessionId);
|
|
1378
|
+
this.store.set(sessionId, value);
|
|
1379
|
+
return value;
|
|
1380
|
+
}
|
|
1381
|
+
peek(sessionId) {
|
|
1382
|
+
return this.store.get(sessionId);
|
|
1383
|
+
}
|
|
1384
|
+
has(sessionId) {
|
|
1385
|
+
return this.store.has(sessionId);
|
|
1386
|
+
}
|
|
1387
|
+
set(sessionId, value) {
|
|
1388
|
+
if (this.store.has(sessionId)) {
|
|
1389
|
+
this.store.delete(sessionId);
|
|
1390
|
+
} else if (this.store.size >= this.maxEntries) {
|
|
1391
|
+
const oldest = this.store.keys().next().value;
|
|
1392
|
+
if (oldest !== undefined)
|
|
1393
|
+
this.store.delete(oldest);
|
|
1394
|
+
}
|
|
1395
|
+
this.store.set(sessionId, value);
|
|
1396
|
+
}
|
|
1397
|
+
delete(sessionId) {
|
|
1398
|
+
return this.store.delete(sessionId);
|
|
1399
|
+
}
|
|
1400
|
+
clear() {
|
|
1401
|
+
this.store.clear();
|
|
1402
|
+
}
|
|
1403
|
+
get size() {
|
|
1404
|
+
return this.store.size;
|
|
1405
|
+
}
|
|
1406
|
+
}
|
|
1362
1407
|
// src/features/magic-context/tool-definition-tokens.ts
|
|
1363
|
-
var
|
|
1408
|
+
var ACTIVITY_WINDOW_MS, routes, sessionFlights;
|
|
1364
1409
|
var init_tool_definition_tokens = __esm(() => {
|
|
1365
1410
|
init_read_session_formatting();
|
|
1366
|
-
|
|
1367
|
-
|
|
1411
|
+
ACTIVITY_WINDOW_MS = 10 * 60000;
|
|
1412
|
+
routes = new Map;
|
|
1413
|
+
sessionFlights = new BoundedSessionMap(1000);
|
|
1368
1414
|
});
|
|
1369
1415
|
|
|
1370
1416
|
// src/shared/opencode-db-path.ts
|
|
@@ -4345,9 +4391,10 @@ function closeConnection(connection) {
|
|
|
4345
4391
|
counters.readersClosed += 1;
|
|
4346
4392
|
}
|
|
4347
4393
|
}
|
|
4348
|
-
function messageTimesQuery(count) {
|
|
4394
|
+
function messageTimesQuery(count, withVersions = false) {
|
|
4349
4395
|
return `SELECT id, COALESCE(time_created, json_extract(data, '$.time.created')) AS created,
|
|
4350
4396
|
json_extract(data, '$.time.completed') AS completed
|
|
4397
|
+
${withVersions ? ", type, seq, time_created AS version_created, time_updated AS version_updated" : ""}
|
|
4351
4398
|
FROM session_message WHERE +session_id = ? AND id IN (${Array.from({ length: count }, () => "?").join(",")})`;
|
|
4352
4399
|
}
|
|
4353
4400
|
|
|
@@ -4467,9 +4514,6 @@ class V2StoreReader {
|
|
|
4467
4514
|
return null;
|
|
4468
4515
|
return typeof row.parent_id === "string" && row.parent_id.length > 0;
|
|
4469
4516
|
}
|
|
4470
|
-
sessionIds() {
|
|
4471
|
-
return this.prepare("SELECT id FROM session_v2").all().map((row) => row.id);
|
|
4472
|
-
}
|
|
4473
4517
|
storedRowsAfter(sessionID, after) {
|
|
4474
4518
|
const row = this.prepare("SELECT COUNT(*) AS count FROM session_message WHERE session_id = ? AND seq > ?").get(sessionID, after);
|
|
4475
4519
|
return row.count;
|
|
@@ -4488,16 +4532,46 @@ class V2StoreReader {
|
|
|
4488
4532
|
return row ? decode(row) : null;
|
|
4489
4533
|
});
|
|
4490
4534
|
}
|
|
4491
|
-
|
|
4492
|
-
const
|
|
4535
|
+
messageTimeVersions(sessionID, ids, span) {
|
|
4536
|
+
const versions = new Map;
|
|
4537
|
+
if (ids.length > 0 && span && span.last - span.first < ids.length * 2) {
|
|
4538
|
+
const wanted = new Set(ids);
|
|
4539
|
+
const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
|
|
4540
|
+
FROM session_message WHERE session_id = ? AND seq >= ? AND seq <= ?`).all(sessionID, span.first, span.last);
|
|
4541
|
+
for (const row of rows)
|
|
4542
|
+
if (wanted.has(row.id))
|
|
4543
|
+
versions.set(row.id, row);
|
|
4544
|
+
for (const [id, version] of this.messageTimeVersions(sessionID, ids.filter((id) => !versions.has(id))))
|
|
4545
|
+
versions.set(id, version);
|
|
4546
|
+
return versions;
|
|
4547
|
+
}
|
|
4493
4548
|
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
4494
4549
|
const batch = ids.slice(offset, offset + 500);
|
|
4495
|
-
const rows = this.prepare(
|
|
4550
|
+
const rows = this.prepare(`SELECT id, type, seq, time_created AS created, time_updated AS updated
|
|
4551
|
+
FROM session_message WHERE +session_id = ? AND id IN (${batch.map(() => "?").join(",")})`).all(sessionID, ...batch);
|
|
4496
4552
|
for (const row of rows)
|
|
4553
|
+
versions.set(row.id, row);
|
|
4554
|
+
}
|
|
4555
|
+
return versions;
|
|
4556
|
+
}
|
|
4557
|
+
messageTimes(sessionID, ids, versions) {
|
|
4558
|
+
const times = new Map;
|
|
4559
|
+
for (let offset = 0;offset < ids.length; offset += 500) {
|
|
4560
|
+
const batch = ids.slice(offset, offset + 500);
|
|
4561
|
+
const rows = this.prepare(messageTimesQuery(batch.length, versions !== undefined)).all(sessionID, ...batch);
|
|
4562
|
+
for (const row of rows) {
|
|
4497
4563
|
times.set(row.id, {
|
|
4498
4564
|
created: typeof row.created === "number" ? row.created : undefined,
|
|
4499
4565
|
completed: typeof row.completed === "number" ? row.completed : undefined
|
|
4500
4566
|
});
|
|
4567
|
+
versions?.set(row.id, {
|
|
4568
|
+
id: row.id,
|
|
4569
|
+
type: row.type,
|
|
4570
|
+
seq: row.seq,
|
|
4571
|
+
created: row.version_created,
|
|
4572
|
+
updated: row.version_updated
|
|
4573
|
+
});
|
|
4574
|
+
}
|
|
4501
4575
|
}
|
|
4502
4576
|
return times;
|
|
4503
4577
|
}
|
|
@@ -5643,7 +5717,7 @@ function projectRawMessages(rows, ordinalFor) {
|
|
|
5643
5717
|
const message = {
|
|
5644
5718
|
id: row.id,
|
|
5645
5719
|
ordinal: ordinalFor(row, index),
|
|
5646
|
-
role: row.type === "assistant" ? "assistant" : "user",
|
|
5720
|
+
role: row.type === "assistant" ? "assistant" : row.type === "system" ? "system" : "user",
|
|
5647
5721
|
createdAt: row.time_created ?? row.data.time?.created,
|
|
5648
5722
|
parts: row.type === "assistant" ? (row.data.content ?? []).map((part) => {
|
|
5649
5723
|
if (part.type !== "tool")
|
|
@@ -21,11 +21,11 @@ import {
|
|
|
21
21
|
getActiveCompartmentRun,
|
|
22
22
|
markActiveCompartmentRunPublished,
|
|
23
23
|
registerActiveCompartmentRun
|
|
24
|
-
} from "./index-
|
|
24
|
+
} from "./index-xk1dz6q9.js";
|
|
25
25
|
import"./index-pte3cfs9.js";
|
|
26
26
|
import"./index-x37vg474.js";
|
|
27
|
-
import"./index-
|
|
28
|
-
import"./index-
|
|
27
|
+
import"./index-t0zx3tgz.js";
|
|
28
|
+
import"./index-8rmt6s4f.js";
|
|
29
29
|
import {
|
|
30
30
|
pushNotification2
|
|
31
31
|
} from "./index-jdxxq8cz.js";
|
|
@@ -33,11 +33,11 @@ import"./index-5ty9rnbx.js";
|
|
|
33
33
|
import"./index-kmbme1v1.js";
|
|
34
34
|
import {
|
|
35
35
|
sendStatusNotification2
|
|
36
|
-
} from "./index-
|
|
36
|
+
} from "./index-s3ebcy63.js";
|
|
37
37
|
import {
|
|
38
38
|
setRecompStarting2,
|
|
39
39
|
setRecompTerminal2
|
|
40
|
-
} from "./index-
|
|
40
|
+
} from "./index-1np16gxq.js";
|
|
41
41
|
import"./index-yjv8dpht.js";
|
|
42
42
|
|
|
43
43
|
// src/hooks/magic-context/wrapup-orchestrator.ts
|
package/package.json
CHANGED
|
@@ -62,11 +62,6 @@ const KNOWN_SLOTS: Record<string, KnownSlot> = {
|
|
|
62
62
|
classification: "VERDICT",
|
|
63
63
|
reason: "Saved: getActiveCooldown deletes an expired entry and forces a new git probe after five minutes.",
|
|
64
64
|
},
|
|
65
|
-
"packages/plugin/src/features/magic-context/message-index.ts:MESSAGE_HISTORY_ORPHAN_UNAVAILABLE_REPROBE_MS":
|
|
66
|
-
{
|
|
67
|
-
classification: "VERDICT",
|
|
68
|
-
reason: "Saved: source_unavailable persists a future timestamp, then the normal cooldown arithmetic re-probes after one day.",
|
|
69
|
-
},
|
|
70
65
|
"packages/plugin/src/features/magic-context/storage-meta-session.ts:sessionMetaSelectColumnsCache":
|
|
71
66
|
{
|
|
72
67
|
classification: "VERDICT",
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Magic Context agent-facing surface (exported from source)
|
|
2
2
|
|
|
3
|
-
Generated by `packages/plugin/scripts/export-agent-surface.ts` at 2026-
|
|
3
|
+
Generated by `packages/plugin/scripts/export-agent-surface.ts` at 2026-11-01.
|
|
4
4
|
Token counts are Claude BPE estimates on the raw text.
|
|
5
5
|
|
|
6
6
|
## 1. System-prompt guidance section
|
|
@@ -201,7 +201,7 @@ Finer recovery:
|
|
|
201
201
|
}
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
### mmc_note — description ~319 tokens, params ~
|
|
204
|
+
### mmc_note — description ~319 tokens, params ~196 tokens (total ~515)
|
|
205
205
|
|
|
206
206
|
**Description:**
|
|
207
207
|
|
|
@@ -228,7 +228,7 @@ First line is the title (under 80 chars), followed by detail. Operations:
|
|
|
228
228
|
```json
|
|
229
229
|
{
|
|
230
230
|
"action": {
|
|
231
|
-
"description": "write | read | update | dismiss.
|
|
231
|
+
"description": "write | read | update | dismiss.",
|
|
232
232
|
"type": "string",
|
|
233
233
|
"enum": [
|
|
234
234
|
"write",
|
|
@@ -259,8 +259,7 @@ First line is the title (under 80 chars), followed by detail. Operations:
|
|
|
259
259
|
"type": "number"
|
|
260
260
|
},
|
|
261
261
|
"note_ids": {
|
|
262
|
-
"description": "Note ids: one for update, 1–50 for dismiss or
|
|
263
|
-
"minItems": 1,
|
|
262
|
+
"description": "Note ids: one for update, 1–50 for dismiss, or 1–50 to read those notes in full. Write and a plain read take an empty list.",
|
|
264
263
|
"maxItems": 50,
|
|
265
264
|
"type": "array",
|
|
266
265
|
"items": {
|
|
@@ -272,7 +271,7 @@ First line is the title (under 80 chars), followed by detail. Operations:
|
|
|
272
271
|
}
|
|
273
272
|
```
|
|
274
273
|
|
|
275
|
-
### mmc_memory — description ~279 tokens, params ~
|
|
274
|
+
### mmc_memory — description ~279 tokens, params ~175 tokens (total ~454)
|
|
276
275
|
|
|
277
276
|
**Description:**
|
|
278
277
|
|
|
@@ -310,7 +309,7 @@ Examples: category="CONFIG_VALUES", content="OpenCode source is at ~/Work/OSS/op
|
|
|
310
309
|
"type": "string"
|
|
311
310
|
},
|
|
312
311
|
"category": {
|
|
313
|
-
"description": "Kind of fact (required for write; on update/merge
|
|
312
|
+
"description": "Kind of fact (required for write; on update/merge, pass the memory's current category to keep it).",
|
|
314
313
|
"type": "string",
|
|
315
314
|
"enum": [
|
|
316
315
|
"PROJECT_RULES",
|
|
@@ -27,6 +27,8 @@ const READ_ONLY_DEFERRED_TRANSACTIONS: Record<string, string> = {
|
|
|
27
27
|
"pins one read snapshot so the session's rowid coverage proof and the filtered message search see the same rows; never writes (read-only connections use it too)",
|
|
28
28
|
"packages/plugin/src/hooks/magic-context/lkg-persist.ts#loadPersistedLkgSlot":
|
|
29
29
|
"reads an LKG slot row and its prefix slices as one consistent snapshot even while another connection saves the slot; never writes (a failed verification clear opens its own transaction)",
|
|
30
|
+
"packages/plugin/src/hooks/magic-context/compaction-marker-manager.ts#reconcileForkOrphanedCompactionMarkers":
|
|
31
|
+
"reads publication intent and finalized ownership as one context.db snapshot while host-order probes use the already-open host connection; never writes context.db",
|
|
30
32
|
};
|
|
31
33
|
|
|
32
34
|
const REPOSITORY_ROOT = resolve(import.meta.dir, "../../../..");
|
|
@@ -75,6 +75,8 @@ import type { Transcript, TranscriptMessage, TranscriptPart } from "./transcript
|
|
|
75
75
|
export { TEXT_TAG_IDENTITY_MARKER };
|
|
76
76
|
|
|
77
77
|
export interface TagTranscriptOptions {
|
|
78
|
+
/** Independently validated text sources; does not authorize tool accounting reuse. */
|
|
79
|
+
reuseTextMessageIds?: ReadonlySet<string>;
|
|
78
80
|
/**
|
|
79
81
|
* When true, skip injecting `§N§` prefix into visible text. Tags
|
|
80
82
|
* still get assigned in the DB so historian/drops can reference
|
|
@@ -305,6 +307,12 @@ interface ToolAggregate {
|
|
|
305
307
|
maxByteSize: number;
|
|
306
308
|
/** Token count paired with maxByteSize (the same output occurrence). */
|
|
307
309
|
maxTokenCount: number;
|
|
310
|
+
/**
|
|
311
|
+
* Whether maxTokenCount is a real count. Legacy rows can store bytes with a
|
|
312
|
+
* NULL token_count; seeding 0 from that must not look like a stored count,
|
|
313
|
+
* or unchanged results would never be recounted.
|
|
314
|
+
*/
|
|
315
|
+
tokenCountKnown: boolean;
|
|
308
316
|
/** Tool name from the first occurrence we see one on. */
|
|
309
317
|
toolName: string | null;
|
|
310
318
|
/** Input byte size from the invocation occurrence (for storage projection). */
|
|
@@ -417,7 +425,10 @@ export function tagTranscript(
|
|
|
417
425
|
targets,
|
|
418
426
|
skipPrefixInjection,
|
|
419
427
|
entryFingerprint: options.entryFingerprintByMessageId?.get(messageId) ?? null,
|
|
420
|
-
reuseIdentity:
|
|
428
|
+
reuseIdentity:
|
|
429
|
+
reuseIdentity ||
|
|
430
|
+
options.reuseTextMessageIds?.has(messageId) === true ||
|
|
431
|
+
contentDerivedTextIds !== undefined,
|
|
421
432
|
timing,
|
|
422
433
|
textIdentitySourceCache: options.textIdentitySourceCache,
|
|
423
434
|
textTokenCache: options.textTokenCache,
|
|
@@ -508,6 +519,13 @@ export function tagTranscript(
|
|
|
508
519
|
timing,
|
|
509
520
|
options.toolTokenCache,
|
|
510
521
|
tokenCacheKey,
|
|
522
|
+
{
|
|
523
|
+
byteSize: existing.maxByteSize,
|
|
524
|
+
tokenCount: existing.tokenCountKnown
|
|
525
|
+
? existing.maxTokenCount
|
|
526
|
+
: null,
|
|
527
|
+
inputTokenCount: existing.inputTokenCount,
|
|
528
|
+
},
|
|
511
529
|
);
|
|
512
530
|
text = accounting.text;
|
|
513
531
|
if (part.kind === "tool_result") {
|
|
@@ -596,6 +614,7 @@ export function tagTranscript(
|
|
|
596
614
|
// genuinely larger folded result can still bump accounting.
|
|
597
615
|
maxByteSize: reusableAccounting.byteSize,
|
|
598
616
|
maxTokenCount: reusableAccounting.tokenCount ?? 0,
|
|
617
|
+
tokenCountKnown: reusableAccounting.tokenCount !== null,
|
|
599
618
|
toolName: null,
|
|
600
619
|
inputByteSize: reusableAccounting.inputByteSize,
|
|
601
620
|
inputTokenCount: reusableAccounting.inputTokenCount,
|
|
@@ -623,6 +642,7 @@ export function tagTranscript(
|
|
|
623
642
|
timing,
|
|
624
643
|
options.toolTokenCache,
|
|
625
644
|
tokenCacheKey,
|
|
645
|
+
tagger.getToolTagAccounting(sessionId, callId, messageId),
|
|
626
646
|
);
|
|
627
647
|
text = accounting.text;
|
|
628
648
|
const outputByteSize = part.kind === "tool_result" ? accounting.byteSize : 0;
|
|
@@ -657,6 +677,11 @@ export function tagTranscript(
|
|
|
657
677
|
occurrences: [{ message, part, kind: part.kind }],
|
|
658
678
|
maxByteSize: persistedAccounting?.byteSize ?? outputByteSize,
|
|
659
679
|
maxTokenCount: persistedAccounting?.tokenCount ?? outputTokenCount,
|
|
680
|
+
// A fresh allocation just wrote outputTokenCount (0 for an
|
|
681
|
+
// invocation); an existing row keeps its NULL as unknown.
|
|
682
|
+
tokenCountKnown: persistedAccounting
|
|
683
|
+
? persistedAccounting.tokenCount !== null
|
|
684
|
+
: true,
|
|
660
685
|
toolName: accounting.toolName,
|
|
661
686
|
inputByteSize:
|
|
662
687
|
persistedAccounting?.inputByteSize ??
|
|
@@ -745,7 +770,9 @@ function syncToolAggregateAccounting(
|
|
|
745
770
|
): void {
|
|
746
771
|
tagger.setToolTagAccounting(sessionId, aggregate.tagId, {
|
|
747
772
|
byteSize: aggregate.maxByteSize,
|
|
748
|
-
|
|
773
|
+
// Unknown stays unknown so the next occurrence/pass recounts instead of
|
|
774
|
+
// caching a fabricated 0 for a legacy row.
|
|
775
|
+
tokenCount: aggregate.tokenCountKnown ? aggregate.maxTokenCount : null,
|
|
749
776
|
inputByteSize: aggregate.inputByteSize,
|
|
750
777
|
inputTokenCount: aggregate.inputTokenCount,
|
|
751
778
|
});
|
|
@@ -770,6 +797,7 @@ function applyGrownToolResultAccounting(args: GrownToolResultAccountingArgs): vo
|
|
|
770
797
|
}
|
|
771
798
|
args.aggregate.maxByteSize = args.byteSize;
|
|
772
799
|
args.aggregate.maxTokenCount = tokenCount;
|
|
800
|
+
args.aggregate.tokenCountKnown = true;
|
|
773
801
|
updateTagByteSize(args.db, args.sessionId, args.aggregate.tagId, args.byteSize);
|
|
774
802
|
updateTagTokenCount(args.db, args.sessionId, args.aggregate.tagId, tokenCount);
|
|
775
803
|
syncToolAggregateAccounting(args.tagger, args.sessionId, args.aggregate);
|
|
@@ -780,12 +808,22 @@ function readAggregateToolAccounting(
|
|
|
780
808
|
timing: TagTranscriptTiming | undefined,
|
|
781
809
|
tokenCache?: Map<string, { text: string; tokenCount: number }>,
|
|
782
810
|
tokenCacheKey?: string,
|
|
811
|
+
persisted?: { byteSize: number; tokenCount: number | null; inputTokenCount: number | null },
|
|
783
812
|
): AggregateToolAccounting {
|
|
784
813
|
const text = part.getText() ?? "";
|
|
785
814
|
const byteSize = getToolPartByteSize(part, text);
|
|
786
|
-
|
|
815
|
+
// Persisted tool-result accounting tracks the largest byte size seen. Skip
|
|
816
|
+
// output tokenization when that size has not grown and a count is stored;
|
|
817
|
+
// known input counts also need no tokenization. Growth and missing counts still take
|
|
818
|
+
// the original counting path, even when the identity was not reusable.
|
|
819
|
+
const metadata = part.getToolMetadata({
|
|
820
|
+
skipInputTokenCount: persisted?.inputTokenCount != null,
|
|
821
|
+
});
|
|
787
822
|
let tokenCount = 0;
|
|
788
|
-
if (
|
|
823
|
+
if (
|
|
824
|
+
part.kind === "tool_result" &&
|
|
825
|
+
(!persisted || persisted.tokenCount === null || byteSize > persisted.byteSize)
|
|
826
|
+
) {
|
|
789
827
|
const tokenStart = timing ? performance.now() : 0;
|
|
790
828
|
tokenCount = getCachedToolPartTokenCount(part, text, tokenCache, tokenCacheKey);
|
|
791
829
|
if (timing) timing.tokenCounting += performance.now() - tokenStart;
|
|
@@ -1414,6 +1452,11 @@ function buildAggregateTarget(
|
|
|
1414
1452
|
},
|
|
1415
1453
|
// Open invocations still belong to the current turn; only complete arcs reclaim.
|
|
1416
1454
|
prepareDrop: () => !occurrences.some((occ) => occ.part.canRemove?.() === "defer"),
|
|
1455
|
+
prepareReplayDrop: () => {
|
|
1456
|
+
if (complete() && !requiresToolArcSkeleton) {
|
|
1457
|
+
for (const occ of occurrences) occ.part.canRemove?.();
|
|
1458
|
+
}
|
|
1459
|
+
},
|
|
1417
1460
|
canDrop: () => complete() && !occurrences.some((occ) => occ.part.hasUserAnswer?.()),
|
|
1418
1461
|
requiresToolArcSkeleton,
|
|
1419
1462
|
// Non-mutating read of the invocation input (the tool_use occurrence
|
package/src/shared/transcript.ts
CHANGED
|
@@ -132,7 +132,7 @@ export interface TranscriptPart {
|
|
|
132
132
|
*
|
|
133
133
|
* For non-tool parts both byte fields are undefined/0.
|
|
134
134
|
*/
|
|
135
|
-
getToolMetadata(): {
|
|
135
|
+
getToolMetadata(options?: { skipInputTokenCount?: boolean }): {
|
|
136
136
|
toolName: string | undefined;
|
|
137
137
|
inputByteSize: number;
|
|
138
138
|
inputTokenCount: number;
|
|
@@ -14,11 +14,7 @@ const fencedSources: Array<{ path: string; sites: string[]; reporterCalls?: stri
|
|
|
14
14
|
},
|
|
15
15
|
{
|
|
16
16
|
path: "packages/plugin/src/features/magic-context/message-index.ts",
|
|
17
|
-
sites: [
|
|
18
|
-
"message_index_incremental",
|
|
19
|
-
"message_index_reconcile",
|
|
20
|
-
"message_index_orphan_sweep",
|
|
21
|
-
],
|
|
17
|
+
sites: ["message_index_incremental", "message_index_reconcile"],
|
|
22
18
|
},
|
|
23
19
|
{
|
|
24
20
|
path: "packages/plugin/src/features/magic-context/storage-meta-persisted.ts",
|
|
@@ -101,7 +97,6 @@ const newlyCoveredSites = [
|
|
|
101
97
|
"opencode_soft_refresh_cache",
|
|
102
98
|
"message_index_incremental",
|
|
103
99
|
"message_index_reconcile",
|
|
104
|
-
"message_index_orphan_sweep",
|
|
105
100
|
"message_index_clear",
|
|
106
101
|
"message_fts_rowid_backfill",
|
|
107
102
|
"storage_meta_wrapup_expiry_cleanup",
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
import type { Database } from "../../shared/sqlite";
|
|
2
|
-
import { type MessageHistoryOrphanSweepOptions, type MessageHistoryOrphanSweepResult } from "./message-index";
|
|
3
|
-
/**
|
|
4
|
-
* Scope wrapper for the background sweep. It lives beside `message-index` rather
|
|
5
|
-
* than inside it: importing the transform-pass scope helpers into
|
|
6
|
-
* `message-index.ts` itself changes the bundled module graph in a way that hits
|
|
7
|
-
* a Bun 1.4.2 packaging bug (a top-level `__promiseAll` init call is emitted
|
|
8
|
-
* without its definition, which crashes node hosts at import time).
|
|
9
|
-
*/
|
|
10
|
-
export declare function sweepOrphanedOpenCodeMessageIndexes(db: Database, openReadableOpenCodeDb: () => Database | null, options?: MessageHistoryOrphanSweepOptions): MessageHistoryOrphanSweepResult;
|
|
11
|
-
//# sourceMappingURL=message-index-sweep.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"message-index-sweep.d.ts","sourceRoot":"","sources":["../../../src/features/magic-context/message-index-sweep.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAEpD,OAAO,EACH,KAAK,gCAAgC,EACrC,KAAK,+BAA+B,EAEvC,MAAM,iBAAiB,CAAC;AAEzB;;;;;;GAMG;AACH,wBAAgB,mCAAmC,CAC/C,EAAE,EAAE,QAAQ,EACZ,sBAAsB,EAAE,MAAM,QAAQ,GAAG,IAAI,EAC7C,OAAO,GAAE,gCAAqC,GAC/C,+BAA+B,CAMjC"}
|