@theokit/sdk 4.13.0 → 4.13.1
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 +6 -0
- package/dist/cron.cjs +49 -12
- package/dist/cron.cjs.map +1 -1
- package/dist/cron.js +49 -12
- package/dist/cron.js.map +1 -1
- package/dist/eval.cjs +49 -12
- package/dist/eval.cjs.map +1 -1
- package/dist/eval.js +49 -12
- package/dist/eval.js.map +1 -1
- package/dist/index.cjs +49 -12
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +49 -12
- package/dist/index.js.map +1 -1
- package/dist/models.cjs +639 -17
- package/dist/models.cjs.map +1 -1
- package/dist/models.js +640 -18
- package/dist/models.js.map +1 -1
- package/dist/provider-catalog.json +6 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -13121,8 +13121,17 @@ var catalogModelSchema = zod.z.object({
|
|
|
13121
13121
|
}).loose();
|
|
13122
13122
|
|
|
13123
13123
|
// src/internal/providers/registry.ts
|
|
13124
|
-
|
|
13125
|
-
|
|
13124
|
+
function globalSingleton(key2, create) {
|
|
13125
|
+
const g = globalThis;
|
|
13126
|
+
const sym = Symbol.for(key2);
|
|
13127
|
+
if (g[sym] === void 0) g[sym] = create();
|
|
13128
|
+
return g[sym];
|
|
13129
|
+
}
|
|
13130
|
+
var REGISTRY = globalSingleton(
|
|
13131
|
+
"theokit-sdk.providers.registry",
|
|
13132
|
+
() => /* @__PURE__ */ new Map()
|
|
13133
|
+
);
|
|
13134
|
+
var ALIASES = globalSingleton("theokit-sdk.providers.aliases", () => /* @__PURE__ */ new Map());
|
|
13126
13135
|
function registerProvider(profile) {
|
|
13127
13136
|
if (REGISTRY.has(profile.name)) {
|
|
13128
13137
|
process.stderr.write(`[theokit-sdk] Provider "${profile.name}" overridden by user plugin.
|
|
@@ -13150,18 +13159,43 @@ function listProviders() {
|
|
|
13150
13159
|
|
|
13151
13160
|
// src/internal/providers/catalog-loader.ts
|
|
13152
13161
|
var __dirname_resolved = path.dirname(url.fileURLToPath((typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('index.cjs', document.baseURI).href))));
|
|
13153
|
-
|
|
13162
|
+
function globalSingleton2(key2, create) {
|
|
13163
|
+
const g = globalThis;
|
|
13164
|
+
const sym = Symbol.for(key2);
|
|
13165
|
+
if (g[sym] === void 0) g[sym] = create();
|
|
13166
|
+
return g[sym];
|
|
13167
|
+
}
|
|
13168
|
+
var modelInfoIndex = globalSingleton2(
|
|
13169
|
+
"theokit-sdk.providers.model-info-index",
|
|
13170
|
+
() => /* @__PURE__ */ new Map()
|
|
13171
|
+
);
|
|
13172
|
+
var patchedModelKeys = globalSingleton2(
|
|
13173
|
+
"theokit-sdk.providers.model-info-patched",
|
|
13174
|
+
() => /* @__PURE__ */ new Set()
|
|
13175
|
+
);
|
|
13176
|
+
var indexState = globalSingleton2("theokit-sdk.providers.model-info-loaded", () => ({
|
|
13177
|
+
loaded: false
|
|
13178
|
+
}));
|
|
13154
13179
|
function getCatalogModelInfo(key2) {
|
|
13155
13180
|
ensureModelIndexLoaded();
|
|
13156
13181
|
return modelInfoIndex.get(key2);
|
|
13157
13182
|
}
|
|
13158
|
-
|
|
13183
|
+
function isPatchedModelKey(key2) {
|
|
13184
|
+
return patchedModelKeys.has(key2);
|
|
13185
|
+
}
|
|
13159
13186
|
function ensureModelIndexLoaded() {
|
|
13160
|
-
if (
|
|
13161
|
-
|
|
13162
|
-
|
|
13163
|
-
|
|
13164
|
-
|
|
13187
|
+
if (indexState.loaded) return;
|
|
13188
|
+
indexState.loaded = true;
|
|
13189
|
+
try {
|
|
13190
|
+
const catalog = loadProviderCatalog();
|
|
13191
|
+
for (const entry of Object.values(catalog)) {
|
|
13192
|
+
indexEntryModels(entry);
|
|
13193
|
+
}
|
|
13194
|
+
} catch (err) {
|
|
13195
|
+
process.stderr.write(
|
|
13196
|
+
`[theokit-sdk] WARN: provider catalog unavailable (${err.message}) \u2014 per-model data disabled
|
|
13197
|
+
`
|
|
13198
|
+
);
|
|
13165
13199
|
}
|
|
13166
13200
|
}
|
|
13167
13201
|
function indexEntryModels(entry) {
|
|
@@ -13425,8 +13459,10 @@ function getPricingEntry(opts) {
|
|
|
13425
13459
|
return void 0;
|
|
13426
13460
|
}
|
|
13427
13461
|
function catalogCostFallback(provider, cleanedModel) {
|
|
13428
|
-
const
|
|
13429
|
-
|
|
13462
|
+
const stripped = stripDateSuffix(cleanedModel);
|
|
13463
|
+
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
13464
|
+
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
13465
|
+
for (const key2 of candidates) {
|
|
13430
13466
|
const info = getCatalogModelInfo(key2);
|
|
13431
13467
|
const cost = info?.cost;
|
|
13432
13468
|
if (cost === void 0) continue;
|
|
@@ -13438,7 +13474,8 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
13438
13474
|
outputCostPerMillion: cost.output,
|
|
13439
13475
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
13440
13476
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
13441
|
-
|
|
13477
|
+
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
13478
|
+
pricingVersion: isPatchedModelKey(key2) ? "catalog-models-dev" : "catalog-vendored"
|
|
13442
13479
|
};
|
|
13443
13480
|
}
|
|
13444
13481
|
return void 0;
|