@oh-my-pi/pi-catalog 18.4.2 → 18.4.3
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/CHANGELOG.md +26 -0
- package/dist/types/compat/types.d.ts +4 -0
- package/dist/types/provider-models/openai-compat.d.ts +10 -7
- package/dist/types/types.d.ts +6 -0
- package/package.json +4 -4
- package/src/build.ts +5 -0
- package/src/compat/axes.ts +3 -0
- package/src/compat/collapse.ts +11 -2
- package/src/compat/rules/README.md +1 -1
- package/src/compat/rules/auth/commandcode.kdl +10 -4
- package/src/compat/rules/classes/anthropic.kdl +30 -0
- package/src/compat/rules/classes/gemini.kdl +11 -0
- package/src/compat/rules/classes/openai.kdl +22 -0
- package/src/compat/rules/classes/xai.kdl +6 -0
- package/src/compat/rules/providers/anthropic.kdl +6 -0
- package/src/compat/rules/providers/commandcode.kdl +223 -76
- package/src/compat/rules/providers/openai-codex.kdl +3 -2
- package/src/compat/rules/providers/openai.kdl +0 -6
- package/src/compat/rules/providers/web.kdl +8 -0
- package/src/compat/rules/runtime/behavior.kdl +7 -2
- package/src/compat/rules/taxonomy/_collapse.kdl +3 -0
- package/src/compat/rules.json +1 -1
- package/src/compat/types.ts +11 -1
- package/src/models.json +1 -1
- package/src/provider-models/openai-compat.ts +19 -11
- package/src/types.ts +6 -0
|
@@ -7296,7 +7296,8 @@ export function modelsDevCatalogFallback(
|
|
|
7296
7296
|
* `baseUrl` overrides the Provider API base path for testing; it is
|
|
7297
7297
|
* normalized to the shared `/provider` root (a trailing `/v1` is stripped)
|
|
7298
7298
|
* so Claude ids route to the Anthropic-compatible Messages endpoint at the
|
|
7299
|
-
* root
|
|
7299
|
+
* root, the ten GPT ids listed in the `api-routes` table to the Responses
|
|
7300
|
+
* endpoint under `/v1`, and every other id to chat completions under `/v1`.
|
|
7300
7301
|
*/
|
|
7301
7302
|
export interface CommandCodeModelManagerConfig {
|
|
7302
7303
|
apiKey?: string;
|
|
@@ -7315,12 +7316,14 @@ function normalizeCommandCodeBasePath(baseUrl: string | undefined): string {
|
|
|
7315
7316
|
* Builds the Command Code model manager: a mixed-protocol OpenAI-compatible
|
|
7316
7317
|
* discovery client. The public `/v1/models` catalog is fetched once per
|
|
7317
7318
|
* options instance; `mapModel` pins each row's transport from the
|
|
7318
|
-
* `api-routes` table (Claude ids to `anthropic-messages`,
|
|
7319
|
-
* `openai-completions`) and seeds
|
|
7320
|
-
* Command Code policy (effort ladders,
|
|
7321
|
-
* applied later by `buildModel` from
|
|
7322
|
-
* mapper never inherits another provider's
|
|
7323
|
-
* or context window.
|
|
7319
|
+
* `api-routes` table (Claude ids to `anthropic-messages`, the listed GPT ids
|
|
7320
|
+
* to `openai-responses`, everything else to `openai-completions`) and seeds
|
|
7321
|
+
* neutral capability defaults. Reviewed Command Code policy (effort ladders,
|
|
7322
|
+
* pricing, limits, modalities) is applied later by `buildModel` from
|
|
7323
|
+
* `providers/commandcode.kdl` — the mapper never inherits another provider's
|
|
7324
|
+
* reasoning, rates, image support, or context window. A successful fetch also
|
|
7325
|
+
* appends the KDL `seed` rows (typesafe/jev), rebased onto the configured
|
|
7326
|
+
* base, because `dynamicModelsAuthoritative` would prune `staticModels`.
|
|
7324
7327
|
*/
|
|
7325
7328
|
export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerConfig): ModelManagerOptions<Api> {
|
|
7326
7329
|
const basePath = normalizeCommandCodeBasePath(config?.baseUrl);
|
|
@@ -7332,8 +7335,8 @@ export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerC
|
|
|
7332
7335
|
baseUrl: discoveryBaseUrl,
|
|
7333
7336
|
}),
|
|
7334
7337
|
dynamicModelsAuthoritative: true,
|
|
7335
|
-
fetchDynamicModels: () => {
|
|
7336
|
-
|
|
7338
|
+
fetchDynamicModels: async () => {
|
|
7339
|
+
const discovered = await fetchOpenAICompatibleModels<Api>({
|
|
7337
7340
|
api: "openai-completions",
|
|
7338
7341
|
provider: "commandcode",
|
|
7339
7342
|
baseUrl: discoveryBaseUrl,
|
|
@@ -7342,8 +7345,9 @@ export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerC
|
|
|
7342
7345
|
// inference. The helper only sends Authorization when set.
|
|
7343
7346
|
apiKey: config?.apiKey,
|
|
7344
7347
|
mapModel: (entry, defaults) => {
|
|
7345
|
-
const route = apiRouteFor("commandcode", defaults.id);
|
|
7346
|
-
const api =
|
|
7348
|
+
const route = apiRouteFor("commandcode", defaults.id)?.api;
|
|
7349
|
+
const api =
|
|
7350
|
+
route === "anthropic-messages" || route === "openai-responses" ? route : "openai-completions";
|
|
7347
7351
|
return {
|
|
7348
7352
|
...defaults,
|
|
7349
7353
|
name: toModelName(entry.name, defaults.name),
|
|
@@ -7373,6 +7377,10 @@ export function commandCodeModelManagerOptions(config?: CommandCodeModelManagerC
|
|
|
7373
7377
|
},
|
|
7374
7378
|
fetch: config?.fetch,
|
|
7375
7379
|
});
|
|
7380
|
+
if (!discovered) return null;
|
|
7381
|
+
const seeds = seedModels("commandcode").map(seed => ({ ...seed, baseUrl: basePath }));
|
|
7382
|
+
const seedIds = new Set(seeds.map(seed => seed.id));
|
|
7383
|
+
return [...discovered.filter(model => !seedIds.has(model.id)), ...seeds];
|
|
7376
7384
|
},
|
|
7377
7385
|
};
|
|
7378
7386
|
}
|
package/src/types.ts
CHANGED
|
@@ -1201,6 +1201,12 @@ export interface Model<TApi extends Api = Api> {
|
|
|
1201
1201
|
kind?: ModelKind;
|
|
1202
1202
|
/** Grounding transport supported by this chat model. */
|
|
1203
1203
|
webSearch?: WebSearchGrounding;
|
|
1204
|
+
/** Cheaper same-provider model to run hosted web search in this model's place (model id or provider/id). */
|
|
1205
|
+
webSearchModel?: string;
|
|
1206
|
+
/** Whether this chat model can carry the Responses `image_generation` tool itself. */
|
|
1207
|
+
hostedImage?: boolean;
|
|
1208
|
+
/** Same-provider image model to generate images in this model's place (model id or provider/id). */
|
|
1209
|
+
imageModel?: string;
|
|
1204
1210
|
/**
|
|
1205
1211
|
* Structured model identity resolved by the compat engine: vendor lineage
|
|
1206
1212
|
* class, product family, and revision. Baked into models.json rows and
|