Skip to content

@codesoul-co/hypha-core / modules/execution-governance/contracts

Using this module

Use the Contracts module for declaring and runtime-validating contracts. It exports 10 constants, 2 functions.

Import from the package entrypoint

ts
import {
  executionGovernanceJsonSchemas,
  executionRiskAssessmentExample,
  executionRiskAssessmentJsonSchema,
  executionRiskAssessmentSchema,
  executionSandboxLevelSchema,
  executionToolBindingExample,
  executionToolBindingJsonSchema,
  executionToolBindingSchema,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

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

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = executionRiskAssessmentSchema.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
executionGovernanceJsonSchemasconstantconst executionGovernanceJsonSchemas: Record<string, JsonSchema>Execution Governance JSON Schemas constant exported by the modules/execution-governance/contracts module.
executionRiskAssessmentExampleconstantconst executionRiskAssessmentExample: ExecutionRiskAssessmentValid example value for Execution Risk Assessment.
executionRiskAssessmentJsonSchemaconstantconst executionRiskAssessmentJsonSchema: JsonSchemaJSON Schema for Execution Risk Assessment.
executionRiskAssessmentSchemaconstantconst executionRiskAssessmentSchema: z.ZodEffects<z.ZodObject<{ id: z.ZodString; level: z.ZodEnum<["low", "medium", "high", "critical"]>; reasons: z.ZodArray<z.ZodString, "many">; matchedRules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; requiresApproval: z.ZodBoolean; recommendedSandboxLevel: z.ZodOptional<z.ZodEnum<["local", "container", "remote_isolated"]>>; evaluatedAt: z.ZodString; }, "strict", z.ZodTypeA...Runtime schema for Execution Risk Assessment.
executionSandboxLevelSchemaconstantconst executionSandboxLevelSchema: z.ZodEnum<["local", "container", "remote_isolated"]>Runtime schema for Execution Sandbox Level.
executionToolBindingExampleconstantconst executionToolBindingExample: ExecutionToolBindingValid example value for Execution Tool Binding.
executionToolBindingJsonSchemaconstantconst executionToolBindingJsonSchema: JsonSchemaJSON Schema for Execution Tool Binding.
executionToolBindingSchemaconstantconst executionToolBindingSchema: z.ZodEffects<z.ZodObject<{ toolId: z.ZodString; operation: z.ZodEnum<["file_read", "file_write", "command", "sandbox", "artifact"]>; executionProfileRef: z.ZodString; requiredScopes: z.ZodArray<z.ZodString, "many">; sideEffectLevel: z.ZodEnum<["read", "write", "external_effect", "irreversible"]>; humanReviewPolicyRef: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { operat...Runtime schema for Execution Tool Binding.
executionToolOperationSchemaconstantconst executionToolOperationSchema: z.ZodEnum<["file_read", "file_write", "command", "sandbox", "artifact"]>Runtime schema for Execution Tool Operation.
executionToolSideEffectLevelSchemaconstantconst executionToolSideEffectLevelSchema: z.ZodEnum<["read", "write", "external_effect", "irreversible"]>Runtime schema for Execution Tool Side Effect Level.
validateExecutionRiskAssessmentfunctionvalidateExecutionRiskAssessment(input: unknown): ExecutionRiskAssessmentValidate Execution Risk Assessment function with 1 public call signature; parameters and return types are listed below.
validateExecutionToolBindingfunctionvalidateExecutionToolBinding(input: unknown): ExecutionToolBindingValidate Execution Tool Binding function with 1 public call signature; parameters and return types are listed below.

executionGovernanceJsonSchemas

Execution Governance JSON Schemas constant exported by the modules/execution-governance/contracts module.

Declaration

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

executionRiskAssessmentExample

Valid example value for Execution Risk Assessment.

Declaration

text
export declare const executionRiskAssessmentExample: ExecutionRiskAssessment;

executionRiskAssessmentJsonSchema

JSON Schema for Execution Risk Assessment.

Declaration

text
export declare const executionRiskAssessmentJsonSchema: JsonSchema;

executionRiskAssessmentSchema

Runtime schema for Execution Risk Assessment.

Declaration

text
export declare const executionRiskAssessmentSchema: z.ZodEffects<z.ZodObject<{ id: z.ZodString; level: z.ZodEnum<["low", "medium", "high", "critical"]>; reasons: z.ZodArray<z.ZodString, "many">; matchedRules: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; requiresApproval: z.ZodBoolean; recommendedSandboxLevel: z.ZodOptional<z.ZodEnum<["local", "container", "remote_isolated"]>>; evaluatedAt: z.ZodString; }, "strict", z.ZodTypeAny, { id: string; evaluatedAt: string; level: "low" | "medium" | "high" | "critical"; reasons: string[]; requiresApproval: boolean; matchedRules?: string[] | undefined; recommendedSandboxLevel?: "local" | "container" | "remote_isolated" | undefined; }, { id: string; evaluatedAt: string; level: "low" | "medium" | "high" | "critical"; reasons: string[]; requiresApproval: boolean; matchedRules?: string[] | undefined; recommendedSandboxLevel?: "local" | "container" | "remote_isolated" | undefined; }>, { id: string; evaluatedAt: string; level: "low" | "medium" | "high" | "critical"; reasons: string[]; requiresApproval: boolean; matchedRules?: string[] | undefined; recommendedSandboxLevel?: "local" | "container" | "remote_isolated" | undefined; }, { id: string; evaluatedAt: string; level: "low" | "medium" | "high" | "critical"; reasons: string[]; requiresApproval: boolean; matchedRules?: string[] | undefined; recommendedSandboxLevel?: "local" | "container" | "remote_isolated" | undefined; }>;

executionSandboxLevelSchema

Runtime schema for Execution Sandbox Level.

Declaration

text
export declare const executionSandboxLevelSchema: z.ZodEnum<["local", "container", "remote_isolated"]>;

executionToolBindingExample

Valid example value for Execution Tool Binding.

Declaration

text
export declare const executionToolBindingExample: ExecutionToolBinding;

executionToolBindingJsonSchema

JSON Schema for Execution Tool Binding.

Declaration

text
export declare const executionToolBindingJsonSchema: JsonSchema;

executionToolBindingSchema

Runtime schema for Execution Tool Binding.

Declaration

text
export declare const executionToolBindingSchema: z.ZodEffects<z.ZodObject<{ toolId: z.ZodString; operation: z.ZodEnum<["file_read", "file_write", "command", "sandbox", "artifact"]>; executionProfileRef: z.ZodString; requiredScopes: z.ZodArray<z.ZodString, "many">; sideEffectLevel: z.ZodEnum<["read", "write", "external_effect", "irreversible"]>; humanReviewPolicyRef: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { operation: "command" | "artifact" | "file_read" | "file_write" | "sandbox"; toolId: string; sideEffectLevel: "external_effect" | "irreversible" | "read" | "write"; executionProfileRef: string; requiredScopes: string[]; humanReviewPolicyRef?: string | undefined; }, { operation: "command" | "artifact" | "file_read" | "file_write" | "sandbox"; toolId: string; sideEffectLevel: "external_effect" | "irreversible" | "read" | "write"; executionProfileRef: string; requiredScopes: string[]; humanReviewPolicyRef?: string | undefined; }>, { operation: "command" | "artifact" | "file_read" | "file_write" | "sandbox"; toolId: string; sideEffectLevel: "external_effect" | "irreversible" | "read" | "write"; executionProfileRef: string; requiredScopes: string[]; humanReviewPolicyRef?: string | undefined; }, { operation: "command" | "artifact" | "file_read" | "file_write" | "sandbox"; toolId: string; sideEffectLevel: "external_effect" | "irreversible" | "read" | "write"; executionProfileRef: string; requiredScopes: string[]; humanReviewPolicyRef?: string | undefined; }>;

executionToolOperationSchema

Runtime schema for Execution Tool Operation.

Declaration

text
export declare const executionToolOperationSchema: z.ZodEnum<["file_read", "file_write", "command", "sandbox", "artifact"]>;

executionToolSideEffectLevelSchema

Runtime schema for Execution Tool Side Effect Level.

Declaration

text
export declare const executionToolSideEffectLevelSchema: z.ZodEnum<["read", "write", "external_effect", "irreversible"]>;

validateExecutionRiskAssessment

Validate Execution Risk Assessment function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function validateExecutionRiskAssessment(input: unknown): ExecutionRiskAssessment;

Call signature

text
validateExecutionRiskAssessment(input: unknown): ExecutionRiskAssessment

Parameters

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

Returns

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

validateExecutionToolBinding

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

Declaration

text
export declare function validateExecutionToolBinding(input: unknown): ExecutionToolBinding;

Call signature

text
validateExecutionToolBinding(input: unknown): ExecutionToolBinding

Parameters

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

Returns

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