deepline 0.3.535 → 0.3.536

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 (229) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +232 -147
  2. package/dist/bundling-sources/sdk/src/index.ts +4 -0
  3. package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +27 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +16 -5
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/types.ts +2 -23
  7. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +26 -14
  8. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-input-contract.ts +33 -8
  9. package/dist/bundling-sources/shared_libs/monitors/fleets/count-drift-alert.ts +121 -0
  10. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
  11. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +14 -82
  12. package/dist/bundling-sources/shared_libs/monitors/package.json +1 -0
  13. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
  14. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -26
  15. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +36 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +21 -31
  17. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +88 -96
  18. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
  19. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
  20. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
  21. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +9 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +127 -9
  25. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
  26. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
  28. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
  29. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +7 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
  34. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +8 -3
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  39. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
  40. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
  41. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
  44. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +84 -49
  45. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +37 -32
  46. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
  47. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
  48. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
  49. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
  50. package/dist/cli/auth-6XQKFOLG.js +43 -0
  51. package/dist/cli/{auth-ZCTMB5RA.mjs → auth-KCTCUO7P.mjs} +7 -7
  52. package/dist/cli/{billing-GVFKZQH3.js → billing-4VBGZ3CT.js} +273 -112
  53. package/dist/cli/{billing-OU2ZHL72.mjs → billing-OOJHKLNS.mjs} +185 -24
  54. package/dist/cli/{chunk-FGN75ZN6.js → chunk-2B4IOGFD.js} +390 -382
  55. package/dist/cli/{chunk-KOZBZPRM.js → chunk-2FCSUOYN.js} +55 -55
  56. package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
  57. package/dist/cli/{chunk-AUEUAPVS.mjs → chunk-2YWJS76L.mjs} +1 -1
  58. package/dist/cli/{chunk-W5YJYU4G.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
  59. package/dist/cli/{chunk-UUQ2OXMH.js → chunk-4E5JXZ3W.js} +18 -20
  60. package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
  61. package/dist/cli/{chunk-XSOTEVOB.js → chunk-6BBGUQJJ.js} +50 -141
  62. package/dist/cli/{chunk-PHLNYBAA.js → chunk-6VUGBQZQ.js} +5 -5
  63. package/dist/cli/{chunk-G2DLG32W.mjs → chunk-AB2GBOD4.mjs} +40 -27
  64. package/dist/cli/{chunk-JWWYLGUT.mjs → chunk-ANUKBZ6W.mjs} +475 -11
  65. package/dist/cli/{chunk-FZKPPB5P.mjs → chunk-BASLYGXK.mjs} +85 -77
  66. package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
  67. package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
  68. package/dist/cli/{chunk-PI5R65OQ.js → chunk-CIDN5K23.js} +1 -1
  69. package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
  70. package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
  71. package/dist/cli/{chunk-D4MHCCIR.js → chunk-CWSLUNA6.js} +33 -33
  72. package/dist/cli/{chunk-E3CLOVG5.mjs → chunk-CXTW7SRW.mjs} +50 -141
  73. package/dist/cli/{chunk-H6SWS5CG.mjs → chunk-DA2I2M7D.mjs} +2 -2
  74. package/dist/cli/{chunk-WAIBM6KX.mjs → chunk-DQHUJMCL.mjs} +5 -5
  75. package/dist/cli/{chunk-DWPY6ZID.mjs → chunk-DUYAMLOC.mjs} +1 -1
  76. package/dist/cli/{chunk-K53NKWZO.mjs → chunk-E24UGPGG.mjs} +13 -15
  77. package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
  78. package/dist/cli/{chunk-7R5DAANG.mjs → chunk-GF32SBST.mjs} +1 -1
  79. package/dist/cli/{chunk-7CWSAEYS.mjs → chunk-GHLDCLSC.mjs} +1 -1
  80. package/dist/cli/{chunk-ZUVE63Y7.js → chunk-GTVZKY3F.js} +2 -2
  81. package/dist/cli/{chunk-J75DANZY.mjs → chunk-HAJQGP5V.mjs} +2 -2
  82. package/dist/cli/{chunk-RFQWSH6I.js → chunk-HWDKRN7L.js} +3 -3
  83. package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
  84. package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
  85. package/dist/cli/{chunk-K76AEBFY.mjs → chunk-JUHDJNSI.mjs} +4 -4
  86. package/dist/cli/{chunk-R2KKEHJN.mjs → chunk-KPQHUVYW.mjs} +5 -5
  87. package/dist/cli/{chunk-6LHX33VN.js → chunk-KWYGWO4Y.js} +9 -6
  88. package/dist/cli/{chunk-7PXP2FQK.js → chunk-LDGZFDUB.js} +2 -2
  89. package/dist/cli/{chunk-KWGXHPHL.js → chunk-LN6RXDTB.js} +523 -59
  90. package/dist/cli/{chunk-TCVCFZP6.mjs → chunk-LZXZQPA2.mjs} +4 -1
  91. package/dist/cli/{chunk-2D6SWQTK.js → chunk-MSP4DTSD.js} +13 -13
  92. package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
  93. package/dist/cli/{chunk-QYBAHYP4.mjs → chunk-OUDTOMZC.mjs} +7 -9
  94. package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
  95. package/dist/cli/{chunk-6TYRRNXY.mjs → chunk-PNY3BWHP.mjs} +2 -2
  96. package/dist/cli/{chunk-DYIWDUY4.js → chunk-Q4MNUOS4.js} +316 -303
  97. package/dist/cli/{chunk-5EKNDNFQ.js → chunk-Q5CXV3E3.js} +2 -2
  98. package/dist/cli/{chunk-W6T23EUC.mjs → chunk-RVSSQPQO.mjs} +1 -1
  99. package/dist/cli/{chunk-WNNA4L6Z.js → chunk-SLPJ3LXI.js} +22 -22
  100. package/dist/cli/{chunk-K3IPGMGP.js → chunk-TX5TUHJN.js} +17 -19
  101. package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
  102. package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
  103. package/dist/cli/{chunk-4NLRWKZB.js → chunk-VBDZIMWD.js} +26 -26
  104. package/dist/cli/{chunk-DAPKLYST.js → chunk-W7AEIGZR.js} +41 -41
  105. package/dist/cli/{chunk-LVISZFYO.mjs → chunk-WC5M3JXE.mjs} +2 -2
  106. package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
  107. package/dist/cli/{chunk-243O3FH5.js → chunk-XBAH3TKU.js} +5 -5
  108. package/dist/cli/{chunk-DFJODFMC.mjs → chunk-XJD2GYUP.mjs} +5 -5
  109. package/dist/cli/{chunk-BF65LB7X.mjs → chunk-XVZRJJDS.mjs} +4 -4
  110. package/dist/cli/{chunk-OM732MGV.js → chunk-Y2NTPYGS.js} +17 -17
  111. package/dist/cli/{chunk-YFZLZNTH.mjs → chunk-YBMHOH6H.mjs} +4 -4
  112. package/dist/cli/{chunk-RKY4LBX3.mjs → chunk-YRLAUGQY.mjs} +3 -3
  113. package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
  114. package/dist/cli/{chunk-JQQG4QL4.mjs → chunk-Z7UIOGW4.mjs} +3 -3
  115. package/dist/cli/{chunk-HYBZWSSH.js → chunk-ZEV2Y56V.js} +44 -44
  116. package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
  117. package/dist/cli/{chunk-HWPOXCCK.js → chunk-ZILSRDIN.js} +8 -8
  118. package/dist/cli/{chunk-CIDATNTY.js → chunk-ZISEH7OL.js} +16 -16
  119. package/dist/cli/{chunk-KA6ZERJL.js → chunk-ZZ4MF2GI.js} +6 -6
  120. package/dist/cli/command-docs.js +2 -2
  121. package/dist/cli/command-docs.mjs +1 -1
  122. package/dist/cli/{csv-CD55KEIO.js → csv-2V2DIFNG.js} +15 -15
  123. package/dist/cli/{csv-CLPVMIRF.mjs → csv-P3HLK4GO.mjs} +6 -6
  124. package/dist/cli/{db-MQKLDAEO.js → db-MREAQVW6.js} +36 -36
  125. package/dist/cli/{db-AU4SMWUN.mjs → db-ZYOY3QRQ.mjs} +9 -9
  126. package/dist/cli/describe-IKZFOADR.mjs +49 -0
  127. package/dist/cli/describe-WW3OQRLP.js +49 -0
  128. package/dist/cli/describe-core.d.mts +3 -3
  129. package/dist/cli/describe-core.d.ts +3 -3
  130. package/dist/cli/describe-core.js +5 -5
  131. package/dist/cli/describe-core.mjs +4 -4
  132. package/dist/cli/{executions-77GOLWRM.js → executions-H5IJ7QSQ.js} +11 -11
  133. package/dist/cli/{executions-TFIJPUX7.mjs → executions-KTSY5M34.mjs} +9 -9
  134. package/dist/cli/{feedback-OV5YAL3A.js → feedback-724QK3Z5.js} +16 -16
  135. package/dist/cli/{feedback-2WRSZ5WL.mjs → feedback-WWJRIXEU.mjs} +8 -8
  136. package/dist/cli/git-PHYRD56H.js +25 -0
  137. package/dist/cli/{git-VNS4ATLZ.mjs → git-R5VRG7X6.mjs} +7 -7
  138. package/dist/cli/index.js +151 -157
  139. package/dist/cli/index.mjs +51 -57
  140. package/dist/cli/{legacy-noops-HDOB5C6F.js → legacy-noops-C6GDEGPU.js} +11 -11
  141. package/dist/cli/{legacy-noops-C732QDCY.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
  142. package/dist/cli/{monitors-5IUMHH3E.js → monitors-VAVQ4WCE.js} +125 -122
  143. package/dist/cli/{monitors-2LYEFXOU.mjs → monitors-WQSKMHAP.mjs} +19 -16
  144. package/dist/cli/{org-ADW2EVAC.js → org-CWWRWXZQ.js} +89 -89
  145. package/dist/cli/{org-G4YGZPHS.mjs → org-MAL4QPVF.mjs} +9 -9
  146. package/dist/cli/{play-7GQ56C2D.mjs → play-ILW6MSNG.mjs} +123 -76
  147. package/dist/cli/{play-EHSOSSHT.js → play-WJOWK5PQ.js} +641 -594
  148. package/dist/cli/{providers-WL3YTCSV.mjs → providers-4V2NMLZZ.mjs} +9 -9
  149. package/dist/cli/{providers-PWCF6OOO.js → providers-W662ANCH.js} +12 -12
  150. package/dist/cli/{quickstart-ZKI5MURA.js → quickstart-BW6EBUYX.js} +8 -8
  151. package/dist/cli/{quickstart-323XOPGI.mjs → quickstart-C22BR743.mjs} +6 -6
  152. package/dist/cli/{run-XZPWA6JS.js → run-KW7KW4FX.js} +50 -53
  153. package/dist/cli/{run-ZCNZU3K2.mjs → run-SPAU5IMW.mjs} +31 -34
  154. package/dist/cli/search-HLE54W5G.js +32 -0
  155. package/dist/cli/{search-CVLVSFMJ.mjs → search-XPC75HLM.mjs} +10 -11
  156. package/dist/cli/{search-output-6PY6RN2R.mjs → search-output-JKYJSEPM.mjs} +6 -6
  157. package/dist/cli/{search-output-7HRSSRBS.js → search-output-VJYE7USJ.js} +8 -8
  158. package/dist/cli/{secrets-6S2ZWDIM.mjs → secrets-OJG73GXQ.mjs} +9 -9
  159. package/dist/cli/{secrets-IYD5VKY4.js → secrets-YB57KGSB.js} +18 -18
  160. package/dist/cli/{sessions-GVEX5TUJ.mjs → sessions-7ZL37BW4.mjs} +8 -8
  161. package/dist/cli/sessions-VEBYZIEU.js +22 -0
  162. package/dist/cli/{settings-CANK4HJQ.js → settings-A7DD2ZYE.js} +88 -89
  163. package/dist/cli/{settings-BN5MJZ3C.mjs → settings-RKSQB7FA.mjs} +15 -16
  164. package/dist/cli/{setup-JNMSCCU4.mjs → setup-NXDUTITY.mjs} +11 -12
  165. package/dist/cli/{setup-YSGKGLSJ.js → setup-S3K5YU62.js} +51 -52
  166. package/dist/cli/skills-NVQ744CN.js +36 -0
  167. package/dist/cli/{skills-QCQN2UM2.mjs → skills-VMFAIDO6.mjs} +9 -10
  168. package/dist/cli/{tools-CDPOID7V.mjs → tools-52NTHBSJ.mjs} +20 -21
  169. package/dist/cli/tools-SBDUL3WB.js +56 -0
  170. package/dist/cli/update-HHVFZPCV.js +34 -0
  171. package/dist/cli/{update-D3ZERUQ3.mjs → update-SAKBEKMV.mjs} +11 -12
  172. package/dist/cli/{views-RDZRWQBQ.mjs → views-ACRV7MD6.mjs} +54 -10
  173. package/dist/cli/{views-4NV2KQKA.js → views-C3GJOBDG.js} +66 -22
  174. package/dist/cli/{workflow-2CG3TVCG.mjs → workflow-CS22E7TC.mjs} +10 -10
  175. package/dist/cli/{workflow-RABJCAZC.js → workflow-ZNWCZEGN.js} +20 -20
  176. package/dist/{client-DhSvMO3A.d.mts → client-BlLYQDNo.d.mts} +1 -1
  177. package/dist/{client-oGNJMQFd.d.ts → client-DSQlkIDO.d.ts} +1 -1
  178. package/dist/{client-core-CdWH6Sii.d.ts → client-core-CDwapXy5.d.ts} +159 -108
  179. package/dist/{client-core-CVG1Et-4.d.mts → client-core-rX7n2H8U.d.mts} +159 -108
  180. package/dist/{compiler-manifest-D2ZlBGxj.d.ts → compiler-manifest-BHNC4RL-.d.mts} +15 -22
  181. package/dist/{compiler-manifest-D2ZlBGxj.d.mts → compiler-manifest-BHNC4RL-.d.ts} +15 -22
  182. package/dist/{errors-B-gOQdj-.d.mts → errors-D7sPXrvB.d.mts} +1 -1
  183. package/dist/{errors-CB0KAmmV.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
  184. package/dist/{index-c3nvUGCS.d.ts → index-CQTBHXHr.d.ts} +1 -1
  185. package/dist/{index-BbJADro4.d.mts → index-NaDZq2xf.d.mts} +1 -1
  186. package/dist/index.d.mts +7 -7
  187. package/dist/index.d.ts +7 -7
  188. package/dist/index.js +15 -15
  189. package/dist/index.mjs +11 -11
  190. package/dist/install-integrity.json +129 -132
  191. package/dist/monitor-fleet-contract.d.mts +17 -11
  192. package/dist/monitor-fleet-contract.d.ts +17 -11
  193. package/dist/monitor-fleet-contract.js +3 -3
  194. package/dist/monitor-fleet-contract.mjs +2 -2
  195. package/dist/monitor-input-contract.js +2 -2
  196. package/dist/monitor-input-contract.mjs +1 -1
  197. package/dist/plays/bundle-play-file.d.mts +3 -3
  198. package/dist/plays/bundle-play-file.d.ts +3 -3
  199. package/dist/plays/bundle-play-file.mjs +17 -5
  200. package/dist/plays/csv-data-input.js +3 -3
  201. package/dist/plays/csv-data-input.mjs +2 -2
  202. package/dist/plays/play-description.d.mts +2 -2
  203. package/dist/plays/play-description.d.ts +2 -2
  204. package/dist/plays/run-request.d.mts +2 -2
  205. package/dist/plays/run-request.d.ts +2 -2
  206. package/dist/plays/run-request.js +3 -3
  207. package/dist/plays/run-request.mjs +2 -2
  208. package/dist/release.d.mts +1 -1
  209. package/dist/release.d.ts +1 -1
  210. package/dist/release.js +2 -2
  211. package/dist/release.mjs +1 -1
  212. package/dist/server.d.mts +4 -4
  213. package/dist/server.d.ts +4 -4
  214. package/dist/server.js +12 -12
  215. package/dist/server.mjs +6 -6
  216. package/package.json +1 -1
  217. package/dist/cli/auth-VDCU3T6A.js +0 -43
  218. package/dist/cli/chunk-4QELPWUW.mjs +0 -405
  219. package/dist/cli/chunk-T7RBM2WX.js +0 -405
  220. package/dist/cli/describe-5BFNHT5V.js +0 -50
  221. package/dist/cli/describe-AWJUXE2U.mjs +0 -50
  222. package/dist/cli/git-HGMX52XU.js +0 -25
  223. package/dist/cli/pages-KXKWSCEV.mjs +0 -266
  224. package/dist/cli/pages-VTJGAI2D.js +0 -266
  225. package/dist/cli/search-J6EY7DQN.js +0 -33
  226. package/dist/cli/sessions-7HPIVSQ4.js +0 -22
  227. package/dist/cli/skills-WDGSSKJZ.js +0 -37
  228. package/dist/cli/tools-URNVXSTZ.js +0 -57
  229. package/dist/cli/update-Q6JW32IA.js +0 -35
@@ -2185,14 +2185,110 @@ type RuntimeMapRowsTrackerInput = {
2185
2185
  budgetBytes?: number;
2186
2186
  };
2187
2187
 
2188
+ /** What `track` charged one row, which `release` takes back. */
2189
+ export type RuntimeMapTrackedRow = {
2190
+ serializedBytes: number;
2191
+ residentBytes: number;
2192
+ };
2193
+
2188
2194
  type RuntimeMapRowsTracker = {
2189
- track(row: unknown): void;
2195
+ track(row: unknown): RuntimeMapTrackedRow;
2196
+ /**
2197
+ * Stop charging a row `track` returned, once nothing retains it. The
2198
+ * largest row seen stays: it describes what was tracked, not what is held.
2199
+ */
2200
+ release(tracked: RuntimeMapTrackedRow): void;
2190
2201
  estimate(): RuntimeMapMemoryEstimate;
2191
2202
  };
2192
2203
 
2204
+ /*
2205
+ * What a completed row costs while a map retains it for its caller's result,
2206
+ * priced from its structure rather than as a multiple of its JSON length.
2207
+ *
2208
+ * Retained rows were charged serialized bytes x 4 + 512. Measured on Node 24.19
2209
+ * and 22.22 (2,000-3,000 rows parsed from JSON and retained as
2210
+ * { key, inputIndex, data } with every value distinct, heap after a full
2211
+ * collection; scripts/benchmark-retained-map-row-resident.mjs), that
2212
+ * charge read 4.00x the resident bytes of a load-heavy-play row, 3.53x a
2213
+ * 40-field CRM upsert and 3.35x a 13 KB nested profile, yet only 0.95x a row
2214
+ * of 150 doubles and 0.74x a 400-field row: one multiplier cannot bound both,
2215
+ * because V8 boxes a double property in a 16-byte HeapNumber, stores a wide
2216
+ * object's properties in a dictionary at 40-60 bytes each against about 8 in
2217
+ * fast mode, and stores a numeric array unboxed at 8 bytes an element.
2218
+ *
2219
+ * In Production the gap held maps shut. The 5,000-row engagers maps of
2220
+ * linkedin-engager-profile-backfill (2026-11-12) carried 204-229 MB of that
2221
+ * charge at their collected live peak while everything the process held
2222
+ * above baseline was 119-139 MB, so ledger occupancy sat over the heap
2223
+ * target with live memory near half of it, and they ran 996-4,757 s.
2224
+ *
2225
+ * Priced this way and scaled by RETAINED_ROW_SAFETY_FACTOR, every measured
2226
+ * shape reads 1.10-3.10x its resident bytes on both versions, never below
2227
+ * it: 1.15x the load-heavy-play row, 1.21x the CRM upsert, 1.32x the
2228
+ * profile, 1.15x the 400-field row, 1.52x the 150 doubles, and at most 3.10x
2229
+ * a row of 200 tiny nested objects.
2230
+ */
2231
+ const RETAINED_STRING_HEADER_BYTES = 24;
2232
+ const RETAINED_HEAP_NUMBER_BYTES = 16;
2233
+ const RETAINED_CONTAINER_BYTES = 64;
2234
+ const RETAINED_ELEMENT_BYTES = 16;
2235
+ const RETAINED_NUMBER_ELEMENT_BYTES = 8;
2236
+ const RETAINED_FAST_PROPERTY_BYTES = 16;
2237
+ const RETAINED_DICTIONARY_PROPERTY_BYTES = 64;
2238
+ /** Own keys past which a parsed object is priced as a dictionary. */
2239
+ const RETAINED_DICTIONARY_PROPERTY_COUNT = 64;
2240
+ const RETAINED_ROW_SAFETY_FACTOR = 1.1;
2241
+ const SMI_LIMIT = 2 ** 30;
2242
+ const TWO_BYTE_CHARACTER = /[^\u0000-\u00ff]/;
2243
+
2244
+ /**
2245
+ * Estimated V8 heap bytes one retained row holds when nothing else shares
2246
+ * its values: an upper bound for every row shape measured above.
2247
+ */
2248
+ export function estimateRuntimeMapRetainedRowBytes(row: unknown): number {
2249
+ let bytes = 0;
2250
+ const pending: unknown[] = [row];
2251
+ while (pending.length > 0) {
2252
+ const value = pending.pop();
2253
+ if (typeof value === 'string') {
2254
+ bytes +=
2255
+ RETAINED_STRING_HEADER_BYTES +
2256
+ value.length * (TWO_BYTE_CHARACTER.test(value) ? 2 : 1);
2257
+ } else if (typeof value === 'number') {
2258
+ if (
2259
+ !(Number.isInteger(value) && value >= -SMI_LIMIT && value < SMI_LIMIT)
2260
+ )
2261
+ bytes += RETAINED_HEAP_NUMBER_BYTES;
2262
+ } else if (ArrayBuffer.isView(value)) {
2263
+ bytes += RETAINED_CONTAINER_BYTES + value.byteLength;
2264
+ } else if (Array.isArray(value)) {
2265
+ if (value.every((element) => typeof element === 'number')) {
2266
+ bytes +=
2267
+ RETAINED_CONTAINER_BYTES +
2268
+ RETAINED_NUMBER_ELEMENT_BYTES * value.length;
2269
+ } else {
2270
+ bytes +=
2271
+ RETAINED_CONTAINER_BYTES + RETAINED_ELEMENT_BYTES * value.length;
2272
+ for (const element of value) pending.push(element);
2273
+ }
2274
+ } else if (value !== null && typeof value === 'object') {
2275
+ const properties = Object.values(value);
2276
+ bytes +=
2277
+ RETAINED_CONTAINER_BYTES +
2278
+ properties.length *
2279
+ (properties.length > RETAINED_DICTIONARY_PROPERTY_COUNT
2280
+ ? RETAINED_DICTIONARY_PROPERTY_BYTES
2281
+ : RETAINED_FAST_PROPERTY_BYTES);
2282
+ for (const property of properties) pending.push(property);
2283
+ }
2284
+ }
2285
+ return Math.ceil(bytes * RETAINED_ROW_SAFETY_FACTOR);
2286
+ }
2287
+
2193
2288
  function createRuntimeMapRowsTracker(
2194
2289
  input: RuntimeMapRowsTrackerInput,
2195
2290
  phase: 'materialize' | 'retained_rows',
2291
+ residentBytesOf: (row: unknown, serializedBytes: number) => number,
2196
2292
  ): RuntimeMapRowsTracker {
2197
2293
  const budgetBytes = positiveBudget(
2198
2294
  input.budgetBytes,
@@ -2201,18 +2297,21 @@ function createRuntimeMapRowsTracker(
2201
2297
  let rowCount = 0;
2202
2298
  let serializedBytes = 0;
2203
2299
  let largestRowBytes = 0;
2204
- const estimate = () =>
2205
- estimateRuntimeMapMaterializedMemory({
2206
- rowCount,
2207
- serializedBytes,
2208
- largestRowBytes,
2209
- });
2300
+ let estimatedResidentBytes = 0;
2301
+ const estimate = (): RuntimeMapMemoryEstimate => ({
2302
+ rowCount,
2303
+ serializedBytes,
2304
+ largestRowBytes,
2305
+ estimatedResidentBytes,
2306
+ });
2210
2307
  return {
2211
2308
  track(row) {
2212
2309
  const rowBytes = runtimeMapJsonByteLength(row);
2310
+ const residentBytes = residentBytesOf(row, rowBytes);
2213
2311
  rowCount += 1;
2214
2312
  serializedBytes += rowBytes;
2215
2313
  largestRowBytes = Math.max(largestRowBytes, rowBytes);
2314
+ estimatedResidentBytes += residentBytes;
2216
2315
  const current = estimate();
2217
2316
  if (current.estimatedResidentBytes > budgetBytes) {
2218
2317
  throw new RuntimeMapMemoryLimitError({
@@ -2222,19 +2321,38 @@ function createRuntimeMapRowsTracker(
2222
2321
  budgetBytes,
2223
2322
  });
2224
2323
  }
2324
+ return { serializedBytes: rowBytes, residentBytes };
2325
+ },
2326
+ release(tracked) {
2327
+ rowCount = Math.max(0, rowCount - 1);
2328
+ serializedBytes = Math.max(0, serializedBytes - tracked.serializedBytes);
2329
+ estimatedResidentBytes = Math.max(
2330
+ 0,
2331
+ estimatedResidentBytes - tracked.residentBytes,
2332
+ );
2225
2333
  },
2226
2334
  estimate,
2227
2335
  };
2228
2336
  }
2229
2337
 
2338
+ /** Input rows a map materializes, priced as before: serialized x 4 + 512. */
2230
2339
  export function createRuntimeMapMaterializationTracker(
2231
2340
  input: RuntimeMapRowsTrackerInput,
2232
2341
  ): RuntimeMapRowsTracker {
2233
- return createRuntimeMapRowsTracker(input, 'materialize');
2342
+ return createRuntimeMapRowsTracker(
2343
+ input,
2344
+ 'materialize',
2345
+ (_row, serializedBytes) =>
2346
+ serializedBytes * NODE_RUNTIME_MAP_MATERIALIZED_MEMORY_MULTIPLIER +
2347
+ NODE_RUNTIME_MAP_ROW_OVERHEAD_BYTES,
2348
+ );
2234
2349
  }
2235
2350
 
2351
+ /** Completed rows a map retains for its result, priced by their structure. */
2236
2352
  export function createRuntimeMapRetainedRowsTracker(
2237
2353
  input: RuntimeMapRowsTrackerInput,
2238
2354
  ): RuntimeMapRowsTracker {
2239
- return createRuntimeMapRowsTracker(input, 'retained_rows');
2355
+ return createRuntimeMapRowsTracker(input, 'retained_rows', (row) =>
2356
+ estimateRuntimeMapRetainedRowBytes(row),
2357
+ );
2240
2358
  }
@@ -84,6 +84,15 @@ export const RUNTIME_MEMORY_LEDGER_OBJECT_PRIOR_FACTOR = 3;
84
84
  export const RUNTIME_MEMORY_LEDGER_RAW_PRIOR_FACTOR = 1.1;
85
85
  /** A two-byte string of a one-byte payload is the worst honest text reading. */
86
86
  export const RUNTIME_MEMORY_LEDGER_RAW_MAX_FACTOR = 2.5;
87
+ /**
88
+ * A category that registers its own resident-byte estimate rather than a
89
+ * serialized length. That estimate already prices the object graph, so a
90
+ * factor above 1 would charge the expansion twice: retained map rows at the
91
+ * object prior of 3 opened at 12x their JSON length, and in the maps that held
92
+ * admission in Production (linkedin-engager-profile-backfill, 2026-11-12) the
93
+ * probe had driven that category's factor to the floor of 1.
94
+ */
95
+ export const RUNTIME_MEMORY_LEDGER_RESIDENT_PRIOR_FACTOR = 1;
87
96
  /**
88
97
  * A category must own at least this share of the current prediction before a
89
98
  * sample is allowed to move its factor. One heap reading is one equation in
@@ -133,9 +142,13 @@ export const RUNTIME_MEMORY_LEDGER_CATEGORY_EXPANSION: Record<
133
142
  min: RUNTIME_MEMORY_LEDGER_MIN_FACTOR,
134
143
  max: RUNTIME_MEMORY_LEDGER_MAX_FACTOR,
135
144
  },
136
- // Rows the caller will read: decoded cell values, same regime as a body.
145
+ // Rows the caller will read. Unlike the other categories this one registers
146
+ // an estimate of resident bytes, not a serialized length
147
+ // (`estimateRuntimeMapRetainedRowBytes`, an upper bound for every measured
148
+ // row shape), so it opens at 1 rather than multiplying that estimate by the
149
+ // object prior again. The probe may still raise it.
137
150
  materializedRows: {
138
- prior: RUNTIME_MEMORY_LEDGER_OBJECT_PRIOR_FACTOR,
151
+ prior: RUNTIME_MEMORY_LEDGER_RESIDENT_PRIOR_FACTOR,
139
152
  min: RUNTIME_MEMORY_LEDGER_MIN_FACTOR,
140
153
  max: RUNTIME_MEMORY_LEDGER_MAX_FACTOR,
141
154
  },
@@ -10,6 +10,7 @@ const RESULT_COLUMNS = {
10
10
  'company-to-job-postings': 'job_postings',
11
11
  'company-to-news': 'news_events',
12
12
  'company-to-tech-stack': 'technologies',
13
+ 'find-professional': 'person_name',
13
14
  'name-and-domain-to-email-waterfall': 'email',
14
15
  'person-linkedin-to-company': 'company_domain',
15
16
  'person-linkedin-to-email': 'email',
@@ -19,7 +20,6 @@ const RESULT_COLUMNS = {
19
20
  'person-to-phone': 'phone',
20
21
  'personal-email': 'personal_email',
21
22
  'personal-email-to-linkedin': 'linkedin_url',
22
- 'professional-to-email': 'email',
23
23
  'smb-business-email': 'email',
24
24
  } as const;
25
25
 
@@ -62,6 +62,12 @@ export type PlayRunnerRateStateAcquireInput = {
62
62
  export type PlayRunnerRateStateConcurrencyObservation = {
63
63
  kind: 'success' | 'throttled';
64
64
  latencyMs: number;
65
+ /**
66
+ * The permit's server-authored `inFlightAtStart`. Optional: older runners
67
+ * omit it, and older receivers ignore it. A receiver that reads it lets a
68
+ * success grow the learned limit only when the call ran near that limit.
69
+ */
70
+ inFlightAtStart?: number;
65
71
  };
66
72
 
67
73
  export type PlayRunnerRateStateConcurrencyObservationBatch = {
@@ -99,6 +99,7 @@ export function simulateFixtureCapacityDiscovery(
99
99
  concurrency: providerConcurrencyControllerOptions({
100
100
  initialLimit: initialConcurrency,
101
101
  maximumLimit: maximumExplorationConcurrency,
102
+ unknownProvider: true,
102
103
  }),
103
104
  });
104
105
  const pending: number[] = Array.from(
@@ -9,6 +9,11 @@ export type Gradient2ConcurrencyControllerOptions = Readonly<{
9
9
  startupProbeMultiplier?: number;
10
10
  /** Reprobe undeclared capacity after an entire healthy completion window. */
11
11
  recoveryProbeMultiplier?: number;
12
+ /**
13
+ * Share of the current limit a success must have started with in flight to
14
+ * count toward the next limit change. Absent: every success counts.
15
+ */
16
+ provenOccupancyFraction?: number;
12
17
  }>;
13
18
 
14
19
  export type Gradient2Observation = Readonly<{
@@ -47,6 +52,13 @@ function openFraction(value: number, label: string): number {
47
52
  return value;
48
53
  }
49
54
 
55
+ function provenFraction(value: number): number {
56
+ if (!Number.isFinite(value) || value <= 0 || value > 1) {
57
+ throw new Error('Proven occupancy fraction must be in (0, 1].');
58
+ }
59
+ return value;
60
+ }
61
+
50
62
  function clamp(value: number, minimum: number, maximum: number): number {
51
63
  return Math.min(maximum, Math.max(minimum, value));
52
64
  }
@@ -66,6 +78,7 @@ export class Gradient2ConcurrencyController {
66
78
  readonly #rttTolerance: number;
67
79
  readonly #startupProbeMultiplier: number;
68
80
  readonly #recoveryProbeMultiplier: number;
81
+ readonly #provenOccupancyFraction: number | null;
69
82
  #limit: number;
70
83
  #shortRttMs: number | null = null;
71
84
  #longRttMs: number | null = null;
@@ -105,6 +118,10 @@ export class Gradient2ConcurrencyController {
105
118
  'Recovery probe multiplier',
106
119
  ),
107
120
  );
121
+ this.#provenOccupancyFraction =
122
+ options.provenOccupancyFraction === undefined
123
+ ? null
124
+ : provenFraction(options.provenOccupancyFraction);
108
125
  this.#windowStartedAtLimit = this.#limit;
109
126
  if (checkpoint) {
110
127
  this.#limit = clamp(
@@ -169,6 +186,10 @@ export class Gradient2ConcurrencyController {
169
186
  this.#minimumRttMs === null
170
187
  ? latencyMs
171
188
  : Math.min(this.#minimumRttMs, latencyMs);
189
+ // A call that started far below the limit never tested it. Its latency
190
+ // still informs the RTT baselines, but it cannot close a window, so the
191
+ // limit only grows after calls actually ran near it.
192
+ if (!this.#provesLimit(observation)) return;
172
193
  this.#successfulSamplesInWindow += 1;
173
194
  if (
174
195
  this.#successfulSamplesInWindow < Math.ceil(this.#windowStartedAtLimit)
@@ -204,6 +225,26 @@ export class Gradient2ConcurrencyController {
204
225
  this.#windowStartedAtLimit = this.#limit;
205
226
  }
206
227
 
228
+ #provesLimit(observation: Gradient2Observation): boolean {
229
+ // Older writers send no occupancy. Absence keeps their samples counting.
230
+ if (
231
+ this.#provenOccupancyFraction === null ||
232
+ observation.inFlightAtStart === undefined
233
+ ) {
234
+ return true;
235
+ }
236
+ // Never ask for more than a fractional limit can admit when enforced by
237
+ // rounding down, or a saturated lane could never prove itself again.
238
+ const required = Math.max(
239
+ 1,
240
+ Math.min(
241
+ Math.floor(this.#limit + 1e-9),
242
+ Math.ceil(this.#limit * this.#provenOccupancyFraction - 1e-9),
243
+ ),
244
+ );
245
+ return observation.inFlightAtStart >= required;
246
+ }
247
+
207
248
  snapshot(): Gradient2ConcurrencyControllerSnapshot {
208
249
  return Object.freeze({
209
250
  limit: this.#limit,
@@ -31,6 +31,12 @@ export const PROVIDER_CAPACITY_POLICY = Object.freeze({
31
31
  rttTolerance: 1.25,
32
32
  startupProbeMultiplier: 2,
33
33
  unknownProviderRecoveryProbeMultiplier: 2,
34
+ // On an undeclared scope, a success proves the current limit only when its
35
+ // call started with at least this share of the limit in flight. Calls that
36
+ // never came near the limit say nothing about whether a larger one is
37
+ // safe. A declared limit already caps growth, so its lanes count every
38
+ // success.
39
+ provenOccupancyFraction: 0.8,
34
40
  }),
35
41
  } as const);
36
42
 
@@ -31,5 +31,14 @@ export function providerConcurrencyControllerOptions(input: {
31
31
  ? PROVIDER_CAPACITY_POLICY.concurrency
32
32
  .unknownProviderRecoveryProbeMultiplier
33
33
  : 1,
34
+ // A declared limit already caps growth. Only an undeclared scope, bounded
35
+ // by the safety limit alone, must see calls run near a limit before
36
+ // trusting a larger one.
37
+ ...(input.unknownProvider
38
+ ? {
39
+ provenOccupancyFraction:
40
+ PROVIDER_CAPACITY_POLICY.concurrency.provenOccupancyFraction,
41
+ }
42
+ : {}),
34
43
  });
35
44
  }
@@ -1878,15 +1878,22 @@ export function createRuntimeResourceGovernor(input: {
1878
1878
  observation.providerSuccess === true &&
1879
1879
  (observation.toolId || observation.providerResourceKey)
1880
1880
  ) {
1881
+ // The permit's occupancy lets the shared learner tell a call that
1882
+ // tested the current limit from one that ran far below it.
1883
+ const inFlightAtStart =
1884
+ observation.providerConcurrencyGrant?.inFlightAtStart;
1885
+ const occupancy = inFlightAtStart != null ? { inFlightAtStart } : {};
1881
1886
  if (observation.toolId) {
1882
1887
  input.executionGovernor.observeToolSuccess({
1883
1888
  toolId: observation.toolId,
1884
1889
  latencyMs: observation.providerLatencyMs,
1890
+ ...occupancy,
1885
1891
  });
1886
1892
  } else {
1887
1893
  input.executionGovernor.observeProviderSuccess({
1888
1894
  provider: observation.providerResourceKey!,
1889
1895
  latencyMs: observation.providerLatencyMs,
1896
+ ...occupancy,
1890
1897
  });
1891
1898
  }
1892
1899
  }
@@ -55,7 +55,7 @@ export const RUNTIME_SANDBOX_MEMORY_ABORT_MESSAGE =
55
55
  export const RUNTIME_SANDBOX_KILLED_MESSAGE =
56
56
  'The execution sandbox was killed before it could return a result, and the kill reason is unavailable. Completed work is durably recorded. Retry the same command safely; Deepline reuses completed steps and does not repeat their provider calls.';
57
57
  export const RUNTIME_LIMIT_EXCEEDED_MESSAGE =
58
- 'The play reached its 30 minute runtime limit and was stopped before returning. Saved datasets remain available: inspect and export them before rerunning unfinished work. Use fewer rows or increase runtime.timeout in the Play; remove the override to use the 30-minute default. Compatible completed work can be reused; an in-flight response is not proof of a saved result.';
58
+ 'The Play reached its 30 minute runtime limit and was stopped before returning. Any saved Dataset rows remain available; rows held only in local variables are not published. Inspect saved output, then use runs resume to recover matching completed operations if the run is eligible. Starting a new run may repeat paid calls; staleAfterSeconds: 0 requests fresh data. Use fewer rows or increase runtime.timeout in the Play; remove the override to use the 30-minute default. An in-flight response is not proof of a saved result.';
59
59
  export const SANDBOX_CAPACITY_EXCEEDED_MESSAGE =
60
60
  'Your organization has reached its concurrency limit, so this play did not start. Try again after another play finishes, or contact Deepline to request a higher limit.';
61
61
  export const RUNTIME_CONTROL_PLANE_UNAVAILABLE_MESSAGE =
@@ -417,7 +417,7 @@ export function runtimeLimitExceededMessage(timeoutSeconds: number): string {
417
417
  timeoutSeconds >= 4 * 60 * 60
418
418
  ? 'This Play already uses the maximum 4-hour runtime.timeout; split unfinished work into smaller batches.'
419
419
  : 'Use fewer rows or increase runtime.timeout in the Play; remove the override to use the 30-minute default.';
420
- return `The play reached its configured runtime limit of ${formatRuntimeLimitDuration(timeoutSeconds)} and was stopped before returning. Saved datasets remain available: inspect and export them before rerunning unfinished work. ${guidance} Compatible completed work can be reused; an in-flight response is not proof of a saved result.`;
420
+ return `The Play reached its configured runtime limit of ${formatRuntimeLimitDuration(timeoutSeconds)} and was stopped before returning. Any saved Dataset rows remain available; rows held only in local variables are not published. Inspect saved output, then use runs resume to recover matching completed operations if the run is eligible. Starting a new run may repeat paid calls; staleAfterSeconds: 0 requests fresh data. ${guidance} An in-flight response is not proof of a saved result.`;
421
421
  }
422
422
 
423
423
  export function runtimeLimitExceededFailure(
@@ -23,6 +23,7 @@ import {
23
23
  isPlayActivityObservation,
24
24
  PLATFORM_RECOVERY_ACTIVITY_ID,
25
25
  CANCELLATION_CLEANUP_ACTIVITY_ID,
26
+ SANDBOX_CAPACITY_ACTIVITY_ID,
26
27
  type PlayActivityObservation,
27
28
  } from './activity-observation';
28
29
  import {
@@ -1922,13 +1923,15 @@ export function reducePlayRunLedgerEvent(
1922
1923
  Object.entries(snapshot.activitiesById).filter(
1923
1924
  ([id]) =>
1924
1925
  id !== PLATFORM_RECOVERY_ACTIVITY_ID &&
1925
- id !== CANCELLATION_CLEANUP_ACTIVITY_ID,
1926
+ id !== CANCELLATION_CLEANUP_ACTIVITY_ID &&
1927
+ id !== SANDBOX_CAPACITY_ACTIVITY_ID,
1926
1928
  ),
1927
1929
  ),
1928
1930
  orderedActivityIds: snapshot.orderedActivityIds.filter(
1929
1931
  (id) =>
1930
1932
  id !== PLATFORM_RECOVERY_ACTIVITY_ID &&
1931
- id !== CANCELLATION_CLEANUP_ACTIVITY_ID,
1933
+ id !== CANCELLATION_CLEANUP_ACTIVITY_ID &&
1934
+ id !== SANDBOX_CAPACITY_ACTIVITY_ID,
1932
1935
  ),
1933
1936
  updatedAt: Math.max(snapshot.updatedAt ?? 0, occurredAt),
1934
1937
  };
@@ -128,9 +128,14 @@ export function createRuntimeToolHooks(input: {
128
128
  return {
129
129
  retrySafeTransientHttp: metadata.retry?.retrySafeTransientHttp === true,
130
130
  requiresExecutionFence: metadata.retry?.requiresExecutionFence === true,
131
- // Absent (an older metadata reader or an unclassified action) is `never`.
132
- providerServerErrorReplay:
133
- metadata.retry?.providerServerErrorReplay ?? 'never',
131
+ // Absent is an unclassified action: a provider 5xx retries (owner
132
+ // rule 2026-11-16). Only a declared `never` refuses.
133
+ ...(metadata.retry?.providerServerErrorReplay !== undefined
134
+ ? {
135
+ providerServerErrorReplay:
136
+ metadata.retry.providerServerErrorReplay,
137
+ }
138
+ : {}),
134
139
  };
135
140
  },
136
141
  getToolDurableRetryContext: async (toolId) => {
@@ -100,6 +100,9 @@ export const RUNTIME_OPERATION_CAPABILITIES = {
100
100
  // Provider prices and availability use the existing discovery authority.
101
101
  get_billing_entitlements: 'tool.inspect',
102
102
  write_page: 'page.write',
103
+ // Lists the running Play's own views: a read of that Play's control-plane
104
+ // metadata, the same authority resolve_play uses.
105
+ list_views: 'artifact.read',
103
106
  } as const satisfies Readonly<Record<string, RuntimeExecutionCapability>>;
104
107
 
105
108
  export const RUNTIME_OPERATION_CONTRACT: DeployedOperationContract =
@@ -115,6 +118,10 @@ export const RUNTIME_OPERATION_CONTRACT: DeployedOperationContract =
115
118
  kind: 'feature-unavailable',
116
119
  code: 'PAGES_UNAVAILABLE',
117
120
  },
121
+ list_views: {
122
+ kind: 'feature-unavailable',
123
+ code: 'VIEWS_UNAVAILABLE',
124
+ },
118
125
  // The shared read cache is only an optimization: an older receiver
119
126
  // writes nothing and the runner treats the publish as a no-op.
120
127
  publish_latest_cache_result: {
@@ -105,12 +105,40 @@ export function resolveRuntimeSandboxComputeItems(input: {
105
105
  * A recovered create is recorded from its reservation, without the ceiling a
106
106
  * live create carries, and cleanup may find it weeks later. It still bills no
107
107
  * more than one run could: `maxBillingDurationSeconds` fills any missing one.
108
+ *
109
+ * A sandbox handed to cleanup before it could receive a command
110
+ * (`customerCodeUnreachable`: a create that timed out or stayed in `creating`)
111
+ * never ran customer code. The time spent failing to acquire it is not billed.
108
112
  */
109
113
  export function resolveLateRuntimeSandboxComputeItems(input: {
110
114
  resources: readonly unknown[];
111
115
  endedAt: number;
112
116
  maxBillingDurationSeconds: number;
113
117
  }): ComputeBillingItem[] {
118
+ return resolveLateItems(input, false);
119
+ }
120
+
121
+ /**
122
+ * The same projection for the late sandboxes that are not billed: what the
123
+ * provider time cost Deepline. For diagnostics only; never record these as
124
+ * billing items.
125
+ */
126
+ export function resolveAbsorbedLateRuntimeSandboxComputeItems(input: {
127
+ resources: readonly unknown[];
128
+ endedAt: number;
129
+ maxBillingDurationSeconds: number;
130
+ }): ComputeBillingItem[] {
131
+ return resolveLateItems(input, true);
132
+ }
133
+
134
+ function resolveLateItems(
135
+ input: {
136
+ resources: readonly unknown[];
137
+ endedAt: number;
138
+ maxBillingDurationSeconds: number;
139
+ },
140
+ customerCodeUnreachable: boolean,
141
+ ): ComputeBillingItem[] {
114
142
  const lateResources: Record<string, unknown>[] = [];
115
143
  for (const resource of input.resources) {
116
144
  if (!resource || typeof resource !== 'object' || Array.isArray(resource)) {
@@ -118,6 +146,9 @@ export function resolveLateRuntimeSandboxComputeItems(input: {
118
146
  }
119
147
  const value = resource as Record<string, unknown>;
120
148
  if (value.lateAcquired !== true) continue;
149
+ if ((value.customerCodeUnreachable === true) !== customerCodeUnreachable) {
150
+ continue;
151
+ }
121
152
  lateResources.push({
122
153
  ...value,
123
154
  maxBillingDurationSeconds:
@@ -267,6 +267,12 @@ export type PlaySchedulerSubmitInput = RetainedPipelineCarrier & {
267
267
  launchIdentityDigest?: string | null;
268
268
  /** Millisecond epoch timestamp captured immediately before scheduler submit. */
269
269
  submittedAtMs?: number;
270
+ /**
271
+ * The workspace's `play.concurrent_runs` entitlement, resolved at admission.
272
+ * The worker enforces it as the live-sandbox cap. Optional: launches from
273
+ * older builds omit it and use the mirrored cap or the runtime default.
274
+ */
275
+ concurrentRunsLimit?: number | null;
270
276
  /** Scheduler backend that owns orchestration for this run. */
271
277
  schedulerBackend?: PlaySchedulerBackendId | null;
272
278
  };
@@ -200,6 +200,7 @@ import {
200
200
  listPostgresSchedulerAmbiguousModalCreateIntents,
201
201
  recordPostgresSchedulerDetachedRunnerLivenessVerdict,
202
202
  recordPostgresSchedulerAttemptRuntimeResource,
203
+ clearPostgresSandboxCapacityActivity,
203
204
  recordPostgresSchedulerAmbiguousModalCreateIntent,
204
205
  recordPostgresSchedulerLateManagedSandboxOperationForCleanup,
205
206
  recordPostgresSchedulerLateRuntimeResourceForCleanup,
@@ -4004,6 +4005,14 @@ async function executeAbsurdAttemptAdapter(
4004
4005
  attempt: generation,
4005
4006
  leaseToken,
4006
4007
  reason: error.message,
4008
+ ...(error instanceof RuntimeSandboxCapacityLimitError
4009
+ ? {
4010
+ sandboxCapacity: {
4011
+ limit: error.limit,
4012
+ nowMs: Date.now(),
4013
+ },
4014
+ }
4015
+ : {}),
4007
4016
  },
4008
4017
  options,
4009
4018
  ),
@@ -5418,6 +5427,9 @@ async function executeAssignedAbsurdAttempt(input: {
5418
5427
  : ('production' as const),
5419
5428
  resumePendingDaytonaOperation: provider === 'daytona',
5420
5429
  operationKey: `sandbox-operation:${runId}:${generation}:${provider}:${providerAttempt ?? 1}`,
5430
+ // The workspace's concurrent-run entitlement, resolved
5431
+ // at admission; older launches fall back to the mirror.
5432
+ entitlementLimit: launch.concurrentRunsLimit ?? null,
5421
5433
  };
5422
5434
  // A pooled callback may retry after its INSERT committed.
5423
5435
  // Keep unsent-create authority outside those callback retries;
@@ -5611,7 +5623,9 @@ async function executeAssignedAbsurdAttempt(input: {
5611
5623
  playRunnerRuntimeResourceFromSandboxExecutionResource(
5612
5624
  resource,
5613
5625
  );
5614
- const recorded = await deps.runWithClient(async (client) => {
5626
+ const recordSandboxResource = async (
5627
+ client: PostgresSchedulerQueryClient,
5628
+ ): Promise<boolean> => {
5615
5629
  if (isManagedSandboxCapacityResource(runnerResource)) {
5616
5630
  const promoted =
5617
5631
  await recordPostgresSchedulerManagedSandboxOperationLive(
@@ -5679,6 +5693,17 @@ async function executeAssignedAbsurdAttempt(input: {
5679
5693
  throw new Error(
5680
5694
  `Runtime resource ${runnerResource.kind} carried a capacity lease without a matching managed provider owner.`,
5681
5695
  );
5696
+ };
5697
+ const recorded = await deps.runWithClient(async (client) => {
5698
+ if (!(await recordSandboxResource(client))) return false;
5699
+ // The run has its sandbox (managed or not): retire the
5700
+ // queued headline a sandbox-capacity wait published.
5701
+ await clearPostgresSandboxCapacityActivity(
5702
+ client,
5703
+ { runId, attempt: generation, nowMs: Date.now() },
5704
+ options,
5705
+ );
5706
+ return true;
5682
5707
  });
5683
5708
  return recorded
5684
5709
  ? { kind: 'recorded' as const }
@@ -91,10 +91,13 @@ export function acquireRateScopeSql(
91
91
  // Keep it available for one later ramp rather than requiring another call at
92
92
  // the old pace. The baseline consumes it once. Unknown-provider upward probes
93
93
  // above useful seed capacity retain their separate observation policy.
94
+ // Before any backpressure the same stored successes also count, whichever
95
+ // run wrote them: a single-call run reports its success only in its final
96
+ // flush, after its one acquire, so waiting for successes carried by the
97
+ // request itself would keep such a lane in cold discovery indefinitely.
94
98
  const recoverySuccess = probeBaselineSupported
95
99
  ? `(${successesParameter}::int > 0 OR (
96
- h.seen_backpressure
97
- AND (${!unknownProvider} OR ${fastRecovery})
100
+ (NOT h.seen_backpressure OR ${!unknownProvider} OR ${fastRecovery})
98
101
  AND h.rate_probe_started_at_ms >= h.last_ramp_at_ms
99
102
  AND h.rate_probe_started_at_ms >= h.rate_observation_started_at_ms
100
103
  AND h.rate_successes > h.rate_probe_successes_at_ramp
@@ -174,6 +177,10 @@ export function updateRateScopeSql(
174
177
  AND ph.next_refill_per_sec > ph.refill_per_sec`;
175
178
  const knownRampedObservation = `${!unknownProvider} AND ph.seen_backpressure
176
179
  AND ph.next_refill_per_sec > ph.refill_per_sec`;
180
+ // A ramp before any backpressure consumes the stored successes that proved
181
+ // it, so the next ramp needs a success recorded after this one.
182
+ const coldRampedObservation = `NOT ph.seen_backpressure
183
+ AND ph.next_ramp_at_ms <> ph.last_ramp_at_ms`;
177
184
  const idleFloorObservation = `ph.observation_was_idle AND ph.fast_recovery`;
178
185
  const rebaseProbe =
179
186
  'ph.rate_probe_started_at_ms < ph.last_ramp_at_ms OR ph.rate_probe_started_at_ms < COALESCE(ph.rate_observation_started_at_ms, 0) OR ph.rate_probe_successes_at_ramp > ph.rate_successes';
@@ -202,10 +209,10 @@ export function updateRateScopeSql(
202
209
  WHEN (SELECT granted FROM grant_calc) > 0
203
210
  AND (ph.rate_observation_started_at_ms IS NULL OR ph.observation_was_idle) THEN 0
204
211
  WHEN ${idleFloorObservation} THEN ph.rate_successes
205
- WHEN ${knownRampedObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN ph.rate_successes
212
+ WHEN ${knownRampedObservation} OR ${coldRampedObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN ph.rate_successes
206
213
  ELSE ph.rate_probe_successes_at_ramp END,
207
214
  rate_probe_started_at_ms = CASE
208
- WHEN ${knownRampedObservation} OR ${idleFloorObservation} OR ${recoveredObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN nv.now_ms
215
+ WHEN ${knownRampedObservation} OR ${coldRampedObservation} OR ${idleFloorObservation} OR ${recoveredObservation} OR ${floorRampedObservation} OR ${probedObservation} OR (${rebaseProbe}) THEN nv.now_ms
209
216
  WHEN (SELECT granted FROM grant_calc) > 0
210
217
  AND (ph.rate_observation_started_at_ms IS NULL OR ph.observation_was_idle) THEN nv.now_ms
211
218
  ELSE ph.rate_probe_started_at_ms END,`