@linxiraos/pi-catalog 1.4.11 → 1.4.13
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 +12 -3
- package/THIRD-PARTY-NOTICES.txt +4 -5
- package/dist/types/compat/auth-ids.d.ts +2 -2
- package/dist/types/compat/responses-websocket.d.ts +6 -0
- package/dist/types/compat/types.d.ts +6 -0
- package/dist/types/discovery/devin-proto.d.ts +15 -0
- package/dist/types/model-manager.d.ts +2 -0
- package/dist/types/types.d.ts +17 -1
- package/dist/types/wire/codex.d.ts +0 -1
- package/dist/types/wire/factory-droid.d.ts +1 -1
- package/package.json +5 -5
- package/src/compat/auth-ids.ts +4 -0
- package/src/compat/axes.ts +6 -0
- package/src/compat/resolve.ts +2 -0
- package/src/compat/responses-websocket.ts +12 -0
- package/src/compat/rules/auth/_order.kdl +1 -1
- package/src/compat/rules/auth/devin-cli.kdl +6 -0
- package/src/compat/rules/auth/devin-windsurf.kdl +6 -0
- package/src/compat/rules/classes/anthropic.kdl +16 -0
- package/src/compat/rules/providers/factory-droid.kdl +56 -4
- package/src/compat/rules/providers/muse-code.kdl +16 -0
- package/src/compat/rules/providers/openai.kdl +3 -0
- package/src/compat/rules/providers/web.kdl +7 -0
- package/src/compat/rules/runtime/behavior.kdl +4 -4
- package/src/compat/rules.json +1 -1
- package/src/compat/types.d.ts +6 -0
- package/src/compat/types.ts +6 -0
- package/src/discovery/codex.ts +0 -1
- package/src/discovery/devin-proto.d.ts +15 -0
- package/src/discovery/devin-proto.ts +28 -0
- package/src/discovery/factory-droid.ts +23 -12
- package/src/model-manager.d.ts +2 -0
- package/src/model-manager.ts +22 -13
- package/src/models.json +1 -1
- package/src/provider-models/openai-compat.ts +38 -1
- package/src/types.d.ts +17 -1
- package/src/types.ts +17 -1
- package/src/wire/codex.d.ts +0 -1
- package/src/wire/codex.ts +0 -1
- package/src/wire/factory-droid.d.ts +1 -1
- package/src/wire/factory-droid.ts +1 -1
package/src/compat/types.d.ts
CHANGED
|
@@ -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
|
}
|
package/src/compat/types.ts
CHANGED
|
@@ -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
|
}
|
package/src/discovery/codex.ts
CHANGED
|
@@ -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");
|
|
@@ -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 {
|
|
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 (
|
|
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
|
|
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
|
-
|
|
270
|
+
routing: FactoryProviderRouting | null,
|
|
269
271
|
region: string | undefined,
|
|
270
|
-
|
|
271
|
-
|
|
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
|
-
|
|
274
|
-
|
|
275
|
-
:
|
|
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. */
|
package/src/model-manager.d.ts
CHANGED
|
@@ -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.
|
package/src/model-manager.ts
CHANGED
|
@@ -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,
|
|
341
|
-
? await Promise.all([fetchModelsDev(options), dynamicFetcher ? fetchDynamicModels(dynamicFetcher) :
|
|
342
|
-
: [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 (
|
|
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
|
-
|
|
529
|
-
|
|
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
|
-
|
|
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({
|