Skip to content

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

模块用法

用于声明并运行时校验契约。Runtime human task 模块公开 3 常量、3 接口、3 类型。

从包入口导入

ts
import {
  RUNTIME_HUMAN_TASK_DECISIONS,
  RUNTIME_HUMAN_TASK_KINDS,
  RUNTIME_HUMAN_TASK_STATUSES,
} from '@codesoul-co/hypha-core';

import type {
  RuntimeHumanTask,
  RuntimeHumanTaskDecisionCommand,
  RuntimeHumanTaskRequest,
  RuntimeHumanTaskDecision,
  RuntimeHumanTaskKind,
  RuntimeHumanTaskStatus,
} from '@codesoul-co/hypha-core';

使用要点

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

公共导出

Symbol种类签名说明
RUNTIME_HUMAN_TASK_DECISIONS常量const RUNTIME_HUMAN_TASK_DECISIONS: readonly ["approved", "rejected", "expired", "cancelled", "superseded"]contracts/runtime-human-task 模块导出的 RUNTIME HUMAN TASK DECISIONS 常量。
RUNTIME_HUMAN_TASK_KINDS常量const RUNTIME_HUMAN_TASK_KINDS: readonly ["tool", "skill", "prompt", "memory", "execution", "mcp", "policy"]contracts/runtime-human-task 模块导出的 RUNTIME HUMAN TASK KINDS 常量。
RUNTIME_HUMAN_TASK_STATUSES常量const RUNTIME_HUMAN_TASK_STATUSES: readonly ["pending", "approved", "rejected", "expired", "cancelled", "superseded"]contracts/runtime-human-task 模块导出的 RUNTIME HUMAN TASK STATUSES 常量。
RuntimeHumanTask接口interface RuntimeHumanTaskRuntime Human Task 接口,共包含 26 个公开字段或方法。
RuntimeHumanTaskDecisionCommand接口interface RuntimeHumanTaskDecisionCommandRuntime Human Task Decision Command 接口,共包含 11 个公开字段或方法。
RuntimeHumanTaskRequest接口interface RuntimeHumanTaskRequestRuntime Human Task Request 接口,共包含 15 个公开字段或方法。
RuntimeHumanTaskDecision类型type RuntimeHumanTaskDecision = (typeof RUNTIME_HUMAN_TASK_DECISIONS)[number]Runtime Human Task Decision 公共类型别名;完整类型表达式见声明。
RuntimeHumanTaskKind类型type RuntimeHumanTaskKind = (typeof RUNTIME_HUMAN_TASK_KINDS)[number]Runtime Human Task Kind 公共类型别名;完整类型表达式见声明。
RuntimeHumanTaskStatus类型type RuntimeHumanTaskStatus = (typeof RUNTIME_HUMAN_TASK_STATUSES)[number]Runtime Human Task Status 公共类型别名;完整类型表达式见声明。

RUNTIME_HUMAN_TASK_DECISIONS

contracts/runtime-human-task 模块导出的 RUNTIME HUMAN TASK DECISIONS 常量。

声明

text
export declare const RUNTIME_HUMAN_TASK_DECISIONS: readonly ["approved", "rejected", "expired", "cancelled", "superseded"];

RUNTIME_HUMAN_TASK_KINDS

contracts/runtime-human-task 模块导出的 RUNTIME HUMAN TASK KINDS 常量。

声明

text
export declare const RUNTIME_HUMAN_TASK_KINDS: readonly ["tool", "skill", "prompt", "memory", "execution", "mcp", "policy"];

RUNTIME_HUMAN_TASK_STATUSES

contracts/runtime-human-task 模块导出的 RUNTIME HUMAN TASK STATUSES 常量。

声明

text
export declare const RUNTIME_HUMAN_TASK_STATUSES: readonly ["pending", "approved", "rejected", "expired", "cancelled", "superseded"];

RuntimeHumanTask

Runtime Human Task 接口,共包含 26 个公开字段或方法。

声明

text
export interface RuntimeHumanTask {
    taskId: string;
    runId: string;
    stateId: string;
    stateAttempt: number;
    kind: RuntimeHumanTaskKind;
    subjectRef: string;
    subjectHash: string;
    status: RuntimeHumanTaskStatus;
    requestedBy: string;
    allowedDecisionScopes: string[];
    requestedAt: string;
    expiresAt?: string;
    revision: number;
    checkpointRef?: string;
    policyRef?: string;
    providerRevision?: string;
    activityDescriptorRef?: string;
    activityDescriptorHash?: string;
    decisionEventId?: string;
    decisionCommandId?: string;
    decisionIdempotencyKey?: string;
    decidedBy?: string;
    decidedAt?: string;
    supersededByTaskId?: string;
    reason?: string;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
activityDescriptorHash属性activityDescriptorHash?: string公开属性;类型、只读和可选状态以签名列为准。
activityDescriptorRef属性activityDescriptorRef?: string公开属性;类型、只读和可选状态以签名列为准。
allowedDecisionScopes属性allowedDecisionScopes: string[]公开属性;类型、只读和可选状态以签名列为准。
checkpointRef属性checkpointRef?: string公开属性;类型、只读和可选状态以签名列为准。
decidedAt属性decidedAt?: string公开属性;类型、只读和可选状态以签名列为准。
decidedBy属性decidedBy?: string公开属性;类型、只读和可选状态以签名列为准。
decisionCommandId属性decisionCommandId?: string公开属性;类型、只读和可选状态以签名列为准。
decisionEventId属性decisionEventId?: string公开属性;类型、只读和可选状态以签名列为准。
decisionIdempotencyKey属性decisionIdempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
kind属性kind: "memory" | "skill" | "mcp" | "policy" | "tool" | "execution" | "prompt"公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
policyRef属性policyRef?: string公开属性;类型、只读和可选状态以签名列为准。
providerRevision属性providerRevision?: string公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
requestedAt属性requestedAt: string公开属性;类型、只读和可选状态以签名列为准。
requestedBy属性requestedBy: string公开属性;类型、只读和可选状态以签名列为准。
revision属性revision: number公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
stateAttempt属性stateAttempt: number公开属性;类型、只读和可选状态以签名列为准。
stateId属性stateId: string公开属性;类型、只读和可选状态以签名列为准。
status属性status: "rejected" | "cancelled" | "expired" | "pending" | "approved" | "superseded"公开属性;类型、只读和可选状态以签名列为准。
subjectHash属性subjectHash: string公开属性;类型、只读和可选状态以签名列为准。
subjectRef属性subjectRef: string公开属性;类型、只读和可选状态以签名列为准。
supersededByTaskId属性supersededByTaskId?: string公开属性;类型、只读和可选状态以签名列为准。
taskId属性taskId: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeHumanTaskDecisionCommand

Runtime Human Task Decision Command 接口,共包含 11 个公开字段或方法。

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

声明

text
export interface RuntimeHumanTaskDecisionCommand {
    commandId: string;
    scope: RuntimeScope;
    principal: RuntimePrincipal;
    taskId: string;
    expectedRevision: number;
    expectedSubjectHash: string;
    decision: RuntimeHumanTaskDecision;
    decidedAt: string;
    supersededByTaskId?: string;
    reason?: string;
    idempotencyKey?: string;
}

契约成员

成员种类签名说明
commandId属性commandId: string公开属性;类型、只读和可选状态以签名列为准。
decidedAt属性decidedAt: string公开属性;类型、只读和可选状态以签名列为准。
decision属性decision: "rejected" | "cancelled" | "expired" | "approved" | "superseded"公开属性;类型、只读和可选状态以签名列为准。
expectedRevision属性expectedRevision: number公开属性;类型、只读和可选状态以签名列为准。
expectedSubjectHash属性expectedSubjectHash: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: RuntimePrincipal公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: RuntimeScope公开属性;类型、只读和可选状态以签名列为准。
supersededByTaskId属性supersededByTaskId?: string公开属性;类型、只读和可选状态以签名列为准。
taskId属性taskId: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeHumanTaskRequest

Runtime Human Task Request 接口,共包含 15 个公开字段或方法。

声明

text
export interface RuntimeHumanTaskRequest {
    taskId: string;
    kind: RuntimeHumanTaskKind;
    subjectRef: string;
    subjectHash: string;
    requestedBy: string;
    allowedDecisionScopes: string[];
    requestedAt: string;
    expiresAt?: string;
    checkpointRef?: string;
    policyRef?: string;
    providerRevision?: string;
    activityDescriptorRef?: string;
    activityDescriptorHash?: string;
    reason?: string;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
activityDescriptorHash属性activityDescriptorHash?: string公开属性;类型、只读和可选状态以签名列为准。
activityDescriptorRef属性activityDescriptorRef?: string公开属性;类型、只读和可选状态以签名列为准。
allowedDecisionScopes属性allowedDecisionScopes: string[]公开属性;类型、只读和可选状态以签名列为准。
checkpointRef属性checkpointRef?: string公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
kind属性kind: "memory" | "skill" | "mcp" | "policy" | "tool" | "execution" | "prompt"公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
policyRef属性policyRef?: string公开属性;类型、只读和可选状态以签名列为准。
providerRevision属性providerRevision?: string公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
requestedAt属性requestedAt: string公开属性;类型、只读和可选状态以签名列为准。
requestedBy属性requestedBy: string公开属性;类型、只读和可选状态以签名列为准。
subjectHash属性subjectHash: string公开属性;类型、只读和可选状态以签名列为准。
subjectRef属性subjectRef: string公开属性;类型、只读和可选状态以签名列为准。
taskId属性taskId: string公开属性;类型、只读和可选状态以签名列为准。

RuntimeHumanTaskDecision

Runtime Human Task Decision 公共类型别名;完整类型表达式见声明。

声明

text
export type RuntimeHumanTaskDecision = (typeof RUNTIME_HUMAN_TASK_DECISIONS)[number];

RuntimeHumanTaskKind

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

声明

text
export type RuntimeHumanTaskKind = (typeof RUNTIME_HUMAN_TASK_KINDS)[number];

RuntimeHumanTaskStatus

Runtime Human Task Status 公共类型别名;完整类型表达式见声明。

声明

text
export type RuntimeHumanTaskStatus = (typeof RUNTIME_HUMAN_TASK_STATUSES)[number];