deepline 0.3.483 → 0.3.485

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 (217) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +91 -30
  2. package/dist/bundling-sources/sdk/src/compat.ts +13 -0
  3. package/dist/bundling-sources/sdk/src/plays/client-core.ts +4 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +143 -9
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +31 -4
  7. package/dist/bundling-sources/sdk/src/tool-calls.ts +1 -1
  8. package/dist/bundling-sources/sdk/src/types.ts +7 -1
  9. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +100 -9
  10. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +32 -3
  11. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +126 -41
  12. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +231 -25
  13. package/dist/bundling-sources/shared_libs/play-runtime/daytona-runtime-config.ts +9 -0
  14. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +130 -19
  15. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +105 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +4 -2
  17. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +194 -56
  18. package/dist/bundling-sources/shared_libs/play-runtime/log-provenance.ts +11 -6
  19. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +3 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/ports.ts +2 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/postgres-adapter.ts +2 -1
  22. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +30 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +195 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +20 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-projection-contract.ts +15 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +2 -2
  27. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +102 -23
  28. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/progress-sidecar.ts +9 -1
  29. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +25 -5
  30. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +133 -82
  31. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +58 -16
  32. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-sandbox-absence.ts +171 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +69 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +100 -40
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +8 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +67 -9
  37. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +5 -5
  38. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +6 -3
  39. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-errors.ts +14 -0
  40. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-writer.ts +87 -31
  41. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +18 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +19 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +14 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +204 -6
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd.ts +39 -0
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/ambiguous-modal-create-state.ts +21 -0
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/compute-billing-job-state.ts +23 -0
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-retirement-state.ts +25 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/integration-operation-value-retirement.ts +15 -1
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/outbox-repair-operation-state.ts +30 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/play-run-recovery.ts +12 -1
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-progress.ts +26 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +44 -15
  54. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +60 -11
  55. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +743 -70
  56. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +6 -1
  57. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +17 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +34 -34
  59. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/sandbox-cleanup-job-state.ts +23 -0
  60. package/dist/bundling-sources/shared_libs/play-runtime/suspension.ts +12 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +21 -0
  62. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +1 -1
  63. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +1 -1
  64. package/dist/bundling-sources/shared_libs/product-notifications/destination-state.ts +93 -0
  65. package/dist/cli/auth-ABZBH55L.js +43 -0
  66. package/dist/cli/{auth-2NXF6Q3Q.mjs → auth-OWMUENCU.mjs} +5 -5
  67. package/dist/cli/{billing-5PW4L5WD.js → billing-2FMNQGOX.js} +80 -80
  68. package/dist/cli/{billing-W2Y4EOZP.mjs → billing-JX4H3VFF.mjs} +7 -7
  69. package/dist/cli/{chunk-UGBZ6MCR.js → chunk-2ILND7XX.js} +2 -2
  70. package/dist/cli/{chunk-25IGCYJP.mjs → chunk-2ZEQ43B7.mjs} +3 -3
  71. package/dist/cli/{chunk-J7S3DJB4.mjs → chunk-3DBW6C7M.mjs} +13 -4
  72. package/dist/cli/{chunk-7APXZ3CX.mjs → chunk-3DYU3JQN.mjs} +2 -2
  73. package/dist/cli/{chunk-VFEW53L5.js → chunk-3OF7NSGR.js} +322 -294
  74. package/dist/cli/{chunk-UDF2CY4D.mjs → chunk-3Z24NKW7.mjs} +62 -34
  75. package/dist/cli/{chunk-62XGOB2D.js → chunk-5DCQWQCP.js} +26 -26
  76. package/dist/cli/{chunk-4X23YY2E.mjs → chunk-62PJ6PK7.mjs} +5 -5
  77. package/dist/cli/{chunk-YL64JIQ7.mjs → chunk-676NZ7K4.mjs} +1 -1
  78. package/dist/cli/{chunk-T5GZZJ7O.js → chunk-775AZTO7.js} +323 -247
  79. package/dist/cli/{chunk-C3LJSOQ6.mjs → chunk-ACTUAZYP.mjs} +5 -5
  80. package/dist/cli/{chunk-R2OR4RHV.js → chunk-AFADYKFE.js} +8 -8
  81. package/dist/cli/{chunk-GVAENVIG.js → chunk-AUQQVDAB.js} +110 -21
  82. package/dist/cli/{chunk-GONUMUBM.js → chunk-BSKPQB2P.js} +7 -7
  83. package/dist/cli/chunk-C6QWRSMQ.js +42 -0
  84. package/dist/cli/{chunk-AK7UKQ5R.js → chunk-CSBMKHTV.js} +5 -5
  85. package/dist/cli/{chunk-PRL7EKJZ.mjs → chunk-CW6TAQBF.mjs} +15 -4
  86. package/dist/cli/{chunk-75IIHFN6.js → chunk-DMNVM34J.js} +5 -4
  87. package/dist/cli/{chunk-IEV5UWPN.mjs → chunk-E73JXJA3.mjs} +1 -1
  88. package/dist/cli/{chunk-DS455RPF.js → chunk-EC2CVPN5.js} +3 -3
  89. package/dist/cli/{chunk-B7HQL77V.js → chunk-ECIXZNSW.js} +87 -76
  90. package/dist/cli/{chunk-JJSLEMQQ.mjs → chunk-FJY6K3BG.mjs} +93 -17
  91. package/dist/cli/{chunk-FK47YUPC.mjs → chunk-G5PI3RNT.mjs} +1 -1
  92. package/dist/cli/{chunk-GRE3ID5E.mjs → chunk-GHHJWCMD.mjs} +2 -1
  93. package/dist/cli/{chunk-2JWG2H2N.js → chunk-HKGXGGIV.js} +1 -1
  94. package/dist/cli/{chunk-2MKX3HV3.js → chunk-IHMYIHF4.js} +5 -5
  95. package/dist/cli/{chunk-SD7QWZTV.mjs → chunk-INW22YP7.mjs} +1 -1
  96. package/dist/cli/{chunk-OWUZKXE7.mjs → chunk-J7EENGKJ.mjs} +1 -1
  97. package/dist/cli/{chunk-AWAFYRFV.mjs → chunk-JD6HKNKD.mjs} +1 -1
  98. package/dist/cli/{chunk-UY7OXFVU.js → chunk-JQXUWYWX.js} +13 -13
  99. package/dist/cli/{chunk-GGJQ4HJW.mjs → chunk-KZTNNLIL.mjs} +2 -2
  100. package/dist/cli/{chunk-NREZRYPU.mjs → chunk-L352NOE3.mjs} +2 -2
  101. package/dist/cli/{chunk-WI2HNYQX.js → chunk-L7IQ3DFH.js} +53 -53
  102. package/dist/cli/{chunk-4IOY2SCQ.js → chunk-LOX3BISD.js} +4 -4
  103. package/dist/cli/{chunk-XRIQN6EP.js → chunk-NKPTM7SK.js} +7 -7
  104. package/dist/cli/{chunk-5ICAG4RE.js → chunk-NLRTFJGH.js} +14 -14
  105. package/dist/cli/{chunk-WKB6Y43W.js → chunk-NRNWPWBW.js} +37 -37
  106. package/dist/cli/{chunk-HNRELVCS.mjs → chunk-ONONSV2Q.mjs} +96 -7
  107. package/dist/cli/{chunk-MYB6JVSD.js → chunk-OW4OTEFF.js} +16 -16
  108. package/dist/cli/{chunk-ISP7ZENV.mjs → chunk-RZE5I2XJ.mjs} +4 -4
  109. package/dist/cli/{chunk-5LHU7NUS.js → chunk-S3WQJ5VG.js} +3 -3
  110. package/dist/cli/{chunk-EDMCD7MX.mjs → chunk-SR6S4EYG.mjs} +5 -5
  111. package/dist/cli/{chunk-2T4OSJEH.js → chunk-T4G2T5DS.js} +21 -21
  112. package/dist/cli/{chunk-EGHYGTJM.mjs → chunk-TMCC7ORQ.mjs} +1 -1
  113. package/dist/cli/{chunk-SCPFOH5Z.mjs → chunk-TSCUWWTM.mjs} +1 -1
  114. package/dist/cli/{chunk-7TKLISLM.js → chunk-TVW6USSG.js} +3 -3
  115. package/dist/cli/{chunk-QSYA6VE4.js → chunk-U6WEGDD3.js} +2 -2
  116. package/dist/cli/{chunk-FGEC5SWP.mjs → chunk-UPHXGZCE.mjs} +4 -4
  117. package/dist/cli/{chunk-5JCXS4MP.js → chunk-UQ3LQ6IF.js} +5 -5
  118. package/dist/cli/{chunk-JYEZ6BWX.mjs → chunk-VZYTLWOM.mjs} +2 -2
  119. package/dist/cli/{chunk-FAZTLYJO.mjs → chunk-W33OL4F2.mjs} +2 -2
  120. package/dist/cli/{chunk-ZM2YPJQJ.js → chunk-XK5DMLZE.js} +5 -1
  121. package/dist/cli/{chunk-LJ5747UC.mjs → chunk-XRDXNAAY.mjs} +5 -1
  122. package/dist/cli/{chunk-S24CK3CJ.mjs → chunk-YDA3PMKK.mjs} +3 -3
  123. package/dist/cli/{csv-EKEFLUIW.js → csv-HFEQPGNY.js} +13 -13
  124. package/dist/cli/{csv-DIFVIR23.mjs → csv-OHF3Y5KB.mjs} +4 -4
  125. package/dist/cli/{db-DOW4EVEU.mjs → db-M456OUXD.mjs} +7 -7
  126. package/dist/cli/{db-S7DDRUHX.js → db-VLQKCYQS.js} +28 -28
  127. package/dist/cli/describe-CP35DZ5Z.js +49 -0
  128. package/dist/cli/{describe-KSZFOWKV.mjs → describe-M6VXFYVL.mjs} +21 -21
  129. package/dist/cli/describe-core.d.mts +3 -3
  130. package/dist/cli/describe-core.d.ts +3 -3
  131. package/dist/cli/describe-core.js +4 -4
  132. package/dist/cli/describe-core.mjs +3 -3
  133. package/dist/cli/{executions-CAG7YC5K.mjs → executions-4FGRBPJF.mjs} +7 -7
  134. package/dist/cli/{executions-3DU5IXB6.js → executions-GKINJZI6.js} +9 -9
  135. package/dist/cli/{feedback-BQMPTE47.mjs → feedback-D2WMGK3V.mjs} +4 -4
  136. package/dist/cli/{feedback-I65JMCP2.js → feedback-ZH5K7WV7.js} +8 -8
  137. package/dist/cli/git-IDALMZDN.js +25 -0
  138. package/dist/cli/{git-UQUCD7XZ.mjs → git-OCIJ5ME4.mjs} +5 -5
  139. package/dist/cli/index.js +142 -139
  140. package/dist/cli/index.mjs +45 -42
  141. package/dist/cli/{legacy-noops-OLNT2BG5.js → legacy-noops-QNIVP7LO.js} +8 -8
  142. package/dist/cli/{legacy-noops-JXKLHUI3.mjs → legacy-noops-V6Q2X34P.mjs} +5 -5
  143. package/dist/cli/{monitors-DLTHHAFQ.mjs → monitors-2USHTG5G.mjs} +8 -8
  144. package/dist/cli/{monitors-Z5X56AZN.js → monitors-5DNK7W2K.js} +92 -92
  145. package/dist/cli/{org-XBHJLKUG.js → org-RPGM5AN4.js} +73 -73
  146. package/dist/cli/{org-6EZZHD3M.mjs → org-TL2YPYSE.mjs} +7 -7
  147. package/dist/cli/{pages-XVJ34SCN.js → pages-PNUKPFWV.js} +18 -18
  148. package/dist/cli/{pages-MYXROSVK.mjs → pages-XDEW6EE3.mjs} +7 -7
  149. package/dist/cli/{play-ACC4T2XQ.js → play-F5LHRKV5.js} +858 -632
  150. package/dist/cli/{play-5PV4LAHE.mjs → play-WINNQ4HZ.mjs} +372 -146
  151. package/dist/cli/{providers-JCI3KNE4.js → providers-BD4IS5U5.js} +10 -10
  152. package/dist/cli/{providers-2DLUGIFF.mjs → providers-PXGL3FRE.mjs} +7 -7
  153. package/dist/cli/{quickstart-PDSQEDLD.js → quickstart-7LVF6HZF.js} +6 -6
  154. package/dist/cli/{quickstart-NSL3C76K.mjs → quickstart-XTH3UQWZ.mjs} +4 -4
  155. package/dist/cli/{run-X5MXCM4P.mjs → run-MBMUENR7.mjs} +26 -26
  156. package/dist/cli/{run-UCFMHOQC.js → run-NH2BAWPA.js} +41 -41
  157. package/dist/cli/{search-RPEMXV6N.mjs → search-BMRWBV66.mjs} +8 -8
  158. package/dist/cli/search-R3MQJQMT.js +32 -0
  159. package/dist/cli/{search-output-MZH3HLVE.js → search-output-5NNT337U.js} +22 -16
  160. package/dist/cli/{search-output-6UO47B7G.mjs → search-output-QKKRD4MF.mjs} +14 -8
  161. package/dist/cli/{secrets-NLEQURD3.mjs → secrets-AWEXBTJV.mjs} +7 -7
  162. package/dist/cli/{secrets-UFBASYGY.js → secrets-KQSTOREN.js} +16 -16
  163. package/dist/cli/{sessions-JYH4DBEE.js → sessions-DSPLZYCJ.js} +6 -6
  164. package/dist/cli/{sessions-3ALFLWVU.mjs → sessions-RO25Q67X.mjs} +5 -5
  165. package/dist/cli/{settings-MQYKNAMB.js → settings-7JXIKNKI.js} +79 -79
  166. package/dist/cli/{settings-YPRILREA.mjs → settings-JMGXGK4Z.mjs} +12 -12
  167. package/dist/cli/{setup-5IGSHH4E.js → setup-5QFAQQRW.js} +47 -47
  168. package/dist/cli/{setup-DK4GM227.mjs → setup-ZQZ47FHB.mjs} +9 -9
  169. package/dist/cli/skills-EDZXY7DV.js +33 -0
  170. package/dist/cli/{skills-KYBZH3IT.mjs → skills-W3H2DL56.mjs} +7 -7
  171. package/dist/cli/{tools-4B2MHNBN.mjs → tools-2BZCVNBS.mjs} +19 -19
  172. package/dist/cli/tools-2EY2ETCZ.js +56 -0
  173. package/dist/cli/{update-S6VEO7NB.mjs → update-GAWYMGAW.mjs} +9 -9
  174. package/dist/cli/update-UKDQKNBY.js +33 -0
  175. package/dist/cli/{workflow-KXZZYFEF.mjs → workflow-M6LLHQ2I.mjs} +8 -8
  176. package/dist/cli/{workflow-FU2XVPUK.js → workflow-ZPTDFPKW.js} +18 -18
  177. package/dist/{client-DJ3r8VQJ.d.mts → client-BkbDHRIg.d.mts} +1 -1
  178. package/dist/{client-JPSNljtj.d.ts → client-D3hVHXjK.d.ts} +1 -1
  179. package/dist/{client-core-3SJlNsKU.d.mts → client-core-BZoSMKcY.d.mts} +30 -15
  180. package/dist/{client-core-rCoQ5Xz3.d.ts → client-core-DUdVqO_m.d.ts} +30 -15
  181. package/dist/{compiler-manifest-gkO9ZkVg.d.mts → compiler-manifest-BFTwq1HI.d.mts} +1 -1
  182. package/dist/{compiler-manifest-gkO9ZkVg.d.ts → compiler-manifest-BFTwq1HI.d.ts} +1 -1
  183. package/dist/{errors-Cc92LKH-.d.ts → errors-c3pMsylw.d.ts} +1 -1
  184. package/dist/{errors-CeCCOKSA.d.mts → errors-w31ybrQM.d.mts} +1 -1
  185. package/dist/{index-DJQKdV76.d.ts → index-CQ-15-QL.d.ts} +1 -1
  186. package/dist/{index-DsqWJL3Q.d.mts → index-DvNtxucX.d.mts} +1 -1
  187. package/dist/index.d.mts +7 -7
  188. package/dist/index.d.ts +7 -7
  189. package/dist/index.js +10 -10
  190. package/dist/index.mjs +7 -7
  191. package/dist/install-integrity.json +123 -116
  192. package/dist/plays/bundle-play-file.d.mts +3 -3
  193. package/dist/plays/bundle-play-file.d.ts +3 -3
  194. package/dist/plays/bundle-play-file.mjs +2 -2
  195. package/dist/plays/play-description.d.mts +2 -2
  196. package/dist/plays/play-description.d.ts +2 -2
  197. package/dist/plays/run-request.d.mts +2 -2
  198. package/dist/plays/run-request.d.ts +2 -2
  199. package/dist/plays/run-request.js +12 -2
  200. package/dist/plays/run-request.mjs +11 -1
  201. package/dist/release.d.mts +1 -1
  202. package/dist/release.d.ts +1 -1
  203. package/dist/release.js +2 -2
  204. package/dist/release.mjs +1 -1
  205. package/dist/server.d.mts +4 -4
  206. package/dist/server.d.ts +4 -4
  207. package/dist/server.js +6 -6
  208. package/dist/server.mjs +4 -4
  209. package/package.json +1 -1
  210. package/dist/cli/auth-JHQKM6QY.js +0 -43
  211. package/dist/cli/chunk-PHDEQ6W3.js +0 -33
  212. package/dist/cli/describe-RXYQCJRR.js +0 -49
  213. package/dist/cli/git-ADIABNMQ.js +0 -25
  214. package/dist/cli/search-YILJZD36.js +0 -32
  215. package/dist/cli/skills-I4IUZN3U.js +0 -33
  216. package/dist/cli/tools-NLZR7ABS.js +0 -56
  217. package/dist/cli/update-RVDEUJTE.js +0 -33
@@ -1031,6 +1031,8 @@ export async function deliverRunCreatedOutboxEventInline(input: {
1031
1031
  schedulerOptions?: Pick<PostgresSchedulerOptions, 'schema'>;
1032
1032
  tokenAuthority: RunLedgerOutboxTokenAuthority;
1033
1033
  appRuntimeFetch?: typeof fetch;
1034
+ /** The receiver origin `appRuntimeFetch` serves in-process, without ingress. */
1035
+ appRuntimeInProcessOrigin?: string | null;
1034
1036
  /** The caller owns this attempt through its after-response lifecycle. */
1035
1037
  background?: boolean;
1036
1038
  deadlineMs?: number;
@@ -1076,7 +1078,10 @@ export async function deliverRunCreatedOutboxEventInline(input: {
1076
1078
  leaseSeconds: RUN_CREATED_INLINE_DELIVERY_LEASE_SECONDS,
1077
1079
  tokenAuthority: input.tokenAuthority,
1078
1080
  ...(input.appRuntimeFetch
1079
- ? { appRuntimeFetch: input.appRuntimeFetch }
1081
+ ? {
1082
+ appRuntimeFetch: input.appRuntimeFetch,
1083
+ appRuntimeInProcessOrigin: input.appRuntimeInProcessOrigin ?? null,
1084
+ }
1080
1085
  : {}),
1081
1086
  signal: controller.signal,
1082
1087
  onAbortedLeaseRelease: (released) => {
@@ -158,6 +158,8 @@ export type RuntimeRunLogPage = {
158
158
  lastStoredSeq: number;
159
159
  firstStoredSeq: number | null;
160
160
  entries: Array<{ seq: number; line: string }>;
161
+ /** The canonical terminal fact and its ordered log prefix are indexed. */
162
+ terminalProjected?: boolean;
161
163
  };
162
164
 
163
165
  function requiredScope(value: string): string {
@@ -1107,6 +1109,8 @@ export async function getRuntimeRunLogPage(
1107
1109
  limit: number;
1108
1110
  /** Return the newest bounded window for a stream's initial connection. */
1109
1111
  tail?: boolean;
1112
+ /** Only canonical-event terminal watchers require this readiness fence. */
1113
+ includeTerminalProjection?: boolean;
1110
1114
  },
1111
1115
  ): Promise<RuntimeRunLogPage> {
1112
1116
  const scope = requiredScope(input.runtimeScope);
@@ -1142,6 +1146,7 @@ export async function getRuntimeRunLogPage(
1142
1146
  first_stored_seq: string | number | null;
1143
1147
  last_stored_seq: string | number | null;
1144
1148
  entries: Array<{ seq: string | number; line: string }>;
1149
+ terminal_projected?: boolean;
1145
1150
  }>(
1146
1151
  // Match the event-then-cursor relation lock order used by migrations and
1147
1152
  // log projection. Cursor-first reads can deadlock a schema expansion.
@@ -1181,6 +1186,15 @@ export async function getRuntimeRunLogPage(
1181
1186
  retained.last_seq AS last_stored_seq,
1182
1187
  coalesce((SELECT jsonb_agg(jsonb_build_object('seq', seq, 'line', line)
1183
1188
  ORDER BY seq) FROM page), '[]'::jsonb) AS entries
1189
+ ${
1190
+ input.includeTerminalProjection
1191
+ ? `, EXISTS (
1192
+ SELECT 1 FROM runtime_observability.events
1193
+ WHERE runtime_scope = $1 AND org_id = $2 AND run_id = $3
1194
+ AND kind IN (${RUN_EVENT_KIND_SQL_LITERAL.runCompleted}, ${RUN_EVENT_KIND_SQL_LITERAL.runFailed}, ${RUN_EVENT_KIND_SQL_LITERAL.runCancelled})
1195
+ ) AS terminal_projected`
1196
+ : ''
1197
+ }
1184
1198
  FROM retained`,
1185
1199
  pageParams,
1186
1200
  );
@@ -1220,6 +1234,9 @@ export async function getRuntimeRunLogPage(
1220
1234
  lastStoredSeq,
1221
1235
  firstStoredSeq,
1222
1236
  entries,
1237
+ ...(input.includeTerminalProjection
1238
+ ? { terminalProjected: row?.terminal_projected === true }
1239
+ : {}),
1223
1240
  };
1224
1241
  }
1225
1242
 
@@ -13,6 +13,8 @@ import {
13
13
  RuntimeSandboxOperationState,
14
14
  RuntimeSandboxProvider,
15
15
  } from './runtime-sandbox-operation';
16
+ import type { ComputeBillingJobStatus } from './compute-billing-job-state';
17
+ import { readComputeBillingJobStatus } from './compute-billing-job-state';
16
18
 
17
19
  /**
18
20
  * The baseline when an organization has no current override. It sits above
@@ -73,6 +75,8 @@ function schemaTables(options?: Pick<PostgresSchedulerOptions, 'schema'>) {
73
75
  return {
74
76
  cache: `${schema}."runtime_org_sandbox_limit_cache"`,
75
77
  leases: `${schema}."runtime_sandbox_capacity_leases"`,
78
+ capacityLock: `${schema}.runtime_sandbox_capacity_lock`,
79
+ capacityObservation: `${schema}.runtime_sandbox_capacity_observation`,
76
80
  operations: `${schema}."runtime_sandbox_operations"`,
77
81
  cleanup: `${schema}."sandbox_cleanup_jobs_v2"`,
78
82
  runs: `${schema}."runs"`,
@@ -151,20 +155,23 @@ export async function syncRuntimeOrgSandboxLimitCache(
151
155
  'expiresAt must be a positive epoch milliseconds value or null.',
152
156
  );
153
157
  }
154
- const { cache } = schemaTables(options);
158
+ const { cache, capacityLock } = schemaTables(options);
155
159
  const result = await client.query<{ synced_at_ms: number }>(
156
160
  `
161
+ WITH capacity_lock AS MATERIALIZED (
162
+ SELECT ${capacityLock}($1) AS acquired
163
+ )
157
164
  INSERT INTO ${cache} (
158
165
  org_id, "limit", expires_at, source_revision, synced_at
159
166
  )
160
- VALUES (
167
+ SELECT
161
168
  $1,
162
169
  $2,
163
170
  CASE WHEN $3::double precision IS NULL THEN NULL
164
171
  ELSE to_timestamp($3::double precision / 1000.0) END,
165
172
  $4,
166
173
  clock_timestamp()
167
- )
174
+ FROM capacity_lock
168
175
  ON CONFLICT (org_id) DO UPDATE
169
176
  SET "limit" = EXCLUDED."limit",
170
177
  expires_at = EXCLUDED.expires_at,
@@ -298,8 +305,15 @@ export async function reserveRuntimeSandboxCapacityLease(
298
305
  > {
299
306
  const orgId = assertId(input.orgId, 'orgId');
300
307
  const runId = assertId(input.runId, 'runId');
301
- const { cache, leases, operations, runs, attempts, cleanup } =
302
- schemaTables(options);
308
+ const {
309
+ cache,
310
+ leases,
311
+ capacityObservation,
312
+ operations,
313
+ runs,
314
+ attempts,
315
+ cleanup,
316
+ } = schemaTables(options);
303
317
  const leaseId = input.leaseId?.trim() || randomUUID();
304
318
  const unsentProviderOperationToken = unsentReservationInputs.get(input);
305
319
  const providerOperationToken =
@@ -311,11 +325,11 @@ export async function reserveRuntimeSandboxCapacityLease(
311
325
  input.resumePendingDaytonaOperation === true &&
312
326
  input.provider === RuntimeSandboxProvider.Daytona &&
313
327
  input.attempt !== undefined;
314
- // This is deliberately a soft admission check: concurrent workers may both
315
- // observe space and insert. Avoid locks and long transactions; the provider
316
- // has its own global safety cap and the 50-minute lease bounds crashes.
317
- // Read the capacity and existing intent together. Neither observation proves
318
- // an INSERT winner; the fenced write must return proof or read it back.
328
+ // Capacity is a soft per-org limit. Two transaction-scoped observation lanes
329
+ // permit one extra lease in a simultaneous race while keeping larger bursts
330
+ // bounded. Keep observation, lease insertion, and provider-operation intent
331
+ // in one query, then prove the insert or read it back before granting create
332
+ // authority. No reservation lock crosses provider I/O.
319
333
  const observed = await client.query<{
320
334
  limit: number;
321
335
  active_leases: number;
@@ -346,29 +360,8 @@ export async function reserveRuntimeSandboxCapacityLease(
346
360
  `
347
361
  WITH observed AS MATERIALIZED (
348
362
  SELECT
349
- coalesce(
350
- (
351
- SELECT CASE
352
- WHEN expires_at IS NOT NULL AND expires_at <= clock_timestamp()
353
- THEN $2::integer
354
- ELSE "limit"
355
- END
356
- FROM ${cache}
357
- WHERE org_id = $1
358
- ),
359
- $2::integer
360
- ) AS "limit",
361
- (
362
- SELECT count(*)::integer
363
- FROM ${leases}
364
- WHERE org_id = $1
365
- AND released_at IS NULL
366
- -- A bound lease represents a provider resource that must remain
367
- -- counted until provider-confirmed deletion. The 50-minute TTL
368
- -- is only the crash backstop for a create that never became
369
- -- durable enough to bind to a sandbox id.
370
- AND (sandbox_id IS NOT NULL OR expires_at > clock_timestamp())
371
- ) AS active_leases,
363
+ capacity.configured_limit AS "limit",
364
+ capacity.active_leases,
372
365
  coalesce((
373
366
  SELECT jsonb_agg(pending)
374
367
  FROM (
@@ -443,6 +436,7 @@ export async function reserveRuntimeSandboxCapacityLease(
443
436
  WHERE lease.lease_id = $5
444
437
  ) AS existing
445
438
  ) AS existing_operation
439
+ FROM ${capacityObservation}($1, $2::integer) AS capacity
446
440
  ), active_run AS MATERIALIZED (
447
441
  SELECT run.run_id
448
442
  FROM ${runs} AS run, observed
@@ -1437,7 +1431,7 @@ export type RuntimeSandboxCapacityTestEvidence = {
1437
1431
  cleanupJobs: number;
1438
1432
  confirmedCleanupJobs: number;
1439
1433
  pendingCleanup: number;
1440
- computeJobStatus: string | null;
1434
+ computeJobStatus: ComputeBillingJobStatus | null;
1441
1435
  hasComputeIntent: boolean;
1442
1436
  recordedResources: number;
1443
1437
  firstAcquiredAtMs: number | null;
@@ -1544,5 +1538,11 @@ export async function readRuntimeSandboxCapacityTestEvidence(
1544
1538
  const evidence = result.rows[0]?.evidence;
1545
1539
  if (!evidence)
1546
1540
  throw new Error('Sandbox capacity evidence query returned no snapshot.');
1541
+ if (evidence.run) {
1542
+ evidence.run.computeJobStatus =
1543
+ evidence.run.computeJobStatus === null
1544
+ ? null
1545
+ : readComputeBillingJobStatus(evidence.run.computeJobStatus);
1546
+ }
1547
1547
  return input.runId && evidence.run === null ? null : evidence;
1548
1548
  }
@@ -0,0 +1,23 @@
1
+ /** Persisted in sandbox_cleanup_jobs_v2.status. */
2
+ export const SandboxCleanupJobStatus = {
3
+ Pending: 'pending',
4
+ Deleting: 'deleting',
5
+ Deleted: 'deleted',
6
+ } as const;
7
+
8
+ export type SandboxCleanupJobStatus =
9
+ (typeof SandboxCleanupJobStatus)[keyof typeof SandboxCleanupJobStatus];
10
+
11
+ /** Decode database text at the scheduler boundary; unknown states fail closed. */
12
+ export function readSandboxCleanupJobStatus(
13
+ value: unknown,
14
+ ): SandboxCleanupJobStatus {
15
+ if (
16
+ value === SandboxCleanupJobStatus.Pending ||
17
+ value === SandboxCleanupJobStatus.Deleting ||
18
+ value === SandboxCleanupJobStatus.Deleted
19
+ ) {
20
+ return value;
21
+ }
22
+ throw new Error(`Unknown sandbox cleanup job status: ${String(value)}.`);
23
+ }
@@ -161,16 +161,28 @@ export class PlayRowExecutionSuspendedError extends Error {
161
161
 
162
162
  /** A provider wait is a control handoff, never a failed cell or receipt. */
163
163
  export class PlayRowProviderBackpressureError extends Error {
164
+ readonly #localRetryAtMs: number | undefined;
165
+
164
166
  constructor(
165
167
  readonly provider: string,
166
168
  readonly retryAtMs: number,
167
169
  /** Live handoff only: the mapped row must not renew this tool's wait budget. */
168
170
  readonly residentWaitBudgetExhausted = false,
171
+ localRetryAtMs?: number,
169
172
  ) {
170
173
  super(
171
174
  `Play row is waiting for ${provider} provider backpressure to clear.`,
172
175
  );
173
176
  this.name = 'PlayRowProviderBackpressureError';
177
+ this.#localRetryAtMs =
178
+ Number.isSafeInteger(localRetryAtMs) && Number(localRetryAtMs) >= 0
179
+ ? localRetryAtMs
180
+ : undefined;
181
+ }
182
+
183
+ /** Live clock evidence only; the provider's canonical deadline stays unchanged. */
184
+ get localRetryAtMs(): number | undefined {
185
+ return this.#localRetryAtMs;
174
186
  }
175
187
  }
176
188
 
@@ -1,3 +1,4 @@
1
+ import { createHash } from 'node:crypto';
1
2
  import { getRuntimeEnv } from './runtime-env';
2
3
  import type { PlayRunnerEvent } from './protocol';
3
4
  import {
@@ -5,6 +6,26 @@ import {
5
6
  type RuntimeTestFaultName,
6
7
  } from './runtime-incident-drills';
7
8
 
9
+ /** Complete rate-acquire traces belong only to the existing scoped synthetic fixture. */
10
+ export function isRuntimeRateStateDiagnosticBucket(bucketId: string): boolean {
11
+ return /^rate:fleet_managed:test_unhinted:[a-f0-9]{64}$/.test(bucketId);
12
+ }
13
+
14
+ export function isRuntimeRateStateDiagnosticScope(
15
+ playName: string | null | undefined,
16
+ bucketId: string,
17
+ ): boolean {
18
+ return (
19
+ /^unhinted_adaptive_[a-f0-9]{12}$/.test(playName ?? '') &&
20
+ isRuntimeRateStateDiagnosticBucket(bucketId)
21
+ );
22
+ }
23
+
24
+ /** Hash the entire quota identity; never log its raw credential/customer components. */
25
+ export function runtimeRateStateBucketDigest(bucketId: string): string {
26
+ return createHash('sha256').update(bucketId).digest('hex');
27
+ }
28
+
8
29
  export const PLAY_RUNTIME_TEST_FAULT_HEADER = 'x-deepline-test-fault';
9
30
 
10
31
  export type RuntimeTestFaultRegistry = {
@@ -1819,7 +1819,7 @@ export const PLAY_AUTHORING_FIELD_REGISTRY = {
1819
1819
  resolution: 'static-required',
1820
1820
  issueCode: 'play_authoring_binding_invalid',
1821
1821
  description:
1822
- 'Opts new source into the current explicit-freshness authoring edition; an already-pinned edition-10 artifact retains its admitted behavior.',
1822
+ 'Declares the current explicit-freshness contract. Unmarked new source also uses the current edition. Already-pinned artifacts retain their admitted behavior.',
1823
1823
  errorMessage:
1824
1824
  'compatibility.authoringContract must be the static literal "explicit-freshness".',
1825
1825
  },
@@ -391,7 +391,7 @@ export function resolvePlaySourceAuthoringContractEdition(
391
391
  throw new PlayAuthoringFieldValidationError(
392
392
  'compatibility.authoringContract',
393
393
  'play_authoring_binding_invalid',
394
- 'compatibility.authoringContract must be statically resolvable; declare "explicit-freshness" to opt into explicit freshness.',
394
+ 'compatibility.authoringContract must be statically resolvable; use the literal "explicit-freshness" or omit the field to use the source default or artifact pin.',
395
395
  );
396
396
  }
397
397
  if (marker.kind === 'absent')
@@ -0,0 +1,93 @@
1
+ /** Persisted product notification destination lifecycle. */
2
+ export const PRODUCT_NOTIFICATION_DESTINATION_STATUS = {
3
+ pendingVerification: 'pending_verification',
4
+ active: 'active',
5
+ disabled: 'disabled',
6
+ needsAttention: 'needs_attention',
7
+ } as const;
8
+
9
+ export type ProductNotificationDestinationStatus =
10
+ (typeof PRODUCT_NOTIFICATION_DESTINATION_STATUS)[keyof typeof PRODUCT_NOTIFICATION_DESTINATION_STATUS];
11
+
12
+ export const PRODUCT_NOTIFICATION_DESTINATION_TRANSITIONS = {
13
+ pending_verification: ['active', 'disabled', 'needs_attention'],
14
+ active: ['pending_verification', 'disabled', 'needs_attention'],
15
+ disabled: ['pending_verification', 'active'],
16
+ needs_attention: ['pending_verification', 'active', 'disabled'],
17
+ } as const satisfies Record<
18
+ ProductNotificationDestinationStatus,
19
+ readonly ProductNotificationDestinationStatus[]
20
+ >;
21
+
22
+ export type StoredProductNotificationDestinationStatus =
23
+ | { kind: 'known'; status: ProductNotificationDestinationStatus }
24
+ | { kind: 'unknown'; value: string };
25
+
26
+ export function readProductNotificationDestinationStatus(
27
+ value: string,
28
+ ): StoredProductNotificationDestinationStatus {
29
+ switch (value) {
30
+ case PRODUCT_NOTIFICATION_DESTINATION_STATUS.pendingVerification:
31
+ case PRODUCT_NOTIFICATION_DESTINATION_STATUS.active:
32
+ case PRODUCT_NOTIFICATION_DESTINATION_STATUS.disabled:
33
+ case PRODUCT_NOTIFICATION_DESTINATION_STATUS.needsAttention:
34
+ return { kind: 'known', status: value };
35
+ default:
36
+ return { kind: 'unknown', value };
37
+ }
38
+ }
39
+
40
+ export function requireProductNotificationDestinationStatus(
41
+ value: string,
42
+ ): ProductNotificationDestinationStatus {
43
+ const stored = readProductNotificationDestinationStatus(value);
44
+ if (stored.kind === 'unknown') {
45
+ throw new Error(
46
+ `Unsupported product notification destination status: ${stored.value}`,
47
+ );
48
+ }
49
+ return stored.status;
50
+ }
51
+
52
+ export function isProductNotificationDestinationDeliverable(
53
+ value: string,
54
+ ): boolean {
55
+ return (
56
+ readProductNotificationDestinationStatus(value).kind === 'known' &&
57
+ value === PRODUCT_NOTIFICATION_DESTINATION_STATUS.active
58
+ );
59
+ }
60
+
61
+ export function canTransitionProductNotificationDestination(
62
+ current: string,
63
+ next: ProductNotificationDestinationStatus,
64
+ ): boolean {
65
+ const stored = readProductNotificationDestinationStatus(current);
66
+ return (
67
+ stored.kind === 'known' &&
68
+ (
69
+ PRODUCT_NOTIFICATION_DESTINATION_TRANSITIONS[
70
+ stored.status
71
+ ] as readonly string[]
72
+ ).includes(next)
73
+ );
74
+ }
75
+
76
+ /** Validate a destination lifecycle write without narrowing persisted schema. */
77
+ export function nextProductNotificationDestinationStatus(
78
+ current: string,
79
+ next: ProductNotificationDestinationStatus,
80
+ ): ProductNotificationDestinationStatus {
81
+ const stored = readProductNotificationDestinationStatus(current);
82
+ if (stored.kind === 'unknown') {
83
+ throw new Error(
84
+ `Cannot transition product notification destination from unknown status: ${stored.value}`,
85
+ );
86
+ }
87
+ if (!canTransitionProductNotificationDestination(current, next)) {
88
+ throw new Error(
89
+ `Invalid product notification destination transition: ${current} -> ${next}`,
90
+ );
91
+ }
92
+ return next;
93
+ }
@@ -0,0 +1,43 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+
13
+
14
+
15
+
16
+
17
+ var _chunkL7IQ3DFHjs = require('./chunk-L7IQ3DFH.js');
18
+ require('./chunk-BSKPQB2P.js');
19
+ require('./chunk-S3WQJ5VG.js');
20
+ require('./chunk-DMNVM34J.js');
21
+ require('./chunk-ALJJRZNJ.js');
22
+ require('./chunk-XNYIZMNQ.js');
23
+ require('./chunk-DIAWYWT5.js');
24
+ require('./chunk-HKGXGGIV.js');
25
+ require('./chunk-OG64RBAC.js');
26
+ require('./chunk-COGTRVWW.js');
27
+
28
+
29
+
30
+
31
+
32
+
33
+
34
+
35
+
36
+
37
+
38
+
39
+
40
+
41
+
42
+
43
+ exports.EXIT_WORKSPACE_MISMATCH = _chunkL7IQ3DFHjs.EXIT_WORKSPACE_MISMATCH; exports.authStatusLine = _chunkL7IQ3DFHjs.authStatusLine; exports.clearPendingClaim = _chunkL7IQ3DFHjs.clearPendingClaim; exports.clearSatisfiedPendingClaim = _chunkL7IQ3DFHjs.clearSatisfiedPendingClaim; exports.handleRegister = _chunkL7IQ3DFHjs.handleRegister; exports.handleStatus = _chunkL7IQ3DFHjs.handleStatus; exports.handleWait = _chunkL7IQ3DFHjs.handleWait; exports.httpJson = _chunkL7IQ3DFHjs.httpJson; exports.readPendingAuthClaim = _chunkL7IQ3DFHjs.readPendingAuthClaim; exports.readStatusBanner = _chunkL7IQ3DFHjs.readStatusBanner; exports.registerAuthCommands = _chunkL7IQ3DFHjs.registerAuthCommands; exports.reportApprovalLinkShown = _chunkL7IQ3DFHjs.reportApprovalLinkShown; exports.reportSetupCompleted = _chunkL7IQ3DFHjs.reportSetupCompleted; exports.resolvePendingAuthClaimForResume = _chunkL7IQ3DFHjs.resolvePendingAuthClaimForResume; exports.statusBannerLine = _chunkL7IQ3DFHjs.statusBannerLine;
@@ -14,14 +14,14 @@ import {
14
14
  reportSetupCompleted,
15
15
  resolvePendingAuthClaimForResume,
16
16
  statusBannerLine
17
- } from "./chunk-25IGCYJP.mjs";
18
- import "./chunk-NREZRYPU.mjs";
19
- import "./chunk-FK47YUPC.mjs";
20
- import "./chunk-GRE3ID5E.mjs";
17
+ } from "./chunk-2ZEQ43B7.mjs";
18
+ import "./chunk-L352NOE3.mjs";
19
+ import "./chunk-G5PI3RNT.mjs";
20
+ import "./chunk-GHHJWCMD.mjs";
21
21
  import "./chunk-4QF2K7TM.mjs";
22
22
  import "./chunk-DLIRSHV6.mjs";
23
23
  import "./chunk-HBL4PM5Q.mjs";
24
- import "./chunk-SCPFOH5Z.mjs";
24
+ import "./chunk-TSCUWWTM.mjs";
25
25
  import "./chunk-WZYKRD7T.mjs";
26
26
  import "./chunk-KRD6H754.mjs";
27
27
  export {