mirror of
https://github.com/getcompanion-ai/co-mono.git
synced 2026-04-15 19:05:11 +00:00
Fix branch summarization abort handling and tree navigation
- Check response.stopReason instead of catching errors for abort detection - Return result object from _generateBranchSummary instead of throwing - Fix summary attachment: attach to navigation target position, not old branch - Support root-level summaries (parentId=null) in branchWithSummary - Remove setTimeout hack for re-showing tree selector on abort
This commit is contained in:
parent
9dac0a1423
commit
01dae9ebcc
7 changed files with 55 additions and 40 deletions
|
|
@ -684,7 +684,7 @@ export class SessionManager {
|
|||
// Tree Traversal
|
||||
// =========================================================================
|
||||
|
||||
getLeafUuid(): string | null {
|
||||
getLeafId(): string | null {
|
||||
return this.leafId;
|
||||
}
|
||||
|
||||
|
|
@ -845,8 +845,8 @@ export class SessionManager {
|
|||
* Same as branch(), but also appends a branch_summary entry that captures
|
||||
* context from the abandoned conversation path.
|
||||
*/
|
||||
branchWithSummary(branchFromId: string, summary: string): string {
|
||||
if (!this.byId.has(branchFromId)) {
|
||||
branchWithSummary(branchFromId: string | null, summary: string): string {
|
||||
if (branchFromId !== null && !this.byId.has(branchFromId)) {
|
||||
throw new Error(`Entry ${branchFromId} not found`);
|
||||
}
|
||||
this.leafId = branchFromId;
|
||||
|
|
@ -855,7 +855,7 @@ export class SessionManager {
|
|||
id: generateId(this.byId),
|
||||
parentId: branchFromId,
|
||||
timestamp: new Date().toISOString(),
|
||||
fromId: branchFromId,
|
||||
fromId: branchFromId ?? "root",
|
||||
summary,
|
||||
};
|
||||
this._appendEntry(entry);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue