mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-16 23:01:56 +00:00
Simplify compaction: remove proactive abort, use Agent.continue() for retry
- Add agentLoopContinue() to pi-ai for resuming from existing context - Add Agent.continue() method and transport.continue() interface - Simplify AgentSession compaction to two cases: overflow (auto-retry) and threshold (no retry) - Remove proactive mid-turn compaction abort - Merge turn prefix summary into main summary - Add isCompacting property to AgentSession and RPC state - Block input during compaction in interactive mode - Show compaction count on session resume - Rename RPC.md to rpc.md for consistency Related to #128
This commit is contained in:
parent
d67c69c6e9
commit
5a9d844f9a
27 changed files with 1261 additions and 1011 deletions
|
|
@ -50,8 +50,6 @@ export interface CompactionEntry {
|
|||
type: "compaction";
|
||||
timestamp: string;
|
||||
summary: string;
|
||||
/** Summary of turn prefix when a turn was split (user message to first kept message) */
|
||||
turnPrefixSummary?: string;
|
||||
firstKeptEntryIndex: number; // Index into session entries where we start keeping
|
||||
tokensBefore: number;
|
||||
}
|
||||
|
|
@ -180,18 +178,9 @@ export function loadSessionFromEntries(entries: SessionEntry[]): LoadedSession {
|
|||
}
|
||||
}
|
||||
|
||||
// Build final messages: summaries + kept messages
|
||||
// Build final messages: summary + kept messages
|
||||
const messages: AppMessage[] = [];
|
||||
|
||||
// Add history summary
|
||||
messages.push(createSummaryMessage(compactionEvent.summary));
|
||||
|
||||
// Add turn prefix summary if present (when a turn was split)
|
||||
if (compactionEvent.turnPrefixSummary) {
|
||||
messages.push(createSummaryMessage(compactionEvent.turnPrefixSummary));
|
||||
}
|
||||
|
||||
// Add kept messages
|
||||
messages.push(...keptMessages);
|
||||
|
||||
return { messages, thinkingLevel, model };
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue