@linxiraos/pi-catalog 1.4.10 → 1.4.12

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.
Files changed (51) hide show
  1. package/CHANGELOG.md +12 -3
  2. package/THIRD-PARTY-NOTICES.txt +99 -0
  3. package/dist/types/compat/auth-ids.d.ts +2 -2
  4. package/dist/types/compat/responses-websocket.d.ts +6 -0
  5. package/dist/types/compat/types.d.ts +6 -0
  6. package/dist/types/discovery/devin-proto.d.ts +15 -0
  7. package/dist/types/model-manager.d.ts +2 -0
  8. package/dist/types/pricing.d.ts +1 -1
  9. package/dist/types/types.d.ts +17 -1
  10. package/dist/types/wire/codex.d.ts +0 -1
  11. package/dist/types/wire/factory-droid.d.ts +1 -1
  12. package/package.json +5 -5
  13. package/src/compat/auth-ids.ts +4 -0
  14. package/src/compat/axes.ts +6 -0
  15. package/src/compat/resolve.ts +2 -0
  16. package/src/compat/responses-websocket.ts +12 -0
  17. package/src/compat/rules/auth/_order.kdl +1 -1
  18. package/src/compat/rules/auth/devin-cli.kdl +6 -0
  19. package/src/compat/rules/auth/devin-windsurf.kdl +6 -0
  20. package/src/compat/rules/classes/anthropic.kdl +16 -0
  21. package/src/compat/rules/providers/factory-droid.kdl +56 -4
  22. package/src/compat/rules/providers/muse-code.kdl +16 -0
  23. package/src/compat/rules/providers/openai.kdl +3 -0
  24. package/src/compat/rules/providers/web.kdl +7 -0
  25. package/src/compat/rules/runtime/behavior.kdl +4 -4
  26. package/src/compat/rules.json +1 -1
  27. package/src/compat/types.d.ts +6 -0
  28. package/src/compat/types.ts +6 -0
  29. package/src/discovery/antigravity.ts +1 -1
  30. package/src/discovery/codex.ts +1 -2
  31. package/src/discovery/cursor.ts +1 -1
  32. package/src/discovery/devin-proto.d.ts +15 -0
  33. package/src/discovery/devin-proto.ts +28 -0
  34. package/src/discovery/factory-droid.ts +23 -12
  35. package/src/discovery/gemini-cli.ts +1 -1
  36. package/src/discovery/gemini.ts +1 -1
  37. package/src/discovery/gitlab-duo-workflow.ts +1 -1
  38. package/src/discovery/openai-compatible.ts +1 -1
  39. package/src/model-cache.ts +1 -1
  40. package/src/model-manager.d.ts +2 -0
  41. package/src/model-manager.ts +23 -14
  42. package/src/models.json +1 -1
  43. package/src/pricing.d.ts +1 -1
  44. package/src/pricing.ts +1 -1
  45. package/src/provider-models/openai-compat.ts +38 -1
  46. package/src/types.d.ts +17 -1
  47. package/src/types.ts +17 -1
  48. package/src/wire/codex.d.ts +0 -1
  49. package/src/wire/codex.ts +0 -1
  50. package/src/wire/factory-droid.d.ts +1 -1
  51. package/src/wire/factory-droid.ts +1 -1
@@ -729,6 +729,12 @@ export interface RequestPolicy {
729
729
  /** Default `tool_choice` to `auto` when the request carries tools and the caller picks none. */
730
730
  responsesToolChoiceAuto?: boolean;
731
731
  googleThinking?: "level" | "level-medium";
732
+ /** Send no `temperature`, `topP` or `topK` in `generationConfig`. */
733
+ googleOmitSampling?: boolean;
734
+ /** Send `generationConfig.maxOutputTokens` as the model's output maximum. */
735
+ googlePinMaxOutputTokens?: boolean;
736
+ /** Replay the model's own turns as the native Gemini content it streamed. */
737
+ googleNativeReplay?: boolean;
732
738
  /** The route locks its upstream for the session (`x-provider-routing-source: session_lock`). */
733
739
  routingSessionLock?: boolean;
734
740
  }
@@ -768,6 +768,12 @@ export interface RequestPolicy {
768
768
  /** Default `tool_choice` to `auto` when the request carries tools and the caller picks none. */
769
769
  responsesToolChoiceAuto?: boolean;
770
770
  googleThinking?: "level" | "level-medium";
771
+ /** Send no `temperature`, `topP` or `topK` in `generationConfig`. */
772
+ googleOmitSampling?: boolean;
773
+ /** Send `generationConfig.maxOutputTokens` as the model's output maximum. */
774
+ googlePinMaxOutputTokens?: boolean;
775
+ /** Replay the model's own turns as the native Gemini content it streamed. */
776
+ googleNativeReplay?: boolean;
771
777
  /** The route locks its upstream for the session (`x-provider-routing-source: session_lock`). */
772
778
  routingSessionLock?: boolean;
773
779
  }
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import type { FetchImpl } from "@linxiraos/pi-utils";
3
3
  import { collapseVariants, type VariantCollapseTable } from "../compat/collapse";
4
4
  import type { AntigravityModelWireProfile, ModelSpec } from "../types";
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import { compareRevision, parseRevision } from "../compat/revision";
3
3
  import { classifyModel } from "../compat/taxonomy";
4
4
  import { getBundledModels } from "../models";
@@ -205,7 +205,6 @@ function buildCodexHeaders(options: CodexModelDiscoveryOptions, clientVersion: s
205
205
  if (options.accountId && options.accountId.trim().length > 0) {
206
206
  headers.set(OPENAI_HEADERS.ACCOUNT_ID, options.accountId);
207
207
  }
208
- headers.set(OPENAI_HEADERS.BETA, OPENAI_HEADER_VALUES.BETA_RESPONSES);
209
208
  headers.set(OPENAI_HEADERS.ORIGINATOR, OPENAI_HEADER_VALUES.ORIGINATOR_CODEX);
210
209
  headers.set(OPENAI_HEADERS.VERSION, clientVersion);
211
210
  headers.set("accept", "application/json");
@@ -1,5 +1,5 @@
1
1
  import * as http2 from "node:http2";
2
- import { type } from "@linxiraos/pi-omptype";
2
+ import { type } from "@linxiraos/zeta-schema";
3
3
  import { slugify } from "@linxiraos/pi-utils";
4
4
  import { collapseVariants, type EffortVariantFamily, reviewedVariantFamilyId } from "../compat/collapse";
5
5
  import { compareRevision, parseRevision } from "../compat/revision";
@@ -1297,6 +1297,21 @@ export interface DevinPlanInfo extends ProtoMessage {
1297
1297
  accountDisplayName: string;
1298
1298
  }
1299
1299
  export declare const DevinPlanInfoSchema: MessageCodec<DevinPlanInfo>;
1300
+ /** Devin message exa.seat_management_pb.ExchangePKCEAuthorizationCodeRequest. */
1301
+ export interface ExchangePKCEAuthorizationCodeRequest extends ProtoMessage {
1302
+ authorizationCode: string;
1303
+ codeVerifier: string;
1304
+ }
1305
+ export declare const ExchangePKCEAuthorizationCodeRequestSchema: MessageCodec<ExchangePKCEAuthorizationCodeRequest>;
1306
+ /** Devin message exa.seat_management_pb.ExchangePKCEAuthorizationCodeResponse. */
1307
+ export interface ExchangePKCEAuthorizationCodeResponse extends ProtoMessage {
1308
+ apiKey: string;
1309
+ name: string;
1310
+ apiServerUrl: string;
1311
+ devinWebappHost: string;
1312
+ devinApiUrl: string;
1313
+ }
1314
+ export declare const ExchangePKCEAuthorizationCodeResponseSchema: MessageCodec<ExchangePKCEAuthorizationCodeResponse>;
1300
1315
  /** Devin message exa.codeium_common_pb.ExperimentConfig. */
1301
1316
  export interface ExperimentConfig extends ProtoMessage {
1302
1317
  experiments: ExperimentWithVariant[];
@@ -1523,6 +1523,34 @@ export const DevinPlanInfoSchema: MessageCodec<DevinPlanInfo> = pb<DevinPlanInfo
1523
1523
  { no: 8, name: "accountDisplayName", kind: "string" },
1524
1524
  ]);
1525
1525
 
1526
+ /** Devin message exa.seat_management_pb.ExchangePKCEAuthorizationCodeRequest. */
1527
+ export interface ExchangePKCEAuthorizationCodeRequest extends ProtoMessage {
1528
+ authorizationCode: string;
1529
+ codeVerifier: string;
1530
+ }
1531
+
1532
+ export const ExchangePKCEAuthorizationCodeRequestSchema: MessageCodec<ExchangePKCEAuthorizationCodeRequest> = pb<ExchangePKCEAuthorizationCodeRequest>("exa.seat_management_pb.ExchangePKCEAuthorizationCodeRequest", [
1533
+ { no: 1, name: "authorizationCode", kind: "string" },
1534
+ { no: 2, name: "codeVerifier", kind: "string" },
1535
+ ]);
1536
+
1537
+ /** Devin message exa.seat_management_pb.ExchangePKCEAuthorizationCodeResponse. */
1538
+ export interface ExchangePKCEAuthorizationCodeResponse extends ProtoMessage {
1539
+ apiKey: string;
1540
+ name: string;
1541
+ apiServerUrl: string;
1542
+ devinWebappHost: string;
1543
+ devinApiUrl: string;
1544
+ }
1545
+
1546
+ export const ExchangePKCEAuthorizationCodeResponseSchema: MessageCodec<ExchangePKCEAuthorizationCodeResponse> = pb<ExchangePKCEAuthorizationCodeResponse>("exa.seat_management_pb.ExchangePKCEAuthorizationCodeResponse", [
1547
+ { no: 1, name: "apiKey", kind: "string" },
1548
+ { no: 2, name: "name", kind: "string" },
1549
+ { no: 3, name: "apiServerUrl", kind: "string" },
1550
+ { no: 4, name: "devinWebappHost", kind: "string" },
1551
+ { no: 5, name: "devinApiUrl", kind: "string" },
1552
+ ]);
1553
+
1526
1554
  /** Devin message exa.codeium_common_pb.ExperimentConfig. */
1527
1555
  export interface ExperimentConfig extends ProtoMessage {
1528
1556
  experiments: ExperimentWithVariant[];
@@ -241,10 +241,7 @@ export async function fetchFactoryDroidModels(
241
241
  }
242
242
  const models = factoryDroidRegistry().flatMap(model => {
243
243
  if (!isModelAvailable(model, flags, policy, servingRegion, images)) return [];
244
- const { id } = model.spec;
245
- const family = model.policy.routingFamily;
246
- const routed = routing?.models?.[id] ?? (family === undefined ? undefined : routing?.defaults?.[family]);
247
- const rotation = resolveRotation(model, routed, servingRegion, routing?.blockedProviders?.[id]);
244
+ const { rotation, configured } = resolveRotation(model, routing, servingRegion);
248
245
  if (rotation.length === 0) return [];
249
246
  const spec = buildFactoryDroidModel(model, {
250
247
  region: options.region,
@@ -253,7 +250,7 @@ export async function fetchFactoryDroidModels(
253
250
  apiProviders: rotation,
254
251
  });
255
252
  // Native reports configured ordering only when live routing chose the rotation.
256
- if (routed !== undefined) spec.factoryDroidRoutingSource = "configured_order";
253
+ if (configured) spec.factoryDroidRoutingSource = "configured_order";
257
254
  return [spec];
258
255
  });
259
256
  return withAvailableRefusalFallbacks(models);
@@ -261,18 +258,32 @@ export async function fetchFactoryDroidModels(
261
258
 
262
259
  /**
263
260
  * Intersect live rotations with registry eligibility and explicit blocks.
264
- * An explicitly configured empty/disallowed rotation never widens to defaults.
261
+ * An explicitly configured empty/disallowed model rotation never widens.
262
+ * Without a model route, a family default that leaves no eligible upstream
263
+ * (empty, naming none of the model's upstreams, or none serving the account's
264
+ * region) falls back to the registry rotation: droid 1.1.0 then sends the
265
+ * first eligible registry upstream, which is the upstream omp pins. Live
266
+ * routing did not choose it, so it is not reported as configured order.
265
267
  */
266
268
  function resolveRotation(
267
269
  model: FactoryDroidRegistryModel,
268
- routed: readonly string[] | undefined,
270
+ routing: FactoryProviderRouting | null,
269
271
  region: string | undefined,
270
- blocked: readonly string[] = [],
271
- ): readonly string[] {
272
+ ): { rotation: readonly string[]; configured: boolean } {
273
+ const { id } = model.spec;
274
+ const blocked = routing?.blockedProviders?.[id] ?? [];
272
275
  const eligible = resolveFactoryDroidRotation(model.policy, region).filter(provider => !blocked.includes(provider));
273
- return routed === undefined
274
- ? eligible
275
- : routed.filter(provider => eligible.some(candidate => candidate === provider));
276
+ const modelRoute = routing?.models?.[id];
277
+ if (modelRoute !== undefined) {
278
+ return { rotation: modelRoute.filter(provider => eligible.includes(provider)), configured: true };
279
+ }
280
+ const family = model.policy.routingFamily;
281
+ const familyRoute = ((family === undefined ? undefined : routing?.defaults?.[family]) ?? []).filter(provider =>
282
+ eligible.includes(provider),
283
+ );
284
+ return familyRoute.length > 0
285
+ ? { rotation: familyRoute, configured: true }
286
+ : { rotation: eligible, configured: false };
276
287
  }
277
288
 
278
289
  /** Account scope plus the upstream rotation resolved for that account. */
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import type { FetchImpl } from "@linxiraos/pi-utils";
3
3
  import { collapseVariants, type VariantCollapseTable } from "../compat/collapse";
4
4
  import { compareRevision, parseRevision } from "../compat/revision";
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import { getBundledModels } from "../models";
3
3
  import { toModelSpec } from "../provider-models/bundled-references";
4
4
  import type { FetchImpl, Model, ModelSpec } from "../types";
@@ -1,6 +1,6 @@
1
1
  import * as fs from "node:fs/promises";
2
2
  import * as path from "node:path";
3
- import { type } from "@linxiraos/pi-omptype";
3
+ import { type } from "@linxiraos/zeta-schema";
4
4
  import { seedModels } from "../compat/providers";
5
5
  import type { FetchImpl, ModelSpec } from "../types";
6
6
  import { discoveryFetch, isRecord } from "../utils";
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import type { Api, FetchImpl, ModelSpec, Provider } from "../types";
3
3
  import { discoveryFetch } from "../utils";
4
4
 
@@ -4,7 +4,7 @@
4
4
  */
5
5
  import type { Database } from "bun:sqlite";
6
6
  import * as path from "node:path";
7
- import { type } from "@linxiraos/pi-omptype";
7
+ import { type } from "@linxiraos/zeta-schema";
8
8
  import { getModelDbPath, isSqliteCorruptionError, logger, openSqliteDatabaseSync, VERSION } from "@linxiraos/pi-utils";
9
9
  import RULES from "./compat/rules.json" with { type: "json" };
10
10
  import type { Api, Model } from "./types";
@@ -110,6 +110,8 @@ export interface ModelResolutionResult<TApi extends Api = Api> {
110
110
  stale: boolean;
111
111
  source: ModelResolutionSource;
112
112
  updatedAt?: number;
113
+ /** Why the provider's endpoint fetcher threw this call; the models then come from cache, models.dev or bundled data. */
114
+ fetchError?: string;
113
115
  }
114
116
  /**
115
117
  * Stateful facade over provider model resolution.
@@ -1,4 +1,4 @@
1
- import { type } from "@linxiraos/pi-omptype";
1
+ import { type } from "@linxiraos/zeta-schema";
2
2
  import { logger, VERSION } from "@linxiraos/pi-utils";
3
3
  import { buildModel } from "./build";
4
4
  import { collapseBuiltVariants } from "./compat/collapse";
@@ -127,6 +127,8 @@ export interface ModelResolutionResult<TApi extends Api = Api> {
127
127
  stale: boolean;
128
128
  source: ModelResolutionSource;
129
129
  updatedAt?: number;
130
+ /** Why the provider's endpoint fetcher threw this call; the models then come from cache, models.dev or bundled data. */
131
+ fetchError?: string;
130
132
  }
131
133
 
132
134
  /**
@@ -337,9 +339,10 @@ export async function resolveProviderModels<TApi extends Api = Api, TModelsDevPa
337
339
  };
338
340
  }
339
341
 
340
- const [fetchedModelsDevModels, fetchedDynamicModels] = shouldFetchFromNetwork
341
- ? await Promise.all([fetchModelsDev(options), dynamicFetcher ? fetchDynamicModels(dynamicFetcher) : null])
342
- : [null, null];
342
+ const [fetchedModelsDevModels, dynamicFetch] = shouldFetchFromNetwork
343
+ ? await Promise.all([fetchModelsDev(options), dynamicFetcher ? fetchDynamicModels(dynamicFetcher) : undefined])
344
+ : [null, undefined];
345
+ const fetchedDynamicModels = dynamicFetch?.models ?? null;
343
346
  const modelsDevFetchSucceeded = fetchedModelsDevModels !== null;
344
347
  const normalizedModelsDevModels = fetchedModelsDevModels?.models ?? [];
345
348
  const modelsDevModels = modelsDevAdditiveStaticModelIds
@@ -429,7 +432,10 @@ export async function resolveProviderModels<TApi extends Api = Api, TModelsDevPa
429
432
  // non-authoritative row reads back as a fresh catalog and suppresses
430
433
  // refetch for NON_AUTHORITATIVE_RETRY_MS, hiding every discovery-only
431
434
  // model until it ages out. Writing nothing lets the next launch retry
432
- // immediately (#10964).
435
+ // immediately (#10964). Likewise keep a prior row whose header-bearing
436
+ // models cannot be restored offline: rewriting it would drop them and
437
+ // mark the remainder fresh, while the untouched row keeps forcing a
438
+ // refetch that recovers them (#18227).
433
439
  const latestCache = readModelCache<TApi>(cacheProviderId, ttlMs, now, dbPath);
434
440
  const latestRestoredCache = restoreCachedModelHeaders(
435
441
  latestCache?.models ?? cache?.models ?? [],
@@ -465,7 +471,10 @@ export async function resolveProviderModels<TApi extends Api = Api, TModelsDevPa
465
471
  ? retainModelIds(mergedFallbackModels, latestUsableCacheModels)
466
472
  : mergedFallbackModels,
467
473
  );
468
- if (fallbackSnapshotModels.length > 0 || latestCache !== null || cache !== null) {
474
+ if (
475
+ latestRestoredCache.unresolvedModelIds.size === 0 &&
476
+ (fallbackSnapshotModels.length > 0 || latestCache !== null || cache !== null)
477
+ ) {
469
478
  writeModelCache(
470
479
  cacheProviderId,
471
480
  now(),
@@ -496,6 +505,7 @@ export async function resolveProviderModels<TApi extends Api = Api, TModelsDevPa
496
505
  : cacheContributed && cache
497
506
  ? { updatedAt: cache.updatedAt }
498
507
  : {}),
508
+ ...(dynamicFetch?.error !== undefined ? { fetchError: dynamicFetch.error } : {}),
499
509
  };
500
510
  }
501
511
 
@@ -520,17 +530,15 @@ async function fetchModelsDev<TApi extends Api, TModelsDevPayload>(
520
530
  }
521
531
  }
522
532
 
533
+ /** The endpoint's catalog (`models: null` when it answered none), and why it threw, if it did. */
523
534
  async function fetchDynamicModels<TApi extends Api>(
524
535
  fetcher: () => Promise<readonly ModelSpec<TApi>[] | null>,
525
- ): Promise<DiscoveredModelSet<TApi> | null> {
536
+ ): Promise<{ models: DiscoveredModelSet<TApi> | null; error?: string }> {
526
537
  try {
527
538
  const models = await fetcher();
528
- if (models === null) {
529
- return null;
530
- }
531
- return buildDiscoveredModelSpecs<TApi>(models);
532
- } catch {
533
- return null;
539
+ return { models: models === null ? null : buildDiscoveredModelSpecs<TApi>(models) };
540
+ } catch (error) {
541
+ return { models: null, error: error instanceof Error ? error.message : String(error) };
534
542
  }
535
543
  }
536
544
 
@@ -848,7 +856,8 @@ const ModelSpecShape = type({
848
856
  name: "string > 0",
849
857
  api: "string > 0",
850
858
  provider: "string > 0",
851
- baseUrl: "string > 0",
859
+ // Providers such as Azure resolve the deployment endpoint at request time.
860
+ baseUrl: "string",
852
861
  reasoning: "boolean",
853
862
  input: "('text' | 'image')[] > 0",
854
863
  cost: FiniteTokenCost.and({