Skip to content

@codesoul-co/hypha-core / contracts/runtime-replay-schemas ​

模块用法 ​

用于声明并运行时校验契约。Runtime replay schemas 模块公开 18 常量、4 函数。

从包入口导入 ​

ts
import {
  runtimeReplayContractDefinitions,
  runtimeReplayContractJsonSchemas,
  runtimeReplayRequestDefinition,
  runtimeReplayRequestExample,
  runtimeReplayRequestJsonSchema,
  runtimeReplayRequestSchema,
  runtimeReplayResultDefinition,
  runtimeReplayResultExample,
} from '@codesoul-co/hypha-core';

// 完整导出列表见下方。

使用要点 ​

  • 4 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。
  • 18 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

运行时校验示例 ​

ts
import { runtimeReplayRequestSchema } from '@codesoul-co/hypha-core';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = runtimeReplayRequestSchema.parse(input);

配置、网络请求或持久化数据等不可信输入应先通过 Runtime Schema,再传给只接受已校验契约的函数或类。

公共导出 ​

Symbol种类签名说明
runtimeReplayContractDefinitions常量const runtimeReplayContractDefinitions: readonly [SpecSchemaDefinition<RuntimeReplayRequest>, SpecSchemaDefinition<RuntimeReplayResult>, SpecSchemaDefinition<RuntimeReplayVerificationRequest>, SpecSchemaDefinition<RuntimeReplayVerificationResult>]由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Contract Definitions 常量。
runtimeReplayContractJsonSchemas常量const runtimeReplayContractJsonSchemas: Record<string, JsonSchema>由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Contract JSON Schemas 常量。
runtimeReplayRequestDefinition常量const runtimeReplayRequestDefinition: SpecSchemaDefinition<RuntimeReplayRequest>由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Request Definition 常量。
runtimeReplayRequestExample常量const runtimeReplayRequestExample: RuntimeReplayRequestRuntime Replay Request 的有效示例值。
runtimeReplayRequestJsonSchema常量const runtimeReplayRequestJsonSchema: JsonSchemaRuntime Replay Request 的 JSON Schema。
runtimeReplayRequestSchema常量const runtimeReplayRequestSchema: z.ZodObject<{ scope: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; agentId: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | unde...Runtime Replay Request 的运行时 Schema。
runtimeReplayResultDefinition常量const runtimeReplayResultDefinition: SpecSchemaDefinition<RuntimeReplayResult>由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Result Definition 常量。
runtimeReplayResultExample常量const runtimeReplayResultExample: RuntimeReplayResultRuntime Replay Result 的有效示例值。
runtimeReplayResultJsonSchema常量const runtimeReplayResultJsonSchema: JsonSchemaRuntime Replay Result 的 JSON Schema。
runtimeReplayResultSchema常量const runtimeReplayResultSchema: z.ZodEffects<z.ZodObject<{ sourceRunId: z.ZodString; mode: z.ZodLiteral<"deterministic">; checkpointId: z.ZodString; baseEventSequence: z.ZodNumber; targetEventSequence: z.ZodNumber; replayedEventCount: z.ZodNumber; appliedEventCount: z.ZodNumber; eventIds: z.ZodArray<z.ZodString, "many">; workflowRevision: z.ZodString; processHash: z.ZodString; dependencySnapshotRef: z.ZodString; ...Runtime Replay Result 的运行时 Schema。
runtimeReplayVerificationRequestDefinition常量const runtimeReplayVerificationRequestDefinition: SpecSchemaDefinition<RuntimeReplayVerificationRequest>由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Verification Request Definition 常量。
runtimeReplayVerificationRequestExample常量const runtimeReplayVerificationRequestExample: RuntimeReplayVerificationRequestRuntime Replay Verification Request 的有效示例值。
runtimeReplayVerificationRequestJsonSchema常量const runtimeReplayVerificationRequestJsonSchema: JsonSchemaRuntime Replay Verification Request 的 JSON Schema。
runtimeReplayVerificationRequestSchema常量const runtimeReplayVerificationRequestSchema: z.ZodObject<{ replay: z.ZodObject<{ scope: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; agentId: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | u...Runtime Replay Verification Request 的运行时 Schema。
runtimeReplayVerificationResultDefinition常量const runtimeReplayVerificationResultDefinition: SpecSchemaDefinition<RuntimeReplayVerificationResult>由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Verification Result Definition 常量。
runtimeReplayVerificationResultExample常量const runtimeReplayVerificationResultExample: RuntimeReplayVerificationResultRuntime Replay Verification Result 的有效示例值。
runtimeReplayVerificationResultJsonSchema常量const runtimeReplayVerificationResultJsonSchema: JsonSchemaRuntime Replay Verification Result 的 JSON Schema。
runtimeReplayVerificationResultSchema常量const runtimeReplayVerificationResultSchema: z.ZodEffects<z.ZodObject<{ replay: z.ZodEffects<z.ZodObject<{ sourceRunId: z.ZodString; mode: z.ZodLiteral<"deterministic">; checkpointId: z.ZodString; baseEventSequence: z.ZodNumber; targetEventSequence: z.ZodNumber; replayedEventCount: z.ZodNumber; appliedEventCount: z.ZodNumber; eventIds: z.ZodArray<z.ZodString, "many">; workflowRevision: z.ZodString; processHash: z....Runtime Replay Verification Result 的运行时 Schema。
validateRuntimeReplayRequest函数validateRuntimeReplayRequest(input: unknown): RuntimeReplayRequestValidate Runtime Replay Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。
validateRuntimeReplayResult函数validateRuntimeReplayResult(input: unknown): RuntimeReplayResultValidate Runtime Replay Result 函数,提供 1 个公开调用签名;参数与返回类型见下表。
validateRuntimeReplayVerificationRequest函数validateRuntimeReplayVerificationRequest(input: unknown): RuntimeReplayVerificationRequestValidate Runtime Replay Verification Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。
validateRuntimeReplayVerificationResult函数validateRuntimeReplayVerificationResult(input: unknown): RuntimeReplayVerificationResultValidate Runtime Replay Verification Result 函数,提供 1 个公开调用签名;参数与返回类型见下表。

runtimeReplayContractDefinitions ​

由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Contract Definitions 常量。

声明 ​

text
export declare const runtimeReplayContractDefinitions: readonly [SpecSchemaDefinition<RuntimeReplayRequest>, SpecSchemaDefinition<RuntimeReplayResult>, SpecSchemaDefinition<RuntimeReplayVerificationRequest>, SpecSchemaDefinition<RuntimeReplayVerificationResult>];

runtimeReplayContractJsonSchemas ​

由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Contract JSON Schemas 常量。

声明 ​

text
export declare const runtimeReplayContractJsonSchemas: Record<string, JsonSchema>;

runtimeReplayRequestDefinition ​

由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Request Definition 常量。

声明 ​

text
export declare const runtimeReplayRequestDefinition: SpecSchemaDefinition<RuntimeReplayRequest>;

runtimeReplayRequestExample ​

Runtime Replay Request 的有效示例值。

声明 ​

text
export declare const runtimeReplayRequestExample: RuntimeReplayRequest;

runtimeReplayRequestJsonSchema ​

Runtime Replay Request 的 JSON Schema。

声明 ​

text
export declare const runtimeReplayRequestJsonSchema: JsonSchema;

runtimeReplayRequestSchema ​

Runtime Replay Request 的运行时 Schema。

声明 ​

text
export declare const runtimeReplayRequestSchema: z.ZodObject<{ scope: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; agentId: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }>; checkpointId: z.ZodOptional<z.ZodString>; expectedWorkflowRevision: z.ZodString; expectedProcessHash: z.ZodString; expectedDependencySnapshotRef: z.ZodString; toSequence: z.ZodOptional<z.ZodNumber>; requestedAt: z.ZodString; }, "strict", z.ZodTypeAny, { scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; requestedAt: string; expectedWorkflowRevision: string; expectedProcessHash: string; expectedDependencySnapshotRef: string; toSequence?: number | undefined; checkpointId?: string | undefined; }, { scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; requestedAt: string; expectedWorkflowRevision: string; expectedProcessHash: string; expectedDependencySnapshotRef: string; toSequence?: number | undefined; checkpointId?: string | undefined; }>;

runtimeReplayResultDefinition ​

由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Result Definition 常量。

声明 ​

text
export declare const runtimeReplayResultDefinition: SpecSchemaDefinition<RuntimeReplayResult>;

runtimeReplayResultExample ​

Runtime Replay Result 的有效示例值。

声明 ​

text
export declare const runtimeReplayResultExample: RuntimeReplayResult;

runtimeReplayResultJsonSchema ​

Runtime Replay Result 的 JSON Schema。

声明 ​

text
export declare const runtimeReplayResultJsonSchema: JsonSchema;

runtimeReplayResultSchema ​

Runtime Replay Result 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const runtimeReplayResultSchema: (typeof import('@codesoul-co/hypha-core'))['runtimeReplayResultSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

runtimeReplayVerificationRequestDefinition ​

由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Verification Request Definition 常量。

声明 ​

text
export declare const runtimeReplayVerificationRequestDefinition: SpecSchemaDefinition<RuntimeReplayVerificationRequest>;

runtimeReplayVerificationRequestExample ​

Runtime Replay Verification Request 的有效示例值。

声明 ​

text
export declare const runtimeReplayVerificationRequestExample: RuntimeReplayVerificationRequest;

runtimeReplayVerificationRequestJsonSchema ​

Runtime Replay Verification Request 的 JSON Schema。

声明 ​

text
export declare const runtimeReplayVerificationRequestJsonSchema: JsonSchema;

runtimeReplayVerificationRequestSchema ​

Runtime Replay Verification Request 的运行时 Schema。

声明 ​

text
export declare const runtimeReplayVerificationRequestSchema: z.ZodObject<{ replay: z.ZodObject<{ scope: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; agentId: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }>; checkpointId: z.ZodOptional<z.ZodString>; expectedWorkflowRevision: z.ZodString; expectedProcessHash: z.ZodString; expectedDependencySnapshotRef: z.ZodString; toSequence: z.ZodOptional<z.ZodNumber>; requestedAt: z.ZodString; }, "strict", z.ZodTypeAny, { scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; requestedAt: string; expectedWorkflowRevision: string; expectedProcessHash: string; expectedDependencySnapshotRef: string; toSequence?: number | undefined; checkpointId?: string | undefined; }, { scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; requestedAt: string; expectedWorkflowRevision: string; expectedProcessHash: string; expectedDependencySnapshotRef: string; toSequence?: number | undefined; checkpointId?: string | undefined; }>; expectedSnapshotChecksum: z.ZodString; }, "strict", z.ZodTypeAny, { replay: { scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; requestedAt: string; expectedWorkflowRevision: string; expectedProcessHash: string; expectedDependencySnapshotRef: string; toSequence?: number | undefined; checkpointId?: string | undefined; }; expectedSnapshotChecksum: string; }, { replay: { scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; requestedAt: string; expectedWorkflowRevision: string; expectedProcessHash: string; expectedDependencySnapshotRef: string; toSequence?: number | undefined; checkpointId?: string | undefined; }; expectedSnapshotChecksum: string; }>;

runtimeReplayVerificationResultDefinition ​

由 contracts/runtime-replay-schemas 模块导出的 Runtime Replay Verification Result Definition 常量。

声明 ​

text
export declare const runtimeReplayVerificationResultDefinition: SpecSchemaDefinition<RuntimeReplayVerificationResult>;

runtimeReplayVerificationResultExample ​

Runtime Replay Verification Result 的有效示例值。

声明 ​

text
export declare const runtimeReplayVerificationResultExample: RuntimeReplayVerificationResult;

runtimeReplayVerificationResultJsonSchema ​

Runtime Replay Verification Result 的 JSON Schema。

声明 ​

text
export declare const runtimeReplayVerificationResultJsonSchema: JsonSchema;

runtimeReplayVerificationResultSchema ​

Runtime Replay Verification Result 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const runtimeReplayVerificationResultSchema: (typeof import('@codesoul-co/hypha-core'))['runtimeReplayVerificationResultSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

validateRuntimeReplayRequest ​

Validate Runtime Replay Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function validateRuntimeReplayRequest(input: unknown): RuntimeReplayRequest;

调用签名 ​

text
validateRuntimeReplayRequest(input: unknown): RuntimeReplayRequest

参数 ​

参数类型必需说明
inputunknown是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: RuntimeReplayRequest
  • 说明: 返回值契约由上述类型定义。

validateRuntimeReplayResult ​

Validate Runtime Replay Result 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function validateRuntimeReplayResult(input: unknown): RuntimeReplayResult;

调用签名 ​

text
validateRuntimeReplayResult(input: unknown): RuntimeReplayResult

参数 ​

参数类型必需说明
inputunknown是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: RuntimeReplayResult
  • 说明: 返回值契约由上述类型定义。

validateRuntimeReplayVerificationRequest ​

Validate Runtime Replay Verification Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function validateRuntimeReplayVerificationRequest(input: unknown): RuntimeReplayVerificationRequest;

调用签名 ​

text
validateRuntimeReplayVerificationRequest(input: unknown): RuntimeReplayVerificationRequest

参数 ​

参数类型必需说明
inputunknown是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: RuntimeReplayVerificationRequest
  • 说明: 返回值契约由上述类型定义。

validateRuntimeReplayVerificationResult ​

Validate Runtime Replay Verification Result 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function validateRuntimeReplayVerificationResult(input: unknown): RuntimeReplayVerificationResult;

调用签名 ​

text
validateRuntimeReplayVerificationResult(input: unknown): RuntimeReplayVerificationResult

参数 ​

参数类型必需说明
inputunknown是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: RuntimeReplayVerificationResult
  • 说明: 返回值契约由上述类型定义。