Pass fromHook to appendCompaction for both manual and auto compaction
This commit is contained in:
@@ -965,7 +965,7 @@ export class AgentSession {
|
|||||||
throw new Error("Compaction cancelled");
|
throw new Error("Compaction cancelled");
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details);
|
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook);
|
||||||
const newEntries = this.sessionManager.getEntries();
|
const newEntries = this.sessionManager.getEntries();
|
||||||
const sessionContext = this.sessionManager.buildSessionContext();
|
const sessionContext = this.sessionManager.buildSessionContext();
|
||||||
this.agent.replaceMessages(sessionContext.messages);
|
this.agent.replaceMessages(sessionContext.messages);
|
||||||
@@ -1139,7 +1139,7 @@ export class AgentSession {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details);
|
this.sessionManager.appendCompaction(summary, firstKeptEntryId, tokensBefore, details, fromHook);
|
||||||
const newEntries = this.sessionManager.getEntries();
|
const newEntries = this.sessionManager.getEntries();
|
||||||
const sessionContext = this.sessionManager.buildSessionContext();
|
const sessionContext = this.sessionManager.buildSessionContext();
|
||||||
this.agent.replaceMessages(sessionContext.messages);
|
this.agent.replaceMessages(sessionContext.messages);
|
||||||
|
|||||||
@@ -641,7 +641,13 @@ export class SessionManager {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/** Append a compaction summary as child of current leaf, then advance leaf. Returns entry id. */
|
/** Append a compaction summary as child of current leaf, then advance leaf. Returns entry id. */
|
||||||
appendCompaction<T = unknown>(summary: string, firstKeptEntryId: string, tokensBefore: number, details?: T): string {
|
appendCompaction<T = unknown>(
|
||||||
|
summary: string,
|
||||||
|
firstKeptEntryId: string,
|
||||||
|
tokensBefore: number,
|
||||||
|
details?: T,
|
||||||
|
fromHook?: boolean,
|
||||||
|
): string {
|
||||||
const entry: CompactionEntry<T> = {
|
const entry: CompactionEntry<T> = {
|
||||||
type: "compaction",
|
type: "compaction",
|
||||||
id: generateId(this.byId),
|
id: generateId(this.byId),
|
||||||
@@ -651,6 +657,7 @@ export class SessionManager {
|
|||||||
firstKeptEntryId,
|
firstKeptEntryId,
|
||||||
tokensBefore,
|
tokensBefore,
|
||||||
details,
|
details,
|
||||||
|
fromHook,
|
||||||
};
|
};
|
||||||
this._appendEntry(entry);
|
this._appendEntry(entry);
|
||||||
return entry.id;
|
return entry.id;
|
||||||
|
|||||||
Reference in New Issue
Block a user