@codesoul-co/hypha-core / contracts/runtime-checkpoint
模块用法
用于声明并运行时校验契约。Runtime checkpoint 模块公开 4 常量、8 接口、4 类型。
从包入口导入
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';
// 完整导出列表见下方。使用要点
- 12 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用
import type,运行时不应依赖它们。 - 4 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。
公共导出
| Symbol | 种类 | 签名 | 说明 |
|---|---|---|---|
RUNTIME_CHECKPOINT_COMPRESSIONS | 常量 | const RUNTIME_CHECKPOINT_COMPRESSIONS: readonly ["none", "gzip", "zstd"] | 由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT COMPRESSIONS 常量。 |
RUNTIME_CHECKPOINT_DISPOSITIONS | 常量 | const RUNTIME_CHECKPOINT_DISPOSITIONS: readonly ["applied", "reused", "lease_unavailable"] | 由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT DISPOSITIONS 常量。 |
RUNTIME_CHECKPOINT_MODES | 常量 | const RUNTIME_CHECKPOINT_MODES: readonly ["none", "state_boundary", "every_n_events", "wait_boundary", "custom"] | 由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT MODES 常量。 |
RUNTIME_CHECKPOINT_REASONS | 常量 | const RUNTIME_CHECKPOINT_REASONS: readonly ["state_boundary", "human_wait", "signal_wait", "timer_wait", "manual", "failure"] | 由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT REASONS 常量。 |
RuntimeCheckpointCreateCommand | 接口 | interface RuntimeCheckpointCreateCommand | Runtime Checkpoint Create Command 接口,共包含 15 个公开字段或方法。 |
RuntimeCheckpointCreateResult | 接口 | interface RuntimeCheckpointCreateResult | Runtime Checkpoint Create Result 接口,共包含 4 个公开字段或方法。 |
RuntimeCheckpointLoadRequest | 接口 | interface RuntimeCheckpointLoadRequest | Runtime Checkpoint Load Request 接口,共包含 3 个公开字段或方法。 |
RuntimeCheckpointLoadResult | 接口 | interface RuntimeCheckpointLoadResult | Runtime Checkpoint Load Result 接口,共包含 4 个公开字段或方法。 |
RuntimeCheckpointPolicySpec | 接口 | interface RuntimeCheckpointPolicySpec | Runtime Checkpoint Policy Spec 接口,共包含 6 个公开字段或方法。 |
RuntimeCheckpointPutResult | 接口 | interface RuntimeCheckpointPutResult | Runtime Checkpoint Put Result 接口,共包含 2 个公开字段或方法。 |
RuntimeCheckpointRecord | 接口 | interface RuntimeCheckpointRecord | Runtime Checkpoint Record 接口,共包含 20 个公开字段或方法。 |
RuntimeCheckpointStore | 接口 | interface RuntimeCheckpointStore | Runtime Checkpoint Store 接口,共包含 4 个公开字段或方法。 |
RuntimeCheckpointCompression | 类型 | type RuntimeCheckpointCompression = (typeof RUNTIME_CHECKPOINT_COMPRESSIONS)[number] | Runtime Checkpoint Compression 公共类型别名;完整类型表达式见声明。 |
RuntimeCheckpointDisposition | 类型 | type RuntimeCheckpointDisposition = (typeof RUNTIME_CHECKPOINT_DISPOSITIONS)[number] | Runtime Checkpoint Disposition 公共类型别名;完整类型表达式见声明。 |
RuntimeCheckpointMode | 类型 | type RuntimeCheckpointMode = (typeof RUNTIME_CHECKPOINT_MODES)[number] | Runtime Checkpoint Mode 公共类型别名;完整类型表达式见声明。 |
RuntimeCheckpointReason | 类型 | type RuntimeCheckpointReason = (typeof RUNTIME_CHECKPOINT_REASONS)[number] | Runtime Checkpoint Reason 公共类型别名;完整类型表达式见声明。 |
RUNTIME_CHECKPOINT_COMPRESSIONS
由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT COMPRESSIONS 常量。
- 种类: 常量
- 导入:
import { RUNTIME_CHECKPOINT_COMPRESSIONS } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export declare const RUNTIME_CHECKPOINT_COMPRESSIONS: readonly ["none", "gzip", "zstd"];RUNTIME_CHECKPOINT_DISPOSITIONS
由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT DISPOSITIONS 常量。
- 种类: 常量
- 导入:
import { RUNTIME_CHECKPOINT_DISPOSITIONS } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export declare const RUNTIME_CHECKPOINT_DISPOSITIONS: readonly ["applied", "reused", "lease_unavailable"];RUNTIME_CHECKPOINT_MODES
由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT MODES 常量。
- 种类: 常量
- 导入:
import { RUNTIME_CHECKPOINT_MODES } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export declare const RUNTIME_CHECKPOINT_MODES: readonly ["none", "state_boundary", "every_n_events", "wait_boundary", "custom"];RUNTIME_CHECKPOINT_REASONS
由 contracts/runtime-checkpoint 模块导出的 RUNTIME CHECKPOINT REASONS 常量。
- 种类: 常量
- 导入:
import { RUNTIME_CHECKPOINT_REASONS } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export declare const RUNTIME_CHECKPOINT_REASONS: readonly ["state_boundary", "human_wait", "signal_wait", "timer_wait", "manual", "failure"];RuntimeCheckpointCreateCommand
Runtime Checkpoint Create Command 接口,共包含 15 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointCreateCommand } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
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>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
checkpointId | 属性 | checkpointId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
contextSnapshotRefs | 属性 | contextSnapshotRefs?: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
createdAt | 属性 | createdAt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
dependencySnapshotRef | 属性 | dependencySnapshotRef: string | 公开属性;类型、只读和可选状态以签名列为准。 |
idempotencyKey | 属性 | idempotencyKey?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
leaseTtlMs | 属性 | leaseTtlMs: number | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, RuntimeJsonValue> | 公开属性;类型、只读和可选状态以签名列为准。 |
ownerId | 属性 | ownerId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
processHash | 属性 | processHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
reason | 属性 | reason: "manual" | "state_boundary" | "human_wait" | "signal_wait" | "timer_wait" | "failure" | 公开属性;类型、只读和可选状态以签名列为准。 |
scope | 属性 | scope: RuntimeScope | 公开属性;类型、只读和可选状态以签名列为准。 |
toolContractSnapshotRef | 属性 | toolContractSnapshotRef?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
variablesHash | 属性 | variablesHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
workflowRevision | 属性 | workflowRevision: string | 公开属性;类型、只读和可选状态以签名列为准。 |
workspaceSnapshotRef | 属性 | workspaceSnapshotRef?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointCreateResult
Runtime Checkpoint Create Result 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointCreateResult } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export interface RuntimeCheckpointCreateResult {
checkpointId: string;
disposition: RuntimeCheckpointDisposition;
eventIds: string[];
record?: RuntimeCheckpointRecord;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
checkpointId | 属性 | checkpointId: string | 公开属性;类型、只读和可选状态以签名列为准。 |
disposition | 属性 | disposition: "applied" | "reused" | "lease_unavailable" | 公开属性;类型、只读和可选状态以签名列为准。 |
eventIds | 属性 | eventIds: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
record | 属性 | record?: RuntimeCheckpointRecord | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointLoadRequest
Runtime Checkpoint Load Request 接口,共包含 3 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointLoadRequest } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export interface RuntimeCheckpointLoadRequest {
scope: RuntimeScope;
checkpointId?: string;
checkedAt: string;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
checkedAt | 属性 | checkedAt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
checkpointId | 属性 | checkpointId?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
scope | 属性 | scope: RuntimeScope | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointLoadResult
Runtime Checkpoint Load Result 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointLoadResult } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export interface RuntimeCheckpointLoadResult {
record: RuntimeCheckpointRecord;
currentHeadSequence: number;
deltaFromSequence: number;
deltaEventCount: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
currentHeadSequence | 属性 | currentHeadSequence: number | 公开属性;类型、只读和可选状态以签名列为准。 |
deltaEventCount | 属性 | deltaEventCount: number | 公开属性;类型、只读和可选状态以签名列为准。 |
deltaFromSequence | 属性 | deltaFromSequence: number | 公开属性;类型、只读和可选状态以签名列为准。 |
record | 属性 | record: RuntimeCheckpointRecord | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointPolicySpec
Runtime Checkpoint Policy Spec 接口,共包含 6 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointPolicySpec } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export interface RuntimeCheckpointPolicySpec {
mode: RuntimeCheckpointMode;
everyNEvents?: number;
retainLast?: number;
persistWorkspaceSnapshot?: boolean;
persistContextRefs?: boolean;
compression?: RuntimeCheckpointCompression;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
compression | 属性 | compression?: "none" | "gzip" | "zstd" | 公开属性;类型、只读和可选状态以签名列为准。 |
everyNEvents | 属性 | everyNEvents?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
mode | 属性 | mode: "none" | "custom" | "state_boundary" | "every_n_events" | "wait_boundary" | 公开属性;类型、只读和可选状态以签名列为准。 |
persistContextRefs | 属性 | persistContextRefs?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
persistWorkspaceSnapshot | 属性 | persistWorkspaceSnapshot?: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
retainLast | 属性 | retainLast?: number | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointPutResult
Runtime Checkpoint Put Result 接口,共包含 2 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointPutResult } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export interface RuntimeCheckpointPutResult {
record: RuntimeCheckpointRecord;
reused: boolean;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
record | 属性 | record: RuntimeCheckpointRecord | 公开属性;类型、只读和可选状态以签名列为准。 |
reused | 属性 | reused: boolean | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointRecord
Runtime Checkpoint Record 接口,共包含 20 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointRecord } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
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>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
checksum | 属性 | checksum: string | 公开属性;类型、只读和可选状态以签名列为准。 |
contextSnapshotRefs | 属性 | contextSnapshotRefs?: string[] | 公开属性;类型、只读和可选状态以签名列为准。 |
createdAt | 属性 | createdAt: string | 公开属性;类型、只读和可选状态以签名列为准。 |
currentState | 属性 | currentState: string | 公开属性;类型、只读和可选状态以签名列为准。 |
dependencySnapshotRef | 属性 | dependencySnapshotRef: string | 公开属性;类型、只读和可选状态以签名列为准。 |
id | 属性 | id: string | 公开属性;类型、只读和可选状态以签名列为准。 |
lastEventSequence | 属性 | lastEventSequence: number | 公开属性;类型、只读和可选状态以签名列为准。 |
metadata | 属性 | metadata?: Record<string, RuntimeJsonValue> | 公开属性;类型、只读和可选状态以签名列为准。 |
pendingWaitRef | 属性 | pendingWaitRef?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
processHash | 属性 | processHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
projectionSnapshot | 属性 | projectionSnapshot: RuntimeOrchestrationProjection | 公开属性;类型、只读和可选状态以签名列为准。 |
projectionVersion | 属性 | projectionVersion: string | 公开属性;类型、只读和可选状态以签名列为准。 |
reason | 属性 | reason: "manual" | "state_boundary" | "human_wait" | "signal_wait" | "timer_wait" | "failure" | 公开属性;类型、只读和可选状态以签名列为准。 |
requestHash | 属性 | requestHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
scope | 属性 | scope: RuntimeScope | 公开属性;类型、只读和可选状态以签名列为准。 |
sequence | 属性 | sequence: number | 公开属性;类型、只读和可选状态以签名列为准。 |
toolContractSnapshotRef | 属性 | toolContractSnapshotRef?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
variablesHash | 属性 | variablesHash: string | 公开属性;类型、只读和可选状态以签名列为准。 |
workflowRevision | 属性 | workflowRevision: string | 公开属性;类型、只读和可选状态以签名列为准。 |
workspaceSnapshotRef | 属性 | workspaceSnapshotRef?: string | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeCheckpointStore
Runtime Checkpoint Store 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeCheckpointStore } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
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[]>;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
get | 方法 | get(scope: RuntimeScope, checkpointId: string): Promise<RuntimeCheckpointRecord | null> | 公开方法;参数与返回类型以签名列为准。 |
latest | 方法 | latest(scope: RuntimeScope): Promise<RuntimeCheckpointRecord | null> | 公开方法;参数与返回类型以签名列为准。 |
list | 方法 | list(scope: RuntimeScope, limit?: number): Promise<RuntimeCheckpointRecord[]> | 公开方法;参数与返回类型以签名列为准。 |
put | 方法 | put(record: RuntimeCheckpointRecord, idempotencyKey: string): Promise<RuntimeCheckpointPutResult> | 公开方法;参数与返回类型以签名列为准。 |
RuntimeCheckpointCompression
Runtime Checkpoint Compression 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { RuntimeCheckpointCompression } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export type RuntimeCheckpointCompression = (typeof RUNTIME_CHECKPOINT_COMPRESSIONS)[number];RuntimeCheckpointDisposition
Runtime Checkpoint Disposition 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { RuntimeCheckpointDisposition } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export type RuntimeCheckpointDisposition = (typeof RUNTIME_CHECKPOINT_DISPOSITIONS)[number];RuntimeCheckpointMode
Runtime Checkpoint Mode 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { RuntimeCheckpointMode } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export type RuntimeCheckpointMode = (typeof RUNTIME_CHECKPOINT_MODES)[number];RuntimeCheckpointReason
Runtime Checkpoint Reason 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { RuntimeCheckpointReason } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-checkpoint
声明
export type RuntimeCheckpointReason = (typeof RUNTIME_CHECKPOINT_REASONS)[number];