fix: address presentation review findings

This commit is contained in:
lda
2026-07-11 05:17:35 +07:00 Verified
parent 531f934288
commit 371377716c
18 changed files with 140 additions and 61 deletions
@@ -0,0 +1,44 @@
import { render, screen } from "@testing-library/react";
import { describe, expect, it } from "vitest";
import { findBeat, findScene } from "../storyboard.js";
import { AgentHandoffScene } from "./AgentHandoffScene.js";
const renderBeat = (beatId: "request" | "handoff") => {
const scene = findScene("agent-handoff");
const beat = findBeat("agent-handoff", beatId);
if (!scene || !beat) throw new Error(`missing agent-handoff/${beatId}`);
return render(<AgentHandoffScene scene={scene} beat={beat} />);
};
describe("AgentHandoffScene", () => {
it("renders a log region named prepared authoring conversation", () => {
renderBeat("request");
expect(screen.getByRole("log", { name: "prepared authoring conversation" })).toBeInTheDocument();
});
it("renders separated user and assistant turns on the request beat", () => {
renderBeat("request");
const userMessages = screen.getAllByText(/report|workflow|prepare/i);
expect(userMessages.length).toBeGreaterThanOrEqual(1);
const assistantMessages = screen.getAllByText(/inspect|capabilities|sources|schemas|let me/i);
expect(assistantMessages.length).toBeGreaterThanOrEqual(1);
});
it("renders the full conversation on the handoff beat", () => {
renderBeat("handoff");
const userMessages = screen.getAllByText(/report|workflow|prepare|save/i);
expect(userMessages.length).toBeGreaterThanOrEqual(1);
const assistantMessages = screen.getAllByText(/inspect|sources|capabilities|compile|deployment|artifact/i);
expect(assistantMessages.length).toBeGreaterThanOrEqual(2);
});
it("does not render prepared workflow lifecycle content", () => {
renderBeat("request");
expect(screen.queryByText("prepared workflow lifecycle")).not.toBeInTheDocument();
});
it("does not include prepared workflow lifecycle content on handoff", () => {
renderBeat("handoff");
expect(screen.queryByText("prepared workflow lifecycle")).not.toBeInTheDocument();
});
});
@@ -0,0 +1,50 @@
import { useMemo } from "react";
import { agentTextMessage } from "../../demo/agent/events.js";
import { AssistantOperatorThread } from "../chat/AssistantOperatorThread.js";
import { projectPreparedAuthoring } from "./authoring-recording.js";
import type { SceneBeatDefinition, SceneDefinition } from "../storyboard.js";
type AgentHandoffSceneProps = {
readonly scene: SceneDefinition;
readonly beat: SceneBeatDefinition;
};
const requestMessages = [
agentTextMessage("handoff-user-1", "user", "We need to prepare a report workflow for the lda_report scenario. Use the available CLI tools to inspect, author, and deploy it."),
agentTextMessage("handoff-assistant-1", "assistant", "Let me inspect the available sources, capabilities, and schemas first."),
];
/**
* Full-screen prepared-authoring conversation for Scene 8.
*
* The request beat shows the operator asking the agent to prepare a report;
* the handoff beat reveals the full completed conversation with all phases.
* Neither run actions nor approval actions are passed because this is a
* prepared recording, not a live agent interaction.
*/
export const AgentHandoffScene = ({ beat }: AgentHandoffSceneProps) => {
const messages = useMemo(() => {
if (beat.id === "handoff") {
const recording = projectPreparedAuthoring();
const result: ReturnType<typeof agentTextMessage>[] = [];
let index = 0;
for (const phase of recording) {
for (const turn of phase.conversation) {
result.push(
agentTextMessage(`msg-${index++}`, turn.role, turn.text),
);
}
}
return result;
}
return requestMessages;
}, [beat.id]);
return (
<AssistantOperatorThread
mode="full"
messages={messages}
ariaLabel="prepared authoring conversation"
/>
);
};