deepline 0.3.534 → 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 (235) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +254 -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/call-requeue-state-machine.ts +420 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +727 -102
  19. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +26 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/durable-retry-policy.ts +624 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
  22. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
  23. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +60 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +372 -10
  28. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
  29. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +21 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +6 -2
  37. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +17 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
  39. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +63 -3
  41. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
  49. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +90 -49
  50. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +136 -30
  51. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
  52. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
  53. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +63 -13
  54. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
  55. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
  56. package/dist/cli/auth-6XQKFOLG.js +43 -0
  57. package/dist/cli/{auth-MHQYIMVX.mjs → auth-KCTCUO7P.mjs} +7 -7
  58. package/dist/cli/{billing-YQLNP4S5.js → billing-4VBGZ3CT.js} +273 -112
  59. package/dist/cli/{billing-LX2PSBJ4.mjs → billing-OOJHKLNS.mjs} +185 -24
  60. package/dist/cli/{chunk-DGKTHWWH.js → chunk-2B4IOGFD.js} +406 -382
  61. package/dist/cli/{chunk-MQORQ7WL.js → chunk-2FCSUOYN.js} +55 -55
  62. package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
  63. package/dist/cli/{chunk-6IFZPEJE.mjs → chunk-2YWJS76L.mjs} +1 -1
  64. package/dist/cli/{chunk-E7TP25I2.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
  65. package/dist/cli/{chunk-LGRZCHKC.js → chunk-4E5JXZ3W.js} +18 -20
  66. package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
  67. package/dist/cli/{chunk-SUWTLXCV.js → chunk-6BBGUQJJ.js} +67 -146
  68. package/dist/cli/{chunk-JBBJDFUJ.js → chunk-6VUGBQZQ.js} +5 -5
  69. package/dist/cli/{chunk-2P3NVX65.mjs → chunk-AB2GBOD4.mjs} +40 -27
  70. package/dist/cli/{chunk-62SOZ67Y.mjs → chunk-ANUKBZ6W.mjs} +475 -11
  71. package/dist/cli/{chunk-MG6YL4M7.mjs → chunk-BASLYGXK.mjs} +101 -77
  72. package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
  73. package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
  74. package/dist/cli/{chunk-RH3YRMUY.js → chunk-CIDN5K23.js} +1 -1
  75. package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
  76. package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
  77. package/dist/cli/{chunk-UWNVFAFN.js → chunk-CWSLUNA6.js} +33 -33
  78. package/dist/cli/{chunk-5FXMEEF4.mjs → chunk-CXTW7SRW.mjs} +67 -146
  79. package/dist/cli/{chunk-O53LHONF.mjs → chunk-DA2I2M7D.mjs} +2 -2
  80. package/dist/cli/{chunk-EYXUAJAU.mjs → chunk-DQHUJMCL.mjs} +5 -5
  81. package/dist/cli/{chunk-7GFR5Y4J.mjs → chunk-DUYAMLOC.mjs} +1 -1
  82. package/dist/cli/{chunk-OMVVHX4U.mjs → chunk-E24UGPGG.mjs} +13 -15
  83. package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
  84. package/dist/cli/{chunk-KJVY7V2X.mjs → chunk-GF32SBST.mjs} +1 -1
  85. package/dist/cli/{chunk-AK622KIG.mjs → chunk-GHLDCLSC.mjs} +1 -1
  86. package/dist/cli/{chunk-A6HNT4EE.js → chunk-GTVZKY3F.js} +2 -2
  87. package/dist/cli/{chunk-BXIUZM5N.mjs → chunk-HAJQGP5V.mjs} +2 -2
  88. package/dist/cli/{chunk-6CEUQYMB.js → chunk-HWDKRN7L.js} +3 -3
  89. package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
  90. package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
  91. package/dist/cli/{chunk-WR4WETRU.mjs → chunk-JUHDJNSI.mjs} +4 -4
  92. package/dist/cli/{chunk-TQH3533L.mjs → chunk-KPQHUVYW.mjs} +5 -5
  93. package/dist/cli/{chunk-V7SCRUFQ.js → chunk-KWYGWO4Y.js} +9 -6
  94. package/dist/cli/{chunk-DZS4JC7I.js → chunk-LDGZFDUB.js} +2 -2
  95. package/dist/cli/{chunk-EGTUOYYG.js → chunk-LN6RXDTB.js} +523 -59
  96. package/dist/cli/{chunk-DQ5ADV2J.mjs → chunk-LZXZQPA2.mjs} +4 -1
  97. package/dist/cli/{chunk-MYSKWJMA.js → chunk-MSP4DTSD.js} +13 -13
  98. package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
  99. package/dist/cli/{chunk-NNAE7E23.mjs → chunk-OUDTOMZC.mjs} +7 -9
  100. package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
  101. package/dist/cli/{chunk-ENCA6O2D.mjs → chunk-PNY3BWHP.mjs} +2 -2
  102. package/dist/cli/{chunk-KSA2XE4T.js → chunk-Q4MNUOS4.js} +316 -303
  103. package/dist/cli/{chunk-GTXSUPCJ.js → chunk-Q5CXV3E3.js} +2 -2
  104. package/dist/cli/{chunk-VAG5YKP6.mjs → chunk-RVSSQPQO.mjs} +1 -1
  105. package/dist/cli/{chunk-VE7ZPLN2.js → chunk-SLPJ3LXI.js} +22 -22
  106. package/dist/cli/{chunk-IX45S5VC.js → chunk-TX5TUHJN.js} +17 -19
  107. package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
  108. package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
  109. package/dist/cli/{chunk-NDFNBJGL.js → chunk-VBDZIMWD.js} +26 -26
  110. package/dist/cli/{chunk-GVGQ6NZW.js → chunk-W7AEIGZR.js} +41 -41
  111. package/dist/cli/{chunk-WDNRPZED.mjs → chunk-WC5M3JXE.mjs} +2 -2
  112. package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
  113. package/dist/cli/{chunk-MQX363YF.js → chunk-XBAH3TKU.js} +5 -5
  114. package/dist/cli/{chunk-BDWZBMGV.mjs → chunk-XJD2GYUP.mjs} +5 -5
  115. package/dist/cli/{chunk-XRZJKHUA.mjs → chunk-XVZRJJDS.mjs} +4 -4
  116. package/dist/cli/{chunk-TVINIDHB.js → chunk-Y2NTPYGS.js} +17 -17
  117. package/dist/cli/{chunk-6GTGWZJG.mjs → chunk-YBMHOH6H.mjs} +4 -4
  118. package/dist/cli/{chunk-TG2UB3A5.mjs → chunk-YRLAUGQY.mjs} +3 -3
  119. package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
  120. package/dist/cli/{chunk-KXQCUX3X.mjs → chunk-Z7UIOGW4.mjs} +3 -3
  121. package/dist/cli/{chunk-HCD36BP6.js → chunk-ZEV2Y56V.js} +44 -44
  122. package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
  123. package/dist/cli/{chunk-XBK6WCVA.js → chunk-ZILSRDIN.js} +8 -8
  124. package/dist/cli/{chunk-B2AS3R5W.js → chunk-ZISEH7OL.js} +16 -16
  125. package/dist/cli/{chunk-HPJAE6PP.js → chunk-ZZ4MF2GI.js} +6 -6
  126. package/dist/cli/command-docs.js +2 -2
  127. package/dist/cli/command-docs.mjs +1 -1
  128. package/dist/cli/{csv-U3M2G76R.js → csv-2V2DIFNG.js} +15 -15
  129. package/dist/cli/{csv-4ID4E5W3.mjs → csv-P3HLK4GO.mjs} +6 -6
  130. package/dist/cli/{db-IHAQIKEQ.js → db-MREAQVW6.js} +36 -36
  131. package/dist/cli/{db-LHX5BBCZ.mjs → db-ZYOY3QRQ.mjs} +9 -9
  132. package/dist/cli/describe-IKZFOADR.mjs +49 -0
  133. package/dist/cli/describe-WW3OQRLP.js +49 -0
  134. package/dist/cli/describe-core.d.mts +3 -3
  135. package/dist/cli/describe-core.d.ts +3 -3
  136. package/dist/cli/describe-core.js +5 -5
  137. package/dist/cli/describe-core.mjs +4 -4
  138. package/dist/cli/{executions-CJ5LV23G.js → executions-H5IJ7QSQ.js} +11 -11
  139. package/dist/cli/{executions-UJ6JZUL5.mjs → executions-KTSY5M34.mjs} +9 -9
  140. package/dist/cli/{feedback-TGUBVGRP.js → feedback-724QK3Z5.js} +16 -16
  141. package/dist/cli/{feedback-YGTPJBRJ.mjs → feedback-WWJRIXEU.mjs} +8 -8
  142. package/dist/cli/git-PHYRD56H.js +25 -0
  143. package/dist/cli/{git-3DOTQHJO.mjs → git-R5VRG7X6.mjs} +7 -7
  144. package/dist/cli/index.js +151 -157
  145. package/dist/cli/index.mjs +51 -57
  146. package/dist/cli/{legacy-noops-BHEHVFHI.js → legacy-noops-C6GDEGPU.js} +11 -11
  147. package/dist/cli/{legacy-noops-RBBYRVLG.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
  148. package/dist/cli/{monitors-XECKLAXA.js → monitors-VAVQ4WCE.js} +125 -122
  149. package/dist/cli/{monitors-5AJCG6IV.mjs → monitors-WQSKMHAP.mjs} +19 -16
  150. package/dist/cli/{org-DOBAIYWG.js → org-CWWRWXZQ.js} +89 -89
  151. package/dist/cli/{org-ZAAIEZKB.mjs → org-MAL4QPVF.mjs} +9 -9
  152. package/dist/cli/{play-KLYRMQPF.mjs → play-ILW6MSNG.mjs} +174 -80
  153. package/dist/cli/{play-E74VN6B7.js → play-WJOWK5PQ.js} +690 -596
  154. package/dist/cli/{providers-XTQXV5LB.mjs → providers-4V2NMLZZ.mjs} +9 -9
  155. package/dist/cli/{providers-APZ6SOSK.js → providers-W662ANCH.js} +12 -12
  156. package/dist/cli/{quickstart-S6WN6NWW.js → quickstart-BW6EBUYX.js} +8 -8
  157. package/dist/cli/{quickstart-X7RHHQCH.mjs → quickstart-C22BR743.mjs} +6 -6
  158. package/dist/cli/{run-3YLIJJ57.js → run-KW7KW4FX.js} +50 -53
  159. package/dist/cli/{run-TZPBBSPX.mjs → run-SPAU5IMW.mjs} +31 -34
  160. package/dist/cli/search-HLE54W5G.js +32 -0
  161. package/dist/cli/{search-VLHE2CMZ.mjs → search-XPC75HLM.mjs} +10 -11
  162. package/dist/cli/{search-output-73BYB7UE.mjs → search-output-JKYJSEPM.mjs} +6 -6
  163. package/dist/cli/{search-output-GCT7PQIT.js → search-output-VJYE7USJ.js} +8 -8
  164. package/dist/cli/{secrets-RLOTGKQZ.mjs → secrets-OJG73GXQ.mjs} +9 -9
  165. package/dist/cli/{secrets-J6CEKXKQ.js → secrets-YB57KGSB.js} +18 -18
  166. package/dist/cli/{sessions-7HZ7OZ62.mjs → sessions-7ZL37BW4.mjs} +8 -8
  167. package/dist/cli/sessions-VEBYZIEU.js +22 -0
  168. package/dist/cli/{settings-WRV5XEZC.js → settings-A7DD2ZYE.js} +88 -89
  169. package/dist/cli/{settings-72K5YCIS.mjs → settings-RKSQB7FA.mjs} +15 -16
  170. package/dist/cli/{setup-KQFY6WT4.mjs → setup-NXDUTITY.mjs} +11 -12
  171. package/dist/cli/{setup-QVXWT2EQ.js → setup-S3K5YU62.js} +51 -52
  172. package/dist/cli/skills-NVQ744CN.js +36 -0
  173. package/dist/cli/{skills-C3K3E473.mjs → skills-VMFAIDO6.mjs} +9 -10
  174. package/dist/cli/{tools-4A2OH6MB.mjs → tools-52NTHBSJ.mjs} +20 -21
  175. package/dist/cli/tools-SBDUL3WB.js +56 -0
  176. package/dist/cli/update-HHVFZPCV.js +34 -0
  177. package/dist/cli/{update-BS6USKPR.mjs → update-SAKBEKMV.mjs} +11 -12
  178. package/dist/cli/{views-WB6GFTRX.mjs → views-ACRV7MD6.mjs} +54 -10
  179. package/dist/cli/{views-4NZGAXHL.js → views-C3GJOBDG.js} +66 -22
  180. package/dist/cli/{workflow-2D4WX55R.mjs → workflow-CS22E7TC.mjs} +10 -10
  181. package/dist/cli/{workflow-L2QTQZYV.js → workflow-ZNWCZEGN.js} +20 -20
  182. package/dist/{client-DoUVSkqC.d.mts → client-BlLYQDNo.d.mts} +1 -1
  183. package/dist/{client-DQm56zMs.d.ts → client-DSQlkIDO.d.ts} +1 -1
  184. package/dist/{client-core-C7KkUIE_.d.ts → client-core-CDwapXy5.d.ts} +167 -108
  185. package/dist/{client-core-CPlwsC1Q.d.mts → client-core-rX7n2H8U.d.mts} +167 -108
  186. package/dist/{compiler-manifest-DsxsQP-T.d.mts → compiler-manifest-BHNC4RL-.d.mts} +58 -21
  187. package/dist/{compiler-manifest-DsxsQP-T.d.ts → compiler-manifest-BHNC4RL-.d.ts} +58 -21
  188. package/dist/{errors-qdJUVQ3g.d.mts → errors-D7sPXrvB.d.mts} +1 -1
  189. package/dist/{errors-Bk5h1D-C.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
  190. package/dist/{index-bL66eHYz.d.ts → index-CQTBHXHr.d.ts} +1 -1
  191. package/dist/{index-PaupwX1B.d.mts → index-NaDZq2xf.d.mts} +1 -1
  192. package/dist/index.d.mts +7 -7
  193. package/dist/index.d.ts +7 -7
  194. package/dist/index.js +15 -15
  195. package/dist/index.mjs +11 -11
  196. package/dist/install-integrity.json +131 -132
  197. package/dist/monitor-fleet-contract.d.mts +17 -11
  198. package/dist/monitor-fleet-contract.d.ts +17 -11
  199. package/dist/monitor-fleet-contract.js +3 -3
  200. package/dist/monitor-fleet-contract.mjs +2 -2
  201. package/dist/monitor-input-contract.js +2 -2
  202. package/dist/monitor-input-contract.mjs +1 -1
  203. package/dist/plays/bundle-play-file.d.mts +3 -3
  204. package/dist/plays/bundle-play-file.d.ts +3 -3
  205. package/dist/plays/bundle-play-file.mjs +67 -3
  206. package/dist/plays/csv-data-input.js +3 -3
  207. package/dist/plays/csv-data-input.mjs +2 -2
  208. package/dist/plays/play-description.d.mts +2 -2
  209. package/dist/plays/play-description.d.ts +2 -2
  210. package/dist/plays/run-request.d.mts +2 -2
  211. package/dist/plays/run-request.d.ts +2 -2
  212. package/dist/plays/run-request.js +3 -3
  213. package/dist/plays/run-request.mjs +2 -2
  214. package/dist/release.d.mts +1 -1
  215. package/dist/release.d.ts +1 -1
  216. package/dist/release.js +2 -2
  217. package/dist/release.mjs +1 -1
  218. package/dist/server.d.mts +4 -4
  219. package/dist/server.d.ts +4 -4
  220. package/dist/server.js +12 -12
  221. package/dist/server.mjs +6 -6
  222. package/package.json +1 -1
  223. package/dist/cli/auth-UP2RGPI6.js +0 -43
  224. package/dist/cli/chunk-5LZ5VSOK.mjs +0 -405
  225. package/dist/cli/chunk-D3J2Y2BP.js +0 -405
  226. package/dist/cli/describe-CI4MREFF.mjs +0 -50
  227. package/dist/cli/describe-IVTSD7ST.js +0 -50
  228. package/dist/cli/git-R3W25XIF.js +0 -25
  229. package/dist/cli/pages-FUOSF6BE.mjs +0 -266
  230. package/dist/cli/pages-TLC2N6L7.js +0 -266
  231. package/dist/cli/search-NB5CBALV.js +0 -33
  232. package/dist/cli/sessions-SFCZSB77.js +0 -22
  233. package/dist/cli/skills-WIJEHVLA.js +0 -37
  234. package/dist/cli/tools-VMMERMLO.js +0 -57
  235. package/dist/cli/update-54WZQDTS.js +0 -35
@@ -192,7 +192,9 @@ export function playCallErrorKind(input: {
192
192
  if (category === 'network' || input.networkKind !== null) {
193
193
  return 'timeout_network';
194
194
  }
195
- if ((httpStatus !== null && httpStatus >= 500) || category === 'upstream') {
195
+ // An upstream category is a 5xx only when no status says otherwise: a
196
+ // provider's 400 or 422 is a 4xx whatever its category.
197
+ if (httpStatus !== null ? httpStatus >= 500 : category === 'upstream') {
196
198
  return origin === 'provider' ? 'provider_5xx' : 'platform';
197
199
  }
198
200
  if (category === 'internal') return 'platform';
@@ -62,6 +62,13 @@ export const RATE_ACQUIRE_MAX_WAIT_MS = 300_000;
62
62
  export const PROVIDER_ADMISSION_WAIT_BUDGET_MS = 120_000;
63
63
  const PROVIDER_NO_PROGRESS_WARNING_MS = 180_000;
64
64
  const SUCCESS_FEEDBACK_DRAIN_TIMEOUT_MS = 10_000;
65
+ /**
66
+ * The longest a confirmed success waits for its lane's next acquire to carry
67
+ * it before it is sent on its own. A single-call run makes no next acquire,
68
+ * so its success otherwise reached the shared learner only in the end-of-run
69
+ * flush, a whole run after the provider answered (p50 35 s in a burst).
70
+ */
71
+ const SUCCESS_FEEDBACK_MAX_DELAY_MS = 1_000;
65
72
 
66
73
  /**
67
74
  * Permits leased per app-runtime round trip for the direct Node substrate.
@@ -205,7 +212,13 @@ type PendingConcurrencyObservations = {
205
212
  laneId: string;
206
213
  sequence: number;
207
214
  };
208
- observations: Array<{ kind: 'success'; latencyMs: number }>;
215
+ observations: SuccessObservation[];
216
+ };
217
+
218
+ type SuccessObservation = {
219
+ kind: 'success';
220
+ latencyMs: number;
221
+ inFlightAtStart?: number;
209
222
  };
210
223
 
211
224
  type SuccessFeedback = {
@@ -326,6 +339,10 @@ export class AppRuntimeRateStateBackend implements RateStateBackend {
326
339
  }
327
340
  >();
328
341
  private readonly successFeedbackSupported = new Set<string>();
342
+ private readonly successFeedbackTimers = new Map<
343
+ string,
344
+ ReturnType<typeof setTimeout>
345
+ >();
329
346
  private successFeedbackDrain: Promise<void> | null = null;
330
347
  /**
331
348
  * Completion samples travel with the next lease refill. This keeps the
@@ -1729,6 +1746,7 @@ export class AppRuntimeRateStateBackend implements RateStateBackend {
1729
1746
  rateScopeToken?: string | null;
1730
1747
  rules: readonly PacingRule[];
1731
1748
  latencyMs?: number | null;
1749
+ inFlightAtStart?: number | null;
1732
1750
  }): void {
1733
1751
  this.providerStalls.delete(input.bucketId);
1734
1752
  const key = pendingSuccessKey(input.bucketId, input.rules);
@@ -1756,6 +1774,11 @@ export class AppRuntimeRateStateBackend implements RateStateBackend {
1756
1774
  pending.observations.push({
1757
1775
  kind: 'success',
1758
1776
  latencyMs: input.latencyMs,
1777
+ ...(input.inFlightAtStart != null &&
1778
+ Number.isSafeInteger(input.inFlightAtStart) &&
1779
+ input.inFlightAtStart >= 1
1780
+ ? { inFlightAtStart: input.inFlightAtStart }
1781
+ : {}),
1759
1782
  });
1760
1783
  }
1761
1784
  }
@@ -1764,6 +1787,52 @@ export class AppRuntimeRateStateBackend implements RateStateBackend {
1764
1787
  // retaining an empty Gradient2 list still makes a lost acquire response
1765
1788
  // unable to replay that rate recovery signal.
1766
1789
  this.pendingConcurrencyObservations.set(key, pending);
1790
+ this.scheduleSuccessFeedback(key, input.bucketId);
1791
+ }
1792
+
1793
+ /**
1794
+ * Send this lane's successes on their own if no acquire has carried them
1795
+ * within SUCCESS_FEEDBACK_MAX_DELAY_MS. A lane that acquires often takes
1796
+ * them along first, so it adds no request.
1797
+ */
1798
+ private scheduleSuccessFeedback(key: string, bucketId: string): void {
1799
+ if (
1800
+ !this.port.flushFeedback ||
1801
+ !this.successFeedbackSupported.has(bucketId) ||
1802
+ this.successFeedbackTimers.has(key)
1803
+ ) {
1804
+ return;
1805
+ }
1806
+ const timer = setTimeout(() => {
1807
+ this.successFeedbackTimers.delete(key);
1808
+ // Advisory: a failed send leaves its frozen batch for the next acquire
1809
+ // or the end-of-run drain, which retry the same identity.
1810
+ void this.sendLaneSuccessFeedback(key).catch(() => undefined);
1811
+ }, SUCCESS_FEEDBACK_MAX_DELAY_MS);
1812
+ timer.unref?.();
1813
+ this.successFeedbackTimers.set(key, timer);
1814
+ }
1815
+
1816
+ private async sendLaneSuccessFeedback(key: string): Promise<void> {
1817
+ // An acquire, penalty or the final drain already carries this lane's batch.
1818
+ if (this.successFeedbackFlights.has(key) || this.successFeedbackDrain) {
1819
+ return;
1820
+ }
1821
+ const scope = this.successFeedbackScopes.get(key);
1822
+ if (!scope || !this.successFeedbackSupported.has(scope.bucketId)) return;
1823
+ const feedback = this.snapshotSuccessFeedback(key);
1824
+ if (!feedback.concurrencyObservationBatch) return;
1825
+ await this.port.flushFeedback!(
1826
+ {
1827
+ ...scope,
1828
+ rules: [...scope.rules],
1829
+ leaseIds: [],
1830
+ ...feedback,
1831
+ schedulerSchema: this.schedulerSchema,
1832
+ },
1833
+ AbortSignal.timeout(SUCCESS_FEEDBACK_DRAIN_TIMEOUT_MS),
1834
+ );
1835
+ this.acknowledgeSuccessFeedback(key, feedback);
1767
1836
  }
1768
1837
 
1769
1838
  async flushSuccessFeedback(): Promise<void> {
@@ -1805,7 +1874,7 @@ export class AppRuntimeRateStateBackend implements RateStateBackend {
1805
1874
 
1806
1875
  private newPendingConcurrencyObservations(
1807
1876
  key: string,
1808
- observations: Array<{ kind: 'success'; latencyMs: number }> = [],
1877
+ observations: SuccessObservation[] = [],
1809
1878
  ): PendingConcurrencyObservations {
1810
1879
  const laneId =
1811
1880
  this.concurrencyObservationLanes.get(key) ??
@@ -206,6 +206,16 @@ export interface PlayExecutionGovernor {
206
206
  */
207
207
  tryAcquireProviderPermit(toolId: string): ProviderPermit | null;
208
208
 
209
+ /**
210
+ * Calls waiting now for one of the run's external-call slots, calls holding
211
+ * one, and the run's configured slot count. Synchronous and local.
212
+ */
213
+ externalExecutionBacklog?(): {
214
+ waiting: number;
215
+ slots: number;
216
+ inFlight: number;
217
+ };
218
+
209
219
  /**
210
220
  * Suggested batch parallelism for a tool: the provider's own rate hints
211
221
  * tightened to the policy's suggested ceiling. No hints → the fallback.
@@ -259,11 +269,14 @@ export interface PlayExecutionGovernor {
259
269
  provider: string;
260
270
  toolId?: string;
261
271
  latencyMs?: number | null;
272
+ /** The admitting permit's server-authored `inFlightAtStart`, when known. */
273
+ inFlightAtStart?: number | null;
262
274
  }): void;
263
275
  /** Feed success back using the same tool-to-provider resolution as acquire. */
264
276
  observeToolSuccess(input: {
265
277
  toolId: string;
266
278
  latencyMs?: number | null;
279
+ inFlightAtStart?: number | null;
267
280
  }): void;
268
281
 
269
282
  snapshot(): GovernanceSnapshot;
@@ -282,6 +295,15 @@ interface GovernorInput {
282
295
  maxConcurrentRows?: number | null;
283
296
  }
284
297
 
298
+ /**
299
+ * Share of the run's external-call slots that stays open while a map reports
300
+ * memory or event-loop pressure. Dropping to one slot stopped every new call
301
+ * until the slowest call already in flight returned: calls-10 (43305298615)
302
+ * started no call for about 44 s while 16 calls of up to 42.8 s finished.
303
+ * Half the slots still sheds load on pressure without that barrier.
304
+ */
305
+ export const EXTERNAL_EXECUTION_PRESSURE_SLOT_SHARE = 0.5;
306
+
285
307
  class Semaphore {
286
308
  private inFlight = 0;
287
309
  private readonly waiters: Array<(reserved: boolean) => void> = [];
@@ -298,6 +320,15 @@ class Semaphore {
298
320
  : this.limit;
299
321
  }
300
322
 
323
+ /** Waiters queued now, against the configured (not pressure-reduced) limit. */
324
+ backlog(): { waiting: number; limit: number; inFlight: number } {
325
+ return {
326
+ waiting: this.waiters.length,
327
+ limit: this.limit,
328
+ inFlight: this.inFlight,
329
+ };
330
+ }
331
+
301
332
  /** Re-read policy before reserving each FIFO handoff. */
302
333
  refresh(): void {
303
334
  while (this.waiters.length > 0 && this.inFlight < this.capacity()) {
@@ -426,7 +457,14 @@ export function createPlayExecutionGovernor(
426
457
  const externalPressureReaders = new Set<() => boolean>();
427
458
  const readExternalCapacity = (): number => {
428
459
  for (const read of externalPressureReaders) {
429
- if (read()) return 1;
460
+ if (read())
461
+ return Math.max(
462
+ 1,
463
+ Math.floor(
464
+ policy.concurrency.toolCalls *
465
+ EXTERNAL_EXECUTION_PRESSURE_SLOT_SHARE,
466
+ ),
467
+ );
430
468
  }
431
469
  return policy.concurrency.toolCalls;
432
470
  };
@@ -780,6 +818,15 @@ export function createPlayExecutionGovernor(
780
818
  return providerPermitFrom(provider, rateLease, localConcurrencySlot);
781
819
  },
782
820
 
821
+ externalExecutionBacklog() {
822
+ const backlog = toolSlots.backlog();
823
+ return {
824
+ waiting: backlog.waiting,
825
+ slots: backlog.limit,
826
+ inFlight: backlog.inFlight,
827
+ };
828
+ },
829
+
783
830
  async suggestedParallelism(toolId, fallback) {
784
831
  const pacing = await resolveAdaptivePacing(toolId);
785
832
  const concurrencyLimits = pacing.rules.flatMap((rule) =>
@@ -871,6 +918,9 @@ export function createPlayExecutionGovernor(
871
918
  ...(rateScope[1] ? { rateScopeToken: rateScope[1] } : {}),
872
919
  rules,
873
920
  latencyMs: success.latencyMs,
921
+ ...(success.inFlightAtStart != null
922
+ ? { inFlightAtStart: success.inFlightAtStart }
923
+ : {}),
874
924
  });
875
925
  return;
876
926
  }
@@ -889,6 +939,9 @@ export function createPlayExecutionGovernor(
889
939
  provider,
890
940
  toolId: success.toolId,
891
941
  latencyMs: success.latencyMs,
942
+ ...(success.inFlightAtStart != null
943
+ ? { inFlightAtStart: success.inFlightAtStart }
944
+ : {}),
892
945
  });
893
946
  },
894
947
 
@@ -961,6 +1014,12 @@ function createInlineChildGovernor(
961
1014
  acquireProviderPermit: (toolId, opts) =>
962
1015
  root.acquireProviderPermit(toolId, opts),
963
1016
  tryAcquireProviderPermit: (toolId) => root.tryAcquireProviderPermit(toolId),
1017
+ externalExecutionBacklog: () =>
1018
+ root.externalExecutionBacklog?.() ?? {
1019
+ waiting: 0,
1020
+ slots: 0,
1021
+ inFlight: 0,
1022
+ },
964
1023
  suggestedParallelism: (toolId, fallback) =>
965
1024
  root.suggestedParallelism(toolId, fallback),
966
1025
  suggestedDirectToolParallelism: (toolId, fallback) =>
@@ -196,6 +196,8 @@ export interface RateStateBackend {
196
196
  rules: readonly PacingRule[];
197
197
  /** Provider residence measured at the HTTP boundary. */
198
198
  latencyMs?: number | null;
199
+ /** The admitting permit's server-authored `inFlightAtStart`, when known. */
200
+ inFlightAtStart?: number | null;
199
201
  }): void;
200
202
 
201
203
  /** Bounded final feedback write after the invocation's provider work settles. */
@@ -97,6 +97,7 @@ export const PLAY_LAUNCH_ENVELOPE_FIELD_ROLES: {
97
97
  runtimeTestFaultHeader: 'detail',
98
98
  testPolicyOverrides: 'detail',
99
99
  submittedAtMs: 'detail',
100
+ concurrentRunsLimit: 'detail',
100
101
  schedulerBackend: 'detail',
101
102
  executionProfile: 'detail',
102
103
  runtimeBackend: 'detail',