Skip to content

Fixture Replay

replayAgentUiFixture 用 contracts fixtures 验证 projection 是否符合标准。

实现锚点:packages/agent-runtime-projection/src/fixtureReplay.ts

API

ts
export function replayAgentUiFixture<TEvent extends AgentRuntimeExecutionEvent>(
  fixture: AgentUiFixture<TEvent>
): AgentUiFixtureReplayResult<TEvent>;
ts
export interface AgentUiFixtureReplayResult<TEvent = AgentRuntimeExecutionEvent> {
  fixtureId: string;
  state: AgentUiProjectionState<TEvent>;
  validationIssues: AgentUiContractValidationIssue[];
  diagnostics: string[];
  passed: boolean;
}

Example

ts
import { getAgentUiFixture } from "@limecloud/agent-ui-contracts";
import { replayAgentUiFixture } from "@limecloud/agent-runtime-projection";

const result = replayAgentUiFixture(getAgentUiFixture("hitl-action"));

if (!result.passed) {
  console.error(result.diagnostics);
}

Checks

Replay 当前检查:

CheckDescription
validation issues复用 contracts validation。
message countexpected.messagePartCount 下限。
timeline countexpected.timelineEntryCount 下限。
graph countexpected.graphNodeCount 下限。
pending action countexpected.pendingActionCount 精确值。
artifact / evidence countrefs 下限。
team workbench countsexpected.teamWorkbench 中 roster、work item、handoff、review、lane count。
expected diagnostics允许特定 repair / failure diagnostics。

teamWorkbench 是必填 projection state 字段。Replay 对没有 team facts 的 fixture 也应确认它存在,并且 hasTeamSurface 与空数组一致。

Required Fixtures

每次修改 projection 逻辑,至少跑内置 fixtures:

ts
for (const fixture of agentUiConformanceFixtures) {
  expect(replayAgentUiFixture(fixture).passed).toBe(true);
}

Boundary

  • Fixture replay 不是 production transport。
  • Replay 不调用 App Server。
  • Replay 不渲染 React。
  • Replay 不替代 GUI smoke;它证明 projection reducer 对标准 facts 的理解。

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