文档Harness SDK

BEEOS CLOUD / DEVELOPER REFERENCE

附录:类型与枚举

Harness SDK 的全部共享类型结构与枚举

附录收录前面各页引用的全部共享类型结构与枚举。对象和联合类型可从字段表的类型列跳转到这里;每个类型与枚举都有稳定锚点(标题的小写形式)。

枚举

MSConnectionStatus

TypeScript

harness 与 Cloud 之间实时连接的状态。harness 在心跳中上报。

取值含义
unknown状态未知。
connectingharness 正在连接。
connected连接已建立。
reconnecting连接已断开,harness 正在重连。
disconnected连接已关闭。
failed连接失败。

RuntimeCapability

TypeScript

harness 可在注册中声明的能力。

取值含义
transport从 Cloud 接收运行时方法。
agents.lifecycle创建、更新和删除智能体。
skills管理智能体的技能。
models列出可用的模型。
cron管理定时任务。
mcp管理 MCP 服务器。
conversation.control控制会话:提示、取消、清除、模式与模型。
terminal提供终端。
canvas提供画布。
subagents运行子智能体。

RuntimeChatConnectionState

TypeScript

聊天客户端实时连接的状态。

取值含义
connected连接已建立。
connecting客户端正在连接。
disconnected连接已关闭。
failed连接失败。

RuntimeMethod

TypeScript 与 Python

Cloud 可能投递给 harness 的运行时方法。每条用户聊天提示都以 session/prompt 到达。

取值常量名含义
agent/createAGENT_CREATE创建智能体(能力 agents.lifecycle)。
agent/updateAGENT_UPDATE更新智能体(能力 agents.lifecycle)。
agent/deleteAGENT_DELETE删除智能体(能力 agents.lifecycle)。
agent/applyTemplateAGENT_APPLY_TEMPLATE把模板应用到智能体(能力 agents.lifecycle)。
skills/listSKILLS_LIST列出智能体的技能(能力 skills)。
skills/installSKILLS_INSTALL安装技能(能力 skills)。
skills/updateSKILLS_UPDATE启用或停用技能(能力 skills)。
skills/uninstallSKILLS_UNINSTALL卸载技能(能力 skills)。
models/listMODELS_LIST列出可用的模型(能力 models)。
cron/listCRON_LIST列出智能体的定时任务(能力 cron)。
cron/statusCRON_STATUS读取调度器的状态(能力 cron)。
cron/addCRON_ADD添加定时任务(能力 cron)。
cron/updateCRON_UPDATE更新定时任务(能力 cron)。
cron/removeCRON_REMOVE移除定时任务(能力 cron)。
cron/runCRON_RUN立即运行一个定时任务(能力 cron)。
cron/runsCRON_RUNS列出定时任务的运行记录(能力 cron)。
mcp/listMCP_LIST列出 MCP 服务器(能力 mcp)。
mcp/prepareMCP_PREPARE准备 MCP 服务器配置(能力 mcp)。
mcp/setMCP_SET设置 MCP 服务器(能力 mcp)。
mcp/unsetMCP_UNSET移除 MCP 服务器(能力 mcp)。
session/set_modeSESSION_SET_MODE设置会话的模式(能力 conversation.control)。
session/set_modelSESSION_SET_MODEL设置会话的模型(能力 conversation.control)。
session/clearSESSION_CLEAR清除会话的历史(能力 conversation.control)。
session/cancelSESSION_CANCEL取消会话中正在运行的提示(能力 conversation.control)。
session/promptSESSION_PROMPT投递一条用户聊天提示(能力 conversation.control)。每条聊天提示都以此方法到达。
canvas/toggleCANVAS_TOGGLE切换画布的显示(能力 canvas)。
canvas/clearCANVAS_CLEAR清空画布(能力 canvas)。
canvas/referenceCANVAS_REFERENCE画布方法 canvas/reference(能力 canvas)。
canvas/dimensionsCANVAS_DIMENSIONS画布方法 canvas/dimensions(能力 canvas)。

结构

AgentGatewayClientOptions

TypeScript · 仅 TypeScript

Agent Gateway 客户端的选项。

字段类型必填说明
baseUrlstring是Agent Gateway 的基础 URL。
identityAgentRequestIdentity是为每个请求签名的身份。
retry?BackoffPolicy | false否幂等调用的默认重试策略;false 表示关闭。默认 TRANSIENT_BACKOFF。
onRetry?(info: { method: string; path: string; attempt: number; delayMs: number; error: unknown }) => void否每次重试前调用,参数为方法、路径、第几次尝试、延迟(毫秒)和错误。

AgentKeyPair

TypeScript 与 Python

harness 实例的原始 Ed25519 密钥材料(32 字节公钥 + 32 字节种子)。

字段类型必填说明
publicKey / public_keyUint8Array / bytes是原始的 32 字节 Ed25519 公钥。
privateKey / private_keyUint8Array / bytes是32 字节的 Ed25519 种子(私钥)。

AnyRuntimeExecutionGrantClaims

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

执行授权的声明。具体结构取决于该授权所允许的方法。

可选形态

#类型
1{ [TMethod in ServiceRuntimeMethod]: RuntimeExecutionGrantClaims<TMethod>; }[ServiceRuntimeMethod]
2{ [TMethod in keyof ConversationRuntimeInvocationResultMap]: ConversationRuntimeExecutionGrantClaims<TMethod>; }[keyof ConversationRuntimeInvocationResultMap]
3{ [TMethod in keyof InstanceRuntimeInvocationResultMap]: InstanceRuntimeExecutionGrantClaims<TMethod>; }[keyof InstanceRuntimeInvocationResultMap]

BackoffPolicy

TypeScript 与 Python

重试的退避计划:尝试次数上限、延迟和总预算。

字段类型必填说明
readonly maxAttempts / max_attemptsnumber / float是总尝试次数(含第一次)。Infinity 表示一直重试,直到用完 budgetMs 或 signal 中止。
readonly initialDelayMs / initial_delay_msnumber / int是第二次尝试之前的延迟,单位毫秒。
readonly maxDelayMs / max_delay_msnumber / int是单次延迟的上限,单位毫秒。
readonly factornumber / float是每次尝试后延迟所乘的系数。
readonly budgetMs? / budget_msnumber / int | None否总的挂钟时间预算;最后一次尝试可以在预算用尽之前开始,但不会在之后开始。

Base64Url

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

base64url 编码的字符串(字符为 A–Z a–z 0–9 - _)。

type Base64Url = string

CanvasRelayClientOptions

TypeScript · 仅 TypeScript

画布中继客户端的选项。

字段类型必填说明
relayUrlstring是画布令牌中的中继 URL。
keysAgentKeyPair是harness 实例的 Ed25519 密钥对。
agentId?string否写入连接查询串的智能体 ID,可选。
token?string否写入连接查询串的画布令牌,可选。
socketFactory?(url: string, headers: Record<string, string>) => CanvasRelaySocket否创建 WebSocket 的函数。测试时可替换,默认使用 ws。

CanvasRelayConnect

Python · 仅 Python

画布中继的连接描述:固定路径和可选的查询值。

字段类型必填说明
pathLiteral['/ws/agent']是始终为 /ws/agent。
agentIdQueryNotRequired[str]是查询参数 agentId 的值。
tokenQueryNotRequired[str]是查询参数 token 的值。

CentrifugeRealtimePortOptions

TypeScript · 仅 TypeScript

Centrifuge 实时端口的选项。

字段类型必填说明
factory?CentrifugeRealtimeFactory否创建 Centrifuge 客户端的函数,测试时可替换。

ConversationHistoryGeneration

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

会话历史的代数,十进制字符串。

type ConversationHistoryGeneration = DecimalUInt64

ConversationRuntimeBoundaryFinishRequest

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

向历史边界报告一次运行结束的请求。

字段类型必填说明
activeRunRegistrationIdstring是已结束运行的注册 ID。
operationIdOperationId是操作的标识。
requestMessageIdRuntimeControlMessageId是承载该请求的消息的标识。
conversationIdPlatformConversationId是会话的标识。
historyGenerationConversationHistoryGeneration是会话历史的代数(generation)。历史被清除时会变化。
runtimeRunIdstring是运行在 harness 中的标识。
terminalState"completed" | "failed" | "cancelled"是运行的结束方式:completed、failed 或 cancelled。
source"runtime" | "recovery"是由谁报告结束:runtime 表示正常结束,recovery 表示在恢复过程中报告。
leaseRuntimeBoundaryLeaseAuthority是上报结束的 harness 的租约凭据。

ConversationRuntimeBoundaryStartRequest

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

向历史边界报告一次运行开始的请求。

字段类型必填说明
operationIdOperationId是操作的标识。
requestMessageIdRuntimeControlMessageId是承载该请求的消息的标识。
conversationIdPlatformConversationId是会话的标识。
historyGenerationConversationHistoryGeneration是会话历史的代数(generation)。历史被清除时会变化。
runtimeRunIdstring是运行在 harness 中的标识。
leaseRuntimeBoundaryLeaseAuthority是上报开始的 harness 的租约凭据。

CoreExecutionAuthorization

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

授权一次执行的一对已签名文档:授权(grant)和边界断言(boundary assertion)。

字段类型必填说明
grantRuntimeExecutionGrantEnvelope是执行授权。
boundaryRuntimeExecutionBoundaryAssertion是执行边界断言。

DecimalUInt64

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

规范形式的无符号 uint64 十进制数(字符串)。

type DecimalUInt64 = `${bigint}`

GatewayA2aRpcResult

TypeScript · 仅 TypeScript

一次智能体间 JSON-RPC 调用的结果。

字段类型必填说明
okboolean是HTTP 状态为成功时为 true。
statusnumber是应答的 HTTP 状态码。
bodystring是原始响应体。
rpcRecord<string, unknown>是按 JSON-RPC 对象解析后的响应体。

GatewayBridgeConfig

TypeScript · 仅 TypeScript

Agent Gateway 返回的终端桥接位置。

字段类型必填说明
urlstring是终端桥接的 URL。
region?string否桥接所在区域;Agent Gateway 给出时才有。

GatewayCanvasToken

TypeScript · 仅 TypeScript

画布令牌及其所属的中继。

字段类型必填说明
tokenstring是画布令牌。
relayUrlstring是画布中继的 URL。
expiresAtnumber是令牌的过期时间(Unix 时间戳)。

GatewayFileRef

TypeScript · 仅 TypeScript

对挂在智能体上的文件的引用。

字段类型必填说明
fileIdstring是文件的标识。
fileNamestring是文件名。
mimeType?string否文件的 MIME 类型。
size?number否大小,单位字节。
source?string否文件的来源。

GatewayFileResolve

TypeScript · 仅 TypeScript

解析文件 ID 时返回的文件详情。

字段类型必填说明
fileId?string否文件的标识。
fileName?string否文件名。
mimeType?string否文件的 MIME 类型。
size?number否大小,单位字节。
downloadUrl?string否可下载该文件的 URL。
[key: string]unknown是Agent Gateway 返回的其他字段。

GatewayPresign

TypeScript · 仅 TypeScript

新文件的上传位置。

字段类型必填说明
fileIdstring是新文件的标识。上传完成后传给确认调用。
uploadUrlstring是文件内容需要上传到的 URL。

GatewayRequestInit

TypeScript · 仅 TypeScript

Agent Gateway 请求的单次调用选项,基于标准的 RequestInit。

继承: Omit<RequestInit, "body">

字段类型必填说明
body?string | Uint8Array否请求体。
retry?BackoffPolicy | false否覆盖客户端默认值;false 表示本次调用不重试。
idempotent?boolean否允许重试 Agent Gateway 会去重的非 GET 调用。

GatewayUploadedFile

TypeScript · 仅 TypeScript

文件上传完成后的结果。

字段类型必填说明
fileIdstring是文件的标识。
uristring是已上传文件的 URI。
fileNamestring是文件名。
mimeTypestring是文件的 MIME 类型。

HistoryBoundaryAction

TypeScript · 仅 TypeScript

历史边界动作的名称:prepare、resetting、reset_done、commit、abort 或 reconcile。

type HistoryBoundaryAction = keyof typeof HISTORY_BOUNDARY_OPERATIONS

JsonValue

TypeScript · 仅 TypeScript

任意 JSON 值:null、布尔、数字、字符串、数组或对象。

可选形态

#类型
1null
2boolean
3number
4string
5JsonValue[]
6{ [key: string]: JsonValue }

可选形态 6

字段类型必填说明
[key: string]JsonValue是对象的各个值,按键索引。

MessageServiceMessageId

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

Message Service 中调用方或运行时使用的幂等键;不透明、长度有限,且不是平台 UUID。

type MessageServiceMessageId = string

OperationId

TypeScript · 仅 TypeScript

操作的标识:HARNESS_OPERATIONS 的键。

type OperationId = keyof typeof OPERATIONS

OperationPathParams

TypeScript · 仅 TypeScript

每个操作的路径参数,按操作 ID 索引。

字段类型必填说明
runtimeRegisterRecord<never, never>是runtimeRegister 的路径参数:无。
runtimeHeartbeat{ registrationId: string }是runtimeHeartbeat 的路径参数:registrationId。
runtimeRealtimeTokenCreateRecord<never, never>是runtimeRealtimeTokenCreate 的路径参数:无。
runtimeConversationSyncRecord<never, never>是runtimeConversationSync 的路径参数:无。
runtimeConversationMessagesList{ conversationId: string }是runtimeConversationMessagesList 的路径参数:conversationId。
runtimeConversationMessageCreate{ conversationId: string }是runtimeConversationMessageCreate 的路径参数:conversationId。
runtimeConversationMessageGet{ conversationId: string; messageId: string }是runtimeConversationMessageGet 的路径参数:conversationId, messageId。
runtimeConversationMessagePatch{ conversationId: string; messageId: string }是runtimeConversationMessagePatch 的路径参数:conversationId, messageId。
runtimeConversationRunStart{ conversationId: string }是runtimeConversationRunStart 的路径参数:conversationId。
runtimeConversationRunFinish{ conversationId: string }是runtimeConversationRunFinish 的路径参数:conversationId。
runtimeDeliveriesReadRecord<never, never>是runtimeDeliveriesRead 的路径参数:无。
runtimeDeliveriesRenewRecord<never, never>是runtimeDeliveriesRenew 的路径参数:无。
runtimeDeliveriesAckRecord<never, never>是runtimeDeliveriesAck 的路径参数:无。
runtimeOperationHistoryGet{ operationId: string }是runtimeOperationHistoryGet 的路径参数:operationId。
runtimeOperationMessageAppend{ operationId: string }是runtimeOperationMessageAppend 的路径参数:operationId。
conversationMessagesList{ conversationId: string }是conversationMessagesList 的路径参数:conversationId。
conversationMessageSend{ conversationId: string }是conversationMessageSend 的路径参数:conversationId。
agentGet{ agentId: string }是agentGet 的路径参数:agentId。
agentUpdate{ agentId: string }是agentUpdate 的路径参数:agentId。
agentSyncRecord<never, never>是agentSync 的路径参数:无。
agentFilesListRecord<never, never>是agentFilesList 的路径参数:无。
agentFilePresignRecord<never, never>是agentFilePresign 的路径参数:无。
agentFileConfirmRecord<never, never>是agentFileConfirm 的路径参数:无。
agentFileResolve{ fileId: string }是agentFileResolve 的路径参数:fileId。
canvasTokenCreateRecord<never, never>是canvasTokenCreate 的路径参数:无。
a2aDiscoverRecord<never, never>是a2aDiscover 的路径参数:无。
a2aJsonRpc{ agentId: string }是a2aJsonRpc 的路径参数:agentId。
a2aTaskGet{ taskId: string }是a2aTaskGet 的路径参数:taskId。
messagingTokenCreateRecord<never, never>是messagingTokenCreate 的路径参数:无。
runtimeHistoryBoundaryPrepare{ conversationId: string }是runtimeHistoryBoundaryPrepare 的路径参数:conversationId。
runtimeHistoryBoundaryResetting{ conversationId: string }是runtimeHistoryBoundaryResetting 的路径参数:conversationId。
runtimeHistoryBoundaryResetDone{ conversationId: string }是runtimeHistoryBoundaryResetDone 的路径参数:conversationId。
runtimeHistoryBoundaryCommit{ conversationId: string }是runtimeHistoryBoundaryCommit 的路径参数:conversationId。
runtimeHistoryBoundaryAbort{ conversationId: string }是runtimeHistoryBoundaryAbort 的路径参数:conversationId。
runtimeHistoryBoundaryReconcile{ conversationId: string }是runtimeHistoryBoundaryReconcile 的路径参数:conversationId。
runtimeConversationMetadataModel{ conversationId: string }是runtimeConversationMetadataModel 的路径参数:conversationId。
runtimeConversationCronDelivery{ conversationId: string }是runtimeConversationCronDelivery 的路径参数:conversationId。
runtimeClaimNextRecord<never, never>是runtimeClaimNext 的路径参数:无。
runtimeClaimExact{ operationId: string }是runtimeClaimExact 的路径参数:operationId。
runtimeClaimRenew{ operationId: string }是runtimeClaimRenew 的路径参数:operationId。
runtimeClaimRelease{ operationId: string }是runtimeClaimRelease 的路径参数:operationId。
runtimeResourceRedeem{ operationId: string; kind: string; resourceRef: string }是runtimeResourceRedeem 的路径参数:operationId, kind, resourceRef。
runtimeOutputFilePresign{ operationId: string }是runtimeOutputFilePresign 的路径参数:operationId。
runtimeOutputFileConfirm{ operationId: string }是runtimeOutputFileConfirm 的路径参数:operationId。
runtimeInputFilesResolve{ operationId: string }是runtimeInputFilesResolve 的路径参数:operationId。
agentTemplateOriginReport{ agentId: string }是agentTemplateOriginReport 的路径参数:agentId。
channelCreateRecord<never, never>是channelCreate 的路径参数:无。
a2aTaskComplete{ taskId: string }是a2aTaskComplete 的路径参数:taskId。
agentEventPublishRecord<never, never>是agentEventPublish 的路径参数:无。
bridgeConfigGetRecord<never, never>是bridgeConfigGet 的路径参数:无。
agentConnectorMcpRecord<never, never>是agentConnectorMcp 的路径参数:无。
automationListRecord<never, never>是automationList 的路径参数:无。
automationCreateRecord<never, never>是automationCreate 的路径参数:无。
automationWebhookCreateRecord<never, never>是automationWebhookCreate 的路径参数:无。
automationGet{ automationId: string }是automationGet 的路径参数:automationId。
automationRunsList{ automationId: string }是automationRunsList 的路径参数:automationId。
automationRunCreate{ automationId: string }是automationRunCreate 的路径参数:automationId。
automationRunGet{ automationId: string; runId: string }是automationRunGet 的路径参数:automationId, runId。

PlatformAgentId

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

智能体的标识:UUID 字符串。

type PlatformAgentId = PlatformResourceId

PlatformConversationId

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

会话的标识:UUID 字符串。

type PlatformConversationId = PlatformResourceId

PlatformInstanceId

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

Cloud 实例的标识:inst_ 加 24 位小写十六进制字符。

type PlatformInstanceId = string

PlatformResourceId

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

Cloud 资源的标识:UUID 字符串。

type PlatformResourceId = string

RetryOptions

TypeScript · 仅 TypeScript

retryWithBackoff 的选项。

字段类型必填说明
policyBackoffPolicy是使用的退避计划。
isRetryable?(error: unknown) => boolean否判断某个错误是否值得重试。默认对所有错误重试。
signal?AbortSignal否中止等待并停止重试。
onRetry?(info: { attempt: number; delayMs: number; error: unknown }) => void否每次重试前调用,参数为第几次尝试、延迟(毫秒)和错误。
sleep?(ms: number, signal?: AbortSignal) => Promise<void>否等待给定的毫秒数,测试时可替换。
now?() => number否毫秒时钟,测试时可替换。

RFC3339Timestamp

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

RFC 3339 格式的时间戳字符串。

type RFC3339Timestamp = string

RuntimeActiveLease

TypeScript 与 Python

注册协调器所报告的当前生效租约。

字段类型必填说明
instanceId / instance_idstring / str是harness 所注册到的 Cloud 实例的标识。
leaseId / lease_idstring / str是运行时租约的标识。
runtimeEpoch / runtime_epoch${bigint} / str是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
runtimeLeaseCredential / runtime_lease_credentialstring / str是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。
leaseExpiresAt / lease_expires_atstring / str是租约过期的时间(RFC 3339 时间戳)。
heartbeat_interval_msint否租约必须续期的间隔,单位毫秒。
registration_idstr否注册的标识。
handler_identitystr否持有该租约的处理方的身份。

RuntimeBoundaryLeaseAuthority

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

harness 向历史边界汇报时用来证明其权限的租约信息。

字段类型必填说明
leaseIdstring是运行时租约的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
runtimeLeaseCredentialstring是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。

RuntimeChatClientOptions

TypeScript · 仅 TypeScript

运行时聊天客户端的选项。

字段类型必填说明
authorityRuntimeChatAuthorityPort是提供当前租约。
httpRuntimeChatHttpPort是用于聊天调用的 HTTP 端口。
realtimeRuntimeChatRealtimePort是用于接收新消息的实时端口。
now?() => number否毫秒时钟,测试时可替换,默认 Date.now。
reconnectDelayMs?(attempt: number) => number否重连的退避延迟,有上限;attempt 从 1 开始。
logger?RuntimeChatLogger否接收日志消息,可选。

RuntimeChatHistoryInput

TypeScript · 仅 TypeScript

读取会话历史的分页选项。

字段类型必填说明
cursor?string否上一页返回的游标。
limit?number否最多返回的条目数。

RuntimeChatHistoryMessage

TypeScript · 仅 TypeScript

历史页中的一条消息。

继承: RuntimeChatMessage

字段类型必填说明
offset?string否消息在会话中的位置,十进制字符串。
historyGeneration?string否消息所属的历史代数。
state?string否消息的状态,例如 streaming 或 completed。
stopReason?string否消息停止的原因。
body?string否消息文本。
parts?readonly unknown[]否消息的结构化片段。

RuntimeChatHistoryPage

TypeScript · 仅 TypeScript

会话历史的一页。

字段类型必填说明
messagesRuntimeChatHistoryMessage[]是本页的消息。
nextCursor?string否下一页的游标。最后一页没有。
hasMoreboolean是还有后续页时为 true。
latestOffsetstring是会话中最新消息的偏移。
historyGenerationstring是历史的当前代数。
historyBoundaryOffsetstring是当前历史代数的起始偏移。

RuntimeChatHttpPortOptions

TypeScript · 仅 TypeScript

聊天客户端所用 HTTP 端口的选项。

字段类型必填说明
baseUrlstring是Message Service 的来源(origin),例如 https://message.example。
fetchImpl?typeof fetch否用于 HTTP 调用的函数,默认是全局 fetch。
now?() => number否毫秒时钟,测试时可替换,默认 Date.now。

RuntimeChatLease

TypeScript · 仅 TypeScript

聊天客户端所需的租约信息。

字段类型必填说明
instanceIdstring是harness 所注册到的 Cloud 实例的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochstring是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
leaseIdstring是运行时租约的标识。
runtimeLeaseCredentialstring是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。
leaseExpiresAtstring是租约过期的时间(RFC 3339 时间戳)。

RuntimeChatLogger

TypeScript · 仅 TypeScript

聊天客户端的日志器,每个方法都是可选的。

字段类型必填说明
debug?(...args: unknown[]) => void否接收调试消息。
info?(...args: unknown[]) => void否接收信息消息。
warn?(...args: unknown[]) => void否接收警告。
error?(...args: unknown[]) => void否接收错误。

RuntimeChatMessage

TypeScript · 仅 TypeScript

一条会话消息。

字段类型必填说明
idstring是消息的标识。
conversationIdstring是会话的标识。
typestring是消息的类型,例如 agent_reply。
contentunknown是消息内容。
senderId?string否发送者的标识。
replyTo?string否本消息所回复的消息的标识。
createdAt?string否消息创建的时间。
[key: string]unknown是Cloud 返回的其他字段。

RuntimeChatPreparedClearProof

TypeScript · 仅 TypeScript

历史清除已经准备好的证明。在修改保留的回复之前会先检查它。

字段类型必填说明
clearIntentIdstring是清除意图的标识。
activeRunRegistrationIdstring是当前运行的注册 ID。
historyGeneration${bigint}是会话历史的代数(generation)。历史被清除时会变化。
runtimeEpoch${bigint}是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。

RuntimeChatRetainedBinding

TypeScript · 仅 TypeScript

把保留的回复绑定到它的会话和消息,以及修改时要执行的检查。

字段类型必填说明
conversationIdstring是会话的标识。
messageIdstring是回复消息的标识。
taskRequestMessageIdstring是原始任务请求的消息 ID,与操作 RPC 请求消息不同。
assertAttempt() => void是由可信的日志所有者提供,绝不从提示内容推断。
mutationKey(sequence: number) => string是由所属尝试提供的稳定幂等键,每个串行化的修改一个。
assertPreparedClear?(proof: RuntimeChatPreparedClearProof) => void否以已准备好的清除证明为参数调用;抛出错误则拒绝本次修改。

RuntimeChatRetainedSnapshot

TypeScript · 仅 TypeScript

回复消息的已存副本。

字段类型必填说明
rawTextstring是读取时消息的原始 JSON 文本。
messageIdstring是消息的标识。
conversationIdstring是会话的标识。
typestring是消息的类型。
senderstring是发送者的标识。
createdAtstring是消息创建的时间。
updatedAt?string否消息最后更新的时间。
replyTo?string否本消息所回复的消息的标识。
bodystring是消息文本。
statestring是消息的状态:streaming、completed、failed、refused 或 cancelled。
stopReason?string否消息停止的原因。

RuntimeChatSendInput

TypeScript · 仅 TypeScript

发送消息的输入。

字段类型必填说明
conversationIdstring是会话的标识。
id?string否新消息的标识。省略时由 Cloud 生成。
typestring是消息的类型,例如 agent_reply。
contentunknown是消息内容。
replyTo?string否本消息所回复的消息的标识。

RuntimeClaimExactRequest

TypeScript · 仅 TypeScript

认领指定的某个操作的请求。

继承: RuntimeClaimNextRequest

字段类型必填说明
operationIdstring是操作的标识。
requestMessageIdstring是承载该请求的消息的标识。
dispatchEpochstring是Cloud 派发该操作时的 epoch。

RuntimeClaimFence

TypeScript · 仅 TypeScript

认领的 fence:证明 harness 仍然拥有该操作。

字段类型必填说明
claimIdstring是认领(claim)的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochstring是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
fencingTokenstring是认领的 fencing token(十进制字符串)。比当前值小的令牌已过期。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGenerationstring是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。
operationIdstring是操作的标识。
requestMessageIdstring是承载该请求的消息的标识。
runtimeLeaseCredentialstring是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。

RuntimeClaimNextRequest

TypeScript · 仅 TypeScript

认领下一个待处理操作的请求。

字段类型必填说明
claimRequestIdstring是本次认领请求的标识,用于去重。
instanceIdstring是harness 所注册到的 Cloud 实例的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochstring是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGenerationstring是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。
runtimeLeaseCredentialstring是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。

RuntimeClaimReleaseRequest

TypeScript · 仅 TypeScript

释放某个操作的认领的请求。

继承: RuntimeClaimFence

字段类型必填说明
reason"completed" | "cancelled" | "worker_shutdown" | "claim_rejected"是释放认领的原因:completed、cancelled、worker_shutdown 或 claim_rejected。

RuntimeClaimRenewRequest

TypeScript · 仅 TypeScript

为某个操作的认领续期的请求。

继承: RuntimeClaimFence

没有字段。

RuntimeControlMessageId

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

运行时控制面在 Message Service 中的消息 ID,遵循同样的有界不透明规则。

type RuntimeControlMessageId = string

RuntimeConversationSyncRequest

Python · 仅 Python

创建或更新某个操作的会话的请求。

字段类型必填说明
schemaVersionLiteral[1]是请求结构的版本,始终为 1。
operationIdstr是操作的标识。
runtimeSessionIdstr是会话在 harness 中的标识。
runtimeSessionKeyNotRequired[str]是会话在 harness 中的 key。
titleNotRequired[str]是会话的标题。

RuntimeDeliveriesReadRequest

Python · 仅 Python

读取待处理投递的请求。

字段类型必填说明
schemaVersionLiteral[1]是请求结构的版本,始终为 1。
maxCountint是最多返回的投递数。
blockMsint是没有待处理投递时的最长等待时间,单位毫秒。

RuntimeDeliveryAppendReceipt

TypeScript · 仅 TypeScript

向某个操作追加消息的结果。

可选形态

#类型
1{ readonly outcome: "created" | "duplicate" | "reconciled"; readonly message?: JsonValue; readonly history?: JsonValue }
2{ readonly outcome: "outcome_unknown"; readonly history?: JsonValue }

可选形态 1

字段类型必填说明
readonly outcome"created" | "duplicate" | "reconciled"是created 表示新消息,duplicate 表示已存储过,reconciled 表示先前不确定的追加已得到确认。
readonly message?JsonValue否已存储的消息。
readonly history?JsonValue否该操作的历史;Cloud 返回时才有。

可选形态 2

字段类型必填说明
readonly outcome"outcome_unknown"是outcome_unknown:追加可能已存储,也可能没有。
readonly history?JsonValue否该操作的历史;Cloud 返回时才有。

RuntimeDeliveryAuthorityLease

TypeScript · 仅 TypeScript

投递端口所需的租约凭据。

继承: RuntimeDeliveryLease

字段类型必填说明
readonly runtimeLeaseCredentialstring是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。

RuntimeDeliveryConsumeOptions

TypeScript · 仅 TypeScript

投递消费循环的选项。

字段类型必填说明
readonly onDelivery(delivery: RuntimeMethodDelivery, context: { readonly lease: RuntimeDeliveryLease; readonly signal: AbortSignal }) => Promise<void>是处理一条投递。处理函数返回时确认该投递,抛出错误时留待重新投递。
readonly onError?(error: unknown) => void否循环自行处理的错误会通过它通知。
readonly onLeaseStarvation?(input: { readonly starvedForMs: number; readonly recovered: boolean }) => void否一段时间内没有有效租约时调用。
readonly readCount?number否单次最多读取的投递数。
readonly blockMs?number否单次读取等待投递的时间,单位毫秒。
readonly idleDelayMs?number否没有投递时再次读取之前的停顿,单位毫秒。
readonly renewIntervalMs?number否仍在处理的投递的续期频率,单位毫秒。

RuntimeDeliveryHistory

TypeScript · 仅 TypeScript

某个操作的历史:已找到、未找到或已过期。

可选形态

#类型
1{ readonly status: "not_found" | "expired" }
2{ readonly status: "found"; readonly snapshot: JsonValue }

可选形态 1

字段类型必填说明
readonly status"not_found" | "expired"是not_found 表示操作未知,expired 表示其历史已不再保留。

可选形态 2

字段类型必填说明
readonly status"found"是found:历史在 snapshot 中。
readonly snapshotJsonValue是已存储的历史。

RuntimeDeliveryIdsRequest

Python · 仅 Python

按 ID 指明投递的请求。

字段类型必填说明
schemaVersionLiteral[1]是请求结构的版本,始终为 1。
deliveryIdslist[str]是投递的标识列表。

RuntimeDeliveryLease

TypeScript · 仅 TypeScript

处理投递时所依据的租约,包括它所属的日志。

字段类型必填说明
readonly instanceIdstring是harness 所注册到的 Cloud 实例的标识。
readonly handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
readonly runtimeEpochstring是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
readonly leaseIdstring是运行时租约的标识。
readonly leaseExpiresAtstring是租约过期的时间(RFC 3339 时间戳)。
readonly journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
readonly journalGenerationstring是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。

RuntimeEpoch

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

运行时注册的 epoch,十进制字符串。

type RuntimeEpoch = DecimalUInt64

RuntimeExecutionBoundaryAssertionClaims

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

执行边界断言的声明:Cloud 签发的、允许某次执行开始或恢复的签名声明。

字段类型必填说明
issstring是令牌的签发方(JWT 的 iss)。
audtypeof RUNTIME_EXECUTION_BOUNDARY_AUDIENCE是令牌的受众(JWT 的 aud)。
substring是令牌的主体(JWT 的 sub)。
jtistring是令牌的唯一 ID(JWT 的 jti)。
iatnumber是签发时间(Unix 秒,JWT 的 iat)。
expnumber是过期时间(Unix 秒,JWT 的 exp)。
executionMode"start" | "resume"是start 表示新的执行,resume 表示延续先前的执行。
executionBoundaryIdstring是执行边界的标识。
predecessorExecutionBoundaryId?string否本次执行所延续的那次执行的边界 ID。start 时不存在,resume 时必须有,并被签入断言。
handoffId?string否交接(handoff)的标识,用于恢复的执行。
operationIdOperationId是操作的标识。
requestMessageIdRuntimeControlMessageId是承载该请求的消息的标识。
commandHashSha256HexDigest是命令的 SHA-256 摘要(64 位小写十六进制)。
executionGrantHashSha256HexDigest是执行授权的 SHA-256 摘要(64 位小写十六进制)。
claimIdstring是认领(claim)的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
fencingTokenRuntimeFencingToken是认领的 fencing token(十进制字符串)。比当前值小的令牌已过期。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGenerationRuntimeRevision是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。
journalRevisionBeforeAttemptRuntimeRevision是本次尝试开始之前日志的修订号。
preparedEntryHashSha256HexDigest是为本次尝试准备的日志条目的 SHA-256 摘要。

RuntimeFencingToken

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

fencing token,十进制字符串。

type RuntimeFencingToken = DecimalUInt64

RuntimeHeartbeatRequest

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

为租约续期的心跳请求。

继承: RuntimeIdentityProof<"runtime.heartbeat">

字段类型必填说明
targetInstanceId?string否该注册必须属于的 Cloud 实例。
leaseIdstring是运行时租约的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
msConnectionStatus?MSConnectionStatus否harness 所观察到的自身实时连接的状态。

RuntimeHeartbeatResult

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

心跳的应答:已续期、已被 fence 或已过期。

可选形态

#类型
1{ status: "renewed"; leaseExpiresAt: RFC3339Timestamp; runtimeLeaseCredential: string; }
2{ status: "fenced"; activeRuntimeEpoch: RuntimeEpoch; }
3{ status: "expired"; }

可选形态 1

字段类型必填说明
status"renewed"是renewed:租约继续有效。
leaseExpiresAtRFC3339Timestamp是租约新的过期时间。
runtimeLeaseCredentialstring是续期后租约的凭据,此后请使用它。

可选形态 2

字段类型必填说明
status"fenced"是fenced:已有另一个注册处于生效状态。
activeRuntimeEpochRuntimeEpoch是当前生效的注册的 epoch。

可选形态 3

字段类型必填说明
status"expired"是expired:租约已过期,harness 必须重新注册。

RuntimeIdentityProof

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

已签名的证明:注册或心跳来自实例身份密钥的持有者。

字段类型必填说明
signaturePurposeTPurpose是签名的用途:注册或心跳的证明域。
instanceIdentityKeyIdRuntimeIdentityKeyId是签名所用密钥的标识。
nonceBase64Url是一次性随机值。
signedAtRFC3339Timestamp是签名时间(RFC 3339 时间戳)。
payloadHashSha256HexDigest是被签名载荷的 SHA-256 摘要(64 位小写十六进制)。
signatureBase64Url是Ed25519 签名。

RuntimeInvocationExpectedTarget

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

运行时方法的作用对象。scope 为 instance、agent 或 conversation,每种 scope 允许的字段不同。

可选形态

#类型
1{ scope: "instance"; platformAgentId?: never; runtimeAgentUid?: string; runtimeLocalKey?: never; platformConversationId?: never; runtimeConversationUid?: nev...
2{ scope: "agent"; platformAgentId: PlatformAgentId; runtimeAgentUid: string; runtimeLocalKey: string; platformConversationId?: never; runtimeConversationUid?...
3{ scope: "conversation"; platformAgentId: PlatformAgentId; runtimeAgentUid: string; runtimeLocalKey?: never; platformConversationId: PlatformConversationId; ...

可选形态 1

字段类型必填说明
scope"instance"是instance:整个实例。
platformAgentId?never否该 scope 下不允许出现,必须省略。
runtimeAgentUid?string否智能体在 harness 内部的标识。
runtimeLocalKey?never否该 scope 下不允许出现,必须省略。
platformConversationId?never否该 scope 下不允许出现,必须省略。
runtimeConversationUid?never否该 scope 下不允许出现,必须省略。
runtimeSessionKey?never否该 scope 下不允许出现,必须省略。

可选形态 2

字段类型必填说明
scope"agent"是agent:某一个智能体。
platformAgentIdPlatformAgentId是智能体在 Cloud 中的标识。
runtimeAgentUidstring是智能体在 harness 内部的标识。
runtimeLocalKeystring是智能体在 harness 内部的本地 key。
platformConversationId?never否该 scope 下不允许出现,必须省略。
runtimeConversationUid?never否该 scope 下不允许出现,必须省略。
runtimeSessionKey?never否该 scope 下不允许出现,必须省略。

可选形态 3

字段类型必填说明
scope"conversation"是conversation:某个智能体的一个会话。
platformAgentIdPlatformAgentId是智能体在 Cloud 中的标识。
runtimeAgentUidstring是智能体在 harness 内部的标识。
runtimeLocalKey?never否该 scope 下不允许出现,必须省略。
platformConversationIdPlatformConversationId是会话在 Cloud 中的标识。
runtimeConversationUidstring是会话在 harness 内部的标识。
runtimeSessionKeystring是会话在 harness 内部的 key。

RuntimeInvocationFence

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

执行必须与之匹配的当前认领的 fence。

字段类型必填说明
claimIdstring是认领(claim)的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
fencingTokenRuntimeFencingToken是认领的 fencing token(十进制字符串)。比当前值小的令牌已过期。
journalStoreIdstring是认领最初针对的日志存储的标识,之后不会再变。
journalGenerationRuntimeRevision是日志存储的代数。

RuntimeInvocationMethod

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

可被调用的运行时方法的名称,例如 session/prompt。

可选形态

#类型
1ServiceRuntimeMethod
2InstanceRuntimeInvocationMethod
3ConversationRuntimeInvocationMethod
4InternalRuntimeInvocationMethod

RuntimeInvocationValidationContext

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

执行授权的校验所依据的上下文:已持久化的调用及其作用对象。

type RuntimeInvocationValidationContext = RuntimeInvocationValidationContextBase & RuntimeInvocationExpectedTarget & ({ method: "session/cancel"; scope: "conversation"; historyGeneration: ConversationHistoryGeneration; targetMessageId: MessageServiceMessageId; } | { method: Exclude<RuntimeInvocationMethod, "session/cancel">; historyGeneration?: never; targetMessageId?: never; })

RuntimeJwksDocumentProvenance

TypeScript · 仅 TypeScript

JWKS 文档的来源及其自述内容。

字段类型必填说明
sourceUrlstring是加载该文档的 URL。
etagstring是响应的 ETag。
issuerstring是文档声明的签发方。
audiencestring是文档声明的受众。
purposestring是文档声明的用途。
maxClaimTtlSecondsnumber是已签名声明的最长有效期,单位秒。文档未声明时为 NaN。

RuntimeJwksFetch

TypeScript · 仅 TypeScript

下载 URL 的函数,签名与 fetch 相同。

type RuntimeJwksFetch = (url: string | URL, init?: RequestInit) => Promise<Response>

RuntimeJwksKeyMaterial

TypeScript · 仅 TypeScript

一个受信公钥的指纹。

字段类型必填说明
jwkThumbprintstring是JWK 形式公钥的 SHA-256 指纹。
spkiSha256string是SPKI DER 形式公钥的 SHA-256 摘要(十六进制)。

RuntimeLeaseCredential

TypeScript 与 Python

单独的租约凭据。

字段类型必填说明
runtimeLeaseCredential / runtime_lease_credentialstring / str是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。
executionGrant? / execution_grantstring / str | None否该操作的执行授权,路由要求时提供。以 X-BeeOS-Execution-Grant 发送。
scopedDeliveryKey? / scoped_delivery_keystring / str | None否以 X-Runtime-Delivery-Key 发送的投递密钥。会话模型和定时任务路由需要。

RuntimeLeaseHttpOptions

TypeScript · 仅 TypeScript

租约 HTTP 客户端的选项。

字段类型必填说明
originstring是租约只能发送到的固定来源(Message Service 或 Agent Gateway)。
retry?BackoffPolicy | false否单次调用的重试。默认不重试,因为追加或确认的结果可能不明确。
fetch?typeof fetch否用于 HTTP 调用的函数,默认是全局 fetch。

RuntimeMessagePatch

Python · 仅 Python

对正在流式写入的消息的修改。

字段类型必填说明
bodyNotRequired[str]是替换整段文本。
body_appendNotRequired[str]是要追加的文本。
body_fromNotRequired[int]是body_append 在文本中的起始位置。
partsNotRequired[list[JsonObject]]是替换结构化片段。
stateNotRequired[str]是新的状态:streaming、completed、failed、refused 或 cancelled。
stop_reasonNotRequired[str]是消息停止的原因。

RuntimeMethodDelivery

TypeScript 与 Python

从 Cloud 读取的一条运行时方法投递。

字段类型必填说明
readonly deliveryId / delivery_idstring / str是投递的标识,用于续期和确认。
readonly redeliveredboolean / bool是该投递之前已发出过时为 true。
readonly idleMs / idle_msnumber / int是投递在被读取之前等待的时间,单位毫秒。
readonly messageJsonValue / Any是投递所含的消息。
readonly executionGrant? / execution_grantstring / str | None否该操作的执行授权,有则提供。

RuntimeNativeConversationSyncRequest

TypeScript · 仅 TypeScript

创建或更新原生会话(session)所对应的会话的请求。

字段类型必填说明
schemaVersion1是请求结构的版本,始终为 1。
operationIdstring是操作的标识。
runtimeSessionIdstring是会话在 harness 中的标识。
runtimeSessionKey?string否会话在 harness 中的 key。
title?string否会话的标题。

RuntimeNativeConversationSyncResponse

TypeScript · 仅 TypeScript

同步时 Cloud 返回的会话。

字段类型必填说明
idstring是会话的标识。
participantsreadonly string[]是参与者的标识列表。
metadata?Readonly<Record<string, string>>否会话的元数据。
owner_identity_id?string否拥有该会话的身份。
target_identity_id?string否该会话所对应的智能体的身份。
target_kind?string否对象的种类。
title?string否会话的标题。
metadata_versionnumber是元数据的版本,每次修改都会增大。
history_generationnumber是会话历史的代数。
last_activity_at?string否会话最后活跃的时间。
state"open" | "closed"是open 或 closed。
closed_reason?string否会话被关闭的原因。
single_shot?boolean否只接受一次提示的会话为 true。
deadline_at?string否会话的截止时间。
created_atstring是会话创建的时间。
closed_at?string否会话关闭的时间。

RuntimeOperationAppendRequest

Python · 仅 Python

向某个操作追加消息的请求。

字段类型必填说明
schemaVersionLiteral[1]是请求结构的版本,始终为 1。
typestr是消息的类型。
payloadAny是消息内容。

RuntimeRealtimeToken

TypeScript 与 Python

实时连接令牌及其使用位置。

字段类型必填说明
tokenstring / str是连接令牌。
centrifugoUrl / centrifugo_urlstring / str是实时服务的 URL。
channelsreadonly string[] / tuple[str, ...]是令牌允许订阅的频道。
principalId / principal_idstring / str是令牌所签发给的主体的标识。
expiresAt / expires_atnumber / int是令牌的过期时间(Unix 时间戳)。聊天客户端把小于 10^12 的值按秒解读,更大的值按毫秒解读。

RuntimeRegistrationActiveResult

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

注册应答 active:租约已授予。

字段类型必填说明
status"active"是active。
instanceIdPlatformInstanceId是harness 所注册到的 Cloud 实例的标识。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGenerationRuntimeRevision是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。
leaseIdstring是运行时租约的标识。
issuedAtRFC3339Timestamp是租约签发的时间(RFC 3339 时间戳)。
leaseExpiresAtRFC3339Timestamp是租约过期的时间(RFC 3339 时间戳)。
heartbeatIntervalMstypeof RUNTIME_LEASE_HEARTBEAT_INTERVAL_MS是租约必须续期的间隔,单位毫秒。
runtimeLeaseCredentialstring是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。

RuntimeRegistrationAuthorityLease

TypeScript · 仅 TypeScript

面向与租约绑定的数据通道的临时授权视图。凭据绝不能写入日志或日志存储(journal)。

继承: RuntimeActiveLease

字段类型必填说明
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。

RuntimeRegistrationConfig

TypeScript · 仅 TypeScript

注册的配置:harness 是什么、能做什么。

字段类型必填说明
registrationIdstring是注册的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
contractRevisionstring是harness 所实现的运行时契约的修订号。
runtimeMethodsreadonly RuntimeInvocationMethod[]是harness 能够处理的运行时方法。
capabilitiesreadonly RuntimeCapability[]是harness 提供的能力。
manifestDigestRuntimeRegistrationHashPayload["manifestDigest"]是harness 清单的摘要。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGeneration${bigint}是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。
instanceIdentityKeyIdstring是为证明签名的实例身份密钥的标识。
targetInstanceId?string否该注册必须属于的 Cloud 实例。
signIdentityProof(message: Uint8Array) => Uint8Array是密钥由宿主保管;对规范化的 Ed25519 证明字节签名。
fencedRetry?BackoffPolicy | false否fenced 应答是可恢复的:前任或控制面稳定期间,授权方可能会 fence 一个注册,所以协调器按此退避策略持续用同一意图重新注册。false 则恢复为终止性的 fence。默认:30 秒起翻倍到 5 分钟,不限次数。
getMSConnectionStatus?(lease: RuntimeActiveLease) => MSConnectionStatus否返回心跳所携带的实时连接状态,可选。

RuntimeRegistrationFencedResult

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

注册应答 fenced:已有另一个注册生效。

字段类型必填说明
status"fenced"是fenced。
activationIdstring是待激活流程的标识。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
activeRuntimeEpochRuntimeEpoch是当前生效的注册的 epoch。

RuntimeRegistrationHashPayload

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

去掉签名字段后的注册请求。身份证明所签的就是它的哈希。

type RuntimeRegistrationHashPayload = Omit<RuntimeRegistrationRequest, "signaturePurpose" | "instanceIdentityKeyId" | "nonce" | "signedAt" | "payloadHash" | "signature">

RuntimeRegistrationIdentity

Python · 仅 Python

注册的持久身份。

字段类型必填说明
registration_idstr是注册的标识。
handler_identitystr是处理方的身份。
journal_store_idstr是日志存储的标识。
journal_generationstr是日志存储的代数,十进制字符串。

RuntimeRegistrationPendingResult

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

注册应答 pending_activation:注册在等待前任交接。

字段类型必填说明
status"pending_activation"是pending_activation。
activationIdstring是待激活流程的标识。
runtimeEpochRuntimeEpoch是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGenerationRuntimeRevision是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。
retryAfterMsnumber是重新注册前需要等待的时间,单位毫秒。

RuntimeRegistrationRequest

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

已签名的注册请求。

继承: RuntimeIdentityProof<"runtime.register">

字段类型必填说明
targetInstanceId?string否该注册必须属于的 Cloud 实例。
registrationIdstring是注册的标识。
handlerIdentitystring是处理方身份,即完成注册并持有租约的 harness 进程。
contractRevisionstring是harness 所实现的运行时契约的修订号。
manifestDigestSha256HexDigest是harness 清单的摘要。
runtimeRpcProtocolVersiontypeof RUNTIME_RPC_PROTOCOL_VERSION是harness 所使用的运行时 RPC 协议的版本。
runtimeMethodsreadonly RuntimeInvocationMethod[]是harness 能够处理的运行时方法。
capabilitiesreadonly RuntimeCapability[]是harness 提供的能力。
journalStoreIdstring是harness 的持久化日志存储(journal store)的标识。
journalGenerationRuntimeRevision是日志存储的代数(generation)。上一个租约过期或注册谱系变化时加一。

RuntimeRegistrationResult

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

注册的应答:pending_activation、active 或 fenced。

可选形态

#类型
1RuntimeRegistrationPendingResult
2RuntimeRegistrationActiveResult
3RuntimeRegistrationFencedResult

RuntimeRevision

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

修订号,十进制字符串。

type RuntimeRevision = DecimalUInt64

Sha256HexDigest

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

SHA-256 摘要,64 位小写十六进制字符。

type Sha256HexDigest = string

TerminalAgentAuthFrame

TypeScript 与 Python

harness 为认证而发给终端桥接的第一帧。

字段类型必填说明
type'agent_auth' / Literal['agent_auth']是始终为 agent_auth。
instance_idstring / str是Cloud 实例的标识。
service'terminal' / Literal['terminal']是始终为 terminal。
public_keystring / str是标准 base64 的 Ed25519 公钥。
timestampnumber / int是Unix 时间(秒)。
noncestring / str是一次性随机值。
signaturestring / str是标准 base64 的 Ed25519 签名。
runtimeLeaseCredentialstring / str是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。
handlerIdentitystring / str是处理方身份,即完成注册并持有租约的 harness 进程。
runtimeEpochstring / str是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
leaseIdstring / str是运行时租约的标识。

TerminalAuthLease

TypeScript 与 Python

写入终端认证帧的租约信息。

字段类型必填说明
instanceId / instance_idstring / str是harness 所注册到的 Cloud 实例的标识。
leaseId / lease_idstring / str是运行时租约的标识。
runtimeEpoch / runtime_epochstring / str是运行时注册的 epoch(十进制字符串)。epoch 低于当前生效注册的注册会被 fence。
runtimeLeaseCredential / runtime_lease_credentialstring / str是随租约签发的凭据,在租约调用中作为 Bearer 令牌发送。请当作机密对待,不要写入日志。
handlerIdentity / handler_identitystring / str是处理方身份,即完成注册并持有租约的 harness 进程。

TerminalBridgeClientOptions

TypeScript · 仅 TypeScript

终端桥接客户端的选项。

字段类型必填说明
bridgeUrlstring是终端桥接的 URL。
keysAgentKeyPair是harness 实例的 Ed25519 密钥对。
leaseTerminalAuthLease是为 harness 认证的租约。
now?() => number否毫秒时钟,测试时可替换,默认 Date.now。
nonce?() => string否nonce 生成函数,测试时可替换。
authTimeoutMs?number否等待 auth_ok 的时间,单位毫秒,默认 10000。
socketFactory?(url: string) => TerminalSocket否创建 WebSocket 的函数。测试时可替换,默认使用 ws。

VerifiedDecodedExecutionBoundary

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

签名已验证的边界断言。

字段类型必填说明
headerCoreExecutionAuthorization["boundary"]["header"]是断言的 JWT 头。
claimsRuntimeExecutionBoundaryAssertionClaims是断言的声明。
compactHashSha256HexDigest是紧凑 JWT 的 SHA-256 摘要(64 位小写十六进制)。

VerifiedDecodedExecutionGrant

TypeScript · 仅 TypeScript · 来源: @beeos-ai/beeos-types

签名已验证的执行授权。

字段类型必填说明
headerCoreExecutionAuthorization["grant"]["header"]是授权的 JWT 头。
claimsAnyRuntimeExecutionGrantClaims是授权的声明。
compactHashSha256HexDigest是紧凑 JWT 的 SHA-256 摘要(64 位小写十六进制)。

由 @beeos-ai/beeos-types 定义的类型

以下类型只被上面的结构间接引用,由 @beeos-ai/beeos-types 的 runtime 入口定义,本页不再展开:

  • ConversationRuntimeExecutionGrantClaims
  • ConversationRuntimeInvocationMethod
  • ConversationRuntimeInvocationResultMap
  • InstanceRuntimeExecutionGrantClaims
  • InstanceRuntimeInvocationMethod
  • InstanceRuntimeInvocationResultMap
  • InternalRuntimeInvocationMethod
  • RuntimeExecutionBoundaryAssertion
  • RuntimeExecutionGrantClaims
  • RuntimeExecutionGrantEnvelope
  • RuntimeIdentityKeyId
  • RuntimeInvocationValidationContextBase
  • ServiceRuntimeMethod