Skip to content

Content Studio 接入

Content Studio 的目标不是重做聊天页,而是把 AI agents 工作台接到 Lime App Server Runtime 和共享 AgentUI。产品差异体现在内容工厂的业务上下文、素材、交付物和工作区编排;runtime facts、projection state 和标准 React surfaces 不在 Content Studio 内重新定义。

目标链路

text
AI agents 工作台
  -> LIME_RUNTIME_BRIDGE / lime.agent
  -> Host capability gateway
  -> App Server agentSession/turn/start
  -> RuntimeEvent / ThreadReadModel / TaskSnapshot / Evidence refs
  -> @limecloud/agent-runtime-client
  -> @limecloud/agent-runtime-projection
  -> @limecloud/agent-runtime-ui
  -> Content Studio business shell

standalone/dev 可以保留自托管 sidecar 作为 compat,但平台宿主下 current owner 是 Host bridge + App Server provider store。Content Studio 不读取、不保存、不传递 Provider key。

Product App owns

内容说明
Business context当前内容类型、素材、栏目、目标渠道、图片/视频/文案任务参数。
Workspace shell左侧 AI agents 入口、内容工厂布局、artifact workspace、素材面板。
Action callbacks根据 onResolveAction 打开输入源、模型设置、审批面板或调用 respondAction
Artifact / Evidence open根据 onSelectArtifactRef / onSelectEvidenceRef 打开产品工作区。
I18n labels注入五语言 aria、标题、按钮、状态文案。
Compatibility cachemessages / executionEvents 仅作为迁移缓存或 hydration 输入。

Product App does not own

不拥有current owner
Provider key / token / secretApp Server Provider Store / 平台 Provider 设置。
Runtime factsApp Server RuntimeCore / ExecutionBackend。
Tool state machineRuntimeEvent tool.* + read model。
Action completionRuntimeEvent action.required / action.resolved
Subagent lineage truthTaskSnapshot / ExecutionGraph / TeamWorkbench projection。
Artifact / Evidence truthartifact service / evidence pack / review/replay owner。
App Server DBApp Server sidecar owner。
React runtime transport@limecloud/agent-runtime-client,不是 UI 包。

接入步骤

  1. 通过 Host Snapshot 确认 App Server readiness、provider readiness、capability readiness。
  2. 如果旧 ModelConfigStore 有 key,只把它当迁移 source,走平台 model settings capability 写入 provider store;成功后清除本地 key,失败 fail closed。
  3. lime.agent capability 或 current App Server session gateway 发起 turn。
  4. Payload 只传业务上下文、workspace refs、provider/model preference,不传 key、token、secret、backendEnv key。
  5. 订阅 agentSession/event,读取 agentSession/read 和必要 TaskSnapshot。
  6. @limecloud/agent-runtime-projection 生成 AgentUiProjectionState
  7. @limecloud/agent-runtime-ui 渲染 AgentUiProjectionView 或子 surface。
  8. 用户动作通过 callback 回到 runtime client 或产品业务模块。

标准 surface 映射

Content Studio 需求Lime standard surfaceSource fact
聊天 / 生成文本UIMessagePartsmodel.delta / model.completed
执行过程ProcessTimelineall RuntimeEvent by sequence
多步骤 / 工具 / 子任务结构ExecutionGraphturn/run/task/subagent/tool/action ids。
工具结果ToolGrouptool.started / tool.result / tool.failed
人类介入ActionRequiredaction.required / action.resolved
Prompt 草稿 / 交付物ArtifactRefList + product artifact workspaceartifact.changed / artifact refs。
证据 / replay / reviewEvidenceRefList + evidence packevidence.changed / review.verdict
子代理 / 团队协作TeamWorkbenchtask.* / subagent.* / handoff.* / review.*
错误 / 缺事实 / stalediagnostics + hydration stateruntime.error / snapshot.updated / read repair。

最小代码形态

ts
import { createAgentRuntimeClientFromSessionGateway } from "@limecloud/agent-runtime-client/sessionGateway";
import { createAgentUiProjector } from "@limecloud/agent-runtime-projection";

const runtime = createAgentRuntimeClientFromSessionGateway(sessionGateway);
const projector = createAgentUiProjector();

await runtime.startTurn({
  sessionId,
  input: {
    text: userPrompt,
    businessRefs: materialRefs,
    providerPreference,
    modelPreference
  }
});

runtime.subscribeEvents((event) => {
  projector.apply(event);
  setAgentUiState(projector.getState());
});
tsx
import { AgentUiProjectionView } from "@limecloud/agent-runtime-ui";

<AgentUiProjectionView
  state={agentUiState}
  onResolveAction={(event, action) => {
    return runtime.respondAction({
      sessionId,
      actionId: event.actionId,
      decision: action.decision
    });
  }}
  onSelectArtifactRef={(ref) => openPromptWorkspace(ref.id)}
  onSelectEvidenceRef={(ref) => openEvidencePack(ref.id)}
  labels={contentStudioAgentLabels}
/>;

兼容迁移表

Existing pathClassificationTargetExit condition
AgentPromptSession.messagescompatUIMessagePartsRuntimeEvent hydration 覆盖首屏恢复后只保留迁移读取。
local executionEventscompatRuntimeEvent / ProcessTimelineApp Server facts adapter 覆盖 tool/action/artifact/evidence 后停止扩展。
模块内工具状态deprecatedtool.* facts + ToolGroup工具成功/失败可从 read model replay。
模块内审批状态deprecatedaction.required/resolved + ActionRequired所有审批按钮改为 respondAction
本地 artifact body 当 assistant 正文deprecatedArtifactRef + artifact workspaceartifact owner 可打开并保留 source event。
本地 evidence / review 报告deprecatedEvidenceRef + evidence packevidence export/review 可追溯到 runtime turn。
ModelConfigStore keycompat migration sourceApp Server provider store平台宿主迁移成功后本地 key 清除。
Provider key in payload/envdeadnonecontract / functional guard 禁止回流。

Blocked / degraded 行为

缺口UI 行为
Host bridge 不可用显示 unavailable,引导进入平台设置或 standalone dev。
Provider 未配置显示 needs-setup / blocked,打开平台 Provider 设置。
Event stream 中断标记 stale,调用 read model repair。
缺 tool/action/artifact/evidence scope id降级 diagnostics,不推断成功。
缺 subagent lineage显示 degraded graph,不伪造 teammate。
只有 fixture/mock backend只能作为测试,不标记 production ready。

验收

Content Studio 接入共享 AgentUI 时至少要证明:

  1. turn payload/env 不包含 key、token、secret。
  2. providerPreference / modelPreference 是非敏感 preference,不是 credential。
  3. RuntimeEvent 能投影到 MessageParts、ProcessTimeline、ExecutionGraph、ActionRequired、ArtifactRef、EvidenceRef。
  4. action 点击只调用 callback;完成态来自 action.resolved
  5. artifact/evidence 只显示 ref;完整内容由产品 workspace 或 evidence pack 打开。
  6. 缺 App Server / Host / Provider 时 fail closed,不切 production mock。
  7. GUI 主路径接入后补产品 UI 回归和 GUI smoke。

参考验证:

bash
npm --prefix packages/agent-ui-contracts run test
npm --prefix packages/agent-runtime-client run test
npm --prefix packages/agent-runtime-projection run test
npm --prefix packages/agent-runtime-ui run test

产品代码接入后再运行产品仓对应 functional / E2E / smoke gate。

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