@every-app/sdk 0.3.0-rc.1 → 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.
- package/LICENSE +21 -0
- package/README.md +1 -1
- package/dist/cloudflare/catalogSettings.generated.d.ts +81 -0
- package/dist/cloudflare/catalogSettings.generated.d.ts.map +1 -0
- package/dist/cloudflare/catalogSettings.generated.js +174 -0
- package/dist/cloudflare/index.d.ts +3 -2
- package/dist/cloudflare/index.d.ts.map +1 -1
- package/dist/cloudflare/index.js +4 -1
- package/dist/cloudflare/sentinel.d.ts +60 -2
- package/dist/cloudflare/sentinel.d.ts.map +1 -1
- package/dist/cloudflare/sentinel.js +37 -2
- package/dist/cloudflare/worker.d.ts +357 -63
- package/dist/cloudflare/worker.d.ts.map +1 -1
- package/dist/cloudflare/worker.js +363 -104
- package/dist/dev/index.d.ts +1 -1
- package/dist/dev/index.d.ts.map +1 -1
- package/dist/dev/index.js +1 -1
- package/dist/dev/keypair.d.ts +2 -0
- package/dist/dev/keypair.d.ts.map +1 -1
- package/dist/dev/keypair.js +2 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +5 -0
- package/dist/internal/aiDefault.d.ts +204 -0
- package/dist/internal/aiDefault.d.ts.map +1 -0
- package/dist/internal/aiDefault.js +334 -0
- package/dist/internal/aiProviders.d.ts +7 -2
- package/dist/internal/aiProviders.d.ts.map +1 -1
- package/dist/internal/aiProviders.js +17 -4
- package/dist/internal/appSettings.d.ts +82 -4
- package/dist/internal/appSettings.d.ts.map +1 -1
- package/dist/internal/appSettings.js +204 -29
- package/dist/internal/audit.d.ts +108 -0
- package/dist/internal/audit.d.ts.map +1 -0
- package/dist/internal/audit.js +235 -0
- package/dist/internal/capabilities.d.ts +2268 -438
- package/dist/internal/capabilities.d.ts.map +1 -1
- package/dist/internal/capabilities.js +128 -539
- package/dist/internal/catalog/commerce.d.ts +394 -0
- package/dist/internal/catalog/commerce.d.ts.map +1 -0
- package/dist/internal/catalog/commerce.js +477 -0
- package/dist/internal/catalog/comms.d.ts +375 -0
- package/dist/internal/catalog/comms.d.ts.map +1 -0
- package/dist/internal/catalog/comms.js +520 -0
- package/dist/internal/catalog/index.d.ts +1973 -0
- package/dist/internal/catalog/index.d.ts.map +1 -0
- package/dist/internal/catalog/index.js +19 -0
- package/dist/internal/catalog/inference.d.ts +393 -0
- package/dist/internal/catalog/inference.d.ts.map +1 -0
- package/dist/internal/catalog/inference.js +460 -0
- package/dist/internal/catalog/infra.d.ts +423 -0
- package/dist/internal/catalog/infra.d.ts.map +1 -0
- package/dist/internal/catalog/infra.js +543 -0
- package/dist/internal/catalog/search.d.ts +400 -0
- package/dist/internal/catalog/search.d.ts.map +1 -0
- package/dist/internal/catalog/search.js +463 -0
- package/dist/internal/devProviders.d.ts +2 -2
- package/dist/internal/devProviders.d.ts.map +1 -1
- package/dist/internal/devProviders.js +19 -1
- package/dist/internal/events.d.ts +13 -2
- package/dist/internal/events.d.ts.map +1 -1
- package/dist/internal/events.js +47 -4
- package/dist/internal/gatewaySettings.d.ts +3 -2
- package/dist/internal/gatewaySettings.d.ts.map +1 -1
- package/dist/internal/gatewaySettings.js +12 -6
- package/dist/internal/identity.d.ts +41 -4
- package/dist/internal/identity.d.ts.map +1 -1
- package/dist/internal/identity.js +48 -10
- package/dist/internal/index.d.ts +6 -1
- package/dist/internal/index.d.ts.map +1 -1
- package/dist/internal/index.js +6 -1
- package/dist/internal/members.d.ts +3 -2
- package/dist/internal/members.d.ts.map +1 -1
- package/dist/internal/oauthClient.d.ts +10 -12
- package/dist/internal/oauthClient.d.ts.map +1 -1
- package/dist/internal/oauthClient.js +20 -81
- package/dist/internal/oauthPresets.d.ts +33 -0
- package/dist/internal/oauthPresets.d.ts.map +1 -0
- package/dist/internal/oauthPresets.js +1064 -0
- package/dist/internal/oauthScopes.d.ts +56 -1
- package/dist/internal/oauthScopes.d.ts.map +1 -1
- package/dist/internal/oauthScopes.js +98 -4
- package/dist/internal/oauthSpec.d.ts +102 -0
- package/dist/internal/oauthSpec.d.ts.map +1 -0
- package/dist/internal/oauthSpec.js +789 -0
- package/dist/internal/protocol.d.ts +64 -1
- package/dist/internal/protocol.d.ts.map +1 -1
- package/dist/internal/protocol.js +51 -1
- package/dist/internal/providerRegistry.d.ts +77 -6
- package/dist/internal/providerRegistry.d.ts.map +1 -1
- package/dist/internal/providerRegistry.js +178 -8
- package/dist/internal/providerSpec.d.ts +18 -7
- package/dist/internal/providerSpec.d.ts.map +1 -1
- package/dist/internal/providerSpec.js +442 -34
- package/dist/internal/signInProviders.d.ts +104 -0
- package/dist/internal/signInProviders.d.ts.map +1 -0
- package/dist/internal/signInProviders.js +245 -0
- package/dist/manifest.d.ts +238 -0
- package/dist/manifest.d.ts.map +1 -0
- package/dist/manifest.js +30 -0
- package/dist/server/ai.d.ts +111 -0
- package/dist/server/ai.d.ts.map +1 -0
- package/dist/server/ai.js +145 -0
- package/dist/server/aiBinding.d.ts +68 -0
- package/dist/server/aiBinding.d.ts.map +1 -0
- package/dist/server/aiBinding.js +294 -0
- package/dist/server/attribution.d.ts +9 -5
- package/dist/server/attribution.d.ts.map +1 -1
- package/dist/server/attribution.js +12 -4
- package/dist/server/authorizeUrl.d.ts +1 -1
- package/dist/server/authorizeUrl.d.ts.map +1 -1
- package/dist/server/authorizeUrl.js +2 -6
- package/dist/server/connectUrl.d.ts +21 -0
- package/dist/server/connectUrl.d.ts.map +1 -0
- package/dist/server/connectUrl.js +37 -0
- package/dist/server/context.d.ts +68 -0
- package/dist/server/context.d.ts.map +1 -0
- package/dist/server/context.js +117 -0
- package/dist/server/emailBinding.d.ts +72 -0
- package/dist/server/emailBinding.d.ts.map +1 -0
- package/dist/server/emailBinding.js +124 -0
- package/dist/server/emit.d.ts +1 -1
- package/dist/server/emit.d.ts.map +1 -1
- package/dist/server/emit.js +7 -7
- package/dist/server/env.d.ts +44 -0
- package/dist/server/env.d.ts.map +1 -0
- package/dist/server/env.js +1 -0
- package/dist/server/everyApp.d.ts +27 -7
- package/dist/server/everyApp.d.ts.map +1 -1
- package/dist/server/everyApp.js +106 -5
- package/dist/server/fromMcpTools.d.ts +89 -0
- package/dist/server/fromMcpTools.d.ts.map +1 -0
- package/dist/server/fromMcpTools.js +192 -0
- package/dist/server/gatewayFetch.d.ts +42 -18
- package/dist/server/gatewayFetch.d.ts.map +1 -1
- package/dist/server/gatewayFetch.js +138 -19
- package/dist/server/gatewayUrl.d.ts +13 -0
- package/dist/server/gatewayUrl.d.ts.map +1 -0
- package/dist/server/gatewayUrl.js +34 -0
- package/dist/server/index.d.ts +15 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +12 -2
- package/dist/server/integrationFetch.d.ts +70 -39
- package/dist/server/integrationFetch.d.ts.map +1 -1
- package/dist/server/integrationFetch.js +244 -82
- package/dist/server/listMembers.d.ts +1 -1
- package/dist/server/listMembers.d.ts.map +1 -1
- package/dist/server/listMembers.js +8 -11
- package/dist/server/refusal.d.ts +55 -0
- package/dist/server/refusal.d.ts.map +1 -0
- package/dist/server/refusal.js +193 -0
- package/dist/server/sendEmail.d.ts +1 -1
- package/dist/server/sendEmail.d.ts.map +1 -1
- package/dist/server/sendEmail.js +7 -7
- package/dist/server/toolsEndpoint.d.ts.map +1 -1
- package/dist/server/toolsEndpoint.js +11 -5
- package/dist/tanstack-start/index.d.ts +9 -0
- package/dist/tanstack-start/index.d.ts.map +1 -0
- package/dist/tanstack-start/index.js +29 -0
- package/dist/testing/index.d.ts +93 -0
- package/dist/testing/index.d.ts.map +1 -0
- package/dist/testing/index.js +156 -0
- package/package.json +35 -14
|
@@ -1,24 +1,66 @@
|
|
|
1
|
-
import { aiProviderSettings, authorizationOf, ConfigurationError, DEV_AI_PROVIDERS, devAiProvider, joinProviderUrl, } from "../internal/index.js";
|
|
2
|
-
import { applyAttribution,
|
|
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
3
|
export const BINDING_ORIGIN = "http://every-app-gateway.internal";
|
|
4
4
|
const AI_PROXY_PREFIX = "/api/ai/";
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
*
|
|
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`).
|
|
10
14
|
*/
|
|
11
|
-
export function
|
|
12
|
-
|
|
13
|
-
const binding =
|
|
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);
|
|
14
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
57
|
if (!binding && Object.keys(devProviders).length === 0) {
|
|
19
|
-
|
|
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");
|
|
@@ -28,15 +70,24 @@ export function createGatewayFetch({ env, for: target, }) {
|
|
|
28
70
|
const bindingRequest = streamingRequest(`${BINDING_ORIGIN}${url.pathname}${url.search}`, outbound, headers);
|
|
29
71
|
return binding.fetch(bindingRequest);
|
|
30
72
|
}
|
|
31
|
-
const
|
|
73
|
+
const direct = directProviderPath(outbound.url, env);
|
|
74
|
+
const { provider, spec, path, search } = direct;
|
|
32
75
|
const dev = devProviders[provider];
|
|
33
76
|
if (!dev) {
|
|
34
|
-
throw new ConfigurationError(`Set ${settingsNames(spec)} in .dev.vars to call ${provider} in local development
|
|
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
|
+
});
|
|
35
81
|
}
|
|
36
82
|
const url = joinProviderUrl(`${spec.origin}${dev.basePath}`, path, search);
|
|
37
83
|
if (!url)
|
|
38
84
|
throw new ConfigurationError("Invalid provider proxy path.");
|
|
39
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
|
+
}
|
|
40
91
|
// The developer's key, put where the provider's entry says (a bearer
|
|
41
92
|
// token for the three today), as the gateway would put its own.
|
|
42
93
|
const auth = authorizationOf(spec.auth, { [spec.keyEnv]: dev.key });
|
|
@@ -46,11 +97,44 @@ export function createGatewayFetch({ env, for: target, }) {
|
|
|
46
97
|
for (const [name, value] of Object.entries(auth?.query ?? {})) {
|
|
47
98
|
url.searchParams.set(name, value);
|
|
48
99
|
}
|
|
49
|
-
const response = await fetch(streamingRequest(url.toString(),
|
|
100
|
+
const response = await fetch(streamingRequest(url.toString(), body, headers));
|
|
50
101
|
// What the gateway does to the provider's answer, so dev behaves alike.
|
|
51
102
|
return spec.normalizeResponse?.(path, response) ?? response;
|
|
52
103
|
};
|
|
53
104
|
}
|
|
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
|
+
}
|
|
54
138
|
/** A copy of `source` aimed at `url`, streaming its body rather than buffering it. */
|
|
55
139
|
export function streamingRequest(url, source, headers) {
|
|
56
140
|
const body = canIncludeBody(source.method) ? source.body : undefined;
|
|
@@ -82,19 +166,54 @@ function localProviders(env) {
|
|
|
82
166
|
}
|
|
83
167
|
return providers;
|
|
84
168
|
}
|
|
85
|
-
function directProviderPath(input) {
|
|
169
|
+
function directProviderPath(input, env) {
|
|
86
170
|
const incoming = new URL(input);
|
|
87
171
|
const match = incoming.pathname.match(/^\/api\/ai\/([a-z][a-z0-9-]*)(\/.*)?$/);
|
|
88
|
-
|
|
89
|
-
|
|
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);
|
|
206
|
+
}
|
|
207
|
+
const spec = provider
|
|
208
|
+
? devAiProvider(provider, env)
|
|
209
|
+
: undefined;
|
|
90
210
|
if (!provider || !spec) {
|
|
91
|
-
throw new ConfigurationError(`Direct local provider fallback only supports ${listOf(Object.keys(DEV_AI_PROVIDERS).map((name) => `${AI_PROXY_PREFIX}${name}`), "and")} paths.`);
|
|
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.`);
|
|
92
212
|
}
|
|
93
|
-
const path = match?.[2] || "/";
|
|
94
213
|
if (path.startsWith("//") || path.includes("\\")) {
|
|
95
214
|
throw new ConfigurationError("Invalid provider proxy path.");
|
|
96
215
|
}
|
|
97
|
-
return { provider, spec, path, search: incoming.search };
|
|
216
|
+
return { provider, spec, path, search: incoming.search, fillModel };
|
|
98
217
|
}
|
|
99
218
|
/** A provider's settings as a person reads them: `KEY`, or `KEY and SETTING`. */
|
|
100
219
|
function settingsNames(spec, conjunction = "and") {
|
|
@@ -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
|
+
}
|
package/dist/server/index.d.ts
CHANGED
|
@@ -3,16 +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";
|
|
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";
|
|
7
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";
|
|
8
13
|
export { authorizeUrl, type AuthorizeUrlOptions } from "./authorizeUrl.js";
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
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";
|
|
11
19
|
export { nodeServerHandler, type NodeServer, type NodeServerHandlerOptions, } from "./nodeServer.js";
|
|
12
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";
|
|
13
23
|
export { listMembers, type ListMembersOptions } from "./listMembers.js";
|
|
14
24
|
export { emit, type EmitOptions } from "./emit.js";
|
|
15
|
-
export type { ApiKeyCapabilityId, CapabilityId, OAuthClientCapabilityId, EmailAddressInput, EmailAttachmentInput, SendEmailMessage, SendEmailResult, ListMembersResult, OrganizationMember, OrganizationMemberRole, EmitEventResult, } from "../internal/index.js";
|
|
25
|
+
export type { ApiKeyCapabilityId, CapabilityId, OAuthClientCapabilityId, ConnectionAccount, EmailAddressInput, EmailAttachmentInput, SendEmailMessage, SendEmailResult, ListMembersResult, OrganizationMember, OrganizationMemberRole, EmitEventResult, } from "../internal/index.js";
|
|
16
26
|
export { ToolError, defineTools, toolResult, type DefineToolsOptions, type PlainToolSchema, type StandardSchemaWithJSON, type ToolContext, type ToolDefinition, type ToolResult, type ToolSchema, type ToolSet, } from "./tools.js";
|
|
17
27
|
export type { ToolRisk } from "../internal/index.js";
|
|
28
|
+
export { fromMcpTools, type FromMcpToolsOptions, type McpToolAnnotationsLike, type McpToolLike, type McpToolResultLike, type McpToolSchemaLike, } from "./fromMcpTools.js";
|
|
18
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,
|
|
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,OAAO,EACP,kBAAkB,EAClB,mBAAmB,EACnB,KAAK,eAAe,EACpB,KAAK,oBAAoB,EACzB,KAAK,eAAe,EACpB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,OAAO,GACb,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,WAAW,EACX,gBAAgB,GACjB,MAAM,cAAc,CAAC;AACtB,OAAO,EAAE,gBAAgB,EAAE,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AACzE,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,YAAY,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAC5C,2FAA2F;AAC3F,OAAO,EAAE,oBAAoB,EAAE,MAAM,yBAAyB,CAAC;AAC/D,OAAO,EAAE,YAAY,EAAE,KAAK,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAC3E,OAAO,EACL,WAAW,EACX,UAAU,EACV,KAAK,iBAAiB,GACvB,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,kBAAkB,EAClB,KAAK,yBAAyB,GAC/B,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,EAAE,EACF,SAAS,EACT,QAAQ,EACR,eAAe,EACf,mBAAmB,EACnB,KAAK,QAAQ,EACb,KAAK,QAAQ,GACd,MAAM,SAAS,CAAC;AACjB,OAAO,EACL,uBAAuB,EACvB,mBAAmB,EACnB,cAAc,EACd,iBAAiB,EACjB,gBAAgB,EAChB,KAAK,cAAc,EACnB,KAAK,SAAS,GACf,MAAM,cAAc,CAAC;AACtB,OAAO,EACL,kBAAkB,EAClB,gBAAgB,EAChB,iBAA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/server/index.js
CHANGED
|
@@ -3,13 +3,23 @@
|
|
|
3
3
|
*
|
|
4
4
|
* There is intentionally no client-side export.
|
|
5
5
|
*/
|
|
6
|
-
export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, requireEveryAppUser, } from "./everyApp.js";
|
|
6
|
+
export { ConfigurationError, IdentityError, everyApp, getEveryAppUser, hasScope, isAdmin, requireCurrentUser, requireEveryAppUser, } from "./everyApp.js";
|
|
7
|
+
export { OrganizationMismatchError, RequestContextError, currentUser, withOrganization, } from "./context.js";
|
|
7
8
|
export { AttributionError } from "./attribution.js";
|
|
9
|
+
export { gatewayUrl } from "./gatewayUrl.js";
|
|
10
|
+
/** The header a Gateway refusal carries its code in; `gatewayRefusal()` reads the rest. */
|
|
11
|
+
export { GATEWAY_ERROR_HEADER } from "../internal/protocol.js";
|
|
8
12
|
export { authorizeUrl } from "./authorizeUrl.js";
|
|
13
|
+
export { connectPath, connectUrl, } from "./connectUrl.js";
|
|
9
14
|
export { createGatewayFetch, } from "./gatewayFetch.js";
|
|
10
|
-
export {
|
|
15
|
+
export { ai, aiBaseUrl, aiStatus, providerBaseUrl, AI_DEFAULT_BASE_URL, } from "./ai.js";
|
|
16
|
+
export { AI_NOT_CONFIGURED_CODES, GatewayRefusalError, gatewayRefusal, isAiNotConfigured, refusalFromError, } from "./refusal.js";
|
|
17
|
+
export { devAccessTokenName, integrationFetch, integrationStatus, } from "./integrationFetch.js";
|
|
11
18
|
export { nodeServerHandler, } from "./nodeServer.js";
|
|
12
19
|
export { sendEmail } from "./sendEmail.js";
|
|
20
|
+
export { gatewayAiBinding } from "./aiBinding.js";
|
|
21
|
+
export { gatewayEmailBinding, } from "./emailBinding.js";
|
|
13
22
|
export { listMembers } from "./listMembers.js";
|
|
14
23
|
export { emit } from "./emit.js";
|
|
15
24
|
export { ToolError, defineTools, toolResult, } from "./tools.js";
|
|
25
|
+
export { fromMcpTools, } from "./fromMcpTools.js";
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { type ApiKeyCapabilityId, type CapabilityId, type EmailCapabilityStatus, type OAuthClientCapabilityId } from "../internal/index.js";
|
|
1
|
+
import { type ApiKeyCapabilityId, type CapabilityId, type ConnectionAccount, type EmailCapabilityStatus, type OAuthClientCapabilityId } from "../internal/index.js";
|
|
2
2
|
import { type GatewayCallFor } from "./attribution.js";
|
|
3
|
+
import type { SetupInfo } from "./refusal.js";
|
|
3
4
|
export interface IntegrationFetchOptions {
|
|
4
5
|
/**
|
|
5
6
|
* The Worker env: the EVERY_APP_GATEWAY binding when deployed, or in local
|
|
@@ -17,13 +18,30 @@ export interface IntegrationFetchOptions {
|
|
|
17
18
|
*/
|
|
18
19
|
provider: ApiKeyCapabilityId | OAuthClientCapabilityId | (string & {});
|
|
19
20
|
/**
|
|
20
|
-
* Whom the call is for
|
|
21
|
-
*
|
|
22
|
-
* (
|
|
23
|
-
*
|
|
24
|
-
*
|
|
21
|
+
* Whom the call is for. Left out, the request `everyApp()` is serving
|
|
22
|
+
* (its user, while the identity is good) or the organization
|
|
23
|
+
* `withOrganization()` named; outside both, `RequestContextError`.
|
|
24
|
+
* Explicitly: the inbound request, or `{ background: true,
|
|
25
|
+
* organizationId }` for work no person started (crons, Workflows,
|
|
26
|
+
* queues). A shared app's Worker must end up with one or the other
|
|
27
|
+
* ({@link AttributionError}).
|
|
25
28
|
*/
|
|
26
29
|
for?: GatewayCallFor;
|
|
30
|
+
/**
|
|
31
|
+
* For an OAuth provider the gateway holds connections for: whose
|
|
32
|
+
* connection the call uses, the person's (`user`, the default when a
|
|
33
|
+
* person is behind the call) or the organization's (`organization`,
|
|
34
|
+
* the default for background work). Sent as `x-everyapp-account`.
|
|
35
|
+
*/
|
|
36
|
+
account?: ConnectionAccount;
|
|
37
|
+
/**
|
|
38
|
+
* `true`: answer null instead of throwing `ConfigurationError` when the
|
|
39
|
+
* provider is unavailable (no binding, and in local dev not its
|
|
40
|
+
* settings in `.dev.vars`), so a feature that can do without it checks
|
|
41
|
+
* for null. A wrong provider id, a binding that isn't one, and an
|
|
42
|
+
* attribution mistake still throw.
|
|
43
|
+
*/
|
|
44
|
+
optional?: boolean;
|
|
27
45
|
}
|
|
28
46
|
/**
|
|
29
47
|
* A `fetch` for one of the gateway's capabilities. Call the provider's real
|
|
@@ -33,7 +51,7 @@ export interface IntegrationFetchOptions {
|
|
|
33
51
|
* sees the key. A refusal the gateway makes itself comes back as a response
|
|
34
52
|
* {@link gatewayRefusal} recognizes; anything else is the provider's answer.
|
|
35
53
|
*
|
|
36
|
-
* For an OAuth client (`
|
|
54
|
+
* For an OAuth client (`google-workspace`, `slack`, ...) it reaches the
|
|
37
55
|
* provider's token endpoints only, and the gateway puts its client on the
|
|
38
56
|
* request: send the code (or refresh token) without `client_id` or
|
|
39
57
|
* `client_secret`. Build the authorize URL with {@link authorizeUrl} from
|
|
@@ -47,8 +65,18 @@ export interface IntegrationFetchOptions {
|
|
|
47
65
|
* provider show <id> --save` writes it), put on the call as the gateway's
|
|
48
66
|
* spec says.
|
|
49
67
|
*/
|
|
50
|
-
export declare function integrationFetch(
|
|
51
|
-
|
|
68
|
+
export declare function integrationFetch(options: IntegrationFetchOptions & {
|
|
69
|
+
optional: true;
|
|
70
|
+
}): typeof fetch | null;
|
|
71
|
+
export declare function integrationFetch(options: IntegrationFetchOptions): typeof fetch;
|
|
72
|
+
/**
|
|
73
|
+
* The `.dev.vars` name of a held token for `provider` in local dev
|
|
74
|
+
* (`GOOGLE_WORKSPACE_ACCESS_TOKEN`, `GITHUB_ACCESS_TOKEN`): a token the
|
|
75
|
+
* developer obtained themselves, standing in for the connection the
|
|
76
|
+
* gateway would hold. Dev-only: the gateway never reads it.
|
|
77
|
+
*/
|
|
78
|
+
export declare function devAccessTokenName(provider: string): string;
|
|
79
|
+
export interface IntegrationStatus extends SetupInfo {
|
|
52
80
|
/** The app's manifest lists the capability. */
|
|
53
81
|
requested: boolean;
|
|
54
82
|
/** The gateway holds a key for it (in local dev: `.dev.vars` sets one). */
|
|
@@ -69,13 +97,8 @@ export type EmailIntegrationStatus = IntegrationStatus & Pick<EmailCapabilitySta
|
|
|
69
97
|
* the app lists the capability and the gateway holds the client.
|
|
70
98
|
*/
|
|
71
99
|
export interface OAuthClientIntegrationStatus extends IntegrationStatus {
|
|
72
|
-
/** The client's public id, for the authorize URL
|
|
100
|
+
/** The client's public id, for the authorize URL. */
|
|
73
101
|
clientId?: string;
|
|
74
|
-
/**
|
|
75
|
-
* The provider's origin when the operator chose it (Mastodon's instance,
|
|
76
|
-
* `MASTODON_URL`): the authorize page, token endpoint and API are on it.
|
|
77
|
-
*/
|
|
78
|
-
origin?: string;
|
|
79
102
|
/**
|
|
80
103
|
* For a client with scope sets (`google-workspace`, `microsoft-365`): the
|
|
81
104
|
* set names the app's manifest entry declares, `[]` when the entry voids
|
|
@@ -92,6 +115,29 @@ export interface OAuthClientIntegrationStatus extends IntegrationStatus {
|
|
|
92
115
|
scopes?: readonly string[];
|
|
93
116
|
/** Slack's `user_scope` strings, when the sets name any. */
|
|
94
117
|
userScopes?: readonly string[];
|
|
118
|
+
/**
|
|
119
|
+
* Which flows the client supports: `app` (the app runs authorize and
|
|
120
|
+
* callback itself and keeps the tokens, the social networks), `gateway`
|
|
121
|
+
* (the Gateway holds the connection; API calls go through
|
|
122
|
+
* `integrationFetch` with the token injected) or `both` (Google,
|
|
123
|
+
* Microsoft, Slack, Discord and every registered OAuth provider).
|
|
124
|
+
*/
|
|
125
|
+
flow?: "app" | "gateway" | "both";
|
|
126
|
+
/** Where a person connects on the Gateway: `/connect/<id>`; see `connectUrl()`. */
|
|
127
|
+
connectPath?: string;
|
|
128
|
+
/**
|
|
129
|
+
* The connection the caller's account would use (the person's, or the
|
|
130
|
+
* organization's for background work), or null when there is none yet;
|
|
131
|
+
* `reconnect` when it exists but lacks a set the app declares or has
|
|
132
|
+
* expired, so the person has to connect again.
|
|
133
|
+
*/
|
|
134
|
+
connection?: {
|
|
135
|
+
account: ConnectionAccount;
|
|
136
|
+
label: string | null;
|
|
137
|
+
scopeSets: readonly string[];
|
|
138
|
+
ready: boolean;
|
|
139
|
+
reconnect?: boolean;
|
|
140
|
+
} | null;
|
|
95
141
|
}
|
|
96
142
|
/** The status of a capability: email's carries its senders, an OAuth client's its id. */
|
|
97
143
|
export type IntegrationStatusOf<P extends string> = P extends "email" ? EmailIntegrationStatus : P extends OAuthClientCapabilityId ? OAuthClientIntegrationStatus : IntegrationStatus;
|
|
@@ -101,31 +147,16 @@ export type IntegrationStatusOf<P extends string> = P extends "email" ? EmailInt
|
|
|
101
147
|
* set up") up front instead of failing mid-task. An OAuth client's status
|
|
102
148
|
* carries its public `clientId` for the authorize URL.
|
|
103
149
|
*/
|
|
104
|
-
export declare function integrationStatus<P extends CapabilityId | (string & {})>({ env, provider, }: {
|
|
150
|
+
export declare function integrationStatus<P extends CapabilityId | (string & {})>({ env, provider, for: explicitTarget, }: {
|
|
105
151
|
env: object;
|
|
106
152
|
provider: P;
|
|
153
|
+
/**
|
|
154
|
+
* Whom the status is for: the request being served (its person), so an
|
|
155
|
+
* OAuth provider's `connection` is that person's; background work
|
|
156
|
+
* (`withOrganization()`) its organization, whose own connection is then
|
|
157
|
+
* reported. Explicitly the inbound request or `{ background: true,
|
|
158
|
+
* organizationId }`, as on every call.
|
|
159
|
+
*/
|
|
160
|
+
for?: GatewayCallFor;
|
|
107
161
|
}): Promise<IntegrationStatusOf<P>>;
|
|
108
|
-
/** A refusal the AppGateway binding made itself, not the provider. */
|
|
109
|
-
export interface GatewayRefusal {
|
|
110
|
-
status: number;
|
|
111
|
-
/** e.g. `capability_not_requested`, `integration_not_configured`. */
|
|
112
|
-
code: string;
|
|
113
|
-
message: string;
|
|
114
|
-
}
|
|
115
|
-
/**
|
|
116
|
-
* A refusal the AppGateway binding made, thrown: what `sendEmail()` throws
|
|
117
|
-
* when the gateway won't send (`email_sender_not_allowed`,
|
|
118
|
-
* `email_budget_exhausted`, ...). The thrown twin of {@link gatewayRefusal}.
|
|
119
|
-
*/
|
|
120
|
-
export declare class GatewayRefusalError extends Error implements GatewayRefusal {
|
|
121
|
-
readonly status: number;
|
|
122
|
-
readonly code: string;
|
|
123
|
-
constructor({ status, code, message }: GatewayRefusal);
|
|
124
|
-
}
|
|
125
|
-
/**
|
|
126
|
-
* The gateway's own refusal in `response`, or null when the response is the
|
|
127
|
-
* provider's answer (which may be an error of its own). Reads the body only
|
|
128
|
-
* for a refusal, so call it before reading the body yourself.
|
|
129
|
-
*/
|
|
130
|
-
export declare function gatewayRefusal(response: Response): Promise<GatewayRefusal | null>;
|
|
131
162
|
//# sourceMappingURL=integrationFetch.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"integrationFetch.d.ts","sourceRoot":"","sources":["../../src/server/integrationFetch.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"integrationFetch.d.ts","sourceRoot":"","sources":["../../src/server/integrationFetch.ts"],"names":[],"mappings":"AAAA,OAAO,EA+BL,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,iBAAiB,EACtB,KAAK,qBAAqB,EAE1B,KAAK,uBAAuB,EAQ7B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAGL,KAAK,cAAc,EACpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAQ9C,MAAM,WAAW,uBAAuB;IACtC;;;;OAIG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;;;;;OAOG;IACH,QAAQ,EAAE,kBAAkB,GAAG,uBAAuB,GAAG,CAAC,MAAM,GAAG,EAAE,CAAC,CAAC;IACvE;;;;;;;;OAQG;IACH,GAAG,CAAC,EAAE,cAAc,CAAC;IACrB;;;;;OAKG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;IAC5B;;;;;;OAMG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;;;;;;;;;;;;;;;;;;G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