@agentclientprotocol/codex-acp 1.10.1-preview.1 → 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.
Files changed (3) hide show
  1. package/README.md +1 -0
  2. package/dist/index.js +65 -29
  3. 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.
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 jetbrains = capabilities?._meta?.[JETBRAINS_META_KEY];
23668
- const air = jetbrains?.[AIR_META_KEY];
23669
- const version2 = air?.[AIR_EXTENSION_VERSION_KEY];
23670
- const supported = air?.[AIR_EXTENSION_CAPABILITIES_KEY];
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) {
@@ -27339,7 +27360,7 @@ var package_default = {
27339
27360
  publishConfig: {
27340
27361
  access: "public"
27341
27362
  },
27342
- version: "1.10.1-preview.1",
27363
+ version: "1.10.1-preview.2",
27343
27364
  description: "",
27344
27365
  main: "dist/index.js",
27345
27366
  bin: {
@@ -27535,9 +27556,9 @@ Working directory: ${JSON.stringify(workspace.cwd)}
27535
27556
  Additional allowed directories: ${JSON.stringify(workspace.additionalDirectories)}`;
27536
27557
  }
27537
27558
  function parseAgentFileChangeReportRequest(meta3) {
27538
- const jetbrains = asRecord(meta3?.[JETBRAINS_META_KEY]);
27539
- const air = asRecord(jetbrains?.[AIR_META_KEY]);
27540
- const request = asRecord(air?.[AIR_AGENT_FILE_CHANGE_REPORT_REQUEST_KEY]);
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]);
27541
27562
  if (request === null || !hasOnlyKeys(request, ["version", "requestId"]) || request["version"] !== AGENT_FILE_CHANGE_REPORT_VERSION) {
27542
27563
  return null;
27543
27564
  }
@@ -27604,7 +27625,7 @@ function parseModelFileChangeReport(turn) {
27604
27625
  } catch {
27605
27626
  throw new AgentFileChangeReportError("invalidOutput", "The audit turn returned invalid JSON");
27606
27627
  }
27607
- const report = asRecord(value);
27628
+ const report = asRecord2(value);
27608
27629
  if (report === null || !hasOnlyKeys(report, ["paths", "complete", "uncertainty"])) {
27609
27630
  throw new AgentFileChangeReportError("invalidOutput", "The audit turn returned an invalid object");
27610
27631
  }
@@ -27781,7 +27802,7 @@ function isWindowsAbsolutePath2(value) {
27781
27802
  function isValidPathText(value) {
27782
27803
  return value.length > 0 && !/[\u0000-\u001F\u007F-\u009F]/.test(value);
27783
27804
  }
27784
- function asRecord(value) {
27805
+ function asRecord2(value) {
27785
27806
  return typeof value === "object" && value !== null && !Array.isArray(value) ? value : null;
27786
27807
  }
27787
27808
  function hasOnlyKeys(value, allowed) {
@@ -30014,7 +30035,7 @@ function findSupportedEffort(options, effort) {
30014
30035
  if (!effort) return void 0;
30015
30036
  return options.find((o) => o.reasoningEffort === effort)?.reasoningEffort;
30016
30037
  }
30017
- function createModelConfigOption(availableModels, currentBaseModelId) {
30038
+ function createModelConfigOption(availableModels, currentBaseModelId, recommendedModelId) {
30018
30039
  const options = availableModels.map((model) => ({
30019
30040
  value: model.id,
30020
30041
  name: model.displayName,
@@ -30027,6 +30048,7 @@ function createModelConfigOption(availableModels, currentBaseModelId) {
30027
30048
  description: null
30028
30049
  });
30029
30050
  }
30051
+ const recommendation = recommendedModelId && options.some((option) => option.value === recommendedModelId) ? recommendedModelId : void 0;
30030
30052
  return {
30031
30053
  id: MODEL_CONFIG_ID,
30032
30054
  name: "Model",
@@ -30034,10 +30056,12 @@ function createModelConfigOption(availableModels, currentBaseModelId) {
30034
30056
  category: "model",
30035
30057
  type: "select",
30036
30058
  currentValue: currentBaseModelId,
30037
- options
30059
+ options,
30060
+ ...recommendation ? { _meta: withAirMeta(void 0, AIR_RECOMMENDED_CONFIG_VALUE_KEY, recommendation) } : {}
30038
30061
  };
30039
30062
  }
30040
- function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEffort) {
30063
+ function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEffort, recommendedEffort) {
30064
+ const recommendation = findSupportedEffort(supportedReasoningEfforts, recommendedEffort);
30041
30065
  return {
30042
30066
  id: REASONING_EFFORT_CONFIG_ID,
30043
30067
  name: "Reasoning effort",
@@ -30049,7 +30073,8 @@ function createReasoningEffortConfigOption(supportedReasoningEfforts, currentEff
30049
30073
  value: option.reasoningEffort,
30050
30074
  name: capitalize(option.reasoningEffort),
30051
30075
  description: option.description
30052
- }))
30076
+ })),
30077
+ ...recommendation ? { _meta: withAirMeta(void 0, AIR_RECOMMENDED_CONFIG_VALUE_KEY, recommendation) } : {}
30053
30078
  };
30054
30079
  }
30055
30080
 
@@ -30749,14 +30774,14 @@ function parseJsonRecord(line) {
30749
30774
  }
30750
30775
  try {
30751
30776
  const value = JSON.parse(line);
30752
- return asRecord2(value);
30777
+ return asRecord3(value);
30753
30778
  } catch {
30754
30779
  return null;
30755
30780
  }
30756
30781
  }
30757
30782
  function extractResponseItem(record2) {
30758
30783
  if (record2["type"] === "response_item") {
30759
- return asRecord2(record2["payload"]);
30784
+ return asRecord3(record2["payload"]);
30760
30785
  }
30761
30786
  const itemType = record2["type"];
30762
30787
  if (typeof itemType === "string" && isLegacyResponseItemType(itemType)) {
@@ -30790,7 +30815,7 @@ function createEventMsgUpdates(record2) {
30790
30815
  if (record2["type"] !== "event_msg") {
30791
30816
  return null;
30792
30817
  }
30793
- const payload = asRecord2(record2["payload"]);
30818
+ const payload = asRecord3(record2["payload"]);
30794
30819
  if (!payload) {
30795
30820
  return [];
30796
30821
  }
@@ -30834,7 +30859,7 @@ function imageBlocks(images) {
30834
30859
  if (typeof image === "string") {
30835
30860
  return [{ type: "text", text: `[@image](${image})` }];
30836
30861
  }
30837
- const record2 = asRecord2(image);
30862
+ const record2 = asRecord3(image);
30838
30863
  const path9 = record2 ? stringValue(record2["path"]) ?? stringValue(record2["url"]) : null;
30839
30864
  return path9 ? [{ type: "text", text: `[@image](${path9})` }] : [];
30840
30865
  });
@@ -30844,7 +30869,7 @@ function contentBlocksFromResponseContent(content) {
30844
30869
  return [];
30845
30870
  }
30846
30871
  return content.flatMap((entry) => {
30847
- const record2 = asRecord2(entry);
30872
+ const record2 = asRecord3(entry);
30848
30873
  if (!record2) {
30849
30874
  return [];
30850
30875
  }
@@ -30877,7 +30902,7 @@ function textParts(value) {
30877
30902
  if (typeof entry === "string") {
30878
30903
  return entry.length > 0 ? [entry] : [];
30879
30904
  }
30880
- const record2 = asRecord2(entry);
30905
+ const record2 = asRecord3(entry);
30881
30906
  if (!record2) {
30882
30907
  return [];
30883
30908
  }
@@ -30969,7 +30994,7 @@ function parseFunctionArguments(value) {
30969
30994
  }
30970
30995
  function rawInputForFunctionCall(name, args) {
30971
30996
  if (name === "exec_command") {
30972
- const record2 = asRecord2(args);
30997
+ const record2 = asRecord3(args);
30973
30998
  if (record2) {
30974
30999
  return {
30975
31000
  command: stringValue(record2["cmd"]) ?? stringValue(record2["command"]),
@@ -31016,14 +31041,14 @@ function functionCallUsesTerminal(item) {
31016
31041
  return item["name"] === "exec_command";
31017
31042
  }
31018
31043
  function commandFromFunctionArguments(args) {
31019
- const record2 = asRecord2(args);
31044
+ const record2 = asRecord3(args);
31020
31045
  if (!record2) {
31021
31046
  return null;
31022
31047
  }
31023
31048
  return stringValue(record2["cmd"]) ?? stringValue(record2["command"]);
31024
31049
  }
31025
31050
  function cwdFromFunctionArguments(args) {
31026
- const record2 = asRecord2(args);
31051
+ const record2 = asRecord3(args);
31027
31052
  if (!record2) {
31028
31053
  return "";
31029
31054
  }
@@ -31495,7 +31520,7 @@ function outputText(output) {
31495
31520
  return "";
31496
31521
  }
31497
31522
  return output.flatMap((entry) => {
31498
- const record2 = asRecord2(entry);
31523
+ const record2 = asRecord3(entry);
31499
31524
  if (!record2) {
31500
31525
  return [];
31501
31526
  }
@@ -31511,7 +31536,7 @@ function outputText(output) {
31511
31536
  }).join("\n");
31512
31537
  }
31513
31538
  function parseExitCode(rawOutput, output) {
31514
- const record2 = asRecord2(rawOutput);
31539
+ const record2 = asRecord3(rawOutput);
31515
31540
  if (record2) {
31516
31541
  const exitCode2 = numberValue(record2["exit_code"]) ?? numberValue(record2["exitCode"]);
31517
31542
  if (exitCode2 !== null) {
@@ -31542,7 +31567,7 @@ function looksLikeCommandFailure(output) {
31542
31567
  }
31543
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);
31544
31569
  }
31545
- function asRecord2(value) {
31570
+ function asRecord3(value) {
31546
31571
  if (value === null || typeof value !== "object" || Array.isArray(value)) {
31547
31572
  return null;
31548
31573
  }
@@ -32324,7 +32349,8 @@ var CodexAcpServer = class _CodexAcpServer {
32324
32349
  AIR_SESSION_FAILURE_KEY,
32325
32350
  AIR_AGENT_FILE_CHANGE_REPORT_KEY,
32326
32351
  AIR_NATIVE_SUBAGENT_SESSIONS_KEY,
32327
- AIR_ASYNC_TASKS_KEY
32352
+ AIR_ASYNC_TASKS_KEY,
32353
+ AIR_RECOMMENDED_CONFIG_VALUE_KEY
32328
32354
  ]
32329
32355
  }
32330
32356
  }
@@ -33485,14 +33511,24 @@ Check ${configPath} and project .codex directories, especially their config.toml
33485
33511
  }
33486
33512
  createSessionConfigOptions(sessionState) {
33487
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;
33488
33520
  const configOptions = [
33489
33521
  sessionState.agentMode.toConfigOption(),
33490
33522
  createCollaborationModeConfigOption(sessionState.collaborationMode),
33491
- createModelConfigOption(sessionState.availableModels, currentModelId.model)
33523
+ createModelConfigOption(sessionState.availableModels, currentModelId.model, recommendedModelId)
33492
33524
  ];
33493
33525
  if (sessionState.supportedReasoningEfforts.length > 0) {
33494
33526
  configOptions.push(
33495
- createReasoningEffortConfigOption(sessionState.supportedReasoningEfforts, currentModelId.effort)
33527
+ createReasoningEffortConfigOption(
33528
+ sessionState.supportedReasoningEfforts,
33529
+ currentModelId.effort,
33530
+ useRecommendedValue ? currentModel?.defaultReasoningEffort : void 0
33531
+ )
33496
33532
  );
33497
33533
  }
33498
33534
  if (sessionState.currentModelSupportsFast) {
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "access": "public"
5
5
  },
6
- "version": "1.10.1-preview.1",
6
+ "version": "1.10.1-preview.2",
7
7
  "description": "",
8
8
  "main": "dist/index.js",
9
9
  "bin": {