@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
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"protocol.d.ts","sourceRoot":"","sources":["../../src/internal/protocol.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EAAwB,KAAK,UAAU,EAAE,MAAM,MAAM,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,eAAO,MAAM,YAAY,UAAU,CAAC;AACpC,eAAO,MAAM,eAAe,sBAAsB,CAAC;AACnD,eAAO,MAAM,mBAAmB,0BAA0B,CAAC;AAC3D;;;;GAIG;AACH,eAAO,MAAM,UAAU,kCAAkC,CAAC;AAC1D,eAAO,MAAM,eAAe,wBAAwB,CAAC;AACrD,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD;;;;GAIG;AACH,eAAO,MAAM,aAAa,sBAAsB,CAAC;AACjD;;;;GAIG;AACH,eAAO,MAAM,oBAAoB,qBAAqB,CAAC;AACvD;;;;;;;GAOG;AACH,eAAO,MAAM,UAAU,mBAAmB,CAAC;AAC3C,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,MAAM,CAAC;AACxC,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,KAAK,CAAC;AAC3C,8CAA8C;AAC9C,eAAO,MAAM,UAAU,oBAAoB,CAAC;AAC5C;;;;;GAKG;AACH,eAAO,MAAM,YAAY,sBAAsB,CAAC;AAChD,qEAAqE;AACrE,eAAO,MAAM,eAAe,kCAAkC,CAAC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;AAED;;;;GAIG;AACH,wBAAsB,aAAa,CACjC,aAAa,EAAE,MAAM,EACrB,IAAI,EAAE,sBAAsB,GAC3B,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
|
@@ -38,6 +38,15 @@ export const GATEWAY_ERROR_HEADER = "x-everyapp-error";
|
|
|
38
38
|
* from what browsers send.
|
|
39
39
|
*/
|
|
40
40
|
export const ORG_HEADER = "x-everyapp-org";
|
|
41
|
+
/**
|
|
42
|
+
* On background work's call to an OAuth provider's API: the member whose
|
|
43
|
+
* connection to this app the call uses. Set by `for: { background: true,
|
|
44
|
+
* userId }`; the gateway reads it on the held-token branch only, for an
|
|
45
|
+
* organization's own app, and the perimeter strips it, with every
|
|
46
|
+
* `x-everyapp-*`, from browsers. It addresses a connection; it is not a
|
|
47
|
+
* permission: connecting in the app already lets the app use it.
|
|
48
|
+
*/
|
|
49
|
+
export const USER_HEADER = "x-everyapp-user";
|
|
41
50
|
/** 120-second lifetime — caps revocation staleness while surviving clock skew. */
|
|
42
51
|
export const IDENTITY_TTL_SECONDS = 120;
|
|
43
52
|
/** System tokens are minted per call and live at most a minute. */
|
|
@@ -62,10 +71,63 @@ export const ISSUER_ENV = "EVERYAPP_IDENTITY_ISSUER";
|
|
|
62
71
|
export const SHARED_ENV = "EVERYAPP_SHARED";
|
|
63
72
|
/** When set to `1` or `true` in the worker env, the dev identity kid is accepted. */
|
|
64
73
|
export const DEV_ENV = "EVERYAPP_DEV";
|
|
74
|
+
/**
|
|
75
|
+
* The organization an app's Worker is pinned to (a secret the deploy sends;
|
|
76
|
+
* in development the stub gateway's organization). `everyApp()` refuses an
|
|
77
|
+
* identity for any other organization; absent on a shared app's Workers.
|
|
78
|
+
*/
|
|
79
|
+
export const ORG_ID_ENV = "EVERY_APP_ORG_ID";
|
|
80
|
+
/**
|
|
81
|
+
* The organization the dev gateway's seeded user belongs to. The same value
|
|
82
|
+
* as `@every-app/sdk/dev`'s, kept apart like {@link DEV_ISSUER} (the same
|
|
83
|
+
* test pins the two together).
|
|
84
|
+
*/
|
|
85
|
+
export const DEV_ORG_ID = "dev-org";
|
|
65
86
|
/** `sub` claim the gateway mints public-route markers with. */
|
|
66
87
|
export const PUBLIC_MARKER_SUB = "public";
|
|
67
88
|
/** `sub` claim of gateway system tokens. */
|
|
68
89
|
export const SYSTEM_TOKEN_SUB = "system";
|
|
90
|
+
/**
|
|
91
|
+
* Linked dev (`everyapp dev --gateway`, docs/design/linked-dev.md): the
|
|
92
|
+
* dev Worker's env names the gateway-lite's loopback forwarder and the
|
|
93
|
+
* run's nonce, and the SDK builds a `{ fetch }` in place of the missing
|
|
94
|
+
* `EVERY_APP_GATEWAY` binding from them. Set by `everyAppWorker()` in a
|
|
95
|
+
* development build from the process environment `everyapp dev` starts
|
|
96
|
+
* the app with; never deployed.
|
|
97
|
+
*/
|
|
98
|
+
export const LINKED_DEV_URL_ENV = "EVERYAPP_LINKED_DEV_URL";
|
|
99
|
+
export const LINKED_DEV_NONCE_ENV = "EVERYAPP_LINKED_DEV_NONCE";
|
|
100
|
+
/** The header the forwarder requires, with the run's nonce: no simple cross-origin request can send it. */
|
|
101
|
+
export const LINKED_DEV_HEADER = "x-everyapp-linked-dev";
|
|
102
|
+
/** Where the gateway-lite serves the forwarder, under the app's own host. */
|
|
103
|
+
export const LINKED_DEV_FORWARD_PATH = "/__everyapp/gateway";
|
|
104
|
+
/**
|
|
105
|
+
* The channels a tool call arrives on: `mcp` for an AI client's MCP
|
|
106
|
+
* connection, `agent` for an agent principal the Gateway runs a call for.
|
|
107
|
+
* Only the ToolBus mints either with a `tc` claim.
|
|
108
|
+
*/
|
|
109
|
+
export const TOOL_CALL_CHANNELS = ["mcp", "agent"];
|
|
110
|
+
/** `act.sub` of an agent principal: `agent:<agt_id>`; `sub` stays its sponsor. */
|
|
111
|
+
export const AGENT_ACTOR_PREFIX = "agent:";
|
|
112
|
+
/** `role` as an {@link OrgRole}: `owner` and `admin` as they are, anything else `member`. */
|
|
113
|
+
export function toOrgRole(role) {
|
|
114
|
+
return role === "owner" || role === "admin" ? role : "member";
|
|
115
|
+
}
|
|
116
|
+
/** Whether `user` manages the organization: an owner or an admin. */
|
|
117
|
+
export function isAdmin(user) {
|
|
118
|
+
return user.orgRole === "owner" || user.orgRole === "admin";
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Whether an agent principal made this call: `chan: "agent"` with
|
|
122
|
+
* `act.sub` `agent:<agt_id>`. `user.id` is still the sponsoring member (the
|
|
123
|
+
* person accountable for the agent), so key rows by it as for anyone;
|
|
124
|
+
* `user.actor.sub` names the agent.
|
|
125
|
+
*/
|
|
126
|
+
export function isAgentCall(user) {
|
|
127
|
+
return (user.channel === "agent" &&
|
|
128
|
+
user.actor.sub.startsWith(AGENT_ACTOR_PREFIX) &&
|
|
129
|
+
user.actor.sub.length > AGENT_ACTOR_PREFIX.length);
|
|
130
|
+
}
|
|
69
131
|
export class ProtocolClaimsError extends Error {
|
|
70
132
|
constructor(message) {
|
|
71
133
|
super(message);
|
|
@@ -78,6 +140,7 @@ export function identitySubjectToClaims(subject, opts) {
|
|
|
78
140
|
email: subject.email,
|
|
79
141
|
org_id: subject.orgId,
|
|
80
142
|
org_role: subject.orgRole,
|
|
143
|
+
...(subject.orgName ? { org_name: subject.orgName } : {}),
|
|
81
144
|
chan: opts.channel ?? "web",
|
|
82
145
|
act: opts.actor ?? { sub: subject.sub },
|
|
83
146
|
scopes: opts.scopes ?? ["*"],
|
|
@@ -112,6 +175,11 @@ export function identityClaimsToEveryAppUser(payload) {
|
|
|
112
175
|
if (!sub || !email || !orgId || !orgRole) {
|
|
113
176
|
throw new ProtocolClaimsError("identity token missing required claims");
|
|
114
177
|
}
|
|
178
|
+
// Display only, so a token without it (or with a malformed one) is still
|
|
179
|
+
// an identity: the app falls back to no name.
|
|
180
|
+
const orgName = typeof payload.org_name === "string" && payload.org_name
|
|
181
|
+
? payload.org_name
|
|
182
|
+
: undefined;
|
|
115
183
|
const chan = payload.chan ?? "web";
|
|
116
184
|
const act = payload.act ?? { sub };
|
|
117
185
|
const scopes = Array.isArray(payload.scopes)
|
|
@@ -122,7 +190,8 @@ export function identityClaimsToEveryAppUser(payload) {
|
|
|
122
190
|
id: sub,
|
|
123
191
|
email,
|
|
124
192
|
orgId,
|
|
125
|
-
orgRole,
|
|
193
|
+
orgRole: toOrgRole(orgRole),
|
|
194
|
+
...(orgName ? { orgName } : {}),
|
|
126
195
|
channel: chan,
|
|
127
196
|
actor: { sub: act.sub ?? sub },
|
|
128
197
|
scopes,
|
|
@@ -158,6 +227,10 @@ export function assertSystemClaims(payload, purpose) {
|
|
|
158
227
|
payload.exp - payload.iat > SYSTEM_TOKEN_TTL_SECONDS) {
|
|
159
228
|
throw new ProtocolClaimsError(`system token must expire within ${SYSTEM_TOKEN_TTL_SECONDS}s of issue`);
|
|
160
229
|
}
|
|
230
|
+
if (purpose === "events.deliver" &&
|
|
231
|
+
(typeof payload.bh !== "string" || payload.bh.length === 0)) {
|
|
232
|
+
throw new ProtocolClaimsError("an events.deliver token must name the body it was minted for");
|
|
233
|
+
}
|
|
161
234
|
return payload;
|
|
162
235
|
}
|
|
163
236
|
let cachedPrivateKey = null;
|
|
@@ -219,6 +292,17 @@ export async function mintPublicMarkerJwt(privateKeyPem, opts) {
|
|
|
219
292
|
.setExpirationTime(nowSec + ttl)
|
|
220
293
|
.sign(key);
|
|
221
294
|
}
|
|
295
|
+
/** SHA-256 of a request body, base64url: what an `events.deliver` token's `bh` names. */
|
|
296
|
+
export async function bodyHash(body) {
|
|
297
|
+
const digest = new Uint8Array(await crypto.subtle.digest("SHA-256", new TextEncoder().encode(body)));
|
|
298
|
+
let binary = "";
|
|
299
|
+
for (const byte of digest)
|
|
300
|
+
binary += String.fromCharCode(byte);
|
|
301
|
+
return btoa(binary)
|
|
302
|
+
.replace(/\+/g, "-")
|
|
303
|
+
.replace(/\//g, "_")
|
|
304
|
+
.replace(/=+$/, "");
|
|
305
|
+
}
|
|
222
306
|
/**
|
|
223
307
|
* Mint the gateway's system token for `x-everyapp-system`: no user, one
|
|
224
308
|
* purpose, one app, one minute. The SDK only accepts it on the endpoint its
|
|
@@ -231,10 +315,14 @@ export async function mintSystemJwt(privateKeyPem, opts) {
|
|
|
231
315
|
}
|
|
232
316
|
const key = await loadPrivateKey(privateKeyPem);
|
|
233
317
|
const nowSec = Math.floor((opts.now ?? Date.now()) / 1000);
|
|
318
|
+
if (opts.purpose === "events.deliver" && !opts.bodyHash) {
|
|
319
|
+
throw new RangeError("an events.deliver token needs the body's hash");
|
|
320
|
+
}
|
|
234
321
|
const claims = {
|
|
235
322
|
typ: "system",
|
|
236
323
|
purpose: opts.purpose,
|
|
237
324
|
jti: crypto.randomUUID(),
|
|
325
|
+
...(opts.bodyHash ? { bh: opts.bodyHash } : {}),
|
|
238
326
|
};
|
|
239
327
|
return new SignJWT(claims)
|
|
240
328
|
.setProtectedHeader({
|
|
@@ -20,7 +20,8 @@
|
|
|
20
20
|
* and not one the gateway serves itself (`refuseHost`, which knows the
|
|
21
21
|
* gateway's own host and `APP_BASE_DOMAIN`).
|
|
22
22
|
*/
|
|
23
|
-
import { type
|
|
23
|
+
import { type Capability, type CapabilityLookup } from "./capabilities.js";
|
|
24
|
+
import { type RegistrableCapability } from "./providerSpec.js";
|
|
24
25
|
/** A `providers` row as the gateway or the CLI read it. */
|
|
25
26
|
export interface ProviderRow {
|
|
26
27
|
id: string;
|
|
@@ -42,13 +43,17 @@ export interface ProviderRow {
|
|
|
42
43
|
* The part of a row a key is set for: its hosts, its host setting and its
|
|
43
44
|
* auth, as one canonical string (sorted keys, sorted hosts), so that
|
|
44
45
|
* replacing a row's hosts or auth changes the key and the value it held
|
|
45
|
-
* is no longer read until the operator sets it again.
|
|
46
|
+
* is no longer read until the operator sets it again. For an OAuth
|
|
47
|
+
* provider the client is bound to its authorize, token and revoke URLs,
|
|
48
|
+
* its API hosts, where the client goes on the token request and its
|
|
49
|
+
* client setting names (`oauth.client-bound-to-endpoints`): an admin who
|
|
50
|
+
* re-points `tokenUrl` has to paste the secret again.
|
|
46
51
|
*/
|
|
47
|
-
export declare function providerBindingKey(capability:
|
|
52
|
+
export declare function providerBindingKey(capability: RegistrableCapability): string;
|
|
48
53
|
/** One registered row as `provider list` and `provider show` report it. */
|
|
49
54
|
export interface RegisteredProvider {
|
|
50
55
|
id: string;
|
|
51
|
-
capability:
|
|
56
|
+
capability: RegistrableCapability;
|
|
52
57
|
/** Whether the row's key was set for the hosts and auth it has now. */
|
|
53
58
|
bound: boolean;
|
|
54
59
|
addedBy: string | null;
|
|
@@ -121,18 +126,24 @@ export declare function rowSecretProblem(id: string, name: string, taken: (name:
|
|
|
121
126
|
* CLI runs it before writing D1, the MCP tool before writing, and the
|
|
122
127
|
* gateway again on every read.
|
|
123
128
|
*/
|
|
124
|
-
export declare function checkProviderRow(id: string, capability:
|
|
129
|
+
export declare function checkProviderRow(id: string, capability: RegistrableCapability, context: {
|
|
125
130
|
/** Settings the other rows hold. */
|
|
126
131
|
rowSettings: ReadonlySet<string>;
|
|
127
132
|
refuseHost?: (host: string) => string | null;
|
|
128
133
|
}): RowRefusal | null;
|
|
134
|
+
/**
|
|
135
|
+
* Every host a row sends a secret to: an API-key provider's `hosts`; an
|
|
136
|
+
* OAuth provider's API hosts (the token), and its authorize, token and
|
|
137
|
+
* revoke hosts (the client). Each passes the row host rules.
|
|
138
|
+
*/
|
|
139
|
+
export declare function registrableHosts(capability: RegistrableCapability): string[];
|
|
129
140
|
/** A row's spec parsed and checked: the capability, or the refusal. */
|
|
130
141
|
export declare function resolveProviderRow(row: ProviderRow, context: {
|
|
131
142
|
rowSettings: ReadonlySet<string>;
|
|
132
143
|
refuseHost?: (host: string) => string | null;
|
|
133
144
|
}): {
|
|
134
145
|
ok: true;
|
|
135
|
-
capability:
|
|
146
|
+
capability: RegistrableCapability;
|
|
136
147
|
} | {
|
|
137
148
|
ok: false;
|
|
138
149
|
refusal: RowRefusal;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providerRegistry.d.ts","sourceRoot":"","sources":["../../src/internal/providerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,
|
|
1
|
+
{"version":3,"file":"providerRegistry.d.ts","sourceRoot":"","sources":["../../src/internal/providerRegistry.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAKL,KAAK,UAAU,EACf,KAAK,gBAAgB,EACtB,MAAM,mBAAmB,CAAC;AAQ3B,OAAO,EAIL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,2DAA2D;AAC3D,MAAM,WAAW,WAAW;IAC1B,EAAE,EAAE,MAAM,CAAC;IACX,gDAAgD;IAChD,IAAI,EAAE,OAAO,CAAC;IACd;;;;;OAKG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,uGAAuG;IACvG,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACxB,mCAAmC;IACnC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CACzB;AAED;;;;;;;;;GASG;AACH,wBAAgB,kBAAkB,CAAC,UAAU,EAAE,qBAAqB,GAAG,MAAM,CA2B5E;AAoBD,2EAA2E;AAC3E,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,qBAAqB,CAAC;IAClC,uEAAuE;IACvE,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;CACxB;AAED,MAAM,MAAM,cAAc,GACtB,uBAAuB,GACvB,kBAAkB,GAClB,uBAAuB,GACvB,uBAAuB,CAAC;AAE5B,mDAAmD;AACnD,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,cAAc,CAAC;IACrB,OAAO,EAAE,MAAM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24
|
import { isDevOnlyGatewaySetting, isInstallOwnedGatewaySetting, isReservedAppSecretName, isSettableGatewaySetting, } from "./gatewaySettings.js";
|
|
25
|
+
import { isSignInSettingName } from "./signInProviders.js";
|
|
25
26
|
import { describeSpecProblems, parseProviderSpec, PROVIDER_ID, } from "./providerSpec.js";
|
|
26
27
|
/**
|
|
27
28
|
* The part of a row a key is set for: its hosts, its host setting and its
|
|
28
29
|
* auth, as one canonical string (sorted keys, sorted hosts), so that
|
|
29
30
|
* replacing a row's hosts or auth changes the key and the value it held
|
|
30
|
-
* is no longer read until the operator sets it again.
|
|
31
|
+
* is no longer read until the operator sets it again. For an OAuth
|
|
32
|
+
* provider the client is bound to its authorize, token and revoke URLs,
|
|
33
|
+
* its API hosts, where the client goes on the token request and its
|
|
34
|
+
* client setting names (`oauth.client-bound-to-endpoints`): an admin who
|
|
35
|
+
* re-points `tokenUrl` has to paste the secret again.
|
|
31
36
|
*/
|
|
32
37
|
export function providerBindingKey(capability) {
|
|
33
|
-
|
|
38
|
+
if (capability.mode === "ai") {
|
|
39
|
+
// An `ai` row's key is bound to where the proxy sends it: its base URL and the key's placement.
|
|
40
|
+
return JSON.stringify({
|
|
41
|
+
kind: "ai",
|
|
42
|
+
auth: sortedAuth(capability.auth),
|
|
43
|
+
origin: capability.origin,
|
|
44
|
+
basePath: capability.basePath ?? null,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
if (capability.mode === "oauth_client") {
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
kind: "oauth2-user",
|
|
50
|
+
authorizeUrl: capability.flow.authorizeUrl,
|
|
51
|
+
tokenUrl: capability.flow.tokenUrl,
|
|
52
|
+
revokeUrl: capability.flow.revokeUrl ?? null,
|
|
53
|
+
inject: capability.flow.inject,
|
|
54
|
+
clientId: capability.secrets.clientId,
|
|
55
|
+
clientSecret: capability.secrets.clientSecret ?? null,
|
|
56
|
+
hosts: [...capability.api].sort(),
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
return JSON.stringify({
|
|
60
|
+
auth: sortedAuth(capability.auth),
|
|
61
|
+
hostSetting: capability.hostSetting ?? null,
|
|
62
|
+
hosts: [...capability.hosts].sort(),
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
/** An auth block with its keys sorted, one level down too, for a canonical key. */
|
|
66
|
+
function sortedAuth(auth) {
|
|
67
|
+
return Object.fromEntries(Object.entries(auth)
|
|
34
68
|
.sort(([a], [b]) => (a < b ? -1 : a > b ? 1 : 0))
|
|
35
69
|
.map(([field, value]) => [
|
|
36
70
|
field,
|
|
@@ -38,11 +72,6 @@ export function providerBindingKey(capability) {
|
|
|
38
72
|
? Object.fromEntries(Object.entries(value).sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0))
|
|
39
73
|
: value,
|
|
40
74
|
]));
|
|
41
|
-
return JSON.stringify({
|
|
42
|
-
auth,
|
|
43
|
-
hostSetting: capability.hostSetting ?? null,
|
|
44
|
-
hosts: [...capability.hosts].sort(),
|
|
45
|
-
});
|
|
46
75
|
}
|
|
47
76
|
/** The reserved app id no provider may take. */
|
|
48
77
|
const RESERVED_IDS = new Set(["everyapp"]);
|
|
@@ -116,6 +145,9 @@ export function rowSecretProblem(id, name, taken) {
|
|
|
116
145
|
if (isReservedAppSecretName(name)) {
|
|
117
146
|
return `${name} is a name everyapp sets itself`;
|
|
118
147
|
}
|
|
148
|
+
if (isSignInSettingName(name)) {
|
|
149
|
+
return `${name} is a sign-in provider's setting name (every <ID>_SIGNIN_<FIELD> name is the Gateway's, set with \`everyapp signin add\`)`;
|
|
150
|
+
}
|
|
119
151
|
if (isSettableGatewaySetting(name)) {
|
|
120
152
|
return `${name} is a Gateway setting another provider or the Gateway reads`;
|
|
121
153
|
}
|
|
@@ -143,7 +175,7 @@ export function checkProviderRow(id, capability, context) {
|
|
|
143
175
|
return { id, code: "PROVIDER_SECRET_TAKEN", message: problem };
|
|
144
176
|
}
|
|
145
177
|
}
|
|
146
|
-
for (const host of capability
|
|
178
|
+
for (const host of registrableHosts(capability)) {
|
|
147
179
|
const problem = publicHostProblem(host) ?? context.refuseHost?.(host);
|
|
148
180
|
if (problem) {
|
|
149
181
|
return { id, code: "PROVIDER_HOST_REFUSED", message: problem };
|
|
@@ -151,6 +183,37 @@ export function checkProviderRow(id, capability, context) {
|
|
|
151
183
|
}
|
|
152
184
|
return null;
|
|
153
185
|
}
|
|
186
|
+
/**
|
|
187
|
+
* Every host a row sends a secret to: an API-key provider's `hosts`; an
|
|
188
|
+
* OAuth provider's API hosts (the token), and its authorize, token and
|
|
189
|
+
* revoke hosts (the client). Each passes the row host rules.
|
|
190
|
+
*/
|
|
191
|
+
export function registrableHosts(capability) {
|
|
192
|
+
if (capability.mode === "api_key")
|
|
193
|
+
return [...capability.hosts];
|
|
194
|
+
if (capability.mode === "ai")
|
|
195
|
+
return [new URL(capability.origin).hostname.toLowerCase()];
|
|
196
|
+
const hosts = [...capability.api];
|
|
197
|
+
const urls = [
|
|
198
|
+
capability.flow.authorizeUrl,
|
|
199
|
+
capability.flow.tokenUrl,
|
|
200
|
+
capability.flow.revokeUrl,
|
|
201
|
+
capability.flow.identity?.url,
|
|
202
|
+
];
|
|
203
|
+
for (const url of urls) {
|
|
204
|
+
if (!url)
|
|
205
|
+
continue;
|
|
206
|
+
try {
|
|
207
|
+
const host = new URL(url).hostname.toLowerCase();
|
|
208
|
+
if (!hosts.includes(host))
|
|
209
|
+
hosts.push(host);
|
|
210
|
+
}
|
|
211
|
+
catch {
|
|
212
|
+
// The parser refused it already.
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
return hosts;
|
|
216
|
+
}
|
|
154
217
|
/** A row's spec parsed and checked: the capability, or the refusal. */
|
|
155
218
|
export function resolveProviderRow(row, context) {
|
|
156
219
|
let spec = row.spec;
|
|
@@ -6,30 +6,41 @@
|
|
|
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
|
-
import { type ApiKeyCapability } from "./capabilities.js";
|
|
23
|
+
import { type AiProviderCapability, type ApiKeyCapability, type OAuthClientCapability } from "./capabilities.js";
|
|
18
24
|
/** A provider id: lowercase, a letter first, 2 to 40 characters. */
|
|
19
25
|
export declare const PROVIDER_ID: RegExp;
|
|
20
26
|
/** A Gateway setting name a provider may hold: upper case, 3 to 64 characters. */
|
|
21
27
|
export declare const PROVIDER_SECRET_NAME: RegExp;
|
|
22
28
|
/** A bare lowercase host with at least one dot: labels of letters, digits and hyphens. */
|
|
23
29
|
export declare const PROVIDER_HOST: RegExp;
|
|
30
|
+
/** What an `ai` row serves by default: chat, and embeddings when it names an embeddings model. */
|
|
31
|
+
export declare const AI_SPEC_CHAT_ROUTE = "/v1/chat/completions";
|
|
32
|
+
export declare const AI_SPEC_EMBEDDINGS_ROUTE = "/v1/embeddings";
|
|
24
33
|
export interface ProviderSpecProblem {
|
|
25
34
|
/** Dotted: `auth.secret`, `hosts.1`, or `(root)`. */
|
|
26
35
|
path: string;
|
|
27
36
|
message: string;
|
|
28
37
|
}
|
|
38
|
+
/** What a row or a preset may be: an API key, an OAuth provider with a `flow`, or an OpenAI-compatible model provider. */
|
|
39
|
+
export type RegistrableCapability = ApiKeyCapability | OAuthClientCapability | AiProviderCapability;
|
|
29
40
|
export type ParsedProviderSpec = {
|
|
30
41
|
ok: true;
|
|
31
42
|
id: string;
|
|
32
|
-
capability:
|
|
43
|
+
capability: RegistrableCapability;
|
|
33
44
|
} | {
|
|
34
45
|
ok: false;
|
|
35
46
|
problems: ProviderSpecProblem[];
|
|
@@ -49,7 +60,7 @@ export declare function describeSpecProblems(problems: readonly ProviderSpecProb
|
|
|
49
60
|
* defaults the parser fills in spelled out, so `parseProviderSpec` of it
|
|
50
61
|
* gives the entry back.
|
|
51
62
|
*/
|
|
52
|
-
export declare function providerSpecOf(id: string, capability:
|
|
63
|
+
export declare function providerSpecOf(id: string, capability: RegistrableCapability): Record<string, unknown>;
|
|
53
64
|
/** The methods an app with `access: "write"` may use on `capability` besides its read methods. */
|
|
54
|
-
export declare function writeMethodsOf(capability:
|
|
65
|
+
export declare function writeMethodsOf(capability: RegistrableCapability): readonly string[];
|
|
55
66
|
//# sourceMappingURL=providerSpec.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"providerSpec.d.ts","sourceRoot":"","sources":["../../src/internal/providerSpec.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"providerSpec.d.ts","sourceRoot":"","sources":["../../src/internal/providerSpec.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAGL,KAAK,oBAAoB,EAEzB,KAAK,gBAAgB,EACrB,KAAK,qBAAqB,EAM3B,MAAM,mBAAmB,CAAC;AAO3B,oEAAoE;AACpE,eAAO,MAAM,WAAW,QAA2B,CAAC;AACpD,kFAAkF;AAClF,eAAO,MAAM,oBAAoB,QAA2B,CAAC;A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