deepline 0.1.243 → 0.1.244

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 (71) hide show
  1. package/README.md +1 -1
  2. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +5 -25
  3. package/dist/bundling-sources/sdk/src/release.ts +23 -21
  4. package/dist/bundling-sources/sdk/src/types.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/play-runtime/backend.ts +2 -21
  6. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +5 -6
  7. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +6 -13
  8. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +9 -26
  9. package/dist/bundling-sources/shared_libs/play-runtime/internal-step-ids.ts +1 -2
  10. package/dist/bundling-sources/shared_libs/play-runtime/map-row-identity.ts +1 -1
  11. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +191 -29
  12. package/dist/bundling-sources/shared_libs/play-runtime/play-latency-trace.ts +1 -1
  13. package/dist/bundling-sources/shared_libs/play-runtime/providers.ts +1 -36
  14. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +2 -3
  15. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/index.ts +0 -7
  16. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1 -12
  17. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-pg.ts +2 -3
  18. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver.ts +5 -15
  19. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -21
  20. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +3 -4
  21. package/dist/bundling-sources/shared_libs/plays/artifact-kind-guard.ts +16 -29
  22. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -8
  23. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +21 -712
  24. package/dist/bundling-sources/shared_libs/plays/bundling/limits.ts +1 -18
  25. package/dist/cli/index.js +29 -71
  26. package/dist/cli/index.mjs +29 -71
  27. package/dist/{compiler-manifest-CYcwzSOJ.d.ts → compiler-manifest-DlE7dnRm.d.mts} +2 -8
  28. package/dist/{compiler-manifest-CYcwzSOJ.d.mts → compiler-manifest-DlE7dnRm.d.ts} +2 -8
  29. package/dist/index.d.mts +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +24 -22
  32. package/dist/index.mjs +24 -22
  33. package/dist/plays/bundle-play-file.d.mts +7 -22
  34. package/dist/plays/bundle-play-file.d.ts +7 -22
  35. package/dist/plays/bundle-play-file.mjs +26 -614
  36. package/package.json +2 -2
  37. package/dist/bundling-sources/apps/play-runner-workers/src/coordinator-entry.ts +0 -4504
  38. package/dist/bundling-sources/apps/play-runner-workers/src/dedup-do.ts +0 -1386
  39. package/dist/bundling-sources/apps/play-runner-workers/src/durable-object-deploy-handoff.ts +0 -30
  40. package/dist/bundling-sources/apps/play-runner-workers/src/entry.ts +0 -8385
  41. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/README.md +0 -21
  42. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/batching.ts +0 -251
  43. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/coordinator-progress.ts +0 -289
  44. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/csv-rows.ts +0 -85
  45. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/customer-console.ts +0 -23
  46. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/dataset-handles.ts +0 -528
  47. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/harness-receipt-store.ts +0 -229
  48. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/ledger-event-batches.ts +0 -81
  49. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/live-progress.ts +0 -22
  50. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-chunk-plan.ts +0 -920
  51. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/map-latency-profile.ts +0 -90
  52. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/output-datasets.ts +0 -475
  53. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/receipts.ts +0 -570
  54. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/result-dataset-persistence.ts +0 -50
  55. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/row-isolation.ts +0 -5
  56. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/run-work-dispatcher.ts +0 -519
  57. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-batch.ts +0 -107
  58. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-dispatch.ts +0 -2541
  59. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-http-errors.ts +0 -7
  60. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/tool-receipts.ts +0 -227
  61. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/work-budget.ts +0 -130
  62. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/worker-platform-budget.ts +0 -39
  63. package/dist/bundling-sources/apps/play-runner-workers/src/runtime/workflow-preview.ts +0 -26
  64. package/dist/bundling-sources/apps/play-runner-workers/src/runtime-api-retry.ts +0 -23
  65. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-instance-create.ts +0 -47
  66. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry-state.ts +0 -167
  67. package/dist/bundling-sources/apps/play-runner-workers/src/workflow-retry.ts +0 -91
  68. package/dist/bundling-sources/sdk/src/plays/harness-stub.ts +0 -329
  69. package/dist/bundling-sources/sdk/src/worker-play-entry.ts +0 -240
  70. package/dist/bundling-sources/shared_libs/play-runtime/governor/coordinator-rate-state-backend.ts +0 -252
  71. package/dist/bundling-sources/shared_libs/play-runtime/runtime-pg-driver-neon-serverless.ts +0 -217
@@ -11,7 +11,6 @@ import {
11
11
  } from './scheduler-backend';
12
12
 
13
13
  export const PLAY_RUNTIME_PROVIDER_IDS = {
14
- workersEdge: 'workers_edge',
15
14
  absurd: 'absurd',
16
15
  } as const;
17
16
 
@@ -27,34 +26,10 @@ export type PlayRuntimeProviderDescriptor = {
27
26
  label: string;
28
27
  };
29
28
 
30
- export const PLAY_RUNTIME_PROVIDER_DISABLED_CODE =
31
- 'PLAY_RUNTIME_PROVIDER_DISABLED' as const;
32
-
33
- export class PlayRuntimeProviderDisabledError extends Error {
34
- readonly code = PLAY_RUNTIME_PROVIDER_DISABLED_CODE;
35
- readonly profile: PlayRuntimeProviderId;
36
-
37
- constructor(profile: PlayRuntimeProviderId) {
38
- super(
39
- `Play runtime profile "${profile}" is disabled. Deepline runs now execute on the "absurd" profile.`,
40
- );
41
- this.name = 'PlayRuntimeProviderDisabledError';
42
- this.profile = profile;
43
- }
44
- }
45
-
46
29
  export const PLAY_RUNTIME_PROVIDERS: Record<
47
30
  PlayRuntimeProviderId,
48
31
  PlayRuntimeProviderDescriptor
49
32
  > = {
50
- workers_edge: {
51
- id: PLAY_RUNTIME_PROVIDER_IDS.workersEdge,
52
- scheduler: PLAY_SCHEDULER_BACKENDS.cfWorkflows,
53
- runner: PLAY_RUNTIME_BACKENDS.cloudflareWorkers,
54
- dedup: PLAY_DEDUP_BACKENDS.durableObject,
55
- artifactKind: PLAY_ARTIFACT_KINDS.esmWorkers,
56
- label: 'Cloudflare Dynamic Workflows + Dynamic Workers + DO dedup',
57
- },
58
33
  absurd: {
59
34
  id: PLAY_RUNTIME_PROVIDER_IDS.absurd,
60
35
  scheduler: PLAY_SCHEDULER_BACKENDS.absurd,
@@ -73,14 +48,6 @@ export function defaultPlayRuntimeProvider(): PlayRuntimeProviderDescriptor {
73
48
  return PLAY_RUNTIME_PROVIDERS.absurd;
74
49
  }
75
50
 
76
- export function assertPlayRuntimeProviderEnabled(
77
- provider: PlayRuntimeProviderDescriptor,
78
- ): void {
79
- if (provider.id === PLAY_RUNTIME_PROVIDER_IDS.workersEdge) {
80
- throw new PlayRuntimeProviderDisabledError(provider.id);
81
- }
82
- }
83
-
84
51
  export function resolvePlayRuntimeProvider(
85
52
  override?: string | null,
86
53
  ): PlayRuntimeProviderDescriptor {
@@ -101,7 +68,5 @@ export function resolvePlayRuntimeProvider(
101
68
  export function resolveEnabledPlayRuntimeProvider(
102
69
  override?: string | null,
103
70
  ): PlayRuntimeProviderDescriptor {
104
- const provider = resolvePlayRuntimeProvider(override);
105
- assertPlayRuntimeProviderEnabled(provider);
106
- return provider;
71
+ return resolvePlayRuntimeProvider(override);
107
72
  }
@@ -35,8 +35,7 @@ export type PlayRunLedgerEventSource =
35
35
  /**
36
36
  * Live progress for a single step/node.
37
37
  *
38
- * Verified producer semantics (workers_edge map executor —
39
- * `apps/play-runner-workers/src/entry.ts`):
38
+ * Verified map-executor producer semantics:
40
39
  *
41
40
  * - `completed` counts SUCCESSFULLY written rows ONLY, never failures/skips.
42
41
  * In-flight it is `min(total, totalRowsWritten + completedExecutedRows)`
@@ -969,7 +968,7 @@ function retryablePlatformDeployFailureSnapshot(
969
968
  // failure isolation). Forcing `completed = total` here would fabricate
970
969
  // successes that never happened and falsify the persisted counts. The truthful
971
970
  // terminal counts are carried by the producer's final reconciled bump, which
972
- // the workers_edge finalize path now drains BEFORE emitting step.completed
971
+ // the finalize path drains BEFORE emitting step.completed
973
972
  // (entry.ts finalize ordering invariant). This settle path is the last-resort
974
973
  // heal for the missing-final-bump case, where the honest thing is "we know it
975
974
  // stopped, we do not know it fully succeeded" — leave the last observed
@@ -13,13 +13,6 @@ export function resolvePlayRunnerBackend(
13
13
  const backend = normalizePlayRuntimeBackend(
14
14
  backendId ?? process.env.DEEPLINE_PLAY_RUNNER_BACKEND,
15
15
  );
16
- if (backend === PLAY_RUNTIME_BACKENDS.cloudflareWorkers) {
17
- throw new Error(
18
- 'The Cloudflare runner-only backend has been retired. Pass ' +
19
- '`body.profile=workers_edge` on POST /api/v2/plays/run to use the ' +
20
- 'Cloudflare scheduler/runner profile.',
21
- );
22
- }
23
16
  if (backend === PLAY_RUNTIME_BACKENDS.daytona) {
24
17
  return daytonaPlayRunnerBackend;
25
18
  }
@@ -91,7 +91,6 @@ import {
91
91
  resolveMapRowOutcomeKey,
92
92
  } from './map-row-outcome';
93
93
  import { DEEPLINE_CELL_META_FIELD } from './cell-staleness';
94
- import type { PlayArtifactKind } from './backend';
95
94
  import {
96
95
  PLAY_RUNTIME_CONTRACT,
97
96
  PLAY_RUNTIME_CONTRACT_HEADER,
@@ -439,14 +438,6 @@ type RuntimeApiActionRequest =
439
438
  | {
440
439
  action: 'resolve_play';
441
440
  playRef: string;
442
- /**
443
- * Artifact kind the caller can execute. Node runners (postgres
444
- * scheduler inline executor, Daytona/local-process) request
445
- * `cjs_node20` so a child published with an esm_workers artifact is
446
- * re-bundled server-side into a `Module._compile`-loadable module.
447
- * Omitted = the stored artifact is returned verbatim.
448
- */
449
- artifactKind?: PlayArtifactKind;
450
441
  }
451
442
  | {
452
443
  action: 'ensure_sheet';
@@ -2964,7 +2955,6 @@ async function writeRuntimeRows(
2964
2955
  export async function resolveRuntimeReferencedPlay(
2965
2956
  context: RuntimeApiContext,
2966
2957
  playRef: string,
2967
- options?: { artifactKind?: PlayArtifactKind },
2968
2958
  ): Promise<ResolvedRuntimePlay | null> {
2969
2959
  const response = await postRuntimeApi<{
2970
2960
  play: ResolvedRuntimePlay | null;
@@ -2972,7 +2962,6 @@ export async function resolveRuntimeReferencedPlay(
2972
2962
  }>(context, {
2973
2963
  action: 'resolve_play',
2974
2964
  playRef,
2975
- ...(options?.artifactKind ? { artifactKind: options.artifactKind } : {}),
2976
2965
  });
2977
2966
  if (!response.play) {
2978
2967
  return null;
@@ -7235,7 +7224,7 @@ async function failRuntimeMapRowChunks(
7235
7224
  * field values that completed before the error — see
7236
7225
  * `failRuntimeMapRowChunks` for the recovery contract.
7237
7226
  *
7238
- * Used by the workers_edge harness's `persistCompletedMapRows` so map
7227
+ * Used by `persistCompletedMapRows` so map
7239
7228
  * completion writes go through the shared runtime storage plane and skip the
7240
7229
  * per-chunk Vercel hop.
7241
7230
  */
@@ -1,7 +1,6 @@
1
1
  /**
2
- * pg-backed Pool factory. Installed at boot by the Node-runtime
3
- * play-runner (Daytona/local). NOT used by the workers_edge harness — pg's
4
- * raw TCP socket usage is banned in workerd.
2
+ * pg-backed Pool factory. Installed at boot by the Node play runner
3
+ * (Daytona/local).
5
4
  */
6
5
  import { Pool, type PoolClient } from 'pg';
7
6
  import {
@@ -1,19 +1,10 @@
1
1
  /**
2
2
  * Driver-agnostic Postgres pool/client surface used by the runtime data plane.
3
3
  *
4
- * The runtime data plane (`runtime-api.ts` direct-Neon writes) needs to run in
5
- * two very different environments:
6
- *
7
- * - Node (Daytona/local play-runner) — uses the `pg` library, raw TCP to Neon.
8
- * - Cloudflare Workers (workers_edge harness) — `pg` cannot bundle (raw TCP
9
- * is banned at workerd boundary), so we use `@neondatabase/serverless`
10
- * which speaks the same Postgres wire protocol over a WebSocket proxy.
11
- *
12
- * Rather than `if-platform` branches inside runtime-api.ts, each runtime
13
- * registers its driver once at boot and the rest of the code uses the
14
- * abstract `RuntimePool` / `RuntimePoolClient` types. Both `pg` and
15
- * `@neondatabase/serverless` already expose the relevant subset of the
16
- * `pg` API surface (`pool.connect()` → `client.query() / .release()`), so
4
+ * The Node runtime registers its `pg` driver once at boot and the rest of the
5
+ * data plane uses the abstract `RuntimePool` / `RuntimePoolClient` types. `pg`
6
+ * exposes the relevant API surface (`pool.connect()` → `client.query() /
7
+ * .release()`), so
17
8
  * the wrappers are thin.
18
9
  */
19
10
 
@@ -143,8 +134,7 @@ export function createRuntimePool(input: {
143
134
  if (!poolFactory) {
144
135
  throw new Error(
145
136
  'No runtime Postgres pool factory registered. Call ' +
146
- 'installPgRuntimePoolDriver() (Node) or ' +
147
- 'installNeonServerlessRuntimePoolDriver() (Workers) at boot before ' +
137
+ 'installPgRuntimePoolDriver() at boot before ' +
148
138
  'using runtime-api Postgres helpers.',
149
139
  );
150
140
  }
@@ -1,12 +1,11 @@
1
1
  /**
2
2
  * Scheduler-backend interface — owns play workflow lifecycle.
3
3
  *
4
- * One of three pluggable axes (alongside runner-backends and dedup-backends).
4
+ * One of two pluggable axes (alongside runner-backends and dedup-backends).
5
5
  * Selected per-run via PlayExecutionProfile.
6
6
  *
7
- * Absurd is the enabled production scheduler. The Cloudflare Workflows
8
- * adapter is retained for historical run interpretation while workers_edge
9
- * launch admission is disabled.
7
+ * Absurd is the only durable production scheduler. In-process exists only for
8
+ * focused local execution.
10
9
  *
11
10
  * Customer plays are unaffected — this is purely the orchestration layer.
12
11
  */
@@ -24,9 +23,6 @@ import type { RuntimeTestPolicyOverrides } from './test-runtime-seams';
24
23
  import type { PlayRunInputPayload } from './play-input';
25
24
 
26
25
  export const PLAY_SCHEDULER_BACKENDS = {
27
- cfWorkflows: 'cf-workflows',
28
- /** Private legacy id retained only so old persisted rows can be interpreted. */
29
- postgres: 'postgres',
30
26
  /**
31
27
  * Postgres-native durable-execution scheduler (vendored Absurd engine). Runs
32
28
  * on the battle-tested run-state store without an external workflow engine.
@@ -47,10 +43,7 @@ export type PlaySchedulerSubmitInput = {
47
43
  playName: string;
48
44
  workflowFamilyKey?: string | null;
49
45
  artifactStorageKey: string;
50
- /**
51
- * Optional inline artifact for node-compatible schedulers. Workers-edge
52
- * schedulers use artifactStorageKey plus dynamicWorkerCode instead.
53
- */
46
+ /** Optional inline artifact for the Node scheduler. */
54
47
  runtimeArtifact?: unknown;
55
48
  artifactHash: string;
56
49
  graphHash: string;
@@ -99,8 +92,6 @@ export type PlaySchedulerSubmitInput = {
99
92
  * this field for DB-session unwrap and the re-minted `executorToken` for auth.
100
93
  */
101
94
  preloadedDbSessionUnwrapKey?: string | null;
102
- /** Optional immutable Worker module source for local Dynamic Worker loading. */
103
- dynamicWorkerCode?: string | null;
104
95
  executorToken: string;
105
96
  /** Immutable facts used by durable schedulers to mint a fresh leg token. */
106
97
  runtimeAuthority: RuntimeAuthorityDescriptor;
@@ -226,10 +217,7 @@ export function normalizePlaySchedulerBackend(
226
217
  ): PlaySchedulerBackendId {
227
218
  const normalized = value?.trim().toLowerCase();
228
219
  if (!normalized) {
229
- return PLAY_SCHEDULER_BACKENDS.cfWorkflows;
230
- }
231
- if (normalized === 'cf-workflows' || normalized === 'cf_workflows') {
232
- return PLAY_SCHEDULER_BACKENDS.cfWorkflows;
220
+ return PLAY_SCHEDULER_BACKENDS.absurd;
233
221
  }
234
222
  if (normalized === 'absurd' || normalized === 'absurd-scheduler') {
235
223
  return PLAY_SCHEDULER_BACKENDS.absurd;
@@ -238,9 +226,6 @@ export function normalizePlaySchedulerBackend(
238
226
  return PLAY_SCHEDULER_BACKENDS.inProcess;
239
227
  }
240
228
  throw new Error(
241
- `Unsupported scheduler backend "${normalized}". Expected one of: ${[
242
- PLAY_SCHEDULER_BACKENDS.cfWorkflows,
243
- PLAY_SCHEDULER_BACKENDS.absurd,
244
- ].join(', ')}.`,
229
+ `Unsupported scheduler backend "${normalized}". Expected one of: ${PLAY_SCHEDULER_BACKENDS.absurd}, ${PLAY_SCHEDULER_BACKENDS.inProcess}.`,
245
230
  );
246
231
  }
@@ -117,9 +117,7 @@ function adaptV2ExecuteResponseToToolResult(data: Record<string, unknown>): {
117
117
  * Parsed view of a raw `/api/v2/integrations/:toolId/execute` JSON body.
118
118
  *
119
119
  * This is the single runtime-side seam from a V2 execute response to the
120
- * inputs of {@link createToolExecuteResult}. Both runner substrates (the
121
- * in-process cjs runtime in `shared_libs/play-runtime/context.ts` and the
122
- * Workers runtime in `apps/play-runner-workers`) must go through
120
+ * inputs of {@link createToolExecuteResult}. The CJS runtime must go through
123
121
  * {@link parseToolExecuteResponse}; the intermediate envelope shapes
124
122
  * (`toolResponse` adaptation, `_metadata.tool` parsing, status derivation)
125
123
  * are private to this module.
@@ -1322,7 +1320,8 @@ function rememberLiveToolResultListDataset(
1322
1320
  liveToolResultListDatasets.delete(datasetId);
1323
1321
  liveToolResultListDatasets.set(datasetId, dataset);
1324
1322
  while (
1325
- liveToolResultListDatasets.size > LIVE_TOOL_RESULT_LIST_DATASET_REGISTRY_LIMIT
1323
+ liveToolResultListDatasets.size >
1324
+ LIVE_TOOL_RESULT_LIST_DATASET_REGISTRY_LIMIT
1326
1325
  ) {
1327
1326
  const oldest = liveToolResultListDatasets.keys().next().value;
1328
1327
  if (typeof oldest !== 'string') break;
@@ -1,18 +1,15 @@
1
1
  import type { PlayArtifactKind, PlayBundleArtifact } from './artifact-types';
2
2
 
3
3
  /**
4
- * Loud, directional guard that stops a Cloudflare-Workers (`esm_workers`)
5
- * bundle from reaching a Node/Daytona (`cjs_node20`) runner.
4
+ * Loud guard that stops a historical or malformed non-CJS bundle from
5
+ * reaching a Node/Daytona (`cjs_node20`) runner.
6
6
  *
7
7
  * The Node runner loads play code with `Module._compile`, which cannot resolve
8
8
  * `cloudflare:workers` scheme imports and dies with the opaque
9
9
  * `ERR_UNSUPPORTED_ESM_URL_SCHEME: Received protocol 'cloudflare:'`. Those
10
- * imports only exist in the Cloudflare Workers harness apps
11
- * (`apps/play-runner-workers/`, `apps/play-harness-worker/`) baked into
12
- * `esm_workers` artifacts. When the wrong artifact kind is targeted for a node
13
- * profile (e.g. the absurd/Daytona scheduler falling back to a verbatim stored
14
- * `esm_workers` bundle), this guard fires at the targeting/load seam with a
15
- * message that names the mismatch instead of surfacing the ESM scheme error.
10
+ * imports can remain in historical `esm_workers` artifacts. If one reaches an
11
+ * active launch seam, this guard names the mismatch instead of surfacing the
12
+ * opaque ESM scheme error.
16
13
  */
17
14
 
18
15
  /**
@@ -20,18 +17,17 @@ import type { PlayArtifactKind, PlayBundleArtifact } from './artifact-types';
20
17
  * `cjs_node20` (the only kind that existed before the workers split). Mirror the
21
18
  * default documented on `PlayBundleArtifact.artifactKind`.
22
19
  */
23
- export function artifactKindOf(artifact: PlayBundleArtifact): PlayArtifactKind {
24
- return artifact.artifactKind ?? 'cjs_node20';
20
+ export function artifactKindOf(artifact: PlayBundleArtifact): string {
21
+ const rawKind = (artifact as { artifactKind?: unknown }).artifactKind;
22
+ return typeof rawKind === 'string' && rawKind.trim() ? rawKind : 'cjs_node20';
25
23
  }
26
24
 
27
25
  /**
28
- * Detect `cloudflare:` scheme imports in bundled code. Matches both static
29
- * `import ... from 'cloudflare:workers'` and `require('cloudflare:...')` forms,
30
- * with single or double quotes. This is the exact shape the Node runner cannot
31
- * load.
26
+ * Detect `cloudflare:` scheme imports in bundled code. Matches static imports,
27
+ * dynamic imports, and require calls with single or double quotes.
32
28
  */
33
29
  const CLOUDFLARE_SCHEME_IMPORT =
34
- /(?:\bfrom\s*|\bimport\s*|\brequire\s*\(\s*)['"]cloudflare:[^'"]*['"]/;
30
+ /(?:\bfrom\s*|\bimport\s*(?:\(\s*)?|\brequire\s*\(\s*)['"]cloudflare:[^'"]*['"]/;
35
31
 
36
32
  export function bundledCodeHasCloudflareSchemeImport(
37
33
  bundledCode: string,
@@ -41,7 +37,7 @@ export function bundledCodeHasCloudflareSchemeImport(
41
37
 
42
38
  export class PlayArtifactKindMismatchError extends Error {
43
39
  readonly expectedKind: PlayArtifactKind;
44
- readonly actualKind: PlayArtifactKind;
40
+ readonly actualKind: string;
45
41
  readonly reason:
46
42
  | 'kind_mismatch'
47
43
  | 'code_format_mismatch'
@@ -49,7 +45,7 @@ export class PlayArtifactKindMismatchError extends Error {
49
45
 
50
46
  constructor(input: {
51
47
  expectedKind: PlayArtifactKind;
52
- actualKind: PlayArtifactKind;
48
+ actualKind: string;
53
49
  reason:
54
50
  | 'kind_mismatch'
55
51
  | 'code_format_mismatch'
@@ -80,12 +76,6 @@ export function assertNodeRunnableArtifact(input: {
80
76
  context: string;
81
77
  }): void {
82
78
  const { artifact, expectedKind, context } = input;
83
- if (expectedKind !== 'cjs_node20') {
84
- // This helper only guards the node runner. A workers-edge target never
85
- // reaches the Node/Daytona load path, so there is nothing to assert.
86
- return;
87
- }
88
-
89
79
  const actualKind = artifactKindOf(artifact);
90
80
  if (actualKind !== 'cjs_node20') {
91
81
  throw new PlayArtifactKindMismatchError({
@@ -93,12 +83,9 @@ export function assertNodeRunnableArtifact(input: {
93
83
  actualKind,
94
84
  reason: 'kind_mismatch',
95
85
  message:
96
- `Node runner (${context}) received a "${actualKind}" play artifact but ` +
97
- `requires "cjs_node20". An "esm_workers" bundle embeds the Cloudflare ` +
98
- `Workers harness (cloudflare:workers imports) and cannot load under ` +
99
- `Module._compile. Rebundle/republish the play for the node runner ` +
100
- `(profile=absurd / backend=daytona|local_process) instead of serving ` +
101
- `the stored workers artifact verbatim.`,
86
+ `Node runner (${context}) received unsupported play artifact kind ` +
87
+ `"${actualKind}"; only "cjs_node20" is executable. Rebuild and ` +
88
+ `republish the play with the current SDK.`,
102
89
  });
103
90
  }
104
91
 
@@ -23,16 +23,12 @@ export type PlayArtifactCompatibility = {
23
23
  runtimeBackend?: string | null;
24
24
  };
25
25
 
26
- /**
27
- * Identifies which runtime can consume this artifact:
28
- * - cjs_node20: Daytona / local-process (Node.js)
29
- * - esm_workers: Cloudflare Workers (V8 isolate)
30
- */
31
- export type PlayArtifactKind = 'cjs_node20' | 'esm_workers';
26
+ /** The only executable Play artifact contract. */
27
+ export type PlayArtifactKind = 'cjs_node20';
32
28
 
33
29
  export type PlayBundleArtifact = {
34
- codeFormat: 'cjs_module' | 'esm_module';
35
- /** Defaults to cjs_node20 when not present (legacy artifacts). */
30
+ codeFormat: 'cjs_module';
31
+ /** Defaults to cjs_node20 when not present on legacy Node artifacts. */
36
32
  artifactKind?: PlayArtifactKind;
37
33
  entryFile: string;
38
34
  virtualFilename: string;