ai-sdk-provider-codex-cli 1.2.1 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +3 -3
- package/dist/index.cjs +48 -4
- package/dist/index.d.cts +36 -1
- package/dist/index.d.ts +36 -1
- package/dist/index.js +48 -4
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -54,7 +54,7 @@ npm i ai ai-sdk-provider-codex-cli
|
|
|
54
54
|
npm i ai@^5.0.0 ai-sdk-provider-codex-cli@ai-sdk-v5
|
|
55
55
|
```
|
|
56
56
|
|
|
57
|
-
> **⚠️ Codex CLI Version**: Requires the current stable Codex CLI **0.
|
|
57
|
+
> **⚠️ Codex CLI Version**: Requires the current stable Codex CLI **0.144.x** for full support of both provider modes (`codexExec` and `codexAppServer`). This package pins its optional `@openai/codex` dependency to `^0.144.0`, the latest non-alpha release line validated for this maintenance update. If you supply your own Codex CLI (global install or custom `codexPath`), check it with `codex --version` and upgrade if needed.
|
|
58
58
|
>
|
|
59
59
|
> ```bash
|
|
60
60
|
> npm i -g @openai/codex@latest
|
|
@@ -90,7 +90,7 @@ import { createCodexAppServer } from 'ai-sdk-provider-codex-cli';
|
|
|
90
90
|
|
|
91
91
|
const provider = createCodexAppServer({
|
|
92
92
|
defaultSettings: {
|
|
93
|
-
minCodexVersion: '0.
|
|
93
|
+
minCodexVersion: '0.144.0',
|
|
94
94
|
autoApprove: false,
|
|
95
95
|
personality: 'pragmatic',
|
|
96
96
|
},
|
|
@@ -363,7 +363,7 @@ See [docs/ai-sdk-v5/configuration.md](docs/ai-sdk-v5/configuration.md) for the f
|
|
|
363
363
|
- `minCodexVersion`: minimum supported app-server version (semver)
|
|
364
364
|
- `includeRawChunks`: emit raw JSON-RPC notifications as `raw` stream parts by default
|
|
365
365
|
- `serverRequests`: typed handlers for server-initiated JSON-RPC requests
|
|
366
|
-
- `autoApprove`: default approval response when no custom handler is provided
|
|
366
|
+
- `autoApprove`: default approval response when no custom handler is provided (covers command execution, file changes, skills, and MCP tool call approvals via `mcpServer/elicitation/request` on Codex >= 0.139)
|
|
367
367
|
- `persistExtendedHistory`: request extended thread history persistence
|
|
368
368
|
- `threadMode`: `stateless` (default) or `persistent` automatic thread reuse
|
|
369
369
|
- `resume`: shorthand to resume an existing thread id
|
package/dist/index.cjs
CHANGED
|
@@ -203,6 +203,9 @@ var serverRequestsSchema = zod.z.object({
|
|
|
203
203
|
onSkillApproval: zod.z.any().refine((val) => val === void 0 || typeof val === "function", {
|
|
204
204
|
message: "onSkillApproval must be a function"
|
|
205
205
|
}).optional(),
|
|
206
|
+
onMcpElicitation: zod.z.any().refine((val) => val === void 0 || typeof val === "function", {
|
|
207
|
+
message: "onMcpElicitation must be a function"
|
|
208
|
+
}).optional(),
|
|
206
209
|
onToolRequestUserInput: zod.z.any().refine((val) => val === void 0 || typeof val === "function", {
|
|
207
210
|
message: "onToolRequestUserInput must be a function"
|
|
208
211
|
}).optional(),
|
|
@@ -4385,6 +4388,17 @@ var skillRequestApprovalParamsSchema = zod.z.object({
|
|
|
4385
4388
|
itemId: zod.z.string(),
|
|
4386
4389
|
skillName: zod.z.string()
|
|
4387
4390
|
}).passthrough();
|
|
4391
|
+
var mcpServerElicitationRequestParamsSchema = zod.z.object({
|
|
4392
|
+
threadId: zod.z.string(),
|
|
4393
|
+
turnId: zod.z.string().nullable().optional(),
|
|
4394
|
+
serverName: zod.z.string(),
|
|
4395
|
+
mode: zod.z.string().optional(),
|
|
4396
|
+
message: zod.z.string().optional(),
|
|
4397
|
+
requestedSchema: zod.z.unknown().optional(),
|
|
4398
|
+
url: zod.z.string().optional(),
|
|
4399
|
+
elicitationId: zod.z.string().optional(),
|
|
4400
|
+
_meta: zod.z.record(zod.z.string(), zod.z.unknown()).nullable().optional()
|
|
4401
|
+
}).passthrough();
|
|
4388
4402
|
var dynamicToolCallParamsSchema = zod.z.object({
|
|
4389
4403
|
threadId: zod.z.string(),
|
|
4390
4404
|
turnId: zod.z.string(),
|
|
@@ -4400,6 +4414,7 @@ var serverRequestParamSchemas = {
|
|
|
4400
4414
|
"item/commandExecution/requestApproval": commandExecutionRequestApprovalParamsSchema,
|
|
4401
4415
|
"item/fileChange/requestApproval": fileChangeRequestApprovalParamsSchema,
|
|
4402
4416
|
"item/tool/requestUserInput": toolRequestUserInputParamsSchema,
|
|
4417
|
+
"mcpServer/elicitation/request": mcpServerElicitationRequestParamsSchema,
|
|
4403
4418
|
"skill/requestApproval": skillRequestApprovalParamsSchema,
|
|
4404
4419
|
"item/tool/call": dynamicToolCallParamsSchema,
|
|
4405
4420
|
"account/chatgptAuthTokens/refresh": chatgptAuthTokensRefreshParamsSchema
|
|
@@ -4423,6 +4438,11 @@ var serverRequestSchema = zod.z.discriminatedUnion("method", [
|
|
|
4423
4438
|
method: zod.z.literal("item/tool/requestUserInput"),
|
|
4424
4439
|
params: toolRequestUserInputParamsSchema
|
|
4425
4440
|
}).passthrough(),
|
|
4441
|
+
zod.z.object({
|
|
4442
|
+
id: jsonRpcIdSchema,
|
|
4443
|
+
method: zod.z.literal("mcpServer/elicitation/request"),
|
|
4444
|
+
params: mcpServerElicitationRequestParamsSchema
|
|
4445
|
+
}).passthrough(),
|
|
4426
4446
|
zod.z.object({
|
|
4427
4447
|
id: jsonRpcIdSchema,
|
|
4428
4448
|
method: zod.z.literal("skill/requestApproval"),
|
|
@@ -4647,7 +4667,7 @@ var AppServerRpcClient = class extends events.EventEmitter {
|
|
|
4647
4667
|
if (this.serverCapabilities?.modelList === false) {
|
|
4648
4668
|
throw new UnsupportedFeatureError({
|
|
4649
4669
|
feature: "model/list",
|
|
4650
|
-
minCodexVersion: this.settings.minCodexVersion ?? "0.
|
|
4670
|
+
minCodexVersion: this.settings.minCodexVersion ?? "0.144.0",
|
|
4651
4671
|
serverVersion: this.serverVersion
|
|
4652
4672
|
});
|
|
4653
4673
|
}
|
|
@@ -4660,7 +4680,7 @@ var AppServerRpcClient = class extends events.EventEmitter {
|
|
|
4660
4680
|
if (error instanceof JsonRpcRequestError && error.code === -32601) {
|
|
4661
4681
|
throw new UnsupportedFeatureError({
|
|
4662
4682
|
feature: "model/list",
|
|
4663
|
-
minCodexVersion: this.settings.minCodexVersion ?? "0.
|
|
4683
|
+
minCodexVersion: this.settings.minCodexVersion ?? "0.144.0",
|
|
4664
4684
|
serverVersion: this.serverVersion
|
|
4665
4685
|
});
|
|
4666
4686
|
}
|
|
@@ -4817,7 +4837,7 @@ var AppServerRpcClient = class extends events.EventEmitter {
|
|
|
4817
4837
|
const message = String(error?.message ?? error);
|
|
4818
4838
|
if (message.includes("ENOENT") || message.includes("unknown subcommand")) {
|
|
4819
4839
|
throw new Error(
|
|
4820
|
-
"codex app-server requires codex CLI >= 0.
|
|
4840
|
+
"codex app-server requires codex CLI >= 0.144.0. Run 'codex --version' to check."
|
|
4821
4841
|
);
|
|
4822
4842
|
}
|
|
4823
4843
|
throw createAPICallError({
|
|
@@ -4839,7 +4859,7 @@ var AppServerRpcClient = class extends events.EventEmitter {
|
|
|
4839
4859
|
return;
|
|
4840
4860
|
}
|
|
4841
4861
|
this.serverVersion = detected;
|
|
4842
|
-
const minVersion = this.settings.minCodexVersion ?? "0.
|
|
4862
|
+
const minVersion = this.settings.minCodexVersion ?? "0.144.0";
|
|
4843
4863
|
const compared = compareSemver(detected, minVersion);
|
|
4844
4864
|
if (compared === void 0) {
|
|
4845
4865
|
this.logger.warn(
|
|
@@ -5108,6 +5128,30 @@ var AppServerRpcClient = class extends events.EventEmitter {
|
|
|
5108
5128
|
await sendResult({ decision: autoApprove ? "approve" : "decline" });
|
|
5109
5129
|
return;
|
|
5110
5130
|
}
|
|
5131
|
+
case "mcpServer/elicitation/request": {
|
|
5132
|
+
const handled = await runHandler(
|
|
5133
|
+
() => handlers.onMcpElicitation?.(normalized)
|
|
5134
|
+
);
|
|
5135
|
+
if (handled !== void 0) {
|
|
5136
|
+
await sendResult(handled);
|
|
5137
|
+
return;
|
|
5138
|
+
}
|
|
5139
|
+
const fallback = await runHandler(
|
|
5140
|
+
() => handlers.onUnhandled?.(normalized)
|
|
5141
|
+
);
|
|
5142
|
+
if (fallback !== void 0) {
|
|
5143
|
+
await sendResult(fallback);
|
|
5144
|
+
return;
|
|
5145
|
+
}
|
|
5146
|
+
const meta = normalized.params._meta;
|
|
5147
|
+
const isToolCallApproval = meta?.codex_approval_kind === "mcp_tool_call";
|
|
5148
|
+
if (isToolCallApproval && autoApprove) {
|
|
5149
|
+
await sendResult({ action: "accept", content: {} });
|
|
5150
|
+
} else {
|
|
5151
|
+
await sendResult({ action: "decline", content: null });
|
|
5152
|
+
}
|
|
5153
|
+
return;
|
|
5154
|
+
}
|
|
5111
5155
|
case "item/tool/requestUserInput": {
|
|
5112
5156
|
const handled = await runHandler(
|
|
5113
5157
|
() => handlers.onToolRequestUserInput?.(
|
package/dist/index.d.cts
CHANGED
|
@@ -407,6 +407,29 @@ interface ToolRequestUserInputParams {
|
|
|
407
407
|
interface ToolRequestUserInputResponse {
|
|
408
408
|
answers: Record<string, unknown>;
|
|
409
409
|
}
|
|
410
|
+
type McpServerElicitationAction = 'accept' | 'decline' | 'cancel';
|
|
411
|
+
interface McpServerElicitationRequestParams {
|
|
412
|
+
threadId: string;
|
|
413
|
+
/** Nullable: the elicitation may arrive outside of an active turn. */
|
|
414
|
+
turnId?: string | null;
|
|
415
|
+
serverName: string;
|
|
416
|
+
/** 'form' requests carry message/requestedSchema; 'url' requests carry url/elicitationId. */
|
|
417
|
+
mode?: string;
|
|
418
|
+
message?: string;
|
|
419
|
+
requestedSchema?: unknown;
|
|
420
|
+
url?: string;
|
|
421
|
+
elicitationId?: string;
|
|
422
|
+
/**
|
|
423
|
+
* For MCP tool approval elicitations, Codex sets
|
|
424
|
+
* `codex_approval_kind: 'mcp_tool_call'` and may include `persist` hints.
|
|
425
|
+
*/
|
|
426
|
+
_meta?: Record<string, unknown> | null;
|
|
427
|
+
}
|
|
428
|
+
interface McpServerElicitationRequestResponse {
|
|
429
|
+
action: McpServerElicitationAction;
|
|
430
|
+
/** Structured user input for accepted elicitations; null for decline/cancel. */
|
|
431
|
+
content?: Record<string, unknown> | null;
|
|
432
|
+
}
|
|
410
433
|
interface DynamicToolCallParams {
|
|
411
434
|
threadId: string;
|
|
412
435
|
turnId: string;
|
|
@@ -547,6 +570,11 @@ interface AppServerSkillApprovalRequest {
|
|
|
547
570
|
method: 'skill/requestApproval';
|
|
548
571
|
params: SkillRequestApprovalParams;
|
|
549
572
|
}
|
|
573
|
+
interface AppServerMcpElicitationRequest {
|
|
574
|
+
id: JsonRpcId;
|
|
575
|
+
method: 'mcpServer/elicitation/request';
|
|
576
|
+
params: McpServerElicitationRequestParams;
|
|
577
|
+
}
|
|
550
578
|
interface AppServerToolRequestUserInputRequest {
|
|
551
579
|
id: JsonRpcId;
|
|
552
580
|
method: 'item/tool/requestUserInput';
|
|
@@ -580,6 +608,13 @@ interface CodexAppServerRequestHandlers {
|
|
|
580
608
|
onCommandExecutionApproval?: (request: AppServerCommandExecutionApprovalRequest) => Promise<CommandExecutionRequestApprovalResponse | undefined>;
|
|
581
609
|
onFileChangeApproval?: (request: AppServerFileChangeApprovalRequest) => Promise<FileChangeRequestApprovalResponse | undefined>;
|
|
582
610
|
onSkillApproval?: (request: AppServerSkillApprovalRequest) => Promise<SkillRequestApprovalResponse | undefined>;
|
|
611
|
+
/**
|
|
612
|
+
* Handles `mcpServer/elicitation/request` (Codex >= 0.139), which includes
|
|
613
|
+
* MCP tool call approvals (`params._meta.codex_approval_kind === 'mcp_tool_call'`).
|
|
614
|
+
* Built-in default: accept tool call approvals when `autoApprove` is true,
|
|
615
|
+
* decline all other elicitations.
|
|
616
|
+
*/
|
|
617
|
+
onMcpElicitation?: (request: AppServerMcpElicitationRequest) => Promise<McpServerElicitationRequestResponse | undefined>;
|
|
583
618
|
onToolRequestUserInput?: (request: AppServerToolRequestUserInputRequest) => Promise<ToolRequestUserInputResponse | undefined>;
|
|
584
619
|
onDynamicToolCall?: (request: AppServerDynamicToolCallRequest) => Promise<DynamicToolCallResponse | undefined>;
|
|
585
620
|
onAuthRefresh?: (request: AppServerAuthRefreshRequest) => Promise<ChatgptAuthTokensRefreshResponse | undefined>;
|
|
@@ -687,7 +722,7 @@ interface CodexAppServerProvider extends ProviderV3 {
|
|
|
687
722
|
* @example
|
|
688
723
|
* ```ts
|
|
689
724
|
* const provider = createCodexAppServer({
|
|
690
|
-
* defaultSettings: { minCodexVersion: '0.
|
|
725
|
+
* defaultSettings: { minCodexVersion: '0.144.0' },
|
|
691
726
|
* });
|
|
692
727
|
*
|
|
693
728
|
* try {
|
package/dist/index.d.ts
CHANGED
|
@@ -407,6 +407,29 @@ interface ToolRequestUserInputParams {
|
|
|
407
407
|
interface ToolRequestUserInputResponse {
|
|
408
408
|
answers: Record<string, unknown>;
|
|
409
409
|
}
|
|
410
|
+
type McpServerElicitationAction = 'accept' | 'decline' | 'cancel';
|
|
411
|
+
interface McpServerElicitationRequestParams {
|
|
412
|
+
threadId: string;
|
|
413
|
+
/** Nullable: the elicitation may arrive outside of an active turn. */
|
|
414
|
+
turnId?: string | null;
|
|
415
|
+
serverName: string;
|
|
416
|
+
/** 'form' requests carry message/requestedSchema; 'url' requests carry url/elicitationId. */
|
|
417
|
+
mode?: string;
|
|
418
|
+
message?: string;
|
|
419
|
+
requestedSchema?: unknown;
|
|
420
|
+
url?: string;
|
|
421
|
+
elicitationId?: string;
|
|
422
|
+
/**
|
|
423
|
+
* For MCP tool approval elicitations, Codex sets
|
|
424
|
+
* `codex_approval_kind: 'mcp_tool_call'` and may include `persist` hints.
|
|
425
|
+
*/
|
|
426
|
+
_meta?: Record<string, unknown> | null;
|
|
427
|
+
}
|
|
428
|
+
interface McpServerElicitationRequestResponse {
|
|
429
|
+
action: McpServerElicitationAction;
|
|
430
|
+
/** Structured user input for accepted elicitations; null for decline/cancel. */
|
|
431
|
+
content?: Record<string, unknown> | null;
|
|
432
|
+
}
|
|
410
433
|
interface DynamicToolCallParams {
|
|
411
434
|
threadId: string;
|
|
412
435
|
turnId: string;
|
|
@@ -547,6 +570,11 @@ interface AppServerSkillApprovalRequest {
|
|
|
547
570
|
method: 'skill/requestApproval';
|
|
548
571
|
params: SkillRequestApprovalParams;
|
|
549
572
|
}
|
|
573
|
+
interface AppServerMcpElicitationRequest {
|
|
574
|
+
id: JsonRpcId;
|
|
575
|
+
method: 'mcpServer/elicitation/request';
|
|
576
|
+
params: McpServerElicitationRequestParams;
|
|
577
|
+
}
|
|
550
578
|
interface AppServerToolRequestUserInputRequest {
|
|
551
579
|
id: JsonRpcId;
|
|
552
580
|
method: 'item/tool/requestUserInput';
|
|
@@ -580,6 +608,13 @@ interface CodexAppServerRequestHandlers {
|
|
|
580
608
|
onCommandExecutionApproval?: (request: AppServerCommandExecutionApprovalRequest) => Promise<CommandExecutionRequestApprovalResponse | undefined>;
|
|
581
609
|
onFileChangeApproval?: (request: AppServerFileChangeApprovalRequest) => Promise<FileChangeRequestApprovalResponse | undefined>;
|
|
582
610
|
onSkillApproval?: (request: AppServerSkillApprovalRequest) => Promise<SkillRequestApprovalResponse | undefined>;
|
|
611
|
+
/**
|
|
612
|
+
* Handles `mcpServer/elicitation/request` (Codex >= 0.139), which includes
|
|
613
|
+
* MCP tool call approvals (`params._meta.codex_approval_kind === 'mcp_tool_call'`).
|
|
614
|
+
* Built-in default: accept tool call approvals when `autoApprove` is true,
|
|
615
|
+
* decline all other elicitations.
|
|
616
|
+
*/
|
|
617
|
+
onMcpElicitation?: (request: AppServerMcpElicitationRequest) => Promise<McpServerElicitationRequestResponse | undefined>;
|
|
583
618
|
onToolRequestUserInput?: (request: AppServerToolRequestUserInputRequest) => Promise<ToolRequestUserInputResponse | undefined>;
|
|
584
619
|
onDynamicToolCall?: (request: AppServerDynamicToolCallRequest) => Promise<DynamicToolCallResponse | undefined>;
|
|
585
620
|
onAuthRefresh?: (request: AppServerAuthRefreshRequest) => Promise<ChatgptAuthTokensRefreshResponse | undefined>;
|
|
@@ -687,7 +722,7 @@ interface CodexAppServerProvider extends ProviderV3 {
|
|
|
687
722
|
* @example
|
|
688
723
|
* ```ts
|
|
689
724
|
* const provider = createCodexAppServer({
|
|
690
|
-
* defaultSettings: { minCodexVersion: '0.
|
|
725
|
+
* defaultSettings: { minCodexVersion: '0.144.0' },
|
|
691
726
|
* });
|
|
692
727
|
*
|
|
693
728
|
* try {
|
package/dist/index.js
CHANGED
|
@@ -195,6 +195,9 @@ var serverRequestsSchema = z.object({
|
|
|
195
195
|
onSkillApproval: z.any().refine((val) => val === void 0 || typeof val === "function", {
|
|
196
196
|
message: "onSkillApproval must be a function"
|
|
197
197
|
}).optional(),
|
|
198
|
+
onMcpElicitation: z.any().refine((val) => val === void 0 || typeof val === "function", {
|
|
199
|
+
message: "onMcpElicitation must be a function"
|
|
200
|
+
}).optional(),
|
|
198
201
|
onToolRequestUserInput: z.any().refine((val) => val === void 0 || typeof val === "function", {
|
|
199
202
|
message: "onToolRequestUserInput must be a function"
|
|
200
203
|
}).optional(),
|
|
@@ -4377,6 +4380,17 @@ var skillRequestApprovalParamsSchema = z.object({
|
|
|
4377
4380
|
itemId: z.string(),
|
|
4378
4381
|
skillName: z.string()
|
|
4379
4382
|
}).passthrough();
|
|
4383
|
+
var mcpServerElicitationRequestParamsSchema = z.object({
|
|
4384
|
+
threadId: z.string(),
|
|
4385
|
+
turnId: z.string().nullable().optional(),
|
|
4386
|
+
serverName: z.string(),
|
|
4387
|
+
mode: z.string().optional(),
|
|
4388
|
+
message: z.string().optional(),
|
|
4389
|
+
requestedSchema: z.unknown().optional(),
|
|
4390
|
+
url: z.string().optional(),
|
|
4391
|
+
elicitationId: z.string().optional(),
|
|
4392
|
+
_meta: z.record(z.string(), z.unknown()).nullable().optional()
|
|
4393
|
+
}).passthrough();
|
|
4380
4394
|
var dynamicToolCallParamsSchema = z.object({
|
|
4381
4395
|
threadId: z.string(),
|
|
4382
4396
|
turnId: z.string(),
|
|
@@ -4392,6 +4406,7 @@ var serverRequestParamSchemas = {
|
|
|
4392
4406
|
"item/commandExecution/requestApproval": commandExecutionRequestApprovalParamsSchema,
|
|
4393
4407
|
"item/fileChange/requestApproval": fileChangeRequestApprovalParamsSchema,
|
|
4394
4408
|
"item/tool/requestUserInput": toolRequestUserInputParamsSchema,
|
|
4409
|
+
"mcpServer/elicitation/request": mcpServerElicitationRequestParamsSchema,
|
|
4395
4410
|
"skill/requestApproval": skillRequestApprovalParamsSchema,
|
|
4396
4411
|
"item/tool/call": dynamicToolCallParamsSchema,
|
|
4397
4412
|
"account/chatgptAuthTokens/refresh": chatgptAuthTokensRefreshParamsSchema
|
|
@@ -4415,6 +4430,11 @@ var serverRequestSchema = z.discriminatedUnion("method", [
|
|
|
4415
4430
|
method: z.literal("item/tool/requestUserInput"),
|
|
4416
4431
|
params: toolRequestUserInputParamsSchema
|
|
4417
4432
|
}).passthrough(),
|
|
4433
|
+
z.object({
|
|
4434
|
+
id: jsonRpcIdSchema,
|
|
4435
|
+
method: z.literal("mcpServer/elicitation/request"),
|
|
4436
|
+
params: mcpServerElicitationRequestParamsSchema
|
|
4437
|
+
}).passthrough(),
|
|
4418
4438
|
z.object({
|
|
4419
4439
|
id: jsonRpcIdSchema,
|
|
4420
4440
|
method: z.literal("skill/requestApproval"),
|
|
@@ -4639,7 +4659,7 @@ var AppServerRpcClient = class extends EventEmitter {
|
|
|
4639
4659
|
if (this.serverCapabilities?.modelList === false) {
|
|
4640
4660
|
throw new UnsupportedFeatureError({
|
|
4641
4661
|
feature: "model/list",
|
|
4642
|
-
minCodexVersion: this.settings.minCodexVersion ?? "0.
|
|
4662
|
+
minCodexVersion: this.settings.minCodexVersion ?? "0.144.0",
|
|
4643
4663
|
serverVersion: this.serverVersion
|
|
4644
4664
|
});
|
|
4645
4665
|
}
|
|
@@ -4652,7 +4672,7 @@ var AppServerRpcClient = class extends EventEmitter {
|
|
|
4652
4672
|
if (error instanceof JsonRpcRequestError && error.code === -32601) {
|
|
4653
4673
|
throw new UnsupportedFeatureError({
|
|
4654
4674
|
feature: "model/list",
|
|
4655
|
-
minCodexVersion: this.settings.minCodexVersion ?? "0.
|
|
4675
|
+
minCodexVersion: this.settings.minCodexVersion ?? "0.144.0",
|
|
4656
4676
|
serverVersion: this.serverVersion
|
|
4657
4677
|
});
|
|
4658
4678
|
}
|
|
@@ -4809,7 +4829,7 @@ var AppServerRpcClient = class extends EventEmitter {
|
|
|
4809
4829
|
const message = String(error?.message ?? error);
|
|
4810
4830
|
if (message.includes("ENOENT") || message.includes("unknown subcommand")) {
|
|
4811
4831
|
throw new Error(
|
|
4812
|
-
"codex app-server requires codex CLI >= 0.
|
|
4832
|
+
"codex app-server requires codex CLI >= 0.144.0. Run 'codex --version' to check."
|
|
4813
4833
|
);
|
|
4814
4834
|
}
|
|
4815
4835
|
throw createAPICallError({
|
|
@@ -4831,7 +4851,7 @@ var AppServerRpcClient = class extends EventEmitter {
|
|
|
4831
4851
|
return;
|
|
4832
4852
|
}
|
|
4833
4853
|
this.serverVersion = detected;
|
|
4834
|
-
const minVersion = this.settings.minCodexVersion ?? "0.
|
|
4854
|
+
const minVersion = this.settings.minCodexVersion ?? "0.144.0";
|
|
4835
4855
|
const compared = compareSemver(detected, minVersion);
|
|
4836
4856
|
if (compared === void 0) {
|
|
4837
4857
|
this.logger.warn(
|
|
@@ -5100,6 +5120,30 @@ var AppServerRpcClient = class extends EventEmitter {
|
|
|
5100
5120
|
await sendResult({ decision: autoApprove ? "approve" : "decline" });
|
|
5101
5121
|
return;
|
|
5102
5122
|
}
|
|
5123
|
+
case "mcpServer/elicitation/request": {
|
|
5124
|
+
const handled = await runHandler(
|
|
5125
|
+
() => handlers.onMcpElicitation?.(normalized)
|
|
5126
|
+
);
|
|
5127
|
+
if (handled !== void 0) {
|
|
5128
|
+
await sendResult(handled);
|
|
5129
|
+
return;
|
|
5130
|
+
}
|
|
5131
|
+
const fallback = await runHandler(
|
|
5132
|
+
() => handlers.onUnhandled?.(normalized)
|
|
5133
|
+
);
|
|
5134
|
+
if (fallback !== void 0) {
|
|
5135
|
+
await sendResult(fallback);
|
|
5136
|
+
return;
|
|
5137
|
+
}
|
|
5138
|
+
const meta = normalized.params._meta;
|
|
5139
|
+
const isToolCallApproval = meta?.codex_approval_kind === "mcp_tool_call";
|
|
5140
|
+
if (isToolCallApproval && autoApprove) {
|
|
5141
|
+
await sendResult({ action: "accept", content: {} });
|
|
5142
|
+
} else {
|
|
5143
|
+
await sendResult({ action: "decline", content: null });
|
|
5144
|
+
}
|
|
5145
|
+
return;
|
|
5146
|
+
}
|
|
5103
5147
|
case "item/tool/requestUserInput": {
|
|
5104
5148
|
const handled = await runHandler(
|
|
5105
5149
|
() => handlers.onToolRequestUserInput?.(
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ai-sdk-provider-codex-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "AI SDK v6 provider for OpenAI Codex CLI (use ChatGPT Plus/Pro subscription)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai-sdk",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"jsonc-parser": "^3.3.1"
|
|
68
68
|
},
|
|
69
69
|
"optionalDependencies": {
|
|
70
|
-
"@openai/codex": "^0.
|
|
70
|
+
"@openai/codex": "^0.144.0"
|
|
71
71
|
},
|
|
72
72
|
"devDependencies": {
|
|
73
73
|
"@eslint/js": "^9.14.0",
|