Skip to content
Source
Sign inSign up
pingdotgg/t3code
Open History to see the last commit

schema.test.ts

73 lines2.1 KB

1import { assert, it } from "@effect/vitest";
2import * as Schema from "effect/Schema";
3​
4import * as CodexSchema from "./schema.ts";
5​
6it("accepts Codex 0.150 multi-agent values", () => {
7 const schemas = [
8 CodexSchema.ServerNotification__SubAgentActivityKind,
9 CodexSchema.V2ItemStartedNotification__SubAgentActivityKind,
10 CodexSchema.V2ItemCompletedNotification__SubAgentActivityKind,
11 CodexSchema.V2ThreadReadResponse__SubAgentActivityKind,
12 CodexSchema.V2ThreadResumeResponse__SubAgentActivityKind,
13 ];
14​
15 for (const schema of schemas) {
16 assert.equal(Schema.is(schema)("completed"), true);
17 }
18​
19 for (const tool of ["sendMessage", "followupTask", "interruptAgent", "listAgents"]) {
20 assert.equal(Schema.is(CodexSchema.ServerNotification__CollabAgentTool)(tool), true);
21 assert.equal(Schema.is(CodexSchema.V2ThreadResumeResponse__CollabAgentTool)(tool), true);
22 }
23​
24 assert.equal(
25 Schema.is(CodexSchema.ServerNotification__CollabAgentToolCallStatus)("interrupted"),
26 true,
27 );
28 assert.equal(
29 Schema.is(CodexSchema.V2ThreadResumeResponse__CollabAgentToolCallStatus)("interrupted"),
30 true,
31 );
32​
33 const resumeResponse = {
34 approvalPolicy: "never",
35 approvalsReviewer: "user",
36 cwd: "/tmp/project",
37 model: "gpt-5.6-sol",
38 modelProvider: "openai",
39 sandbox: { type: "dangerFullAccess" },
40 thread: {
41 cliVersion: "0.150.0",
42 createdAt: 0,
43 cwd: "/tmp/project",
44 ephemeral: false,
45 id: "root-thread",
46 modelProvider: "openai",
47 preview: "",
48 sessionId: "session-1",
49 source: "cli",
50 status: { type: "idle" },
51 turns: [
52 {
53 id: "turn-1",
54 status: "completed",
55 items: [
56 {
57 agentsStates: {},
58 id: "item-1",
59 receiverThreadIds: ["child-thread"],
60 senderThreadId: "root-thread",
61 status: "interrupted",
62 tool: "followupTask",
63 type: "collabAgentToolCall",
64 },
65 ],
66 },
67 ],
68 updatedAt: 0,
69 },
70 };
71​
72 assert.equal(Schema.is(CodexSchema.V2ThreadResumeResponse)(resumeResponse), true);
73});