Skip to content

Commit 9f9673b

Browse files
clean: do not pass nulls for optional app-server fields (#150)
1 parent 06a749b commit 9f9673b

3 files changed

Lines changed: 7 additions & 58 deletions

File tree

src/CodexAcpClient.ts

Lines changed: 5 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@ import type {
2525
AccountLoginCompletedNotification,
2626
AccountUpdatedNotification,
2727
GetAccountResponse,
28-
ListMcpServerStatusParams,
2928
ListMcpServerStatusResponse,
3029
Model,
3130
SkillsListParams,
@@ -204,15 +203,9 @@ export class CodexAcpClient {
204203
await this.refreshSkills(request.cwd, request._meta);
205204

206205
const response = await this.codexClient.threadResume({
207-
approvalPolicy: null,
208-
sandbox: null,
209-
baseInstructions: null,
210206
config: await this.createSessionConfig(request.cwd, request.mcpServers ?? []),
211207
cwd: request.cwd,
212-
developerInstructions: null,
213-
model: null,
214208
modelProvider: this.getResumeModelProvider(),
215-
personality: null,
216209
threadId: request.sessionId,
217210
});
218211
const codexModels = await this.fetchAvailableModels();
@@ -227,15 +220,9 @@ export class CodexAcpClient {
227220

228221
async loadSession(request: acp.LoadSessionRequest): Promise<SessionMetadataWithThread> {
229222
const response = await this.codexClient.threadResume({
230-
approvalPolicy: null,
231-
sandbox: null,
232-
baseInstructions: null,
233223
config: await this.createSessionConfig(request.cwd, request.mcpServers ?? []),
234224
cwd: request.cwd,
235-
developerInstructions: null,
236-
model: null,
237225
modelProvider: this.getResumeModelProvider(),
238-
personality: null,
239226
threadId: request.sessionId,
240227
});
241228
const codexModels = await this.fetchAvailableModels();
@@ -255,14 +242,7 @@ export class CodexAcpClient {
255242
const response = await this.codexClient.threadStart({
256243
config: await this.createSessionConfig(request.cwd, request.mcpServers),
257244
modelProvider: this.getModelProvider(),
258-
model: null,
259245
cwd: request.cwd,
260-
approvalPolicy: null,
261-
sandbox: null,
262-
baseInstructions: null,
263-
developerInstructions: null,
264-
personality: null,
265-
ephemeral: null,
266246
});
267247

268248
const codexModels = await this.fetchAvailableModels();
@@ -407,14 +387,11 @@ export class CodexAcpClient {
407387

408388
await this.refreshSkills(cwd, request._meta);
409389
return await this.codexClient.runTurn({
410-
outputSchema: null,
411390
threadId: request.sessionId,
412391
input: input,
413392
approvalPolicy: agentMode.approvalPolicy,
414393
sandboxPolicy: agentMode.sandboxPolicy,
415394
summary: disableSummary ? "none" : null,
416-
personality: null,
417-
cwd: null,
418395
effort: effort,
419396
model: modelId.model,
420397
serviceTier: serviceTier,
@@ -468,8 +445,8 @@ export class CodexAcpClient {
468445
});
469446
}
470447

471-
async listMcpServers(params: ListMcpServerStatusParams = { cursor: null, limit: null }): Promise<ListMcpServerStatusResponse> {
472-
return this.codexClient.listMcpServerStatus(params);
448+
async listMcpServers(): Promise<ListMcpServerStatusResponse> {
449+
return this.codexClient.listMcpServerStatus({});
473450
}
474451

475452
async listSessions(request: acp.ListSessionsRequest): Promise<acp.ListSessionsResponse> {
@@ -499,11 +476,8 @@ export class CodexAcpClient {
499476
const modelProviders = preferredProvider ? [preferredProvider] : [];
500477
const listResponse = await this.codexClient.threadList({
501478
cursor: request.cursor ?? null,
502-
limit: null,
503-
sortKey: null,
504479
modelProviders: modelProviders,
505480
sourceKinds: sourceKinds,
506-
archived: null,
507481
});
508482

509483
if (listResponse.data.length === 0) {
@@ -561,30 +535,9 @@ export class CodexAcpClient {
561535

562536
private async runSessionListDiagnostics(): Promise<Record<string, unknown>> {
563537
const [allProviders, archivedAllProviders, customGateway] = await Promise.all([
564-
this.codexClient.threadList({
565-
cursor: null,
566-
limit: null,
567-
sortKey: null,
568-
modelProviders: [],
569-
sourceKinds: null,
570-
archived: null,
571-
}),
572-
this.codexClient.threadList({
573-
cursor: null,
574-
limit: null,
575-
sortKey: null,
576-
modelProviders: [],
577-
sourceKinds: null,
578-
archived: true,
579-
}),
580-
this.codexClient.threadList({
581-
cursor: null,
582-
limit: null,
583-
sortKey: null,
584-
modelProviders: ["custom-gateway"],
585-
sourceKinds: null,
586-
archived: null,
587-
}),
538+
this.codexClient.threadList({}),
539+
this.codexClient.threadList({archived: true}),
540+
this.codexClient.threadList({modelProviders: ["custom-gateway"]}),
588541
]);
589542

590543
return {

src/CodexAppServerClient.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import type {
66
ServerNotification
77
} from "./app-server";
88
import type {
9-
AccountLoginCompletedNotification, AccountUpdatedNotification,
109
ConfigReadParams,
1110
ConfigReadResponse,
1211
GetAccountParams,
@@ -257,11 +256,11 @@ export class CodexAppServerClient {
257256
});
258257
}
259258

260-
async listModels(params: ModelListParams = {cursor: null, limit: null}): Promise<ModelListResponse> {
259+
async listModels(params: ModelListParams): Promise<ModelListResponse> {
261260
return await this.sendRequest({ method: "model/list", params });
262261
}
263262

264-
async listSkills(params: SkillsListParams = {}): Promise<SkillsListResponse> {
263+
async listSkills(params: SkillsListParams): Promise<SkillsListResponse> {
265264
return await this.sendRequest({ method: "skills/list", params });
266265
}
267266

src/__tests__/CodexACPAgent/data/send-attachments-turn-start.json

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
"eventType": "request",
2222
"method": "turn/start",
2323
"params": {
24-
"outputSchema": null,
2524
"threadId": "threadId",
2625
"input": [
2726
{
@@ -53,8 +52,6 @@
5352
"excludeSlashTmp": false
5453
},
5554
"summary": null,
56-
"personality": null,
57-
"cwd": "cwd",
5855
"effort": "effort",
5956
"model": "model",
6057
"serviceTier": null

0 commit comments

Comments
 (0)