deepline 0.3.572 → 0.3.574

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 (170) hide show
  1. package/dist/bundling-sources/sdk/src/config.ts +19 -0
  2. package/dist/bundling-sources/sdk/src/play.ts +7 -4
  3. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  4. package/dist/bundling-sources/sdk/src/types.ts +8 -0
  5. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +43 -7
  6. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +56 -20
  7. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +4 -3
  8. package/dist/cli/agents-6WN5LYUP.mjs +833 -0
  9. package/dist/cli/agents-7ZZSF4FS.js +833 -0
  10. package/dist/cli/{auth-YUDM3YOC.mjs → auth-I2QVO677.mjs} +5 -5
  11. package/dist/cli/auth-UKPV5U2B.js +44 -0
  12. package/dist/cli/{billing-F3ZGOWKL.js → billing-44QFBUWA.js} +106 -106
  13. package/dist/cli/{billing-O7WUC4TU.mjs → billing-YPH4GEWU.mjs} +10 -10
  14. package/dist/cli/{chunk-ITQPBWDS.js → chunk-2QYU57RG.js} +15 -7
  15. package/dist/cli/{chunk-LBNP52C4.js → chunk-2RPRSTHD.js} +5 -5
  16. package/dist/cli/{chunk-I4WKB3HO.mjs → chunk-2TMAKJBT.mjs} +2 -2
  17. package/dist/cli/{chunk-PQ6PM4V6.mjs → chunk-4T2U72SP.mjs} +1 -1
  18. package/dist/cli/{chunk-HYCJNHZ4.js → chunk-5E2PAGF5.js} +27 -20
  19. package/dist/cli/{chunk-W3HLZ24Q.js → chunk-6B5EZOI3.js} +10 -10
  20. package/dist/cli/{chunk-YOST7EJF.js → chunk-6GZIT3TH.js} +20 -20
  21. package/dist/cli/{chunk-72WI67H4.mjs → chunk-7334X74C.mjs} +2 -2
  22. package/dist/cli/{chunk-PI4TKE2B.js → chunk-7GQU46SZ.js} +26 -26
  23. package/dist/cli/{chunk-NOKSEYMS.js → chunk-7UR57HPJ.js} +1 -1
  24. package/dist/cli/{chunk-6ASDTHEN.js → chunk-AFPGYZBH.js} +21 -17
  25. package/dist/cli/{chunk-V2W7GX2I.mjs → chunk-B2XLIQPH.mjs} +3 -3
  26. package/dist/cli/{chunk-XNJXRS3B.js → chunk-BUBOZKH2.js} +2 -2
  27. package/dist/cli/{chunk-K4LAEKHS.js → chunk-D6ZVRKJ2.js} +41 -41
  28. package/dist/cli/{chunk-5VUD7HGD.js → chunk-DG56RWI2.js} +2 -2
  29. package/dist/cli/{chunk-UKD5ZBQD.js → chunk-DOZIWA66.js} +7 -7
  30. package/dist/cli/{chunk-EKWDSE6H.mjs → chunk-DX646HO7.mjs} +4 -4
  31. package/dist/cli/{chunk-43GCEVHO.js → chunk-ECLCRE5P.js} +3 -3
  32. package/dist/cli/{chunk-UUYB6IXC.js → chunk-G2HW2SAP.js} +13 -13
  33. package/dist/cli/{chunk-BWWDU6FN.mjs → chunk-G7OR3GVD.mjs} +5 -5
  34. package/dist/cli/{chunk-UQWYDNGB.mjs → chunk-GMQZFWQU.mjs} +17 -10
  35. package/dist/cli/{chunk-VGPHXXPI.js → chunk-H7PVSG3L.js} +15 -15
  36. package/dist/cli/{chunk-EL4LME5Y.js → chunk-I62ZBEKH.js} +48 -48
  37. package/dist/cli/{chunk-QA733N7N.mjs → chunk-IA2LTIWO.mjs} +2 -2
  38. package/dist/cli/{chunk-FGBX2WVJ.js → chunk-IB225ZK4.js} +4 -4
  39. package/dist/cli/{chunk-VZ4S5JRC.js → chunk-ID3LGPOE.js} +23 -23
  40. package/dist/cli/{chunk-LHPYCJNL.js → chunk-IXYVHTRZ.js} +19 -6
  41. package/dist/cli/{chunk-64MOX3SN.mjs → chunk-JCO226JM.mjs} +111 -2
  42. package/dist/cli/{chunk-SJI56XPM.mjs → chunk-JY7RKJ65.mjs} +21 -16
  43. package/dist/cli/{chunk-N6KF6X3D.js → chunk-KSHZY52O.js} +114 -5
  44. package/dist/cli/{chunk-BM4GE67C.mjs → chunk-L2NXB4WG.mjs} +19 -6
  45. package/dist/cli/{chunk-UFUXGMHL.mjs → chunk-LCAXLGAY.mjs} +2 -2
  46. package/dist/cli/{chunk-AHNJGA6Z.js → chunk-LJLM4BUL.js} +6 -6
  47. package/dist/cli/{chunk-EKIWY5DD.mjs → chunk-LLSCFLFU.mjs} +1 -1
  48. package/dist/cli/{chunk-OUVQKSVC.mjs → chunk-MAMGREBW.mjs} +1 -1
  49. package/dist/cli/{chunk-CYW6PE3G.mjs → chunk-MGF3MK27.mjs} +5 -5
  50. package/dist/cli/{chunk-PZGK6EEB.js → chunk-N6I3BB2O.js} +280 -275
  51. package/dist/cli/{chunk-4W5EFHHY.js → chunk-NDDGFX4X.js} +11 -11
  52. package/dist/cli/{chunk-RIA73OAZ.mjs → chunk-NRVEVKXR.mjs} +2 -2
  53. package/dist/cli/{chunk-UY6Z3XWW.mjs → chunk-OH6WOID2.mjs} +2 -2
  54. package/dist/cli/{chunk-GX4VZL4Z.mjs → chunk-OIZUFRTE.mjs} +3 -3
  55. package/dist/cli/{chunk-3SFLY3T3.js → chunk-PP5RMEQQ.js} +5 -5
  56. package/dist/cli/{chunk-UMP76GYQ.mjs → chunk-PW6NKI2A.mjs} +3 -3
  57. package/dist/cli/{chunk-ENHQBPR5.mjs → chunk-Q3A53SWK.mjs} +4 -3
  58. package/dist/cli/{chunk-X6F4XOT2.mjs → chunk-QPSBV4FD.mjs} +2 -2
  59. package/dist/cli/{chunk-6R57HEPF.mjs → chunk-S22FSNNC.mjs} +1 -1
  60. package/dist/cli/{chunk-XVQE6IBS.js → chunk-SLXCVPN7.js} +2 -2
  61. package/dist/cli/{chunk-AJO3I3LL.mjs → chunk-SRUNYWQ2.mjs} +9 -1
  62. package/dist/cli/{chunk-5EMYPLTW.js → chunk-UXIUAIL2.js} +53 -53
  63. package/dist/cli/{chunk-MVQ5XGRO.mjs → chunk-VGIDPJXM.mjs} +3 -3
  64. package/dist/cli/{chunk-PRDCU7BY.js → chunk-VLUBEMWM.js} +20 -20
  65. package/dist/cli/{chunk-W3RHISD6.js → chunk-VYSUJMB5.js} +8 -8
  66. package/dist/cli/{chunk-W742U53L.mjs → chunk-W6UCS3O6.mjs} +5 -5
  67. package/dist/cli/{chunk-Q6H5RRTG.mjs → chunk-X7RKCAMX.mjs} +4 -4
  68. package/dist/cli/{chunk-TBLP7HDL.js → chunk-XMBTAPHR.js} +10 -9
  69. package/dist/cli/{chunk-EDAG7ZU4.mjs → chunk-XVBEEGI4.mjs} +1 -1
  70. package/dist/cli/{chunk-JJEN7TRR.mjs → chunk-YR4REP4D.mjs} +1 -1
  71. package/dist/cli/{chunk-QMIMGKR2.js → chunk-Z3XFXFRT.js} +9 -9
  72. package/dist/cli/{chunk-JEI7PHET.mjs → chunk-ZFXDD7VM.mjs} +1 -1
  73. package/dist/cli/{chunk-HUJMFETO.mjs → chunk-ZTCP5BHH.mjs} +7 -3
  74. package/dist/cli/command-docs.js +3 -3
  75. package/dist/cli/command-docs.mjs +2 -2
  76. package/dist/cli/concurrent-runs-help-BFVCUJF4.js +22 -0
  77. package/dist/cli/{concurrent-runs-help-5BKCGFGL.mjs → concurrent-runs-help-ROQM6UB3.mjs} +7 -7
  78. package/dist/cli/{csv-7ZAWND7L.js → csv-FWGSY4GE.js} +13 -13
  79. package/dist/cli/{csv-MO5WZZDN.mjs → csv-R7GV33BC.mjs} +4 -4
  80. package/dist/cli/{db-36LX7JBQ.js → db-OCH35YJG.js} +27 -27
  81. package/dist/cli/{db-OYMULINA.mjs → db-UWXA4RRV.mjs} +6 -6
  82. package/dist/cli/describe-6OI5K2SH.js +50 -0
  83. package/dist/cli/{describe-JLAERB6X.mjs → describe-QI4HMUGE.mjs} +21 -21
  84. package/dist/cli/describe-core.d.mts +4 -2
  85. package/dist/cli/describe-core.d.ts +4 -2
  86. package/dist/cli/describe-core.js +4 -4
  87. package/dist/cli/describe-core.mjs +3 -3
  88. package/dist/cli/{executions-AQ32J4BZ.js → executions-7CFGC24E.js} +8 -8
  89. package/dist/cli/{executions-IZAB2XNC.mjs → executions-YF3KMZZN.mjs} +6 -6
  90. package/dist/cli/{feedback-WA6EBE5H.mjs → feedback-DWIWBS7O.mjs} +6 -6
  91. package/dist/cli/{feedback-3IV54HOH.js → feedback-YCZHHSBS.js} +14 -14
  92. package/dist/cli/git-TGLNZRS3.js +26 -0
  93. package/dist/cli/{git-OSLU6HIK.mjs → git-XCGMQQOD.mjs} +5 -5
  94. package/dist/cli/index.js +152 -148
  95. package/dist/cli/index.mjs +51 -47
  96. package/dist/cli/{integrations-WOXFOC4M.mjs → integrations-5ABAJBSW.mjs} +7 -7
  97. package/dist/cli/{integrations-65SYNL53.js → integrations-IEZA3TGK.js} +29 -29
  98. package/dist/cli/{legacy-noops-3SGXDAV6.js → legacy-noops-KNFLJ5P2.js} +9 -9
  99. package/dist/cli/{legacy-noops-4FNG2JY3.mjs → legacy-noops-OZMY73Y3.mjs} +6 -6
  100. package/dist/cli/{mcp-PX27RHCY.js → mcp-NLQAO7KP.js} +24 -24
  101. package/dist/cli/{mcp-RZLWMZHH.mjs → mcp-WSPFKQPZ.mjs} +4 -4
  102. package/dist/cli/{monitors-F5BLGS4R.js → monitors-BJYOB4S3.js} +100 -100
  103. package/dist/cli/{monitors-VK2LW7VU.mjs → monitors-LPKFFTOX.mjs} +7 -7
  104. package/dist/cli/{org-7AEBTN6Y.mjs → org-RYPMUYUW.mjs} +6 -6
  105. package/dist/cli/{org-UU3V7U4K.js → org-WIVHI4WT.js} +121 -121
  106. package/dist/cli/{outcomes-BWERSUJL.mjs → outcomes-FADJYC4I.mjs} +9 -7
  107. package/dist/cli/{outcomes-GCTBGPMK.js → outcomes-QKX7IE3O.js} +17 -15
  108. package/dist/cli/{play-TX3RAAYS.mjs → play-4ZKK5Q7U.mjs} +88 -33
  109. package/dist/cli/{play-7NBCCL26.js → play-ID73J3NP.js} +393 -338
  110. package/dist/cli/{providers-KFWZXDCV.mjs → providers-LURYBSNO.mjs} +6 -6
  111. package/dist/cli/{providers-IL2IVKHB.js → providers-WCCGYGW6.js} +9 -9
  112. package/dist/cli/{quickstart-RAMDGRRI.mjs → quickstart-KCCSEE5J.mjs} +4 -4
  113. package/dist/cli/{quickstart-MPA6TUK5.js → quickstart-LVPOU25V.js} +6 -6
  114. package/dist/cli/{run-WBUSXBUS.js → run-2QMJRCVA.js} +48 -48
  115. package/dist/cli/{run-QNJSKPBN.mjs → run-XXK7DDUF.mjs} +26 -26
  116. package/dist/cli/search-AQSAXA6D.js +32 -0
  117. package/dist/cli/{search-2X4P2FXR.mjs → search-ZYAWW3CK.mjs} +7 -7
  118. package/dist/cli/{search-output-MNJ4AQLV.mjs → search-output-N45AIOB4.mjs} +9 -6
  119. package/dist/cli/{search-output-P2WNCHA3.js → search-output-YNXAZSKT.js} +12 -9
  120. package/dist/cli/{secrets-XX54OU22.mjs → secrets-7Q3AOUAS.mjs} +6 -6
  121. package/dist/cli/{secrets-K5CNDUVR.js → secrets-MHT27L2M.js} +15 -15
  122. package/dist/cli/{sessions-C4GQ6ZVO.mjs → sessions-6QKOM7M3.mjs} +6 -6
  123. package/dist/cli/sessions-RGD7L4LC.js +23 -0
  124. package/dist/cli/{settings-7HBTADGW.mjs → settings-NPVIDENI.mjs} +12 -12
  125. package/dist/cli/{settings-QP3DVFPS.js → settings-OP7Q6YX6.js} +85 -85
  126. package/dist/cli/{setup-VPDAKY2G.mjs → setup-OOT3EIMF.mjs} +9 -9
  127. package/dist/cli/{setup-X6J7U6B4.js → setup-RT6GHL3W.js} +49 -49
  128. package/dist/cli/skills-ERAA734H.js +37 -0
  129. package/dist/cli/{skills-UGY6W4AC.mjs → skills-TEXI4CLZ.mjs} +7 -7
  130. package/dist/cli/tools-D5SZSIIH.js +57 -0
  131. package/dist/cli/{tools-SVBUAHDD.mjs → tools-G5L36M3X.mjs} +19 -19
  132. package/dist/cli/update-WZ6527EF.js +37 -0
  133. package/dist/cli/{update-SDNKNDNW.mjs → update-YNKQTE4D.mjs} +9 -9
  134. package/dist/cli/{views-M6RBPC65.mjs → views-IQFMUMLU.mjs} +6 -6
  135. package/dist/cli/{views-JBFSHQBU.js → views-OVQ5AQAU.js} +21 -21
  136. package/dist/cli/{workflow-UAMTGHQC.js → workflow-RCBYXIFZ.js} +17 -17
  137. package/dist/cli/{workflow-RYVRAIHV.mjs → workflow-Y5IFMI7N.mjs} +7 -7
  138. package/dist/{client-DCnExziW.d.ts → client-BrdMPFCM.d.ts} +1 -1
  139. package/dist/{client-ClJlqkKt.d.mts → client-CF-bsrtI.d.mts} +1 -1
  140. package/dist/{client-core-DAOPQnGD.d.mts → client-core-DM1ZedOG.d.mts} +8 -0
  141. package/dist/{client-core-BKq5ZNAl.d.ts → client-core-rMoUWSYM.d.ts} +8 -0
  142. package/dist/index.d.mts +3 -3
  143. package/dist/index.d.ts +3 -3
  144. package/dist/index.js +9 -9
  145. package/dist/index.mjs +6 -6
  146. package/dist/install-integrity.json +128 -126
  147. package/dist/plays/play-description.d.mts +1 -1
  148. package/dist/plays/play-description.d.ts +1 -1
  149. package/dist/plays/run-request.d.mts +1 -1
  150. package/dist/plays/run-request.d.ts +1 -1
  151. package/dist/release.d.mts +1 -1
  152. package/dist/release.d.ts +1 -1
  153. package/dist/release.js +2 -2
  154. package/dist/release.mjs +1 -1
  155. package/dist/server.d.mts +2 -2
  156. package/dist/server.d.ts +2 -2
  157. package/dist/server.js +5 -5
  158. package/dist/server.mjs +3 -3
  159. package/package.json +1 -1
  160. package/dist/cli/auth-PXIVGUVZ.js +0 -44
  161. package/dist/cli/concurrent-runs-help-KGELXJIQ.js +0 -22
  162. package/dist/cli/describe-AVGE4MH6.js +0 -50
  163. package/dist/cli/git-VOFO6V5W.js +0 -26
  164. package/dist/cli/search-CJHG3VA4.js +0 -32
  165. package/dist/cli/sessions-3RMRBBJZ.js +0 -23
  166. package/dist/cli/skills-JUGXGSX2.js +0 -37
  167. package/dist/cli/tools-ZEI42NSP.js +0 -57
  168. package/dist/cli/update-VC4UEGMR.js +0 -37
  169. /package/dist/cli/{chunk-2RIKOPIM.mjs → chunk-HECXJBED.mjs} +0 -0
  170. /package/dist/cli/{chunk-H4ALLC2X.js → chunk-TJCENACZ.js} +0 -0
@@ -1028,6 +1028,25 @@ function activeOrganizationFromEnv(
1028
1028
  return { org_id: orgId, org_name: orgName };
1029
1029
  }
1030
1030
 
1031
+ /**
1032
+ * The org a dashboard link printed for `baseUrl` is for: the one saved with
1033
+ * the credential the CLI resolves for that host, or null when none is saved.
1034
+ * The dashboard only switches to it for a member, so a link carries it as a
1035
+ * request, never as authority.
1036
+ */
1037
+ export function resolveCliDashboardOrgId(baseUrl: string): string | null {
1038
+ // ponytail: the default credential for the host; a command run with an
1039
+ // explicit key or --auth-scope still links the default credential's org.
1040
+ const apiKey = resolveApiKeyForBaseUrl(baseUrl);
1041
+ if (!apiKey) return null;
1042
+ const normalized = normalizeBaseUrl(baseUrl);
1043
+ if (!normalized) return null;
1044
+ return (
1045
+ resolveCliCommandContext({ baseUrl: normalized, apiKey })
1046
+ .active_organization?.org_id ?? null
1047
+ );
1048
+ }
1049
+
1031
1050
  /**
1032
1051
  * Resolve display-only organization metadata from the exact credential source
1033
1052
  * selected for this CLI process. The metadata never participates in routing.
@@ -564,9 +564,7 @@ type DocflowHelperObserver = {
564
564
  */
565
565
  export function __deeplineCurrentDocflowContext(): DocflowHelperObserver | null {
566
566
  const context =
567
- docflowRunContexts?.getStore() ??
568
- scriptRuns.getStore()?.context ??
569
- null;
567
+ docflowRunContexts?.getStore() ?? scriptRuns.getStore()?.context ?? null;
570
568
  if (!context) return null;
571
569
  // Display-only: a context that cannot be read is no context at all.
572
570
  let observe: unknown;
@@ -581,7 +579,12 @@ export function __deeplineCurrentDocflowContext(): DocflowHelperObserver | null
581
579
  }
582
580
  if (typeof observe !== 'function') return null;
583
581
  return {
584
- __deeplineObserveDocflowNode: (nodeId, inputCaptures, outputPaths, execute) =>
582
+ __deeplineObserveDocflowNode: (
583
+ nodeId,
584
+ inputCaptures,
585
+ outputPaths,
586
+ execute,
587
+ ) =>
585
588
  observe.call(context, nodeId, inputCaptures, outputPaths, execute, {
586
589
  origin: 'helper',
587
590
  }),
@@ -205,7 +205,7 @@ export const SDK_RELEASE = {
205
205
  // getters keep their established compatibility behavior.
206
206
  // 0.3.1 deprecated the legacy `deepline enrich` command in favor of Plays.
207
207
  // 0.3.90 is the first deliberately versioned SDK release for API v3.
208
- version: '0.3.572',
208
+ version: '0.3.574',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -315,6 +315,14 @@ export interface ToolDefinition extends ToolExecutionMetadataFields {
315
315
  }>;
316
316
  /** User-facing pricing summary. Internal provider/settlement costs are intentionally omitted. */
317
317
  pricing?: ToolPricingSummary | null;
318
+ /**
319
+ * Set when the tool runs on this workspace's own provider key, so Deepline
320
+ * charges 0 credits: `own_provider_credentials` (the provider bills the
321
+ * workspace) or `free` (free on Deepline). Absent for managed pricing.
322
+ */
323
+ billingSource?: string;
324
+ /** Display label for {@link billingSource}: "your key" on a saved key. */
325
+ billingSourceLabel?: string;
318
326
  /** How to use the tool well: the provider's summary and the tool's own notes. */
319
327
  guidance?: { provider?: string; tool?: string };
320
328
  /** Copyable play-runtime guidance for V2 tool execution results. */
@@ -299,7 +299,7 @@ export class DaytonaLaunchOutcomeUnknownError extends Error {
299
299
  }
300
300
  }
301
301
 
302
- function providerError(error: unknown): unknown {
302
+ function providerError(error: unknown, emptyBody = false): unknown {
303
303
  if (!axios.isAxiosError(error)) return error;
304
304
  const status = error.response?.status;
305
305
  const data = error.response?.data;
@@ -324,12 +324,29 @@ function providerError(error: unknown): unknown {
324
324
  429: DaytonaRateLimitError,
325
325
  };
326
326
  const ErrorClass = errorClasses[status ?? 0] ?? DaytonaError;
327
- return new ErrorClass(
327
+ const failure = new ErrorClass(
328
328
  message,
329
329
  status,
330
330
  undefined,
331
331
  typeof data?.code === 'string' ? data.code : error.code,
332
332
  );
333
+ if (status !== undefined && emptyBody) {
334
+ // Not enumerable, so serialized errors keep their existing shape.
335
+ Object.defineProperty(failure, 'emptyResponseBody', { value: true });
336
+ }
337
+ return failure;
338
+ }
339
+
340
+ /**
341
+ * Daytona answered with an HTTP status and a body of zero bytes: no message and
342
+ * no code of its own. Only this client's transport records it, as a field, so
343
+ * callers never read it from the message.
344
+ */
345
+ export function daytonaResponseBodyWasEmpty(error: unknown): boolean {
346
+ return (
347
+ isDaytonaProviderError(error) &&
348
+ (error as { emptyResponseBody?: unknown }).emptyResponseBody === true
349
+ );
333
350
  }
334
351
 
335
352
  /** Every SDK request owns its socket deadline, including streamed response bodies. */
@@ -338,8 +355,26 @@ function createTransport(signal: () => AbortSignal | undefined) {
338
355
  InternalAxiosRequestConfig,
339
356
  { finish(): void; signal: AbortSignal }
340
357
  >();
358
+ // Each answer's body size before axios decodes it. A decoded `null` or `""`
359
+ // came from a body, so only zero raw bytes counts as no body. A body this
360
+ // cannot measure, such as a stream, is never recorded as empty.
361
+ const rawBodyBytes = new WeakMap<InternalAxiosRequestConfig, number>();
362
+ function recordRawBody(this: InternalAxiosRequestConfig, body: unknown) {
363
+ const bytes =
364
+ typeof body === 'string'
365
+ ? Buffer.byteLength(body)
366
+ : Buffer.isBuffer(body) || body instanceof ArrayBuffer
367
+ ? body.byteLength
368
+ : undefined;
369
+ if (bytes !== undefined) rawBodyBytes.set(this, bytes);
370
+ return body;
371
+ }
341
372
  const transport = axios.create();
342
373
  transport.interceptors.request.use((request) => {
374
+ request.transformResponse = [
375
+ recordRawBody,
376
+ ...[request.transformResponse ?? []].flat(),
377
+ ];
343
378
  const controller = new AbortController();
344
379
  // Honor the SDK's shorter command/delete windows; upload gets at most the
345
380
  // existing 90s staging budget even without an enclosing phase scope.
@@ -389,13 +424,14 @@ function createTransport(signal: () => AbortSignal | undefined) {
389
424
  return response;
390
425
  },
391
426
  (error: unknown) => {
392
- const scope =
393
- axios.isAxiosError(error) && error.config
394
- ? active.get(error.config)
395
- : undefined;
427
+ const config = axios.isAxiosError(error) ? error.config : undefined;
428
+ const scope = config ? active.get(config) : undefined;
396
429
  scope?.finish();
397
430
  if (scope?.signal.aborted) throw scope.signal.reason;
398
- throw providerError(error);
431
+ throw providerError(
432
+ error,
433
+ config !== undefined && rawBodyBytes.get(config) === 0,
434
+ );
399
435
  },
400
436
  );
401
437
  return transport;
@@ -45,6 +45,10 @@ import type {
45
45
  DaytonaSandbox,
46
46
  DaytonaStageEmitter,
47
47
  } from './daytona-lifecycle';
48
+ import {
49
+ daytonaErrorStatusForLog,
50
+ daytonaResponseBodyWasEmpty,
51
+ } from './daytona-launch-transport';
48
52
  import {
49
53
  buildDaytonaRuntimeWatchdogSource,
50
54
  PLAY_RUNNER_UV_THREADPOOL_SIZE,
@@ -143,19 +147,34 @@ function bakedRunnerGuardPrefix(verify?: {
143
147
  export class DaytonaNodeUnavailableError extends Error {
144
148
  constructor(
145
149
  readonly diagnostic: {
146
- reason: 'command_failed' | 'empty_output';
150
+ reason: 'command_failed' | 'empty_output' | 'provider_rejected';
147
151
  exitCode: number | null;
148
152
  attempts: number;
149
153
  responseBytes: number;
150
154
  },
155
+ options?: { cause?: unknown },
151
156
  ) {
152
157
  super(
153
158
  `Daytona Node executable was not ready before payload staging (${diagnostic.reason}, exit ${diagnostic.exitCode ?? 'unknown'}).`,
159
+ options,
154
160
  );
155
161
  this.name = 'DaytonaNodeUnavailableError';
156
162
  }
157
163
  }
158
164
 
165
+ /**
166
+ * Daytona refused the readiness read with a bare 400: no message and no code.
167
+ * A sandbox whose toolbox is still starting answers this way, and the read
168
+ * sends no payload or customer command, so it is read again. A 400 that says
169
+ * anything stays loud: it would fail the same way on every sandbox.
170
+ */
171
+ function isUnexplainedDaytonaRejection(error: unknown): error is Error {
172
+ return (
173
+ daytonaErrorStatusForLog(error) === 400 &&
174
+ daytonaResponseBodyWasEmpty(error)
175
+ );
176
+ }
177
+
159
178
  /**
160
179
  * A prebaked runner the launcher expects in the sandbox image. `verified`
161
180
  * settles with whether the sandbox itself proved the file exists and hashes to
@@ -1415,31 +1434,48 @@ export async function stageDaytonaRunnerPayload(
1415
1434
  // provider's actual Node executable before constructing either launcher.
1416
1435
  const nodeStartedAt = Date.now();
1417
1436
  // A started sandbox may still be bringing its toolbox/runtime online. Retry
1418
- // only an unsuccessful or empty readiness read on this same sandbox before
1419
- // handing the pre-code failure back to the existing startup recovery owner.
1437
+ // only an unsuccessful or empty readiness read, or a bare 400 rejection of
1438
+ // it, on this same sandbox before handing the pre-code failure back to the
1439
+ // existing startup recovery owner.
1420
1440
  const retryDelaysMs = [0, 150, 350] as const;
1421
1441
  let node!: Awaited<ReturnType<DaytonaSandbox['process']['executeCommand']>>;
1422
1442
  for (const [attempt, delayMs] of retryDelaysMs.entries()) {
1423
1443
  if (delayMs) await new Promise((resolve) => setTimeout(resolve, delayMs));
1424
- node = await input.sandbox.process.executeCommand(
1425
- 'node -p process.execPath',
1426
- input.workDir,
1427
- {},
1428
- 5,
1429
- );
1430
- if (node.exitCode === 0 && node.result.trim() !== '') break;
1431
- const diagnostic = {
1432
- reason: node.exitCode === 0 ? 'empty_output' : 'command_failed',
1433
- exitCode:
1434
- typeof node.exitCode === 'number' && Number.isInteger(node.exitCode)
1435
- ? node.exitCode
1436
- : null,
1437
- attempts: attempt + 1,
1438
- responseBytes: Buffer.byteLength(node.result),
1439
- } satisfies DaytonaNodeUnavailableError['diagnostic'];
1444
+ let rejection: Error | undefined;
1445
+ try {
1446
+ node = await input.sandbox.process.executeCommand(
1447
+ 'node -p process.execPath',
1448
+ input.workDir,
1449
+ {},
1450
+ 5,
1451
+ );
1452
+ } catch (error) {
1453
+ if (!isUnexplainedDaytonaRejection(error)) throw error;
1454
+ rejection = error;
1455
+ }
1456
+ if (!rejection && node.exitCode === 0 && node.result.trim() !== '') break;
1457
+ const diagnostic: DaytonaNodeUnavailableError['diagnostic'] = rejection
1458
+ ? {
1459
+ reason: 'provider_rejected',
1460
+ exitCode: null,
1461
+ attempts: attempt + 1,
1462
+ responseBytes: 0,
1463
+ }
1464
+ : {
1465
+ reason: node.exitCode === 0 ? 'empty_output' : 'command_failed',
1466
+ exitCode:
1467
+ typeof node.exitCode === 'number' && Number.isInteger(node.exitCode)
1468
+ ? node.exitCode
1469
+ : null,
1470
+ attempts: attempt + 1,
1471
+ responseBytes: Buffer.byteLength(node.result),
1472
+ };
1440
1473
  input.emitStage('runtime:node_unavailable', diagnostic);
1441
1474
  if (attempt === retryDelaysMs.length - 1) {
1442
- throw new DaytonaNodeUnavailableError(diagnostic);
1475
+ throw new DaytonaNodeUnavailableError(
1476
+ diagnostic,
1477
+ rejection ? { cause: rejection } : undefined,
1478
+ );
1443
1479
  }
1444
1480
  }
1445
1481
  const nodeBinaryPath = node.result.trim();
@@ -301,9 +301,10 @@ export const RUNTIME_FAST_LAUNCH_PROFILE: RuntimeSpeedProfileId =
301
301
  export const RUNTIME_FAST_LAUNCH_ORGANIZATION_PROFILES: Readonly<
302
302
  Record<string, RuntimeSpeedProfileId>
303
303
  > = {
304
- // Internal Deepline workspace: the one org granted EN for its Production
305
- // measurement. Rollback is this entry back to 'fast_launch@4', or removal.
306
- jh772jvn83r6be5kpcjn6rcqj182tgre: 'fast_launch@7',
304
+ // Internal Deepline workspace: the one org granted early start (EN, then
305
+ // PX + CA) for its Production measurement. Rollback is this entry back to
306
+ // 'fast_launch@7' (its previous Production pin), or 'fast_launch@4', or removal.
307
+ jh772jvn83r6be5kpcjn6rcqj182tgre: 'fast_launch@8',
307
308
  };
308
309
 
309
310
  /** The profile the rollout grants to this organization. */