@decocms/runtime 0.28.1 → 1.0.0-alpha.5
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/config-schema.json +553 -0
- package/package.json +15 -76
- package/scripts/generate-json-schema.ts +24 -0
- package/src/asset-server/dev-server-proxy.ts +16 -0
- package/src/asset-server/index.ts +44 -0
- package/src/bindings/README.md +1 -1
- package/src/bindings/binder.ts +1 -1
- package/src/bindings/channels.ts +1 -1
- package/src/bindings/deconfig/resources.ts +47 -17
- package/src/bindings/deconfig/types.ts +1 -1
- package/src/bindings/language-model/ai-sdk.ts +7 -4
- package/src/bindings/resources/bindings.ts +1 -1
- package/src/bindings/resources/schemas.ts +1 -1
- package/src/bindings/views.ts +1 -1
- package/src/bindings.ts +8 -7
- package/src/index.ts +5 -20
- package/src/mastra.ts +1 -229
- package/src/mcp.ts +7 -6
- package/src/proxy.ts +0 -8
- package/src/resources.ts +1 -1
- package/src/state.ts +1 -1
- package/src/views.ts +1 -1
- package/tsconfig.json +8 -0
- package/dist/admin.d.ts +0 -5
- package/dist/admin.js +0 -21
- package/dist/admin.js.map +0 -1
- package/dist/bindings/deconfig/index.d.ts +0 -12
- package/dist/bindings/deconfig/index.js +0 -10
- package/dist/bindings/deconfig/index.js.map +0 -1
- package/dist/bindings/index.d.ts +0 -2315
- package/dist/bindings/index.js +0 -156
- package/dist/bindings/index.js.map +0 -1
- package/dist/chunk-3AWMDSOH.js +0 -96
- package/dist/chunk-3AWMDSOH.js.map +0 -1
- package/dist/chunk-4XSQKJLU.js +0 -105
- package/dist/chunk-4XSQKJLU.js.map +0 -1
- package/dist/chunk-5EYZ2LVM.js +0 -158
- package/dist/chunk-5EYZ2LVM.js.map +0 -1
- package/dist/chunk-7ITSLORK.js +0 -128
- package/dist/chunk-7ITSLORK.js.map +0 -1
- package/dist/chunk-I7BWSAN6.js +0 -49
- package/dist/chunk-I7BWSAN6.js.map +0 -1
- package/dist/chunk-L4OT2YDO.js +0 -27
- package/dist/chunk-L4OT2YDO.js.map +0 -1
- package/dist/chunk-SHQSNOFL.js +0 -769
- package/dist/chunk-SHQSNOFL.js.map +0 -1
- package/dist/chunk-UHR3BLMF.js +0 -92
- package/dist/chunk-UHR3BLMF.js.map +0 -1
- package/dist/chunk-UIJGM3NV.js +0 -518
- package/dist/chunk-UIJGM3NV.js.map +0 -1
- package/dist/chunk-ZPUT6RN6.js +0 -32
- package/dist/chunk-ZPUT6RN6.js.map +0 -1
- package/dist/client.d.ts +0 -28
- package/dist/client.js +0 -5
- package/dist/client.js.map +0 -1
- package/dist/d1-store.d.ts +0 -9
- package/dist/d1-store.js +0 -4
- package/dist/d1-store.js.map +0 -1
- package/dist/drizzle.d.ts +0 -49
- package/dist/drizzle.js +0 -121
- package/dist/drizzle.js.map +0 -1
- package/dist/index-LOfgE9a_.d.ts +0 -471
- package/dist/index-xKtm7A7B.d.ts +0 -530
- package/dist/index.d.ts +0 -10
- package/dist/index.js +0 -637
- package/dist/index.js.map +0 -1
- package/dist/mastra.d.ts +0 -10
- package/dist/mastra.js +0 -6
- package/dist/mastra.js.map +0 -1
- package/dist/mcp-87iLaW9V.d.ts +0 -105
- package/dist/mcp-client.d.ts +0 -232
- package/dist/mcp-client.js +0 -4
- package/dist/mcp-client.js.map +0 -1
- package/dist/proxy.d.ts +0 -11
- package/dist/proxy.js +0 -5
- package/dist/proxy.js.map +0 -1
- package/dist/resources.d.ts +0 -362
- package/dist/resources.js +0 -4
- package/dist/resources.js.map +0 -1
- package/dist/views.d.ts +0 -72
- package/dist/views.js +0 -4
- package/dist/views.js.map +0 -1
- package/src/cf-imports.ts +0 -1
- package/src/d1-store.ts +0 -34
- package/src/deprecated.ts +0 -59
- package/src/workflow.ts +0 -193
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { proxy } from "hono/proxy";
|
|
2
|
+
import { Context } from "hono";
|
|
3
|
+
|
|
4
|
+
export const devServerProxy = (url: string | URL) => (c: Context) => {
|
|
5
|
+
const incomingUrl = new URL(c.req.raw.url);
|
|
6
|
+
const target = new URL(url);
|
|
7
|
+
target.pathname = incomingUrl.pathname;
|
|
8
|
+
target.search = incomingUrl.search;
|
|
9
|
+
|
|
10
|
+
return proxy(target, {
|
|
11
|
+
raw: c.req.raw,
|
|
12
|
+
headers: {
|
|
13
|
+
...c.req.raw.headers,
|
|
14
|
+
},
|
|
15
|
+
});
|
|
16
|
+
};
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { serveStatic } from "hono/bun";
|
|
2
|
+
import { Hono } from "hono";
|
|
3
|
+
import { devServerProxy } from "./dev-server-proxy";
|
|
4
|
+
import { Handler } from "hono/types";
|
|
5
|
+
|
|
6
|
+
interface AssetServerConfig {
|
|
7
|
+
env: "development" | "production" | "test";
|
|
8
|
+
localDevProxyUrl?: string | URL;
|
|
9
|
+
assetsDirectory?: string;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const DEFAULT_LOCAL_DEV_PROXY_URL = "http://localhost:4000";
|
|
13
|
+
const DEFAULT_ASSETS_DIRECTORY = "./dist/client";
|
|
14
|
+
|
|
15
|
+
interface HonoApp {
|
|
16
|
+
use: (path: string, handler: Handler) => void;
|
|
17
|
+
get: (path: string, handler: Handler) => void;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export const applyAssetServerRoutes = (
|
|
21
|
+
app: HonoApp,
|
|
22
|
+
config: AssetServerConfig,
|
|
23
|
+
) => {
|
|
24
|
+
const environment = config.env;
|
|
25
|
+
const localDevProxyUrl =
|
|
26
|
+
config.localDevProxyUrl ?? DEFAULT_LOCAL_DEV_PROXY_URL;
|
|
27
|
+
const assetsDirectory = config.assetsDirectory ?? DEFAULT_ASSETS_DIRECTORY;
|
|
28
|
+
|
|
29
|
+
if (environment === "development") {
|
|
30
|
+
app.use("*", devServerProxy(localDevProxyUrl));
|
|
31
|
+
} else if (environment === "production") {
|
|
32
|
+
app.use("/assets/*", serveStatic({ root: assetsDirectory }));
|
|
33
|
+
app.get("*", serveStatic({ path: `${assetsDirectory}/index.html` }));
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export const createAssetServer = (config: AssetServerConfig) => {
|
|
38
|
+
const app = new Hono();
|
|
39
|
+
applyAssetServerRoutes(app, config);
|
|
40
|
+
return app;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
export const createAssetServerFetcher = (config: AssetServerConfig) =>
|
|
44
|
+
createAssetServer(config).fetch;
|
package/src/bindings/README.md
CHANGED
package/src/bindings/binder.ts
CHANGED
package/src/bindings/channels.ts
CHANGED
|
@@ -103,7 +103,9 @@ export const createDeconfigResource = <
|
|
|
103
103
|
});
|
|
104
104
|
|
|
105
105
|
// Filter files that end with .json
|
|
106
|
-
const allFiles = Object.entries(
|
|
106
|
+
const allFiles = Object.entries(
|
|
107
|
+
(filesList as { files: Record<string, unknown> }).files,
|
|
108
|
+
)
|
|
107
109
|
.filter(([path]) => path.endsWith(".json"))
|
|
108
110
|
.map(([path, metadata]) => ({
|
|
109
111
|
path,
|
|
@@ -189,8 +191,20 @@ export const createDeconfigResource = <
|
|
|
189
191
|
aValue = getMetadataString(a.metadata, "description") || "";
|
|
190
192
|
bValue = getMetadataString(b.metadata, "description") || "";
|
|
191
193
|
} else {
|
|
192
|
-
aValue =
|
|
193
|
-
|
|
194
|
+
aValue =
|
|
195
|
+
typeof a.metadata === "object" &&
|
|
196
|
+
a.metadata &&
|
|
197
|
+
"mtime" in a.metadata &&
|
|
198
|
+
typeof a.metadata.mtime === "number"
|
|
199
|
+
? a.metadata.mtime
|
|
200
|
+
: 0;
|
|
201
|
+
bValue =
|
|
202
|
+
typeof b.metadata === "object" &&
|
|
203
|
+
b.metadata &&
|
|
204
|
+
"mtime" in b.metadata &&
|
|
205
|
+
typeof b.metadata.mtime === "number"
|
|
206
|
+
? b.metadata.mtime
|
|
207
|
+
: 0;
|
|
194
208
|
}
|
|
195
209
|
|
|
196
210
|
if (sortOrder === "desc") {
|
|
@@ -226,11 +240,17 @@ export const createDeconfigResource = <
|
|
|
226
240
|
uri,
|
|
227
241
|
data: { name, description },
|
|
228
242
|
created_at:
|
|
229
|
-
|
|
243
|
+
typeof metadata === "object" &&
|
|
244
|
+
metadata &&
|
|
245
|
+
"ctime" in metadata &&
|
|
246
|
+
typeof metadata.ctime === "number"
|
|
230
247
|
? new Date(metadata.ctime).toISOString()
|
|
231
248
|
: undefined,
|
|
232
249
|
updated_at:
|
|
233
|
-
|
|
250
|
+
typeof metadata === "object" &&
|
|
251
|
+
metadata &&
|
|
252
|
+
"mtime" in metadata &&
|
|
253
|
+
typeof metadata.mtime === "number"
|
|
234
254
|
? new Date(metadata.mtime).toISOString()
|
|
235
255
|
: undefined,
|
|
236
256
|
created_by: getMetadataString(metadata, "createdBy"),
|
|
@@ -264,12 +284,16 @@ export const createDeconfigResource = <
|
|
|
264
284
|
const filePath = ResourcePath.build(directory, resourceId);
|
|
265
285
|
|
|
266
286
|
try {
|
|
267
|
-
const fileData = await deconfig.READ_FILE({
|
|
287
|
+
const fileData = (await deconfig.READ_FILE({
|
|
268
288
|
path: filePath,
|
|
269
289
|
format: "plainString",
|
|
270
|
-
})
|
|
290
|
+
})) as {
|
|
291
|
+
content: string;
|
|
292
|
+
ctime: number;
|
|
293
|
+
mtime: number;
|
|
294
|
+
};
|
|
271
295
|
|
|
272
|
-
const content = fileData.content
|
|
296
|
+
const content = fileData.content;
|
|
273
297
|
|
|
274
298
|
// Parse the JSON content
|
|
275
299
|
let parsedData: Record<string, unknown> = {};
|
|
@@ -285,8 +309,14 @@ export const createDeconfigResource = <
|
|
|
285
309
|
return {
|
|
286
310
|
uri,
|
|
287
311
|
data: validatedData,
|
|
288
|
-
created_at:
|
|
289
|
-
|
|
312
|
+
created_at:
|
|
313
|
+
typeof fileData.ctime === "number"
|
|
314
|
+
? new Date(fileData.ctime).toISOString()
|
|
315
|
+
: new Date().toISOString(),
|
|
316
|
+
updated_at:
|
|
317
|
+
typeof fileData.mtime === "number"
|
|
318
|
+
? new Date(fileData.mtime).toISOString()
|
|
319
|
+
: new Date().toISOString(),
|
|
290
320
|
created_by:
|
|
291
321
|
parsedData &&
|
|
292
322
|
"created_by" in parsedData &&
|
|
@@ -347,7 +377,7 @@ export const createDeconfigResource = <
|
|
|
347
377
|
};
|
|
348
378
|
|
|
349
379
|
const fileContent = JSON.stringify(resourceData, null, 2);
|
|
350
|
-
const putResult = await deconfig.PUT_FILE({
|
|
380
|
+
const putResult = (await deconfig.PUT_FILE({
|
|
351
381
|
path: filePath,
|
|
352
382
|
content: fileContent,
|
|
353
383
|
metadata: {
|
|
@@ -357,7 +387,7 @@ export const createDeconfigResource = <
|
|
|
357
387
|
name: validatedData.name || resourceId,
|
|
358
388
|
description: validatedData.description || "",
|
|
359
389
|
},
|
|
360
|
-
});
|
|
390
|
+
})) as { conflict?: boolean };
|
|
361
391
|
|
|
362
392
|
if (putResult.conflict) {
|
|
363
393
|
throw new UserInputError(
|
|
@@ -393,11 +423,11 @@ export const createDeconfigResource = <
|
|
|
393
423
|
// Read existing file to get current data
|
|
394
424
|
let existingData: Record<string, unknown> = {};
|
|
395
425
|
try {
|
|
396
|
-
const fileData = await deconfig.READ_FILE({
|
|
426
|
+
const fileData = (await deconfig.READ_FILE({
|
|
397
427
|
path: filePath,
|
|
398
428
|
format: "plainString",
|
|
399
|
-
});
|
|
400
|
-
existingData = JSON.parse(fileData.content
|
|
429
|
+
})) as { content: string };
|
|
430
|
+
existingData = JSON.parse(fileData.content);
|
|
401
431
|
} catch {
|
|
402
432
|
throw new NotFoundError(`Resource not found: ${uri}`);
|
|
403
433
|
}
|
|
@@ -429,7 +459,7 @@ export const createDeconfigResource = <
|
|
|
429
459
|
|
|
430
460
|
const fileContent = JSON.stringify(updatedData, null, 2);
|
|
431
461
|
|
|
432
|
-
const putResult = await deconfig.PUT_FILE({
|
|
462
|
+
const putResult = (await deconfig.PUT_FILE({
|
|
433
463
|
path: filePath,
|
|
434
464
|
content: fileContent,
|
|
435
465
|
metadata: {
|
|
@@ -439,7 +469,7 @@ export const createDeconfigResource = <
|
|
|
439
469
|
name: validatedData.name || resourceId,
|
|
440
470
|
description: validatedData.description || "",
|
|
441
471
|
},
|
|
442
|
-
});
|
|
472
|
+
})) as { conflict?: boolean };
|
|
443
473
|
|
|
444
474
|
if (putResult.conflict) {
|
|
445
475
|
throw new UserInputError(
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
// Types for DeconfigResource
|
|
2
|
-
import { z } from "zod
|
|
2
|
+
import { z } from "zod";
|
|
3
3
|
import type { DefaultEnv } from "../../index.ts";
|
|
4
4
|
import type { MCPClientFetchStub, ToolBinder } from "../../mcp.ts";
|
|
5
5
|
import type { BaseResourceDataSchema } from "../resources/bindings.ts";
|
|
@@ -42,10 +42,13 @@ export const createProvider = (binding: LLMBindingClient): Provider => {
|
|
|
42
42
|
return await binding.COLLECTION_LLM_LIST({});
|
|
43
43
|
},
|
|
44
44
|
languageModel: (modelId: string): LanguageModelV2 => {
|
|
45
|
-
const supportedUrls = lazy(
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
45
|
+
const supportedUrls = lazy(
|
|
46
|
+
(): Promise<Record<string, RegExp[]>> =>
|
|
47
|
+
binding
|
|
48
|
+
.LLM_METADATA({ modelId })
|
|
49
|
+
.then((metadata: { supportedUrls: Record<string, string[]> }) =>
|
|
50
|
+
toRegExp(metadata.supportedUrls),
|
|
51
|
+
),
|
|
49
52
|
);
|
|
50
53
|
|
|
51
54
|
return {
|
package/src/bindings/views.ts
CHANGED
package/src/bindings.ts
CHANGED
|
@@ -63,8 +63,9 @@ type WorkspaceClientContext = Omit<
|
|
|
63
63
|
>;
|
|
64
64
|
export const workspaceClient = (
|
|
65
65
|
ctx: WorkspaceClientContext,
|
|
66
|
+
decocmsApiUrl?: string,
|
|
66
67
|
): ReturnType<(typeof MCPClient)["forWorkspace"]> => {
|
|
67
|
-
return MCPClient.forWorkspace(ctx.workspace, ctx.token);
|
|
68
|
+
return MCPClient.forWorkspace(ctx.workspace, ctx.token, decocmsApiUrl);
|
|
68
69
|
};
|
|
69
70
|
|
|
70
71
|
const mcpClientForAppName = (appName: string, decoChatApiUrl?: string) => {
|
|
@@ -76,7 +77,7 @@ const mcpClientForAppName = (appName: string, decoChatApiUrl?: string) => {
|
|
|
76
77
|
}),
|
|
77
78
|
};
|
|
78
79
|
|
|
79
|
-
return MCPClient.forConnection(mcpConnection);
|
|
80
|
+
return MCPClient.forConnection(mcpConnection, decoChatApiUrl);
|
|
80
81
|
};
|
|
81
82
|
|
|
82
83
|
export const proxyConnectionForId = (
|
|
@@ -85,7 +86,7 @@ export const proxyConnectionForId = (
|
|
|
85
86
|
token?: string;
|
|
86
87
|
cookie?: string;
|
|
87
88
|
},
|
|
88
|
-
|
|
89
|
+
decocmsApiUrl?: string,
|
|
89
90
|
appName?: string,
|
|
90
91
|
): MCPConnection => {
|
|
91
92
|
let headers: Record<string, string> | undefined = appName
|
|
@@ -100,7 +101,7 @@ export const proxyConnectionForId = (
|
|
|
100
101
|
url: createIntegrationsUrl({
|
|
101
102
|
integrationId,
|
|
102
103
|
workspace: ctx.workspace,
|
|
103
|
-
decoCmsApiUrl:
|
|
104
|
+
decoCmsApiUrl: decocmsApiUrl,
|
|
104
105
|
branch: ctx.branch,
|
|
105
106
|
}),
|
|
106
107
|
token: ctx.token,
|
|
@@ -110,18 +111,18 @@ export const proxyConnectionForId = (
|
|
|
110
111
|
const mcpClientForIntegrationId = (
|
|
111
112
|
integrationId: string,
|
|
112
113
|
ctx: WorkspaceClientContext,
|
|
113
|
-
|
|
114
|
+
decocmsApiUrl?: string,
|
|
114
115
|
appName?: string,
|
|
115
116
|
) => {
|
|
116
117
|
const mcpConnection = proxyConnectionForId(
|
|
117
118
|
integrationId,
|
|
118
119
|
ctx,
|
|
119
|
-
|
|
120
|
+
decocmsApiUrl,
|
|
120
121
|
appName,
|
|
121
122
|
);
|
|
122
123
|
|
|
123
124
|
// TODO(@igorbrasileiro): Switch this proxy to be a proxy that call MCP Client.toolCall from @modelcontextprotocol
|
|
124
|
-
return MCPClient.forConnection(mcpConnection);
|
|
125
|
+
return MCPClient.forConnection(mcpConnection, decocmsApiUrl);
|
|
125
126
|
};
|
|
126
127
|
|
|
127
128
|
function mcpClientFromState(
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/* oxlint-disable no-explicit-any */
|
|
2
2
|
import type { ExecutionContext } from "@cloudflare/workers-types";
|
|
3
3
|
import { decodeJwt } from "jose";
|
|
4
|
-
import type { z } from "zod
|
|
4
|
+
import type { z } from "zod";
|
|
5
5
|
import {
|
|
6
6
|
getReqToken,
|
|
7
7
|
handleAuthCallback,
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
} from "./bindings.ts";
|
|
16
16
|
import { DeconfigResource } from "./bindings/deconfig/index.ts";
|
|
17
17
|
import { DECO_MCP_CLIENT_HEADER } from "./client.ts";
|
|
18
|
-
import { DeprecatedEnv } from "./deprecated.ts";
|
|
19
18
|
import {
|
|
20
19
|
createMCPServer,
|
|
21
20
|
type CreateMCPServerOptions,
|
|
@@ -23,8 +22,6 @@ import {
|
|
|
23
22
|
} from "./mastra.ts";
|
|
24
23
|
import { MCPClient, type QueryResult } from "./mcp.ts";
|
|
25
24
|
import { State } from "./state.ts";
|
|
26
|
-
import type { WorkflowDO } from "./workflow.ts";
|
|
27
|
-
import { Workflow } from "./workflow.ts";
|
|
28
25
|
import type { Binding, ContractBinding, MCPBinding } from "./wrangler.ts";
|
|
29
26
|
export { proxyConnectionForId } from "./bindings.ts";
|
|
30
27
|
export {
|
|
@@ -39,8 +36,7 @@ export interface WorkspaceDB {
|
|
|
39
36
|
}) => Promise<{ result: QueryResult[] }>;
|
|
40
37
|
}
|
|
41
38
|
|
|
42
|
-
export interface DefaultEnv<TSchema extends z.ZodTypeAny = any>
|
|
43
|
-
extends DeprecatedEnv<TSchema> {
|
|
39
|
+
export interface DefaultEnv<TSchema extends z.ZodTypeAny = any> {
|
|
44
40
|
DECO_REQUEST_CONTEXT: RequestContext<TSchema>;
|
|
45
41
|
DECO_APP_NAME: string;
|
|
46
42
|
DECO_APP_SLUG: string;
|
|
@@ -51,7 +47,6 @@ export interface DefaultEnv<TSchema extends z.ZodTypeAny = any>
|
|
|
51
47
|
DECO_APP_DEPLOYMENT_ID: string;
|
|
52
48
|
DECO_BINDINGS: string;
|
|
53
49
|
DECO_API_TOKEN: string;
|
|
54
|
-
DECO_WORKFLOW_DO: DurableObjectNamespace<WorkflowDO>;
|
|
55
50
|
DECO_WORKSPACE_DB: WorkspaceDB & {
|
|
56
51
|
forContext: (ctx: RequestContext) => WorkspaceDB;
|
|
57
52
|
};
|
|
@@ -144,9 +139,9 @@ const withDefaultBindings = ({
|
|
|
144
139
|
ctx: RequestContext;
|
|
145
140
|
url?: string;
|
|
146
141
|
}) => {
|
|
147
|
-
const client = workspaceClient(ctx);
|
|
142
|
+
const client = workspaceClient(ctx, env.DECO_API_URL);
|
|
148
143
|
const createWorkspaceDB = (ctx: RequestContext): WorkspaceDB => {
|
|
149
|
-
const client = workspaceClient(ctx);
|
|
144
|
+
const client = workspaceClient(ctx, env.DECO_API_URL);
|
|
150
145
|
return {
|
|
151
146
|
query: ({ sql, params }) => {
|
|
152
147
|
return client.DATABASES_RUN_SQL({
|
|
@@ -183,11 +178,6 @@ const withDefaultBindings = ({
|
|
|
183
178
|
env["DECO_WORKSPACE_API"] = client;
|
|
184
179
|
env["DECO_WORKSPACE_DB"] = workspaceDbBinding;
|
|
185
180
|
|
|
186
|
-
// Backwards compatibility
|
|
187
|
-
env["DECO_CHAT_API"] = MCPClient;
|
|
188
|
-
env["DECO_CHAT_WORKSPACE_API"] = client;
|
|
189
|
-
env["DECO_CHAT_WORKSPACE_DB"] = workspaceDbBinding;
|
|
190
|
-
|
|
191
181
|
env["IS_LOCAL"] =
|
|
192
182
|
(url?.startsWith("http://localhost") ||
|
|
193
183
|
url?.startsWith("http://127.0.0.1")) ??
|
|
@@ -277,8 +267,6 @@ export const withBindings = <TEnv>({
|
|
|
277
267
|
}
|
|
278
268
|
|
|
279
269
|
env.DECO_REQUEST_CONTEXT = context;
|
|
280
|
-
// Backwards compatibility
|
|
281
|
-
env.DECO_CHAT_REQUEST_CONTEXT = context;
|
|
282
270
|
const bindings = WorkersMCPBindings.parse(env.DECO_BINDINGS);
|
|
283
271
|
|
|
284
272
|
for (const binding of bindings) {
|
|
@@ -297,9 +285,7 @@ export const withBindings = <TEnv>({
|
|
|
297
285
|
|
|
298
286
|
export const withRuntime = <TEnv, TSchema extends z.ZodTypeAny = never>(
|
|
299
287
|
userFns: UserDefaultExport<TEnv, TSchema>,
|
|
300
|
-
): ExportedHandler<TEnv & DefaultEnv<TSchema>>
|
|
301
|
-
Workflow: ReturnType<typeof Workflow>;
|
|
302
|
-
} => {
|
|
288
|
+
): ExportedHandler<TEnv & DefaultEnv<TSchema>> => {
|
|
303
289
|
const server = createMCPServer<TEnv, TSchema>(userFns);
|
|
304
290
|
const fetcher = async (
|
|
305
291
|
req: Request,
|
|
@@ -357,7 +343,6 @@ export const withRuntime = <TEnv, TSchema extends z.ZodTypeAny = never>(
|
|
|
357
343
|
);
|
|
358
344
|
};
|
|
359
345
|
return {
|
|
360
|
-
Workflow: Workflow(server, userFns.workflows),
|
|
361
346
|
fetch: async (
|
|
362
347
|
req: Request,
|
|
363
348
|
env: TEnv & DefaultEnv<TSchema>,
|