@vedmalex/ai-connect 0.6.0 → 0.7.0
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/README.md +3 -1
- package/dist/browser/index.js +5 -2
- package/dist/browser/index.js.map +2 -2
- package/dist/bun/index.js +23 -7
- package/dist/bun/index.js.map +2 -2
- package/dist/bun/local.js +23 -7
- package/dist/bun/local.js.map +2 -2
- package/dist/node/index.js +23 -7
- package/dist/node/index.js.map +2 -2
- package/dist/node/local.js +23 -7
- package/dist/node/local.js.map +2 -2
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/default-handlers.d.ts.map +1 -1
- package/dist/types/model-reference.d.ts.map +1 -1
- package/dist/types/types.d.ts +20 -0
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/node/local.js
CHANGED
|
@@ -1975,6 +1975,8 @@ function fillConfiguredContextLength(route, models) {
|
|
|
1975
1975
|
return {
|
|
1976
1976
|
...entry,
|
|
1977
1977
|
contextLength: configured,
|
|
1978
|
+
// FT-002: typed provenance (canonical) + metadata alias (back-compat).
|
|
1979
|
+
contextWindowSource: "configured",
|
|
1978
1980
|
metadata: { ...entry.metadata ?? {}, contextWindowSource: "configured" }
|
|
1979
1981
|
};
|
|
1980
1982
|
});
|
|
@@ -3304,7 +3306,8 @@ function createClient(configOrInput, options = {}) {
|
|
|
3304
3306
|
...catalog.canonicalModelId ? { canonicalModelId: catalog.canonicalModelId } : {},
|
|
3305
3307
|
...catalog.resolvedModelId ? { resolvedModelId: catalog.resolvedModelId } : {},
|
|
3306
3308
|
...catalog.currentModelId ? { currentModelId: catalog.currentModelId } : {},
|
|
3307
|
-
availableModels: catalog.availableModels
|
|
3309
|
+
availableModels: catalog.availableModels,
|
|
3310
|
+
...catalog.warnings?.length ? { warnings: catalog.warnings } : {}
|
|
3308
3311
|
});
|
|
3309
3312
|
wideAttempts.push({
|
|
3310
3313
|
index: wideAttempts.length + 1,
|
|
@@ -4989,7 +4992,7 @@ function parseOpenAiModelCatalog(route, payload) {
|
|
|
4989
4992
|
modelId: entry.id,
|
|
4990
4993
|
name: typeof entry.display_name === "string" ? entry.display_name : typeof entry.name === "string" ? entry.name : entry.id,
|
|
4991
4994
|
...typeof entry.description === "string" ? { description: entry.description } : {},
|
|
4992
|
-
...contextLength !== void 0 ? { contextLength } : {},
|
|
4995
|
+
...contextLength !== void 0 ? { contextLength, contextWindowSource: "discovered" } : {},
|
|
4993
4996
|
...pricing ? { pricing } : {},
|
|
4994
4997
|
...free ? { free } : {},
|
|
4995
4998
|
...metadata ? {
|
|
@@ -8765,16 +8768,20 @@ function buildCliDiscoveryInvocation(route, command, options) {
|
|
|
8765
8768
|
parameterKeys
|
|
8766
8769
|
};
|
|
8767
8770
|
}
|
|
8768
|
-
function buildStaticCliCatalog(route) {
|
|
8771
|
+
function buildStaticCliCatalog(route, warning) {
|
|
8769
8772
|
const models = route.advertisedModels.map((id) => ({
|
|
8770
8773
|
modelId: id,
|
|
8771
8774
|
name: id
|
|
8772
8775
|
}));
|
|
8773
|
-
|
|
8776
|
+
const catalog = buildModelCatalog(
|
|
8774
8777
|
route,
|
|
8775
8778
|
models,
|
|
8776
8779
|
currentModelIdForRoute(route, route.advertisedModels)
|
|
8777
8780
|
);
|
|
8781
|
+
if (warning) {
|
|
8782
|
+
catalog.warnings = [...catalog.warnings ?? [], warning];
|
|
8783
|
+
}
|
|
8784
|
+
return catalog;
|
|
8778
8785
|
}
|
|
8779
8786
|
function statsToUsage(stats) {
|
|
8780
8787
|
if (!stats || typeof stats !== "object") {
|
|
@@ -8917,7 +8924,9 @@ function modelInfoFromRecord(record, selector) {
|
|
|
8917
8924
|
modelId,
|
|
8918
8925
|
name,
|
|
8919
8926
|
...description ? { description } : {},
|
|
8920
|
-
|
|
8927
|
+
// FT-002: a contextLength read from the list-command output is a discovered
|
|
8928
|
+
// value (consistent with the API parsers), so tag its provenance.
|
|
8929
|
+
...contextLength !== void 0 ? { contextLength, contextWindowSource: "discovered" } : {}
|
|
8921
8930
|
};
|
|
8922
8931
|
}
|
|
8923
8932
|
function parseCliModelList(stdout, parser, selector) {
|
|
@@ -9188,13 +9197,20 @@ function createCliTransportManager(options) {
|
|
|
9188
9197
|
throw error;
|
|
9189
9198
|
}
|
|
9190
9199
|
if (source.fallback === "static") {
|
|
9191
|
-
|
|
9200
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
9201
|
+
return buildStaticCliCatalog(
|
|
9202
|
+
context.route,
|
|
9203
|
+
`CLI discovery command for "${context.route.transport.id}" failed (${detail}); fell back to the static models[] catalog.`
|
|
9204
|
+
);
|
|
9192
9205
|
}
|
|
9193
9206
|
throw error;
|
|
9194
9207
|
}
|
|
9195
9208
|
if (models.length === 0) {
|
|
9196
9209
|
if (source.fallback === "static") {
|
|
9197
|
-
return buildStaticCliCatalog(
|
|
9210
|
+
return buildStaticCliCatalog(
|
|
9211
|
+
context.route,
|
|
9212
|
+
`CLI discovery command for "${context.route.transport.id}" returned no models; fell back to the static models[] catalog.`
|
|
9213
|
+
);
|
|
9198
9214
|
}
|
|
9199
9215
|
throw new AiConnectError(
|
|
9200
9216
|
"temporary_unavailable",
|