Skip to content

Commit cd2fffb

Browse files
committed
Plugin: align app server turn protocol
1 parent 7b53c9e commit cd2fffb

File tree

2 files changed

+171
-150
lines changed

2 files changed

+171
-150
lines changed

src/client.test.ts

Lines changed: 34 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { describe, expect, it } from "vitest";
22
import { __testing } from "./client.js";
33

44
describe("buildTurnStartPayloads", () => {
5-
it("uses only text input variants for normal turns", () => {
5+
it("uses the canonical v2 turn/start payload for normal turns", () => {
66
expect(
77
__testing.buildTurnStartPayloads({
88
threadId: "thread-123",
@@ -15,15 +15,10 @@ describe("buildTurnStartPayloads", () => {
1515
input: [{ type: "text", text: "ship it" }],
1616
model: "gpt-5.4",
1717
},
18-
{
19-
thread_id: "thread-123",
20-
input: [{ type: "text", text: "ship it" }],
21-
model: "gpt-5.4",
22-
},
2318
]);
2419
});
2520

26-
it("prefers text-only collaboration payloads and preserves explicit null developer instructions", () => {
21+
it("keeps collaboration payloads valid by including settings and preserving explicit null developer instructions", () => {
2722
expect(
2823
__testing.buildTurnStartPayloads({
2924
threadId: "thread-123",
@@ -51,7 +46,7 @@ describe("buildTurnStartPayloads", () => {
5146
},
5247
},
5348
{
54-
thread_id: "thread-123",
49+
threadId: "thread-123",
5550
input: [{ type: "text", text: "plan it" }],
5651
model: "gpt-5.4",
5752
collaboration_mode: {
@@ -66,27 +61,44 @@ describe("buildTurnStartPayloads", () => {
6661
threadId: "thread-123",
6762
input: [{ type: "text", text: "plan it" }],
6863
model: "gpt-5.4",
69-
collaborationMode: {
70-
mode: "plan",
71-
},
7264
},
65+
]);
66+
});
67+
});
68+
69+
describe("buildTurnSteerPayloads", () => {
70+
it("uses expectedTurnId plus text input for turn/steer", () => {
71+
expect(
72+
__testing.buildTurnSteerPayloads({
73+
threadId: "thread-123",
74+
turnId: "turn-456",
75+
text: "continue",
76+
}),
77+
).toEqual([
7378
{
74-
thread_id: "thread-123",
75-
input: [{ type: "text", text: "plan it" }],
76-
model: "gpt-5.4",
77-
collaboration_mode: {
78-
mode: "plan",
79-
},
79+
threadId: "thread-123",
80+
expectedTurnId: "turn-456",
81+
input: [{ type: "text", text: "continue" }],
8082
},
81-
{
83+
]);
84+
});
85+
});
86+
87+
describe("buildThreadResumePayloads", () => {
88+
it("uses the canonical camelCase resume payload", () => {
89+
expect(
90+
__testing.buildThreadResumePayloads({
8291
threadId: "thread-123",
83-
input: [{ type: "text", text: "plan it" }],
8492
model: "gpt-5.4",
85-
},
93+
cwd: "/tmp/workspace",
94+
serviceTier: "default",
95+
}),
96+
).toEqual([
8697
{
87-
thread_id: "thread-123",
88-
input: [{ type: "text", text: "plan it" }],
98+
threadId: "thread-123",
8999
model: "gpt-5.4",
100+
cwd: "/tmp/workspace",
101+
serviceTier: "default",
90102
},
91103
]);
92104
});

0 commit comments

Comments
 (0)