@agentclientprotocol/codex-acp 2.5.1-preview.15 → 2.5.1-preview.16
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/dist/index.js +22 -7
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -41315,6 +41315,7 @@ var AgentMode = class _AgentMode {
|
|
|
41315
41315
|
|
|
41316
41316
|
// src/CodexAcpClient.ts
|
|
41317
41317
|
import path10 from "node:path";
|
|
41318
|
+
import { isDeepStrictEqual } from "node:util";
|
|
41318
41319
|
|
|
41319
41320
|
// package.json
|
|
41320
41321
|
var package_default = {
|
|
@@ -41322,7 +41323,7 @@ var package_default = {
|
|
|
41322
41323
|
publishConfig: {
|
|
41323
41324
|
access: "public"
|
|
41324
41325
|
},
|
|
41325
|
-
version: "2.5.1-preview.
|
|
41326
|
+
version: "2.5.1-preview.16",
|
|
41326
41327
|
description: "",
|
|
41327
41328
|
main: "dist/index.js",
|
|
41328
41329
|
bin: {
|
|
@@ -42204,9 +42205,9 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
42204
42205
|
if (!URL.canParse(request.baseUrl) || !["http:", "https:"].includes(new URL(request.baseUrl).protocol)) {
|
|
42205
42206
|
throw RequestError.invalidParams({ baseUrl: request.baseUrl }, "baseUrl must be an http(s) URL");
|
|
42206
42207
|
}
|
|
42207
|
-
const
|
|
42208
|
+
const previousListing = this.hasProviderRouting(gatewayConfig) ? this.gatewayConfig?.listedModels ?? null : null;
|
|
42208
42209
|
try {
|
|
42209
|
-
gatewayConfig.listedModels =
|
|
42210
|
+
gatewayConfig.listedModels = previousListing ?? await listGatewayModels(gatewayConfig.config.base_url, gatewayConfig.config.http_headers);
|
|
42210
42211
|
} catch (error62) {
|
|
42211
42212
|
if (error62 instanceof GatewayListingError) {
|
|
42212
42213
|
throw RequestError.internalError(
|
|
@@ -42218,6 +42219,10 @@ var CodexAcpClient = class _CodexAcpClient {
|
|
|
42218
42219
|
}
|
|
42219
42220
|
return gatewayConfig;
|
|
42220
42221
|
}
|
|
42222
|
+
/** Whether `providers/set` already applied the provider config of `gatewayConfig`. */
|
|
42223
|
+
hasProviderRouting(gatewayConfig) {
|
|
42224
|
+
return this.gatewayConfigSource === "acpProviders" && this.gatewayConfig !== null && sameProviderConfig(this.gatewayConfig, gatewayConfig);
|
|
42225
|
+
}
|
|
42221
42226
|
/** `providers/set`: replaces the routing with a configuration from {@link prepareProvider}. */
|
|
42222
42227
|
setProvider(gatewayConfig) {
|
|
42223
42228
|
this.gatewayConfigSource = "acpProviders";
|
|
@@ -43144,10 +43149,8 @@ function buildGatewayConfig(params) {
|
|
|
43144
43149
|
listedModels: null
|
|
43145
43150
|
};
|
|
43146
43151
|
}
|
|
43147
|
-
function
|
|
43148
|
-
|
|
43149
|
-
const rightHeaders = right.config.http_headers;
|
|
43150
|
-
return left.config.base_url === right.config.base_url && left.config.wire_api === right.config.wire_api && leftHeaders.length === Object.keys(rightHeaders).length && leftHeaders.every(([name, value]) => rightHeaders[name] === value);
|
|
43152
|
+
function sameProviderConfig(left, right) {
|
|
43153
|
+
return left.modelProvider === right.modelProvider && isDeepStrictEqual(left.config, right.config);
|
|
43151
43154
|
}
|
|
43152
43155
|
function readMetaAdditionalRoots(meta3) {
|
|
43153
43156
|
const rawRoots = meta3?.["additionalRoots"];
|
|
@@ -50129,6 +50132,8 @@ var CodexAcpServer = class {
|
|
|
50129
50132
|
recovery;
|
|
50130
50133
|
initializeRequest = null;
|
|
50131
50134
|
providerUpdate = null;
|
|
50135
|
+
/** The last provider update failed, so the app-server may not run the routing of the agent. */
|
|
50136
|
+
providerUpdateFailed = false;
|
|
50132
50137
|
/**
|
|
50133
50138
|
* Numbers `providers/set` and `providers/disable` requests in arrival order. A listing finishing after a newer
|
|
50134
50139
|
* request was applied is dropped; a newer request that failed drops nothing.
|
|
@@ -51664,6 +51669,11 @@ You have been logged out. Please try again.`);
|
|
|
51664
51669
|
return {};
|
|
51665
51670
|
}
|
|
51666
51671
|
this.appliedProviderRequest = request;
|
|
51672
|
+
if (this.codexAcpClient.hasProviderRouting(gatewayConfig) && !this.providerUpdateFailed) {
|
|
51673
|
+
logger.log("providers/set unchanged: the app-server is not restarted");
|
|
51674
|
+
await this.waitForProviderUpdate();
|
|
51675
|
+
return {};
|
|
51676
|
+
}
|
|
51667
51677
|
this.codexAcpClient.setProvider(gatewayConfig);
|
|
51668
51678
|
await this.enqueueProviderUpdate((client) => client.setProvider(gatewayConfig));
|
|
51669
51679
|
return {};
|
|
@@ -51761,6 +51771,11 @@ You have been logged out. Please try again.`);
|
|
|
51761
51771
|
}
|
|
51762
51772
|
});
|
|
51763
51773
|
this.providerUpdate = update;
|
|
51774
|
+
update.then(() => {
|
|
51775
|
+
this.providerUpdateFailed = false;
|
|
51776
|
+
}, () => {
|
|
51777
|
+
this.providerUpdateFailed = true;
|
|
51778
|
+
});
|
|
51764
51779
|
this.recovery?.settleReplacement(update);
|
|
51765
51780
|
try {
|
|
51766
51781
|
await update;
|