@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 29 lines 1.3 KB
Raw
1 import { expect, it } from "@effect/vitest";
2 import * as Exit from "effect/Exit";
3 import * as Schema from "effect/Schema";
4 import { Tool } from "effect/ai";
5
6 import { OrchestratorToolkit } from "./tools.ts";
7
8 // Oversized page sizes clamp on decode, so the schema has no `maximum`; Codex also drops
9 // bounds from its TypeScript view. The description is the only place a model sees a limit.
10 it("states t3_thread_read page size limits in the parameter descriptions", () => {
11 const schema = Tool.getJsonSchema(OrchestratorToolkit.tools.t3_thread_read) as {
12 readonly properties: Readonly<Record<string, { readonly description?: string }>>;
13 };
14 const limits = { limit: "100", runLimit: "50", maxCharsPerItem: "20000" };
15 for (const [name, maximum] of Object.entries(limits)) {
16 expect(schema.properties[name]?.description, name).toContain(maximum);
17 }
18 });
19
20 it("refuses a t3_thread_update whose fields do not fit its action", () => {
21 const decode = Schema.decodeUnknownExit(
22 OrchestratorToolkit.tools.t3_thread_update.parametersSchema,
23 );
24 expect(Exit.isFailure(decode({ action: "rename" }))).toBe(true);
25 expect(Exit.isFailure(decode({ action: "regenerate_title", title: "New" }))).toBe(true);
26 expect(Exit.isSuccess(decode({ action: "rename", title: "New", environmentId: undefined }))).toBe(
27 true,
28 );
29 });