Skip to content

@codesoul-co/hypha-core / modules/command-execution/index

Using this module

Use the Index module for executing runtime behavior at this boundary. It exports 19 constants, 5 functions.

Import from the package entrypoint

ts
import {
  commandExecutionJsonSchemas,
  commandExecutionRequestExample,
  commandExecutionRequestJsonSchema,
  commandExecutionRequestSchema,
  commandExecutionResultExample,
  commandExecutionResultJsonSchema,
  commandExecutionResultSchema,
  commandExecutionStatusSchema,
} from '@codesoul-co/hypha-core';

// The complete export list is documented below.

Usage patterns

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

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = commandExecutionRequestSchema.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
commandExecutionJsonSchemasconstantconst commandExecutionJsonSchemas: Record<string, JsonSchema>Command Execution JSON Schemas constant exported by the modules/command-execution/index module.
commandExecutionRequestExampleconstantconst commandExecutionRequestExample: CommandExecutionRequestValid example value for Command Execution Request.
commandExecutionRequestJsonSchemaconstantconst commandExecutionRequestJsonSchema: JsonSchemaJSON Schema for Command Execution Request.
commandExecutionRequestSchemaconstantconst commandExecutionRequestSchema: z.ZodEffects<z.ZodObject<{ executionId: z.ZodOptional<z.ZodString>; operationId: z.ZodString; principal: z.ZodObject<{ principalId: z.ZodString; type: z.ZodEnum<["user", "agent", "service", "system"]>; tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; permissionSc...Runtime schema for Command Execution Request.
commandExecutionResultExampleconstantconst commandExecutionResultExample: CommandExecutionResultValid example value for Command Execution Result.
commandExecutionResultJsonSchemaconstantconst commandExecutionResultJsonSchema: JsonSchemaJSON Schema for Command Execution Result.
commandExecutionResultSchemaconstantconst commandExecutionResultSchema: z.ZodEffects<z.ZodObject<{ executionId: z.ZodString; revision: z.ZodNumber; sandboxId: z.ZodString; status: z.ZodEnum<["queued", "starting", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "oom_killed", "resource_exceeded", "quarantined"]>; exitCode: z.ZodNullable<z.ZodNumber>; signal: z.ZodOptional<z.ZodString>; stdout: z.ZodOptional<z.ZodString>; stde...Runtime schema for Command Execution Result.
commandExecutionStatusSchemaconstantconst commandExecutionStatusSchema: z.ZodEnum<["queued", "starting", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "oom_killed", "resource_exceeded", "quarantined"]>Runtime schema for Command Execution Status.
commandExecutionStatusTransitionsconstantconst commandExecutionStatusTransitions: Readonly<Record<CommandExecutionStatus, readonly CommandExecutionStatus[]>>Command Execution Status Transitions constant exported by the modules/command-execution/index module.
commandOutputChunkExampleconstantconst commandOutputChunkExample: CommandOutputChunkValid example value for Command Output Chunk.
commandOutputChunkJsonSchemaconstantconst commandOutputChunkJsonSchema: JsonSchemaJSON Schema for Command Output Chunk.
commandOutputChunkSchemaconstantconst commandOutputChunkSchema: z.ZodEffects<z.ZodObject<{ executionId: z.ZodString; sequence: z.ZodNumber; stream: z.ZodEnum<["stdout", "stderr"]>; encoding: z.ZodEnum<["utf8", "base64"]>; content: z.ZodString; byteLength: z.ZodNumber; contentHash: z.ZodString; emittedAt: z.ZodString; truncated: z.ZodOptional<z.ZodBoolean>; }, "strict", z.ZodTypeAny, { executionId: string; contentHash: string; sequence: number; s...Runtime schema for Command Output Chunk.
executionCancelRequestExampleconstantconst executionCancelRequestExample: ExecutionCancelRequestValid example value for Execution Cancel Request.
executionCancelRequestJsonSchemaconstantconst executionCancelRequestJsonSchema: JsonSchemaJSON Schema for Execution Cancel Request.
executionCancelRequestSchemaconstantconst executionCancelRequestSchema: z.ZodObject<{ operationId: z.ZodString; executionId: z.ZodString; principal: z.ZodObject<{ principalId: z.ZodString; type: z.ZodEnum<["user", "agent", "service", "system"]>; tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; permissionScopes: z.ZodArray<z.ZodString,...Runtime schema for Execution Cancel Request.
executionReceiptJsonSchemaconstantconst executionReceiptJsonSchema: JsonSchemaJSON Schema for Execution Receipt.
executionReceiptSchemaconstantconst executionReceiptSchema: z.ZodObject<{ id: z.ZodString; providerId: z.ZodString; executionId: z.ZodString; providerExecutionRef: z.ZodOptional<z.ZodString>; status: z.ZodEnum<["accepted", "completed", "rejected", "unknown"]>; issuedAt: z.ZodString; receiptHash: z.ZodString; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strict", z.ZodTypeAny, { status: "unknown" | "completed" | "rejected...Runtime schema for Execution Receipt.
executionResourceUsageJsonSchemaconstantconst executionResourceUsageJsonSchema: JsonSchemaJSON Schema for Execution Resource Usage.
executionResourceUsageSchemaconstantconst executionResourceUsageSchema: z.ZodObject<{ cpuTimeMs: z.ZodOptional<z.ZodNumber>; peakMemoryBytes: z.ZodOptional<z.ZodNumber>; readBytes: z.ZodOptional<z.ZodNumber>; writtenBytes: z.ZodOptional<z.ZodNumber>; networkBytesSent: z.ZodOptional<z.ZodNumber>; networkBytesReceived: z.ZodOptional<z.ZodNumber>; processCountPeak: z.ZodOptional<z.ZodNumber>; outputBytes: z.ZodOptional<z.ZodNumber>; }, "strict", z.ZodT...Runtime schema for Execution Resource Usage.
canTransitionCommandExecutionStatusfunctioncanTransitionCommandExecutionStatus(from: CommandExecutionStatus, to: CommandExecutionStatus): booleanCan Transition Command Execution Status function with 1 public call signature; parameters and return types are listed below.
validateCommandExecutionRequestfunctionvalidateCommandExecutionRequest(input: unknown): CommandExecutionRequestValidate Command Execution Request function with 1 public call signature; parameters and return types are listed below.
validateCommandExecutionResultfunctionvalidateCommandExecutionResult(input: unknown): CommandExecutionResultValidate Command Execution Result function with 1 public call signature; parameters and return types are listed below.
validateCommandOutputChunkfunctionvalidateCommandOutputChunk(input: unknown): CommandOutputChunkValidate Command Output Chunk function with 1 public call signature; parameters and return types are listed below.
validateExecutionCancelRequestfunctionvalidateExecutionCancelRequest(input: unknown): ExecutionCancelRequestValidate Execution Cancel Request function with 1 public call signature; parameters and return types are listed below.

commandExecutionJsonSchemas

Command Execution JSON Schemas constant exported by the modules/command-execution/index module.

Declaration

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

commandExecutionRequestExample

Valid example value for Command Execution Request.

Declaration

text
export declare const commandExecutionRequestExample: CommandExecutionRequest;

commandExecutionRequestJsonSchema

JSON Schema for Command Execution Request.

Declaration

text
export declare const commandExecutionRequestJsonSchema: JsonSchema;

commandExecutionRequestSchema

Runtime schema for Command Execution Request.

Declaration

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

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.

commandExecutionResultExample

Valid example value for Command Execution Result.

Declaration

text
export declare const commandExecutionResultExample: CommandExecutionResult;

commandExecutionResultJsonSchema

JSON Schema for Command Execution Result.

Declaration

text
export declare const commandExecutionResultJsonSchema: JsonSchema;

commandExecutionResultSchema

Runtime schema for Command Execution Result.

Declaration

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

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.

commandExecutionStatusSchema

Runtime schema for Command Execution Status.

Declaration

text
export declare const commandExecutionStatusSchema: z.ZodEnum<["queued", "starting", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "oom_killed", "resource_exceeded", "quarantined"]>;

commandExecutionStatusTransitions

Command Execution Status Transitions constant exported by the modules/command-execution/index module.

Declaration

text
export declare const commandExecutionStatusTransitions: Readonly<Record<CommandExecutionStatus, readonly CommandExecutionStatus[]>>;

commandOutputChunkExample

Valid example value for Command Output Chunk.

Declaration

text
export declare const commandOutputChunkExample: CommandOutputChunk;

commandOutputChunkJsonSchema

JSON Schema for Command Output Chunk.

Declaration

text
export declare const commandOutputChunkJsonSchema: JsonSchema;

commandOutputChunkSchema

Runtime schema for Command Output Chunk.

Declaration

text
export declare const commandOutputChunkSchema: z.ZodEffects<z.ZodObject<{ executionId: z.ZodString; sequence: z.ZodNumber; stream: z.ZodEnum<["stdout", "stderr"]>; encoding: z.ZodEnum<["utf8", "base64"]>; content: z.ZodString; byteLength: z.ZodNumber; contentHash: z.ZodString; emittedAt: z.ZodString; truncated: z.ZodOptional<z.ZodBoolean>; }, "strict", z.ZodTypeAny, { executionId: string; contentHash: string; sequence: number; stream: "stdout" | "stderr"; content: string; encoding: "utf8" | "base64"; byteLength: number; emittedAt: string; truncated?: boolean | undefined; }, { executionId: string; contentHash: string; sequence: number; stream: "stdout" | "stderr"; content: string; encoding: "utf8" | "base64"; byteLength: number; emittedAt: string; truncated?: boolean | undefined; }>, { executionId: string; contentHash: string; sequence: number; stream: "stdout" | "stderr"; content: string; encoding: "utf8" | "base64"; byteLength: number; emittedAt: string; truncated?: boolean | undefined; }, { executionId: string; contentHash: string; sequence: number; stream: "stdout" | "stderr"; content: string; encoding: "utf8" | "base64"; byteLength: number; emittedAt: string; truncated?: boolean | undefined; }>;

executionCancelRequestExample

Valid example value for Execution Cancel Request.

Declaration

text
export declare const executionCancelRequestExample: ExecutionCancelRequest;

executionCancelRequestJsonSchema

JSON Schema for Execution Cancel Request.

Declaration

text
export declare const executionCancelRequestJsonSchema: JsonSchema;

executionCancelRequestSchema

Runtime schema for Execution Cancel Request.

Declaration

text
export declare const executionCancelRequestSchema: z.ZodObject<{ operationId: z.ZodString; executionId: z.ZodString; principal: z.ZodObject<{ principalId: z.ZodString; type: z.ZodEnum<["user", "agent", "service", "system"]>; tenantId: z.ZodOptional<z.ZodString>; userId: z.ZodOptional<z.ZodString>; agentId: z.ZodOptional<z.ZodString>; roles: z.ZodOptional<z.ZodArray<z.ZodString, "many">>; permissionScopes: z.ZodArray<z.ZodString, "many">; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strict", z.ZodTypeAny, { type: "user" | "agent" | "service" | "system"; principalId: string; permissionScopes: string[]; metadata?: Record<string, unknown> | undefined; agentId?: string | undefined; tenantId?: string | undefined; userId?: string | undefined; roles?: string[] | undefined; }, { type: "user" | "agent" | "service" | "system"; principalId: string; permissionScopes: string[]; metadata?: Record<string, unknown> | undefined; agentId?: string | undefined; tenantId?: string | undefined; userId?: string | undefined; roles?: string[] | undefined; }>; expectedRevision: z.ZodNumber; reason: z.ZodOptional<z.ZodString>; gracePeriodMs: z.ZodOptional<z.ZodNumber>; idempotencyKey: z.ZodOptional<z.ZodString>; correlationId: z.ZodOptional<z.ZodString>; causationId: z.ZodOptional<z.ZodString>; }, "strict", z.ZodTypeAny, { operationId: string; executionId: string; principal: { type: "user" | "agent" | "service" | "system"; principalId: string; permissionScopes: string[]; metadata?: Record<string, unknown> | undefined; agentId?: string | undefined; tenantId?: string | undefined; userId?: string | undefined; roles?: string[] | undefined; }; expectedRevision: number; reason?: string | undefined; correlationId?: string | undefined; causationId?: string | undefined; idempotencyKey?: string | undefined; gracePeriodMs?: number | undefined; }, { operationId: string; executionId: string; principal: { type: "user" | "agent" | "service" | "system"; principalId: string; permissionScopes: string[]; metadata?: Record<string, unknown> | undefined; agentId?: string | undefined; tenantId?: string | undefined; userId?: string | undefined; roles?: string[] | undefined; }; expectedRevision: number; reason?: string | undefined; correlationId?: string | undefined; causationId?: string | undefined; idempotencyKey?: string | undefined; gracePeriodMs?: number | undefined; }>;

executionReceiptJsonSchema

JSON Schema for Execution Receipt.

Declaration

text
export declare const executionReceiptJsonSchema: JsonSchema;

executionReceiptSchema

Runtime schema for Execution Receipt.

Declaration

text
export declare const executionReceiptSchema: z.ZodObject<{ id: z.ZodString; providerId: z.ZodString; executionId: z.ZodString; providerExecutionRef: z.ZodOptional<z.ZodString>; status: z.ZodEnum<["accepted", "completed", "rejected", "unknown"]>; issuedAt: z.ZodString; receiptHash: z.ZodString; metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>; }, "strict", z.ZodTypeAny, { status: "unknown" | "completed" | "rejected" | "accepted"; id: string; executionId: string; providerId: string; issuedAt: string; receiptHash: string; metadata?: Record<string, unknown> | undefined; providerExecutionRef?: string | undefined; }, { status: "unknown" | "completed" | "rejected" | "accepted"; id: string; executionId: string; providerId: string; issuedAt: string; receiptHash: string; metadata?: Record<string, unknown> | undefined; providerExecutionRef?: string | undefined; }>;

executionResourceUsageJsonSchema

JSON Schema for Execution Resource Usage.

Declaration

text
export declare const executionResourceUsageJsonSchema: JsonSchema;

executionResourceUsageSchema

Runtime schema for Execution Resource Usage.

Declaration

text
export declare const executionResourceUsageSchema: z.ZodObject<{ cpuTimeMs: z.ZodOptional<z.ZodNumber>; peakMemoryBytes: z.ZodOptional<z.ZodNumber>; readBytes: z.ZodOptional<z.ZodNumber>; writtenBytes: z.ZodOptional<z.ZodNumber>; networkBytesSent: z.ZodOptional<z.ZodNumber>; networkBytesReceived: z.ZodOptional<z.ZodNumber>; processCountPeak: z.ZodOptional<z.ZodNumber>; outputBytes: z.ZodOptional<z.ZodNumber>; }, "strict", z.ZodTypeAny, { cpuTimeMs?: number | undefined; peakMemoryBytes?: number | undefined; readBytes?: number | undefined; writtenBytes?: number | undefined; networkBytesSent?: number | undefined; networkBytesReceived?: number | undefined; processCountPeak?: number | undefined; outputBytes?: number | undefined; }, { cpuTimeMs?: number | undefined; peakMemoryBytes?: number | undefined; readBytes?: number | undefined; writtenBytes?: number | undefined; networkBytesSent?: number | undefined; networkBytesReceived?: number | undefined; processCountPeak?: number | undefined; outputBytes?: number | undefined; }>;

canTransitionCommandExecutionStatus

Can Transition Command Execution Status function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function canTransitionCommandExecutionStatus(from: CommandExecutionStatus, to: CommandExecutionStatus): boolean;

Call signature

text
canTransitionCommandExecutionStatus(from: CommandExecutionStatus, to: CommandExecutionStatus): boolean

Parameters

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

Returns

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

validateCommandExecutionRequest

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

Declaration

text
export declare function validateCommandExecutionRequest(input: unknown): CommandExecutionRequest;

Call signature

text
validateCommandExecutionRequest(input: unknown): CommandExecutionRequest

Parameters

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

Returns

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

validateCommandExecutionResult

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

Declaration

text
export declare function validateCommandExecutionResult(input: unknown): CommandExecutionResult;

Call signature

text
validateCommandExecutionResult(input: unknown): CommandExecutionResult

Parameters

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

Returns

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

validateCommandOutputChunk

Validate Command Output Chunk function with 1 public call signature; parameters and return types are listed below.

Declaration

text
export declare function validateCommandOutputChunk(input: unknown): CommandOutputChunk;

Call signature

text
validateCommandOutputChunk(input: unknown): CommandOutputChunk

Parameters

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

Returns

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

validateExecutionCancelRequest

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

Declaration

text
export declare function validateExecutionCancelRequest(input: unknown): ExecutionCancelRequest;

Call signature

text
validateExecutionCancelRequest(input: unknown): ExecutionCancelRequest

Parameters

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

Returns

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