The best way to control Claude Code, Codex and more from any computer or phone
| 1 | import { assert, it } from "@effect/vitest"; |
| 2 | import { ProviderInstanceId, TextGenerationError } from "@t3tools/contracts"; |
| 3 | import * as Effect from "effect/Effect"; |
| 4 | |
| 5 | import { decodeJsonReply, fromRunner } from "./textGenerationOperations.ts"; |
| 6 | |
| 7 | // regression: #23726 a reply that echoes the schema key replaced the seed title with "title" |
| 8 | it.effect("fails a thread title reply that is only the schema key", () => |
| 9 | Effect.gen(function* () { |
| 10 | const textGeneration = fromRunner("Stub", (request) => |
| 11 | decodeJsonReply(request, "Stub", '{"title":"title","needsRefinement":false}'), |
| 12 | ); |
| 13 | |
| 14 | const outcome = yield* textGeneration |
| 15 | .generateThreadTitle({ |
| 16 | cwd: process.cwd(), |
| 17 | message: "$implement Issue #140", |
| 18 | modelSelection: { |
| 19 | instanceId: ProviderInstanceId.make("pi"), |
| 20 | model: "anthropic/claude-haiku-4-5", |
| 21 | }, |
| 22 | }) |
| 23 | .pipe(Effect.match({ onFailure: (error) => error, onSuccess: (result) => result })); |
| 24 | |
| 25 | assert.instanceOf(outcome, TextGenerationError); |
| 26 | assert.strictEqual(outcome.operation, "generateThreadTitle"); |
| 27 | }), |
| 28 | ); |