@oh-my-pi/pi-catalog 18.4.2 → 18.4.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.
@@ -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 while every other id uses chat completions under `/v1`.
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`, everything else to
7319
- * `openai-completions`) and seeds neutral capability defaults. Reviewed
7320
- * Command Code policy (effort ladders, pricing, limits, modalities) is
7321
- * applied later by `buildModel` from `providers/commandcode.kdl` — the
7322
- * mapper never inherits another provider's reasoning, rates, image support,
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
- return fetchOpenAICompatibleModels<Api>({
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 = route?.api === "anthropic-messages" ? route.api : "openai-completions";
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
@@ -560,6 +560,15 @@ export interface AnthropicCompat {
560
560
  * `tools.<n>.custom.strict: Extra inputs are not permitted`.
561
561
  */
562
562
  disableStrictTools?: boolean;
563
+ /**
564
+ * The endpoint is Amazon Bedrock's Anthropic Messages API (`/anthropic` on
565
+ * bedrock-runtime or bedrock-mantle). Requests drop tool `strict`, fit
566
+ * `metadata.user_id` to Bedrock's request-metadata pattern, and may use
567
+ * on-demand compaction. Detected from the model `baseUrl`; set it in
568
+ * models.yml `compat` for a route the URL check cannot see (a proxy, an
569
+ * `ANTHROPIC_BASE_URL` reroute) or to `false` to opt out.
570
+ */
571
+ bedrockMessagesApi?: boolean;
563
572
  /**
564
573
  * Map adaptive thinking (`thinking: { type: "adaptive" }`) to
565
574
  * `{ type: "enabled", budget_tokens }`. Vertex AI rejects the `adaptive`
@@ -587,6 +596,13 @@ export interface AnthropicCompat {
587
596
  * `input_transformations` under the thinking-binding-controls beta.
588
597
  */
589
598
  supportsThinkingBindingControls?: boolean;
599
+ /**
600
+ * Whether the model replaces `thinking: { type: "disabled" }` with
601
+ * `thinking: { type: "between_tools" }` (Claude Sonnet 5.5). The disabled
602
+ * form is rejected with a 400; `between_tools` skips up-front thinking and
603
+ * only allows progress updates between tool calls.
604
+ */
605
+ supportsBetweenToolsThinking?: boolean;
590
606
  /**
591
607
  * Whether the model accepts a forced `tool_choice` (`{ type: "any" }` or
592
608
  * `{ type: "tool", name }`). Claude Fable/Mythos 5 reject forced tool use
@@ -960,9 +976,17 @@ export interface ResolvedOpenAIResponsesCompat extends ResolvedOpenAISharedCompa
960
976
  export type ResolvedOpenRouterCompat = ResolvedOpenAICompat & ResolvedOpenAIResponsesCompat;
961
977
 
962
978
  /** Fully-resolved anthropic-messages compat view (same contract as `ResolvedOpenAICompat`). */
963
- export type ResolvedAnthropicCompat = Required<Omit<AnthropicCompat, "streamIdleTimeoutMs" | "thinkingLoopGuard">> & {
979
+ export type ResolvedAnthropicCompat = Required<
980
+ Omit<AnthropicCompat, "streamIdleTimeoutMs" | "thinkingLoopGuard" | "bedrockMessagesApi">
981
+ > & {
964
982
  /** Thinking-loop watchdog guard family applied to streamed reasoning. */
965
983
  thinkingLoopGuard?: AnthropicCompat["thinkingLoopGuard"];
984
+ /**
985
+ * Bedrock's Anthropic Messages API (see {@link AnthropicCompat.bedrockMessagesApi}).
986
+ * `true` when detected or configured; otherwise unset, so rows baked before
987
+ * this field keep matching.
988
+ */
989
+ bedrockMessagesApi?: boolean;
966
990
  /**
967
991
  * Stream-watchdog idle-timeout fallback in ms for slow reasoning hosts; 0 disables the idle watchdog.
968
992
  * Undefined defers to `PI_STREAM_IDLE_TIMEOUT_MS`, then the legacy
@@ -1201,6 +1225,12 @@ export interface Model<TApi extends Api = Api> {
1201
1225
  kind?: ModelKind;
1202
1226
  /** Grounding transport supported by this chat model. */
1203
1227
  webSearch?: WebSearchGrounding;
1228
+ /** Cheaper same-provider model to run hosted web search in this model's place (model id or provider/id). */
1229
+ webSearchModel?: string;
1230
+ /** Whether this chat model can carry the Responses `image_generation` tool itself. */
1231
+ hostedImage?: boolean;
1232
+ /** Same-provider image model to generate images in this model's place (model id or provider/id). */
1233
+ imageModel?: string;
1204
1234
  /**
1205
1235
  * Structured model identity resolved by the compat engine: vendor lineage
1206
1236
  * class, product family, and revision. Baked into models.json rows and
@@ -1352,6 +1382,12 @@ export interface Model<TApi extends Api = Api> {
1352
1382
  useResponsesLite?: boolean;
1353
1383
  /** Codex Code Mode restriction: model expects tools routed through a programmatic exec surface (mirrors codex-rs `tool_mode`). */
1354
1384
  toolMode?: "code_mode_only";
1385
+ /**
1386
+ * Service-tier ids the provider advertises for this model (Codex discovery
1387
+ * `service_tiers[].id`, e.g. `priority`, `ultrafast`). Absent when the
1388
+ * provider publishes no per-model tier list.
1389
+ */
1390
+ serviceTiers?: readonly string[];
1355
1391
  /** Preferred model to switch to when context promotion is triggered (model id or provider/id). */
1356
1392
  contextPromotionTarget?: string;
1357
1393
  /** Preferred model to use only for compaction (model id or provider/id); the active session model is unchanged. */
package/src/wire/codex.ts CHANGED
@@ -9,10 +9,12 @@ export const CODEX_BASE_URL = "https://chatgpt.com/backend-api";
9
9
  * Updated from npm by `bun run check-spoofed-versions --update`.
10
10
  *
11
11
  * The backend version-gates model availability against this value on both
12
- * `/models?client_version=` and `/responses`; 0.155.1 exposes GPT-6 Sol and Luna.
13
- * An older pin silently hides newer SKUs from discovery.
12
+ * `/models?client_version=` and `/responses`, independently of a model's
13
+ * declared `minimal_client_version`: GPT-6.1 Sol declares 0.153.0 yet is
14
+ * omitted from `/models` at 0.155.1 and listed at 0.159.0. An older pin
15
+ * silently hides newer SKUs from discovery.
14
16
  */
15
- export const CODEX_CLIENT_VERSION = "0.155.1";
17
+ export const CODEX_CLIENT_VERSION = "0.159.0";
16
18
 
17
19
  export const OPENAI_HEADERS = {
18
20
  BETA: "OpenAI-Beta",