/** * Tree-navigation controller for AgentSession. * * Handles navigating to a different node in the session tree (staying in the * same session file, unlike fork). When the user opts to summarize the * abandoned branch it runs the `session_before_tree` hook, generates a branch * summary (from an extension or the default summarizer), attaches it at the new * leaf, refreshes agent context, and emits `session_tree`. Owns the branch * summarization abort controller. Extracted from agent-session.ts behind a * narrow TreeNavigationControllerDeps interface. */ import type { AgentMessage } from "@kolisachint/hoocode-agent-core"; import type { Model } from "@kolisachint/hoocode-ai"; import type { ExtensionRunner } from "./extensions/index.js"; import type { BranchSummaryEntry, SessionManager } from "./session-manager.js"; import type { SettingsManager } from "./settings-manager.js"; /** Options for navigating the session tree. */ export interface NavigateTreeOptions { /** Whether the user wants to summarize the abandoned branch */ summarize?: boolean; /** Custom instructions for the summarizer */ customInstructions?: string; /** If true, customInstructions replaces the default prompt */ replaceInstructions?: boolean; /** Label to attach to the branch summary entry */ label?: string; } /** Result of navigating the session tree. */ export interface NavigateTreeResult { editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry; } /** Narrow dependencies the tree-navigation controller needs from AgentSession. */ export interface TreeNavigationControllerDeps { sessionManager: SessionManager; settingsManager: SettingsManager; getModel(): Model | undefined; /** Read at call time; the extension runner is swapped on reload. */ getExtensionRunner(): ExtensionRunner; getRequiredRequestAuth(model: Model): Promise<{ apiKey: string; headers?: Record; }>; setAgentMessages(messages: AgentMessage[]): void; } export declare class TreeNavigationController { private readonly deps; private _branchSummaryAbortController; constructor(deps: TreeNavigationControllerDeps); /** Whether branch summarization is currently running */ get isSummarizing(): boolean; /** Cancel in-progress branch summarization. */ abortBranchSummary(): void; /** * Navigate to a different node in the session tree. * Unlike fork() which creates a new session file, this stays in the same file. * * @param targetId The entry ID to navigate to * @param options.summarize Whether user wants to summarize abandoned branch * @param options.customInstructions Custom instructions for summarizer * @param options.replaceInstructions If true, customInstructions replaces the default prompt * @param options.label Label to attach to the branch summary entry * @returns Result with editorText (if user message) and cancelled status */ navigateTree(targetId: string, options?: NavigateTreeOptions): Promise; } //# sourceMappingURL=agent-session-tree-navigation.d.ts.map