Skip to content

Errors

Runtime client 的错误策略是 fail closed:transport 或 App Server 失败必须向上暴露,不切 mock,不从 UI 层伪造完成态。

Error Classes

当前 package 复用 app-server-client 的 request result / thrown error 形态。文档层要求错误至少可映射到以下 UI 状态。

Runtime conditionUI statusRetry
host_unavailablestale / blocked等 Host bridge ready 后重试。
provider_not_readyblocked打开 Provider setup。
permission_deniedblocked / failed需要用户处理或调整策略。
stream_interruptedstaleread model repair。
schema_mismatchfailed修 contracts / adapter。
runtime_failedfailed展示 diagnostics ref。
ts
export interface RuntimeClientError {
  code:
    | "provider_not_ready"
    | "host_unavailable"
    | "permission_denied"
    | "stream_interrupted"
    | "schema_mismatch"
    | "runtime_failed";
  message: string;
  retryable: boolean;
  actionId?: string;
  diagnosticsRef?: string;
}

UI Mapping

ts
function runtimeStatusFromError(error: RuntimeClientError) {
  if (error.code === "stream_interrupted") return "stale";
  if (error.code === "provider_not_ready") return "blocked";
  if (error.retryable) return "blocked";
  return "failed";
}

禁止事项

  • 不把 transport error 静默转换成空 read model。
  • 不在 production path 中使用 fixture replay 伪造事件。
  • 不把 Provider error 文案直接当稳定 enum。
  • 不在 React surface 中捕获错误后修改 runtime truth。

Lime Agent Workbench 是面向 Lime AgentRuntime 与 AgentUI 的治理优先标准。