mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-18 19:03:41 +00:00
Add ReadonlySessionManager and refactor branch summarization
- Add ReadonlySessionManager interface to session-manager.ts - Re-export from hooks/index.ts - Add collectEntriesForBranchSummary() to extract entries for summarization - Don't stop at compaction boundaries (include their summaries as context) - Add token budget support to prepareBranchEntries() - Walk entries newest-to-oldest to prioritize recent context - Use options object for generateBranchSummary() - Handle compaction entries as context summaries - Export new types: CollectEntriesResult, GenerateBranchSummaryOptions
This commit is contained in:
parent
5cbaf2be88
commit
08fab16e2d
5 changed files with 191 additions and 79 deletions
|
|
@ -155,6 +155,20 @@ export interface SessionInfo {
|
|||
allMessagesText: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* Read-only interface for SessionManager.
|
||||
* Used by compaction/summarization utilities that only need to read session data.
|
||||
*/
|
||||
export interface ReadonlySessionManager {
|
||||
getLeafId(): string | null;
|
||||
getEntry(id: string): SessionEntry | undefined;
|
||||
getPath(fromId?: string): SessionEntry[];
|
||||
getEntries(): SessionEntry[];
|
||||
getChildren(parentId: string): SessionEntry[];
|
||||
getTree(): SessionTreeNode[];
|
||||
getLabel(id: string): string | undefined;
|
||||
}
|
||||
|
||||
/** Generate a unique short ID (8 hex chars, collision-checked) */
|
||||
function generateId(byId: { has(id: string): boolean }): string {
|
||||
for (let i = 0; i < 100; i++) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue