deepline 0.3.583 → 0.4.0

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 (194) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +79 -36
  2. package/dist/bundling-sources/sdk/src/index.ts +2 -0
  3. package/dist/bundling-sources/sdk/src/release.ts +7 -3
  4. package/dist/bundling-sources/sdk/src/types.ts +37 -0
  5. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +22 -3
  6. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +94 -5
  7. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +66 -12
  8. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +10 -0
  9. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-topology.ts +6 -1
  10. package/dist/bundling-sources/shared_libs/play-runtime/deployment/runtime-tuple-recovery.ts +9 -3
  11. package/dist/bundling-sources/shared_libs/play-runtime/docflow-node-io.ts +86 -20
  12. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +17 -6
  13. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +22 -6
  14. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +54 -0
  15. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/terminal/postgres-adapter.ts +2 -1
  16. package/dist/bundling-sources/shared_libs/play-runtime/row-failure-summary.ts +1 -0
  17. package/dist/bundling-sources/shared_libs/play-runtime/run-snapshot-stream.ts +4 -1
  18. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/early-sandbox.ts +12 -3
  19. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +197 -19
  20. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +25 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/runtime-scheduler-topology.ts +5 -0
  22. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +73 -3
  23. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-wake-policy.ts +419 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/early-sandbox-lane.ts +20 -6
  25. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-pool.ts +24 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +1 -1
  27. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +36 -19
  28. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +380 -51
  29. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +21 -10
  30. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +32 -0
  31. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +6 -0
  32. package/dist/bundling-sources/shared_libs/plays/deploy/api-client.ts +3 -1
  33. package/dist/bundling-sources/shared_libs/plays/deploy/run-deployment.ts +34 -4
  34. package/dist/bundling-sources/shared_libs/plays/docflow-recording-lint.ts +512 -0
  35. package/dist/bundling-sources/shared_libs/plays/docflow-requirement.ts +346 -0
  36. package/dist/bundling-sources/shared_libs/plays/docflow-rule-codes.ts +38 -0
  37. package/dist/bundling-sources/shared_libs/plays/docflow-unreached-reason.ts +42 -2
  38. package/dist/bundling-sources/shared_libs/plays/docflow.ts +223 -32
  39. package/dist/bundling-sources/shared_libs/plays/play-check-compact.ts +14 -1
  40. package/dist/bundling-sources/shared_libs/plays/run-result.ts +35 -0
  41. package/dist/cli/{agents-G344SPW2.mjs → agents-AHXB7N7Y.mjs} +4 -4
  42. package/dist/cli/{agents-ZPDXVPEE.js → agents-KBZ7OUZS.js} +33 -33
  43. package/dist/cli/{auth-V66RP2A6.mjs → auth-3CACO52T.mjs} +5 -5
  44. package/dist/cli/auth-UOHCO5K6.js +44 -0
  45. package/dist/cli/{billing-ROYUQF67.js → billing-5KXPGKMO.js} +105 -105
  46. package/dist/cli/{billing-BTMGZJCR.mjs → billing-TSTK63NB.mjs} +9 -9
  47. package/dist/cli/{chunk-ROWROMXD.mjs → chunk-2GWKBQJZ.mjs} +1 -1
  48. package/dist/cli/{chunk-VXEZKZU4.mjs → chunk-3DJMPID5.mjs} +11 -11
  49. package/dist/cli/{chunk-VH45GV3T.js → chunk-3ET6NRXP.js} +7 -3
  50. package/dist/cli/{chunk-43MKV6E4.mjs → chunk-3MWTAM3F.mjs} +3 -3
  51. package/dist/cli/{chunk-U6BTY4WS.mjs → chunk-4ANDW2OT.mjs} +1 -1
  52. package/dist/cli/{chunk-H4BYWEV5.js → chunk-4BSCSQ6I.js} +4 -4
  53. package/dist/cli/{chunk-ACS6BYE5.mjs → chunk-4UEXAMDU.mjs} +2 -2
  54. package/dist/cli/{chunk-QPN662ZP.js → chunk-5XGLDVSD.js} +100 -100
  55. package/dist/cli/{chunk-MFPHCUHK.js → chunk-7XXJJVSI.js} +5 -5
  56. package/dist/cli/{chunk-QGOHEJVJ.js → chunk-7ZCD7OPO.js} +5 -5
  57. package/dist/cli/{chunk-AXKFZIXC.mjs → chunk-AJJSKKH4.mjs} +2 -2
  58. package/dist/cli/{chunk-KSXBLXLV.mjs → chunk-BHF5UW34.mjs} +1 -1
  59. package/dist/cli/{chunk-AHQDUMDM.js → chunk-BO2TXH5Y.js} +20 -20
  60. package/dist/cli/{chunk-W5WLWRKL.mjs → chunk-BUC2TNF2.mjs} +2 -2
  61. package/dist/cli/{chunk-6GYGMWQV.js → chunk-BUUAFSSN.js} +68 -50
  62. package/dist/cli/{chunk-WUVDJSZE.js → chunk-C45E47KC.js} +23 -23
  63. package/dist/cli/{chunk-BUMCOVBP.js → chunk-D4R3AL4F.js} +5 -5
  64. package/dist/cli/{chunk-PVDP3AZY.mjs → chunk-DAZRIAXW.mjs} +4 -4
  65. package/dist/cli/{chunk-W3ECB7GC.js → chunk-DNOZQGJF.js} +3 -3
  66. package/dist/cli/{chunk-HYT5B2NL.js → chunk-DUL6UQ2T.js} +2 -2
  67. package/dist/cli/{chunk-P2YNTAGL.mjs → chunk-ES3S6UXR.mjs} +2 -2
  68. package/dist/cli/{chunk-K6GDSCFL.mjs → chunk-FDAYUP3M.mjs} +3 -3
  69. package/dist/cli/{chunk-23LYXVI4.js → chunk-FEVUIT2U.js} +6 -6
  70. package/dist/cli/{chunk-6S3OAJCJ.mjs → chunk-FSPEUU3V.mjs} +49 -6
  71. package/dist/cli/{chunk-2QIVGZKS.mjs → chunk-FZZMCVOS.mjs} +5 -5
  72. package/dist/cli/{chunk-73IZARR5.js → chunk-GHOB72U6.js} +13 -13
  73. package/dist/cli/{chunk-LVJAHM2I.mjs → chunk-GLYWRTEL.mjs} +3 -3
  74. package/dist/cli/{chunk-AXOQ2FMS.mjs → chunk-HNTIGYRT.mjs} +1 -1
  75. package/dist/cli/{chunk-C7UCDL2K.js → chunk-IGPHYKEJ.js} +41 -41
  76. package/dist/cli/{chunk-PULU5YGX.js → chunk-ISSYN3DJ.js} +20 -20
  77. package/dist/cli/{chunk-ZHIJA4MW.mjs → chunk-JKQPITEE.mjs} +54 -36
  78. package/dist/cli/{chunk-EHV52KUV.mjs → chunk-KMLACXI2.mjs} +7 -3
  79. package/dist/cli/{chunk-WAZR72D5.js → chunk-KQXACHYA.js} +26 -26
  80. package/dist/cli/{chunk-PGUK5VPC.js → chunk-LW2GKYZW.js} +2 -2
  81. package/dist/cli/{chunk-J54DMFV5.mjs → chunk-O2KSPI2M.mjs} +2 -2
  82. package/dist/cli/{chunk-CCC3NIYB.js → chunk-O6GT6JD7.js} +9 -9
  83. package/dist/cli/{chunk-DNYFNOWG.mjs → chunk-OCXWUWUI.mjs} +5 -5
  84. package/dist/cli/{chunk-MEAWK5G7.js → chunk-QKRDAJ3T.js} +53 -53
  85. package/dist/cli/{chunk-N5XRUZRS.js → chunk-QQESWF6D.js} +16 -16
  86. package/dist/cli/{chunk-2D5YISAL.js → chunk-REX5SUYU.js} +2 -2
  87. package/dist/cli/{chunk-RO2LTLJA.js → chunk-RXIQWG2N.js} +48 -48
  88. package/dist/cli/{chunk-VXDKL434.js → chunk-S33BN7GZ.js} +3 -3
  89. package/dist/cli/{chunk-72MEXMSH.mjs → chunk-SGRJJLNV.mjs} +1 -1
  90. package/dist/cli/{chunk-HOGRT5X6.mjs → chunk-TCNYSNVU.mjs} +1 -1
  91. package/dist/cli/{chunk-H7F3ROT3.mjs → chunk-TFPMVSGK.mjs} +2 -2
  92. package/dist/cli/{chunk-GFX6CDAB.mjs → chunk-V73WDQEA.mjs} +5 -5
  93. package/dist/cli/{chunk-LHD3HOYN.js → chunk-VYERVFGB.js} +49 -6
  94. package/dist/cli/{chunk-C233ZRNX.mjs → chunk-WBRSVML3.mjs} +4 -4
  95. package/dist/cli/{chunk-7AFTLM74.mjs → chunk-WW52ANX4.mjs} +2 -2
  96. package/dist/cli/{chunk-ZFJNIZHI.js → chunk-XZS35M3Y.js} +10 -10
  97. package/dist/cli/{chunk-YRNWA2IL.js → chunk-YNYHYL5C.js} +15 -15
  98. package/dist/cli/{chunk-JQT3SHXL.mjs → chunk-ZHE5E2WJ.mjs} +1 -1
  99. package/dist/cli/{chunk-N5RCXI3M.mjs → chunk-ZJ2H77VV.mjs} +5 -5
  100. package/dist/cli/{chunk-GQHZV7EQ.js → chunk-ZX6UVPGZ.js} +7 -7
  101. package/dist/cli/command-docs.js +2 -2
  102. package/dist/cli/command-docs.mjs +1 -1
  103. package/dist/cli/concurrent-runs-help-H5SZUA5J.js +22 -0
  104. package/dist/cli/{concurrent-runs-help-A2Y33OQ5.mjs → concurrent-runs-help-IYELSCHB.mjs} +6 -6
  105. package/dist/cli/{csv-PS74WVXE.mjs → csv-ENEC3APZ.mjs} +4 -4
  106. package/dist/cli/{csv-TKSR2LFV.js → csv-X6CP57R4.js} +13 -13
  107. package/dist/cli/{db-R6GOM4VC.js → db-6HLRSE2M.js} +27 -27
  108. package/dist/cli/{db-EXLBRZ7K.mjs → db-YGKRFK4T.mjs} +6 -6
  109. package/dist/cli/{describe-JJBXFPVQ.mjs → describe-4SGQEX7K.mjs} +18 -18
  110. package/dist/cli/describe-Q2OYHDVZ.js +50 -0
  111. package/dist/cli/describe-core.d.mts +2 -2
  112. package/dist/cli/describe-core.d.ts +2 -2
  113. package/dist/cli/{executions-474U7R3Y.js → executions-IC55YJ67.js} +8 -8
  114. package/dist/cli/{executions-5PEODJQG.mjs → executions-PO2IOSZ7.mjs} +6 -6
  115. package/dist/cli/{feedback-QUQVRDBD.mjs → feedback-6BUD5F4I.mjs} +6 -6
  116. package/dist/cli/{feedback-URTCAOXP.js → feedback-BCGQLZ5T.js} +14 -14
  117. package/dist/cli/git-5X3MLBIP.js +26 -0
  118. package/dist/cli/{git-AQF23KKU.mjs → git-IN4IBL2K.mjs} +5 -5
  119. package/dist/cli/index.js +148 -148
  120. package/dist/cli/index.mjs +47 -47
  121. package/dist/cli/{integrations-NMFOOSS4.js → integrations-R2Z2MDO3.js} +29 -29
  122. package/dist/cli/{integrations-5POBI72U.mjs → integrations-ZMGB6NQA.mjs} +7 -7
  123. package/dist/cli/{legacy-noops-6YVCOSFO.mjs → legacy-noops-GIC5OZKP.mjs} +6 -6
  124. package/dist/cli/{legacy-noops-V75T5LHV.js → legacy-noops-X4JPRPTJ.js} +9 -9
  125. package/dist/cli/{mcp-7WEYQ5V7.mjs → mcp-G4IRJIKK.mjs} +4 -4
  126. package/dist/cli/{mcp-N6GYXCUQ.js → mcp-USZKTVL2.js} +24 -24
  127. package/dist/cli/{monitors-TAK4M5Y4.mjs → monitors-SNFZPSCY.mjs} +7 -7
  128. package/dist/cli/{monitors-HW4H4PE5.js → monitors-T7LRP7OB.js} +100 -100
  129. package/dist/cli/{org-FULXOXNE.js → org-2L2ZZL2P.js} +121 -121
  130. package/dist/cli/{org-3C2RN36N.mjs → org-YTXLKW52.mjs} +6 -6
  131. package/dist/cli/{outcomes-4KRZL6OL.mjs → outcomes-CJWBIFTA.mjs} +6 -6
  132. package/dist/cli/{outcomes-O3HDQWGN.js → outcomes-O63F57JF.js} +14 -14
  133. package/dist/cli/{play-ZTRWUODW.mjs → play-6UWPUHC6.mjs} +331 -70
  134. package/dist/cli/{play-HA4RGX7T.js → play-T353SULJ.js} +930 -669
  135. package/dist/cli/{providers-FAKWWJE2.mjs → providers-LZABK2UW.mjs} +6 -6
  136. package/dist/cli/{providers-DXMKWBZN.js → providers-XORJH2VW.js} +9 -9
  137. package/dist/cli/{quickstart-YWGBTW77.mjs → quickstart-O4RF7J55.mjs} +4 -4
  138. package/dist/cli/{quickstart-MA74UPNI.js → quickstart-QBNUNPZR.js} +6 -6
  139. package/dist/cli/{run-4DXSGXRB.js → run-2CPMFC6W.js} +44 -44
  140. package/dist/cli/{run-QHCYMSBP.mjs → run-GBRPFC6P.mjs} +23 -23
  141. package/dist/cli/{search-N4ZOK5XX.mjs → search-G7TS7OFB.mjs} +7 -7
  142. package/dist/cli/search-M3AHFCKQ.js +32 -0
  143. package/dist/cli/{search-output-F2OYLVK2.mjs → search-output-BIIJRUCP.mjs} +4 -4
  144. package/dist/cli/{search-output-D5VAC52B.js → search-output-NRKLNWSD.js} +6 -6
  145. package/dist/cli/{secrets-LD4FVAQI.mjs → secrets-DN3XEZNH.mjs} +6 -6
  146. package/dist/cli/{secrets-3KETOTDS.js → secrets-FUXYSEL5.js} +15 -15
  147. package/dist/cli/{sessions-LPLI4Z4O.mjs → sessions-PMUTPCTT.mjs} +6 -6
  148. package/dist/cli/sessions-VMBMBGVJ.js +23 -0
  149. package/dist/cli/{settings-NCGPJG3Z.mjs → settings-N6GNS2KA.mjs} +12 -12
  150. package/dist/cli/{settings-NFBTCOMB.js → settings-ZDTWCQ6B.js} +85 -85
  151. package/dist/cli/{setup-NH6MRYXZ.mjs → setup-LJ3KWPSA.mjs} +9 -9
  152. package/dist/cli/{setup-ATBSUSH4.js → setup-PN5TSSJE.js} +49 -49
  153. package/dist/cli/{skills-ITPBPIXD.mjs → skills-7J42K6VC.mjs} +7 -7
  154. package/dist/cli/skills-CXDENBLF.js +37 -0
  155. package/dist/cli/{tools-2XZPR65V.mjs → tools-M3S6D6DA.mjs} +17 -17
  156. package/dist/cli/tools-WY2GMOC7.js +57 -0
  157. package/dist/cli/{update-VFB22FWO.mjs → update-XTVFG74E.mjs} +9 -9
  158. package/dist/cli/update-ZB2IBGXG.js +37 -0
  159. package/dist/cli/{views-WJUZOQM2.js → views-B4X2FWTF.js} +21 -21
  160. package/dist/cli/{views-MRN3HWTG.mjs → views-UFYRDO4X.mjs} +6 -6
  161. package/dist/cli/{workflow-Q4JFBTVH.js → workflow-I2RM2J2J.js} +17 -17
  162. package/dist/cli/{workflow-A6P7YV5W.mjs → workflow-ZLMS3PDE.mjs} +7 -7
  163. package/dist/{client-QznpkWrk.d.ts → client-2QWMJInp.d.ts} +1 -1
  164. package/dist/{client-CmG8MT0x.d.mts → client-7H8TXmLa.d.mts} +1 -1
  165. package/dist/{client-core-CY0jNW0e.d.mts → client-core-BraEuxbg.d.mts} +67 -4
  166. package/dist/{client-core-CXDqfeiB.d.ts → client-core-DRglY5xa.d.ts} +67 -4
  167. package/dist/index.d.mts +3 -3
  168. package/dist/index.d.ts +3 -3
  169. package/dist/index.js +9 -9
  170. package/dist/index.mjs +6 -6
  171. package/dist/install-integrity.json +125 -120
  172. package/dist/plays/bundle-play-file.mjs +5 -0
  173. package/dist/plays/play-description.d.mts +1 -1
  174. package/dist/plays/play-description.d.ts +1 -1
  175. package/dist/plays/run-request.d.mts +1 -1
  176. package/dist/plays/run-request.d.ts +1 -1
  177. package/dist/release.d.mts +3 -3
  178. package/dist/release.d.ts +3 -3
  179. package/dist/release.js +2 -2
  180. package/dist/release.mjs +1 -1
  181. package/dist/server.d.mts +2 -2
  182. package/dist/server.d.ts +2 -2
  183. package/dist/server.js +5 -5
  184. package/dist/server.mjs +3 -3
  185. package/package.json +1 -1
  186. package/dist/cli/auth-VU6VIPVY.js +0 -44
  187. package/dist/cli/concurrent-runs-help-6WUNDV77.js +0 -22
  188. package/dist/cli/describe-CA2FL2OS.js +0 -50
  189. package/dist/cli/git-WJ4V2B4T.js +0 -26
  190. package/dist/cli/search-V765JH2H.js +0 -32
  191. package/dist/cli/sessions-XC65OMDS.js +0 -23
  192. package/dist/cli/skills-4NQBTGOL.js +0 -37
  193. package/dist/cli/tools-ZVOFATX2.js +0 -57
  194. package/dist/cli/update-QME3KPOP.js +0 -37
@@ -173,7 +173,8 @@ export function createRuntimeTuplePanicRecovery(input: {
173
173
  internalToken: string;
174
174
  vercelProtectionBypassToken?: string;
175
175
  vercel: Readonly<{
176
- token: string;
176
+ /** A getter is read at each request, for short-lived (OIDC) tokens. */
177
+ token: string | (() => string);
177
178
  teamId: string;
178
179
  projectId: string;
179
180
  productionDomain?: string;
@@ -304,13 +305,18 @@ export function createRuntimeTuplePanicRecovery(input: {
304
305
  }
305
306
  };
306
307
 
308
+ const vercelToken = (): string =>
309
+ typeof input.vercel.token === 'function'
310
+ ? input.vercel.token()
311
+ : input.vercel.token;
312
+
307
313
  const restoreAndVerifyPublicApplication = async (
308
314
  publication: RuntimeTuplePanicPublication,
309
315
  ): Promise<void> => {
310
316
  const activeDeploymentId = async (): Promise<string | null> => {
311
317
  const alias = await fetchImpl(
312
318
  `https://api.vercel.com/v4/aliases/${encodeURIComponent(productionDomain)}?teamId=${encodeURIComponent(input.vercel.teamId)}`,
313
- { headers: { authorization: `Bearer ${input.vercel.token}` } },
319
+ { headers: { authorization: `Bearer ${vercelToken()}` } },
314
320
  );
315
321
  if (!alias.ok) {
316
322
  await errorWithResponse('Read Vercel Production alias', alias);
@@ -346,7 +352,7 @@ export function createRuntimeTuplePanicRecovery(input: {
346
352
  fetchImpl,
347
353
  projectId: input.vercel.projectId,
348
354
  teamId: input.vercel.teamId,
349
- token: input.vercel.token,
355
+ token: vercelToken(),
350
356
  });
351
357
  if (!response.ok && response.status !== 202) {
352
358
  const body = await response.text();
@@ -200,6 +200,9 @@ function previewValue(
200
200
  depth: number;
201
201
  ancestors: WeakSet<object>;
202
202
  redactor?: PreviewOptions['redactor'];
203
+ /** Shallower than `DOCFLOW_NODE_IO_LIMITS.maxDepth`, for a value that
204
+ * does not fit the phase at full depth (`fittingPreview`). */
205
+ maxDepth?: number;
203
206
  },
204
207
  ): PlayDocflowNodeValuePreview {
205
208
  if (value === null) return { kind: 'null' };
@@ -289,12 +292,50 @@ function previewValue(
289
292
  if (input.ancestors.has(value)) {
290
293
  return { kind: 'unavailable', reason: 'cycle' };
291
294
  }
292
- if (input.depth >= DOCFLOW_NODE_IO_LIMITS.maxDepth) {
295
+ if (input.depth >= (input.maxDepth ?? DOCFLOW_NODE_IO_LIMITS.maxDepth)) {
293
296
  return { kind: 'unavailable', reason: 'depth' };
294
297
  }
295
298
 
296
299
  input.ancestors.add(value);
297
300
  try {
301
+ // A Map holds its entries in an internal slot, not as fields, so it read
302
+ // as `{}`; a Set likewise read as `{}`. Read them through the built-in
303
+ // iterators (never an authored override) as the same object and array
304
+ // previews a plain record and a list give: no new preview kind.
305
+ if (value instanceof Map) {
306
+ const entries = [...Map.prototype.entries.call(value)];
307
+ const selected = entries.slice(0, DOCFLOW_NODE_IO_LIMITS.maxObjectFields);
308
+ const fields: Record<string, PlayDocflowNodeValuePreview> = {};
309
+ for (const [key, entry] of selected) {
310
+ const name = typeof key === 'string' ? key : String(key);
311
+ fields[
312
+ truncateUtf8(
313
+ ledgerSafeDocflowPreviewKey(
314
+ input.redactor?.redactRegisteredSecrets(name) ?? name,
315
+ ),
316
+ DOCFLOW_NODE_IO_LIMITS.maxStringBytes,
317
+ )
318
+ ] = previewValue(entry, { ...input, depth: input.depth + 1 });
319
+ }
320
+ return {
321
+ kind: 'object',
322
+ fields,
323
+ totalFields: entries.length,
324
+ ...(entries.length > selected.length ? { truncated: true } : {}),
325
+ };
326
+ }
327
+ if (value instanceof Set) {
328
+ const all = [...Set.prototype.values.call(value)];
329
+ const items = all
330
+ .slice(0, DOCFLOW_NODE_IO_LIMITS.maxArrayItems)
331
+ .map((item) => previewValue(item, { ...input, depth: input.depth + 1 }));
332
+ return {
333
+ kind: 'array',
334
+ items,
335
+ totalItems: all.length,
336
+ ...(all.length > items.length ? { truncated: true } : {}),
337
+ };
338
+ }
298
339
  if (Array.isArray(value)) {
299
340
  const items: PlayDocflowNodeValuePreview[] = [];
300
341
  for (
@@ -362,6 +403,38 @@ function previewValue(
362
403
  }
363
404
  }
364
405
 
406
+ /**
407
+ * A value's preview that fits beside the previews already taken, read at full
408
+ * depth, then shallower: a long list of records keeps its count and its first
409
+ * items' top-level fields rather than being dropped whole. Null when not even
410
+ * its top level fits.
411
+ */
412
+ function fittingPreview(
413
+ value: unknown,
414
+ taken: PlayDocflowNodeIoPreviewMap,
415
+ path: string,
416
+ redactor: PreviewOptions['redactor'],
417
+ ): PlayDocflowNodeValuePreview | null {
418
+ for (
419
+ let maxDepth = DOCFLOW_NODE_IO_LIMITS.maxDepth;
420
+ maxDepth >= 1;
421
+ maxDepth -= 1
422
+ ) {
423
+ const preview = previewValue(value, {
424
+ depth: 0,
425
+ ancestors: new WeakSet(),
426
+ redactor,
427
+ maxDepth,
428
+ });
429
+ if (
430
+ utf8Bytes(JSON.stringify({ ...taken, [path]: preview })) <=
431
+ DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
432
+ )
433
+ return preview;
434
+ }
435
+ return null;
436
+ }
437
+
365
438
  export function buildPlayDocflowNodeIoPreviewMap(
366
439
  values: Record<string, unknown>,
367
440
  options: PreviewOptions = {},
@@ -388,16 +461,13 @@ export function buildPlayDocflowNodeIoPreviewMap(
388
461
  ),
389
462
  DOCFLOW_NODE_IO_LIMITS.maxStringBytes,
390
463
  );
391
- const preview = previewValue(value, {
392
- depth: 0,
393
- ancestors: new WeakSet(),
394
- redactor: options.redactor,
395
- });
396
- const candidate = { ...previews, [safePath]: preview };
397
- if (
398
- utf8Bytes(JSON.stringify(candidate)) >
399
- DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
400
- ) {
464
+ const preview = fittingPreview(
465
+ value,
466
+ previews,
467
+ safePath,
468
+ options.redactor,
469
+ );
470
+ if (!preview) {
401
471
  truncated = true;
402
472
  break;
403
473
  }
@@ -477,17 +547,13 @@ export function buildPlayDocflowNodeInputPreviewMap(
477
547
  ),
478
548
  DOCFLOW_NODE_IO_LIMITS.maxStringBytes,
479
549
  );
480
- const preview: PlayDocflowNodeValuePreview = available
481
- ? previewValue(current, {
482
- depth: 0,
483
- ancestors: new WeakSet(),
484
- redactor: options.redactor,
485
- })
550
+ const preview: PlayDocflowNodeValuePreview | null = available
551
+ ? fittingPreview(current, values, safePath, options.redactor)
486
552
  : { kind: 'unavailable', reason: 'access_error' };
487
- const candidate = { ...values, [safePath]: preview };
488
553
  if (
489
- utf8Bytes(JSON.stringify(candidate)) >
490
- DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
554
+ !preview ||
555
+ utf8Bytes(JSON.stringify({ ...values, [safePath]: preview })) >
556
+ DOCFLOW_NODE_IO_LIMITS.maxPhaseBytes
491
557
  ) {
492
558
  truncated = true;
493
559
  break;
@@ -164,6 +164,8 @@ export type RuntimeReceiptHydrationGate = {
164
164
  /** Abort the queue wait; the signal's reason is what rejects. */
165
165
  signal?: AbortSignal;
166
166
  }): Promise<RuntimeReceiptHydrationTurn>;
167
+ /** Typical nonzero response size once sampled. Cold misses cannot price an unknown body. */
168
+ measuredOutputBytesPerKey(): number | undefined;
167
169
  snapshot(): RuntimeReceiptHydrationGateSnapshot;
168
170
  /**
169
171
  * Release the admission timer and reject every still-queued turn. A closed
@@ -370,18 +372,19 @@ export function createRuntimeReceiptHydrationGate(input: {
370
372
  if (slot < sampleReservoirSize) perKeySamples[slot] = bytesPerKey;
371
373
  };
372
374
 
375
+ const measuredBytesPerKey = (): number | undefined =>
376
+ perKeySamples.length >= sampleTurns
377
+ ? (percentile(perKeySamples, 0.9) ?? undefined)
378
+ : undefined;
379
+
373
380
  /** Ledger bytes one receipt key is expected to cost. */
374
381
  const priceKey = (occupancy: RuntimeMemoryOccupancy): number => {
375
- const measured =
376
- perKeySamples.length >= sampleTurns
377
- ? percentile(perKeySamples, 0.9)
378
- : null;
379
382
  // The lane's own measurement is what a receipt read costs. Before it has
380
383
  // one, a receipt key is priced as a row: the ledger's settled p90 per
381
384
  // owner, or the unmeasured prior behind it. That is an overestimate for a
382
385
  // claim that returns no output, and deliberately so — the alternative is
383
386
  // admitting an unknown payload against a budget it may not fit.
384
- return measured === null ? occupancy.ownerReserveLedgerBytes : measured;
387
+ return measuredBytesPerKey() ?? occupancy.ownerReserveLedgerBytes;
385
388
  };
386
389
 
387
390
  /** Prefer a manifest's exact serialized body size over the conservative prior. */
@@ -587,6 +590,10 @@ export function createRuntimeReceiptHydrationGate(input: {
587
590
  }
588
591
 
589
592
  return {
593
+ measuredOutputBytesPerKey() {
594
+ const measured = measuredBytesPerKey();
595
+ return measured === 0 ? undefined : measured;
596
+ },
590
597
  acquire(request) {
591
598
  const requestedKeys = request?.receiptKeys;
592
599
  const receiptKeys =
@@ -834,7 +841,11 @@ export type DurableReceiptExecutionStore = {
834
841
  */
835
842
  getMany(
836
843
  receiptKeys: string[],
837
- options?: { hydrateOutput?: boolean },
844
+ options?: {
845
+ hydrateOutput?: boolean;
846
+ /** Known decoded output sizes; they size read batches only. */
847
+ expectedOutputBytes?: ReadonlyMap<string, number>;
848
+ },
838
849
  ): Promise<Map<string, RuntimeStepReceipt>>;
839
850
  claim(
840
851
  receiptKey: string,
@@ -679,12 +679,19 @@ export async function executeWithFreshnessReceipt<T>(input: {
679
679
  measure?.([receipt]);
680
680
  return completedCall(receipt);
681
681
  });
682
- const readMany = (keys: readonly string[], expectedBytes?: number) =>
682
+ const readMany = (
683
+ keys: readonly string[],
684
+ expectedBytes?: number,
685
+ expectedOutputBytes?: ReadonlyMap<string, number>,
686
+ ) =>
683
687
  input.withHydration(
684
688
  async (measure) => {
685
689
  const getMany = input.store.getMany;
686
690
  const receipts = getMany
687
- ? await getMany([...keys]).then((byKey) =>
691
+ ? await getMany(
692
+ [...keys],
693
+ expectedOutputBytes ? { expectedOutputBytes } : undefined,
694
+ ).then((byKey) =>
688
695
  keys.map((key) => byKey.get(key) ?? null),
689
696
  )
690
697
  : await Promise.all(keys.map((key) => input.store.get(key)));
@@ -730,11 +737,20 @@ export async function executeWithFreshnessReceipt<T>(input: {
730
737
  }
731
738
  return [...manifests];
732
739
  }
733
- const expectedBytes = bodiless.reduce((total, key) => {
740
+ const expectedOutputBytes = new Map<string, number>();
741
+ for (const key of bodiless) {
734
742
  const bytes = manifests[keys.indexOf(key)]?.outputByteLength;
735
- return total + (Number.isSafeInteger(bytes) ? bytes! : 0);
736
- }, 0);
737
- const hydrated = await readMany(bodiless, expectedBytes);
743
+ if (Number.isSafeInteger(bytes)) expectedOutputBytes.set(key, bytes!);
744
+ }
745
+ const expectedBytes = [...expectedOutputBytes.values()].reduce(
746
+ (total, bytes) => total + bytes,
747
+ 0,
748
+ );
749
+ const hydrated = await readMany(
750
+ bodiless,
751
+ expectedBytes,
752
+ expectedOutputBytes,
753
+ );
738
754
  return keys.map((key, index) => {
739
755
  const at = bodiless.indexOf(key);
740
756
  return at === -1 ? manifests[index]! : (hydrated[at] ?? null);
@@ -107,6 +107,22 @@ export const RUNTIME_RECEIPT_GATEWAY_BATCH_MAX_BYTES = 12 * 1024 * 1024;
107
107
  * gateway writer behind one request.
108
108
  */
109
109
  export const RUNTIME_RECEIPT_WRITER_TARGET_BATCH_BYTES = 8 * 1024 * 1024;
110
+ /**
111
+ * Receipt reads are bounded by what they return, not only by key count. On
112
+ * 1 December 2026 a map of page bodies coalesced 200 full reads into one
113
+ * request; each ran past the 30 s Postgres read timeout and every retry asked
114
+ * for the same 200 bodies. A read batch closes before its expected decoded
115
+ * output passes this budget. One receipt larger than it still reads alone.
116
+ */
117
+ export const RUNTIME_RECEIPT_READ_TARGET_RESPONSE_BYTES = 4 * 1024 * 1024;
118
+ /**
119
+ * Price of a full read whose size the caller does not know. A manifest read
120
+ * gives the exact size first; this prior only bounds reads without one, so an
121
+ * unpriced batch holds at most 128 keys.
122
+ */
123
+ export const RUNTIME_RECEIPT_READ_UNKNOWN_OUTPUT_BYTES = 32 * 1024;
124
+ /** A manifest carries status, lease facts and a size: never the body. */
125
+ export const RUNTIME_RECEIPT_MANIFEST_RESPONSE_BYTES = 1024;
110
126
  /**
111
127
  * Batching window for runtime step receipt completions.
112
128
  *
@@ -1019,6 +1035,11 @@ function compactRunListPreviewValue(
1019
1035
  if (!isPlainObject(value)) {
1020
1036
  return { value: String(value), truncated: true };
1021
1037
  }
1038
+ // A dataset handle is fixed-size once its internals (`_metadata`: work
1039
+ // progress, cardinality, …) are left out: keep it whole, so the run list
1040
+ // can say "3 rows" and open them instead of losing the output.
1041
+ const handle = compactRunListDatasetHandle(value);
1042
+ if (handle) return { value: handle, truncated: false };
1022
1043
 
1023
1044
  const output: Record<string, unknown> = Object.create(null) as Record<
1024
1045
  string,
@@ -1046,6 +1067,37 @@ function compactRunListPreviewValue(
1046
1067
  };
1047
1068
  }
1048
1069
 
1070
+ /** The fields a dataset handle keeps in a run-list preview, scalars only. */
1071
+ const RUN_LIST_DATASET_HANDLE_FIELDS = [
1072
+ 'datasetId',
1073
+ 'tableNamespace',
1074
+ 'name',
1075
+ 'rowCount',
1076
+ 'count',
1077
+ ] as const;
1078
+
1079
+ /**
1080
+ * `{ kind: 'dataset', datasetId, tableNamespace?, name?, rowCount?, count? }`
1081
+ * for a dataset handle (bounded strings, finite counts), else null.
1082
+ */
1083
+ function compactRunListDatasetHandle(
1084
+ value: Record<string, unknown>,
1085
+ ): Record<string, unknown> | null {
1086
+ if (value.kind !== 'dataset') return null;
1087
+ const handle: Record<string, unknown> = { kind: 'dataset' };
1088
+ for (const key of RUN_LIST_DATASET_HANDLE_FIELDS) {
1089
+ const field = value[key];
1090
+ if (typeof field === 'number' && Number.isFinite(field))
1091
+ handle[key] = field;
1092
+ else if (typeof field === 'string')
1093
+ handle[key] = compactRunListPreviewString(field).value;
1094
+ }
1095
+ return typeof handle.datasetId === 'string' ||
1096
+ typeof handle.tableNamespace === 'string'
1097
+ ? handle
1098
+ : null;
1099
+ }
1100
+
1049
1101
  function runListPreviewFieldBytes(
1050
1102
  key: string,
1051
1103
  value: unknown,
@@ -1084,6 +1136,8 @@ export function buildBoundedRunListOutputPreview(
1084
1136
  truncated = true;
1085
1137
  continue;
1086
1138
  }
1139
+ // The output's own bookkeeping is never a value a reader reads.
1140
+ if (key === '_metadata') continue;
1087
1141
  const compacted = compactRunListPreviewValue(child, 0);
1088
1142
  truncated ||= compacted.truncated;
1089
1143
  let previewValue = compacted.value;
@@ -2,6 +2,7 @@ import { ABSURD_WAKE_CHANNEL } from '@deepline/absurd/sdk';
2
2
 
3
3
  import { absurdRunnerTerminalEventName } from '../../scheduler-backends/absurd-shared';
4
4
  import {
5
+ absurdEngineWakeEchoSql,
5
6
  directCompletePostgresSchedulerRunnerTerminal,
6
7
  recordPostgresSchedulerRunnerTerminal,
7
8
  type PostgresSchedulerQueryClient,
@@ -60,7 +61,7 @@ export function createPostgresPlayRunTerminalPorts(input: {
60
61
  `WITH emitted AS (
61
62
  SELECT absurd.emit_event($1, $2, 'null'::jsonb)
62
63
  )
63
- SELECT pg_notify('${ABSURD_WAKE_CHANNEL}', $1) FROM emitted`,
64
+ SELECT ${absurdEngineWakeEchoSql(options, `'${ABSURD_WAKE_CHANNEL}'`, '$1')} FROM emitted`,
64
65
  [
65
66
  terminal.queueName,
66
67
  absurdRunnerTerminalEventName(terminal.runId, terminal.attempt),
@@ -89,6 +89,7 @@ export function settledRowFailureKind(error: unknown): RowFailureKind {
89
89
  'PROVIDER_AUTHORIZATION_FAILED',
90
90
  'PROVIDER_AUTHENTICATION_FAILED',
91
91
  'PROVIDER_ACCOUNT_CAPACITY',
92
+ 'PROVIDER_FIELD_NOT_ENTITLED',
92
93
  ].includes(code)
93
94
  )
94
95
  return 'inputOrAuth';
@@ -1,3 +1,4 @@
1
+ import { playRunResult } from '../plays/run-result';
1
2
  import {
2
3
  projectPlayStepProgressCounters,
3
4
  resolveTimingWindow,
@@ -345,7 +346,9 @@ export function buildPlayRunStatusSnapshot(input: {
345
346
  updatedAt: input.run.updatedAt ?? null,
346
347
  finishedAt: input.run.finishedAt ?? null,
347
348
  });
348
- const terminalRunLogTail = extractTerminalRunLogTail(input.run.result);
349
+ const terminalRunLogTail = extractTerminalRunLogTail(
350
+ playRunResult(input.run),
351
+ );
349
352
  const projectedSnapshot =
350
353
  terminalRunLogTail &&
351
354
  terminalRunLogTail.totalLogCount > ledgerSnapshot.totalLogCount
@@ -683,10 +683,11 @@ export type EarlySandboxAdapter<
683
683
  * An advisory check run inside the fire-and-forget create, before any
684
684
  * provider call: a skip names why this run would not adopt in time (its
685
685
  * org's sandbox capacity is full, so the run will queue past the adoption
686
- * window). Null, or a rejected check, creates as before.
686
+ * window). A null reason passes with details (logged `create_gate_open`, so
687
+ * the decision is visible). Null, or a rejected check, creates as before.
687
688
  */
688
689
  export type EarlySandboxCreateGate = () => Promise<{
689
- reason: string;
690
+ reason: string | null;
690
691
  [detail: string]: unknown;
691
692
  } | null>;
692
693
 
@@ -735,7 +736,7 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
735
736
  });
736
737
  return null;
737
738
  });
738
- if (skip) {
739
+ if (skip?.reason) {
739
740
  // Resolves null like a failed create: the registry releases the
740
741
  // entry's units and the launch creates its own sandbox.
741
742
  logEarlySandbox(adapter.logScope, 'create_skipped', {
@@ -746,6 +747,14 @@ export function startEarlySandbox<TSandbox extends EarlySandboxHandle>(
746
747
  });
747
748
  return null;
748
749
  }
750
+ if (skip) {
751
+ const { reason: _open, ...details } = skip;
752
+ logEarlySandbox(adapter.logScope, 'create_gate_open', {
753
+ key,
754
+ orgId,
755
+ ...details,
756
+ });
757
+ }
749
758
  }
750
759
  return await adapter.createEarly({
751
760
  ...input,