@agentclientprotocol/claude-agent-acp 0.114.1-preview.3 → 0.114.1-preview.4
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.
|
@@ -45,6 +45,22 @@ export declare function readHistoryAcrossCompactions(sessionId: string, messages
|
|
|
45
45
|
* and the history before a compaction that `getSessionMessages` leaves out.
|
|
46
46
|
* Without `dir`, all project directories are searched. */
|
|
47
47
|
export declare function loadFullSessionHistory(sessionId: string, dir?: string): Promise<SessionStoreEntry[]>;
|
|
48
|
+
/** The position of each record of a transcript, by its uuid. */
|
|
49
|
+
export declare function recordPositions(entries: readonly SessionStoreEntry[]): Map<unknown, number>;
|
|
50
|
+
/**
|
|
51
|
+
* The uuid of the record that `entry` follows, given the `positions` of the
|
|
52
|
+
* records of its transcript: its `parentUuid`, or for a compaction boundary,
|
|
53
|
+
* the message before the compaction.
|
|
54
|
+
*
|
|
55
|
+
* Claude Code can write a boundary whose `logicalParentUuid` is not in the
|
|
56
|
+
* transcript: it lists the message in `compactMetadata.preservedMessages`, but
|
|
57
|
+
* does not write it. Such a boundary follows
|
|
58
|
+
* `compactMetadata.preservedSegment.tailUuid`, the `logicalParentUuid` of the
|
|
59
|
+
* other boundaries, when that message comes before the boundary in the file.
|
|
60
|
+
* In a fork, the boundary is the first record and the preserved messages come
|
|
61
|
+
* after it: the boundary then keeps its `logicalParentUuid`.
|
|
62
|
+
*/
|
|
63
|
+
export declare function recordParentUuid(entry: SessionStoreEntry, positions: ReadonlyMap<unknown, number>): string | undefined;
|
|
48
64
|
/** What a resume restores from the end of the local transcript. */
|
|
49
65
|
export type ResumedTail = {
|
|
50
66
|
model?: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resumed-session.d.ts","sourceRoot":"","sources":["../src/resumed-session.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,cAAc,EAEnB,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AACxC,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Ae,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,YAAY,EACrB,SAAS,UAAO,GACf,OAAO,CAAC,WAAW,CAAC,CAiBtB;AAED,0FAA0F;AAC1F,wBAAsB,cAAc,CAClC,SAAS,EAAE,MAAM,EACjB,OAAO,CAAC,EAAE;IAAE,MAAM,EAAE,OAAO,CAAA;CAAE,GAC5B,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAuB7B;AAED;qFACqF;AACrF,wBAAsB,qBAAqB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAOtF;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,UAAU,EAClB,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,iBAAiB,EAAE,CAAC,CAgB9B"}
|
package/dist/resumed-session.js
CHANGED
|
@@ -82,7 +82,9 @@ export async function readHistoryAcrossCompactions(sessionId, messages, logger,
|
|
|
82
82
|
if (!isCompactSummaryMessage(messages[0]))
|
|
83
83
|
return messages;
|
|
84
84
|
try {
|
|
85
|
-
const
|
|
85
|
+
const records = snapshot ?? (await loadFullSessionHistory(sessionId, dir));
|
|
86
|
+
const positions = recordPositions(records);
|
|
87
|
+
const entries = records.map((entry) => linkCompactBoundary(entry, positions, sessionId, logger));
|
|
86
88
|
const read = (records) => getSessionMessages(sessionId, {
|
|
87
89
|
dir,
|
|
88
90
|
sessionStore: { append: async () => { }, load: async () => records },
|
|
@@ -123,19 +125,65 @@ export async function loadFullSessionHistory(sessionId, dir) {
|
|
|
123
125
|
await importSessionToStore(sessionId, store, { dir, includeSubagents: false });
|
|
124
126
|
return entries;
|
|
125
127
|
}
|
|
126
|
-
/** The
|
|
127
|
-
function
|
|
128
|
+
/** The position of each record of a transcript, by its uuid. */
|
|
129
|
+
export function recordPositions(entries) {
|
|
130
|
+
return new Map(entries.flatMap((entry, index) => typeof entry.uuid === "string" ? [[entry.uuid, index]] : []));
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* The uuid of the record that `entry` follows, given the `positions` of the
|
|
134
|
+
* records of its transcript: its `parentUuid`, or for a compaction boundary,
|
|
135
|
+
* the message before the compaction.
|
|
136
|
+
*
|
|
137
|
+
* Claude Code can write a boundary whose `logicalParentUuid` is not in the
|
|
138
|
+
* transcript: it lists the message in `compactMetadata.preservedMessages`, but
|
|
139
|
+
* does not write it. Such a boundary follows
|
|
140
|
+
* `compactMetadata.preservedSegment.tailUuid`, the `logicalParentUuid` of the
|
|
141
|
+
* other boundaries, when that message comes before the boundary in the file.
|
|
142
|
+
* In a fork, the boundary is the first record and the preserved messages come
|
|
143
|
+
* after it: the boundary then keeps its `logicalParentUuid`.
|
|
144
|
+
*/
|
|
145
|
+
export function recordParentUuid(entry, positions) {
|
|
146
|
+
if (typeof entry.parentUuid === "string" && entry.parentUuid)
|
|
147
|
+
return entry.parentUuid;
|
|
148
|
+
const logical = entry.logicalParentUuid;
|
|
149
|
+
if (typeof logical !== "string")
|
|
150
|
+
return undefined;
|
|
151
|
+
if (positions.has(logical) || entry.type !== "system" || entry.subtype !== "compact_boundary") {
|
|
152
|
+
return logical;
|
|
153
|
+
}
|
|
154
|
+
const tail = preservedTail(entry);
|
|
155
|
+
const tailAt = tail === undefined ? undefined : positions.get(tail);
|
|
156
|
+
const at = positions.get(entry.uuid);
|
|
157
|
+
return tailAt !== undefined && at !== undefined && tailAt < at ? tail : logical;
|
|
158
|
+
}
|
|
159
|
+
function preservedTail(entry) {
|
|
160
|
+
const segment = entry.compactMetadata
|
|
161
|
+
?.preservedSegment;
|
|
162
|
+
const tail = segment?.tailUuid;
|
|
163
|
+
return typeof tail === "string" ? tail : undefined;
|
|
164
|
+
}
|
|
165
|
+
/** The record unchanged, or a compaction boundary linked to the message
|
|
166
|
+
* before it (see {@link recordParentUuid}). */
|
|
167
|
+
function linkCompactBoundary(entry, positions, sessionId, logger) {
|
|
128
168
|
if (entry.type !== "system" ||
|
|
129
169
|
entry.subtype !== "compact_boundary" ||
|
|
130
170
|
typeof entry.logicalParentUuid !== "string") {
|
|
131
171
|
return entry;
|
|
132
172
|
}
|
|
173
|
+
const logical = entry.logicalParentUuid;
|
|
174
|
+
const parentUuid = recordParentUuid({ ...entry, parentUuid: null }, positions) ?? logical;
|
|
175
|
+
if (parentUuid !== logical) {
|
|
176
|
+
logger?.log(`The compaction ${entry.uuid} of session ${sessionId} follows message ${logical}, which is not in the transcript: linking it to the last preserved message ${parentUuid}`);
|
|
177
|
+
}
|
|
178
|
+
else if (!positions.has(logical) && !positions.has(preservedTail(entry))) {
|
|
179
|
+
logger?.error(`The compaction ${entry.uuid} of session ${sessionId} follows message ${logical}, which is not in the transcript: leaving out the history before it`);
|
|
180
|
+
}
|
|
133
181
|
const compactMetadata = typeof entry.compactMetadata === "object" && entry.compactMetadata !== null
|
|
134
182
|
? { ...entry.compactMetadata }
|
|
135
183
|
: {};
|
|
136
184
|
delete compactMetadata.preservedSegment;
|
|
137
185
|
delete compactMetadata.preservedMessages;
|
|
138
|
-
return { ...entry, parentUuid
|
|
186
|
+
return { ...entry, parentUuid, compactMetadata };
|
|
139
187
|
}
|
|
140
188
|
/**
|
|
141
189
|
* Read the resume model and the permission mode of a session from the end
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session-rewind.d.ts","sourceRoot":"","sources":["../src/session-rewind.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"session-rewind.d.ts","sourceRoot":"","sources":["../src/session-rewind.ts"],"names":[],"mappings":"AAsBA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACvB,MAAM,gCAAgC,CAAC;AAexC,eAAO,MAAM,qBAAqB,oBAAoB,CAAC;AAEvD,MAAM,MAAM,oBAAoB,GAAG;IACjC,SAAS,EAAE,MAAM,CAAC;IACl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G,IAAI,CAAA;CAAE,EACtE,OAAO,EAAE,SAAS,CAAC,EAAE,EACrB,WAAW,EAAE,WAAW,GAAG,SAAS,GACnC,CAAC,EAAE,CAKL;AAED,6EAA6E;AAC7E,MAAM,MAAM,WAAW,GAAG;IACxB,sDAAsD;IACtD,eAAe,EAAE,MAAM,CAAC;IACxB,iFAAiF;IACjF,iBAAiB,EAAE,MAAM,CAAC;CAC3B,CAAC;AAQF,4CAA4C;AAC5C,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAY3F;AAED;;;;;GAKG;AACH,wBAAsB,eAAe,CACnC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,EACf,OAAO,CAAC,EAAE;IAAE,UAAU,EAAE,MAAM,CAAA;CAAE,GAC/B,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CA+BlC;AAED,6CAA6C;AAC7C,wBAAsB,gBAAgB,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAGvE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,oBAAoB,CACxC,SAAS,EAAE,MAAM,EACjB,MAAM,CAAC,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAuB7B"}
|
package/dist/session-rewind.js
CHANGED
|
@@ -26,7 +26,7 @@ import { appendFile, mkdir, readFile, rename, rm, writeFile } from "node:fs/prom
|
|
|
26
26
|
import path from "node:path";
|
|
27
27
|
import { isCompactSummaryMessage } from "./context-compaction.js";
|
|
28
28
|
import { isReplayHiddenMetaMessage } from "./message-filters.js";
|
|
29
|
-
import { findTranscript, loadFullSessionHistory, readHistoryAcrossCompactions, } from "./resumed-session.js";
|
|
29
|
+
import { findTranscript, loadFullSessionHistory, readHistoryAcrossCompactions, recordParentUuid, recordPositions, } from "./resumed-session.js";
|
|
30
30
|
import { cursorMessageId, forkPointOf } from "./session-cursors.js";
|
|
31
31
|
export const SESSION_REWIND_METHOD = "_session/rewind";
|
|
32
32
|
export function parseSessionRewindRequest(params) {
|
|
@@ -221,10 +221,11 @@ export async function withoutRewoundBranch(sessionId, entries, logger) {
|
|
|
221
221
|
if (!point)
|
|
222
222
|
return entries;
|
|
223
223
|
const dropped = new Set([point.droppedPromptUuid]);
|
|
224
|
+
const positions = recordPositions(entries);
|
|
224
225
|
return entries.filter((entry) => {
|
|
225
226
|
if (typeof entry.uuid !== "string")
|
|
226
227
|
return true;
|
|
227
|
-
const parent = entry
|
|
228
|
+
const parent = recordParentUuid(entry, positions);
|
|
228
229
|
const inDropped = entry.uuid === point.droppedPromptUuid || (typeof parent === "string" && dropped.has(parent));
|
|
229
230
|
if (inDropped)
|
|
230
231
|
dropped.add(entry.uuid);
|
|
@@ -338,7 +339,7 @@ export async function prepareRewoundResume(sessionId, logger) {
|
|
|
338
339
|
const newest = newestMainChainUuid(history);
|
|
339
340
|
if (!newest)
|
|
340
341
|
return undefined;
|
|
341
|
-
const active = chainUuids(newest, byUuid);
|
|
342
|
+
const active = chainUuids(newest, history, byUuid);
|
|
342
343
|
const pending = isPending(point, history, active);
|
|
343
344
|
const leaf = pending ? point.resumeSessionAt : newest;
|
|
344
345
|
await markResumedLeaf(sessionId, history, byUuid, leaf, pending);
|
|
@@ -391,7 +392,7 @@ async function markResumedLeaf(sessionId, history, byUuid, leaf, explicit) {
|
|
|
391
392
|
continue;
|
|
392
393
|
}
|
|
393
394
|
}
|
|
394
|
-
const branch = chainUuids(leaf, byUuid);
|
|
395
|
+
const branch = chainUuids(leaf, history, byUuid);
|
|
395
396
|
const lastPrompt = history
|
|
396
397
|
.filter((entry) => branch.has(entry.uuid) && entry.type === "user")
|
|
397
398
|
.map(promptText)
|
|
@@ -443,9 +444,11 @@ function newestMainChainUuid(entries) {
|
|
|
443
444
|
CHAIN_ENTRY_TYPES.has(entry.type) &&
|
|
444
445
|
isMainChainEntry(entry))?.uuid;
|
|
445
446
|
}
|
|
446
|
-
/** The uuids of `leaf` and of every entry it descends from. A
|
|
447
|
-
* boundary has no `parentUuid`;
|
|
448
|
-
|
|
447
|
+
/** The uuids of `leaf` and of every entry of `history` it descends from. A
|
|
448
|
+
* compaction boundary has no `parentUuid`; the message before the compaction
|
|
449
|
+
* carries the chain on (see `recordParentUuid`). */
|
|
450
|
+
function chainUuids(leaf, history, byUuid) {
|
|
451
|
+
const positions = recordPositions(history);
|
|
449
452
|
const chain = new Set();
|
|
450
453
|
let cursor = leaf;
|
|
451
454
|
while (cursor && !chain.has(cursor)) {
|
|
@@ -453,8 +456,7 @@ function chainUuids(leaf, byUuid) {
|
|
|
453
456
|
if (!entry)
|
|
454
457
|
break;
|
|
455
458
|
chain.add(cursor);
|
|
456
|
-
|
|
457
|
-
cursor = typeof parent === "string" ? parent : undefined;
|
|
459
|
+
cursor = recordParentUuid(entry, positions);
|
|
458
460
|
}
|
|
459
461
|
return chain;
|
|
460
462
|
}
|
package/package.json
CHANGED