The best way to control Claude Code, Codex and more from any computer or phone
| 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 | assertTurnItemTypeSequence, |
| 10 | assertUserMessagesInclude, |
| 11 | assertVisibleTurnItemsMirrorLocalTurnItems, |
| 12 | OPENCODE2_SIMPLE_PROMPT, |
| 13 | projectionFor, |
| 14 | } from "../shared.ts"; |
| 15 | |
| 16 | export function assertOpenCode2SimpleOutput( |
| 17 | result: OrchestratorV2ScenarioResult, |
| 18 | transcript: ProviderReplayTranscript, |
| 19 | ) { |
| 20 | assertBaseProjection({ result, transcript, runCount: 1, runStatuses: ["completed"] }); |
| 21 | const projection = projectionFor(result, transcript.scenario); |
| 22 | assertSemanticProjectionIntegrity(projection); |
| 23 | assertVisibleTurnItemsMirrorLocalTurnItems(projection); |
| 24 | assertTurnItemTypeSequence(projection, [ |
| 25 | "user_message", |
| 26 | "reasoning", |
| 27 | "assistant_message", |
| 28 | "checkpoint", |
| 29 | ]); |
| 30 | assertUserMessagesInclude(projection, [OPENCODE2_SIMPLE_PROMPT]); |
| 31 | assertAssistantTextIncludes(projection, "391 is not prime: it's the product 17 × 23."); |
| 32 | |
| 33 | const reasoning = projection.turnItems.find((item) => item.type === "reasoning"); |
| 34 | assert.include(reasoning?.type === "reasoning" ? reasoning.text : "", "17×23 = 391"); |
| 35 | |
| 36 | const [providerTurn] = projection.providerTurns; |
| 37 | assert.equal(providerTurn?.status, "completed"); |
| 38 | assert.deepInclude(providerTurn?.turnTokenUsage, { |
| 39 | usageStatus: "complete", |
| 40 | inputTokens: 8701 + 489, |
| 41 | cachedInputTokens: 489, |
| 42 | outputTokens: 113 + 147, |
| 43 | reasoningTokens: 147, |
| 44 | models: ["opencode/space-bunny-free"], |
| 45 | }); |
| 46 | assert.deepInclude(providerTurn?.tokenUsage, { |
| 47 | usedTokens: 8701 + 489 + 113, |
| 48 | maxTokens: 524288, |
| 49 | }); |
| 50 | } |