deepline 0.2.0 → 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 (31) hide show
  1. package/dist/bundling-sources/sdk/src/client.ts +13 -2
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/play-runtime/backend.ts +19 -0
  4. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +104 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +4 -1
  6. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +106 -3
  7. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-modal-fallback.ts +218 -0
  8. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +26 -7
  9. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +33 -0
  10. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +380 -0
  11. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/index.ts +28 -3
  12. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +240 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +5 -1
  14. package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +17 -2
  15. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sandbox-placement-policy.ts +188 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +77 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +7 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +10 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/worker-api-types.ts +39 -0
  20. package/dist/cli/index.js +50 -26
  21. package/dist/cli/index.mjs +50 -26
  22. package/dist/index.d.mts +4 -2
  23. package/dist/index.d.ts +4 -2
  24. package/dist/index.js +50 -5
  25. package/dist/index.mjs +50 -5
  26. package/dist/plays/bundle-play-file.d.mts +2 -2
  27. package/dist/plays/bundle-play-file.d.ts +2 -2
  28. package/dist/plays/bundle-play-file.mjs +7 -1
  29. package/dist/{tool-execution-error-YDz7UMl-.d.mts → tool-execution-error-4-rhemLQ.d.mts} +7 -1
  30. package/dist/{tool-execution-error-YDz7UMl-.d.ts → tool-execution-error-4-rhemLQ.d.ts} +7 -1
  31. package/package.json +1 -1
package/dist/cli/index.js CHANGED
@@ -1040,7 +1040,7 @@ var SDK_RELEASE = {
1040
1040
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1041
1041
  // exposed storage-dependent synchronous access. This deliberate minor
1042
1042
  // release keeps lazy paging semantics independent of row residency.
1043
- version: "0.2.0",
1043
+ version: "0.2.1",
1044
1044
  contracts: {
1045
1045
  api: {
1046
1046
  name: "sdk-http-api",
@@ -3247,6 +3247,33 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
3247
3247
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
3248
3248
  }
3249
3249
 
3250
+ // ../shared_libs/play-runtime/backend.ts
3251
+ var PLAY_RUNTIME_BACKENDS = {
3252
+ localProcess: "local_process",
3253
+ daytona: "daytona",
3254
+ modal: "modal"
3255
+ };
3256
+ var PLAY_ARTIFACT_KINDS = {
3257
+ cjsNode20: "cjs_node20"
3258
+ };
3259
+ var PLAY_BACKEND_DESCRIPTORS = {
3260
+ [PLAY_RUNTIME_BACKENDS.localProcess]: {
3261
+ id: PLAY_RUNTIME_BACKENDS.localProcess,
3262
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
3263
+ label: "Local node subprocess"
3264
+ },
3265
+ [PLAY_RUNTIME_BACKENDS.daytona]: {
3266
+ id: PLAY_RUNTIME_BACKENDS.daytona,
3267
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
3268
+ label: "Daytona sandbox"
3269
+ },
3270
+ [PLAY_RUNTIME_BACKENDS.modal]: {
3271
+ id: PLAY_RUNTIME_BACKENDS.modal,
3272
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
3273
+ label: "Modal sandbox"
3274
+ }
3275
+ };
3276
+
3250
3277
  // ../shared_libs/play-runtime/runtime-environment.ts
3251
3278
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
3252
3279
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -3259,12 +3286,19 @@ function normalizePlayRuntimeSelection(value) {
3259
3286
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
3260
3287
  const record = value;
3261
3288
  if (Object.keys(record).some(
3262
- (key) => key !== "environment" && key !== "namespace"
3289
+ (key) => key !== "environment" && key !== "namespace" && key !== "backend"
3263
3290
  ) || record.environment !== "preview") {
3264
3291
  return null;
3265
3292
  }
3266
3293
  const namespace = normalizePlayRuntimeNamespace(record.namespace);
3267
- return namespace ? { environment: "preview", namespace } : null;
3294
+ if (!namespace) return null;
3295
+ if (record.backend === void 0) {
3296
+ return { environment: "preview", namespace };
3297
+ }
3298
+ if (record.backend !== PLAY_RUNTIME_BACKENDS.daytona && record.backend !== PLAY_RUNTIME_BACKENDS.modal) {
3299
+ return null;
3300
+ }
3301
+ return { environment: "preview", namespace, backend: record.backend };
3268
3302
  }
3269
3303
  function normalizePlayRuntimeEnvironment(value) {
3270
3304
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
@@ -3297,7 +3331,7 @@ function resolvePlayRunRuntimeSelection(request) {
3297
3331
  const runtime = normalizePlayRuntimeSelection(request.runtime);
3298
3332
  if (!runtime) {
3299
3333
  throw new DeeplineError(
3300
- 'runtime must be exactly { environment: "preview", namespace } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
3334
+ 'runtime must be { environment: "preview", namespace, backend?: "daytona" | "modal" } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
3301
3335
  void 0,
3302
3336
  "INVALID_RUNTIME_SELECTION"
3303
3337
  );
@@ -3333,7 +3367,18 @@ function resolvePlayRunRuntimeSelection(request) {
3333
3367
  "INVALID_RUNTIME_NAMESPACE"
3334
3368
  );
3335
3369
  }
3336
- return { environment, namespace };
3370
+ const configuredBackend = process.env.DEEPLINE_PLAY_RUNNER_BACKEND?.trim();
3371
+ if (!configuredBackend) {
3372
+ return { environment, namespace };
3373
+ }
3374
+ if (configuredBackend !== "daytona" && configuredBackend !== "modal") {
3375
+ throw new DeeplineError(
3376
+ `DEEPLINE_PLAY_RUNNER_BACKEND must be daytona or modal for preview runtime selection. Received "${configuredBackend}".`,
3377
+ void 0,
3378
+ "INVALID_RUNTIME_BACKEND"
3379
+ );
3380
+ }
3381
+ return { environment, namespace, backend: configuredBackend };
3337
3382
  }
3338
3383
  function runtimeSelectionHeaders(runtime) {
3339
3384
  if (!runtime) return void 0;
@@ -12067,27 +12112,6 @@ ${hint}`;
12067
12112
  });
12068
12113
  }
12069
12114
 
12070
- // ../shared_libs/play-runtime/backend.ts
12071
- var PLAY_RUNTIME_BACKENDS = {
12072
- localProcess: "local_process",
12073
- daytona: "daytona"
12074
- };
12075
- var PLAY_ARTIFACT_KINDS = {
12076
- cjsNode20: "cjs_node20"
12077
- };
12078
- var PLAY_BACKEND_DESCRIPTORS = {
12079
- [PLAY_RUNTIME_BACKENDS.localProcess]: {
12080
- id: PLAY_RUNTIME_BACKENDS.localProcess,
12081
- artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
12082
- label: "Local node subprocess"
12083
- },
12084
- [PLAY_RUNTIME_BACKENDS.daytona]: {
12085
- id: PLAY_RUNTIME_BACKENDS.daytona,
12086
- artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
12087
- label: "Daytona sandbox"
12088
- }
12089
- };
12090
-
12091
12115
  // ../shared_libs/play-runtime/dedup-backend.ts
12092
12116
  var PLAY_DEDUP_BACKENDS = {
12093
12117
  inMemory: "in_memory",
@@ -1025,7 +1025,7 @@ var SDK_RELEASE = {
1025
1025
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
1026
1026
  // exposed storage-dependent synchronous access. This deliberate minor
1027
1027
  // release keeps lazy paging semantics independent of row residency.
1028
- version: "0.2.0",
1028
+ version: "0.2.1",
1029
1029
  contracts: {
1030
1030
  api: {
1031
1031
  name: "sdk-http-api",
@@ -3232,6 +3232,33 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
3232
3232
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
3233
3233
  }
3234
3234
 
3235
+ // ../shared_libs/play-runtime/backend.ts
3236
+ var PLAY_RUNTIME_BACKENDS = {
3237
+ localProcess: "local_process",
3238
+ daytona: "daytona",
3239
+ modal: "modal"
3240
+ };
3241
+ var PLAY_ARTIFACT_KINDS = {
3242
+ cjsNode20: "cjs_node20"
3243
+ };
3244
+ var PLAY_BACKEND_DESCRIPTORS = {
3245
+ [PLAY_RUNTIME_BACKENDS.localProcess]: {
3246
+ id: PLAY_RUNTIME_BACKENDS.localProcess,
3247
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
3248
+ label: "Local node subprocess"
3249
+ },
3250
+ [PLAY_RUNTIME_BACKENDS.daytona]: {
3251
+ id: PLAY_RUNTIME_BACKENDS.daytona,
3252
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
3253
+ label: "Daytona sandbox"
3254
+ },
3255
+ [PLAY_RUNTIME_BACKENDS.modal]: {
3256
+ id: PLAY_RUNTIME_BACKENDS.modal,
3257
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
3258
+ label: "Modal sandbox"
3259
+ }
3260
+ };
3261
+
3235
3262
  // ../shared_libs/play-runtime/runtime-environment.ts
3236
3263
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
3237
3264
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -3244,12 +3271,19 @@ function normalizePlayRuntimeSelection(value) {
3244
3271
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
3245
3272
  const record = value;
3246
3273
  if (Object.keys(record).some(
3247
- (key) => key !== "environment" && key !== "namespace"
3274
+ (key) => key !== "environment" && key !== "namespace" && key !== "backend"
3248
3275
  ) || record.environment !== "preview") {
3249
3276
  return null;
3250
3277
  }
3251
3278
  const namespace = normalizePlayRuntimeNamespace(record.namespace);
3252
- return namespace ? { environment: "preview", namespace } : null;
3279
+ if (!namespace) return null;
3280
+ if (record.backend === void 0) {
3281
+ return { environment: "preview", namespace };
3282
+ }
3283
+ if (record.backend !== PLAY_RUNTIME_BACKENDS.daytona && record.backend !== PLAY_RUNTIME_BACKENDS.modal) {
3284
+ return null;
3285
+ }
3286
+ return { environment: "preview", namespace, backend: record.backend };
3253
3287
  }
3254
3288
  function normalizePlayRuntimeEnvironment(value) {
3255
3289
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
@@ -3282,7 +3316,7 @@ function resolvePlayRunRuntimeSelection(request) {
3282
3316
  const runtime = normalizePlayRuntimeSelection(request.runtime);
3283
3317
  if (!runtime) {
3284
3318
  throw new DeeplineError(
3285
- 'runtime must be exactly { environment: "preview", namespace } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
3319
+ 'runtime must be { environment: "preview", namespace, backend?: "daytona" | "modal" } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
3286
3320
  void 0,
3287
3321
  "INVALID_RUNTIME_SELECTION"
3288
3322
  );
@@ -3318,7 +3352,18 @@ function resolvePlayRunRuntimeSelection(request) {
3318
3352
  "INVALID_RUNTIME_NAMESPACE"
3319
3353
  );
3320
3354
  }
3321
- return { environment, namespace };
3355
+ const configuredBackend = process.env.DEEPLINE_PLAY_RUNNER_BACKEND?.trim();
3356
+ if (!configuredBackend) {
3357
+ return { environment, namespace };
3358
+ }
3359
+ if (configuredBackend !== "daytona" && configuredBackend !== "modal") {
3360
+ throw new DeeplineError(
3361
+ `DEEPLINE_PLAY_RUNNER_BACKEND must be daytona or modal for preview runtime selection. Received "${configuredBackend}".`,
3362
+ void 0,
3363
+ "INVALID_RUNTIME_BACKEND"
3364
+ );
3365
+ }
3366
+ return { environment, namespace, backend: configuredBackend };
3322
3367
  }
3323
3368
  function runtimeSelectionHeaders(runtime) {
3324
3369
  if (!runtime) return void 0;
@@ -12096,27 +12141,6 @@ ${hint}`;
12096
12141
  });
12097
12142
  }
12098
12143
 
12099
- // ../shared_libs/play-runtime/backend.ts
12100
- var PLAY_RUNTIME_BACKENDS = {
12101
- localProcess: "local_process",
12102
- daytona: "daytona"
12103
- };
12104
- var PLAY_ARTIFACT_KINDS = {
12105
- cjsNode20: "cjs_node20"
12106
- };
12107
- var PLAY_BACKEND_DESCRIPTORS = {
12108
- [PLAY_RUNTIME_BACKENDS.localProcess]: {
12109
- id: PLAY_RUNTIME_BACKENDS.localProcess,
12110
- artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
12111
- label: "Local node subprocess"
12112
- },
12113
- [PLAY_RUNTIME_BACKENDS.daytona]: {
12114
- id: PLAY_RUNTIME_BACKENDS.daytona,
12115
- artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
12116
- label: "Daytona sandbox"
12117
- }
12118
- };
12119
-
12120
12144
  // ../shared_libs/play-runtime/dedup-backend.ts
12121
12145
  var PLAY_DEDUP_BACKENDS = {
12122
12146
  inMemory: "in_memory",
package/dist/index.d.mts CHANGED
@@ -1,10 +1,12 @@
1
- import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-YDz7UMl-.mjs';
2
- export { e as ProviderTransientError, f as ProviderTransientErrorCategory, g as ToolExecutionErrorCategory, h as ToolExecutionErrorOrigin, i as ToolExecutionFailureV1, j as ToolExecutionNetworkKind, k as ToolExecutionNetworkScope } from './tool-execution-error-YDz7UMl-.mjs';
1
+ import { c as PlayRuntimeBackendId, a as PlayCompilerManifest, D as DeeplineError, d as ToolExecutionError, e as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-4-rhemLQ.mjs';
2
+ export { f as ProviderTransientError, g as ProviderTransientErrorCategory, h as ToolExecutionErrorCategory, i as ToolExecutionErrorOrigin, j as ToolExecutionFailureV1, k as ToolExecutionNetworkKind, l as ToolExecutionNetworkScope } from './tool-execution-error-4-rhemLQ.mjs';
3
3
 
4
4
  type PlayRuntimeSelection = {
5
5
  environment: 'preview';
6
6
  /** Caller-named isolation scope inside a remote runtime environment. */
7
7
  namespace: string;
8
+ /** Explicit managed-sandbox executor. Omission preserves Daytona compatibility. */
9
+ backend?: Extract<PlayRuntimeBackendId, 'daytona' | 'modal'>;
8
10
  };
9
11
 
10
12
  /**
package/dist/index.d.ts CHANGED
@@ -1,10 +1,12 @@
1
- import { a as PlayCompilerManifest, D as DeeplineError, c as ToolExecutionError, d as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-YDz7UMl-.js';
2
- export { e as ProviderTransientError, f as ProviderTransientErrorCategory, g as ToolExecutionErrorCategory, h as ToolExecutionErrorOrigin, i as ToolExecutionFailureV1, j as ToolExecutionNetworkKind, k as ToolExecutionNetworkScope } from './tool-execution-error-YDz7UMl-.js';
1
+ import { c as PlayRuntimeBackendId, a as PlayCompilerManifest, D as DeeplineError, d as ToolExecutionError, e as ToolExecutionErrorOptions, T as ToolExecutionErrorSchemaVersion } from './tool-execution-error-4-rhemLQ.js';
2
+ export { f as ProviderTransientError, g as ProviderTransientErrorCategory, h as ToolExecutionErrorCategory, i as ToolExecutionErrorOrigin, j as ToolExecutionFailureV1, k as ToolExecutionNetworkKind, l as ToolExecutionNetworkScope } from './tool-execution-error-4-rhemLQ.js';
3
3
 
4
4
  type PlayRuntimeSelection = {
5
5
  environment: 'preview';
6
6
  /** Caller-named isolation scope inside a remote runtime environment. */
7
7
  namespace: string;
8
+ /** Explicit managed-sandbox executor. Omission preserves Daytona compatibility. */
9
+ backend?: Extract<PlayRuntimeBackendId, 'daytona' | 'modal'>;
8
10
  };
9
11
 
10
12
  /**
package/dist/index.js CHANGED
@@ -763,7 +763,7 @@ var SDK_RELEASE = {
763
763
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
764
764
  // exposed storage-dependent synchronous access. This deliberate minor
765
765
  // release keeps lazy paging semantics independent of row residency.
766
- version: "0.2.0",
766
+ version: "0.2.1",
767
767
  contracts: {
768
768
  api: {
769
769
  name: "sdk-http-api",
@@ -2970,6 +2970,33 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2970
2970
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2971
2971
  }
2972
2972
 
2973
+ // ../shared_libs/play-runtime/backend.ts
2974
+ var PLAY_RUNTIME_BACKENDS = {
2975
+ localProcess: "local_process",
2976
+ daytona: "daytona",
2977
+ modal: "modal"
2978
+ };
2979
+ var PLAY_ARTIFACT_KINDS = {
2980
+ cjsNode20: "cjs_node20"
2981
+ };
2982
+ var PLAY_BACKEND_DESCRIPTORS = {
2983
+ [PLAY_RUNTIME_BACKENDS.localProcess]: {
2984
+ id: PLAY_RUNTIME_BACKENDS.localProcess,
2985
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
2986
+ label: "Local node subprocess"
2987
+ },
2988
+ [PLAY_RUNTIME_BACKENDS.daytona]: {
2989
+ id: PLAY_RUNTIME_BACKENDS.daytona,
2990
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
2991
+ label: "Daytona sandbox"
2992
+ },
2993
+ [PLAY_RUNTIME_BACKENDS.modal]: {
2994
+ id: PLAY_RUNTIME_BACKENDS.modal,
2995
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
2996
+ label: "Modal sandbox"
2997
+ }
2998
+ };
2999
+
2973
3000
  // ../shared_libs/play-runtime/runtime-environment.ts
2974
3001
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
2975
3002
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -2982,12 +3009,19 @@ function normalizePlayRuntimeSelection(value) {
2982
3009
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
2983
3010
  const record = value;
2984
3011
  if (Object.keys(record).some(
2985
- (key) => key !== "environment" && key !== "namespace"
3012
+ (key) => key !== "environment" && key !== "namespace" && key !== "backend"
2986
3013
  ) || record.environment !== "preview") {
2987
3014
  return null;
2988
3015
  }
2989
3016
  const namespace = normalizePlayRuntimeNamespace(record.namespace);
2990
- return namespace ? { environment: "preview", namespace } : null;
3017
+ if (!namespace) return null;
3018
+ if (record.backend === void 0) {
3019
+ return { environment: "preview", namespace };
3020
+ }
3021
+ if (record.backend !== PLAY_RUNTIME_BACKENDS.daytona && record.backend !== PLAY_RUNTIME_BACKENDS.modal) {
3022
+ return null;
3023
+ }
3024
+ return { environment: "preview", namespace, backend: record.backend };
2991
3025
  }
2992
3026
  function normalizePlayRuntimeEnvironment(value) {
2993
3027
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
@@ -3020,7 +3054,7 @@ function resolvePlayRunRuntimeSelection(request) {
3020
3054
  const runtime = normalizePlayRuntimeSelection(request.runtime);
3021
3055
  if (!runtime) {
3022
3056
  throw new DeeplineError(
3023
- 'runtime must be exactly { environment: "preview", namespace } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
3057
+ 'runtime must be { environment: "preview", namespace, backend?: "daytona" | "modal" } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
3024
3058
  void 0,
3025
3059
  "INVALID_RUNTIME_SELECTION"
3026
3060
  );
@@ -3056,7 +3090,18 @@ function resolvePlayRunRuntimeSelection(request) {
3056
3090
  "INVALID_RUNTIME_NAMESPACE"
3057
3091
  );
3058
3092
  }
3059
- return { environment, namespace };
3093
+ const configuredBackend = process.env.DEEPLINE_PLAY_RUNNER_BACKEND?.trim();
3094
+ if (!configuredBackend) {
3095
+ return { environment, namespace };
3096
+ }
3097
+ if (configuredBackend !== "daytona" && configuredBackend !== "modal") {
3098
+ throw new DeeplineError(
3099
+ `DEEPLINE_PLAY_RUNNER_BACKEND must be daytona or modal for preview runtime selection. Received "${configuredBackend}".`,
3100
+ void 0,
3101
+ "INVALID_RUNTIME_BACKEND"
3102
+ );
3103
+ }
3104
+ return { environment, namespace, backend: configuredBackend };
3060
3105
  }
3061
3106
  function runtimeSelectionHeaders(runtime) {
3062
3107
  if (!runtime) return void 0;
package/dist/index.mjs CHANGED
@@ -689,7 +689,7 @@ var SDK_RELEASE = {
689
689
  // 0.2.0 makes Dataset Handles uniformly async-only after 0.1.320 briefly
690
690
  // exposed storage-dependent synchronous access. This deliberate minor
691
691
  // release keeps lazy paging semantics independent of row residency.
692
- version: "0.2.0",
692
+ version: "0.2.1",
693
693
  contracts: {
694
694
  api: {
695
695
  name: "sdk-http-api",
@@ -2896,6 +2896,33 @@ function usesExtendedTheirstackJobSearchBudget(endpointId, payload) {
2896
2896
  return maxAgeDays !== null && maxAgeDays >= 365 ? true : usesLongExplicitDateWindow(payload);
2897
2897
  }
2898
2898
 
2899
+ // ../shared_libs/play-runtime/backend.ts
2900
+ var PLAY_RUNTIME_BACKENDS = {
2901
+ localProcess: "local_process",
2902
+ daytona: "daytona",
2903
+ modal: "modal"
2904
+ };
2905
+ var PLAY_ARTIFACT_KINDS = {
2906
+ cjsNode20: "cjs_node20"
2907
+ };
2908
+ var PLAY_BACKEND_DESCRIPTORS = {
2909
+ [PLAY_RUNTIME_BACKENDS.localProcess]: {
2910
+ id: PLAY_RUNTIME_BACKENDS.localProcess,
2911
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
2912
+ label: "Local node subprocess"
2913
+ },
2914
+ [PLAY_RUNTIME_BACKENDS.daytona]: {
2915
+ id: PLAY_RUNTIME_BACKENDS.daytona,
2916
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
2917
+ label: "Daytona sandbox"
2918
+ },
2919
+ [PLAY_RUNTIME_BACKENDS.modal]: {
2920
+ id: PLAY_RUNTIME_BACKENDS.modal,
2921
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
2922
+ label: "Modal sandbox"
2923
+ }
2924
+ };
2925
+
2899
2926
  // ../shared_libs/play-runtime/runtime-environment.ts
2900
2927
  var PLAY_RUNTIME_ENVIRONMENTS = ["preview"];
2901
2928
  var PLAY_RUNTIME_NAMESPACE_PATTERN = /^[a-z][a-z0-9-]{0,30}$/;
@@ -2908,12 +2935,19 @@ function normalizePlayRuntimeSelection(value) {
2908
2935
  if (!value || typeof value !== "object" || Array.isArray(value)) return null;
2909
2936
  const record = value;
2910
2937
  if (Object.keys(record).some(
2911
- (key) => key !== "environment" && key !== "namespace"
2938
+ (key) => key !== "environment" && key !== "namespace" && key !== "backend"
2912
2939
  ) || record.environment !== "preview") {
2913
2940
  return null;
2914
2941
  }
2915
2942
  const namespace = normalizePlayRuntimeNamespace(record.namespace);
2916
- return namespace ? { environment: "preview", namespace } : null;
2943
+ if (!namespace) return null;
2944
+ if (record.backend === void 0) {
2945
+ return { environment: "preview", namespace };
2946
+ }
2947
+ if (record.backend !== PLAY_RUNTIME_BACKENDS.daytona && record.backend !== PLAY_RUNTIME_BACKENDS.modal) {
2948
+ return null;
2949
+ }
2950
+ return { environment: "preview", namespace, backend: record.backend };
2917
2951
  }
2918
2952
  function normalizePlayRuntimeEnvironment(value) {
2919
2953
  return typeof value === "string" && PLAY_RUNTIME_ENVIRONMENTS.includes(value) ? value : null;
@@ -2946,7 +2980,7 @@ function resolvePlayRunRuntimeSelection(request) {
2946
2980
  const runtime = normalizePlayRuntimeSelection(request.runtime);
2947
2981
  if (!runtime) {
2948
2982
  throw new DeeplineError(
2949
- 'runtime must be exactly { environment: "preview", namespace } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
2983
+ 'runtime must be { environment: "preview", namespace, backend?: "daytona" | "modal" } with namespace matching ^[a-z][a-z0-9-]{0,30}$.',
2950
2984
  void 0,
2951
2985
  "INVALID_RUNTIME_SELECTION"
2952
2986
  );
@@ -2982,7 +3016,18 @@ function resolvePlayRunRuntimeSelection(request) {
2982
3016
  "INVALID_RUNTIME_NAMESPACE"
2983
3017
  );
2984
3018
  }
2985
- return { environment, namespace };
3019
+ const configuredBackend = process.env.DEEPLINE_PLAY_RUNNER_BACKEND?.trim();
3020
+ if (!configuredBackend) {
3021
+ return { environment, namespace };
3022
+ }
3023
+ if (configuredBackend !== "daytona" && configuredBackend !== "modal") {
3024
+ throw new DeeplineError(
3025
+ `DEEPLINE_PLAY_RUNNER_BACKEND must be daytona or modal for preview runtime selection. Received "${configuredBackend}".`,
3026
+ void 0,
3027
+ "INVALID_RUNTIME_BACKEND"
3028
+ );
3029
+ }
3030
+ return { environment, namespace, backend: configuredBackend };
2986
3031
  }
2987
3032
  function runtimeSelectionHeaders(runtime) {
2988
3033
  if (!runtime) return void 0;
@@ -1,5 +1,5 @@
1
- import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-YDz7UMl-.mjs';
2
- export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-YDz7UMl-.mjs';
1
+ import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-4-rhemLQ.mjs';
2
+ export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-4-rhemLQ.mjs';
3
3
 
4
4
  type PlayPackageImport = {
5
5
  name: string;
@@ -1,5 +1,5 @@
1
- import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-YDz7UMl-.js';
2
- export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-YDz7UMl-.js';
1
+ import { T as ToolExecutionErrorSchemaVersion, P as PlayArtifactKind$1, a as PlayCompilerManifest } from '../tool-execution-error-4-rhemLQ.js';
2
+ export { b as PLAY_ARTIFACT_KINDS } from '../tool-execution-error-4-rhemLQ.js';
3
3
 
4
4
  type PlayPackageImport = {
5
5
  name: string;
@@ -25,7 +25,8 @@ import { build, transformSync } from "esbuild";
25
25
  // ../shared_libs/play-runtime/backend.ts
26
26
  var PLAY_RUNTIME_BACKENDS = {
27
27
  localProcess: "local_process",
28
- daytona: "daytona"
28
+ daytona: "daytona",
29
+ modal: "modal"
29
30
  };
30
31
  var PLAY_ARTIFACT_KINDS = {
31
32
  cjsNode20: "cjs_node20"
@@ -40,6 +41,11 @@ var PLAY_BACKEND_DESCRIPTORS = {
40
41
  id: PLAY_RUNTIME_BACKENDS.daytona,
41
42
  artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
42
43
  label: "Daytona sandbox"
44
+ },
45
+ [PLAY_RUNTIME_BACKENDS.modal]: {
46
+ id: PLAY_RUNTIME_BACKENDS.modal,
47
+ artifactKind: PLAY_ARTIFACT_KINDS.cjsNode20,
48
+ label: "Modal sandbox"
43
49
  }
44
50
  };
45
51
 
@@ -1,3 +1,9 @@
1
+ declare const PLAY_RUNTIME_BACKENDS: {
2
+ readonly localProcess: "local_process";
3
+ readonly daytona: "daytona";
4
+ readonly modal: "modal";
5
+ };
6
+ type PlayRuntimeBackendId = (typeof PLAY_RUNTIME_BACKENDS)[keyof typeof PLAY_RUNTIME_BACKENDS];
1
7
  /**
2
8
  * The one executable Play artifact contract. Daytona and local-process both
3
9
  * load CommonJS under Node 20.
@@ -437,4 +443,4 @@ declare class ProviderTransientError extends ToolExecutionError {
437
443
  static [Symbol.hasInstance](value: unknown): boolean;
438
444
  }
439
445
 
440
- export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, ToolExecutionError as c, type ToolExecutionErrorOptions as d, ProviderTransientError as e, type ProviderTransientErrorCategory as f, type ToolExecutionErrorCategory as g, type ToolExecutionErrorOrigin as h, type ToolExecutionFailureV1 as i, type ToolExecutionNetworkKind as j, type ToolExecutionNetworkScope as k };
446
+ export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, type PlayRuntimeBackendId as c, ToolExecutionError as d, type ToolExecutionErrorOptions as e, ProviderTransientError as f, type ProviderTransientErrorCategory as g, type ToolExecutionErrorCategory as h, type ToolExecutionErrorOrigin as i, type ToolExecutionFailureV1 as j, type ToolExecutionNetworkKind as k, type ToolExecutionNetworkScope as l };
@@ -1,3 +1,9 @@
1
+ declare const PLAY_RUNTIME_BACKENDS: {
2
+ readonly localProcess: "local_process";
3
+ readonly daytona: "daytona";
4
+ readonly modal: "modal";
5
+ };
6
+ type PlayRuntimeBackendId = (typeof PLAY_RUNTIME_BACKENDS)[keyof typeof PLAY_RUNTIME_BACKENDS];
1
7
  /**
2
8
  * The one executable Play artifact contract. Daytona and local-process both
3
9
  * load CommonJS under Node 20.
@@ -437,4 +443,4 @@ declare class ProviderTransientError extends ToolExecutionError {
437
443
  static [Symbol.hasInstance](value: unknown): boolean;
438
444
  }
439
445
 
440
- export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, ToolExecutionError as c, type ToolExecutionErrorOptions as d, ProviderTransientError as e, type ProviderTransientErrorCategory as f, type ToolExecutionErrorCategory as g, type ToolExecutionErrorOrigin as h, type ToolExecutionFailureV1 as i, type ToolExecutionNetworkKind as j, type ToolExecutionNetworkScope as k };
446
+ export { DeeplineError as D, type PlayArtifactKind as P, type ToolExecutionErrorSchemaVersion as T, type PlayCompilerManifest as a, PLAY_ARTIFACT_KINDS as b, type PlayRuntimeBackendId as c, ToolExecutionError as d, type ToolExecutionErrorOptions as e, ProviderTransientError as f, type ProviderTransientErrorCategory as g, type ToolExecutionErrorCategory as h, type ToolExecutionErrorOrigin as i, type ToolExecutionFailureV1 as j, type ToolExecutionNetworkKind as k, type ToolExecutionNetworkScope as l };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.2.0",
3
+ "version": "0.2.1",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {