Skip to content

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

模块用法

用于声明并运行时校验契约。Runtime helpers 模块公开 2 常量、27 接口、4 类型。

从包入口导入

ts
import {
  RUNTIME_DETERMINISTIC_OBSERVATION_KINDS,
  RUNTIME_WAIT_INTENT_TYPES,
} from '@codesoul-co/hypha-core';

import type {
  HumanWaitRequest,
  PauseRequest,
  RuntimeClockHelper,
  RuntimeDeterminismResolution,
  RuntimeDeterminismResolveRequest,
  RuntimeDeterminismScope,
  RuntimeDeterminismStore,
  RuntimeDeterministicObservation,
} from '@codesoul-co/hypha-core';

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

使用要点

  • 31 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 2 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

公共导出

Symbol种类签名说明
RUNTIME_DETERMINISTIC_OBSERVATION_KINDS常量const RUNTIME_DETERMINISTIC_OBSERVATION_KINDS: readonly ["clock", "id"]contracts/runtime-helpers 模块导出的 RUNTIME DETERMINISTIC OBSERVATION KINDS 常量。
RUNTIME_WAIT_INTENT_TYPES常量const RUNTIME_WAIT_INTENT_TYPES: readonly ["human", "signal", "timer", "pause"]contracts/runtime-helpers 模块导出的 RUNTIME WAIT INTENT TYPES 常量。
HumanWaitRequest接口interface HumanWaitRequestHuman Wait Request 接口,共包含 5 个公开字段或方法。
PauseRequest接口interface PauseRequestPause Request 接口,共包含 3 个公开字段或方法。
RuntimeClockHelper接口interface RuntimeClockHelperRuntime Clock Helper 接口,共包含 2 个公开字段或方法。
RuntimeDeterminismResolution接口interface RuntimeDeterminismResolutionRuntime Determinism Resolution 接口,共包含 2 个公开字段或方法。
RuntimeDeterminismResolveRequest接口interface RuntimeDeterminismResolveRequestRuntime Determinism Resolve Request 接口,共包含 3 个公开字段或方法。
RuntimeDeterminismScope接口interface RuntimeDeterminismScopeRuntime Determinism Scope 接口,共包含 5 个公开字段或方法。
RuntimeDeterminismStore接口interface RuntimeDeterminismStoreRuntime Determinism Store 接口,共包含 1 个公开字段或方法。
RuntimeDeterministicObservation接口interface RuntimeDeterministicObservationRuntime Deterministic Observation 接口,共包含 4 个公开字段或方法。
RuntimeEventAppendOptions接口interface RuntimeEventAppendOptionsRuntime Event Append Options 接口,共包含 4 个公开字段或方法。
RuntimeEventCommitPort接口interface RuntimeEventCommitPortRuntime Event Commit Port 接口,共包含 2 个公开字段或方法。
RuntimeEventCommitRequest接口interface RuntimeEventCommitRequestRuntime Event Commit Request 接口,共包含 4 个公开字段或方法。
RuntimeEventHelper接口interface RuntimeEventHelperRuntime Event Helper 接口,共包含 3 个公开字段或方法。
RuntimeHelperExecutionScope接口interface RuntimeHelperExecutionScopeRuntime Helper Execution Scope 接口,共包含 6 个公开字段或方法。
RuntimeHelperSdk接口interface RuntimeHelperSdkRuntime Helper Sdk 接口,共包含 4 个公开字段或方法。
RuntimeIdHelper接口interface RuntimeIdHelperRuntime ID Helper 接口,共包含 1 个公开字段或方法。
RuntimeIoHelperSdk接口interface RuntimeIoHelperSdkRuntime Io Helper Sdk 接口,共包含 2 个公开字段或方法。
RuntimeObservationEventInput接口interface RuntimeObservationEventInputRuntime Observation Event Input 接口,共包含 3 个公开字段或方法。
RuntimeResourceAcquireOptions接口interface RuntimeResourceAcquireOptionsRuntime Resource Acquire Options 接口,共包含 2 个公开字段或方法。
RuntimeResourceHelper接口interface RuntimeResourceHelperRuntime Resource Helper 接口,共包含 4 个公开字段或方法。
RuntimeResourceHelperDependencies接口interface RuntimeResourceHelperDependenciesRuntime Resource Helper Dependencies 接口,共包含 5 个公开字段或方法。
RuntimeResourceRenewOptions接口interface RuntimeResourceRenewOptionsRuntime Resource Renew Options 接口,共包含 1 个公开字段或方法。
RuntimeTransitionHelper接口interface RuntimeTransitionHelperRuntime Transition Helper 接口,共包含 4 个公开字段或方法。
RuntimeTransitionProposal接口interface RuntimeTransitionProposalRuntime Transition Proposal 接口,共包含 3 个公开字段或方法。
RuntimeWaitHelper接口interface RuntimeWaitHelperRuntime Wait Helper 接口,共包含 4 个公开字段或方法。
RuntimeWaitIntent接口interface RuntimeWaitIntentRuntime Wait Intent 接口,共包含 8 个公开字段或方法。
SignalWaitRequest接口interface SignalWaitRequestSignal Wait Request 接口,共包含 5 个公开字段或方法。
TimerWaitRequest接口interface TimerWaitRequestTimer Wait Request 接口,共包含 3 个公开字段或方法。
RuntimeDeterministicObservationKind类型type RuntimeDeterministicObservationKind = (typeof RUNTIME_DETERMINISTIC_OBSERVATION_KINDS)[number]Runtime Deterministic Observation Kind 公共类型别名;完整类型表达式见声明。
RuntimeJsonValue类型type RuntimeJsonValue = null | boolean | number | string | RuntimeJsonValue[] | { [key: string]: RuntimeJsonValue; }Runtime JSON Value 公共类型别名;完整类型表达式见声明。
RuntimeStateExecutionResult类型type RuntimeStateExecutionResult = { kind: 'completed'; output?: RuntimeJsonValue; variablesPatch?: Record<string, RuntimeJsonValue>; } | { kind: 'continued'; observation?: RuntimeJsonValue; } | { kind: 'failed'; error: NormalizedRuntimeError; } | { kind: 'waiting'; wait: RuntimeWaitIntent; }Runtime State Execution Result 公共类型别名;完整类型表达式见声明。
RuntimeWaitIntentType类型type RuntimeWaitIntentType = (typeof RUNTIME_WAIT_INTENT_TYPES)[number]Runtime Wait Intent Type 公共类型别名;完整类型表达式见声明。

RUNTIME_DETERMINISTIC_OBSERVATION_KINDS

contracts/runtime-helpers 模块导出的 RUNTIME DETERMINISTIC OBSERVATION KINDS 常量。

  • 种类: 常量
  • 导入: import { RUNTIME_DETERMINISTIC_OBSERVATION_KINDS } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export declare const RUNTIME_DETERMINISTIC_OBSERVATION_KINDS: readonly ["clock", "id"];

RUNTIME_WAIT_INTENT_TYPES

contracts/runtime-helpers 模块导出的 RUNTIME WAIT INTENT TYPES 常量。

  • 种类: 常量
  • 导入: import { RUNTIME_WAIT_INTENT_TYPES } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export declare const RUNTIME_WAIT_INTENT_TYPES: readonly ["human", "signal", "timer", "pause"];

HumanWaitRequest

Human Wait Request 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { HumanWaitRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface HumanWaitRequest {
    key?: string;
    expiresAt?: string;
    timeoutTransitionId?: string;
    pendingActionRef?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
key属性key?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。
pendingActionRef属性pendingActionRef?: string公开属性;类型、只读和可选状态以签名列为准。
timeoutTransitionId属性timeoutTransitionId?: string公开属性;类型、只读和可选状态以签名列为准。

PauseRequest

Pause Request 接口,共包含 3 个公开字段或方法。

声明

text
export interface PauseRequest {
    reason: string;
    resumeKey?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
metadata属性metadata?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。
reason属性reason: string公开属性;类型、只读和可选状态以签名列为准。
resumeKey属性resumeKey?: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeClockHelper

Runtime Clock Helper 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeClockHelper } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeClockHelper {
    now(): Promise<string>;
    sleepUntil(isoTime: string): Promise<RuntimeStateExecutionResult>;
}

契约成员

成员种类签名说明
now方法now(): Promise<string>公开方法;参数与返回类型以签名列为准。
sleepUntil方法sleepUntil(isoTime: string): Promise<RuntimeStateExecutionResult>公开方法;参数与返回类型以签名列为准。

RuntimeDeterminismResolution

Runtime Determinism Resolution 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeDeterminismResolution } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeDeterminismResolution<T extends RuntimeJsonValue = RuntimeJsonValue> {
    observation: RuntimeDeterministicObservation<T>;
    reused: boolean;
}

契约成员

成员种类签名说明
observation属性observation: RuntimeDeterministicObservation<T>公开属性;类型、只读和可选状态以签名列为准。
reused属性reused: boolean公开属性;类型、只读和可选状态以签名列为准。

RuntimeDeterminismResolveRequest

Runtime Determinism Resolve Request 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeDeterminismResolveRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeDeterminismResolveRequest {
    scope: RuntimeDeterminismScope;
    key: string;
    kind: RuntimeDeterministicObservationKind;
}

契约成员

成员种类签名说明
key属性key: string公开属性;类型、只读和可选状态以签名列为准。
kind属性kind: "clock" | "id"公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: RuntimeDeterminismScope公开属性;类型、只读和可选状态以签名列为准。

RuntimeDeterminismScope

Runtime Determinism Scope 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeDeterminismScope } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeDeterminismScope {
    tenantId?: string;
    userId: string;
    runId: string;
    stateId: string;
    stateAttempt: number;
}

契约成员

成员种类签名说明
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
stateAttempt属性stateAttempt: number公开属性;类型、只读和可选状态以签名列为准。
stateId属性stateId: string公开属性;类型、只读和可选状态以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。
userId属性userId: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeDeterminismStore

Runtime Determinism Store 接口,共包含 1 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeDeterminismStore } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeDeterminismStore {
    resolve<T extends RuntimeJsonValue>(request: RuntimeDeterminismResolveRequest, produce: () => T | Promise<T>): Promise<RuntimeDeterminismResolution<T>>;
}

契约成员

成员种类签名说明
resolve方法resolve<T extends RuntimeJsonValue>(request: RuntimeDeterminismResolveRequest, produce: () => T | Promise<T>): Promise<RuntimeDeterminismResolution<T>>公开方法;参数与返回类型以签名列为准。

RuntimeDeterministicObservation

Runtime Deterministic Observation 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeDeterministicObservation } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeDeterministicObservation<T extends RuntimeJsonValue = RuntimeJsonValue> {
    scope: RuntimeDeterminismScope;
    key: string;
    kind: RuntimeDeterministicObservationKind;
    value: T;
}

契约成员

成员种类签名说明
key属性key: string公开属性;类型、只读和可选状态以签名列为准。
kind属性kind: "clock" | "id"公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: RuntimeDeterminismScope公开属性;类型、只读和可选状态以签名列为准。
value属性value: T公开属性;类型、只读和可选状态以签名列为准。

RuntimeEventAppendOptions

Runtime Event Append Options 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeEventAppendOptions } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeEventAppendOptions {
    idempotencyKey?: string;
    causationId?: string;
    parentEventId?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
causationId属性causationId?: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。
parentEventId属性parentEventId?: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeEventCommitPort

Runtime Event Commit Port 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeEventCommitPort } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeEventCommitPort {
    append(request: RuntimeEventCommitRequest): Promise<FrameworkEvent[]>;
    readSince(scope: RuntimeScope, sequence: number): Promise<FrameworkEvent[]>;
}

契约成员

成员种类签名说明
append方法append(request: RuntimeEventCommitRequest): Promise<FrameworkEvent[]>公开方法;参数与返回类型以签名列为准。
readSince方法readSince(scope: RuntimeScope, sequence: number): Promise<FrameworkEvent[]>公开方法;参数与返回类型以签名列为准。

RuntimeEventCommitRequest

Runtime Event Commit Request 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeEventCommitRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeEventCommitRequest {
    scope: RuntimeHelperExecutionScope;
    events: EventCreateInput[];
    fencingToken: number;
    idempotencyKey: string;
}

契约成员

成员种类签名说明
events属性events: EventCreateInput<unknown>[]公开属性;类型、只读和可选状态以签名列为准。
fencingToken属性fencingToken: number公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey: string公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: RuntimeHelperExecutionScope公开属性;类型、只读和可选状态以签名列为准。

RuntimeEventHelper

Runtime Event Helper 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeEventHelper } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeEventHelper {
    append<T extends RuntimeJsonValue>(type: RuntimeObservationEventType, payload: T, options?: RuntimeEventAppendOptions): Promise<FrameworkEvent<T>>;
    appendBatch(inputs: RuntimeObservationEventInput[]): Promise<FrameworkEvent[]>;
    readSince(sequence: number): Promise<FrameworkEvent[]>;
}

契约成员

成员种类签名说明
append方法append<T extends RuntimeJsonValue>(type: RuntimeObservationEventType, payload: T, options?: RuntimeEventAppendOptions): Promise<FrameworkEvent<T>>公开方法;参数与返回类型以签名列为准。
appendBatch方法appendBatch(inputs: RuntimeObservationEventInput[]): Promise<FrameworkEvent[]>公开方法;参数与返回类型以签名列为准。
readSince方法readSince(sequence: number): Promise<FrameworkEvent[]>公开方法;参数与返回类型以签名列为准。

RuntimeHelperExecutionScope

Runtime Helper Execution Scope 接口,共包含 6 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeHelperExecutionScope } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeHelperExecutionScope {
    scope: RuntimeScope;
    stateId: string;
    stateAttempt: number;
    fencingToken: number;
    correlationId: string;
    causationId?: string;
}

契约成员

成员种类签名说明
causationId属性causationId?: string公开属性;类型、只读和可选状态以签名列为准。
correlationId属性correlationId: string公开属性;类型、只读和可选状态以签名列为准。
fencingToken属性fencingToken: number公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: RuntimeScope公开属性;类型、只读和可选状态以签名列为准。
stateAttempt属性stateAttempt: number公开属性;类型、只读和可选状态以签名列为准。
stateId属性stateId: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeHelperSdk

Runtime Helper Sdk 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeHelperSdk } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeHelperSdk {
    readonly transitions: RuntimeTransitionHelper;
    readonly waits: RuntimeWaitHelper;
    readonly clock: RuntimeClockHelper;
    readonly ids: RuntimeIdHelper;
}

契约成员

成员种类签名说明
clock属性readonly clock: RuntimeClockHelper公开属性;类型、只读和可选状态以签名列为准。
ids属性readonly ids: RuntimeIdHelper公开属性;类型、只读和可选状态以签名列为准。
transitions属性readonly transitions: RuntimeTransitionHelper公开属性;类型、只读和可选状态以签名列为准。
waits属性readonly waits: RuntimeWaitHelper公开属性;类型、只读和可选状态以签名列为准。

RuntimeIdHelper

Runtime ID Helper 接口,共包含 1 个公开字段或方法。

声明

text
export interface RuntimeIdHelper {
    next(namespace: string): Promise<string>;
}

契约成员

成员种类签名说明
next方法next(namespace: string): Promise<string>公开方法;参数与返回类型以签名列为准。

RuntimeIoHelperSdk

Runtime Io Helper Sdk 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeIoHelperSdk } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeIoHelperSdk {
    readonly events: RuntimeEventHelper;
    readonly resources: RuntimeResourceHelper;
}

契约成员

成员种类签名说明
events属性readonly events: RuntimeEventHelper公开属性;类型、只读和可选状态以签名列为准。
resources属性readonly resources: RuntimeResourceHelper公开属性;类型、只读和可选状态以签名列为准。

RuntimeObservationEventInput

Runtime Observation Event Input 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeObservationEventInput } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeObservationEventInput<T extends RuntimeJsonValue = RuntimeJsonValue> {
    type: RuntimeObservationEventType;
    payload: T;
    options?: RuntimeEventAppendOptions;
}

契约成员

成员种类签名说明
options属性options?: RuntimeEventAppendOptions公开属性;类型、只读和可选状态以签名列为准。
payload属性payload: T公开属性;类型、只读和可选状态以签名列为准。
type属性type: runtime.observation.${string}公开属性;类型、只读和可选状态以签名列为准。

RuntimeResourceAcquireOptions

Runtime Resource Acquire Options 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeResourceAcquireOptions } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeResourceAcquireOptions {
    ttlMs: number;
    idempotencyKey?: string;
}

契约成员

成员种类签名说明
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
ttlMs属性ttlMs: number公开属性;类型、只读和可选状态以签名列为准。

RuntimeResourceHelper

Runtime Resource Helper 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeResourceHelper } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeResourceHelper {
    acquire(resources: Omit<RuntimeResourceRequest, 'requestedClaimId'>[], options: RuntimeResourceAcquireOptions): Promise<RuntimeResourceClaim[]>;
    renew(claims: RuntimeResourceClaim[], options: RuntimeResourceRenewOptions): Promise<RuntimeResourceClaim[]>;
    release(claims: RuntimeResourceClaim[]): Promise<void>;
    assertCurrent(claim: RuntimeResourceClaim): Promise<RuntimeResourceClaim>;
}

契约成员

成员种类签名说明
acquire方法acquire(resources: Omit<RuntimeResourceRequest, "requestedClaimId">[], options: RuntimeResourceAcquireOptions): Promise<RuntimeResourceClaim[]>公开方法;参数与返回类型以签名列为准。
assertCurrent方法assertCurrent(claim: RuntimeResourceClaim): Promise<RuntimeResourceClaim>公开方法;参数与返回类型以签名列为准。
release方法release(claims: RuntimeResourceClaim[]): Promise<void>公开方法;参数与返回类型以签名列为准。
renew方法renew(claims: RuntimeResourceClaim[], options: RuntimeResourceRenewOptions): Promise<RuntimeResourceClaim[]>公开方法;参数与返回类型以签名列为准。

RuntimeResourceHelperDependencies

Runtime Resource Helper Dependencies 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeResourceHelperDependencies } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeResourceHelperDependencies {
    runLease: RunLeaseAuthorization;
    coordinator: RuntimeResourceCoordinator;
    ids: RuntimeIdHelper;
    clock: RuntimeClockHelper;
    stateId: string;
}

契约成员

成员种类签名说明
clock属性clock: RuntimeClockHelper公开属性;类型、只读和可选状态以签名列为准。
coordinator属性coordinator: RuntimeResourceCoordinator公开属性;类型、只读和可选状态以签名列为准。
ids属性ids: RuntimeIdHelper公开属性;类型、只读和可选状态以签名列为准。
runLease属性runLease: RunLeaseAuthorization公开属性;类型、只读和可选状态以签名列为准。
stateId属性stateId: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeResourceRenewOptions

Runtime Resource Renew Options 接口,共包含 1 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeResourceRenewOptions } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeResourceRenewOptions {
    ttlMs: number;
}

契约成员

成员种类签名说明
ttlMs属性ttlMs: number公开属性;类型、只读和可选状态以签名列为准。

RuntimeTransitionHelper

Runtime Transition Helper 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeTransitionHelper } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeTransitionHelper {
    propose(to: string, reason?: string, variablesPatch?: Record<string, RuntimeJsonValue>): RuntimeTransitionProposal;
    complete(output?: RuntimeJsonValue, variablesPatch?: Record<string, RuntimeJsonValue>): RuntimeStateExecutionResult;
    continue(observation?: RuntimeJsonValue): RuntimeStateExecutionResult;
    fail(error: NormalizedRuntimeError): RuntimeStateExecutionResult;
}

契约成员

成员种类签名说明
complete方法complete(output?: RuntimeJsonValue, variablesPatch?: Record<string, RuntimeJsonValue>): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。
continue方法continue(observation?: RuntimeJsonValue): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。
fail方法fail(error: NormalizedRuntimeError): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。
propose方法propose(to: string, reason?: string, variablesPatch?: Record<string, RuntimeJsonValue>): RuntimeTransitionProposal公开方法;参数与返回类型以签名列为准。

RuntimeTransitionProposal

Runtime Transition Proposal 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeTransitionProposal } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeTransitionProposal {
    to: string;
    reason?: string;
    variablesPatch?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
to属性to: string公开属性;类型、只读和可选状态以签名列为准。
variablesPatch属性variablesPatch?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。

RuntimeWaitHelper

Runtime Wait Helper 接口,共包含 4 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeWaitHelper } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeWaitHelper {
    human(request: HumanWaitRequest): RuntimeStateExecutionResult;
    signal(request: SignalWaitRequest): RuntimeStateExecutionResult;
    timer(request: TimerWaitRequest): RuntimeStateExecutionResult;
    pause(request: PauseRequest): RuntimeStateExecutionResult;
}

契约成员

成员种类签名说明
human方法human(request: HumanWaitRequest): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。
pause方法pause(request: PauseRequest): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。
signal方法signal(request: SignalWaitRequest): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。
timer方法timer(request: TimerWaitRequest): RuntimeStateExecutionResult公开方法;参数与返回类型以签名列为准。

RuntimeWaitIntent

Runtime Wait Intent 接口,共包含 8 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { RuntimeWaitIntent } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface RuntimeWaitIntent {
    type: RuntimeWaitIntentType;
    key?: string;
    expectedSchema?: JsonSchema;
    expiresAt?: string;
    timeoutTransitionId?: string;
    pendingActionRef?: string;
    reason?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
expectedSchema属性expectedSchema?: JsonSchema公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
key属性key?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。
pendingActionRef属性pendingActionRef?: string公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
timeoutTransitionId属性timeoutTransitionId?: string公开属性;类型、只读和可选状态以签名列为准。
type属性type: "human" | "signal" | "timer" | "pause"公开属性;类型、只读和可选状态以签名列为准。

SignalWaitRequest

Signal Wait Request 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SignalWaitRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface SignalWaitRequest {
    key: string;
    expectedSchema?: JsonSchema;
    expiresAt?: string;
    timeoutTransitionId?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
expectedSchema属性expectedSchema?: JsonSchema公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
key属性key: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。
timeoutTransitionId属性timeoutTransitionId?: string公开属性;类型、只读和可选状态以签名列为准。

TimerWaitRequest

Timer Wait Request 接口,共包含 3 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { TimerWaitRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export interface TimerWaitRequest {
    fireAt: string;
    timeoutTransitionId?: string;
    metadata?: Record<string, RuntimeJsonValue>;
}

契约成员

成员种类签名说明
fireAt属性fireAt: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, RuntimeJsonValue>公开属性;类型、只读和可选状态以签名列为准。
timeoutTransitionId属性timeoutTransitionId?: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeDeterministicObservationKind

Runtime Deterministic Observation Kind 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { RuntimeDeterministicObservationKind } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export type RuntimeDeterministicObservationKind = (typeof RUNTIME_DETERMINISTIC_OBSERVATION_KINDS)[number];

RuntimeJsonValue

Runtime JSON Value 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { RuntimeJsonValue } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export type RuntimeJsonValue = null | boolean | number | string | RuntimeJsonValue[] | {
    [key: string]: RuntimeJsonValue;
};

RuntimeStateExecutionResult

Runtime State Execution Result 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { RuntimeStateExecutionResult } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export type RuntimeStateExecutionResult = {
    kind: 'completed';
    output?: RuntimeJsonValue;
    variablesPatch?: Record<string, RuntimeJsonValue>;
} | {
    kind: 'continued';
    observation?: RuntimeJsonValue;
} | {
    kind: 'failed';
    error: NormalizedRuntimeError;
} | {
    kind: 'waiting';
    wait: RuntimeWaitIntent;
};

RuntimeWaitIntentType

Runtime Wait Intent Type 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { RuntimeWaitIntentType } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/runtime-helpers

声明

text
export type RuntimeWaitIntentType = (typeof RUNTIME_WAIT_INTENT_TYPES)[number];