Skip to content

@codesoul-co/hypha-tools / index ​

Using this module ​

Aggregates the public entrypoint exports for @codesoul-co/hypha-tools; applications import these symbols from the package entrypoint instead of internal file paths.

Import from the package entrypoint ​

ts
import {
  AllowAllToolAuthorizer,
  GovernedToolRunner,
  HttpToolAdapter,
  InMemoryToolApprovalStore,
  InMemoryToolInvocationStore,
  InMemoryToolResultCache,
  LocalFunctionToolAdapter,
  MCPToolAdapter,
} from '@codesoul-co/hypha-tools';

import type {
  AdapterCancellationRequest,
  AdapterExecutionRequest,
  HttpToolAdapterOptions,
  InMemoryToolResultCacheOptions,
  MCPToolInvocationPort,
  RedisLikeToolResultCacheClient,
  RedisToolResultCacheOptions,
  ToolAdapter,
} from '@codesoul-co/hypha-tools';

// The complete export list is documented below.

Usage patterns ​

  • Use the 51 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The module exposes 17 classes as constructable runtime implementations. Each symbol entry lists its constructor and public methods.
  • The module exposes 5 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 12 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Runtime validation example ​

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

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

Parse untrusted configuration, network, or persisted input with the runtime schema before passing it to functions or classes that expect a validated contract.

Public exports ​

SymbolKindSignatureDescription
AllowAllToolAuthorizerclassnew AllowAllToolAuthorizer(): AllowAllToolAuthorizerAllow All Tool Authorizer class with 2 public constructor or member entries; its exact declarations are listed below.
GovernedToolRunnerclassnew GovernedToolRunner(registry: ToolRegistry, trace: TraceRecorder, policy?: PolicyEngine, options?: { approvalStore?: ToolApprovalStore; invocationStore?: ToolInvocationStore; authorizer?: ToolAuthorizer; middleware?: ToolMiddleware[]; artifactPort?: ToolArtifactPort; snapshotStore?: ToolContractSnapshotStore; receiptReconciler?: ToolReceiptReconciler; resultCache?: ToolResultCache; resultCacheFailureMode?: "byp...Governed Tool Runner class with 8 public constructor or member entries; its exact declarations are listed below.
HttpToolAdapterclassnew HttpToolAdapter(id: string, options: HttpToolAdapterOptions): HttpToolAdapterHttp Tool Adapter class with 7 public constructor or member entries; its exact declarations are listed below.
InMemoryToolApprovalStoreclassnew InMemoryToolApprovalStore(): InMemoryToolApprovalStoreIn Memory Tool Approval Store class with 6 public constructor or member entries; its exact declarations are listed below.
InMemoryToolInvocationStoreclassnew InMemoryToolInvocationStore(): InMemoryToolInvocationStoreIn Memory Tool Invocation Store class with 8 public constructor or member entries; its exact declarations are listed below.
InMemoryToolResultCacheclassnew InMemoryToolResultCache(options?: InMemoryToolResultCacheOptions): InMemoryToolResultCacheIn Memory Tool Result Cache class with 5 public constructor or member entries; its exact declarations are listed below.
LocalFunctionToolAdapterclassnew LocalFunctionToolAdapter<TInput = unknown, TOutput = unknown>(id: string, handler: ToolHandler<TInput, TOutput>): LocalFunctionToolAdapter<TInput, TOutput>Local Function Tool Adapter class with 6 public constructor or member entries; its exact declarations are listed below.
MCPToolAdapterclassnew MCPToolAdapter(id: string, serverId: string, capabilityId: string, gateway: MCPToolInvocationPort): MCPToolAdapterMCP Tool Adapter class with 7 public constructor or member entries; its exact declarations are listed below.
MockToolAdapterclassnew MockToolAdapter<TInput = unknown, TOutput = unknown>(id: string, handler: ToolHandler<TInput, TOutput>): MockToolAdapter<TInput, TOutput>Mock Tool Adapter class with 6 public constructor or member entries; its exact declarations are listed below.
MockToolRunnerclassnew MockToolRunner(defaultOutput?: unknown): MockToolRunnerMock Tool Runner class with 4 public constructor or member entries; its exact declarations are listed below.
PermissionScopeToolAuthorizerclassnew PermissionScopeToolAuthorizer(): PermissionScopeToolAuthorizerPermission Scope Tool Authorizer class with 2 public constructor or member entries; its exact declarations are listed below.
PluginToolAdapterclassnew PluginToolAdapter<TInput = unknown, TOutput = unknown>(id: string, handler: ToolHandler<TInput, TOutput>): PluginToolAdapter<TInput, TOutput>Plugin Tool Adapter class with 6 public constructor or member entries; its exact declarations are listed below.
RedisToolResultCacheclassnew RedisToolResultCache(options: RedisToolResultCacheOptions): RedisToolResultCacheShared Redis-compatible Store for local, self-hosted, and managed Redis deployments.
ToolRegistryclassnew ToolRegistry(): ToolRegistryTool Registry class with 9 public constructor or member entries; its exact declarations are listed below.
ToolResultCacheEntryTooLargeErrorclassnew ToolResultCacheEntryTooLargeError(actualBytes: number, maxEntryBytes: number): ToolResultCacheEntryTooLargeErrorTool Result Cache Entry Too Large Error class with 11 public constructor or member entries; its exact declarations are listed below.
ToolResultCacheOperationTimeoutErrorclassnew ToolResultCacheOperationTimeoutError(operation: "get" | "set" | "delete" | "verify", timeoutMs: number): ToolResultCacheOperationTimeoutErrorTool Result Cache Operation Timeout Error class with 11 public constructor or member entries; its exact declarations are listed below.
ToolResultCacheValidationErrorclassnew ToolResultCacheValidationError(message: string): ToolResultCacheValidationErrorTool Result Cache Validation Error class with 9 public constructor or member entries; its exact declarations are listed below.
TOOL_INVOCATION_STATUSESconstantconst TOOL_INVOCATION_STATUSES: readonly ["created", "validating", "validated", "policy_checked", "waiting_approval", "approved", "rejected", "queued", "running", "cancelling", "completed", "failed", "timed_out", "expired", "conflict", "denied", "cancelled"]TOOL INVOCATION STATUSES constant exported by the index module.
toolCacheValidityRecordSchemaconstantconst toolCacheValidityRecordSchema: z.ZodObject<{ toolId: z.ZodString; toolRevision: z.ZodString; inputHash: z.ZodString; scopeHash: z.ZodString; policyRevision: z.ZodString; contractSnapshotHash: z.ZodOptional<z.ZodString>; capabilityHash: z.ZodOptional<z.ZodString>; externalStateVersion: z.ZodOptional<z.ZodString>; key: z.ZodString; validUntil: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { toolId: st...Runtime schema for Tool Cache Validity Record.
toolProfileSpecDefinitionconstantconst toolProfileSpecDefinition: SpecSchemaDefinition<ToolProfileSpec>Runtime validation entrypoint for the Tool Profile spec, combining its parser, example and JSON Schema.
toolProfileSpecSchemaconstantconst toolProfileSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; revision: z.ZodOptional<z.ZodString>; toolRefs: z.ZodArray<z.ZodObject<{ id: z.ZodString; version: z.ZodOptional<z.ZodString>; revision: z.ZodOptional<z.ZodString>; }, "strip", z.ZodTypeAny, { id: string; revision?: string | undefined; version?: string | undefined; }, { id: string; revision?: string | undefined; version?: string | un...Runtime schema for Tool Profile Spec.
toolResultCacheEntryJsonSchemaconstantconst toolResultCacheEntryJsonSchema: JsonSchemaJSON Schema for Tool Result Cache Entry.
toolResultCacheEntrySchemaconstantconst toolResultCacheEntrySchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<"1.0">; keyVersion: z.ZodLiteral<"1">; validity: z.ZodObject<{ toolId: z.ZodString; toolRevision: z.ZodString; inputHash: z.ZodString; scopeHash: z.ZodString; policyRevision: z.ZodString; contractSnapshotHash: z.ZodOptional<z.ZodString>; capabilityHash: z.ZodOptional<z.ZodString>; externalStateVersion: z.ZodOptional<z.ZodString>; key: z.Zo...Runtime schema for Tool Result Cache Entry.
toolSpecDefinitionconstantconst toolSpecDefinition: SpecSchemaDefinition<ToolSpec>Runtime validation entrypoint for the Tool spec, combining its parser, example and JSON Schema.
toolSpecDefinitionsconstantconst toolSpecDefinitions: readonly [SpecSchemaDefinition<ToolSpec>, SpecSchemaDefinition<ToolProfileSpec>]Tool Spec Definitions constant exported by the index module.
toolSpecExampleconstantconst toolSpecExample: ToolSpecValid example value for Tool Spec.
toolSpecJsonSchemaconstantconst toolSpecJsonSchema: JsonSchemaJSON Schema for Tool Spec.
toolSpecJsonSchemasconstantconst toolSpecJsonSchemas: Record<string, JsonSchema>Tool Spec JSON Schemas constant exported by the index module.
toolSpecSchemaconstantconst toolSpecSchema: z.ZodObject<{ id: z.ZodString; version: z.ZodString; revision: z.ZodOptional<z.ZodString>; name: z.ZodOptional<z.ZodString>; displayName: z.ZodOptional<z.ZodString>; description: z.ZodString; instructions: z.ZodOptional<z.ZodString>; tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; inputSchema: z.ZodType<JsonSchema, z.ZodTypeDef, JsonSchema>; outputSchema: z.ZodOptional<z.ZodType<JsonSch...Runtime schema for Tool Spec.
normalizeToolSpecfunctionnormalizeToolSpec(spec: ToolSpec): ResolvedToolSpecNormalize Tool Spec function with 1 public call signature; parameters and return types are listed below.
validateEffectiveCapabilityAccessfunctionvalidateEffectiveCapabilityAccess(input: { snapshot: ToolContractSnapshot | null; context: ToolCallContext; spec: ToolSpec; }): string | nullValidate Effective Capability Access function with 1 public call signature; parameters and return types are listed below.
validateToolInputfunctionvalidateToolInput(schema: JsonSchema, input: unknown): ToolSchemaValidationResultValidate Tool Input function with 1 public call signature; parameters and return types are listed below.
validateToolResultCacheEntryfunctionvalidateToolResultCacheEntry(value: unknown, maxEntryBytes?: number): ToolResultCacheEntryValidate Tool Result Cache Entry function with 1 public call signature; parameters and return types are listed below.
validateToolSpecfunctionvalidateToolSpec(input: unknown): ToolSpecValidate Tool Spec function with 1 public call signature; parameters and return types are listed below.
AdapterCancellationRequestinterfaceinterface AdapterCancellationRequestAdapter Cancellation Request interface with 3 public fields or methods.
AdapterExecutionRequestinterfaceinterface AdapterExecutionRequestAdapter Execution Request interface with 3 public fields or methods.
HttpToolAdapterOptionsinterfaceinterface HttpToolAdapterOptionsHttp Tool Adapter Options interface with 4 public fields or methods.
InMemoryToolResultCacheOptionsinterfaceinterface InMemoryToolResultCacheOptionsIn Memory Tool Result Cache Options interface with 2 public fields or methods.
MCPToolInvocationPortinterfaceinterface MCPToolInvocationPortMCP Tool Invocation Port interface with 3 public fields or methods.
RedisLikeToolResultCacheClientinterfaceinterface RedisLikeToolResultCacheClientRedis Like Tool Result Cache Client interface with 3 public fields or methods.
RedisToolResultCacheOptionsinterfaceinterface RedisToolResultCacheOptionsRedis Tool Result Cache Options interface with 5 public fields or methods.
ToolAdapterinterfaceinterface ToolAdapterTool Adapter interface with 7 public fields or methods.
ToolAdapterCapabilitiesinterfaceinterface ToolAdapterCapabilitiesTool Adapter Capabilities interface with 5 public fields or methods.
ToolApprovalGrantinterfaceinterface ToolApprovalGrantTool Approval Grant interface with 11 public fields or methods.
ToolApprovalRequestinterfaceinterface ToolApprovalRequestTool Approval Request interface with 15 public fields or methods.
ToolApprovalStoreinterfaceinterface ToolApprovalStoreTool Approval Store interface with 5 public fields or methods.
ToolArtifactPortinterfaceinterface ToolArtifactPortTool Artifact Port interface with 1 public fields or methods.
ToolAuthorizationDecisioninterfaceinterface ToolAuthorizationDecisionTool Authorization Decision interface with 3 public fields or methods.
ToolAuthorizationInputinterfaceinterface ToolAuthorizationInputTool Authorization Input interface with 4 public fields or methods.
ToolAuthorizerinterfaceinterface ToolAuthorizerTool Authorizer interface with 1 public fields or methods.
ToolCachedResultProjectioninterfaceinterface ToolCachedResultProjectionOnly stable, replay-safe output fields may cross invocation boundaries.
ToolCallContextinterfaceinterface ToolCallContextTool Call Context interface with 24 public fields or methods.
ToolCallErrorinterfaceinterface ToolCallErrorTool Call Error interface with 5 public fields or methods.
ToolCallRequestinterfaceinterface ToolCallRequestTool Call Request interface with 3 public fields or methods.
ToolCallResultinterfaceinterface ToolCallResultTool Call Result interface with 12 public fields or methods.
ToolExecutionEnvelopeinterfaceinterface ToolExecutionEnvelopeTool Execution Envelope interface with 7 public fields or methods.
ToolExecutionScopeinterfaceinterface ToolExecutionScopeTool Execution Scope interface with 3 public fields or methods.
ToolIdempotencyLookupinterfaceinterface ToolIdempotencyLookupTool Idempotency Lookup interface with 3 public fields or methods.
ToolInvocationListRequestinterfaceinterface ToolInvocationListRequestTool Invocation List Request interface with 4 public fields or methods.
ToolInvocationRecordinterfaceinterface ToolInvocationRecordTool Invocation Record interface with 37 public fields or methods.
ToolInvocationStoreinterfaceinterface ToolInvocationStoreTool Invocation Store interface with 7 public fields or methods.
ToolMiddlewareinterfaceinterface ToolMiddlewareTool Middleware interface with 5 public fields or methods.
ToolMiddlewareContextinterfaceinterface ToolMiddlewareContextTool Middleware Context interface with 5 public fields or methods.
ToolObservationPortinterfaceinterface ToolObservationPortTool Observation Port interface with 1 public fields or methods.
ToolPrincipalinterfaceinterface ToolPrincipalTool Principal interface with 13 public fields or methods.
ToolProfileSpecinterfaceinterface ToolProfileSpec extends VersionedSpecTool Profile Spec interface with 11 public fields or methods.
ToolProgressUpdateinterfaceinterface ToolProgressUpdateTool Progress Update interface with 6 public fields or methods.
ToolReceiptReconcilerinterfaceinterface ToolReceiptReconcilerTool Receipt Reconciler interface with 1 public fields or methods.
ToolReceiptReconciliationinterfaceinterface ToolReceiptReconciliationTool Receipt Reconciliation interface with 3 public fields or methods.
ToolResultCacheinterfaceinterface ToolResultCacheTool Result Cache interface with 3 public fields or methods.
ToolResultCacheArtifactVerifierinterfaceinterface ToolResultCacheArtifactVerifierTool Result Cache Artifact Verifier interface with 1 public fields or methods.
ToolResultCacheEntryinterfaceinterface ToolResultCacheEntryTool Result Cache Entry interface with 5 public fields or methods.
ToolRunnerinterfaceinterface ToolRunnerTool Runner interface with 2 public fields or methods.
ToolSchemaValidationIssueinterfaceinterface ToolSchemaValidationIssueTool Schema Validation Issue interface with 2 public fields or methods.
ToolSchemaValidationResultinterfaceinterface ToolSchemaValidationResultTool Schema Validation Result interface with 3 public fields or methods.
ToolSpecinterfaceinterface ToolSpecTool Spec interface with 33 public fields or methods.
ToolTargetResolutioninterfaceinterface ToolTargetResolutionTool Target Resolution interface with 3 public fields or methods.
ToolTargetResolverinterfaceinterface ToolTargetResolverTool Target Resolver interface with 1 public fields or methods.
MockToolHandlertypetype MockToolHandler = (request: ToolCallRequest) => Promise<ToolCallResult> | ToolCallResultPublic type alias for Mock Tool Handler; the declaration contains its complete type expression.
ResolvedToolSpectypetype ResolvedToolSpec = ToolSpec & GovernedToolContractSpecPublic type alias for Resolved Tool Spec; the declaration contains its complete type expression.
ToolExecutionPhasetypetype ToolExecutionPhase = 'resolution' | 'authorization' | 'input_validation' | 'policy' | 'approval' | 'execution' | 'timeout' | 'output_validation'Public type alias for Tool Execution Phase; the declaration contains its complete type expression.
ToolHandlertypetype ToolHandler = (input: TInput, context: ToolCallContext) => Promise<TOutput>Public type alias for Tool Handler; the declaration contains its complete type expression.
ToolInvocationPatchtypetype ToolInvocationPatch = Partial<Pick<ToolInvocationRecord, 'status' | 'executionCycle' | 'attemptCount' | 'result' | 'approvalRequest' | 'updatedAt' | 'startedAt' | 'completedAt' | 'lateResultState' | 'outputHash' | 'artifactRefs' | 'observationRefs' | 'externalReceipt'>>Public type alias for Tool Invocation Patch; the declaration contains its complete type expression.
ToolInvocationStatustypetype ToolInvocationStatus = (typeof TOOL_INVOCATION_STATUSES)[number]Public type alias for Tool Invocation Status; the declaration contains its complete type expression.
ToolResultContenttypetype ToolResultContent = { type: 'text'; text: string; } | { type: 'json'; value: unknown; } | { type: 'image'; artifactRef?: string; url?: string; mimeType?: string; alt?: string; } | { type: 'resource'; uri: string; mimeType?: string; title?: string; } | { type: 'artifact'; artifactRef: string; title?: string; mimeType?: string; }Public type alias for Tool Result Content; the declaration contains its complete type expression.

AllowAllToolAuthorizer ​

Allow All Tool Authorizer class with 2 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { AllowAllToolAuthorizer } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class AllowAllToolAuthorizer implements ToolAuthorizer {
    authorize(): Promise<ToolAuthorizationDecision>;
}

Public members ​

MemberKindSignatureDescription
authorizemethodauthorize(): Promise<ToolAuthorizationDecision>Public method; parameters and return type are shown in the signature.
constructorconstructor(): AllowAllToolAuthorizerCreates an instance of this class.

GovernedToolRunner ​

Governed Tool Runner class with 8 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { GovernedToolRunner } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class GovernedToolRunner implements ToolRunner {
    constructor(registry: ToolRegistry, trace: TraceRecorder, policy?: PolicyEngine, options?: {
            approvalStore?: ToolApprovalStore;
            invocationStore?: ToolInvocationStore;
            authorizer?: ToolAuthorizer;
            middleware?: ToolMiddleware[];
            artifactPort?: ToolArtifactPort;
            snapshotStore?: ToolContractSnapshotStore;
            receiptReconciler?: ToolReceiptReconciler;
            resultCache?: ToolResultCache;
            resultCacheFailureMode?: 'bypass' | 'strict';
            resultCacheTimeoutMs?: number;
            resultCacheMaxEntryBytes?: number;
            resultCacheArtifactVerifier?: ToolResultCacheArtifactVerifier;
            observationPort?: ToolObservationPort;
            telemetry?: TelemetryRecorder;
            now?: () => string;
        });
    getInvocation(invocationId: string): Promise<ToolInvocationRecord | null>;
    listInvocations(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>;
    recoverPendingInvocations(): Promise<ToolCallResult[]>;
    run(request: ToolCallRequest): Promise<ToolCallResult>;
    approveAndResume(invocationId: string, approvedBy: string, options?: {
            approvedAt?: string;
            expiresAt?: string;
        }): Promise<ToolCallResult>;
    rejectInvocation(invocationId: string): Promise<ToolCallResult>;
    cancelInvocation(invocationId: string, reason?: string): Promise<ToolCallResult>;
}

Public members ​

MemberKindSignatureDescription
approveAndResumemethodapproveAndResume(invocationId: string, approvedBy: string, options?: { approvedAt?: string; expiresAt?: string; }): Promise<ToolCallResult>Public method; parameters and return type are shown in the signature.
cancelInvocationmethodcancelInvocation(invocationId: string, reason?: string): Promise<ToolCallResult>Public method; parameters and return type are shown in the signature.
constructorconstructor(registry: ToolRegistry, trace: TraceRecorder, policy?: PolicyEngine, options?: { approvalStore?: ToolApprovalStore; invocationStore?: ToolInvocationStore; authorizer?: ToolAuthorizer; middleware?: ToolMiddleware[]; artifactPort?: ToolArtifactPort; snapshotStore?: ToolContractSnapshotStore; receiptReconciler?: ToolReceiptReconciler; resultCache?: ToolResultCache; resultCacheFailureMode?: "bypass" | "strict"; resul...Creates an instance of this class.
getInvocationmethodgetInvocation(invocationId: string): Promise<ToolInvocationRecord | null>Public method; parameters and return type are shown in the signature.
listInvocationsmethodlistInvocations(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>Public method; parameters and return type are shown in the signature.
recoverPendingInvocationsmethodrecoverPendingInvocations(): Promise<ToolCallResult[]>Public method; parameters and return type are shown in the signature.
rejectInvocationmethodrejectInvocation(invocationId: string): Promise<ToolCallResult>Public method; parameters and return type are shown in the signature.
runmethodrun(request: ToolCallRequest): Promise<ToolCallResult>Public method; parameters and return type are shown in the signature.

HttpToolAdapter ​

Http Tool Adapter class with 7 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { HttpToolAdapter } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class HttpToolAdapter implements ToolAdapter {
    readonly id: string;
    readonly source: ToolSource;
    constructor(id: string, options: HttpToolAdapterOptions);
    capabilities(): Promise<ToolAdapterCapabilities>;
    execute(request: AdapterExecutionRequest): Promise<ToolExecutionEnvelope>;
    cancel(): Promise<void>;
    health(): Promise<ProviderHealth>;
}

Public members ​

MemberKindSignatureDescription
cancelmethodcancel(): Promise<void>Public method; parameters and return type are shown in the signature.
capabilitiesmethodcapabilities(): Promise<ToolAdapterCapabilities>Public method; parameters and return type are shown in the signature.
constructorconstructor(id: string, options: HttpToolAdapterOptions): HttpToolAdapterCreates an instance of this class.
executemethodexecute(request: AdapterExecutionRequest): Promise<ToolExecutionEnvelope>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertyreadonly source: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.

InMemoryToolApprovalStore ​

In Memory Tool Approval Store class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { InMemoryToolApprovalStore } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class InMemoryToolApprovalStore implements ToolApprovalStore {
    getRequest(invocationId: string): Promise<ToolApprovalRequest | null>;
    requestApproval(request: ToolApprovalRequest): Promise<ToolApprovalRequest>;
    getGrant(invocationId: string): Promise<ToolApprovalGrant | null>;
    approve(invocationId: string, approvedBy: string, options?: {
            approvedAt?: string;
            expiresAt?: string;
        }): Promise<ToolApprovalGrant>;
    reject(invocationId: string): Promise<ToolApprovalRequest>;
}

Public members ​

MemberKindSignatureDescription
approvemethodapprove(invocationId: string, approvedBy: string, options?: { approvedAt?: string; expiresAt?: string; }): Promise<ToolApprovalGrant>Public method; parameters and return type are shown in the signature.
constructorconstructor(): InMemoryToolApprovalStoreCreates an instance of this class.
getGrantmethodgetGrant(invocationId: string): Promise<ToolApprovalGrant | null>Public method; parameters and return type are shown in the signature.
getRequestmethodgetRequest(invocationId: string): Promise<ToolApprovalRequest | null>Public method; parameters and return type are shown in the signature.
rejectmethodreject(invocationId: string): Promise<ToolApprovalRequest>Public method; parameters and return type are shown in the signature.
requestApprovalmethodrequestApproval(request: ToolApprovalRequest): Promise<ToolApprovalRequest>Public method; parameters and return type are shown in the signature.

InMemoryToolInvocationStore ​

In Memory Tool Invocation Store class with 8 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { InMemoryToolInvocationStore } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class InMemoryToolInvocationStore implements ToolInvocationStore {
    get(invocationId: string): Promise<ToolInvocationRecord | null>;
    findByIdempotency(request: ToolIdempotencyLookup): Promise<ToolInvocationRecord | null>;
    list(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>;
    create(record: ToolInvocationRecord): Promise<ToolInvocationRecord>;
    update(invocationId: string, patch: ToolInvocationPatch, options?: {
            expectedStatuses?: readonly ToolInvocationStatus[];
            expectedRevision?: number;
        }): Promise<ToolInvocationRecord>;
    getCompleted(invocationId: string): Promise<ToolCallResult | null>;
    saveCompleted(invocationId: string, result: ToolCallResult): Promise<void>;
}

Public members ​

MemberKindSignatureDescription
constructorconstructor(): InMemoryToolInvocationStoreCreates an instance of this class.
createmethodcreate(record: ToolInvocationRecord): Promise<ToolInvocationRecord>Public method; parameters and return type are shown in the signature.
findByIdempotencymethodfindByIdempotency(request: ToolIdempotencyLookup): Promise<ToolInvocationRecord | null>Public method; parameters and return type are shown in the signature.
getmethodget(invocationId: string): Promise<ToolInvocationRecord | null>Public method; parameters and return type are shown in the signature.
getCompletedmethodgetCompleted(invocationId: string): Promise<ToolCallResult | null>Public method; parameters and return type are shown in the signature.
listmethodlist(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>Public method; parameters and return type are shown in the signature.
saveCompletedmethodsaveCompleted(invocationId: string, result: ToolCallResult): Promise<void>Public method; parameters and return type are shown in the signature.
updatemethodupdate(invocationId: string, patch: ToolInvocationPatch, options?: { expectedStatuses?: readonly ToolInvocationStatus[]; expectedRevision?: number; }): Promise<ToolInvocationRecord>Public method; parameters and return type are shown in the signature.

InMemoryToolResultCache ​

In Memory Tool Result Cache class with 5 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { InMemoryToolResultCache } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class InMemoryToolResultCache implements ToolResultCache {
    constructor(options?: InMemoryToolResultCacheOptions);
    get(key: string): Promise<ToolResultCacheEntry | null>;
    set(entry: ToolResultCacheEntry): Promise<void>;
    delete(key: string): Promise<void>;
    size(): number;
}

Public members ​

MemberKindSignatureDescription
constructorconstructor(options?: InMemoryToolResultCacheOptions): InMemoryToolResultCacheCreates an instance of this class.
deletemethoddelete(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<ToolResultCacheEntry | null>Public method; parameters and return type are shown in the signature.
setmethodset(entry: ToolResultCacheEntry): Promise<void>Public method; parameters and return type are shown in the signature.
sizemethodsize(): numberPublic method; parameters and return type are shown in the signature.

LocalFunctionToolAdapter ​

Local Function Tool Adapter class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { LocalFunctionToolAdapter } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class LocalFunctionToolAdapter<TInput = unknown, TOutput = unknown> implements ToolAdapter<TInput, TOutput> {
    readonly id: string;
    readonly source: ToolSource;
    constructor(id: string, handler: ToolHandler<TInput, TOutput>);
    capabilities(): Promise<ToolAdapterCapabilities>;
    execute(request: AdapterExecutionRequest<TInput>): Promise<ToolExecutionEnvelope<TOutput>>;
    health(): Promise<ProviderHealth>;
}

Public members ​

MemberKindSignatureDescription
capabilitiesmethodcapabilities(): Promise<ToolAdapterCapabilities>Public method; parameters and return type are shown in the signature.
constructorconstructor<TInput = unknown, TOutput = unknown>(id: string, handler: ToolHandler<TInput, TOutput>): LocalFunctionToolAdapter<TInput, TOutput>Creates an instance of this class.
executemethodexecute(request: AdapterExecutionRequest<TInput>): Promise<ToolExecutionEnvelope<TOutput>>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertyreadonly source: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.

MCPToolAdapter ​

MCP Tool Adapter class with 7 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { MCPToolAdapter } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class MCPToolAdapter implements ToolAdapter {
    readonly id: string;
    readonly source: ToolSource;
    constructor(id: string, serverId: string, capabilityId: string, gateway: MCPToolInvocationPort);
    capabilities(): Promise<ToolAdapterCapabilities>;
    execute(request: AdapterExecutionRequest): Promise<ToolExecutionEnvelope>;
    cancel(request: AdapterCancellationRequest): Promise<void>;
    health(): Promise<ProviderHealth>;
}

Public members ​

MemberKindSignatureDescription
cancelmethodcancel(request: AdapterCancellationRequest): Promise<void>Public method; parameters and return type are shown in the signature.
capabilitiesmethodcapabilities(): Promise<ToolAdapterCapabilities>Public method; parameters and return type are shown in the signature.
constructorconstructor(id: string, serverId: string, capabilityId: string, gateway: MCPToolInvocationPort): MCPToolAdapterCreates an instance of this class.
executemethodexecute(request: AdapterExecutionRequest): Promise<ToolExecutionEnvelope>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertyreadonly source: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.

MockToolAdapter ​

Mock Tool Adapter class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { MockToolAdapter } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class MockToolAdapter<TInput = unknown, TOutput = unknown> extends LocalFunctionToolAdapter<TInput, TOutput> {
    readonly source: ToolSource;
}

Public members ​

MemberKindSignatureDescription
capabilitiesmethodcapabilities(): Promise<ToolAdapterCapabilities>Public method; parameters and return type are shown in the signature.
constructorconstructor<TInput = unknown, TOutput = unknown>(id: string, handler: ToolHandler<TInput, TOutput>): MockToolAdapter<TInput, TOutput>Creates an instance of this class.
executemethodexecute(request: AdapterExecutionRequest<TInput>): Promise<ToolExecutionEnvelope<TOutput>>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertyreadonly source: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.

MockToolRunner ​

Mock Tool Runner class with 4 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { MockToolRunner } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class MockToolRunner implements ToolRunner {
    constructor(defaultOutput?: unknown);
    registerHandler(toolId: string, handler: MockToolHandler): void;
    registerResult(toolId: string, result: ToolCallResult): void;
    run(request: ToolCallRequest): Promise<ToolCallResult>;
}

Public members ​

MemberKindSignatureDescription
constructorconstructor(defaultOutput?: unknown): MockToolRunnerCreates an instance of this class.
registerHandlermethodregisterHandler(toolId: string, handler: MockToolHandler): voidPublic method; parameters and return type are shown in the signature.
registerResultmethodregisterResult(toolId: string, result: ToolCallResult): voidPublic method; parameters and return type are shown in the signature.
runmethodrun(request: ToolCallRequest): Promise<ToolCallResult>Public method; parameters and return type are shown in the signature.

PermissionScopeToolAuthorizer ​

Permission Scope Tool Authorizer class with 2 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { PermissionScopeToolAuthorizer } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class PermissionScopeToolAuthorizer implements ToolAuthorizer {
    authorize(input: ToolAuthorizationInput): Promise<ToolAuthorizationDecision>;
}

Public members ​

MemberKindSignatureDescription
authorizemethodauthorize(input: ToolAuthorizationInput): Promise<ToolAuthorizationDecision>Public method; parameters and return type are shown in the signature.
constructorconstructor(): PermissionScopeToolAuthorizerCreates an instance of this class.

PluginToolAdapter ​

Plugin Tool Adapter class with 6 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { PluginToolAdapter } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class PluginToolAdapter<TInput = unknown, TOutput = unknown> extends LocalFunctionToolAdapter<TInput, TOutput> {
    readonly source: ToolSource;
}

Public members ​

MemberKindSignatureDescription
capabilitiesmethodcapabilities(): Promise<ToolAdapterCapabilities>Public method; parameters and return type are shown in the signature.
constructorconstructor<TInput = unknown, TOutput = unknown>(id: string, handler: ToolHandler<TInput, TOutput>): PluginToolAdapter<TInput, TOutput>Creates an instance of this class.
executemethodexecute(request: AdapterExecutionRequest<TInput>): Promise<ToolExecutionEnvelope<TOutput>>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertyreadonly source: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.

RedisToolResultCache ​

Shared Redis-compatible Store for local, self-hosted, and managed Redis deployments.

  • Kind: class
  • Import: import { RedisToolResultCache } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class RedisToolResultCache implements ToolResultCache {
    constructor(options: RedisToolResultCacheOptions);
    get(key: string): Promise<ToolResultCacheEntry | null>;
    set(entry: ToolResultCacheEntry): Promise<void>;
    delete(key: string): Promise<void>;
}

Public members ​

MemberKindSignatureDescription
constructorconstructor(options: RedisToolResultCacheOptions): RedisToolResultCacheCreates an instance of this class.
deletemethoddelete(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<ToolResultCacheEntry | null>Public method; parameters and return type are shown in the signature.
setmethodset(entry: ToolResultCacheEntry): Promise<void>Public method; parameters and return type are shown in the signature.

ToolRegistry ​

Tool Registry class with 9 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { ToolRegistry } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class ToolRegistry {
    register(spec: ToolSpec, handler: ToolHandler, options?: {
            replace?: boolean;
            targetResolver?: ToolTargetResolver;
        }): void;
    registerAdapter(spec: ToolSpec, adapter: ToolAdapter, options?: {
            replace?: boolean;
            targetResolver?: ToolTargetResolver;
        }): void;
    unregister(toolId: string): boolean;
    getSpec(toolId: string): ResolvedToolSpec | null;
    getAdapter(toolId: string): ToolAdapter | null;
    getTargetResolver(toolId: string): ToolTargetResolver | null;
    resolve(ref: {
            id: string;
            version?: string;
            revision?: string;
        }): {
            spec: ResolvedToolSpec;
            adapter: ToolAdapter;
        } | null;
    list(): ResolvedToolSpec[];
}

Public members ​

MemberKindSignatureDescription
constructorconstructor(): ToolRegistryCreates an instance of this class.
getAdaptermethodgetAdapter(toolId: string): ToolAdapter | nullPublic method; parameters and return type are shown in the signature.
getSpecmethodgetSpec(toolId: string): ResolvedToolSpec | nullPublic method; parameters and return type are shown in the signature.
getTargetResolvermethodgetTargetResolver(toolId: string): ToolTargetResolver | nullPublic method; parameters and return type are shown in the signature.
listmethodlist(): ResolvedToolSpec[]Public method; parameters and return type are shown in the signature.
registermethodregister(spec: ToolSpec, handler: ToolHandler, options?: { replace?: boolean; targetResolver?: ToolTargetResolver; }): voidPublic method; parameters and return type are shown in the signature.
registerAdaptermethodregisterAdapter(spec: ToolSpec, adapter: ToolAdapter, options?: { replace?: boolean; targetResolver?: ToolTargetResolver; }): voidPublic method; parameters and return type are shown in the signature.
resolvemethodresolve(ref: { id: string; version?: string; revision?: string; }): { spec: ResolvedToolSpec; adapter: ToolAdapter; } | nullPublic method; parameters and return type are shown in the signature.
unregistermethodunregister(toolId: string): booleanPublic method; parameters and return type are shown in the signature.

ToolResultCacheEntryTooLargeError ​

Tool Result Cache Entry Too Large Error class with 11 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { ToolResultCacheEntryTooLargeError } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class ToolResultCacheEntryTooLargeError extends Error {
    readonly actualBytes: number;
    readonly maxEntryBytes: number;
    readonly code = "TOOL_RESULT_CACHE_ENTRY_TOO_LARGE";
    constructor(actualBytes: number, maxEntryBytes: number);
}

Public members ​

MemberKindSignatureDescription
actualBytespropertyreadonly actualBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
causepropertycause?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
codepropertyreadonly code: "TOOL_RESULT_CACHE_ENTRY_TOO_LARGE"Public property; its type, readonly modifier and optionality are shown in the signature.
constructorconstructor(actualBytes: number, maxEntryBytes: number): ToolResultCacheEntryTooLargeErrorCreates an instance of this class.
maxEntryBytespropertyreadonly maxEntryBytes: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stackpropertystack?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
static captureStackTracemethodstatic captureStackTrace(targetObject: object, constructorOpt?: Function): voidCreates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called. js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance: js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a();
static prepareStackTracemethodstatic prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): anyPublic method; parameters and return type are shown in the signature.
static stackTraceLimitpropertystatic stackTraceLimit: numberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

ToolResultCacheOperationTimeoutError ​

Tool Result Cache Operation Timeout Error class with 11 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { ToolResultCacheOperationTimeoutError } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class ToolResultCacheOperationTimeoutError extends Error {
    readonly operation: 'get' | 'set' | 'delete' | 'verify';
    readonly timeoutMs: number;
    readonly code = "TOOL_RESULT_CACHE_TIMEOUT";
    constructor(operation: 'get' | 'set' | 'delete' | 'verify', timeoutMs: number);
}

Public members ​

MemberKindSignatureDescription
causepropertycause?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
codepropertyreadonly code: "TOOL_RESULT_CACHE_TIMEOUT"Public property; its type, readonly modifier and optionality are shown in the signature.
constructorconstructor(operation: "get" | "set" | "delete" | "verify", timeoutMs: number): ToolResultCacheOperationTimeoutErrorCreates an instance of this class.
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operationpropertyreadonly operation: "delete" | "verify" | "get" | "set"Public property; its type, readonly modifier and optionality are shown in the signature.
stackpropertystack?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
static captureStackTracemethodstatic captureStackTrace(targetObject: object, constructorOpt?: Function): voidCreates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called. js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance: js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a();
static prepareStackTracemethodstatic prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): anyPublic method; parameters and return type are shown in the signature.
static stackTraceLimitpropertystatic stackTraceLimit: numberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.
timeoutMspropertyreadonly timeoutMs: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolResultCacheValidationError ​

Tool Result Cache Validation Error class with 9 public constructor or member entries; its exact declarations are listed below.

  • Kind: class
  • Import: import { ToolResultCacheValidationError } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare class ToolResultCacheValidationError extends Error {
    readonly code = "TOOL_RESULT_CACHE_CORRUPT";
    constructor(message: string);
}

Public members ​

MemberKindSignatureDescription
causepropertycause?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
codepropertyreadonly code: "TOOL_RESULT_CACHE_CORRUPT"Public property; its type, readonly modifier and optionality are shown in the signature.
constructorconstructor(message: string): ToolResultCacheValidationErrorCreates an instance of this class.
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
stackpropertystack?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
static captureStackTracemethodstatic captureStackTrace(targetObject: object, constructorOpt?: Function): voidCreates a .stack property on targetObject, which when accessed returns a string representing the location in the code at which Error.captureStackTrace() was called. js const myObject = {}; Error.captureStackTrace(myObject); myObject.stack; // Similar to `new Error().stack` The first line of the trace will be prefixed with ${myObject.name}: ${myObject.message}. The optional constructorOpt argument accepts a function. If given, all frames above constructorOpt, including constructorOpt, will be omitted from the generated stack trace. The constructorOpt argument is useful for hiding implementation details of error generation from the user. For instance: js function a() { b(); } function b() { c(); } function c() { // Create an error without stack trace to avoid calculating the stack trace twice. const { stackTraceLimit } = Error; Error.stackTraceLimit = 0; const error = new Error(); Error.stackTraceLimit = stackTraceLimit; // Capture the stack trace above function b Error.captureStackTrace(error, b); // Neither function c, nor b is included in the stack trace throw error; } a();
static prepareStackTracemethodstatic prepareStackTrace(err: Error, stackTraces: NodeJS.CallSite[]): anyPublic method; parameters and return type are shown in the signature.
static stackTraceLimitpropertystatic stackTraceLimit: numberThe Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.captureStackTrace(obj)). The default value is 10 but may be set to any valid JavaScript number. Changes will affect any stack trace captured after the value has been changed. If set to a non-number value, or set to a negative number, stack traces will not capture any frames.

TOOL_INVOCATION_STATUSES ​

TOOL INVOCATION STATUSES constant exported by the index module.

  • Kind: constant
  • Import: import { TOOL_INVOCATION_STATUSES } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const TOOL_INVOCATION_STATUSES: readonly ["created", "validating", "validated", "policy_checked", "waiting_approval", "approved", "rejected", "queued", "running", "cancelling", "completed", "failed", "timed_out", "expired", "conflict", "denied", "cancelled"];

toolCacheValidityRecordSchema ​

Runtime schema for Tool Cache Validity Record.

  • Kind: constant
  • Import: import { toolCacheValidityRecordSchema } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolCacheValidityRecordSchema: z.ZodObject<{ toolId: z.ZodString; toolRevision: z.ZodString; inputHash: z.ZodString; scopeHash: z.ZodString; policyRevision: z.ZodString; contractSnapshotHash: z.ZodOptional<z.ZodString>; capabilityHash: z.ZodOptional<z.ZodString>; externalStateVersion: z.ZodOptional<z.ZodString>; key: z.ZodString; validUntil: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { toolId: string; toolRevision: string; policyRevision: string; scopeHash: string; inputHash: string; key: string; contractSnapshotHash?: string | undefined; capabilityHash?: string | undefined; externalStateVersion?: string | undefined; validUntil?: string | undefined; }, { toolId: string; toolRevision: string; policyRevision: string; scopeHash: string; inputHash: string; key: string; contractSnapshotHash?: string | undefined; capabilityHash?: string | undefined; externalStateVersion?: string | undefined; validUntil?: string | undefined; }>;

toolProfileSpecDefinition ​

Runtime validation entrypoint for the Tool Profile spec, combining its parser, example and JSON Schema.

  • Kind: constant
  • Import: import { toolProfileSpecDefinition } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolProfileSpecDefinition: SpecSchemaDefinition<ToolProfileSpec>;

toolProfileSpecSchema ​

Runtime schema for Tool Profile Spec.

  • Kind: constant
  • Import: import { toolProfileSpecSchema } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const toolProfileSpecSchema: (typeof import('@codesoul-co/hypha-tools'))['toolProfileSpecSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

toolResultCacheEntryJsonSchema ​

JSON Schema for Tool Result Cache Entry.

  • Kind: constant
  • Import: import { toolResultCacheEntryJsonSchema } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolResultCacheEntryJsonSchema: JsonSchema;

toolResultCacheEntrySchema ​

Runtime schema for Tool Result Cache Entry.

  • Kind: constant
  • Import: import { toolResultCacheEntrySchema } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolResultCacheEntrySchema: z.ZodObject<{ schemaVersion: z.ZodLiteral<"1.0">; keyVersion: z.ZodLiteral<"1">; validity: z.ZodObject<{ toolId: z.ZodString; toolRevision: z.ZodString; inputHash: z.ZodString; scopeHash: z.ZodString; policyRevision: z.ZodString; contractSnapshotHash: z.ZodOptional<z.ZodString>; capabilityHash: z.ZodOptional<z.ZodString>; externalStateVersion: z.ZodOptional<z.ZodString>; key: z.ZodString; validUntil: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { toolId: string; toolRevision: string; policyRevision: string; scopeHash: string; inputHash: string; key: string; contractSnapshotHash?: string | undefined; capabilityHash?: string | undefined; externalStateVersion?: string | undefined; validUntil?: string | undefined; }, { toolId: string; toolRevision: string; policyRevision: string; scopeHash: string; inputHash: string; key: string; contractSnapshotHash?: string | undefined; capabilityHash?: string | undefined; externalStateVersion?: string | undefined; validUntil?: string | undefined; }>; result: z.ZodObject<{ output: z.ZodOptional<z.ZodUnknown>; content: z.ZodOptional<z.ZodArray<z.ZodType<ToolResultContent, z.ZodTypeDef, ToolResultContent>, "many">>; artifactRefs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; }, "strict", z.ZodTypeAny, { output?: unknown; artifactRefs?: string[] | undefined; content?: ToolResultContent[] | undefined; }, { output?: unknown; artifactRefs?: string[] | undefined; content?: ToolResultContent[] | undefined; }>; createdAt: z.ZodString; }, "strict", z.ZodTypeAny, { schemaVersion: "1.0"; result: { output?: unknown; artifactRefs?: string[] | undefined; content?: ToolResultContent[] | undefined; }; createdAt: string; keyVersion: "1"; validity: { toolId: string; toolRevision: string; policyRevision: string; scopeHash: string; inputHash: string; key: string; contractSnapshotHash?: string | undefined; capabilityHash?: string | undefined; externalStateVersion?: string | undefined; validUntil?: string | undefined; }; }, { schemaVersion: "1.0"; result: { output?: unknown; artifactRefs?: string[] | undefined; content?: ToolResultContent[] | undefined; }; createdAt: string; keyVersion: "1"; validity: { toolId: string; toolRevision: string; policyRevision: string; scopeHash: string; inputHash: string; key: string; contractSnapshotHash?: string | undefined; capabilityHash?: string | undefined; externalStateVersion?: string | undefined; validUntil?: string | undefined; }; }>;

toolSpecDefinition ​

Runtime validation entrypoint for the Tool spec, combining its parser, example and JSON Schema.

  • Kind: constant
  • Import: import { toolSpecDefinition } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolSpecDefinition: SpecSchemaDefinition<ToolSpec>;

toolSpecDefinitions ​

Tool Spec Definitions constant exported by the index module.

  • Kind: constant
  • Import: import { toolSpecDefinitions } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolSpecDefinitions: readonly [SpecSchemaDefinition<ToolSpec>, SpecSchemaDefinition<ToolProfileSpec>];

toolSpecExample ​

Valid example value for Tool Spec.

  • Kind: constant
  • Import: import { toolSpecExample } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolSpecExample: ToolSpec;

toolSpecJsonSchema ​

JSON Schema for Tool Spec.

  • Kind: constant
  • Import: import { toolSpecJsonSchema } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare const toolSpecJsonSchema: JsonSchema;

toolSpecJsonSchemas ​

Tool Spec JSON Schemas constant exported by the index module.

  • Kind: constant
  • Import: import { toolSpecJsonSchemas } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

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

toolSpecSchema ​

Runtime schema for Tool Spec.

  • Kind: constant
  • Import: import { toolSpecSchema } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
// Exact type resolved from the package entrypoint; see source for the compiler expansion.
export declare const toolSpecSchema: (typeof import('@codesoul-co/hypha-tools'))['toolSpecSchema'];

This compiler-expanded constant type is compacted. Its public name, top-level type, and source location remain here; use the module’s exported interfaces, types, or runtime schema for input/output fields.

normalizeToolSpec ​

Normalize Tool Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { normalizeToolSpec } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare function normalizeToolSpec(spec: ToolSpec): ResolvedToolSpec;

Call signature ​

text
normalizeToolSpec(spec: ToolSpec): ResolvedToolSpec

Parameters ​

ParameterTypeRequiredDescription
specToolSpecYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: ResolvedToolSpec
  • Description: The return contract is defined by the type shown above.

validateEffectiveCapabilityAccess ​

Validate Effective Capability Access function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateEffectiveCapabilityAccess } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare function validateEffectiveCapabilityAccess(input: {
    snapshot: ToolContractSnapshot | null;
    context: ToolCallContext;
    spec: ToolSpec;
}): string | null;

Call signature ​

text
validateEffectiveCapabilityAccess(input: { snapshot: ToolContractSnapshot | null; context: ToolCallContext; spec: ToolSpec; }): string | null

Parameters ​

ParameterTypeRequiredDescription
input{ snapshot: ToolContractSnapshot | null; context: ToolCallContext; spec: ToolSpec; }YesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: string
  • Description: The return contract is defined by the type shown above.

validateToolInput ​

Validate Tool Input function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateToolInput } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare function validateToolInput(schema: JsonSchema, input: unknown): ToolSchemaValidationResult;

Call signature ​

text
validateToolInput(schema: JsonSchema, input: unknown): ToolSchemaValidationResult

Parameters ​

ParameterTypeRequiredDescription
schemaJsonSchemaYesRequired parameter; accepted values are defined by the type column.
inputunknownYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: ToolSchemaValidationResult
  • Description: The return contract is defined by the type shown above.

validateToolResultCacheEntry ​

Validate Tool Result Cache Entry function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateToolResultCacheEntry } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare function validateToolResultCacheEntry(value: unknown, maxEntryBytes?: number): ToolResultCacheEntry;

Call signature ​

text
validateToolResultCacheEntry(value: unknown, maxEntryBytes?: number): ToolResultCacheEntry

Parameters ​

ParameterTypeRequiredDescription
valueunknownYesRequired parameter; accepted values are defined by the type column.
maxEntryBytesnumberNoOptional parameter; accepted values are defined by the type column.

Returns ​

  • Type: ToolResultCacheEntry
  • Description: The return contract is defined by the type shown above.

validateToolSpec ​

Validate Tool Spec function with 1 public call signature; parameters and return types are listed below.

  • Kind: function
  • Import: import { validateToolSpec } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export declare function validateToolSpec(input: unknown): ToolSpec;

Call signature ​

text
validateToolSpec(input: unknown): ToolSpec

Parameters ​

ParameterTypeRequiredDescription
inputunknownYesRequired parameter; accepted values are defined by the type column.

Returns ​

  • Type: ToolSpec
  • Description: The return contract is defined by the type shown above.

AdapterCancellationRequest ​

Adapter Cancellation Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { AdapterCancellationRequest } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface AdapterCancellationRequest {
    toolId: string;
    invocationId: string;
    reason?: string;
}

Contract members ​

MemberKindSignatureDescription
invocationIdpropertyinvocationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

AdapterExecutionRequest ​

Adapter Execution Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { AdapterExecutionRequest } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface AdapterExecutionRequest<TInput = unknown> {
    toolId: string;
    input: TInput;
    context: ToolCallContext;
}

Contract members ​

MemberKindSignatureDescription
contextpropertycontext: ToolCallContextPublic property; its type, readonly modifier and optionality are shown in the signature.
inputpropertyinput: TInputPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

HttpToolAdapterOptions ​

Http Tool Adapter Options interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { HttpToolAdapterOptions } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface HttpToolAdapterOptions {
    endpoint: string;
    headers?: Record<string, string>;
    resolveHeaders?: () => Promise<Record<string, string>>;
    fetch?: typeof fetch;
}

Contract members ​

MemberKindSignatureDescription
endpointpropertyendpoint: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
fetchmethodfetch?(input: RequestInfo | URL, init?: RequestInit): Promise<Response> | fetch?(input: string | URL | Request, init?: RequestInit): Promise<Response>Public method; parameters and return type are shown in the signature.
headerspropertyheaders?: Record<string, string>Public property; its type, readonly modifier and optionality are shown in the signature.
resolveHeadersmethodresolveHeaders?(): Promise<Record<string, string>>Public method; parameters and return type are shown in the signature.

InMemoryToolResultCacheOptions ​

In Memory Tool Result Cache Options interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { InMemoryToolResultCacheOptions } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface InMemoryToolResultCacheOptions {
    maxEntries?: number;
    maxEntryBytes?: number;
}

Contract members ​

MemberKindSignatureDescription
maxEntriespropertymaxEntries?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxEntryBytespropertymaxEntryBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

MCPToolInvocationPort ​

MCP Tool Invocation Port interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { MCPToolInvocationPort } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface MCPToolInvocationPort {
    invoke(request: {
        serverId: string;
        capabilityId: string;
        input: unknown;
        context: ToolCallContext;
    }): Promise<unknown>;
    health(serverId: string): Promise<ProviderHealth>;
    cancel?(requestId: string): Promise<void>;
}

Contract members ​

MemberKindSignatureDescription
cancelmethodcancel?(requestId: string): Promise<void>Public method; parameters and return type are shown in the signature.
healthmethodhealth(serverId: string): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
invokemethodinvoke(request: { serverId: string; capabilityId: string; input: unknown; context: ToolCallContext; }): Promise<unknown>Public method; parameters and return type are shown in the signature.

RedisLikeToolResultCacheClient ​

Redis Like Tool Result Cache Client interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { RedisLikeToolResultCacheClient } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface RedisLikeToolResultCacheClient {
    get(key: string): Promise<string | null>;
    set(key: string, value: string, mode?: 'PX', durationMilliseconds?: number): Promise<unknown>;
    del(...keys: string[]): Promise<number>;
}

Contract members ​

MemberKindSignatureDescription
delmethoddel(...keys: string[]): Promise<number>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<string | null>Public method; parameters and return type are shown in the signature.
setmethodset(key: string, value: string, mode?: "PX", durationMilliseconds?: number): Promise<unknown>Public method; parameters and return type are shown in the signature.

RedisToolResultCacheOptions ​

Redis Tool Result Cache Options interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { RedisToolResultCacheOptions } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface RedisToolResultCacheOptions {
    client: RedisLikeToolResultCacheClient;
    namespace?: string;
    maxEntryBytes?: number;
    defaultTtlMs?: number;
    now?: () => string;
}

Contract members ​

MemberKindSignatureDescription
clientpropertyclient: RedisLikeToolResultCacheClientPublic property; its type, readonly modifier and optionality are shown in the signature.
defaultTtlMspropertydefaultTtlMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
maxEntryBytespropertymaxEntryBytes?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
namespacepropertynamespace?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
nowmethodnow?(): stringPublic method; parameters and return type are shown in the signature.

ToolAdapter ​

Tool Adapter interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { ToolAdapter } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolAdapter<TInput = unknown, TOutput = unknown> {
    readonly id: string;
    readonly source: ToolSource;
    capabilities(): Promise<ToolAdapterCapabilities>;
    execute(request: AdapterExecutionRequest<TInput>): Promise<ToolExecutionEnvelope<TOutput>>;
    cancel?(request: AdapterCancellationRequest): Promise<void>;
    health(): Promise<ProviderHealth>;
    close?(): Promise<void>;
}

Contract members ​

MemberKindSignatureDescription
cancelmethodcancel?(request: AdapterCancellationRequest): Promise<void>Public method; parameters and return type are shown in the signature.
capabilitiesmethodcapabilities(): Promise<ToolAdapterCapabilities>Public method; parameters and return type are shown in the signature.
closemethodclose?(): Promise<void>Public method; parameters and return type are shown in the signature.
executemethodexecute(request: AdapterExecutionRequest<TInput>): Promise<ToolExecutionEnvelope<TOutput>>Public method; parameters and return type are shown in the signature.
healthmethodhealth(): Promise<ProviderHealth>Public method; parameters and return type are shown in the signature.
idpropertyreadonly id: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertyreadonly source: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.

ToolAdapterCapabilities ​

Tool Adapter Capabilities interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ToolAdapterCapabilities } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolAdapterCapabilities {
    execute: boolean;
    cancel: boolean;
    health: boolean;
    close: boolean;
    streaming?: boolean;
}

Contract members ​

MemberKindSignatureDescription
cancelpropertycancel: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
closepropertyclose: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
executepropertyexecute: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
healthpropertyhealth: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
streamingpropertystreaming?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolApprovalGrant ​

Tool Approval Grant interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { ToolApprovalGrant } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolApprovalGrant {
    requestId: string;
    invocationId: string;
    toolId: string;
    inputHash: string;
    toolRevision?: string;
    contractSnapshotRef?: string;
    principalId?: string;
    policyDecisionRef?: string;
    approvedBy: string;
    approvedAt: string;
    expiresAt?: string;
}

Contract members ​

MemberKindSignatureDescription
approvedAtpropertyapprovedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
approvedBypropertyapprovedBy: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contractSnapshotRefpropertycontractSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
inputHashpropertyinputHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
invocationIdpropertyinvocationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policyDecisionRefpropertypolicyDecisionRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestIdpropertyrequestId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolRevisionpropertytoolRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolApprovalRequest ​

Tool Approval Request interface with 15 public fields or methods.

  • Kind: interface
  • Import: import type { ToolApprovalRequest } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolApprovalRequest {
    id: string;
    invocationId: string;
    toolId: string;
    toolRevision?: string;
    contractSnapshotRef?: string;
    principalId?: string;
    policyDecisionRef?: string;
    inputHash: string;
    runId: string;
    stepId: string;
    userId?: string;
    reason?: string;
    requestedAt: string;
    expiresAt?: string;
    status: 'pending' | 'approved' | 'rejected' | 'expired' | 'cancelled';
}

Contract members ​

MemberKindSignatureDescription
contractSnapshotRefpropertycontractSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
expiresAtpropertyexpiresAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
inputHashpropertyinputHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
invocationIdpropertyinvocationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policyDecisionRefpropertypolicyDecisionRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestedAtpropertyrequestedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "rejected" | "cancelled" | "expired" | "pending" | "approved"Public property; its type, readonly modifier and optionality are shown in the signature.
stepIdpropertystepId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolRevisionpropertytoolRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolApprovalStore ​

Tool Approval Store interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ToolApprovalStore } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolApprovalStore {
    getRequest(invocationId: string): Promise<ToolApprovalRequest | null>;
    requestApproval(request: ToolApprovalRequest): Promise<ToolApprovalRequest>;
    getGrant(invocationId: string): Promise<ToolApprovalGrant | null>;
    approve(invocationId: string, approvedBy: string, options?: {
        approvedAt?: string;
        expiresAt?: string;
    }): Promise<ToolApprovalGrant>;
    reject(invocationId: string): Promise<ToolApprovalRequest>;
}

Contract members ​

MemberKindSignatureDescription
approvemethodapprove(invocationId: string, approvedBy: string, options?: { approvedAt?: string; expiresAt?: string; }): Promise<ToolApprovalGrant>Public method; parameters and return type are shown in the signature.
getGrantmethodgetGrant(invocationId: string): Promise<ToolApprovalGrant | null>Public method; parameters and return type are shown in the signature.
getRequestmethodgetRequest(invocationId: string): Promise<ToolApprovalRequest | null>Public method; parameters and return type are shown in the signature.
rejectmethodreject(invocationId: string): Promise<ToolApprovalRequest>Public method; parameters and return type are shown in the signature.
requestApprovalmethodrequestApproval(request: ToolApprovalRequest): Promise<ToolApprovalRequest>Public method; parameters and return type are shown in the signature.

ToolArtifactPort ​

Tool Artifact Port interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ToolArtifactPort } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolArtifactPort {
    store(request: {
        invocationId: string;
        toolId: string;
        value: unknown;
        mimeType?: string;
        metadata?: Record<string, unknown>;
    }): Promise<string>;
}

Contract members ​

MemberKindSignatureDescription
storemethodstore(request: { invocationId: string; toolId: string; value: unknown; mimeType?: string; metadata?: Record<string, unknown>; }): Promise<string>Public method; parameters and return type are shown in the signature.

ToolAuthorizationDecision ​

Tool Authorization Decision interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolAuthorizationDecision } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolAuthorizationDecision {
    allowed: boolean;
    reason?: string;
    missingPermissionScopes?: string[];
}

Contract members ​

MemberKindSignatureDescription
allowedpropertyallowed: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
missingPermissionScopespropertymissingPermissionScopes?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolAuthorizationInput ​

Tool Authorization Input interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ToolAuthorizationInput } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolAuthorizationInput {
    tool: ToolSpec;
    request: ToolCallRequest;
    principal?: ToolPrincipal;
    executionScope?: ToolExecutionScope;
}

Contract members ​

MemberKindSignatureDescription
executionScopepropertyexecutionScope?: ToolExecutionScopePublic property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyprincipal?: ToolPrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
requestpropertyrequest: ToolCallRequest<unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
toolpropertytool: ToolSpecPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolAuthorizer ​

Tool Authorizer interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ToolAuthorizer } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolAuthorizer {
    authorize(input: ToolAuthorizationInput): Promise<ToolAuthorizationDecision>;
}

Contract members ​

MemberKindSignatureDescription
authorizemethodauthorize(input: ToolAuthorizationInput): Promise<ToolAuthorizationDecision>Public method; parameters and return type are shown in the signature.

ToolCachedResultProjection ​

Only stable, replay-safe output fields may cross invocation boundaries.

  • Kind: interface
  • Import: import type { ToolCachedResultProjection } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolCachedResultProjection {
    output?: unknown;
    content?: ToolResultContent[];
    artifactRefs?: string[];
}

Contract members ​

MemberKindSignatureDescription
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
contentpropertycontent?: ToolResultContent[]Public property; its type, readonly modifier and optionality are shown in the signature.
outputpropertyoutput?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolCallContext ​

Tool Call Context interface with 24 public fields or methods.

  • Kind: interface
  • Import: import type { ToolCallContext } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolCallContext {
    runId: string;
    stepId: string;
    invocationId?: string;
    userId?: string;
    tenantId?: string;
    workspaceId?: string;
    sessionId?: string;
    agentId?: string;
    fsmState?: string;
    idempotencyKey?: string;
    operationId?: string;
    correlationId?: string;
    causationId?: string;
    parentEventId?: string;
    contractSnapshotRef?: string;
    capabilitySnapshotRef?: string;
    capabilityApprovals?: EffectiveCapabilityApproval[];
    deadlineAt?: string;
    signal?: AbortSignal;
    abortSignal?: AbortSignal;
    reportProgress?: (update: ToolProgressUpdate) => void | Promise<void>;
    executionScope?: ToolExecutionScope;
    principal?: ToolPrincipal;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
abortSignalpropertyabortSignal?: AbortSignalPublic property; its type, readonly modifier and optionality are shown in the signature.
agentIdpropertyagentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
capabilityApprovalspropertycapabilityApprovals?: EffectiveCapabilityApproval[]Public property; its type, readonly modifier and optionality are shown in the signature.
capabilitySnapshotRefpropertycapabilitySnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
causationIdpropertycausationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contractSnapshotRefpropertycontractSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
correlationIdpropertycorrelationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deadlineAtpropertydeadlineAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
executionScopepropertyexecutionScope?: ToolExecutionScopePublic property; its type, readonly modifier and optionality are shown in the signature.
fsmStatepropertyfsmState?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idempotencyKeypropertyidempotencyKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
invocationIdpropertyinvocationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
parentEventIdpropertyparentEventId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyprincipal?: ToolPrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
reportProgressmethodreportProgress?(update: ToolProgressUpdate): void | Promise<void>Public method; parameters and return type are shown in the signature.
runIdpropertyrunId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sessionIdpropertysessionId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
signalpropertysignal?: AbortSignalPublic property; its type, readonly modifier and optionality are shown in the signature.
stepIdpropertystepId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceIdpropertyworkspaceId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolCallError ​

Tool Call Error interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ToolCallError } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolCallError {
    code: string;
    message: string;
    phase: ToolExecutionPhase;
    retryable?: boolean;
    details?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
codepropertycode: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
detailspropertydetails?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
phasepropertyphase: ToolExecutionPhasePublic property; its type, readonly modifier and optionality are shown in the signature.
retryablepropertyretryable?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolCallRequest ​

Tool Call Request interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolCallRequest } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolCallRequest<TInput = unknown> {
    toolId: string;
    input: TInput;
    context: ToolCallContext;
}

Contract members ​

MemberKindSignatureDescription
contextpropertycontext: ToolCallContextPublic property; its type, readonly modifier and optionality are shown in the signature.
inputpropertyinput: TInputPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolCallResult ​

Tool Call Result interface with 12 public fields or methods.

  • Kind: interface
  • Import: import type { ToolCallResult } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolCallResult<TOutput = unknown> {
    toolId: string;
    invocationId?: string;
    output?: TOutput;
    error?: ToolCallError | string;
    approvalRequest?: ToolApprovalRequest;
    attempts?: number;
    durationMs?: number;
    content?: ToolResultContent[];
    artifactRefs?: string[];
    observationRefs?: string[];
    externalReceipt?: ToolExternalReceipt;
    status: 'completed' | 'failed' | 'denied' | 'human_review_required' | 'cancelled' | 'conflict';
}

Contract members ​

MemberKindSignatureDescription
approvalRequestpropertyapprovalRequest?: ToolApprovalRequestPublic property; its type, readonly modifier and optionality are shown in the signature.
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
attemptspropertyattempts?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
contentpropertycontent?: ToolResultContent[]Public property; its type, readonly modifier and optionality are shown in the signature.
durationMspropertydurationMs?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: string | ToolCallErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
externalReceiptpropertyexternalReceipt?: ToolExternalReceiptPublic property; its type, readonly modifier and optionality are shown in the signature.
invocationIdpropertyinvocationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observationRefspropertyobservationRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
outputpropertyoutput?: TOutputPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "completed" | "cancelled" | "failed" | "denied" | "conflict" | "human_review_required"Public property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolExecutionEnvelope ​

Tool Execution Envelope interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { ToolExecutionEnvelope } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolExecutionEnvelope<TOutput = unknown> {
    kind: 'tool_execution_envelope';
    output?: TOutput;
    content?: ToolResultContent[];
    artifactRefs?: string[];
    observationRefs?: string[];
    externalReceipt?: ToolExternalReceipt;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
contentpropertycontent?: ToolResultContent[]Public property; its type, readonly modifier and optionality are shown in the signature.
externalReceiptpropertyexternalReceipt?: ToolExternalReceiptPublic property; its type, readonly modifier and optionality are shown in the signature.
kindpropertykind: "tool_execution_envelope"Public property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
observationRefspropertyobservationRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
outputpropertyoutput?: TOutputPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolExecutionScope ​

Tool Execution Scope interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolExecutionScope } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolExecutionScope {
    allowedToolIds?: readonly string[];
    policyRefs?: readonly string[];
    fsmState?: string;
}

Contract members ​

MemberKindSignatureDescription
allowedToolIdspropertyallowedToolIds?: readonly string[]Public property; its type, readonly modifier and optionality are shown in the signature.
fsmStatepropertyfsmState?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
policyRefspropertypolicyRefs?: readonly string[]Public property; its type, readonly modifier and optionality are shown in the signature.

ToolIdempotencyLookup ​

Tool Idempotency Lookup interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolIdempotencyLookup } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolIdempotencyLookup {
    toolId: string;
    idempotencyKey: string;
    scopeHash: string;
}

Contract members ​

MemberKindSignatureDescription
idempotencyKeypropertyidempotencyKey: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
scopeHashpropertyscopeHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolInvocationListRequest ​

Tool Invocation List Request interface with 4 public fields or methods.

  • Kind: interface
  • Import: import type { ToolInvocationListRequest } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolInvocationListRequest {
    statuses?: readonly ToolInvocationStatus[];
    toolId?: string;
    runId?: string;
    limit?: number;
}

Contract members ​

MemberKindSignatureDescription
limitpropertylimit?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
runIdpropertyrunId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statusespropertystatuses?: readonly ("completed" | "rejected" | "queued" | "running" | "cancelling" | "cancelled" | "failed" | "timed_out" | "created" | "denied" | "expired" | "approved" | "conflict" | "policy_checked" | "waiting_approval" | "validating" | "validated")[]Public property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolInvocationRecord ​

Tool Invocation Record interface with 37 public fields or methods.

  • Kind: interface
  • Import: import type { ToolInvocationRecord } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolInvocationRecord {
    id: string;
    operationId?: string;
    toolId: string;
    toolVersion?: string;
    toolRevision?: string;
    contractSnapshotRef?: string;
    principal?: ToolPrincipal;
    scope?: {
        tenantId?: string;
        userId?: string;
        workspaceId?: string;
        sessionId?: string;
        runId: string;
        stepId?: string;
        agentId?: string;
        fsmState?: string;
    };
    status: ToolInvocationStatus;
    inputHash: string;
    redactedInput?: unknown;
    sideEffectLevel?: SideEffectLevel;
    idempotencyKey?: string;
    idempotencyFingerprint?: string;
    reusedFromInvocationId?: string;
    request: ToolCallRequest;
    executionCycle: number;
    attemptCount: number;
    revision: number;
    result?: ToolCallResult;
    approvalRequest?: ToolApprovalRequest;
    approvalRequestId?: string;
    maxAttempts?: number;
    queuedAt?: string;
    deadlineAt?: string;
    outputHash?: string;
    artifactRefs?: string[];
    observationRefs?: string[];
    externalReceipt?: {
        provider?: string;
        receiptId: string;
        status?: string;
        metadata?: Record<string, unknown>;
    };
    lateResultState?: 'none' | 'pending' | 'accepted' | 'discarded' | 'quarantined';
    correlationId?: string;
    causationId?: string;
    metadata?: Record<string, unknown>;
    createdAt: string;
    updatedAt: string;
    startedAt?: string;
    completedAt?: string;
}

Contract members ​

MemberKindSignatureDescription
approvalRequestpropertyapprovalRequest?: ToolApprovalRequestPublic property; its type, readonly modifier and optionality are shown in the signature.
approvalRequestIdpropertyapprovalRequestId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
attemptCountpropertyattemptCount: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
causationIdpropertycausationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
completedAtpropertycompletedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
contractSnapshotRefpropertycontractSnapshotRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
correlationIdpropertycorrelationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
deadlineAtpropertydeadlineAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
executionCyclepropertyexecutionCycle: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
externalReceiptpropertyexternalReceipt?: { provider?: string; receiptId: string; status?: string; metadata?: Record<string, unknown>; }Public property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idempotencyFingerprintpropertyidempotencyFingerprint?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idempotencyKeypropertyidempotencyKey?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
inputHashpropertyinputHash: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lateResultStatepropertylateResultState?: "none" | "accepted" | "quarantined" | "pending" | "discarded"Public property; its type, readonly modifier and optionality are shown in the signature.
maxAttemptspropertymaxAttempts?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
observationRefspropertyobservationRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
operationIdpropertyoperationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
outputHashpropertyoutputHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
principalpropertyprincipal?: ToolPrincipalPublic property; its type, readonly modifier and optionality are shown in the signature.
queuedAtpropertyqueuedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
redactedInputpropertyredactedInput?: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
requestpropertyrequest: ToolCallRequest<unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
resultpropertyresult?: ToolCallResult<unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
reusedFromInvocationIdpropertyreusedFromInvocationId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
scopepropertyscope?: { tenantId?: string; userId?: string; workspaceId?: string; sessionId?: string; runId: string; stepId?: string; agentId?: string; fsmState?: string; }Public property; its type, readonly modifier and optionality are shown in the signature.
sideEffectLevelpropertysideEffectLevel?: SideEffectLevelPublic property; its type, readonly modifier and optionality are shown in the signature.
startedAtpropertystartedAt?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus: "completed" | "rejected" | "queued" | "running" | "cancelling" | "cancelled" | "failed" | "timed_out" | "created" | "denied" | "expired" | "approved" | "conflict" | "policy_checked" | "waiting_approval" | "validating" | "validated"Public property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolRevisionpropertytoolRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
toolVersionpropertytoolVersion?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
updatedAtpropertyupdatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolInvocationStore ​

Tool Invocation Store interface with 7 public fields or methods.

  • Kind: interface
  • Import: import type { ToolInvocationStore } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolInvocationStore {
    get(invocationId: string): Promise<ToolInvocationRecord | null>;
    findByIdempotency(request: ToolIdempotencyLookup): Promise<ToolInvocationRecord | null>;
    list(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>;
    create(record: ToolInvocationRecord): Promise<ToolInvocationRecord>;
    update(invocationId: string, patch: ToolInvocationPatch, options?: {
        expectedStatuses?: readonly ToolInvocationStatus[];
        expectedRevision?: number;
    }): Promise<ToolInvocationRecord>;
    getCompleted(invocationId: string): Promise<ToolCallResult | null>;
    saveCompleted(invocationId: string, result: ToolCallResult): Promise<void>;
}

Contract members ​

MemberKindSignatureDescription
createmethodcreate(record: ToolInvocationRecord): Promise<ToolInvocationRecord>Public method; parameters and return type are shown in the signature.
findByIdempotencymethodfindByIdempotency(request: ToolIdempotencyLookup): Promise<ToolInvocationRecord | null>Public method; parameters and return type are shown in the signature.
getmethodget(invocationId: string): Promise<ToolInvocationRecord | null>Public method; parameters and return type are shown in the signature.
getCompletedmethodgetCompleted(invocationId: string): Promise<ToolCallResult | null>Public method; parameters and return type are shown in the signature.
listmethodlist(request?: ToolInvocationListRequest): Promise<ToolInvocationRecord[]>Public method; parameters and return type are shown in the signature.
saveCompletedmethodsaveCompleted(invocationId: string, result: ToolCallResult): Promise<void>Public method; parameters and return type are shown in the signature.
updatemethodupdate(invocationId: string, patch: ToolInvocationPatch, options?: { expectedStatuses?: readonly ToolInvocationStatus[]; expectedRevision?: number; }): Promise<ToolInvocationRecord>Public method; parameters and return type are shown in the signature.

ToolMiddleware ​

Tool Middleware interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ToolMiddleware } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolMiddleware {
    id: string;
    beforeAuthorization?(context: ToolMiddlewareContext): Promise<void> | void;
    beforeExecution?(context: ToolMiddlewareContext): Promise<void> | void;
    afterExecution?(context: ToolMiddlewareContext, result: ToolExecutionEnvelope): Promise<ToolExecutionEnvelope | void> | ToolExecutionEnvelope | void;
    onError?(context: ToolMiddlewareContext, error: unknown): Promise<void> | void;
}

Contract members ​

MemberKindSignatureDescription
afterExecutionmethodafterExecution?(context: ToolMiddlewareContext, result: ToolExecutionEnvelope): Promise<ToolExecutionEnvelope | void> | ToolExecutionEnvelope | voidPublic method; parameters and return type are shown in the signature.
beforeAuthorizationmethodbeforeAuthorization?(context: ToolMiddlewareContext): Promise<void> | voidPublic method; parameters and return type are shown in the signature.
beforeExecutionmethodbeforeExecution?(context: ToolMiddlewareContext): Promise<void> | voidPublic method; parameters and return type are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
onErrormethodonError?(context: ToolMiddlewareContext, error: unknown): Promise<void> | voidPublic method; parameters and return type are shown in the signature.

ToolMiddlewareContext ​

Tool Middleware Context interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ToolMiddlewareContext } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolMiddlewareContext {
    invocationId: string;
    request: ToolCallRequest;
    originalRequest: ToolCallRequest;
    spec: ResolvedToolSpec;
    attempt?: number;
}

Contract members ​

MemberKindSignatureDescription
attemptpropertyattempt?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
invocationIdpropertyinvocationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
originalRequestpropertyoriginalRequest: ToolCallRequest<unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
requestpropertyrequest: ToolCallRequest<unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
specpropertyspec: ResolvedToolSpecPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolObservationPort ​

Tool Observation Port interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ToolObservationPort } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolObservationPort {
    record(request: {
        invocationId: string;
        toolId: string;
        toolRevision: string;
        runId: string;
        stepId: string;
        inputHash: string;
        outputHash: string;
        value: unknown;
        artifactRefs?: string[];
        provenance: Record<string, unknown>;
    }): Promise<string>;
}

Contract members ​

MemberKindSignatureDescription
recordmethodrecord(request: { invocationId: string; toolId: string; toolRevision: string; runId: string; stepId: string; inputHash: string; outputHash: string; value: unknown; artifactRefs?: string[]; provenance: Record<string, unknown>; }): Promise<string>Public method; parameters and return type are shown in the signature.

ToolPrincipal ​

Tool Principal interface with 13 public fields or methods.

  • Kind: interface
  • Import: import type { ToolPrincipal } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

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

Contract members ​

MemberKindSignatureDescription
agentIdpropertyagentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
authenticationContextpropertyauthenticationContext?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
delegatedBypropertydelegatedBy?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
delegationDepthpropertydelegationDepth?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
permissionScopespropertypermissionScopes: readonly string[]Public property; its type, readonly modifier and optionality are shown in the signature.
principalIdpropertyprincipalId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
rolespropertyroles?: readonly string[]Public property; its type, readonly modifier and optionality are shown in the signature.
tenantIdpropertytenantId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
typepropertytype: "system" | "agent" | "user" | "service"Public property; its type, readonly modifier and optionality are shown in the signature.
userIdpropertyuserId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
workspaceIdpropertyworkspaceId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolProfileSpec ​

Tool Profile Spec interface with 11 public fields or methods.

  • Kind: interface
  • Import: import type { ToolProfileSpec } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolProfileSpec extends VersionedSpec {
    toolRefs: SpecRef[];
    mcpProfileRefs?: SpecRef[];
    policyRefs?: SpecRef[];
    defaultPermissionScopes?: string[];
    contractSnapshotMode?: 'run' | 'state';
    lazyLoad?: boolean;
    maxLoadedTools?: number;
    metadata?: Record<string, unknown>;
    /** @deprecated Register Tool contracts separately and use toolRefs. */
    tools?: ToolSpec[];
}

Contract members ​

MemberKindSignatureDescription
contractSnapshotModepropertycontractSnapshotMode?: "run" | "state"Public property; its type, readonly modifier and optionality are shown in the signature.
defaultPermissionScopespropertydefaultPermissionScopes?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
lazyLoadpropertylazyLoad?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
maxLoadedToolspropertymaxLoadedTools?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
mcpProfileRefspropertymcpProfileRefs?: SpecRef[]Public property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
policyRefspropertypolicyRefs?: SpecRef[]Public property; its type, readonly modifier and optionality are shown in the signature.
toolRefspropertytoolRefs: SpecRef[]Public property; its type, readonly modifier and optionality are shown in the signature.
toolspropertytools?: ToolSpec[]Public property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolProgressUpdate ​

Tool Progress Update interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { ToolProgressUpdate } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolProgressUpdate {
    message?: string;
    current?: number;
    total?: number;
    percentage?: number;
    stage?: string;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
currentpropertycurrent?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
messagepropertymessage?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
percentagepropertypercentage?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.
stagepropertystage?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
totalpropertytotal?: numberPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolReceiptReconciler ​

Tool Receipt Reconciler interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ToolReceiptReconciler } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolReceiptReconciler {
    reconcile(request: {
        invocationId: string;
        tool: ResolvedToolSpec;
        call: ToolCallRequest;
        attempt: number;
    }): Promise<ToolReceiptReconciliation>;
}

Contract members ​

MemberKindSignatureDescription
reconcilemethodreconcile(request: { invocationId: string; tool: ResolvedToolSpec; call: ToolCallRequest; attempt: number; }): Promise<ToolReceiptReconciliation>Public method; parameters and return type are shown in the signature.

ToolReceiptReconciliation ​

Tool Receipt Reconciliation interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolReceiptReconciliation } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolReceiptReconciliation {
    state: 'committed' | 'not_committed' | 'unknown';
    receipt?: ToolExternalReceipt;
    details?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
detailspropertydetails?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
receiptpropertyreceipt?: ToolExternalReceiptPublic property; its type, readonly modifier and optionality are shown in the signature.
statepropertystate: "unknown" | "committed" | "not_committed"Public property; its type, readonly modifier and optionality are shown in the signature.

ToolResultCache ​

Tool Result Cache interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolResultCache } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolResultCache {
    get(key: string): Promise<ToolResultCacheEntry | null>;
    set(entry: ToolResultCacheEntry): Promise<void>;
    delete?(key: string): Promise<void>;
}

Contract members ​

MemberKindSignatureDescription
deletemethoddelete?(key: string): Promise<void>Public method; parameters and return type are shown in the signature.
getmethodget(key: string): Promise<ToolResultCacheEntry | null>Public method; parameters and return type are shown in the signature.
setmethodset(entry: ToolResultCacheEntry): Promise<void>Public method; parameters and return type are shown in the signature.

ToolResultCacheArtifactVerifier ​

Tool Result Cache Artifact Verifier interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ToolResultCacheArtifactVerifier } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolResultCacheArtifactVerifier {
    verify(request: {
        toolId: string;
        artifactRefs: readonly string[];
        tenantId?: string;
        userId?: string;
        workspaceId?: string;
    }): Promise<boolean>;
}

Contract members ​

MemberKindSignatureDescription
verifymethodverify(request: { toolId: string; artifactRefs: readonly string[]; tenantId?: string; userId?: string; workspaceId?: string; }): Promise<boolean>Public method; parameters and return type are shown in the signature.

ToolResultCacheEntry ​

Tool Result Cache Entry interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ToolResultCacheEntry } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolResultCacheEntry {
    schemaVersion: '1.0';
    keyVersion: '1';
    validity: ToolCacheValidityRecord;
    result: ToolCachedResultProjection;
    createdAt: string;
}

Contract members ​

MemberKindSignatureDescription
createdAtpropertycreatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
keyVersionpropertykeyVersion: "1"Public property; its type, readonly modifier and optionality are shown in the signature.
resultpropertyresult: ToolCachedResultProjectionPublic property; its type, readonly modifier and optionality are shown in the signature.
schemaVersionpropertyschemaVersion: "1.0"Public property; its type, readonly modifier and optionality are shown in the signature.
validitypropertyvalidity: ToolCacheValidityRecordPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolRunner ​

Tool Runner interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { ToolRunner } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolRunner {
    run(request: ToolCallRequest): Promise<ToolCallResult>;
    cancelInvocation?(invocationId: string, reason?: string): Promise<ToolCallResult | null>;
}

Contract members ​

MemberKindSignatureDescription
cancelInvocationmethodcancelInvocation?(invocationId: string, reason?: string): Promise<ToolCallResult | null>Public method; parameters and return type are shown in the signature.
runmethodrun(request: ToolCallRequest): Promise<ToolCallResult>Public method; parameters and return type are shown in the signature.

ToolSchemaValidationIssue ​

Tool Schema Validation Issue interface with 2 public fields or methods.

  • Kind: interface
  • Import: import type { ToolSchemaValidationIssue } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolSchemaValidationIssue {
    path: string;
    message: string;
}

Contract members ​

MemberKindSignatureDescription
messagepropertymessage: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
pathpropertypath: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolSchemaValidationResult ​

Tool Schema Validation Result interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolSchemaValidationResult } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolSchemaValidationResult {
    valid: boolean;
    error?: string;
    issues: ToolSchemaValidationIssue[];
}

Contract members ​

MemberKindSignatureDescription
errorpropertyerror?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
issuespropertyissues: ToolSchemaValidationIssue[]Public property; its type, readonly modifier and optionality are shown in the signature.
validpropertyvalid: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolSpec ​

Tool Spec interface with 33 public fields or methods.

  • Kind: interface
  • Import: import type { ToolSpec } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolSpec {
    id: string;
    version: string;
    revision?: string;
    name?: string;
    displayName?: string;
    description: string;
    instructions?: string;
    tags?: string[];
    inputSchema: JsonSchema;
    outputSchema?: JsonSchema;
    input?: ToolSchemaSpec;
    output?: ToolSchemaSpec;
    sideEffectLevel: SideEffectLevel;
    permissionScope?: string[];
    preconditions?: string[];
    postconditions?: string[];
    timeoutPolicy?: TimeoutPolicySpec;
    retryPolicy?: RetryPolicySpec;
    auditPolicy?: AuditPolicySpec;
    humanApprovalPolicy?: HumanReviewPolicySpec;
    idempotencyPolicy?: {
        mode: 'none' | 'optional' | 'required';
    };
    source?: ToolSource;
    sourceRef?: {
        serverId?: string;
        capabilityId?: string;
        capabilityHash?: string;
        trustLevel?: 'trusted' | 'reviewed' | 'untrusted';
        declarationSource?: 'framework' | 'user' | 'server' | 'unknown';
    } & 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>;
}

Contract members ​

MemberKindSignatureDescription
auditPolicypropertyauditPolicy?: AuditPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
cachepropertycache?: ToolCachePolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
deprecatedpropertydeprecated?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
descriptionpropertydescription: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
displayNamepropertydisplayName?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
enabledpropertyenabled?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
executionpropertyexecution?: ToolExecutionPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
governancepropertygovernance?: ToolGovernanceSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
humanApprovalPolicypropertyhumanApprovalPolicy?: HumanReviewPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
idpropertyid: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
idempotencyPolicypropertyidempotencyPolicy?: { mode: "none" | "optional" | "required"; }Public property; its type, readonly modifier and optionality are shown in the signature.
inputpropertyinput?: ToolSchemaSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
inputSchemapropertyinputSchema: JsonSchemaPublic property; its type, readonly modifier and optionality are shown in the signature.
instructionspropertyinstructions?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
namepropertyname?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
observabilitypropertyobservability?: ToolObservabilitySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
outputpropertyoutput?: ToolSchemaSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
outputSchemapropertyoutputSchema?: JsonSchemaPublic property; its type, readonly modifier and optionality are shown in the signature.
permissionScopepropertypermissionScope?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
postconditionspropertypostconditions?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
preconditionspropertypreconditions?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
replacedBypropertyreplacedBy?: { id: string; version?: string; revision?: string; }Public property; its type, readonly modifier and optionality are shown in the signature.
retryPolicypropertyretryPolicy?: RetryPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
revisionpropertyrevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
semanticspropertysemantics?: ToolSemanticSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
sideEffectLevelpropertysideEffectLevel: SideEffectLevelPublic property; its type, readonly modifier and optionality are shown in the signature.
sourcepropertysource?: ToolSourcePublic property; its type, readonly modifier and optionality are shown in the signature.
sourceRefpropertysourceRef?: { serverId?: string; capabilityId?: string; capabilityHash?: string; trustLevel?: "trusted" | "reviewed" | "untrusted"; declarationSource?: "framework" | "user" | "server" | "unknown"; } & ToolSourceRefPublic property; its type, readonly modifier and optionality are shown in the signature.
streamingpropertystreaming?: ToolStreamingSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
tagspropertytags?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
timeoutPolicypropertytimeoutPolicy?: TimeoutPolicySpecPublic property; its type, readonly modifier and optionality are shown in the signature.
versionpropertyversion: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolTargetResolution ​

Tool Target Resolution interface with 3 public fields or methods.

  • Kind: interface
  • Import: import type { ToolTargetResolution } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolTargetResolution {
    toolId: string;
    input: unknown;
    metadata?: Record<string, unknown>;
}

Contract members ​

MemberKindSignatureDescription
inputpropertyinput: unknownPublic property; its type, readonly modifier and optionality are shown in the signature.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
toolIdpropertytoolId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.

ToolTargetResolver ​

Tool Target Resolver interface with 1 public fields or methods.

  • Kind: interface
  • Import: import type { ToolTargetResolver } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export interface ToolTargetResolver {
    resolve(request: ToolCallRequest, registry: ToolRegistry): Promise<ToolTargetResolution>;
}

Contract members ​

MemberKindSignatureDescription
resolvemethodresolve(request: ToolCallRequest, registry: ToolRegistry): Promise<ToolTargetResolution>Public method; parameters and return type are shown in the signature.

MockToolHandler ​

Public type alias for Mock Tool Handler; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { MockToolHandler } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type MockToolHandler = (request: ToolCallRequest) => Promise<ToolCallResult> | ToolCallResult;

ResolvedToolSpec ​

Public type alias for Resolved Tool Spec; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ResolvedToolSpec } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type ResolvedToolSpec = ToolSpec & GovernedToolContractSpec;

ToolExecutionPhase ​

Public type alias for Tool Execution Phase; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ToolExecutionPhase } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type ToolExecutionPhase = 'resolution' | 'authorization' | 'input_validation' | 'policy' | 'approval' | 'execution' | 'timeout' | 'output_validation';

ToolHandler ​

Public type alias for Tool Handler; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ToolHandler } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type ToolHandler<TInput = unknown, TOutput = unknown> = (input: TInput, context: ToolCallContext) => Promise<TOutput>;

ToolInvocationPatch ​

Public type alias for Tool Invocation Patch; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ToolInvocationPatch } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type ToolInvocationPatch = Partial<Pick<ToolInvocationRecord, 'status' | 'executionCycle' | 'attemptCount' | 'result' | 'approvalRequest' | 'updatedAt' | 'startedAt' | 'completedAt' | 'lateResultState' | 'outputHash' | 'artifactRefs' | 'observationRefs' | 'externalReceipt'>>;

ToolInvocationStatus ​

Public type alias for Tool Invocation Status; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ToolInvocationStatus } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type ToolInvocationStatus = (typeof TOOL_INVOCATION_STATUSES)[number];

ToolResultContent ​

Public type alias for Tool Result Content; the declaration contains its complete type expression.

  • Kind: type
  • Import: import type { ToolResultContent } from '@codesoul-co/hypha-tools';
  • Source module: index

Declaration ​

text
export type ToolResultContent = {
    type: 'text';
    text: string;
} | {
    type: 'json';
    value: unknown;
} | {
    type: 'image';
    artifactRef?: string;
    url?: string;
    mimeType?: string;
    alt?: string;
} | {
    type: 'resource';
    uri: string;
    mimeType?: string;
    title?: string;
} | {
    type: 'artifact';
    artifactRef: string;
    title?: string;
    mimeType?: string;
};