deepline 0.1.307 → 0.1.308

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 (24) hide show
  1. package/dist/bundling-sources/sdk/src/play.ts +26 -0
  2. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  3. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  4. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +66 -11
  5. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +13 -5
  6. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +12 -3
  7. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/local-process.ts +21 -9
  8. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +2 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +5 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +17 -2
  11. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runtime-limits.ts +102 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/tool-http-errors.ts +56 -9
  13. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +56 -0
  14. package/dist/bundling-sources/shared_libs/plays/contracts.ts +6 -0
  15. package/dist/cli/index.js +174 -11
  16. package/dist/cli/index.mjs +174 -11
  17. package/dist/index.d.mts +16 -0
  18. package/dist/index.d.ts +16 -0
  19. package/dist/index.js +11 -1
  20. package/dist/index.mjs +11 -1
  21. package/dist/plays/bundle-play-file.d.mts +8 -0
  22. package/dist/plays/bundle-play-file.d.ts +8 -0
  23. package/dist/plays/bundle-play-file.mjs +42 -0
  24. package/package.json +1 -1
@@ -1022,7 +1022,7 @@ var SDK_RELEASE = {
1022
1022
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
1023
1023
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
1024
1024
  // Operators use the checkout-local deepline-admin binary instead.
1025
- version: "0.1.307",
1025
+ version: "0.1.308",
1026
1026
  contracts: {
1027
1027
  api: {
1028
1028
  name: "sdk-http-api",
@@ -12171,6 +12171,134 @@ function resolveEnabledExecutionProfile(override) {
12171
12171
  }
12172
12172
  }
12173
12173
 
12174
+ // ../shared_libs/play-runtime/sandbox-runtime-limits.ts
12175
+ var STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS = {
12176
+ timeoutSeconds: 30 * 60,
12177
+ memoryGiB: 1,
12178
+ cpu: 1,
12179
+ diskGiB: 3
12180
+ };
12181
+ var MAX_PLAY_SANDBOX_RUNTIME_LIMITS = {
12182
+ timeoutSeconds: 4 * 60 * 60,
12183
+ memoryGiB: 16,
12184
+ cpu: 4,
12185
+ diskGiB: 50
12186
+ };
12187
+ function parsePositiveInteger3(value, unit) {
12188
+ const match = new RegExp(`^(\\d+)\\s*${unit}$`, "i").exec(value.trim());
12189
+ if (!match) return null;
12190
+ const parsed = Number(match[1]);
12191
+ return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
12192
+ }
12193
+ function parseTimeout(value) {
12194
+ const match = /^(\d+)\s*([mh])$/i.exec(value.trim());
12195
+ if (!match) return null;
12196
+ const amount = Number(match[1]);
12197
+ if (!Number.isSafeInteger(amount) || amount <= 0) return null;
12198
+ return amount * (match[2].toLowerCase() === "h" ? 3600 : 60);
12199
+ }
12200
+ function resolvePlaySandboxRuntimeLimits(declaration) {
12201
+ const base = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS;
12202
+ if (!declaration) return { ...base };
12203
+ const timeoutSeconds = declaration.timeout ? parseTimeout(declaration.timeout) : base.timeoutSeconds;
12204
+ const memoryGiB = declaration.memory ? parsePositiveInteger3(declaration.memory, "GiB") : base.memoryGiB;
12205
+ const diskGiB = declaration.disk ? parsePositiveInteger3(declaration.disk, "GiB") : base.diskGiB;
12206
+ const cpu = declaration.cpu ?? base.cpu;
12207
+ if (timeoutSeconds === null || memoryGiB === null || diskGiB === null || !Number.isSafeInteger(cpu) || cpu <= 0) {
12208
+ throw new Error(
12209
+ 'Invalid runtime sandbox declaration. Use timeout like "90m" or "2h", memory/disk like "4GiB", and a positive integer cpu.'
12210
+ );
12211
+ }
12212
+ const resolved = { timeoutSeconds, memoryGiB, cpu, diskGiB };
12213
+ for (const key of ["memoryGiB", "cpu", "diskGiB"]) {
12214
+ if (resolved[key] < base[key]) {
12215
+ throw new Error(
12216
+ `Requested runtime ${key}=${resolved[key]} is below the supported minimum ${base[key]}.`
12217
+ );
12218
+ }
12219
+ }
12220
+ for (const key of Object.keys(
12221
+ resolved
12222
+ )) {
12223
+ if (resolved[key] > MAX_PLAY_SANDBOX_RUNTIME_LIMITS[key]) {
12224
+ throw new Error(
12225
+ `Requested runtime ${key}=${resolved[key]} exceeds this organisation's maximum ${MAX_PLAY_SANDBOX_RUNTIME_LIMITS[key]}.`
12226
+ );
12227
+ }
12228
+ }
12229
+ return resolved;
12230
+ }
12231
+ function hasNonStandardPlaySandboxRuntimeLimits(value) {
12232
+ return Object.keys(value).some(
12233
+ (key) => value[key] !== STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS[key]
12234
+ );
12235
+ }
12236
+
12237
+ // ../shared_libs/play-runtime/worker-api-types.ts
12238
+ var DAYTONA_COMPUTE_PRICING_USD = {
12239
+ vcpuSecond: 14e-6,
12240
+ memoryGiBSecond: 45e-7,
12241
+ storageGiBSecond: 3e-8,
12242
+ includedStorageGiB: 5
12243
+ };
12244
+ function roundUsd(amount) {
12245
+ return Number(Math.max(0, amount).toFixed(12));
12246
+ }
12247
+ function resolveDaytonaSandboxComputeItem(input2) {
12248
+ const billableSeconds = Math.max(1, Math.ceil(input2.wallTimeSeconds));
12249
+ const cpu = Math.max(0, input2.cpu);
12250
+ const memoryGiB = Math.max(0, input2.memoryGiB);
12251
+ const billableDiskGiB = Math.max(
12252
+ 0,
12253
+ input2.diskGiB - DAYTONA_COMPUTE_PRICING_USD.includedStorageGiB
12254
+ );
12255
+ const providerCostUsd = roundUsd(
12256
+ billableSeconds * (cpu * DAYTONA_COMPUTE_PRICING_USD.vcpuSecond + memoryGiB * DAYTONA_COMPUTE_PRICING_USD.memoryGiBSecond + billableDiskGiB * DAYTONA_COMPUTE_PRICING_USD.storageGiBSecond)
12257
+ );
12258
+ return {
12259
+ itemId: input2.itemId,
12260
+ source: input2.source ?? "daytona",
12261
+ unit: "sandbox_second",
12262
+ units: billableSeconds,
12263
+ providerCostUsd,
12264
+ metadata: {
12265
+ sandboxId: input2.sandboxId ?? null,
12266
+ cpu,
12267
+ memoryGiB,
12268
+ diskGiB: Math.max(0, input2.diskGiB),
12269
+ billableDiskGiB,
12270
+ startedAt: input2.startedAt,
12271
+ endedAt: input2.endedAt
12272
+ }
12273
+ };
12274
+ }
12275
+
12276
+ // ../shared_libs/billing/compute-pricing.ts
12277
+ var COMPUTE_BILLING_MARKUP_MULTIPLIER = 5;
12278
+ var DEFAULT_USD_PER_CUSTOMER_CREDIT = 0.1;
12279
+ var DEFAULT_PROVIDER_MARKUP_MULTIPLIER = 1.4;
12280
+ function roundUpCredits(value) {
12281
+ if (!Number.isFinite(value) || value <= 0) return 0;
12282
+ return Math.ceil(value * 100) / 100;
12283
+ }
12284
+ function estimateDaytonaMaximumComputeCredits(limits) {
12285
+ const item = resolveDaytonaSandboxComputeItem({
12286
+ itemId: "estimate",
12287
+ wallTimeSeconds: limits.timeoutSeconds,
12288
+ cpu: limits.cpu,
12289
+ memoryGiB: limits.memoryGiB,
12290
+ diskGiB: limits.diskGiB
12291
+ });
12292
+ return roundUpCredits(
12293
+ item.providerCostUsd * COMPUTE_BILLING_MARKUP_MULTIPLIER * DEFAULT_PROVIDER_MARKUP_MULTIPLIER / DEFAULT_USD_PER_CUSTOMER_CREDIT
12294
+ );
12295
+ }
12296
+ function formatNonStandardSandboxRuntimeWarning(limits) {
12297
+ if (!hasNonStandardPlaySandboxRuntimeLimits(limits)) return null;
12298
+ const maximumComputeCredits = estimateDaytonaMaximumComputeCredits(limits);
12299
+ return `This Play requests a non-standard sandbox (${limits.timeoutSeconds}s, ${limits.memoryGiB}GiB memory, ${limits.cpu} CPU, ${limits.diskGiB}GiB disk). Maximum compute estimate: ${maximumComputeCredits.toFixed(2)} Deepline credits. It may queue longer.`;
12300
+ }
12301
+
12174
12302
  // ../shared_libs/play-runtime/internal-step-ids.ts
12175
12303
  var INTERNAL_GLUE_NODE_ID_PREFIX = "run_javascript:";
12176
12304
  function isInternalGlueStepId(stepId) {
@@ -12730,7 +12858,7 @@ function looksLikeFilePath(target) {
12730
12858
  }
12731
12859
  return target.includes("\\") || /\.(ts|js|mjs|play\.ts)$/.test(target);
12732
12860
  }
12733
- function parsePositiveInteger3(value, flagName) {
12861
+ function parsePositiveInteger4(value, flagName) {
12734
12862
  const parsed = Number.parseInt(value, 10);
12735
12863
  if (!Number.isFinite(parsed) || parsed <= 0) {
12736
12864
  throw new Error(`${flagName} must be a positive integer.`);
@@ -16250,7 +16378,7 @@ function parsePlayRunOptions(args) {
16250
16378
  );
16251
16379
  }
16252
16380
  if ((arg === "--tail-timeout-ms" || arg === "--timeout-ms") && args[index + 1]) {
16253
- waitTimeoutMs = parsePositiveInteger3(args[++index], arg);
16381
+ waitTimeoutMs = parsePositiveInteger4(args[++index], arg);
16254
16382
  continue;
16255
16383
  }
16256
16384
  if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
@@ -16573,23 +16701,49 @@ function formatPlayCheckIssueLines(issue) {
16573
16701
  }
16574
16702
  return lines;
16575
16703
  }
16576
- function printPlayCheckIssues(issues, writer) {
16577
- if (!issues?.length) return;
16578
- const errorIssues = issues.filter((issue) => issue.severity === "error");
16579
- const warningIssues = issues.filter((issue) => issue.severity === "warning");
16704
+ function printPlayCheckIssues(issues, writer, warnings = void 0) {
16705
+ const errorIssues = (issues ?? []).filter(
16706
+ (issue) => issue.severity === "error"
16707
+ );
16708
+ const warningIssues = (issues ?? []).filter(
16709
+ (issue) => issue.severity === "warning"
16710
+ );
16711
+ const structuredWarningMessages = warningIssues.map(
16712
+ (issue) => issue.message.trim()
16713
+ );
16714
+ const stringWarnings = [...new Set(warnings ?? [])].filter((warning) => {
16715
+ const trimmed = warning.trim();
16716
+ return trimmed.length > 0 && !structuredWarningMessages.some(
16717
+ (message) => trimmed === message || trimmed.startsWith(message)
16718
+ );
16719
+ });
16580
16720
  if (errorIssues.length) {
16581
16721
  writer(" issues:");
16582
16722
  for (const issue of errorIssues) {
16583
16723
  for (const line of formatPlayCheckIssueLines(issue)) writer(line);
16584
16724
  }
16585
16725
  }
16586
- if (warningIssues.length) {
16726
+ if (warningIssues.length || stringWarnings.length) {
16587
16727
  writer(" warnings:");
16588
16728
  for (const issue of warningIssues) {
16589
16729
  for (const line of formatPlayCheckIssueLines(issue)) writer(line);
16590
16730
  }
16731
+ for (const warning of stringWarnings) writer(` - ${warning.trim()}`);
16591
16732
  }
16592
16733
  }
16734
+ function formatPlaySandboxRuntimeWarning(declaration) {
16735
+ if (!declaration) return null;
16736
+ const warning = formatNonStandardSandboxRuntimeWarning(
16737
+ resolvePlaySandboxRuntimeLimits(declaration)
16738
+ );
16739
+ return warning ? `Warning: ${warning}` : null;
16740
+ }
16741
+ function printBundledRuntimeWarning(bundle) {
16742
+ const warning = formatPlaySandboxRuntimeWarning(
16743
+ bundle.sandboxRuntimeDeclaration
16744
+ );
16745
+ if (warning) console.warn(warning);
16746
+ }
16593
16747
  function partitionMirroredErrors(errors, issues) {
16594
16748
  const errorMessages = (issues ?? []).filter((issue) => issue.severity === "error").map((issue) => issue.message.trim()).filter((message) => message.length > 0);
16595
16749
  if (errorMessages.length === 0) {
@@ -16767,7 +16921,11 @@ async function handlePlayCheck(args) {
16767
16921
  }
16768
16922
  printPlayTriggers(enrichedResult.triggers);
16769
16923
  printRecognizedSummary(enrichedResult.recognized);
16770
- printPlayCheckIssues(enrichedResult.issues, (line) => console.log(line));
16924
+ printPlayCheckIssues(
16925
+ enrichedResult.issues,
16926
+ (line) => console.log(line),
16927
+ enrichedResult.warnings
16928
+ );
16771
16929
  printToolGetterHints(enrichedResult.toolGetterHints);
16772
16930
  } else {
16773
16931
  console.error(`\u2717 ${playName} failed cloud play check`);
@@ -16778,7 +16936,11 @@ async function handlePlayCheck(args) {
16778
16936
  for (const error of unstructuredErrors) {
16779
16937
  console.error(` ${error}`);
16780
16938
  }
16781
- printPlayCheckIssues(enrichedResult.issues, (line) => console.error(line));
16939
+ printPlayCheckIssues(
16940
+ enrichedResult.issues,
16941
+ (line) => console.error(line),
16942
+ enrichedResult.warnings
16943
+ );
16782
16944
  printToolGetterHints(enrichedResult.toolGetterHints);
16783
16945
  }
16784
16946
  return enrichedResult.valid ? 0 : 1;
@@ -16839,6 +17001,7 @@ async function handleFileBackedRun(options, hooks) {
16839
17001
  }
16840
17002
  const bundleResult = graph.root;
16841
17003
  const playName = bundleResult.playName ?? extractPlayName(sourceCode, absolutePlayPath);
17004
+ printBundledRuntimeWarning(bundleResult);
16842
17005
  try {
16843
17006
  progress.phase("publishing imported plays");
16844
17007
  await traceCliSpan(
@@ -17376,7 +17539,7 @@ async function handleRunLogs(args) {
17376
17539
  for (let index = 0; index < args.length; index += 1) {
17377
17540
  const arg = args[index];
17378
17541
  if (arg === "--limit" && args[index + 1]) {
17379
- limit = parsePositiveInteger3(args[++index], "--limit");
17542
+ limit = parsePositiveInteger4(args[++index], "--limit");
17380
17543
  continue;
17381
17544
  }
17382
17545
  if (arg === "--out" && args[index + 1]) {
package/dist/index.d.mts CHANGED
@@ -3811,6 +3811,17 @@ type PlayBindings = {
3811
3811
  /** Stop the run before a billed action would push total run credits above this cap. */
3812
3812
  maxCreditsPerRun?: number;
3813
3813
  };
3814
+ /** Requested sandbox envelope; the server enforces the final allowed limits. */
3815
+ runtime?: {
3816
+ /** Duration such as `"90m"` or `"2h"`. */
3817
+ timeout?: string;
3818
+ /** Memory such as `"4GiB"`. */
3819
+ memory?: string;
3820
+ /** Whole vCPU count. */
3821
+ cpu?: number;
3822
+ /** Disk such as `"10GiB"`. */
3823
+ disk?: string;
3824
+ };
3814
3825
  /** Webhook trigger with optional HMAC signature verification. */
3815
3826
  webhook?: {
3816
3827
  hmac?: {
@@ -4625,6 +4636,8 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
4625
4636
  bindings?: PlayBindings;
4626
4637
  /** Billing options. */
4627
4638
  billing?: PlayBindings['billing'];
4639
+ /** Requested sandbox envelope; the server enforces the final allowed limits. */
4640
+ runtime?: PlayBindings['runtime'];
4628
4641
  /** Runtime compatibility override. Omit for the current typed contract. */
4629
4642
  compatibility?: PlayBindings['compatibility'];
4630
4643
  };
@@ -4667,6 +4680,8 @@ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boole
4667
4680
  type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & DeeplineNamedPlay<TInput, TOutput> & {
4668
4681
  /** Optional trigger bindings (cron, webhook). */
4669
4682
  readonly bindings?: PlayBindings;
4683
+ /** Requested sandbox envelope. */
4684
+ readonly runtime?: PlayBindings['runtime'];
4670
4685
  /** Runtime compatibility explicitly selected by the author. */
4671
4686
  readonly compatibility?: PlayBindings['compatibility'];
4672
4687
  /** The play's name (same as `.name`). */
@@ -4678,6 +4693,7 @@ type PlayMetadata = {
4678
4693
  bindings?: PlayBindings;
4679
4694
  inputSchema?: Record<string, unknown>;
4680
4695
  billing?: PlayBindings['billing'];
4696
+ runtime?: PlayBindings['runtime'];
4681
4697
  compatibility?: PlayBindings['compatibility'];
4682
4698
  };
4683
4699
  /**
package/dist/index.d.ts CHANGED
@@ -3811,6 +3811,17 @@ type PlayBindings = {
3811
3811
  /** Stop the run before a billed action would push total run credits above this cap. */
3812
3812
  maxCreditsPerRun?: number;
3813
3813
  };
3814
+ /** Requested sandbox envelope; the server enforces the final allowed limits. */
3815
+ runtime?: {
3816
+ /** Duration such as `"90m"` or `"2h"`. */
3817
+ timeout?: string;
3818
+ /** Memory such as `"4GiB"`. */
3819
+ memory?: string;
3820
+ /** Whole vCPU count. */
3821
+ cpu?: number;
3822
+ /** Disk such as `"10GiB"`. */
3823
+ disk?: string;
3824
+ };
3814
3825
  /** Webhook trigger with optional HMAC signature verification. */
3815
3826
  webhook?: {
3816
3827
  hmac?: {
@@ -4625,6 +4636,8 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
4625
4636
  bindings?: PlayBindings;
4626
4637
  /** Billing options. */
4627
4638
  billing?: PlayBindings['billing'];
4639
+ /** Requested sandbox envelope; the server enforces the final allowed limits. */
4640
+ runtime?: PlayBindings['runtime'];
4628
4641
  /** Runtime compatibility override. Omit for the current typed contract. */
4629
4642
  compatibility?: PlayBindings['compatibility'];
4630
4643
  };
@@ -4667,6 +4680,8 @@ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boole
4667
4680
  type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & DeeplineNamedPlay<TInput, TOutput> & {
4668
4681
  /** Optional trigger bindings (cron, webhook). */
4669
4682
  readonly bindings?: PlayBindings;
4683
+ /** Requested sandbox envelope. */
4684
+ readonly runtime?: PlayBindings['runtime'];
4670
4685
  /** Runtime compatibility explicitly selected by the author. */
4671
4686
  readonly compatibility?: PlayBindings['compatibility'];
4672
4687
  /** The play's name (same as `.name`). */
@@ -4678,6 +4693,7 @@ type PlayMetadata = {
4678
4693
  bindings?: PlayBindings;
4679
4694
  inputSchema?: Record<string, unknown>;
4680
4695
  billing?: PlayBindings['billing'];
4696
+ runtime?: PlayBindings['runtime'];
4681
4697
  compatibility?: PlayBindings['compatibility'];
4682
4698
  };
4683
4699
  /**
package/dist/index.js CHANGED
@@ -760,7 +760,7 @@ var SDK_RELEASE = {
760
760
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
761
761
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
762
762
  // Operators use the checkout-local deepline-admin binary instead.
763
- version: "0.1.307",
763
+ version: "0.1.308",
764
764
  contracts: {
765
765
  api: {
766
766
  name: "sdk-http-api",
@@ -7449,6 +7449,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7449
7449
  description: maybeBindings?.description,
7450
7450
  inputSchema: void 0,
7451
7451
  billing: maybeBindings?.billing,
7452
+ runtime: maybeBindings?.runtime,
7452
7453
  compatibility: maybeBindings?.compatibility
7453
7454
  } : {
7454
7455
  name: nameOrConfig.id,
@@ -7457,6 +7458,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7457
7458
  description: nameOrConfig.description,
7458
7459
  inputSchema: nameOrConfig.input.schema,
7459
7460
  billing: nameOrConfig.billing,
7461
+ runtime: nameOrConfig.runtime ?? nameOrConfig.bindings?.runtime,
7460
7462
  compatibility: nameOrConfig.compatibility ?? nameOrConfig.bindings?.compatibility
7461
7463
  };
7462
7464
  const name = config.name;
@@ -7465,6 +7467,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7465
7467
  const description = config.description?.trim();
7466
7468
  const billing = config.billing;
7467
7469
  const inputSchema = config.inputSchema;
7470
+ const runtime = config.runtime;
7468
7471
  const compatibility = config.compatibility;
7469
7472
  if (typeof fn !== "function") {
7470
7473
  throw new Error("definePlay(...) requires an async run function.");
@@ -7491,6 +7494,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7491
7494
  ...bindings ? { bindings } : {},
7492
7495
  ...inputSchema ? { inputSchema } : {},
7493
7496
  ...billing ? { billing } : {},
7497
+ ...runtime ? { runtime } : {},
7494
7498
  ...compatibility ? { compatibility } : {}
7495
7499
  };
7496
7500
  const play = fn;
@@ -7512,6 +7516,12 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7512
7516
  configurable: false,
7513
7517
  writable: false
7514
7518
  });
7519
+ Object.defineProperty(play, "runtime", {
7520
+ value: runtime,
7521
+ enumerable: true,
7522
+ configurable: false,
7523
+ writable: false
7524
+ });
7515
7525
  Object.defineProperty(play, "compatibility", {
7516
7526
  value: compatibility,
7517
7527
  enumerable: true,
package/dist/index.mjs CHANGED
@@ -686,7 +686,7 @@ var SDK_RELEASE = {
686
686
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
687
687
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
688
688
  // Operators use the checkout-local deepline-admin binary instead.
689
- version: "0.1.307",
689
+ version: "0.1.308",
690
690
  contracts: {
691
691
  api: {
692
692
  name: "sdk-http-api",
@@ -7375,6 +7375,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7375
7375
  description: maybeBindings?.description,
7376
7376
  inputSchema: void 0,
7377
7377
  billing: maybeBindings?.billing,
7378
+ runtime: maybeBindings?.runtime,
7378
7379
  compatibility: maybeBindings?.compatibility
7379
7380
  } : {
7380
7381
  name: nameOrConfig.id,
@@ -7383,6 +7384,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7383
7384
  description: nameOrConfig.description,
7384
7385
  inputSchema: nameOrConfig.input.schema,
7385
7386
  billing: nameOrConfig.billing,
7387
+ runtime: nameOrConfig.runtime ?? nameOrConfig.bindings?.runtime,
7386
7388
  compatibility: nameOrConfig.compatibility ?? nameOrConfig.bindings?.compatibility
7387
7389
  };
7388
7390
  const name = config.name;
@@ -7391,6 +7393,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7391
7393
  const description = config.description?.trim();
7392
7394
  const billing = config.billing;
7393
7395
  const inputSchema = config.inputSchema;
7396
+ const runtime = config.runtime;
7394
7397
  const compatibility = config.compatibility;
7395
7398
  if (typeof fn !== "function") {
7396
7399
  throw new Error("definePlay(...) requires an async run function.");
@@ -7417,6 +7420,7 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7417
7420
  ...bindings ? { bindings } : {},
7418
7421
  ...inputSchema ? { inputSchema } : {},
7419
7422
  ...billing ? { billing } : {},
7423
+ ...runtime ? { runtime } : {},
7420
7424
  ...compatibility ? { compatibility } : {}
7421
7425
  };
7422
7426
  const play = fn;
@@ -7438,6 +7442,12 @@ function definePlay(nameOrConfig, maybeFn, maybeBindings) {
7438
7442
  configurable: false,
7439
7443
  writable: false
7440
7444
  });
7445
+ Object.defineProperty(play, "runtime", {
7446
+ value: runtime,
7447
+ enumerable: true,
7448
+ configurable: false,
7449
+ writable: false
7450
+ });
7441
7451
  Object.defineProperty(play, "compatibility", {
7442
7452
  value: compatibility,
7443
7453
  enumerable: true,
@@ -40,6 +40,13 @@ type PlayBundleArtifact = {
40
40
  cacheHit: boolean;
41
41
  };
42
42
 
43
+ type PlaySandboxRuntimeDeclaration = {
44
+ timeout?: string;
45
+ memory?: string;
46
+ cpu?: number;
47
+ disk?: string;
48
+ };
49
+
43
50
  type ImportedPlayDependency = {
44
51
  filePath: string;
45
52
  playName: string;
@@ -84,6 +91,7 @@ type BundledPlayFileSuccess = {
84
91
  filePath: string;
85
92
  playName: string | null;
86
93
  playDescription: string | null;
94
+ sandboxRuntimeDeclaration: PlaySandboxRuntimeDeclaration | null;
87
95
  compilerManifest?: PlayCompilerManifest;
88
96
  packagedFiles: PlayLocalFileReference[];
89
97
  unresolvedFileReferences: PlayLocalFileDiscoveryError[];
@@ -40,6 +40,13 @@ type PlayBundleArtifact = {
40
40
  cacheHit: boolean;
41
41
  };
42
42
 
43
+ type PlaySandboxRuntimeDeclaration = {
44
+ timeout?: string;
45
+ memory?: string;
46
+ cpu?: number;
47
+ disk?: string;
48
+ };
49
+
43
50
  type ImportedPlayDependency = {
44
51
  filePath: string;
45
52
  playName: string;
@@ -84,6 +91,7 @@ type BundledPlayFileSuccess = {
84
91
  filePath: string;
85
92
  playName: string | null;
86
93
  playDescription: string | null;
94
+ sandboxRuntimeDeclaration: PlaySandboxRuntimeDeclaration | null;
87
95
  compilerManifest?: PlayCompilerManifest;
88
96
  packagedFiles: PlayLocalFileReference[];
89
97
  unresolvedFileReferences: PlayLocalFileDiscoveryError[];
@@ -594,6 +594,39 @@ function toolErrorSchemaVersionFromOptions(node, context) {
594
594
  if (schemaVersion === 0 || schemaVersion === 1) return schemaVersion;
595
595
  return null;
596
596
  }
597
+ function sandboxRuntimeDeclarationFromOptions(node, context) {
598
+ const directRuntime = resolveStaticProperty(node, "runtime", context);
599
+ const bindings = resolveStaticProperty(node, "bindings", context);
600
+ const bindingRuntime = bindings.kind === "found" ? resolveStaticProperty(bindings.value, "runtime", context) : { kind: "absent" };
601
+ const runtime = directRuntime.kind === "found" ? directRuntime : bindingRuntime;
602
+ if (runtime.kind !== "found") return null;
603
+ const timeout = resolveStaticProperty(runtime.value, "timeout", context);
604
+ const memory = resolveStaticProperty(runtime.value, "memory", context);
605
+ const cpu = resolveStaticProperty(runtime.value, "cpu", context);
606
+ const disk = resolveStaticProperty(runtime.value, "disk", context);
607
+ const declaration = {};
608
+ if (timeout.kind === "found") {
609
+ const value = staticStringFromExpression(timeout.value, context);
610
+ if (value === null) return null;
611
+ declaration.timeout = value;
612
+ }
613
+ if (memory.kind === "found") {
614
+ const value = staticStringFromExpression(memory.value, context);
615
+ if (value === null) return null;
616
+ declaration.memory = value;
617
+ }
618
+ if (cpu.kind === "found") {
619
+ const value = staticNumberFromExpression(cpu.value, context);
620
+ if (value === null) return null;
621
+ declaration.cpu = value;
622
+ }
623
+ if (disk.kind === "found") {
624
+ const value = staticStringFromExpression(disk.value, context);
625
+ if (value === null) return null;
626
+ declaration.disk = value;
627
+ }
628
+ return declaration;
629
+ }
597
630
  function stringPropertyFromObjectExpression(node, propertyName, context, seenObjects = /* @__PURE__ */ new Set()) {
598
631
  const object = objectExpressionFromNode(node, context);
599
632
  if (!object || seenObjects.has(object)) return null;
@@ -655,6 +688,10 @@ function playMetadataFromDefinePlayCall(node, context) {
655
688
  );
656
689
  }
657
690
  const options = isObjectForm ? firstArg : args[2] ?? null;
691
+ const sandboxRuntimeDeclaration = sandboxRuntimeDeclarationFromOptions(
692
+ options,
693
+ context
694
+ );
658
695
  const toolErrorSchemaVersion = toolErrorSchemaVersionFromOptions(
659
696
  options,
660
697
  context
@@ -666,6 +703,7 @@ function playMetadataFromDefinePlayCall(node, context) {
666
703
  return {
667
704
  name,
668
705
  description,
706
+ sandboxRuntimeDeclaration,
669
707
  toolErrorSchemaVersion: toolErrorSchemaVersion ?? null,
670
708
  toolErrorSchemaVersionUnknown
671
709
  };
@@ -1053,6 +1091,7 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
1053
1091
  }
1054
1092
  const playName = metadata?.name ?? null;
1055
1093
  const playDescription = metadata?.description ?? null;
1094
+ const sandboxRuntimeDeclaration = metadata?.sandboxRuntimeDeclaration ?? null;
1056
1095
  return {
1057
1096
  sourceCode,
1058
1097
  sourceFiles: Object.fromEntries(
@@ -1069,6 +1108,7 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
1069
1108
  },
1070
1109
  playName,
1071
1110
  playDescription,
1111
+ sandboxRuntimeDeclaration,
1072
1112
  toolErrorSchemaVersion: metadata?.toolErrorSchemaVersion ?? null,
1073
1113
  importedPlayDependencies: [...importedPlayDependencies.values()].sort(
1074
1114
  (left, right) => left.filePath.localeCompare(right.filePath)
@@ -1251,6 +1291,7 @@ entry-export:${exportName}`
1251
1291
  filePath: absolutePath,
1252
1292
  playName: analysis.playName,
1253
1293
  playDescription: analysis.playDescription,
1294
+ sandboxRuntimeDeclaration: analysis.sandboxRuntimeDeclaration,
1254
1295
  packagedFiles: discoveredFiles.files,
1255
1296
  unresolvedFileReferences: discoveredFiles.unresolved,
1256
1297
  importedPlayDependencies: analysis.importedPlayDependencies
@@ -1319,6 +1360,7 @@ entry-export:${exportName}`
1319
1360
  filePath: absolutePath,
1320
1361
  playName: analysis.playName,
1321
1362
  playDescription: analysis.playDescription,
1363
+ sandboxRuntimeDeclaration: analysis.sandboxRuntimeDeclaration,
1322
1364
  packagedFiles: discoveredFiles.files,
1323
1365
  unresolvedFileReferences: discoveredFiles.unresolved,
1324
1366
  importedPlayDependencies: analysis.importedPlayDependencies
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "deepline",
3
- "version": "0.1.307",
3
+ "version": "0.1.308",
4
4
  "description": "Deepline SDK + CLI — B2B data enrichment powered by durable cloud execution",
5
5
  "license": "MIT",
6
6
  "repository": {