Skip to content

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

Using this module

Use the Execution governance module for declaring and runtime-validating contracts. It exports 2 constants, 4 interfaces, 3 types.

Import from the package entrypoint

ts
import {
  EXECUTION_SANDBOX_LEVELS,
  EXECUTION_TOOL_OPERATIONS,
} from '@codesoul-co/hypha-core';

import type {
  ExecutionRiskAssessment,
  ExecutionRiskEvaluationInput,
  ExecutionRiskEvaluator,
  ExecutionToolBinding,
  ExecutionSandboxLevel,
  ExecutionToolOperation,
  ExecutionToolSideEffectLevel,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 7 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.
  • The 2 constant/enum exports provide stable values, schemas, definitions, or defaults. Reuse these exports instead of copying internal values into an application.

Public exports

SymbolKindSignatureDescription
EXECUTION_SANDBOX_LEVELSconstantconst EXECUTION_SANDBOX_LEVELS: readonly ["local", "container", "remote_isolated"]EXECUTION SANDBOX LEVELS constant exported by the contracts/execution-governance module.
EXECUTION_TOOL_OPERATIONSconstantconst EXECUTION_TOOL_OPERATIONS: readonly ["file_read", "file_write", "command", "sandbox", "artifact"]EXECUTION TOOL OPERATIONS constant exported by the contracts/execution-governance module.
ExecutionRiskAssessmentinterfaceinterface ExecutionRiskAssessmentExecution Risk Assessment interface with 7 public fields or methods.
ExecutionRiskEvaluationInputinterfaceinterface ExecutionRiskEvaluationInputExecution Risk Evaluation Input interface with 6 public fields or methods.
ExecutionRiskEvaluatorinterfaceinterface ExecutionRiskEvaluatorExecution Risk Evaluator interface with 1 public fields or methods.
ExecutionToolBindinginterfaceinterface ExecutionToolBindingExecution Tool Binding interface with 6 public fields or methods.
ExecutionSandboxLeveltypetype ExecutionSandboxLevel = (typeof EXECUTION_SANDBOX_LEVELS)[number]Public type alias for Execution Sandbox Level; the declaration contains its complete type expression.
ExecutionToolOperationtypetype ExecutionToolOperation = (typeof EXECUTION_TOOL_OPERATIONS)[number]Public type alias for Execution Tool Operation; the declaration contains its complete type expression.
ExecutionToolSideEffectLeveltypetype ExecutionToolSideEffectLevel = Exclude<SideEffectLevel, 'none'>Public type alias for Execution Tool Side Effect Level; the declaration contains its complete type expression.

EXECUTION_SANDBOX_LEVELS

EXECUTION SANDBOX LEVELS constant exported by the contracts/execution-governance module.

Declaration

text
export declare const EXECUTION_SANDBOX_LEVELS: readonly ["local", "container", "remote_isolated"];

EXECUTION_TOOL_OPERATIONS

EXECUTION TOOL OPERATIONS constant exported by the contracts/execution-governance module.

Declaration

text
export declare const EXECUTION_TOOL_OPERATIONS: readonly ["file_read", "file_write", "command", "sandbox", "artifact"];

ExecutionRiskAssessment

Execution Risk Assessment interface with 7 public fields or methods.

Declaration

text
export interface ExecutionRiskAssessment {
    id: string;
    level: RiskLevel;
    reasons: string[];
    matchedRules?: string[];
    requiresApproval: boolean;
    recommendedSandboxLevel?: ExecutionSandboxLevel;
    evaluatedAt: string;
}

Contract members

MemberKindSignatureDescription
evaluatedAtpropertyevaluatedAt: 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.
levelpropertylevel: RiskLevelPublic property; its type, readonly modifier and optionality are shown in the signature.
matchedRulespropertymatchedRules?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
reasonspropertyreasons: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
recommendedSandboxLevelpropertyrecommendedSandboxLevel?: "local" | "container" | "remote_isolated"Public property; its type, readonly modifier and optionality are shown in the signature.
requiresApprovalpropertyrequiresApproval: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.

ExecutionRiskEvaluationInput

Execution Risk Evaluation Input interface with 6 public fields or methods.

Declaration

text
export interface ExecutionRiskEvaluationInput {
    assessmentId: string;
    binding: ExecutionToolBinding;
    request: CommandExecutionRequest | WorkspaceOperationRequest;
    environment: ExecutionEnvironmentSpec;
    workspace: WorkspaceSpec;
    evaluatedAt: string;
}

Contract members

MemberKindSignatureDescription
assessmentIdpropertyassessmentId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
bindingpropertybinding: ExecutionToolBindingPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentpropertyenvironment: ExecutionEnvironmentSpecPublic property; its type, readonly modifier and optionality are shown in the signature.
evaluatedAtpropertyevaluatedAt: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
requestpropertyrequest: CommandExecutionRequest | WorkspaceOperationRequestPublic property; its type, readonly modifier and optionality are shown in the signature.
workspacepropertyworkspace: WorkspaceSpecPublic property; its type, readonly modifier and optionality are shown in the signature.

ExecutionRiskEvaluator

Execution Risk Evaluator interface with 1 public fields or methods.

Declaration

text
export interface ExecutionRiskEvaluator {
    evaluate(input: ExecutionRiskEvaluationInput): ExecutionRiskAssessment;
}

Contract members

MemberKindSignatureDescription
evaluatemethodevaluate(input: ExecutionRiskEvaluationInput): ExecutionRiskAssessmentPublic method; parameters and return type are shown in the signature.

ExecutionToolBinding

Execution Tool Binding interface with 6 public fields or methods.

Declaration

text
export interface ExecutionToolBinding {
    toolId: string;
    operation: ExecutionToolOperation;
    executionProfileRef: string;
    requiredScopes: string[];
    sideEffectLevel: ExecutionToolSideEffectLevel;
    humanReviewPolicyRef?: string;
}

Contract members

MemberKindSignatureDescription
executionProfileRefpropertyexecutionProfileRef: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
humanReviewPolicyRefpropertyhumanReviewPolicyRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
operationpropertyoperation: "artifact" | "command" | "file_read" | "file_write" | "sandbox"Public property; its type, readonly modifier and optionality are shown in the signature.
requiredScopespropertyrequiredScopes: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
sideEffectLevelpropertysideEffectLevel: ExecutionToolSideEffectLevelPublic 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.

ExecutionSandboxLevel

Public type alias for Execution Sandbox Level; the declaration contains its complete type expression.

Declaration

text
export type ExecutionSandboxLevel = (typeof EXECUTION_SANDBOX_LEVELS)[number];

ExecutionToolOperation

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

Declaration

text
export type ExecutionToolOperation = (typeof EXECUTION_TOOL_OPERATIONS)[number];

ExecutionToolSideEffectLevel

Public type alias for Execution Tool Side Effect Level; the declaration contains its complete type expression.

Declaration

text
export type ExecutionToolSideEffectLevel = Exclude<SideEffectLevel, 'none'>;