| 1 | import { assert } from "@effect/vitest"; |
| 2 | import type { ProviderReplayTranscript } from "@t3tools/contracts"; |
| 3 | |
| 4 | import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts"; |
| 5 | import { |
| 6 | assertAssistantTextIncludes, |
| 7 | assertBaseProjection, |
| 8 | assertRuntimeRequestCounts, |
| 9 | assertSemanticProjectionIntegrity, |
| 10 | assertTurnItemTypes, |
| 11 | assertUserMessageInputIntents, |
| 12 | assertUserMessagesInclude, |
| 13 | assertVisibleTurnItemsMirrorLocalTurnItems, |
| 14 | MESSAGE_STEERING_INITIAL_PROMPT, |
| 15 | MESSAGE_STEERING_STEER_PROMPT, |
| 16 | projectionFor, |
| 17 | } from "../shared.ts"; |
| 18 | |
| 19 | export function assertClaudeMessageSteeringOutput( |
| 20 | result: OrchestratorV2ScenarioResult, |
| 21 | transcript: ProviderReplayTranscript, |
| 22 | ) { |
| 23 | assert.equal(transcript.provider, "claudeAgent"); |
| 24 | assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] }); |
| 25 | |
| 26 | const projection = projectionFor(result, transcript.scenario); |
| 27 | assertSemanticProjectionIntegrity(projection); |
| 28 | assertVisibleTurnItemsMirrorLocalTurnItems(projection); |
| 29 | assertTurnItemTypes(projection, ["user_message", "assistant_message"]); |
| 30 | assertRuntimeRequestCounts(projection, { total: 0 }); |
| 31 | assertUserMessagesInclude(projection, [ |
| 32 | MESSAGE_STEERING_INITIAL_PROMPT, |
| 33 | MESSAGE_STEERING_STEER_PROMPT, |
| 34 | ]); |
| 35 | assertUserMessageInputIntents(projection, ["turn_start", "steer"]); |
| 36 | assertAssistantTextIncludes(projection, "steering fixture observed"); |
| 37 | assert.equal(projection.runs.length, 1, "steering must attach to the active run"); |
| 38 | assert.equal( |
| 39 | projection.providerTurns.length, |
| 40 | 1, |
| 41 | "active steering must not create a new provider turn", |
| 42 | ); |
| 43 | } |