deepline 0.3.544 → 0.3.546

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 (192) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +5 -0
  2. package/dist/bundling-sources/sdk/src/errors.ts +1 -1
  3. package/dist/bundling-sources/sdk/src/http-core.ts +41 -12
  4. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  5. package/dist/bundling-sources/shared_libs/monitors/fleets/errors.ts +5 -0
  6. package/dist/bundling-sources/shared_libs/monitors/fleets/issues.ts +5 -1
  7. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +6 -0
  8. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +35 -3
  9. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +2 -2
  10. package/dist/bundling-sources/shared_libs/play-data-plane/contracts.ts +5 -0
  11. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-contract.ts +27 -0
  12. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +4 -0
  13. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +8 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/fleet-sandbox-sweep.ts +40 -3
  15. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +19 -3
  16. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +18 -4
  17. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +441 -103
  18. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox-egress.ts +322 -0
  19. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +200 -64
  20. package/dist/bundling-sources/shared_libs/play-runtime/runtime-speed-profile.ts +65 -2
  21. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +5 -3
  22. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +32 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +206 -12
  24. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +10 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +30 -2
  26. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +30 -1
  27. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +35 -2
  28. package/dist/bundling-sources/shared_libs/security/email-blacklist.ts +35 -1
  29. package/dist/bundling-sources/shared_libs/security/email-domain.ts +19 -0
  30. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +2 -0
  31. package/dist/cli/{auth-IMWJAHPU.mjs → auth-KFWG72AZ.mjs} +6 -6
  32. package/dist/cli/auth-W32GMYND.js +43 -0
  33. package/dist/cli/{billing-YQMW3QJI.mjs → billing-MMZ336HO.mjs} +10 -10
  34. package/dist/cli/{billing-Y55PR2PV.js → billing-OQVOAZ4S.js} +98 -98
  35. package/dist/cli/{chunk-RJPDCSTD.mjs → chunk-3DUNNZB6.mjs} +4 -4
  36. package/dist/cli/{chunk-G26VJCNT.js → chunk-4AZLGNXV.js} +36 -26
  37. package/dist/cli/{chunk-Y3T5GWYK.mjs → chunk-5OEFXAKP.mjs} +5 -1
  38. package/dist/cli/{chunk-RG34YBDE.js → chunk-5V7NZKGG.js} +2 -2
  39. package/dist/cli/{chunk-UHIAQPVA.js → chunk-5VNQMVCU.js} +26 -26
  40. package/dist/cli/{chunk-PDJ4UDCO.js → chunk-5W4ENHWM.js} +12 -12
  41. package/dist/cli/{chunk-3JDA23NN.mjs → chunk-6FBDTYR2.mjs} +2 -2
  42. package/dist/cli/{chunk-KE6CSCUF.js → chunk-6LG7MLJ2.js} +44 -44
  43. package/dist/cli/{chunk-HXM2JUGD.mjs → chunk-6Y5TU3R7.mjs} +2 -2
  44. package/dist/cli/{chunk-PFGOCUH3.mjs → chunk-7MY7KWJS.mjs} +1 -1
  45. package/dist/cli/{chunk-57G4NYOL.mjs → chunk-7ZW67ME6.mjs} +1 -1
  46. package/dist/cli/{chunk-JBWOE6AP.js → chunk-BTFUAGHC.js} +16 -16
  47. package/dist/cli/{chunk-5PR4VLLL.mjs → chunk-EEG46QZY.mjs} +2 -2
  48. package/dist/cli/{chunk-3I26HMJ7.js → chunk-EEJHB76U.js} +9 -9
  49. package/dist/cli/{chunk-2GJZLIKW.js → chunk-EITMD3A5.js} +1 -1
  50. package/dist/cli/{chunk-Z44YTSTA.js → chunk-F2VEFMU5.js} +13 -13
  51. package/dist/cli/{chunk-4JQEAYN3.js → chunk-F5YQXCP3.js} +5 -1
  52. package/dist/cli/{chunk-BEQ7RQLT.mjs → chunk-GOOF7E2B.mjs} +5 -5
  53. package/dist/cli/{chunk-PMW5YP72.mjs → chunk-GYTSDSQD.mjs} +11 -11
  54. package/dist/cli/{chunk-ZY6FL4O4.js → chunk-H7Q5IDO3.js} +19 -19
  55. package/dist/cli/{chunk-GV45TTI6.mjs → chunk-HJR2DDJS.mjs} +2 -2
  56. package/dist/cli/{chunk-7HMMTSDA.js → chunk-IVWU7SJC.js} +5 -5
  57. package/dist/cli/{chunk-WBSGPLH5.mjs → chunk-J65HJCJO.mjs} +2 -2
  58. package/dist/cli/{chunk-REEOMNCO.mjs → chunk-JA633HRV.mjs} +3 -3
  59. package/dist/cli/{chunk-HVJQF5BI.mjs → chunk-JARZ47OP.mjs} +2 -2
  60. package/dist/cli/{chunk-IFIJ4DBJ.js → chunk-JCH4UNNS.js} +2 -2
  61. package/dist/cli/{chunk-COJHT2KF.js → chunk-JCWNF44W.js} +22 -22
  62. package/dist/cli/{chunk-3KGMM4KS.js → chunk-JVOUQFHT.js} +1 -1
  63. package/dist/cli/{chunk-W7X4KH45.js → chunk-JYG4XZLT.js} +99 -99
  64. package/dist/cli/{chunk-HBSWATOU.mjs → chunk-K2XELBPF.mjs} +5 -5
  65. package/dist/cli/{chunk-HAQRF6DJ.mjs → chunk-KUK7ARXA.mjs} +2 -2
  66. package/dist/cli/{chunk-WUEORIOY.mjs → chunk-LHE2TSV6.mjs} +1 -1
  67. package/dist/cli/{chunk-7GNZEOTH.js → chunk-LIJKRDDG.js} +6 -6
  68. package/dist/cli/{chunk-SKS53WM6.mjs → chunk-LX2TC3HO.mjs} +4 -4
  69. package/dist/cli/{chunk-GQHRGBHV.js → chunk-MEGHIX4M.js} +5 -5
  70. package/dist/cli/{chunk-H4SAHB3Q.mjs → chunk-MI7X6V6V.mjs} +3 -3
  71. package/dist/cli/{chunk-ON56ISO6.js → chunk-MXQP7CXZ.js} +8 -8
  72. package/dist/cli/{chunk-PKRW76XG.js → chunk-ND7SFRQL.js} +2 -2
  73. package/dist/cli/{chunk-CQBIO6HW.mjs → chunk-NURW5XH4.mjs} +1 -1
  74. package/dist/cli/{chunk-Q7ZOWNKR.mjs → chunk-OAKWSLKS.mjs} +2 -2
  75. package/dist/cli/{chunk-SK3HPU2J.mjs → chunk-P7A3H6G5.mjs} +1 -1
  76. package/dist/cli/{chunk-UNMNGRPB.js → chunk-PMDHY2YK.js} +7 -7
  77. package/dist/cli/{chunk-LW274RO7.mjs → chunk-PU3ZAG6V.mjs} +1 -1
  78. package/dist/cli/{chunk-ZHY4T5M6.mjs → chunk-RO66FPTS.mjs} +22 -12
  79. package/dist/cli/{chunk-DYDHLBSK.js → chunk-SH32HL7I.js} +53 -53
  80. package/dist/cli/{chunk-DF2X7GJG.js → chunk-SYTWWVIQ.js} +5 -5
  81. package/dist/cli/{chunk-JWVG7ZPX.js → chunk-TBWYZOSV.js} +3 -3
  82. package/dist/cli/{chunk-RUFR4PUO.js → chunk-UQJBV5PM.js} +10 -10
  83. package/dist/cli/{chunk-LPUBBUKX.mjs → chunk-UREAIHUU.mjs} +2 -2
  84. package/dist/cli/{chunk-22OBDYHP.js → chunk-VAT2SXFF.js} +12 -12
  85. package/dist/cli/{chunk-LQ6RRYXN.mjs → chunk-VPERQ3U6.mjs} +5 -5
  86. package/dist/cli/{chunk-456RRXAP.mjs → chunk-VTK3HGMN.mjs} +5 -5
  87. package/dist/cli/{chunk-DVDWAC2M.mjs → chunk-VXTTAYOT.mjs} +2 -2
  88. package/dist/cli/{chunk-4PKHFW56.js → chunk-WKHPLBJK.js} +15 -15
  89. package/dist/cli/{chunk-YIRVKMON.mjs → chunk-X5KOHDJN.mjs} +1 -1
  90. package/dist/cli/{chunk-C4P2KLWT.js → chunk-Z3UEBFIN.js} +41 -41
  91. package/dist/cli/command-docs.js +2 -2
  92. package/dist/cli/command-docs.mjs +1 -1
  93. package/dist/cli/concurrent-runs-help-6QT7ZR4W.js +21 -0
  94. package/dist/cli/{concurrent-runs-help-KBWPKSTP.mjs → concurrent-runs-help-C2O5YKQA.mjs} +7 -7
  95. package/dist/cli/{csv-XGGDZTQI.js → csv-MJDNOIQJ.js} +14 -14
  96. package/dist/cli/{csv-M5EBEMZH.mjs → csv-Z4DNGR54.mjs} +5 -5
  97. package/dist/cli/{db-M6FJ6J6E.mjs → db-4RL2BNOF.mjs} +7 -7
  98. package/dist/cli/{db-CVPR54XK.js → db-S5QVPK5E.js} +32 -32
  99. package/dist/cli/{describe-X6QA2U3C.mjs → describe-L4P5SZLQ.mjs} +19 -19
  100. package/dist/cli/describe-VLU2LUDJ.js +50 -0
  101. package/dist/cli/describe-core.d.mts +3 -3
  102. package/dist/cli/describe-core.d.ts +3 -3
  103. package/dist/cli/describe-core.js +1 -1
  104. package/dist/cli/describe-core.mjs +1 -1
  105. package/dist/cli/{executions-VJEEWN22.js → executions-MFZ2Z36O.js} +9 -9
  106. package/dist/cli/{executions-EHTS2XJX.mjs → executions-RR6O3XK5.mjs} +7 -7
  107. package/dist/cli/{feedback-76VGY4GP.mjs → feedback-EQBQ3ABB.mjs} +7 -7
  108. package/dist/cli/{feedback-DQPUCUXO.js → feedback-YDAG7VH2.js} +15 -15
  109. package/dist/cli/git-E6W44F5M.js +25 -0
  110. package/dist/cli/{git-IY6DKKLR.mjs → git-YGLCCU35.mjs} +6 -6
  111. package/dist/cli/index.js +150 -150
  112. package/dist/cli/index.mjs +46 -46
  113. package/dist/cli/{integrations-242LE3TQ.mjs → integrations-FWYXSBHK.mjs} +8 -8
  114. package/dist/cli/{integrations-CQSTIKFY.js → integrations-IQXYMRMW.js} +16 -16
  115. package/dist/cli/{legacy-noops-SWTSTMRY.mjs → legacy-noops-I4YRIX5F.mjs} +7 -7
  116. package/dist/cli/{legacy-noops-U72DO6ZF.js → legacy-noops-U7LI7UXC.js} +10 -10
  117. package/dist/cli/{mcp-L473BKLJ.js → mcp-GX2UKKWU.js} +25 -25
  118. package/dist/cli/{mcp-JJH6JR52.mjs → mcp-QJBMB6VS.mjs} +5 -5
  119. package/dist/cli/{monitors-3TF2DOFD.js → monitors-WCJYINGX.js} +164 -106
  120. package/dist/cli/{monitors-VSYHUBKC.mjs → monitors-Z6EGKYJP.mjs} +70 -12
  121. package/dist/cli/{org-YKVI2ZTI.js → org-7SKG423N.js} +89 -89
  122. package/dist/cli/{org-S5VIKU2E.mjs → org-NNHICBR2.mjs} +7 -7
  123. package/dist/cli/{play-DOWEG45Y.js → play-4P4DTG3Q.js} +318 -318
  124. package/dist/cli/{play-C7T5A3QM.mjs → play-CXDFPJ7Z.mjs} +18 -18
  125. package/dist/cli/{providers-TAZPPFTB.js → providers-EE4TUE3O.js} +10 -10
  126. package/dist/cli/{providers-BMVVX3VD.mjs → providers-VQLQ7DTR.mjs} +7 -7
  127. package/dist/cli/{quickstart-A3WKMKTW.mjs → quickstart-IYNJRB5G.mjs} +5 -5
  128. package/dist/cli/{quickstart-HD6FQXGR.js → quickstart-RVXHK4WA.js} +7 -7
  129. package/dist/cli/{run-BVVV2UX7.js → run-R3F34KU3.js} +44 -44
  130. package/dist/cli/{run-FV7TWNOC.mjs → run-VBQPPMEX.mjs} +24 -24
  131. package/dist/cli/{search-MGK6WIKS.mjs → search-B7R62HX5.mjs} +8 -8
  132. package/dist/cli/search-UUVFXZRA.js +32 -0
  133. package/dist/cli/{search-output-GM7LDZKE.mjs → search-output-LNQQXIGZ.mjs} +5 -5
  134. package/dist/cli/{search-output-6Y7KEPIE.js → search-output-LWHWEPOT.js} +7 -7
  135. package/dist/cli/{secrets-4RFAR7YI.mjs → secrets-NM3VAJLO.mjs} +7 -7
  136. package/dist/cli/{secrets-SISXIXSZ.js → secrets-QBOZ7WTD.js} +16 -16
  137. package/dist/cli/sessions-K3PD73Q2.js +22 -0
  138. package/dist/cli/{sessions-CE3OMEG7.mjs → sessions-R5BSIJ4I.mjs} +7 -7
  139. package/dist/cli/{settings-4HPM3K4A.js → settings-POYWKNRD.js} +86 -86
  140. package/dist/cli/{settings-E22IDSX2.mjs → settings-S4PN7WLY.mjs} +13 -13
  141. package/dist/cli/{setup-BK65MDZ6.mjs → setup-PFLXVBTL.mjs} +10 -10
  142. package/dist/cli/{setup-BDRSNLKX.js → setup-VHB4Z654.js} +50 -50
  143. package/dist/cli/skills-QNE2EYT3.js +36 -0
  144. package/dist/cli/{skills-FI2GZMR4.mjs → skills-W2TELEU7.mjs} +8 -8
  145. package/dist/cli/tools-3RLI4HGF.js +57 -0
  146. package/dist/cli/{tools-HMMWYUNW.mjs → tools-M4FA6N3Y.mjs} +18 -18
  147. package/dist/cli/update-UT6KIW2W.js +34 -0
  148. package/dist/cli/{update-WDKBSXV5.mjs → update-W7LIHEA7.mjs} +10 -10
  149. package/dist/cli/{views-775AUDWQ.js → views-DJXAGD7V.js} +22 -22
  150. package/dist/cli/{views-JYIJCO23.mjs → views-KTVPV6UP.mjs} +7 -7
  151. package/dist/cli/{workflow-FKKHE3IU.mjs → workflow-LGKCRODX.mjs} +8 -8
  152. package/dist/cli/{workflow-4H6KQRFQ.js → workflow-NVZDJKH2.js} +18 -18
  153. package/dist/{client-DD_FyJVd.d.ts → client-CCyWJqAI.d.ts} +1 -1
  154. package/dist/{client-ANT3pyoa.d.mts → client-Tp1LSULB.d.mts} +1 -1
  155. package/dist/{client-core-QHmo73k1.d.ts → client-core-BpYiYEfu.d.ts} +10 -1
  156. package/dist/{client-core-Dg9tKhdB.d.mts → client-core-D8eCZz3O.d.mts} +10 -1
  157. package/dist/{compiler-manifest-BWFtsQIC.d.ts → compiler-manifest-EBWEUj0b.d.mts} +35 -0
  158. package/dist/{compiler-manifest-BWFtsQIC.d.mts → compiler-manifest-EBWEUj0b.d.ts} +35 -0
  159. package/dist/{errors-Lm9_vJHZ.d.ts → errors-CParKUQR.d.mts} +2 -2
  160. package/dist/{errors-CwKXXtuu.d.mts → errors-Qt0OTA7_.d.ts} +2 -2
  161. package/dist/{index-DjwsAt82.d.mts → index-BMUVCNp7.d.mts} +1 -1
  162. package/dist/{index-3vJ-V9yw.d.ts → index-CoqDkIw0.d.ts} +1 -1
  163. package/dist/index.d.mts +7 -7
  164. package/dist/index.d.ts +7 -7
  165. package/dist/index.js +10 -10
  166. package/dist/index.mjs +7 -7
  167. package/dist/install-integrity.json +126 -124
  168. package/dist/plays/bundle-play-file.d.mts +3 -3
  169. package/dist/plays/bundle-play-file.d.ts +3 -3
  170. package/dist/plays/bundle-play-file.mjs +20 -1
  171. package/dist/plays/play-description.d.mts +2 -2
  172. package/dist/plays/play-description.d.ts +2 -2
  173. package/dist/plays/run-request.d.mts +2 -2
  174. package/dist/plays/run-request.d.ts +2 -2
  175. package/dist/release.d.mts +1 -1
  176. package/dist/release.d.ts +1 -1
  177. package/dist/release.js +2 -2
  178. package/dist/release.mjs +1 -1
  179. package/dist/server.d.mts +4 -4
  180. package/dist/server.d.ts +4 -4
  181. package/dist/server.js +10 -10
  182. package/dist/server.mjs +4 -4
  183. package/package.json +1 -1
  184. package/dist/cli/auth-ENBXAKQS.js +0 -43
  185. package/dist/cli/concurrent-runs-help-TOMLCMV7.js +0 -21
  186. package/dist/cli/describe-RUODIS6M.js +0 -50
  187. package/dist/cli/git-RLHTSYRY.js +0 -25
  188. package/dist/cli/search-VJFCWUZN.js +0 -32
  189. package/dist/cli/sessions-OWWZJZXH.js +0 -22
  190. package/dist/cli/skills-ZLBFUAFR.js +0 -36
  191. package/dist/cli/tools-3K72VE33.js +0 -57
  192. package/dist/cli/update-QZV6DH5V.js +0 -34
@@ -1928,6 +1928,11 @@ export type MonitorsHealth = {
1928
1928
  next_attempt_at?: number;
1929
1929
  summary?: Record<string, unknown>;
1930
1930
  }>;
1931
+ /**
1932
+ * With a fleet scope: its failed and blocked members, and the command that
1933
+ * lists each with its reason. Older servers omit this additive field.
1934
+ */
1935
+ fleet_members?: { failed: number; blocked: number; next: string | null };
1931
1936
  /** Bounded sample explaining why normal audit did not settle the row. */
1932
1937
  unaudited_monitors: Array<{
1933
1938
  monitor_key: string;
@@ -133,7 +133,7 @@ export class AuthError extends DeeplineError {
133
133
  * @sdkReference errors 100
134
134
  */
135
135
  export class RateLimitError extends DeeplineError {
136
- /** Milliseconds to wait before retrying, from the `Retry-After` response header. Defaults to 5000. */
136
+ /** Milliseconds to wait before retrying: the exact `retry-after-ms` delay when Deepline sends one, else the `Retry-After` header. Defaults to 5000. */
137
137
  public retryAfterMs: number;
138
138
 
139
139
  /** Constructed by the SDK after exhausting HTTP-level rate-limit retries. */
@@ -546,7 +546,7 @@ export class HttpClient {
546
546
  const candidateUrls = options?.exactUrlOnly
547
547
  ? [url]
548
548
  : buildCandidateUrls(url);
549
- let retryAfterDelayMs: number | null = null;
549
+ let retryAfterHint: RetryAfterHint | null = null;
550
550
  let totalRetryWaitMs = 0;
551
551
 
552
552
  let maxRetries = options?.maxRetries ?? this.config.maxRetries;
@@ -559,11 +559,19 @@ export class HttpClient {
559
559
  }
560
560
  if (attempt > 0) {
561
561
  const backoffMs = Math.min(1000 * Math.pow(2, attempt - 1), 30_000);
562
+ // An exact limiter hint is when the next slot frees, so the first
563
+ // retry waits only that. Being refused again means other callers took
564
+ // the slot: later retries keep the exponential backoff floor so a
565
+ // crowd of refused callers spreads out instead of spending every
566
+ // retry in the same instant. A whole-second Retry-After is always a
567
+ // floor under the backoff.
562
568
  const delayMs =
563
- retryAfterDelayMs === null
569
+ retryAfterHint === null
564
570
  ? backoffMs
565
- : Math.max(backoffMs, retryAfterDelayMs);
566
- retryAfterDelayMs = null;
571
+ : retryAfterHint.exact && attempt === 1
572
+ ? retryAfterHint.delayMs
573
+ : Math.max(backoffMs, retryAfterHint.delayMs);
574
+ retryAfterHint = null;
567
575
  if (totalRetryWaitMs + delayMs > MAX_AUTOMATIC_RETRY_WAIT_MS) {
568
576
  // Honor the upstream delay by returning its original error. Never
569
577
  // retry sooner than requested, and never let automatic retries hold
@@ -675,7 +683,10 @@ export class HttpClient {
675
683
  failure.retryAfterMs ?? Math.max(0, retryAfter),
676
684
  });
677
685
  if (responseRetryAllowed && attempt < maxRetries) {
678
- retryAfterDelayMs = retryAfter;
686
+ retryAfterHint = parseRetryAfterHint(response) ?? {
687
+ delayMs: retryAfter,
688
+ exact: false,
689
+ };
679
690
  break;
680
691
  }
681
692
  throw attachToolUpstreamResponse(lastError, parsed);
@@ -698,7 +709,10 @@ export class HttpClient {
698
709
  const retryAfter = parseRetryAfter(response);
699
710
  lastError = new RateLimitError(retryAfter);
700
711
  if (responseRetryAllowed && attempt < maxRetries) {
701
- retryAfterDelayMs = retryAfter;
712
+ retryAfterHint = parseRetryAfterHint(response) ?? {
713
+ delayMs: retryAfter,
714
+ exact: false,
715
+ };
702
716
  break;
703
717
  }
704
718
  throw options?.toolId
@@ -740,7 +754,7 @@ export class HttpClient {
740
754
  },
741
755
  );
742
756
  if (retryableApiError && attempt < maxRetries) {
743
- retryAfterDelayMs = parseOptionalRetryAfter(response);
757
+ retryAfterHint = parseRetryAfterHint(response);
744
758
  break;
745
759
  }
746
760
  throw lastError;
@@ -770,7 +784,7 @@ export class HttpClient {
770
784
  response: parsed,
771
785
  });
772
786
  if (retryableApiError && attempt < maxRetries) {
773
- retryAfterDelayMs = parseOptionalRetryAfter(response);
787
+ retryAfterHint = parseRetryAfterHint(response);
774
788
  break;
775
789
  }
776
790
  throw options?.toolId
@@ -1220,17 +1234,32 @@ function detectHtmlErrorBody(
1220
1234
  };
1221
1235
  }
1222
1236
 
1223
- /** Parse the `Retry-After` header as milliseconds. Falls back to 5000ms. */
1237
+ type RetryAfterHint = {
1238
+ delayMs: number;
1239
+ /** True when the server sent the limiter's exact delay (`retry-after-ms`). */
1240
+ exact: boolean;
1241
+ };
1242
+
1243
+ /** The response's retry delay in milliseconds. Falls back to 5000ms. */
1224
1244
  function parseRetryAfter(response: Response): number {
1225
- return parseOptionalRetryAfter(response) ?? 5000;
1245
+ return parseRetryAfterHint(response)?.delayMs ?? 5000;
1226
1246
  }
1227
1247
 
1228
- function parseOptionalRetryAfter(response: Response): number | null {
1248
+ /**
1249
+ * Deepline's execute limiter sends `retry-after-ms`, the exact delay until
1250
+ * its window frees a slot, beside `Retry-After`, which can only say whole
1251
+ * seconds. Prefer the exact delay when it is present.
1252
+ */
1253
+ function parseRetryAfterHint(response: Response): RetryAfterHint | null {
1254
+ const exactMs = Number(response.headers.get('retry-after-ms') ?? '');
1255
+ if (Number.isFinite(exactMs) && exactMs > 0) {
1256
+ return { delayMs: Math.ceil(exactMs), exact: true };
1257
+ }
1229
1258
  const header = response.headers.get('retry-after');
1230
1259
  if (header) {
1231
1260
  const seconds = Number(header);
1232
1261
  if (Number.isFinite(seconds) && seconds > 0) {
1233
- return seconds * 1000;
1262
+ return { delayMs: seconds * 1000, exact: false };
1234
1263
  }
1235
1264
  }
1236
1265
  return null;
@@ -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.544',
208
+ version: '0.3.546',
209
209
  updateSummary: {
210
210
  introducedIn: '0.3.90',
211
211
  summary:
@@ -26,6 +26,11 @@ export function fleetDriftCommand(fleetId: string): string {
26
26
  return `deepline monitors fleets get ${fleetId} --drift`;
27
27
  }
28
28
 
29
+ /** Problem members by cause, each with its own message, paginated. */
30
+ export function fleetIssuesCommand(fleetId: string): string {
31
+ return `deepline monitors fleets issues ${fleetId}`;
32
+ }
33
+
29
34
  /** There is no `fleets list` verb: `get` with no id is the list. */
30
35
  export function fleetListCommand(): string {
31
36
  return 'deepline monitors fleets get';
@@ -33,6 +33,7 @@ export const FLEET_BLOCKED_CAUSES = [
33
33
  'monitors_per_account_limit',
34
34
  'rollout_access',
35
35
  'identity_occupied',
36
+ 'invalid_payload',
36
37
  'unsupported_tool',
37
38
  'needs_support',
38
39
  'unknown_code',
@@ -86,13 +87,16 @@ export function classifyFleetFailure(error: string | null): FleetFailedCause {
86
87
  for (const [prefix, cause] of FAILED_PREFIXES) {
87
88
  if (message.startsWith(prefix)) return cause;
88
89
  }
89
- return PROVIDER_REJECTION_DETAIL.test(message) ? 'provider_rejected' : 'other';
90
+ return PROVIDER_REJECTION_DETAIL.test(message)
91
+ ? 'provider_rejected'
92
+ : 'other';
90
93
  }
91
94
 
92
95
  const BLOCKED_CAUSES: Readonly<Record<string, FleetBlockedCause>> = {
93
96
  [FLEET_BLOCKED_BY.watchedEntities]: 'watched_accounts_limit',
94
97
  [FLEET_BLOCKED_BY.monitorsPerEntity]: 'monitors_per_account_limit',
95
98
  [FLEET_BLOCKED_BY.rolloutAccess]: 'rollout_access',
99
+ [FLEET_BLOCKED_BY.invalidPayload]: 'invalid_payload',
96
100
  [FLEET_REFUSAL.identityOccupied]: 'identity_occupied',
97
101
  [FLEET_REFUSAL.batchUnsupported]: 'unsupported_tool',
98
102
  [FLEET_REFUSAL.orphanedResource]: 'needs_support',
@@ -5,6 +5,12 @@ export const FLEET_BLOCKED_BY = {
5
5
  watchedEntities: OrgLimit.MonitorWatchedEntities,
6
6
  monitorsPerEntity: OrgLimit.MonitorsPerEntity,
7
7
  rolloutAccess: 'monitor.rollout_access',
8
+ /**
9
+ * The member's rendered payload breaks its monitor tool's payload rules, so
10
+ * the provider would refuse it. Its row carries the field-level reason;
11
+ * fixing the source row or template unblocks it on the next plan.
12
+ */
13
+ invalidPayload: 'monitor.invalid_payload',
8
14
  } as const;
9
15
  /** Refusals a fleet's provider work records on a member it could not create. */
10
16
  export const FLEET_REFUSAL = {
@@ -40,6 +40,12 @@ export type DesiredFleetMember = {
40
40
  /** The rendered monitor definition: `{ key, tool, payload }`. */
41
41
  definition: Record<string, unknown>;
42
42
  desiredHash: string;
43
+ /**
44
+ * Why this member's payload breaks its monitor tool's payload rules, naming
45
+ * the field. Such a member is planned blocked rather than sent, so one bad
46
+ * source row cannot sink a provider bulk (#10560).
47
+ */
48
+ payloadRefusal?: string;
43
49
  };
44
50
 
45
51
  /** A monitor the fleet already owns, as Convex reports it. */
@@ -86,6 +92,8 @@ export type PlannedFleetMember = {
86
92
  desiredHash?: string;
87
93
  desiredDefinition?: Record<string, unknown>;
88
94
  blockedBy?: string;
95
+ /** The member-specific reason behind `blockedBy`, stored as its error. */
96
+ error?: string;
89
97
  /** True when the commit must be given a monitor seed for this key. */
90
98
  needsSeed: boolean;
91
99
  /** An `adopt` the sync's opt-in authorizes, not a named Batch. */
@@ -273,9 +281,18 @@ export function planFleetMembers(input: {
273
281
  let adoptsWithUpdate = 0;
274
282
  let adoptsExisting = 0;
275
283
 
276
- const refuse = (member: PlannedFleetMember, blockedBy: string) => {
284
+ const refuse = (
285
+ member: PlannedFleetMember,
286
+ blockedBy: string,
287
+ error?: string,
288
+ ) => {
277
289
  blocked[blockedBy] = (blocked[blockedBy] ?? 0) + 1;
278
- members.push({ ...member, action: 'blocked', blockedBy });
290
+ members.push({
291
+ ...member,
292
+ action: 'blocked',
293
+ blockedBy,
294
+ ...(error === undefined ? {} : { error }),
295
+ });
279
296
  };
280
297
 
281
298
  for (const desired of input.desired) {
@@ -302,6 +319,16 @@ export function planFleetMembers(input: {
302
319
  owned?.convergence === 'settled' &&
303
320
  owned.firstMissingAt === null;
304
321
  if (settledOnDesired) continue;
322
+ // The provider keeps running the radar it has; the change that cannot
323
+ // be sent waits, blocked, for a fixed row or template.
324
+ if (desired.payloadRefusal !== undefined) {
325
+ refuse(
326
+ { ...base, needsSeed: false },
327
+ FLEET_BLOCKED_BY.invalidPayload,
328
+ desired.payloadRefusal,
329
+ );
330
+ continue;
331
+ }
305
332
  // A member an older revision marked missing (the removal grace, since
306
333
  // removed) is still re-published, which clears that mark through the
307
334
  // same guarded transition every other change uses.
@@ -334,7 +361,12 @@ export function planFleetMembers(input: {
334
361
  }
335
362
  continue;
336
363
  }
337
-
364
+ // Before any limit: a member the provider would refuse must not take one
365
+ // of the organization's account slots from a member it would accept.
366
+ if (desired.payloadRefusal !== undefined) {
367
+ refuse(base, FLEET_BLOCKED_BY.invalidPayload, desired.payloadRefusal);
368
+ continue;
369
+ }
338
370
  const onEntity = entityCounts.get(entityKey) ?? 0;
339
371
  if (onEntity >= input.entitlements.monitorsPerEntity) {
340
372
  refuse(base, FLEET_BLOCKED_BY.monitorsPerEntity);
@@ -1245,8 +1245,8 @@
1245
1245
  "owner": "billing",
1246
1246
  "criticality": "operational",
1247
1247
  "purpose": "Request workspace drains for indexed pending usage from closed UTC days, including late arrivals.",
1248
- "successDefinition": "Discovery reaches the end of the indexed pending workspaces and issues closed-day wake requests. Each invocation inspects at most 200 workspaces.",
1249
- "failureDefinition": "Discovery or wake dispatch fails, or the bounded pass stops before reaching the end. The next invocation resumes from its saved workspace cursor.",
1248
+ "successDefinition": "Discovery reaches the end of the chronological pending-event scan and issues asynchronous workspace wake requests. Each query reads at most 25 events or 128 KiB; each invocation commits at most 40 pages within five minutes.",
1249
+ "failureDefinition": "Discovery or wake dispatch fails, or the bounded pass stops before reaching the end. The next invocation resumes from its saved event cursor and frozen time range.",
1250
1250
  "startGraceMs": 120000,
1251
1251
  "runTimeoutMs": 420000,
1252
1252
  "failureAlert": "convex_action_wrapper",
@@ -34,4 +34,9 @@ export interface PlaySheetColumnContract {
34
34
  export interface PlaySheetContract {
35
35
  tableNamespace: string;
36
36
  columns: PlaySheetColumnContract[];
37
+ /**
38
+ * Authored fields the run page shows first, in this order, from
39
+ * `.run({ columnOrder: [...] })`. Display only; absent on older contracts.
40
+ */
41
+ columnOrder?: string[];
37
42
  }
@@ -318,3 +318,30 @@ export function datasetWrittenColumnOrder(input: {
318
318
  for (const field of input.outputFields ?? []) append(field);
319
319
  return order;
320
320
  }
321
+
322
+ /**
323
+ * The written order to show: the contract's `columnOrder` columns first, in
324
+ * that order, then every other written column in written order. Always a
325
+ * permutation of `written` (a listed column the run never wrote is skipped),
326
+ * so the ledger's longest-list rule still sees the full set. `written` stays
327
+ * the append-only order; apply this to a copy at emission.
328
+ */
329
+ export function datasetDisplayColumnOrder(
330
+ written: readonly string[],
331
+ contract: Pick<PlaySheetContract, 'columns' | 'columnOrder'>,
332
+ ): string[] {
333
+ if (!contract.columnOrder?.length) return [...written];
334
+ const present = new Set(written);
335
+ const leading: string[] = [];
336
+ for (const field of contract.columnOrder) {
337
+ const declared = contract.columns.find(
338
+ (column) =>
339
+ (column.source === 'input' || column.source === 'datasetColumn') &&
340
+ (column.field ?? column.id) === field,
341
+ );
342
+ const sqlName = declared?.sqlName ?? sqlSafePlayColumnName(field);
343
+ if (present.has(sqlName) && !leading.includes(sqlName)) leading.push(sqlName);
344
+ }
345
+ const lead = new Set(leading);
346
+ return [...leading, ...written.filter((name) => !lead.has(name))];
347
+ }
@@ -9719,6 +9719,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
9719
9719
  'ctx.dataset.run.undrawnColumns',
9720
9720
  options.undrawnColumns,
9721
9721
  );
9722
+ validateOptionalPlayAuthoringField(
9723
+ 'ctx.dataset.run.columnOrder',
9724
+ options.columnOrder,
9725
+ );
9722
9726
  if (options.key !== undefined) {
9723
9727
  validatePlayAuthoringField('ctx.dataset.run.key', options.key);
9724
9728
  }
@@ -461,6 +461,13 @@ export interface RuntimeDatasetOptions<TItem = Record<string, unknown>> {
461
461
  * execution behavior.
462
462
  */
463
463
  undrawnColumns?: readonly string[];
464
+ /**
465
+ * Columns the run page shows first, in this order. Every other column keeps
466
+ * the order the run wrote it in (row keys, then each `withColumn`), and a
467
+ * cascade's attempt columns stay right after the cascade. Display only:
468
+ * read from literals at compile time, it changes no execution or stored value.
469
+ */
470
+ columnOrder?: readonly string[];
464
471
  }
465
472
 
466
473
  export type RuntimeDatasetDefinitionOptions<TItem = Record<string, unknown>> =
@@ -474,6 +481,7 @@ export type RuntimeDatasetRunOptions<TItem = Record<string, unknown>> = Pick<
474
481
  | 'onRowError'
475
482
  | 'mode'
476
483
  | 'undrawnColumns'
484
+ | 'columnOrder'
477
485
  >;
478
486
 
479
487
  /** Runtime-only receipt recovery bit; never part of the customer authoring API. */
@@ -44,6 +44,13 @@ export type FleetSandboxSweepAdapter = Readonly<{
44
44
  scope: FleetSandboxSweepScope;
45
45
  /** Minimum spacing between pass starts. */
46
46
  intervalMs: number;
47
+ /**
48
+ * Loop-driven owners only: spread passes across a fleet that boots
49
+ * together. Each interval is scaled by a random factor in
50
+ * [1 - jitterRatio, 1 + jitterRatio], and the first pass waits a random
51
+ * [0, 2 * jitterRatio * intervalMs]. In [0, 0.5]; absent: no jitter.
52
+ */
53
+ jitterRatio?: number;
47
54
  /**
48
55
  * One pass: enumerate, apply the provider's age, ownership and dry-run
49
56
  * policy, and terminate or restore cleanup for each dead sandbox. A
@@ -81,6 +88,18 @@ export function assertFleetSandboxSweepAdapters(
81
88
  `Fleet sandbox sweep for ${adapter.provider} needs a positive integer interval.`,
82
89
  );
83
90
  }
91
+ if (
92
+ adapter.jitterRatio !== undefined &&
93
+ !(
94
+ Number.isFinite(adapter.jitterRatio) &&
95
+ adapter.jitterRatio >= 0 &&
96
+ adapter.jitterRatio <= 0.5
97
+ )
98
+ ) {
99
+ throw new FleetSandboxSweepAdapterError(
100
+ `Fleet sandbox sweep for ${adapter.provider} needs a jitter ratio in [0, 0.5].`,
101
+ );
102
+ }
84
103
  if (adapter.scope === 'provider_inventory') {
85
104
  const support = runtimeSandboxProviderProfile(adapter.provider)
86
105
  .capabilities.orphanEnumeration;
@@ -116,17 +135,26 @@ export function createFleetSandboxSweep(input: {
116
135
  adapters: readonly FleetSandboxSweepAdapter[];
117
136
  /** Injected clock; read on every call so fake timers apply. */
118
137
  now?: () => number;
138
+ /** Injected uniform [0, 1) source for `jitterRatio`. */
139
+ random?: () => number;
119
140
  }): FleetSandboxSweep {
120
141
  assertFleetSandboxSweepAdapters(input.adapters);
121
142
  const now = input.now ?? (() => Date.now());
143
+ const random = input.random ?? Math.random;
144
+ const createdAtMs = now();
122
145
  const states: PassState[] = input.adapters.map((adapter) => ({
123
146
  adapter,
124
147
  running: null,
125
- nextDueAtMs: 0,
148
+ nextDueAtMs: adapter.jitterRatio
149
+ ? createdAtMs + 2 * adapter.jitterRatio * random() * adapter.intervalMs
150
+ : 0,
126
151
  }));
127
152
 
128
153
  const start = (state: PassState, startedAtMs: number): void => {
129
- state.nextDueAtMs = startedAtMs + state.adapter.intervalMs;
154
+ const jitter = state.adapter.jitterRatio ?? 0;
155
+ state.nextDueAtMs =
156
+ startedAtMs +
157
+ state.adapter.intervalMs * (1 + jitter * (2 * random() - 1));
130
158
  // The async wrapper turns a synchronous throw into a rejection, so it is
131
159
  // reported like any other failed pass and never reaches the next Adapter.
132
160
  const pass: Promise<void> = (async () => {
@@ -184,11 +212,20 @@ export function createFleetSandboxSweep(input: {
184
212
  /**
185
213
  * Timer-driven owner: run every Adapter's pass once now, then once per its
186
214
  * interval, skipping (and reporting) a tick whose previous pass still runs.
187
- * Timers are unref'd so the sweep never keeps a process alive.
215
+ * Timers are unref'd so the sweep never keeps a process alive. `jitterRatio`
216
+ * is loop-driven only: fixed timers would silently ignore it, so an Adapter
217
+ * that sets it is refused before any timer starts.
188
218
  */
189
219
  export function startFleetSandboxSweepTimers(input: {
190
220
  adapters: readonly FleetSandboxSweepAdapter[];
191
221
  }): { stop: () => void; sweep: FleetSandboxSweep } {
222
+ for (const adapter of input.adapters) {
223
+ if (adapter.jitterRatio !== undefined) {
224
+ throw new FleetSandboxSweepAdapterError(
225
+ `Fleet sandbox sweep for ${adapter.provider} sets jitterRatio, which timer-driven owners do not support.`,
226
+ );
227
+ }
228
+ }
192
229
  const sweep = createFleetSandboxSweep({ adapters: input.adapters });
193
230
  const intervals = input.adapters.map((adapter) => {
194
231
  const interval = setInterval(() => {
@@ -19,6 +19,14 @@ export {
19
19
  modalSandboxResourcesForPlay,
20
20
  } from './worker-api-types';
21
21
  export const MODAL_SANDBOX_MEMORY_MIB = 1024;
22
+ /**
23
+ * The Modal region every Play sandbox is created in: us-east (Virginia), next
24
+ * to the Fly iad receipt gateway, execution relay and workers it talks to.
25
+ * Unpinned, Modal places a sandbox anywhere: about 36% of Production Modal
26
+ * runs landed overseas (Europe, Israel), each sandbox-to-relay round trip
27
+ * 94-117 ms instead of 14-27 ms. A narrow region costs 1.75x Modal's base price.
28
+ */
29
+ export const MODAL_SANDBOX_REGIONS: readonly string[] = ['us-east'];
22
30
 
23
31
  export function isModalPreviewEvaluation(input: {
24
32
  runtimeSchedulerSchema: string | null | undefined;
@@ -92,6 +100,16 @@ function cidrAllowlist(raw: string | null | undefined): string[] | null {
92
100
  return values.length > 0 ? values : null;
93
101
  }
94
102
 
103
+ /** Production refuses a Modal sandbox without an outbound allowlist. */
104
+ export class ModalSandboxAllowlistRequiredError extends Error {
105
+ constructor() {
106
+ super(
107
+ 'DEEPLINE_DAYTONA_NETWORK_ALLOW_LIST is required for the Modal capacity fallback in production. Refusing to run customer code with unrestricted outbound network access.',
108
+ );
109
+ this.name = 'ModalSandboxAllowlistRequiredError';
110
+ }
111
+ }
112
+
95
113
  export function resolveModalSandboxNetworkPolicy(input: {
96
114
  runtimeSchedulerSchema: string | null | undefined;
97
115
  env?: NodeJS.ProcessEnv;
@@ -105,9 +123,7 @@ export function resolveModalSandboxNetworkPolicy(input: {
105
123
  env.NODE_ENV === 'production' &&
106
124
  !isIsolatedRuntimeSchedulerSchema(input.runtimeSchedulerSchema)
107
125
  ) {
108
- throw new Error(
109
- 'DEEPLINE_DAYTONA_NETWORK_ALLOW_LIST is required for the Modal capacity fallback in production. Refusing to run customer code with unrestricted outbound network access.',
110
- );
126
+ throw new ModalSandboxAllowlistRequiredError();
111
127
  }
112
128
  return { outboundCidrAllowlist };
113
129
  }
@@ -71,6 +71,7 @@ import {
71
71
  } from '../tool-http-errors';
72
72
  import {
73
73
  augmentSheetContractWithDatasetFields,
74
+ datasetDisplayColumnOrder,
74
75
  datasetWrittenColumnOrder,
75
76
  } from '../../play-data-plane/sheet-contract';
76
77
  import { nextWorkCounterInvocationSeq } from '../runtime-work-counters';
@@ -2506,10 +2507,21 @@ async function run(
2506
2507
  persistedRows: number;
2507
2508
  succeededRows: number;
2508
2509
  failedRows: number;
2509
- /** Stored column names in the order this run wrote them. */
2510
+ /** Stored column names in the order this run wrote them. Append-only. */
2510
2511
  columns?: string[];
2512
+ /** The dataset's sheet contract; its `columnOrder` leads the emitted order. */
2513
+ sheetContract?: PlaySheetContract;
2511
2514
  }
2512
2515
  >();
2516
+ // The order events carry: authored `columnOrder` first, then written order.
2517
+ // A permutation of the written set, so the ledger's longest list stays whole.
2518
+ const emittedDatasetColumns = (settlement: {
2519
+ columns?: string[];
2520
+ sheetContract?: PlaySheetContract;
2521
+ }): string[] =>
2522
+ settlement.sheetContract
2523
+ ? datasetDisplayColumnOrder(settlement.columns ?? [], settlement.sheetContract)
2524
+ : [...(settlement.columns ?? [])];
2513
2525
  const runtimeSheetAttemptKey = (input: {
2514
2526
  playName: string;
2515
2527
  runId: string;
@@ -2845,7 +2857,7 @@ async function run(
2845
2857
  failedRows: settlement.failedRows,
2846
2858
  complete: false,
2847
2859
  ...(settlement.columns?.length
2848
- ? { columns: settlement.columns }
2860
+ ? { columns: emittedDatasetColumns(settlement) }
2849
2861
  : {}),
2850
2862
  at: event.at,
2851
2863
  },
@@ -3069,6 +3081,7 @@ async function run(
3069
3081
  rows: items,
3070
3082
  existing: settlement.columns,
3071
3083
  });
3084
+ settlement.sheetContract = sheetContract;
3072
3085
  runtimeMapDatasetSettlements.set(datasetId, settlement);
3073
3086
  emitRunnerEvent(
3074
3087
  {
@@ -3084,7 +3097,7 @@ async function run(
3084
3097
  failedRows: 0,
3085
3098
  complete: false,
3086
3099
  ...(settlement.columns.length > 0
3087
- ? { columns: settlement.columns }
3100
+ ? { columns: emittedDatasetColumns(settlement) }
3088
3101
  : {}),
3089
3102
  // ADR 0019 dataset-grain row birth. These rows entered from
3090
3103
  // play-body code, so the only witnessed fact is how many arrived at
@@ -3463,6 +3476,7 @@ async function run(
3463
3476
  outputFields: input.outputFields,
3464
3477
  existing: settlement.columns,
3465
3478
  });
3479
+ settlement.sheetContract = sheetContract;
3466
3480
  runtimeMapDatasetSettlements.set(datasetId, settlement);
3467
3481
  emitWorkerLog(
3468
3482
  `[perf] runtime map persist table=${input.tableNamespace} rows=${input.rows.length} updated=${result.updated} accepted=${committedTerminalRows} stale=${staleKeys.size} elapsed_ms=${Date.now() - persistStartedAt}`,
@@ -3747,7 +3761,7 @@ async function run(
3747
3761
  failedRows: settlement.failedRows,
3748
3762
  complete: true,
3749
3763
  ...(settlement.columns?.length
3750
- ? { columns: settlement.columns }
3764
+ ? { columns: emittedDatasetColumns(settlement) }
3751
3765
  : {}),
3752
3766
  at: Date.now(),
3753
3767
  },