Skip to content

架构

Lime 的架构重点不是“前端连一个 agent endpoint”,而是让所有 Agent Apps 共享同一套 runtime facts 和 UI 投影。

标准事实源

current 事实源不应继续扩展
Runtime APIApp Server JSON-RPC + RuntimeCore read APIslegacy desktop facade、产品应用本地 runtime DB。
执行事实RuntimeEvent、ThreadReadModel、TaskSnapshot、ArtifactSummary、EvidenceSummaryassistant prose、日志缩进、本地 executionEvents 文本。
UI 投影UIMessagePartsProcessTimelineExecutionGraph、ToolGroup、ActionRequired非标准组件树协议、模块本地过程模型。
React 表面共享 AgentUI components 和产品样式适配每个 App 复制一套过程组件。

Runtime 参考层

Lime 底层 AgentRuntime 可以参考本地 Rust 执行型 runtime 的执行模型,但参考层不能越过 Lime current 事实源。

参考能力Lime current 落点架构要求
Submission Queue / Event QueueApp Server JSON-RPC + RuntimeEvent stream输入和输出解耦,event 可重放、可水合。
Session / Turn / TurnItemRuntimeCore session/thread/turn/task/run外部 item 只能映射为 Lime facts。
Tool executor / MCP toolExecutionBackend + Tool inventory工具生命周期必须产生 tool.* facts。
Exec policy / approvals / guardianPolicy service + ActionRequired权限提升必须走 action.* / permission.*
Sandbox / permission profileDesktop Host policy + App Server policy文件、网络、命令权限必须可解释、可拒绝。
Context compaction / historyRuntimeCore read model + history.* events历史压缩必须可恢复,不由 UI 拼 prompt。
App-server protocol fixturesLime contracts + conformanceschema、fixture、replay 是标准的一部分。

底层执行型 runtime 参考的是运行时品类能力;Lime 标准仍以 App Server、RuntimeCore、ExecutionBackend、AgentUI Projection 为唯一演进主链。

组件职责

组件职责
产品应用业务上下文、业务动作、页面编排。
Desktop Hostsidecar lifecycle、Host Snapshot、capability dispatch、IPC。
App Server JSON-RPCcurrent runtime API 与 read API。
RuntimeCoresession/thread/turn/task/run/action/event/read model truth。
ExecutionBackend模型、工具、命令、子代理、远程通道 adapter。
Provider StoreProvider metadata/key 的唯一事实源。
AgentUI Projection把 runtime facts 归一化为 UIMessagePartsProcessTimelineExecutionGraph 和 surface state。
AgentUI Surfaces消息、过程、工具、审批、产物、证据、诊断、团队工作台。
Agent SDK Line用四个包拆清 contracts、projection、React surface、runtime transport,不把 runtime client 塞进 UI 包。

端到端数据流

这条链路里只有 RuntimeCore 和 owner services 写事实。产品应用、React 组件和 projection reducer 都只消费事实或提交 intent。

TypeScript 包边界

分类职责
@limecloud/agent-ui-contractscurrentRuntimeEvent、read model、projection state、fixture 和 schema 类型。
@limecloud/agent-runtime-projectioncurrentprojector、fixture replay、App Server facts adapter、UIMessageParts / ProcessTimeline / ExecutionGraph 投影。
@limecloud/agent-runtime-uicurrentReact projection view、消息/过程/执行图/审批/团队工作台共享表面。
@limecloud/agent-runtime-clientcurrentApp Server JSON-RPC client、event subscription、read APIs、evidence export。
@limecloud/agent-uifuture facade未来可选 re-export UI contracts/projection/runtime-ui;不承载真实实现,不包含 runtime transport。

四包产品线是统一标准,不是统一成一个物理包。这样可以让产品应用只依赖 React 表面,测试和 CLI 只依赖 contracts/projection,runtime 集成只依赖 runtime client。

包依赖方向

text
@limecloud/agent-runtime-ui
  -> @limecloud/agent-runtime-projection
  -> @limecloud/agent-ui-contracts

@limecloud/agent-runtime-client
  -> @limecloud/agent-ui-contracts

@limecloud/agent-ui
  -> @limecloud/agent-runtime-ui
  -> @limecloud/agent-runtime-projection
  -> @limecloud/agent-ui-contracts

禁止方向:

  • agent-ui-contracts 依赖 React、App Server client 或产品应用。
  • agent-runtime-projection 依赖 React DOM、Electron、Provider SDK。
  • agent-runtime-ui 直接调用 Provider 或读 App Server DB。
  • agent-runtime-client 生成 UI projection state。

所有权 rule

UI 可以渲染事实、聚合事实、折叠事实,但不能写入 runtime truth。用户动作必须回到拥有方 API:

  • turn/cancel/resume -> RuntimeCore。
  • approval/input -> action owner。
  • artifact edit/export -> artifact service。
  • evidence export/review -> evidence service。
  • Provider settings -> platform/App Server Provider store。

传输规则

传输层可以是 Electron IPC、stdio JSON-RPC、HTTP SSE、WebSocket 或 future remote channel。传输不是标准核心。标准核心是 event envelope、read models、投影 mapping 和 ownership。

迁移策略

现有 Lime 路径分类收敛目标
packages/app-server-clientcurrent dependency@limecloud/agent-runtime-client 显式包裹和导出 current runtime client facade。
packages/agent-runtime-projectioncurrent作为 Lime AgentUI projection 的物理实现包继续演进。
packages/agent-runtime-uicurrent作为 Lime React AgentUI surfaces 的物理实现包继续演进。
packages/agent-app-runtime/projectioncompat/deprecated投影 API 合并到 @limecloud/agent-runtime-projection 后退出。
产品应用 local messages / executionEventscompat只作为迁移缓存,最终由 RuntimeEvent / ReadModel 驱动。
产品应用 local process componentdeprecated迁到共享 ProcessTimeline / ExecutionGraph surfaces。

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