docs: complete scene 8 chat entry slice

This commit is contained in:
lda
2026-07-12 05:15:56 +07:00 Verified
parent 3158060211
commit d1128c0b49
9 changed files with 60 additions and 28 deletions
@@ -154,9 +154,14 @@ describe("projectPreparedAuthoringThread", () => {
});
it("keeps the canonical projection unchanged without a request override", () => {
expect(projectPreparedAuthoringThread("discover")).toEqual(
projectPreparedAuthoringThread("discover"),
);
const firstUser = projectPreparedAuthoringThread("discover")
.find((message) => message.role === "user");
expect(firstUser?.parts).toEqual([
{
type: "text",
text: "We need to author a report workflow for the lda_report scenario. What sources and capabilities are available?",
},
]);
});
it("overrides only the first user request and preserves Discover tool data", () => {
@@ -287,15 +287,15 @@ export const projectPreparedAuthoringThread = (
let requestReplaced = false;
return recording.slice(0, finalPhaseIndex + 1).flatMap((phase) => {
const conversation = phase.conversation.map((turn, index) =>
agentTextMessage(
const conversation = phase.conversation.map((turn, index) => {
const shouldReplaceRequest = requestOverride !== undefined && !requestReplaced && turn.role === "user";
if (shouldReplaceRequest) requestReplaced = true;
return agentTextMessage(
`authoring-${phase.phase}-message-${index}`,
turn.role,
requestOverride !== undefined && !requestReplaced && turn.role === "user"
? (requestReplaced = true, requestOverride)
: turn.text,
),
);
shouldReplaceRequest ? requestOverride : turn.text,
);
});
const groupId = authoringToolGroupId(phase.phase);
const toolParts = phase.commands.flatMap((command, index) => {
const callId = `${groupId}-command-${index}`;