@every-app/sdk 0.3.0-rc.2 → 0.3.0-rc.4

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 (110) hide show
  1. package/README.md +1 -1
  2. package/dist/cloudflare/index.d.ts +2 -2
  3. package/dist/cloudflare/index.d.ts.map +1 -1
  4. package/dist/cloudflare/index.js +1 -1
  5. package/dist/cloudflare/sentinel.d.ts +57 -2
  6. package/dist/cloudflare/sentinel.d.ts.map +1 -1
  7. package/dist/cloudflare/sentinel.js +27 -2
  8. package/dist/cloudflare/worker.d.ts +297 -5
  9. package/dist/cloudflare/worker.d.ts.map +1 -1
  10. package/dist/cloudflare/worker.js +279 -12
  11. package/dist/dev/index.d.ts +1 -1
  12. package/dist/dev/index.d.ts.map +1 -1
  13. package/dist/dev/index.js +1 -1
  14. package/dist/dev/keypair.d.ts +2 -0
  15. package/dist/dev/keypair.d.ts.map +1 -1
  16. package/dist/dev/keypair.js +2 -0
  17. package/dist/internal/aiDefault.d.ts +141 -0
  18. package/dist/internal/aiDefault.d.ts.map +1 -0
  19. package/dist/internal/aiDefault.js +204 -0
  20. package/dist/internal/aiProviders.d.ts +4 -1
  21. package/dist/internal/aiProviders.d.ts.map +1 -1
  22. package/dist/internal/aiProviders.js +5 -1
  23. package/dist/internal/appSettings.d.ts +20 -2
  24. package/dist/internal/appSettings.d.ts.map +1 -1
  25. package/dist/internal/appSettings.js +53 -7
  26. package/dist/internal/audit.d.ts +108 -0
  27. package/dist/internal/audit.d.ts.map +1 -0
  28. package/dist/internal/audit.js +235 -0
  29. package/dist/internal/capabilities.d.ts +276 -7
  30. package/dist/internal/capabilities.d.ts.map +1 -1
  31. package/dist/internal/capabilities.js +111 -0
  32. package/dist/internal/catalog/index.d.ts +39 -2
  33. package/dist/internal/catalog/index.d.ts.map +1 -1
  34. package/dist/internal/catalog/inference.d.ts +39 -2
  35. package/dist/internal/catalog/inference.d.ts.map +1 -1
  36. package/dist/internal/catalog/inference.js +36 -4
  37. package/dist/internal/devProviders.d.ts +2 -2
  38. package/dist/internal/devProviders.d.ts.map +1 -1
  39. package/dist/internal/devProviders.js +19 -1
  40. package/dist/internal/events.d.ts +13 -2
  41. package/dist/internal/events.d.ts.map +1 -1
  42. package/dist/internal/events.js +42 -4
  43. package/dist/internal/identity.d.ts +29 -3
  44. package/dist/internal/identity.d.ts.map +1 -1
  45. package/dist/internal/identity.js +37 -9
  46. package/dist/internal/index.d.ts +5 -1
  47. package/dist/internal/index.d.ts.map +1 -1
  48. package/dist/internal/index.js +5 -1
  49. package/dist/internal/members.d.ts +3 -2
  50. package/dist/internal/members.d.ts.map +1 -1
  51. package/dist/internal/oauthPresets.d.ts +29 -0
  52. package/dist/internal/oauthPresets.d.ts.map +1 -0
  53. package/dist/internal/oauthPresets.js +534 -0
  54. package/dist/internal/oauthScopes.d.ts +56 -1
  55. package/dist/internal/oauthScopes.d.ts.map +1 -1
  56. package/dist/internal/oauthScopes.js +98 -4
  57. package/dist/internal/oauthSpec.d.ts +59 -0
  58. package/dist/internal/oauthSpec.d.ts.map +1 -0
  59. package/dist/internal/oauthSpec.js +676 -0
  60. package/dist/internal/protocol.d.ts +36 -1
  61. package/dist/internal/protocol.d.ts.map +1 -1
  62. package/dist/internal/protocol.js +30 -1
  63. package/dist/internal/providerRegistry.d.ts +17 -6
  64. package/dist/internal/providerRegistry.d.ts.map +1 -1
  65. package/dist/internal/providerRegistry.js +47 -2
  66. package/dist/internal/providerSpec.d.ts +11 -7
  67. package/dist/internal/providerSpec.d.ts.map +1 -1
  68. package/dist/internal/providerSpec.js +134 -37
  69. package/dist/internal/signInProviders.d.ts.map +1 -1
  70. package/dist/internal/signInProviders.js +11 -4
  71. package/dist/server/ai.d.ts +45 -0
  72. package/dist/server/ai.d.ts.map +1 -0
  73. package/dist/server/ai.js +40 -0
  74. package/dist/server/attribution.d.ts +9 -5
  75. package/dist/server/attribution.d.ts.map +1 -1
  76. package/dist/server/attribution.js +12 -4
  77. package/dist/server/connectUrl.d.ts +21 -0
  78. package/dist/server/connectUrl.d.ts.map +1 -0
  79. package/dist/server/connectUrl.js +37 -0
  80. package/dist/server/context.d.ts +68 -0
  81. package/dist/server/context.d.ts.map +1 -0
  82. package/dist/server/context.js +117 -0
  83. package/dist/server/emit.d.ts +1 -1
  84. package/dist/server/emit.d.ts.map +1 -1
  85. package/dist/server/emit.js +4 -4
  86. package/dist/server/everyApp.d.ts +27 -7
  87. package/dist/server/everyApp.d.ts.map +1 -1
  88. package/dist/server/everyApp.js +106 -5
  89. package/dist/server/fromMcpTools.d.ts +89 -0
  90. package/dist/server/fromMcpTools.d.ts.map +1 -0
  91. package/dist/server/fromMcpTools.js +192 -0
  92. package/dist/server/gatewayFetch.d.ts +8 -6
  93. package/dist/server/gatewayFetch.d.ts.map +1 -1
  94. package/dist/server/gatewayFetch.js +78 -11
  95. package/dist/server/index.d.ts +7 -3
  96. package/dist/server/index.d.ts.map +1 -1
  97. package/dist/server/index.js +6 -2
  98. package/dist/server/integrationFetch.d.ts +55 -8
  99. package/dist/server/integrationFetch.d.ts.map +1 -1
  100. package/dist/server/integrationFetch.js +198 -18
  101. package/dist/server/listMembers.d.ts +1 -1
  102. package/dist/server/listMembers.d.ts.map +1 -1
  103. package/dist/server/listMembers.js +5 -8
  104. package/dist/server/sendEmail.d.ts +1 -1
  105. package/dist/server/sendEmail.d.ts.map +1 -1
  106. package/dist/server/sendEmail.js +4 -4
  107. package/dist/server/toolsEndpoint.d.ts.map +1 -1
  108. package/dist/server/toolsEndpoint.js +11 -5
  109. package/package.json +13 -14
  110. package/LICENSE +0 -21
@@ -407,11 +407,20 @@ export declare const CATALOG_ENTRIES: {
407
407
  readonly docs: "https://platform.claude.com/settings/keys";
408
408
  readonly api: "https://platform.claude.com/docs/en/api/overview";
409
409
  readonly origin: "https://api.anthropic.com";
410
- readonly inferenceRoutes: readonly ["/v1/messages", "/v1/messages/count_tokens"];
410
+ readonly inferenceRoutes: readonly ["/v1/messages", "/v1/messages/count_tokens", "/v1/chat/completions"];
411
+ readonly unstoredRoutes: readonly ["/v1/chat/completions"];
412
+ readonly shape: "anthropic";
413
+ readonly chat: {
414
+ readonly path: "/v1/chat/completions";
415
+ readonly model: "claude-haiku-5-5";
416
+ };
417
+ readonly aig: {
418
+ readonly slug: "anthropic";
419
+ };
411
420
  readonly hint: "An API key from the Claude Console's API keys page; the Gateway sends it as a bearer token. Apps send the anthropic-version header themselves.";
412
421
  readonly secrets: readonly [{
413
422
  readonly name: "ANTHROPIC_API_KEY";
414
- readonly hint: "A key scoped to one workspace, so no call needs an anthropic-workspace-id header.";
423
+ readonly hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.";
415
424
  }];
416
425
  readonly smoke: {
417
426
  readonly method: "GET";
@@ -442,6 +451,14 @@ export declare const CATALOG_ENTRIES: {
442
451
  readonly api: "https://ai.google.dev/gemini-api/docs/openai";
443
452
  readonly origin: "https://generativelanguage.googleapis.com";
444
453
  readonly inferenceRoutes: readonly ["/v1beta/openai/chat/completions", "/v1beta/openai/embeddings", "/v1beta/openai/images/generations"];
454
+ readonly chat: {
455
+ readonly path: "/v1beta/openai/chat/completions";
456
+ readonly model: "gemini-3.1-flash-lite";
457
+ };
458
+ readonly embeddings: {
459
+ readonly path: "/v1beta/openai/embeddings";
460
+ readonly model: "gemini-embedding-001";
461
+ };
445
462
  readonly hint: "An API key from Google AI Studio; the Gateway sends it as a bearer token. Apps call Gemini's OpenAI-shaped paths under /v1beta/openai.";
446
463
  readonly secrets: readonly [{
447
464
  readonly name: "GEMINI_API_KEY";
@@ -475,6 +492,17 @@ export declare const CATALOG_ENTRIES: {
475
492
  readonly api: "https://docs.mistral.ai/api/";
476
493
  readonly origin: "https://api.mistral.ai";
477
494
  readonly inferenceRoutes: readonly ["/v1/chat/completions", "/v1/fim/completions", "/v1/embeddings", "/v1/moderations", "/v1/chat/moderations", "/v1/classifications", "/v1/chat/classifications", "/v1/ocr", "/v1/audio/transcriptions", "/v1/audio/speech"];
495
+ readonly chat: {
496
+ readonly path: "/v1/chat/completions";
497
+ readonly model: "mistral-small-latest";
498
+ };
499
+ readonly embeddings: {
500
+ readonly path: "/v1/embeddings";
501
+ readonly model: "mistral-embed";
502
+ };
503
+ readonly aig: {
504
+ readonly slug: "mistral";
505
+ };
478
506
  readonly hint: "An API key from API Keys in the Mistral Studio console; the Gateway sends it as a bearer token. Free mode needs no card; usage and rate limits apply.";
479
507
  readonly secrets: readonly [{
480
508
  readonly name: "MISTRAL_API_KEY";
@@ -505,6 +533,14 @@ export declare const CATALOG_ENTRIES: {
505
533
  readonly api: "https://console.groq.com/docs/api-reference";
506
534
  readonly origin: "https://api.groq.com";
507
535
  readonly inferenceRoutes: readonly ["/openai/v1/chat/completions", "/openai/v1/responses", "/openai/v1/audio/transcriptions", "/openai/v1/audio/translations", "/openai/v1/audio/speech"];
536
+ readonly chat: {
537
+ readonly path: "/openai/v1/chat/completions";
538
+ readonly model: "openai/gpt-oss-20b";
539
+ };
540
+ readonly aig: {
541
+ readonly slug: "groq";
542
+ readonly trim: "/openai/v1";
543
+ };
508
544
  readonly hint: "An API key from the Groq console; the Gateway sends it as a bearer token. Apps call the OpenAI-shaped paths under /openai/v1.";
509
545
  readonly secrets: readonly [{
510
546
  readonly name: "GROQ_API_KEY";
@@ -538,6 +574,7 @@ export declare const CATALOG_ENTRIES: {
538
574
  readonly api: "https://docs.cohere.com/reference/about";
539
575
  readonly origin: "https://api.cohere.com";
540
576
  readonly inferenceRoutes: readonly ["/v2/chat", "/v2/embed", "/v2/rerank", "/v1/classify", "/v2/audio/transcriptions", "/v2/parse", "/v1/tokenize", "/v1/detokenize"];
577
+ readonly shape: "other";
541
578
  readonly hint: "An API key from the Cohere dashboard; the Gateway sends it as a bearer token. Trial keys are free and limited; production keys are paid.";
542
579
  readonly secrets: readonly [{
543
580
  readonly name: "COHERE_API_KEY";
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":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;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAMlB,CAAC"}
@@ -10,11 +10,20 @@ export declare const INFERENCE: {
10
10
  readonly docs: "https://platform.claude.com/settings/keys";
11
11
  readonly api: "https://platform.claude.com/docs/en/api/overview";
12
12
  readonly origin: "https://api.anthropic.com";
13
- readonly inferenceRoutes: readonly ["/v1/messages", "/v1/messages/count_tokens"];
13
+ readonly inferenceRoutes: readonly ["/v1/messages", "/v1/messages/count_tokens", "/v1/chat/completions"];
14
+ readonly unstoredRoutes: readonly ["/v1/chat/completions"];
15
+ readonly shape: "anthropic";
16
+ readonly chat: {
17
+ readonly path: "/v1/chat/completions";
18
+ readonly model: "claude-haiku-5-5";
19
+ };
20
+ readonly aig: {
21
+ readonly slug: "anthropic";
22
+ };
14
23
  readonly hint: "An API key from the Claude Console's API keys page; the Gateway sends it as a bearer token. Apps send the anthropic-version header themselves.";
15
24
  readonly secrets: readonly [{
16
25
  readonly name: "ANTHROPIC_API_KEY";
17
- readonly hint: "A key scoped to one workspace, so no call needs an anthropic-workspace-id header.";
26
+ readonly hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.";
18
27
  }];
19
28
  readonly smoke: {
20
29
  readonly method: "GET";
@@ -45,6 +54,14 @@ export declare const INFERENCE: {
45
54
  readonly api: "https://ai.google.dev/gemini-api/docs/openai";
46
55
  readonly origin: "https://generativelanguage.googleapis.com";
47
56
  readonly inferenceRoutes: readonly ["/v1beta/openai/chat/completions", "/v1beta/openai/embeddings", "/v1beta/openai/images/generations"];
57
+ readonly chat: {
58
+ readonly path: "/v1beta/openai/chat/completions";
59
+ readonly model: "gemini-3.1-flash-lite";
60
+ };
61
+ readonly embeddings: {
62
+ readonly path: "/v1beta/openai/embeddings";
63
+ readonly model: "gemini-embedding-001";
64
+ };
48
65
  readonly hint: "An API key from Google AI Studio; the Gateway sends it as a bearer token. Apps call Gemini's OpenAI-shaped paths under /v1beta/openai.";
49
66
  readonly secrets: readonly [{
50
67
  readonly name: "GEMINI_API_KEY";
@@ -78,6 +95,17 @@ export declare const INFERENCE: {
78
95
  readonly api: "https://docs.mistral.ai/api/";
79
96
  readonly origin: "https://api.mistral.ai";
80
97
  readonly inferenceRoutes: readonly ["/v1/chat/completions", "/v1/fim/completions", "/v1/embeddings", "/v1/moderations", "/v1/chat/moderations", "/v1/classifications", "/v1/chat/classifications", "/v1/ocr", "/v1/audio/transcriptions", "/v1/audio/speech"];
98
+ readonly chat: {
99
+ readonly path: "/v1/chat/completions";
100
+ readonly model: "mistral-small-latest";
101
+ };
102
+ readonly embeddings: {
103
+ readonly path: "/v1/embeddings";
104
+ readonly model: "mistral-embed";
105
+ };
106
+ readonly aig: {
107
+ readonly slug: "mistral";
108
+ };
81
109
  readonly hint: "An API key from API Keys in the Mistral Studio console; the Gateway sends it as a bearer token. Free mode needs no card; usage and rate limits apply.";
82
110
  readonly secrets: readonly [{
83
111
  readonly name: "MISTRAL_API_KEY";
@@ -108,6 +136,14 @@ export declare const INFERENCE: {
108
136
  readonly api: "https://console.groq.com/docs/api-reference";
109
137
  readonly origin: "https://api.groq.com";
110
138
  readonly inferenceRoutes: readonly ["/openai/v1/chat/completions", "/openai/v1/responses", "/openai/v1/audio/transcriptions", "/openai/v1/audio/translations", "/openai/v1/audio/speech"];
139
+ readonly chat: {
140
+ readonly path: "/openai/v1/chat/completions";
141
+ readonly model: "openai/gpt-oss-20b";
142
+ };
143
+ readonly aig: {
144
+ readonly slug: "groq";
145
+ readonly trim: "/openai/v1";
146
+ };
111
147
  readonly hint: "An API key from the Groq console; the Gateway sends it as a bearer token. Apps call the OpenAI-shaped paths under /openai/v1.";
112
148
  readonly secrets: readonly [{
113
149
  readonly name: "GROQ_API_KEY";
@@ -141,6 +177,7 @@ export declare const INFERENCE: {
141
177
  readonly api: "https://docs.cohere.com/reference/about";
142
178
  readonly origin: "https://api.cohere.com";
143
179
  readonly inferenceRoutes: readonly ["/v2/chat", "/v2/embed", "/v2/rerank", "/v1/classify", "/v2/audio/transcriptions", "/v2/parse", "/v1/tokenize", "/v1/detokenize"];
180
+ readonly shape: "other";
144
181
  readonly hint: "An API key from the Cohere dashboard; the Gateway sends it as a bearer token. Trial keys are free and limited; production keys are paid.";
145
182
  readonly secrets: readonly [{
146
183
  readonly name: "COHERE_API_KEY";
@@ -1 +1 @@
1
- {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../src/internal/catalog/inference.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkbsD,CAAC"}
1
+ {"version":3,"file":"inference.d.ts","sourceRoot":"","sources":["../../../src/internal/catalog/inference.ts"],"names":[],"mappings":"AAeA,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkdsD,CAAC"}
@@ -1,5 +1,5 @@
1
1
  export const INFERENCE = {
2
- // Bearer is the documented header today; x-api-key is the legacy fallback. A workspace-scoped key keeps anthropic-workspace-id harmless.
2
+ // Bearer is the documented header today; x-api-key is the legacy fallback. The Gateway strips anthropic-workspace-id (and x-api-key), so the key alone decides the workspace.
3
3
  anthropic: {
4
4
  mode: "ai",
5
5
  label: "Anthropic",
@@ -11,12 +11,24 @@ export const INFERENCE = {
11
11
  docs: "https://platform.claude.com/settings/keys",
12
12
  api: "https://platform.claude.com/docs/en/api/overview",
13
13
  origin: "https://api.anthropic.com",
14
- inferenceRoutes: ["/v1/messages", "/v1/messages/count_tokens"],
14
+ inferenceRoutes: [
15
+ "/v1/messages",
16
+ "/v1/messages/count_tokens",
17
+ // Anthropic's OpenAI-compatible chat completions (its docs: not a
18
+ // long-term solution; `strict` is ignored): what the default route
19
+ // maps onto when Anthropic is the Gateway's default.
20
+ "/v1/chat/completions",
21
+ ],
22
+ unstoredRoutes: ["/v1/chat/completions"],
23
+ // The Messages API is the shape an app pins `anthropic` for.
24
+ shape: "anthropic",
25
+ chat: { path: "/v1/chat/completions", model: "claude-haiku-5-5" },
26
+ aig: { slug: "anthropic" },
15
27
  hint: "An API key from the Claude Console's API keys page; the Gateway sends it as a bearer token. Apps send the anthropic-version header themselves.",
16
28
  secrets: [
17
29
  {
18
30
  name: "ANTHROPIC_API_KEY",
19
- hint: "A key scoped to one workspace, so no call needs an anthropic-workspace-id header.",
31
+ hint: "A key scoped to one workspace; the Gateway strips any anthropic-workspace-id header an app sends, so the key alone decides the workspace.",
20
32
  },
21
33
  ],
22
34
  smoke: {
@@ -52,6 +64,16 @@ export const INFERENCE = {
52
64
  "/v1beta/openai/embeddings",
53
65
  "/v1beta/openai/images/generations",
54
66
  ],
67
+ chat: {
68
+ path: "/v1beta/openai/chat/completions",
69
+ model: "gemini-3.1-flash-lite",
70
+ },
71
+ embeddings: {
72
+ path: "/v1beta/openai/embeddings",
73
+ model: "gemini-embedding-001",
74
+ },
75
+ // No `aig`: AI Gateway documents Google AI Studio's native form only
76
+ // (/v1/models/{model}:generateContent), not these OpenAI-shaped paths.
55
77
  hint: "An API key from Google AI Studio; the Gateway sends it as a bearer token. Apps call Gemini's OpenAI-shaped paths under /v1beta/openai.",
56
78
  secrets: [
57
79
  {
@@ -98,6 +120,9 @@ export const INFERENCE = {
98
120
  "/v1/audio/transcriptions",
99
121
  "/v1/audio/speech",
100
122
  ],
123
+ chat: { path: "/v1/chat/completions", model: "mistral-small-latest" },
124
+ embeddings: { path: "/v1/embeddings", model: "mistral-embed" },
125
+ aig: { slug: "mistral" },
101
126
  hint: "An API key from API Keys in the Mistral Studio console; the Gateway sends it as a bearer token. Free mode needs no card; usage and rate limits apply.",
102
127
  secrets: [
103
128
  {
@@ -136,6 +161,9 @@ export const INFERENCE = {
136
161
  "/openai/v1/audio/translations",
137
162
  "/openai/v1/audio/speech",
138
163
  ],
164
+ chat: { path: "/openai/v1/chat/completions", model: "openai/gpt-oss-20b" },
165
+ // AI Gateway's Groq endpoint takes the path without `/openai/v1`.
166
+ aig: { slug: "groq", trim: "/openai/v1" },
139
167
  hint: "An API key from the Groq console; the Gateway sends it as a bearer token. Apps call the OpenAI-shaped paths under /openai/v1.",
140
168
  secrets: [
141
169
  {
@@ -180,6 +208,10 @@ export const INFERENCE = {
180
208
  "/v1/tokenize",
181
209
  "/v1/detokenize",
182
210
  ],
211
+ // Cohere's own v2 shape: pinned by an app that speaks it, never the
212
+ // default (its OpenAI-compatible endpoint is on another host,
213
+ // api.cohere.ai). No `aig`: AI Gateway documents v1 paths only.
214
+ shape: "other",
183
215
  hint: "An API key from the Cohere dashboard; the Gateway sends it as a bearer token. Trial keys are free and limited; production keys are paid.",
184
216
  secrets: [
185
217
  {
@@ -388,7 +420,7 @@ export const INFERENCE = {
388
420
  },
389
421
  tags: ["ai", "images", "video", "audio"],
390
422
  },
391
- // The router forwards X-HF-Bill-To as sent, so an app can bill any organization the token's user belongs to (TODO.md).
423
+ // The Gateway strips X-HF-Bill-To, so calls bill the token's own account, never another organization the token's user belongs to.
392
424
  huggingface: {
393
425
  mode: "api_key",
394
426
  label: "Hugging Face Inference",
@@ -16,7 +16,7 @@
16
16
  * doesn't parse is ignored until an app asks for its id, which then gets
17
17
  * a ConfigurationError naming the file.
18
18
  */
19
- import type { ApiKeyCapability } from "./capabilities.js";
19
+ import { type RegistrableCapability } from "./providerSpec.js";
20
20
  /** The dev Worker's binding holding the specs (a copy is in ../cloudflare/worker.ts, kept in step by a test). */
21
21
  export declare const DEV_PROVIDERS_ENV = "EVERYAPP_DEV_PROVIDERS";
22
22
  /** Where the specs live in an app, relative to its directory. */
@@ -33,7 +33,7 @@ export declare function devProviderFile(id: string): string;
33
33
  /** A registered provider resolved for local development, or why it can't be. */
34
34
  export type DevProviderLookup = {
35
35
  found: true;
36
- capability: ApiKeyCapability;
36
+ capability: RegistrableCapability;
37
37
  file: string;
38
38
  } | {
39
39
  found: false;
@@ -1 +1 @@
1
- {"version":3,"file":"devProviders.d.ts","sourceRoot":"","sources":["../../src/internal/devProviders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAG1D,iHAAiH;AACjH,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAC;CACf;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GACzB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,gBAAgB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC3D;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAuBtC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,EAAE,EAAE,MAAM,GACT,iBAAiB,CA+BnB"}
1
+ {"version":3,"file":"devProviders.d.ts","sourceRoot":"","sources":["../../src/internal/devProviders.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAGL,KAAK,qBAAqB,EAC3B,MAAM,mBAAmB,CAAC;AAE3B,iHAAiH;AACjH,eAAO,MAAM,iBAAiB,2BAA2B,CAAC;AAE1D,iEAAiE;AACjE,eAAO,MAAM,iBAAiB,wBAAwB,CAAC;AAEvD,0CAA0C;AAC1C,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,uDAAuD;IACvD,IAAI,EAAE,OAAO,CAAC;CACf;AAED,uEAAuE;AACvE,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAElD;AAED,gFAAgF;AAChF,MAAM,MAAM,iBAAiB,GACzB;IAAE,KAAK,EAAE,IAAI,CAAC;IAAC,UAAU,EAAE,qBAAqB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAChE;IAAE,KAAK,EAAE,KAAK,CAAC;IAAC,OAAO,EAAE,MAAM,CAAA;CAAE,CAAC;AAuBtC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC,EACzC,EAAE,EAAE,MAAM,GACT,iBAAiB,CA+BnB"}
@@ -1,4 +1,22 @@
1
- import { describeSpecProblems, parseProviderSpec } from "./providerSpec.js";
1
+ /**
2
+ * A provider registered on a gateway, in local development
3
+ * (docs/design/2026-10-provider-registry.md, section 4). There is no
4
+ * gateway to ask in `everyapp dev`, so the spec comes from the app's
5
+ * directory: `everyapp provider add` (run in an app directory) and
6
+ * `everyapp provider show <id> --save` write it to
7
+ * `.everyapp/providers/<id>.json`, `everyAppWorker()` reads every such
8
+ * file when it builds the dev Worker and hands them over as one text
9
+ * binding, {@link DEV_PROVIDERS_ENV}, and `integrationFetch()`'s local
10
+ * fallback resolves an id outside the catalog from it, with the
11
+ * developer's own key from `.dev.vars` under the spec's setting names.
12
+ *
13
+ * The binding is JSON: `[{ "file": ".everyapp/providers/stripe.json",
14
+ * "spec": <the file's JSON, or its text when it isn't JSON> }]`. Each spec
15
+ * is parsed here, with the same parser `provider add` uses; one that
16
+ * doesn't parse is ignored until an app asks for its id, which then gets
17
+ * a ConfigurationError naming the file.
18
+ */
19
+ import { describeSpecProblems, parseProviderSpec, } from "./providerSpec.js";
2
20
  /** The dev Worker's binding holding the specs (a copy is in ../cloudflare/worker.ts, kept in step by a test). */
3
21
  export const DEV_PROVIDERS_ENV = "EVERYAPP_DEV_PROVIDERS";
4
22
  /** Where the specs live in an app, relative to its directory. */
@@ -9,7 +9,7 @@
9
9
  * apps/every-app-gateway/src/server/events/catalogue.ts; this module knows
10
10
  * the names, versions and one-line descriptions only.
11
11
  */
12
- export type EventGroup = "member" | "app" | "cap" | "tool" | "connection" | "token" | "access" | "signin_provider" | "mcp_app" | "provider" | "ping";
12
+ export type EventGroup = "member" | "organization" | "app" | "cap" | "group" | "tool" | "connection" | "token" | "access" | "signin_provider" | "mcp_app" | "provider" | "subscription" | "ai" | "ping";
13
13
  export interface EventTypeInfo {
14
14
  /** `member.joined`, `cap.reached`, … */
15
15
  readonly type: string;
@@ -56,8 +56,19 @@ export declare const EVENT_SUBSCRIPTIONS_MAX = 25;
56
56
  /** A webhook signing secret's length. */
57
57
  export declare const EVENT_SECRET_MIN_LENGTH = 16;
58
58
  export declare const EVENT_SECRET_MAX_LENGTH = 128;
59
- /** Events and deliveries are kept this long. */
59
+ /**
60
+ * Deliveries (the queue and its log) are kept this long. Events themselves
61
+ * are the audit log and live longer ({@link AUDIT_RETENTION_DAYS}).
62
+ */
60
63
  export declare const EVENT_RETENTION_DAYS = 30;
64
+ /**
65
+ * Events are kept this long: Admin → Activity → Audit, `everyapp workspace
66
+ * audit` and `everyapp_workspace_audit` read them back. A constant, not a
67
+ * setting.
68
+ */
69
+ export declare const AUDIT_RETENTION_DAYS = 90;
70
+ /** The most audit rows one page carries, on every surface. */
71
+ export declare const AUDIT_PAGE_MAX = 200;
61
72
  /** A subscription's URL. */
62
73
  export declare const EVENT_URL_MAX_LENGTH = 2048;
63
74
  /** A subscription's name. */
@@ -1 +1 @@
1
- {"version":3,"file":"events.d.ts","sourceRoot":"","sources":["../../src/internal/events.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,MAAM,MAAM,UAAU,GAClB,QAAQ,GACR,KAAK,GACL,KAAK,GACL,MAAM,GACN,YAAY,GACZ,OAAO,GACP,QAAQ,GACR,iBAAiB,GACjB,SAAS,GACT,UAAU,GACV,MAAM,CAAC;AAEX,MAAM,WAAW,aAAa;IAC5B,wCAAwC;IACxC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,iFAAiF;IACjF,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,0EAA0E;IAC1E,QAAQ,CAAC,WAAW,EAAE,MAAM,CAAC;IAC7B,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;CAC5B;AASD;;;;;GAKG;AACH,eAAO,MAAM,WAAW,EAAE,SAAS,aAAa,EAkD/C,CAAC;AAIF,2EAA2E;AAC3E,wBAAgB,aAAa,CAAC,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAErE;AAED,uEAAuE;AACvE,eAAO,MAAM,gBAAgB,SAAS,CAAC;AAEvC,gFAAgF;AAChF,eAAO,MAAM,sBAAsB,QAA0C,CAAC;AAC9E,eAAO,MAAM,kBAAkB,KAAK,CAAC;AAErC,+CAA+C;AAC/C,wBAAgB,YAAY,CAAC,KAAK,E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ED,kEAAkE;AAClE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAChC;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,EAAE,EAAE,MAAM,EAAE,CAAA;CAAE,GAAG,IAAI,CAY5C"}
@@ -24,16 +24,29 @@ export const EVENT_TYPES = [
24
24
  entry("member", "member.reactivated", "A member was reactivated"),
25
25
  entry("member", "member.removed", "A member was removed"),
26
26
  entry("member", "member.password_reset", "A member reset their password"),
27
+ entry("member", "member.invitation_cancelled", "A pending invitation was cancelled"),
28
+ entry("organization", "organization.renamed", "The workspace was renamed"),
27
29
  entry("app", "app.installed", "An app was installed on the Gateway"),
28
30
  entry("app", "app.updated", "An app was redeployed"),
31
+ entry("app", "app.live", "An app went live on the Gateway"),
29
32
  entry("app", "app.removed", "An app was removed from the Gateway"),
30
33
  entry("app", "app.needs_setup", "An app needs a setting before it opens"),
31
34
  entry("app", "app.ready", "An app has every setting it needs"),
32
35
  entry("app", "app.paused_cap", "An app is paused: its monthly cap is reached"),
33
36
  entry("app", "app.tools_changed", "An app's AI tools changed"),
37
+ entry("app", "app.renamed", "An app's name or description changed"),
38
+ entry("app", "app.settings_changed", "An app's settings were set or unset (names only)"),
39
+ entry("app", "app.access_changed", "Who can open an app changed"),
40
+ entry("app", "app.email_changed", "An app's email senders or inbound changed"),
34
41
  entry("cap", "cap.warning", "An app is at 80% of its monthly cap"),
35
42
  entry("cap", "cap.reached", "An app reached its monthly cap"),
36
43
  entry("cap", "cap.raised", "An app's monthly cap, or the workspace default, was raised or removed"),
44
+ entry("cap", "cap.changed", "An app's monthly cap, or the workspace default, was set or lowered"),
45
+ entry("group", "group.created", "A group was created"),
46
+ entry("group", "group.updated", "A group was renamed or described"),
47
+ entry("group", "group.removed", "A group was removed"),
48
+ entry("group", "group.members_changed", "A group's members changed"),
49
+ entry("group", "group.apps_changed", "The apps a group opens changed"),
37
50
  entry("tool", "tool.blocked", "An AI client's tool call was blocked"),
38
51
  entry("tool", "tool.error", "An AI client's tool call failed"),
39
52
  entry("connection", "connection.created", "An AI app was connected"),
@@ -47,8 +60,19 @@ export const EVENT_TYPES = [
47
60
  entry("mcp_app", "mcp_app.removed", "An MCP app was removed"),
48
61
  entry("mcp_app", "mcp_app.enabled", "An MCP app is being served again"),
49
62
  entry("mcp_app", "mcp_app.disabled", "An MCP app stopped being served"),
50
- entry("provider", "provider.added", "An API provider was registered"),
51
- entry("provider", "provider.removed", "An API provider was removed"),
63
+ entry("mcp_app", "mcp_app.updated", "An MCP app's risk default, name or description changed"),
64
+ entry("mcp_app", "mcp_app.tool_changed", "One tool of an MCP app was overridden: its risk, or on/off"),
65
+ entry("provider", "provider.added", "A provider was registered"),
66
+ entry("provider", "provider.removed", "A provider was removed"),
67
+ entry("provider", "provider.updated", "A provider's spec or OAuth client was replaced"),
68
+ entry("provider", "provider.connected", "Someone connected an account at an OAuth provider"),
69
+ entry("provider", "provider.disconnected", "An OAuth provider account was disconnected"),
70
+ entry("provider", "provider.connection_expired", "An OAuth provider refused to refresh a connection; it needs reconnecting"),
71
+ entry("subscription", "subscription.created", "An event subscription was added"),
72
+ entry("subscription", "subscription.updated", "An event subscription was changed, paused or resumed"),
73
+ entry("subscription", "subscription.removed", "An event subscription was removed"),
74
+ entry("subscription", "subscription.redelivered", "A delivery was queued again by hand"),
75
+ entry("ai", "ai.default_changed", "The default model provider changed"),
52
76
  entry("ping", "ping", "A test event, sent to one subscription on request"),
53
77
  ];
54
78
  const typesByName = new Map(EVENT_TYPES.map((info) => [info.type, info]));
@@ -101,8 +125,19 @@ export const EVENT_SUBSCRIPTIONS_MAX = 25;
101
125
  /** A webhook signing secret's length. */
102
126
  export const EVENT_SECRET_MIN_LENGTH = 16;
103
127
  export const EVENT_SECRET_MAX_LENGTH = 128;
104
- /** Events and deliveries are kept this long. */
128
+ /**
129
+ * Deliveries (the queue and its log) are kept this long. Events themselves
130
+ * are the audit log and live longer ({@link AUDIT_RETENTION_DAYS}).
131
+ */
105
132
  export const EVENT_RETENTION_DAYS = 30;
133
+ /**
134
+ * Events are kept this long: Admin → Activity → Audit, `everyapp workspace
135
+ * audit` and `everyapp_workspace_audit` read them back. A constant, not a
136
+ * setting.
137
+ */
138
+ export const AUDIT_RETENTION_DAYS = 90;
139
+ /** The most audit rows one page carries, on every surface. */
140
+ export const AUDIT_PAGE_MAX = 200;
106
141
  /** A subscription's URL. */
107
142
  export const EVENT_URL_MAX_LENGTH = 2048;
108
143
  /** A subscription's name. */
@@ -174,8 +209,11 @@ export const EVENT_EMAIL_RECIPIENTS = ["owners", "admins"];
174
209
  * gateway's app events and every app's own.
175
210
  */
176
211
  export function eventPatternMatches(pattern, type) {
212
+ // Everything but a test ping and the bus's own housekeeping: a webhook
213
+ // hears about subscriptions only when it names `subscription.*`, so a
214
+ // catch-all's first delivery is the event it was made for, not itself.
177
215
  if (pattern === "*")
178
- return type !== "ping";
216
+ return type !== "ping" && !type.startsWith("subscription.");
179
217
  if (pattern.endsWith(".*")) {
180
218
  return type.startsWith(pattern.slice(0, -1));
181
219
  }
@@ -1,5 +1,5 @@
1
- import { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, type SystemClaims, type SystemTokenPurpose } from "./protocol.js";
2
- export { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, };
1
+ import { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, ORG_ID_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, type SystemClaims, type SystemTokenPurpose } from "./protocol.js";
2
+ export { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, ORG_ID_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, type EveryAppUser, type IdentityChannel, };
3
3
  export declare class IdentityError extends Error {
4
4
  readonly status = 401;
5
5
  constructor(message: string);
@@ -35,6 +35,25 @@ export interface VerifyOptions {
35
35
  * claims).
36
36
  */
37
37
  export declare function verifyIdentityJwt(token: string, options: VerifyOptions): Promise<EveryAppUser>;
38
+ /** A verified identity, with when it stops being one. */
39
+ export interface VerifiedIdentity {
40
+ user: EveryAppUser;
41
+ /** The token's `exp`, in epoch milliseconds. */
42
+ expiresAt: number;
43
+ }
44
+ /**
45
+ * {@link verifyIdentityJwt}, keeping the token's expiry: the SDK's request
46
+ * context stops forwarding an identity shortly before it, and goes on as
47
+ * the organization's background work.
48
+ */
49
+ export declare function verifyIdentity(token: string, options: VerifyOptions): Promise<VerifiedIdentity>;
50
+ /**
51
+ * The organization pin: a deployed Worker serves one organization
52
+ * (`EVERY_APP_ORG_ID`), and an identity for any other is refused, whatever
53
+ * its audience says. Throws {@link IdentityError} on a mismatch; a Worker
54
+ * with no pin (a shared app's) accepts every organization.
55
+ */
56
+ export declare function assertOrganizationPin(user: EveryAppUser, organizationId: string | undefined): void;
38
57
  /**
39
58
  * Verify the gateway's system token (the value of `x-everyapp-system`)
40
59
  * fail-closed, for exactly one purpose. A user identity or public marker is
@@ -56,9 +75,16 @@ export interface IdentityResult {
56
75
  user: EveryAppUser | null;
57
76
  /** True when the gateway marked this request as a public route. */
58
77
  isPublic: boolean;
78
+ /** When the identity expires (epoch ms); null on a public route. */
79
+ expiresAt: number | null;
59
80
  }
60
81
  export interface RequestIdentityOptions {
61
82
  audience: string;
83
+ /**
84
+ * The organization this Worker is pinned to ({@link ORG_ID_ENV}): an
85
+ * identity for another is refused. Undefined accepts every organization.
86
+ */
87
+ organizationId?: string;
62
88
  /** Provide keys directly, or let {@link getIdentityFromRequest} read env. */
63
89
  publicKeys?: string[];
64
90
  /** Env bag to read {@link PUBLIC_KEYS_ENV} / {@link DEV_ENV} from. */
@@ -84,5 +110,5 @@ export declare function resolveVerifyOptions(options: RequestIdentityOptions): V
84
110
  * problem — including a bare/forged public header — so a re-exposed worker
85
111
  * fails closed.
86
112
  */
87
- export declare function getIdentityFromRequest(request: Request, options: RequestIdentityOptions): Promise<IdentityResult>;
113
+ export declare function getIdentityFromRequest(request: Request | Headers, options: RequestIdentityOptions): Promise<IdentityResult>;
88
114
  //# sourceMappingURL=identity.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../../src/internal/identity.ts"],"names":[],"mappings":"AAgBA,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EAKjB,KAAK,YAAY,EACjB,KAAK,eAAe,EAEpB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAEvB,OAAO,EACL,UAAU,EACV,OAAO,EACP,UAAU,EACV,YAAY,EACZ,mBAAmB,EACnB,eAAe,EACf,eAAe,EACf,UAAU,EACV,aAAa,EACb,eAAe,EACf,iBAAiB,EACjB,KAAK,YAAY,EACjB,KAAK,eAAe,GACrB,CAAC;AAEF,qBAAa,aAAc,SAAQ,KAAK;IACtC,QAAQ,CAAC,MAAM,OAAO;gBACV,OAAO,EAAE,MAAM;CAI5B;AAED,qBAAa,kBAAmB,SAAQ,KAAK;IAC3C,QAAQ,CAAC,MAAM,OAAO;gBACV,OAAO,EAAE,M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;IACxB,6EAA6E;IAC7E,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,sEAAsE;IACtE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,8EAA8E;IAC9E,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;;;;GAKG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,sBAAsB,GAC9B,aAAa,CAwBf;AAED;;;;;;;GAOG;AACH,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,OAAO,GAAG,OAAO,EAC1B,OAAO,EAAE,sBAAsB,GAC9B,OAAO,CAAC,cAAc,CAAC,CAmBzB"}
@@ -9,8 +9,8 @@
9
9
  * survives verification produces a user.
10
10
  */
11
11
  import { importSPKI, jwtVerify, decodeProtectedHeader, } from "jose";
12
- import { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, assertPublicMarkerClaims, assertSystemClaims, identityClaimsToEveryAppUser, ProtocolClaimsError, } from "./protocol.js";
13
- export { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, };
12
+ import { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, ORG_ID_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, assertPublicMarkerClaims, assertSystemClaims, identityClaimsToEveryAppUser, ProtocolClaimsError, } from "./protocol.js";
13
+ export { APP_ID_ENV, DEV_ENV, DEV_ISSUER, IDENTITY_ALG, IDENTITY_DEV_KEY_ID, IDENTITY_HEADER, IDENTITY_KEY_ID, ISSUER_ENV, ORG_ID_ENV, PUBLIC_HEADER, PUBLIC_KEYS_ENV, PUBLIC_MARKER_SUB, };
14
14
  export class IdentityError extends Error {
15
15
  status = 401;
16
16
  constructor(message) {
@@ -81,9 +81,19 @@ function assertDevIssuer(options) {
81
81
  * claims).
82
82
  */
83
83
  export async function verifyIdentityJwt(token, options) {
84
+ return (await verifyIdentity(token, options)).user;
85
+ }
86
+ /**
87
+ * {@link verifyIdentityJwt}, keeping the token's expiry: the SDK's request
88
+ * context stops forwarding an identity shortly before it, and goes on as
89
+ * the organization's background work.
90
+ */
91
+ export async function verifyIdentity(token, options) {
84
92
  const payload = await verifyPinnedJwt(token, options, "user");
85
93
  try {
86
- return identityClaimsToEveryAppUser(payload);
94
+ const user = identityClaimsToEveryAppUser(payload);
95
+ // `exp` is a required claim (verifyPinnedJwt); jose checked it.
96
+ return { user, expiresAt: payload.exp * 1000 };
87
97
  }
88
98
  catch (error) {
89
99
  if (error instanceof ProtocolClaimsError) {
@@ -92,6 +102,17 @@ export async function verifyIdentityJwt(token, options) {
92
102
  throw error;
93
103
  }
94
104
  }
105
+ /**
106
+ * The organization pin: a deployed Worker serves one organization
107
+ * (`EVERY_APP_ORG_ID`), and an identity for any other is refused, whatever
108
+ * its audience says. Throws {@link IdentityError} on a mismatch; a Worker
109
+ * with no pin (a shared app's) accepts every organization.
110
+ */
111
+ export function assertOrganizationPin(user, organizationId) {
112
+ if (organizationId && user.orgId !== organizationId) {
113
+ throw new IdentityError(`identity is for organization "${user.orgId}", and this Worker serves organization "${organizationId}" (${ORG_ID_ENV})`);
114
+ }
115
+ }
95
116
  /**
96
117
  * Verify the gateway's system token (the value of `x-everyapp-system`)
97
118
  * fail-closed, for exactly one purpose. A user identity or public marker is
@@ -137,7 +158,7 @@ async function verifyPinnedJwt(token, options, expectedTyp) {
137
158
  throw new IdentityError(`unexpected kid "${header.kid}"`);
138
159
  }
139
160
  if (expectedTyp !== "public" && !options.issuer) {
140
- throw new IdentityError(`${ISSUER_ENV} not configured — deploy with the Every App CLI or provide an explicit issuer.`);
161
+ throw new IdentityError(`${ISSUER_ENV} not configured — deploy with the EveryApp CLI or provide an explicit issuer.`);
141
162
  }
142
163
  const verifyOpts = {
143
164
  algorithms: [IDENTITY_ALG],
@@ -217,15 +238,22 @@ export function resolveVerifyOptions(options) {
217
238
  */
218
239
  export async function getIdentityFromRequest(request, options) {
219
240
  const verifyOptions = resolveVerifyOptions(options);
220
- const publicMarker = request.headers.get(PUBLIC_HEADER);
241
+ const headers = isRequestLike(request) ? request.headers : request;
242
+ const publicMarker = headers.get(PUBLIC_HEADER);
221
243
  if (publicMarker) {
222
244
  await verifyPublicMarkerJwt(publicMarker, verifyOptions);
223
- return { user: null, isPublic: true };
245
+ return { user: null, isPublic: true, expiresAt: null };
224
246
  }
225
- const token = request.headers.get(IDENTITY_HEADER);
247
+ const token = headers.get(IDENTITY_HEADER);
226
248
  if (!token) {
227
249
  throw new IdentityError("request reached the app without an identity token (not proxied through the gateway?)");
228
250
  }
229
- const user = await verifyIdentityJwt(token, verifyOptions);
230
- return { user, isPublic: false };
251
+ const { user, expiresAt } = await verifyIdentity(token, verifyOptions);
252
+ assertOrganizationPin(user, options.organizationId);
253
+ return { user, isPublic: false, expiresAt };
254
+ }
255
+ // Duck-typed: a Request from another realm (a test runner, a polyfill) still
256
+ // carries its headers the same way.
257
+ function isRequestLike(value) {
258
+ return "headers" in value && typeof value.headers?.get === "function";
231
259
  }