@every-app/sdk 0.2.0 → 0.3.0-rc.10

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 (189) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +609 -3
  3. package/dist/cloudflare/catalogSettings.generated.d.ts +81 -0
  4. package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -0
  5. package/dist/cloudflare/catalogSettings.generated.js +174 -0
  6. package/dist/cloudflare/index.d.ts +23 -0
  7. package/dist/cloudflare/index.d.ts.map +1 -0
  8. package/dist/cloudflare/index.js +24 -0
  9. package/dist/cloudflare/sentinel.d.ts +127 -0
  10. package/dist/cloudflare/sentinel.d.ts.map +1 -0
  11. package/dist/cloudflare/sentinel.js +85 -0
  12. package/dist/cloudflare/worker.d.ts +805 -0
  13. package/dist/cloudflare/worker.d.ts.map +1 -0
  14. package/dist/cloudflare/worker.js +997 -0
  15. package/dist/dev/index.d.ts +8 -0
  16. package/dist/dev/index.d.ts.map +1 -0
  17. package/dist/dev/index.js +7 -0
  18. package/dist/dev/keypair.d.ts +26 -0
  19. package/dist/dev/keypair.d.ts.map +1 -0
  20. package/dist/dev/keypair.js +62 -0
  21. package/dist/index.d.ts +6 -0
  22. package/dist/index.d.ts.map +1 -0
  23. package/dist/index.js +5 -0
  24. package/dist/internal/aiDefault.d.ts +204 -0
  25. package/dist/internal/aiDefault.d.ts.map +1 -0
  26. package/dist/internal/aiDefault.js +334 -0
  27. package/dist/internal/aiProviders.d.ts +72 -0
  28. package/dist/internal/aiProviders.d.ts.map +1 -0
  29. package/dist/internal/aiProviders.js +233 -0
  30. package/dist/internal/appSettings.d.ts +315 -0
  31. package/dist/internal/appSettings.d.ts.map +1 -0
  32. package/dist/internal/appSettings.js +549 -0
  33. package/dist/internal/audit.d.ts +108 -0
  34. package/dist/internal/audit.d.ts.map +1 -0
  35. package/dist/internal/audit.js +235 -0
  36. package/dist/internal/capabilities.d.ts +3174 -0
  37. package/dist/internal/capabilities.d.ts.map +1 -0
  38. package/dist/internal/capabilities.js +1110 -0
  39. package/dist/internal/catalog/commerce.d.ts +394 -0
  40. package/dist/internal/catalog/commerce.d.ts.map +1 -0
  41. package/dist/internal/catalog/commerce.js +477 -0
  42. package/dist/internal/catalog/comms.d.ts +375 -0
  43. package/dist/internal/catalog/comms.d.ts.map +1 -0
  44. package/dist/internal/catalog/comms.js +520 -0
  45. package/dist/internal/catalog/index.d.ts +1973 -0
  46. package/dist/internal/catalog/index.d.ts.map +1 -0
  47. package/dist/internal/catalog/index.js +19 -0
  48. package/dist/internal/catalog/inference.d.ts +393 -0
  49. package/dist/internal/catalog/inference.d.ts.map +1 -0
  50. package/dist/internal/catalog/inference.js +460 -0
  51. package/dist/internal/catalog/infra.d.ts +423 -0
  52. package/dist/internal/catalog/infra.d.ts.map +1 -0
  53. package/dist/internal/catalog/infra.js +543 -0
  54. package/dist/internal/catalog/search.d.ts +400 -0
  55. package/dist/internal/catalog/search.d.ts.map +1 -0
  56. package/dist/internal/catalog/search.js +463 -0
  57. package/dist/internal/devProviders.d.ts +49 -0
  58. package/dist/internal/devProviders.d.ts.map +1 -0
  59. package/dist/internal/devProviders.js +80 -0
  60. package/dist/internal/email.d.ts +280 -0
  61. package/dist/internal/email.d.ts.map +1 -0
  62. package/dist/internal/email.js +613 -0
  63. package/dist/internal/events.d.ts +193 -0
  64. package/dist/internal/events.d.ts.map +1 -0
  65. package/dist/internal/events.js +367 -0
  66. package/dist/internal/gatewaySettings.d.ts +83 -0
  67. package/dist/internal/gatewaySettings.d.ts.map +1 -0
  68. package/dist/internal/gatewaySettings.js +215 -0
  69. package/dist/internal/identity.d.ts +57 -5
  70. package/dist/internal/identity.d.ts.map +1 -1
  71. package/dist/internal/identity.js +99 -22
  72. package/dist/internal/index.d.ts +22 -1
  73. package/dist/internal/index.d.ts.map +1 -1
  74. package/dist/internal/index.js +22 -1
  75. package/dist/internal/members.d.ts +36 -0
  76. package/dist/internal/members.d.ts.map +1 -0
  77. package/dist/internal/members.js +7 -0
  78. package/dist/internal/oauthClient.d.ts +61 -0
  79. package/dist/internal/oauthClient.d.ts.map +1 -0
  80. package/dist/internal/oauthClient.js +133 -0
  81. package/dist/internal/oauthPresets.d.ts +33 -0
  82. package/dist/internal/oauthPresets.d.ts.map +1 -0
  83. package/dist/internal/oauthPresets.js +1064 -0
  84. package/dist/internal/oauthScopes.d.ts +172 -0
  85. package/dist/internal/oauthScopes.d.ts.map +1 -0
  86. package/dist/internal/oauthScopes.js +510 -0
  87. package/dist/internal/oauthSpec.d.ts +102 -0
  88. package/dist/internal/oauthSpec.d.ts.map +1 -0
  89. package/dist/internal/oauthSpec.js +789 -0
  90. package/dist/internal/organizationName.d.ts +18 -0
  91. package/dist/internal/organizationName.d.ts.map +1 -0
  92. package/dist/internal/organizationName.js +24 -0
  93. package/dist/internal/protocol.d.ts +150 -3
  94. package/dist/internal/protocol.d.ts.map +1 -1
  95. package/dist/internal/protocol.js +163 -2
  96. package/dist/internal/providerApps.d.ts +75 -0
  97. package/dist/internal/providerApps.d.ts.map +1 -0
  98. package/dist/internal/providerApps.js +59 -0
  99. package/dist/internal/providerRegistry.d.ts +218 -0
  100. package/dist/internal/providerRegistry.d.ts.map +1 -0
  101. package/dist/internal/providerRegistry.js +432 -0
  102. package/dist/internal/providerSpec.d.ts +66 -0
  103. package/dist/internal/providerSpec.d.ts.map +1 -0
  104. package/dist/internal/providerSpec.js +1154 -0
  105. package/dist/internal/remoteMcp.d.ts +188 -0
  106. package/dist/internal/remoteMcp.d.ts.map +1 -0
  107. package/dist/internal/remoteMcp.js +543 -0
  108. package/dist/internal/signInProviders.d.ts +104 -0
  109. package/dist/internal/signInProviders.d.ts.map +1 -0
  110. package/dist/internal/signInProviders.js +245 -0
  111. package/dist/internal/tools.d.ts +115 -0
  112. package/dist/internal/tools.d.ts.map +1 -0
  113. package/dist/internal/tools.js +80 -0
  114. package/dist/manifest.d.ts +238 -0
  115. package/dist/manifest.d.ts.map +1 -0
  116. package/dist/manifest.js +30 -0
  117. package/dist/server/ai.d.ts +111 -0
  118. package/dist/server/ai.d.ts.map +1 -0
  119. package/dist/server/ai.js +145 -0
  120. package/dist/server/aiBinding.d.ts +68 -0
  121. package/dist/server/aiBinding.d.ts.map +1 -0
  122. package/dist/server/aiBinding.js +294 -0
  123. package/dist/server/attribution.d.ts +43 -0
  124. package/dist/server/attribution.d.ts.map +1 -0
  125. package/dist/server/attribution.js +75 -0
  126. package/dist/server/authorizeUrl.d.ts +43 -0
  127. package/dist/server/authorizeUrl.d.ts.map +1 -0
  128. package/dist/server/authorizeUrl.js +106 -0
  129. package/dist/server/connectUrl.d.ts +21 -0
  130. package/dist/server/connectUrl.d.ts.map +1 -0
  131. package/dist/server/connectUrl.js +37 -0
  132. package/dist/server/context.d.ts +68 -0
  133. package/dist/server/context.d.ts.map +1 -0
  134. package/dist/server/context.js +117 -0
  135. package/dist/server/emailBinding.d.ts +72 -0
  136. package/dist/server/emailBinding.d.ts.map +1 -0
  137. package/dist/server/emailBinding.js +124 -0
  138. package/dist/server/emit.d.ts +63 -0
  139. package/dist/server/emit.d.ts.map +1 -0
  140. package/dist/server/emit.js +101 -0
  141. package/dist/server/env.d.ts +44 -0
  142. package/dist/server/env.d.ts.map +1 -0
  143. package/dist/server/env.js +1 -0
  144. package/dist/server/everyApp.d.ts +65 -19
  145. package/dist/server/everyApp.d.ts.map +1 -1
  146. package/dist/server/everyApp.js +195 -30
  147. package/dist/server/fromMcpTools.d.ts +89 -0
  148. package/dist/server/fromMcpTools.d.ts.map +1 -0
  149. package/dist/server/fromMcpTools.js +192 -0
  150. package/dist/server/gatewayFetch.d.ts +54 -14
  151. package/dist/server/gatewayFetch.d.ts.map +1 -1
  152. package/dist/server/gatewayFetch.js +201 -37
  153. package/dist/server/gatewayUrl.d.ts +13 -0
  154. package/dist/server/gatewayUrl.d.ts.map +1 -0
  155. package/dist/server/gatewayUrl.js +34 -0
  156. package/dist/server/index.d.ts +23 -3
  157. package/dist/server/index.d.ts.map +1 -1
  158. package/dist/server/index.js +19 -2
  159. package/dist/server/integrationFetch.d.ts +162 -0
  160. package/dist/server/integrationFetch.d.ts.map +1 -0
  161. package/dist/server/integrationFetch.js +688 -0
  162. package/dist/server/listMembers.d.ts +32 -0
  163. package/dist/server/listMembers.d.ts.map +1 -0
  164. package/dist/server/listMembers.js +71 -0
  165. package/dist/server/nodeServer.d.ts +48 -0
  166. package/dist/server/nodeServer.d.ts.map +1 -0
  167. package/dist/server/nodeServer.js +45 -0
  168. package/dist/server/refusal.d.ts +55 -0
  169. package/dist/server/refusal.d.ts.map +1 -0
  170. package/dist/server/refusal.js +193 -0
  171. package/dist/server/sendEmail.d.ts +39 -0
  172. package/dist/server/sendEmail.d.ts.map +1 -0
  173. package/dist/server/sendEmail.js +114 -0
  174. package/dist/server/tools.d.ts +184 -0
  175. package/dist/server/tools.d.ts.map +1 -0
  176. package/dist/server/tools.js +347 -0
  177. package/dist/server/toolsEndpoint.d.ts +32 -0
  178. package/dist/server/toolsEndpoint.d.ts.map +1 -0
  179. package/dist/server/toolsEndpoint.js +237 -0
  180. package/dist/tanstack-start/index.d.ts +9 -0
  181. package/dist/tanstack-start/index.d.ts.map +1 -0
  182. package/dist/tanstack-start/index.js +29 -0
  183. package/dist/testing/index.d.ts +93 -0
  184. package/dist/testing/index.d.ts.map +1 -0
  185. package/dist/testing/index.js +156 -0
  186. package/package.json +42 -8
  187. package/dist/server/mcp.d.ts +0 -66
  188. package/dist/server/mcp.d.ts.map +0 -1
  189. package/dist/server/mcp.js +0 -147
@@ -0,0 +1,192 @@
1
+ /**
2
+ * `fromMcpTools()` — an app's existing MCP tools as `defineTools()` entries.
3
+ *
4
+ * const tools: McpToolLike[] = [];
5
+ * registerMyTools((name, config, handler) =>
6
+ * tools.push({ name, ...config, handler }),
7
+ * );
8
+ * export default everyApp(handler, {
9
+ * tools: defineTools(fromMcpTools(tools), { instructions }),
10
+ * });
11
+ *
12
+ * Takes the shape `McpServer.registerTool(name, config, handler)` is called
13
+ * with (or what a low-level server's `tools/list` returns, plus a handler),
14
+ * structurally: the SDK takes no dependency on `@modelcontextprotocol/sdk`,
15
+ * and a live `McpServer` keeps its registry private, so the app hands over
16
+ * the list it registers from.
17
+ */
18
+ import { TOOL_NAME_PATTERN } from "../internal/index.js";
19
+ import { ToolError, toolResult, } from "./tools.js";
20
+ const JSON_SCHEMA_TARGET = "draft-2020-12";
21
+ /**
22
+ * Adapt MCP tools into `defineTools()` entries, keyed by tool name, to spread
23
+ * beside the app's own: `defineTools({ ...fromMcpTools(list), my_tool })`.
24
+ *
25
+ * - `title`, `description` (the name when absent), `idempotentHint` and
26
+ * `openWorldHint` carry over; risk as {@link FromMcpToolsOptions.risk}.
27
+ * - A result's text blocks, joined by a blank line, are what the model
28
+ * reads; `structuredContent` is sent as structured content (checked
29
+ * against `outputSchema` when there is one). Other blocks are dropped.
30
+ * - `isError: true` becomes a {@link ToolError} with the result's text.
31
+ *
32
+ * Names must already be lowercase snake_case; `defineTools()` checks them.
33
+ */
34
+ export function fromMcpTools(tools, options = {}) {
35
+ const out = {};
36
+ for (const tool of tools) {
37
+ const problem = (message) => new TypeError(`fromMcpTools: tool "${tool?.name}" ${message}`);
38
+ if (!tool || typeof tool.name !== "string") {
39
+ throw new TypeError("fromMcpTools: every tool needs a name");
40
+ }
41
+ if (!TOOL_NAME_PATTERN.test(tool.name)) {
42
+ throw problem("must be named in lowercase snake_case: a letter, then letters, digits or _ (at most 48 characters); rename it in the list");
43
+ }
44
+ if (Object.prototype.hasOwnProperty.call(out, tool.name)) {
45
+ throw problem("is listed twice");
46
+ }
47
+ if (typeof tool.handler !== "function") {
48
+ throw problem("needs a handler function");
49
+ }
50
+ const output = tool.outputSchema === undefined
51
+ ? undefined
52
+ : toToolSchema(tool.outputSchema, problem);
53
+ const annotations = tool.annotations ?? {};
54
+ const title = tool.title ?? annotations.title;
55
+ out[tool.name] = {
56
+ ...(title !== undefined ? { title } : {}),
57
+ description: tool.description?.trim() ? tool.description : tool.name,
58
+ risk: options.risk?.(tool) ?? defaultRisk(annotations),
59
+ input: toToolSchema(tool.inputSchema ?? {}, problem),
60
+ ...(output ? { output } : {}),
61
+ ...(annotations.idempotentHint !== undefined
62
+ ? { idempotent: annotations.idempotentHint }
63
+ : {}),
64
+ ...(annotations.openWorldHint !== undefined
65
+ ? { openWorld: annotations.openWorldHint }
66
+ : {}),
67
+ handler: async (args, context) => {
68
+ const extra = options.context
69
+ ? await options.context(context)
70
+ : context;
71
+ const result = await tool.handler(args, extra);
72
+ return fromCallToolResult(result);
73
+ },
74
+ };
75
+ }
76
+ return out;
77
+ }
78
+ function defaultRisk(annotations) {
79
+ if (annotations.readOnlyHint === true)
80
+ return "read";
81
+ return annotations.destructiveHint === true ? "destructive" : "write";
82
+ }
83
+ function fromCallToolResult(result) {
84
+ if (!isRecord(result)) {
85
+ throw new Error("the MCP tool did not return a CallToolResult");
86
+ }
87
+ const text = (Array.isArray(result.content) ? result.content : [])
88
+ .flatMap((part) => isRecord(part) && part.type === "text" && typeof part.text === "string"
89
+ ? [part.text]
90
+ : [])
91
+ .join("\n\n");
92
+ if (result.isError === true)
93
+ throw new ToolError(text || "The tool failed.");
94
+ const structured = result.structuredContent;
95
+ if (isRecord(structured) && !Array.isArray(structured)) {
96
+ return toolResult({ text, structured });
97
+ }
98
+ return text;
99
+ }
100
+ function isRecord(value) {
101
+ return typeof value === "object" && value !== null;
102
+ }
103
+ function isStandardWithJson(value) {
104
+ if (!isRecord(value))
105
+ return false;
106
+ const standard = value["~standard"];
107
+ return (isRecord(standard) &&
108
+ typeof standard.validate === "function" &&
109
+ isRecord(standard.jsonSchema));
110
+ }
111
+ function isPlainToolSchema(value) {
112
+ return isRecord(value.jsonSchema) && typeof value.validate === "function";
113
+ }
114
+ function toToolSchema(schema, problem) {
115
+ if (!isRecord(schema) || Array.isArray(schema)) {
116
+ throw problem("has a schema that is not an object");
117
+ }
118
+ if (isStandardWithJson(schema) || isPlainToolSchema(schema)) {
119
+ return schema;
120
+ }
121
+ if ("~standard" in schema) {
122
+ throw problem("has a schema that doesn't convert to JSON Schema (zod >= 4.2 does)");
123
+ }
124
+ const values = Object.values(schema);
125
+ if (values.every((value) => isRecord(value) && "~standard" in value)) {
126
+ if (!values.every(isStandardWithJson)) {
127
+ throw problem("has a raw shape whose fields don't convert to JSON Schema (zod >= 4.2 does)");
128
+ }
129
+ return rawShapeSchema(schema);
130
+ }
131
+ return jsonSchemaOnly(schema);
132
+ }
133
+ /** A plain JSON Schema: described as is; any object passes. */
134
+ function jsonSchemaOnly(jsonSchema) {
135
+ return {
136
+ jsonSchema,
137
+ validate: (value) => isRecord(value) && !Array.isArray(value)
138
+ ? { value }
139
+ : { issues: [{ message: "Expected an object" }] },
140
+ };
141
+ }
142
+ /**
143
+ * `{ key: schema }` as an object schema, the way `McpServer` wraps one in
144
+ * `z.object()`: unknown keys are dropped, and a field is optional when its
145
+ * schema accepts `undefined`.
146
+ */
147
+ function rawShapeSchema(shape) {
148
+ const properties = {};
149
+ const required = [];
150
+ for (const [key, field] of Object.entries(shape)) {
151
+ const { $schema: _, ...property } = field["~standard"].jsonSchema.input({
152
+ target: JSON_SCHEMA_TARGET,
153
+ });
154
+ properties[key] = property;
155
+ const absent = field["~standard"].validate(undefined);
156
+ // An async validator can't be asked here; call the field required.
157
+ if (absent instanceof Promise || absent.issues)
158
+ required.push(key);
159
+ }
160
+ return {
161
+ jsonSchema: {
162
+ type: "object",
163
+ properties,
164
+ ...(required.length > 0 ? { required } : {}),
165
+ },
166
+ validate: async (value) => {
167
+ if (!isRecord(value) || Array.isArray(value)) {
168
+ return { issues: [{ message: "Expected an object" }] };
169
+ }
170
+ const parsed = {};
171
+ const issues = [];
172
+ for (const [key, field] of Object.entries(shape)) {
173
+ const result = await field["~standard"].validate(value[key]);
174
+ if (result.issues) {
175
+ for (const issue of result.issues) {
176
+ issues.push({
177
+ message: issue.message,
178
+ path: [
179
+ key,
180
+ ...(issue.path ?? []).map((segment) => typeof segment === "object" ? segment.key : segment),
181
+ ],
182
+ });
183
+ }
184
+ }
185
+ else if (key in value || result.value !== undefined) {
186
+ parsed[key] = result.value;
187
+ }
188
+ }
189
+ return issues.length > 0 ? { issues } : { value: parsed };
190
+ },
191
+ };
192
+ }
@@ -1,21 +1,61 @@
1
- interface GatewayServiceBinding {
1
+ import { type GatewayCallFor } from "./attribution.js";
2
+ export declare const BINDING_ORIGIN = "http://every-app-gateway.internal";
3
+ export interface GatewayServiceBinding {
2
4
  fetch(input: RequestInfo | URL, init?: RequestInit): Promise<Response>;
3
5
  }
4
- export interface GatewayFetchEnv {
5
- EVERY_APP_GATEWAY?: GatewayServiceBinding;
6
- EVERYAPP_DEV?: string | boolean;
7
- OPENAI_API_KEY?: string;
8
- }
6
+ /**
7
+ * The Gateway the SDK's services call: the `EVERY_APP_GATEWAY` service
8
+ * binding when deployed; under `everyapp dev --gateway` (linked dev,
9
+ * docs/design/linked-dev.md) a `{ fetch }` that sends the same requests to
10
+ * the gateway-lite's loopback forwarder, which adds the person's token and
11
+ * forwards them to the real Gateway's `/linked-dev/<app>` route. Undefined
12
+ * with neither (stub and mirror modes: the `.dev.vars` fallbacks). A value
13
+ * under the binding's name that isn't one is answered as before by each
14
+ * caller (`ConfigurationError`).
15
+ */
16
+ export declare function gatewayBinding(env: object): GatewayServiceBinding | undefined;
17
+ /**
18
+ * The linked dev shim: a request to the binding's origin goes to the
19
+ * forwarder's URL with the same path and query, the run's nonce on it. The
20
+ * forwarder answers as the Gateway did, refusals included; nothing here
21
+ * falls back to a local key.
22
+ */
23
+ export declare function linkedDevBinding(forwarderUrl: string, nonce: string): GatewayServiceBinding;
9
24
  export interface CreateGatewayFetchOptions {
10
- env: GatewayFetchEnv;
11
- /** The inbound app request whose verified identity may be forwarded. */
12
- request: Request;
25
+ /**
26
+ * The Worker env, as it is: the EVERY_APP_GATEWAY binding when deployed,
27
+ * or in local dev EVERYAPP_DEV and the provider's settings in
28
+ * `.dev.vars` (`OPENROUTER_API_KEY`, …). No cast needed.
29
+ */
30
+ env: object;
31
+ /**
32
+ * Whom the call is for. Left out, the request `everyApp()` is serving
33
+ * (its user, while the identity is good) or the organization
34
+ * `withOrganization()` named; outside both, `RequestContextError`.
35
+ * Explicitly: the inbound request, or `{ background: true,
36
+ * organizationId }` for work no person started (crons, Workflows,
37
+ * queues). A shared app's Worker must end up with one or the other
38
+ * ({@link AttributionError}).
39
+ */
40
+ for?: GatewayCallFor;
41
+ /**
42
+ * `true`: answer null instead of throwing `ConfigurationError` when AI
43
+ * is unavailable (no binding, and in local dev no provider key), so a
44
+ * feature that can do without a model checks for null. A binding that
45
+ * isn't one, and an attribution mistake, still throw.
46
+ */
47
+ optional?: boolean;
13
48
  }
14
49
  /**
15
- * Create an OpenAI-compatible fetch function backed by the private gateway
16
- * service binding. In local dev only, the developer's own OPENAI_API_KEY is a
17
- * direct-provider fallback when no binding exists.
50
+ * Create a fetch for the gateway's AI providers (`/api/ai/<provider>/…`),
51
+ * backed by the private gateway service binding. In local dev only, the
52
+ * developer's own provider key from `.dev.vars` is a direct-provider
53
+ * fallback when no binding exists.
18
54
  */
19
- export declare function createGatewayFetch({ env, request: inboundRequest, }: CreateGatewayFetchOptions): typeof fetch;
20
- export {};
55
+ export declare function createGatewayFetch(options: CreateGatewayFetchOptions & {
56
+ optional: true;
57
+ }): typeof fetch | null;
58
+ export declare function createGatewayFetch(options: CreateGatewayFetchOptions): typeof fetch;
59
+ /** A copy of `source` aimed at `url`, streaming its body rather than buffering it. */
60
+ export declare function streamingRequest(url: string, source: Request, headers: Headers): Request;
21
61
  //# sourceMappingURL=gatewayFetch.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"gatewayFetch.d.ts","sourceRoot":"","sources":["../../src/server/gatewayFetch.ts"],"names":[],"mappings":"AAMA,UAAU,qBAAqB;IAC7B,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxE;AAED,MAAM,WAAW,eAAe;IAC9B,iBAAiB,CAAC,EAAE,qBAAqB,CAAC;IAC1C,YAAY,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC;IAChC,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,MAAM,WAAW,yBAAyB;IACxC,GAAG,EAAE,eAAe,CAAC;IACrB,wEAAwE;IACxE,OAAO,EAAE,OAAO,CAAC;CAClB;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,GAAG,EACH,OAAO,EAAE,cAAc,GACxB,EAAE,yBAAyB,GAAG,OAAO,KAAK,CAyC1C"}
1
+ {"version":3,"file":"gatewayFetch.d.ts","sourceRoot":"","sources":["../../src/server/gatewayFetch.ts"],"names":[],"mappings":"AAiBA,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAE1B,eAAO,MAAM,cAAc,sCAAsC,CAAC;AAGlE,MAAM,WAAW,qBAAqB;IACpC,KAAK,CAAC,KAAK,EAAE,WAAW,GAAG,GAAG,EAAE,IAAI,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,CAAC,CAAC;CACxE;AAED;;;;;;;;;GASG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,GAAG,qBAAqB,GAAG,SAAS,CAW7E;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,YAAY,EAAE,MAAM,EACpB,KAAK,EAAE,MAAM,GACZ,qBAAqB,CAiBvB;AAeD,MAAM,WAAW,yBAAyB;IACxC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;;;OAKG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GAAG;IAAE,QAAQ,EAAE,IAAI,CAAA;CAAE,GACtD,OAAO,KAAK,GAAG,IAAI,CAAC;AACvB,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,yBAAyB,GACjC,OAAO,KAAK,CAAC;AA2HhB,sFAAsF;AACtF,wBAAgB,gBAAgB,CAC9B,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,OAAO,EACf,OAAO,EAAE,OAAO,GACf,OAAO,CAUT"}
@@ -1,44 +1,142 @@
1
- import { ConfigurationError, IDENTITY_HEADER } from "../internal/index.js";
2
- const BINDING_ORIGIN = "http://every-app-gateway.internal";
3
- const OPENAI_UPSTREAM_ORIGIN = "https://api.openai.com";
4
- const OPENAI_PROXY_PREFIX = "/api/ai/openai";
1
+ import { AI_DEFAULT_MODEL, AI_DEFAULT_PROVIDER, AI_DEFAULT_ROUTES, aiProviderSettings, authorizationOf, ConfigurationError, DEV_AI_PROVIDERS, DEV_ENV, devAiProvider, joinProviderUrl, LINKED_DEV_HEADER, LINKED_DEV_NONCE_ENV, LINKED_DEV_URL_ENV, resolveAiDefault, } from "../internal/index.js";
2
+ import { applyAttribution, attributionFor, } from "./attribution.js";
3
+ export const BINDING_ORIGIN = "http://every-app-gateway.internal";
4
+ const AI_PROXY_PREFIX = "/api/ai/";
5
5
  /**
6
- * Create an OpenAI-compatible fetch function backed by the private gateway
7
- * service binding. In local dev only, the developer's own OPENAI_API_KEY is a
8
- * direct-provider fallback when no binding exists.
6
+ * The Gateway the SDK's services call: the `EVERY_APP_GATEWAY` service
7
+ * binding when deployed; under `everyapp dev --gateway` (linked dev,
8
+ * docs/design/linked-dev.md) a `{ fetch }` that sends the same requests to
9
+ * the gateway-lite's loopback forwarder, which adds the person's token and
10
+ * forwards them to the real Gateway's `/linked-dev/<app>` route. Undefined
11
+ * with neither (stub and mirror modes: the `.dev.vars` fallbacks). A value
12
+ * under the binding's name that isn't one is answered as before by each
13
+ * caller (`ConfigurationError`).
9
14
  */
10
- export function createGatewayFetch({ env, request: inboundRequest, }) {
11
- const binding = env.EVERY_APP_GATEWAY;
12
- const devProviderKey = env.EVERYAPP_DEV
13
- ? env.OPENAI_API_KEY?.trim()
14
- : undefined;
15
+ export function gatewayBinding(env) {
16
+ const values = env;
17
+ const binding = values["EVERY_APP_GATEWAY"];
18
+ if (binding)
19
+ return binding;
20
+ if (!values[DEV_ENV])
21
+ return undefined;
22
+ const url = values[LINKED_DEV_URL_ENV];
23
+ const nonce = values[LINKED_DEV_NONCE_ENV];
24
+ if (typeof url !== "string" || !url.trim() || typeof nonce !== "string") {
25
+ return undefined;
26
+ }
27
+ return linkedDevBinding(url.trim(), nonce);
28
+ }
29
+ /**
30
+ * The linked dev shim: a request to the binding's origin goes to the
31
+ * forwarder's URL with the same path and query, the run's nonce on it. The
32
+ * forwarder answers as the Gateway did, refusals included; nothing here
33
+ * falls back to a local key.
34
+ */
35
+ export function linkedDevBinding(forwarderUrl, nonce) {
36
+ const base = forwarderUrl.replace(/\/+$/, "");
37
+ return {
38
+ fetch(input, init) {
39
+ const outbound = new Request(input, init);
40
+ const url = new URL(outbound.url);
41
+ const headers = new Headers(outbound.headers);
42
+ headers.set(LINKED_DEV_HEADER, nonce);
43
+ return fetch(streamingRequest(`${base}${url.pathname}${url.search}`, outbound, headers));
44
+ },
45
+ };
46
+ }
47
+ export function createGatewayFetch({ env: workerEnv, for: explicitTarget, optional = false, }) {
48
+ const env = workerEnv;
49
+ // Checked now, so a call nobody's fails where the fetch is made; and
50
+ // again per call, where an identity may since have neared its expiry.
51
+ attributionFor(env, explicitTarget, "createGatewayFetch");
52
+ const binding = gatewayBinding(env);
53
+ const devProviders = env.EVERYAPP_DEV ? localProviders(env) : {};
15
54
  if (binding && typeof binding.fetch !== "function") {
16
55
  throw new ConfigurationError("EVERY_APP_GATEWAY is configured but is not a valid service binding.");
17
56
  }
18
- if (!binding && !devProviderKey) {
19
- throw new ConfigurationError("AI gateway unavailable: deploy with the EVERY_APP_GATEWAY binding, or set OPENAI_API_KEY in .dev.vars for direct local development.");
57
+ if (!binding && Object.keys(devProviders).length === 0) {
58
+ if (optional)
59
+ return null;
60
+ throw new ConfigurationError(`AI gateway unavailable: deploy with the EVERY_APP_GATEWAY binding, or set the provider's key (${listOf(Object.values(DEV_AI_PROVIDERS).map((spec) => settingsNames(spec, "with")), "or")}) in .dev.vars for direct local development.`, { code: "ai_provider_not_configured" });
20
61
  }
21
62
  return async (input, init) => {
63
+ const target = attributionFor(env, explicitTarget, "createGatewayFetch");
22
64
  const outbound = new Request(input, init);
23
65
  const headers = new Headers(outbound.headers);
24
66
  headers.delete("authorization");
25
- const identity = inboundRequest.headers.get(IDENTITY_HEADER);
26
- if (identity)
27
- headers.set(IDENTITY_HEADER, identity);
28
- else
29
- headers.delete(IDENTITY_HEADER);
30
67
  if (binding) {
31
- const target = new URL(outbound.url);
32
- const bindingRequest = streamingRequest(`${BINDING_ORIGIN}${target.pathname}${target.search}`, outbound, headers);
68
+ applyAttribution(headers, target);
69
+ const url = new URL(outbound.url);
70
+ const bindingRequest = streamingRequest(`${BINDING_ORIGIN}${url.pathname}${url.search}`, outbound, headers);
33
71
  return binding.fetch(bindingRequest);
34
72
  }
35
- const providerUrl = directOpenAiUrl(outbound.url);
36
- headers.delete(IDENTITY_HEADER);
37
- headers.set("authorization", `Bearer ${devProviderKey}`);
38
- return fetch(streamingRequest(providerUrl, outbound, headers));
73
+ const direct = directProviderPath(outbound.url, env);
74
+ const { provider, spec, path, search } = direct;
75
+ const dev = devProviders[provider];
76
+ if (!dev) {
77
+ throw new ConfigurationError(`Set ${settingsNames(spec)} in .dev.vars to call ${provider} in local development.`, {
78
+ code: "ai_provider_not_configured",
79
+ settings: aiProviderSettings(spec),
80
+ });
81
+ }
82
+ const url = joinProviderUrl(`${spec.origin}${dev.basePath}`, path, search);
83
+ if (!url)
84
+ throw new ConfigurationError("Invalid provider proxy path.");
85
+ applyAttribution(headers, undefined);
86
+ // The default route in dev: the model filled in as the gateway would.
87
+ let body = outbound;
88
+ if (direct.fillModel !== null) {
89
+ body = await withModel(outbound, direct.fillModel, headers);
90
+ }
91
+ // The developer's key, put where the provider's entry says (a bearer
92
+ // token for the three today), as the gateway would put its own.
93
+ const auth = authorizationOf(spec.auth, { [spec.keyEnv]: dev.key });
94
+ for (const [name, value] of Object.entries(auth?.headers ?? {})) {
95
+ headers.set(name, value);
96
+ }
97
+ for (const [name, value] of Object.entries(auth?.query ?? {})) {
98
+ url.searchParams.set(name, value);
99
+ }
100
+ const response = await fetch(streamingRequest(url.toString(), body, headers));
101
+ // What the gateway does to the provider's answer, so dev behaves alike.
102
+ return spec.normalizeResponse?.(path, response) ?? response;
39
103
  };
40
104
  }
41
- function streamingRequest(url, source, headers) {
105
+ /**
106
+ * `source` with `model` put into its JSON body where the app named none
107
+ * or named `default`, as the gateway's default route does. A body that
108
+ * isn't a JSON object goes through as it is.
109
+ */
110
+ async function withModel(source, model, headers) {
111
+ if (!canIncludeBody(source.method) || !source.body)
112
+ return source;
113
+ const text = await source.clone().text();
114
+ let payload;
115
+ try {
116
+ payload = JSON.parse(text);
117
+ }
118
+ catch {
119
+ return source;
120
+ }
121
+ if (!payload || typeof payload !== "object" || Array.isArray(payload)) {
122
+ return source;
123
+ }
124
+ const record = payload;
125
+ if (record["model"] === undefined ||
126
+ record["model"] === null ||
127
+ record["model"] === AI_DEFAULT_MODEL) {
128
+ record["model"] = model;
129
+ }
130
+ headers.delete("content-length");
131
+ return new Request(source.url, {
132
+ method: source.method,
133
+ headers,
134
+ body: JSON.stringify(record),
135
+ signal: source.signal,
136
+ });
137
+ }
138
+ /** A copy of `source` aimed at `url`, streaming its body rather than buffering it. */
139
+ export function streamingRequest(url, source, headers) {
42
140
  const body = canIncludeBody(source.method) ? source.body : undefined;
43
141
  const init = {
44
142
  method: source.method,
@@ -49,20 +147,86 @@ function streamingRequest(url, source, headers) {
49
147
  };
50
148
  return new Request(url, init);
51
149
  }
52
- function directOpenAiUrl(input) {
150
+ /** The providers `.dev.vars` sets every setting of, with their key and base path. */
151
+ function localProviders(env) {
152
+ const providers = {};
153
+ for (const [provider, spec] of Object.entries(DEV_AI_PROVIDERS)) {
154
+ const settings = {};
155
+ for (const name of aiProviderSettings(spec)) {
156
+ const value = env[name];
157
+ if (typeof value === "string" && value.trim()) {
158
+ settings[name] = value.trim();
159
+ }
160
+ }
161
+ const key = settings[spec.keyEnv];
162
+ // A provider is reachable only with every setting it needs.
163
+ if (!key || Object.keys(settings).length < aiProviderSettings(spec).length)
164
+ continue;
165
+ providers[provider] = { key, basePath: spec.basePath?.(settings) ?? "" };
166
+ }
167
+ return providers;
168
+ }
169
+ function directProviderPath(input, env) {
53
170
  const incoming = new URL(input);
54
- if (incoming.pathname !== OPENAI_PROXY_PREFIX &&
55
- !incoming.pathname.startsWith(`${OPENAI_PROXY_PREFIX}/`)) {
56
- throw new ConfigurationError(`Direct local provider fallback only supports ${OPENAI_PROXY_PREFIX} paths.`);
171
+ const match = incoming.pathname.match(/^\/api\/ai\/([a-z][a-z0-9-]*)(\/.*)?$/);
172
+ let provider = match?.[1];
173
+ let path = match?.[2] || "/";
174
+ let fillModel = null;
175
+ if (provider === AI_DEFAULT_PROVIDER) {
176
+ // The default in dev, by the gateway's rule on the developer's own
177
+ // `.dev.vars`: the first provider of the order with every setting set,
178
+ // with its seed models (dev has no operator settings; a request that
179
+ // names a model sends it as it is).
180
+ const values = env;
181
+ const resolution = resolveAiDefault({
182
+ provider: null,
183
+ isSet: (name) => typeof values[name] === "string" &&
184
+ values[name].trim().length > 0,
185
+ });
186
+ if (!resolution.configured) {
187
+ throw new ConfigurationError(`Set ${resolution.settings.join(" and ")} (or another model provider's key) in .dev.vars to call the default model in local development.`, {
188
+ code: "ai_default_not_configured",
189
+ settings: resolution.settings,
190
+ });
191
+ }
192
+ const route = path === AI_DEFAULT_ROUTES.chat
193
+ ? resolution.chat
194
+ : path === AI_DEFAULT_ROUTES.embeddings
195
+ ? resolution.embeddings
196
+ : undefined;
197
+ if (!route) {
198
+ throw new ConfigurationError(`The default model serves ${AI_DEFAULT_ROUTES.chat} and ${AI_DEFAULT_ROUTES.embeddings} only; call /api/ai/<provider>/… for anything else.`);
199
+ }
200
+ provider = resolution.provider;
201
+ path = route.path;
202
+ fillModel =
203
+ route === resolution.chat
204
+ ? resolution.model
205
+ : (resolution.embeddingsModel ?? null);
57
206
  }
58
- const upstreamPath = incoming.pathname.slice(OPENAI_PROXY_PREFIX.length) || "/";
59
- if (!upstreamPath.startsWith("/") || upstreamPath.startsWith("//")) {
60
- throw new ConfigurationError("Invalid OpenAI proxy path.");
207
+ const spec = provider
208
+ ? devAiProvider(provider, env)
209
+ : undefined;
210
+ if (!provider || !spec) {
211
+ throw new ConfigurationError(`Direct local provider fallback only supports ${listOf([AI_DEFAULT_PROVIDER, ...Object.keys(DEV_AI_PROVIDERS)].map((name) => `${AI_PROXY_PREFIX}${name}`), "and")} paths.`);
61
212
  }
62
- const upstream = new URL(OPENAI_UPSTREAM_ORIGIN);
63
- upstream.pathname = upstreamPath;
64
- upstream.search = incoming.search;
65
- return upstream.toString();
213
+ if (path.startsWith("//") || path.includes("\\")) {
214
+ throw new ConfigurationError("Invalid provider proxy path.");
215
+ }
216
+ return { provider, spec, path, search: incoming.search, fillModel };
217
+ }
218
+ /** A provider's settings as a person reads them: `KEY`, or `KEY and SETTING`. */
219
+ function settingsNames(spec, conjunction = "and") {
220
+ const [key, ...others] = aiProviderSettings(spec);
221
+ return others.length
222
+ ? `${key} ${conjunction} ${listOf(others, "and")}`
223
+ : key;
224
+ }
225
+ /** `a`, `a and b`, `a, b and c`. */
226
+ function listOf(items, conjunction) {
227
+ return items.length < 2
228
+ ? (items[0] ?? "")
229
+ : `${items.slice(0, -1).join(", ")} ${conjunction} ${items.at(-1)}`;
66
230
  }
67
231
  function canIncludeBody(method) {
68
232
  const normalized = method.toUpperCase();
@@ -0,0 +1,13 @@
1
+ /**
2
+ * The Gateway's URL, with `path` on it: `gatewayUrl(env)` for the launcher,
3
+ * `gatewayUrl(env, "/admin/users")` for the page where owners and admins
4
+ * invite people.
5
+ *
6
+ * Read from `env.GATEWAY_URL`, which the deploy sets on every Worker of the
7
+ * app and `everyapp dev` sets to its local launcher, so the same link works
8
+ * in both. `env` is the Worker's env (any object; only `GATEWAY_URL` is
9
+ * read). Throws {@link ConfigurationError} when it is unset or not an http(s)
10
+ * URL: a Worker no deploy or `everyapp dev` built.
11
+ */
12
+ export declare function gatewayUrl(env: object, path?: string): string;
13
+ //# sourceMappingURL=gatewayUrl.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gatewayUrl.d.ts","sourceRoot":"","sources":["../../src/server/gatewayUrl.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,wBAAgB,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,SAAM,GAAG,MAAM,CAgB1D"}
@@ -0,0 +1,34 @@
1
+ /**
2
+ * `gatewayUrl()`: the one rule for a link from an app back to its Gateway
3
+ * ("‹ Every App", "Invite people", "Sign out").
4
+ */
5
+ import { ConfigurationError } from "../internal/index.js";
6
+ /** Where the Gateway is: the deploy sets it, and so does `everyapp dev`. */
7
+ const GATEWAY_URL_ENV = "GATEWAY_URL";
8
+ /**
9
+ * The Gateway's URL, with `path` on it: `gatewayUrl(env)` for the launcher,
10
+ * `gatewayUrl(env, "/admin/users")` for the page where owners and admins
11
+ * invite people.
12
+ *
13
+ * Read from `env.GATEWAY_URL`, which the deploy sets on every Worker of the
14
+ * app and `everyapp dev` sets to its local launcher, so the same link works
15
+ * in both. `env` is the Worker's env (any object; only `GATEWAY_URL` is
16
+ * read). Throws {@link ConfigurationError} when it is unset or not an http(s)
17
+ * URL: a Worker no deploy or `everyapp dev` built.
18
+ */
19
+ export function gatewayUrl(env, path = "/") {
20
+ const value = env[GATEWAY_URL_ENV];
21
+ let base;
22
+ if (typeof value === "string" && value) {
23
+ try {
24
+ base = new URL(value);
25
+ }
26
+ catch {
27
+ base = undefined;
28
+ }
29
+ }
30
+ if (!base || (base.protocol !== "https:" && base.protocol !== "http:")) {
31
+ throw new ConfigurationError(`${GATEWAY_URL_ENV} is ${value ? "not an http(s) URL" : "unset"}: everyapp deploy and everyapp dev set it on the app's Worker.`);
32
+ }
33
+ return new URL(path, base.origin).toString();
34
+ }
@@ -3,7 +3,27 @@
3
3
  *
4
4
  * There is intentionally no client-side export.
5
5
  */
6
- export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, requireEveryAppUser, type EveryAppOptions, type EveryAppManifestLike, type EveryAppHandler, type EveryAppUser, type IdentityResult, } from "./everyApp.js";
7
- export { createGatewayFetch, type CreateGatewayFetchOptions, type GatewayFetchEnv, } from "./gatewayFetch.js";
8
- export { createMcpHandler, type CreateMcpHandlerOptions, type McpToolContext, type McpToolDefinition, type McpRequestHandler, } from "./mcp.js";
6
+ export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, isAdmin, requireCurrentUser, requireEveryAppUser, type EveryAppOptions, type EveryAppManifestLike, type EveryAppHandler, type EveryAppUser, type IdentityResult, type OrgRole, } from "./everyApp.js";
7
+ export { OrganizationMismatchError, RequestContextError, currentUser, withOrganization, } from "./context.js";
8
+ export { AttributionError, type GatewayCallFor } from "./attribution.js";
9
+ export { gatewayUrl } from "./gatewayUrl.js";
10
+ export type { EveryAppEnv } from "./env.js";
11
+ /** The header a Gateway refusal carries its code in; `gatewayRefusal()` reads the rest. */
12
+ export { GATEWAY_ERROR_HEADER } from "../internal/protocol.js";
13
+ export { authorizeUrl, type AuthorizeUrlOptions } from "./authorizeUrl.js";
14
+ export { connectPath, connectUrl, type ConnectUrlOptions, } from "./connectUrl.js";
15
+ export { createGatewayFetch, type CreateGatewayFetchOptions, } from "./gatewayFetch.js";
16
+ export { ai, aiBaseUrl, aiStatus, providerBaseUrl, AI_DEFAULT_BASE_URL, type AiClient, type AiStatus, } from "./ai.js";
17
+ export { AI_NOT_CONFIGURED_CODES, GatewayRefusalError, gatewayRefusal, isAiNotConfigured, refusalFromError, type GatewayRefusal, type SetupInfo, } from "./refusal.js";
18
+ export { devAccessTokenName, integrationFetch, integrationStatus, type EmailIntegrationStatus, type IntegrationFetchOptions, type IntegrationStatus, type IntegrationStatusOf, type OAuthClientIntegrationStatus, } from "./integrationFetch.js";
19
+ export { nodeServerHandler, type NodeServer, type NodeServerHandlerOptions, } from "./nodeServer.js";
20
+ export { sendEmail, type SendEmailOptions } from "./sendEmail.js";
21
+ export { gatewayAiBinding, type GatewayAiBindingOptions } from "./aiBinding.js";
22
+ export { gatewayEmailBinding, type GatewayEmailBindingMessage, type GatewayEmailBindingOptions, } from "./emailBinding.js";
23
+ export { listMembers, type ListMembersOptions } from "./listMembers.js";
24
+ export { emit, type EmitOptions } from "./emit.js";
25
+ export type { ApiKeyCapabilityId, CapabilityId, OAuthClientCapabilityId, ConnectionAccount, EmailAddressInput, EmailAttachmentInput, SendEmailMessage, SendEmailResult, ListMembersResult, OrganizationMember, OrganizationMemberRole, EmitEventResult, } from "../internal/index.js";
26
+ export { ToolError, defineTools, toolResult, type DefineToolsOptions, type PlainToolSchema, type StandardSchemaWithJSON, type ToolContext, type ToolDefinition, type ToolResult, type ToolSchema, type ToolSet, } from "./tools.js";
27
+ export type { ToolRisk } from "../internal/index.js";
28
+ export { fromMcpTools, type FromMcpToolsOptions, type McpToolAnnotationsLike, type McpToolLike, type McpToolResultLike, type McpToolSchemaLike, } from "./fromMcpTools.js";
9
29
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,kBAAkB,EAClB,aAAa,EACb,QAAQ,EACR,eAAe,EACf,QAAQ,EACR,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,eAAe,GACrB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,gBAAgB,EAChB,KAAK,uBAAuB,EAC5B,KAAK,cAAc,EACnB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,GACvB,MAAM,UAAU,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/server/index.ts"],"names":[],"mappings":"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"}