deepline 0.3.535 → 0.3.537

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 +22 -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-ZCTMB5RA.mjs → auth-4SUPGDIM.mjs} +7 -7
  51. package/dist/cli/auth-Y2K2ZYYA.js +43 -0
  52. package/dist/cli/{billing-OU2ZHL72.mjs → billing-5JUA3ZM3.mjs} +185 -24
  53. package/dist/cli/{billing-GVFKZQH3.js → billing-SQU726P7.js} +273 -112
  54. package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
  55. package/dist/cli/{chunk-ZUVE63Y7.js → chunk-2Q7VXTMS.js} +2 -2
  56. package/dist/cli/{chunk-WAIBM6KX.mjs → chunk-37AZHCTP.mjs} +5 -5
  57. package/dist/cli/{chunk-D4MHCCIR.js → chunk-3PMCQ3LK.js} +33 -33
  58. package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
  59. package/dist/cli/{chunk-PI5R65OQ.js → chunk-5EOEJKSV.js} +1 -1
  60. package/dist/cli/{chunk-XSOTEVOB.js → chunk-6BBGUQJJ.js} +50 -141
  61. package/dist/cli/{chunk-OM732MGV.js → chunk-ALHKB3AE.js} +17 -17
  62. package/dist/cli/{chunk-6LHX33VN.js → chunk-AVQET3NR.js} +9 -6
  63. package/dist/cli/{chunk-W6T23EUC.mjs → chunk-AX2OAXDL.mjs} +1 -1
  64. package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
  65. package/dist/cli/{chunk-G2DLG32W.mjs → chunk-BFHR7IC2.mjs} +40 -27
  66. package/dist/cli/{chunk-KWGXHPHL.js → chunk-BGXEMTIG.js} +523 -59
  67. package/dist/cli/{chunk-AUEUAPVS.mjs → chunk-BRRCWUOW.mjs} +1 -1
  68. package/dist/cli/{chunk-QYBAHYP4.mjs → chunk-C37VELBR.mjs} +7 -9
  69. package/dist/cli/{chunk-H6SWS5CG.mjs → chunk-C3XD2WHM.mjs} +2 -2
  70. package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
  71. package/dist/cli/{chunk-CIDATNTY.js → chunk-CFND2ACL.js} +16 -16
  72. package/dist/cli/{chunk-J75DANZY.mjs → chunk-CGDW2CRR.mjs} +2 -2
  73. package/dist/cli/{chunk-RFQWSH6I.js → chunk-CHIGEDAE.js} +3 -3
  74. package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
  75. package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
  76. package/dist/cli/{chunk-E3CLOVG5.mjs → chunk-CXTW7SRW.mjs} +50 -141
  77. package/dist/cli/{chunk-4NLRWKZB.js → chunk-D77W6Q67.js} +26 -26
  78. package/dist/cli/{chunk-JWWYLGUT.mjs → chunk-EEFSUCYP.mjs} +475 -11
  79. package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
  80. package/dist/cli/{chunk-6TYRRNXY.mjs → chunk-GI3V4D7K.mjs} +2 -2
  81. package/dist/cli/{chunk-DFJODFMC.mjs → chunk-GPMS6OPX.mjs} +5 -5
  82. package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
  83. package/dist/cli/{chunk-DAPKLYST.js → chunk-IQOIT6E3.js} +41 -41
  84. package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
  85. package/dist/cli/{chunk-FGN75ZN6.js → chunk-JMHYDDBQ.js} +390 -382
  86. package/dist/cli/{chunk-KA6ZERJL.js → chunk-JS2SBCWD.js} +6 -6
  87. package/dist/cli/{chunk-W5YJYU4G.mjs → chunk-K4WJ4BYO.mjs} +2 -2
  88. package/dist/cli/{chunk-LVISZFYO.mjs → chunk-KH27B2HJ.mjs} +2 -2
  89. package/dist/cli/{chunk-UUQ2OXMH.js → chunk-KULT6O5K.js} +18 -20
  90. package/dist/cli/{chunk-YFZLZNTH.mjs → chunk-L3JVGNAT.mjs} +4 -4
  91. package/dist/cli/{chunk-HYBZWSSH.js → chunk-L6QAIZNZ.js} +44 -44
  92. package/dist/cli/{chunk-TCVCFZP6.mjs → chunk-NU7B5X6J.mjs} +4 -1
  93. package/dist/cli/{chunk-7PXP2FQK.js → chunk-NXGLJGPB.js} +2 -2
  94. package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
  95. package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
  96. package/dist/cli/{chunk-2D6SWQTK.js → chunk-PJ4ZGZAN.js} +13 -13
  97. package/dist/cli/{chunk-HWPOXCCK.js → chunk-PU42VOBI.js} +8 -8
  98. package/dist/cli/{chunk-RKY4LBX3.mjs → chunk-QDBGPRR2.mjs} +3 -3
  99. package/dist/cli/{chunk-KOZBZPRM.js → chunk-QPDLG7DQ.js} +55 -55
  100. package/dist/cli/{chunk-DWPY6ZID.mjs → chunk-R7JYG6XO.mjs} +1 -1
  101. package/dist/cli/{chunk-K76AEBFY.mjs → chunk-RMVZTBI5.mjs} +4 -4
  102. package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
  103. package/dist/cli/{chunk-WNNA4L6Z.js → chunk-UGA5KI4A.js} +22 -22
  104. package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
  105. package/dist/cli/{chunk-7CWSAEYS.mjs → chunk-V5IIBG2E.mjs} +1 -1
  106. package/dist/cli/{chunk-BF65LB7X.mjs → chunk-VP2K5B3R.mjs} +4 -4
  107. package/dist/cli/{chunk-DYIWDUY4.js → chunk-VRYX2BR4.js} +316 -303
  108. package/dist/cli/{chunk-R2KKEHJN.mjs → chunk-W3J3LT22.mjs} +5 -5
  109. package/dist/cli/{chunk-PHLNYBAA.js → chunk-WBFOV5HT.js} +5 -5
  110. package/dist/cli/{chunk-5EKNDNFQ.js → chunk-WBTYWJLN.js} +2 -2
  111. package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
  112. package/dist/cli/{chunk-K3IPGMGP.js → chunk-XDS26J7Z.js} +17 -19
  113. package/dist/cli/{chunk-JQQG4QL4.mjs → chunk-Y6AMMXWS.mjs} +3 -3
  114. package/dist/cli/{chunk-7R5DAANG.mjs → chunk-Z2PPB3IO.mjs} +1 -1
  115. package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
  116. package/dist/cli/{chunk-243O3FH5.js → chunk-ZFSB7GXF.js} +5 -5
  117. package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
  118. package/dist/cli/{chunk-FZKPPB5P.mjs → chunk-ZHPSJ3LJ.mjs} +85 -77
  119. package/dist/cli/{chunk-K53NKWZO.mjs → chunk-ZUAMXZXC.mjs} +13 -15
  120. package/dist/cli/command-docs.js +2 -2
  121. package/dist/cli/command-docs.mjs +1 -1
  122. package/dist/cli/{csv-CLPVMIRF.mjs → csv-HZP6QMG7.mjs} +6 -6
  123. package/dist/cli/{csv-CD55KEIO.js → csv-JITYN27L.js} +15 -15
  124. package/dist/cli/{db-MQKLDAEO.js → db-FYSRB7O4.js} +36 -36
  125. package/dist/cli/{db-AU4SMWUN.mjs → db-QRIRTOMM.mjs} +9 -9
  126. package/dist/cli/describe-LSOHOLFI.js +49 -0
  127. package/dist/cli/describe-REXJVJC3.mjs +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-TFIJPUX7.mjs → executions-53KJAFOW.mjs} +9 -9
  133. package/dist/cli/{executions-77GOLWRM.js → executions-BSTF4DDS.js} +11 -11
  134. package/dist/cli/{feedback-OV5YAL3A.js → feedback-6MW3QOXX.js} +16 -16
  135. package/dist/cli/{feedback-2WRSZ5WL.mjs → feedback-CWUJJF3J.mjs} +8 -8
  136. package/dist/cli/{git-VNS4ATLZ.mjs → git-CKVZTJFS.mjs} +7 -7
  137. package/dist/cli/git-S7SWUZ3T.js +25 -0
  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-QBL4PNGB.js} +11 -11
  141. package/dist/cli/{legacy-noops-C732QDCY.mjs → legacy-noops-USTBRFRX.mjs} +8 -8
  142. package/dist/cli/{monitors-2LYEFXOU.mjs → monitors-6UCG5D7W.mjs} +19 -16
  143. package/dist/cli/{monitors-5IUMHH3E.js → monitors-VCR6SUZD.js} +125 -122
  144. package/dist/cli/{org-G4YGZPHS.mjs → org-GSRBOJVO.mjs} +9 -9
  145. package/dist/cli/{org-ADW2EVAC.js → org-HPILTEG4.js} +89 -89
  146. package/dist/cli/{play-7GQ56C2D.mjs → play-QRTYQNG4.mjs} +123 -76
  147. package/dist/cli/{play-EHSOSSHT.js → play-TK7WOP5H.js} +641 -594
  148. package/dist/cli/{providers-PWCF6OOO.js → providers-HEXNJ5QC.js} +12 -12
  149. package/dist/cli/{providers-WL3YTCSV.mjs → providers-OAQJWVBS.mjs} +9 -9
  150. package/dist/cli/{quickstart-323XOPGI.mjs → quickstart-FFVHTPSP.mjs} +6 -6
  151. package/dist/cli/{quickstart-ZKI5MURA.js → quickstart-PYZTFXZX.js} +8 -8
  152. package/dist/cli/{run-XZPWA6JS.js → run-4DWJXJRO.js} +50 -53
  153. package/dist/cli/{run-ZCNZU3K2.mjs → run-HLN6YYZH.mjs} +31 -34
  154. package/dist/cli/search-WERQBC6V.js +32 -0
  155. package/dist/cli/{search-CVLVSFMJ.mjs → search-ZHRCXGEL.mjs} +10 -11
  156. package/dist/cli/{search-output-7HRSSRBS.js → search-output-2KY6PFDH.js} +8 -8
  157. package/dist/cli/{search-output-6PY6RN2R.mjs → search-output-N7QXACVK.mjs} +6 -6
  158. package/dist/cli/{secrets-6S2ZWDIM.mjs → secrets-FKMWBLHU.mjs} +9 -9
  159. package/dist/cli/{secrets-IYD5VKY4.js → secrets-WXQ7XO5C.js} +18 -18
  160. package/dist/cli/{sessions-GVEX5TUJ.mjs → sessions-3YDTEDA5.mjs} +8 -8
  161. package/dist/cli/sessions-LXQ4Q6BS.js +22 -0
  162. package/dist/cli/{settings-CANK4HJQ.js → settings-67TWLQ6E.js} +88 -89
  163. package/dist/cli/{settings-BN5MJZ3C.mjs → settings-JTPASUZN.mjs} +15 -16
  164. package/dist/cli/{setup-YSGKGLSJ.js → setup-KUERQJUX.js} +51 -52
  165. package/dist/cli/{setup-JNMSCCU4.mjs → setup-VYNGXUJ6.mjs} +11 -12
  166. package/dist/cli/skills-EFRLHY3F.js +36 -0
  167. package/dist/cli/{skills-QCQN2UM2.mjs → skills-KI4KYHH6.mjs} +9 -10
  168. package/dist/cli/tools-C3EIGFFP.js +56 -0
  169. package/dist/cli/{tools-CDPOID7V.mjs → tools-UQDJS2RS.mjs} +20 -21
  170. package/dist/cli/{update-D3ZERUQ3.mjs → update-7FQQUBOD.mjs} +11 -12
  171. package/dist/cli/update-KCY72RXH.js +34 -0
  172. package/dist/cli/{views-RDZRWQBQ.mjs → views-JAM4MNNV.mjs} +54 -10
  173. package/dist/cli/{views-4NV2KQKA.js → views-MJK7JGZG.js} +66 -22
  174. package/dist/cli/{workflow-RABJCAZC.js → workflow-AQPRIWQX.js} +20 -20
  175. package/dist/cli/{workflow-2CG3TVCG.mjs → workflow-TQRV5FGO.mjs} +10 -10
  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
@@ -376,7 +376,7 @@ type RuntimeApiRequest =
376
376
  action: 'governor_budget_charge';
377
377
  } & PlayRunnerBudgetChargeInput)
378
378
  | { action: 'get_billing_entitlements' }
379
- | ({ action: 'write_page' } & PlayPageWriteRequest)
379
+ | { action: 'list_views' }
380
380
  | { action: 'get_runtime_traffic_policy' }
381
381
  | RuntimeReceiptAction;
382
382
 
@@ -2456,51 +2456,41 @@ export async function getBillingEntitlementsViaAppRuntime(
2456
2456
  }
2457
2457
  }
2458
2458
 
2459
- export type PlayPageWriteRequest = {
2460
- name: string;
2461
- public: boolean;
2462
- contentType: string;
2463
- description?: string;
2464
- /** Exactly one of these carries the content. */
2465
- contentText?: string;
2466
- contentBase64?: string;
2467
- };
2468
-
2469
- export type PlayPageWriteResult = {
2459
+ /** A view of the running Play, as `deepline.views.list()` returns it. */
2460
+ export type PlayViewLink = {
2461
+ id: string;
2470
2462
  name: string;
2463
+ /** Opens the view at its latest run. */
2471
2464
  url: string;
2472
- public: boolean;
2473
- created: boolean;
2474
- warnings: string[];
2465
+ /** Opens the view at the run that asked. */
2466
+ runUrl: string;
2467
+ access: 'workspace' | 'public';
2475
2468
  };
2476
2469
 
2477
- export async function writePageViaAppRuntime(
2470
+ export async function listViewsViaAppRuntime(
2478
2471
  context: WorkerRuntimeApiContext,
2479
- input: PlayPageWriteRequest,
2480
- ): Promise<PlayPageWriteResult> {
2472
+ ): Promise<PlayViewLink[]> {
2481
2473
  try {
2482
- return await postAppRuntimeApi<PlayPageWriteResult>(context, {
2483
- action: 'write_page',
2484
- ...input,
2485
- });
2474
+ const result = await postAppRuntimeApi<{ views: PlayViewLink[] }>(
2475
+ context,
2476
+ { action: 'list_views' },
2477
+ );
2478
+ return result.views;
2486
2479
  } catch (error) {
2487
- // An older receiver does not know write_page, and a token minted while
2488
- // page.write is withheld from the defaults lacks it. write_page needs only
2489
- // page.write, so either exact 403 means page writes are not available yet.
2480
+ // An older receiver does not know list_views. Say so instead of returning
2481
+ // an empty list, which would read as "this Play has no views".
2490
2482
  if (
2491
2483
  error instanceof AppRuntimeApiResponseError &&
2492
2484
  error.status === 403 &&
2493
2485
  error.code === null &&
2494
- (error.detail === 'Unsupported runtime action capability scope.' ||
2495
- error.detail ===
2496
- 'Workflow executor token does not permit this operation.')
2486
+ error.detail === 'Unsupported runtime action capability scope.'
2497
2487
  ) {
2498
2488
  throw new AppRuntimeApiResponseError({
2499
- action: 'write_page',
2489
+ action: 'list_views',
2500
2490
  status: 503,
2501
- code: 'PAGES_UNAVAILABLE',
2491
+ code: 'VIEWS_UNAVAILABLE',
2502
2492
  retryable: false,
2503
- detail: 'Page writes are not available to this run yet.',
2493
+ detail: 'Listing views is not available to this run yet.',
2504
2494
  });
2505
2495
  }
2506
2496
  throw error;
@@ -68,7 +68,7 @@ import type { CompiledRequestBatch } from './batch-runtime';
68
68
  import type { AnyBatchOperationStrategy } from './batching-types';
69
69
  import {
70
70
  getBillingEntitlementsViaAppRuntime,
71
- writePageViaAppRuntime,
71
+ listViewsViaAppRuntime,
72
72
  type RuntimeApiResponseMeta,
73
73
  } from './app-runtime-api';
74
74
  import {
@@ -262,6 +262,7 @@ import {
262
262
  TOOL_EXECUTE_PROVIDER_RATE_RETRY_SNAPSHOT_HEADER,
263
263
  TOOL_EXECUTE_PROVIDER_PERMIT_PATH_SUFFIX,
264
264
  TOOL_EXECUTE_PROVIDER_PERMIT_RECEIVER_HEADER,
265
+ isProviderPacingWaitResponse,
265
266
  isProviderPermitExecuteReceiverUnavailable,
266
267
  TOOL_EXECUTE_APP_PACING_REFUSAL_HEADER,
267
268
  TOOL_EXECUTE_APP_PACING_REFUSAL_VALUE,
@@ -275,6 +276,7 @@ import {
275
276
  ToolExecuteAuthScopeChangedError,
276
277
  toolExecuteBillingRetryIdentity,
277
278
  type ToolExecuteHttpFailureOutcome,
279
+ type ProviderServerErrorReplay,
278
280
  } from './tool-execute-retry-policy';
279
281
  import {
280
282
  createToolHttpError,
@@ -328,10 +330,9 @@ import {
328
330
  type PlaySecretPromise,
329
331
  type PlaySqlQuery,
330
332
  type PlayAuthoringRunScope,
331
- type PlayAuthoringPageWriteOptions,
332
- type PlayAuthoringPageWriteResult,
333
333
  type PlayAuthoringRuntimeContext,
334
334
  type PlayAuthoringRunStepsOptions,
335
+ hostedPagesRemovedMessage,
335
336
  } from '../plays/authoring-contract';
336
337
  import {
337
338
  resolvePlayArtifactRuntimeContract,
@@ -447,6 +448,7 @@ import {
447
448
  resolveRuntimeMapMemoryLimits,
448
449
  RuntimeMapMemoryLimitError,
449
450
  type RuntimeMapHeapAdmissionSnapshot,
451
+ type RuntimeMapTrackedRow,
450
452
  } from './map-memory-limits';
451
453
  import { RuntimeMapRowFeed } from './runtime-map-row-feed';
452
454
  import {
@@ -463,6 +465,7 @@ import type { RuntimeMapRowFeedSnapshot } from './runtime-map-row-feed';
463
465
  import { createRuntimeDispatchFlow, createRuntimeFlow } from './runtime-flow';
464
466
  import {
465
467
  createRuntimeMemoryLedger,
468
+ RUNTIME_MEMORY_LEDGER_OBJECT_PRIOR_FACTOR,
466
469
  type RuntimeMemoryLedger,
467
470
  type RuntimeMemoryLedgerHandle,
468
471
  } from './memory-ledger';
@@ -2216,23 +2219,6 @@ function durableRetryErrorClassForHttpFailure(input: {
2216
2219
  });
2217
2220
  }
2218
2221
 
2219
- /**
2220
- * Whether a call retries durably. Only a call that sets its own `retry` does
2221
- * for now; a call without one keeps the behaviour from before durable
2222
- * retries (in-call retries, then the error reaches the Play).
2223
- *
2224
- * Temporary ordering, not a switch: prebuilt Plays typecheck against the SDK
2225
- * Production runs, which gains `retry` only when this ships, so they cannot
2226
- * bound their fallback legs yet. PR #10348 removes this predicate together
2227
- * with the prebuilt `retry` legs, making durable retry every call's
2228
- * behaviour.
2229
- */
2230
- export function callOptsIntoDurableRetry(
2231
- retry: PlayToolCallRetryPolicy | undefined,
2232
- ): boolean {
2233
- return retry !== undefined;
2234
- }
2235
-
2236
2222
  /**
2237
2223
  * A call's own `retry` governs its in-call resends too, like an activity
2238
2224
  * RetryPolicy counts every attempt. A class it lists as `nonRetryable`, or
@@ -3069,7 +3055,7 @@ type ScalarPlayAuthoringRuntimeContext = Pick<
3069
3055
  | 'tools'
3070
3056
  | 'customerDb'
3071
3057
  | 'billing'
3072
- | 'pages'
3058
+ | 'views'
3073
3059
  | 'run'
3074
3060
  | 'tool'
3075
3061
  | 'step'
@@ -3080,36 +3066,6 @@ type ScalarPlayAuthoringRuntimeContext = Pick<
3080
3066
  | 'sleep'
3081
3067
  >;
3082
3068
 
3083
- /** Text stays text on the wire, so only real binary pays the base64 overhead. */
3084
- function encodePageContent(
3085
- name: string,
3086
- options: PlayAuthoringPageWriteOptions,
3087
- ): { contentType: string } & (
3088
- | { contentText: string }
3089
- | { contentBase64: string }
3090
- ) {
3091
- const { content, contentType } = options;
3092
- if (typeof content === 'string') {
3093
- return {
3094
- contentType: contentType ?? 'text/plain; charset=utf-8',
3095
- contentText: content,
3096
- };
3097
- }
3098
- if (content instanceof Uint8Array || content instanceof ArrayBuffer) {
3099
- return {
3100
- contentType: contentType ?? 'application/octet-stream',
3101
- contentBase64: Buffer.from(content as Uint8Array).toString('base64'),
3102
- };
3103
- }
3104
- const contentText = JSON.stringify(content);
3105
- if (contentText === undefined) {
3106
- throw new Error(
3107
- `ctx.pages.write("${name}") requires content: a string, bytes, or a JSON value.`,
3108
- );
3109
- }
3110
- return { contentType: contentType ?? 'application/json', contentText };
3111
- }
3112
-
3113
3069
  export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
3114
3070
  private rowStates = new Map<number, RowState>();
3115
3071
  private toolCallQueue: ToolCallRequest[] = [];
@@ -3770,37 +3726,26 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
3770
3726
  },
3771
3727
  };
3772
3728
 
3773
- readonly pages = {
3774
- write: async (
3775
- name: string,
3776
- options: PlayAuthoringPageWriteOptions,
3777
- ): Promise<PlayAuthoringPageWriteResult> => {
3729
+ readonly views = {
3730
+ list: () => {
3778
3731
  this.assertNoPendingDurableSuspension();
3779
- if (typeof name !== 'string' || !name) {
3780
- throw new Error('ctx.pages.write(name, options) requires a page name.');
3781
- }
3782
- if (typeof options?.public !== 'boolean') {
3783
- throw new Error(
3784
- `ctx.pages.write("${name}") requires public: true or false, so the write always says who can see the page.`,
3785
- );
3786
- }
3787
- const result = await writePageViaAppRuntime(
3788
- {
3789
- baseUrl: this.#options.baseUrl ?? '',
3790
- executorToken: this.#options.executorToken ?? '',
3791
- vercelProtectionBypassToken:
3792
- this.#options.vercelProtectionBypassToken,
3793
- signal: this.#options.executionSignal,
3794
- },
3795
- {
3796
- name,
3797
- public: options.public,
3798
- description: options.description,
3799
- ...encodePageContent(name, options),
3800
- },
3801
- );
3802
- for (const warning of result.warnings) this.log(warning);
3803
- return result;
3732
+ return listViewsViaAppRuntime({
3733
+ baseUrl: this.#options.baseUrl ?? '',
3734
+ executorToken: this.#options.executorToken ?? '',
3735
+ vercelProtectionBypassToken: this.#options.vercelProtectionBypassToken,
3736
+ signal: this.#options.executionSignal,
3737
+ });
3738
+ },
3739
+ };
3740
+
3741
+ /**
3742
+ * Hosted pages were removed. Plays bundled before the removal still call
3743
+ * this, so it fails with a message the author can act on instead of a
3744
+ * TypeError on an undefined property.
3745
+ */
3746
+ readonly pages = {
3747
+ write: async (name: unknown): Promise<never> => {
3748
+ throw new Error(hostedPagesRemovedMessage(name));
3804
3749
  },
3805
3750
  };
3806
3751
 
@@ -4954,7 +4899,19 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
4954
4899
  bytes: 0,
4955
4900
  });
4956
4901
  }
4957
- this.activeMapCheckpointMemory?.update(this.activeMapCheckpointBytes);
4902
+ this.updateActiveMapCheckpointMemory();
4903
+ }
4904
+
4905
+ /**
4906
+ * `materializedRows` registers resident bytes and opens at a factor of 1.
4907
+ * Checkpoint patches are measured as JSON length, so they register that
4908
+ * length at the object prior: the charge the category's old prior of 3 gave
4909
+ * them, rather than a third of it.
4910
+ */
4911
+ private updateActiveMapCheckpointMemory(): void {
4912
+ this.activeMapCheckpointMemory?.update(
4913
+ this.activeMapCheckpointBytes * RUNTIME_MEMORY_LEDGER_OBJECT_PRIOR_FACTOR,
4914
+ );
4958
4915
  }
4959
4916
 
4960
4917
  private releaseActiveMapCheckpointBytes(checkpointKey: string): void {
@@ -4969,7 +4926,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
4969
4926
  0,
4970
4927
  this.activeMapCheckpointBytes - releasedBytes,
4971
4928
  );
4972
- this.activeMapCheckpointMemory?.update(this.activeMapCheckpointBytes);
4929
+ this.updateActiveMapCheckpointMemory();
4973
4930
  }
4974
4931
 
4975
4932
  private emitExecutionEvent(event: PlayExecutionEvent): void {
@@ -12154,6 +12111,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12154
12111
  mapName: normalizedTableNamespace,
12155
12112
  budgetBytes: runtimeOptions?.retainedRowsMemoryBudgetBytes,
12156
12113
  });
12114
+ // What each retained row was charged, so a row the map stops retaining
12115
+ // gives its charge back.
12116
+ const retainedRowCharges = new WeakMap<
12117
+ PersistableMapRow,
12118
+ RuntimeMapTrackedRow
12119
+ >();
12157
12120
  // The Runtime Sheet is already the authoritative result store for these
12158
12121
  // maps. Once live RSS says response bodies are constraining row admission,
12159
12122
  // retain only rows whose terminal write has not committed yet. This keeps
@@ -12173,6 +12136,11 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12173
12136
  for (const row of rows) {
12174
12137
  if (incrementalPersistence.isPersisted(row)) {
12175
12138
  released += 1;
12139
+ const charge = retainedRowCharges.get(row);
12140
+ if (charge) {
12141
+ retainedRowsMemoryTracker.release(charge);
12142
+ retainedRowCharges.delete(row);
12143
+ }
12176
12144
  continue;
12177
12145
  }
12178
12146
  rows[retained] = row;
@@ -12182,6 +12150,12 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12182
12150
  }
12183
12151
  if (released > 0) {
12184
12152
  retainedRowsComplete = false;
12153
+ // The ledger now reads only the rows still retained. Left at the
12154
+ // charge it carried when the rows went, occupancy stayed at the heap
12155
+ // target with the rows gone and kept re-arming the hold: a 600-row
12156
+ // map crossing a 64 MiB target took 17 pressure episodes and 55
12157
+ // holds, against one of each with the charge given back.
12158
+ trackMaterializedRowBytes();
12185
12159
  this.runtimeLog(
12186
12160
  `Dataset ${normalizedTableNamespace} released ${released} durably persisted row(s) under live memory pressure; using the Runtime Sheet.`,
12187
12161
  );
@@ -12189,10 +12163,9 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12189
12163
  };
12190
12164
  // The retained-result cache is the map's other resident budget. The
12191
12165
  // tracker already measures every row it admits, so the ledger reads that
12192
- // estimate rather than serializing the same rows a second time. It is an
12193
- // upper bound: the tracker is cumulative, so a partial release under
12194
- // pressure is not subtracted from it — and a memory ledger that overstates
12195
- // holds admission early, which is the safe direction to be wrong in.
12166
+ // estimate rather than serializing the same rows a second time: an upper
12167
+ // bound on what the rows still retained hold, which falls as rows are
12168
+ // released under pressure.
12196
12169
  // This mutable holder crosses asynchronous row workers. Keeping the
12197
12170
  // handle in an object also makes that ownership visible to TypeScript's
12198
12171
  // control-flow analysis; assignments inside the tracker closure are real
@@ -12215,7 +12188,7 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
12215
12188
  ): void => {
12216
12189
  if (!retainedRowsComplete) return;
12217
12190
  try {
12218
- retainedRowsMemoryTracker.track(row);
12191
+ retainedRowCharges.set(row, retainedRowsMemoryTracker.track(row));
12219
12192
  target.push(row);
12220
12193
  trackMaterializedRowBytes();
12221
12194
  } catch (error) {
@@ -17530,7 +17503,8 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
17530
17503
  | ToolExecuteHttpFailureOutcome
17531
17504
  | { errorClass: DurableRetryErrorClass };
17532
17505
  responseText: string;
17533
- providerServerErrorReplay: 'idempotent_key' | 'read_safe' | 'never';
17506
+ /** Absent: an unclassified action. */
17507
+ providerServerErrorReplay: ProviderServerErrorReplay | undefined;
17534
17508
  rowScoped: boolean;
17535
17509
  /** The call's input, for a per-request write class (generic HTTP). */
17536
17510
  toolInput: Record<string, unknown>;
@@ -21429,8 +21403,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21429
21403
  .catch(() => null);
21430
21404
  const retrySafeTransientHttp =
21431
21405
  retryPolicy?.retrySafeTransientHttp === true;
21432
- const providerServerErrorReplay =
21433
- retryPolicy?.providerServerErrorReplay ?? 'never';
21406
+ // Owner rule (2026-11-16): a provider 5xx retries unless the action
21407
+ // declares `never`; absent is an unclassified action and retries.
21408
+ // A policy that could not be read is not known to allow it, so it
21409
+ // stays `never`.
21410
+ const providerServerErrorReplay:
21411
+ | ProviderServerErrorReplay
21412
+ | undefined = retryPolicy
21413
+ ? retryPolicy.providerServerErrorReplay
21414
+ : 'never';
21434
21415
  const requiresExecutionFence =
21435
21416
  retryPolicy?.requiresExecutionFence === true;
21436
21417
  // Fenced execution is an operation-specific opt-in. A gateway may
@@ -21843,7 +21824,6 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
21843
21824
  // `retry`; the policy (`park.enabled` per class) is the live off
21844
21825
  // switch.
21845
21826
  const callRequeueKey =
21846
- callOptsIntoDurableRetry(options?.retry) &&
21847
21827
  this.#options.durableBoundaries &&
21848
21828
  // A durable retry must find its own record after a replay, so it
21849
21829
  // needs a replay-stable receipt key. A per-invocation transport
@@ -22299,8 +22279,10 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
22299
22279
  let dispatchedWithProviderPermit = false;
22300
22280
  let providerPermitReceiverRejected = false;
22301
22281
  let providerDispatchCounted = false;
22282
+ let providerPacingWaitRefusedDispatch = false;
22302
22283
  const recordProviderDispatch = () => {
22303
- if (providerDispatchCounted) return;
22284
+ if (providerDispatchCounted || providerPacingWaitRefusedDispatch)
22285
+ return;
22304
22286
  providerDispatchCounted = true;
22305
22287
  this.resourceGovernor.recordProviderDispatch();
22306
22288
  recordToolCallSend(retryFactsTargets, provider);
@@ -22729,12 +22711,15 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
22729
22711
  // headers arrive; decoded body data stays scoped until
22730
22712
  // it has been read and verified below.
22731
22713
  response = dispatchedResponse;
22714
+ // A delegated 503 can attest that it never dispatched.
22715
+ // Read its body before counting it as a provider request.
22732
22716
  if (
22733
- dispatchedResponse.headers.has(
22717
+ dispatchedResponse.status !== 503 &&
22718
+ (dispatchedResponse.headers.has(
22734
22719
  TOOL_EXECUTE_PROVIDER_PERMIT_RECEIVER_HEADER,
22735
22720
  ) ||
22736
- (dispatchedResponse.status !== 403 &&
22737
- dispatchedResponse.status !== 404)
22721
+ (dispatchedResponse.status !== 403 &&
22722
+ dispatchedResponse.status !== 404))
22738
22723
  )
22739
22724
  recordProviderDispatch();
22740
22725
  if (dispatchedResponse.status === 429) {
@@ -22907,6 +22892,13 @@ export class PlayContextImpl implements ScalarPlayAuthoringRuntimeContext {
22907
22892
  dispatchedResponse,
22908
22893
  dispatchedResponseErrorText ?? '',
22909
22894
  );
22895
+ providerPacingWaitRefusedDispatch =
22896
+ dispatchedWithProviderPermit &&
22897
+ dispatchedResponse.status === 503 &&
22898
+ isProviderPacingWaitResponse({
22899
+ status: dispatchedResponse.status,
22900
+ bodyText: dispatchedResponseErrorText ?? '',
22901
+ });
22910
22902
  if (!providerPermitReceiverRejected)
22911
22903
  recordProviderDispatch();
22912
22904
  if (dispatchedResponse.status === 429) {
@@ -47,17 +47,19 @@ export const DURABLE_RUNS_ROLLOUT = {
47
47
  sharedReadCacheWrites: true,
48
48
  /**
49
49
  * A provider's 5xx is retried inside the attempt with exponential backoff
50
- * and jitter, sending the same provider idempotency key, but only for an
51
- * action that is classified for it (`retry.providerServerErrorReplay` of
52
- * `idempotent_key` or `read_safe`, or `retrySafeTransientHttp`). A write,
53
- * upsert, create or send, a paid call whose 5xx is ambiguous after
54
- * dispatch, and any unclassified action is never resent. Only successes are
55
- * final for the classified actions. The runner decides; the gateway
56
- * previous-outcome check only validates the recorded outcome.
50
+ * and jitter, sending the same provider idempotency key. Owner rule
51
+ * (2026-11-16): every action retries, writes and unclassified actions
52
+ * included, because at-least-once is worth more than a lost write. Not
53
+ * retried: an action that declares `retry.providerServerErrorReplay:
54
+ * 'never'`, a model's own invalid answer (`model_output`), and any timeout
55
+ * (a transport failure or a 504), since a timeout is never retried. Only
56
+ * successes are final. The runner decides; the gateway previous-outcome
57
+ * check only validates the recorded outcome.
57
58
  *
58
- * Known limit: a provider that ignores idempotency keys may still apply a
59
- * classified write twice if its classification is wrong, so a new replaying
60
- * action needs review (`tests/fixtures/provider-server-error-replay.json`).
59
+ * Known limit, accepted by the owner: a provider that ignores idempotency
60
+ * keys may apply a write twice when its 5xx came after it applied the
61
+ * write. There is no exactly-once claim; an action whose duplicate would
62
+ * be unacceptable declares `never`.
61
63
  * Each call is retried at most twice (3 sends), a provider Retry-After wait
62
64
  * is capped at 30 s, and the retries never charge the run-wide retry
63
65
  * budget. Off again stops new retries; a call already retried keeps its
@@ -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) ??
@@ -269,11 +269,14 @@ export interface PlayExecutionGovernor {
269
269
  provider: string;
270
270
  toolId?: string;
271
271
  latencyMs?: number | null;
272
+ /** The admitting permit's server-authored `inFlightAtStart`, when known. */
273
+ inFlightAtStart?: number | null;
272
274
  }): void;
273
275
  /** Feed success back using the same tool-to-provider resolution as acquire. */
274
276
  observeToolSuccess(input: {
275
277
  toolId: string;
276
278
  latencyMs?: number | null;
279
+ inFlightAtStart?: number | null;
277
280
  }): void;
278
281
 
279
282
  snapshot(): GovernanceSnapshot;
@@ -915,6 +918,9 @@ export function createPlayExecutionGovernor(
915
918
  ...(rateScope[1] ? { rateScopeToken: rateScope[1] } : {}),
916
919
  rules,
917
920
  latencyMs: success.latencyMs,
921
+ ...(success.inFlightAtStart != null
922
+ ? { inFlightAtStart: success.inFlightAtStart }
923
+ : {}),
918
924
  });
919
925
  return;
920
926
  }
@@ -933,6 +939,9 @@ export function createPlayExecutionGovernor(
933
939
  provider,
934
940
  toolId: success.toolId,
935
941
  latencyMs: success.latencyMs,
942
+ ...(success.inFlightAtStart != null
943
+ ? { inFlightAtStart: success.inFlightAtStart }
944
+ : {}),
936
945
  });
937
946
  },
938
947
 
@@ -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',