@moinulmoin/eden-runtime-cloudflare 0.1.5 → 0.2.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 (47) hide show
  1. package/NOTICE +0 -31
  2. package/dist/eden-eve-host-worker.mjs +130 -10
  3. package/dist/eve-host-runtime.d.ts +13 -3
  4. package/dist/eve-host-runtime.js +47 -3
  5. package/dist/eve-host.d.ts +6 -1
  6. package/dist/eve-host.js +20 -11
  7. package/dist/index.d.ts +0 -18
  8. package/dist/index.js +0 -5
  9. package/package.json +2 -6
  10. package/dist/artifact-runtime.d.ts +0 -27
  11. package/dist/artifact-runtime.js +0 -14
  12. package/dist/http-host.d.ts +0 -6
  13. package/dist/http-host.js +0 -419
  14. package/dist/model-adapter-internal.d.ts +0 -12
  15. package/dist/model-adapter-internal.js +0 -172
  16. package/dist/model-adapter.d.ts +0 -9
  17. package/dist/model-adapter.js +0 -56
  18. package/dist/model-contracts.d.ts +0 -92
  19. package/dist/model-contracts.js +0 -2
  20. package/dist/model-normalizers.d.ts +0 -7
  21. package/dist/model-normalizers.js +0 -453
  22. package/dist/session-checkpoint.d.ts +0 -48
  23. package/dist/session-checkpoint.js +0 -300
  24. package/dist/session-identity.d.ts +0 -9
  25. package/dist/session-identity.js +0 -45
  26. package/dist/session-jobs.d.ts +0 -69
  27. package/dist/session-jobs.js +0 -427
  28. package/dist/session-journal.d.ts +0 -154
  29. package/dist/session-journal.js +0 -391
  30. package/dist/session-schema.d.ts +0 -21
  31. package/dist/session-schema.js +0 -247
  32. package/dist/session-state.d.ts +0 -165
  33. package/dist/session-state.js +0 -168
  34. package/dist/session.d.ts +0 -40
  35. package/dist/session.js +0 -792
  36. package/dist/test-execution.d.ts +0 -8
  37. package/dist/test-execution.js +0 -12
  38. package/dist/test-worker.d.ts +0 -12
  39. package/dist/test-worker.js +0 -214
  40. package/dist/tool-harness.d.ts +0 -31
  41. package/dist/tool-harness.js +0 -226
  42. package/dist/turn-runner-storage.d.ts +0 -28
  43. package/dist/turn-runner-storage.js +0 -583
  44. package/dist/turn-runner-types.d.ts +0 -112
  45. package/dist/turn-runner-types.js +0 -21
  46. package/dist/turn-runner.d.ts +0 -6
  47. package/dist/turn-runner.js +0 -370
package/NOTICE CHANGED
@@ -1,24 +1,6 @@
1
- eve
2
- Copyright 2026 Vercel, Inc. and contributors
3
-
4
- This product includes software developed at Vercel, Inc.
5
- (https://vercel.com/).
6
-
7
1
  Eden
8
2
  Copyright 2026 Eden contributors
9
3
 
10
- This repository contains Eden-owned modified derivative implementations
11
- informed by portable concepts from the Eve framework:
12
-
13
- Eve, version 0.31.3
14
- https://github.com/vercel/eve
15
- reference commit: 0b102bc90e7cf2c3e294f6ca3af86c307d449b1a
16
-
17
- Eve is distributed under the Apache License, Version 2.0. The applicable
18
- Apache-2.0 terms are included in LICENSE. This notice is retained for the
19
- Eve attribution obligation; it does not grant ownership of Eden's original
20
- implementation.
21
-
22
4
  Cloudflare Containers
23
5
  @cloudflare/containers, version 0.3.7
24
6
  https://github.com/cloudflare/containers
@@ -27,16 +9,3 @@ Eden's generated Worker host bundle includes software from
27
9
  `@cloudflare/containers`, distributed under MIT OR Apache-2.0. Eden
28
10
  redistributes that bundled software under the Apache-2.0 option included in
29
11
  LICENSE.
30
-
31
- The following Eden source files are marked in-file as modified derivatives of
32
- portable Eve concepts:
33
-
34
- packages/definitions/src/index.ts
35
- packages/compiler/src/index.ts
36
- packages/client/src/protocol.ts
37
- packages/runtime-cloudflare/src/session-journal.ts
38
- packages/runtime-cloudflare/src/model-normalizers.ts
39
-
40
- Eden does not include unmodified Eve source. The listed files are Eden-owned
41
- modifications and must retain their in-file modified-derivative notices when
42
- redistributed.
@@ -94,6 +94,33 @@ function addTimeoutSignal(existingSignal, timeoutMs) {
94
94
  controller.signal.addEventListener("abort", () => clearTimeout(timeoutId));
95
95
  return controller.signal;
96
96
  }
97
+ function simpleGlobMatch(pattern, value) {
98
+ const parts = pattern.split("*");
99
+ if (parts.length === 1)
100
+ return pattern === value;
101
+ if (!value.startsWith(parts[0]))
102
+ return false;
103
+ if (!value.endsWith(parts[parts.length - 1]))
104
+ return false;
105
+ let pos = parts[0].length;
106
+ for (let i = 1; i < parts.length - 1; i++) {
107
+ const idx = value.indexOf(parts[i], pos);
108
+ if (idx === -1)
109
+ return false;
110
+ pos = idx + parts[i].length;
111
+ }
112
+ return pos <= value.length - parts[parts.length - 1].length;
113
+ }
114
+ function matchesHostList(hostname, patterns) {
115
+ return patterns.some((pattern) => simpleGlobMatch(pattern, hostname));
116
+ }
117
+ function normalizeHostname(hostname) {
118
+ let end = hostname.length;
119
+ while (end > 0 && hostname[end - 1] === ".") {
120
+ end--;
121
+ }
122
+ return hostname.slice(0, end);
123
+ }
97
124
  var ContainerState = class {
98
125
  storage;
99
126
  status;
@@ -147,6 +174,60 @@ var ContainerState = class {
147
174
  await this.storage.put(CONTAINER_STATE_KEY, this.status);
148
175
  }
149
176
  };
177
+ var ContainerProxy = class extends WorkerEntrypoint {
178
+ async fetch(request) {
179
+ const url = new URL(request.url);
180
+ const hostname = normalizeHostname(url.hostname);
181
+ const { className, containerId, outboundByHostOverrides, outboundHandlerOverride, enableInternet, allowedHosts, deniedHosts, interceptAll } = this.ctx.props;
182
+ const baseCtx = { containerId, className };
183
+ if (deniedHosts && matchesHostList(hostname, deniedHosts)) {
184
+ return new Response("Origin is disallowed", { status: 520 });
185
+ }
186
+ if (allowedHosts && !matchesHostList(hostname, allowedHosts)) {
187
+ return new Response("Origin is disallowed", { status: 520 });
188
+ }
189
+ const handlers = outboundHandlersRegistry.get(className);
190
+ if (outboundByHostOverrides && handlers) {
191
+ const override = outboundByHostOverrides[hostname] ?? Object.entries(outboundByHostOverrides).find(([pattern]) => pattern !== hostname && simpleGlobMatch(pattern, hostname))?.[1];
192
+ if (override && handlers[override.method]) {
193
+ return handlers[override.method](request, this.env, {
194
+ ...baseCtx,
195
+ params: override.params
196
+ });
197
+ }
198
+ }
199
+ const handlersByHost = outboundByHostRegistry.get(className);
200
+ if (handlersByHost) {
201
+ const handler = handlersByHost[hostname] ?? Object.entries(handlersByHost).find(([pattern]) => pattern !== hostname && simpleGlobMatch(pattern, hostname))?.[1];
202
+ if (handler) {
203
+ return handler(request, this.env, baseCtx);
204
+ }
205
+ }
206
+ if (!interceptAll) {
207
+ if (allowedHosts || enableInternet) {
208
+ return fetch(request);
209
+ }
210
+ return new Response("Origin is disallowed", { status: 520 });
211
+ }
212
+ if (outboundHandlerOverride && handlers?.[outboundHandlerOverride.method]) {
213
+ return handlers[outboundHandlerOverride.method](request, this.env, {
214
+ ...baseCtx,
215
+ params: outboundHandlerOverride.params
216
+ });
217
+ }
218
+ const defaultOutboundHandlerName = defaultOutboundHandlerNameRegistry.get(className);
219
+ if (defaultOutboundHandlerName && handlers?.[defaultOutboundHandlerName]) {
220
+ return handlers[defaultOutboundHandlerName](request, this.env, baseCtx);
221
+ }
222
+ if (allowedHosts) {
223
+ return fetch(request);
224
+ }
225
+ if (enableInternet) {
226
+ return fetch(request);
227
+ }
228
+ return new Response("Origin is disallowed", { status: 520 });
229
+ }
230
+ };
150
231
  var Container = class extends DurableObject {
151
232
  static get outboundByHost() {
152
233
  return outboundByHostRegistry.get(this.name);
@@ -1417,16 +1498,19 @@ var EVE_HOST_DEFAULTS = {
1417
1498
  healthPath: "/eve/v1/health",
1418
1499
  internalPort: 8080,
1419
1500
  maxInstances: 1,
1420
- startCommand: [
1421
- "./node_modules/.bin/eve",
1422
- "start",
1423
- "--host",
1424
- "0.0.0.0",
1425
- "--port",
1426
- "8080"
1427
- ],
1501
+ instanceType: "basic",
1428
1502
  sleepAfter: "24h"
1429
1503
  };
1504
+ function isEveWorkflowInternalRoute(pathname) {
1505
+ let decodedPath = pathname;
1506
+ try {
1507
+ decodedPath = decodeURIComponent(pathname);
1508
+ } catch {
1509
+ }
1510
+ return /^\/\.well-known\/workflow\/v1\/(?:flow|step)(?:\/|$)/iu.test(
1511
+ decodedPath.replace(/\/+/gu, "/")
1512
+ );
1513
+ }
1430
1514
  var EVE_HOST_OWNED_HEADERS = [
1431
1515
  "forwarded",
1432
1516
  "x-forwarded-for",
@@ -1602,6 +1686,7 @@ var RESERVED_EVE_HOST_VARIABLES = /* @__PURE__ */ new Set([
1602
1686
  "PORT",
1603
1687
  "NITRO_PORT",
1604
1688
  "NODE_ENV",
1689
+ "NODE_EXTRA_CA_CERTS",
1605
1690
  "WORKFLOW_LOCAL_BASE_URL",
1606
1691
  "EDEN_EVE_DEPLOYMENT_ID",
1607
1692
  "EDEN_EVE_GENERATION_ID",
@@ -1810,11 +1895,38 @@ function createEveReadinessGate(options) {
1810
1895
  }
1811
1896
 
1812
1897
  // src/eve-host-runtime.ts
1898
+ var EVE_CLOUDFLARE_CONTAINERS_CA_PATH = "/etc/cloudflare/certs/cloudflare-containers-ca.crt";
1899
+ async function routeEveOutboundRequest(request, env) {
1900
+ const publicOrigin = env.EVE_PUBLIC_ORIGIN;
1901
+ const bindingName = env.EVE_CONTAINER_BINDING_NAME;
1902
+ const instanceName = env.EVE_CONTAINER_INSTANCE_NAME;
1903
+ if (typeof publicOrigin !== "string" || typeof bindingName !== "string" || typeof instanceName !== "string") {
1904
+ throw new EveHostError(
1905
+ "HOST_ORIGIN_UNAVAILABLE",
1906
+ "The container loopback identity is unavailable to the outbound handler."
1907
+ );
1908
+ }
1909
+ assertStableOrigin(publicOrigin);
1910
+ assertNonEmpty(bindingName, "Container binding name");
1911
+ assertNonEmpty(instanceName, "Container instance name");
1912
+ const hostname = new URL(request.url).hostname;
1913
+ if (hostname !== new URL(publicOrigin).hostname) {
1914
+ return fetch(request);
1915
+ }
1916
+ const namespace = env[bindingName];
1917
+ if (namespace === void 0) {
1918
+ throw new EveHostError(
1919
+ "HOST_READINESS_UNPROVEN",
1920
+ "The configured Container binding is unavailable to the outbound handler."
1921
+ );
1922
+ }
1923
+ return namespace.getByName(instanceName).containerFetch(request, EVE_HOST_DEFAULTS.internalPort);
1924
+ }
1813
1925
  var EveHostContainer = class extends Container {
1814
1926
  defaultPort = EVE_HOST_DEFAULTS.internalPort;
1815
1927
  requiredPorts = [EVE_HOST_DEFAULTS.internalPort];
1816
1928
  sleepAfter = EVE_HOST_DEFAULTS.sleepAfter;
1817
- entrypoint = [...EVE_HOST_DEFAULTS.startCommand];
1929
+ interceptHttps = true;
1818
1930
  enableInternet = true;
1819
1931
  pingEndpoint = "localhost/eve/v1/health";
1820
1932
  lifecycle = createEveHostLifecycleObserver();
@@ -1846,6 +1958,9 @@ var EveHostContainer = class extends Container {
1846
1958
  WORKFLOW_LOCAL_BASE_URL: publicOrigin,
1847
1959
  EDEN_EVE_DEPLOYMENT_ID: deploymentId,
1848
1960
  EDEN_EVE_GENERATION_ID: generationId,
1961
+ // Trust the runtime-mounted Cloudflare Containers CA so the intercepted
1962
+ // HTTPS deliveries to the public origin below complete TLS.
1963
+ NODE_EXTRA_CA_CERTS: EVE_CLOUDFLARE_CONTAINERS_CA_PATH,
1849
1964
  ...env.EDEN_EVE_RUNTIME_REVISION === void 0 ? {} : { EDEN_EVE_RUNTIME_REVISION: env.EDEN_EVE_RUNTIME_REVISION }
1850
1965
  };
1851
1966
  this.readiness = createEveReadinessGate({
@@ -1913,6 +2028,9 @@ function createEveHostWorker(options) {
1913
2028
  }
1914
2029
  return {
1915
2030
  async fetch(request, env) {
2031
+ if (isEveWorkflowInternalRoute(new URL(request.url).pathname)) {
2032
+ return new Response(null, { status: 404 });
2033
+ }
1916
2034
  const namespace = env[options.containerBindingName];
1917
2035
  if (namespace === void 0) {
1918
2036
  throw new EveHostError(
@@ -1955,6 +2073,8 @@ function createEveHostWorker(options) {
1955
2073
  };
1956
2074
  }
1957
2075
  export {
2076
+ ContainerProxy,
1958
2077
  EveHostContainer,
1959
- createEveHostWorker
2078
+ createEveHostWorker,
2079
+ routeEveOutboundRequest
1960
2080
  };
@@ -1,5 +1,16 @@
1
- import { Container } from "@cloudflare/containers";
1
+ import { Container, ContainerProxy } from "@cloudflare/containers";
2
2
  import { type EveHostContainerEnvironment, type EveHostForwardingMetadata, type EveHostReadinessEvidence } from "./eve-host.js";
3
+ export { ContainerProxy };
4
+ /**
5
+ * Delivers the container's own HTTPS requests to its public workers.dev origin
6
+ * back into the container over the internal port instead of the public edge.
7
+ * The Workflow local World posts queue deliveries to
8
+ * `WORKFLOW_LOCAL_BASE_URL`, which must remain the public origin so Eve's
9
+ * externally visible callback URLs stay correct; re-routing that traffic
10
+ * inside the Worker lets the public Worker path refuse the unauthenticated
11
+ * queue endpoints without breaking delivery.
12
+ */
13
+ export declare function routeEveOutboundRequest(request: Request, env: EveHostContainerEnvironment): Promise<Response>;
3
14
  /**
4
15
  * This module is the only Eve-host surface that depends on provider runtime
5
16
  * packages. It is bundled into the deployed Worker directory instead of the
@@ -11,7 +22,7 @@ export declare class EveHostContainer extends Container<EveHostContainerEnvironm
11
22
  defaultPort: 8080;
12
23
  requiredPorts: 8080[];
13
24
  sleepAfter: "24h";
14
- entrypoint: ("./node_modules/.bin/eve" | "start" | "--host" | "0.0.0.0" | "--port" | "8080")[];
25
+ interceptHttps: boolean;
15
26
  enableInternet: boolean;
16
27
  pingEndpoint: string;
17
28
  readonly lifecycle: import("./eve-host.js").EveHostLifecycleObserver;
@@ -42,5 +53,4 @@ export interface EveHostWorkerHandler {
42
53
  fetch(request: Request, env: EveHostWorkerEnvironment): Promise<Response>;
43
54
  }
44
55
  export declare function createEveHostWorker(options: EveHostWorkerOptions): EveHostWorkerHandler;
45
- export {};
46
56
  //# sourceMappingURL=eve-host-runtime.d.ts.map
@@ -1,10 +1,45 @@
1
- import { Container } from "@cloudflare/containers";
2
- import { EVE_HOST_DEFAULTS, EveHostError, assertNonEmpty, assertStableOrigin, createEveHostLifecycleObserver, createEveReadinessGate, createTrustedEveRequest, IDENTIFIER_PATTERN, readProtectedRuntimeVariables, WORKER_NAME_PATTERN, } from "./eve-host.js";
1
+ import { Container, ContainerProxy } from "@cloudflare/containers";
2
+ import { EVE_HOST_DEFAULTS, EveHostError, assertNonEmpty, assertStableOrigin, createEveHostLifecycleObserver, createEveReadinessGate, createTrustedEveRequest, IDENTIFIER_PATTERN, readProtectedRuntimeVariables, WORKER_NAME_PATTERN, isEveWorkflowInternalRoute, } from "./eve-host.js";
3
+ export { ContainerProxy };
4
+ const EVE_CLOUDFLARE_CONTAINERS_CA_PATH = "/etc/cloudflare/certs/cloudflare-containers-ca.crt";
5
+ /**
6
+ * Delivers the container's own HTTPS requests to its public workers.dev origin
7
+ * back into the container over the internal port instead of the public edge.
8
+ * The Workflow local World posts queue deliveries to
9
+ * `WORKFLOW_LOCAL_BASE_URL`, which must remain the public origin so Eve's
10
+ * externally visible callback URLs stay correct; re-routing that traffic
11
+ * inside the Worker lets the public Worker path refuse the unauthenticated
12
+ * queue endpoints without breaking delivery.
13
+ */
14
+ export async function routeEveOutboundRequest(request, env) {
15
+ const publicOrigin = env.EVE_PUBLIC_ORIGIN;
16
+ const bindingName = env.EVE_CONTAINER_BINDING_NAME;
17
+ const instanceName = env.EVE_CONTAINER_INSTANCE_NAME;
18
+ if (typeof publicOrigin !== "string" ||
19
+ typeof bindingName !== "string" ||
20
+ typeof instanceName !== "string") {
21
+ throw new EveHostError("HOST_ORIGIN_UNAVAILABLE", "The container loopback identity is unavailable to the outbound handler.");
22
+ }
23
+ assertStableOrigin(publicOrigin);
24
+ assertNonEmpty(bindingName, "Container binding name");
25
+ assertNonEmpty(instanceName, "Container instance name");
26
+ const hostname = new URL(request.url).hostname;
27
+ if (hostname !== new URL(publicOrigin).hostname) {
28
+ return fetch(request);
29
+ }
30
+ const namespace = env[bindingName];
31
+ if (namespace === undefined) {
32
+ throw new EveHostError("HOST_READINESS_UNPROVEN", "The configured Container binding is unavailable to the outbound handler.");
33
+ }
34
+ return namespace
35
+ .getByName(instanceName)
36
+ .containerFetch(request, EVE_HOST_DEFAULTS.internalPort);
37
+ }
3
38
  export class EveHostContainer extends Container {
4
39
  defaultPort = EVE_HOST_DEFAULTS.internalPort;
5
40
  requiredPorts = [EVE_HOST_DEFAULTS.internalPort];
6
41
  sleepAfter = EVE_HOST_DEFAULTS.sleepAfter;
7
- entrypoint = [...EVE_HOST_DEFAULTS.startCommand];
42
+ interceptHttps = true;
8
43
  enableInternet = true;
9
44
  pingEndpoint = "localhost/eve/v1/health";
10
45
  lifecycle = createEveHostLifecycleObserver();
@@ -35,6 +70,9 @@ export class EveHostContainer extends Container {
35
70
  WORKFLOW_LOCAL_BASE_URL: publicOrigin,
36
71
  EDEN_EVE_DEPLOYMENT_ID: deploymentId,
37
72
  EDEN_EVE_GENERATION_ID: generationId,
73
+ // Trust the runtime-mounted Cloudflare Containers CA so the intercepted
74
+ // HTTPS deliveries to the public origin below complete TLS.
75
+ NODE_EXTRA_CA_CERTS: EVE_CLOUDFLARE_CONTAINERS_CA_PATH,
38
76
  ...(env.EDEN_EVE_RUNTIME_REVISION === undefined
39
77
  ? {}
40
78
  : { EDEN_EVE_RUNTIME_REVISION: env.EDEN_EVE_RUNTIME_REVISION }),
@@ -92,6 +130,12 @@ export function createEveHostWorker(options) {
92
130
  }
93
131
  return {
94
132
  async fetch(request, env) {
133
+ // Queue deliveries to these endpoints arrive through the container's
134
+ // intercepted outbound loopback instead, so any request that reaches
135
+ // the public Worker fetch path is external and unauthenticated.
136
+ if (isEveWorkflowInternalRoute(new URL(request.url).pathname)) {
137
+ return new Response(null, { status: 404 });
138
+ }
95
139
  const namespace = env[options.containerBindingName];
96
140
  if (namespace === undefined) {
97
141
  throw new EveHostError("HOST_READINESS_UNPROVEN", "The configured Container binding is unavailable.");
@@ -3,9 +3,11 @@ export declare const EVE_HOST_DEFAULTS: {
3
3
  readonly healthPath: "/eve/v1/health";
4
4
  readonly internalPort: 8080;
5
5
  readonly maxInstances: 1;
6
- readonly startCommand: readonly ["./node_modules/.bin/eve", "start", "--host", "0.0.0.0", "--port", "8080"];
6
+ readonly instanceType: "basic";
7
7
  readonly sleepAfter: "24h";
8
8
  };
9
+ /** Queue deliveries are private; webhook and manifest routes stay forwarded. */
10
+ export declare function isEveWorkflowInternalRoute(pathname: string): boolean;
9
11
  export declare const EVE_HOST_OWNED_HEADERS: readonly ["forwarded", "x-forwarded-for", "x-forwarded-host", "x-forwarded-port", "x-forwarded-proto", "x-forwarded-server", "x-forwarded-scheme", "x-real-ip", "cf-connecting-ip", "cf-visitor", "true-client-ip", "x-original-host", "x-original-proto", "x-envoy-original-host", "x-envoy-original-proto", "x-proxy-host", "x-host", "x-eve-public-origin", "x-workflow-local-base-url", "x-eden-eve-callback-base", "x-eden-eve-deployment-id", "x-eden-eve-generation-id", "x-eden-eve-public-origin", "x-eden-eve-correlation-id", "x-eden-eve-container-name", "x-eden-eve-container-id", "x-eden-eve-runtime-revision", "x-eden-deployment-id", "x-eden-generation-id", "x-eden-container-name", "x-eden-container-id", "cf-container-target-port"];
10
12
  export declare const WORKER_NAME_PATTERN: RegExp;
11
13
  export declare const IDENTIFIER_PATTERN: RegExp;
@@ -45,6 +47,7 @@ export interface EveHostWranglerConfig {
45
47
  readonly vars: {
46
48
  readonly EVE_PUBLIC_ORIGIN: string;
47
49
  readonly EVE_CONTAINER_INSTANCE_NAME: string;
50
+ readonly EVE_CONTAINER_BINDING_NAME: string;
48
51
  readonly EDEN_EVE_DEPLOYMENT_ID: string;
49
52
  readonly EDEN_EVE_GENERATION_ID: string;
50
53
  readonly EVE_RUNTIME_VARIABLE_NAMES: readonly string[];
@@ -57,6 +60,7 @@ export interface EveHostWranglerConfig {
57
60
  readonly image: string;
58
61
  readonly image_build_context?: string;
59
62
  readonly max_instances: 1;
63
+ readonly instance_type: "basic";
60
64
  }
61
65
  ];
62
66
  readonly durable_objects: {
@@ -128,6 +132,7 @@ export interface EveHostContainerEnvironment {
128
132
  readonly EVE_RUNTIME_VARIABLE_NAMES?: readonly string[];
129
133
  readonly EVE_PUBLIC_ORIGIN?: string;
130
134
  readonly EVE_CONTAINER_INSTANCE_NAME?: string;
135
+ readonly EVE_CONTAINER_BINDING_NAME?: string;
131
136
  readonly EDEN_EVE_DEPLOYMENT_ID?: string;
132
137
  readonly EDEN_EVE_GENERATION_ID?: string;
133
138
  readonly EDEN_EVE_RUNTIME_REVISION?: string;
package/dist/eve-host.js CHANGED
@@ -3,16 +3,20 @@ export const EVE_HOST_DEFAULTS = {
3
3
  healthPath: "/eve/v1/health",
4
4
  internalPort: 8080,
5
5
  maxInstances: 1,
6
- startCommand: [
7
- "./node_modules/.bin/eve",
8
- "start",
9
- "--host",
10
- "0.0.0.0",
11
- "--port",
12
- "8080",
13
- ],
6
+ instanceType: "basic",
14
7
  sleepAfter: "24h",
15
8
  };
9
+ /** Queue deliveries are private; webhook and manifest routes stay forwarded. */
10
+ export function isEveWorkflowInternalRoute(pathname) {
11
+ let decodedPath = pathname;
12
+ try {
13
+ decodedPath = decodeURIComponent(pathname);
14
+ }
15
+ catch {
16
+ // Malformed escapes cannot name a queue route in Eve's router.
17
+ }
18
+ return /^\/\.well-known\/workflow\/v1\/(?:flow|step)(?:\/|$)/iu.test(decodedPath.replace(/\/+/gu, "/"));
19
+ }
16
20
  export const EVE_HOST_OWNED_HEADERS = [
17
21
  "forwarded",
18
22
  "x-forwarded-for",
@@ -141,6 +145,7 @@ export function createEveHostConfig(request) {
141
145
  ? {}
142
146
  : { image_build_context: request.containerImageBuildContext }),
143
147
  max_instances: EVE_HOST_DEFAULTS.maxInstances,
148
+ instance_type: EVE_HOST_DEFAULTS.instanceType,
144
149
  };
145
150
  return {
146
151
  worker: {
@@ -154,6 +159,7 @@ export function createEveHostConfig(request) {
154
159
  vars: {
155
160
  EVE_PUBLIC_ORIGIN: request.stableWorkersDevOrigin,
156
161
  EVE_CONTAINER_INSTANCE_NAME: request.stableContainerInstanceName,
162
+ EVE_CONTAINER_BINDING_NAME: request.containerBindingName,
157
163
  EDEN_EVE_DEPLOYMENT_ID: request.deploymentId,
158
164
  EDEN_EVE_GENERATION_ID: request.generationId,
159
165
  EVE_RUNTIME_VARIABLE_NAMES: request.runtimeVariableNames ?? [],
@@ -208,10 +214,12 @@ export function generateEveHostWorkerSource(request) {
208
214
  }),
209
215
  };
210
216
  return [
211
- `import { EveHostContainer, createEveHostWorker } from ${JSON.stringify(moduleSpecifier)};`,
217
+ `import { ContainerProxy, EveHostContainer, createEveHostWorker, routeEveOutboundRequest } from ${JSON.stringify(moduleSpecifier)};`,
212
218
  request.config.container.className === "EveHostContainer"
213
- ? "export { EveHostContainer };"
214
- : `export { EveHostContainer as ${request.config.container.className} };`,
219
+ ? "export { ContainerProxy, EveHostContainer };"
220
+ : `export { ContainerProxy, EveHostContainer as ${request.config.container.className} };`,
221
+ "",
222
+ `EveHostContainer.outboundByHost = { ${JSON.stringify(new URL(request.config.container.publicOrigin).hostname)}: routeEveOutboundRequest };`,
215
223
  "",
216
224
  `export default createEveHostWorker(${JSON.stringify(workerOptions)});`,
217
225
  "",
@@ -331,6 +339,7 @@ const RESERVED_EVE_HOST_VARIABLES = new Set([
331
339
  "PORT",
332
340
  "NITRO_PORT",
333
341
  "NODE_ENV",
342
+ "NODE_EXTRA_CA_CERTS",
334
343
  "WORKFLOW_LOCAL_BASE_URL",
335
344
  "EDEN_EVE_DEPLOYMENT_ID",
336
345
  "EDEN_EVE_GENERATION_ID",
package/dist/index.d.ts CHANGED
@@ -1,21 +1,3 @@
1
- import type { EdenEvent, EdenEventType, EdenSessionSnapshot, EdenVersionSet } from "@moinulmoin/eden-definitions";
2
- export { configureEdenArtifact, readConfiguredEdenArtifact, } from "./artifact-runtime.js";
3
- export type { EdenArtifactGenerationMetadata, EdenConfiguredArtifact, EdenRuntimeAgentArtifact, } from "./artifact-runtime.js";
4
- export type { EdenEvent, EdenEventDataByType, EdenEventType, EdenSessionSnapshot, EdenVersionSet, } from "@moinulmoin/eden-definitions";
5
- export { createModelAdapter, normalizeEdenJsonValue, normalizeModelFailure, normalizeModelMessages, normalizeModelResult, } from "./model-adapter.js";
6
- export type { EdenModelAdapter, EdenModelCorrelation, EdenModelFailure, EdenModelFailureCode, EdenModelFinishReason, EdenModelMessage, EdenModelMessagePart, EdenModelOptions, EdenModelOutcome, EdenModelAdapterCall, EdenModelAdapterRequest, EdenModelRequest, EdenModelResult, EdenModelRole, EdenModelToolCall, EdenModelToolChoice, EdenModelToolDefinition, EdenModelToolResult, EdenModelUsage, } from "./model-adapter.js";
7
- export interface EdenRuntimeConfiguration {
8
- readonly versions: EdenVersionSet;
9
- }
10
- export interface EdenSessionStore {
11
- createSession(): Promise<EdenSessionSnapshot>;
12
- readEvents(sessionId: string, startIndex?: number): Promise<readonly EdenEvent<EdenEventType>[]>;
13
- }
14
- export interface EdenRuntime {
15
- readonly configuration: EdenRuntimeConfiguration;
16
- readonly sessions: EdenSessionStore;
17
- }
18
- export declare function createRuntime(configuration: EdenRuntimeConfiguration, sessions: EdenSessionStore): EdenRuntime;
19
1
  export { EVE_HOST_DEFAULTS, EVE_HOST_OWNED_HEADERS, EveHostError, createEveHostConfig, createEveHostLifecycleObserver, createEveHostProxy, createEveReadinessGate, createTrustedEveRequest, generateEveHostWorkerSource, resolveStableWorkersDevOrigin, } from "./eve-host.js";
20
2
  export type { EveContainerTransport, EveHostConfig, EveHostConfigRequest, EveHostContainerConfig, EveHostContainerEnvironment, EveHostErrorCode, EveHostForwardingMetadata, EveHostIdentity, EveHostLifecycleEvent, EveHostLifecycleObserver, EveHostProxyOptions, EveHostReadinessEvidence, EveHostReadinessOptions, EveReadinessGate, EveHostWranglerConfig, EveGeneratedWorkerSourceRequest, StableWorkersDevOriginRequest, } from "./eve-host.js";
21
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,7 +1,2 @@
1
- export { configureEdenArtifact, readConfiguredEdenArtifact, } from "./artifact-runtime.js";
2
- export { createModelAdapter, normalizeEdenJsonValue, normalizeModelFailure, normalizeModelMessages, normalizeModelResult, } from "./model-adapter.js";
3
- export function createRuntime(configuration, sessions) {
4
- return { configuration, sessions };
5
- }
6
1
  export { EVE_HOST_DEFAULTS, EVE_HOST_OWNED_HEADERS, EveHostError, createEveHostConfig, createEveHostLifecycleObserver, createEveHostProxy, createEveReadinessGate, createTrustedEveRequest, generateEveHostWorkerSource, resolveStableWorkersDevOrigin, } from "./eve-host.js";
7
2
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@moinulmoin/eden-runtime-cloudflare",
3
- "version": "0.1.5",
4
- "description": "Cloudflare runtime for Eden Deploy and Eden Agent.",
3
+ "version": "0.2.1",
4
+ "description": "Cloudflare Worker/Container host runtime for Eden's Eve deployments.",
5
5
  "type": "module",
6
6
  "license": "Apache-2.0",
7
7
  "types": "./dist/index.d.ts",
@@ -19,12 +19,8 @@
19
19
  "LICENSE",
20
20
  "NOTICE"
21
21
  ],
22
- "dependencies": {
23
- "@moinulmoin/eden-definitions": "0.1.5"
24
- },
25
22
  "devDependencies": {
26
23
  "@cloudflare/containers": "0.3.7",
27
- "@cloudflare/vitest-pool-workers": "0.20.3",
28
24
  "@cloudflare/workers-types": "5.20260810.1"
29
25
  },
30
26
  "repository": {
@@ -1,27 +0,0 @@
1
- import type { EdenAgentDefinition, EdenJsonValue, EdenToolDefinition } from "@moinulmoin/eden-definitions";
2
- export interface EdenArtifactGenerationMetadata {
3
- readonly generationId: string;
4
- readonly bundleDigest: string;
5
- readonly manifestVersion: string;
6
- readonly runtimeVersion: string;
7
- readonly agentBundleVersion: string;
8
- readonly protocolVersion: string;
9
- /** Generated artifact/schema-contract version, not the installed SQLite level. */
10
- readonly schemaVersion: number;
11
- readonly toolNames: readonly string[];
12
- readonly executionMode: "local" | "remote";
13
- }
14
- export interface EdenRuntimeAgentArtifact {
15
- readonly agent: EdenAgentDefinition;
16
- readonly instructions: string;
17
- readonly tools: Readonly<Record<string, EdenToolDefinition>>;
18
- readonly toolSchemas: Readonly<Record<string, EdenJsonValue>>;
19
- readonly moduleMap?: unknown;
20
- }
21
- export interface EdenConfiguredArtifact {
22
- readonly artifact: EdenRuntimeAgentArtifact;
23
- readonly generation: EdenArtifactGenerationMetadata;
24
- }
25
- export declare function configureEdenArtifact(artifact: EdenRuntimeAgentArtifact, generation: EdenArtifactGenerationMetadata): void;
26
- export declare function readConfiguredEdenArtifact(): EdenConfiguredArtifact | undefined;
27
- //# sourceMappingURL=artifact-runtime.d.ts.map
@@ -1,14 +0,0 @@
1
- let configuredArtifact;
2
- export function configureEdenArtifact(artifact, generation) {
3
- configuredArtifact = Object.freeze({
4
- artifact,
5
- generation: Object.freeze({
6
- ...generation,
7
- toolNames: Object.freeze([...generation.toolNames]),
8
- }),
9
- });
10
- }
11
- export function readConfiguredEdenArtifact() {
12
- return configuredArtifact;
13
- }
14
- //# sourceMappingURL=artifact-runtime.js.map
@@ -1,6 +0,0 @@
1
- export interface EdenWorkerEnvironment {
2
- readonly EDEN_BEARER_SECRET?: string;
3
- readonly EDEN_SESSIONS?: DurableObjectNamespace;
4
- }
5
- export declare function handleEdenRequest(request: Request, env: EdenWorkerEnvironment): Promise<Response>;
6
- //# sourceMappingURL=http-host.d.ts.map