import type { ResidentAgendaStore, ResidentPursuit } from './agenda.js'; import { type ResidentObservation, type ResidentSelection, type ResidentSelector } from './initiative.js'; import { type ResidentLearningState } from './learning.js'; import { type ResidentStep } from './loop.js'; import { type ResidentMessageInput } from './outbox.js'; import { type ResidentDecision } from './store.js'; /** @experimental Host result describes execution, not external-effect rollback. */ export interface ResidentHostResult { readonly status: 'idle' | 'paused' | 'unresolved' | 'cancelled' | 'limit' | 'contended'; readonly stepsSettled: number; readonly nextWakeAt: number | null; readonly selection?: ResidentSelection; } /** @experimental Explicit authorization to drive a finite number of background steps. */ export interface ResidentHostRunOptions { readonly signal: AbortSignal; readonly maxSteps: number; /** Maximum single idle wait; with keepAlive, also bounds local agenda polling. */ readonly maxIdleMs?: number; /** Keep waiting for useful work within this invocation's finite step cap. Default false. */ readonly keepAlive?: boolean; } /** @experimental Immutable context from the agenda snapshot that authorized this admission. */ export interface ResidentStepContext { readonly agendaRevision: number; readonly learning?: ResidentLearningState; } /** @experimental A developer callback may bind a different SDK turn for each pursuit. */ export type ResidentPursuitStep = (pursuit: ResidentPursuit, signal: AbortSignal) => ReturnType; /** @experimental Context-aware callback; existing two-argument steps remain assignable. */ export type ResidentContextualStep = (pursuit: ResidentPursuit, signal: AbortSignal, context: ResidentStepContext) => ReturnType; /** @experimental Inspect actual outcomes and resource receipts independently of model prose. */ export type ResidentObserver = (pursuit: ResidentPursuit, decision: ResidentDecision, signal: AbortSignal) => Promise; /** @experimental Host validates content and destination; null means no communication. */ export type ResidentMessageFactory = (pursuit: ResidentPursuit, decision: ResidentDecision, signal: AbortSignal) => Promise; /** @experimental Opt-in local selection, observed settlement and atomic outbound intent. */ export interface ResidentHostOptions { readonly select?: ResidentSelector; readonly observe?: ResidentObserver; readonly prepareMessage?: ResidentMessageFactory; /** Bind approved learning to the exact admission snapshot. Default false. */ readonly learning?: boolean; } /** * @experimental Local driver for one durable agenda. Shared agenda admission * prevents overlapping pursuits across processes. Notifications are local; * opt-in keepAlive also rereads durable state on bounded idle timers. */ export declare class ResidentHost { private readonly agenda; private readonly step; private controller; private active; private idle; private generation; private controls; private controlsPending; private readonly options; constructor(agenda: ResidentAgendaStore, step: ResidentContextualStep, options?: ResidentHostOptions); /** Interrupt local idle waiting after the host learns of new durable state. */ notify(): void; private snapshot; private paused; private control; /** * Signal current work and durably close future admission. Resolving this method * is NOT quiescence: await the turn promise before claiming the callback stopped. * An interrupted admitted pursuit remains unresolved until reconciled explicitly. */ pause(): Promise; /** Reauthorize future work only after this host's previous invocation drained. */ resume(): Promise; /** Persist fresh evidence and interrupt this host's idle timer. */ wake(id: string, reason: string): Promise; run(options: ResidentHostRunOptions): Promise; private drive; } //# sourceMappingURL=host.d.ts.map