@oh-my-pi/pi-catalog 18.2.8 → 18.2.9
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 +16 -0
- package/dist/types/compat/auth-ids.d.ts +2 -2
- package/dist/types/compat/axes.d.ts +2 -2
- package/dist/types/compat/catalog-policy.d.ts +7 -0
- package/dist/types/compat/output-limits.d.ts +3 -0
- package/dist/types/compat/provider-ids.d.ts +1 -1
- package/dist/types/compat/tools.d.ts +5 -0
- package/dist/types/provider-models/openai-compat.d.ts +26 -0
- package/dist/types/wire/singularityapi.d.ts +29 -0
- package/package.json +4 -4
- package/src/compat/auth-ids.ts +4 -0
- package/src/compat/axes.ts +21 -2
- package/src/compat/catalog-policy.ts +28 -0
- package/src/compat/output-limits.ts +12 -0
- package/src/compat/provider-ids.ts +2 -0
- package/src/compat/resolve.ts +4 -2
- package/src/compat/rules/README.md +10 -10
- package/src/compat/rules/auth/_order.kdl +1 -1
- package/src/compat/rules/auth/singularityapi-dev.kdl +22 -0
- package/src/compat/rules/auth/singularityapi-tech.kdl +23 -0
- package/src/compat/rules/classes/gpt-oss.kdl +3 -0
- package/src/compat/rules/classes/xai.kdl +3 -3
- package/src/compat/rules/providers/amazon-bedrock.kdl +1 -1
- package/src/compat/rules/providers/anthropic.kdl +1 -1
- package/src/compat/rules/providers/cloudflare-ai-gateway.kdl +1 -1
- package/src/compat/rules/providers/commandcode.kdl +1 -1
- package/src/compat/rules/providers/cursor.kdl +1 -1
- package/src/compat/rules/providers/google-antigravity.kdl +5 -0
- package/src/compat/rules/providers/kilo.kdl +1 -1
- package/src/compat/rules/providers/litellm.kdl +1 -1
- package/src/compat/rules/providers/native-tools.kdl +4 -0
- package/src/compat/rules/providers/opencode-zen.kdl +1 -1
- package/src/compat/rules/providers/output-limits.kdl +4 -0
- package/src/compat/rules/providers/singularityapi-dev.kdl +92 -0
- package/src/compat/rules/providers/singularityapi-tech.kdl +72 -0
- package/src/compat/rules/providers/tool-free-history.kdl +6 -0
- package/src/compat/rules/providers/vercel-ai-gateway.kdl +1 -1
- package/src/compat/rules/providers/xai-oauth.kdl +8 -1
- package/src/compat/rules/providers/xai.kdl +4 -4
- package/src/compat/rules/providers/xiaomi-token-plan-cn.kdl +23 -0
- package/src/compat/rules/providers/zenmux.kdl +1 -1
- package/src/compat/rules/runtime/behavior.kdl +2 -0
- package/src/compat/rules.json +1 -12526
- package/src/compat/tools.ts +12 -0
- package/src/discovery/devin.ts +59 -36
- package/src/models.json +1 -1
- package/src/provider-models/cache-provider-id.ts +31 -0
- package/src/provider-models/descriptors.ts +4 -0
- package/src/provider-models/openai-compat.ts +159 -0
- package/src/wire/singularityapi.ts +34 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { Model } from "../types";
|
|
2
|
+
import { resolveCatalogPolicy } from "./catalog-policy";
|
|
3
|
+
|
|
4
|
+
/** Whether the transport exposes native tools that an empty caller catalog cannot disable. */
|
|
5
|
+
export function requiresNativeTools(model: Model): boolean {
|
|
6
|
+
return resolveCatalogPolicy(model).requiresNativeTools === true;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/** Whether disabling tools requires a history without prior tool calls or results. */
|
|
10
|
+
export function requiresToolFreeHistoryForToolOptOut(model: Model): boolean {
|
|
11
|
+
return resolveCatalogPolicy(model).requiresToolFreeHistoryForToolOptOut === true;
|
|
12
|
+
}
|
package/src/discovery/devin.ts
CHANGED
|
@@ -10,6 +10,7 @@ import {
|
|
|
10
10
|
DisplayOption,
|
|
11
11
|
GetCliModelConfigsRequestSchema,
|
|
12
12
|
GetCliModelConfigsResponseSchema,
|
|
13
|
+
type Metadata,
|
|
13
14
|
MetadataSchema,
|
|
14
15
|
ModelDimensionKind,
|
|
15
16
|
} from "./devin-proto";
|
|
@@ -323,54 +324,76 @@ export async function fetchDevinModels(
|
|
|
323
324
|
const controller = new AbortController();
|
|
324
325
|
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
325
326
|
const signal = options.signal ? AbortSignal.any([controller.signal, options.signal]) : controller.signal;
|
|
327
|
+
const fetchImpl = discoveryFetch(options.fetch);
|
|
326
328
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
329
|
+
const fetchCatalog = async (metadata: Metadata): Promise<ModelSpec<"devin-agent">[] | null> => {
|
|
330
|
+
try {
|
|
331
|
+
const request = create(GetCliModelConfigsRequestSchema, { metadata });
|
|
332
|
+
// `toBinary` always allocates a fresh ArrayBuffer-backed view; the DOM
|
|
333
|
+
// `BodyInit` typing just cannot see that through its ArrayBufferLike signature.
|
|
334
|
+
const body = toBinary(GetCliModelConfigsRequestSchema, request) as Uint8Array<ArrayBuffer>;
|
|
335
|
+
const response = await fetchImpl(requestUrl, {
|
|
336
|
+
method: "POST",
|
|
337
|
+
headers: {
|
|
338
|
+
"content-type": "application/proto",
|
|
339
|
+
"connect-protocol-version": "1",
|
|
340
|
+
accept: "*/*",
|
|
341
|
+
},
|
|
342
|
+
body,
|
|
343
|
+
signal,
|
|
344
|
+
});
|
|
345
|
+
if (!response.ok) return null;
|
|
343
346
|
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
+
const decoded = decodeDevinUnaryMessage(
|
|
348
|
+
GetCliModelConfigsResponseSchema,
|
|
349
|
+
new Uint8Array(await response.arrayBuffer()),
|
|
350
|
+
);
|
|
351
|
+
return decoded ? normalizeDevinModels(decoded.clientModelConfigs, options.baseUrl) : null;
|
|
352
|
+
} catch {
|
|
347
353
|
return null;
|
|
348
354
|
}
|
|
355
|
+
};
|
|
349
356
|
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
357
|
+
try {
|
|
358
|
+
const nativeMetadata = create(MetadataSchema, {
|
|
359
|
+
...devinDiscoveryMetadata(options.apiKey),
|
|
360
|
+
supportedModelDisplays: [...DEVIN_SUPPORTED_MODEL_DISPLAYS],
|
|
361
|
+
});
|
|
362
|
+
const nativeModels = await fetchCatalog(nativeMetadata);
|
|
363
|
+
const nativeIsSeedOnly =
|
|
364
|
+
nativeModels !== null &&
|
|
365
|
+
nativeModels.length > 0 &&
|
|
366
|
+
nativeModels.every(model => model.id === "swe-1-6" || model.id === "swe-1-6-fast");
|
|
367
|
+
if (nativeModels !== null && nativeModels.length > 0 && !nativeIsSeedOnly) {
|
|
368
|
+
return nativeModels;
|
|
356
369
|
}
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
370
|
+
|
|
371
|
+
// Legacy Windsurf Enterprise seats expose their full credential-scoped
|
|
372
|
+
// roster only to the editor identity and raw windsurf_api_key. Native
|
|
373
|
+
// chisel discovery returns the two-row fallback seed for those seats.
|
|
374
|
+
const legacyMetadata = create(MetadataSchema, {
|
|
375
|
+
apiKey: options.apiKey ?? "",
|
|
376
|
+
ideName: "windsurf",
|
|
377
|
+
ideVersion: "3.2.23",
|
|
378
|
+
extensionName: "windsurf",
|
|
379
|
+
extensionVersion: "1.48.2",
|
|
380
|
+
locale: "en",
|
|
381
|
+
});
|
|
382
|
+
const legacyModels = await fetchCatalog(legacyMetadata);
|
|
383
|
+
const models =
|
|
384
|
+
legacyModels !== null && (nativeModels === null || legacyModels.length > nativeModels.length)
|
|
385
|
+
? legacyModels
|
|
386
|
+
: nativeModels;
|
|
387
|
+
if (models === null || models.length === 0) {
|
|
388
|
+
// The backend gates the native catalog on the pinned client identity;
|
|
389
|
+
// an empty-but-200 response is the failure signature of a stale pin.
|
|
390
|
+
logger.warn("Devin returned an empty model catalog; the pinned client identities may be stale", {
|
|
366
391
|
metadata: devinDiscoveryMetadata(undefined),
|
|
367
392
|
});
|
|
368
393
|
return null;
|
|
369
394
|
}
|
|
370
395
|
|
|
371
396
|
return models;
|
|
372
|
-
} catch {
|
|
373
|
-
return null;
|
|
374
397
|
} finally {
|
|
375
398
|
clearTimeout(timer);
|
|
376
399
|
}
|