@decocms/runtime 0.28.1 → 1.0.0-alpha-candy.1

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 (97) hide show
  1. package/package.json +11 -77
  2. package/scripts/generate-json-schema.ts +24 -0
  3. package/src/asset-server/dev-server-proxy.ts +16 -0
  4. package/src/asset-server/index.ts +44 -0
  5. package/src/bindings/README.md +1 -1
  6. package/src/bindings/binder.ts +2 -5
  7. package/src/bindings/channels.ts +1 -1
  8. package/src/bindings/index.ts +0 -33
  9. package/src/bindings/language-model/utils.ts +0 -91
  10. package/src/bindings.ts +30 -108
  11. package/src/client.ts +1 -145
  12. package/src/index.ts +46 -175
  13. package/src/mcp.ts +8 -165
  14. package/src/proxy.ts +3 -62
  15. package/src/state.ts +1 -30
  16. package/src/tools.ts +336 -0
  17. package/src/wrangler.ts +5 -5
  18. package/tsconfig.json +8 -0
  19. package/dist/admin.d.ts +0 -5
  20. package/dist/admin.js +0 -21
  21. package/dist/admin.js.map +0 -1
  22. package/dist/bindings/deconfig/index.d.ts +0 -12
  23. package/dist/bindings/deconfig/index.js +0 -10
  24. package/dist/bindings/deconfig/index.js.map +0 -1
  25. package/dist/bindings/index.d.ts +0 -2315
  26. package/dist/bindings/index.js +0 -156
  27. package/dist/bindings/index.js.map +0 -1
  28. package/dist/chunk-3AWMDSOH.js +0 -96
  29. package/dist/chunk-3AWMDSOH.js.map +0 -1
  30. package/dist/chunk-4XSQKJLU.js +0 -105
  31. package/dist/chunk-4XSQKJLU.js.map +0 -1
  32. package/dist/chunk-5EYZ2LVM.js +0 -158
  33. package/dist/chunk-5EYZ2LVM.js.map +0 -1
  34. package/dist/chunk-7ITSLORK.js +0 -128
  35. package/dist/chunk-7ITSLORK.js.map +0 -1
  36. package/dist/chunk-I7BWSAN6.js +0 -49
  37. package/dist/chunk-I7BWSAN6.js.map +0 -1
  38. package/dist/chunk-L4OT2YDO.js +0 -27
  39. package/dist/chunk-L4OT2YDO.js.map +0 -1
  40. package/dist/chunk-SHQSNOFL.js +0 -769
  41. package/dist/chunk-SHQSNOFL.js.map +0 -1
  42. package/dist/chunk-UHR3BLMF.js +0 -92
  43. package/dist/chunk-UHR3BLMF.js.map +0 -1
  44. package/dist/chunk-UIJGM3NV.js +0 -518
  45. package/dist/chunk-UIJGM3NV.js.map +0 -1
  46. package/dist/chunk-ZPUT6RN6.js +0 -32
  47. package/dist/chunk-ZPUT6RN6.js.map +0 -1
  48. package/dist/client.d.ts +0 -28
  49. package/dist/client.js +0 -5
  50. package/dist/client.js.map +0 -1
  51. package/dist/d1-store.d.ts +0 -9
  52. package/dist/d1-store.js +0 -4
  53. package/dist/d1-store.js.map +0 -1
  54. package/dist/drizzle.d.ts +0 -49
  55. package/dist/drizzle.js +0 -121
  56. package/dist/drizzle.js.map +0 -1
  57. package/dist/index-LOfgE9a_.d.ts +0 -471
  58. package/dist/index-xKtm7A7B.d.ts +0 -530
  59. package/dist/index.d.ts +0 -10
  60. package/dist/index.js +0 -637
  61. package/dist/index.js.map +0 -1
  62. package/dist/mastra.d.ts +0 -10
  63. package/dist/mastra.js +0 -6
  64. package/dist/mastra.js.map +0 -1
  65. package/dist/mcp-87iLaW9V.d.ts +0 -105
  66. package/dist/mcp-client.d.ts +0 -232
  67. package/dist/mcp-client.js +0 -4
  68. package/dist/mcp-client.js.map +0 -1
  69. package/dist/proxy.d.ts +0 -11
  70. package/dist/proxy.js +0 -5
  71. package/dist/proxy.js.map +0 -1
  72. package/dist/resources.d.ts +0 -362
  73. package/dist/resources.js +0 -4
  74. package/dist/resources.js.map +0 -1
  75. package/dist/views.d.ts +0 -72
  76. package/dist/views.js +0 -4
  77. package/dist/views.js.map +0 -1
  78. package/src/admin.ts +0 -16
  79. package/src/auth.ts +0 -233
  80. package/src/bindings/deconfig/helpers.ts +0 -107
  81. package/src/bindings/deconfig/index.ts +0 -1
  82. package/src/bindings/deconfig/resources.ts +0 -659
  83. package/src/bindings/deconfig/types.ts +0 -106
  84. package/src/bindings/language-model/ai-sdk.ts +0 -87
  85. package/src/bindings/language-model/index.ts +0 -4
  86. package/src/bindings/resources/bindings.ts +0 -99
  87. package/src/bindings/resources/helpers.ts +0 -95
  88. package/src/bindings/resources/schemas.ts +0 -265
  89. package/src/bindings/views.ts +0 -14
  90. package/src/cf-imports.ts +0 -1
  91. package/src/d1-store.ts +0 -34
  92. package/src/deprecated.ts +0 -59
  93. package/src/drizzle.ts +0 -201
  94. package/src/mastra.ts +0 -898
  95. package/src/resources.ts +0 -168
  96. package/src/views.ts +0 -26
  97. package/src/workflow.ts +0 -193
@@ -1,471 +0,0 @@
1
- import { DurableObjectNamespace as DurableObjectNamespace$1, ExecutionContext as ExecutionContext$1 } from '@cloudflare/workers-types';
2
- import { z } from 'zod/v3';
3
- import { ToolExecutionContext, ToolAction, Tool, Workflow as Workflow$1 } from '@mastra/core';
4
- import { RuntimeContext } from '@mastra/core/di';
5
- import { createWorkflow, Step as Step$1, ExecuteFunction, DefaultEngineType } from '@mastra/core/workflows';
6
- import { ResourceCreateInputSchema, ResourceUpdateInputSchema, ResourceDeleteInputSchema } from './resources.js';
7
- import { Q as QueryResult } from './mcp-87iLaW9V.js';
8
- import { MCPConnection } from '@decocms/bindings/connection';
9
- import '@decocms/bindings';
10
-
11
- declare const createRuntimeContext: (prev?: RuntimeContext<AppContext>) => RuntimeContext<AppContext<any>>;
12
- /**
13
- * creates a private tool that always ensure for athentication before being executed
14
- */
15
- declare function createPrivateTool<TSchemaIn extends z.ZodSchema = z.ZodSchema, TSchemaOut extends z.ZodSchema | undefined = undefined, TSuspendSchema extends z.ZodSchema = z.ZodSchema, TResumeSchema extends z.ZodSchema = z.ZodSchema, TContext extends ToolExecutionContext<TSchemaIn> = ToolExecutionContext<TSchemaIn>, TExecute extends ToolAction<TSchemaIn, TSchemaOut, any, any, TContext>["execute"] = ToolAction<TSchemaIn, TSchemaOut, any, any, TContext>["execute"]>(opts: ToolAction<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext> & {
16
- execute?: TExecute;
17
- }): [TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TExecute] extends [
18
- z.ZodSchema,
19
- z.ZodSchema,
20
- z.ZodSchema,
21
- z.ZodSchema,
22
- Function
23
- ] ? Tool<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext> & {
24
- inputSchema: TSchemaIn;
25
- outputSchema: TSchemaOut;
26
- execute: (context: TContext) => Promise<any>;
27
- } : Tool<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext>;
28
- interface StreamableTool<TSchemaIn extends z.ZodSchema = z.ZodSchema> {
29
- id: string;
30
- inputSchema: TSchemaIn;
31
- streamable?: true;
32
- description?: string;
33
- execute: (input: ToolExecutionContext<TSchemaIn>) => Promise<Response>;
34
- }
35
- declare function createStreamableTool<TSchemaIn extends z.ZodSchema = z.ZodSchema>(streamableTool: StreamableTool<TSchemaIn>): StreamableTool<TSchemaIn>;
36
- declare function createTool<TSchemaIn extends z.ZodSchema | undefined = undefined, TSchemaOut extends z.ZodSchema | undefined = undefined, TSuspendSchema extends z.ZodSchema = z.ZodSchema, TResumeSchema extends z.ZodSchema = z.ZodSchema, TContext extends ToolExecutionContext<TSchemaIn, TSuspendSchema, TResumeSchema> = ToolExecutionContext<TSchemaIn, TSuspendSchema, TResumeSchema>, TExecute extends ToolAction<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext>["execute"] = ToolAction<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext>["execute"]>(opts: ToolAction<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext> & {
37
- execute?: TExecute;
38
- }): [TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TExecute] extends [
39
- z.ZodSchema,
40
- z.ZodSchema,
41
- z.ZodSchema,
42
- z.ZodSchema,
43
- Function
44
- ] ? Tool<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext> & {
45
- inputSchema: TSchemaIn;
46
- outputSchema: TSchemaOut;
47
- execute: (context: TContext) => Promise<any>;
48
- } : Tool<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext>;
49
- type ExecWithContext<TF extends (...args: any[]) => any> = (input: Omit<Parameters<TF>[0], "runtimeContext"> & {
50
- runtimeContext: RuntimeContext<AppContext>;
51
- }) => ReturnType<TF>;
52
- interface Step<TStepId extends string = string, TState extends z.ZodObject<any> = z.ZodObject<any, z.$strip>, TSchemaIn extends z.ZodType<any> = z.ZodType<any>, TSchemaOut extends z.ZodType<any> = z.ZodType<any>, TResumeSchema extends z.ZodType<any> = z.ZodType<any>, TSuspendSchema extends z.ZodType<any> = z.ZodType<any>, TEngineType = any> extends Omit<Step$1<TStepId, TState, TSchemaIn, TSchemaOut, TResumeSchema, TSuspendSchema, TEngineType>, "execute"> {
53
- execute: ExecWithContext<ExecuteFunction<z.infer<TState>, z.infer<TSchemaIn>, z.infer<TSchemaOut>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, TEngineType>>;
54
- }
55
- declare function createStepFromTool<TSchemaIn extends z.ZodType<any>, TSchemaOut extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TContext extends ToolExecutionContext<TSchemaIn, TSuspendSchema, TResumeSchema>>(tool: Tool<TSchemaIn, TSchemaOut, TSuspendSchema, TResumeSchema, TContext> & {
56
- inputSchema: TSchemaIn;
57
- outputSchema: TSchemaOut;
58
- execute: (context: TContext) => Promise<any>;
59
- }): Step<string, TSchemaIn, TSchemaOut, z.ZodType<any>, z.ZodType<any>, DefaultEngineType>;
60
- declare function createStep<TStepId extends string, TStepInput extends z.ZodType<any>, TStepOutput extends z.ZodType<any>, TResumeSchema extends z.ZodType<any>, TSuspendSchema extends z.ZodType<any>>(opts: {
61
- id: TStepId;
62
- description?: string;
63
- inputSchema: TStepInput;
64
- outputSchema: TStepOutput;
65
- resumeSchema?: TResumeSchema;
66
- suspendSchema?: TSuspendSchema;
67
- execute: ExecWithContext<ExecuteFunction<z.infer<TStepInput>, z.infer<TStepOutput>, z.infer<TResumeSchema>, z.infer<TSuspendSchema>, DefaultEngineType>>;
68
- }): Step<TStepId, TStepInput, TStepOutput, TResumeSchema, TSuspendSchema, DefaultEngineType>;
69
- interface ViewExport {
70
- title: string;
71
- icon: string;
72
- url: string;
73
- tools?: string[];
74
- rules?: string[];
75
- installBehavior?: "none" | "open" | "autoPin";
76
- }
77
- type Resources<Env = any, TSchema extends z.ZodTypeAny = never> = Array<(env: Env & DefaultEnv<TSchema>) => {
78
- name: string;
79
- icon: string;
80
- title: string;
81
- description?: string;
82
- tools: {
83
- read: (args: {
84
- uri: string;
85
- }) => Promise<unknown>;
86
- search: (args: {
87
- term: string;
88
- cursor?: string;
89
- limit?: number;
90
- }) => Promise<unknown>;
91
- create?: (args: z.infer<typeof ResourceCreateInputSchema>) => Promise<unknown>;
92
- update?: (args: z.infer<typeof ResourceUpdateInputSchema>) => Promise<unknown>;
93
- delete?: (args: z.infer<typeof ResourceDeleteInputSchema>) => Promise<unknown>;
94
- };
95
- views?: {
96
- list?: {
97
- url?: string;
98
- tools?: string[];
99
- rules?: string[];
100
- };
101
- detail?: {
102
- url?: string;
103
- mimeTypePattern?: string;
104
- resourceName?: string;
105
- tools?: string[];
106
- rules?: string[];
107
- };
108
- };
109
- }>;
110
- interface Integration {
111
- id: string;
112
- appId: string;
113
- }
114
- type CreatedTool = ReturnType<typeof createTool> | ReturnType<typeof createStreamableTool>;
115
- declare function isStreamableTool(tool: CreatedTool): tool is StreamableTool;
116
- interface CreateMCPServerOptions<Env = any, TSchema extends z.ZodTypeAny = never> {
117
- before?: (env: Env & DefaultEnv<TSchema>) => Promise<void> | void;
118
- oauth?: {
119
- state?: TSchema;
120
- scopes?: string[];
121
- };
122
- views?: (env: Env & DefaultEnv<TSchema>) => Promise<ViewExport[]> | ViewExport[];
123
- resources?: Resources<Env, TSchema>;
124
- tools?: Array<(env: Env & DefaultEnv<TSchema>) => Promise<CreatedTool> | CreatedTool | CreatedTool[] | Promise<CreatedTool[]>> | ((env: Env & DefaultEnv<TSchema>) => CreatedTool[] | Promise<CreatedTool[]>);
125
- workflows?: Array<(env: Env & DefaultEnv<TSchema>) => Promise<{
126
- workflow: ReturnType<typeof createWorkflow>;
127
- }> | ReturnType<typeof createWorkflow>>;
128
- }
129
- type Fetch<TEnv = any> = (req: Request, env: TEnv, ctx: ExecutionContext) => Promise<Response> | Response;
130
- interface AppContext<TEnv = any> {
131
- env: TEnv;
132
- ctx: {
133
- waitUntil: (promise: Promise<any>) => void;
134
- };
135
- req?: Request;
136
- }
137
- type CallTool = (opts: {
138
- toolCallId: string;
139
- toolCallInput: any;
140
- }) => Promise<any>;
141
- type MCPServer<TEnv = any, TSchema extends z.ZodTypeAny = never> = {
142
- fetch: Fetch<TEnv & DefaultEnv<TSchema>>;
143
- callTool: CallTool;
144
- };
145
- declare const isWorkflow: (value: any) => value is Workflow$1;
146
- declare const createMCPServer: <TEnv = any, TSchema extends z.ZodTypeAny = never>(options: CreateMCPServerOptions<TEnv, TSchema>) => MCPServer<TEnv, TSchema>;
147
-
148
- interface StartWorkflowArgs {
149
- workflowId: string;
150
- args: unknown;
151
- runId?: string;
152
- ctx: RequestContext;
153
- }
154
- interface CancelWorkflowArgs {
155
- workflowId: string;
156
- runId?: string;
157
- ctx: RequestContext;
158
- }
159
- interface ResumeWorkflowArgs {
160
- workflowId: string;
161
- runId?: string;
162
- resumeData: unknown;
163
- stepId: string;
164
- ctx: RequestContext;
165
- }
166
- interface WorkflowDO extends Rpc.DurableObjectBranded {
167
- start: (args: StartWorkflowArgs) => Promise<{
168
- runId: string;
169
- }>;
170
- cancel: (args: CancelWorkflowArgs) => Promise<{
171
- cancelled: boolean;
172
- }>;
173
- resume: (args: ResumeWorkflowArgs) => Promise<{
174
- resumed: boolean;
175
- }>;
176
- }
177
- declare const Workflow: (server: MCPServer<any, any>, workflows?: CreateMCPServerOptions["workflows"]) => {
178
- new (ctx: DurableObjectState<{}>, env: DefaultEnv): {
179
- ctx: DurableObjectState<{}>;
180
- env: DefaultEnv;
181
- bindings(ctx: RequestContext): DefaultEnv<any>;
182
- runWithContext<T>(ctx: RequestContext, f: (ctx: DefaultEnv) => Promise<T>): Promise<T>;
183
- "__#private@#getWorkflow"(workflowId: string, bindings: DefaultEnv): Promise<{
184
- workflow: Workflow$1;
185
- }>;
186
- start({ workflowId, runId, args, ctx }: StartWorkflowArgs): Promise<{
187
- runId: string;
188
- }>;
189
- cancel({ workflowId, runId, ctx }: CancelWorkflowArgs): Promise<{
190
- cancelled: boolean;
191
- }>;
192
- resume({ workflowId, runId, resumeData, stepId, ctx }: ResumeWorkflowArgs): Promise<{
193
- resumed: boolean;
194
- }>;
195
- fetch?(request: Request): Response | Promise<Response>;
196
- alarm?(alarmInfo?: AlarmInvocationInfo): void | Promise<void>;
197
- webSocketMessage?(ws: WebSocket, message: string | ArrayBuffer): void | Promise<void>;
198
- webSocketClose?(ws: WebSocket, code: number, reason: string, wasClean: boolean): void | Promise<void>;
199
- webSocketError?(ws: WebSocket, error: unknown): void | Promise<void>;
200
- __DURABLE_OBJECT_BRAND: never;
201
- };
202
- };
203
-
204
- interface DeprecatedEnv<TSchema extends z.ZodTypeAny = any> {
205
- /**
206
- * @deprecated Use DECO_REQUEST_CONTEXT instead
207
- */
208
- DECO_CHAT_REQUEST_CONTEXT: RequestContext<TSchema>;
209
- /**
210
- * @deprecated Use DECO_APP_NAME instead
211
- */
212
- DECO_CHAT_APP_NAME: string;
213
- /**
214
- * @deprecated Use DECO_APP_SLUG instead
215
- */
216
- DECO_CHAT_APP_SLUG: string;
217
- /**
218
- * @deprecated Use DECO_APP_ENTRYPOINT instead
219
- */
220
- DECO_CHAT_APP_ENTRYPOINT: string;
221
- /**
222
- * @deprecated Use DECO_API_URL instead
223
- */
224
- DECO_CHAT_API_URL?: string;
225
- /**
226
- * @deprecated Use DECO_WORKSPACE instead
227
- */
228
- DECO_CHAT_WORKSPACE: string;
229
- /**
230
- * @deprecated Use DECO_API_JWT_PUBLIC_KEY instead
231
- */
232
- DECO_CHAT_API_JWT_PUBLIC_KEY: string;
233
- /**
234
- * @deprecated Use DECO_APP_DEPLOYMENT_ID instead
235
- */
236
- DECO_CHAT_APP_DEPLOYMENT_ID: string;
237
- /**
238
- * @deprecated Use DECO_BINDINGS instead
239
- */
240
- DECO_CHAT_BINDINGS: string;
241
- /**
242
- * @deprecated Use DECO_API_TOKEN instead
243
- */
244
- DECO_CHAT_API_TOKEN: string;
245
- /**
246
- * @deprecated Use DECO_WORKFLOW_DO instead
247
- */
248
- DECO_CHAT_WORKFLOW_DO: DurableObjectNamespace$1<WorkflowDO>;
249
- /**
250
- * @deprecated Use DECO_WORKSPACE_DB instead
251
- */
252
- DECO_CHAT_WORKSPACE_DB: WorkspaceDB & {
253
- forContext: (ctx: RequestContext) => WorkspaceDB;
254
- };
255
- }
256
-
257
- interface BindingBase {
258
- name: string;
259
- }
260
- interface MCPIntegrationIdBinding extends BindingBase {
261
- type: "mcp";
262
- /**
263
- * If not provided, will return a function that takes the integration id and return the binding implementation..
264
- */
265
- integration_id: string;
266
- }
267
- interface MCPIntegrationNameBinding extends BindingBase {
268
- type: "mcp";
269
- /**
270
- * The name of the integration to bind.
271
- */
272
- integration_name: string;
273
- }
274
- interface ContractClause {
275
- id: string;
276
- price: string | number;
277
- description?: string;
278
- }
279
- interface Contract {
280
- body: string;
281
- clauses: ContractClause[];
282
- }
283
- interface ContractBinding extends BindingBase {
284
- type: "contract";
285
- /**
286
- * The clauses of this contract
287
- */
288
- contract: Contract;
289
- }
290
- type MCPBinding = MCPIntegrationIdBinding | MCPIntegrationNameBinding;
291
- type Binding = MCPBinding | ContractBinding;
292
- interface MigrationBase {
293
- tag: string;
294
- }
295
- interface NewClassMigration extends MigrationBase {
296
- new_classes?: string[];
297
- new_sqlite_classes?: string[];
298
- }
299
- interface DeletedClassMigration extends MigrationBase {
300
- deleted_classes: string[];
301
- }
302
- interface RenamedClassMigration extends MigrationBase {
303
- renamed_classes: {
304
- from: string;
305
- to: string;
306
- }[];
307
- }
308
- type Migration = NewClassMigration | DeletedClassMigration | RenamedClassMigration;
309
- interface KVNamespace {
310
- binding: string;
311
- id: string;
312
- }
313
- interface Triggers {
314
- crons: string[];
315
- }
316
- interface Route {
317
- pattern: string;
318
- custom_domain?: boolean;
319
- }
320
- interface WranglerConfig {
321
- name: string;
322
- main?: string;
323
- scope?: string;
324
- main_module?: string;
325
- routes?: Route[];
326
- compatibility_date?: string;
327
- compatibility_flags?: string[];
328
- vars?: Record<string, string>;
329
- kv_namespaces?: KVNamespace[];
330
- triggers?: Triggers;
331
- ai?: {
332
- binding: string;
333
- };
334
- browser?: {
335
- binding: string;
336
- };
337
- durable_objects?: {
338
- bindings?: {
339
- name: string;
340
- class_name: string;
341
- }[];
342
- };
343
- hyperdrive?: {
344
- binding: string;
345
- id: string;
346
- localConnectionString: string;
347
- }[];
348
- d1_databases?: {
349
- database_name: string;
350
- database_id?: string;
351
- binding: string;
352
- }[];
353
- queues?: {
354
- consumers?: {
355
- queue: string;
356
- max_batch_timeout: number;
357
- }[];
358
- producers?: {
359
- queue: string;
360
- binding: string;
361
- }[];
362
- };
363
- workflows?: {
364
- name: string;
365
- binding: string;
366
- class_name?: string;
367
- script_name?: string;
368
- }[];
369
- migrations?: Migration[];
370
- assets?: {
371
- directory?: string;
372
- binding?: string;
373
- jwt?: string;
374
- not_found_handling?: "none" | "404-page" | "single-page-application";
375
- run_worker_first?: boolean;
376
- };
377
- keep_assets?: boolean;
378
- deco?: {
379
- enable_workflows?: boolean;
380
- workspace?: string;
381
- local?: boolean;
382
- integration?: {
383
- friendlyName?: string;
384
- icon?: string;
385
- description?: string;
386
- };
387
- bindings?: Binding[];
388
- };
389
- }
390
-
391
- type WorkspaceClientContext = Omit<RequestContext, "ensureAuthenticated" | "state" | "fetchIntegrationMetadata">;
392
- declare const proxyConnectionForId: (integrationId: string, ctx: Omit<WorkspaceClientContext, "token"> & {
393
- token?: string;
394
- cookie?: string;
395
- }, decoChatApiUrl?: string, appName?: string) => MCPConnection;
396
-
397
- interface WorkspaceDB {
398
- query: (params: {
399
- sql: string;
400
- params: string[];
401
- }) => Promise<{
402
- result: QueryResult[];
403
- }>;
404
- }
405
- interface DefaultEnv<TSchema extends z.ZodTypeAny = any> extends DeprecatedEnv<TSchema> {
406
- DECO_REQUEST_CONTEXT: RequestContext<TSchema>;
407
- DECO_APP_NAME: string;
408
- DECO_APP_SLUG: string;
409
- DECO_APP_ENTRYPOINT: string;
410
- DECO_API_URL?: string;
411
- DECO_WORKSPACE: string;
412
- DECO_API_JWT_PUBLIC_KEY: string;
413
- DECO_APP_DEPLOYMENT_ID: string;
414
- DECO_BINDINGS: string;
415
- DECO_API_TOKEN: string;
416
- DECO_WORKFLOW_DO: DurableObjectNamespace<WorkflowDO>;
417
- DECO_WORKSPACE_DB: WorkspaceDB & {
418
- forContext: (ctx: RequestContext) => WorkspaceDB;
419
- };
420
- IS_LOCAL: boolean;
421
- [key: string]: unknown;
422
- }
423
- interface BindingsObject {
424
- bindings?: Binding[];
425
- }
426
- declare const WorkersMCPBindings: {
427
- parse: (bindings?: string) => Binding[];
428
- stringify: (bindings: Binding[]) => string;
429
- };
430
- interface UserDefaultExport<TUserEnv = Record<string, unknown>, TSchema extends z.ZodTypeAny = never, TEnv = TUserEnv & DefaultEnv<TSchema>> extends CreateMCPServerOptions<TEnv, TSchema> {
431
- fetch?: (req: Request, env: TEnv, ctx: ExecutionContext$1) => Promise<Response> | Response;
432
- }
433
- interface User {
434
- id: string;
435
- email: string;
436
- workspace: string;
437
- user_metadata: {
438
- avatar_url: string;
439
- full_name: string;
440
- picture: string;
441
- [key: string]: unknown;
442
- };
443
- }
444
- interface RequestContext<TSchema extends z.ZodTypeAny = any> {
445
- state: z.infer<TSchema>;
446
- branch?: string;
447
- token: string;
448
- workspace: string;
449
- ensureAuthenticated: (options?: {
450
- workspaceHint?: string;
451
- }) => User | undefined;
452
- callerApp?: string;
453
- integrationId?: string;
454
- }
455
- declare class UnauthorizedError extends Error {
456
- redirectTo: URL;
457
- constructor(message: string, redirectTo: URL);
458
- }
459
- declare const withBindings: <TEnv>({ env: _env, server, tokenOrContext, origin, url, branch, }: {
460
- env: TEnv;
461
- server: MCPServer<TEnv, any>;
462
- tokenOrContext?: string | RequestContext;
463
- origin?: string | null;
464
- url?: string;
465
- branch?: string | null;
466
- }) => TEnv;
467
- declare const withRuntime: <TEnv, TSchema extends z.ZodTypeAny = never>(userFns: UserDefaultExport<TEnv, TSchema>) => ExportedHandler<TEnv & DefaultEnv<TSchema>> & {
468
- Workflow: ReturnType<typeof Workflow>;
469
- };
470
-
471
- export { type AppContext as A, type BindingsObject as B, type CreatedTool as C, type DefaultEnv as D, type ExecWithContext as E, type Fetch as F, type Integration as I, type MCPServer as M, type Resources as R, type StreamableTool as S, type UserDefaultExport as U, type ViewExport as V, type WorkspaceDB as W, createStreamableTool as a, createRuntimeContext as b, createPrivateTool as c, createTool as d, type Step as e, createStepFromTool as f, createStep as g, type CreateMCPServerOptions as h, isStreamableTool as i, isWorkflow as j, createMCPServer as k, WorkersMCPBindings as l, type User as m, type RequestContext as n, UnauthorizedError as o, withRuntime as p, proxyConnectionForId as q, type Contract as r, type Migration as s, type WranglerConfig as t, withBindings as w };