@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/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 4.13.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- M44 adversarial-review fixes for the model catalog: (B1) the provider registry + model-info index now live on `globalThis` via `Symbol.for` so every bundle copy (`dist/index.js`, `dist/models.js` — tsup bundles entries separately) shares the SAME state — previously `refreshModelCatalog` from `@theokit/sdk/models` patched a bundle-local index invisible to capability/pricing lookups and saw an empty registry (a published-artifact-only defect the src-level tests could not catch); (H2) a live models-dev patch is now a per-field MERGE that preserves theokit extension fields (`cache_control`, overlay `structured_output`) instead of a wholesale replace that wiped them; (H3) the runtime refresh gained the models.dev↔theokit id mapping (google↔google-gemini, zai↔zhipu, togetherai↔together, fireworks-ai↔fireworks, amazon-bedrock↔bedrock, google-vertex↔vertex) resolving against catalog entries (id + aliases) with a WARN for skipped unknowns — Google/Z.AI/Together/Fireworks now actually refresh; (M4) `refreshModelCatalog` self-initializes provider registration so the `/models` subpath works standalone; (M5) pricing provenance is honest post-refresh (`catalog-models-dev` vs `catalog-vendored`); (M6) the anthropic builtin defaults (opus-4-7 / sonnet-4-6 / haiku-4-5) now carry `cache_control: true` in the vendored catalog; (L8) the models-dev cache honors `THEOKIT_HOME`; (L9) a missing/corrupt vendored catalog degrades with WARN instead of throwing from `resolveModelCapabilities`, cache patch errors never delete a valid cache, and refresh never rejects; (L10) the pricing step-5 fallback also tries the date-stripped id; (L11) falsy `THEOKIT_DISABLE_MODELS_FETCH` values (`0`/`false`/empty) no longer disable the fetch.
|
|
8
|
+
|
|
3
9
|
## 4.13.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/dist/cron.cjs
CHANGED
|
@@ -10539,8 +10539,17 @@ var catalogModelSchema = zod.z.object({
|
|
|
10539
10539
|
}).loose();
|
|
10540
10540
|
|
|
10541
10541
|
// src/internal/providers/registry.ts
|
|
10542
|
-
|
|
10543
|
-
|
|
10542
|
+
function globalSingleton(key, create) {
|
|
10543
|
+
const g = globalThis;
|
|
10544
|
+
const sym = Symbol.for(key);
|
|
10545
|
+
if (g[sym] === void 0) g[sym] = create();
|
|
10546
|
+
return g[sym];
|
|
10547
|
+
}
|
|
10548
|
+
var REGISTRY = globalSingleton(
|
|
10549
|
+
"theokit-sdk.providers.registry",
|
|
10550
|
+
() => /* @__PURE__ */ new Map()
|
|
10551
|
+
);
|
|
10552
|
+
var ALIASES = globalSingleton("theokit-sdk.providers.aliases", () => /* @__PURE__ */ new Map());
|
|
10544
10553
|
function registerProvider(profile) {
|
|
10545
10554
|
if (REGISTRY.has(profile.name)) {
|
|
10546
10555
|
process.stderr.write(`[theokit-sdk] Provider "${profile.name}" overridden by user plugin.
|
|
@@ -10565,18 +10574,43 @@ function getProviderProfile(name) {
|
|
|
10565
10574
|
|
|
10566
10575
|
// src/internal/providers/catalog-loader.ts
|
|
10567
10576
|
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('cron.cjs', document.baseURI).href))));
|
|
10568
|
-
|
|
10577
|
+
function globalSingleton2(key, create) {
|
|
10578
|
+
const g = globalThis;
|
|
10579
|
+
const sym = Symbol.for(key);
|
|
10580
|
+
if (g[sym] === void 0) g[sym] = create();
|
|
10581
|
+
return g[sym];
|
|
10582
|
+
}
|
|
10583
|
+
var modelInfoIndex = globalSingleton2(
|
|
10584
|
+
"theokit-sdk.providers.model-info-index",
|
|
10585
|
+
() => /* @__PURE__ */ new Map()
|
|
10586
|
+
);
|
|
10587
|
+
var patchedModelKeys = globalSingleton2(
|
|
10588
|
+
"theokit-sdk.providers.model-info-patched",
|
|
10589
|
+
() => /* @__PURE__ */ new Set()
|
|
10590
|
+
);
|
|
10591
|
+
var indexState = globalSingleton2("theokit-sdk.providers.model-info-loaded", () => ({
|
|
10592
|
+
loaded: false
|
|
10593
|
+
}));
|
|
10569
10594
|
function getCatalogModelInfo(key) {
|
|
10570
10595
|
ensureModelIndexLoaded();
|
|
10571
10596
|
return modelInfoIndex.get(key);
|
|
10572
10597
|
}
|
|
10573
|
-
|
|
10598
|
+
function isPatchedModelKey(key) {
|
|
10599
|
+
return patchedModelKeys.has(key);
|
|
10600
|
+
}
|
|
10574
10601
|
function ensureModelIndexLoaded() {
|
|
10575
|
-
if (
|
|
10576
|
-
|
|
10577
|
-
|
|
10578
|
-
|
|
10579
|
-
|
|
10602
|
+
if (indexState.loaded) return;
|
|
10603
|
+
indexState.loaded = true;
|
|
10604
|
+
try {
|
|
10605
|
+
const catalog = loadProviderCatalog();
|
|
10606
|
+
for (const entry of Object.values(catalog)) {
|
|
10607
|
+
indexEntryModels(entry);
|
|
10608
|
+
}
|
|
10609
|
+
} catch (err) {
|
|
10610
|
+
process.stderr.write(
|
|
10611
|
+
`[theokit-sdk] WARN: provider catalog unavailable (${err.message}) \u2014 per-model data disabled
|
|
10612
|
+
`
|
|
10613
|
+
);
|
|
10580
10614
|
}
|
|
10581
10615
|
}
|
|
10582
10616
|
function indexEntryModels(entry) {
|
|
@@ -10829,8 +10863,10 @@ function getPricingEntry(opts) {
|
|
|
10829
10863
|
return void 0;
|
|
10830
10864
|
}
|
|
10831
10865
|
function catalogCostFallback(provider, cleanedModel) {
|
|
10832
|
-
const
|
|
10833
|
-
|
|
10866
|
+
const stripped = stripDateSuffix(cleanedModel);
|
|
10867
|
+
const candidates = [`${provider}/${cleanedModel}`, cleanedModel];
|
|
10868
|
+
if (stripped !== cleanedModel) candidates.push(`${provider}/${stripped}`, stripped);
|
|
10869
|
+
for (const key of candidates) {
|
|
10834
10870
|
const info = getCatalogModelInfo(key);
|
|
10835
10871
|
const cost = info?.cost;
|
|
10836
10872
|
if (cost === void 0) continue;
|
|
@@ -10842,7 +10878,8 @@ function catalogCostFallback(provider, cleanedModel) {
|
|
|
10842
10878
|
outputCostPerMillion: cost.output,
|
|
10843
10879
|
...cost.cache_read !== void 0 ? { cacheReadCostPerMillion: cost.cache_read } : {},
|
|
10844
10880
|
...cost.cache_write !== void 0 ? { cacheWriteCostPerMillion: cost.cache_write } : {},
|
|
10845
|
-
|
|
10881
|
+
// M44 M5 fix — honest provenance: a key patched by the LIVE models-dev source is not "vendored".
|
|
10882
|
+
pricingVersion: isPatchedModelKey(key) ? "catalog-models-dev" : "catalog-vendored"
|
|
10846
10883
|
};
|
|
10847
10884
|
}
|
|
10848
10885
|
return void 0;
|