| 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 | assertSemanticProjectionIntegrity, |
| 9 | assertUserMessagesInclude, |
| 10 | assertVisibleTurnItemsMirrorLocalTurnItems, |
| 11 | OPENCODE2_COMMAND_PROMPT, |
| 12 | projectionFor, |
| 13 | } from "../shared.ts"; |
| 14 | |
| 15 | /** |
| 16 | * `/hello WORLD` names a workspace command, so it runs through |
| 17 | * `session.command` and OpenCode expands the template ("Reply with exactly: |
| 18 | * HELLO $ARGUMENTS") in its own execution, which ends the turn. |
| 19 | */ |
| 20 | export function assertOpenCode2CommandOutput( |
| 21 | result: OrchestratorV2ScenarioResult, |
| 22 | transcript: ProviderReplayTranscript, |
| 23 | ) { |
| 24 | assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] }); |
| 25 | const projection = projectionFor(result, transcript.scenario); |
| 26 | assertSemanticProjectionIntegrity(projection); |
| 27 | assertVisibleTurnItemsMirrorLocalTurnItems(projection); |
| 28 | assertUserMessagesInclude(projection, [OPENCODE2_COMMAND_PROMPT]); |
| 29 | assertAssistantTextIncludes(projection, "HELLO WORLD"); |
| 30 | assert.deepEqual( |
| 31 | projection.providerTurns.map((turn) => turn.status), |
| 32 | ["completed"], |
| 33 | ); |
| 34 | } |