@moinulmoin/eden-runtime-cloudflare 0.9.0 → 0.11.0
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/dist/eden-eve-host-worker.mjs +18836 -16582
- package/dist/eve-host-runtime.d.ts +36 -7
- package/dist/eve-host-runtime.js +754 -77
- package/dist/eve-host.d.ts +45 -5
- package/dist/eve-host.js +56 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/package.json +2 -2
package/dist/eve-host.d.ts
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
export declare const EDEN_AFFINITY_CONTRACT = 1;
|
|
2
|
+
/** Keeps the root declaration and module-load surfaces provider-independent. */
|
|
3
|
+
export declare function callDeploymentControlRpc(options: {
|
|
4
|
+
readonly origin: string;
|
|
5
|
+
readonly token: string;
|
|
6
|
+
readonly operation: "deployments.drainState" | "deployments.retire";
|
|
7
|
+
readonly args: unknown[];
|
|
8
|
+
readonly signal?: AbortSignal;
|
|
9
|
+
}): Promise<unknown>;
|
|
1
10
|
export declare const EVE_HOST_DEFAULTS: {
|
|
2
11
|
readonly compatibilityDate: "2026-04-01";
|
|
3
12
|
readonly healthPath: "/eve/v1/health";
|
|
@@ -82,11 +91,33 @@ export interface EveHostIdentity {
|
|
|
82
91
|
readonly stableContainerInstanceName: string;
|
|
83
92
|
readonly deploymentId: string;
|
|
84
93
|
readonly generationId: string;
|
|
94
|
+
readonly releaseId?: string;
|
|
95
|
+
readonly eveVersion?: string;
|
|
96
|
+
readonly affinityContract?: number;
|
|
97
|
+
}
|
|
98
|
+
export interface EveRetainedDeployment {
|
|
99
|
+
readonly image: string;
|
|
100
|
+
readonly generationId: string;
|
|
101
|
+
readonly runtimeRevisionHandle?: string;
|
|
102
|
+
readonly releaseId?: string;
|
|
103
|
+
readonly eveVersion?: string;
|
|
104
|
+
readonly affinityContract?: number;
|
|
105
|
+
readonly worldRpcAuth?: boolean;
|
|
106
|
+
}
|
|
107
|
+
export interface EveDeploymentRoute {
|
|
108
|
+
readonly image: string;
|
|
109
|
+
readonly generationId: string;
|
|
110
|
+
readonly runtimeRevisionHandle?: string;
|
|
111
|
+
readonly releaseId?: string;
|
|
112
|
+
readonly eveVersion?: string;
|
|
113
|
+
readonly affinityContract?: number;
|
|
114
|
+
readonly worldRpcAuth?: boolean;
|
|
85
115
|
}
|
|
86
116
|
export interface EveHostConfigRequest extends EveHostIdentity {
|
|
87
117
|
readonly accountId?: string;
|
|
88
118
|
readonly stableWorkersDevOrigin: string;
|
|
89
119
|
readonly containerImage: string;
|
|
120
|
+
readonly retainedDeployments?: Readonly<Record<string, EveRetainedDeployment>>;
|
|
90
121
|
readonly containerImageBuildContext?: string;
|
|
91
122
|
readonly runtimeVariableNames?: readonly string[];
|
|
92
123
|
readonly runtimeRevisionHandle?: string;
|
|
@@ -98,6 +129,7 @@ export interface EveHostConfigRequest extends EveHostIdentity {
|
|
|
98
129
|
/** Overrides the Container `sleepAfter` (e.g. "30s") for testing. */
|
|
99
130
|
readonly containerSleepAfter?: string;
|
|
100
131
|
readonly workflowWorld?: string;
|
|
132
|
+
readonly worldRpcAuth?: boolean;
|
|
101
133
|
/**
|
|
102
134
|
* Durable Object state already published for this exact target. In-place
|
|
103
135
|
* updates carry the recorded binding and migration history forward
|
|
@@ -135,10 +167,13 @@ export interface EveHostWranglerConfig {
|
|
|
135
167
|
readonly EVE_CONTAINER_INSTANCE_NAME: string;
|
|
136
168
|
readonly EDEN_EVE_DEPLOYMENT_ID: string;
|
|
137
169
|
readonly EDEN_EVE_GENERATION_ID: string;
|
|
170
|
+
readonly EDEN_EVE_DEPLOYMENTS?: string;
|
|
171
|
+
readonly EDEN_EVE_RELEASE_ID: string;
|
|
138
172
|
readonly EVE_RUNTIME_VARIABLE_NAMES: readonly string[];
|
|
139
173
|
readonly EDEN_EVE_RUNTIME_REVISION?: string;
|
|
140
174
|
readonly EDEN_EVE_CONTAINER_SLEEP_AFTER?: string;
|
|
141
175
|
readonly EDEN_EVE_WORLD_CLOUDFLARE?: true;
|
|
176
|
+
readonly EDEN_EVE_WORLD_RPC_AUTH?: true;
|
|
142
177
|
};
|
|
143
178
|
readonly triggers?: {
|
|
144
179
|
readonly crons: readonly string[];
|
|
@@ -148,11 +183,9 @@ export interface EveHostWranglerConfig {
|
|
|
148
183
|
readonly name: string;
|
|
149
184
|
readonly class_name: string;
|
|
150
185
|
readonly scheduling_policy: "durable_object";
|
|
151
|
-
readonly images: {
|
|
152
|
-
readonly
|
|
153
|
-
|
|
154
|
-
};
|
|
155
|
-
};
|
|
186
|
+
readonly images: Readonly<Record<string, {
|
|
187
|
+
readonly image: string;
|
|
188
|
+
}>>;
|
|
156
189
|
}
|
|
157
190
|
];
|
|
158
191
|
readonly durable_objects: {
|
|
@@ -169,6 +202,8 @@ export interface EveHostContainerConfig {
|
|
|
169
202
|
readonly publicOrigin: string;
|
|
170
203
|
readonly deploymentId: string;
|
|
171
204
|
readonly generationId: string;
|
|
205
|
+
readonly deployments?: Readonly<Record<string, EveDeploymentRoute>>;
|
|
206
|
+
readonly releaseId?: string;
|
|
172
207
|
readonly runtimeRevisionHandle?: string;
|
|
173
208
|
readonly schedules: readonly EveScheduleCronEntry[];
|
|
174
209
|
}
|
|
@@ -184,6 +219,7 @@ export declare function assertStableOrigin(value: string, workerName?: string):
|
|
|
184
219
|
export declare function createEveHostConfig(request: EveHostConfigRequest): EveHostConfig;
|
|
185
220
|
export declare function generateEveHostWorkerSource(request: EveGeneratedWorkerSourceRequest): string;
|
|
186
221
|
export interface EveHostForwardingMetadata {
|
|
222
|
+
readonly releaseId?: string;
|
|
187
223
|
readonly publicOrigin: string;
|
|
188
224
|
readonly deploymentId: string;
|
|
189
225
|
readonly generationId: string;
|
|
@@ -198,9 +234,13 @@ export interface EveHostContainerEnvironment {
|
|
|
198
234
|
readonly EVE_CONTAINER_INSTANCE_NAME?: string;
|
|
199
235
|
readonly EDEN_EVE_DEPLOYMENT_ID?: string;
|
|
200
236
|
readonly EDEN_EVE_GENERATION_ID?: string;
|
|
237
|
+
readonly EDEN_EVE_RELEASE_ID?: string;
|
|
238
|
+
readonly EDEN_EVE_CONTROL_TOKEN?: string;
|
|
239
|
+
readonly EDEN_EVE_DEPLOYMENTS?: string;
|
|
201
240
|
readonly EDEN_EVE_RUNTIME_REVISION?: string;
|
|
202
241
|
readonly EDEN_EVE_CONTAINER_SLEEP_AFTER?: string;
|
|
203
242
|
readonly EDEN_EVE_WORLD_CLOUDFLARE?: boolean;
|
|
243
|
+
readonly EDEN_EVE_WORLD_RPC_AUTH?: boolean;
|
|
204
244
|
}
|
|
205
245
|
export interface EveHostReadinessEvidence {
|
|
206
246
|
readonly healthPath: "/eve/v1/health";
|
package/dist/eve-host.js
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
export const EDEN_AFFINITY_CONTRACT = 1;
|
|
2
|
+
/** Keeps the root declaration and module-load surfaces provider-independent. */
|
|
3
|
+
export async function callDeploymentControlRpc(options) {
|
|
4
|
+
// The World implementation is optional for root-module consumers. A static
|
|
5
|
+
// provider import would break that intentionally provider-free load boundary.
|
|
6
|
+
const world = await import("@moinulmoin/eden-world-cloudflare/core");
|
|
7
|
+
return world.callDeploymentControlRpc(options);
|
|
8
|
+
}
|
|
1
9
|
export const EVE_HOST_DEFAULTS = {
|
|
2
10
|
compatibilityDate: "2026-04-01",
|
|
3
11
|
healthPath: "/eve/v1/health",
|
|
@@ -303,11 +311,45 @@ export function createEveHostConfig(request) {
|
|
|
303
311
|
if (request.containerSleepAfter !== undefined) {
|
|
304
312
|
parseEveSleepAfterMs(request.containerSleepAfter);
|
|
305
313
|
}
|
|
314
|
+
const retainedDeployments = {
|
|
315
|
+
...request.retainedDeployments,
|
|
316
|
+
[request.deploymentId]: {
|
|
317
|
+
image: request.containerImage,
|
|
318
|
+
releaseId: request.releaseId ?? request.deploymentId,
|
|
319
|
+
...(request.eveVersion === undefined ? {} : { eveVersion: request.eveVersion }),
|
|
320
|
+
affinityContract: request.affinityContract ?? EDEN_AFFINITY_CONTRACT,
|
|
321
|
+
...(request.worldRpcAuth === true ? { worldRpcAuth: true } : {}),
|
|
322
|
+
generationId: request.generationId,
|
|
323
|
+
...(request.runtimeRevisionHandle === undefined
|
|
324
|
+
? {}
|
|
325
|
+
: { runtimeRevisionHandle: request.runtimeRevisionHandle }),
|
|
326
|
+
},
|
|
327
|
+
};
|
|
328
|
+
const images = {};
|
|
329
|
+
const deployments = {};
|
|
330
|
+
for (const [deploymentId, retained] of Object.entries(retainedDeployments)) {
|
|
331
|
+
assertNonEmpty(deploymentId, "retained deployment identity");
|
|
332
|
+
assertNonEmpty(retained.generationId, "retained generation identity");
|
|
333
|
+
assertContainerImage(retained.image);
|
|
334
|
+
const image = `deployment_${Array.from(new TextEncoder().encode(deploymentId), (byte) => byte.toString(16).padStart(2, "0")).join("")}`;
|
|
335
|
+
images[image] = { image: retained.image };
|
|
336
|
+
deployments[deploymentId] = {
|
|
337
|
+
image,
|
|
338
|
+
generationId: retained.generationId,
|
|
339
|
+
...(retained.releaseId === undefined ? {} : { releaseId: retained.releaseId }),
|
|
340
|
+
...(retained.eveVersion === undefined ? {} : { eveVersion: retained.eveVersion }),
|
|
341
|
+
...(retained.affinityContract === undefined ? {} : { affinityContract: retained.affinityContract }),
|
|
342
|
+
...(retained.worldRpcAuth === undefined ? {} : { worldRpcAuth: retained.worldRpcAuth }),
|
|
343
|
+
...(retained.runtimeRevisionHandle === undefined
|
|
344
|
+
? {}
|
|
345
|
+
: { runtimeRevisionHandle: retained.runtimeRevisionHandle }),
|
|
346
|
+
};
|
|
347
|
+
}
|
|
306
348
|
const container = {
|
|
307
349
|
name: request.containerApplicationName,
|
|
308
350
|
class_name: "EveHostDurableContainer",
|
|
309
351
|
scheduling_policy: "durable_object",
|
|
310
|
-
images: { eve: { image: request.containerImage } },
|
|
352
|
+
images: request.retainedDeployments === undefined ? { eve: { image: request.containerImage } } : images,
|
|
311
353
|
};
|
|
312
354
|
const worldCloudflare = request.workflowWorld === "@moinulmoin/eden-world-cloudflare";
|
|
313
355
|
const priorMigrations = [];
|
|
@@ -377,7 +419,9 @@ export function createEveHostConfig(request) {
|
|
|
377
419
|
EVE_PUBLIC_ORIGIN: request.stableWorkersDevOrigin,
|
|
378
420
|
EVE_CONTAINER_INSTANCE_NAME: request.stableContainerInstanceName,
|
|
379
421
|
EDEN_EVE_DEPLOYMENT_ID: request.deploymentId,
|
|
422
|
+
EDEN_EVE_RELEASE_ID: request.releaseId ?? request.deploymentId,
|
|
380
423
|
EDEN_EVE_GENERATION_ID: request.generationId,
|
|
424
|
+
...(request.retainedDeployments === undefined ? {} : { EDEN_EVE_DEPLOYMENTS: JSON.stringify(deployments) }),
|
|
381
425
|
EVE_RUNTIME_VARIABLE_NAMES: request.runtimeVariableNames ?? [],
|
|
382
426
|
...(request.runtimeRevisionHandle === undefined
|
|
383
427
|
? {}
|
|
@@ -388,6 +432,7 @@ export function createEveHostConfig(request) {
|
|
|
388
432
|
...(request.workflowWorld === "@moinulmoin/eden-world-cloudflare"
|
|
389
433
|
? { EDEN_EVE_WORLD_CLOUDFLARE: true }
|
|
390
434
|
: {}),
|
|
435
|
+
...(request.worldRpcAuth === true ? { EDEN_EVE_WORLD_RPC_AUTH: true } : {}),
|
|
391
436
|
},
|
|
392
437
|
...(schedules.length === 0
|
|
393
438
|
? {}
|
|
@@ -404,6 +449,7 @@ export function createEveHostConfig(request) {
|
|
|
404
449
|
port: EVE_HOST_DEFAULTS.internalPort,
|
|
405
450
|
publicOrigin: request.stableWorkersDevOrigin,
|
|
406
451
|
deploymentId: request.deploymentId,
|
|
452
|
+
releaseId: request.releaseId ?? request.deploymentId,
|
|
407
453
|
generationId: request.generationId,
|
|
408
454
|
...(request.runtimeRevisionHandle === undefined
|
|
409
455
|
? {}
|
|
@@ -418,6 +464,7 @@ export function generateEveHostWorkerSource(request) {
|
|
|
418
464
|
publicOrigin: request.config.container.publicOrigin,
|
|
419
465
|
workerName: request.config.worker.name,
|
|
420
466
|
deploymentId: request.config.container.deploymentId,
|
|
467
|
+
releaseId: request.config.container.releaseId ?? request.config.container.deploymentId,
|
|
421
468
|
generationId: request.config.container.generationId,
|
|
422
469
|
stableContainerInstanceName: request.config.container.instanceName,
|
|
423
470
|
...(request.config.container.runtimeRevisionHandle === undefined
|
|
@@ -465,7 +512,7 @@ export function createTrustedEveRequest(request, metadata) {
|
|
|
465
512
|
const headers = new Headers(request.headers);
|
|
466
513
|
const headersToStrip = [];
|
|
467
514
|
headers.forEach((_value, header) => {
|
|
468
|
-
if (isHostOwnedHeader(header)) {
|
|
515
|
+
if (isHostOwnedHeader(header) || header.startsWith("x-vqs-")) {
|
|
469
516
|
headersToStrip.push(header);
|
|
470
517
|
}
|
|
471
518
|
});
|
|
@@ -491,6 +538,7 @@ export function createTrustedEveRequest(request, metadata) {
|
|
|
491
538
|
headers.set("x-forwarded-proto", edgeProtocol);
|
|
492
539
|
headers.set("x-eden-eve-public-origin", metadata.publicOrigin);
|
|
493
540
|
headers.set("x-eden-eve-deployment-id", metadata.deploymentId);
|
|
541
|
+
headers.set("x-eden-eve-release-id", metadata.releaseId ?? metadata.deploymentId);
|
|
494
542
|
headers.set("x-eden-eve-generation-id", metadata.generationId);
|
|
495
543
|
headers.set("x-eden-eve-correlation-id", metadata.correlationId);
|
|
496
544
|
if (metadata.runtimeRevisionHandle !== undefined) {
|
|
@@ -531,8 +579,14 @@ const RESERVED_EVE_HOST_VARIABLES = new Set([
|
|
|
531
579
|
"NODE_EXTRA_CA_CERTS",
|
|
532
580
|
"WORKFLOW_LOCAL_BASE_URL",
|
|
533
581
|
"EDEN_WORLD_URL",
|
|
582
|
+
"EDEN_WORLD_TOKEN",
|
|
534
583
|
"EDEN_EVE_DEPLOYMENT_ID",
|
|
535
584
|
"EDEN_EVE_GENERATION_ID",
|
|
585
|
+
"EDEN_EVE_DEPLOYMENTS",
|
|
586
|
+
"EDEN_EVE_RELEASE_ID",
|
|
587
|
+
"EDEN_AFFINITY_CONTRACT",
|
|
588
|
+
"EDEN_EVE_CONTROL_TOKEN",
|
|
589
|
+
"EVE_SCHEDULES_DISABLED",
|
|
536
590
|
"EDEN_EVE_RUNTIME_REVISION",
|
|
537
591
|
]);
|
|
538
592
|
export function readProtectedRuntimeVariables(env) {
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { createEveHostConfig, generateEveHostWorkerSource, parseEveScheduleCron, resolveStableWorkersDevOrigin, } from "./eve-host.js";
|
|
2
|
-
export type { EveDurableBinding, EveDurableMigration, EveHostConfig, EveScheduleCronEntry, } from "./eve-host.js";
|
|
1
|
+
export { EDEN_AFFINITY_CONTRACT, callDeploymentControlRpc, createEveHostConfig, generateEveHostWorkerSource, parseEveScheduleCron, resolveStableWorkersDevOrigin, } from "./eve-host.js";
|
|
2
|
+
export type { EveDurableBinding, EveDurableMigration, EveHostConfig, EveRetainedDeployment, EveDeploymentRoute, EveScheduleCronEntry, } from "./eve-host.js";
|
|
3
3
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export { createEveHostConfig, generateEveHostWorkerSource, parseEveScheduleCron, resolveStableWorkersDevOrigin, } from "./eve-host.js";
|
|
1
|
+
export { EDEN_AFFINITY_CONTRACT, callDeploymentControlRpc, createEveHostConfig, generateEveHostWorkerSource, parseEveScheduleCron, resolveStableWorkersDevOrigin, } from "./eve-host.js";
|
|
2
2
|
//# sourceMappingURL=index.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@moinulmoin/eden-runtime-cloudflare",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.11.0",
|
|
4
4
|
"description": "Cloudflare Worker/Container host runtime for Eden's Eve deployments.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "Apache-2.0",
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
"NOTICE"
|
|
21
21
|
],
|
|
22
22
|
"devDependencies": {
|
|
23
|
-
"@moinulmoin/eden-world-cloudflare": "0.
|
|
23
|
+
"@moinulmoin/eden-world-cloudflare": "0.11.0",
|
|
24
24
|
"@cloudflare/workers-types": "5.20261006.1"
|
|
25
25
|
},
|
|
26
26
|
"repository": {
|