@every-app/sdk 0.3.0-rc.11 → 0.3.0-rc.12

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.
Files changed (66) hide show
  1. package/README.md +6 -4
  2. package/dist/cloudflare/worker.d.ts +1 -1
  3. package/dist/cloudflare/worker.d.ts.map +1 -1
  4. package/dist/cloudflare/worker.js +1 -2
  5. package/dist/internal/aiDefault.d.ts +32 -76
  6. package/dist/internal/aiDefault.d.ts.map +1 -1
  7. package/dist/internal/aiDefault.js +41 -144
  8. package/dist/internal/appSettings.d.ts +14 -17
  9. package/dist/internal/appSettings.d.ts.map +1 -1
  10. package/dist/internal/appSettings.js +2 -16
  11. package/dist/internal/capabilities.d.ts +9 -8
  12. package/dist/internal/capabilities.d.ts.map +1 -1
  13. package/dist/internal/capabilities.js +2 -2
  14. package/dist/internal/catalog/commerce.js +1 -1
  15. package/dist/internal/gatewaySettings.d.ts +2 -2
  16. package/dist/internal/gatewaySettings.d.ts.map +1 -1
  17. package/dist/internal/gatewaySettings.js +0 -6
  18. package/dist/internal/protocol.d.ts +5 -24
  19. package/dist/internal/protocol.d.ts.map +1 -1
  20. package/dist/internal/protocol.js +0 -19
  21. package/dist/internal/remoteMcp.d.ts +4 -6
  22. package/dist/internal/remoteMcp.d.ts.map +1 -1
  23. package/dist/internal/remoteMcp.js +7 -10
  24. package/dist/internal/tools.d.ts +11 -7
  25. package/dist/internal/tools.d.ts.map +1 -1
  26. package/dist/internal/tools.js +8 -8
  27. package/dist/manifest.d.ts +9 -25
  28. package/dist/manifest.d.ts.map +1 -1
  29. package/dist/server/ai.d.ts +1 -93
  30. package/dist/server/ai.d.ts.map +1 -1
  31. package/dist/server/ai.js +17 -111
  32. package/dist/server/attribution.d.ts +1 -1
  33. package/dist/server/context.d.ts +12 -14
  34. package/dist/server/context.d.ts.map +1 -1
  35. package/dist/server/context.js +23 -25
  36. package/dist/server/everyApp.d.ts +4 -23
  37. package/dist/server/everyApp.d.ts.map +1 -1
  38. package/dist/server/everyApp.js +13 -46
  39. package/dist/server/gatewayFetch.d.ts +1 -1
  40. package/dist/server/gatewayFetch.js +1 -1
  41. package/dist/server/index.d.ts +3 -7
  42. package/dist/server/index.d.ts.map +1 -1
  43. package/dist/server/index.js +3 -7
  44. package/dist/server/integrationFetch.d.ts +1 -1
  45. package/dist/server/refusal.d.ts +0 -9
  46. package/dist/server/refusal.d.ts.map +1 -1
  47. package/dist/server/refusal.js +0 -22
  48. package/dist/server/tools.d.ts +11 -8
  49. package/dist/server/tools.d.ts.map +1 -1
  50. package/dist/server/tools.js +10 -4
  51. package/dist/server/toolsEndpoint.d.ts +2 -3
  52. package/dist/server/toolsEndpoint.d.ts.map +1 -1
  53. package/dist/server/toolsEndpoint.js +6 -11
  54. package/dist/testing/index.d.ts +2 -3
  55. package/dist/testing/index.d.ts.map +1 -1
  56. package/dist/testing/index.js +2 -6
  57. package/package.json +1 -1
  58. package/dist/server/aiBinding.d.ts +0 -68
  59. package/dist/server/aiBinding.d.ts.map +0 -1
  60. package/dist/server/aiBinding.js +0 -294
  61. package/dist/server/emailBinding.d.ts +0 -72
  62. package/dist/server/emailBinding.d.ts.map +0 -1
  63. package/dist/server/emailBinding.js +0 -124
  64. package/dist/server/fromMcpTools.d.ts +0 -89
  65. package/dist/server/fromMcpTools.d.ts.map +0 -1
  66. package/dist/server/fromMcpTools.js +0 -192
@@ -4,8 +4,8 @@
4
4
  * gateway's service binding and never public:
5
5
  *
6
6
  * POST /__everyapp/tools/list x-everyapp-system JWT (purpose "tools.list")
7
- * POST /__everyapp/tools/call x-everyapp-identity JWT, chan "mcp" or
8
- * "agent" + tc claim
7
+ * POST /__everyapp/tools/call x-everyapp-identity JWT, chan "mcp"
8
+ * + tc claim
9
9
  *
10
10
  * MCP itself (protocol eras, headers, envelopes) stays in the gateway; apps
11
11
  * only ever speak this small versioned JSON shape. Both sides import the
@@ -15,12 +15,14 @@ export const TOOLS_PROTOCOL_VERSION = 1;
15
15
  export const TOOLS_PATH_PREFIX = "/__everyapp/tools";
16
16
  export const TOOLS_LIST_PATH = `${TOOLS_PATH_PREFIX}/list`;
17
17
  export const TOOLS_CALL_PATH = `${TOOLS_PATH_PREFIX}/call`;
18
- export const TOOL_RISKS = ["read", "write", "destructive"];
19
- /** Scopes the gateway mints on tool-call identities (`chan: "mcp"` or `"agent"`), one per risk. */
18
+ /**
19
+ * A tool reads or writes. A write tool that deletes or can't be undone also
20
+ * says `destructiveHint` in its annotations, so clients ask before calling.
21
+ */
22
+ export const TOOL_RISKS = ["read", "write"];
23
+ /** Scopes the gateway mints on tool-call identities (`chan: "mcp"`), one per risk. */
20
24
  export const MCP_READ_SCOPE = "mcp:read";
21
25
  export const MCP_WRITE_SCOPE = "mcp:write";
22
- /** Never minted in v1: destructive tools are hidden until approvals exist. */
23
- export const MCP_DESTRUCTIVE_SCOPE = "mcp:destructive";
24
26
  /** Local tool names: lowercase snake_case, at most 48 characters. */
25
27
  export const TOOL_NAME_PATTERN = /^[a-z][a-z0-9_]{0,47}$/;
26
28
  export function isToolRisk(value) {
@@ -34,8 +36,6 @@ export function requiredScopeForRisk(risk) {
34
36
  return MCP_READ_SCOPE;
35
37
  case "write":
36
38
  return MCP_WRITE_SCOPE;
37
- case "destructive":
38
- return MCP_DESTRUCTIVE_SCOPE;
39
39
  }
40
40
  }
41
41
  /**
@@ -37,6 +37,13 @@ export interface EveryAppPublicRoute {
37
37
  readonly path: string;
38
38
  /** The methods it answers; `["GET"]` when left out. */
39
39
  readonly methods?: readonly string[];
40
+ /**
41
+ * A bearer route: a native app or a script reaches it with its Gateway
42
+ * token only, on every method (no `methods`). The Gateway answers 401 to
43
+ * a request carrying its session cookie there, and Cloudflare Access
44
+ * lets it through like any public route.
45
+ */
46
+ readonly bearer?: true;
40
47
  }
41
48
  /** A Durable Object or Workflow class: its binding, the class, and the helper Worker that defines it. */
42
49
  export interface EveryAppClassResource {
@@ -151,7 +158,7 @@ export interface EveryAppSettingEntry {
151
158
  /** One of the app's own secrets, with its need. */
152
159
  export interface EveryAppSecretEntry extends EveryAppSettingNeed {
153
160
  readonly name: string;
154
- /** Its guide in the everyapp skill (`"setup/main-secret.md"`). */
161
+ /** Its setup guide, a path in the app (`"docs/setup/main-secret.md"`). */
155
162
  readonly setup?: string;
156
163
  }
157
164
  /** `everyapp.config.ts`. */
@@ -163,8 +170,6 @@ export interface EveryAppManifest {
163
170
  readonly description?: string;
164
171
  /** The path of an SVG the app serves (`"/everyapp-icon.svg"`). */
165
172
  readonly icon?: string;
166
- /** Legacy: the entry comes from `cloudflare.config.ts`. */
167
- readonly main?: string;
168
173
  /** YYYY-MM-DD. */
169
174
  readonly compatibilityDate?: string;
170
175
  readonly resources?: EveryAppResources;
@@ -187,18 +192,6 @@ export interface EveryAppManifest {
187
192
  * OG image): path patterns, GET and HEAD, never Worker code.
188
193
  */
189
194
  readonly publicAssets?: readonly string[];
190
- /**
191
- * Routes a bearer client (a native app, a script with a personal token)
192
- * reaches with its token only: `paths` in `public`'s glob syntax, every
193
- * method, and `why` the app needs them, shown to the operator. The
194
- * Gateway answers 401 to a request carrying its session cookie there,
195
- * and `everyapp access on` lets these paths through Cloudflare Access.
196
- * Default: none.
197
- */
198
- readonly bearerRoutes?: {
199
- readonly paths: readonly string[];
200
- readonly why: string;
201
- };
202
195
  /** AI providers the Gateway calls for the app, by id or with their need. */
203
196
  readonly providers?: readonly (string | (EveryAppSettingNeed & {
204
197
  readonly id: string;
@@ -216,7 +209,7 @@ export interface EveryAppManifest {
216
209
  readonly models?: readonly string[];
217
210
  /** OpenAI API paths beyond inference (`"/v1/files"`). */
218
211
  readonly routes?: readonly string[];
219
- /** The app takes the Gateway's default chat model (`ai()`). */
212
+ /** The app takes the workspace's default chat model (`/api/ai/default`, `aiBaseUrl()`). */
220
213
  readonly chat?: boolean | EveryAppSettingNeed;
221
214
  };
222
215
  /** `inbound: true`: the Worker exports an `email()` handler. */
@@ -225,14 +218,10 @@ export interface EveryAppManifest {
225
218
  };
226
219
  /** Who can open the app once registered; `"admins"` by default. */
227
220
  readonly access?: "everyone" | "admins";
228
- readonly serverFnGuard?: boolean;
229
- readonly serverFnBase?: string;
230
221
  /** Shell command that builds the app; `cf build` by default. */
231
222
  readonly build?: string;
232
223
  /** Shell command `everyapp dev` starts; it must listen on PORT. */
233
224
  readonly dev?: string;
234
- /** Legacy: the port comes from PORT. */
235
- readonly devPort?: number;
236
225
  /** Dependency install command; false skips it. */
237
226
  readonly install?: false | string;
238
227
  readonly migrations?: {
@@ -242,11 +231,6 @@ export interface EveryAppManifest {
242
231
  readonly config?: string;
243
232
  readonly binding?: string;
244
233
  };
245
- /** Who answers `/mcp` on the app's own host, and why it needs to. */
246
- readonly mcp?: {
247
- readonly by: "gateway" | "app";
248
- readonly why: string;
249
- };
250
234
  /**
251
235
  * The Gateway events the app receives at `everyApp(handler, { events: {
252
236
  * on } })`: types or patterns from `member.*` (but `member.password_reset`),
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.ts","sourceRoot":"","sources":["../src/manifest.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAEH,yFAAyF;AACzF,MAAM,WAAW,mBAAmB;IAClC,yEAAyE;IACzE,QAAQ,CAAC,GAAG,CAAC,EAAE,MAAM,CAAC;IACtB,kEAAkE;IAClE,QAAQ,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC;IACvB,2EAA2E;IAC3E,QAAQ,CAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;IAC5B,4DAA4D;IAC5D,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,oDAAoD;AACpD,MAAM,WAAW,mBAAmB;IAClC,gEAAgE;IAChE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,uDAAuD;IACvD,QAAQ,CAAC,OAAO,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;CACtC;AAED,yGAAyG;AACzG,MAAM,WAAW,qBAAqB;IACpC,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/**
2
- * `ai()`: the Gateway's default chat model for an app that needs "a model"
3
- * rather than one provider (docs/design/2026-10-model-providers.md). The
4
- * manifest says `ai: { chat: true }` (or `{ chat: { why } }`); the Gateway's
5
- * operator decides which provider and model that is (`everyapp ai
6
- * default`, else OpenRouter → Workers AI → OpenAI → …, the first with its
7
- * key set), and the app never names either: it sends OpenAI-shaped chat
8
- * completions (and embeddings) to `/api/ai/default/v1/…` with `model:
9
- * "default"` or no model at all, and the Gateway fills the model in.
10
- *
11
- * An OpenAI client takes `baseURL` and `fetch` as they are:
12
- *
13
- * const { baseURL, fetch, model } = ai({ env, for: request });
14
- * const client = new OpenAI({ baseURL, fetch, apiKey: "gateway-managed" });
15
- * await client.chat.completions.create({ model, messages });
16
- *
17
- * In local development with no Gateway, the developer's own key in
18
- * `.dev.vars` decides the provider by the same order (createGatewayFetch's
19
- * fallback). An app that needs one provider in particular keeps listing it
20
- * under `providers` and calling `/api/ai/<provider>/…`.
21
- */
22
- import { AI_DEFAULT_MODEL } from "../internal/index.js";
23
- import { type GatewayCallFor } from "./attribution.js";
24
- import { type CreateGatewayFetchOptions } from "./gatewayFetch.js";
25
- import type { SetupInfo } from "./refusal.js";
26
- export interface AiClient {
27
- /** `http://every-app-gateway.internal/api/ai/default/v1`: an OpenAI client's base URL. */
28
- baseURL: string;
29
- /** The fetch that reaches the Gateway (or, in dev, the provider directly). */
30
- fetch: typeof fetch;
31
- /** The model name that means "whatever the Gateway's default is": `default`. */
32
- model: typeof AI_DEFAULT_MODEL;
33
- /** The default route's chat completions URL, for a plain `fetch`. */
34
- chatCompletionsUrl: string;
35
- /** The default route's embeddings URL, for a plain `fetch`. */
36
- embeddingsUrl: string;
37
- }
38
- /** The base URL of the default route, as the SDK and the docs name it. */
39
- export declare const AI_DEFAULT_BASE_URL = "http://every-app-gateway.internal/api/ai/default/v1";
40
- /**
41
- * The Gateway's default chat model as a client: a base URL, a fetch and
42
- * the model name to send. Throws `ConfigurationError` where
43
- * `createGatewayFetch` does (no binding and no dev key) and
44
- * `AttributionError` where a shared app's call says nobody's.
45
- */
46
- export declare function ai(options: CreateGatewayFetchOptions & {
47
- optional: true;
48
- }): AiClient | null;
49
- export declare function ai(options: CreateGatewayFetchOptions): AiClient;
50
- /** Whether model calls to a provider (or the default) would go through. */
51
- export interface AiStatus extends SetupInfo {
52
- /** The id asked about: `default`, or a provider's (`openrouter`, `workers-ai`, …). */
53
- provider: string;
54
- /** The manifest asks for it: `ai.chat` for `default`, else `providers`. */
55
- requested: boolean;
56
- /** The Gateway (in local dev, `.dev.vars`) holds every setting it needs. */
57
- configured: boolean;
58
- /** Calls would go through. */
59
- ready: boolean;
60
- /**
61
- * For `default`: the provider and model calls go to now, or null while
62
- * none is configured. Null for a named provider.
63
- */
64
- resolved: {
65
- provider: string;
66
- label: string;
67
- model: string;
68
- } | null;
69
- }
70
- /**
71
- * Whether the app can use a model right now, without calling one: gate
72
- * an AI feature and show `setup` ("A chat model isn't set up on this
73
- * Gateway: it needs OPENROUTER_API_KEY. An admin runs: pnpm everyapp
74
- * configure inbox") up front instead of failing mid-task. `provider`
75
- * defaults to `default`, the Gateway's default model (`ai: { chat: true }`);
76
- * name one the manifest lists under `providers` to ask about it instead.
77
- * The Gateway owns the wording: show `setup` and `command` as they are.
78
- *
79
- * Over the binding it sends `GET /api/ai/<provider>`; in local dev it
80
- * answers from `.dev.vars` by the same rule `createGatewayFetch()` uses.
81
- */
82
- export declare function aiStatus({ env, provider, for: explicitTarget, }: {
83
- env: object;
84
- provider?: string;
85
- /**
86
- * Whom the status is for: the default resolves on that organization's
87
- * choice (`everyapp ai default`). Left out, the request `everyApp()` is
88
- * serving or the organization `withOrganization()` named, as on every
89
- * call.
90
- */
91
- for?: GatewayCallFor;
92
- }): Promise<AiStatus>;
93
1
  /**
94
2
  * A provider's root behind the Gateway, `http://every-app-gateway.internal/api/ai/<provider>`:
95
3
  * join the provider's own paths onto it (`/api/v1/chat/completions` for
@@ -100,7 +8,7 @@ export declare function providerBaseUrl(provider: string): string;
100
8
  /**
101
9
  * The OpenAI-compatible base URL of `provider` behind the Gateway, for an
102
10
  * OpenAI client's `baseURL` (with `fetch: createGatewayFetch(...)`):
103
- * `default` (the default) is {@link AI_DEFAULT_BASE_URL},
11
+ * `default` (the default, and what it is when left out) is
104
12
  * `…/api/ai/default/v1`; a catalog provider's is its root and the prefix
105
13
  * of its chat route (`…/api/ai/openrouter/api/v1`, `…/api/ai/workers-ai/v1`,
106
14
  * `…/api/ai/openai/v1`). Throws `ConfigurationError` for a provider with
@@ -1 +1 @@
1
- {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/server/ai.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,OAAO,EACL,gBAAgB,EAOjB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAIL,KAAK,yBAAyB,EAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE9C,MAAM,WAAW,QAAQ;IACvB,0FAA0F;IAC1F,OAAO,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,KAAK,EAAE,OAAO,KAAK,CAAC;IACpB,gFAAgF;IAChF,KAAK,EAAE,OAAO,gBAAgB,CAAC;IAC/B,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,+DAA+D;IAC/D,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,0EAA0E;AAC1E,eAAO,MAAM,mBAAmB,wDAAuD,CAAC;AAExF;;;;;GAKG;AACH,wBAAgB,EAAE,CAChB,OAAO,EAAE,yBAAyB,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GACtD,QAAQ,GAAG,IAAI,CAAC;AACnB,wBAAgB,EAAE,CAAC,OAAO,EAAE,yBAAyB,GAAG,QAAQ,CAAC;AAajE,2EAA2E;AAC3E,MAAM,WAAW,QAAS,SAAQ,SAAS;IACzC,sFAAsF;IACtF,QAAQ,EAAE,MAAM,CAAC;IACjB,2EAA2E;IAC3E,SAAS,EAAE,OAAO,CAAC;IACnB,4EAA4E;IAC5E,UAAU,EAAE,OAAO,CAAC;IACpB,8BAA8B;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf;;;OAGG;IACH,QAAQ,EAAE;QAAE,QAAQ,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAC;QAAC,KAAK,EAAE,MAAM,CAAA;KAAE,GAAG,IAAI,CAAC;CACrE;AAED;;;;;;;;;;;GAWG;AACH,wBAAsB,QAAQ,CAAC,EAC7B,GAAG,EACH,QAA8B,EAC9B,GAAG,EAAE,cAAc,GACpB,EAAE;IACD,GAAG,EAAE,MAAM,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;;;OAKG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;CACtB,GAAG,OAAO,CAAC,QAAQ,CAAC,CA+EpB;AAID;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,QAAQ,GAAE,MAA4B,GAAG,MAAM,CAaxE"}
1
+ {"version":3,"file":"ai.d.ts","sourceRoot":"","sources":["../../src/server/ai.ts"],"names":[],"mappings":"AA2BA;;;;;GAKG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,QAAQ,GAAE,MAA4B,GAAG,MAAM,CAaxE"}
package/dist/server/ai.js CHANGED
@@ -1,116 +1,22 @@
1
1
  /**
2
- * `ai()`: the Gateway's default chat model for an app that needs "a model"
3
- * rather than one provider (docs/design/2026-10-model-providers.md). The
4
- * manifest says `ai: { chat: true }` (or `{ chat: { why } }`); the Gateway's
5
- * operator decides which provider and model that is (`everyapp ai
6
- * default`, else OpenRouter → Workers AI → OpenAI → …, the first with its
7
- * key set), and the app never names either: it sends OpenAI-shaped chat
8
- * completions (and embeddings) to `/api/ai/default/v1/…` with `model:
9
- * "default"` or no model at all, and the Gateway fills the model in.
2
+ * Where an app's model calls go behind the Gateway, for an OpenAI client's
3
+ * `baseURL` or a plain `fetch`, both sent with `createGatewayFetch()`:
4
+ * `aiBaseUrl("openai")` (a provider's OpenAI-compatible base), `aiBaseUrl()`
5
+ * (the Gateway's default model, `ai: { chat: true }`: send `model:
6
+ * "default"` or none and the Gateway fills in the workspace's model), and
7
+ * `providerBaseUrl("openai")` (a provider's root, for its own paths).
10
8
  *
11
- * An OpenAI client takes `baseURL` and `fetch` as they are:
12
- *
13
- * const { baseURL, fetch, model } = ai({ env, for: request });
14
- * const client = new OpenAI({ baseURL, fetch, apiKey: "gateway-managed" });
15
- * await client.chat.completions.create({ model, messages });
16
- *
17
- * In local development with no Gateway, the developer's own key in
18
- * `.dev.vars` decides the provider by the same order (createGatewayFetch's
19
- * fallback). An app that needs one provider in particular keeps listing it
20
- * under `providers` and calling `/api/ai/<provider>/…`.
9
+ * const client = new OpenAI({
10
+ * baseURL: aiBaseUrl(),
11
+ * fetch: createGatewayFetch({ env }),
12
+ * apiKey: "gateway-managed",
13
+ * });
14
+ * await client.chat.completions.create({ model: "default", messages });
21
15
  */
22
- import { AI_DEFAULT_MODEL, AI_DEFAULT_PROVIDER, CATALOG, ConfigurationError, aiProviderSettings, devAiProvider, resolveAiDefault, } from "../internal/index.js";
23
- import { applyAttribution, attributionFor, } from "./attribution.js";
24
- import { BINDING_ORIGIN, createGatewayFetch, gatewayBinding, } from "./gatewayFetch.js";
25
- /** The base URL of the default route, as the SDK and the docs name it. */
26
- export const AI_DEFAULT_BASE_URL = `${BINDING_ORIGIN}/api/ai/${AI_DEFAULT_PROVIDER}/v1`;
27
- export function ai(options) {
28
- const fetch = createGatewayFetch(options);
29
- if (!fetch)
30
- return null;
31
- return {
32
- baseURL: AI_DEFAULT_BASE_URL,
33
- fetch,
34
- model: AI_DEFAULT_MODEL,
35
- chatCompletionsUrl: `${AI_DEFAULT_BASE_URL}/chat/completions`,
36
- embeddingsUrl: `${AI_DEFAULT_BASE_URL}/embeddings`,
37
- };
38
- }
39
- /**
40
- * Whether the app can use a model right now, without calling one: gate
41
- * an AI feature and show `setup` ("A chat model isn't set up on this
42
- * Gateway: it needs OPENROUTER_API_KEY. An admin runs: pnpm everyapp
43
- * configure inbox") up front instead of failing mid-task. `provider`
44
- * defaults to `default`, the Gateway's default model (`ai: { chat: true }`);
45
- * name one the manifest lists under `providers` to ask about it instead.
46
- * The Gateway owns the wording: show `setup` and `command` as they are.
47
- *
48
- * Over the binding it sends `GET /api/ai/<provider>`; in local dev it
49
- * answers from `.dev.vars` by the same rule `createGatewayFetch()` uses.
50
- */
51
- export async function aiStatus({ env, provider = AI_DEFAULT_PROVIDER, for: explicitTarget, }) {
52
- const target = attributionFor(env, explicitTarget, "aiStatus");
53
- const values = env;
54
- const binding = gatewayBinding(env);
55
- const unavailable = {
56
- provider,
57
- requested: false,
58
- configured: false,
59
- ready: false,
60
- resolved: null,
61
- settings: [],
62
- setup: null,
63
- command: null,
64
- };
65
- if (binding && typeof binding.fetch === "function") {
66
- const headers = new Headers();
67
- if (target !== undefined)
68
- applyAttribution(headers, target);
69
- const response = await binding.fetch(`${BINDING_ORIGIN}/api/ai/${encodeURIComponent(provider)}`, { headers });
70
- if (!response.ok)
71
- return unavailable;
72
- const body = (await response.json());
73
- return {
74
- ...unavailable,
75
- ...body,
76
- provider,
77
- settings: Array.isArray(body.settings) ? body.settings : [],
78
- setup: typeof body.setup === "string" ? body.setup : null,
79
- command: typeof body.command === "string" ? body.command : null,
80
- resolved: body.resolved ?? null,
81
- };
82
- }
83
- if (!values["EVERYAPP_DEV"])
84
- return unavailable;
85
- const isSet = (name) => typeof values[name] === "string" && values[name].trim() !== "";
86
- const dev = (label, settings, configured, resolved, also = "") => ({
87
- provider,
88
- requested: true,
89
- configured,
90
- ready: configured,
91
- resolved,
92
- settings: configured ? [] : [...settings],
93
- setup: configured
94
- ? null
95
- : `${label} isn't set up for local development: set ${settings.join(" and ")}${also} in .dev.vars.`,
96
- command: null,
97
- });
98
- if (provider === AI_DEFAULT_PROVIDER) {
99
- const resolution = resolveAiDefault({ provider: null, isSet });
100
- return dev("A chat model", resolution.settings, resolution.configured, resolution.configured
101
- ? {
102
- provider: resolution.provider,
103
- label: resolution.label,
104
- model: resolution.model,
105
- }
106
- : null, " (or another model provider's key)");
107
- }
108
- const spec = devAiProvider(provider);
109
- if (!spec)
110
- return unavailable;
111
- const settings = aiProviderSettings(spec);
112
- return dev(CATALOG.get(provider)?.label ?? provider, settings, settings.every(isSet), null);
113
- }
16
+ import { AI_DEFAULT_PROVIDER, CATALOG, ConfigurationError, } from "../internal/index.js";
17
+ import { BINDING_ORIGIN } from "./gatewayFetch.js";
18
+ /** The base URL of the default route, `…/api/ai/default/v1`. */
19
+ const AI_DEFAULT_BASE_URL = `${BINDING_ORIGIN}/api/ai/${AI_DEFAULT_PROVIDER}/v1`;
114
20
  const CHAT_COMPLETIONS = "/chat/completions";
115
21
  /**
116
22
  * A provider's root behind the Gateway, `http://every-app-gateway.internal/api/ai/<provider>`:
@@ -124,7 +30,7 @@ export function providerBaseUrl(provider) {
124
30
  /**
125
31
  * The OpenAI-compatible base URL of `provider` behind the Gateway, for an
126
32
  * OpenAI client's `baseURL` (with `fetch: createGatewayFetch(...)`):
127
- * `default` (the default) is {@link AI_DEFAULT_BASE_URL},
33
+ * `default` (the default, and what it is when left out) is
128
34
  * `…/api/ai/default/v1`; a catalog provider's is its root and the prefix
129
35
  * of its chat route (`…/api/ai/openrouter/api/v1`, `…/api/ai/workers-ai/v1`,
130
36
  * `…/api/ai/openai/v1`). Throws `ConfigurationError` for a provider with
@@ -2,7 +2,7 @@
2
2
  * Whom a call through the gateway is for, which decides the organization
3
3
  * it counts against. Left out, it comes from the request context: the
4
4
  * request `everyApp()` is serving (its person, while the identity is good),
5
- * or the organization `withOrganization()` named. Given explicitly:
5
+ * or the organization the SDK's event delivery runs under. Given explicitly:
6
6
  *
7
7
  * - the inbound `Request`: its person, by the identity the gateway put on
8
8
  * it (forwarded as is);
@@ -14,9 +14,9 @@ export interface ServedRequest {
14
14
  */
15
15
  export declare const IDENTITY_EXPIRY_MARGIN_MS = 15000;
16
16
  /**
17
- * Code `request_context_missing`: `currentUser()` or a Gateway call with
18
- * no `for`, outside any request `everyApp()` serves and outside
19
- * `withOrganization()`. Work no request started names its organization.
17
+ * Code `request_context_missing`: a Gateway call with no `for`, outside
18
+ * any request `everyApp()` serves. Work no request started passes
19
+ * `for: { background: true }`.
20
20
  */
21
21
  export declare class RequestContextError extends Error {
22
22
  readonly code = "request_context_missing";
@@ -35,20 +35,18 @@ export declare function serveRequest<T>(served: ServedRequest, fn: () => T): T;
35
35
  /**
36
36
  * Run `fn` as `organizationId`'s background work: every Gateway call made
37
37
  * inside it (and in what it awaits or schedules) is that organization's,
38
- * with no person behind it. For a Workflow step, a cron, a queue consumer or
39
- * a Durable Object alarm, which no request started. An organization's own
40
- * app names its own (`env.EVERY_APP_ORG_ID`); a shared app's Worker names
41
- * the one the work is for. Inside a request another organization's person
42
- * is driving, it throws {@link OrganizationMismatchError}; inside that
43
- * organization's own request, the person stays attributed while their
44
- * identity is good.
38
+ * with no person behind it. The SDK's event delivery (eventsEndpoint.ts)
39
+ * runs the app's `events.on` under it; apps pass `for` instead. Inside a
40
+ * request another organization's person is driving, it throws
41
+ * {@link OrganizationMismatchError}; inside that organization's own
42
+ * request, the person stays attributed while their identity is good.
45
43
  */
46
44
  export declare function withOrganization<T>(organizationId: string, fn: () => T): T;
47
45
  /**
48
- * The verified user of the request being served: an `EveryAppUser`, or
49
- * `null` on a public route and inside `withOrganization()`'s background
50
- * work. Throws {@link RequestContextError} outside both: there is no one
51
- * to be, and a handler that isn't under `everyApp()` is a bug.
46
+ * The verified user of the request being served (`everyApp()` reads it to
47
+ * reuse one verification): an `EveryAppUser`, or `null` on a public route
48
+ * and inside `withOrganization()`'s background work. Throws
49
+ * {@link RequestContextError} outside both.
52
50
  */
53
51
  export declare function currentUser(): EveryAppUser | null;
54
52
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/server/context.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,wEAAwE;IACxE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAUD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,6BAA6B;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,uCAAuC;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAErE;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAc1E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,YAAY,GAAG,IAAI,CAQjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAmB,GACvB,OAAO,GAAG;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAoBrE"}
1
+ {"version":3,"file":"context.d.ts","sourceRoot":"","sources":["../../src/server/context.ts"],"names":[],"mappings":"AAmBA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,2DAA2D;AAC3D,MAAM,WAAW,aAAa;IAC5B,OAAO,EAAE,OAAO,CAAC;IACjB,oDAAoD;IACpD,IAAI,EAAE,YAAY,GAAG,IAAI,CAAC;IAC1B,wEAAwE;IACxE,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAUD;;;;GAIG;AACH,eAAO,MAAM,yBAAyB,QAAS,CAAC;AAEhD;;;;GAIG;AACH,qBAAa,mBAAoB,SAAQ,KAAK;IAC5C,QAAQ,CAAC,IAAI,6BAA6B;gBAC9B,OAAO,EAAE,MAAM;CAI5B;AAED;;;GAGG;AACH,qBAAa,yBAA0B,SAAQ,KAAK;IAClD,QAAQ,CAAC,IAAI,uCAAuC;gBACxC,OAAO,EAAE,MAAM;CAI5B;AAED,uEAAuE;AACvE,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,aAAa,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAErE;AAED;;;;;;;;GAQG;AACH,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,cAAc,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,CAAC,GAAG,CAAC,CAc1E;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,IAAI,YAAY,GAAG,IAAI,CAQjD;AAED;;;;;;;;;GASG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,MAAM,EACZ,GAAG,GAAE,MAAmB,GACvB,OAAO,GAAG;IAAE,UAAU,EAAE,IAAI,CAAC;IAAC,cAAc,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAoBrE"}
@@ -4,17 +4,17 @@
4
4
  * `AsyncLocalStorage`, which every Every App Worker has (`nodejs_compat`).
5
5
  *
6
6
  * `everyApp()` opens it around the handler and around each tool call, with
7
- * the verified user and the request the Gateway forwarded. Deeper in the
8
- * app, `currentUser()` reads the user without the request, and every call
9
- * back to the Gateway (`integrationFetch`, `ai`, `sendEmail`, `emit`, ...)
10
- * is attributed to that person without a `for`.
7
+ * the verified user and the request the Gateway forwarded. Every call back
8
+ * to the Gateway made inside it (`integrationFetch`, `sendEmail`, `emit`,
9
+ * ...) is attributed to that person without a `for`.
11
10
  *
12
11
  * Work no request started (a cron, a Workflow step, a queue consumer, a
13
- * Durable Object alarm) has no context of its own: it runs under
14
- * `withOrganization(organizationId, fn)`, which makes every Gateway call
15
- * inside it that organization's background work. A Gateway call with
16
- * neither is refused before it is made ({@link RequestContextError}): the
17
- * SDK never acts as nobody.
12
+ * Durable Object alarm) has no context of its own: it says whom each call
13
+ * is for, `for: { background: true }` (a shared app's Worker adds the
14
+ * `organizationId`). The SDK's own event delivery runs its handler under
15
+ * `withOrganization()`, which does the same for every call inside it. A
16
+ * Gateway call with neither is refused before it is made
17
+ * ({@link RequestContextError}): the SDK never acts as nobody.
18
18
  */
19
19
  import { AsyncLocalStorage } from "node:async_hooks";
20
20
  const scopes = new AsyncLocalStorage();
@@ -25,9 +25,9 @@ const scopes = new AsyncLocalStorage();
25
25
  */
26
26
  export const IDENTITY_EXPIRY_MARGIN_MS = 15_000;
27
27
  /**
28
- * Code `request_context_missing`: `currentUser()` or a Gateway call with
29
- * no `for`, outside any request `everyApp()` serves and outside
30
- * `withOrganization()`. Work no request started names its organization.
28
+ * Code `request_context_missing`: a Gateway call with no `for`, outside
29
+ * any request `everyApp()` serves. Work no request started passes
30
+ * `for: { background: true }`.
31
31
  */
32
32
  export class RequestContextError extends Error {
33
33
  code = "request_context_missing";
@@ -54,13 +54,11 @@ export function serveRequest(served, fn) {
54
54
  /**
55
55
  * Run `fn` as `organizationId`'s background work: every Gateway call made
56
56
  * inside it (and in what it awaits or schedules) is that organization's,
57
- * with no person behind it. For a Workflow step, a cron, a queue consumer or
58
- * a Durable Object alarm, which no request started. An organization's own
59
- * app names its own (`env.EVERY_APP_ORG_ID`); a shared app's Worker names
60
- * the one the work is for. Inside a request another organization's person
61
- * is driving, it throws {@link OrganizationMismatchError}; inside that
62
- * organization's own request, the person stays attributed while their
63
- * identity is good.
57
+ * with no person behind it. The SDK's event delivery (eventsEndpoint.ts)
58
+ * runs the app's `events.on` under it; apps pass `for` instead. Inside a
59
+ * request another organization's person is driving, it throws
60
+ * {@link OrganizationMismatchError}; inside that organization's own
61
+ * request, the person stays attributed while their identity is good.
64
62
  */
65
63
  export function withOrganization(organizationId, fn) {
66
64
  if (typeof organizationId !== "string" || organizationId.trim() === "") {
@@ -74,15 +72,15 @@ export function withOrganization(organizationId, fn) {
74
72
  return scopes.run({ ...parent, organizationId }, fn);
75
73
  }
76
74
  /**
77
- * The verified user of the request being served: an `EveryAppUser`, or
78
- * `null` on a public route and inside `withOrganization()`'s background
79
- * work. Throws {@link RequestContextError} outside both: there is no one
80
- * to be, and a handler that isn't under `everyApp()` is a bug.
75
+ * The verified user of the request being served (`everyApp()` reads it to
76
+ * reuse one verification): an `EveryAppUser`, or `null` on a public route
77
+ * and inside `withOrganization()`'s background work. Throws
78
+ * {@link RequestContextError} outside both.
81
79
  */
82
80
  export function currentUser() {
83
81
  const scope = scopes.getStore();
84
82
  if (!scope) {
85
- throw new RequestContextError("currentUser() was called outside a request everyApp() serves and outside withOrganization(): there is no user here.");
83
+ throw new RequestContextError("currentUser() was called outside a request everyApp() serves: there is no user here.");
86
84
  }
87
85
  return scope.served?.user ?? null;
88
86
  }
@@ -99,7 +97,7 @@ export function currentUser() {
99
97
  export function attributionFromContext(what, now = Date.now()) {
100
98
  const scope = scopes.getStore();
101
99
  if (!scope) {
102
- throw new RequestContextError(`${what} was called with no \`for\`, outside a request everyApp() serves and outside withOrganization(): the call would be nobody's. Pass for: request, or run the work under withOrganization(organizationId, fn).`);
100
+ throw new RequestContextError(`${what} was called with no \`for\`, outside a request everyApp() serves: the call would be nobody's. Pass for: request, or for: { background: true } for work no request started (a cron, a Workflow step, a queue consumer).`);
103
101
  }
104
102
  const served = scope.served;
105
103
  if (served?.user) {
@@ -17,19 +17,18 @@
17
17
  * event sink's deliveries (`/__everyapp/events`) for `events: { on }`.
18
18
  *
19
19
  * Around the handler and around each tool call it opens the request
20
- * context (context.ts): `currentUser()` reads the user anywhere below, and
21
- * every call back to the Gateway is attributed to the request without a
22
- * `for`. A deployed Worker is pinned to its organization
20
+ * context (context.ts): every call back to the Gateway is attributed to
21
+ * the request without a `for`. A deployed Worker is pinned to its organization
23
22
  * (`EVERY_APP_ORG_ID`), and an identity for any other is refused on both
24
23
  * paths. The response leaves without `Set-Cookie`: the perimeter strips
25
24
  * every `Cookie` before a request reaches the app, so a cookie the app's
26
25
  * framework sets could never come back, and one named like the Gateway's
27
26
  * session cookie would lock the person out of the app host.
28
27
  */
29
- import { ConfigurationError, IdentityError, isAdmin, isAgentCall, type EveryAppUser, type IdentityResult, type OrgRole } from "../internal/index.js";
28
+ import { ConfigurationError, isAdmin, type EveryAppUser, type IdentityResult, type OrgRole } from "../internal/index.js";
30
29
  import type { ToolSet } from "./tools.js";
31
30
  import { type AppEventsOptions } from "./eventsEndpoint.js";
32
- export { ConfigurationError, IdentityError, isAdmin, isAgentCall };
31
+ export { ConfigurationError, isAdmin };
33
32
  export type { EveryAppUser, IdentityResult, OrgRole };
34
33
  /**
35
34
  * The runtime's `ExecutionContext`, which `everyApp()` passes to the handler
@@ -38,10 +37,6 @@ export type { EveryAppUser, IdentityResult, OrgRole };
38
37
  * `fetch` themselves pass a stub cast to it.
39
38
  */
40
39
  export type ExecutionContextLike = ExecutionContext;
41
- export interface EveryAppManifestLike {
42
- id: string;
43
- [key: string]: unknown;
44
- }
45
40
  export interface EveryAppOptions<TEnv = Record<string, unknown>> {
46
41
  /** Optional expected issuer (gateway URL). Defaults to env.EVERYAPP_IDENTITY_ISSUER when set. */
47
42
  issuer?: string;
@@ -83,7 +78,6 @@ interface EveryAppExport<TEnv, TCtx extends ExecutionContextLike> {
83
78
  * (a framework that hands out headers alone needs no made-up Request).
84
79
  * Answers from the request context or the per-request cache first, then
85
80
  * verifies the identity headers from the audience and public keys in env.
86
- * Inside a handler `everyApp()` serves, `currentUser()` is the shorter way.
87
81
  */
88
82
  export declare function getEveryAppUser(request: Request | Headers, env: object): Promise<EveryAppUser | null>;
89
83
  /**
@@ -91,20 +85,7 @@ export declare function getEveryAppUser(request: Request | Headers, env: object)
91
85
  * everyApp() when the request is public or unauthenticated.
92
86
  */
93
87
  export declare function requireEveryAppUser(request: Request | Headers, env: object): Promise<EveryAppUser>;
94
- /**
95
- * The user of the request being served (`currentUser()`), or throw the
96
- * same 401 JSON Response as `requireEveryAppUser()` on a public route.
97
- * Outside a request (`withOrganization()` work, a handler not under
98
- * `everyApp()`) it throws `RequestContextError`, as `currentUser()` does.
99
- */
100
- export declare function requireCurrentUser(): EveryAppUser;
101
88
  export declare function hasScope(user: EveryAppUser, scope: string): boolean;
102
89
  /** Wrap a Worker fetch handler with Every App identity verification. */
103
90
  export declare function everyApp<TEnv = Record<string, unknown>, TCtx extends ExecutionContextLike = ExecutionContext>(handler: EveryAppHandler<TEnv, TCtx>, options?: EveryAppOptions<TEnv>): EveryAppExport<TEnv, TCtx>;
104
- /**
105
- * @deprecated Drop the manifest: the app id now comes from
106
- * `env.EVERYAPP_APP_ID` and the audience from `env.EVERYAPP_AUDIENCE`.
107
- * When passed, it must match the app id.
108
- */
109
- export declare function everyApp<TEnv = Record<string, unknown>, TCtx extends ExecutionContextLike = ExecutionContext>(handler: EveryAppHandler<TEnv, TCtx>, manifest: EveryAppManifestLike | undefined, options?: EveryAppOptions<TEnv>): EveryAppExport<TEnv, TCtx>;
110
91
  //# sourceMappingURL=everyApp.d.ts.map