Skip to content

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

模块用法

用于声明并运行时校验契约。Sandbox 模块公开 19 接口、1 类型。

从包入口导入

ts
import type {
  ExecutionEnvironmentSpec,
  ExecutionImageSpec,
  ExecutionLoggingPolicySpec,
  NetworkPolicySpec,
  ProcessPolicySpec,
  ResourceLimitSpec,
  SandboxCleanupRequest,
  SandboxCreateRequest,
} from '@codesoul-co/hypha-core';

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

使用要点

  • 20 个类型/接口用于应用代码、Adapter 或测试中的静态契约;请使用 import type,运行时不应依赖它们。

公共导出

Symbol种类签名说明
ExecutionEnvironmentSpec接口interface ExecutionEnvironmentSpec extends VersionedSpec, SpecMetadataExecution Environment Spec 接口,共包含 23 个公开字段或方法。
ExecutionImageSpec接口interface ExecutionImageSpecExecution Image Spec 接口,共包含 8 个公开字段或方法。
ExecutionLoggingPolicySpec接口interface ExecutionLoggingPolicySpecExecution Logging Policy Spec 接口,共包含 7 个公开字段或方法。
NetworkPolicySpec接口interface NetworkPolicySpecNetwork Policy Spec 接口,共包含 16 个公开字段或方法。
ProcessPolicySpec接口interface ProcessPolicySpecProcess Policy Spec 接口,共包含 17 个公开字段或方法。
ResourceLimitSpec接口interface ResourceLimitSpecResource Limit Spec 接口,共包含 19 个公开字段或方法。
SandboxCleanupRequest接口interface SandboxCleanupRequestSandbox Cleanup Request 接口,共包含 6 个公开字段或方法。
SandboxCreateRequest接口interface SandboxCreateRequestSandbox Create Request 接口,共包含 12 个公开字段或方法。
SandboxFilesystemPolicySpec接口interface SandboxFilesystemPolicySpecSandbox Filesystem Policy Spec 接口,共包含 10 个公开字段或方法。
SandboxLifecyclePolicySpec接口interface SandboxLifecyclePolicySpecSandbox Lifecycle Policy Spec 接口,共包含 12 个公开字段或方法。
SandboxMountSpec接口interface SandboxMountSpecSandbox Mount Spec 接口,共包含 8 个公开字段或方法。
SandboxProviderCapabilities接口interface SandboxProviderCapabilitiesSandbox Provider Capabilities 接口,共包含 12 个公开字段或方法。
SandboxRecord接口interface SandboxRecordSandbox Record 接口,共包含 26 个公开字段或方法。
SandboxSecurityPolicySpec接口interface SandboxSecurityPolicySpecSandbox Security Policy Spec 接口,共包含 20 个公开字段或方法。
SandboxStartRequest接口interface SandboxStartRequestSandbox Start Request 接口,共包含 5 个公开字段或方法。
SandboxStatusRequest接口interface SandboxStatusRequestSandbox Status Request 接口,共包含 2 个公开字段或方法。
SandboxTerminateRequest接口interface SandboxTerminateRequestSandbox Terminate Request 接口,共包含 6 个公开字段或方法。
SandboxTmpfsSpec接口interface SandboxTmpfsSpecSandbox Tmpfs Spec 接口,共包含 6 个公开字段或方法。
SecretInjectionPolicySpec接口interface SecretInjectionPolicySpecSecret Injection Policy Spec 接口,共包含 8 个公开字段或方法。
SandboxStatus类型type SandboxStatus = 'creating' | 'created' | 'starting' | 'ready' | 'busy' | 'stopping' | 'stopped' | 'terminating' | 'terminated' | 'cleaning' | 'cleaned' | 'failed'Sandbox Status 公共类型别名;完整类型表达式见声明。

ExecutionEnvironmentSpec

Execution Environment Spec 接口,共包含 23 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ExecutionEnvironmentSpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface ExecutionEnvironmentSpec extends VersionedSpec, SpecMetadata {
    revision?: string;
    provider: 'mock' | 'local_process' | 'docker' | 'remote_sandbox' | 'custom';
    providerRef?: string;
    image?: ExecutionImageSpec;
    process: ProcessPolicySpec;
    resources: ResourceLimitSpec;
    filesystem: SandboxFilesystemPolicySpec;
    network: NetworkPolicySpec;
    security: SandboxSecurityPolicySpec;
    secrets: SecretInjectionPolicySpec;
    logging: ExecutionLoggingPolicySpec;
    lifecycle: SandboxLifecyclePolicySpec;
    workingDirectoryPolicy: 'workspace_only' | 'configured_paths';
    defaultTimeoutMs: number;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
createdAt属性createdAt?: string公开属性;类型、只读和可选状态以签名列为准。
defaultTimeoutMs属性defaultTimeoutMs: number公开属性;类型、只读和可选状态以签名列为准。
description属性description?: string公开属性;类型、只读和可选状态以签名列为准。
filesystem属性filesystem: SandboxFilesystemPolicySpec公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
image属性image?: ExecutionImageSpec公开属性;类型、只读和可选状态以签名列为准。
lifecycle属性lifecycle: SandboxLifecyclePolicySpec公开属性;类型、只读和可选状态以签名列为准。
logging属性logging: ExecutionLoggingPolicySpec公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
name属性name?: string公开属性;类型、只读和可选状态以签名列为准。
network属性network: NetworkPolicySpec公开属性;类型、只读和可选状态以签名列为准。
owner属性owner?: string公开属性;类型、只读和可选状态以签名列为准。
process属性process: ProcessPolicySpec公开属性;类型、只读和可选状态以签名列为准。
provider属性provider: "mock" | "local_process" | "docker" | "remote_sandbox" | "custom"公开属性;类型、只读和可选状态以签名列为准。
providerRef属性providerRef?: string公开属性;类型、只读和可选状态以签名列为准。
resources属性resources: ResourceLimitSpec公开属性;类型、只读和可选状态以签名列为准。
revision属性revision?: string公开属性;类型、只读和可选状态以签名列为准。
secrets属性secrets: SecretInjectionPolicySpec公开属性;类型、只读和可选状态以签名列为准。
security属性security: SandboxSecurityPolicySpec公开属性;类型、只读和可选状态以签名列为准。
tags属性tags?: string[]公开属性;类型、只读和可选状态以签名列为准。
updatedAt属性updatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
version属性version: string公开属性;类型、只读和可选状态以签名列为准。
workingDirectoryPolicy属性workingDirectoryPolicy: "workspace_only" | "configured_paths"公开属性;类型、只读和可选状态以签名列为准。

ExecutionImageSpec

Execution Image Spec 接口,共包含 8 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ExecutionImageSpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface ExecutionImageSpec {
    reference: string;
    digest?: string;
    platform?: string;
    pullPolicy?: 'never' | 'if_not_present' | 'always';
    trustedRegistryRefs?: string[];
    requireDigestPin?: boolean;
    sbomRef?: string;
    signaturePolicyRef?: string;
}

契约成员

成员种类签名说明
digest属性digest?: string公开属性;类型、只读和可选状态以签名列为准。
platform属性platform?: string公开属性;类型、只读和可选状态以签名列为准。
pullPolicy属性pullPolicy?: "never" | "if_not_present" | "always"公开属性;类型、只读和可选状态以签名列为准。
reference属性reference: string公开属性;类型、只读和可选状态以签名列为准。
requireDigestPin属性requireDigestPin?: boolean公开属性;类型、只读和可选状态以签名列为准。
sbomRef属性sbomRef?: string公开属性;类型、只读和可选状态以签名列为准。
signaturePolicyRef属性signaturePolicyRef?: string公开属性;类型、只读和可选状态以签名列为准。
trustedRegistryRefs属性trustedRegistryRefs?: string[]公开属性;类型、只读和可选状态以签名列为准。

ExecutionLoggingPolicySpec

Execution Logging Policy Spec 接口,共包含 7 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ExecutionLoggingPolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface ExecutionLoggingPolicySpec {
    captureStdout: boolean;
    captureStderr: boolean;
    streamOutput?: boolean;
    includeTimestamps?: boolean;
    maxLineBytes?: number;
    redactPatterns?: string[];
    persistOutputAsArtifact?: boolean;
}

契约成员

成员种类签名说明
captureStderr属性captureStderr: boolean公开属性;类型、只读和可选状态以签名列为准。
captureStdout属性captureStdout: boolean公开属性;类型、只读和可选状态以签名列为准。
includeTimestamps属性includeTimestamps?: boolean公开属性;类型、只读和可选状态以签名列为准。
maxLineBytes属性maxLineBytes?: number公开属性;类型、只读和可选状态以签名列为准。
persistOutputAsArtifact属性persistOutputAsArtifact?: boolean公开属性;类型、只读和可选状态以签名列为准。
redactPatterns属性redactPatterns?: string[]公开属性;类型、只读和可选状态以签名列为准。
streamOutput属性streamOutput?: boolean公开属性;类型、只读和可选状态以签名列为准。

NetworkPolicySpec

Network Policy Spec 接口,共包含 16 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { NetworkPolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface NetworkPolicySpec {
    mode: 'disabled' | 'restricted' | 'enabled' | 'task_authorized';
    allowedDomains?: string[];
    deniedDomains?: string[];
    allowedCidrs?: string[];
    deniedCidrs?: string[];
    allowedPorts?: number[];
    allowedProtocols?: Array<'tcp' | 'udp' | 'http' | 'https' | 'dns'>;
    dnsPolicy?: 'disabled' | 'system' | 'managed';
    proxyRef?: string;
    blockPrivateNetworks?: boolean;
    blockMetadataEndpoints?: boolean;
    resolveAndPinDns?: boolean;
    taskAuthorizationTtlSeconds?: number;
    maxConnections?: number;
    maxBytesSent?: number;
    maxBytesReceived?: number;
}

契约成员

成员种类签名说明
allowedCidrs属性allowedCidrs?: string[]公开属性;类型、只读和可选状态以签名列为准。
allowedDomains属性allowedDomains?: string[]公开属性;类型、只读和可选状态以签名列为准。
allowedPorts属性allowedPorts?: number[]公开属性;类型、只读和可选状态以签名列为准。
allowedProtocols属性allowedProtocols?: ("tcp" | "udp" | "http" | "https" | "dns")[]公开属性;类型、只读和可选状态以签名列为准。
blockMetadataEndpoints属性blockMetadataEndpoints?: boolean公开属性;类型、只读和可选状态以签名列为准。
blockPrivateNetworks属性blockPrivateNetworks?: boolean公开属性;类型、只读和可选状态以签名列为准。
deniedCidrs属性deniedCidrs?: string[]公开属性;类型、只读和可选状态以签名列为准。
deniedDomains属性deniedDomains?: string[]公开属性;类型、只读和可选状态以签名列为准。
dnsPolicy属性dnsPolicy?: "system" | "managed" | "disabled"公开属性;类型、只读和可选状态以签名列为准。
maxBytesReceived属性maxBytesReceived?: number公开属性;类型、只读和可选状态以签名列为准。
maxBytesSent属性maxBytesSent?: number公开属性;类型、只读和可选状态以签名列为准。
maxConnections属性maxConnections?: number公开属性;类型、只读和可选状态以签名列为准。
mode属性mode: "disabled" | "restricted" | "enabled" | "task_authorized"公开属性;类型、只读和可选状态以签名列为准。
proxyRef属性proxyRef?: string公开属性;类型、只读和可选状态以签名列为准。
resolveAndPinDns属性resolveAndPinDns?: boolean公开属性;类型、只读和可选状态以签名列为准。
taskAuthorizationTtlSeconds属性taskAuthorizationTtlSeconds?: number公开属性;类型、只读和可选状态以签名列为准。

ProcessPolicySpec

Process Policy Spec 接口,共包含 17 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ProcessPolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface ProcessPolicySpec {
    shellEnabled: boolean;
    allowedShells?: string[];
    allowedExecutables?: string[];
    deniedExecutables?: string[];
    executableResolution: 'absolute_allowlist' | 'path_allowlist' | 'container_path';
    maxProcesses?: number;
    maxThreads?: number;
    maxOpenFiles?: number;
    allowBackgroundProcesses?: boolean;
    allowDaemonization?: boolean;
    killProcessTreeOnExit: boolean;
    environmentAllowList?: string[];
    environmentDenyList?: string[];
    inheritHostEnvironment?: boolean;
    defaultUmask?: string;
    locale?: string;
    timezone?: string;
}

契约成员

成员种类签名说明
allowBackgroundProcesses属性allowBackgroundProcesses?: boolean公开属性;类型、只读和可选状态以签名列为准。
allowDaemonization属性allowDaemonization?: boolean公开属性;类型、只读和可选状态以签名列为准。
allowedExecutables属性allowedExecutables?: string[]公开属性;类型、只读和可选状态以签名列为准。
allowedShells属性allowedShells?: string[]公开属性;类型、只读和可选状态以签名列为准。
defaultUmask属性defaultUmask?: string公开属性;类型、只读和可选状态以签名列为准。
deniedExecutables属性deniedExecutables?: string[]公开属性;类型、只读和可选状态以签名列为准。
environmentAllowList属性environmentAllowList?: string[]公开属性;类型、只读和可选状态以签名列为准。
environmentDenyList属性environmentDenyList?: string[]公开属性;类型、只读和可选状态以签名列为准。
executableResolution属性executableResolution: "absolute_allowlist" | "path_allowlist" | "container_path"公开属性;类型、只读和可选状态以签名列为准。
inheritHostEnvironment属性inheritHostEnvironment?: boolean公开属性;类型、只读和可选状态以签名列为准。
killProcessTreeOnExit属性killProcessTreeOnExit: boolean公开属性;类型、只读和可选状态以签名列为准。
locale属性locale?: string公开属性;类型、只读和可选状态以签名列为准。
maxOpenFiles属性maxOpenFiles?: number公开属性;类型、只读和可选状态以签名列为准。
maxProcesses属性maxProcesses?: number公开属性;类型、只读和可选状态以签名列为准。
maxThreads属性maxThreads?: number公开属性;类型、只读和可选状态以签名列为准。
shellEnabled属性shellEnabled: boolean公开属性;类型、只读和可选状态以签名列为准。
timezone属性timezone?: string公开属性;类型、只读和可选状态以签名列为准。

ResourceLimitSpec

Resource Limit Spec 接口,共包含 19 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { ResourceLimitSpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface ResourceLimitSpec {
    cpuCores?: number;
    cpuQuotaMicros?: number;
    cpuPeriodMicros?: number;
    cpuShares?: number;
    maxCpuSeconds?: number;
    memoryMb?: number;
    memorySwapMb?: number;
    oomKillDisable?: boolean;
    diskBytes?: number;
    tempBytes?: number;
    maxWriteBytes?: number;
    blockIoWeight?: number;
    pidsLimit?: number;
    maxOpenFiles?: number;
    maxStdoutBytes?: number;
    maxStderrBytes?: number;
    maxCombinedOutputBytes?: number;
    maxExecutionSeconds?: number;
    maxIdleSeconds?: number;
}

契约成员

成员种类签名说明
blockIoWeight属性blockIoWeight?: number公开属性;类型、只读和可选状态以签名列为准。
cpuCores属性cpuCores?: number公开属性;类型、只读和可选状态以签名列为准。
cpuPeriodMicros属性cpuPeriodMicros?: number公开属性;类型、只读和可选状态以签名列为准。
cpuQuotaMicros属性cpuQuotaMicros?: number公开属性;类型、只读和可选状态以签名列为准。
cpuShares属性cpuShares?: number公开属性;类型、只读和可选状态以签名列为准。
diskBytes属性diskBytes?: number公开属性;类型、只读和可选状态以签名列为准。
maxCombinedOutputBytes属性maxCombinedOutputBytes?: number公开属性;类型、只读和可选状态以签名列为准。
maxCpuSeconds属性maxCpuSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
maxExecutionSeconds属性maxExecutionSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
maxIdleSeconds属性maxIdleSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
maxOpenFiles属性maxOpenFiles?: number公开属性;类型、只读和可选状态以签名列为准。
maxStderrBytes属性maxStderrBytes?: number公开属性;类型、只读和可选状态以签名列为准。
maxStdoutBytes属性maxStdoutBytes?: number公开属性;类型、只读和可选状态以签名列为准。
maxWriteBytes属性maxWriteBytes?: number公开属性;类型、只读和可选状态以签名列为准。
memoryMb属性memoryMb?: number公开属性;类型、只读和可选状态以签名列为准。
memorySwapMb属性memorySwapMb?: number公开属性;类型、只读和可选状态以签名列为准。
oomKillDisable属性oomKillDisable?: boolean公开属性;类型、只读和可选状态以签名列为准。
pidsLimit属性pidsLimit?: number公开属性;类型、只读和可选状态以签名列为准。
tempBytes属性tempBytes?: number公开属性;类型、只读和可选状态以签名列为准。

SandboxCleanupRequest

Sandbox Cleanup Request 接口,共包含 6 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxCleanupRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxCleanupRequest {
    operationId: string;
    sandboxId: string;
    principal: ExecutionPrincipal;
    expectedRevision: number;
    reason?: string;
    idempotencyKey?: string;
}

契约成员

成员种类签名说明
expectedRevision属性expectedRevision: number公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ExecutionPrincipal公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
sandboxId属性sandboxId: string公开属性;类型、只读和可选状态以签名列为准。

SandboxCreateRequest

Sandbox Create Request 接口,共包含 12 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxCreateRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxCreateRequest {
    operationId: string;
    principal: ExecutionPrincipal;
    environment: ExecutionEnvironmentSpec;
    environmentRevision: string;
    userId: string;
    tenantId?: string;
    workspaceId: string;
    sessionId?: string;
    runId: string;
    agentId?: string;
    idempotencyKey?: string;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
agentId属性agentId?: string公开属性;类型、只读和可选状态以签名列为准。
environment属性environment: ExecutionEnvironmentSpec公开属性;类型、只读和可选状态以签名列为准。
environmentRevision属性environmentRevision: string公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ExecutionPrincipal公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
sessionId属性sessionId?: string公开属性;类型、只读和可选状态以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。
userId属性userId: string公开属性;类型、只读和可选状态以签名列为准。
workspaceId属性workspaceId: string公开属性;类型、只读和可选状态以签名列为准。

SandboxFilesystemPolicySpec

Sandbox Filesystem Policy Spec 接口,共包含 10 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxFilesystemPolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxFilesystemPolicySpec {
    rootFilesystem: 'read_only' | 'writable';
    mounts: SandboxMountSpec[];
    tmpfs?: SandboxTmpfsSpec[];
    maskPaths?: string[];
    readonlyPaths?: string[];
    writablePaths?: string[];
    allowDeviceAccess?: boolean;
    allowedDevices?: string[];
    allowHostPathMounts?: boolean;
    maxMounts?: number;
}

契约成员

成员种类签名说明
allowDeviceAccess属性allowDeviceAccess?: boolean公开属性;类型、只读和可选状态以签名列为准。
allowedDevices属性allowedDevices?: string[]公开属性;类型、只读和可选状态以签名列为准。
allowHostPathMounts属性allowHostPathMounts?: boolean公开属性;类型、只读和可选状态以签名列为准。
maskPaths属性maskPaths?: string[]公开属性;类型、只读和可选状态以签名列为准。
maxMounts属性maxMounts?: number公开属性;类型、只读和可选状态以签名列为准。
mounts属性mounts: SandboxMountSpec[]公开属性;类型、只读和可选状态以签名列为准。
readonlyPaths属性readonlyPaths?: string[]公开属性;类型、只读和可选状态以签名列为准。
rootFilesystem属性rootFilesystem: "read_only" | "writable"公开属性;类型、只读和可选状态以签名列为准。
tmpfs属性tmpfs?: SandboxTmpfsSpec[]公开属性;类型、只读和可选状态以签名列为准。
writablePaths属性writablePaths?: string[]公开属性;类型、只读和可选状态以签名列为准。

SandboxLifecyclePolicySpec

Sandbox Lifecycle Policy Spec 接口,共包含 12 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxLifecyclePolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxLifecyclePolicySpec {
    reuse: 'never' | 'run' | 'session' | 'pool';
    idleTtlSeconds?: number;
    maxLifetimeSeconds?: number;
    maxExecutions?: number;
    createTimeoutMs?: number;
    startTimeoutMs?: number;
    stopTimeoutMs?: number;
    cleanupTimeoutMs?: number;
    snapshotOnFailure?: boolean;
    cleanupOnSuccess?: boolean;
    cleanupOnFailure?: boolean;
    retainForDebugSeconds?: number;
}

契约成员

成员种类签名说明
cleanupOnFailure属性cleanupOnFailure?: boolean公开属性;类型、只读和可选状态以签名列为准。
cleanupOnSuccess属性cleanupOnSuccess?: boolean公开属性;类型、只读和可选状态以签名列为准。
cleanupTimeoutMs属性cleanupTimeoutMs?: number公开属性;类型、只读和可选状态以签名列为准。
createTimeoutMs属性createTimeoutMs?: number公开属性;类型、只读和可选状态以签名列为准。
idleTtlSeconds属性idleTtlSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
maxExecutions属性maxExecutions?: number公开属性;类型、只读和可选状态以签名列为准。
maxLifetimeSeconds属性maxLifetimeSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
retainForDebugSeconds属性retainForDebugSeconds?: number公开属性;类型、只读和可选状态以签名列为准。
reuse属性reuse: "session" | "run" | "never" | "pool"公开属性;类型、只读和可选状态以签名列为准。
snapshotOnFailure属性snapshotOnFailure?: boolean公开属性;类型、只读和可选状态以签名列为准。
startTimeoutMs属性startTimeoutMs?: number公开属性;类型、只读和可选状态以签名列为准。
stopTimeoutMs属性stopTimeoutMs?: number公开属性;类型、只读和可选状态以签名列为准。

SandboxMountSpec

Sandbox Mount Spec 接口,共包含 8 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxMountSpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxMountSpec {
    sourceRef: string;
    targetPath: string;
    mode: 'ro' | 'rw';
    type: 'bind' | 'volume' | 'artifact' | 'workspace' | 'tmpfs';
    propagation?: 'private' | 'rprivate';
    noExec?: boolean;
    noSuid?: boolean;
    noDev?: boolean;
}

契约成员

成员种类签名说明
mode属性mode: "ro" | "rw"公开属性;类型、只读和可选状态以签名列为准。
noDev属性noDev?: boolean公开属性;类型、只读和可选状态以签名列为准。
noExec属性noExec?: boolean公开属性;类型、只读和可选状态以签名列为准。
noSuid属性noSuid?: boolean公开属性;类型、只读和可选状态以签名列为准。
propagation属性propagation?: "private" | "rprivate"公开属性;类型、只读和可选状态以签名列为准。
sourceRef属性sourceRef: string公开属性;类型、只读和可选状态以签名列为准。
targetPath属性targetPath: string公开属性;类型、只读和可选状态以签名列为准。
type属性type: "artifact" | "workspace" | "bind" | "volume" | "tmpfs"公开属性;类型、只读和可选状态以签名列为准。

SandboxProviderCapabilities

Sandbox Provider Capabilities 接口,共包含 12 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxProviderCapabilities } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxProviderCapabilities {
    processIsolation: boolean;
    filesystemIsolation: boolean;
    networkIsolation: boolean;
    cpuLimits: boolean;
    memoryLimits: boolean;
    diskLimits: boolean;
    pidsLimit: boolean;
    cancellation: boolean;
    processTreeKill: boolean;
    snapshots: boolean;
    imageDigestPinning: boolean;
    remoteExecution: boolean;
}

契约成员

成员种类签名说明
cancellation属性cancellation: boolean公开属性;类型、只读和可选状态以签名列为准。
cpuLimits属性cpuLimits: boolean公开属性;类型、只读和可选状态以签名列为准。
diskLimits属性diskLimits: boolean公开属性;类型、只读和可选状态以签名列为准。
filesystemIsolation属性filesystemIsolation: boolean公开属性;类型、只读和可选状态以签名列为准。
imageDigestPinning属性imageDigestPinning: boolean公开属性;类型、只读和可选状态以签名列为准。
memoryLimits属性memoryLimits: boolean公开属性;类型、只读和可选状态以签名列为准。
networkIsolation属性networkIsolation: boolean公开属性;类型、只读和可选状态以签名列为准。
pidsLimit属性pidsLimit: boolean公开属性;类型、只读和可选状态以签名列为准。
processIsolation属性processIsolation: boolean公开属性;类型、只读和可选状态以签名列为准。
processTreeKill属性processTreeKill: boolean公开属性;类型、只读和可选状态以签名列为准。
remoteExecution属性remoteExecution: boolean公开属性;类型、只读和可选状态以签名列为准。
snapshots属性snapshots: boolean公开属性;类型、只读和可选状态以签名列为准。

SandboxRecord

Sandbox Record 接口,共包含 26 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxRecord } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxRecord {
    id: string;
    revision: number;
    providerId: string;
    environmentRef: SpecRef;
    environmentRevision: string;
    tenantId?: string;
    userId: string;
    workspaceId: string;
    sessionId?: string;
    runId: string;
    agentId?: string;
    status: SandboxStatus;
    providerSandboxRef?: string;
    imageDigest?: string;
    activeExecutionIds: string[];
    resourceLimits: ResourceLimitSpec;
    networkPolicyHash: string;
    mountPolicyHash: string;
    createdAt: string;
    readyAt?: string;
    lastUsedAt?: string;
    expiresAt?: string;
    terminatedAt?: string;
    cleanedAt?: string;
    error?: NormalizedExecutionError;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
activeExecutionIds属性activeExecutionIds: string[]公开属性;类型、只读和可选状态以签名列为准。
agentId属性agentId?: string公开属性;类型、只读和可选状态以签名列为准。
cleanedAt属性cleanedAt?: string公开属性;类型、只读和可选状态以签名列为准。
createdAt属性createdAt: string公开属性;类型、只读和可选状态以签名列为准。
environmentRef属性environmentRef: SpecRef公开属性;类型、只读和可选状态以签名列为准。
environmentRevision属性environmentRevision: string公开属性;类型、只读和可选状态以签名列为准。
error属性error?: NormalizedExecutionError公开属性;类型、只读和可选状态以签名列为准。
expiresAt属性expiresAt?: string公开属性;类型、只读和可选状态以签名列为准。
id属性id: string公开属性;类型、只读和可选状态以签名列为准。
imageDigest属性imageDigest?: string公开属性;类型、只读和可选状态以签名列为准。
lastUsedAt属性lastUsedAt?: string公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
mountPolicyHash属性mountPolicyHash: string公开属性;类型、只读和可选状态以签名列为准。
networkPolicyHash属性networkPolicyHash: string公开属性;类型、只读和可选状态以签名列为准。
providerId属性providerId: string公开属性;类型、只读和可选状态以签名列为准。
providerSandboxRef属性providerSandboxRef?: string公开属性;类型、只读和可选状态以签名列为准。
readyAt属性readyAt?: string公开属性;类型、只读和可选状态以签名列为准。
resourceLimits属性resourceLimits: ResourceLimitSpec公开属性;类型、只读和可选状态以签名列为准。
revision属性revision: number公开属性;类型、只读和可选状态以签名列为准。
runId属性runId: string公开属性;类型、只读和可选状态以签名列为准。
sessionId属性sessionId?: string公开属性;类型、只读和可选状态以签名列为准。
status属性status: SandboxStatus公开属性;类型、只读和可选状态以签名列为准。
tenantId属性tenantId?: string公开属性;类型、只读和可选状态以签名列为准。
terminatedAt属性terminatedAt?: string公开属性;类型、只读和可选状态以签名列为准。
userId属性userId: string公开属性;类型、只读和可选状态以签名列为准。
workspaceId属性workspaceId: string公开属性;类型、只读和可选状态以签名列为准。

SandboxSecurityPolicySpec

Sandbox Security Policy Spec 接口,共包含 20 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxSecurityPolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxSecurityPolicySpec {
    runAsUser?: string;
    runAsGroup?: string;
    nonRootRequired: boolean;
    noNewPrivileges: boolean;
    privileged: boolean;
    dropCapabilities?: string[];
    addCapabilities?: string[];
    seccompProfileRef?: string;
    appArmorProfileRef?: string;
    selinuxLabelRef?: string;
    userNamespace?: boolean;
    pidNamespace?: boolean;
    networkNamespace?: boolean;
    ipcNamespace?: boolean;
    utsNamespace?: boolean;
    readOnlyProc?: boolean;
    maskHostProc?: boolean;
    preventPtrace?: boolean;
    allowNestedContainers?: boolean;
    metadata?: Record<string, unknown>;
}

契约成员

成员种类签名说明
addCapabilities属性addCapabilities?: string[]公开属性;类型、只读和可选状态以签名列为准。
allowNestedContainers属性allowNestedContainers?: boolean公开属性;类型、只读和可选状态以签名列为准。
appArmorProfileRef属性appArmorProfileRef?: string公开属性;类型、只读和可选状态以签名列为准。
dropCapabilities属性dropCapabilities?: string[]公开属性;类型、只读和可选状态以签名列为准。
ipcNamespace属性ipcNamespace?: boolean公开属性;类型、只读和可选状态以签名列为准。
maskHostProc属性maskHostProc?: boolean公开属性;类型、只读和可选状态以签名列为准。
metadata属性metadata?: Record<string, unknown>公开属性;类型、只读和可选状态以签名列为准。
networkNamespace属性networkNamespace?: boolean公开属性;类型、只读和可选状态以签名列为准。
noNewPrivileges属性noNewPrivileges: boolean公开属性;类型、只读和可选状态以签名列为准。
nonRootRequired属性nonRootRequired: boolean公开属性;类型、只读和可选状态以签名列为准。
pidNamespace属性pidNamespace?: boolean公开属性;类型、只读和可选状态以签名列为准。
preventPtrace属性preventPtrace?: boolean公开属性;类型、只读和可选状态以签名列为准。
privileged属性privileged: boolean公开属性;类型、只读和可选状态以签名列为准。
readOnlyProc属性readOnlyProc?: boolean公开属性;类型、只读和可选状态以签名列为准。
runAsGroup属性runAsGroup?: string公开属性;类型、只读和可选状态以签名列为准。
runAsUser属性runAsUser?: string公开属性;类型、只读和可选状态以签名列为准。
seccompProfileRef属性seccompProfileRef?: string公开属性;类型、只读和可选状态以签名列为准。
selinuxLabelRef属性selinuxLabelRef?: string公开属性;类型、只读和可选状态以签名列为准。
userNamespace属性userNamespace?: boolean公开属性;类型、只读和可选状态以签名列为准。
utsNamespace属性utsNamespace?: boolean公开属性;类型、只读和可选状态以签名列为准。

SandboxStartRequest

Sandbox Start Request 接口,共包含 5 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxStartRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxStartRequest {
    operationId: string;
    sandboxId: string;
    principal: ExecutionPrincipal;
    expectedRevision: number;
    idempotencyKey?: string;
}

契约成员

成员种类签名说明
expectedRevision属性expectedRevision: number公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ExecutionPrincipal公开属性;类型、只读和可选状态以签名列为准。
sandboxId属性sandboxId: string公开属性;类型、只读和可选状态以签名列为准。

SandboxStatusRequest

Sandbox Status Request 接口,共包含 2 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxStatusRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxStatusRequest {
    sandboxId: string;
    principal: ExecutionPrincipal;
}

契约成员

成员种类签名说明
principal属性principal: ExecutionPrincipal公开属性;类型、只读和可选状态以签名列为准。
sandboxId属性sandboxId: string公开属性;类型、只读和可选状态以签名列为准。

SandboxTerminateRequest

Sandbox Terminate Request 接口,共包含 6 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxTerminateRequest } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxTerminateRequest {
    operationId: string;
    sandboxId: string;
    principal: ExecutionPrincipal;
    expectedRevision: number;
    reason?: string;
    idempotencyKey?: string;
}

契约成员

成员种类签名说明
expectedRevision属性expectedRevision: number公开属性;类型、只读和可选状态以签名列为准。
idempotencyKey属性idempotencyKey?: string公开属性;类型、只读和可选状态以签名列为准。
operationId属性operationId: string公开属性;类型、只读和可选状态以签名列为准。
principal属性principal: ExecutionPrincipal公开属性;类型、只读和可选状态以签名列为准。
reason属性reason?: string公开属性;类型、只读和可选状态以签名列为准。
sandboxId属性sandboxId: string公开属性;类型、只读和可选状态以签名列为准。

SandboxTmpfsSpec

Sandbox Tmpfs Spec 接口,共包含 6 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SandboxTmpfsSpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SandboxTmpfsSpec {
    targetPath: string;
    sizeBytes?: number;
    mode?: number;
    noExec?: boolean;
    noSuid?: boolean;
    noDev?: boolean;
}

契约成员

成员种类签名说明
mode属性mode?: number公开属性;类型、只读和可选状态以签名列为准。
noDev属性noDev?: boolean公开属性;类型、只读和可选状态以签名列为准。
noExec属性noExec?: boolean公开属性;类型、只读和可选状态以签名列为准。
noSuid属性noSuid?: boolean公开属性;类型、只读和可选状态以签名列为准。
sizeBytes属性sizeBytes?: number公开属性;类型、只读和可选状态以签名列为准。
targetPath属性targetPath: string公开属性;类型、只读和可选状态以签名列为准。

SecretInjectionPolicySpec

Secret Injection Policy Spec 接口,共包含 8 个公开字段或方法。

  • 种类: 接口
  • 导入: import type { SecretInjectionPolicySpec } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export interface SecretInjectionPolicySpec {
    allowedSecretRefs?: string[];
    injectionMode: 'none' | 'environment' | 'file' | 'brokered';
    exposeNamesOnly?: boolean;
    redactFromOutput: boolean;
    redactFromEvents: boolean;
    ttlSeconds?: number;
    revokeOnExecutionEnd?: boolean;
    allowChildProcessInheritance?: boolean;
}

契约成员

成员种类签名说明
allowChildProcessInheritance属性allowChildProcessInheritance?: boolean公开属性;类型、只读和可选状态以签名列为准。
allowedSecretRefs属性allowedSecretRefs?: string[]公开属性;类型、只读和可选状态以签名列为准。
exposeNamesOnly属性exposeNamesOnly?: boolean公开属性;类型、只读和可选状态以签名列为准。
injectionMode属性injectionMode: "none" | "environment" | "file" | "brokered"公开属性;类型、只读和可选状态以签名列为准。
redactFromEvents属性redactFromEvents: boolean公开属性;类型、只读和可选状态以签名列为准。
redactFromOutput属性redactFromOutput: boolean公开属性;类型、只读和可选状态以签名列为准。
revokeOnExecutionEnd属性revokeOnExecutionEnd?: boolean公开属性;类型、只读和可选状态以签名列为准。
ttlSeconds属性ttlSeconds?: number公开属性;类型、只读和可选状态以签名列为准。

SandboxStatus

Sandbox Status 公共类型别名;完整类型表达式见声明。

  • 种类: 类型
  • 导入: import type { SandboxStatus } from '@codesoul-co/hypha-core';
  • 源码模块: contracts/sandbox

声明

text
export type SandboxStatus = 'creating' | 'created' | 'starting' | 'ready' | 'busy' | 'stopping' | 'stopped' | 'terminating' | 'terminated' | 'cleaning' | 'cleaned' | 'failed';