ocx-cursor 1.0.3 → 1.0.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/package.json +1 -1
- package/src/catalog.mjs +27 -2
package/package.json
CHANGED
package/src/catalog.mjs
CHANGED
|
@@ -73,6 +73,30 @@ export function priorityModelIds(catalogFile = configuredCodexCatalogFile()) {
|
|
|
73
73
|
}
|
|
74
74
|
}
|
|
75
75
|
|
|
76
|
+
export function codexNativeModels(catalogFile = configuredCodexCatalogFile()) {
|
|
77
|
+
try {
|
|
78
|
+
const payload = JSON.parse(readFileSync(catalogFile, "utf8"));
|
|
79
|
+
return payload.models
|
|
80
|
+
.filter((model) => typeof model?.slug === "string"
|
|
81
|
+
&& !model.slug.includes("/")
|
|
82
|
+
&& model.visibility === "list"
|
|
83
|
+
&& model.supported_in_api === true
|
|
84
|
+
&& model.opencodex_capability_provenance === undefined)
|
|
85
|
+
.map((model) => ({
|
|
86
|
+
id: model.slug,
|
|
87
|
+
owned_by: "openai",
|
|
88
|
+
capabilities: {
|
|
89
|
+
input_modalities: model.input_modalities,
|
|
90
|
+
context_length: model.context_window,
|
|
91
|
+
max_output_tokens: model.max_output_tokens,
|
|
92
|
+
reasoning_effort: model.supported_reasoning_levels?.map(({ effort }) => effort),
|
|
93
|
+
},
|
|
94
|
+
}));
|
|
95
|
+
} catch {
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
|
|
76
100
|
export function normalizeActiveCatalog(configured, active, fastModelIds = new Set()) {
|
|
77
101
|
const configuredById = new Map(configured
|
|
78
102
|
.filter((model) => typeof model.provider === "string" && typeof model.model === "string")
|
|
@@ -141,9 +165,10 @@ export async function activeModels(fetchImpl = fetch) {
|
|
|
141
165
|
}
|
|
142
166
|
|
|
143
167
|
export async function buildActiveCatalog(options = {}) {
|
|
168
|
+
const codexCatalogFile = options.codexCatalogFile || configuredCodexCatalogFile();
|
|
144
169
|
return normalizeActiveCatalog(
|
|
145
170
|
configuredModels(options.ocxBin),
|
|
146
|
-
await activeModels(options.fetchImpl),
|
|
147
|
-
options.fastModelIds || priorityModelIds(
|
|
171
|
+
[...await activeModels(options.fetchImpl), ...codexNativeModels(codexCatalogFile)],
|
|
172
|
+
options.fastModelIds || priorityModelIds(codexCatalogFile),
|
|
148
173
|
);
|
|
149
174
|
}
|