Skip to content

Package boundaries

Lime 统一的是 AgentUI / AgentRuntime 标准,不是把所有能力塞进一个物理包。当前主仓真实四包分别承担 contracts、runtime transport、projection、React surfaces。

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

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

未来可以提供 @limecloud/agent-ui 作为 facade,但它只能 re-export UI 侧包,不能 re-export runtime client,避免产品应用无意中把 UI 包变成 transport owner。

包职责

current owner不负责
@limecloud/agent-ui-contractsTypeScript types、fixtures、validation、message/timeline/graph/projection contracts。React、transport、Provider、产品业务逻辑。
@limecloud/agent-runtime-clientApp Server JSON-RPC facade、session gateway、event subscription、read APIs、action response、evidence export。ProjectionState、React component、工具状态机。
@limecloud/agent-runtime-projectionprojector、fixture replay、App Server facts adapter、read model projection、message/timeline/graph derivation。DOM、React hooks、App Server JSON-RPC、Provider Store。
@limecloud/agent-runtime-uiReact projection view、message parts、process timeline、execution graph、action required、team workbench。runtime truth、stream subscription、Provider key、DB 读取。

标准 surface

SDK 文档和包导出统一使用以下 surface 名称:

SurfaceContract ownerProjection ownerReact owner
UIMessageParts@limecloud/agent-ui-contracts@limecloud/agent-runtime-projectionUIMessagePartsView
ProcessTimeline@limecloud/agent-ui-contracts@limecloud/agent-runtime-projectionProcessTimelineView
ExecutionGraph@limecloud/agent-ui-contracts@limecloud/agent-runtime-projectionExecutionGraphView
ActionRequired@limecloud/agent-ui-contractsstate.actionsActionRequiredList
ArtifactRef@limecloud/agent-ui-contractsstate.artifactsArtifact lane / product callback
EvidenceRef@limecloud/agent-ui-contractsstate.evidenceEvidence lane / product callback
TeamWorkbenchAgentUiTeamWorkbenchModelstate.teamWorkbenchTeamWorkbenchView

产品应用可以组合这些 surface,但不能新增第二套标准事实源。Runtime client 只提供 runtime facts;projection 才生成 surface state;React 只渲染 projection state。

代码组织要求

text
packages/
  agent-ui-contracts/
    src/
      runtime.ts
      projection.ts
      messages.ts
      timeline.ts
      graph.ts
      fixtures.ts
      validation.ts
  agent-runtime-client/
    src/
      index.ts
      sessionGateway.ts
  agent-runtime-projection/
    src/
      uiState.ts
      readModel.ts
      fixtureReplay.ts
      appServerFacts.ts
      normalization.ts
  agent-runtime-ui/
    src/
      projectionView.tsx
      messages.tsx
      processTimeline.tsx
      executionGraph.tsx
      runtimeFacts.tsx
      teamWorkbench.tsx

每个包内部继续按领域拆分,避免把 reducer、component、transport 写在一个文件里。src/index.ts 只做 barrel exports。

依赖禁止表

禁止依赖原因
agent-ui-contracts -> react合同层必须能被 App Server client、fixtures、Node test 使用。
agent-ui-contracts -> agent-runtime-clientcontract 不能依赖 transport。
agent-runtime-projection -> react-domprojection 必须可在 CLI、test、server side replay 运行。
agent-runtime-projection -> provider SDKprojection 只消费 normalized facts。
agent-runtime-ui -> App Server DBReact 组件不能绕过 runtime client 和 read models。
agent-runtime-client -> agent-runtime-projectionclient 不生成 UI 状态,避免 transport 绑定特定 UI。
agent-runtime-client -> mock fallbackproduction transport 失败必须 fail closed。

从 Lime 现有包迁移

Lime 现有路径标准包分类退出条件
packages/agent-ui-contracts@limecloud/agent-ui-contractscurrent继续补 schema、fixture、validation 和 version contract。
packages/agent-runtime-client@limecloud/agent-runtime-clientcurrent完整覆盖 App Server runtime client facade,不生成 UI state。
packages/agent-runtime-projection@limecloud/agent-runtime-projectioncurrentApp Server facts、fixture replay、projection selectors 都进入该包。
packages/agent-runtime-ui@limecloud/agent-runtime-uicurrentMessage、Timeline、ExecutionGraph、ActionRequired、TeamWorkbench 都从该包复用。
packages/app-server-clientruntime client dependencycurrent dependency不直接作为 AgentUI package 暴露给产品应用。
产品应用 local process component@limecloud/agent-runtime-ui shared surfacesdeprecatedShared ProcessTimeline / ExecutionGraph / TeamWorkbench 接入后删除。

版本策略

变更SemVer必须同步
RuntimeEvent 字段删除或语义改变majorfixtures、validation、projection tests、runtime-client tests、文档。
新增可选 event familyminorfixture、validation docs、projection mapping。
React surface props 改名majorcomponent tests、product adoption docs。
Runtime client error code 改名majortransport tests、UI blocked state mapping。
Fixture 增补minorconformance docs。

最小导出面

ts
// @limecloud/agent-ui-contracts
export type {
  AgentRuntimeExecutionEvent,
  AgentRuntimeReadModel,
  AgentUiProjectionState,
  UIMessagePart,
  ProcessTimelineEntry,
  ExecutionGraphNode,
  AgentUiTeamWorkbenchModel
};
export {
  getAgentUiFixture,
  validateRuntimeEvent,
  validateAgentUiFixture
};

// @limecloud/agent-runtime-client
export { createAgentRuntimeClient };
export { createAgentRuntimeClientFromSessionGateway };
export type { AgentRuntimeClient, AgentRuntimeSessionGateway };

// @limecloud/agent-runtime-projection
export { createAgentUiProjector, projectAgentUiState };
export { replayAgentUiFixture, replayAppServerFacts };

// @limecloud/agent-runtime-ui
export { AgentUiProjectionView };
export {
  UIMessagePartsView,
  ProcessTimelineView,
  ExecutionGraphView,
  ActionRequiredList,
  TeamWorkbenchView
};

Future facade 规则

如果将来新增 @limecloud/agent-ui,只能提供:

ts
export * from "@limecloud/agent-ui-contracts";
export * from "@limecloud/agent-runtime-projection";
export * from "@limecloud/agent-runtime-ui";

它不能导出:

  • createAgentRuntimeClient
  • Host bridge transport
  • Provider setup APIs
  • App Server JSON-RPC methods

如果产品应用需要 runtime client,必须显式依赖 @limecloud/agent-runtime-client,让 transport owner 清晰可见。

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