deepline 0.1.313 → 0.1.315

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.
@@ -5,36 +5,38 @@ export type PlaySandboxRuntimeLimits = {
5
5
  diskGiB: number;
6
6
  };
7
7
 
8
+ export type PlaySandboxSize = 'standard';
9
+
10
+ export const PLAY_SANDBOX_SIZE_LIMITS = {
11
+ standard: {
12
+ memoryGiB: 1,
13
+ cpu: 1,
14
+ diskGiB: 3,
15
+ },
16
+ } as const satisfies Record<
17
+ PlaySandboxSize,
18
+ Omit<PlaySandboxRuntimeLimits, 'timeoutSeconds'>
19
+ >;
20
+
8
21
  export const STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS: PlaySandboxRuntimeLimits = {
9
22
  timeoutSeconds: 30 * 60,
10
- memoryGiB: 1,
11
- cpu: 1,
12
- diskGiB: 3,
23
+ ...PLAY_SANDBOX_SIZE_LIMITS.standard,
13
24
  };
14
25
 
15
26
  // Product-wide ceilings. Organisation entitlements may lower these, but a
16
27
  // customer-authored Play can never ask Daytona for an unbounded resource.
17
28
  export const MAX_PLAY_SANDBOX_RUNTIME_LIMITS: PlaySandboxRuntimeLimits = {
18
29
  timeoutSeconds: 4 * 60 * 60,
19
- memoryGiB: 16,
20
- cpu: 4,
21
- diskGiB: 50,
30
+ memoryGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.memoryGiB,
31
+ cpu: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.cpu,
32
+ diskGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.diskGiB,
22
33
  };
23
34
 
24
35
  export type PlaySandboxRuntimeDeclaration = {
25
36
  timeout?: string;
26
- memory?: string;
27
- cpu?: number;
28
- disk?: string;
37
+ size?: PlaySandboxSize;
29
38
  };
30
39
 
31
- function parsePositiveInteger(value: string, unit: string): number | null {
32
- const match = new RegExp(`^(\\d+)\\s*${unit}$`, 'i').exec(value.trim());
33
- if (!match) return null;
34
- const parsed = Number(match[1]);
35
- return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
36
- }
37
-
38
40
  function parseTimeout(value: string): number | null {
39
41
  const match = /^(\d+)\s*([mh])$/i.exec(value.trim());
40
42
  if (!match) return null;
@@ -43,60 +45,65 @@ function parseTimeout(value: string): number | null {
43
45
  return amount * (match[2].toLowerCase() === 'h' ? 3600 : 60);
44
46
  }
45
47
 
46
- export function resolvePlaySandboxRuntimeLimits(
47
- declaration: PlaySandboxRuntimeDeclaration | null | undefined,
48
+ export function validatePlaySandboxRuntimeLimits(
49
+ value: PlaySandboxRuntimeLimits,
48
50
  ): PlaySandboxRuntimeLimits {
49
51
  const base = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS;
50
- if (!declaration) return { ...base };
51
- const timeoutSeconds = declaration.timeout
52
- ? parseTimeout(declaration.timeout)
53
- : base.timeoutSeconds;
54
- const memoryGiB = declaration.memory
55
- ? parsePositiveInteger(declaration.memory, 'GiB')
56
- : base.memoryGiB;
57
- const diskGiB = declaration.disk
58
- ? parsePositiveInteger(declaration.disk, 'GiB')
59
- : base.diskGiB;
60
- const cpu = declaration.cpu ?? base.cpu;
61
- if (
62
- timeoutSeconds === null ||
63
- memoryGiB === null ||
64
- diskGiB === null ||
65
- !Number.isSafeInteger(cpu) ||
66
- cpu <= 0
67
- ) {
68
- throw new Error(
69
- 'Invalid runtime sandbox declaration. Use timeout like "90m" or "2h", memory/disk like "4GiB", and a positive integer cpu.',
70
- );
71
- }
72
- const resolved = { timeoutSeconds, memoryGiB, cpu, diskGiB };
73
52
  for (const key of ['memoryGiB', 'cpu', 'diskGiB'] as const) {
74
- if (resolved[key] < base[key]) {
53
+ if (value[key] !== base[key]) {
75
54
  throw new Error(
76
- `Requested runtime ${key}=${resolved[key]} is below the supported minimum ${base[key]}.`,
55
+ `Unsupported runtime sandbox resources: ${key}=${value[key]}. ` +
56
+ `Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard" ` +
57
+ `(${base.cpu} CPU, ${base.memoryGiB}GiB memory, ${base.diskGiB}GiB disk).`,
77
58
  );
78
59
  }
79
60
  }
80
- for (const key of Object.keys(
81
- resolved,
82
- ) as (keyof PlaySandboxRuntimeLimits)[]) {
83
- if (resolved[key] > MAX_PLAY_SANDBOX_RUNTIME_LIMITS[key]) {
84
- throw new Error(
85
- `Requested runtime ${key}=${resolved[key]} exceeds this organisation's maximum ${MAX_PLAY_SANDBOX_RUNTIME_LIMITS[key]}.`,
86
- );
87
- }
61
+ if (
62
+ !Number.isSafeInteger(value.timeoutSeconds) ||
63
+ value.timeoutSeconds <= 0
64
+ ) {
65
+ throw new Error(
66
+ 'Invalid runtime sandbox timeout. Use timeout like "90m" or "2h".',
67
+ );
68
+ }
69
+ if (value.timeoutSeconds > MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds) {
70
+ throw new Error(
71
+ `Requested runtime timeoutSeconds=${value.timeoutSeconds} exceeds this organisation's maximum ${MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds}.`,
72
+ );
88
73
  }
89
- return resolved;
74
+ return { ...value };
90
75
  }
91
76
 
92
- export function hasNonStandardPlaySandboxRuntimeLimits(
93
- value: PlaySandboxRuntimeLimits,
94
- ): boolean {
95
- return Object.keys(value).some(
96
- (key) =>
97
- value[key as keyof PlaySandboxRuntimeLimits] !==
98
- STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS[
99
- key as keyof PlaySandboxRuntimeLimits
100
- ],
77
+ export function resolvePlaySandboxRuntimeLimits(
78
+ declaration: PlaySandboxRuntimeDeclaration | null | undefined,
79
+ ): PlaySandboxRuntimeLimits {
80
+ const base = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS;
81
+ if (!declaration) return { ...base };
82
+ const unsupportedProperties = Object.keys(declaration).filter(
83
+ (key) => key !== 'timeout' && key !== 'size',
101
84
  );
85
+ if (unsupportedProperties.length > 0) {
86
+ throw new Error(
87
+ `Unsupported runtime sandbox option${unsupportedProperties.length === 1 ? '' : 's'}: ${unsupportedProperties.join(', ')}. ` +
88
+ 'Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard".',
89
+ );
90
+ }
91
+ if (declaration.size !== undefined && declaration.size !== 'standard') {
92
+ throw new Error(
93
+ `Unsupported runtime sandbox size "${String(declaration.size)}". Supported sizes: "standard".`,
94
+ );
95
+ }
96
+ const timeoutSeconds = declaration.timeout
97
+ ? parseTimeout(declaration.timeout)
98
+ : base.timeoutSeconds;
99
+ if (timeoutSeconds === null) {
100
+ throw new Error(
101
+ 'Invalid runtime sandbox timeout. Use timeout like "90m" or "2h".',
102
+ );
103
+ }
104
+ const size = declaration.size ?? 'standard';
105
+ return validatePlaySandboxRuntimeLimits({
106
+ timeoutSeconds,
107
+ ...PLAY_SANDBOX_SIZE_LIMITS[size],
108
+ });
102
109
  }
@@ -887,6 +887,35 @@ function resolveStaticProperty(
887
887
  return resolution;
888
888
  }
889
889
 
890
+ function staticPropertyNames(
891
+ node: AstNode | null | undefined,
892
+ context: PlayMetadataExtractionContext,
893
+ ancestors = new Set<AstNode>(),
894
+ ): Set<string> | null {
895
+ if (!node) return new Set();
896
+ const object = objectExpressionFromNode(node, context);
897
+ if (!object || ancestors.has(object)) return null;
898
+ const nextAncestors = new Set(ancestors).add(object);
899
+ const names = new Set<string>();
900
+ for (const property of astArray(object.properties)) {
901
+ if (property.type === 'SpreadElement') {
902
+ const spreadNames = staticPropertyNames(
903
+ isAstNode(property.argument) ? property.argument : null,
904
+ context,
905
+ nextAncestors,
906
+ );
907
+ if (!spreadNames) return null;
908
+ for (const name of spreadNames) names.add(name);
909
+ continue;
910
+ }
911
+ if (property.type !== 'Property') return null;
912
+ const name = propertyNameFromKey(property);
913
+ if (name === null) return null;
914
+ names.add(name);
915
+ }
916
+ return names;
917
+ }
918
+
890
919
  function staticNumberFromExpression(
891
920
  node: AstNode | null | undefined,
892
921
  context: PlayMetadataExtractionContext,
@@ -957,30 +986,30 @@ function sandboxRuntimeDeclarationFromOptions(
957
986
  directRuntime.kind === 'found' ? directRuntime : bindingRuntime;
958
987
  if (runtime.kind !== 'found') return null;
959
988
 
989
+ const propertyNames = staticPropertyNames(runtime.value, context);
990
+ const unsupportedProperties = propertyNames
991
+ ? [...propertyNames].filter(
992
+ (propertyName) => propertyName !== 'timeout' && propertyName !== 'size',
993
+ )
994
+ : [];
995
+ if (unsupportedProperties.length > 0) {
996
+ throw new Error(
997
+ `Unsupported runtime sandbox option${unsupportedProperties.length === 1 ? '' : 's'} "${unsupportedProperties.join('", "')}". ` +
998
+ 'Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard".',
999
+ );
1000
+ }
960
1001
  const timeout = resolveStaticProperty(runtime.value, 'timeout', context);
961
- const memory = resolveStaticProperty(runtime.value, 'memory', context);
962
- const cpu = resolveStaticProperty(runtime.value, 'cpu', context);
963
- const disk = resolveStaticProperty(runtime.value, 'disk', context);
1002
+ const size = resolveStaticProperty(runtime.value, 'size', context);
964
1003
  const declaration: PlaySandboxRuntimeDeclaration = {};
965
1004
  if (timeout.kind === 'found') {
966
1005
  const value = staticStringFromExpression(timeout.value, context);
967
1006
  if (value === null) return null;
968
1007
  declaration.timeout = value;
969
1008
  }
970
- if (memory.kind === 'found') {
971
- const value = staticStringFromExpression(memory.value, context);
972
- if (value === null) return null;
973
- declaration.memory = value;
974
- }
975
- if (cpu.kind === 'found') {
976
- const value = staticNumberFromExpression(cpu.value, context);
977
- if (value === null) return null;
978
- declaration.cpu = value;
979
- }
980
- if (disk.kind === 'found') {
981
- const value = staticStringFromExpression(disk.value, context);
1009
+ if (size.kind === 'found') {
1010
+ const value = staticStringFromExpression(size.value, context);
982
1011
  if (value === null) return null;
983
- declaration.disk = value;
1012
+ declaration.size = value as PlaySandboxRuntimeDeclaration['size'];
984
1013
  }
985
1014
  return declaration;
986
1015
  }
@@ -1596,8 +1625,7 @@ async function analyzeSourceGraph(
1596
1625
  }
1597
1626
  const playName = metadata?.name ?? null;
1598
1627
  const playDescription = metadata?.description ?? null;
1599
- const sandboxRuntimeDeclaration =
1600
- metadata?.sandboxRuntimeDeclaration ?? null;
1628
+ const sandboxRuntimeDeclaration = metadata?.sandboxRuntimeDeclaration ?? null;
1601
1629
 
1602
1630
  return {
1603
1631
  sourceCode,
package/dist/cli/index.js CHANGED
@@ -1037,7 +1037,7 @@ var SDK_RELEASE = {
1037
1037
  // 0.1.253 makes play-page browser opening opt-in and retires --no-open.
1038
1038
  // 0.1.254 removes the internal operations tree from the published SDK CLI.
1039
1039
  // Operators use the checkout-local deepline-admin binary instead.
1040
- version: "0.1.313",
1040
+ version: "0.1.315",
1041
1041
  contracts: {
1042
1042
  api: {
1043
1043
  name: "sdk-http-api",
@@ -12143,24 +12143,23 @@ function resolveEnabledExecutionProfile(override) {
12143
12143
  }
12144
12144
 
12145
12145
  // ../shared_libs/play-runtime/sandbox-runtime-limits.ts
12146
+ var PLAY_SANDBOX_SIZE_LIMITS = {
12147
+ standard: {
12148
+ memoryGiB: 1,
12149
+ cpu: 1,
12150
+ diskGiB: 3
12151
+ }
12152
+ };
12146
12153
  var STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS = {
12147
12154
  timeoutSeconds: 30 * 60,
12148
- memoryGiB: 1,
12149
- cpu: 1,
12150
- diskGiB: 3
12155
+ ...PLAY_SANDBOX_SIZE_LIMITS.standard
12151
12156
  };
12152
12157
  var MAX_PLAY_SANDBOX_RUNTIME_LIMITS = {
12153
12158
  timeoutSeconds: 4 * 60 * 60,
12154
- memoryGiB: 16,
12155
- cpu: 4,
12156
- diskGiB: 50
12159
+ memoryGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.memoryGiB,
12160
+ cpu: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.cpu,
12161
+ diskGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.diskGiB
12157
12162
  };
12158
- function parsePositiveInteger3(value, unit) {
12159
- const match = new RegExp(`^(\\d+)\\s*${unit}$`, "i").exec(value.trim());
12160
- if (!match) return null;
12161
- const parsed = Number(match[1]);
12162
- return Number.isSafeInteger(parsed) && parsed > 0 ? parsed : null;
12163
- }
12164
12163
  function parseTimeout(value) {
12165
12164
  const match = /^(\d+)\s*([mh])$/i.exec(value.trim());
12166
12165
  if (!match) return null;
@@ -12168,41 +12167,54 @@ function parseTimeout(value) {
12168
12167
  if (!Number.isSafeInteger(amount) || amount <= 0) return null;
12169
12168
  return amount * (match[2].toLowerCase() === "h" ? 3600 : 60);
12170
12169
  }
12171
- function resolvePlaySandboxRuntimeLimits(declaration) {
12170
+ function validatePlaySandboxRuntimeLimits(value) {
12172
12171
  const base = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS;
12173
- if (!declaration) return { ...base };
12174
- const timeoutSeconds = declaration.timeout ? parseTimeout(declaration.timeout) : base.timeoutSeconds;
12175
- const memoryGiB = declaration.memory ? parsePositiveInteger3(declaration.memory, "GiB") : base.memoryGiB;
12176
- const diskGiB = declaration.disk ? parsePositiveInteger3(declaration.disk, "GiB") : base.diskGiB;
12177
- const cpu = declaration.cpu ?? base.cpu;
12178
- if (timeoutSeconds === null || memoryGiB === null || diskGiB === null || !Number.isSafeInteger(cpu) || cpu <= 0) {
12179
- throw new Error(
12180
- 'Invalid runtime sandbox declaration. Use timeout like "90m" or "2h", memory/disk like "4GiB", and a positive integer cpu.'
12181
- );
12182
- }
12183
- const resolved = { timeoutSeconds, memoryGiB, cpu, diskGiB };
12184
12172
  for (const key of ["memoryGiB", "cpu", "diskGiB"]) {
12185
- if (resolved[key] < base[key]) {
12173
+ if (value[key] !== base[key]) {
12186
12174
  throw new Error(
12187
- `Requested runtime ${key}=${resolved[key]} is below the supported minimum ${base[key]}.`
12175
+ `Unsupported runtime sandbox resources: ${key}=${value[key]}. Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard" (${base.cpu} CPU, ${base.memoryGiB}GiB memory, ${base.diskGiB}GiB disk).`
12188
12176
  );
12189
12177
  }
12190
12178
  }
12191
- for (const key of Object.keys(
12192
- resolved
12193
- )) {
12194
- if (resolved[key] > MAX_PLAY_SANDBOX_RUNTIME_LIMITS[key]) {
12195
- throw new Error(
12196
- `Requested runtime ${key}=${resolved[key]} exceeds this organisation's maximum ${MAX_PLAY_SANDBOX_RUNTIME_LIMITS[key]}.`
12197
- );
12198
- }
12179
+ if (!Number.isSafeInteger(value.timeoutSeconds) || value.timeoutSeconds <= 0) {
12180
+ throw new Error(
12181
+ 'Invalid runtime sandbox timeout. Use timeout like "90m" or "2h".'
12182
+ );
12199
12183
  }
12200
- return resolved;
12184
+ if (value.timeoutSeconds > MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds) {
12185
+ throw new Error(
12186
+ `Requested runtime timeoutSeconds=${value.timeoutSeconds} exceeds this organisation's maximum ${MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds}.`
12187
+ );
12188
+ }
12189
+ return { ...value };
12201
12190
  }
12202
- function hasNonStandardPlaySandboxRuntimeLimits(value) {
12203
- return Object.keys(value).some(
12204
- (key) => value[key] !== STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS[key]
12191
+ function resolvePlaySandboxRuntimeLimits(declaration) {
12192
+ const base = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS;
12193
+ if (!declaration) return { ...base };
12194
+ const unsupportedProperties = Object.keys(declaration).filter(
12195
+ (key) => key !== "timeout" && key !== "size"
12205
12196
  );
12197
+ if (unsupportedProperties.length > 0) {
12198
+ throw new Error(
12199
+ `Unsupported runtime sandbox option${unsupportedProperties.length === 1 ? "" : "s"}: ${unsupportedProperties.join(", ")}. Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard".`
12200
+ );
12201
+ }
12202
+ if (declaration.size !== void 0 && declaration.size !== "standard") {
12203
+ throw new Error(
12204
+ `Unsupported runtime sandbox size "${String(declaration.size)}". Supported sizes: "standard".`
12205
+ );
12206
+ }
12207
+ const timeoutSeconds = declaration.timeout ? parseTimeout(declaration.timeout) : base.timeoutSeconds;
12208
+ if (timeoutSeconds === null) {
12209
+ throw new Error(
12210
+ 'Invalid runtime sandbox timeout. Use timeout like "90m" or "2h".'
12211
+ );
12212
+ }
12213
+ const size = declaration.size ?? "standard";
12214
+ return validatePlaySandboxRuntimeLimits({
12215
+ timeoutSeconds,
12216
+ ...PLAY_SANDBOX_SIZE_LIMITS[size]
12217
+ });
12206
12218
  }
12207
12219
 
12208
12220
  // ../shared_libs/play-runtime/worker-api-types.ts
@@ -12265,9 +12277,11 @@ function estimateDaytonaMaximumComputeCredits(limits) {
12265
12277
  );
12266
12278
  }
12267
12279
  function formatNonStandardSandboxRuntimeWarning(limits) {
12268
- if (!hasNonStandardPlaySandboxRuntimeLimits(limits)) return null;
12280
+ if (limits.timeoutSeconds <= STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds) {
12281
+ return null;
12282
+ }
12269
12283
  const maximumComputeCredits = estimateDaytonaMaximumComputeCredits(limits);
12270
- 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.`;
12284
+ return `This Play requests the standard sandbox for up to ${limits.timeoutSeconds}s (${limits.memoryGiB}GiB memory, ${limits.cpu} CPU, ${limits.diskGiB}GiB disk). Maximum compute estimate: ${maximumComputeCredits.toFixed(2)} Deepline credits. Longer runtimes are risky.`;
12271
12285
  }
12272
12286
 
12273
12287
  // ../shared_libs/play-runtime/internal-step-ids.ts
@@ -12829,7 +12843,7 @@ function looksLikeFilePath(target) {
12829
12843
  }
12830
12844
  return target.includes("\\") || /\.(ts|js|mjs|play\.ts)$/.test(target);
12831
12845
  }
12832
- function parsePositiveInteger4(value, flagName) {
12846
+ function parsePositiveInteger3(value, flagName) {
12833
12847
  const parsed = Number.parseInt(value, 10);
12834
12848
  if (!Number.isFinite(parsed) || parsed <= 0) {
12835
12849
  throw new Error(`${flagName} must be a positive integer.`);
@@ -16349,7 +16363,7 @@ function parsePlayRunOptions(args) {
16349
16363
  );
16350
16364
  }
16351
16365
  if ((arg === "--tail-timeout-ms" || arg === "--timeout-ms") && args[index + 1]) {
16352
- waitTimeoutMs = parsePositiveInteger4(args[++index], arg);
16366
+ waitTimeoutMs = parsePositiveInteger3(args[++index], arg);
16353
16367
  continue;
16354
16368
  }
16355
16369
  if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
@@ -17510,7 +17524,7 @@ async function handleRunLogs(args) {
17510
17524
  for (let index = 0; index < args.length; index += 1) {
17511
17525
  const arg = args[index];
17512
17526
  if (arg === "--limit" && args[index + 1]) {
17513
- limit = parsePositiveInteger4(args[++index], "--limit");
17527
+ limit = parsePositiveInteger3(args[++index], "--limit");
17514
17528
  continue;
17515
17529
  }
17516
17530
  if (arg === "--out" && args[index + 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.313",
1025
+ version: "0.1.315",
1026
1026
  contracts: {
1027
1027
  api: {
1028
1028
  name: "sdk-http-api",
@@ -12172,24 +12172,23 @@ function resolveEnabledExecutionProfile(override) {
12172
12172
  }
12173
12173
 
12174
12174
  // ../shared_libs/play-runtime/sandbox-runtime-limits.ts
12175
+ var PLAY_SANDBOX_SIZE_LIMITS = {
12176
+ standard: {
12177
+ memoryGiB: 1,
12178
+ cpu: 1,
12179
+ diskGiB: 3
12180
+ }
12181
+ };
12175
12182
  var STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS = {
12176
12183
  timeoutSeconds: 30 * 60,
12177
- memoryGiB: 1,
12178
- cpu: 1,
12179
- diskGiB: 3
12184
+ ...PLAY_SANDBOX_SIZE_LIMITS.standard
12180
12185
  };
12181
12186
  var MAX_PLAY_SANDBOX_RUNTIME_LIMITS = {
12182
12187
  timeoutSeconds: 4 * 60 * 60,
12183
- memoryGiB: 16,
12184
- cpu: 4,
12185
- diskGiB: 50
12188
+ memoryGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.memoryGiB,
12189
+ cpu: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.cpu,
12190
+ diskGiB: STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.diskGiB
12186
12191
  };
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
12192
  function parseTimeout(value) {
12194
12193
  const match = /^(\d+)\s*([mh])$/i.exec(value.trim());
12195
12194
  if (!match) return null;
@@ -12197,41 +12196,54 @@ function parseTimeout(value) {
12197
12196
  if (!Number.isSafeInteger(amount) || amount <= 0) return null;
12198
12197
  return amount * (match[2].toLowerCase() === "h" ? 3600 : 60);
12199
12198
  }
12200
- function resolvePlaySandboxRuntimeLimits(declaration) {
12199
+ function validatePlaySandboxRuntimeLimits(value) {
12201
12200
  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
12201
  for (const key of ["memoryGiB", "cpu", "diskGiB"]) {
12214
- if (resolved[key] < base[key]) {
12202
+ if (value[key] !== base[key]) {
12215
12203
  throw new Error(
12216
- `Requested runtime ${key}=${resolved[key]} is below the supported minimum ${base[key]}.`
12204
+ `Unsupported runtime sandbox resources: ${key}=${value[key]}. Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard" (${base.cpu} CPU, ${base.memoryGiB}GiB memory, ${base.diskGiB}GiB disk).`
12217
12205
  );
12218
12206
  }
12219
12207
  }
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
- }
12208
+ if (!Number.isSafeInteger(value.timeoutSeconds) || value.timeoutSeconds <= 0) {
12209
+ throw new Error(
12210
+ 'Invalid runtime sandbox timeout. Use timeout like "90m" or "2h".'
12211
+ );
12228
12212
  }
12229
- return resolved;
12213
+ if (value.timeoutSeconds > MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds) {
12214
+ throw new Error(
12215
+ `Requested runtime timeoutSeconds=${value.timeoutSeconds} exceeds this organisation's maximum ${MAX_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds}.`
12216
+ );
12217
+ }
12218
+ return { ...value };
12230
12219
  }
12231
- function hasNonStandardPlaySandboxRuntimeLimits(value) {
12232
- return Object.keys(value).some(
12233
- (key) => value[key] !== STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS[key]
12220
+ function resolvePlaySandboxRuntimeLimits(declaration) {
12221
+ const base = STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS;
12222
+ if (!declaration) return { ...base };
12223
+ const unsupportedProperties = Object.keys(declaration).filter(
12224
+ (key) => key !== "timeout" && key !== "size"
12234
12225
  );
12226
+ if (unsupportedProperties.length > 0) {
12227
+ throw new Error(
12228
+ `Unsupported runtime sandbox option${unsupportedProperties.length === 1 ? "" : "s"}: ${unsupportedProperties.join(", ")}. Use runtime.size with a Deepline prebuilt sandbox. Supported sizes: "standard".`
12229
+ );
12230
+ }
12231
+ if (declaration.size !== void 0 && declaration.size !== "standard") {
12232
+ throw new Error(
12233
+ `Unsupported runtime sandbox size "${String(declaration.size)}". Supported sizes: "standard".`
12234
+ );
12235
+ }
12236
+ const timeoutSeconds = declaration.timeout ? parseTimeout(declaration.timeout) : base.timeoutSeconds;
12237
+ if (timeoutSeconds === null) {
12238
+ throw new Error(
12239
+ 'Invalid runtime sandbox timeout. Use timeout like "90m" or "2h".'
12240
+ );
12241
+ }
12242
+ const size = declaration.size ?? "standard";
12243
+ return validatePlaySandboxRuntimeLimits({
12244
+ timeoutSeconds,
12245
+ ...PLAY_SANDBOX_SIZE_LIMITS[size]
12246
+ });
12235
12247
  }
12236
12248
 
12237
12249
  // ../shared_libs/play-runtime/worker-api-types.ts
@@ -12294,9 +12306,11 @@ function estimateDaytonaMaximumComputeCredits(limits) {
12294
12306
  );
12295
12307
  }
12296
12308
  function formatNonStandardSandboxRuntimeWarning(limits) {
12297
- if (!hasNonStandardPlaySandboxRuntimeLimits(limits)) return null;
12309
+ if (limits.timeoutSeconds <= STANDARD_PLAY_SANDBOX_RUNTIME_LIMITS.timeoutSeconds) {
12310
+ return null;
12311
+ }
12298
12312
  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.`;
12313
+ return `This Play requests the standard sandbox for up to ${limits.timeoutSeconds}s (${limits.memoryGiB}GiB memory, ${limits.cpu} CPU, ${limits.diskGiB}GiB disk). Maximum compute estimate: ${maximumComputeCredits.toFixed(2)} Deepline credits. Longer runtimes are risky.`;
12300
12314
  }
12301
12315
 
12302
12316
  // ../shared_libs/play-runtime/internal-step-ids.ts
@@ -12858,7 +12872,7 @@ function looksLikeFilePath(target) {
12858
12872
  }
12859
12873
  return target.includes("\\") || /\.(ts|js|mjs|play\.ts)$/.test(target);
12860
12874
  }
12861
- function parsePositiveInteger4(value, flagName) {
12875
+ function parsePositiveInteger3(value, flagName) {
12862
12876
  const parsed = Number.parseInt(value, 10);
12863
12877
  if (!Number.isFinite(parsed) || parsed <= 0) {
12864
12878
  throw new Error(`${flagName} must be a positive integer.`);
@@ -16378,7 +16392,7 @@ function parsePlayRunOptions(args) {
16378
16392
  );
16379
16393
  }
16380
16394
  if ((arg === "--tail-timeout-ms" || arg === "--timeout-ms") && args[index + 1]) {
16381
- waitTimeoutMs = parsePositiveInteger4(args[++index], arg);
16395
+ waitTimeoutMs = parsePositiveInteger3(args[++index], arg);
16382
16396
  continue;
16383
16397
  }
16384
16398
  if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
@@ -17539,7 +17553,7 @@ async function handleRunLogs(args) {
17539
17553
  for (let index = 0; index < args.length; index += 1) {
17540
17554
  const arg = args[index];
17541
17555
  if (arg === "--limit" && args[index + 1]) {
17542
- limit = parsePositiveInteger4(args[++index], "--limit");
17556
+ limit = parsePositiveInteger3(args[++index], "--limit");
17543
17557
  continue;
17544
17558
  }
17545
17559
  if (arg === "--out" && args[index + 1]) {
package/dist/index.d.mts CHANGED
@@ -3844,16 +3844,12 @@ type PlayBindings = {
3844
3844
  /** Stop the run before a billed action would push total run credits above this cap. */
3845
3845
  maxCreditsPerRun?: number;
3846
3846
  };
3847
- /** Requested sandbox envelope; the server enforces the final allowed limits. */
3847
+ /** Requested prebuilt sandbox and runtime deadline. */
3848
3848
  runtime?: {
3849
3849
  /** Duration such as `"90m"` or `"2h"`. */
3850
3850
  timeout?: string;
3851
- /** Memory such as `"4GiB"`. */
3852
- memory?: string;
3853
- /** Whole vCPU count. */
3854
- cpu?: number;
3855
- /** Disk such as `"10GiB"`. */
3856
- disk?: string;
3851
+ /** Deepline-managed prebuilt sandbox size. */
3852
+ size?: 'standard';
3857
3853
  };
3858
3854
  /** Webhook trigger with optional HMAC signature verification. */
3859
3855
  webhook?: {
@@ -4669,7 +4665,7 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
4669
4665
  bindings?: PlayBindings;
4670
4666
  /** Billing options. */
4671
4667
  billing?: PlayBindings['billing'];
4672
- /** Requested sandbox envelope; the server enforces the final allowed limits. */
4668
+ /** Requested prebuilt sandbox and runtime deadline. */
4673
4669
  runtime?: PlayBindings['runtime'];
4674
4670
  /** Runtime compatibility override. Omit for the current typed contract. */
4675
4671
  compatibility?: PlayBindings['compatibility'];
@@ -4713,7 +4709,7 @@ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boole
4713
4709
  type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & DeeplineNamedPlay<TInput, TOutput> & {
4714
4710
  /** Optional trigger bindings (cron, webhook). */
4715
4711
  readonly bindings?: PlayBindings;
4716
- /** Requested sandbox envelope. */
4712
+ /** Requested prebuilt sandbox and runtime deadline. */
4717
4713
  readonly runtime?: PlayBindings['runtime'];
4718
4714
  /** Runtime compatibility explicitly selected by the author. */
4719
4715
  readonly compatibility?: PlayBindings['compatibility'];
package/dist/index.d.ts CHANGED
@@ -3844,16 +3844,12 @@ type PlayBindings = {
3844
3844
  /** Stop the run before a billed action would push total run credits above this cap. */
3845
3845
  maxCreditsPerRun?: number;
3846
3846
  };
3847
- /** Requested sandbox envelope; the server enforces the final allowed limits. */
3847
+ /** Requested prebuilt sandbox and runtime deadline. */
3848
3848
  runtime?: {
3849
3849
  /** Duration such as `"90m"` or `"2h"`. */
3850
3850
  timeout?: string;
3851
- /** Memory such as `"4GiB"`. */
3852
- memory?: string;
3853
- /** Whole vCPU count. */
3854
- cpu?: number;
3855
- /** Disk such as `"10GiB"`. */
3856
- disk?: string;
3851
+ /** Deepline-managed prebuilt sandbox size. */
3852
+ size?: 'standard';
3857
3853
  };
3858
3854
  /** Webhook trigger with optional HMAC signature verification. */
3859
3855
  webhook?: {
@@ -4669,7 +4665,7 @@ type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = {
4669
4665
  bindings?: PlayBindings;
4670
4666
  /** Billing options. */
4671
4667
  billing?: PlayBindings['billing'];
4672
- /** Requested sandbox envelope; the server enforces the final allowed limits. */
4668
+ /** Requested prebuilt sandbox and runtime deadline. */
4673
4669
  runtime?: PlayBindings['runtime'];
4674
4670
  /** Runtime compatibility override. Omit for the current typed contract. */
4675
4671
  compatibility?: PlayBindings['compatibility'];
@@ -4713,7 +4709,7 @@ declare function runIf<Row, Value>(predicate: (row: Row, index: number) => boole
4713
4709
  type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & DeeplineNamedPlay<TInput, TOutput> & {
4714
4710
  /** Optional trigger bindings (cron, webhook). */
4715
4711
  readonly bindings?: PlayBindings;
4716
- /** Requested sandbox envelope. */
4712
+ /** Requested prebuilt sandbox and runtime deadline. */
4717
4713
  readonly runtime?: PlayBindings['runtime'];
4718
4714
  /** Runtime compatibility explicitly selected by the author. */
4719
4715
  readonly compatibility?: PlayBindings['compatibility'];