Skip to content

@codesoul-co/hypha-core / contracts/runtime-activity-schemas

Using this module

Use the Runtime activity schemas module for declaring and runtime-validating contracts. It exports 13 constants, 4 functions.

Import from the package entrypoint

ts
import {
  runtimeActivityContractDefinitions,
  runtimeActivityContractJsonSchemas,
  runtimeActivityDescriptorDefinition,
  runtimeActivityDescriptorExample,
  runtimeActivityDescriptorJsonSchema,
  runtimeActivityDescriptorSchema,
  runtimeActivityInvocationSchema,
  runtimeActivityObservationJsonSchema,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

  • The module exposes 4 functions as direct operation entrypoints. Every overload, required/optional parameter, and return type is documented below.
  • The 13 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 { runtimeActivityDescriptorSchema } from '@codesoul-co/hypha-core';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = runtimeActivityDescriptorSchema.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
runtimeActivityContractDefinitionsconstantconst runtimeActivityContractDefinitions: readonly [SpecSchemaDefinition<RuntimeActivityRequest<RuntimeJsonValue>>, SpecSchemaDefinition<RuntimeActivityDescriptor>]Runtime Activity Contract Definitions constant exported by the contracts/runtime-activity-schemas module.
runtimeActivityContractJsonSchemasconstantconst runtimeActivityContractJsonSchemas: Record<string, JsonSchema>Runtime Activity Contract JSON Schemas constant exported by the contracts/runtime-activity-schemas module.
runtimeActivityDescriptorDefinitionconstantconst runtimeActivityDescriptorDefinition: SpecSchemaDefinition<RuntimeActivityDescriptor>Runtime Activity Descriptor Definition constant exported by the contracts/runtime-activity-schemas module.
runtimeActivityDescriptorExampleconstantconst runtimeActivityDescriptorExample: RuntimeActivityDescriptorValid example value for Runtime Activity Descriptor.
runtimeActivityDescriptorJsonSchemaconstantconst runtimeActivityDescriptorJsonSchema: JsonSchemaJSON Schema for Runtime Activity Descriptor.
runtimeActivityDescriptorSchemaconstantconst runtimeActivityDescriptorSchema: z.ZodObject<{ version: z.ZodLiteral<"1.0.0">; activityId: z.ZodString; activityKind: z.ZodEnum<["react_quantum", "tool", "memory", "execution", "mcp", "policy"]>; runId: z.ZodString; stateId: z.ZodString; stateAttempt: z.ZodNumber; operationId: z.ZodString; inputRef: z.ZodString; inputHash: z.ZodString; providerRef: z.ZodOptional<z.ZodString>; providerRevision: z.ZodOptional<...Runtime schema for Runtime Activity Descriptor.
runtimeActivityInvocationSchemaconstantconst runtimeActivityInvocationSchema: z.ZodObject<{ activityId: z.ZodString; operationId: z.ZodString; activityType: z.ZodEnum<["tool", "memory", "model", "execution", "custom"]>; target: z.ZodString; input: z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>; scope: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; ru...Runtime schema for Runtime Activity Invocation.
runtimeActivityObservationJsonSchemaconstantconst runtimeActivityObservationJsonSchema: JsonSchemaJSON Schema for Runtime Activity Observation.
runtimeActivityObservationSchemaconstantconst runtimeActivityObservationSchema: z.ZodEffects<z.ZodObject<{ activityId: z.ZodString; status: z.ZodEnum<["completed", "failed", "waiting", "cancelled"]>; eventIds: z.ZodArray<z.ZodString, "many">; output: z.ZodOptional<z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>>; artifactRefs: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; retryable: z.ZodOptional<z.ZodBoolean>; error: z.ZodOptional<z.ZodOb...Runtime schema for Runtime Activity Observation.
runtimeActivityRequestDefinitionconstantconst runtimeActivityRequestDefinition: SpecSchemaDefinition<RuntimeActivityRequest<RuntimeJsonValue>>Runtime Activity Request Definition constant exported by the contracts/runtime-activity-schemas module.
runtimeActivityRequestExampleconstantconst runtimeActivityRequestExample: RuntimeActivityRequest<RuntimeJsonValue>Valid example value for Runtime Activity Request.
runtimeActivityRequestJsonSchemaconstantconst runtimeActivityRequestJsonSchema: JsonSchemaJSON Schema for Runtime Activity Request.
runtimeActivityRequestSchemaconstantconst runtimeActivityRequestSchema: z.ZodObject<{ target: z.ZodString; input: z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>; options: z.ZodOptional<z.ZodObject<{ effect: z.ZodOptional<z.ZodEnum<["pure", "idempotent", "external_effect", "irreversible"]>>; timeoutMs: z.ZodOptional<z.ZodNumber>; retry: z.ZodOptional<z.ZodEffects<z.ZodObject<{ maxAttempts: z.ZodNumber; initialDelayMs: z.ZodOptional<z.Zod...Runtime schema for Runtime Activity Request.
validateRuntimeActivityDescriptorfunctionvalidateRuntimeActivityDescriptor(input: unknown): RuntimeActivityDescriptorValidate Runtime Activity Descriptor function with 1 public call signature; parameters and return types are listed below.
validateRuntimeActivityInvocationfunctionvalidateRuntimeActivityInvocation(input: unknown): RuntimeActivityInvocationValidate Runtime Activity Invocation function with 1 public call signature; parameters and return types are listed below.
validateRuntimeActivityObservationfunctionvalidateRuntimeActivityObservation(input: unknown): RuntimeActivityObservationValidate Runtime Activity Observation function with 1 public call signature; parameters and return types are listed below.
validateRuntimeActivityRequestfunctionvalidateRuntimeActivityRequest(input: unknown): RuntimeActivityRequestValidate Runtime Activity Request function with 1 public call signature; parameters and return types are listed below.

runtimeActivityContractDefinitions

Runtime Activity Contract Definitions constant exported by the contracts/runtime-activity-schemas module.

Declaration

text
export declare const runtimeActivityContractDefinitions: readonly [SpecSchemaDefinition<RuntimeActivityRequest<RuntimeJsonValue>>, SpecSchemaDefinition<RuntimeActivityDescriptor>];

runtimeActivityContractJsonSchemas

Runtime Activity Contract JSON Schemas constant exported by the contracts/runtime-activity-schemas module.

Declaration

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

runtimeActivityDescriptorDefinition

Runtime Activity Descriptor Definition constant exported by the contracts/runtime-activity-schemas module.

Declaration

text
export declare const runtimeActivityDescriptorDefinition: SpecSchemaDefinition<RuntimeActivityDescriptor>;

runtimeActivityDescriptorExample

Valid example value for Runtime Activity Descriptor.

Declaration

text
export declare const runtimeActivityDescriptorExample: RuntimeActivityDescriptor;

runtimeActivityDescriptorJsonSchema

JSON Schema for Runtime Activity Descriptor.

Declaration

text
export declare const runtimeActivityDescriptorJsonSchema: JsonSchema;

runtimeActivityDescriptorSchema

Runtime schema for Runtime Activity Descriptor.

Declaration

text
export declare const runtimeActivityDescriptorSchema: z.ZodObject<{ version: z.ZodLiteral<"1.0.0">; activityId: z.ZodString; activityKind: z.ZodEnum<["react_quantum", "tool", "memory", "execution", "mcp", "policy"]>; runId: z.ZodString; stateId: z.ZodString; stateAttempt: z.ZodNumber; operationId: z.ZodString; inputRef: z.ZodString; inputHash: z.ZodString; providerRef: z.ZodOptional<z.ZodString>; providerRevision: z.ZodOptional<z.ZodString>; idempotencyKey: z.ZodString; deadlineAt: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { operationId: string; version: "1.0.0"; runId: string; idempotencyKey: string; stateAttempt: number; stateId: string; activityId: string; activityKind: "tool" | "memory" | "execution" | "policy" | "mcp" | "react_quantum"; inputRef: string; inputHash: string; providerRevision?: string | undefined; providerRef?: string | undefined; deadlineAt?: string | undefined; }, { operationId: string; version: "1.0.0"; runId: string; idempotencyKey: string; stateAttempt: number; stateId: string; activityId: string; activityKind: "tool" | "memory" | "execution" | "policy" | "mcp" | "react_quantum"; inputRef: string; inputHash: string; providerRevision?: string | undefined; providerRef?: string | undefined; deadlineAt?: string | undefined; }>;

runtimeActivityInvocationSchema

Runtime schema for Runtime Activity Invocation.

Declaration

text
export declare const runtimeActivityInvocationSchema: z.ZodObject<{ activityId: z.ZodString; operationId: z.ZodString; activityType: z.ZodEnum<["tool", "memory", "model", "execution", "custom"]>; target: z.ZodString; input: z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>; scope: z.ZodObject<{ tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodString; workspaceId: z.ZodOptional<z.ZodString>; sessionId: z.ZodString; runId: z.ZodString; agentId: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }, { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }>; stateId: z.ZodString; stateAttempt: z.ZodNumber; fencingToken: z.ZodNumber; correlationId: z.ZodString; causationId: z.ZodOptional<z.ZodString>; idempotencyKey: z.ZodString; requestedAt: z.ZodString; effect: z.ZodEnum<["pure", "idempotent", "external_effect", "irreversible"]>; timeoutMs: z.ZodOptional<z.ZodNumber>; retry: z.ZodOptional<z.ZodEffects<z.ZodObject<{ maxAttempts: z.ZodNumber; initialDelayMs: z.ZodOptional<z.ZodNumber>; maxDelayMs: z.ZodOptional<z.ZodNumber>; }, "strict", z.ZodTypeAny, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }>, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }>>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>>>; }, "strict", z.ZodTypeAny, { operationId: string; effect: "pure" | "idempotent" | "external_effect" | "irreversible"; correlationId: string; idempotencyKey: string; scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; stateAttempt: number; stateId: string; requestedAt: string; fencingToken: number; activityId: string; activityType: "custom" | "tool" | "memory" | "model" | "execution"; input: RuntimeJsonValue; target: string; metadata?: Record<string, RuntimeJsonValue> | undefined; causationId?: string | undefined; timeoutMs?: number | undefined; retry?: { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; } | undefined; }, { operationId: string; effect: "pure" | "idempotent" | "external_effect" | "irreversible"; correlationId: string; idempotencyKey: string; scope: { sessionId: string; runId: string; userId: string; workspaceId?: string | undefined; agentId?: string | undefined; tenantId?: string | undefined; }; stateAttempt: number; stateId: string; requestedAt: string; fencingToken: number; activityId: string; activityType: "custom" | "tool" | "memory" | "model" | "execution"; input: RuntimeJsonValue; target: string; metadata?: Record<string, RuntimeJsonValue> | undefined; causationId?: string | undefined; timeoutMs?: number | undefined; retry?: { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; } | undefined; }>;

runtimeActivityObservationJsonSchema

JSON Schema for Runtime Activity Observation.

Declaration

text
export declare const runtimeActivityObservationJsonSchema: JsonSchema;

runtimeActivityObservationSchema

Runtime schema for Runtime Activity Observation.

Declaration

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

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.

runtimeActivityRequestDefinition

Runtime Activity Request Definition constant exported by the contracts/runtime-activity-schemas module.

Declaration

text
export declare const runtimeActivityRequestDefinition: SpecSchemaDefinition<RuntimeActivityRequest<RuntimeJsonValue>>;

runtimeActivityRequestExample

Valid example value for Runtime Activity Request.

Declaration

text
export declare const runtimeActivityRequestExample: RuntimeActivityRequest<RuntimeJsonValue>;

runtimeActivityRequestJsonSchema

JSON Schema for Runtime Activity Request.

Declaration

text
export declare const runtimeActivityRequestJsonSchema: JsonSchema;

runtimeActivityRequestSchema

Runtime schema for Runtime Activity Request.

Declaration

text
export declare const runtimeActivityRequestSchema: z.ZodObject<{ target: z.ZodString; input: z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>; options: z.ZodOptional<z.ZodObject<{ effect: z.ZodOptional<z.ZodEnum<["pure", "idempotent", "external_effect", "irreversible"]>>; timeoutMs: z.ZodOptional<z.ZodNumber>; retry: z.ZodOptional<z.ZodEffects<z.ZodObject<{ maxAttempts: z.ZodNumber; initialDelayMs: z.ZodOptional<z.ZodNumber>; maxDelayMs: z.ZodOptional<z.ZodNumber>; }, "strict", z.ZodTypeAny, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }>, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }, { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; }>>; idempotencyKey: z.ZodOptional<z.ZodString>; causationId: z.ZodOptional<z.ZodString>; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodType<RuntimeJsonValue, z.ZodTypeDef, RuntimeJsonValue>>>; }, "strict", z.ZodTypeAny, { metadata?: Record<string, RuntimeJsonValue> | undefined; effect?: "pure" | "idempotent" | "external_effect" | "irreversible" | undefined; causationId?: string | undefined; idempotencyKey?: string | undefined; timeoutMs?: number | undefined; retry?: { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; } | undefined; }, { metadata?: Record<string, RuntimeJsonValue> | undefined; effect?: "pure" | "idempotent" | "external_effect" | "irreversible" | undefined; causationId?: string | undefined; idempotencyKey?: string | undefined; timeoutMs?: number | undefined; retry?: { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; } | undefined; }>>; }, "strict", z.ZodTypeAny, { input: RuntimeJsonValue; target: string; options?: { metadata?: Record<string, RuntimeJsonValue> | undefined; effect?: "pure" | "idempotent" | "external_effect" | "irreversible" | undefined; causationId?: string | undefined; idempotencyKey?: string | undefined; timeoutMs?: number | undefined; retry?: { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; } | undefined; } | undefined; }, { input: RuntimeJsonValue; target: string; options?: { metadata?: Record<string, RuntimeJsonValue> | undefined; effect?: "pure" | "idempotent" | "external_effect" | "irreversible" | undefined; causationId?: string | undefined; idempotencyKey?: string | undefined; timeoutMs?: number | undefined; retry?: { maxAttempts: number; initialDelayMs?: number | undefined; maxDelayMs?: number | undefined; } | undefined; } | undefined; }>;

validateRuntimeActivityDescriptor

Validate Runtime Activity Descriptor function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function validateRuntimeActivityDescriptor(input: unknown): RuntimeActivityDescriptor;

Call signature

text
validateRuntimeActivityDescriptor(input: unknown): RuntimeActivityDescriptor

Parameters

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

Returns

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

validateRuntimeActivityInvocation

Validate Runtime Activity Invocation function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function validateRuntimeActivityInvocation(input: unknown): RuntimeActivityInvocation;

Call signature

text
validateRuntimeActivityInvocation(input: unknown): RuntimeActivityInvocation

Parameters

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

Returns

  • Type: RuntimeActivityInvocation<RuntimeJsonValue>
  • Description: The return contract is defined by the type shown above.

validateRuntimeActivityObservation

Validate Runtime Activity Observation function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function validateRuntimeActivityObservation(input: unknown): RuntimeActivityObservation;

Call signature

text
validateRuntimeActivityObservation(input: unknown): RuntimeActivityObservation

Parameters

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

Returns

  • Type: RuntimeActivityObservation<RuntimeJsonValue>
  • Description: The return contract is defined by the type shown above.

validateRuntimeActivityRequest

Validate Runtime Activity Request function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function validateRuntimeActivityRequest(input: unknown): RuntimeActivityRequest;

Call signature

text
validateRuntimeActivityRequest(input: unknown): RuntimeActivityRequest

Parameters

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

Returns

  • Type: RuntimeActivityRequest<RuntimeJsonValue>
  • Description: The return contract is defined by the type shown above.