Skip to content

@codesoul-co/hypha-core / specs

模块用法

用于声明并运行时校验契约。Specs 模块公开 2 常量、2 函数、22 接口、2 类型。

从包入口导入

ts
import {
  allowAllPolicyEngine,
  denyExternalEffectsPolicyEngine,
  assertVersionedSpec,
  createPolicySpecEngine,
} from '@codesoul-co/hypha-core';

import type {
  AuditPolicySpec,
  ContextSourceSpec,
  ContextSpec,
  DeploymentSpec,
  EvaluationSpec,
  HarnessedAgentSystemSpec,
  HumanReviewPolicySpec,
  JsonSchema,
} from '@codesoul-co/hypha-core';

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

使用要点

  • 24 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。
  • 2 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。
  • 2 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

公共导出

Symbol种类签名说明
allowAllPolicyEngine常量const allowAllPolicyEngine: PolicyEnginespecs 模块导出的 Allow All Policy Engine 常量。
denyExternalEffectsPolicyEngine常量const denyExternalEffectsPolicyEngine: PolicyEnginespecs 模块导出的 Deny External Effects Policy Engine 常量。
assertVersionedSpec函数assertVersionedSpec(spec: VersionedSpec, label?: string): voidAssert Versioned Spec 函数,提供 1 个公开调用签名;参数与返回类型见下表。
createPolicySpecEngine函数createPolicySpecEngine(policy: PolicySpec): PolicyEngineCreate Policy Spec Engine 函数,提供 1 个公开调用签名;参数与返回类型见下表。
AuditPolicySpec接口interface AuditPolicySpecAudit Policy Spec 接口,共包含 4 个公开字段或方法。
ContextSourceSpec接口interface ContextSourceSpec extends VersionedSpec, SpecMetadataContext Source Spec 接口,共包含 11 个公开字段或方法。
ContextSpec接口interface ContextSpec extends VersionedSpec, SpecMetadataContext Spec 接口,共包含 12 个公开字段或方法。
DeploymentSpec接口interface DeploymentSpec extends VersionedSpec, SpecMetadataDeployment Spec 接口,共包含 11 个公开字段或方法。
EvaluationSpec接口interface EvaluationSpec extends VersionedSpec, SpecMetadataEvaluation Spec 接口,共包含 11 个公开字段或方法。
HarnessedAgentSystemSpec接口interface HarnessedAgentSystemSpec extends VersionedSpec, SpecMetadataHarnessed Agent System Spec 接口,共包含 25 个公开字段或方法。
HumanReviewPolicySpec接口interface HumanReviewPolicySpecHuman Review Policy Spec 接口,共包含 4 个公开字段或方法。
JsonSchema接口interface JsonSchema的 JSON Schema。
OutputContractSpec接口interface OutputContractSpec extends VersionedSpec, SpecMetadataOutput Contract Spec 接口,共包含 9 个公开字段或方法。
PolicyDecision接口interface PolicyDecisionPolicy Decision 接口,共包含 6 个公开字段或方法。
PolicyEngine接口interface PolicyEnginePolicy Engine 接口,共包含 1 个公开字段或方法。
PolicyEvaluationContext接口interface PolicyEvaluationContextPolicy Evaluation Context 接口,共包含 7 个公开字段或方法。
PolicyRuleSpec接口interface PolicyRuleSpec extends VersionedSpec, SpecMetadataPolicy Rule Spec 接口,共包含 12 个公开字段或方法。
PolicySpec接口interface PolicySpec extends VersionedSpec, SpecMetadataPolicy Spec 接口,共包含 10 个公开字段或方法。
RegressionSpec接口interface RegressionSpec extends VersionedSpec, SpecMetadataRegression Spec 接口,共包含 10 个公开字段或方法。
ReplaySpec接口interface ReplaySpec extends VersionedSpec, SpecMetadataReplay Spec 接口,共包含 13 个公开字段或方法。
RetryPolicySpec接口interface RetryPolicySpecRetry Policy Spec 接口,共包含 6 个公开字段或方法。
SpecMetadata接口interface SpecMetadataSpec Metadata 接口,共包含 6 个公开字段或方法。
SpecRef接口interface SpecRefSpec Ref 接口,共包含 3 个公开字段或方法。
TimeoutPolicySpec接口interface TimeoutPolicySpecTimeout Policy Spec 接口,共包含 2 个公开字段或方法。
TraceSpec接口interface TraceSpec extends VersionedSpec, SpecMetadataTrace Spec 接口,共包含 11 个公开字段或方法。
VersionedSpec接口interface VersionedSpecVersioned Spec 接口,共包含 2 个公开字段或方法。
RiskLevel类型type RiskLevel = 'low' | 'medium' | 'high' | 'critical'Risk Level 公共类型别名;完整类型表达式见声明。
SideEffectLevel类型type SideEffectLevel = 'none' | 'read' | 'write' | 'external_effect' | 'irreversible'Side Effect Level 公共类型别名;完整类型表达式见声明。

allowAllPolicyEngine

specs 模块导出的 Allow All Policy Engine 常量。

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

声明

text
export declare const allowAllPolicyEngine: PolicyEngine;

denyExternalEffectsPolicyEngine

specs 模块导出的 Deny External Effects Policy Engine 常量。

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

声明

text
export declare const denyExternalEffectsPolicyEngine: PolicyEngine;

assertVersionedSpec

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

  • 种类: 函数
  • 导入: import { assertVersionedSpec } from '@codesoul-co/hypha-core';
  • 源码模块: specs

声明

text
export declare function assertVersionedSpec(spec: VersionedSpec, label?: string): void;

调用签名

text
assertVersionedSpec(spec: VersionedSpec, label?: string): void

参数

参数类型必需说明
specVersionedSpec必需参数;接受的值由类型列定义。
labelstring可选参数;接受的值由类型列定义。

返回值

  • 类型: void
  • 说明: 不返回值。

createPolicySpecEngine

Create Policy Spec Engine 函数,提供 1 个公开调用签名;参数与返回类型见下表。

  • 种类: 函数
  • 导入: import { createPolicySpecEngine } from '@codesoul-co/hypha-core';
  • 源码模块: specs

声明

text
export declare function createPolicySpecEngine(policy: PolicySpec): PolicyEngine;

调用签名

text
createPolicySpecEngine(policy: PolicySpec): PolicyEngine

参数

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

返回值

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

AuditPolicySpec

Audit Policy Spec 接口,共包含 4 个公开字段或方法。

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

声明

text
export interface AuditPolicySpec {
    enabled: boolean;
    includeInput?: boolean;
    includeOutput?: boolean;
    redactPaths?: string[];
}

契约成员

成员种类签名说明
enabled属性enabled: boolean公开属性;类型、只读和可选状态以签名列为准。
includeInput属性includeInput?: boolean公开属性;类型、只读和可选状态以签名列为准。
includeOutput属性includeOutput?: boolean公开属性;类型、只读和可选状态以签名列为准。
redactPaths属性redactPaths?: string[]公开属性;类型、只读和可选状态以签名列为准。

ContextSourceSpec

Context Source Spec 接口,共包含 11 个公开字段或方法。

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

声明

text
export interface ContextSourceSpec extends VersionedSpec, SpecMetadata {
    type: 'memory' | 'artifact' | 'skill' | 'domain' | 'mcp' | 'user_input' | 'system';
    provenanceRequired?: boolean;
    trustLevel?: 'trusted' | 'reviewed' | 'untrusted';
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
provenanceRequired属性provenanceRequired?: boolean公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
trustLevel属性trustLevel?: "trusted" | "reviewed" | "untrusted"公开属性;类型、只读和可选状态以签名列为准。
type属性type: "memory" | "artifact" | "skill" | "domain" | "mcp" | "user_input" | "system"公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

ContextSpec

Context Spec 接口,共包含 12 个公开字段或方法。

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

声明

text
export interface ContextSpec extends VersionedSpec, SpecMetadata {
    sources: ContextSourceSpec[];
    tokenBudget?: number;
    provenancePolicy?: 'required' | 'best_effort' | 'none';
    instructionBoundaryPolicy?: 'strict' | 'tagged' | 'none';
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
instructionBoundaryPolicy属性instructionBoundaryPolicy?: "none" | "strict" | "tagged"公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
provenancePolicy属性provenancePolicy?: "none" | "required" | "best_effort"公开属性;类型、只读和可选状态以签名列为准。
sources属性sources: ContextSourceSpec[]公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
tokenBudget属性tokenBudget?: number公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

DeploymentSpec

Deployment Spec 接口,共包含 11 个公开字段或方法。

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

声明

text
export interface DeploymentSpec extends VersionedSpec, SpecMetadata {
    mode: 'local' | 'self_hosted' | 'managed';
    runtimeMode?: 'single-user' | 'multi-user';
    configRefs?: SpecRef[];
}

契约成员

成员种类签名说明
configRefs属性configRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
mode属性mode: "local" | "self_hosted" | "managed"公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
runtimeMode属性runtimeMode?: "single-user" | "multi-user"公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

EvaluationSpec

Evaluation Spec 接口,共包含 11 个公开字段或方法。

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

声明

text
export interface EvaluationSpec extends VersionedSpec, SpecMetadata {
    type: 'schema' | 'output_contract' | 'tool_trace' | 'policy' | 'process' | 'cost' | 'latency' | 'regression' | 'human';
    rubric?: JsonSchema;
    deterministic?: boolean;
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
deterministic属性deterministic?: boolean公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
rubric属性rubric?: JsonSchema公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
type属性type: "schema" | "output_contract" | "tool_trace" | "policy" | "process" | "cost" | "latency" | "regression" | "human"公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

HarnessedAgentSystemSpec

Harnessed Agent System Spec 接口,共包含 25 个公开字段或方法。

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

声明

text
export interface HarnessedAgentSystemSpec extends VersionedSpec, SpecMetadata {
    agentRef: SpecRef;
    fsmProcessRef: SpecRef;
    traceRef: SpecRef;
    policyRefs?: SpecRef[];
    memoryRefs?: SpecRef[];
    toolRefs?: SpecRef[];
    skillRefs?: SpecRef[];
    mcpRefs?: SpecRef[];
    contextRefs?: SpecRef[];
    reasoningRefs?: SpecRef[];
    outputContractRefs?: SpecRef[];
    businessRuleRefs?: SpecRef[];
    modelProfileRef?: SpecRef;
    evaluationRefs?: SpecRef[];
    replayRef?: SpecRef;
    regressionRef?: SpecRef;
    deploymentRef?: SpecRef;
}

契约成员

成员种类签名说明
agentRef属性agentRef: SpecRef公开属性;类型、只读和可选状态以签名列为准。
businessRuleRefs属性businessRuleRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
contextRefs属性contextRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
deploymentRef属性deploymentRef?: SpecRef公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
evaluationRefs属性evaluationRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
fsmProcessRef属性fsmProcessRef: SpecRef公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
mcpRefs属性mcpRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
memoryRefs属性memoryRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
modelProfileRef属性modelProfileRef?: SpecRef公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
outputContractRefs属性outputContractRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
policyRefs属性policyRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
reasoningRefs属性reasoningRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
regressionRef属性regressionRef?: SpecRef公开属性;类型、只读和可选状态以签名列为准。
replayRef属性replayRef?: SpecRef公开属性;类型、只读和可选状态以签名列为准。
skillRefs属性skillRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
toolRefs属性toolRefs?: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
traceRef属性traceRef: SpecRef公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

HumanReviewPolicySpec

Human Review Policy Spec 接口,共包含 4 个公开字段或方法。

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

声明

text
export interface HumanReviewPolicySpec {
    required: boolean;
    reason?: string;
    approverRole?: string;
    timeoutPolicy?: TimeoutPolicySpec;
}

契约成员

成员种类签名说明
approverRole属性approverRole?: string公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
required属性required: boolean公开属性;类型、只读和可选状态以签名列为准。
timeoutPolicy属性timeoutPolicy?: TimeoutPolicySpec公开属性;类型、只读和可选状态以签名列为准。

JsonSchema

的 JSON Schema。

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

声明

text
export interface JsonSchema {
    type?: string;
    properties?: Record<string, JsonSchema>;
    required?: string[];
    items?: JsonSchema;
    enum?: unknown[];
    additionalProperties?: boolean | JsonSchema;
    [key: string]: unknown;
}

契约成员

成员种类签名说明
additionalProperties属性additionalProperties?: boolean | JsonSchema公开属性;类型、只读和可选状态以签名列为准。
enum属性enum?: unknown[]公开属性;类型、只读和可选状态以签名列为准。
items属性items?: JsonSchema公开属性;类型、只读和可选状态以签名列为准。
properties属性properties?: Record<string, JsonSchema>公开属性;类型、只读和可选状态以签名列为准。
required属性required?: string[]公开属性;类型、只读和可选状态以签名列为准。
type属性type?: string公开属性;类型、只读和可选状态以签名列为准。

OutputContractSpec

Output Contract Spec 接口,共包含 9 个公开字段或方法。

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

声明

text
export interface OutputContractSpec extends VersionedSpec, SpecMetadata {
    schema: JsonSchema;
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
schema属性schema: JsonSchema公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

PolicyDecision

Policy Decision 接口,共包含 6 个公开字段或方法。

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

声明

text
export interface PolicyDecision {
    allowed: boolean;
    requiresHumanReview?: boolean;
    policyId?: string;
    ruleId?: string;
    reason?: string;
    metadata?: Record<string, unknown>;
}

契约成员

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

PolicyEngine

Policy Engine 接口,共包含 1 个公开字段或方法。

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

声明

text
export interface PolicyEngine {
    evaluate(context: PolicyEvaluationContext): Promise<PolicyDecision>;
}

契约成员

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

PolicyEvaluationContext

Policy Evaluation Context 接口,共包含 7 个公开字段或方法。

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

声明

text
export interface PolicyEvaluationContext<TInput = unknown> {
    runId: string;
    stepId?: string;
    userId?: string;
    capabilityId?: string;
    sideEffectLevel?: SideEffectLevel;
    input?: TInput;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
capabilityId属性capabilityId?: string公开属性;类型、只读和可选状态以签名列为准。
input属性input?: TInput公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevel属性sideEffectLevel?: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。
stepId属性stepId?: string公开属性;类型、只读和可选状态以签名列为准。
userId属性userId?: string公开属性;类型、只读和可选状态以签名列为准。

PolicyRuleSpec

Policy Rule Spec 接口,共包含 12 个公开字段或方法。

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

声明

text
export interface PolicyRuleSpec extends VersionedSpec, SpecMetadata {
    effect: 'allow' | 'deny' | 'require_human_review';
    expression?: string;
    sideEffectLevels?: SideEffectLevel[];
    scopes?: string[];
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
effect属性effect: "allow" | "deny" | "require_human_review"公开属性;类型、只读和可选状态以签名列为准。
expression属性expression?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
scopes属性scopes?: string[]公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevels属性sideEffectLevels?: SideEffectLevel[]公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

PolicySpec

Policy Spec 接口,共包含 10 个公开字段或方法。

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

声明

text
export interface PolicySpec extends VersionedSpec, SpecMetadata {
    rules: PolicyRuleSpec[];
    defaultEffect?: 'allow' | 'deny';
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
defaultEffect属性defaultEffect?: "allow" | "deny"公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
rules属性rules: PolicyRuleSpec[]公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

RegressionSpec

Regression Spec 接口,共包含 10 个公开字段或方法。

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

声明

text
export interface RegressionSpec extends VersionedSpec, SpecMetadata {
    fixtureRefs: SpecRef[];
    requiredChecks: Array<'event_types' | 'state_path' | 'tool_calls' | 'policy_decisions' | 'output_contract'>;
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
fixtureRefs属性fixtureRefs: SpecRef[]公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
requiredChecks属性requiredChecks: ("output_contract" | "state_path" | "event_types" | "tool_calls" | "policy_decisions")[]公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

ReplaySpec

Replay Spec 接口,共包含 13 个公开字段或方法。

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

声明

text
export interface ReplaySpec extends VersionedSpec, SpecMetadata {
    captureModelIO?: boolean;
    captureToolIO?: boolean;
    captureMemoryReadSet?: boolean;
    capturePolicyDecisions?: boolean;
    snapshotPolicy?: 'none' | 'state_path' | 'full';
}

契约成员

成员种类签名说明
captureMemoryReadSet属性captureMemoryReadSet?: boolean公开属性;类型、只读和可选状态以签名列为准。
captureModelIO属性captureModelIO?: boolean公开属性;类型、只读和可选状态以签名列为准。
capturePolicyDecisions属性capturePolicyDecisions?: boolean公开属性;类型、只读和可选状态以签名列为准。
captureToolIO属性captureToolIO?: boolean公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
snapshotPolicy属性snapshotPolicy?: "none" | "state_path" | "full"公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

RetryPolicySpec

Retry Policy Spec 接口,共包含 6 个公开字段或方法。

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

声明

text
export interface RetryPolicySpec {
    maxAttempts: number;
    backoffMs?: number;
    maxBackoffMs?: number;
    jitterRatio?: number;
    maxElapsedMs?: number;
    retryableCodes?: string[];
}

契约成员

成员种类签名说明
backoffMs属性backoffMs?: number公开属性;类型、只读和可选状态以签名列为准。
jitterRatio属性jitterRatio?: number公开属性;类型、只读和可选状态以签名列为准。
maxAttempts属性maxAttempts: number公开属性;类型、只读和可选状态以签名列为准。
maxBackoffMs属性maxBackoffMs?: number公开属性;类型、只读和可选状态以签名列为准。
maxElapsedMs属性maxElapsedMs?: number公开属性;类型、只读和可选状态以签名列为准。
retryableCodes属性retryableCodes?: string[]公开属性;类型、只读和可选状态以签名列为准。

SpecMetadata

Spec Metadata 接口,共包含 6 个公开字段或方法。

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

声明

text
export interface SpecMetadata {
    name?: string;
    description?: string;
    owner?: string;
    tags?: string[];
    createdAt?: string;
    updatedAt?: string;
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。

SpecRef

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

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

声明

text
export interface SpecRef {
    id: string;
    version?: string;
    revision?: string;
}

契约成员

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

TimeoutPolicySpec

Timeout Policy Spec 接口,共包含 2 个公开字段或方法。

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

声明

text
export interface TimeoutPolicySpec {
    timeoutMs: number;
    onTimeout?: 'fail' | 'retry' | 'human_review';
}

契约成员

成员种类签名说明
onTimeout属性onTimeout?: "fail" | "retry" | "human_review"公开属性;类型、只读和可选状态以签名列为准。
timeoutMs属性timeoutMs: number公开属性;类型、只读和可选状态以签名列为准。

TraceSpec

Trace Spec 接口,共包含 11 个公开字段或方法。

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

声明

text
export interface TraceSpec extends VersionedSpec, SpecMetadata {
    eventTypes: string[];
    retentionPolicy?: string;
    redactionPolicy?: string;
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
eventTypes属性eventTypes: string[]公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
redactionPolicy属性redactionPolicy?: string公开属性;类型、只读和可选状态以签名列为准。
retentionPolicy属性retentionPolicy?: string公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

VersionedSpec

Versioned Spec 接口,共包含 2 个公开字段或方法。

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

声明

text
export interface VersionedSpec {
    id: string;
    version: string;
}

契约成员

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

RiskLevel

Risk Level 公共类型别名;完整类型表达式见声明。

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

声明

text
export type RiskLevel = 'low' | 'medium' | 'high' | 'critical';

SideEffectLevel

Side Effect Level 公共类型别名;完整类型表达式见声明。

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

声明

text
export type SideEffectLevel = 'none' | 'read' | 'write' | 'external_effect' | 'irreversible';