Skip to content

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

Using this module

Use the Execution events module for declaring and runtime-validating contracts. It exports 4 interfaces, 7 types.

Import from the package entrypoint

ts
import type {
  CommandExecutionEventPayload,
  ExecutionEventPayloadBase,
  NetworkAuthorizationEventPayload,
  SandboxLifecycleEventPayload,
  CommandExecutionFrameworkEventType,
  ExecutionEventCreateInput,
  ExecutionEventPayloadMap,
  ExecutionFrameworkEvent,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

  • Use the 11 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
CommandExecutionEventPayloadinterfaceinterface CommandExecutionEventPayload extends ExecutionEventPayloadBaseCommand Execution Event Payload interface with 22 public fields or methods.
ExecutionEventPayloadBaseinterfaceinterface ExecutionEventPayloadBaseExecution Event Payload Base interface with 14 public fields or methods.
NetworkAuthorizationEventPayloadinterfaceinterface NetworkAuthorizationEventPayload extends ExecutionEventPayloadBaseNetwork Authorization Event Payload interface with 19 public fields or methods.
SandboxLifecycleEventPayloadinterfaceinterface SandboxLifecycleEventPayload extends ExecutionEventPayloadBaseSandbox Lifecycle Event Payload interface with 17 public fields or methods.
CommandExecutionFrameworkEventTypetypetype CommandExecutionFrameworkEventType = 'command.execution.requested' | 'command.execution.validated' | 'command.execution.approval.required' | 'command.execution.queued' | 'command.execution.started' | 'command.execution.output.truncated' | 'command.execution.resource.exceeded' | 'command.execution.oom_killed' | 'command.execution.timeout' | 'command.execution.cancellation.requested' | 'command.execution.cancel...Public type alias for Command Execution Framework Event Type; the declaration contains its complete type expression.
ExecutionEventCreateInputtypetype ExecutionEventCreateInput = Omit<EventCreateInput<ExecutionEventPayloadMap[TType]>, 'type'> & { type: TType; }Public type alias for Execution Event Create Input; the declaration contains its complete type expression.
ExecutionEventPayloadMaptypetype ExecutionEventPayloadMap = { [K in SandboxFrameworkEventType]: SandboxLifecycleEventPayload; } & { [K in CommandExecutionFrameworkEventType]: CommandExecutionEventPayload; } & { [K in NetworkAuthorizationFrameworkEventType]: NetworkAuthorizationEventPayload; }Public type alias for Execution Event Payload Map; the declaration contains its complete type expression.
ExecutionFrameworkEventtypetype ExecutionFrameworkEvent = Omit<FrameworkEvent<ExecutionEventPayloadMap[TType]>, 'type'> & { type: TType; }Public type alias for Execution Framework Event; the declaration contains its complete type expression.
ExecutionFrameworkEventTypetypetype ExecutionFrameworkEventType = SandboxFrameworkEventType | CommandExecutionFrameworkEventType | NetworkAuthorizationFrameworkEventTypePublic type alias for Execution Framework Event Type; the declaration contains its complete type expression.
NetworkAuthorizationFrameworkEventTypetypetype NetworkAuthorizationFrameworkEventType = 'network.authorization.requested' | 'network.authorization.granted' | 'network.authorization.denied' | 'network.authorization.revoked'Public type alias for Network Authorization Framework Event Type; the declaration contains its complete type expression.
SandboxFrameworkEventTypetypetype SandboxFrameworkEventType = 'sandbox.create.requested' | 'sandbox.created' | 'sandbox.started' | 'sandbox.ready' | 'sandbox.degraded' | 'sandbox.terminate.requested' | 'sandbox.terminated' | 'sandbox.cleanup.completed' | 'sandbox.cleanup.failed'Public type alias for Sandbox Framework Event Type; the declaration contains its complete type expression.

CommandExecutionEventPayload

Command Execution Event Payload interface with 22 public fields or methods.

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

Declaration

text
export interface CommandExecutionEventPayload extends ExecutionEventPayloadBase {
    executionId: string;
    revision?: number;
    providerId?: string;
    status?: CommandExecutionStatus;
    exitCode?: number | null;
    signal?: string;
    outputStream?: 'stdout' | 'stderr';
    outputTruncated?: boolean;
    approvalRef?: string;
    recoveryDisposition?: ExecutionRecoveryDisposition;
}

Contract members

MemberKindSignatureDescription
approvalRefpropertyapprovalRef?: 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.
commandHashpropertycommandHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentIdpropertyenvironmentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentRevisionpropertyenvironmentRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: NormalizedExecutionErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
executionIdpropertyexecutionId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
exitCodepropertyexitCode?: numberPublic 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.
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.
outputStreampropertyoutputStream?: "stdout" | "stderr"Public property; its type, readonly modifier and optionality are shown in the signature.
outputTruncatedpropertyoutputTruncated?: booleanPublic property; its type, readonly modifier and optionality are shown in the signature.
providerIdpropertyproviderId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
recoveryDispositionpropertyrecoveryDisposition?: ExecutionRecoveryDispositionPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceUsagepropertyresourceUsage?: ExecutionResourceUsagePublic 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.
sandboxIdpropertysandboxId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
signalpropertysignal?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceTreeHashpropertysourceTreeHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus?: CommandExecutionStatusPublic 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.

ExecutionEventPayloadBase

Execution Event Payload Base interface with 14 public fields or methods.

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

Declaration

text
export interface ExecutionEventPayloadBase {
    operationId?: string;
    executionId?: string;
    sandboxId?: string;
    workspaceId?: string;
    environmentId?: string;
    environmentRevision?: string;
    commandHash?: string;
    sourceTreeHash?: string;
    artifactRefs?: string[];
    status?: string;
    latencyMs?: number;
    resourceUsage?: ExecutionResourceUsage;
    error?: NormalizedExecutionError;
    metadata?: Record<string, unknown>;
}

Contract members

MemberKindSignatureDescription
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
commandHashpropertycommandHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentIdpropertyenvironmentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentRevisionpropertyenvironmentRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: NormalizedExecutionErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
executionIdpropertyexecutionId?: stringPublic 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.
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.
resourceUsagepropertyresourceUsage?: ExecutionResourceUsagePublic property; its type, readonly modifier and optionality are shown in the signature.
sandboxIdpropertysandboxId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceTreeHashpropertysourceTreeHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus?: 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.

NetworkAuthorizationEventPayload

Network Authorization Event Payload interface with 19 public fields or methods.

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

Declaration

text
export interface NetworkAuthorizationEventPayload extends ExecutionEventPayloadBase {
    authorizationId: string;
    networkPolicyHash: string;
    decision: 'requested' | 'granted' | 'denied' | 'revoked';
    expiresAt?: string;
    reason?: string;
}

Contract members

MemberKindSignatureDescription
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
authorizationIdpropertyauthorizationId: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
commandHashpropertycommandHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
decisionpropertydecision: "requested" | "granted" | "denied" | "revoked"Public property; its type, readonly modifier and optionality are shown in the signature.
environmentIdpropertyenvironmentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentRevisionpropertyenvironmentRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: NormalizedExecutionErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
executionIdpropertyexecutionId?: 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.
latencyMspropertylatencyMs?: 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.
networkPolicyHashpropertynetworkPolicyHash: stringPublic 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.
reasonpropertyreason?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceUsagepropertyresourceUsage?: ExecutionResourceUsagePublic property; its type, readonly modifier and optionality are shown in the signature.
sandboxIdpropertysandboxId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceTreeHashpropertysourceTreeHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus?: 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.

SandboxLifecycleEventPayload

Sandbox Lifecycle Event Payload interface with 17 public fields or methods.

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

Declaration

text
export interface SandboxLifecycleEventPayload extends ExecutionEventPayloadBase {
    sandboxId?: string;
    providerId?: string;
    providerSandboxRef?: string;
    status?: SandboxStatus | 'degraded';
    missingCapabilities?: SandboxCapabilityName[];
}

Contract members

MemberKindSignatureDescription
artifactRefspropertyartifactRefs?: string[]Public property; its type, readonly modifier and optionality are shown in the signature.
commandHashpropertycommandHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentIdpropertyenvironmentId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
environmentRevisionpropertyenvironmentRevision?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
errorpropertyerror?: NormalizedExecutionErrorPublic property; its type, readonly modifier and optionality are shown in the signature.
executionIdpropertyexecutionId?: stringPublic 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.
metadatapropertymetadata?: Record<string, unknown>Public property; its type, readonly modifier and optionality are shown in the signature.
missingCapabilitiespropertymissingCapabilities?: (keyof import("/Users/erwin/Downloads/codespace/Hypha/packages/core/dist/contracts/sandbox").SandboxProviderCapabilities)[]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.
providerIdpropertyproviderId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
providerSandboxRefpropertyproviderSandboxRef?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
resourceUsagepropertyresourceUsage?: ExecutionResourceUsagePublic property; its type, readonly modifier and optionality are shown in the signature.
sandboxIdpropertysandboxId?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
sourceTreeHashpropertysourceTreeHash?: stringPublic property; its type, readonly modifier and optionality are shown in the signature.
statuspropertystatus?: "degraded" | SandboxStatusPublic 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.

CommandExecutionFrameworkEventType

Public type alias for Command Execution Framework Event Type; the declaration contains its complete type expression.

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

Declaration

text
export type CommandExecutionFrameworkEventType = 'command.execution.requested' | 'command.execution.validated' | 'command.execution.approval.required' | 'command.execution.queued' | 'command.execution.started' | 'command.execution.output.truncated' | 'command.execution.resource.exceeded' | 'command.execution.oom_killed' | 'command.execution.timeout' | 'command.execution.cancellation.requested' | 'command.execution.cancelled' | 'command.execution.completed' | 'command.execution.failed' | 'command.execution.result.unknown' | 'command.execution.recovered';

ExecutionEventCreateInput

Public type alias for Execution Event Create Input; the declaration contains its complete type expression.

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

Declaration

text
export type ExecutionEventCreateInput<TType extends ExecutionFrameworkEventType = ExecutionFrameworkEventType> = Omit<EventCreateInput<ExecutionEventPayloadMap[TType]>, 'type'> & {
    type: TType;
};

ExecutionEventPayloadMap

Public type alias for Execution Event Payload Map; the declaration contains its complete type expression.

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

Declaration

text
export type ExecutionEventPayloadMap = {
    [K in SandboxFrameworkEventType]: SandboxLifecycleEventPayload;
} & {
    [K in CommandExecutionFrameworkEventType]: CommandExecutionEventPayload;
} & {
    [K in NetworkAuthorizationFrameworkEventType]: NetworkAuthorizationEventPayload;
};

ExecutionFrameworkEvent

Public type alias for Execution Framework Event; the declaration contains its complete type expression.

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

Declaration

text
export type ExecutionFrameworkEvent<TType extends ExecutionFrameworkEventType = ExecutionFrameworkEventType> = Omit<FrameworkEvent<ExecutionEventPayloadMap[TType]>, 'type'> & {
    type: TType;
};

ExecutionFrameworkEventType

Public type alias for Execution Framework Event Type; the declaration contains its complete type expression.

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

Declaration

text
export type ExecutionFrameworkEventType = SandboxFrameworkEventType | CommandExecutionFrameworkEventType | NetworkAuthorizationFrameworkEventType;

NetworkAuthorizationFrameworkEventType

Public type alias for Network Authorization Framework Event Type; the declaration contains its complete type expression.

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

Declaration

text
export type NetworkAuthorizationFrameworkEventType = 'network.authorization.requested' | 'network.authorization.granted' | 'network.authorization.denied' | 'network.authorization.revoked';

SandboxFrameworkEventType

Public type alias for Sandbox Framework Event Type; the declaration contains its complete type expression.

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

Declaration

text
export type SandboxFrameworkEventType = 'sandbox.create.requested' | 'sandbox.created' | 'sandbox.started' | 'sandbox.ready' | 'sandbox.degraded' | 'sandbox.terminate.requested' | 'sandbox.terminated' | 'sandbox.cleanup.completed' | 'sandbox.cleanup.failed';