deepline 0.3.546 → 0.3.547

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 (202) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +13 -0
  2. package/dist/bundling-sources/sdk/src/index.ts +7 -1
  3. package/dist/bundling-sources/sdk/src/integrations.ts +17 -7
  4. package/dist/bundling-sources/sdk/src/play.ts +71 -0
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +13 -4
  7. package/dist/bundling-sources/sdk/src/types.ts +33 -0
  8. package/dist/bundling-sources/shared_libs/integration-contracts/calendar-delegation.ts +7 -0
  9. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +2 -0
  10. package/dist/bundling-sources/shared_libs/monitors/tracking-provider-guidance.ts +1 -0
  11. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +19 -1
  12. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +17 -2
  13. package/dist/bundling-sources/shared_libs/play-runtime/async-operation.ts +57 -5
  14. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +295 -52
  15. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/docflow-decision-tracker.ts +135 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/docflow-fail-open.ts +177 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/docflow-node-io.ts +99 -2
  19. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +16 -10
  20. package/dist/bundling-sources/shared_libs/play-runtime/fenced-call-diagnostics.ts +211 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/runtime-capacity-policy.ts +52 -14
  22. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +21 -2
  23. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +18 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +68 -0
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +11 -3
  26. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +9 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +48 -0
  28. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -1
  29. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +716 -51
  30. package/dist/bundling-sources/shared_libs/plays/docflow-decision-arms.ts +146 -0
  31. package/dist/bundling-sources/shared_libs/plays/docflow-flow-order.ts +94 -0
  32. package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +10 -1
  33. package/dist/bundling-sources/shared_libs/plays/docflow.ts +787 -117
  34. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +8 -2
  35. package/dist/bundling-sources/shared_libs/plays/static-pipeline.ts +6 -0
  36. package/dist/bundling-sources/shared_libs/plays/trigger-config-contract.ts +13 -0
  37. package/dist/bundling-sources/shared_libs/product-notifications/billing-sales.ts +25 -0
  38. package/dist/bundling-sources/shared_libs/security/secret-redaction.ts +56 -0
  39. package/dist/cli/auth-AC5277PI.js +43 -0
  40. package/dist/cli/{auth-KFWG72AZ.mjs → auth-WJEY4IDX.mjs} +5 -5
  41. package/dist/cli/{billing-OQVOAZ4S.js → billing-IJITDDRQ.js} +96 -96
  42. package/dist/cli/{billing-MMZ336HO.mjs → billing-PHJUDYF3.mjs} +10 -10
  43. package/dist/cli/{chunk-TBWYZOSV.js → chunk-2AHY47SI.js} +3 -3
  44. package/dist/cli/{chunk-MXQP7CXZ.js → chunk-2HPTLBNB.js} +3 -3
  45. package/dist/cli/{chunk-TI6DTURF.js → chunk-4WAM6TLD.js} +7 -1
  46. package/dist/cli/{chunk-JARZ47OP.mjs → chunk-56MEAGWA.mjs} +2 -2
  47. package/dist/cli/{chunk-GYTSDSQD.mjs → chunk-5SFHPMBY.mjs} +11 -11
  48. package/dist/cli/{chunk-Z3UEBFIN.js → chunk-ABLTVG3J.js} +41 -41
  49. package/dist/cli/{chunk-LX2TC3HO.mjs → chunk-AEQ5VWZ5.mjs} +4 -4
  50. package/dist/cli/{chunk-MI7X6V6V.mjs → chunk-CKIRKYW7.mjs} +3 -3
  51. package/dist/cli/{chunk-2JHYYB3F.js → chunk-CSPHSNBW.js} +3 -3
  52. package/dist/cli/{chunk-IVWU7SJC.js → chunk-D6OIEH47.js} +5 -5
  53. package/dist/cli/{chunk-KUK7ARXA.mjs → chunk-DIUNDLSX.mjs} +2 -2
  54. package/dist/cli/{chunk-RO66FPTS.mjs → chunk-DJI5CLLW.mjs} +1 -1
  55. package/dist/cli/{chunk-LIJKRDDG.js → chunk-DZC7LMYM.js} +6 -6
  56. package/dist/cli/{chunk-UQJBV5PM.js → chunk-E2OIYPB4.js} +10 -10
  57. package/dist/cli/{chunk-JA633HRV.mjs → chunk-ECUD4QPD.mjs} +3 -3
  58. package/dist/cli/{chunk-VPERQ3U6.mjs → chunk-ESCVHDNY.mjs} +5 -5
  59. package/dist/cli/{chunk-JVOUQFHT.js → chunk-FFBXLFKV.js} +1 -1
  60. package/dist/cli/{chunk-3DUNNZB6.mjs → chunk-FMQXAOVE.mjs} +4 -4
  61. package/dist/cli/{chunk-HXIR3VQL.mjs → chunk-FZHMNK6F.mjs} +7 -1
  62. package/dist/cli/{chunk-PU3ZAG6V.mjs → chunk-G6KW764N.mjs} +1 -1
  63. package/dist/cli/{chunk-EEG46QZY.mjs → chunk-G6XTCG3J.mjs} +2 -2
  64. package/dist/cli/{chunk-EEJHB76U.js → chunk-GIGAYLY6.js} +12 -12
  65. package/dist/cli/{chunk-BLYW6FFB.js → chunk-GJA2PRHJ.js} +2 -2
  66. package/dist/cli/{chunk-H7Q5IDO3.js → chunk-GJOGFWX3.js} +20 -20
  67. package/dist/cli/{chunk-6Y5TU3R7.mjs → chunk-GPAWLXW3.mjs} +1 -1
  68. package/dist/cli/{chunk-5W4ENHWM.js → chunk-GZFZZQL4.js} +285 -264
  69. package/dist/cli/{chunk-P7A3H6G5.mjs → chunk-HARZ4AAX.mjs} +1 -1
  70. package/dist/cli/{chunk-MEGHIX4M.js → chunk-HFIFKP3A.js} +5 -5
  71. package/dist/cli/{chunk-LHE2TSV6.mjs → chunk-IGAK22XO.mjs} +1 -1
  72. package/dist/cli/{chunk-VTK3HGMN.mjs → chunk-IKYN6PLO.mjs} +5 -5
  73. package/dist/cli/{chunk-UREAIHUU.mjs → chunk-ITLZBDSR.mjs} +3 -3
  74. package/dist/cli/{chunk-6LG7MLJ2.js → chunk-IVFFCAV2.js} +44 -44
  75. package/dist/cli/{chunk-SYTWWVIQ.js → chunk-K3GMDSUX.js} +5 -5
  76. package/dist/cli/{chunk-WKHPLBJK.js → chunk-L5J6UJ2X.js} +15 -15
  77. package/dist/cli/{chunk-X5KOHDJN.mjs → chunk-L6QE2XVM.mjs} +1 -1
  78. package/dist/cli/{chunk-SH32HL7I.js → chunk-LMLSOHTU.js} +53 -53
  79. package/dist/cli/{chunk-JCWNF44W.js → chunk-MBQELFL7.js} +22 -22
  80. package/dist/cli/{chunk-Z7SXGOIQ.mjs → chunk-MF7PCM6C.mjs} +1 -1
  81. package/dist/cli/{chunk-F2VEFMU5.js → chunk-MO7TGNXB.js} +13 -13
  82. package/dist/cli/{chunk-7ZW67ME6.mjs → chunk-MOZEAGSR.mjs} +1 -1
  83. package/dist/cli/{chunk-5VNQMVCU.js → chunk-N63U5CRG.js} +26 -26
  84. package/dist/cli/{chunk-JCH4UNNS.js → chunk-NBYFQZ6O.js} +2 -2
  85. package/dist/cli/{chunk-BTFUAGHC.js → chunk-OVYXYTEP.js} +16 -16
  86. package/dist/cli/{chunk-J65HJCJO.mjs → chunk-PBMO36BP.mjs} +2 -2
  87. package/dist/cli/{chunk-F5YQXCP3.js → chunk-PVQCX6KQ.js} +50 -7
  88. package/dist/cli/{chunk-K2XELBPF.mjs → chunk-QLE3QKJ2.mjs} +5 -5
  89. package/dist/cli/{chunk-VAT2SXFF.js → chunk-QU3K3IY6.js} +12 -12
  90. package/dist/cli/{chunk-JYG4XZLT.js → chunk-REAFIEV5.js} +99 -99
  91. package/dist/cli/{chunk-5OEFXAKP.mjs → chunk-RMCCB3XY.mjs} +50 -7
  92. package/dist/cli/{chunk-HJR2DDJS.mjs → chunk-RXRC2COC.mjs} +2 -2
  93. package/dist/cli/{chunk-4AZLGNXV.js → chunk-SAJWYN4B.js} +4 -4
  94. package/dist/cli/{chunk-VXTTAYOT.mjs → chunk-TNJG4ZPN.mjs} +3 -3
  95. package/dist/cli/{chunk-PMDHY2YK.js → chunk-VNOQEDVC.js} +7 -7
  96. package/dist/cli/{chunk-GOOF7E2B.mjs → chunk-VPF54TXQ.mjs} +5 -5
  97. package/dist/cli/{chunk-2HSZCQMT.mjs → chunk-WYT3H6JD.mjs} +1 -1
  98. package/dist/cli/{chunk-OAKWSLKS.mjs → chunk-XMBVHJPR.mjs} +28 -7
  99. package/dist/cli/{chunk-7MY7KWJS.mjs → chunk-XNTDTAKC.mjs} +1 -1
  100. package/dist/cli/{chunk-5V7NZKGG.js → chunk-YURGAKI3.js} +2 -2
  101. package/dist/cli/{chunk-ND7SFRQL.js → chunk-YVKLF7RW.js} +2 -2
  102. package/dist/cli/{chunk-6FBDTYR2.mjs → chunk-Z2YGQZWV.mjs} +2 -2
  103. package/dist/cli/command-docs.js +2 -2
  104. package/dist/cli/command-docs.mjs +1 -1
  105. package/dist/cli/{concurrent-runs-help-C2O5YKQA.mjs → concurrent-runs-help-ZNGP563R.mjs} +6 -6
  106. package/dist/cli/concurrent-runs-help-ZYISYOQA.js +21 -0
  107. package/dist/cli/{csv-Z4DNGR54.mjs → csv-VAHQHYYV.mjs} +4 -4
  108. package/dist/cli/{csv-MJDNOIQJ.js → csv-X6D4ZELE.js} +13 -13
  109. package/dist/cli/{db-4RL2BNOF.mjs → db-4G4S2VOV.mjs} +7 -7
  110. package/dist/cli/{db-S5QVPK5E.js → db-YA5ZGVEX.js} +28 -28
  111. package/dist/cli/{describe-L4P5SZLQ.mjs → describe-EVXEM2S6.mjs} +19 -19
  112. package/dist/cli/describe-GYYSLZLV.js +50 -0
  113. package/dist/cli/describe-core.d.mts +4 -4
  114. package/dist/cli/describe-core.d.ts +4 -4
  115. package/dist/cli/{executions-MFZ2Z36O.js → executions-5YC7ABF6.js} +9 -9
  116. package/dist/cli/{executions-RR6O3XK5.mjs → executions-HR6CTN5M.mjs} +7 -7
  117. package/dist/cli/{feedback-EQBQ3ABB.mjs → feedback-GEU5SPLR.mjs} +6 -6
  118. package/dist/cli/{feedback-YDAG7VH2.js → feedback-MJHSYLFF.js} +14 -14
  119. package/dist/cli/git-FZIQZNI4.js +25 -0
  120. package/dist/cli/{git-YGLCCU35.mjs → git-NPFF6QUS.mjs} +5 -5
  121. package/dist/cli/index.js +146 -146
  122. package/dist/cli/index.mjs +45 -45
  123. package/dist/cli/{integrations-IQXYMRMW.js → integrations-YPHFI77G.js} +19 -17
  124. package/dist/cli/{integrations-FWYXSBHK.mjs → integrations-Z7EGVBHF.mjs} +11 -9
  125. package/dist/cli/{legacy-noops-U7LI7UXC.js → legacy-noops-246E3KKG.js} +9 -9
  126. package/dist/cli/{legacy-noops-I4YRIX5F.mjs → legacy-noops-5IYCFWWX.mjs} +6 -6
  127. package/dist/cli/{mcp-QJBMB6VS.mjs → mcp-WUYGZXPI.mjs} +4 -4
  128. package/dist/cli/{mcp-GX2UKKWU.js → mcp-YTYTW67G.js} +24 -24
  129. package/dist/cli/{monitors-Z6EGKYJP.mjs → monitors-73DQKCU7.mjs} +26 -8
  130. package/dist/cli/{monitors-WCJYINGX.js → monitors-SA6ILD6Z.js} +119 -101
  131. package/dist/cli/{org-NNHICBR2.mjs → org-WVQRB2KX.mjs} +7 -7
  132. package/dist/cli/{org-7SKG423N.js → org-X7ELDV7B.js} +89 -89
  133. package/dist/cli/{play-CXDFPJ7Z.mjs → play-QI6V2EUQ.mjs} +295 -67
  134. package/dist/cli/{play-4P4DTG3Q.js → play-QTYOAJPE.js} +897 -669
  135. package/dist/cli/{providers-VQLQ7DTR.mjs → providers-DPVMVDS4.mjs} +7 -7
  136. package/dist/cli/{providers-EE4TUE3O.js → providers-XXFLVREV.js} +10 -10
  137. package/dist/cli/{quickstart-RVXHK4WA.js → quickstart-33ISXQJU.js} +6 -6
  138. package/dist/cli/{quickstart-IYNJRB5G.mjs → quickstart-YWGNHULM.mjs} +4 -4
  139. package/dist/cli/{run-R3F34KU3.js → run-BWHZXLTD.js} +45 -45
  140. package/dist/cli/{run-VBQPPMEX.mjs → run-J6FCAKQC.mjs} +25 -25
  141. package/dist/cli/search-JCWJX2XD.js +32 -0
  142. package/dist/cli/{search-B7R62HX5.mjs → search-Z3UU3WBB.mjs} +8 -8
  143. package/dist/cli/{search-output-LNQQXIGZ.mjs → search-output-OJYY4J7E.mjs} +4 -4
  144. package/dist/cli/{search-output-LWHWEPOT.js → search-output-YIPV74ME.js} +6 -6
  145. package/dist/cli/{secrets-QBOZ7WTD.js → secrets-UXRJCEN4.js} +16 -16
  146. package/dist/cli/{secrets-NM3VAJLO.mjs → secrets-YZZN2WST.mjs} +7 -7
  147. package/dist/cli/{sessions-R5BSIJ4I.mjs → sessions-ITCGPD7Z.mjs} +6 -6
  148. package/dist/cli/sessions-NA4SJH6Q.js +22 -0
  149. package/dist/cli/{settings-POYWKNRD.js → settings-LAFYMILP.js} +86 -86
  150. package/dist/cli/{settings-S4PN7WLY.mjs → settings-ZP2LSVNM.mjs} +13 -13
  151. package/dist/cli/{setup-VHB4Z654.js → setup-4AL3XYM5.js} +49 -49
  152. package/dist/cli/{setup-PFLXVBTL.mjs → setup-WEQAQSYC.mjs} +9 -9
  153. package/dist/cli/{skills-W2TELEU7.mjs → skills-NQH4HFW2.mjs} +7 -7
  154. package/dist/cli/skills-XZ4Y6SZ7.js +36 -0
  155. package/dist/cli/{tools-M4FA6N3Y.mjs → tools-CXK2GSI4.mjs} +18 -18
  156. package/dist/cli/tools-WJQ6Y7E4.js +57 -0
  157. package/dist/cli/{update-W7LIHEA7.mjs → update-3ROF3Z75.mjs} +9 -9
  158. package/dist/cli/update-ZLRLTBRD.js +34 -0
  159. package/dist/cli/{views-KTVPV6UP.mjs → views-AOUHVGV2.mjs} +7 -7
  160. package/dist/cli/{views-DJXAGD7V.js → views-XJFO5CEH.js} +22 -22
  161. package/dist/cli/{workflow-NVZDJKH2.js → workflow-GY3DBHXX.js} +18 -18
  162. package/dist/cli/{workflow-LGKCRODX.mjs → workflow-KBS2QJK6.mjs} +8 -8
  163. package/dist/{client-Tp1LSULB.d.mts → client-D1uWA2Vc.d.mts} +1 -1
  164. package/dist/{client-CCyWJqAI.d.ts → client-Hz7SsBXs.d.ts} +1 -1
  165. package/dist/{client-core-BpYiYEfu.d.ts → client-core-D3Ad7Flt.d.ts} +554 -504
  166. package/dist/{client-core-D8eCZz3O.d.mts → client-core-Db_e63Hb.d.mts} +554 -504
  167. package/dist/{compiler-manifest-EBWEUj0b.d.ts → compiler-manifest-BqwVrOri.d.mts} +38 -18
  168. package/dist/{compiler-manifest-EBWEUj0b.d.mts → compiler-manifest-BqwVrOri.d.ts} +38 -18
  169. package/dist/{errors-CParKUQR.d.mts → errors-BU8FB99X.d.mts} +1 -1
  170. package/dist/{errors-Qt0OTA7_.d.ts → errors-DfVN_FUG.d.ts} +1 -1
  171. package/dist/{index-CoqDkIw0.d.ts → index-BGnvtYGc.d.ts} +6 -1
  172. package/dist/{index-BMUVCNp7.d.mts → index-DjZgwpGw.d.mts} +6 -1
  173. package/dist/index.d.mts +28 -8
  174. package/dist/index.d.ts +28 -8
  175. package/dist/index.js +64 -39
  176. package/dist/index.mjs +32 -7
  177. package/dist/install-integrity.json +133 -128
  178. package/dist/plays/bundle-play-file.d.mts +3 -3
  179. package/dist/plays/bundle-play-file.d.ts +3 -3
  180. package/dist/plays/bundle-play-file.mjs +620 -124
  181. package/dist/plays/play-description.d.mts +3 -3
  182. package/dist/plays/play-description.d.ts +3 -3
  183. package/dist/plays/run-request.d.mts +2 -2
  184. package/dist/plays/run-request.d.ts +2 -2
  185. package/dist/release.d.mts +1 -1
  186. package/dist/release.d.ts +1 -1
  187. package/dist/release.js +2 -2
  188. package/dist/release.mjs +1 -1
  189. package/dist/server.d.mts +4 -4
  190. package/dist/server.d.ts +4 -4
  191. package/dist/server.js +6 -6
  192. package/dist/server.mjs +4 -4
  193. package/package.json +1 -1
  194. package/dist/cli/auth-W32GMYND.js +0 -43
  195. package/dist/cli/concurrent-runs-help-6QT7ZR4W.js +0 -21
  196. package/dist/cli/describe-VLU2LUDJ.js +0 -50
  197. package/dist/cli/git-E6W44F5M.js +0 -25
  198. package/dist/cli/search-UUVFXZRA.js +0 -32
  199. package/dist/cli/sessions-K3PD73Q2.js +0 -22
  200. package/dist/cli/skills-QNE2EYT3.js +0 -36
  201. package/dist/cli/tools-3RLI4HGF.js +0 -57
  202. package/dist/cli/update-UT6KIW2W.js +0 -34
@@ -26,9 +26,10 @@ export const RUNTIME_CAPACITY_POLICY = {
26
26
  */
27
27
  maxActiveLaneMachines: 8,
28
28
  /**
29
- * Shared started/pending worker budget across every release lane. Existing
30
- * claim owners and rollback holds are retained; restoring the active warm
31
- * floor may temporarily exceed this budget without forcing any worker off.
29
+ * Started/pending worker budget shared by historical (draining) release
30
+ * lanes, counted over their own Machines. The active lane grows against
31
+ * maxActiveLaneMachines instead, so draining lanes cannot hold new runs at
32
+ * the warm floor. Existing claim owners and rollback holds are retained.
32
33
  */
33
34
  maxFleetMachines: 8,
34
35
  workerSlotsPerMachine: 8,
@@ -44,7 +45,7 @@ export const RUNTIME_CAPACITY_POLICY = {
44
45
  * boots it in about 1.3 s, against about 12 s for a new Machine, which
45
46
  * waits for its app-scoped static egress IP before it can reach the
46
47
  * database (16% of fresh boots crashed on that wait, 2026-11-10/11).
47
- * Six is the whole burst headroom (maxFleetMachines - activeLaneMachines);
48
+ * Six is the whole burst headroom (maxActiveLaneMachines - activeLaneMachines);
48
49
  * 99% of 161 Production bursts added at most six Machines in their first
49
50
  * minute. More could never start at once inside the fleet budget. Fly
50
51
  * bills a stopped Machine's rootfs at $0.15 per GB-month.
@@ -169,13 +170,23 @@ export function desiredAbsurdLaneMachines(input: {
169
170
  * not free budget until Fly confirms them. This function never removes workers.
170
171
  *
171
172
  * Restore the active warm floor first, even when that reports budget debt.
172
- * Give freed budget to historical runnable lanes in round-robin order before
173
- * active burst growth. Persist nextCursor between reconciliations so repeated
173
+ * Historical runnable lanes share maxFleetMachines (counted over their own
174
+ * Machines) in round-robin order; the active lane grows to
175
+ * maxActiveLaneMachines (counted over its own Machines). Neither partition can
176
+ * starve the other. Persist nextCursor between reconciliations so repeated
174
177
  * single-slot openings do not always favor the first historical release.
175
178
  */
176
179
  export function planAbsurdWorkerFleetGrowth(input: {
177
180
  existingMachines: number;
181
+ /**
182
+ * Started and pending Machines on the active release lane, out of
183
+ * existingMachines. The active lane grows against maxActiveLaneMachines and
184
+ * historical lanes against maxFleetMachines, each counting only its own
185
+ * Machines, so neither can starve the other.
186
+ */
187
+ activeLaneMachines: number;
178
188
  maxFleetMachines?: number;
189
+ maxActiveLaneMachines?: number;
179
190
  activeWarmFloorMissing: number;
180
191
  demands: readonly {
181
192
  releaseId: string;
@@ -203,6 +214,17 @@ export function planAbsurdWorkerFleetGrowth(input: {
203
214
  const maxFleetMachines = requireMachineCount(
204
215
  input.maxFleetMachines ?? RUNTIME_CAPACITY_POLICY.absurd.maxFleetMachines,
205
216
  );
217
+ const maxActiveLaneMachines = requireMachineCount(
218
+ input.maxActiveLaneMachines ??
219
+ RUNTIME_CAPACITY_POLICY.absurd.maxActiveLaneMachines,
220
+ );
221
+ const activeLaneMachines = requireMachineCount(input.activeLaneMachines);
222
+ if (activeLaneMachines > physicalCount) {
223
+ throw new Error(
224
+ 'Active-lane Machines cannot exceed the physical worker fleet.',
225
+ );
226
+ }
227
+ const historicalPhysicalCount = physicalCount - activeLaneMachines;
206
228
  const warmFloorMissing = requireMachineCount(input.activeWarmFloorMissing);
207
229
  const cursor = input.cursor ?? '';
208
230
  if (typeof cursor !== 'string') {
@@ -259,10 +281,10 @@ export function planAbsurdWorkerFleetGrowth(input: {
259
281
  activeLane?.remaining ?? 0,
260
282
  );
261
283
  for (let seat = 0; seat < warmFloorGrowth; seat += 1) grant(activeLane!);
262
- let available = Math.max(
263
- 0,
264
- maxFleetMachines - physicalCount - warmFloorGrowth,
265
- );
284
+ // Historical lanes share maxFleetMachines, counted over their own Machines.
285
+ // On 2026-11-18 one shared budget let nine draining lanes (18 Machines) hold
286
+ // the active lane at its 2-Machine warm floor, and new runs queued 6-12 s.
287
+ let available = Math.max(0, maxFleetMachines - historicalPhysicalCount);
266
288
  const historical = lanes
267
289
  .filter((lane) => !lane.demand.active && lane.remaining > 0)
268
290
  .sort((a, b) =>
@@ -294,27 +316,43 @@ export function planAbsurdWorkerFleetGrowth(input: {
294
316
  }
295
317
  index = (index + 1) % historical.length;
296
318
  }
297
- while (available > 0 && activeLane && activeLane.remaining > 0) {
319
+ // The active lane grows against its own cap, after its warm floor.
320
+ let activeAvailable = Math.max(
321
+ 0,
322
+ maxActiveLaneMachines - activeLaneMachines - warmFloorGrowth,
323
+ );
324
+ while (activeAvailable > 0 && activeLane && activeLane.remaining > 0) {
298
325
  grant(activeLane);
299
- available -= 1;
326
+ activeAvailable -= 1;
300
327
  }
301
328
  let allocatedCount = 0;
329
+ let activeAllocated = 0;
302
330
  let deferredCount = 0;
303
331
  const allocations = lanes.map((lane) => {
304
- allocatedCount +=
332
+ const laneAllocated =
305
333
  lane.allocation.startMachineIds.length + lane.allocation.createCount;
334
+ allocatedCount += laneAllocated;
335
+ if (lane.demand.active) activeAllocated += laneAllocated;
306
336
  deferredCount += lane.remaining;
307
337
  return { ...lane.allocation, deferredCount: lane.remaining };
308
338
  });
309
339
  const projectedPhysicalCount = requireMachineCount(
310
340
  physicalCount + allocatedCount,
311
341
  );
342
+ const historicalAllocated = allocatedCount - activeAllocated;
312
343
  return {
313
344
  allocations,
314
345
  nextCursor,
315
346
  physicalCount,
316
347
  projectedPhysicalCount,
317
- budgetDebt: Math.max(0, projectedPhysicalCount - maxFleetMachines),
348
+ // Debt is reported per partition; the warm floor may exceed the active
349
+ // cap only when protected capacity already fills it.
350
+ budgetDebt:
351
+ Math.max(
352
+ 0,
353
+ historicalPhysicalCount + historicalAllocated - maxFleetMachines,
354
+ ) +
355
+ Math.max(0, activeLaneMachines + activeAllocated - maxActiveLaneMachines),
318
356
  deferredCount,
319
357
  warmFloorGrowth,
320
358
  maxFleetMachines,
@@ -776,10 +776,23 @@ function isTransientHeartbeatTimeout(error: unknown): boolean {
776
776
  );
777
777
  }
778
778
 
779
- function capacityDeferralSeconds(error: unknown, runId: string): number {
779
+ export function capacityDeferralSeconds(
780
+ error: unknown,
781
+ runId: string,
782
+ generation?: number,
783
+ ): number {
780
784
  if (!isRuntimeSchedulerCapacityError(error)) return 5;
785
+ // A run repeatedly rejected at the workspace cap does not need to claim
786
+ // another generation every 15 seconds. Preserve short retries on young
787
+ // runs and use the existing durable task defer for older generations.
788
+ const workspaceCapFloorSeconds =
789
+ error instanceof RuntimeSandboxCapacityLimitError &&
790
+ generation !== undefined &&
791
+ generation >= 5
792
+ ? 60
793
+ : 1;
781
794
  const baseSeconds = Math.max(
782
- 1,
795
+ workspaceCapFloorSeconds,
783
796
  Math.ceil(runtimeSchedulerCapacityRetryAfterMs(error) / 1_000),
784
797
  );
785
798
  // Keep a saturated fleet from waking every parked run in the same second.
@@ -4121,6 +4134,12 @@ async function executeAbsurdAttemptAdapter(
4121
4134
  options,
4122
4135
  ),
4123
4136
  );
4137
+ if (error instanceof RuntimeSandboxCapacityLimitError) {
4138
+ throw new DeferTask(
4139
+ error.message,
4140
+ capacityDeferralSeconds(error, runId, generation),
4141
+ );
4142
+ }
4124
4143
  throw error;
4125
4144
  }
4126
4145
  await salvageAbsurdFinalAttemptTerminal({
@@ -1191,6 +1191,14 @@ export function createPostgresSchedulerProgressReporter(input: {
1191
1191
  return;
1192
1192
  }
1193
1193
  if (event.type === 'docflow.node.completed') {
1194
+ // A decision's completion is re-emitted carrying the arm it took; a
1195
+ // repeat of the same invocation without it must not erase that arm.
1196
+ const decision =
1197
+ event.decision ??
1198
+ (current?.nodeIo?.attempt === event.attempt &&
1199
+ current.nodeIo.invocationId === event.invocationId
1200
+ ? current.nodeIo.decision
1201
+ : undefined);
1194
1202
  setNodeProgress(event.nodeId, {
1195
1203
  startedAt: current?.startedAt ?? event.at,
1196
1204
  completedAt: event.at,
@@ -1202,6 +1210,7 @@ export function createPostgresSchedulerProgressReporter(input: {
1202
1210
  outputs: event.outputs,
1203
1211
  ...(event.outputsTruncated ? { outputsTruncated: true } : {}),
1204
1212
  error: null,
1213
+ ...(decision ? { decision } : {}),
1205
1214
  },
1206
1215
  });
1207
1216
  scheduleFlush(true);
@@ -1560,6 +1569,14 @@ export function createPostgresSchedulerProgressReporter(input: {
1560
1569
  continue;
1561
1570
  }
1562
1571
  const at = observation.settledAt ?? observation.startedAt ?? Date.now();
1572
+ // Durable observations carry no decision arm; the live completion that
1573
+ // recorded one for this same invocation keeps it.
1574
+ const decision =
1575
+ observation.status === 'completed' &&
1576
+ current?.nodeIo?.attempt === observation.attempt &&
1577
+ current.nodeIo.invocationId === (observation.invocationId ?? undefined)
1578
+ ? current.nodeIo.decision
1579
+ : undefined;
1563
1580
  setNodeProgress(nodeId, {
1564
1581
  startedAt: current?.startedAt ?? observation.startedAt ?? at,
1565
1582
  ...(observation.status === 'started' ? {} : { completedAt: at }),
@@ -1581,6 +1598,7 @@ export function createPostgresSchedulerProgressReporter(input: {
1581
1598
  : observation.status === 'completed'
1582
1599
  ? { error: null }
1583
1600
  : {}),
1601
+ ...(decision ? { decision } : {}),
1584
1602
  },
1585
1603
  });
1586
1604
  }
@@ -19815,6 +19815,74 @@ export async function getPostgresSchedulerObservationsForRuns(
19815
19815
  return result.rows.map(mapObservationRow);
19816
19816
  }
19817
19817
 
19818
+ /**
19819
+ * The newest settled observation of EVERY node for a bounded page of runs, in
19820
+ * one org-scoped read over the observations primary key — what a runs grid's
19821
+ * per-step columns summarize. Same winner rule as the one-node read: highest
19822
+ * attempt, then latest invocation.
19823
+ */
19824
+ export async function getPostgresSchedulerSettledObservationsForRuns(
19825
+ client: PostgresSchedulerQueryClient,
19826
+ input: { runIds: readonly string[] },
19827
+ options: PostgresSchedulerReceiptOptions,
19828
+ ): Promise<DocflowObservationRecord[]> {
19829
+ const runIds = [
19830
+ ...new Set(input.runIds.map((runId) => runId.trim()).filter(Boolean)),
19831
+ ];
19832
+ if (runIds.length === 0) return [];
19833
+ const result = await client.query<ObservationRow>(
19834
+ `
19835
+ SELECT DISTINCT ON (run_id, node_id)
19836
+ run_id, attempt, node_id, invocation_seq, invocation_id, status,
19837
+ inputs_json, outputs_json, inputs_truncated, outputs_truncated,
19838
+ error, started_at, settled_at
19839
+ FROM ${tableName('observations', options)}
19840
+ WHERE org_id = $1
19841
+ AND run_id = ANY($2::text[])
19842
+ AND status IN ('completed', 'failed')
19843
+ ORDER BY run_id, node_id, attempt DESC, invocation_seq DESC
19844
+ `,
19845
+ [receiptOrgId(options), runIds],
19846
+ );
19847
+ return result.rows.map(mapObservationRow);
19848
+ }
19849
+
19850
+ /**
19851
+ * The diagram each run of a bounded page pinned at launch: the `docflow` of
19852
+ * the static pipeline frozen into its contract snapshot. A run's steps are
19853
+ * read against the diagram it ran with, not the Play's current one, so an
19854
+ * edited diagram never relabels or drops an old run's recorded steps. Read
19855
+ * through the runs primary key, org-scoped; the JSON path is extracted in the
19856
+ * database so the rest of the launch never leaves it. Runs without a pinned
19857
+ * diagram are absent.
19858
+ */
19859
+ export async function getPostgresSchedulerPinnedDocflowsForRuns(
19860
+ client: PostgresSchedulerQueryClient,
19861
+ input: { runIds: readonly string[] },
19862
+ options: PostgresSchedulerReceiptOptions,
19863
+ ): Promise<Map<string, unknown>> {
19864
+ const runIds = [
19865
+ ...new Set(input.runIds.map((runId) => runId.trim()).filter(Boolean)),
19866
+ ];
19867
+ if (runIds.length === 0) return new Map();
19868
+ const result = await client.query<{ run_id: string; docflow: unknown }>(
19869
+ `
19870
+ SELECT run_id,
19871
+ launch_json #> '{contractSnapshot,staticPipeline,docflow}' AS docflow
19872
+ FROM ${tableName('runs', options)}
19873
+ WHERE org_id = $1
19874
+ AND run_id = ANY($2::text[])
19875
+ `,
19876
+ [receiptOrgId(options), runIds],
19877
+ );
19878
+ const docflows = new Map<string, unknown>();
19879
+ for (const row of result.rows) {
19880
+ if (row.docflow && typeof row.docflow === 'object')
19881
+ docflows.set(row.run_id, row.docflow);
19882
+ }
19883
+ return docflows;
19884
+ }
19885
+
19818
19886
  export async function countPostgresSchedulerReceipts(
19819
19887
  client: PostgresSchedulerQueryClient,
19820
19888
  input: {
@@ -310,8 +310,11 @@ export async function reserveRuntimeSandboxCapacityLease(
310
310
  /** Resume the one unresolved Daytona create for this run, if present. */
311
311
  resumePendingDaytonaOperation?: boolean;
312
312
  /**
313
- * The `play.concurrent_runs` entitlement the launch carries. When set it
314
- * is the limit; otherwise the mirrored cap, then the runtime default.
313
+ * The `play.concurrent_runs` entitlement the launch carries. Any unexpired
314
+ * time-limited row in the mirrored org limit cache wins, raising or
315
+ * lowering the limit, so an operator can resize an org's already-queued
316
+ * runs; otherwise this, then the mirrored cap, then the runtime default.
317
+ * A permanent mirrored row never outranks the launch.
315
318
  */
316
319
  entitlementLimit?: number | null;
317
320
  },
@@ -392,7 +395,12 @@ export async function reserveRuntimeSandboxCapacityLease(
392
395
  `
393
396
  WITH observed AS MATERIALIZED (
394
397
  SELECT
395
- coalesce($14::integer, capacity.configured_limit) AS "limit",
398
+ coalesce((
399
+ SELECT override."limit" FROM ${cache} AS override
400
+ WHERE override.org_id = $1
401
+ AND override.expires_at IS NOT NULL
402
+ AND override.expires_at > clock_timestamp()
403
+ ), $14::integer, capacity.configured_limit) AS "limit",
396
404
  capacity.active_leases,
397
405
  coalesce((
398
406
  SELECT jsonb_agg(pending)
@@ -4,6 +4,9 @@ import {
4
4
  isQueryResultDatasetReadRequest,
5
5
  } from './query-result-dataset';
6
6
 
7
+ const WORKSPACE_CALENDAR_LIST_ALIAS =
8
+ 'events.google-calendar.calendars.list-workspace';
9
+
7
10
  const ALWAYS_FRESH_INTEGRATION_TOOL_IDS = new Set([
8
11
  'google_workspace_request',
9
12
  'google_workspace_export_dataset',
@@ -12,6 +15,8 @@ const ALWAYS_FRESH_INTEGRATION_TOOL_IDS = new Set([
12
15
  // Google sharing and the current credential must be checked on every call.
13
16
  'google_calendar_availability_get_free_busy',
14
17
  'google_calendar_availability_get_workspace_free_busy',
18
+ 'google_calendar_availability_list_workspace_calendars',
19
+ WORKSPACE_CALENDAR_LIST_ALIAS,
15
20
  'google_calendar_availability_query_free_busy',
16
21
  'google_calendar_availability_get_booking_event',
17
22
  'google_calendar_availability_insert_event',
@@ -33,6 +38,8 @@ const ALWAYS_FRESH_INTEGRATION_READ_TOOL_IDS = new Set([
33
38
  'google_workspace_request',
34
39
  'google_calendar_availability_get_free_busy',
35
40
  'google_calendar_availability_get_workspace_free_busy',
41
+ 'google_calendar_availability_list_workspace_calendars',
42
+ WORKSPACE_CALENDAR_LIST_ALIAS,
36
43
  'google_calendar_availability_query_free_busy',
37
44
  'google_calendar_availability_get_booking_event',
38
45
  ]);
@@ -175,7 +182,8 @@ export function reusableWindowEligibility(
175
182
  return refuse(
176
183
  'workspace',
177
184
  toolId,
178
- toolId.startsWith('google_calendar_availability_')
185
+ toolId.startsWith('google_calendar_availability_') ||
186
+ toolId === WORKSPACE_CALENDAR_LIST_ALIAS
179
187
  ? 'checks current calendar access on every call'
180
188
  : 'works on a live Google Workspace file whose edits and conflict checks must be seen each run',
181
189
  );
@@ -2030,6 +2030,54 @@ export function createToolExecuteResult<TResult = unknown>(input: {
2030
2030
  return wrapper;
2031
2031
  }
2032
2032
 
2033
+ const DOCFLOW_TOOL_RESULT_PREVIEW_FIELDS = 16;
2034
+
2035
+ /**
2036
+ * A plain-data view of a tool result for diagram node previews, which never
2037
+ * invoke getters on authored values. A tool result is runtime-owned: its
2038
+ * fields read the provider response through runtime accessors, so this view
2039
+ * resolves them here, bounded and fail-safe.
2040
+ *
2041
+ * Enumerable keys are the tool's declared outputs, in declared order (so every
2042
+ * run of a node previews the same fields in the same order), each resolved
2043
+ * through `result.field(name)`. `fields` (the catalog tree, as plain data) and
2044
+ * `status` stay readable by an `out:` path without crowding the preview. A
2045
+ * result with no declared outputs, and any other value, is returned unchanged.
2046
+ */
2047
+ export function docflowToolResultPreviewProjection(value: unknown): unknown {
2048
+ let outputs: string[];
2049
+ try {
2050
+ if (!isToolExecuteResult(value)) return value;
2051
+ const extractors = (value._metadata as { extractors?: unknown })
2052
+ .extractors;
2053
+ outputs = isRecord(extractors) ? Object.keys(extractors) : [];
2054
+ } catch {
2055
+ return value;
2056
+ }
2057
+ if (outputs.length === 0) return value;
2058
+ const projection: Record<string, unknown> = {};
2059
+ for (const name of outputs.slice(0, DOCFLOW_TOOL_RESULT_PREVIEW_FIELDS)) {
2060
+ try {
2061
+ projection[name] = (value as { field(name: string): unknown }).field(
2062
+ name,
2063
+ );
2064
+ } catch {
2065
+ // An ambiguous or unreadable field is left out of the preview.
2066
+ }
2067
+ }
2068
+ let tree: unknown = null;
2069
+ try {
2070
+ tree = JSON.parse(JSON.stringify(value.fields ?? {}) ?? 'null');
2071
+ } catch {
2072
+ tree = null;
2073
+ }
2074
+ Object.defineProperties(projection, {
2075
+ fields: { value: tree, enumerable: false },
2076
+ status: { value: value.status, enumerable: false },
2077
+ });
2078
+ return projection;
2079
+ }
2080
+
2033
2081
  export function isToolExecuteResult(
2034
2082
  value: unknown,
2035
2083
  ): value is ToolExecuteResult {
@@ -234,6 +234,10 @@ export const PLAY_AUTHORING_CONTRACT_ISSUE_CODES = [
234
234
  'docflow_binding_drift',
235
235
  'docflow_branch_labels_required',
236
236
  'docflow_branch_requires_decision',
237
+ 'docflow_decision_arms_incomplete',
238
+ 'docflow_decision_outside_region',
239
+ 'docflow_region_exits_unlabeled',
240
+ 'docflow_show_undeclared',
237
241
  'docflow_direction_not_top_down',
238
242
  'docflow_directive_ignored',
239
243
  'docflow_dataset_unrepresented',
@@ -245,7 +249,8 @@ export const PLAY_AUTHORING_CONTRACT_ISSUE_CODES = [
245
249
  'play_dataset_column_order_unknown',
246
250
  'docflow_layout_complexity',
247
251
  'docflow_topology_invalid',
248
- 'docflow_io_ambiguous',
252
+ 'docflow_io_missing',
253
+ 'docflow_box_is_sketch',
249
254
  'docflow_input_not_found',
250
255
  'docflow_output_not_found',
251
256
  'docflow_label_counts_rows',