Skip to content

@codesoul-co/hypha-core / modules/runtime/runtime-human-task

模块用法

用于执行该边界的运行时行为。Runtime human task 模块公开 5 函数。

从包入口导入

ts
import {
  assertRuntimeHumanTaskDecision,
  assertRuntimeHumanTaskResume,
  projectRuntimeHumanTasks,
  runtimeHumanTaskKind,
  runtimeHumanTaskResolutionEventId,
} from '@codesoul-co/hypha-core';

使用要点

  • 5 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。

公共导出

Symbol种类签名说明
assertRuntimeHumanTaskDecision函数assertRuntimeHumanTaskDecision<TTask extends RuntimeHumanTask>(task: TTask | undefined, command: Pick<RuntimeHumanTaskDecisionCommand, "expectedRevision" | "expectedSubjectHash" | "principal" | "decidedAt" | "decision">): TTaskAssert Runtime Human Task Decision 函数,提供 1 个公开调用签名;参数与返回类型见下表。
assertRuntimeHumanTaskResume函数assertRuntimeHumanTaskResume<TTask extends RuntimeHumanTask>(task: TTask | undefined, expected: { taskId: string; kind: RuntimeHumanTaskKind; subjectRef: string; subjectHash: string; revision: number; requestedBy: string; resumedAt: string; checkpointRef?: string; policyRef?: string; providerRevision?: string; activityDescriptorRef?: string; activityDescriptorHash?: string; }): TTaskAssert Runtime Human Task Resume 函数,提供 1 个公开调用签名;参数与返回类型见下表。
projectRuntimeHumanTasks函数projectRuntimeHumanTasks(events: readonly FrameworkEvent[]): RuntimeHumanTask[]Project Runtime Human Tasks 函数,提供 1 个公开调用签名;参数与返回类型见下表。
runtimeHumanTaskKind函数runtimeHumanTaskKind(value: string): RuntimeHumanTaskKind | undefinedRuntime Human Task Kind 函数,提供 1 个公开调用签名;参数与返回类型见下表。
runtimeHumanTaskResolutionEventId函数runtimeHumanTaskResolutionEventId(input: { runId: string; taskId: string; expectedRevision: number; }): stringRuntime Human Task Resolution Event ID 函数,提供 1 个公开调用签名;参数与返回类型见下表。

assertRuntimeHumanTaskDecision

Assert Runtime Human Task Decision 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明

text
export declare function assertRuntimeHumanTaskDecision<TTask extends RuntimeHumanTask>(task: TTask | undefined, command: Pick<RuntimeHumanTaskDecisionCommand, 'expectedRevision' | 'expectedSubjectHash' | 'principal' | 'decidedAt' | 'decision'>): TTask;

调用签名

text
assertRuntimeHumanTaskDecision<TTask extends RuntimeHumanTask>(task: TTask | undefined, command: Pick<RuntimeHumanTaskDecisionCommand, "expectedRevision" | "expectedSubjectHash" | "principal" | "decidedAt" | "decision">): TTask

参数

参数类型必需说明
taskTTask必需参数;接受的值由类型列定义。
commandPick<RuntimeHumanTaskDecisionCommand, "principal" | "decidedAt" | "expectedRevision" | "expectedSubjectHash" | "decision">必需参数;接受的值由类型列定义。

返回值

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

assertRuntimeHumanTaskResume

Assert Runtime Human Task Resume 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明

text
export declare function assertRuntimeHumanTaskResume<TTask extends RuntimeHumanTask>(task: TTask | undefined, expected: {
    taskId: string;
    kind: RuntimeHumanTaskKind;
    subjectRef: string;
    subjectHash: string;
    revision: number;
    requestedBy: string;
    resumedAt: string;
    checkpointRef?: string;
    policyRef?: string;
    providerRevision?: string;
    activityDescriptorRef?: string;
    activityDescriptorHash?: string;
}): TTask;

调用签名

text
assertRuntimeHumanTaskResume<TTask extends RuntimeHumanTask>(task: TTask | undefined, expected: { taskId: string; kind: RuntimeHumanTaskKind; subjectRef: string; subjectHash: string; revision: number; requestedBy: string; resumedAt: string; checkpointRef?: string; policyRef?: string; providerRevision?: string; activityDescriptorRef?: string; activityDescriptorHash?: string; }): TTask

参数

参数类型必需说明
taskTTask必需参数;接受的值由类型列定义。
expected{ taskId: string; kind: RuntimeHumanTaskKind; subjectRef: string; subjectHash: string; revision: number; requestedBy: string; resumedAt: string; checkpointRef?: string; policyRef?: string; providerRevision?: string; activityDescriptorRef?: string; activityDescriptorHash?: string; }必需参数;接受的值由类型列定义。

返回值

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

projectRuntimeHumanTasks

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

声明

text
export declare function projectRuntimeHumanTasks(events: readonly FrameworkEvent[]): RuntimeHumanTask[];

调用签名

text
projectRuntimeHumanTasks(events: readonly FrameworkEvent[]): RuntimeHumanTask[]

参数

参数类型必需说明
eventsreadonly FrameworkEvent<unknown>[]必需参数;接受的值由类型列定义。

返回值

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

runtimeHumanTaskKind

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

声明

text
export declare function runtimeHumanTaskKind(value: string): RuntimeHumanTaskKind | undefined;

调用签名

text
runtimeHumanTaskKind(value: string): RuntimeHumanTaskKind | undefined

参数

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

返回值

  • 类型: "memory" | "skill" | "mcp" | "policy" | "tool" | "execution" | "prompt"
  • 说明: 返回值契约由上述类型定义。

runtimeHumanTaskResolutionEventId

Runtime Human Task Resolution Event ID 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明

text
export declare function runtimeHumanTaskResolutionEventId(input: {
    runId: string;
    taskId: string;
    expectedRevision: number;
}): string;

调用签名

text
runtimeHumanTaskResolutionEventId(input: { runId: string; taskId: string; expectedRevision: number; }): string

参数

参数类型必需说明
input{ runId: string; taskId: string; expectedRevision: number; }必需参数;接受的值由类型列定义。

返回值

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