import type { EventBus } from '../kernel/events.js'; import type { ConversationState } from '../core/conversation-state.js'; /** * Plan items are the strategic counterpart to todos. Where `ctx.todos` * is the moment-to-moment task board the LLM mutates per-turn, a plan * captures the higher-level approach — the steps the user (or LLM) * laid out before any work began. * * Plans persist by default (per session) so a resumed session can show * "you were on step 3 of 5". Todos are derived/transient. Both can * coexist: think roadmap (plan) vs. sprint board (todos). */ export interface PlanItem { id: string; title: string; /** Optional longer-form context or rationale. */ details?: string | undefined; status: 'open' | 'in_progress' | 'done'; createdAt: string; updatedAt: string; } export interface PlanFile { version: 1; sessionId: string; title?: string | undefined; updatedAt: string; items: PlanItem[]; } export declare function loadPlan(filePath: string, events?: EventBus): Promise; /** * Persist a plan. Returns `true` on success, `false` if the write failed * (still emits `storage.error` + warns — it does NOT throw, so callers that * treat a lost plan-save as non-fatal keep working). `mutatePlan` inspects the * result and throws so the plan TOOL can report `ok:false` instead of falsely * claiming the plan was persisted. */ export declare function savePlan(filePath: string, plan: PlanFile, events?: EventBus, warn?: (msg: string) => void): Promise; /** Create a new PlanFile when none exists on disk. */ export declare function emptyPlan(sessionId: string, title?: string): PlanFile; export declare function addPlanItem(plan: PlanFile, title: string, details?: string | undefined): { plan: PlanFile; item: PlanItem; }; export declare function removePlanItem(plan: PlanFile, idOrIndex: string): PlanFile; export declare function setPlanItemStatus(plan: PlanFile, idOrIndex: string, status: PlanItem['status']): PlanFile; export declare function clearPlan(plan: PlanFile): PlanFile; /** Render the plan as a short markdown-ish string suitable for slash output. */ export declare function formatPlan(plan: PlanFile): string; /** * Promote a plan item to a set of todo items. * The plan item is marked 'in_progress' (if not already done) and its * title + details become the first todo; additional subtasks are appended. * Returns the derived todo list so the caller can pass it to `todoTool` * or `ctx.state.replaceTodos()`. */ export declare function deriveTodosFromPlanItem(plan: PlanFile, idOrIndex: string, subtasks?: string[] | undefined): { plan: PlanFile; todos: Array<{ id: string; content: string; status: 'pending' | 'in_progress' | 'completed'; activeForm?: string | undefined; promotedFromPlan?: string | undefined; }>; } | null; /** * Load, modify, and save the plan file under a file-level lock. * Prevents races from parallel tool invocations (e.g. batch_tool_use). */ export declare function mutatePlan(filePath: string, sessionId: string, fn: (plan: PlanFile) => PlanFile | Promise): Promise; /** * Optional: attach a state-listener so meta operations (storing a plan * id on ctx.meta) trigger a save. Currently a stub — plans don't live * on Context, but this keeps the API surface symmetric with the todos * checkpoint so future refactors can flip plans into Context if needed. */ export declare function attachPlanCheckpoint(_state: ConversationState, _filePath: string, _sessionId: string): () => void; //# sourceMappingURL=plan-store.d.ts.map