Skip to content

@codesoul-co/hypha-core / modules/execution-events/index ​

模块用法 ​

用于创建、记录或读取 Event 契约。Index 模块公开 19 常量、3 函数。

从包入口导入 ​

ts
import {
  commandExecutionEventExample,
  commandExecutionEventPayloadJsonSchema,
  commandExecutionEventPayloadSchema,
  commandExecutionFrameworkEventTypes,
  executionEventJsonSchemas,
  executionEventPayloadBaseJsonSchema,
  executionEventPayloadBaseSchema,
  executionFrameworkEventEnvelopeSchema,
} from '@codesoul-co/hypha-core';

// 完整导出列表见下方。

使用要点 ​

  • 3 个函数是该模块的直接操作入口;每个 overload 的必需/可选参数与返回类型均在下方列出。
  • 19 个常量/枚举提供稳定值、Schema、Definition 或默认配置;应复用这些导出,避免在应用中复制内部值。

运行时校验示例 ​

ts
import { commandExecutionEventPayloadSchema } from '@codesoul-co/hypha-core';

declare function loadExternalInput(): unknown;
const input: unknown = loadExternalInput();
const parsed = commandExecutionEventPayloadSchema.parse(input);

配置、网络请求或持久化数据等不可信输入应先通过 Runtime Schema,再传给只接受已校验契约的函数或类。

公共导出 ​

Symbol种类签名说明
commandExecutionEventExample常量const commandExecutionEventExample: ExecutionFrameworkEvent<"command.execution.completed">Command Execution Event 的有效示例值。
commandExecutionEventPayloadJsonSchema常量const commandExecutionEventPayloadJsonSchema: JsonSchemaCommand Execution Event Payload 的 JSON Schema。
commandExecutionEventPayloadSchema常量const commandExecutionEventPayloadSchema: z.ZodEffects<z.ZodObject<{ operationId: z.ZodOptional<z.ZodString>; sandboxId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; environmentId: z.ZodOptional<z.ZodString>; environmentRevision: z.ZodOptional<z.ZodString>; commandHash: z.ZodOptional<z.ZodString>; sourceTreeHash: z.ZodOptional<z.ZodString>; artifactRefs: z.ZodOptional<z.ZodArray<z.ZodString...Command Execution Event Payload 的运行时 Schema。
commandExecutionFrameworkEventTypes常量const commandExecutionFrameworkEventTypes: readonly ["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.cance...由 modules/execution-events/index 模块导出的 Command Execution Framework Event Types 常量。
executionEventJsonSchemas常量const executionEventJsonSchemas: Record<string, JsonSchema>由 modules/execution-events/index 模块导出的 Execution Event JSON Schemas 常量。
executionEventPayloadBaseJsonSchema常量const executionEventPayloadBaseJsonSchema: JsonSchemaExecution Event Payload Base 的 JSON Schema。
executionEventPayloadBaseSchema常量const executionEventPayloadBaseSchema: z.ZodEffects<z.ZodObject<{ operationId: z.ZodOptional<z.ZodString>; executionId: z.ZodOptional<z.ZodString>; sandboxId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; environmentId: z.ZodOptional<z.ZodString>; environmentRevision: z.ZodOptional<z.ZodString>; commandHash: z.ZodOptional<z.ZodString>; sourceTreeHash: z.ZodOptional<z.ZodString>; artifactRefs...Execution Event Payload Base 的运行时 Schema。
executionFrameworkEventEnvelopeSchema常量const executionFrameworkEventEnvelopeSchema: z.ZodEffects<z.ZodObject<{ id: z.ZodString; type: z.ZodEnum<["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed", "command.execution.requested", "command.execution.validated", "command.execution.approval.required",...Execution Framework Event Envelope 的运行时 Schema。
executionFrameworkEventJsonSchema常量const executionFrameworkEventJsonSchema: JsonSchemaExecution Framework Event 的 JSON Schema。
executionFrameworkEventTypes常量const executionFrameworkEventTypes: readonly ["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed", "command.execution.requested", "command.execution.validated", "command.execution.approval.required", "command.execution.queued", "command.execution.started", "c...由 modules/execution-events/index 模块导出的 Execution Framework Event Types 常量。
executionFrameworkEventTypeSchema常量const executionFrameworkEventTypeSchema: z.ZodEnum<["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed", "command.execution.requested", "command.execution.validated", "command.execution.approval.required", "command.execution.queued", "command.execution.starte...Execution Framework Event Type 的运行时 Schema。
networkAuthorizationEventExample常量const networkAuthorizationEventExample: ExecutionFrameworkEvent<"network.authorization.granted">Network Authorization Event 的有效示例值。
networkAuthorizationEventPayloadJsonSchema常量const networkAuthorizationEventPayloadJsonSchema: JsonSchemaNetwork Authorization Event Payload 的 JSON Schema。
networkAuthorizationEventPayloadSchema常量const networkAuthorizationEventPayloadSchema: z.ZodEffects<z.ZodObject<{ operationId: z.ZodOptional<z.ZodString>; executionId: z.ZodOptional<z.ZodString>; sandboxId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; environmentId: z.ZodOptional<z.ZodString>; environmentRevision: z.ZodOptional<z.ZodString>; commandHash: z.ZodOptional<z.ZodString>; sourceTreeHash: z.ZodOptional<z.ZodString>; artif...Network Authorization Event Payload 的运行时 Schema。
networkAuthorizationFrameworkEventTypes常量const networkAuthorizationFrameworkEventTypes: readonly ["network.authorization.requested", "network.authorization.granted", "network.authorization.denied", "network.authorization.revoked"]由 modules/execution-events/index 模块导出的 Network Authorization Framework Event Types 常量。
sandboxFrameworkEventTypes常量const sandboxFrameworkEventTypes: readonly ["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed"]由 modules/execution-events/index 模块导出的 Sandbox Framework Event Types 常量。
sandboxLifecycleEventExample常量const sandboxLifecycleEventExample: ExecutionFrameworkEvent<"sandbox.ready">Sandbox Lifecycle Event 的有效示例值。
sandboxLifecycleEventPayloadJsonSchema常量const sandboxLifecycleEventPayloadJsonSchema: JsonSchemaSandbox Lifecycle Event Payload 的 JSON Schema。
sandboxLifecycleEventPayloadSchema常量const sandboxLifecycleEventPayloadSchema: z.ZodEffects<z.ZodObject<{ operationId: z.ZodOptional<z.ZodString>; executionId: z.ZodOptional<z.ZodString>; workspaceId: z.ZodOptional<z.ZodString>; environmentId: z.ZodOptional<z.ZodString>; environmentRevision: z.ZodOptional<z.ZodString>; commandHash: z.ZodOptional<z.ZodString>; sourceTreeHash: z.ZodOptional<z.ZodString>; artifactRefs: z.ZodOptional<z.ZodArray<z.ZodStri...Sandbox Lifecycle Event Payload 的运行时 Schema。
createExecutionFrameworkEvent函数createExecutionFrameworkEvent<TType extends ExecutionFrameworkEventType>(input: ExecutionEventCreateInput<TType>): ExecutionFrameworkEvent<TType>Create Execution Framework Event 函数,提供 1 个公开调用签名;参数与返回类型见下表。
validateExecutionEventPayload函数validateExecutionEventPayload<TType extends ExecutionFrameworkEventType>(type: TType, input: unknown): ExecutionEventPayloadMap[TType]Validate Execution Event Payload 函数,提供 1 个公开调用签名;参数与返回类型见下表。
validateExecutionFrameworkEvent函数validateExecutionFrameworkEvent(input: unknown): ExecutionFrameworkEventValidate Execution Framework Event 函数,提供 1 个公开调用签名;参数与返回类型见下表。

commandExecutionEventExample ​

Command Execution Event 的有效示例值。

声明 ​

text
export declare const commandExecutionEventExample: ExecutionFrameworkEvent<"command.execution.completed">;

commandExecutionEventPayloadJsonSchema ​

Command Execution Event Payload 的 JSON Schema。

声明 ​

text
export declare const commandExecutionEventPayloadJsonSchema: JsonSchema;

commandExecutionEventPayloadSchema ​

Command Execution Event Payload 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const commandExecutionEventPayloadSchema: (typeof import('@codesoul-co/hypha-core'))['commandExecutionEventPayloadSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

commandExecutionFrameworkEventTypes ​

由 modules/execution-events/index 模块导出的 Command Execution Framework Event Types 常量。

声明 ​

text
export declare const commandExecutionFrameworkEventTypes: readonly ["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"];

executionEventJsonSchemas ​

由 modules/execution-events/index 模块导出的 Execution Event JSON Schemas 常量。

声明 ​

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

executionEventPayloadBaseJsonSchema ​

Execution Event Payload Base 的 JSON Schema。

声明 ​

text
export declare const executionEventPayloadBaseJsonSchema: JsonSchema;

executionEventPayloadBaseSchema ​

Execution Event Payload Base 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const executionEventPayloadBaseSchema: (typeof import('@codesoul-co/hypha-core'))['executionEventPayloadBaseSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

executionFrameworkEventEnvelopeSchema ​

Execution Framework Event Envelope 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const executionFrameworkEventEnvelopeSchema: (typeof import('@codesoul-co/hypha-core'))['executionFrameworkEventEnvelopeSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

executionFrameworkEventJsonSchema ​

Execution Framework Event 的 JSON Schema。

声明 ​

text
export declare const executionFrameworkEventJsonSchema: JsonSchema;

executionFrameworkEventTypes ​

由 modules/execution-events/index 模块导出的 Execution Framework Event Types 常量。

声明 ​

text
export declare const executionFrameworkEventTypes: readonly ["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed", "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", "network.authorization.requested", "network.authorization.granted", "network.authorization.denied", "network.authorization.revoked"];

executionFrameworkEventTypeSchema ​

Execution Framework Event Type 的运行时 Schema。

声明 ​

text
export declare const executionFrameworkEventTypeSchema: z.ZodEnum<["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed", "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", "network.authorization.requested", "network.authorization.granted", "network.authorization.denied", "network.authorization.revoked"]>;

networkAuthorizationEventExample ​

Network Authorization Event 的有效示例值。

声明 ​

text
export declare const networkAuthorizationEventExample: ExecutionFrameworkEvent<"network.authorization.granted">;

networkAuthorizationEventPayloadJsonSchema ​

Network Authorization Event Payload 的 JSON Schema。

  • 种类: 常量
  • 导入: import { networkAuthorizationEventPayloadJsonSchema } from '@codesoul-co/hypha-core';
  • 源码模块: modules/execution-events/index

声明 ​

text
export declare const networkAuthorizationEventPayloadJsonSchema: JsonSchema;

networkAuthorizationEventPayloadSchema ​

Network Authorization Event Payload 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const networkAuthorizationEventPayloadSchema: (typeof import('@codesoul-co/hypha-core'))['networkAuthorizationEventPayloadSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

networkAuthorizationFrameworkEventTypes ​

由 modules/execution-events/index 模块导出的 Network Authorization Framework Event Types 常量。

声明 ​

text
export declare const networkAuthorizationFrameworkEventTypes: readonly ["network.authorization.requested", "network.authorization.granted", "network.authorization.denied", "network.authorization.revoked"];

sandboxFrameworkEventTypes ​

由 modules/execution-events/index 模块导出的 Sandbox Framework Event Types 常量。

声明 ​

text
export declare const sandboxFrameworkEventTypes: readonly ["sandbox.create.requested", "sandbox.created", "sandbox.started", "sandbox.ready", "sandbox.degraded", "sandbox.terminate.requested", "sandbox.terminated", "sandbox.cleanup.completed", "sandbox.cleanup.failed"];

sandboxLifecycleEventExample ​

Sandbox Lifecycle Event 的有效示例值。

声明 ​

text
export declare const sandboxLifecycleEventExample: ExecutionFrameworkEvent<"sandbox.ready">;

sandboxLifecycleEventPayloadJsonSchema ​

Sandbox Lifecycle Event Payload 的 JSON Schema。

声明 ​

text
export declare const sandboxLifecycleEventPayloadJsonSchema: JsonSchema;

sandboxLifecycleEventPayloadSchema ​

Sandbox Lifecycle Event Payload 的运行时 Schema。

声明 ​

text
// 精确类型由包入口解析;完整编译器展开定义见源码链接。
export declare const sandboxLifecycleEventPayloadSchema: (typeof import('@codesoul-co/hypha-core'))['sandboxLifecycleEventPayloadSchema'];

该常量的编译器展开类型已压缩;它的公共名称、顶层类型与源码位置仍保留在本条目中。相关输入/输出字段请使用同模块导出的接口、类型或 Runtime Schema。

createExecutionFrameworkEvent ​

Create Execution Framework Event 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function createExecutionFrameworkEvent<TType extends ExecutionFrameworkEventType>(input: ExecutionEventCreateInput<TType>): ExecutionFrameworkEvent<TType>;

调用签名 ​

text
createExecutionFrameworkEvent<TType extends ExecutionFrameworkEventType>(input: ExecutionEventCreateInput<TType>): ExecutionFrameworkEvent<TType>

参数 ​

参数类型必需说明
inputExecutionEventCreateInput<TType>是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: ExecutionFrameworkEvent<TType>
  • 说明: 返回值契约由上述类型定义。

validateExecutionEventPayload ​

Validate Execution Event Payload 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function validateExecutionEventPayload<TType extends ExecutionFrameworkEventType>(type: TType, input: unknown): ExecutionEventPayloadMap[TType];

调用签名 ​

text
validateExecutionEventPayload<TType extends ExecutionFrameworkEventType>(type: TType, input: unknown): ExecutionEventPayloadMap[TType]

参数 ​

参数类型必需说明
typeTType是必需参数;接受的值由类型列定义。
inputunknown是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: ExecutionEventPayloadMap[TType]
  • 说明: 返回值契约由上述类型定义。

validateExecutionFrameworkEvent ​

Validate Execution Framework Event 函数,提供 1 个公开调用签名;参数与返回类型见下表。

声明 ​

text
export declare function validateExecutionFrameworkEvent(input: unknown): ExecutionFrameworkEvent;

调用签名 ​

text
validateExecutionFrameworkEvent(input: unknown): ExecutionFrameworkEvent

参数 ​

参数类型必需说明
inputunknown是必需参数;接受的值由类型列定义。

返回值 ​

  • 类型: ExecutionFrameworkEvent
  • 说明: 返回值契约由上述类型定义。