codex-copilot-dx 0.4.12 → 0.4.13
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/package.json +1 -1
- package/src/adapter.mjs +11 -1
- package/src/models.mjs +13 -14
package/package.json
CHANGED
package/src/adapter.mjs
CHANGED
|
@@ -750,8 +750,18 @@ export function startAdapter(port = 2026, host = "127.0.0.1", options = {}) {
|
|
|
750
750
|
socket.destroy();
|
|
751
751
|
});
|
|
752
752
|
|
|
753
|
-
return new Promise((resolve) => {
|
|
753
|
+
return new Promise((resolve, reject) => {
|
|
754
|
+
const onListenError = (e) => {
|
|
755
|
+
if (e?.code === "EADDRINUSE") {
|
|
756
|
+
reject(new Error(`Adapter address http://${host}:${port} is already in use. Stop the existing codex-copilot-dx process or set ADAPTER_PORT to another port.`));
|
|
757
|
+
return;
|
|
758
|
+
}
|
|
759
|
+
reject(e);
|
|
760
|
+
};
|
|
761
|
+
|
|
762
|
+
server.once("error", onListenError);
|
|
754
763
|
server.listen(port, host, () => {
|
|
764
|
+
server.off("error", onListenError);
|
|
755
765
|
const actualPort = server.address()?.port || port;
|
|
756
766
|
console.log(status("ok", `Adapter listening on http://${host}:${actualPort}`));
|
|
757
767
|
resolve(server);
|
package/src/models.mjs
CHANGED
|
@@ -31,6 +31,9 @@ const DEFAULT_CLAUDE_DESKTOP_MODEL_DEFS = [
|
|
|
31
31
|
maxInputTokens: 200000,
|
|
32
32
|
maxOutputTokens: 8192,
|
|
33
33
|
},
|
|
34
|
+
];
|
|
35
|
+
|
|
36
|
+
const DEFAULT_CLAUDE_MODEL_ALIAS_DEFS = [
|
|
34
37
|
{
|
|
35
38
|
id: "claude-sonnet-4-6",
|
|
36
39
|
upstream: "claude-sonnet-4.6",
|
|
@@ -126,19 +129,6 @@ export function claudeDesktopModelDefsFromCopilotModels(models) {
|
|
|
126
129
|
});
|
|
127
130
|
}
|
|
128
131
|
|
|
129
|
-
const upstreamIds = new Set(defs.map((model) => model.upstream));
|
|
130
|
-
for (const alias of DEFAULT_CLAUDE_DESKTOP_MODEL_DEFS) {
|
|
131
|
-
if (alias.id === alias.upstream || seen.has(alias.id) || !upstreamIds.has(alias.upstream)) continue;
|
|
132
|
-
const upstream = defs.find((model) => model.upstream === alias.upstream);
|
|
133
|
-
defs.push({
|
|
134
|
-
...alias,
|
|
135
|
-
displayName: upstream?.displayName || alias.displayName,
|
|
136
|
-
maxInputTokens: upstream?.maxInputTokens || alias.maxInputTokens,
|
|
137
|
-
maxOutputTokens: upstream?.maxOutputTokens || alias.maxOutputTokens,
|
|
138
|
-
});
|
|
139
|
-
seen.add(alias.id);
|
|
140
|
-
}
|
|
141
|
-
|
|
142
132
|
return defs;
|
|
143
133
|
}
|
|
144
134
|
|
|
@@ -153,9 +143,18 @@ export function claudeDesktopModelIds(env = process.env, options = {}) {
|
|
|
153
143
|
return claudeDesktopModelDefs(env, options).map((model) => model.id);
|
|
154
144
|
}
|
|
155
145
|
|
|
146
|
+
function claudeModelResolutionDefs(env = process.env, options = {}) {
|
|
147
|
+
const defs = claudeDesktopModelDefs(env, options);
|
|
148
|
+
if (parseModelAliasEnv(env.CCDX_CLAUDE_MODEL_ALIASES).length) return defs;
|
|
149
|
+
|
|
150
|
+
const upstreamIds = new Set(defs.map((model) => model.upstream));
|
|
151
|
+
const aliases = DEFAULT_CLAUDE_MODEL_ALIAS_DEFS.filter((alias) => upstreamIds.has(alias.upstream));
|
|
152
|
+
return [...defs, ...aliases];
|
|
153
|
+
}
|
|
154
|
+
|
|
156
155
|
export function resolveAnthropicModel(model, env = process.env, options = {}) {
|
|
157
156
|
const requestedModel = String(model || "");
|
|
158
|
-
const match =
|
|
157
|
+
const match = claudeModelResolutionDefs(env, options).find((entry) => entry.id === requestedModel);
|
|
159
158
|
return {
|
|
160
159
|
requestedModel,
|
|
161
160
|
upstreamModel: match?.upstream || requestedModel,
|