1import { assert } from "@effect/vitest";
2import type { ProviderReplayTranscript } from "@t3tools/contracts";
3
4import type { OrchestratorV2ScenarioResult } from "../../OrchestratorScenario.ts";
5import {
6 assertAssistantTextIncludes,
7 assertBaseProjection,
8 assertSemanticProjectionIntegrity,
9 assertUserMessagesInclude,
10 assertVisibleTurnItemsMirrorLocalTurnItems,
11 OPENCODE2_SKILL_PROMPT,
12 projectionFor,
13} from "../shared.ts";
14
15/**
16 * `$greet` names a workspace skill, so the prompt attaches it natively
17 * (`prompt{skills:[{id:"greet"}]}`, checked by the transcript) and the model
18 * follows it: the skill says to open with MANGO.
19 */
20export function assertOpenCode2SkillOutput(
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_SKILL_PROMPT]);
29 assertAssistantTextIncludes(projection, "MANGO");
30 assert.deepEqual(
31 projection.providerTurns.map((turn) => turn.status),
32 ["completed"],
33 );
34}