@devries-cameron20 / t3code Mirror · read-only
Fork 0

The best way to control Claude Code, Codex and more from any computer or phone

Mirrored from https://github.com/Camo67/t3code.git

Synced Nov 21, 04:45 UTC

main
ts 28 lines 1.07 KB
Raw
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 );