Skip to content

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

Using this module

Use the Execution module for declaring and runtime-validating contracts. It exports 3 interfaces.

Import from the package entrypoint

ts
import type {
  ExecutionPrincipal,
  NormalizedExecutionError,
  ProviderHealth,
} from '@codesoul-co/hypha-core';

Usage patterns

  • Use the 3 type/interface exports as static contracts in application code, adapters, or tests. Import them with import type; they do not exist at runtime.

Public exports

SymbolKindSignatureDescription
ExecutionPrincipalinterfaceinterface ExecutionPrincipalExecution Principal interface with 8 public fields or methods.
NormalizedExecutionErrorinterfaceinterface NormalizedExecutionErrorNormalized Execution Error interface with 6 public fields or methods.
ProviderHealthinterfaceinterface ProviderHealthProvider Health interface with 5 public fields or methods.

ExecutionPrincipal

Execution Principal interface with 8 public fields or methods.

  • Kind: interface
  • Import: import type { ExecutionPrincipal } from '@codesoul-co/hypha-core';
  • Source module: contracts/execution

Declaration

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

Contract members

MemberKindSignatureDescription
agentIdpropertyagentId?: 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: 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?: 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.

NormalizedExecutionError

Normalized Execution Error interface with 6 public fields or methods.

  • Kind: interface
  • Import: import type { NormalizedExecutionError } from '@codesoul-co/hypha-core';
  • Source module: contracts/execution

Declaration

text
export interface NormalizedExecutionError {
    code: 'EXECUTION_INVALID_REQUEST' | 'EXECUTION_PERMISSION_DENIED' | 'EXECUTION_POLICY_DENIED' | 'EXECUTION_APPROVAL_REQUIRED' | 'EXECUTION_WORKSPACE_NOT_FOUND' | 'EXECUTION_PATH_ESCAPE' | 'EXECUTION_PATH_DENIED' | 'EXECUTION_QUOTA_EXCEEDED' | 'EXECUTION_ENVIRONMENT_UNAVAILABLE' | 'EXECUTION_SANDBOX_CREATE_FAILED' | 'EXECUTION_SANDBOX_START_FAILED' | 'EXECUTION_IMAGE_UNTRUSTED' | 'EXECUTION_NETWORK_DENIED' | 'EXECUTION_SECRET_DENIED' | 'EXECUTION_PROCESS_START_FAILED' | 'EXECUTION_TIMEOUT' | 'EXECUTION_IDLE_TIMEOUT' | 'EXECUTION_CANCELLED' | 'EXECUTION_OOM_KILLED' | 'EXECUTION_RESOURCE_EXCEEDED' | 'EXECUTION_OUTPUT_LIMIT' | 'EXECUTION_RESULT_UNKNOWN' | 'EXECUTION_REVISION_CONFLICT' | 'EXECUTION_LEASE_HELD' | 'EXECUTION_LEASE_LOST' | 'EXECUTION_IDEMPOTENCY_CONFLICT' | 'EXECUTION_CLEANUP_FAILED' | 'EXECUTION_INTERNAL_ERROR';
    message: string;
    retryable: boolean;
    providerCode?: string | number;
    details?: Record<string, unknown>;
    causeRef?: string;
}

Contract members

MemberKindSignatureDescription
causeRefpropertycauseRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
codepropertycode: "EXECUTION_INVALID_REQUEST" | "EXECUTION_PERMISSION_DENIED" | "EXECUTION_POLICY_DENIED" | "EXECUTION_APPROVAL_REQUIRED" | "EXECUTION_WORKSPACE_NOT_FOUND" | "EXECUTION_PATH_ESCAPE" | "EXECUTION_PATH_DENIED" | "EXECUTION_QUOTA_EXCEEDED" | "EXECUTION_ENVIRONMENT_UNAVAILABLE" | "EXECUTION_SANDBOX_CREATE_FAILED" | "EXECUTION_SANDBOX_START_FAILED" | "EXECUTION_IMAGE_UNTRUSTED" | "EXECUTION_NETWORK_DENIED" | "EXECU...Public 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.
providerCodepropertyproviderCode?: string | numberPublic 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.

ProviderHealth

Provider Health interface with 5 public fields or methods.

  • Kind: interface
  • Import: import type { ProviderHealth } from '@codesoul-co/hypha-core';
  • Source module: contracts/execution

Declaration

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

Contract members

MemberKindSignatureDescription
checkedAtpropertycheckedAt: 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.
latencyMspropertylatencyMs?: 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.
statuspropertystatus: "healthy" | "degraded" | "unhealthy" | "unknown"Public property; its type, readonly modifier and optionality are shown in the signature.