@velum-labs/routekit-tool-codex 0.16.2 → 0.16.4
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/launch.js +10 -3
- package/dist/test/launch.test.js +39 -0
- package/package.json +6 -5
package/dist/launch.js
CHANGED
|
@@ -3,6 +3,7 @@ import { copyFileSync, existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync,
|
|
|
3
3
|
import { homedir } from "node:os";
|
|
4
4
|
import { join } from "node:path";
|
|
5
5
|
import { stringify as tomlStringify } from "smol-toml";
|
|
6
|
+
import { isCodexPickerEligibleModel } from "@velum-labs/routekit-contracts";
|
|
6
7
|
import { trimTrailingSlashes } from "@velum-labs/routekit-runtime";
|
|
7
8
|
const PROVIDER_ID = "routekit";
|
|
8
9
|
const CATALOG_FILE = "model-catalog.json";
|
|
@@ -82,9 +83,14 @@ function codexModelId(modelId) {
|
|
|
82
83
|
? modelId.slice("codex/".length)
|
|
83
84
|
: modelId;
|
|
84
85
|
}
|
|
86
|
+
function catalogModels(spec) {
|
|
87
|
+
return spec.models.filter((model) => model.id === spec.defaultModel ||
|
|
88
|
+
model.aliases?.includes(spec.defaultModel) === true ||
|
|
89
|
+
isCodexPickerEligibleModel(model));
|
|
90
|
+
}
|
|
85
91
|
function catalogIds(spec) {
|
|
86
92
|
return [
|
|
87
|
-
...new Set([spec.defaultModel, ...spec.
|
|
93
|
+
...new Set([spec.defaultModel, ...catalogModels(spec).flatMap((model) => [
|
|
88
94
|
model.id,
|
|
89
95
|
...(model.aliases ?? [])
|
|
90
96
|
])].map(codexModelId))
|
|
@@ -98,7 +104,8 @@ function isCodexNativeId(spec, id) {
|
|
|
98
104
|
}
|
|
99
105
|
export function codexCatalogEntries(spec, template, stockModels = [], options = {}) {
|
|
100
106
|
const appendUnlistedStock = options.appendUnlistedStock ?? true;
|
|
101
|
-
const
|
|
107
|
+
const models = catalogModels(spec);
|
|
108
|
+
const ids = catalogIds(spec);
|
|
102
109
|
const listed = new Set(ids);
|
|
103
110
|
const stockBySlug = new Map(stockModels.flatMap((entry) => {
|
|
104
111
|
const slug = presetSlug(entry);
|
|
@@ -143,7 +150,7 @@ export function codexCatalogEntries(spec, template, stockModels = [], options =
|
|
|
143
150
|
if (stock !== undefined && isCodexNativeId(spec, id)) {
|
|
144
151
|
return { ...stock, slug: id, visibility: "list", priority, prefer_websockets: false };
|
|
145
152
|
}
|
|
146
|
-
const model =
|
|
153
|
+
const model = models.find((candidate) => codexModelId(candidate.id) === id ||
|
|
147
154
|
candidate.aliases?.some((alias) => codexModelId(alias) === id) === true);
|
|
148
155
|
const levels = (model?.reasoning?.efforts ?? []).map((effort) => ({
|
|
149
156
|
effort: effort.id,
|
package/dist/test/launch.test.js
CHANGED
|
@@ -59,6 +59,45 @@ test("Codex launcher serializes namespaced models without interpreting provider
|
|
|
59
59
|
.every((entry) => Array.isArray(entry.supported_reasoning_levels)), "every gateway-routed entry carries supported_reasoning_levels");
|
|
60
60
|
assert.deepEqual(JSON.parse(codexModelCatalogJson(SPEC, template)).models, entries.slice(0, 3));
|
|
61
61
|
});
|
|
62
|
+
test("Codex launcher filters incompatible OpenRouter models and aliases", () => {
|
|
63
|
+
const spec = {
|
|
64
|
+
gatewayUrl: "http://127.0.0.1:9999",
|
|
65
|
+
defaultModel: "openai/unknown",
|
|
66
|
+
models: [
|
|
67
|
+
{ id: "openrouter/chat-only", provider: "openrouter", aliases: ["chat-alias"] },
|
|
68
|
+
{
|
|
69
|
+
id: "openrouter/reasoning",
|
|
70
|
+
provider: "openrouter",
|
|
71
|
+
aliases: ["reasoning-alias"],
|
|
72
|
+
reasoning: { status: "supported", provenance: "provider" }
|
|
73
|
+
},
|
|
74
|
+
{ id: "openai/unknown", provider: "openai", aliases: ["openai-alias"] }
|
|
75
|
+
],
|
|
76
|
+
args: []
|
|
77
|
+
};
|
|
78
|
+
const entries = codexCatalogEntries(spec, { slug: "stock" }, [], {
|
|
79
|
+
appendUnlistedStock: false
|
|
80
|
+
});
|
|
81
|
+
assert.deepEqual(entries.map((entry) => entry.slug), ["openai/unknown", "openrouter/reasoning", "reasoning-alias", "openai-alias"]);
|
|
82
|
+
});
|
|
83
|
+
test("Codex launcher retains an incompatible selected default deterministically", () => {
|
|
84
|
+
const spec = {
|
|
85
|
+
gatewayUrl: "http://127.0.0.1:9999",
|
|
86
|
+
defaultModel: "selected-alias",
|
|
87
|
+
models: [
|
|
88
|
+
{
|
|
89
|
+
id: "openrouter/chat-only",
|
|
90
|
+
provider: "openrouter",
|
|
91
|
+
aliases: ["selected-alias", "second-alias"]
|
|
92
|
+
},
|
|
93
|
+
{ id: "openrouter/hidden", provider: "openrouter", aliases: ["hidden-alias"] }
|
|
94
|
+
],
|
|
95
|
+
args: []
|
|
96
|
+
};
|
|
97
|
+
assert.deepEqual(codexCatalogEntries(spec, { slug: "stock" }, [], {
|
|
98
|
+
appendUnlistedStock: false
|
|
99
|
+
}).map((entry) => entry.slug), ["selected-alias", "openrouter/chat-only", "second-alias"]);
|
|
100
|
+
});
|
|
62
101
|
test("Codex launcher exposes only provider-discovered Claude effort levels", () => {
|
|
63
102
|
const spec = {
|
|
64
103
|
gatewayUrl: "http://127.0.0.1:9999",
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@velum-labs/routekit-tool-codex",
|
|
3
3
|
"private": false,
|
|
4
|
-
"version": "0.16.
|
|
4
|
+
"version": "0.16.4",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git+https://github.com/velum-labs/routekit.git",
|
|
@@ -29,10 +29,11 @@
|
|
|
29
29
|
"@openai/codex-sdk": "0.145.0",
|
|
30
30
|
"smol-toml": "1.7.0",
|
|
31
31
|
"zod": "4.4.3",
|
|
32
|
-
"@velum-labs/routekit-
|
|
33
|
-
"@velum-labs/routekit-
|
|
34
|
-
"@velum-labs/routekit-
|
|
35
|
-
"@velum-labs/routekit-
|
|
32
|
+
"@velum-labs/routekit-contracts": "0.16.4",
|
|
33
|
+
"@velum-labs/routekit-harness-core": "0.16.4",
|
|
34
|
+
"@velum-labs/routekit-registry": "0.16.4",
|
|
35
|
+
"@velum-labs/routekit-runtime": "0.16.4",
|
|
36
|
+
"@velum-labs/routekit-tools": "0.16.4"
|
|
36
37
|
},
|
|
37
38
|
"keywords": [
|
|
38
39
|
"llm",
|