import { type Api, type ImageContent, type Model, type Models, type Usage } from "@earendil-works/pi-ai"; import type { AgentMessage, ThinkingLevel } from "../../types.ts"; import type { AbortRequestResult, AbortResult, AgentLane, CancelQueuedResult, CompactionResult, DriveOptions, DriveResult, HarnessEvent, LaneExecutionInfo, LaneSnapshot, ModelIdentity, NavigationResult, OperationAdmissionResult, OperationRequest, QueueResult, RecordUsageResult, ResumeResult, RunResult, WatchHandle } from "../agent-harness.ts"; import { type Context } from "../context.ts"; import type { HookRegistry } from "../hooks.ts"; import { OperationMismatch } from "../result.ts"; import type { BranchScan, Entry, JsonValue, OperationMeta, OperationResultRecord, OperationState, Session, SessionReader } from "../session/types.ts"; import { type Config, type ContinueOperationResult, Drive, type LaneCommand, type LaneState, type OperationCommand } from "./types.ts"; type EmitBatch = (events: readonly HarnessEvent[], context: Context) => Promise; type WatchHandler = (snapshot: T, filter: (event: HarnessEvent) => boolean, context: Context, resnapshot: (context: Context, markBoundary: () => void) => Promise) => WatchHandle; type FaultHandler = (cause: unknown, context: Context) => Error; /** Runtime implementation of one configured lane. */ export declare class Lane implements AgentLane { readonly name: string; readonly session: Session; readonly models: Models; readonly hooks: HookRegistry; readonly emitBatch: EmitBatch; private readonly onFault; private readonly installWatch; private readonly config; private stateChange; private resolveStateChange; private idleOwner; /** Package-internal drive owner. Public only because deterministic procedure tests install exact owners directly. */ activeDrive: Drive | undefined; /** Authoritative live control projection while this harness owns the Session. */ state: LaneState; closedError: Error | undefined; constructor(name: string, session: Session, models: Models, hooks: HookRegistry, state: LaneState, onFault: FaultHandler, emitBatch: EmitBatch, installWatch: WatchHandler, readConfig: () => Config); getTipId(_context: Context): Promise; getResult(operationId: string, context: Context): Promise; readConfig(): Config; mismatch(expected: string, currentOperationId: string | null, lastOperationId: string | null): OperationMismatch; private readLane; command(plan: (state: LaneState, reader: SessionReader) => LaneCommand | Promise>, context: Context): Promise; /** * Run a command against the current operation even after cancellation is requested. Use this to settle admitted * effects, finish the operation, or update concurrent child state. The capability narrows the planner's state type; * the Drive continuation remains the sole top-level state writer. */ settleOperation(_capability: TState, plan: (state: LaneState, current: TState, meta: OperationMeta, reader: SessionReader) => OperationCommand | Promise>, context: Context): Promise; /** * Run an ordinary operation command only while durable control is running. Use this before starting new hooks, * effects, or forward progress. Returns `cancel_requested` without invoking the planner once cancellation is requested. */ continueOperation(capability: TState, plan: (state: LaneState, current: TState, meta: OperationMeta, reader: SessionReader) => OperationCommand | Promise>, context: Context): Promise>; accept(request: OperationRequest, context: Context): Promise; private acceptRun; private acceptCompaction; private acceptNavigation; drive(options: DriveOptions, context: Context): Promise; /** Package-private durable cancellation primitive. Public exposure remains guarded until M8. */ requestOperationAbort(operationId: string, context: Context): Promise; requestAbort(operationId: string, context: Context): Promise; inspectExecution(context: Context): Promise; prompt(...args: [text: string, images: ImageContent[] | undefined, context: Context] | [message: AgentMessage | AgentMessage[], context: Context]): Promise; skill(name: string, additionalInstructions: string | undefined, context: Context): Promise; promptFromTemplate(name: string, args: string[] | undefined, context: Context): Promise; private driveRunRequest; compact(options: { customInstructions?: string; } | undefined, context: Context): Promise; navigateTree(targetId: string | null, options: Extract["options"], context: Context): Promise; private driveStructuralAdmission; private continueAfterStructural; resume(context: Context): Promise; abort(context: Context): Promise; steer(message: string | AgentMessage, images: ImageContent[] | undefined, context: Context): Promise; followUp(message: string | AgentMessage, images: ImageContent[] | undefined, context: Context): Promise; nextRun(message: string | AgentMessage, images: ImageContent[] | undefined, context: Context): Promise; private enqueue; cancelQueued(entryId: string, context: Context): Promise; recordUsage(usage: Usage, options: { entryId?: string; details?: JsonValue; } | undefined, context: Context): Promise; waitForIdle(context: Context): Promise; runWhenIdle(callback: (context: Context) => void | Promise, context: Context): Promise; getModel(_context: Context): Promise | undefined>; setModel(model: ModelIdentity, context: Context): Promise; getThinkingLevel(_context: Context): Promise; setThinkingLevel(thinkingLevel: ThinkingLevel, context: Context): Promise; getActiveTools(_context: Context): Promise; setActiveTools(activeToolNames: string[], context: Context): Promise; watch(context: Context): Promise>; private captureLaneSnapshot; private setConfiguration; findEntries(query: BranchScan | undefined, context: Context): Promise; findEntry(query: BranchScan | undefined, context: Context): Promise; appendMessage(message: AgentMessage, context: Context): Promise; appendCustomEntry(customType: string, data: JsonValue | undefined, context: Context): Promise; private append; seal(error: Error): Promise; private signalStateChange; assertOpen(): void; } export {}; //# sourceMappingURL=lane.d.ts.map