@agentclientprotocol/codex-acp 1.10.0 → 1.10.1-preview.2
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 +11 -0
- package/dist/index.js +138 -49
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -10,6 +10,7 @@ Use [OpenAI Codex](https://github.com/openai/codex) from [Agent Client Protocol]
|
|
|
10
10
|
|
|
11
11
|
- ChatGPT, API key, and client-provided custom gateway authentication.
|
|
12
12
|
- Model, reasoning effort, fast mode, approval, and sandbox mode configuration.
|
|
13
|
+
- Concrete recommended model and reasoning-effort values through the opt-in [AIR recommended config values](docs/recommended-config-values-extension.md) capability.
|
|
13
14
|
- Text prompts, embedded context, images, resource links, and additional workspace directories.
|
|
14
15
|
- Shell command, file change, [permission request](docs/permission-extension.md), MCP tool call, terminal output, reasoning, plan, web search, image generation, image view, token usage, and review events.
|
|
15
16
|
- [Native ACP subagent sessions](docs/subagent-sessions.md) (after capability negotiation) with separate child histories and root-routed permissions; a legacy tool-call fallback otherwise.
|
|
@@ -40,6 +41,16 @@ The npm package includes a compatible `@openai/codex` dependency. Set `CODEX_PAT
|
|
|
40
41
|
CODEX_PATH=/path/to/codex npx -y @agentclientprotocol/codex-acp
|
|
41
42
|
```
|
|
42
43
|
|
|
44
|
+
To try changes that have landed on `main` but are not released yet, install from the
|
|
45
|
+
`preview` channel. Pushes to `main` trigger preview publishing without waiting
|
|
46
|
+
for CI or release-please; release commits are excluded, and newer pushes can
|
|
47
|
+
replace queued previews. See
|
|
48
|
+
[docs/RELEASES.md](docs/RELEASES.md#preview-releases).
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
npx -y @agentclientprotocol/codex-acp@preview
|
|
52
|
+
```
|
|
53
|
+
|
|
43
54
|
## Authentication
|
|
44
55
|
|
|
45
56
|
The adapter advertises ACP auth methods during initialization. Clients can authenticate with:
|
package/dist/index.js
CHANGED
|
@@ -23660,16 +23660,37 @@ var AIR_SESSION_FAILURE_KEY = "sessionFailure";
|
|
|
23660
23660
|
var AIR_AGENT_FILE_CHANGE_REPORT_KEY = "agentFileChangeReport";
|
|
23661
23661
|
var AIR_NATIVE_SUBAGENT_SESSIONS_KEY = "nativeSubagentSessions";
|
|
23662
23662
|
var AIR_ASYNC_TASKS_KEY = "asyncTasks";
|
|
23663
|
+
var AIR_RECOMMENDED_CONFIG_VALUE_KEY = "recommendedValue";
|
|
23663
23664
|
var AIR_ASYNC_TASKS_BACKGROUNDED_KEY = "backgrounded";
|
|
23664
23665
|
var AIR_AGENT_FILE_CHANGE_REPORT_REQUEST_KEY = "agentFileChangeReportRequest";
|
|
23665
23666
|
var AIR_EXTENSION_VERSION = 1;
|
|
23667
|
+
function withAirMeta(meta3, key, value) {
|
|
23668
|
+
const root = asRecord(meta3);
|
|
23669
|
+
const jetbrains = asRecord(root[JETBRAINS_META_KEY]);
|
|
23670
|
+
const air = asRecord(jetbrains[AIR_META_KEY]);
|
|
23671
|
+
return {
|
|
23672
|
+
...root,
|
|
23673
|
+
[JETBRAINS_META_KEY]: {
|
|
23674
|
+
...jetbrains,
|
|
23675
|
+
[AIR_META_KEY]: {
|
|
23676
|
+
...air,
|
|
23677
|
+
[AIR_EXTENSION_VERSION_KEY]: AIR_EXTENSION_VERSION,
|
|
23678
|
+
[key]: value
|
|
23679
|
+
}
|
|
23680
|
+
}
|
|
23681
|
+
};
|
|
23682
|
+
}
|
|
23666
23683
|
function clientSupportsAirCapability(capabilities, capability) {
|
|
23667
|
-
const
|
|
23668
|
-
const
|
|
23669
|
-
const
|
|
23670
|
-
const
|
|
23684
|
+
const meta3 = asRecord(capabilities?._meta);
|
|
23685
|
+
const jetbrains = asRecord(meta3[JETBRAINS_META_KEY]);
|
|
23686
|
+
const air = asRecord(jetbrains[AIR_META_KEY]);
|
|
23687
|
+
const version2 = air[AIR_EXTENSION_VERSION_KEY];
|
|
23688
|
+
const supported = air[AIR_EXTENSION_CAPABILITIES_KEY];
|
|
23671
23689
|
return typeof version2 === "number" && Number.isInteger(version2) && version2 >= AIR_EXTENSION_VERSION && Array.isArray(supported) && supported.includes(capability);
|
|
23672
23690
|
}
|
|
23691
|
+
function asRecord(value) {
|
|
23692
|
+
return value !== null && typeof value === "object" && !Array.isArray(value) ? value : {};
|
|
23693
|
+
}
|
|
23673
23694
|
|
|
23674
23695
|
// src/subagents/CodexAgentPath.ts
|
|
23675
23696
|
function normalizeAgentPath(path9) {
|
|
@@ -25956,8 +25977,9 @@ function buildMcpPermissionRequest(sessionId, params, context, nextStandaloneToo
|
|
|
25956
25977
|
toolCallId: nextStandaloneToolCallId(),
|
|
25957
25978
|
kind: context.isToolApproval ? "execute" : "other",
|
|
25958
25979
|
status: "pending",
|
|
25980
|
+
title: context.isToolApproval ? "MCP tool call approval" : "Question from MCP server",
|
|
25959
25981
|
content: [messageContent],
|
|
25960
|
-
rawInput: { serverName: params.serverName, schema: params.requestedSchema }
|
|
25982
|
+
rawInput: { serverName: params.serverName, description: params.message, schema: params.requestedSchema }
|
|
25961
25983
|
},
|
|
25962
25984
|
...context.isToolApproval ? { _meta: { is_mcp_tool_approval: true } } : {},
|
|
25963
25985
|
options
|
|
@@ -25975,8 +25997,9 @@ function buildMcpPermissionRequest(sessionId, params, context, nextStandaloneToo
|
|
|
25975
25997
|
toolCallId: `elicitation-${params.elicitationId}`,
|
|
25976
25998
|
kind: "fetch",
|
|
25977
25999
|
status: "pending",
|
|
26000
|
+
title: "MCP server requests to open a URL",
|
|
25978
26001
|
content: [messageContent],
|
|
25979
|
-
rawInput: { serverName: params.serverName, url: params.url }
|
|
26002
|
+
rawInput: { serverName: params.serverName, description: params.message, url: params.url }
|
|
25980
26003
|
},
|
|
25981
26004
|
options
|
|
25982
26005
|
},
|
|
@@ -26158,11 +26181,29 @@ var CodexElicitationHandler = class {
|
|
|
26158
26181
|
context.isToolApproval,
|
|
26159
26182
|
context.persistOptions
|
|
26160
26183
|
);
|
|
26161
|
-
if (correlatedCallId !== void 0
|
|
26162
|
-
|
|
26163
|
-
|
|
26164
|
-
|
|
26165
|
-
|
|
26184
|
+
if (correlatedCallId !== void 0) {
|
|
26185
|
+
if (result.action === "accept") {
|
|
26186
|
+
await this.connection.notify(methods.client.session.update, {
|
|
26187
|
+
sessionId: params.threadId,
|
|
26188
|
+
update: { sessionUpdate: "tool_call_update", toolCallId: correlatedCallId, status: "in_progress" }
|
|
26189
|
+
});
|
|
26190
|
+
}
|
|
26191
|
+
} else {
|
|
26192
|
+
try {
|
|
26193
|
+
await this.connection.notify(methods.client.session.update, {
|
|
26194
|
+
sessionId: params.threadId,
|
|
26195
|
+
update: {
|
|
26196
|
+
sessionUpdate: "tool_call_update",
|
|
26197
|
+
toolCallId: request.toolCall.toolCallId,
|
|
26198
|
+
status: "completed",
|
|
26199
|
+
title: request.toolCall.title,
|
|
26200
|
+
content: request.toolCall.content,
|
|
26201
|
+
rawOutput: { action: result.action }
|
|
26202
|
+
}
|
|
26203
|
+
});
|
|
26204
|
+
} catch (error51) {
|
|
26205
|
+
logger.error("Failed to finalize standalone MCP elicitation tool call", error51);
|
|
26206
|
+
}
|
|
26166
26207
|
}
|
|
26167
26208
|
return result;
|
|
26168
26209
|
} catch (error51) {
|
|
@@ -27319,7 +27360,7 @@ var package_default = {
|
|
|
27319
27360
|
publishConfig: {
|
|
27320
27361
|
access: "public"
|
|
27321
27362
|
},
|
|
27322
|
-
version: "1.10.
|
|
27363
|
+
version: "1.10.1-preview.2",
|
|
27323
27364
|
description: "",
|
|
27324
27365
|
main: "dist/index.js",
|
|
27325
27366
|
bin: {
|
|
@@ -27515,9 +27556,9 @@ Working directory: ${JSON.stringify(workspace.cwd)}
|
|
|
27515
27556
|
Additional allowed directories: ${JSON.stringify(workspace.additionalDirectories)}`;
|
|
27516
27557
|
}
|
|
27517
27558
|
function parseAgentFileChangeReportRequest(meta3) {
|
|
27518
|
-
const jetbrains =
|
|
27519
|
-
const air =
|
|
27520
|
-
const request =
|
|
27559
|
+
const jetbrains = asRecord2(meta3?.[JETBRAINS_META_KEY]);
|
|
27560
|
+
const air = asRecord2(jetbrains?.[AIR_META_KEY]);
|
|
27561
|
+
const request = asRecord2(air?.[AIR_AGENT_FILE_CHANGE_REPORT_REQUEST_KEY]);
|
|
27521
27562
|
if (request === null || !hasOnlyKeys(request, ["version", "requestId"]) || request["version"] !== AGENT_FILE_CHANGE_REPORT_VERSION) {
|
|
27522
27563
|
return null;
|
|
27523
27564
|
}
|
|
@@ -27584,7 +27625,7 @@ function parseModelFileChangeReport(turn) {
|
|
|
27584
27625
|
} catch {
|
|
27585
27626
|
throw new AgentFileChangeReportError("invalidOutput", "The audit turn returned invalid JSON");
|
|
27586
27627
|
}
|
|
27587
|
-
const report =
|
|
27628
|
+
const report = asRecord2(value);
|
|
27588
27629
|
if (report === null || !hasOnlyKeys(report, ["paths", "complete", "uncertainty"])) {
|
|
27589
27630
|
throw new AgentFileChangeReportError("invalidOutput", "The audit turn returned an invalid object");
|
|
27590
27631
|
}
|
|
@@ -27761,7 +27802,7 @@ function isWindowsAbsolutePath2(value) {
|
|
|
27761
27802
|
function isValidPathText(value) {
|
|
27762
27803
|
return value.length > 0 && !/[\u0000-\u001F\u007F-\u009F]/.test(value);
|
|
27763
27804
|
}
|
|
27764
|
-
function
|
|
27805
|
+
function asRecord2(value) {
|
|
27765
27806
|
return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
|
|
27766
27807
|
}
|
|
27767
27808
|
function hasOnlyKeys(value, allowed) {
|
|
@@ -27889,6 +27930,7 @@ async function forkSession(request, additionalDirectories, dependencies) {
|
|
|
27889
27930
|
await dependencies.refreshSkills(request.cwd, additionalDirectories);
|
|
27890
27931
|
const lastTurnId = await resolveForkTurnId(request, dependencies.codexClient);
|
|
27891
27932
|
const response = await dependencies.codexClient.threadFork({
|
|
27933
|
+
excludeTurns: true,
|
|
27892
27934
|
config: await dependencies.createSessionConfig(
|
|
27893
27935
|
request.cwd,
|
|
27894
27936
|
additionalDirectories,
|
|
@@ -27914,10 +27956,7 @@ async function forkSession(request, additionalDirectories, dependencies) {
|
|
|
27914
27956
|
async function resolveForkTurnId(request, codexClient) {
|
|
27915
27957
|
const forkPoint = readAirForkPoint(request._meta);
|
|
27916
27958
|
if (!forkPoint) return void 0;
|
|
27917
|
-
const history = await codexClient.
|
|
27918
|
-
threadId: request.sessionId,
|
|
27919
|
-
includeTurns: true
|
|
27920
|
-
});
|
|
27959
|
+
const history = await codexClient.threadReadWithHistory(request.sessionId);
|
|
27921
27960
|
const candidateIds = airForkMessageIdCandidates(forkPoint.messageId);
|
|
27922
27961
|
const itemTurnId = candidateIds.map((candidateId) => history.thread.turns.find((turn) => turn.items.some((item) => item.id === candidateId))?.id).find((turnId) => turnId !== void 0);
|
|
27923
27962
|
if (itemTurnId) return itemTurnId;
|
|
@@ -28340,6 +28379,7 @@ var CodexAcpClient = class {
|
|
|
28340
28379
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
28341
28380
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
28342
28381
|
const response = await this.codexClient.threadResume({
|
|
28382
|
+
excludeTurns: true,
|
|
28343
28383
|
config: await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []),
|
|
28344
28384
|
cwd: request.cwd,
|
|
28345
28385
|
modelProvider: await this.getResumeModelProvider(),
|
|
@@ -28374,16 +28414,17 @@ var CodexAcpClient = class {
|
|
|
28374
28414
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
28375
28415
|
await this.refreshSkills(request.cwd, additionalDirectories);
|
|
28376
28416
|
const response = await this.codexClient.threadResume({
|
|
28417
|
+
excludeTurns: true,
|
|
28377
28418
|
config: await this.createSessionConfig(request.cwd, additionalDirectories, request.mcpServers ?? []),
|
|
28378
28419
|
cwd: request.cwd,
|
|
28379
28420
|
modelProvider: await this.getResumeModelProvider(),
|
|
28380
28421
|
threadId: request.sessionId
|
|
28381
28422
|
});
|
|
28382
28423
|
onSubscribed?.();
|
|
28383
|
-
const
|
|
28384
|
-
|
|
28385
|
-
|
|
28386
|
-
});
|
|
28424
|
+
const thread = response.thread.historyMode === "paginated" ? {
|
|
28425
|
+
...response.thread,
|
|
28426
|
+
turns: response.turnsBackwardsCursor === null ? [] : await this.codexClient.threadReadHistory(response.thread.id, response.turnsBackwardsCursor)
|
|
28427
|
+
} : (await this.codexClient.threadReadWithHistory(response.thread.id)).thread;
|
|
28387
28428
|
const codexModels = await this.fetchAvailableModels();
|
|
28388
28429
|
const currentModelId = this.createModelId(codexModels, response.model, response.reasoningEffort).toString();
|
|
28389
28430
|
return {
|
|
@@ -28393,15 +28434,12 @@ var CodexAcpClient = class {
|
|
|
28393
28434
|
collaborationMode: this.getCollaborationMode(response.thread.id),
|
|
28394
28435
|
modelProvider: response.modelProvider,
|
|
28395
28436
|
currentServiceTier: response.serviceTier ?? null,
|
|
28396
|
-
thread
|
|
28437
|
+
thread,
|
|
28397
28438
|
additionalDirectories
|
|
28398
28439
|
};
|
|
28399
28440
|
}
|
|
28400
28441
|
async readSessionThread(sessionId) {
|
|
28401
|
-
return (await this.codexClient.
|
|
28402
|
-
threadId: sessionId,
|
|
28403
|
-
includeTurns: true
|
|
28404
|
-
})).thread;
|
|
28442
|
+
return (await this.codexClient.threadReadWithHistory(sessionId)).thread;
|
|
28405
28443
|
}
|
|
28406
28444
|
async newSession(request) {
|
|
28407
28445
|
const additionalDirectories = readAdditionalDirectories(request.cwd, request.additionalDirectories, request._meta);
|
|
@@ -28682,6 +28720,7 @@ var CodexAcpClient = class {
|
|
|
28682
28720
|
let lateStopReason = null;
|
|
28683
28721
|
try {
|
|
28684
28722
|
const forkPromise = this.codexClient.threadFork({
|
|
28723
|
+
excludeTurns: true,
|
|
28685
28724
|
threadId: params.sessionId,
|
|
28686
28725
|
lastTurnId: params.turnId,
|
|
28687
28726
|
cwd: params.workspace.cwd,
|
|
@@ -29516,6 +29555,41 @@ var CodexAppServerClient = class {
|
|
|
29516
29555
|
async threadRead(params) {
|
|
29517
29556
|
return await this.sendRequest({ method: "thread/read", params });
|
|
29518
29557
|
}
|
|
29558
|
+
async threadTurnsList(params) {
|
|
29559
|
+
return await this.sendRequest({ method: "thread/turns/list", params });
|
|
29560
|
+
}
|
|
29561
|
+
async threadReadWithHistory(threadId) {
|
|
29562
|
+
const response = await this.threadRead({ threadId });
|
|
29563
|
+
if (response.thread.historyMode === "legacy") {
|
|
29564
|
+
return await this.threadRead({ threadId, includeTurns: true });
|
|
29565
|
+
}
|
|
29566
|
+
const turns = await this.threadReadHistory(threadId);
|
|
29567
|
+
return { ...response, thread: { ...response.thread, turns } };
|
|
29568
|
+
}
|
|
29569
|
+
async threadReadHistory(threadId, initialCursor = null) {
|
|
29570
|
+
const turns = [];
|
|
29571
|
+
const seenCursors = /* @__PURE__ */ new Set();
|
|
29572
|
+
if (initialCursor !== null) seenCursors.add(initialCursor);
|
|
29573
|
+
let cursor = initialCursor;
|
|
29574
|
+
do {
|
|
29575
|
+
const page = await this.threadTurnsList({
|
|
29576
|
+
threadId,
|
|
29577
|
+
cursor,
|
|
29578
|
+
limit: 50,
|
|
29579
|
+
sortDirection: "desc",
|
|
29580
|
+
itemsView: "full"
|
|
29581
|
+
});
|
|
29582
|
+
turns.push(...page.data);
|
|
29583
|
+
cursor = page.nextCursor;
|
|
29584
|
+
if (cursor !== null) {
|
|
29585
|
+
if (seenCursors.has(cursor)) {
|
|
29586
|
+
throw new Error("Codex returned a repeated thread history cursor");
|
|
29587
|
+
}
|
|
29588
|
+
seenCursors.add(cursor);
|
|
29589
|
+
}
|
|
29590
|
+
} while (cursor !== null);
|
|
29591
|
+
return turns.reverse();
|
|
29592
|
+
}
|
|
29519
29593
|
async threadArchive(params) {
|
|
29520
29594
|
return await this.sendRequest({ method: "thread/archive", params });
|
|
29521
29595
|
}
|
|
@@ -29961,7 +30035,7 @@ function findSupportedEffort(options, effort) {
|
|
|
29961
30035
|
if (!effort) return void 0;
|
|
29962
30036
|
return options.find((o) => o.reasoningEffort === effort)?.reasoningEffort;
|
|
29963
30037
|
}
|
|
29964
|
-
function createModelConfigOption(availableModels, currentBaseModelId) {
|
|
30038
|
+
function createModelConfigOption(availableModels, currentBaseModelId, recommendedModelId) {
|
|
29965
30039
|
const options = availableModels.map((model) => ({
|
|
29966
30040
|
value: model.id,
|
|
29967
30041
|
name: model.displayName,
|
|
@@ -29974,6 +30048,7 @@ function createModelConfigOption(availableModels, currentBaseModelId) {
|
|
|
29974
30048
|
description: null
|
|
29975
30049
|
});
|
|
29976
30050
|
}
|
|
30051
|
+
const recommendation = recommendedModelId && options.some((option) => option.value === recommendedModelId) ? recommendedModelId : void 0;
|
|
29977
30052
|
return {
|
|
29978
30053
|
id: MODEL_CONFIG_ID,
|
|
29979
30054
|
name: "Model",
|
|
@@ -29981,10 +30056,12 @@ function createModelConfigOption(availableModels, currentBaseModelId) {
|
|
|
29981
30056
|
category: "model",
|
|
29982
30057
|
type: "select",
|
|
29983
30058
|
currentValue: currentBaseModelId,
|
|
29984
|
-
options
|
|
30059
|
+
options,
|
|
30060
|
+
...recommendation ? { _meta: withAirMeta(void 0, AIR_RECOMMENDED_CONFIG_VALUE_KEY, recommendation) } : {}
|
|
29985
30061
|
};
|
|
29986
30062
|
}
|
|
29987
|
-
function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEffort) {
|
|
30063
|
+
function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEffort, recommendedEffort) {
|
|
30064
|
+
const recommendation = findSupportedEffort(supportedReasoningEfforts, recommendedEffort);
|
|
29988
30065
|
return {
|
|
29989
30066
|
id: REASONING_EFFORT_CONFIG_ID,
|
|
29990
30067
|
name: "Reasoning effort",
|
|
@@ -29996,7 +30073,8 @@ function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEff
|
|
|
29996
30073
|
value: option.reasoningEffort,
|
|
29997
30074
|
name: capitalize(option.reasoningEffort),
|
|
29998
30075
|
description: option.description
|
|
29999
|
-
}))
|
|
30076
|
+
})),
|
|
30077
|
+
...recommendation ? { _meta: withAirMeta(void 0, AIR_RECOMMENDED_CONFIG_VALUE_KEY, recommendation) } : {}
|
|
30000
30078
|
};
|
|
30001
30079
|
}
|
|
30002
30080
|
|
|
@@ -30696,14 +30774,14 @@ function parseJsonRecord(line) {
|
|
|
30696
30774
|
}
|
|
30697
30775
|
try {
|
|
30698
30776
|
const value = JSON.parse(line);
|
|
30699
|
-
return
|
|
30777
|
+
return asRecord3(value);
|
|
30700
30778
|
} catch {
|
|
30701
30779
|
return null;
|
|
30702
30780
|
}
|
|
30703
30781
|
}
|
|
30704
30782
|
function extractResponseItem(record2) {
|
|
30705
30783
|
if (record2["type"] === "response_item") {
|
|
30706
|
-
return
|
|
30784
|
+
return asRecord3(record2["payload"]);
|
|
30707
30785
|
}
|
|
30708
30786
|
const itemType = record2["type"];
|
|
30709
30787
|
if (typeof itemType === "string" && isLegacyResponseItemType(itemType)) {
|
|
@@ -30737,7 +30815,7 @@ function createEventMsgUpdates(record2) {
|
|
|
30737
30815
|
if (record2["type"] !== "event_msg") {
|
|
30738
30816
|
return null;
|
|
30739
30817
|
}
|
|
30740
|
-
const payload =
|
|
30818
|
+
const payload = asRecord3(record2["payload"]);
|
|
30741
30819
|
if (!payload) {
|
|
30742
30820
|
return [];
|
|
30743
30821
|
}
|
|
@@ -30781,7 +30859,7 @@ function imageBlocks(images) {
|
|
|
30781
30859
|
if (typeof image === "string") {
|
|
30782
30860
|
return [{ type: "text", text: `[@image](${image})` }];
|
|
30783
30861
|
}
|
|
30784
|
-
const record2 =
|
|
30862
|
+
const record2 = asRecord3(image);
|
|
30785
30863
|
const path9 = record2 ? stringValue(record2["path"]) ?? stringValue(record2["url"]) : null;
|
|
30786
30864
|
return path9 ? [{ type: "text", text: `[@image](${path9})` }] : [];
|
|
30787
30865
|
});
|
|
@@ -30791,7 +30869,7 @@ function contentBlocksFromResponseContent(content) {
|
|
|
30791
30869
|
return [];
|
|
30792
30870
|
}
|
|
30793
30871
|
return content.flatMap((entry) => {
|
|
30794
|
-
const record2 =
|
|
30872
|
+
const record2 = asRecord3(entry);
|
|
30795
30873
|
if (!record2) {
|
|
30796
30874
|
return [];
|
|
30797
30875
|
}
|
|
@@ -30824,7 +30902,7 @@ function textParts(value) {
|
|
|
30824
30902
|
if (typeof entry === "string") {
|
|
30825
30903
|
return entry.length > 0 ? [entry] : [];
|
|
30826
30904
|
}
|
|
30827
|
-
const record2 =
|
|
30905
|
+
const record2 = asRecord3(entry);
|
|
30828
30906
|
if (!record2) {
|
|
30829
30907
|
return [];
|
|
30830
30908
|
}
|
|
@@ -30916,7 +30994,7 @@ function parseFunctionArguments(value) {
|
|
|
30916
30994
|
}
|
|
30917
30995
|
function rawInputForFunctionCall(name, args) {
|
|
30918
30996
|
if (name === "exec_command") {
|
|
30919
|
-
const record2 =
|
|
30997
|
+
const record2 = asRecord3(args);
|
|
30920
30998
|
if (record2) {
|
|
30921
30999
|
return {
|
|
30922
31000
|
command: stringValue(record2["cmd"]) ?? stringValue(record2["command"]),
|
|
@@ -30963,14 +31041,14 @@ function functionCallUsesTerminal(item) {
|
|
|
30963
31041
|
return item["name"] === "exec_command";
|
|
30964
31042
|
}
|
|
30965
31043
|
function commandFromFunctionArguments(args) {
|
|
30966
|
-
const record2 =
|
|
31044
|
+
const record2 = asRecord3(args);
|
|
30967
31045
|
if (!record2) {
|
|
30968
31046
|
return null;
|
|
30969
31047
|
}
|
|
30970
31048
|
return stringValue(record2["cmd"]) ?? stringValue(record2["command"]);
|
|
30971
31049
|
}
|
|
30972
31050
|
function cwdFromFunctionArguments(args) {
|
|
30973
|
-
const record2 =
|
|
31051
|
+
const record2 = asRecord3(args);
|
|
30974
31052
|
if (!record2) {
|
|
30975
31053
|
return "";
|
|
30976
31054
|
}
|
|
@@ -31442,7 +31520,7 @@ function outputText(output) {
|
|
|
31442
31520
|
return "";
|
|
31443
31521
|
}
|
|
31444
31522
|
return output.flatMap((entry) => {
|
|
31445
|
-
const record2 =
|
|
31523
|
+
const record2 = asRecord3(entry);
|
|
31446
31524
|
if (!record2) {
|
|
31447
31525
|
return [];
|
|
31448
31526
|
}
|
|
@@ -31458,7 +31536,7 @@ function outputText(output) {
|
|
|
31458
31536
|
}).join("\n");
|
|
31459
31537
|
}
|
|
31460
31538
|
function parseExitCode(rawOutput, output) {
|
|
31461
|
-
const record2 =
|
|
31539
|
+
const record2 = asRecord3(rawOutput);
|
|
31462
31540
|
if (record2) {
|
|
31463
31541
|
const exitCode2 = numberValue(record2["exit_code"]) ?? numberValue(record2["exitCode"]);
|
|
31464
31542
|
if (exitCode2 !== null) {
|
|
@@ -31489,7 +31567,7 @@ function looksLikeCommandFailure(output) {
|
|
|
31489
31567
|
}
|
|
31490
31568
|
return /(^|\n)(Error|Failed|Command failed|Sandbox error|No such file or directory|Permission denied|Operation not permitted|ENOENT|EACCES)(:|\b)/i.test(trimmed);
|
|
31491
31569
|
}
|
|
31492
|
-
function
|
|
31570
|
+
function asRecord3(value) {
|
|
31493
31571
|
if (value === null || typeof value !== "object" || Array.isArray(value)) {
|
|
31494
31572
|
return null;
|
|
31495
31573
|
}
|
|
@@ -32271,7 +32349,8 @@ var CodexAcpServer = class _CodexAcpServer {
|
|
|
32271
32349
|
AIR_SESSION_FAILURE_KEY,
|
|
32272
32350
|
AIR_AGENT_FILE_CHANGE_REPORT_KEY,
|
|
32273
32351
|
AIR_NATIVE_SUBAGENT_SESSIONS_KEY,
|
|
32274
|
-
AIR_ASYNC_TASKS_KEY
|
|
32352
|
+
AIR_ASYNC_TASKS_KEY,
|
|
32353
|
+
AIR_RECOMMENDED_CONFIG_VALUE_KEY
|
|
32275
32354
|
]
|
|
32276
32355
|
}
|
|
32277
32356
|
}
|
|
@@ -33432,14 +33511,24 @@ Check ${configPath} and project .codex directories, especially their config.toml
|
|
|
33432
33511
|
}
|
|
33433
33512
|
createSessionConfigOptions(sessionState) {
|
|
33434
33513
|
const currentModelId = ModelId.fromString(sessionState.currentModelId);
|
|
33514
|
+
const useRecommendedValue = clientSupportsAirCapability(
|
|
33515
|
+
this.clientCapabilities,
|
|
33516
|
+
AIR_RECOMMENDED_CONFIG_VALUE_KEY
|
|
33517
|
+
);
|
|
33518
|
+
const currentModel = this.findCurrentModel(sessionState.availableModels, sessionState.currentModelId);
|
|
33519
|
+
const recommendedModelId = useRecommendedValue ? sessionState.availableModels.find((model) => model.isDefault)?.id : void 0;
|
|
33435
33520
|
const configOptions = [
|
|
33436
33521
|
sessionState.agentMode.toConfigOption(),
|
|
33437
33522
|
createCollaborationModeConfigOption(sessionState.collaborationMode),
|
|
33438
|
-
createModelConfigOption(sessionState.availableModels, currentModelId.model)
|
|
33523
|
+
createModelConfigOption(sessionState.availableModels, currentModelId.model, recommendedModelId)
|
|
33439
33524
|
];
|
|
33440
33525
|
if (sessionState.supportedReasoningEfforts.length > 0) {
|
|
33441
33526
|
configOptions.push(
|
|
33442
|
-
createReasoningEffortConfigOption(
|
|
33527
|
+
createReasoningEffortConfigOption(
|
|
33528
|
+
sessionState.supportedReasoningEfforts,
|
|
33529
|
+
currentModelId.effort,
|
|
33530
|
+
useRecommendedValue ? currentModel?.defaultReasoningEffort : void 0
|
|
33531
|
+
)
|
|
33443
33532
|
);
|
|
33444
33533
|
}
|
|
33445
33534
|
if (sessionState.currentModelSupportsFast) {
|