mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
Add fromHook field to CompactionEntry and BranchSummaryEntry
- fromHook: true = hook generated, skip file extraction - fromHook: undefined/false = pi generated, extract files (backward compatible) - branchWithSummary now accepts fromHook parameter - File extraction only runs for !entry.fromHook entries
This commit is contained in:
parent
0445da666c
commit
f118cdc67b
3 changed files with 9 additions and 3 deletions
|
|
@ -64,6 +64,8 @@ export interface CompactionEntry<T = unknown> extends SessionEntryBase {
|
|||
tokensBefore: number;
|
||||
/** Hook-specific data (e.g., ArtifactIndex, version markers for structured compaction) */
|
||||
details?: T;
|
||||
/** True if generated by a hook, undefined/false if pi-generated (backward compatible) */
|
||||
fromHook?: boolean;
|
||||
}
|
||||
|
||||
export interface BranchSummaryEntry<T = unknown> extends SessionEntryBase {
|
||||
|
|
@ -72,6 +74,8 @@ export interface BranchSummaryEntry<T = unknown> extends SessionEntryBase {
|
|||
summary: string;
|
||||
/** Hook-specific data (not sent to LLM) */
|
||||
details?: T;
|
||||
/** True if generated by a hook, false if pi-generated */
|
||||
fromHook?: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -872,7 +876,7 @@ export class SessionManager {
|
|||
* Same as branch(), but also appends a branch_summary entry that captures
|
||||
* context from the abandoned conversation path.
|
||||
*/
|
||||
branchWithSummary(branchFromId: string | null, summary: string, details?: unknown): string {
|
||||
branchWithSummary(branchFromId: string | null, summary: string, details?: unknown, fromHook?: boolean): string {
|
||||
if (branchFromId !== null && !this.byId.has(branchFromId)) {
|
||||
throw new Error(`Entry ${branchFromId} not found`);
|
||||
}
|
||||
|
|
@ -885,6 +889,7 @@ export class SessionManager {
|
|||
fromId: branchFromId ?? "root",
|
||||
summary,
|
||||
details,
|
||||
fromHook,
|
||||
};
|
||||
this._appendEntry(entry);
|
||||
return entry.id;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue