Skip to content

@codesoul-co/hypha-tools / contracts

模块用法

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

从包入口导入

ts
import {
  effectiveAgentCapabilitySnapshotSchema,
  effectiveCapabilityApprovalSchema,
  governedHumanApprovalDefinition,
  governedHumanApprovalExample,
  governedHumanApprovalJsonSchema,
  governedHumanApprovalPolicySpecSchema,
  governedHumanApprovalRequestSchema,
  governedToolContractDefinition,
} from '@codesoul-co/hypha-tools';

import type {
  EffectiveAgentCapabilitySnapshot,
  EffectiveCapabilityApproval,
  GovernedHumanApprovalPolicySpec,
  GovernedHumanApprovalRequest,
  GovernedToolContractSpec,
  GovernedToolInvocationRecord,
  HumanApprovalDecisionRecord,
  NormalizedToolError,
} from '@codesoul-co/hypha-tools';

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

使用要点

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

运行时校验示例

ts
import { effectiveAgentCapabilitySnapshotSchema } from '@codesoul-co/hypha-tools';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = effectiveAgentCapabilitySnapshotSchema.parse(input);

配置、网络请求或持久化数据等不可信输入应先通过 Runtime Schema,再传给只接受已校验契约的函数或类。

公共导出

Symbol种类签名说明
effectiveAgentCapabilitySnapshotSchema常量const effectiveAgentCapabilitySnapshotSchema: z.ZodObject<{ id: z.ZodString; runId: z.ZodString; agentId: z.ZodString; principalId: z.ZodString; tenantId: z.ZodOptional<z.ZodString>; domainId: z.ZodOptional<z.ZodString>; createdAt: z.ZodString; expiresAt: z.ZodOptional<z.ZodString>; skillRevisions: z.ZodArray<z.ZodObject<{ id: z.ZodString; version: z.ZodString; contentHash: z.ZodString; }, "strip", z.ZodTypeAny, {...Effective Agent Capability Snapshot 的运行时 Schema。
effectiveCapabilityApprovalSchema常量const effectiveCapabilityApprovalSchema: z.ZodObject<{ taskId: z.ZodString; subjectType: z.ZodLiteral<"effective_capability_snapshot">; subjectHash: z.ZodString; snapshotId: z.ZodString; runId: z.ZodString; agentId: z.ZodString; principalId: z.ZodString; approvedBy: z.ZodString; approvedAt: z.ZodString; expiresAt: z.ZodString; status: z.ZodLiteral<"approved">; }, "strict", z.ZodTypeAny, { status: "approved"; runId...Effective Capability Approval 的运行时 Schema。
governedHumanApprovalDefinition常量const governedHumanApprovalDefinition: SpecSchemaDefinition<GovernedHumanApprovalRequest>contracts 模块导出的 Governed Human Approval Definition 常量。
governedHumanApprovalExample常量const governedHumanApprovalExample: GovernedHumanApprovalRequestGoverned Human Approval 的有效示例值。
governedHumanApprovalJsonSchema常量const governedHumanApprovalJsonSchema: JsonSchemaGoverned Human Approval 的 JSON Schema。
governedHumanApprovalPolicySpecSchema常量const governedHumanApprovalPolicySpecSchema: z.ZodObject<{ mode: z.ZodEnum<["never", "policy", "always"]>; requiredForSideEffects: z.ZodOptional<z.ZodArray<z.ZodEnum<["none", "read", "write", "external_effect", "irreversible"]>, "many">>; approverRoles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; minApprovals: z.ZodOptional<z.ZodNumber>; expiresAfterSeconds: z.ZodOptional<z.ZodNumber>; allowParameterEdit: z.Zo...Governed Human Approval Policy Spec 的运行时 Schema。
governedHumanApprovalRequestSchema常量const governedHumanApprovalRequestSchema: z.ZodObject<{ id: z.ZodString; revision: z.ZodNumber; invocationId: z.ZodString; toolRef: z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; revision?: string | undefined; }, { id: string; version?: string | undefined; revision?: string | undefined; ...Governed Human Approval Request 的运行时 Schema。
governedToolContractDefinition常量const governedToolContractDefinition: SpecSchemaDefinition<GovernedToolContractSpec>contracts 模块导出的 Governed Tool Contract Definition 常量。
governedToolContractExample常量const governedToolContractExample: GovernedToolContractSpecGoverned Tool Contract 的有效示例值。
governedToolContractJsonSchema常量const governedToolContractJsonSchema: JsonSchemaGoverned Tool Contract 的 JSON Schema。
governedToolContractJsonSchemas常量const governedToolContractJsonSchemas: Record<string, JsonSchema>contracts 模块导出的 Governed Tool Contract JSON Schemas 常量。
governedToolContractSpecSchema常量const governedToolContractSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; revision: z.ZodString; name: z.ZodString; displayName: z.ZodOptional<z.ZodString>; description: z.ZodString; instructions: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; input: z.ZodObject<{ jsonSchema: z.ZodType<JsonSchema, z.ZodTypeDef, JsonSchema>; schemaId: z.ZodOptional<z.ZodString>; s...Governed Tool Contract Spec 的运行时 Schema。
governedToolInvocationDefinition常量const governedToolInvocationDefinition: SpecSchemaDefinition<GovernedToolInvocationRecord>contracts 模块导出的 Governed Tool Invocation Definition 常量。
governedToolInvocationExample常量const governedToolInvocationExample: GovernedToolInvocationRecordGoverned Tool Invocation 的有效示例值。
governedToolInvocationJsonSchema常量const governedToolInvocationJsonSchema: JsonSchemaGoverned Tool Invocation 的 JSON Schema。
governedToolInvocationRecordSchema常量const governedToolInvocationRecordSchema: z.ZodObject<{ id: z.ZodString; revision: z.ZodNumber; operationId: z.ZodString; toolRef: z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; revision?: string | undefined; }, { id: string; version?: string | undefined; revision?: string | undefined; }...Governed Tool Invocation Record 的运行时 Schema。
governedToolInvocationStatusSchema常量const governedToolInvocationStatusSchema: z.ZodEnum<["created", "validating", "validated", "denied", "waiting_approval", "approved", "rejected", "queued", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "expired", "conflict"]>Governed Tool Invocation Status 的运行时 Schema。
normalizedToolErrorSchema常量const normalizedToolErrorSchema: z.ZodObject<{ code: z.ZodEnum<["TOOL_NOT_FOUND", "TOOL_DISABLED", "TOOL_SCHEMA_INVALID", "TOOL_OUTPUT_INVALID", "TOOL_PERMISSION_DENIED", "TOOL_POLICY_DENIED", "TOOL_APPROVAL_REQUIRED", "TOOL_APPROVAL_REJECTED", "TOOL_APPROVAL_EXPIRED", "TOOL_IDEMPOTENCY_CONFLICT", "TOOL_CONCURRENCY_CONFLICT", "TOOL_TIMEOUT", "TOOL_CANCELLED", "TOOL_ADAPTER_UNAVAILABLE", "TOOL_RETRY_EXHAUSTED", "TO...Normalized Tool Error 的运行时 Schema。
providerHealthSchema常量const providerHealthSchema: z.ZodObject<{ status: z.ZodEnum<["healthy", "degraded", "unhealthy", "unknown"]>; checkedAt: z.ZodString; latencyMs: z.ZodOptional<z.ZodNumber>; message: z.ZodOptional<z.ZodString>; details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { status: "unknown" | "healthy" | "degraded" | "unhealthy"; checkedAt: string; message?: string | undefined; latencyM...Provider Health 的运行时 Schema。
toolCachePolicySpecSchema常量const toolCachePolicySpecSchema: z.ZodObject<{ mode: z.ZodEnum<["disabled", "result", "observation_ref"]>; ttlSeconds: z.ZodOptional<z.ZodNumber>; scope: z.ZodEnum<["run", "session", "workspace", "tenant"]>; keyFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; includeToolRevision: z.ZodBoolean; includePolicyRevision: z.ZodBoolean; allowForSideEffectLevels: z.ZodOptional<z.ZodArray<z.ZodEnum<["none", "read", ...Tool Cache Policy Spec 的运行时 Schema。
toolContractSnapshotDefinition常量const toolContractSnapshotDefinition: SpecSchemaDefinition<ToolContractSnapshot>contracts 模块导出的 Tool Contract Snapshot Definition 常量。
toolContractSnapshotExample常量const toolContractSnapshotExample: ToolContractSnapshotTool Contract Snapshot 的有效示例值。
toolContractSnapshotItemSchema常量const toolContractSnapshotItemSchema: z.ZodObject<{ toolId: z.ZodString; toolVersion: z.ZodString; toolRevision: z.ZodString; inputSchemaHash: z.ZodString; outputSchemaHash: z.ZodOptional<z.ZodString>; sourceCapabilityHash: z.ZodOptional<z.ZodString>; sideEffectLevel: z.ZodEnum<["none", "read", "write", "external_effect", "irreversible"]>; adapterRef: z.ZodString; }, "strip", z.ZodTypeAny, { toolId: string; toolVe...Tool Contract Snapshot Item 的运行时 Schema。
toolContractSnapshotJsonSchema常量const toolContractSnapshotJsonSchema: JsonSchemaTool Contract Snapshot 的 JSON Schema。
toolContractSnapshotSchema常量const toolContractSnapshotSchema: z.ZodObject<{ id: z.ZodString; runId: z.ZodString; createdAt: z.ZodString; toolContracts: z.ZodArray<z.ZodObject<{ toolId: z.ZodString; toolVersion: z.ZodString; toolRevision: z.ZodString; inputSchemaHash: z.ZodString; outputSchemaHash: z.ZodOptional<z.ZodString>; sourceCapabilityHash: z.ZodOptional<z.ZodString>; sideEffectLevel: z.ZodEnum<["none", "read", "write", "external_effec...Tool Contract Snapshot 的运行时 Schema。
toolEventPayloadBaseDefinition常量const toolEventPayloadBaseDefinition: SpecSchemaDefinition<ToolEventPayloadBase>contracts 模块导出的 Tool Event Payload Base Definition 常量。
toolEventPayloadBaseExample常量const toolEventPayloadBaseExample: ToolEventPayloadBaseTool Event Payload Base 的有效示例值。
toolEventPayloadBaseJsonSchema常量const toolEventPayloadBaseJsonSchema: JsonSchemaTool Event Payload Base 的 JSON Schema。
toolEventPayloadBaseSchema常量const toolEventPayloadBaseSchema: z.ZodObject<{ invocationId: z.ZodOptional<z.ZodString>; operationId: z.ZodOptional<z.ZodString>; toolId: z.ZodOptional<z.ZodString>; toolVersion: z.ZodOptional<z.ZodString>; toolRevision: z.ZodOptional<z.ZodString>; contractSnapshotRef: z.ZodOptional<z.ZodString>; scopeHash: z.ZodOptional<z.ZodString>; principalId: z.ZodOptional<z.ZodString>; sideEffectLevel: z.ZodOptional<z.ZodEn...Tool Event Payload Base 的运行时 Schema。
toolExecutionContextSpecSchema常量const toolExecutionContextSpecSchema: z.ZodObject<{ principal: z.ZodObject<{ principalId: z.ZodString; type: z.ZodEnum<["user", "agent", "service", "system"]>; tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; permissionScopes: z.ZodArray<z.ZodString, "many">;...Tool Execution Context Spec 的运行时 Schema。
toolExecutionPolicySpecSchema常量const toolExecutionPolicySpecSchema: z.ZodObject<{ timeout: z.ZodObject<{ timeoutMs: z.ZodNumber; onTimeout: z.ZodOptional<z.ZodEnum<["fail", "retry", "human_review"]>>; }, "strip", z.ZodTypeAny, { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; }, { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; }>; retry: z.ZodObject<{ maxAttempts: z.ZodNumber; backoff...Tool Execution Policy Spec 的运行时 Schema。
toolGovernanceSpecSchema常量const toolGovernanceSpecSchema: z.ZodObject<{ requiredPermissionScopes: z.ZodArray<z.ZodString, "many">; deniedPermissionScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; allowedPrincipalTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "agent", "service", "system"]>, "many">>; policyRefs: z.ZodOptional<z.ZodArray<z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z....Tool Governance Spec 的运行时 Schema。
toolInvocationScopeSpecSchema常量const toolInvocationScopeSpecSchema: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; stepId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; fsmState: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { runId: string; userId: string; sessionId: string; agentId?: string | undefined; ten...Tool Invocation Scope Spec 的运行时 Schema。
toolObservabilitySpecSchema常量const toolObservabilitySpecSchema: z.ZodObject<{ traceLevel: z.ZodEnum<["none", "metadata", "summary", "full_redacted"]>; recordInput: z.ZodOptional<z.ZodBoolean>; recordOutput: z.ZodOptional<z.ZodBoolean>; recordAttempts: z.ZodOptional<z.ZodBoolean>; recordPolicyDecision: z.ZodOptional<z.ZodBoolean>; metricsEnabled: z.ZodOptional<z.ZodBoolean>; redactionPolicyRef: z.ZodOptional<z.ZodObject<{ id: z.ZodString; vers...Tool Observability Spec 的运行时 Schema。
toolPrincipalSpecSchema常量const toolPrincipalSpecSchema: z.ZodObject<{ principalId: z.ZodString; type: z.ZodEnum<["user", "agent", "service", "system"]>; tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; permissionScopes: z.ZodArray<z.ZodString, "many">; delegatedBy: z.ZodOptional<z.Zo...Tool Principal Spec 的运行时 Schema。
toolSchemaSpecSchema常量const toolSchemaSpecSchema: z.ZodObject<{ jsonSchema: z.ZodType<JsonSchema, z.ZodTypeDef, JsonSchema>; schemaId: z.ZodOptional<z.ZodString>; schemaVersion: z.ZodOptional<z.ZodString>; schemaHash: z.ZodString; strict: z.ZodOptional<z.ZodBoolean>; allowAdditionalProperties: z.ZodOptional<z.ZodBoolean>; maxSerializedBytes: z.ZodOptional<z.ZodNumber>; sensitivePaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; red...Tool Schema Spec 的运行时 Schema。
toolSemanticSpecSchema常量const toolSemanticSpecSchema: z.ZodType<ToolSemanticSpec, z.ZodTypeDef, ToolSemanticSpec>Tool Semantic Spec 的运行时 Schema。
toolSourceRefSchema常量const toolSourceRefSchema: z.ZodObject<{ adapterId: z.ZodOptional<z.ZodString>; handlerId: z.ZodOptional<z.ZodString>; endpointRef: z.ZodOptional<z.ZodString>; mcpServerId: z.ZodOptional<z.ZodString>; mcpCapabilityId: z.ZodOptional<z.ZodString>; mcpCapabilityHash: z.ZodOptional<z.ZodString>; pluginId: z.ZodOptional<z.ZodString>; hostedToolId: z.ZodOptional<z.ZodString>; metadata: z.ZodOptional<z.ZodRecord<z.ZodStr...Tool Source Ref 的运行时 Schema。
canonicalJson函数canonicalJson(value: unknown): stringCanonical JSON 函数,提供 1 个公开调用签名;参数与返回类型见下表。
createToolCacheValidityKey函数createToolCacheValidityKey(input: ToolCacheValidityInput): stringCreate Tool Cache Validity Key 函数,提供 1 个公开调用签名;参数与返回类型见下表。
createToolSchemaSpec函数createToolSchemaSpec(jsonSchema: JsonSchema, options?: Omit<Partial<ToolSchemaSpec>, "jsonSchema" | "schemaHash">): ToolSchemaSpecCreate Tool Schema Spec 函数,提供 1 个公开调用签名;参数与返回类型见下表。
hashToolContract函数hashToolContract(value: unknown): stringHash Tool Contract 函数,提供 1 个公开调用签名;参数与返回类型见下表。
EffectiveAgentCapabilitySnapshot接口interface EffectiveAgentCapabilitySnapshotEffective Agent Capability Snapshot 接口,共包含 17 个公开字段或方法。
EffectiveCapabilityApproval接口interface EffectiveCapabilityApprovalEffective Capability Approval 接口,共包含 11 个公开字段或方法。
GovernedHumanApprovalPolicySpec接口interface GovernedHumanApprovalPolicySpecGoverned Human Approval Policy Spec 接口,共包含 9 个公开字段或方法。
GovernedHumanApprovalRequest接口interface GovernedHumanApprovalRequestGoverned Human Approval Request 接口,共包含 19 个公开字段或方法。
GovernedToolContractSpec接口interface GovernedToolContractSpecGoverned Tool Contract Spec 接口,共包含 22 个公开字段或方法。
GovernedToolInvocationRecord接口interface GovernedToolInvocationRecordGoverned Tool Invocation Record 接口,共包含 35 个公开字段或方法。
HumanApprovalDecisionRecord接口interface HumanApprovalDecisionRecordHuman Approval Decision Record 接口,共包含 5 个公开字段或方法。
NormalizedToolError接口interface NormalizedToolErrorNormalized Tool Error 接口,共包含 7 个公开字段或方法。
ProviderHealth接口interface ProviderHealthProvider Health 接口,共包含 5 个公开字段或方法。
ToolArtifactContract接口interface ToolArtifactContractTool Artifact Contract 接口,共包含 4 个公开字段或方法。
ToolCachePolicySpec接口interface ToolCachePolicySpecTool Cache Policy Spec 接口,共包含 8 个公开字段或方法。
ToolCacheValidityInput接口interface ToolCacheValidityInputTool Cache Validity Input 接口,共包含 8 个公开字段或方法。
ToolCacheValidityRecord接口interface ToolCacheValidityRecord extends ToolCacheValidityInputTool Cache Validity Record 接口,共包含 10 个公开字段或方法。
ToolCancellationPolicySpec接口interface ToolCancellationPolicySpecTool Cancellation Policy Spec 接口,共包含 2 个公开字段或方法。
ToolConcurrencyPolicySpec接口interface ToolConcurrencyPolicySpecTool Concurrency Policy Spec 接口,共包含 3 个公开字段或方法。
ToolContractSnapshot接口interface ToolContractSnapshotTool Contract Snapshot 接口,共包含 8 个公开字段或方法。
ToolContractSnapshotItem接口interface ToolContractSnapshotItemTool Contract Snapshot Item 接口,共包含 8 个公开字段或方法。
ToolContractSnapshotStore接口interface ToolContractSnapshotStoreTool Contract Snapshot Store 接口,共包含 2 个公开字段或方法。
ToolEventPayloadBase接口interface ToolEventPayloadBaseTool Event Payload Base 接口,共包含 15 个公开字段或方法。
ToolExecutionContextSpec接口interface ToolExecutionContextSpecTool Execution Context Spec 接口,共包含 21 个公开字段或方法。
ToolExecutionPolicySpec接口interface ToolExecutionPolicySpecTool Execution Policy Spec 接口,共包含 7 个公开字段或方法。
ToolExternalReceipt接口interface ToolExternalReceiptTool External Receipt 接口,共包含 5 个公开字段或方法。
ToolGovernanceSpec接口interface ToolGovernanceSpecTool Governance Spec 接口,共包含 10 个公开字段或方法。
ToolInvocationScopeSpec接口interface ToolInvocationScopeSpecTool Invocation Scope Spec 接口,共包含 8 个公开字段或方法。
ToolLateResultPolicySpec接口interface ToolLateResultPolicySpecTool Late Result Policy Spec 接口,共包含 2 个公开字段或方法。
ToolObservabilitySpec接口interface ToolObservabilitySpecTool Observability Spec 接口,共包含 7 个公开字段或方法。
ToolOutputLimitSpec接口interface ToolOutputLimitSpecTool Output Limit Spec 接口,共包含 2 个公开字段或方法。
ToolPrincipalSpec接口interface ToolPrincipalSpecTool Principal Spec 接口,共包含 12 个公开字段或方法。
ToolSchemaSpec接口interface ToolSchemaSpecTool Schema Spec 接口,共包含 9 个公开字段或方法。
ToolSemanticSpec接口interface ToolSemanticSpecTool Semantic Spec 接口,共包含 10 个公开字段或方法。
ToolSourceRef接口interface ToolSourceRefTool Source Ref 接口,共包含 9 个公开字段或方法。
ToolStreamingSpec接口interface ToolStreamingSpecTool Streaming Spec 接口,共包含 4 个公开字段或方法。
GovernedToolInvocationStatus类型type GovernedToolInvocationStatus = 'created' | 'validating' | 'validated' | 'denied' | 'waiting_approval' | 'approved' | 'rejected' | 'queued' | 'running' | 'cancelling' | 'cancelled' | 'completed' | 'failed' | 'timed_out' | 'expired' | 'conflict'Governed Tool Invocation Status 公共类型别名;完整类型表达式见声明。
ToolSource类型type ToolSource = 'local' | 'mcp' | 'http' | 'plugin' | 'hosted' | 'execution' | 'custom'Tool Source 公共类型别名;完整类型表达式见声明。

effectiveAgentCapabilitySnapshotSchema

Effective Agent Capability Snapshot 的运行时 Schema。

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

声明

text
export declare const effectiveAgentCapabilitySnapshotSchema: z.ZodObject<{ id: z.ZodString; runId: z.ZodString; agentId: z.ZodString; principalId: z.ZodString; tenantId: z.ZodOptional<z.ZodString>; domainId: z.ZodOptional<z.ZodString>; createdAt: z.ZodString; expiresAt: z.ZodOptional<z.ZodString>; skillRevisions: z.ZodArray<z.ZodObject<{ id: z.ZodString; version: z.ZodString; contentHash: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; version: string; contentHash: string; }, { id: string; version: string; contentHash: string; }>, "many">; allowedToolIds: z.ZodArray<z.ZodString, "many">; allowedMCPServerIds: z.ZodArray<z.ZodString, "many">; memoryAccess: z.ZodEnum<["none", "read", "write", "read_write"]>; allowedExecutionProfiles: z.ZodArray<z.ZodString, "many">; maximumSideEffectLevel: z.ZodEnum<["none", "read", "write", "external_effect", "irreversible"]>; requiresHumanReview: z.ZodBoolean; policyRefs: z.ZodArray<z.ZodString, "many">; snapshotHash: z.ZodString; }, "strip", z.ZodTypeAny, { id: string; policyRefs: string[]; runId: string; agentId: string; principalId: string; createdAt: string; skillRevisions: { id: string; version: string; contentHash: string; }[]; allowedToolIds: string[]; allowedMCPServerIds: string[]; memoryAccess: "none" | "read" | "write" | "read_write"; allowedExecutionProfiles: string[]; maximumSideEffectLevel: "none" | "read" | "write" | "external_effect" | "irreversible"; requiresHumanReview: boolean; snapshotHash: string; tenantId?: string | undefined; domainId?: string | undefined; expiresAt?: string | undefined; }, { id: string; policyRefs: string[]; runId: string; agentId: string; principalId: string; createdAt: string; skillRevisions: { id: string; version: string; contentHash: string; }[]; allowedToolIds: string[]; allowedMCPServerIds: string[]; memoryAccess: "none" | "read" | "write" | "read_write"; allowedExecutionProfiles: string[]; maximumSideEffectLevel: "none" | "read" | "write" | "external_effect" | "irreversible"; requiresHumanReview: boolean; snapshotHash: string; tenantId?: string | undefined; domainId?: string | undefined; expiresAt?: string | undefined; }>;

effectiveCapabilityApprovalSchema

Effective Capability Approval 的运行时 Schema。

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

声明

text
export declare const effectiveCapabilityApprovalSchema: z.ZodObject<{ taskId: z.ZodString; subjectType: z.ZodLiteral<"effective_capability_snapshot">; subjectHash: z.ZodString; snapshotId: z.ZodString; runId: z.ZodString; agentId: z.ZodString; principalId: z.ZodString; approvedBy: z.ZodString; approvedAt: z.ZodString; expiresAt: z.ZodString; status: z.ZodLiteral<"approved">; }, "strict", z.ZodTypeAny, { status: "approved"; runId: string; agentId: string; principalId: string; expiresAt: string; taskId: string; subjectType: "effective_capability_snapshot"; subjectHash: string; snapshotId: string; approvedBy: string; approvedAt: string; }, { status: "approved"; runId: string; agentId: string; principalId: string; expiresAt: string; taskId: string; subjectType: "effective_capability_snapshot"; subjectHash: string; snapshotId: string; approvedBy: string; approvedAt: string; }>;

governedHumanApprovalDefinition

contracts 模块导出的 Governed Human Approval Definition 常量。

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

声明

text
export declare const governedHumanApprovalDefinition: SpecSchemaDefinition<GovernedHumanApprovalRequest>;

governedHumanApprovalExample

Governed Human Approval 的有效示例值。

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

声明

text
export declare const governedHumanApprovalExample: GovernedHumanApprovalRequest;

governedHumanApprovalJsonSchema

Governed Human Approval 的 JSON Schema。

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

声明

text
export declare const governedHumanApprovalJsonSchema: JsonSchema;

governedHumanApprovalPolicySpecSchema

Governed Human Approval Policy Spec 的运行时 Schema。

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

声明

text
export declare const governedHumanApprovalPolicySpecSchema: z.ZodObject<{ mode: z.ZodEnum<["never", "policy", "always"]>; requiredForSideEffects: z.ZodOptional<z.ZodArray<z.ZodEnum<["none", "read", "write", "external_effect", "irreversible"]>, "many">>; approverRoles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; minApprovals: z.ZodOptional<z.ZodNumber>; expiresAfterSeconds: z.ZodOptional<z.ZodNumber>; allowParameterEdit: z.ZodOptional<z.ZodBoolean>; requireReason: z.ZodOptional<z.ZodBoolean>; revalidateOnResume: z.ZodOptional<z.ZodBoolean>; escalationPolicyRef: z.ZodOptional<z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; revision?: string | undefined; }, { id: string; version?: string | undefined; revision?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { mode: "never" | "policy" | "always"; requiredForSideEffects?: ("none" | "read" | "write" | "external_effect" | "irreversible")[] | undefined; approverRoles?: string[] | undefined; minApprovals?: number | undefined; expiresAfterSeconds?: number | undefined; allowParameterEdit?: boolean | undefined; requireReason?: boolean | undefined; revalidateOnResume?: boolean | undefined; escalationPolicyRef?: { id: string; version?: string | undefined; revision?: string | undefined; } | undefined; }, { mode: "never" | "policy" | "always"; requiredForSideEffects?: ("none" | "read" | "write" | "external_effect" | "irreversible")[] | undefined; approverRoles?: string[] | undefined; minApprovals?: number | undefined; expiresAfterSeconds?: number | undefined; allowParameterEdit?: boolean | undefined; requireReason?: boolean | undefined; revalidateOnResume?: boolean | undefined; escalationPolicyRef?: { id: string; version?: string | undefined; revision?: string | undefined; } | undefined; }>;

governedHumanApprovalRequestSchema

Governed Human Approval Request 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const governedHumanApprovalRequestSchema: (typeof import('@codesoul-co/hypha-tools'))['governedHumanApprovalRequestSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

governedToolContractDefinition

contracts 模块导出的 Governed Tool Contract Definition 常量。

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

声明

text
export declare const governedToolContractDefinition: SpecSchemaDefinition<GovernedToolContractSpec>;

governedToolContractExample

Governed Tool Contract 的有效示例值。

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

声明

text
export declare const governedToolContractExample: GovernedToolContractSpec;

governedToolContractJsonSchema

Governed Tool Contract 的 JSON Schema。

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

声明

text
export declare const governedToolContractJsonSchema: JsonSchema;

governedToolContractJsonSchemas

contracts 模块导出的 Governed Tool Contract JSON Schemas 常量。

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

声明

text
export declare const governedToolContractJsonSchemas: Record<string, JsonSchema>;

governedToolContractSpecSchema

Governed Tool Contract Spec 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const governedToolContractSpecSchema: (typeof import('@codesoul-co/hypha-tools'))['governedToolContractSpecSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

governedToolInvocationDefinition

contracts 模块导出的 Governed Tool Invocation Definition 常量。

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

声明

text
export declare const governedToolInvocationDefinition: SpecSchemaDefinition<GovernedToolInvocationRecord>;

governedToolInvocationExample

Governed Tool Invocation 的有效示例值。

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

声明

text
export declare const governedToolInvocationExample: GovernedToolInvocationRecord;

governedToolInvocationJsonSchema

Governed Tool Invocation 的 JSON Schema。

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

声明

text
export declare const governedToolInvocationJsonSchema: JsonSchema;

governedToolInvocationRecordSchema

Governed Tool Invocation Record 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const governedToolInvocationRecordSchema: (typeof import('@codesoul-co/hypha-tools'))['governedToolInvocationRecordSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

governedToolInvocationStatusSchema

Governed Tool Invocation Status 的运行时 Schema。

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

声明

text
export declare const governedToolInvocationStatusSchema: z.ZodEnum<["created", "validating", "validated", "denied", "waiting_approval", "approved", "rejected", "queued", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "expired", "conflict"]>;

normalizedToolErrorSchema

Normalized Tool Error 的运行时 Schema。

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

声明

text
export declare const normalizedToolErrorSchema: z.ZodObject<{ code: z.ZodEnum<["TOOL_NOT_FOUND", "TOOL_DISABLED", "TOOL_SCHEMA_INVALID", "TOOL_OUTPUT_INVALID", "TOOL_PERMISSION_DENIED", "TOOL_POLICY_DENIED", "TOOL_APPROVAL_REQUIRED", "TOOL_APPROVAL_REJECTED", "TOOL_APPROVAL_EXPIRED", "TOOL_IDEMPOTENCY_CONFLICT", "TOOL_CONCURRENCY_CONFLICT", "TOOL_TIMEOUT", "TOOL_CANCELLED", "TOOL_ADAPTER_UNAVAILABLE", "TOOL_RETRY_EXHAUSTED", "TOOL_LATE_RESULT", "TOOL_EXECUTION_FAILED", "TOOL_INTERNAL_ERROR"]>; message: z.ZodString; retryable: z.ZodBoolean; attempt: z.ZodOptional<z.ZodNumber>; providerCode: z.ZodOptional<z.ZodUnion<[z.ZodString, z.ZodNumber]>>; details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; causeRef: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { code: "TOOL_NOT_FOUND" | "TOOL_DISABLED" | "TOOL_SCHEMA_INVALID" | "TOOL_OUTPUT_INVALID" | "TOOL_PERMISSION_DENIED" | "TOOL_POLICY_DENIED" | "TOOL_APPROVAL_REQUIRED" | "TOOL_APPROVAL_REJECTED" | "TOOL_APPROVAL_EXPIRED" | "TOOL_IDEMPOTENCY_CONFLICT" | "TOOL_CONCURRENCY_CONFLICT" | "TOOL_TIMEOUT" | "TOOL_CANCELLED" | "TOOL_ADAPTER_UNAVAILABLE" | "TOOL_RETRY_EXHAUSTED" | "TOOL_LATE_RESULT" | "TOOL_EXECUTION_FAILED" | "TOOL_INTERNAL_ERROR"; message: string; retryable: boolean; details?: Record<string, unknown> | undefined; attempt?: number | undefined; providerCode?: string | number | undefined; causeRef?: string | undefined; }, { code: "TOOL_NOT_FOUND" | "TOOL_DISABLED" | "TOOL_SCHEMA_INVALID" | "TOOL_OUTPUT_INVALID" | "TOOL_PERMISSION_DENIED" | "TOOL_POLICY_DENIED" | "TOOL_APPROVAL_REQUIRED" | "TOOL_APPROVAL_REJECTED" | "TOOL_APPROVAL_EXPIRED" | "TOOL_IDEMPOTENCY_CONFLICT" | "TOOL_CONCURRENCY_CONFLICT" | "TOOL_TIMEOUT" | "TOOL_CANCELLED" | "TOOL_ADAPTER_UNAVAILABLE" | "TOOL_RETRY_EXHAUSTED" | "TOOL_LATE_RESULT" | "TOOL_EXECUTION_FAILED" | "TOOL_INTERNAL_ERROR"; message: string; retryable: boolean; details?: Record<string, unknown> | undefined; attempt?: number | undefined; providerCode?: string | number | undefined; causeRef?: string | undefined; }>;

providerHealthSchema

Provider Health 的运行时 Schema。

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

声明

text
export declare const providerHealthSchema: z.ZodObject<{ status: z.ZodEnum<["healthy", "degraded", "unhealthy", "unknown"]>; checkedAt: z.ZodString; latencyMs: z.ZodOptional<z.ZodNumber>; message: z.ZodOptional<z.ZodString>; details: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { status: "unknown" | "healthy" | "degraded" | "unhealthy"; checkedAt: string; message?: string | undefined; latencyMs?: number | undefined; details?: Record<string, unknown> | undefined; }, { status: "unknown" | "healthy" | "degraded" | "unhealthy"; checkedAt: string; message?: string | undefined; latencyMs?: number | undefined; details?: Record<string, unknown> | undefined; }>;

toolCachePolicySpecSchema

Tool Cache Policy Spec 的运行时 Schema。

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

声明

text
export declare const toolCachePolicySpecSchema: z.ZodObject<{ mode: z.ZodEnum<["disabled", "result", "observation_ref"]>; ttlSeconds: z.ZodOptional<z.ZodNumber>; scope: z.ZodEnum<["run", "session", "workspace", "tenant"]>; keyFields: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; includeToolRevision: z.ZodBoolean; includePolicyRevision: z.ZodBoolean; allowForSideEffectLevels: z.ZodOptional<z.ZodArray<z.ZodEnum<["none", "read", "write", "external_effect", "irreversible"]>, "many">>; staleWhileRevalidateSeconds: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { mode: "disabled" | "result" | "observation_ref"; scope: "run" | "session" | "workspace" | "tenant"; includeToolRevision: boolean; includePolicyRevision: boolean; keyFields?: string[] | undefined; ttlSeconds?: number | undefined; allowForSideEffectLevels?: ("none" | "read" | "write" | "external_effect" | "irreversible")[] | undefined; staleWhileRevalidateSeconds?: number | undefined; }, { mode: "disabled" | "result" | "observation_ref"; scope: "run" | "session" | "workspace" | "tenant"; includeToolRevision: boolean; includePolicyRevision: boolean; keyFields?: string[] | undefined; ttlSeconds?: number | undefined; allowForSideEffectLevels?: ("none" | "read" | "write" | "external_effect" | "irreversible")[] | undefined; staleWhileRevalidateSeconds?: number | undefined; }>;

toolContractSnapshotDefinition

contracts 模块导出的 Tool Contract Snapshot Definition 常量。

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

声明

text
export declare const toolContractSnapshotDefinition: SpecSchemaDefinition<ToolContractSnapshot>;

toolContractSnapshotExample

Tool Contract Snapshot 的有效示例值。

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

声明

text
export declare const toolContractSnapshotExample: ToolContractSnapshot;

toolContractSnapshotItemSchema

Tool Contract Snapshot Item 的运行时 Schema。

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

声明

text
export declare const toolContractSnapshotItemSchema: z.ZodObject<{ toolId: z.ZodString; toolVersion: z.ZodString; toolRevision: z.ZodString; inputSchemaHash: z.ZodString; outputSchemaHash: z.ZodOptional<z.ZodString>; sourceCapabilityHash: z.ZodOptional<z.ZodString>; sideEffectLevel: z.ZodEnum<["none", "read", "write", "external_effect", "irreversible"]>; adapterRef: z.ZodString; }, "strip", z.ZodTypeAny, { toolId: string; toolVersion: string; toolRevision: string; inputSchemaHash: string; sideEffectLevel: "none" | "read" | "write" | "external_effect" | "irreversible"; adapterRef: string; outputSchemaHash?: string | undefined; sourceCapabilityHash?: string | undefined; }, { toolId: string; toolVersion: string; toolRevision: string; inputSchemaHash: string; sideEffectLevel: "none" | "read" | "write" | "external_effect" | "irreversible"; adapterRef: string; outputSchemaHash?: string | undefined; sourceCapabilityHash?: string | undefined; }>;

toolContractSnapshotJsonSchema

Tool Contract Snapshot 的 JSON Schema。

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

声明

text
export declare const toolContractSnapshotJsonSchema: JsonSchema;

toolContractSnapshotSchema

Tool Contract Snapshot 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const toolContractSnapshotSchema: (typeof import('@codesoul-co/hypha-tools'))['toolContractSnapshotSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

toolEventPayloadBaseDefinition

contracts 模块导出的 Tool Event Payload Base Definition 常量。

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

声明

text
export declare const toolEventPayloadBaseDefinition: SpecSchemaDefinition<ToolEventPayloadBase>;

toolEventPayloadBaseExample

Tool Event Payload Base 的有效示例值。

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

声明

text
export declare const toolEventPayloadBaseExample: ToolEventPayloadBase;

toolEventPayloadBaseJsonSchema

Tool Event Payload Base 的 JSON Schema。

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

声明

text
export declare const toolEventPayloadBaseJsonSchema: JsonSchema;

toolEventPayloadBaseSchema

Tool Event Payload Base 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const toolEventPayloadBaseSchema: (typeof import('@codesoul-co/hypha-tools'))['toolEventPayloadBaseSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

toolExecutionContextSpecSchema

Tool Execution Context Spec 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const toolExecutionContextSpecSchema: (typeof import('@codesoul-co/hypha-tools'))['toolExecutionContextSpecSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

toolExecutionPolicySpecSchema

Tool Execution Policy Spec 的运行时 Schema。

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

声明

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const toolExecutionPolicySpecSchema: (typeof import('@codesoul-co/hypha-tools'))['toolExecutionPolicySpecSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

toolGovernanceSpecSchema

Tool Governance Spec 的运行时 Schema。

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

声明

text
export declare const toolGovernanceSpecSchema: z.ZodObject<{ requiredPermissionScopes: z.ZodArray<z.ZodString, "many">; deniedPermissionScopes: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; allowedPrincipalTypes: z.ZodOptional<z.ZodArray<z.ZodEnum<["user", "agent", "service", "system"]>, "many">>; policyRefs: z.ZodOptional<z.ZodArray<z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; revision?: string | undefined; }, { id: string; version?: string | undefined; revision?: string | undefined; }>, "many">>; approvalPolicy: z.ZodOptional<z.ZodObject<{ required: z.ZodBoolean; reason: z.ZodOptional<z.ZodString>; approverRole: z.ZodOptional<z.ZodString>; timeoutPolicy: z.ZodOptional<z.ZodObject<{ timeoutMs: z.ZodNumber; onTimeout: z.ZodOptional<z.ZodEnum<["fail", "retry", "human_review"]>>; }, "strip", z.ZodTypeAny, { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; }, { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; }>>; }, "strip", z.ZodTypeAny, { required: boolean; reason?: string | undefined; approverRole?: string | undefined; timeoutPolicy?: { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; } | undefined; }, { required: boolean; reason?: string | undefined; approverRole?: string | undefined; timeoutPolicy?: { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; } | undefined; }>>; auditPolicy: z.ZodObject<{ enabled: z.ZodBoolean; includeInput: z.ZodOptional<z.ZodBoolean>; includeOutput: z.ZodOptional<z.ZodBoolean>; redactPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { enabled: boolean; includeInput?: boolean | undefined; includeOutput?: boolean | undefined; redactPaths?: string[] | undefined; }, { enabled: boolean; includeInput?: boolean | undefined; includeOutput?: boolean | undefined; redactPaths?: string[] | undefined; }>; tenantIsolation: z.ZodOptional<z.ZodBoolean>; workspaceIsolation: z.ZodOptional<z.ZodBoolean>; allowDelegation: z.ZodOptional<z.ZodBoolean>; maxDelegationDepth: z.ZodOptional<z.ZodNumber>; }, "strip", z.ZodTypeAny, { requiredPermissionScopes: string[]; auditPolicy: { enabled: boolean; includeInput?: boolean | undefined; includeOutput?: boolean | undefined; redactPaths?: string[] | undefined; }; deniedPermissionScopes?: string[] | undefined; allowedPrincipalTypes?: ("user" | "agent" | "service" | "system")[] | undefined; policyRefs?: { id: string; version?: string | undefined; revision?: string | undefined; }[] | undefined; approvalPolicy?: { required: boolean; reason?: string | undefined; approverRole?: string | undefined; timeoutPolicy?: { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; } | undefined; } | undefined; tenantIsolation?: boolean | undefined; workspaceIsolation?: boolean | undefined; allowDelegation?: boolean | undefined; maxDelegationDepth?: number | undefined; }, { requiredPermissionScopes: string[]; auditPolicy: { enabled: boolean; includeInput?: boolean | undefined; includeOutput?: boolean | undefined; redactPaths?: string[] | undefined; }; deniedPermissionScopes?: string[] | undefined; allowedPrincipalTypes?: ("user" | "agent" | "service" | "system")[] | undefined; policyRefs?: { id: string; version?: string | undefined; revision?: string | undefined; }[] | undefined; approvalPolicy?: { required: boolean; reason?: string | undefined; approverRole?: string | undefined; timeoutPolicy?: { timeoutMs: number; onTimeout?: "fail" | "retry" | "human_review" | undefined; } | undefined; } | undefined; tenantIsolation?: boolean | undefined; workspaceIsolation?: boolean | undefined; allowDelegation?: boolean | undefined; maxDelegationDepth?: number | undefined; }>;

toolInvocationScopeSpecSchema

Tool Invocation Scope Spec 的运行时 Schema。

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

声明

text
export declare const toolInvocationScopeSpecSchema: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; stepId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; fsmState: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { runId: string; userId: string; sessionId: string; agentId?: string | undefined; tenantId?: string | undefined; workspaceId?: string | undefined; stepId?: string | undefined; fsmState?: string | undefined; }, { runId: string; userId: string; sessionId: string; agentId?: string | undefined; tenantId?: string | undefined; workspaceId?: string | undefined; stepId?: string | undefined; fsmState?: string | undefined; }>;

toolObservabilitySpecSchema

Tool Observability Spec 的运行时 Schema。

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

声明

text
export declare const toolObservabilitySpecSchema: z.ZodObject<{ traceLevel: z.ZodEnum<["none", "metadata", "summary", "full_redacted"]>; recordInput: z.ZodOptional<z.ZodBoolean>; recordOutput: z.ZodOptional<z.ZodBoolean>; recordAttempts: z.ZodOptional<z.ZodBoolean>; recordPolicyDecision: z.ZodOptional<z.ZodBoolean>; metricsEnabled: z.ZodOptional<z.ZodBoolean>; redactionPolicyRef: z.ZodOptional<z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; version?: string | undefined; revision?: string | undefined; }, { id: string; version?: string | undefined; revision?: string | undefined; }>>; }, "strip", z.ZodTypeAny, { traceLevel: "metadata" | "none" | "summary" | "full_redacted"; recordInput?: boolean | undefined; recordOutput?: boolean | undefined; recordAttempts?: boolean | undefined; recordPolicyDecision?: boolean | undefined; metricsEnabled?: boolean | undefined; redactionPolicyRef?: { id: string; version?: string | undefined; revision?: string | undefined; } | undefined; }, { traceLevel: "metadata" | "none" | "summary" | "full_redacted"; recordInput?: boolean | undefined; recordOutput?: boolean | undefined; recordAttempts?: boolean | undefined; recordPolicyDecision?: boolean | undefined; metricsEnabled?: boolean | undefined; redactionPolicyRef?: { id: string; version?: string | undefined; revision?: string | undefined; } | undefined; }>;

toolPrincipalSpecSchema

Tool Principal Spec 的运行时 Schema。

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

声明

text
export declare const toolPrincipalSpecSchema: z.ZodObject<{ principalId: z.ZodString; type: z.ZodEnum<["user", "agent", "service", "system"]>; tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; permissionScopes: z.ZodArray<z.ZodString, "many">; delegatedBy: z.ZodOptional<z.ZodString>; delegationDepth: z.ZodOptional<z.ZodNumber>; authenticationContext: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { type: "user" | "agent" | "service" | "system"; principalId: string; permissionScopes: string[]; metadata?: Record<string, unknown> | undefined; agentId?: string | undefined; tenantId?: string | undefined; userId?: string | undefined; workspaceId?: string | undefined; roles?: string[] | undefined; delegatedBy?: string | undefined; delegationDepth?: number | undefined; authenticationContext?: Record<string, unknown> | undefined; }, { type: "user" | "agent" | "service" | "system"; principalId: string; permissionScopes: string[]; metadata?: Record<string, unknown> | undefined; agentId?: string | undefined; tenantId?: string | undefined; userId?: string | undefined; workspaceId?: string | undefined; roles?: string[] | undefined; delegatedBy?: string | undefined; delegationDepth?: number | undefined; authenticationContext?: Record<string, unknown> | undefined; }>;

toolSchemaSpecSchema

Tool Schema Spec 的运行时 Schema。

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

声明

text
export declare const toolSchemaSpecSchema: z.ZodObject<{ jsonSchema: z.ZodType<JsonSchema, z.ZodTypeDef, JsonSchema>; schemaId: z.ZodOptional<z.ZodString>; schemaVersion: z.ZodOptional<z.ZodString>; schemaHash: z.ZodString; strict: z.ZodOptional<z.ZodBoolean>; allowAdditionalProperties: z.ZodOptional<z.ZodBoolean>; maxSerializedBytes: z.ZodOptional<z.ZodNumber>; sensitivePaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; redactedPaths: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strip", z.ZodTypeAny, { jsonSchema: JsonSchema; schemaHash: string; schemaId?: string | undefined; schemaVersion?: string | undefined; strict?: boolean | undefined; allowAdditionalProperties?: boolean | undefined; maxSerializedBytes?: number | undefined; sensitivePaths?: string[] | undefined; redactedPaths?: string[] | undefined; }, { jsonSchema: JsonSchema; schemaHash: string; schemaId?: string | undefined; schemaVersion?: string | undefined; strict?: boolean | undefined; allowAdditionalProperties?: boolean | undefined; maxSerializedBytes?: number | undefined; sensitivePaths?: string[] | undefined; redactedPaths?: string[] | undefined; }>;

toolSemanticSpecSchema

Tool Semantic Spec 的运行时 Schema。

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

声明

text
export declare const toolSemanticSpecSchema: z.ZodType<ToolSemanticSpec, z.ZodTypeDef, ToolSemanticSpec>;

toolSourceRefSchema

Tool Source Ref 的运行时 Schema。

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

声明

text
export declare const toolSourceRefSchema: z.ZodObject<{ adapterId: z.ZodOptional<z.ZodString>; handlerId: z.ZodOptional<z.ZodString>; endpointRef: z.ZodOptional<z.ZodString>; mcpServerId: z.ZodOptional<z.ZodString>; mcpCapabilityId: z.ZodOptional<z.ZodString>; mcpCapabilityHash: z.ZodOptional<z.ZodString>; pluginId: z.ZodOptional<z.ZodString>; hostedToolId: z.ZodOptional<z.ZodString>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strip", z.ZodTypeAny, { adapterId?: string | undefined; handlerId?: string | undefined; endpointRef?: string | undefined; mcpServerId?: string | undefined; mcpCapabilityId?: string | undefined; mcpCapabilityHash?: string | undefined; pluginId?: string | undefined; hostedToolId?: string | undefined; metadata?: Record<string, unknown> | undefined; }, { adapterId?: string | undefined; handlerId?: string | undefined; endpointRef?: string | undefined; mcpServerId?: string | undefined; mcpCapabilityId?: string | undefined; mcpCapabilityHash?: string | undefined; pluginId?: string | undefined; hostedToolId?: string | undefined; metadata?: Record<string, unknown> | undefined; }>;

canonicalJson

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

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

声明

text
export declare function canonicalJson(value: unknown): string;

调用签名

text
canonicalJson(value: unknown): string

参数

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

返回值

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

createToolCacheValidityKey

Create Tool Cache Validity Key 函数,提供 1 个公开调用签名;参数与返回类型见下表。

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

声明

text
export declare function createToolCacheValidityKey(input: ToolCacheValidityInput): string;

调用签名

text
createToolCacheValidityKey(input: ToolCacheValidityInput): string

参数

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

返回值

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

createToolSchemaSpec

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

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

声明

text
export declare function createToolSchemaSpec(jsonSchema: JsonSchema, options?: Omit<Partial<ToolSchemaSpec>, 'jsonSchema' | 'schemaHash'>): ToolSchemaSpec;

调用签名

text
createToolSchemaSpec(jsonSchema: JsonSchema, options?: Omit<Partial<ToolSchemaSpec>, "jsonSchema" | "schemaHash">): ToolSchemaSpec

参数

参数类型必需说明
jsonSchemaJsonSchema必需参数;接受的值由类型列定义。
optionsOmit<Partial<ToolSchemaSpec>, "jsonSchema" | "schemaHash">可选参数;接受的值由类型列定义。

返回值

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

hashToolContract

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

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

声明

text
export declare function hashToolContract(value: unknown): string;

调用签名

text
hashToolContract(value: unknown): string

参数

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

返回值

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

EffectiveAgentCapabilitySnapshot

Effective Agent Capability Snapshot 接口,共包含 17 个公开字段或方法。

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

声明

text
export interface EffectiveAgentCapabilitySnapshot {
    id: string;
    runId: string;
    agentId: string;
    principalId: string;
    tenantId?: string;
    domainId?: string;
    createdAt: string;
    expiresAt?: string;
    skillRevisions: Array<{
        id: string;
        version: string;
        contentHash: string;
    }>;
    allowedToolIds: string[];
    allowedMCPServerIds: string[];
    memoryAccess: 'none' | 'read' | 'write' | 'read_write';
    allowedExecutionProfiles: string[];
    maximumSideEffectLevel: SideEffectLevel;
    requiresHumanReview: boolean;
    policyRefs: string[];
    snapshotHash: string;
}

契约成员

成员种类签名说明
agentId属性agentId: string公开属性;类型、只读和可选状态以签名列为准。
allowedExecutionProfiles属性allowedExecutionProfiles: string[]公开属性;类型、只读和可选状态以签名列为准。
allowedMCPServerIds属性allowedMCPServerIds: string[]公开属性;类型、只读和可选状态以签名列为准。
allowedToolIds属性allowedToolIds: string[]公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt: string公开属性;类型、只读和可选状态以签名列为准。
domainId属性domainId?: string公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
maximumSideEffectLevel属性maximumSideEffectLevel: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。
memoryAccess属性memoryAccess: "none" | "read" | "write" | "read_write"公开属性;类型、只读和可选状态以签名列为准。
policyRefs属性policyRefs: string[]公开属性;类型、只读和可选状态以签名列为准。
principalId属性principalId: string公开属性;类型、只读和可选状态以签名列为准。
requiresHumanReview属性requiresHumanReview: boolean公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
skillRevisions属性skillRevisions: { id: string; version: string; contentHash: string; }[]公开属性;类型、只读和可选状态以签名列为准。
snapshotHash属性snapshotHash: string公开属性;类型、只读和可选状态以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。

EffectiveCapabilityApproval

Effective Capability Approval 接口,共包含 11 个公开字段或方法。

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

声明

text
export interface EffectiveCapabilityApproval {
    taskId: string;
    subjectType: 'effective_capability_snapshot';
    subjectHash: string;
    snapshotId: string;
    runId: string;
    agentId: string;
    principalId: string;
    approvedBy: string;
    approvedAt: string;
    expiresAt: string;
    status: 'approved';
}

契约成员

成员种类签名说明
agentId属性agentId: string公开属性;类型、只读和可选状态以签名列为准。
approvedAt属性approvedAt: string公开属性;类型、只读和可选状态以签名列为准。
approvedBy属性approvedBy: string公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt: string公开属性;类型、只读和可选状态以签名列为准。
principalId属性principalId: string公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
snapshotId属性snapshotId: string公开属性;类型、只读和可选状态以签名列为准。
status属性status: "approved"公开属性;类型、只读和可选状态以签名列为准。
subjectHash属性subjectHash: string公开属性;类型、只读和可选状态以签名列为准。
subjectType属性subjectType: "effective_capability_snapshot"公开属性;类型、只读和可选状态以签名列为准。
taskId属性taskId: string公开属性;类型、只读和可选状态以签名列为准。

GovernedHumanApprovalPolicySpec

Governed Human Approval Policy Spec 接口,共包含 9 个公开字段或方法。

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

声明

text
export interface GovernedHumanApprovalPolicySpec {
    mode: 'never' | 'policy' | 'always';
    requiredForSideEffects?: SideEffectLevel[];
    approverRoles?: string[];
    minApprovals?: number;
    expiresAfterSeconds?: number;
    allowParameterEdit?: boolean;
    requireReason?: boolean;
    revalidateOnResume?: boolean;
    escalationPolicyRef?: {
        id: string;
        version?: string;
        revision?: string;
    };
}

契约成员

成员种类签名说明
allowParameterEdit属性allowParameterEdit?: boolean公开属性;类型、只读和可选状态以签名列为准。
approverRoles属性approverRoles?: string[]公开属性;类型、只读和可选状态以签名列为准。
escalationPolicyRef属性escalationPolicyRef?: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。
expiresAfterSeconds属性expiresAfterSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
minApprovals属性minApprovals?: number公开属性;类型、只读和可选状态以签名列为准。
mode属性mode: "policy" | "never" | "always"公开属性;类型、只读和可选状态以签名列为准。
requiredForSideEffects属性requiredForSideEffects?: SideEffectLevel[]公开属性;类型、只读和可选状态以签名列为准。
requireReason属性requireReason?: boolean公开属性;类型、只读和可选状态以签名列为准。
revalidateOnResume属性revalidateOnResume?: boolean公开属性;类型、只读和可选状态以签名列为准。

GovernedHumanApprovalRequest

Governed Human Approval Request 接口,共包含 19 个公开字段或方法。

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

声明

text
export interface GovernedHumanApprovalRequest {
    id: string;
    revision: number;
    invocationId: string;
    toolRef: {
        id: string;
        version?: string;
        revision?: string;
    };
    toolRevision: string;
    scope: ToolInvocationScopeSpec;
    principal: ToolPrincipalSpec;
    requestSummary: string;
    parameterSummary?: unknown;
    parameterHash: string;
    riskSummary?: string;
    sideEffectLevel: SideEffectLevel;
    policyDecisionRef?: string;
    requestedAt: string;
    expiresAt?: string;
    status: 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
    decisions: HumanApprovalDecisionRecord[];
    pendingActionRef: string;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
decisions属性decisions: HumanApprovalDecisionRecord[]公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
invocationId属性invocationId: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
parameterHash属性parameterHash: string公开属性;类型、只读和可选状态以签名列为准。
parameterSummary属性parameterSummary?: unknown公开属性;类型、只读和可选状态以签名列为准。
pendingActionRef属性pendingActionRef: string公开属性;类型、只读和可选状态以签名列为准。
policyDecisionRef属性policyDecisionRef?: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ToolPrincipalSpec公开属性;类型、只读和可选状态以签名列为准。
requestedAt属性requestedAt: string公开属性;类型、只读和可选状态以签名列为准。
requestSummary属性requestSummary: string公开属性;类型、只读和可选状态以签名列为准。
revision属性revision: number公开属性;类型、只读和可选状态以签名列为准。
riskSummary属性riskSummary?: string公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: ToolInvocationScopeSpec公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevel属性sideEffectLevel: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。
status属性status: "rejected" | "cancelled" | "expired" | "pending" | "approved"公开属性;类型、只读和可选状态以签名列为准。
toolRef属性toolRef: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。
toolRevision属性toolRevision: string公开属性;类型、只读和可选状态以签名列为准。

GovernedToolContractSpec

Governed Tool Contract Spec 接口,共包含 22 个公开字段或方法。

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

声明

text
export interface GovernedToolContractSpec {
    id: string;
    version: string;
    revision: string;
    name: string;
    displayName?: string;
    description: string;
    instructions?: string;
    tags?: string[];
    input: ToolSchemaSpec;
    output?: ToolSchemaSpec;
    source: ToolSource;
    sourceRef?: ToolSourceRef;
    semantics: ToolSemanticSpec;
    execution: ToolExecutionPolicySpec;
    governance: ToolGovernanceSpec;
    observability: ToolObservabilitySpec;
    cache?: ToolCachePolicySpec;
    streaming?: ToolStreamingSpec;
    enabled?: boolean;
    deprecated?: boolean;
    replacedBy?: {
        id: string;
        version?: string;
        revision?: string;
    };
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
cache属性cache?: ToolCachePolicySpec公开属性;类型、只读和可选状态以签名列为准。
deprecated属性deprecated?: boolean公开属性;类型、只读和可选状态以签名列为准。
description属性description: string公开属性;类型、只读和可选状态以签名列为准。
displayName属性displayName?: string公开属性;类型、只读和可选状态以签名列为准。
enabled属性enabled?: boolean公开属性;类型、只读和可选状态以签名列为准。
execution属性execution: ToolExecutionPolicySpec公开属性;类型、只读和可选状态以签名列为准。
governance属性governance: ToolGovernanceSpec公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
input属性input: ToolSchemaSpec公开属性;类型、只读和可选状态以签名列为准。
instructions属性instructions?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
name属性name: string公开属性;类型、只读和可选状态以签名列为准。
observability属性observability: ToolObservabilitySpec公开属性;类型、只读和可选状态以签名列为准。
output属性output?: ToolSchemaSpec公开属性;类型、只读和可选状态以签名列为准。
replacedBy属性replacedBy?: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。
revision属性revision: string公开属性;类型、只读和可选状态以签名列为准。
semantics属性semantics: ToolSemanticSpec公开属性;类型、只读和可选状态以签名列为准。
source属性source: ToolSource公开属性;类型、只读和可选状态以签名列为准。
sourceRef属性sourceRef?: ToolSourceRef公开属性;类型、只读和可选状态以签名列为准。
streaming属性streaming?: ToolStreamingSpec公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。

GovernedToolInvocationRecord

Governed Tool Invocation Record 接口,共包含 35 个公开字段或方法。

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

声明

text
export interface GovernedToolInvocationRecord {
    id: string;
    revision: number;
    operationId: string;
    toolRef: {
        id: string;
        version?: string;
        revision?: string;
    };
    toolRevision: string;
    contractSnapshotRef?: string;
    principal: ToolPrincipalSpec;
    scope: ToolInvocationScopeSpec;
    input?: unknown;
    inputHash: string;
    redactedInput?: unknown;
    status: GovernedToolInvocationStatus;
    sideEffectLevel: SideEffectLevel;
    idempotencyKey?: string;
    idempotencyFingerprint?: string;
    reusedFromInvocationId?: string;
    approvalRequestId?: string;
    currentAttempt: number;
    maxAttempts: number;
    queuedAt?: string;
    startedAt?: string;
    deadlineAt?: string;
    completedAt?: string;
    output?: unknown;
    outputHash?: string;
    artifactRefs?: string[];
    observationRefs?: string[];
    externalReceipt?: ToolExternalReceipt;
    error?: NormalizedToolError;
    lateResultState?: 'none' | 'pending' | 'accepted' | 'discarded' | 'quarantined';
    correlationId?: string;
    causationId?: string;
    createdAt: string;
    updatedAt: string;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
approvalRequestId属性approvalRequestId?: string公开属性;类型、只读和可选状态以签名列为准。
artifactRefs属性artifactRefs?: string[]公开属性;类型、只读和可选状态以签名列为准。
causationId属性causationId?: string公开属性;类型、只读和可选状态以签名列为准。
completedAt属性completedAt?: string公开属性;类型、只读和可选状态以签名列为准。
contractSnapshotRef属性contractSnapshotRef?: string公开属性;类型、只读和可选状态以签名列为准。
correlationId属性correlationId?: string公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt: string公开属性;类型、只读和可选状态以签名列为准。
currentAttempt属性currentAttempt: number公开属性;类型、只读和可选状态以签名列为准。
deadlineAt属性deadlineAt?: string公开属性;类型、只读和可选状态以签名列为准。
error属性error?: NormalizedToolError公开属性;类型、只读和可选状态以签名列为准。
externalReceipt属性externalReceipt?: ToolExternalReceipt公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyFingerprint属性idempotencyFingerprint?: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
input属性input?: unknown公开属性;类型、只读和可选状态以签名列为准。
inputHash属性inputHash: string公开属性;类型、只读和可选状态以签名列为准。
lateResultState属性lateResultState?: "none" | "accepted" | "quarantined" | "pending" | "discarded"公开属性;类型、只读和可选状态以签名列为准。
maxAttempts属性maxAttempts: number公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
observationRefs属性observationRefs?: string[]公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
output属性output?: unknown公开属性;类型、只读和可选状态以签名列为准。
outputHash属性outputHash?: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ToolPrincipalSpec公开属性;类型、只读和可选状态以签名列为准。
queuedAt属性queuedAt?: string公开属性;类型、只读和可选状态以签名列为准。
redactedInput属性redactedInput?: unknown公开属性;类型、只读和可选状态以签名列为准。
reusedFromInvocationId属性reusedFromInvocationId?: string公开属性;类型、只读和可选状态以签名列为准。
revision属性revision: number公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: ToolInvocationScopeSpec公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevel属性sideEffectLevel: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。
startedAt属性startedAt?: string公开属性;类型、只读和可选状态以签名列为准。
status属性status: GovernedToolInvocationStatus公开属性;类型、只读和可选状态以签名列为准。
toolRef属性toolRef: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。
toolRevision属性toolRevision: string公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt: string公开属性;类型、只读和可选状态以签名列为准。

HumanApprovalDecisionRecord

Human Approval Decision Record 接口,共包含 5 个公开字段或方法。

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

声明

text
export interface HumanApprovalDecisionRecord {
    decidedBy: string;
    decision: 'approved' | 'rejected';
    reason?: string;
    decidedAt: string;
    parameterHash: string;
}

契约成员

成员种类签名说明
decidedAt属性decidedAt: string公开属性;类型、只读和可选状态以签名列为准。
decidedBy属性decidedBy: string公开属性;类型、只读和可选状态以签名列为准。
decision属性decision: "rejected" | "approved"公开属性;类型、只读和可选状态以签名列为准。
parameterHash属性parameterHash: string公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。

NormalizedToolError

Normalized Tool Error 接口,共包含 7 个公开字段或方法。

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

声明

text
export interface NormalizedToolError {
    code: 'TOOL_NOT_FOUND' | 'TOOL_DISABLED' | 'TOOL_SCHEMA_INVALID' | 'TOOL_OUTPUT_INVALID' | 'TOOL_PERMISSION_DENIED' | 'TOOL_POLICY_DENIED' | 'TOOL_APPROVAL_REQUIRED' | 'TOOL_APPROVAL_REJECTED' | 'TOOL_APPROVAL_EXPIRED' | 'TOOL_IDEMPOTENCY_CONFLICT' | 'TOOL_CONCURRENCY_CONFLICT' | 'TOOL_TIMEOUT' | 'TOOL_CANCELLED' | 'TOOL_ADAPTER_UNAVAILABLE' | 'TOOL_RETRY_EXHAUSTED' | 'TOOL_LATE_RESULT' | 'TOOL_EXECUTION_FAILED' | 'TOOL_INTERNAL_ERROR';
    message: string;
    retryable: boolean;
    attempt?: number;
    providerCode?: string | number;
    details?: Record<string, unknown>;
    causeRef?: string;
}

契约成员

成员种类签名说明
attempt属性attempt?: number公开属性;类型、只读和可选状态以签名列为准。
causeRef属性causeRef?: string公开属性;类型、只读和可选状态以签名列为准。
code属性code: "TOOL_NOT_FOUND" | "TOOL_DISABLED" | "TOOL_SCHEMA_INVALID" | "TOOL_OUTPUT_INVALID" | "TOOL_PERMISSION_DENIED" | "TOOL_POLICY_DENIED" | "TOOL_APPROVAL_REQUIRED" | "TOOL_APPROVAL_REJECTED" | "TOOL_APPROVAL_EXPIRED" | "TOOL_IDEMPOTENCY_CONFLICT" | "TOOL_CONCURRENCY_CONFLICT" | "TOOL_TIMEOUT" | "TOOL_CANCELLED" | "TOOL_ADAPTER_UNAVAILABLE" | "TOOL_RETRY_EXHAUSTED" | "TOOL_LATE_RESULT" | "TOOL_EXECUTION_FAILED" |...公开属性;类型、只读和可选状态以签名列为准。
details属性details?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
message属性message: string公开属性;类型、只读和可选状态以签名列为准。
providerCode属性providerCode?: string | number公开属性;类型、只读和可选状态以签名列为准。
retryable属性retryable: boolean公开属性;类型、只读和可选状态以签名列为准。

ProviderHealth

Provider Health 接口,共包含 5 个公开字段或方法。

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

声明

text
export interface ProviderHealth {
    status: 'healthy' | 'degraded' | 'unhealthy' | 'unknown';
    checkedAt: string;
    latencyMs?: number;
    message?: string;
    details?: Record<string, unknown>;
}

契约成员

成员种类签名说明
checkedAt属性checkedAt: string公开属性;类型、只读和可选状态以签名列为准。
details属性details?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
latencyMs属性latencyMs?: number公开属性;类型、只读和可选状态以签名列为准。
message属性message?: string公开属性;类型、只读和可选状态以签名列为准。
status属性status: "healthy" | "degraded" | "unhealthy" | "unknown"公开属性;类型、只读和可选状态以签名列为准。

ToolArtifactContract

Tool Artifact Contract 接口,共包含 4 个公开字段或方法。

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

声明

text
export interface ToolArtifactContract {
    kind?: string;
    mimeTypes?: string[];
    maxInlineBytes?: number;
    required?: boolean;
}

契约成员

成员种类签名说明
kind属性kind?: string公开属性;类型、只读和可选状态以签名列为准。
maxInlineBytes属性maxInlineBytes?: number公开属性;类型、只读和可选状态以签名列为准。
mimeTypes属性mimeTypes?: string[]公开属性;类型、只读和可选状态以签名列为准。
required属性required?: boolean公开属性;类型、只读和可选状态以签名列为准。

ToolCachePolicySpec

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

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

声明

text
export interface ToolCachePolicySpec {
    mode: 'disabled' | 'result' | 'observation_ref';
    ttlSeconds?: number;
    scope: 'run' | 'session' | 'workspace' | 'tenant';
    keyFields?: string[];
    includeToolRevision: boolean;
    includePolicyRevision: boolean;
    allowForSideEffectLevels?: SideEffectLevel[];
    staleWhileRevalidateSeconds?: number;
}

契约成员

成员种类签名说明
allowForSideEffectLevels属性allowForSideEffectLevels?: SideEffectLevel[]公开属性;类型、只读和可选状态以签名列为准。
includePolicyRevision属性includePolicyRevision: boolean公开属性;类型、只读和可选状态以签名列为准。
includeToolRevision属性includeToolRevision: boolean公开属性;类型、只读和可选状态以签名列为准。
keyFields属性keyFields?: string[]公开属性;类型、只读和可选状态以签名列为准。
mode属性mode: "disabled" | "result" | "observation_ref"公开属性;类型、只读和可选状态以签名列为准。
scope属性scope: "workspace" | "session" | "run" | "tenant"公开属性;类型、只读和可选状态以签名列为准。
staleWhileRevalidateSeconds属性staleWhileRevalidateSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
ttlSeconds属性ttlSeconds?: number公开属性;类型、只读和可选状态以签名列为准。

ToolCacheValidityInput

Tool Cache Validity Input 接口,共包含 8 个公开字段或方法。

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

声明

text
export interface ToolCacheValidityInput {
    toolId: string;
    toolRevision: string;
    inputHash: string;
    scopeHash: string;
    policyRevision: string;
    contractSnapshotHash?: string;
    capabilityHash?: string;
    externalStateVersion?: string;
}

契约成员

成员种类签名说明
capabilityHash属性capabilityHash?: string公开属性;类型、只读和可选状态以签名列为准。
contractSnapshotHash属性contractSnapshotHash?: string公开属性;类型、只读和可选状态以签名列为准。
externalStateVersion属性externalStateVersion?: string公开属性;类型、只读和可选状态以签名列为准。
inputHash属性inputHash: string公开属性;类型、只读和可选状态以签名列为准。
policyRevision属性policyRevision: string公开属性;类型、只读和可选状态以签名列为准。
scopeHash属性scopeHash: string公开属性;类型、只读和可选状态以签名列为准。
toolId属性toolId: string公开属性;类型、只读和可选状态以签名列为准。
toolRevision属性toolRevision: string公开属性;类型、只读和可选状态以签名列为准。

ToolCacheValidityRecord

Tool Cache Validity Record 接口,共包含 10 个公开字段或方法。

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

声明

text
export interface ToolCacheValidityRecord extends ToolCacheValidityInput {
    key: string;
    validUntil?: string;
}

契约成员

成员种类签名说明
capabilityHash属性capabilityHash?: string公开属性;类型、只读和可选状态以签名列为准。
contractSnapshotHash属性contractSnapshotHash?: string公开属性;类型、只读和可选状态以签名列为准。
externalStateVersion属性externalStateVersion?: string公开属性;类型、只读和可选状态以签名列为准。
inputHash属性inputHash: string公开属性;类型、只读和可选状态以签名列为准。
key属性key: string公开属性;类型、只读和可选状态以签名列为准。
policyRevision属性policyRevision: string公开属性;类型、只读和可选状态以签名列为准。
scopeHash属性scopeHash: string公开属性;类型、只读和可选状态以签名列为准。
toolId属性toolId: string公开属性;类型、只读和可选状态以签名列为准。
toolRevision属性toolRevision: string公开属性;类型、只读和可选状态以签名列为准。
validUntil属性validUntil?: string公开属性;类型、只读和可选状态以签名列为准。

ToolCancellationPolicySpec

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

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

声明

text
export interface ToolCancellationPolicySpec {
    mode: 'cooperative' | 'provider' | 'unsupported';
    gracePeriodMs?: number;
}

契约成员

成员种类签名说明
gracePeriodMs属性gracePeriodMs?: number公开属性;类型、只读和可选状态以签名列为准。
mode属性mode: "provider" | "cooperative" | "unsupported"公开属性;类型、只读和可选状态以签名列为准。

ToolConcurrencyPolicySpec

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

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

声明

text
export interface ToolConcurrencyPolicySpec {
    maxConcurrent?: number;
    keyFields?: string[];
    queueWhenBusy?: boolean;
}

契约成员

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

ToolContractSnapshot

Tool Contract Snapshot 接口,共包含 8 个公开字段或方法。

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

声明

text
export interface ToolContractSnapshot {
    id: string;
    runId: string;
    createdAt: string;
    toolContracts: ToolContractSnapshotItem[];
    catalogRevision?: string;
    policyRevision?: string;
    effectiveCapabilities?: EffectiveAgentCapabilitySnapshot;
    snapshotHash: string;
}

契约成员

成员种类签名说明
catalogRevision属性catalogRevision?: string公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt: string公开属性;类型、只读和可选状态以签名列为准。
effectiveCapabilities属性effectiveCapabilities?: EffectiveAgentCapabilitySnapshot公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
policyRevision属性policyRevision?: string公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
snapshotHash属性snapshotHash: string公开属性;类型、只读和可选状态以签名列为准。
toolContracts属性toolContracts: ToolContractSnapshotItem[]公开属性;类型、只读和可选状态以签名列为准。

ToolContractSnapshotItem

Tool Contract Snapshot Item 接口,共包含 8 个公开字段或方法。

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

声明

text
export interface ToolContractSnapshotItem {
    toolId: string;
    toolVersion: string;
    toolRevision: string;
    inputSchemaHash: string;
    outputSchemaHash?: string;
    sourceCapabilityHash?: string;
    sideEffectLevel: SideEffectLevel;
    adapterRef: string;
}

契约成员

成员种类签名说明
adapterRef属性adapterRef: string公开属性;类型、只读和可选状态以签名列为准。
inputSchemaHash属性inputSchemaHash: string公开属性;类型、只读和可选状态以签名列为准。
outputSchemaHash属性outputSchemaHash?: string公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevel属性sideEffectLevel: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。
sourceCapabilityHash属性sourceCapabilityHash?: string公开属性;类型、只读和可选状态以签名列为准。
toolId属性toolId: string公开属性;类型、只读和可选状态以签名列为准。
toolRevision属性toolRevision: string公开属性;类型、只读和可选状态以签名列为准。
toolVersion属性toolVersion: string公开属性;类型、只读和可选状态以签名列为准。

ToolContractSnapshotStore

Tool Contract Snapshot Store 接口,共包含 2 个公开字段或方法。

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

声明

text
export interface ToolContractSnapshotStore {
    get(snapshotId: string): Promise<ToolContractSnapshot | null>;
    save(snapshot: ToolContractSnapshot): Promise<void>;
}

契约成员

成员种类签名说明
get方法get(snapshotId: string): Promise<ToolContractSnapshot | null>公开方法;参数与返回类型以签名列为准。
save方法save(snapshot: ToolContractSnapshot): Promise<void>公开方法;参数与返回类型以签名列为准。

ToolEventPayloadBase

Tool Event Payload Base 接口,共包含 15 个公开字段或方法。

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

声明

text
export interface ToolEventPayloadBase {
    invocationId?: string;
    operationId?: string;
    toolId?: string;
    toolVersion?: string;
    toolRevision?: string;
    contractSnapshotRef?: string;
    scopeHash?: string;
    principalId?: string;
    sideEffectLevel?: SideEffectLevel;
    attempt?: number;
    latencyMs?: number;
    inputHash?: string;
    outputHash?: string;
    error?: NormalizedToolError;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
attempt属性attempt?: number公开属性;类型、只读和可选状态以签名列为准。
contractSnapshotRef属性contractSnapshotRef?: string公开属性;类型、只读和可选状态以签名列为准。
error属性error?: NormalizedToolError公开属性;类型、只读和可选状态以签名列为准。
inputHash属性inputHash?: string公开属性;类型、只读和可选状态以签名列为准。
invocationId属性invocationId?: string公开属性;类型、只读和可选状态以签名列为准。
latencyMs属性latencyMs?: number公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId?: string公开属性;类型、只读和可选状态以签名列为准。
outputHash属性outputHash?: string公开属性;类型、只读和可选状态以签名列为准。
principalId属性principalId?: string公开属性;类型、只读和可选状态以签名列为准。
scopeHash属性scopeHash?: string公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevel属性sideEffectLevel?: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。
toolId属性toolId?: string公开属性;类型、只读和可选状态以签名列为准。
toolRevision属性toolRevision?: string公开属性;类型、只读和可选状态以签名列为准。
toolVersion属性toolVersion?: string公开属性;类型、只读和可选状态以签名列为准。

ToolExecutionContextSpec

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

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

声明

text
export interface ToolExecutionContextSpec {
    principal: ToolPrincipalSpec;
    tenantId?: string;
    userId: string;
    workspaceId?: string;
    sessionId: string;
    runId: string;
    stepId?: string;
    agentId?: string;
    fsmState?: string;
    invocationId: string;
    operationId: string;
    idempotencyKey?: string;
    correlationId?: string;
    causationId?: string;
    parentEventId?: string;
    contractSnapshotRef?: string;
    capabilitySnapshotRef?: string;
    capabilityApprovals?: EffectiveCapabilityApproval[];
    deadlineAt?: string;
    abortSignal?: AbortSignal;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
abortSignal属性abortSignal?: AbortSignal公开属性;类型、只读和可选状态以签名列为准。
agentId属性agentId?: string公开属性;类型、只读和可选状态以签名列为准。
capabilityApprovals属性capabilityApprovals?: EffectiveCapabilityApproval[]公开属性;类型、只读和可选状态以签名列为准。
capabilitySnapshotRef属性capabilitySnapshotRef?: string公开属性;类型、只读和可选状态以签名列为准。
causationId属性causationId?: string公开属性;类型、只读和可选状态以签名列为准。
contractSnapshotRef属性contractSnapshotRef?: string公开属性;类型、只读和可选状态以签名列为准。
correlationId属性correlationId?: string公开属性;类型、只读和可选状态以签名列为准。
deadlineAt属性deadlineAt?: string公开属性;类型、只读和可选状态以签名列为准。
fsmState属性fsmState?: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
invocationId属性invocationId: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
parentEventId属性parentEventId?: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ToolPrincipalSpec公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
sessionId属性sessionId: string公开属性;类型、只读和可选状态以签名列为准。
stepId属性stepId?: string公开属性;类型、只读和可选状态以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。
userId属性userId: string公开属性;类型、只读和可选状态以签名列为准。
workspaceId属性workspaceId?: string公开属性;类型、只读和可选状态以签名列为准。

ToolExecutionPolicySpec

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

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

声明

text
export interface ToolExecutionPolicySpec {
    timeout: TimeoutPolicySpec;
    retry: RetryPolicySpec;
    cancellation?: ToolCancellationPolicySpec;
    concurrency?: ToolConcurrencyPolicySpec;
    lateResult?: ToolLateResultPolicySpec;
    outputLimit?: ToolOutputLimitSpec;
    environmentRef?: {
        id: string;
        version?: string;
        revision?: string;
    };
}

契约成员

成员种类签名说明
cancellation属性cancellation?: ToolCancellationPolicySpec公开属性;类型、只读和可选状态以签名列为准。
concurrency属性concurrency?: ToolConcurrencyPolicySpec公开属性;类型、只读和可选状态以签名列为准。
environmentRef属性environmentRef?: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。
lateResult属性lateResult?: ToolLateResultPolicySpec公开属性;类型、只读和可选状态以签名列为准。
outputLimit属性outputLimit?: ToolOutputLimitSpec公开属性;类型、只读和可选状态以签名列为准。
retry属性retry: RetryPolicySpec公开属性;类型、只读和可选状态以签名列为准。
timeout属性timeout: TimeoutPolicySpec公开属性;类型、只读和可选状态以签名列为准。

ToolExternalReceipt

Tool External Receipt 接口,共包含 5 个公开字段或方法。

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

声明

text
export interface ToolExternalReceipt {
    provider?: string;
    receiptId: string;
    status?: string;
    committedAt?: string;
    metadata?: Record<string, unknown>;
}

契约成员

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

ToolGovernanceSpec

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

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

声明

text
export interface ToolGovernanceSpec {
    requiredPermissionScopes: string[];
    deniedPermissionScopes?: string[];
    allowedPrincipalTypes?: Array<'user' | 'agent' | 'service' | 'system'>;
    policyRefs?: Array<{
        id: string;
        version?: string;
        revision?: string;
    }>;
    approvalPolicy?: HumanReviewPolicySpec;
    auditPolicy: {
        enabled: boolean;
        includeInput?: boolean;
        includeOutput?: boolean;
        redactPaths?: string[];
    };
    tenantIsolation?: boolean;
    workspaceIsolation?: boolean;
    allowDelegation?: boolean;
    maxDelegationDepth?: number;
}

契约成员

成员种类签名说明
allowDelegation属性allowDelegation?: boolean公开属性;类型、只读和可选状态以签名列为准。
allowedPrincipalTypes属性allowedPrincipalTypes?: ("system" | "agent" | "user" | "service")[]公开属性;类型、只读和可选状态以签名列为准。
approvalPolicy属性approvalPolicy?: HumanReviewPolicySpec公开属性;类型、只读和可选状态以签名列为准。
auditPolicy属性auditPolicy: { enabled: boolean; includeInput?: boolean; includeOutput?: boolean; redactPaths?: string[]; }公开属性;类型、只读和可选状态以签名列为准。
deniedPermissionScopes属性deniedPermissionScopes?: string[]公开属性;类型、只读和可选状态以签名列为准。
maxDelegationDepth属性maxDelegationDepth?: number公开属性;类型、只读和可选状态以签名列为准。
policyRefs属性policyRefs?: { id: string; version?: string; revision?: string; }[]公开属性;类型、只读和可选状态以签名列为准。
requiredPermissionScopes属性requiredPermissionScopes: string[]公开属性;类型、只读和可选状态以签名列为准。
tenantIsolation属性tenantIsolation?: boolean公开属性;类型、只读和可选状态以签名列为准。
workspaceIsolation属性workspaceIsolation?: boolean公开属性;类型、只读和可选状态以签名列为准。

ToolInvocationScopeSpec

Tool Invocation Scope Spec 接口,共包含 8 个公开字段或方法。

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

声明

text
export interface ToolInvocationScopeSpec {
    tenantId?: string;
    userId: string;
    workspaceId?: string;
    sessionId: string;
    runId: string;
    stepId?: string;
    agentId?: string;
    fsmState?: string;
}

契约成员

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

ToolLateResultPolicySpec

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

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

声明

text
export interface ToolLateResultPolicySpec {
    mode: 'discard' | 'accept' | 'quarantine' | 'reconcile';
    reconciliationToolRef?: {
        id: string;
        version?: string;
        revision?: string;
    };
}

契约成员

成员种类签名说明
mode属性mode: "reconcile" | "quarantine" | "discard" | "accept"公开属性;类型、只读和可选状态以签名列为准。
reconciliationToolRef属性reconciliationToolRef?: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。

ToolObservabilitySpec

Tool Observability Spec 接口,共包含 7 个公开字段或方法。

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

声明

text
export interface ToolObservabilitySpec {
    traceLevel: 'none' | 'metadata' | 'summary' | 'full_redacted';
    recordInput?: boolean;
    recordOutput?: boolean;
    recordAttempts?: boolean;
    recordPolicyDecision?: boolean;
    metricsEnabled?: boolean;
    redactionPolicyRef?: {
        id: string;
        version?: string;
        revision?: string;
    };
}

契约成员

成员种类签名说明
metricsEnabled属性metricsEnabled?: boolean公开属性;类型、只读和可选状态以签名列为准。
recordAttempts属性recordAttempts?: boolean公开属性;类型、只读和可选状态以签名列为准。
recordInput属性recordInput?: boolean公开属性;类型、只读和可选状态以签名列为准。
recordOutput属性recordOutput?: boolean公开属性;类型、只读和可选状态以签名列为准。
recordPolicyDecision属性recordPolicyDecision?: boolean公开属性;类型、只读和可选状态以签名列为准。
redactionPolicyRef属性redactionPolicyRef?: { id: string; version?: string; revision?: string; }公开属性;类型、只读和可选状态以签名列为准。
traceLevel属性traceLevel: "none" | "metadata" | "summary" | "full_redacted"公开属性;类型、只读和可选状态以签名列为准。

ToolOutputLimitSpec

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

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

声明

text
export interface ToolOutputLimitSpec {
    maxInlineBytes: number;
    overflow: 'fail' | 'truncate' | 'artifact';
}

契约成员

成员种类签名说明
maxInlineBytes属性maxInlineBytes: number公开属性;类型、只读和可选状态以签名列为准。
overflow属性overflow: "fail" | "artifact" | "truncate"公开属性;类型、只读和可选状态以签名列为准。

ToolPrincipalSpec

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

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

声明

text
export interface ToolPrincipalSpec {
    principalId: string;
    type: 'user' | 'agent' | 'service' | 'system';
    tenantId?: string;
    userId?: string;
    workspaceId?: string;
    agentId?: string;
    roles?: string[];
    permissionScopes: string[];
    delegatedBy?: string;
    delegationDepth?: number;
    authenticationContext?: Record<string, unknown>;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
agentId属性agentId?: string公开属性;类型、只读和可选状态以签名列为准。
authenticationContext属性authenticationContext?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
delegatedBy属性delegatedBy?: string公开属性;类型、只读和可选状态以签名列为准。
delegationDepth属性delegationDepth?: number公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
permissionScopes属性permissionScopes: string[]公开属性;类型、只读和可选状态以签名列为准。
principalId属性principalId: string公开属性;类型、只读和可选状态以签名列为准。
roles属性roles?: string[]公开属性;类型、只读和可选状态以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。
type属性type: "system" | "agent" | "user" | "service"公开属性;类型、只读和可选状态以签名列为准。
userId属性userId?: string公开属性;类型、只读和可选状态以签名列为准。
workspaceId属性workspaceId?: string公开属性;类型、只读和可选状态以签名列为准。

ToolSchemaSpec

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

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

声明

text
export interface ToolSchemaSpec {
    jsonSchema: JsonSchema;
    schemaId?: string;
    schemaVersion?: string;
    schemaHash: string;
    strict?: boolean;
    allowAdditionalProperties?: boolean;
    maxSerializedBytes?: number;
    sensitivePaths?: string[];
    redactedPaths?: string[];
}

契约成员

成员种类签名说明
allowAdditionalProperties属性allowAdditionalProperties?: boolean公开属性;类型、只读和可选状态以签名列为准。
jsonSchema属性jsonSchema: JsonSchema公开属性;类型、只读和可选状态以签名列为准。
maxSerializedBytes属性maxSerializedBytes?: number公开属性;类型、只读和可选状态以签名列为准。
redactedPaths属性redactedPaths?: string[]公开属性;类型、只读和可选状态以签名列为准。
schemaHash属性schemaHash: string公开属性;类型、只读和可选状态以签名列为准。
schemaId属性schemaId?: string公开属性;类型、只读和可选状态以签名列为准。
schemaVersion属性schemaVersion?: string公开属性;类型、只读和可选状态以签名列为准。
sensitivePaths属性sensitivePaths?: string[]公开属性;类型、只读和可选状态以签名列为准。
strict属性strict?: boolean公开属性;类型、只读和可选状态以签名列为准。

ToolSemanticSpec

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

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

声明

text
export interface ToolSemanticSpec {
    sideEffectLevel: SideEffectLevel;
    idempotency: 'none' | 'caller_key' | 'derived_key' | 'provider_key' | 'intrinsic';
    deterministic?: boolean;
    readOnlyHint?: boolean;
    destructiveHint?: boolean;
    openWorldHint?: boolean;
    preconditions?: PolicyRuleSpec[];
    postconditions?: PolicyRuleSpec[];
    expectedArtifacts?: ToolArtifactContract[];
    resultSemantics?: 'observation' | 'artifact' | 'state_patch' | 'external_receipt';
}

契约成员

成员种类签名说明
destructiveHint属性destructiveHint?: boolean公开属性;类型、只读和可选状态以签名列为准。
deterministic属性deterministic?: boolean公开属性;类型、只读和可选状态以签名列为准。
expectedArtifacts属性expectedArtifacts?: ToolArtifactContract[]公开属性;类型、只读和可选状态以签名列为准。
idempotency属性idempotency: "none" | "caller_key" | "derived_key" | "provider_key" | "intrinsic"公开属性;类型、只读和可选状态以签名列为准。
openWorldHint属性openWorldHint?: boolean公开属性;类型、只读和可选状态以签名列为准。
postconditions属性postconditions?: PolicyRuleSpec[]公开属性;类型、只读和可选状态以签名列为准。
preconditions属性preconditions?: PolicyRuleSpec[]公开属性;类型、只读和可选状态以签名列为准。
readOnlyHint属性readOnlyHint?: boolean公开属性;类型、只读和可选状态以签名列为准。
resultSemantics属性resultSemantics?: "artifact" | "observation" | "state_patch" | "external_receipt"公开属性;类型、只读和可选状态以签名列为准。
sideEffectLevel属性sideEffectLevel: SideEffectLevel公开属性;类型、只读和可选状态以签名列为准。

ToolSourceRef

Tool Source Ref 接口,共包含 9 个公开字段或方法。

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

声明

text
export interface ToolSourceRef {
    adapterId?: string;
    handlerId?: string;
    endpointRef?: string;
    mcpServerId?: string;
    mcpCapabilityId?: string;
    mcpCapabilityHash?: string;
    pluginId?: string;
    hostedToolId?: string;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
adapterId属性adapterId?: string公开属性;类型、只读和可选状态以签名列为准。
endpointRef属性endpointRef?: string公开属性;类型、只读和可选状态以签名列为准。
handlerId属性handlerId?: string公开属性;类型、只读和可选状态以签名列为准。
hostedToolId属性hostedToolId?: string公开属性;类型、只读和可选状态以签名列为准。
mcpCapabilityHash属性mcpCapabilityHash?: string公开属性;类型、只读和可选状态以签名列为准。
mcpCapabilityId属性mcpCapabilityId?: string公开属性;类型、只读和可选状态以签名列为准。
mcpServerId属性mcpServerId?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
pluginId属性pluginId?: string公开属性;类型、只读和可选状态以签名列为准。

ToolStreamingSpec

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

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

声明

text
export interface ToolStreamingSpec {
    enabled: boolean;
    supportsProgress?: boolean;
    supportsStructuredContent?: boolean;
    maxUpdates?: number;
}

契约成员

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

GovernedToolInvocationStatus

Governed Tool Invocation Status 公共类型别名;完整类型表达式见声明。

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

声明

text
export type GovernedToolInvocationStatus = 'created' | 'validating' | 'validated' | 'denied' | 'waiting_approval' | 'approved' | 'rejected' | 'queued' | 'running' | 'cancelling' | 'cancelled' | 'completed' | 'failed' | 'timed_out' | 'expired' | 'conflict';

ToolSource

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

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

声明

text
export type ToolSource = 'local' | 'mcp' | 'http' | 'plugin' | 'hosted' | 'execution' | 'custom';