@every-app/sdk 0.3.0-rc.1 → 0.3.0-rc.11
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/LICENSE +21 -0
- package/README.md +62 -64
- package/dist/cloudflare/catalogSettings.generated.d.ts +84 -0
- package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -0
- package/dist/cloudflare/catalogSettings.generated.js +175 -0
- package/dist/cloudflare/index.d.ts +3 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -1
- package/dist/cloudflare/sentinel.d.ts +60 -2
- package/dist/cloudflare/sentinel.d.ts.map +1 -1
- package/dist/cloudflare/sentinel.js +37 -2
- package/dist/cloudflare/worker.d.ts +391 -63
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +394 -108
- package/dist/dev/index.d.ts +1 -1
- package/dist/dev/index.d.ts.map +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/dev/keypair.d.ts +2 -0
- package/dist/dev/keypair.d.ts.map +1 -1
- package/dist/dev/keypair.js +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/internal/aiDefault.d.ts +205 -0
- package/dist/internal/aiDefault.d.ts.map +1 -0
- package/dist/internal/aiDefault.js +335 -0
- package/dist/internal/aiProviders.d.ts +7 -2
- package/dist/internal/aiProviders.d.ts.map +1 -1
- package/dist/internal/aiProviders.js +19 -6
- package/dist/internal/appSettings.d.ts +82 -4
- package/dist/internal/appSettings.d.ts.map +1 -1
- package/dist/internal/appSettings.js +204 -29
- package/dist/internal/audit.d.ts +108 -0
- package/dist/internal/audit.d.ts.map +1 -0
- package/dist/internal/audit.js +235 -0
- package/dist/internal/capabilities.d.ts +2261 -815
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +122 -1034
- package/dist/internal/catalog/commerce.d.ts +394 -0
- package/dist/internal/catalog/commerce.d.ts.map +1 -0
- package/dist/internal/catalog/commerce.js +477 -0
- package/dist/internal/catalog/comms.d.ts +375 -0
- package/dist/internal/catalog/comms.d.ts.map +1 -0
- package/dist/internal/catalog/comms.js +520 -0
- package/dist/internal/catalog/index.d.ts +2008 -0
- package/dist/internal/catalog/index.d.ts.map +1 -0
- package/dist/internal/catalog/index.js +19 -0
- package/dist/internal/catalog/inference.d.ts +393 -0
- package/dist/internal/catalog/inference.d.ts.map +1 -0
- package/dist/internal/catalog/inference.js +460 -0
- package/dist/internal/catalog/infra.d.ts +458 -0
- package/dist/internal/catalog/infra.d.ts.map +1 -0
- package/dist/internal/catalog/infra.js +608 -0
- package/dist/internal/catalog/search.d.ts +400 -0
- package/dist/internal/catalog/search.d.ts.map +1 -0
- package/dist/internal/catalog/search.js +463 -0
- package/dist/internal/devProviders.d.ts +2 -2
- package/dist/internal/devProviders.d.ts.map +1 -1
- package/dist/internal/devProviders.js +19 -1
- package/dist/internal/events.d.ts +65 -3
- package/dist/internal/events.d.ts.map +1 -1
- package/dist/internal/events.js +110 -5
- package/dist/internal/gatewaySettings.d.ts +3 -2
- package/dist/internal/gatewaySettings.d.ts.map +1 -1
- package/dist/internal/gatewaySettings.js +12 -6
- package/dist/internal/identity.d.ts +41 -4
- package/dist/internal/identity.d.ts.map +1 -1
- package/dist/internal/identity.js +48 -10
- package/dist/internal/index.d.ts +6 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +6 -1
- package/dist/internal/members.d.ts +3 -2
- package/dist/internal/members.d.ts.map +1 -1
- package/dist/internal/oauthBuiltIns.d.ts +101 -0
- package/dist/internal/oauthBuiltIns.d.ts.map +1 -0
- package/dist/internal/oauthBuiltIns.js +122 -0
- package/dist/internal/oauthClient.d.ts +8 -50
- package/dist/internal/oauthClient.d.ts.map +1 -1
- package/dist/internal/oauthClient.js +2 -177
- package/dist/internal/oauthPresets.d.ts +32 -0
- package/dist/internal/oauthPresets.d.ts.map +1 -0
- package/dist/internal/oauthPresets.js +253 -0
- package/dist/internal/oauthScopes.d.ts +43 -100
- package/dist/internal/oauthScopes.d.ts.map +1 -1
- package/dist/internal/oauthScopes.js +83 -382
- package/dist/internal/oauthSpec.d.ts +103 -0
- package/dist/internal/oauthSpec.d.ts.map +1 -0
- package/dist/internal/oauthSpec.js +520 -0
- package/dist/internal/protocol.d.ts +97 -5
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +89 -1
- package/dist/internal/providerRegistry.d.ts +17 -6
- package/dist/internal/providerRegistry.d.ts.map +1 -1
- package/dist/internal/providerRegistry.js +71 -8
- package/dist/internal/providerSpec.d.ts +18 -7
- package/dist/internal/providerSpec.d.ts.map +1 -1
- package/dist/internal/providerSpec.js +420 -34
- package/dist/internal/remoteMcp.d.ts.map +1 -1
- package/dist/internal/remoteMcp.js +1 -5
- package/dist/internal/signInProviders.d.ts +104 -0
- package/dist/internal/signInProviders.d.ts.map +1 -0
- package/dist/internal/signInProviders.js +245 -0
- package/dist/internal/tools.d.ts +5 -4
- package/dist/internal/tools.d.ts.map +1 -1
- package/dist/internal/tools.js +4 -3
- package/dist/manifest.d.ts +267 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +30 -0
- package/dist/server/ai.d.ts +111 -0
- package/dist/server/ai.d.ts.map +1 -0
- package/dist/server/ai.js +145 -0
- package/dist/server/aiBinding.d.ts +68 -0
- package/dist/server/aiBinding.d.ts.map +1 -0
- package/dist/server/aiBinding.js +294 -0
- package/dist/server/attribution.d.ts +18 -5
- package/dist/server/attribution.d.ts.map +1 -1
- package/dist/server/attribution.js +19 -5
- package/dist/server/connectUrl.d.ts +16 -0
- package/dist/server/connectUrl.d.ts.map +1 -0
- package/dist/server/connectUrl.js +40 -0
- package/dist/server/context.d.ts +68 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +117 -0
- package/dist/server/emailBinding.d.ts +72 -0
- package/dist/server/emailBinding.d.ts.map +1 -0
- package/dist/server/emailBinding.js +124 -0
- package/dist/server/emit.d.ts +1 -1
- package/dist/server/emit.d.ts.map +1 -1
- package/dist/server/emit.js +7 -7
- package/dist/server/env.d.ts +44 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +1 -0
- package/dist/server/eventsEndpoint.d.ts +48 -0
- package/dist/server/eventsEndpoint.d.ts.map +1 -0
- package/dist/server/eventsEndpoint.js +145 -0
- package/dist/server/everyApp.d.ts +40 -11
- package/dist/server/everyApp.d.ts.map +1 -1
- package/dist/server/everyApp.js +116 -6
- package/dist/server/fromMcpTools.d.ts +89 -0
- package/dist/server/fromMcpTools.d.ts.map +1 -0
- package/dist/server/fromMcpTools.js +192 -0
- package/dist/server/gatewayFetch.d.ts +42 -18
- package/dist/server/gatewayFetch.d.ts.map +1 -1
- package/dist/server/gatewayFetch.js +138 -19
- package/dist/server/gatewayUrl.d.ts +13 -0
- package/dist/server/gatewayUrl.d.ts.map +1 -0
- package/dist/server/gatewayUrl.js +34 -0
- package/dist/server/index.d.ts +16 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +13 -3
- package/dist/server/integrationFetch.d.ts +92 -73
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +206 -319
- package/dist/server/listMembers.d.ts +1 -1
- package/dist/server/listMembers.d.ts.map +1 -1
- package/dist/server/listMembers.js +8 -11
- package/dist/server/refusal.d.ts +55 -0
- package/dist/server/refusal.d.ts.map +1 -0
- package/dist/server/refusal.js +193 -0
- package/dist/server/sendEmail.d.ts +1 -1
- package/dist/server/sendEmail.d.ts.map +1 -1
- package/dist/server/sendEmail.js +7 -7
- package/dist/server/tools.d.ts +7 -2
- package/dist/server/tools.d.ts.map +1 -1
- package/dist/server/tools.js +2 -1
- package/dist/server/toolsEndpoint.d.ts +3 -1
- package/dist/server/toolsEndpoint.d.ts.map +1 -1
- package/dist/server/toolsEndpoint.js +19 -7
- package/dist/server/webhooks.d.ts +56 -0
- package/dist/server/webhooks.d.ts.map +1 -0
- package/dist/server/webhooks.js +205 -0
- package/dist/tanstack-start/index.d.ts +9 -0
- package/dist/tanstack-start/index.d.ts.map +1 -0
- package/dist/tanstack-start/index.js +29 -0
- package/dist/testing/index.d.ts +93 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +156 -0
- package/package.json +35 -14
- package/dist/server/authorizeUrl.d.ts +0 -43
- package/dist/server/authorizeUrl.d.ts.map +0 -1
- package/dist/server/authorizeUrl.js +0 -110
|
@@ -6,15 +6,22 @@
|
|
|
6
6
|
* JSON into an {@link ApiKeyCapability} or names every problem; nothing
|
|
7
7
|
* here reads a value: a spec names Gateway settings, never holds one.
|
|
8
8
|
*
|
|
9
|
-
*
|
|
10
|
-
* or basic)
|
|
11
|
-
* the
|
|
9
|
+
* Three kinds parse: API-key providers (`auth.kind` bearer, header, query
|
|
10
|
+
* or basic), OAuth providers (`auth.kind` oauth2-user, the half in
|
|
11
|
+
* ./oauthSpec.ts: the Gateway runs the flow and holds the tokens,
|
|
12
|
+
* docs/design/2026-10-oauth-providers.md), and OpenAI-compatible model
|
|
13
|
+
* providers (`mode: "ai"`: a `baseUrl`, the key's placement, the models
|
|
14
|
+
* it serves and the default, its inference routes; the AI proxy serves a
|
|
15
|
+
* row exactly as it serves a catalog `ai` entry, inference POSTs alone,
|
|
16
|
+
* `store: false` on chat, the usage tap, so a new model vendor is a
|
|
17
|
+
* registered spec, not a catalog release).
|
|
12
18
|
*
|
|
13
19
|
* The rules that make a row safe on a particular gateway (its secret names
|
|
14
20
|
* are its own, its hosts are public, it shadows no catalog entry) are the
|
|
15
21
|
* registry's (./providerRegistry.ts), run after this parse.
|
|
16
22
|
*/
|
|
17
23
|
import { DEFAULT_WRITE_METHODS, authSettingNames, } from "./capabilities.js";
|
|
24
|
+
import { REMOVED_OAUTH_FIELDS, oauthSpecOf, parseOAuthUserSpec, } from "./oauthSpec.js";
|
|
18
25
|
/** A provider id: lowercase, a letter first, 2 to 40 characters. */
|
|
19
26
|
export const PROVIDER_ID = /^[a-z][a-z0-9-]{1,39}$/;
|
|
20
27
|
/** A Gateway setting name a provider may hold: upper case, 3 to 64 characters. */
|
|
@@ -26,7 +33,12 @@ const SEGMENT = /^[a-z0-9_-]{1,64}$/;
|
|
|
26
33
|
const HEADER_NAME = /^[A-Za-z0-9-]{1,64}$/;
|
|
27
34
|
const QUERY_PARAM = /^[A-Za-z0-9_.-]{1,64}$/;
|
|
28
35
|
const SCHEME = /^[A-Za-z][A-Za-z0-9-]{0,31}$/;
|
|
29
|
-
|
|
36
|
+
/**
|
|
37
|
+
* A JSON field name, or a dotted path to a nested one (`usage.cost`, at
|
|
38
|
+
* most four segments): the capability proxy reads a top-level name off the
|
|
39
|
+
* answer's head, the AI proxy a path into the usage object off its tail.
|
|
40
|
+
*/
|
|
41
|
+
const RESPONSE_FIELD = /^[A-Za-z_][A-Za-z0-9_]{0,63}(?:\.[A-Za-z_][A-Za-z0-9_]{0,63}){0,3}$/;
|
|
30
42
|
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
31
43
|
const TAG = /^[a-z][a-z0-9-]{0,31}$/;
|
|
32
44
|
/** Control and format characters: in no text a spec carries. */
|
|
@@ -52,6 +64,15 @@ const RESERVED_HEADERS = new Set([
|
|
|
52
64
|
]);
|
|
53
65
|
const MAX_HOSTS = 20;
|
|
54
66
|
const MAX_ACCOUNT_WIDE_PATHS = 50;
|
|
67
|
+
/** An inference route an `ai` row names: `/v1/chat/completions`, segments of lowercase letters, digits, `_` and `-`. */
|
|
68
|
+
const AI_ROUTE = /^(?:\/[a-z0-9_-]+)+$/;
|
|
69
|
+
const MAX_AI_ROUTES = 20;
|
|
70
|
+
const MAX_MODELS = 100;
|
|
71
|
+
/** A model name as OpenAI-compatible APIs spell them: `gpt-6-luna`, `meta-llama/llama-4`, `claude-haiku-5-5:beta`. */
|
|
72
|
+
const MODEL_NAME = /^[A-Za-z0-9][A-Za-z0-9._:/@-]{0,199}$/;
|
|
73
|
+
/** What an `ai` row serves by default: chat, and embeddings when it names an embeddings model. */
|
|
74
|
+
export const AI_SPEC_CHAT_ROUTE = "/v1/chat/completions";
|
|
75
|
+
export const AI_SPEC_EMBEDDINGS_ROUTE = "/v1/embeddings";
|
|
55
76
|
const KNOWN_FIELDS = new Set([
|
|
56
77
|
"id",
|
|
57
78
|
"mode",
|
|
@@ -75,7 +96,46 @@ const KNOWN_FIELDS = new Set([
|
|
|
75
96
|
"example",
|
|
76
97
|
"verified",
|
|
77
98
|
"tags",
|
|
99
|
+
// An `ai` spec's own.
|
|
100
|
+
"baseUrl",
|
|
101
|
+
"models",
|
|
102
|
+
"defaultModel",
|
|
103
|
+
"embeddingsModel",
|
|
104
|
+
"routes",
|
|
105
|
+
"chatRoute",
|
|
106
|
+
"embeddingsRoute",
|
|
78
107
|
]);
|
|
108
|
+
/** Fields only an `ai` spec has. */
|
|
109
|
+
const AI_ONLY_FIELDS = [
|
|
110
|
+
"baseUrl",
|
|
111
|
+
"models",
|
|
112
|
+
"defaultModel",
|
|
113
|
+
"embeddingsModel",
|
|
114
|
+
"routes",
|
|
115
|
+
"chatRoute",
|
|
116
|
+
"embeddingsRoute",
|
|
117
|
+
];
|
|
118
|
+
/** Fields an `ai` spec never has: the key goes to one base URL, and the AI proxy's rules replace the capability proxy's. */
|
|
119
|
+
const NOT_AI_FIELDS = [
|
|
120
|
+
"hosts",
|
|
121
|
+
"hostSetting",
|
|
122
|
+
"data",
|
|
123
|
+
"access",
|
|
124
|
+
"readMethods",
|
|
125
|
+
"writeMethods",
|
|
126
|
+
"accountWidePaths",
|
|
127
|
+
];
|
|
128
|
+
/** Fields an API-key spec has that an `oauth2-user` spec does not. */
|
|
129
|
+
const API_KEY_ONLY_FIELDS = [
|
|
130
|
+
"hostSetting",
|
|
131
|
+
"data",
|
|
132
|
+
"secrets",
|
|
133
|
+
"accountWidePaths",
|
|
134
|
+
"smoke",
|
|
135
|
+
"cost",
|
|
136
|
+
"rate",
|
|
137
|
+
"verified",
|
|
138
|
+
];
|
|
79
139
|
function isRecord(value) {
|
|
80
140
|
return typeof value === "object" && value !== null && !Array.isArray(value);
|
|
81
141
|
}
|
|
@@ -300,7 +360,7 @@ function auth(value, problems) {
|
|
|
300
360
|
default:
|
|
301
361
|
problems.push({
|
|
302
362
|
path: "auth.kind",
|
|
303
|
-
message: "must be bearer, header, query or
|
|
363
|
+
message: "must be bearer, header, query, basic or oauth2-user (an AI provider is a catalog entry, not a spec this gateway takes)",
|
|
304
364
|
});
|
|
305
365
|
return undefined;
|
|
306
366
|
}
|
|
@@ -475,11 +535,11 @@ function cost(value, problems) {
|
|
|
475
535
|
}
|
|
476
536
|
const usd = nonNegative(value["usd"], "cost.usd", problems);
|
|
477
537
|
const note = text(value["note"], "cost.note", problems, { max: 200 });
|
|
478
|
-
const responseField = text(value["responseField"], "cost.responseField", problems, { max:
|
|
538
|
+
const responseField = text(value["responseField"], "cost.responseField", problems, { max: 128 });
|
|
479
539
|
if (responseField !== undefined && !RESPONSE_FIELD.test(responseField)) {
|
|
480
540
|
problems.push({
|
|
481
541
|
path: "cost.responseField",
|
|
482
|
-
message: "must be a JSON field name",
|
|
542
|
+
message: "must be a JSON field name, or a dotted path to a nested one",
|
|
483
543
|
});
|
|
484
544
|
}
|
|
485
545
|
if (unit !== "call" && unit !== "result" && unit !== "token")
|
|
@@ -532,6 +592,43 @@ function verified(value, problems) {
|
|
|
532
592
|
});
|
|
533
593
|
return undefined;
|
|
534
594
|
}
|
|
595
|
+
/** `access`, `readMethods` and `writeMethods`, shared by both kinds. */
|
|
596
|
+
function grants(input, problems) {
|
|
597
|
+
const access = stringList(input["access"], "access", problems, {
|
|
598
|
+
max: 2,
|
|
599
|
+
each: (level, at) => {
|
|
600
|
+
if (level !== "read" && level !== "write") {
|
|
601
|
+
problems.push({ path: at, message: "must be read or write" });
|
|
602
|
+
}
|
|
603
|
+
},
|
|
604
|
+
});
|
|
605
|
+
if (access && access.length === 0) {
|
|
606
|
+
problems.push({ path: "access", message: "must list read, write or both" });
|
|
607
|
+
}
|
|
608
|
+
const readMethods = methods(input["readMethods"], "readMethods", problems);
|
|
609
|
+
// A write-only provider (a sender, a GraphQL API) reads with nothing:
|
|
610
|
+
// every call needs the write grant. Anything that offers read lists how.
|
|
611
|
+
if (readMethods &&
|
|
612
|
+
readMethods.length === 0 &&
|
|
613
|
+
(!Array.isArray(access) || access.includes("read"))) {
|
|
614
|
+
problems.push({
|
|
615
|
+
path: "readMethods",
|
|
616
|
+
message: "must list a method unless access is write alone",
|
|
617
|
+
});
|
|
618
|
+
}
|
|
619
|
+
const writeMethods = methods(input["writeMethods"], "writeMethods", problems);
|
|
620
|
+
return { access, readMethods, writeMethods };
|
|
621
|
+
}
|
|
622
|
+
function tagList(value, problems) {
|
|
623
|
+
return stringList(value, "tags", problems, {
|
|
624
|
+
max: 10,
|
|
625
|
+
each: (tag, at) => {
|
|
626
|
+
if (!TAG.test(tag)) {
|
|
627
|
+
problems.push({ path: at, message: "must be a lowercase word" });
|
|
628
|
+
}
|
|
629
|
+
},
|
|
630
|
+
});
|
|
631
|
+
}
|
|
535
632
|
/**
|
|
536
633
|
* Parse a provider spec. Every problem is reported, with its path, so a
|
|
537
634
|
* person fixes the file once. On success the id and the catalog-shaped
|
|
@@ -546,7 +643,11 @@ export function parseProviderSpec(input) {
|
|
|
546
643
|
problems: [{ path: "(root)", message: "must be a JSON object" }],
|
|
547
644
|
};
|
|
548
645
|
}
|
|
646
|
+
const oauthSpec = isRecord(input["auth"]) && input["auth"]["kind"] === "oauth2-user";
|
|
549
647
|
for (const field of Object.keys(input)) {
|
|
648
|
+
// An OAuth spec's removed fields get their own message below.
|
|
649
|
+
if (oauthSpec && Object.hasOwn(REMOVED_OAUTH_FIELDS, field))
|
|
650
|
+
continue;
|
|
550
651
|
if (!KNOWN_FIELDS.has(field)) {
|
|
551
652
|
problems.push({ path: field, message: "unknown field" });
|
|
552
653
|
}
|
|
@@ -558,10 +659,21 @@ export function parseProviderSpec(input) {
|
|
|
558
659
|
message: "must be lowercase letters, digits and hyphens, a letter first, 2 to 40 characters (stripe)",
|
|
559
660
|
});
|
|
560
661
|
}
|
|
561
|
-
|
|
662
|
+
const isOAuth = isRecord(input["auth"]) && input["auth"]["kind"] === "oauth2-user";
|
|
663
|
+
const isAi = input["mode"] === "ai";
|
|
664
|
+
const expectedMode = isOAuth ? "oauth_client" : "api_key";
|
|
665
|
+
if (!isAi && input["mode"] !== undefined && input["mode"] !== expectedMode) {
|
|
562
666
|
problems.push({
|
|
563
667
|
path: "mode",
|
|
564
|
-
message:
|
|
668
|
+
message: isOAuth
|
|
669
|
+
? "an oauth2-user spec's mode is oauth_client (or left out)"
|
|
670
|
+
: 'this gateway registers api_key, oauth_client (auth.kind oauth2-user) and ai (mode: "ai", an OpenAI-compatible model provider) providers',
|
|
671
|
+
});
|
|
672
|
+
}
|
|
673
|
+
if (isAi && isOAuth) {
|
|
674
|
+
problems.push({
|
|
675
|
+
path: "auth.kind",
|
|
676
|
+
message: "an ai spec's key is a bearer, header, query or basic key, never oauth2-user",
|
|
565
677
|
});
|
|
566
678
|
}
|
|
567
679
|
const name = text(input["name"], "name", problems, { max: 64 });
|
|
@@ -590,6 +702,56 @@ export function parseProviderSpec(input) {
|
|
|
590
702
|
}
|
|
591
703
|
},
|
|
592
704
|
});
|
|
705
|
+
if (isAi && !isOAuth) {
|
|
706
|
+
return parseAiSpec(input, problems, { id, name, description, docs, api });
|
|
707
|
+
}
|
|
708
|
+
if (isOAuth) {
|
|
709
|
+
// Fields an OAuth spec had before scopes moved to each app's config,
|
|
710
|
+
// each refused with what to write instead.
|
|
711
|
+
for (const [field, message] of Object.entries(REMOVED_OAUTH_FIELDS)) {
|
|
712
|
+
if (input[field] !== undefined)
|
|
713
|
+
problems.push({ path: field, message });
|
|
714
|
+
}
|
|
715
|
+
const hint = text(input["hint"], "hint", problems, { max: 500 });
|
|
716
|
+
const example = text(input["example"], "example", problems, { max: 200 });
|
|
717
|
+
const tags = tagList(input["tags"], problems);
|
|
718
|
+
// An OAuth provider: its token goes to `hosts` alone, so the API-key
|
|
719
|
+
// fields that shape a key's placement have no meaning here.
|
|
720
|
+
for (const field of API_KEY_ONLY_FIELDS) {
|
|
721
|
+
if (input[field] !== undefined) {
|
|
722
|
+
problems.push({
|
|
723
|
+
path: field,
|
|
724
|
+
message: "not a field of an oauth2-user spec",
|
|
725
|
+
});
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
if (input["hosts"] === undefined || (hosts && hosts.length === 0)) {
|
|
729
|
+
problems.push({
|
|
730
|
+
path: "hosts",
|
|
731
|
+
message: "required: at least one API host the token is sent to",
|
|
732
|
+
});
|
|
733
|
+
}
|
|
734
|
+
const parsed = typeof id === "string" &&
|
|
735
|
+
name !== undefined &&
|
|
736
|
+
docs !== undefined &&
|
|
737
|
+
hosts !== undefined
|
|
738
|
+
? parseOAuthUserSpec(input, {
|
|
739
|
+
id,
|
|
740
|
+
name,
|
|
741
|
+
docs,
|
|
742
|
+
hosts,
|
|
743
|
+
...(description === undefined ? {} : { description }),
|
|
744
|
+
...(api === undefined ? {} : { reference: api }),
|
|
745
|
+
...(hint === undefined ? {} : { hint }),
|
|
746
|
+
...(example === undefined ? {} : { example }),
|
|
747
|
+
...(tags === undefined ? {} : { tags }),
|
|
748
|
+
}, problems)
|
|
749
|
+
: undefined;
|
|
750
|
+
if (problems.length > 0 || !parsed || typeof id !== "string") {
|
|
751
|
+
return { ok: false, problems };
|
|
752
|
+
}
|
|
753
|
+
return { ok: true, id, capability: parsed.capability };
|
|
754
|
+
}
|
|
593
755
|
const hostSetting = input["hostSetting"] === undefined
|
|
594
756
|
? undefined
|
|
595
757
|
: secretName(input["hostSetting"], "hostSetting", problems);
|
|
@@ -623,22 +785,7 @@ export function parseProviderSpec(input) {
|
|
|
623
785
|
...(parsedAuth ? authSettingNames(parsedAuth) : []),
|
|
624
786
|
...(hostSetting === undefined ? [] : [hostSetting]),
|
|
625
787
|
], problems);
|
|
626
|
-
const access =
|
|
627
|
-
max: 2,
|
|
628
|
-
each: (level, at) => {
|
|
629
|
-
if (level !== "read" && level !== "write") {
|
|
630
|
-
problems.push({ path: at, message: "must be read or write" });
|
|
631
|
-
}
|
|
632
|
-
},
|
|
633
|
-
});
|
|
634
|
-
if (access && access.length === 0) {
|
|
635
|
-
problems.push({ path: "access", message: "must list read, write or both" });
|
|
636
|
-
}
|
|
637
|
-
const readMethods = methods(input["readMethods"], "readMethods", problems);
|
|
638
|
-
if (readMethods && readMethods.length === 0) {
|
|
639
|
-
problems.push({ path: "readMethods", message: "must list a method" });
|
|
640
|
-
}
|
|
641
|
-
const writeMethods = methods(input["writeMethods"], "writeMethods", problems);
|
|
788
|
+
const { access, readMethods, writeMethods } = grants(input, problems);
|
|
642
789
|
const paths = accountWidePaths(input["accountWidePaths"], problems);
|
|
643
790
|
const hint = text(input["hint"], "hint", problems, { max: 500 });
|
|
644
791
|
const smokeRequest = smoke(input["smoke"], hosts ?? [], problems);
|
|
@@ -646,14 +793,7 @@ export function parseProviderSpec(input) {
|
|
|
646
793
|
const parsedRate = rate(input["rate"], problems);
|
|
647
794
|
const example = text(input["example"], "example", problems, { max: 200 });
|
|
648
795
|
const parsedVerified = verified(input["verified"], problems);
|
|
649
|
-
const tags =
|
|
650
|
-
max: 10,
|
|
651
|
-
each: (tag, at) => {
|
|
652
|
-
if (!TAG.test(tag)) {
|
|
653
|
-
problems.push({ path: at, message: "must be a lowercase word" });
|
|
654
|
-
}
|
|
655
|
-
},
|
|
656
|
-
});
|
|
796
|
+
const tags = tagList(input["tags"], problems);
|
|
657
797
|
if (problems.length > 0 ||
|
|
658
798
|
typeof id !== "string" ||
|
|
659
799
|
name === undefined ||
|
|
@@ -687,6 +827,197 @@ export function parseProviderSpec(input) {
|
|
|
687
827
|
};
|
|
688
828
|
return { ok: true, id, capability };
|
|
689
829
|
}
|
|
830
|
+
/**
|
|
831
|
+
* The `ai` half of `parseProviderSpec`: an OpenAI-compatible model
|
|
832
|
+
* provider. `baseUrl` is where the app's path is joined (`https://api.groq.com/openai`:
|
|
833
|
+
* the origin, and a base path the proxy keeps in front of every route);
|
|
834
|
+
* `auth` places the key as an API-key spec does; `models` lists what the
|
|
835
|
+
* provider serves (1 to 100; the proxy refuses any other) with
|
|
836
|
+
* `defaultModel` the one the Gateway's default route fills in and
|
|
837
|
+
* `embeddingsModel` the one for `/api/ai/default/v1/embeddings`; `routes`
|
|
838
|
+
* are the inference paths apps may POST to (default chat, and embeddings
|
|
839
|
+
* with an embeddings model), `chatRoute` and `embeddingsRoute` which of
|
|
840
|
+
* them the default route maps onto. Chat answers are never stored
|
|
841
|
+
* (`store: false` on the chat route). `cost.responseField` is where the
|
|
842
|
+
* answer carries the call's price, read by the usage tap as OpenRouter's
|
|
843
|
+
* `usage.cost` is.
|
|
844
|
+
*/
|
|
845
|
+
function parseAiSpec(input, problems, common) {
|
|
846
|
+
for (const field of NOT_AI_FIELDS) {
|
|
847
|
+
if (input[field] !== undefined) {
|
|
848
|
+
problems.push({ path: field, message: "not a field of an ai spec" });
|
|
849
|
+
}
|
|
850
|
+
}
|
|
851
|
+
const base = httpsUrl(input["baseUrl"], "baseUrl", problems);
|
|
852
|
+
let origin;
|
|
853
|
+
let basePath;
|
|
854
|
+
if (input["baseUrl"] === undefined) {
|
|
855
|
+
problems.push({
|
|
856
|
+
path: "baseUrl",
|
|
857
|
+
message: "required: the https URL the app's paths are joined onto (https://api.groq.com/openai)",
|
|
858
|
+
});
|
|
859
|
+
}
|
|
860
|
+
else if (base !== undefined) {
|
|
861
|
+
const url = new URL(base);
|
|
862
|
+
if (url.search || url.hash || url.username || url.password || url.port) {
|
|
863
|
+
problems.push({
|
|
864
|
+
path: "baseUrl",
|
|
865
|
+
message: "must be an https URL with no query, fragment, credentials or port",
|
|
866
|
+
});
|
|
867
|
+
}
|
|
868
|
+
else if (!PROVIDER_HOST.test(url.hostname)) {
|
|
869
|
+
problems.push({
|
|
870
|
+
path: "baseUrl",
|
|
871
|
+
message: "must name a public host with a dot (api.groq.com)",
|
|
872
|
+
});
|
|
873
|
+
}
|
|
874
|
+
else {
|
|
875
|
+
origin = url.origin;
|
|
876
|
+
const path = url.pathname.replace(/\/+$/, "");
|
|
877
|
+
if (path && !AI_ROUTE.test(path)) {
|
|
878
|
+
problems.push({
|
|
879
|
+
path: "baseUrl",
|
|
880
|
+
message: "its path must be segments of lowercase letters, digits, _ and -",
|
|
881
|
+
});
|
|
882
|
+
}
|
|
883
|
+
else if (path) {
|
|
884
|
+
basePath = path;
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
const parsedAuth = auth(input["auth"], problems);
|
|
889
|
+
if (input["auth"] === undefined) {
|
|
890
|
+
problems.push({ path: "auth", message: "required" });
|
|
891
|
+
}
|
|
892
|
+
const secrets = secretDetails(input["secrets"], parsedAuth ? authSettingNames(parsedAuth) : [], problems);
|
|
893
|
+
const models = stringList(input["models"], "models", problems, {
|
|
894
|
+
max: MAX_MODELS,
|
|
895
|
+
each: (model, at) => {
|
|
896
|
+
if (!MODEL_NAME.test(model)) {
|
|
897
|
+
problems.push({
|
|
898
|
+
path: at,
|
|
899
|
+
message: "must be a model name (gpt-6-luna, meta-llama/llama-4)",
|
|
900
|
+
});
|
|
901
|
+
}
|
|
902
|
+
},
|
|
903
|
+
});
|
|
904
|
+
if (input["models"] === undefined || (models && models.length === 0)) {
|
|
905
|
+
problems.push({
|
|
906
|
+
path: "models",
|
|
907
|
+
message: "required: the models the provider serves, at least one",
|
|
908
|
+
});
|
|
909
|
+
}
|
|
910
|
+
const defaultModel = text(input["defaultModel"], "defaultModel", problems, {
|
|
911
|
+
max: 200,
|
|
912
|
+
});
|
|
913
|
+
if (input["defaultModel"] === undefined) {
|
|
914
|
+
problems.push({
|
|
915
|
+
path: "defaultModel",
|
|
916
|
+
message: "required: the chat model the Gateway fills in when an app names none; one of models",
|
|
917
|
+
});
|
|
918
|
+
}
|
|
919
|
+
else if (defaultModel !== undefined &&
|
|
920
|
+
models &&
|
|
921
|
+
!models.includes(defaultModel)) {
|
|
922
|
+
problems.push({ path: "defaultModel", message: "must be one of models" });
|
|
923
|
+
}
|
|
924
|
+
const embeddingsModel = text(input["embeddingsModel"], "embeddingsModel", problems, { max: 200 });
|
|
925
|
+
if (embeddingsModel !== undefined &&
|
|
926
|
+
models &&
|
|
927
|
+
!models.includes(embeddingsModel)) {
|
|
928
|
+
problems.push({
|
|
929
|
+
path: "embeddingsModel",
|
|
930
|
+
message: "must be one of models",
|
|
931
|
+
});
|
|
932
|
+
}
|
|
933
|
+
const routeList = (value, path) => stringList(value, path, problems, {
|
|
934
|
+
max: MAX_AI_ROUTES,
|
|
935
|
+
each: (route, at) => {
|
|
936
|
+
if (!AI_ROUTE.test(route)) {
|
|
937
|
+
problems.push({
|
|
938
|
+
path: at,
|
|
939
|
+
message: "must be a path of lowercase segments starting with / (/v1/chat/completions)",
|
|
940
|
+
});
|
|
941
|
+
}
|
|
942
|
+
},
|
|
943
|
+
});
|
|
944
|
+
const chatRoute = text(input["chatRoute"], "chatRoute", problems, { max: 200 }) ??
|
|
945
|
+
AI_SPEC_CHAT_ROUTE;
|
|
946
|
+
const embeddingsRoute = text(input["embeddingsRoute"], "embeddingsRoute", problems, { max: 200 }) ??
|
|
947
|
+
AI_SPEC_EMBEDDINGS_ROUTE;
|
|
948
|
+
for (const [field, route] of [
|
|
949
|
+
["chatRoute", chatRoute],
|
|
950
|
+
["embeddingsRoute", embeddingsRoute],
|
|
951
|
+
]) {
|
|
952
|
+
if (!AI_ROUTE.test(route)) {
|
|
953
|
+
problems.push({
|
|
954
|
+
path: field,
|
|
955
|
+
message: "must be a path of lowercase segments starting with /",
|
|
956
|
+
});
|
|
957
|
+
}
|
|
958
|
+
}
|
|
959
|
+
const routes = routeList(input["routes"], "routes") ?? [
|
|
960
|
+
chatRoute,
|
|
961
|
+
...(embeddingsModel !== undefined ? [embeddingsRoute] : []),
|
|
962
|
+
];
|
|
963
|
+
if (routes.length === 0) {
|
|
964
|
+
problems.push({ path: "routes", message: "must list a route" });
|
|
965
|
+
}
|
|
966
|
+
if (!routes.includes(chatRoute)) {
|
|
967
|
+
problems.push({ path: "chatRoute", message: "must be one of routes" });
|
|
968
|
+
}
|
|
969
|
+
if (embeddingsModel !== undefined && !routes.includes(embeddingsRoute)) {
|
|
970
|
+
problems.push({
|
|
971
|
+
path: "embeddingsRoute",
|
|
972
|
+
message: "must be one of routes",
|
|
973
|
+
});
|
|
974
|
+
}
|
|
975
|
+
const hint = text(input["hint"], "hint", problems, { max: 500 });
|
|
976
|
+
const smokeRequest = smoke(input["smoke"], origin ? [new URL(origin).host] : [], problems);
|
|
977
|
+
const parsedCost = cost(input["cost"], problems);
|
|
978
|
+
const parsedRate = rate(input["rate"], problems);
|
|
979
|
+
const example = text(input["example"], "example", problems, { max: 200 });
|
|
980
|
+
const parsedVerified = verified(input["verified"], problems);
|
|
981
|
+
const tags = tagList(input["tags"], problems);
|
|
982
|
+
const { id, name, description, docs, api } = common;
|
|
983
|
+
if (problems.length > 0 ||
|
|
984
|
+
typeof id !== "string" ||
|
|
985
|
+
name === undefined ||
|
|
986
|
+
docs === undefined ||
|
|
987
|
+
origin === undefined ||
|
|
988
|
+
!parsedAuth ||
|
|
989
|
+
!models ||
|
|
990
|
+
defaultModel === undefined) {
|
|
991
|
+
return { ok: false, problems };
|
|
992
|
+
}
|
|
993
|
+
const capability = {
|
|
994
|
+
mode: "ai",
|
|
995
|
+
label: name,
|
|
996
|
+
auth: parsedAuth,
|
|
997
|
+
docs,
|
|
998
|
+
origin,
|
|
999
|
+
...(basePath === undefined ? {} : { basePath }),
|
|
1000
|
+
inferenceRoutes: routes,
|
|
1001
|
+
unstoredRoutes: [chatRoute],
|
|
1002
|
+
shape: "openai",
|
|
1003
|
+
chat: { path: chatRoute, seedModel: defaultModel },
|
|
1004
|
+
...(embeddingsModel === undefined
|
|
1005
|
+
? {}
|
|
1006
|
+
: { embeddings: { path: embeddingsRoute, seedModel: embeddingsModel } }),
|
|
1007
|
+
models,
|
|
1008
|
+
...(description === undefined ? {} : { description }),
|
|
1009
|
+
...(api === undefined ? {} : { api }),
|
|
1010
|
+
...(secrets === undefined ? {} : { secrets }),
|
|
1011
|
+
...(hint === undefined ? {} : { hint }),
|
|
1012
|
+
...(smokeRequest === undefined ? {} : { smoke: smokeRequest }),
|
|
1013
|
+
...(parsedCost === undefined ? {} : { cost: parsedCost }),
|
|
1014
|
+
...(parsedRate === undefined ? {} : { rate: parsedRate }),
|
|
1015
|
+
...(example === undefined ? {} : { example }),
|
|
1016
|
+
...(parsedVerified === undefined ? {} : { verified: parsedVerified }),
|
|
1017
|
+
...(tags === undefined ? {} : { tags }),
|
|
1018
|
+
};
|
|
1019
|
+
return { ok: true, id, capability };
|
|
1020
|
+
}
|
|
690
1021
|
/** The problems as one line: `auth.secret: must name a Gateway setting; hosts.0: …`. */
|
|
691
1022
|
export function describeSpecProblems(problems) {
|
|
692
1023
|
return problems
|
|
@@ -700,6 +1031,60 @@ export function describeSpecProblems(problems) {
|
|
|
700
1031
|
* gives the entry back.
|
|
701
1032
|
*/
|
|
702
1033
|
export function providerSpecOf(id, capability) {
|
|
1034
|
+
if (capability.mode === "oauth_client")
|
|
1035
|
+
return oauthSpecOf(id, capability);
|
|
1036
|
+
if (capability.mode === "ai") {
|
|
1037
|
+
if (!capability.chat || !capability.models) {
|
|
1038
|
+
throw new Error(`${id} is a catalog AI entry without a model list: it has no spec`);
|
|
1039
|
+
}
|
|
1040
|
+
return {
|
|
1041
|
+
id,
|
|
1042
|
+
mode: "ai",
|
|
1043
|
+
name: capability.label,
|
|
1044
|
+
...(capability.description === undefined
|
|
1045
|
+
? {}
|
|
1046
|
+
: { description: capability.description }),
|
|
1047
|
+
docs: capability.docs,
|
|
1048
|
+
...(capability.api === undefined ? {} : { api: capability.api }),
|
|
1049
|
+
baseUrl: `${capability.origin}${capability.basePath ?? ""}`,
|
|
1050
|
+
auth: { ...capability.auth },
|
|
1051
|
+
...(capability.secrets === undefined
|
|
1052
|
+
? {}
|
|
1053
|
+
: { secrets: capability.secrets.map((detail) => ({ ...detail })) }),
|
|
1054
|
+
models: [...capability.models],
|
|
1055
|
+
defaultModel: capability.chat.seedModel,
|
|
1056
|
+
...(capability.embeddings === undefined
|
|
1057
|
+
? {}
|
|
1058
|
+
: { embeddingsModel: capability.embeddings.seedModel }),
|
|
1059
|
+
routes: [...capability.inferenceRoutes],
|
|
1060
|
+
chatRoute: capability.chat.path,
|
|
1061
|
+
...(capability.embeddings === undefined
|
|
1062
|
+
? {}
|
|
1063
|
+
: { embeddingsRoute: capability.embeddings.path }),
|
|
1064
|
+
...(capability.hint === undefined ? {} : { hint: capability.hint }),
|
|
1065
|
+
...(capability.smoke === undefined
|
|
1066
|
+
? {}
|
|
1067
|
+
: {
|
|
1068
|
+
smoke: {
|
|
1069
|
+
...capability.smoke,
|
|
1070
|
+
expect: [...capability.smoke.expect],
|
|
1071
|
+
},
|
|
1072
|
+
}),
|
|
1073
|
+
...(capability.cost === undefined
|
|
1074
|
+
? {}
|
|
1075
|
+
: { cost: { ...capability.cost } }),
|
|
1076
|
+
...(capability.rate === undefined
|
|
1077
|
+
? {}
|
|
1078
|
+
: { rate: { ...capability.rate } }),
|
|
1079
|
+
...(capability.example === undefined
|
|
1080
|
+
? {}
|
|
1081
|
+
: { example: capability.example }),
|
|
1082
|
+
...(capability.verified === undefined
|
|
1083
|
+
? {}
|
|
1084
|
+
: { verified: capability.verified }),
|
|
1085
|
+
...(capability.tags === undefined ? {} : { tags: [...capability.tags] }),
|
|
1086
|
+
};
|
|
1087
|
+
}
|
|
703
1088
|
return {
|
|
704
1089
|
id,
|
|
705
1090
|
name: capability.label,
|
|
@@ -742,5 +1127,6 @@ export function providerSpecOf(id, capability) {
|
|
|
742
1127
|
}
|
|
743
1128
|
/** The methods an app with `access: "write"` may use on `capability` besides its read methods. */
|
|
744
1129
|
export function writeMethodsOf(capability) {
|
|
745
|
-
return capability.writeMethods ??
|
|
1130
|
+
return ((capability.mode === "api_key" ? capability.writeMethods : undefined) ??
|
|
1131
|
+
DEFAULT_WRITE_METHODS);
|
|
746
1132
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"remoteMcp.d.ts","sourceRoot":"","sources":["../../src/internal/remoteMcp.ts"],"names":[],"mappings":"AAyBA,OAAO,EAAiC,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE1E,eAAO,MAAM,qBAAqB,yDAMxB,CAAC;AACX,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,qBAAqB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEvE;;;;;GAKG;AACH,MAAM,MAAM,aAAa,GACrB;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE;AAClB,uCAAuC;GACrC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE;AACpC,mCAAmC;GACjC;IAAE,IAAI,EAAE,QAAQ,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,CAAC,EAAE,MAAM,CAAA;CAAE;AACrE,6EAA6E;GAC3E;IAAE,IAAI,EAAE,OAAO,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GACjC;IAAE,IAAI,EAAE,OAAO,CAAA;CAAE,CAAC;AAEtB;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,2CAI3B,CAAC;AACX,MAAM,MAAM,oBAAoB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE7E,8EAA8E;AAC9E,MAAM,WAAW,qBAAqB;IACpC,IAAI,CAAC,EAAE,QAAQ,CAAC;IAChB,6EAA6E;IAC7E,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,MAAM,WAAW,cAAc;IAC7B,uEAAuE;IACvE,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,aAAa,CAAC;IACpB,IAAI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AE,IAAI,CAAC,cAAc,EAAE,OAAO,CAAC,EACpC,YAAY,EAAE,MAAM,GACnB,OAAO,CAET;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAenE;AAED;;;GAGG;AACH,wBAAgB,oBAAoB,CAClC,IAAI,EAAE,aAAa,EACnB,KAAK,EAAE,MAAM,GACZ,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAYxB;AASD,2DAA2D;AAC3D,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,aAAa,GAAG,MAAM,CAa9D"}
|
|
@@ -147,11 +147,7 @@ export function reservedUpstreamHosts() {
|
|
|
147
147
|
hosts.add(host);
|
|
148
148
|
}
|
|
149
149
|
else if (capability.mode === "oauth_client") {
|
|
150
|
-
|
|
151
|
-
if ("host" in endpoint && typeof endpoint.host === "string") {
|
|
152
|
-
hosts.add(endpoint.host);
|
|
153
|
-
}
|
|
154
|
-
}
|
|
150
|
+
hosts.add(new URL(capability.flow.tokenUrl).hostname);
|
|
155
151
|
}
|
|
156
152
|
}
|
|
157
153
|
return [...hosts].sort();
|