Open History to see the last commit
1import { assert, it } from "@effect/vitest";
2import * as Schema from "effect/Schema";
3
4import * as CodexSchema from "./schema.ts";
5
6const isGetAccountResponse = Schema.is(CodexSchema.V2GetAccountResponse);
7
8it("accepts Codex 0.150 multi-agent values", () => {
9 const schemas = [
10 CodexSchema.ServerNotification__SubAgentActivityKind,
11 CodexSchema.V2ItemStartedNotification__SubAgentActivityKind,
12 CodexSchema.V2ItemCompletedNotification__SubAgentActivityKind,
13 CodexSchema.V2ThreadReadResponse__SubAgentActivityKind,
14 CodexSchema.V2ThreadResumeResponse__SubAgentActivityKind,
15 ];
16
17 for (const schema of schemas) {
18 assert.equal(Schema.is(schema)("completed"), true);
19 }
20
21 for (const tool of ["sendMessage", "followupTask", "interruptAgent", "listAgents"]) {
22 assert.equal(Schema.is(CodexSchema.ServerNotification__CollabAgentTool)(tool), true);
23 assert.equal(Schema.is(CodexSchema.V2ThreadResumeResponse__CollabAgentTool)(tool), true);
24 }
25
26 assert.equal(
27 Schema.is(CodexSchema.ServerNotification__CollabAgentToolCallStatus)("interrupted"),
28 true,
29 );
30 assert.equal(
31 Schema.is(CodexSchema.V2ThreadResumeResponse__CollabAgentToolCallStatus)("interrupted"),
32 true,
33 );
34
35 const resumeResponse = {
36 approvalPolicy: "never",
37 approvalsReviewer: "user",
38 cwd: "/tmp/project",
39 model: "gpt-5.6-sol",
40 modelProvider: "openai",
41 sandbox: { type: "dangerFullAccess" },
42 thread: {
43 cliVersion: "0.150.0",
44 createdAt: 0,
45 cwd: "/tmp/project",
46 ephemeral: false,
47 id: "root-thread",
48 modelProvider: "openai",
49 preview: "",
50 sessionId: "session-1",
51 source: "cli",
52 status: { type: "idle" },
53 turns: [
54 {
55 id: "turn-1",
56 status: "completed",
57 items: [
58 {
59 agentsStates: {},
60 id: "item-1",
61 receiverThreadIds: ["child-thread"],
62 senderThreadId: "root-thread",
63 status: "interrupted",
64 tool: "followupTask",
65 type: "collabAgentToolCall",
66 },
67 ],
68 },
69 ],
70 updatedAt: 0,
71 },
72 };
73
74 assert.equal(Schema.is(CodexSchema.V2ThreadResumeResponse)(resumeResponse), true);
75});
76
77it("accepts Codex 0.150 account plan values", () => {
78 const planTypes = [
79 "self_serve_business_prolite",
80 "ent26",
81 "enterprise_cbp_automation",
82 "edu_plus",
83 "edu_pro",
84 ];
85
86 for (const planType of planTypes) {
87 const accountResponse = {
88 account: {
89 email: "user@example.com",
90 planType,
91 type: "chatgpt",
92 },
93 requiresOpenaiAuth: true,
94 };
95
96 assert.equal(isGetAccountResponse(accountResponse), true);
97 }
98});