import type { JsonValue } from "../state/json.js"; import type { WorkflowSettingsScopeRecord } from "../workflows/settings.js"; import { type InitializeWorkflowRunOptions, type WorkflowExecutionStore } from "../workflows/store.js"; import type { WorkflowTransition } from "../workflows/transitions.js"; import type { WorkflowDefinition, WorkflowEffectRecovery, WorkflowEffectReservation, WorkflowNotificationReceipt, WorkflowNotificationRequest, WorkflowRunState, WorkflowTraceEvent, WorkflowUpdateInput, WorkflowUpdateRecord } from "../workflows/types.js"; import type { WorkflowRunnerMessageKind, WorkflowRunnerStoreOperation } from "./workflow-runner-protocol.js"; export interface WorkflowRunnerStoreTransport { request(options: { messageId: string; operation: WorkflowRunnerStoreOperation; kind: WorkflowRunnerMessageKind; expectedRevision: number; attemptId?: string; payload: JsonValue; }): Promise<{ result?: JsonValue; revision?: number; }>; } /** A runner-side store that can only propose state changes to its server. */ export declare class ServerBackedWorkflowStore implements WorkflowExecutionStore { private readonly runId; private readonly transport; readonly databasePath = "server://pi-workflows-state"; private revision; constructor(runId: string, transport: WorkflowRunnerStoreTransport, initialRevision?: number); initializeRun(workflow: WorkflowDefinition, state: WorkflowRunState, options?: InitializeWorkflowRunOptions): Promise; prepareRunResume(runId: string): Promise; readRunState(runId: string): Promise; commitTransition(runId: string, transition: WorkflowTransition): Promise; publishUpdate(runId: string, nodeId: string, attemptId: string, update: WorkflowUpdateInput): Promise<{ event: WorkflowTraceEvent; record: WorkflowUpdateRecord; }>; findSettingsScope(runId: string, mountPath: string, invocation: number): Promise; ensureSettingsScope(options: { runId: string; mountPath: string; invocation: number; settings: JsonValue; }): Promise; getSettingsScopeAtChange(scopeId: string, changeNumber: number): Promise; readCheckpoint(runId: string, attemptId: string): Promise; reserveEffect(options: { runId: string; attemptId: string; effectType: string; idempotencyKey: string; request: JsonValue; recovery: WorkflowEffectRecovery; }): Promise; settleEffect(options: { runId: string; effectId: string; attemptNumber: number; outcome: "applied" | "rejected" | "ambiguous" | "cancelled"; result?: JsonValue; error?: string; }): Promise; requestInteraction(options: { attemptId: string; kind: "agent" | "assistant" | "decision"; contract: JsonValue; }): Promise; acceptInteraction(options: { requestId: string; submissionId: string; attemptId: string; value: JsonValue; }): Promise; rejectInteraction(options: { requestId: string; submissionId: string; attemptId: string; error: string; }): Promise; requestNotification(request: WorkflowNotificationRequest): Promise; private call; }