@agentproto/runtime 5.8.0 → 5.9.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/dist/catalog-models.mjs +38 -2
- package/dist/catalog-models.mjs.map +1 -1
- package/dist/config-schema.mjs +13 -0
- package/dist/config-schema.mjs.map +1 -1
- package/dist/config.mjs +13 -0
- package/dist/config.mjs.map +1 -1
- package/dist/index.d.ts +761 -60
- package/dist/index.mjs +1225 -217
- package/dist/index.mjs.map +1 -1
- package/dist/resume-strategies.d.ts +22 -1
- package/dist/resume-strategies.mjs +2 -1
- package/dist/resume-strategies.mjs.map +1 -1
- package/dist/session-presence.mjs +13 -0
- package/dist/session-presence.mjs.map +1 -1
- package/dist/{sessions-SrISpFsH.d.ts → sessions-Cse9PhLG.d.ts} +102 -6
- package/dist/user-presets.d.ts +1 -1
- package/package.json +9 -9
package/dist/catalog-models.mjs
CHANGED
|
@@ -27,6 +27,10 @@ var providers_store_exports = {};
|
|
|
27
27
|
__reExport(providers_store_exports, providers_store_star);
|
|
28
28
|
|
|
29
29
|
// src/spawn-defaults.ts
|
|
30
|
+
function modelIdPrefixProvider(modelId) {
|
|
31
|
+
const slash = modelId.indexOf("/");
|
|
32
|
+
return slash > 0 ? modelId.slice(0, slash) : void 0;
|
|
33
|
+
}
|
|
30
34
|
function subscriptionSurfaceFor(sub, endpoint) {
|
|
31
35
|
if (sub === void 0) return void 0;
|
|
32
36
|
if (!Array.isArray(sub)) {
|
|
@@ -34,6 +38,31 @@ function subscriptionSurfaceFor(sub, endpoint) {
|
|
|
34
38
|
}
|
|
35
39
|
return sub.find((s) => s.provider !== void 0 && s.provider === endpoint) ?? sub.find((s) => s.provider === void 0);
|
|
36
40
|
}
|
|
41
|
+
function directAuthMethods(descriptor, endpoint) {
|
|
42
|
+
const methods = [];
|
|
43
|
+
if (subscriptionSurfaceFor(descriptor?.authSubscription, endpoint) !== void 0) {
|
|
44
|
+
methods.push("oauth-bearer");
|
|
45
|
+
}
|
|
46
|
+
if (descriptor?.provider || descriptor?.modelDerivedApiKey) methods.push("api-key");
|
|
47
|
+
return methods;
|
|
48
|
+
}
|
|
49
|
+
function spawnEligibilityManifest(adapter, descriptor, route, model) {
|
|
50
|
+
const directEndpoint = descriptor?.provider ?? (model ? descriptor?.modelProviders?.[model] : void 0) ?? (model && descriptor?.modelDerivedApiKey ? modelIdPrefixProvider(model) : void 0) ?? (model ? getModelProvider(model) : void 0);
|
|
51
|
+
const routeId = route?.gateway ?? directEndpoint;
|
|
52
|
+
if (!routeId) return void 0;
|
|
53
|
+
const direct = directEndpoint !== void 0 && routeId === directEndpoint;
|
|
54
|
+
return {
|
|
55
|
+
manifest: {
|
|
56
|
+
id: adapter,
|
|
57
|
+
endpointByRoute: { [routeId]: direct ? directEndpoint : routeId },
|
|
58
|
+
methodsByRoute: {
|
|
59
|
+
[routeId]: direct ? directAuthMethods(descriptor, directEndpoint) : ["api-key"]
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
routeId,
|
|
63
|
+
direct
|
|
64
|
+
};
|
|
65
|
+
}
|
|
37
66
|
|
|
38
67
|
// src/catalog-models.ts
|
|
39
68
|
var WIDENING_ROUTES = [
|
|
@@ -270,6 +299,7 @@ function buildCatalogModels(input) {
|
|
|
270
299
|
];
|
|
271
300
|
const merged = mergeContributions(contributions);
|
|
272
301
|
const query = input.query ?? {};
|
|
302
|
+
const queryAdapter = query.adapter ? input.adapters.find((a) => a.slug === query.adapter) : void 0;
|
|
273
303
|
const servableByRoute = /* @__PURE__ */ new Map();
|
|
274
304
|
for (const row of merged) {
|
|
275
305
|
const set = servableByRoute.get(row.route) ?? /* @__PURE__ */ new Set();
|
|
@@ -284,12 +314,18 @@ function buildCatalogModels(input) {
|
|
|
284
314
|
if (query.adapter && !row.adapters.includes(query.adapter)) continue;
|
|
285
315
|
const isDirectVendorRoute = row.route === row.vendor && row.adapterModes.length === 0;
|
|
286
316
|
const walletEligible = !isDirectVendorRoute || checkModelWalletEligibility(`${row.vendor}/${row.product}`, row.route).ok;
|
|
287
|
-
const
|
|
317
|
+
const projected = queryAdapter === void 0 ? void 0 : queryAdapter.authDescriptor ? spawnEligibilityManifest(
|
|
318
|
+
queryAdapter.slug,
|
|
319
|
+
queryAdapter.authDescriptor,
|
|
320
|
+
{ gateway: row.route },
|
|
321
|
+
row.ref
|
|
322
|
+
) : null;
|
|
323
|
+
const manifest = projected?.manifest ?? {
|
|
288
324
|
id: `${row.vendor}/${row.product}@${row.route}`,
|
|
289
325
|
endpointByRoute: { [row.route]: billedVendor(row.vendor, row.route) },
|
|
290
326
|
methodsByRoute: { [row.route]: row.methods }
|
|
291
327
|
};
|
|
292
|
-
const eligible = walletEligible ? eligibleProfiles(input.profiles, manifest, row.route).filter(
|
|
328
|
+
const eligible = walletEligible && projected !== null ? eligibleProfiles(input.profiles, manifest, projected?.routeId ?? row.route).filter(
|
|
293
329
|
(p) => profileAllowsModel(p, row.ref, `${row.vendor}/${row.product}`)
|
|
294
330
|
) : [];
|
|
295
331
|
const runnable = eligible.length > 0;
|