@oh-my-pi/pi-catalog 18.2.7 → 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 +26 -3
- package/README.md +18 -18
- 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/compat/types.d.ts +2 -2
- package/dist/types/provider-models/openai-compat.d.ts +26 -0
- package/dist/types/types.d.ts +5 -2
- package/dist/types/wire/singularityapi.d.ts +29 -0
- package/package.json +38 -38
- 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 +34 -33
- 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/openai.kdl +58 -0
- package/src/compat/rules/providers/opencode-zen.kdl +1 -1
- package/src/compat/rules/providers/openrouter.kdl +108 -0
- 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 -1
- package/src/compat/tools.ts +12 -0
- package/src/compat/types.ts +2 -2
- package/src/discovery/devin.ts +59 -34
- 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 +390 -119
- package/src/types.ts +19 -1
- 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/compat/types.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* `behavior.ts`, `resolve.ts`) exposes to consumers.
|
|
6
6
|
*/
|
|
7
7
|
import type { Effort } from "../effort";
|
|
8
|
-
import type { Api, ThinkingControlMode, TokenCost } from "../types";
|
|
8
|
+
import type { Api, KindApiKind, ThinkingControlMode, TokenCost } from "../types";
|
|
9
9
|
import type { RevisionOp } from "./revision";
|
|
10
10
|
|
|
11
11
|
/** Class-membership matcher kinds, most to least specific. */
|
|
@@ -648,7 +648,7 @@ export interface CompiledProvider {
|
|
|
648
648
|
/** Present only for providers enrolled in `generate-models.ts` discovery. */
|
|
649
649
|
discovery?: CompiledProviderDiscovery;
|
|
650
650
|
/** Non-chat model kinds mapped to their runtime transport APIs. */
|
|
651
|
-
kindApis?: Partial<Record<
|
|
651
|
+
kindApis?: Partial<Record<KindApiKind, Api>>;
|
|
652
652
|
/** Authored bundled rows, when the provider cannot be discovered at generation time. */
|
|
653
653
|
seed?: CompiledSeed;
|
|
654
654
|
}
|
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,52 +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
|
-
|
|
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;
|
|
341
346
|
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
347
|
+
const decoded = decodeDevinUnaryMessage(
|
|
348
|
+
GetCliModelConfigsResponseSchema,
|
|
349
|
+
new Uint8Array(await response.arrayBuffer()),
|
|
350
|
+
);
|
|
351
|
+
return decoded ? normalizeDevinModels(decoded.clientModelConfigs, options.baseUrl) : null;
|
|
352
|
+
} catch {
|
|
345
353
|
return null;
|
|
346
354
|
}
|
|
355
|
+
};
|
|
347
356
|
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
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;
|
|
354
369
|
}
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
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", {
|
|
364
391
|
metadata: devinDiscoveryMetadata(undefined),
|
|
365
392
|
});
|
|
366
393
|
return null;
|
|
367
394
|
}
|
|
368
395
|
|
|
369
396
|
return models;
|
|
370
|
-
} catch {
|
|
371
|
-
return null;
|
|
372
397
|
} finally {
|
|
373
398
|
clearTimeout(timer);
|
|
374
399
|
}
|