@codesoul-co/hypha-core / contracts/runtime-helpers
模块用法
用于声明并运行时校验契约。Runtime helpers 模块公开 2 常量、27 接口、4 类型。
从包入口导入
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 HumanWaitRequest | Human Wait Request 接口,共包含 5 个公开字段或方法。 |
PauseRequest | 接口 | interface PauseRequest | Pause Request 接口,共包含 3 个公开字段或方法。 |
RuntimeClockHelper | 接口 | interface RuntimeClockHelper | Runtime Clock Helper 接口,共包含 2 个公开字段或方法。 |
RuntimeDeterminismResolution | 接口 | interface RuntimeDeterminismResolution | Runtime Determinism Resolution 接口,共包含 2 个公开字段或方法。 |
RuntimeDeterminismResolveRequest | 接口 | interface RuntimeDeterminismResolveRequest | Runtime Determinism Resolve Request 接口,共包含 3 个公开字段或方法。 |
RuntimeDeterminismScope | 接口 | interface RuntimeDeterminismScope | Runtime Determinism Scope 接口,共包含 5 个公开字段或方法。 |
RuntimeDeterminismStore | 接口 | interface RuntimeDeterminismStore | Runtime Determinism Store 接口,共包含 1 个公开字段或方法。 |
RuntimeDeterministicObservation | 接口 | interface RuntimeDeterministicObservation | Runtime Deterministic Observation 接口,共包含 4 个公开字段或方法。 |
RuntimeEventAppendOptions | 接口 | interface RuntimeEventAppendOptions | Runtime Event Append Options 接口,共包含 4 个公开字段或方法。 |
RuntimeEventCommitPort | 接口 | interface RuntimeEventCommitPort | Runtime Event Commit Port 接口,共包含 2 个公开字段或方法。 |
RuntimeEventCommitRequest | 接口 | interface RuntimeEventCommitRequest | Runtime Event Commit Request 接口,共包含 4 个公开字段或方法。 |
RuntimeEventHelper | 接口 | interface RuntimeEventHelper | Runtime Event Helper 接口,共包含 3 个公开字段或方法。 |
RuntimeHelperExecutionScope | 接口 | interface RuntimeHelperExecutionScope | Runtime Helper Execution Scope 接口,共包含 6 个公开字段或方法。 |
RuntimeHelperSdk | 接口 | interface RuntimeHelperSdk | Runtime Helper Sdk 接口,共包含 4 个公开字段或方法。 |
RuntimeIdHelper | 接口 | interface RuntimeIdHelper | Runtime ID Helper 接口,共包含 1 个公开字段或方法。 |
RuntimeIoHelperSdk | 接口 | interface RuntimeIoHelperSdk | Runtime Io Helper Sdk 接口,共包含 2 个公开字段或方法。 |
RuntimeObservationEventInput | 接口 | interface RuntimeObservationEventInput | Runtime Observation Event Input 接口,共包含 3 个公开字段或方法。 |
RuntimeResourceAcquireOptions | 接口 | interface RuntimeResourceAcquireOptions | Runtime Resource Acquire Options 接口,共包含 2 个公开字段或方法。 |
RuntimeResourceHelper | 接口 | interface RuntimeResourceHelper | Runtime Resource Helper 接口,共包含 4 个公开字段或方法。 |
RuntimeResourceHelperDependencies | 接口 | interface RuntimeResourceHelperDependencies | Runtime Resource Helper Dependencies 接口,共包含 5 个公开字段或方法。 |
RuntimeResourceRenewOptions | 接口 | interface RuntimeResourceRenewOptions | Runtime Resource Renew Options 接口,共包含 1 个公开字段或方法。 |
RuntimeTransitionHelper | 接口 | interface RuntimeTransitionHelper | Runtime Transition Helper 接口,共包含 4 个公开字段或方法。 |
RuntimeTransitionProposal | 接口 | interface RuntimeTransitionProposal | Runtime Transition Proposal 接口,共包含 3 个公开字段或方法。 |
RuntimeWaitHelper | 接口 | interface RuntimeWaitHelper | Runtime Wait Helper 接口,共包含 4 个公开字段或方法。 |
RuntimeWaitIntent | 接口 | interface RuntimeWaitIntent | Runtime Wait Intent 接口,共包含 8 个公开字段或方法。 |
SignalWaitRequest | 接口 | interface SignalWaitRequest | Signal Wait Request 接口,共包含 5 个公开字段或方法。 |
TimerWaitRequest | 接口 | interface TimerWaitRequest | Timer 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
声明
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
声明
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
声明
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 个公开字段或方法。
- 种类: 接口
- 导入:
import type { PauseRequest } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-helpers
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeIdHelper } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-helpers
声明
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
声明
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
声明
export interface RuntimeObservationEventInput<T extends RuntimeJsonValue = RuntimeJsonValue> {
type: RuntimeObservationEventType;
payload: T;
options?: RuntimeEventAppendOptions;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
options | 属性 | options?: RuntimeEventAppendOptions | 公开属性;类型、只读和可选状态以签名列为准。 |
payload | 属性 | payload: T | 公开属性;类型、只读和可选状态以签名列为准。 |
type | 属性 | type: | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeResourceAcquireOptions
Runtime Resource Acquire Options 接口,共包含 2 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeResourceAcquireOptions } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-helpers
声明
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
声明
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
声明
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
声明
export interface RuntimeResourceRenewOptions {
ttlMs: number;
}契约成员
| 成员 | 种类 | 签名 | 说明 |
|---|---|---|---|
ttlMs | 属性 | ttlMs: number | 公开属性;类型、只读和可选状态以签名列为准。 |
RuntimeTransitionHelper
Runtime Transition Helper 接口,共包含 4 个公开字段或方法。
- 种类: 接口
- 导入:
import type { RuntimeTransitionHelper } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-helpers
声明
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
声明
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
声明
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
声明
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
声明
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
声明
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
声明
export type RuntimeDeterministicObservationKind = (typeof RUNTIME_DETERMINISTIC_OBSERVATION_KINDS)[number];RuntimeJsonValue
Runtime JSON Value 公共类型别名;完整类型表达式见声明。
- 种类: 类型
- 导入:
import type { RuntimeJsonValue } from '@codesoul-co/hypha-core'; - 源码模块:
contracts/runtime-helpers
声明
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
声明
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
声明
export type RuntimeWaitIntentType = (typeof RUNTIME_WAIT_INTENT_TYPES)[number];