@agent-proxy/gateway 0.14.1 → 0.14.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/dist/index.js +10 -10
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -7525,8 +7525,8 @@ function codexCatalogFile(paths) {
|
|
|
7525
7525
|
}
|
|
7526
7526
|
async function rebuildStaticCatalog(paths, config, source, { refreshAdapters = false } = {}) {
|
|
7527
7527
|
const adapters = await source.collect(refreshAdapters, paths.runtimeHome);
|
|
7528
|
-
|
|
7529
|
-
|
|
7528
|
+
for (const failure of adapters.failures)
|
|
7529
|
+
console.warn(`WARNING: ${failure}\uFF1B\u5DF2\u8DF3\u8FC7\u8BE5\u63D2\u4EF6\uFF0C\u4E0D\u5F71\u54CD\u6A21\u578B\u9009\u62E9\u4FDD\u5B58\u3002`);
|
|
7530
7530
|
return writeStaticCatalog(paths, config, adapters.entries, (model) => source.ownsModel(model));
|
|
7531
7531
|
}
|
|
7532
7532
|
function writeStaticCatalog(paths, config, adapterModels, ownsModel = () => false) {
|
|
@@ -7588,8 +7588,8 @@ async function updateCodexModelCatalog(paths, config, catalogSource, {
|
|
|
7588
7588
|
snapshotWritten = true;
|
|
7589
7589
|
} else if (refreshAdapters) {
|
|
7590
7590
|
const adapters = await catalogSource.collect(true, paths.runtimeHome);
|
|
7591
|
-
|
|
7592
|
-
|
|
7591
|
+
for (const failure of adapters.failures)
|
|
7592
|
+
console.warn(`WARNING: ${failure}\uFF1B\u5DF2\u8DF3\u8FC7\u8BE5\u63D2\u4EF6\uFF0C\u4E0D\u5F71\u54CD\u6A21\u578B\u9009\u62E9\u4FDD\u5B58\u3002`);
|
|
7593
7593
|
count = adapters.entries.length;
|
|
7594
7594
|
}
|
|
7595
7595
|
if (tomlChanged) {
|
|
@@ -8616,17 +8616,17 @@ function excludedModelResponse(model) {
|
|
|
8616
8616
|
}
|
|
8617
8617
|
}, { status: 404, headers: { "x-codex-cliproxy-gateway": "model-excluded" } });
|
|
8618
8618
|
}
|
|
8619
|
-
async function
|
|
8619
|
+
async function availablePluginCatalog(registry, processLog, mountPath, operation) {
|
|
8620
8620
|
const catalogs = await Promise.all(registry.plugins.map(async (plugin) => {
|
|
8621
8621
|
try {
|
|
8622
|
-
return await plugin.refreshCatalog();
|
|
8622
|
+
return await (operation === "startup" ? plugin.refreshCatalog() : plugin.reloadCatalog());
|
|
8623
8623
|
} catch {
|
|
8624
8624
|
logGatewayError(processLog, {
|
|
8625
8625
|
requestTime: localTime(),
|
|
8626
|
-
method: "START",
|
|
8626
|
+
method: operation === "startup" ? "START" : "RELOAD",
|
|
8627
8627
|
url: `${mountPath}/models`,
|
|
8628
8628
|
status: 503,
|
|
8629
|
-
message: `\u63D2\u4EF6 ${plugin.id} \u542F\u52A8\u76EE\u5F55\u5237\u65B0\u4E0D\u53EF\u7528\uFF1B\u5C06\u5C1D\u8BD5\u7F13\u5B58\u76EE\u5F55\uFF0C\u5176\u4F59\u63D2\u4EF6\u548C default \u7EE7\u7EED\u5C31\u7EEA\u3002`
|
|
8629
|
+
message: `\u63D2\u4EF6 ${plugin.id} ${operation === "startup" ? "\u542F\u52A8\u76EE\u5F55\u5237\u65B0" : "\u76EE\u5F55\u70ED\u52A0\u8F7D"}\u4E0D\u53EF\u7528\uFF1B\u5C06\u5C1D\u8BD5\u7F13\u5B58\u76EE\u5F55\uFF0C\u5176\u4F59\u63D2\u4EF6\u548C default \u7EE7\u7EED\u5C31\u7EEA\u3002`
|
|
8630
8630
|
});
|
|
8631
8631
|
try {
|
|
8632
8632
|
return await plugin.getCatalog();
|
|
@@ -8649,7 +8649,7 @@ function createPluginGatewayHandler(config, registry, apiKey = readApiKey(), rea
|
|
|
8649
8649
|
let modelExclusion = compileModelFilter(config.excludedModels);
|
|
8650
8650
|
let closed = false;
|
|
8651
8651
|
let ready;
|
|
8652
|
-
const modelsReady = () => ready ??= registry.ready().then(() => config.upstreamOnly === true ?
|
|
8652
|
+
const modelsReady = () => ready ??= registry.ready().then(() => config.upstreamOnly === true ? availablePluginCatalog(registry, processLog, mountPath, "startup") : registry.getCatalog()).then((catalog) => {
|
|
8653
8653
|
if (!closed && runtimePaths && config.upstreamOnly === true) {
|
|
8654
8654
|
writeStaticCatalog(runtimePaths, config, catalog.models, ownsLocalModel);
|
|
8655
8655
|
}
|
|
@@ -8658,7 +8658,7 @@ function createPluginGatewayHandler(config, registry, apiKey = readApiKey(), rea
|
|
|
8658
8658
|
await modelsReady().catch(() => {});
|
|
8659
8659
|
if (closed)
|
|
8660
8660
|
return;
|
|
8661
|
-
const catalog = await registry
|
|
8661
|
+
const catalog = await availablePluginCatalog(registry, processLog, mountPath, "reload");
|
|
8662
8662
|
if (closed)
|
|
8663
8663
|
return;
|
|
8664
8664
|
const nextFilter = compileModelFilter(next.excludedModels);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@agent-proxy/gateway",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.2",
|
|
4
4
|
"description": "Agent Proxy 的 Bun 网关与 CLI 业务应用。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -48,5 +48,5 @@
|
|
|
48
48
|
"type": "git",
|
|
49
49
|
"url": "git+https://github.com/aceHubert/codex-cliproxy-gateway.git"
|
|
50
50
|
},
|
|
51
|
-
"gitHead": "
|
|
51
|
+
"gitHead": "a5de8b09aa6dfe369fb41337cb776784b3a8f917"
|
|
52
52
|
}
|