UNPKG

@sema-agent/core

Version:

Stateless, task-oriented AI agent core

26 lines (25 loc) • 1.69 kB
import { type WorkflowJournalStore } from "../workflow-journal-store.js"; import { type ContractAssertionRunner } from "./contract-harness.js"; /** * Optional backend-specific hooks for the #5156 R1 `stopResumeClaim` arm-(b) contract cases (aging a held claim past its expiry, * and — for backends that judge holder-process liveness — marking a held claim's process as gone). A backend that omits hooks * still clears arms (a), (c), (d) and the non-writing arm whenever it implements `stopResumeClaim`. */ export interface WorkflowJournalStoreContractHooks { /** Age a held claim on `(sourceRunId, scope)` past its expiry so arm (b) ("expired") runs on the real backend. * May return a cleanup callback (e.g. restoring a shifted clock), invoked in a `finally` after the stop call. */ readonly expireClaim?: (store: WorkflowJournalStore, key: { readonly sourceRunId: string; readonly scope: string; }) => Promise<void | (() => void)> | void | (() => void); /** Mark a held claim on `(sourceRunId, scope)` as published by a process proven gone on this host (file-store arm (b)). */ readonly markClaimHolderGone?: (store: WorkflowJournalStore, key: { readonly sourceRunId: string; readonly scope: string; }) => Promise<void> | void; } /** * The full cross-backend contract for {@link WorkflowJournalStore}. Every case builds its own store via * `make()`; with no runner the cases run sequentially and the first failure throws. */ export declare function workflowJournalStoreContract(make: () => WorkflowJournalStore, runAssertion?: ContractAssertionRunner, hooks?: WorkflowJournalStoreContractHooks): Promise<void>;