import type { CheckpointRestoreAudit } from "./checkpoint-restore.js"; import type { StoredAgentRunState } from "./agent-run-state.js"; import { Agent, AgentRunCheckpointMetadata, AgentRunResume, AgentRunState, AgentRunStateOptions, DecisionScope, Guardrails, NestedRunOutcome, PendingDecision, RunDecision, StickyDecision, ToolResult } from "./contracts.js"; import type { AgentIdentity } from "./identity.js"; /** Pending decisions of a suspended state, synthesizing the legacy single-approval shape. */ export declare function pendingDecisionsOf(state: StoredAgentRunState): readonly PendingDecision[] | undefined; /** * Transport-neutral shape validation for the complete `AgentRunResume` input (plan 020 Task 2). * Runs before any checkpoint read/write, agent resolution, subscription, or tool execution so * untyped callers (plain JavaScript, `as any`) cannot make resume fall through to approval or * crash with raw TypeErrors. State-dependent checks (foreign/stale/duplicate ids, scope, * schema, policy) stay in {@link resolveRunDecisions}. Errors never include tool arguments, * elicitation payloads, credentials, or foreign approval details. * * The legacy `decision` accepts `continue` (plan 084 Task 1) in addition to `approve`/`deny`; * it is a crash-recovery action for running-state checkpoints and is resolved in * `prepareAgentRunResume`, never as an approval outcome. */ export declare function assertValidAgentRunResume(resume: AgentRunResume): void; interface ResolvedRunDecisions { readonly decisionsById: ReadonlyMap; readonly stickyDecisions: readonly StickyDecision[]; readonly remaining: readonly PendingDecision[]; } /** * Validate one decision batch against the suspended state. Fail-closed and atomic: any * invalid entry rejects the whole batch before any CAS, leaving state and version untouched. * Unknown and foreign approval ids share one non-enumerating error. */ export declare function resolveRunDecisions(input: { readonly agent: Agent; readonly state: StoredAgentRunState; readonly decisions: readonly RunDecision[]; readonly signal?: AbortSignal; /** * Plan 104 T6: extra `tool_input` guardrails for decision-time revalidation of modified arguments — * the resumed session's restored pack rules. Session-scoped on purpose: `agent.config.guardrails` is * never mutated, so no other session of that agent inherits the packs. */ readonly guardrails?: Guardrails; }): Promise; /** * Resolve a tool's declared elicitation contract for a gated call. A throwing hook falls back to * plain tool approval: malformed model args then surface as a tool error after approval, never * as a run failure at the gate. Output is bounded before it enters the pending-decision record. */ export declare class AgentRunSuspended extends Error { readonly state: AgentRunState; readonly interruption: import("./contracts.js").AgentRunInterruption; readonly code = "ERR_PRISM_AGENT_RUN_SUSPENDED"; constructor(state: AgentRunState, interruption: import("./contracts.js").AgentRunInterruption); } /** Root-visible nested approval id: hashed so it stays bounded and non-enumerating at any depth. */ export declare function nestedApprovalId(runId: string, childApprovalId: string): string; export declare function pathsEqual(a: readonly string[] | undefined, b: readonly string[] | undefined): boolean; export declare function decisionScopesEqual(a: DecisionScope, b: DecisionScope): boolean; export declare function nestedOutcomeToolResult(outcome: Exclude, toolCallId: string, name: string): ToolResult; /** * Non-state extras carried into a resumed run: the sidecar metadata seed (so later checkpoint * writes preserve the record's map) and the restore audit emitted on `agent_resumed`. */ export interface ActiveDurableRunExtras { readonly checkpointMetadata?: AgentRunCheckpointMetadata; readonly restore?: CheckpointRestoreAudit; } export interface ActiveDurableRun extends ActiveDurableRunExtras { readonly options: AgentRunStateOptions; state?: StoredAgentRunState; version: number; /** Validated decisions driving the pending-call replay on a resumed run. */ readonly decisions?: ReadonlyMap; } /** Compact redacted principal reference used in decision scopes; never a credential. */ export declare function decisionIdentityRef(identity: AgentIdentity | undefined): string | undefined; export {};