/** * Session-tree navigation (in-file branch switching + fork-selector reads). * * Extracted verbatim from agent-session.ts (god-file decomposition). `navigateTree` moves the leaf * to another node in the SAME session file (unlike fork(), which creates a new file), optionally * summarizing the abandoned branch via the model or an extension override. It owns no state: the * branch-summary abort controller stays on the session (also read by `isCompacting`) and is set/cleared * here through a dep so the session's abort/compacting surface is untouched. */ import type { Agent } from "@caupulican/pi-agent-core/agent"; import type { BranchSummaryEntry, SessionManager } from "@caupulican/pi-agent-core/session"; import type { Api, Model } from "@caupulican/pi-ai"; import type { ExtensionRunner } from "./extensions/index.ts"; import type { RequestAuth } from "./request-auth.ts"; import type { SettingsManager } from "./settings-manager.ts"; export interface SessionTreeNavigatorDeps { /** Session log — leaf/branch reads and writes go through this. */ getSessionManager(): SessionManager; /** Current model — required to run the default branch summarizer. */ getModel(): Model | undefined; /** Extension runner — `session_before_tree`/`session_tree` hooks fire here. */ getExtensionRunner(): ExtensionRunner; /** Resolve request auth for the summarizer call (session-owned, also used by compaction). */ getRequiredRequestAuth(model: Model): Promise; /** Settings — branch-summary reserve tokens. */ getSettingsManager(): SettingsManager; /** The underlying agent — the rebuilt message view is assigned to `agent.state.messages`. */ getAgent(): Agent; /** Store/clear the in-flight branch-summary abort controller on the session (read by isCompacting). */ setBranchSummaryAbort(controller: AbortController | undefined): void; } export declare class SessionTreeNavigator { private readonly deps; constructor(deps: SessionTreeNavigatorDeps); /** * 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?: { summarize?: boolean; customInstructions?: string; replaceInstructions?: boolean; label?: string; }): Promise<{ editorText?: string; cancelled: boolean; aborted?: boolean; summaryEntry?: BranchSummaryEntry; }>; /** * Get all user messages from session for fork selector. */ getUserMessagesForForking(): Array<{ entryId: string; text: string; }>; private _extractUserMessageText; } //# sourceMappingURL=session-tree-navigator.d.ts.map