Skip to content

@codesoul-co/hypha-core / contracts/runtime-checkpoint

Using this module

Use the Runtime checkpoint module for declaring and runtime-validating contracts. It exports 4 constants, 8 interfaces, 4 types.

Import from the package entrypoint

ts
import {
  RUNTIME_CHECKPOINT_COMPRESSIONS,
  RUNTIME_CHECKPOINT_DISPOSITIONS,
  RUNTIME_CHECKPOINT_MODES,
  RUNTIME_CHECKPOINT_REASONS,
} from '@codesoul-co/hypha-core';

import type {
  RuntimeCheckpointCreateCommand,
  RuntimeCheckpointCreateResult,
  RuntimeCheckpointLoadRequest,
  RuntimeCheckpointLoadResult,
  RuntimeCheckpointPolicySpec,
  RuntimeCheckpointPutResult,
  RuntimeCheckpointRecord,
  RuntimeCheckpointStore,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

  • Use the 12 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The 4 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Public exports

SymbolKindSignatureDescription
RUNTIME_CHECKPOINT_COMPRESSIONSconstantconst RUNTIME_CHECKPOINT_COMPRESSIONS: readonly ["none", "gzip", "zstd"]RUNTIME CHECKPOINT COMPRESSIONS constant exported by the contracts/runtime-checkpoint module.
RUNTIME_CHECKPOINT_DISPOSITIONSconstantconst RUNTIME_CHECKPOINT_DISPOSITIONS: readonly ["applied", "reused", "lease_unavailable"]RUNTIME CHECKPOINT DISPOSITIONS constant exported by the contracts/runtime-checkpoint module.
RUNTIME_CHECKPOINT_MODESconstantconst RUNTIME_CHECKPOINT_MODES: readonly ["none", "state_boundary", "every_n_events", "wait_boundary", "custom"]RUNTIME CHECKPOINT MODES constant exported by the contracts/runtime-checkpoint module.
RUNTIME_CHECKPOINT_REASONSconstantconst RUNTIME_CHECKPOINT_REASONS: readonly ["state_boundary", "human_wait", "signal_wait", "timer_wait", "manual", "failure"]RUNTIME CHECKPOINT REASONS constant exported by the contracts/runtime-checkpoint module.
RuntimeCheckpointCreateCommandinterfaceinterface RuntimeCheckpointCreateCommandRuntime Checkpoint Create Command interface with 15 public fields or methods.
RuntimeCheckpointCreateResultinterfaceinterface RuntimeCheckpointCreateResultRuntime Checkpoint Create Result interface with 4 public fields or methods.
RuntimeCheckpointLoadRequestinterfaceinterface RuntimeCheckpointLoadRequestRuntime Checkpoint Load Request interface with 3 public fields or methods.
RuntimeCheckpointLoadResultinterfaceinterface RuntimeCheckpointLoadResultRuntime Checkpoint Load Result interface with 4 public fields or methods.
RuntimeCheckpointPolicySpecinterfaceinterface RuntimeCheckpointPolicySpecRuntime Checkpoint Policy Spec interface with 6 public fields or methods.
RuntimeCheckpointPutResultinterfaceinterface RuntimeCheckpointPutResultRuntime Checkpoint Put Result interface with 2 public fields or methods.
RuntimeCheckpointRecordinterfaceinterface RuntimeCheckpointRecordRuntime Checkpoint Record interface with 20 public fields or methods.
RuntimeCheckpointStoreinterfaceinterface RuntimeCheckpointStoreRuntime Checkpoint Store interface with 4 public fields or methods.
RuntimeCheckpointCompressiontypetype RuntimeCheckpointCompression = (typeof RUNTIME_CHECKPOINT_COMPRESSIONS)[number]Public type alias for Runtime Checkpoint Compression; the declaration contains its complete type expression.
RuntimeCheckpointDispositiontypetype RuntimeCheckpointDisposition = (typeof RUNTIME_CHECKPOINT_DISPOSITIONS)[number]Public type alias for Runtime Checkpoint Disposition; the declaration contains its complete type expression.
RuntimeCheckpointModetypetype RuntimeCheckpointMode = (typeof RUNTIME_CHECKPOINT_MODES)[number]Public type alias for Runtime Checkpoint Mode; the declaration contains its complete type expression.
RuntimeCheckpointReasontypetype RuntimeCheckpointReason = (typeof RUNTIME_CHECKPOINT_REASONS)[number]Public type alias for Runtime Checkpoint Reason; the declaration contains its complete type expression.

RUNTIME_CHECKPOINT_COMPRESSIONS

RUNTIME CHECKPOINT COMPRESSIONS constant exported by the contracts/runtime-checkpoint module.

Declaration

text
export declare const RUNTIME_CHECKPOINT_COMPRESSIONS: readonly ["none", "gzip", "zstd"];

RUNTIME_CHECKPOINT_DISPOSITIONS

RUNTIME CHECKPOINT DISPOSITIONS constant exported by the contracts/runtime-checkpoint module.

Declaration

text
export declare const RUNTIME_CHECKPOINT_DISPOSITIONS: readonly ["applied", "reused", "lease_unavailable"];

RUNTIME_CHECKPOINT_MODES

RUNTIME CHECKPOINT MODES constant exported by the contracts/runtime-checkpoint module.

Declaration

text
export declare const RUNTIME_CHECKPOINT_MODES: readonly ["none", "state_boundary", "every_n_events", "wait_boundary", "custom"];

RUNTIME_CHECKPOINT_REASONS

RUNTIME CHECKPOINT REASONS constant exported by the contracts/runtime-checkpoint module.

Declaration

text
export declare const RUNTIME_CHECKPOINT_REASONS: readonly ["state_boundary", "human_wait", "signal_wait", "timer_wait", "manual", "failure"];

RuntimeCheckpointCreateCommand

Runtime Checkpoint Create Command interface with 15 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeCheckpointCreateCommand } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-checkpoint

Declaration

text
export interface RuntimeCheckpointCreateCommand {
    checkpointId: string;
    scope: RuntimeScope;
    ownerId: string;
    leaseTtlMs: number;
    workflowRevision: string;
    processHash: string;
    variablesHash: string;
    dependencySnapshotRef: string;
    toolContractSnapshotRef?: string;
    workspaceSnapshotRef?: string;
    contextSnapshotRefs?: string[];
    reason: RuntimeCheckpointReason;
    createdAt: string;
    idempotencyKey?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

Contract members

MemberKindSignatureDescription
checkpointIdpropertycheckpointId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contextSnapshotRefspropertycontextSnapshotRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
dependencySnapshotRefpropertydependencySnapshotRef: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idempotencyKeypropertyidempotencyKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
leaseTtlMspropertyleaseTtlMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, RuntimeJsonValue>Public property; its type, readonly modifier and optionality are shown in the signature.
ownerIdpropertyownerId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
processHashpropertyprocessHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: "manual" | "state_boundary" | "human_wait" | "signal_wait" | "timer_wait" | "failure"Public property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RuntimeScopePublic property; its type, readonly modifier and optionality are shown in the signature.
toolContractSnapshotRefpropertytoolContractSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
variablesHashpropertyvariablesHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workflowRevisionpropertyworkflowRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceSnapshotRefpropertyworkspaceSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointCreateResult

Runtime Checkpoint Create Result interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeCheckpointCreateResult } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-checkpoint

Declaration

text
export interface RuntimeCheckpointCreateResult {
    checkpointId: string;
    disposition: RuntimeCheckpointDisposition;
    eventIds: string[];
    record?: RuntimeCheckpointRecord;
}

Contract members

MemberKindSignatureDescription
checkpointIdpropertycheckpointId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
dispositionpropertydisposition: "applied" | "reused" | "lease_unavailable"Public property; its type, readonly modifier and optionality are shown in the signature.
eventIdspropertyeventIds: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
recordpropertyrecord?: RuntimeCheckpointRecordPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointLoadRequest

Runtime Checkpoint Load Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeCheckpointLoadRequest } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-checkpoint

Declaration

text
export interface RuntimeCheckpointLoadRequest {
    scope: RuntimeScope;
    checkpointId?: string;
    checkedAt: string;
}

Contract members

MemberKindSignatureDescription
checkedAtpropertycheckedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
checkpointIdpropertycheckpointId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RuntimeScopePublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointLoadResult

Runtime Checkpoint Load Result interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeCheckpointLoadResult } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-checkpoint

Declaration

text
export interface RuntimeCheckpointLoadResult {
    record: RuntimeCheckpointRecord;
    currentHeadSequence: number;
    deltaFromSequence: number;
    deltaEventCount: number;
}

Contract members

MemberKindSignatureDescription
currentHeadSequencepropertycurrentHeadSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
deltaEventCountpropertydeltaEventCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
deltaFromSequencepropertydeltaFromSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
recordpropertyrecord: RuntimeCheckpointRecordPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointPolicySpec

Runtime Checkpoint Policy Spec interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeCheckpointPolicySpec } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-checkpoint

Declaration

text
export interface RuntimeCheckpointPolicySpec {
    mode: RuntimeCheckpointMode;
    everyNEvents?: number;
    retainLast?: number;
    persistWorkspaceSnapshot?: boolean;
    persistContextRefs?: boolean;
    compression?: RuntimeCheckpointCompression;
}

Contract members

MemberKindSignatureDescription
compressionpropertycompression?: "none" | "gzip" | "zstd"Public property; its type, readonly modifier and optionality are shown in the signature.
everyNEventspropertyeveryNEvents?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
modepropertymode: "none" | "custom" | "state_boundary" | "every_n_events" | "wait_boundary"Public property; its type, readonly modifier and optionality are shown in the signature.
persistContextRefspropertypersistContextRefs?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
persistWorkspaceSnapshotpropertypersistWorkspaceSnapshot?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
retainLastpropertyretainLast?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointPutResult

Runtime Checkpoint Put Result interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { RuntimeCheckpointPutResult } from '@codesoul-co/hypha-core';
  • Source module: contracts/runtime-checkpoint

Declaration

text
export interface RuntimeCheckpointPutResult {
    record: RuntimeCheckpointRecord;
    reused: boolean;
}

Contract members

MemberKindSignatureDescription
recordpropertyrecord: RuntimeCheckpointRecordPublic property; its type, readonly modifier and optionality are shown in the signature.
reusedpropertyreused: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointRecord

Runtime Checkpoint Record interface with 20 public fields or methods.

Declaration

text
export interface RuntimeCheckpointRecord {
    id: string;
    scope: RuntimeScope;
    sequence: number;
    workflowRevision: string;
    processHash: string;
    currentState: string;
    variablesHash: string;
    projectionVersion: string;
    projectionSnapshot: RuntimeOrchestrationProjection;
    dependencySnapshotRef: string;
    toolContractSnapshotRef?: string;
    workspaceSnapshotRef?: string;
    contextSnapshotRefs?: string[];
    pendingWaitRef?: string;
    lastEventSequence: number;
    reason: RuntimeCheckpointReason;
    requestHash: string;
    checksum: string;
    createdAt: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

Contract members

MemberKindSignatureDescription
checksumpropertychecksum: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contextSnapshotRefspropertycontextSnapshotRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
currentStatepropertycurrentState: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
dependencySnapshotRefpropertydependencySnapshotRef: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lastEventSequencepropertylastEventSequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, RuntimeJsonValue>Public property; its type, readonly modifier and optionality are shown in the signature.
pendingWaitRefpropertypendingWaitRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
processHashpropertyprocessHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
projectionSnapshotpropertyprojectionSnapshot: RuntimeOrchestrationProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
projectionVersionpropertyprojectionVersion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason: "manual" | "state_boundary" | "human_wait" | "signal_wait" | "timer_wait" | "failure"Public property; its type, readonly modifier and optionality are shown in the signature.
requestHashpropertyrequestHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope: RuntimeScopePublic property; its type, readonly modifier and optionality are shown in the signature.
sequencepropertysequence: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
toolContractSnapshotRefpropertytoolContractSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
variablesHashpropertyvariablesHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workflowRevisionpropertyworkflowRevision: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceSnapshotRefpropertyworkspaceSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

RuntimeCheckpointStore

Runtime Checkpoint Store interface with 4 public fields or methods.

Declaration

text
export interface RuntimeCheckpointStore {
    put(record: RuntimeCheckpointRecord, idempotencyKey: string): Promise<RuntimeCheckpointPutResult>;
    get(scope: RuntimeScope, checkpointId: string): Promise<RuntimeCheckpointRecord | null>;
    latest(scope: RuntimeScope): Promise<RuntimeCheckpointRecord | null>;
    list(scope: RuntimeScope, limit?: number): Promise<RuntimeCheckpointRecord[]>;
}

Contract members

MemberKindSignatureDescription
getmethodget(scope: RuntimeScope, checkpointId: string): Promise<RuntimeCheckpointRecord | null>Public method; parameters and return type are shown in the signature.
latestmethodlatest(scope: RuntimeScope): Promise<RuntimeCheckpointRecord | null>Public method; parameters and return type are shown in the signature.
listmethodlist(scope: RuntimeScope, limit?: number): Promise<RuntimeCheckpointRecord[]>Public method; parameters and return type are shown in the signature.
putmethodput(record: RuntimeCheckpointRecord, idempotencyKey: string): Promise<RuntimeCheckpointPutResult>Public method; parameters and return type are shown in the signature.

RuntimeCheckpointCompression

Public type alias for Runtime Checkpoint Compression; the declaration contains its complete type expression.

Declaration

text
export type RuntimeCheckpointCompression = (typeof RUNTIME_CHECKPOINT_COMPRESSIONS)[number];

RuntimeCheckpointDisposition

Public type alias for Runtime Checkpoint Disposition; the declaration contains its complete type expression.

Declaration

text
export type RuntimeCheckpointDisposition = (typeof RUNTIME_CHECKPOINT_DISPOSITIONS)[number];

RuntimeCheckpointMode

Public type alias for Runtime Checkpoint Mode; the declaration contains its complete type expression.

Declaration

text
export type RuntimeCheckpointMode = (typeof RUNTIME_CHECKPOINT_MODES)[number];

RuntimeCheckpointReason

Public type alias for Runtime Checkpoint Reason; the declaration contains its complete type expression.

Declaration

text
export type RuntimeCheckpointReason = (typeof RUNTIME_CHECKPOINT_REASONS)[number];