@codesoul-co/hypha-core / modules/command-execution/index
模块用法
用于执行该边界的运行时行为。Index 模块公开 19 常量、5 函数。
从包入口导入
import {
commandExecutionJsonSchemas,
commandExecutionRequestExample,
commandExecutionRequestJsonSchema,
commandExecutionRequestSchema,
commandExecutionResultExample,
commandExecutionResultJsonSchema,
commandExecutionResultSchema,
commandExecutionStatusSchema,
} from '@codesoul-co/hypha-core';
// 完整导出列表见下方。使用要点
- 5 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。
- 19 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。
运行时校验示例
import { commandExecutionRequestSchema } from '@codesoul-co/hypha-core';
declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = commandExecutionRequestSchema.parse(input);配置、网络请求或持久化数据等不可信输入应先通过 Runtime Schema,再传给只接受已校验契约的函数或类。
公共导出
| Symbol | 种类 | 签名 | 说明 |
|---|---|---|---|
commandExecutionJsonSchemas | 常量 | const commandExecutionJsonSchemas: Record<string, JsonSchema> | 由 modules/command-execution/index 模块导出的 Command Execution JSON Schemas 常量。 |
commandExecutionRequestExample | 常量 | const commandExecutionRequestExample: CommandExecutionRequest | Command Execution Request 的有效示例值。 |
commandExecutionRequestJsonSchema | 常量 | const commandExecutionRequestJsonSchema: JsonSchema | Command Execution Request 的 JSON Schema。 |
commandExecutionRequestSchema | 常量 | const 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... | Command Execution Request 的运行时 Schema。 |
commandExecutionResultExample | 常量 | const commandExecutionResultExample: CommandExecutionResult | Command Execution Result 的有效示例值。 |
commandExecutionResultJsonSchema | 常量 | const commandExecutionResultJsonSchema: JsonSchema | Command Execution Result 的 JSON Schema。 |
commandExecutionResultSchema | 常量 | const 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... | Command Execution Result 的运行时 Schema。 |
commandExecutionStatusSchema | 常量 | const commandExecutionStatusSchema: z.ZodEnum<["queued", "starting", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "oom_killed", "resource_exceeded", "quarantined"]> | Command Execution Status 的运行时 Schema。 |
commandExecutionStatusTransitions | 常量 | const commandExecutionStatusTransitions: Readonly<Record<CommandExecutionStatus, readonly CommandExecutionStatus[]>> | 由 modules/command-execution/index 模块导出的 Command Execution Status Transitions 常量。 |
commandOutputChunkExample | 常量 | const commandOutputChunkExample: CommandOutputChunk | Command Output Chunk 的有效示例值。 |
commandOutputChunkJsonSchema | 常量 | const commandOutputChunkJsonSchema: JsonSchema | Command Output Chunk 的 JSON Schema。 |
commandOutputChunkSchema | 常量 | 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; s... | Command Output Chunk 的运行时 Schema。 |
executionCancelRequestExample | 常量 | const executionCancelRequestExample: ExecutionCancelRequest | Execution Cancel Request 的有效示例值。 |
executionCancelRequestJsonSchema | 常量 | const executionCancelRequestJsonSchema: JsonSchema | Execution Cancel Request 的 JSON Schema。 |
executionCancelRequestSchema | 常量 | 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,... | Execution Cancel Request 的运行时 Schema。 |
executionReceiptJsonSchema | 常量 | const executionReceiptJsonSchema: JsonSchema | Execution Receipt 的 JSON Schema。 |
executionReceiptSchema | 常量 | 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... | Execution Receipt 的运行时 Schema。 |
executionResourceUsageJsonSchema | 常量 | const executionResourceUsageJsonSchema: JsonSchema | Execution Resource Usage 的 JSON Schema。 |
executionResourceUsageSchema | 常量 | 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.ZodT... | Execution Resource Usage 的运行时 Schema。 |
canTransitionCommandExecutionStatus | 函数 | canTransitionCommandExecutionStatus(from: CommandExecutionStatus, to: CommandExecutionStatus): boolean | Can Transition Command Execution Status 函数,提供 1 个公开调用签名;参数与返回类型见下表。 |
validateCommandExecutionRequest | 函数 | validateCommandExecutionRequest(input: unknown): CommandExecutionRequest | Validate Command Execution Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。 |
validateCommandExecutionResult | 函数 | validateCommandExecutionResult(input: unknown): CommandExecutionResult | Validate Command Execution Result 函数,提供 1 个公开调用签名;参数与返回类型见下表。 |
validateCommandOutputChunk | 函数 | validateCommandOutputChunk(input: unknown): CommandOutputChunk | Validate Command Output Chunk 函数,提供 1 个公开调用签名;参数与返回类型见下表。 |
validateExecutionCancelRequest | 函数 | validateExecutionCancelRequest(input: unknown): ExecutionCancelRequest | Validate Execution Cancel Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。 |
commandExecutionJsonSchemas
由 modules/command-execution/index 模块导出的 Command Execution JSON Schemas 常量。
- 种类: 常量
- 导入:
import { commandExecutionJsonSchemas } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionJsonSchemas: Record<string, JsonSchema>;commandExecutionRequestExample
Command Execution Request 的有效示例值。
- 种类: 常量
- 导入:
import { commandExecutionRequestExample } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionRequestExample: CommandExecutionRequest;commandExecutionRequestJsonSchema
Command Execution Request 的 JSON Schema。
- 种类: 常量
- 导入:
import { commandExecutionRequestJsonSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionRequestJsonSchema: JsonSchema;commandExecutionRequestSchema
Command Execution Request 的运行时 Schema。
- 种类: 常量
- 导入:
import { commandExecutionRequestSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const commandExecutionRequestSchema: (typeof import('@codesoul-co/hypha-core'))['commandExecutionRequestSchema'];该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。
commandExecutionResultExample
Command Execution Result 的有效示例值。
- 种类: 常量
- 导入:
import { commandExecutionResultExample } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionResultExample: CommandExecutionResult;commandExecutionResultJsonSchema
Command Execution Result 的 JSON Schema。
- 种类: 常量
- 导入:
import { commandExecutionResultJsonSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionResultJsonSchema: JsonSchema;commandExecutionResultSchema
Command Execution Result 的运行时 Schema。
- 种类: 常量
- 导入:
import { commandExecutionResultSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const commandExecutionResultSchema: (typeof import('@codesoul-co/hypha-core'))['commandExecutionResultSchema'];该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。
commandExecutionStatusSchema
Command Execution Status 的运行时 Schema。
- 种类: 常量
- 导入:
import { commandExecutionStatusSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionStatusSchema: z.ZodEnum<["queued", "starting", "running", "cancelling", "cancelled", "completed", "failed", "timed_out", "oom_killed", "resource_exceeded", "quarantined"]>;commandExecutionStatusTransitions
由 modules/command-execution/index 模块导出的 Command Execution Status Transitions 常量。
- 种类: 常量
- 导入:
import { commandExecutionStatusTransitions } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandExecutionStatusTransitions: Readonly<Record<CommandExecutionStatus, readonly CommandExecutionStatus[]>>;commandOutputChunkExample
Command Output Chunk 的有效示例值。
- 种类: 常量
- 导入:
import { commandOutputChunkExample } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandOutputChunkExample: CommandOutputChunk;commandOutputChunkJsonSchema
Command Output Chunk 的 JSON Schema。
- 种类: 常量
- 导入:
import { commandOutputChunkJsonSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const commandOutputChunkJsonSchema: JsonSchema;commandOutputChunkSchema
Command Output Chunk 的运行时 Schema。
- 种类: 常量
- 导入:
import { commandOutputChunkSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
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
Execution Cancel Request 的有效示例值。
- 种类: 常量
- 导入:
import { executionCancelRequestExample } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const executionCancelRequestExample: ExecutionCancelRequest;executionCancelRequestJsonSchema
Execution Cancel Request 的 JSON Schema。
- 种类: 常量
- 导入:
import { executionCancelRequestJsonSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const executionCancelRequestJsonSchema: JsonSchema;executionCancelRequestSchema
Execution Cancel Request 的运行时 Schema。
- 种类: 常量
- 导入:
import { executionCancelRequestSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
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
Execution Receipt 的 JSON Schema。
- 种类: 常量
- 导入:
import { executionReceiptJsonSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const executionReceiptJsonSchema: JsonSchema;executionReceiptSchema
Execution Receipt 的运行时 Schema。
- 种类: 常量
- 导入:
import { executionReceiptSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
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
Execution Resource Usage 的 JSON Schema。
- 种类: 常量
- 导入:
import { executionResourceUsageJsonSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare const executionResourceUsageJsonSchema: JsonSchema;executionResourceUsageSchema
Execution Resource Usage 的运行时 Schema。
- 种类: 常量
- 导入:
import { executionResourceUsageSchema } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
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 函数,提供 1 个公开调用签名;参数与返回类型见下表。
- 种类: 函数
- 导入:
import { canTransitionCommandExecutionStatus } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare function canTransitionCommandExecutionStatus(from: CommandExecutionStatus, to: CommandExecutionStatus): boolean;调用签名
canTransitionCommandExecutionStatus(from: CommandExecutionStatus, to: CommandExecutionStatus): boolean参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
from | CommandExecutionStatus | 是 | 必需参数;接受的值由类型列定义。 |
to | CommandExecutionStatus | 是 | 必需参数;接受的值由类型列定义。 |
返回值
- 类型:
boolean - 说明: 返回值契约由上述类型定义。
validateCommandExecutionRequest
Validate Command Execution Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。
- 种类: 函数
- 导入:
import { validateCommandExecutionRequest } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare function validateCommandExecutionRequest(input: unknown): CommandExecutionRequest;调用签名
validateCommandExecutionRequest(input: unknown): CommandExecutionRequest参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
input | unknown | 是 | 必需参数;接受的值由类型列定义。 |
返回值
- 类型:
CommandExecutionRequest - 说明: 返回值契约由上述类型定义。
validateCommandExecutionResult
Validate Command Execution Result 函数,提供 1 个公开调用签名;参数与返回类型见下表。
- 种类: 函数
- 导入:
import { validateCommandExecutionResult } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare function validateCommandExecutionResult(input: unknown): CommandExecutionResult;调用签名
validateCommandExecutionResult(input: unknown): CommandExecutionResult参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
input | unknown | 是 | 必需参数;接受的值由类型列定义。 |
返回值
- 类型:
CommandExecutionResult - 说明: 返回值契约由上述类型定义。
validateCommandOutputChunk
Validate Command Output Chunk 函数,提供 1 个公开调用签名;参数与返回类型见下表。
- 种类: 函数
- 导入:
import { validateCommandOutputChunk } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare function validateCommandOutputChunk(input: unknown): CommandOutputChunk;调用签名
validateCommandOutputChunk(input: unknown): CommandOutputChunk参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
input | unknown | 是 | 必需参数;接受的值由类型列定义。 |
返回值
- 类型:
CommandOutputChunk - 说明: 返回值契约由上述类型定义。
validateExecutionCancelRequest
Validate Execution Cancel Request 函数,提供 1 个公开调用签名;参数与返回类型见下表。
- 种类: 函数
- 导入:
import { validateExecutionCancelRequest } from '@codesoul-co/hypha-core'; - 源码模块:
modules/command-execution/index
声明
export declare function validateExecutionCancelRequest(input: unknown): ExecutionCancelRequest;调用签名
validateExecutionCancelRequest(input: unknown): ExecutionCancelRequest参数
| 参数 | 类型 | 必需 | 说明 |
|---|---|---|---|
input | unknown | 是 | 必需参数;接受的值由类型列定义。 |
返回值
- 类型:
ExecutionCancelRequest - 说明: 返回值契约由上述类型定义。
