deepline 0.3.534 → 0.3.536

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +254 -147
  2. package/dist/bundling-sources/sdk/src/index.ts +4 -0
  3. package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +27 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +16 -5
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/types.ts +2 -23
  7. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +26 -14
  8. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-input-contract.ts +33 -8
  9. package/dist/bundling-sources/shared_libs/monitors/fleets/count-drift-alert.ts +121 -0
  10. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
  11. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +14 -82
  12. package/dist/bundling-sources/shared_libs/monitors/package.json +1 -0
  13. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
  14. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -26
  15. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +36 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +21 -31
  17. package/dist/bundling-sources/shared_libs/play-runtime/call-requeue-state-machine.ts +420 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +727 -102
  19. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +26 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/durable-retry-policy.ts +624 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
  22. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
  23. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +60 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +372 -10
  28. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
  29. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +21 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +6 -2
  37. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +17 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
  39. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +63 -3
  41. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
  49. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +90 -49
  50. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +136 -30
  51. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
  52. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
  53. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +63 -13
  54. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
  55. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
  56. package/dist/cli/auth-6XQKFOLG.js +43 -0
  57. package/dist/cli/{auth-MHQYIMVX.mjs → auth-KCTCUO7P.mjs} +7 -7
  58. package/dist/cli/{billing-YQLNP4S5.js → billing-4VBGZ3CT.js} +273 -112
  59. package/dist/cli/{billing-LX2PSBJ4.mjs → billing-OOJHKLNS.mjs} +185 -24
  60. package/dist/cli/{chunk-DGKTHWWH.js → chunk-2B4IOGFD.js} +406 -382
  61. package/dist/cli/{chunk-MQORQ7WL.js → chunk-2FCSUOYN.js} +55 -55
  62. package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
  63. package/dist/cli/{chunk-6IFZPEJE.mjs → chunk-2YWJS76L.mjs} +1 -1
  64. package/dist/cli/{chunk-E7TP25I2.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
  65. package/dist/cli/{chunk-LGRZCHKC.js → chunk-4E5JXZ3W.js} +18 -20
  66. package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
  67. package/dist/cli/{chunk-SUWTLXCV.js → chunk-6BBGUQJJ.js} +67 -146
  68. package/dist/cli/{chunk-JBBJDFUJ.js → chunk-6VUGBQZQ.js} +5 -5
  69. package/dist/cli/{chunk-2P3NVX65.mjs → chunk-AB2GBOD4.mjs} +40 -27
  70. package/dist/cli/{chunk-62SOZ67Y.mjs → chunk-ANUKBZ6W.mjs} +475 -11
  71. package/dist/cli/{chunk-MG6YL4M7.mjs → chunk-BASLYGXK.mjs} +101 -77
  72. package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
  73. package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
  74. package/dist/cli/{chunk-RH3YRMUY.js → chunk-CIDN5K23.js} +1 -1
  75. package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
  76. package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
  77. package/dist/cli/{chunk-UWNVFAFN.js → chunk-CWSLUNA6.js} +33 -33
  78. package/dist/cli/{chunk-5FXMEEF4.mjs → chunk-CXTW7SRW.mjs} +67 -146
  79. package/dist/cli/{chunk-O53LHONF.mjs → chunk-DA2I2M7D.mjs} +2 -2
  80. package/dist/cli/{chunk-EYXUAJAU.mjs → chunk-DQHUJMCL.mjs} +5 -5
  81. package/dist/cli/{chunk-7GFR5Y4J.mjs → chunk-DUYAMLOC.mjs} +1 -1
  82. package/dist/cli/{chunk-OMVVHX4U.mjs → chunk-E24UGPGG.mjs} +13 -15
  83. package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
  84. package/dist/cli/{chunk-KJVY7V2X.mjs → chunk-GF32SBST.mjs} +1 -1
  85. package/dist/cli/{chunk-AK622KIG.mjs → chunk-GHLDCLSC.mjs} +1 -1
  86. package/dist/cli/{chunk-A6HNT4EE.js → chunk-GTVZKY3F.js} +2 -2
  87. package/dist/cli/{chunk-BXIUZM5N.mjs → chunk-HAJQGP5V.mjs} +2 -2
  88. package/dist/cli/{chunk-6CEUQYMB.js → chunk-HWDKRN7L.js} +3 -3
  89. package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
  90. package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
  91. package/dist/cli/{chunk-WR4WETRU.mjs → chunk-JUHDJNSI.mjs} +4 -4
  92. package/dist/cli/{chunk-TQH3533L.mjs → chunk-KPQHUVYW.mjs} +5 -5
  93. package/dist/cli/{chunk-V7SCRUFQ.js → chunk-KWYGWO4Y.js} +9 -6
  94. package/dist/cli/{chunk-DZS4JC7I.js → chunk-LDGZFDUB.js} +2 -2
  95. package/dist/cli/{chunk-EGTUOYYG.js → chunk-LN6RXDTB.js} +523 -59
  96. package/dist/cli/{chunk-DQ5ADV2J.mjs → chunk-LZXZQPA2.mjs} +4 -1
  97. package/dist/cli/{chunk-MYSKWJMA.js → chunk-MSP4DTSD.js} +13 -13
  98. package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
  99. package/dist/cli/{chunk-NNAE7E23.mjs → chunk-OUDTOMZC.mjs} +7 -9
  100. package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
  101. package/dist/cli/{chunk-ENCA6O2D.mjs → chunk-PNY3BWHP.mjs} +2 -2
  102. package/dist/cli/{chunk-KSA2XE4T.js → chunk-Q4MNUOS4.js} +316 -303
  103. package/dist/cli/{chunk-GTXSUPCJ.js → chunk-Q5CXV3E3.js} +2 -2
  104. package/dist/cli/{chunk-VAG5YKP6.mjs → chunk-RVSSQPQO.mjs} +1 -1
  105. package/dist/cli/{chunk-VE7ZPLN2.js → chunk-SLPJ3LXI.js} +22 -22
  106. package/dist/cli/{chunk-IX45S5VC.js → chunk-TX5TUHJN.js} +17 -19
  107. package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
  108. package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
  109. package/dist/cli/{chunk-NDFNBJGL.js → chunk-VBDZIMWD.js} +26 -26
  110. package/dist/cli/{chunk-GVGQ6NZW.js → chunk-W7AEIGZR.js} +41 -41
  111. package/dist/cli/{chunk-WDNRPZED.mjs → chunk-WC5M3JXE.mjs} +2 -2
  112. package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
  113. package/dist/cli/{chunk-MQX363YF.js → chunk-XBAH3TKU.js} +5 -5
  114. package/dist/cli/{chunk-BDWZBMGV.mjs → chunk-XJD2GYUP.mjs} +5 -5
  115. package/dist/cli/{chunk-XRZJKHUA.mjs → chunk-XVZRJJDS.mjs} +4 -4
  116. package/dist/cli/{chunk-TVINIDHB.js → chunk-Y2NTPYGS.js} +17 -17
  117. package/dist/cli/{chunk-6GTGWZJG.mjs → chunk-YBMHOH6H.mjs} +4 -4
  118. package/dist/cli/{chunk-TG2UB3A5.mjs → chunk-YRLAUGQY.mjs} +3 -3
  119. package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
  120. package/dist/cli/{chunk-KXQCUX3X.mjs → chunk-Z7UIOGW4.mjs} +3 -3
  121. package/dist/cli/{chunk-HCD36BP6.js → chunk-ZEV2Y56V.js} +44 -44
  122. package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
  123. package/dist/cli/{chunk-XBK6WCVA.js → chunk-ZILSRDIN.js} +8 -8
  124. package/dist/cli/{chunk-B2AS3R5W.js → chunk-ZISEH7OL.js} +16 -16
  125. package/dist/cli/{chunk-HPJAE6PP.js → chunk-ZZ4MF2GI.js} +6 -6
  126. package/dist/cli/command-docs.js +2 -2
  127. package/dist/cli/command-docs.mjs +1 -1
  128. package/dist/cli/{csv-U3M2G76R.js → csv-2V2DIFNG.js} +15 -15
  129. package/dist/cli/{csv-4ID4E5W3.mjs → csv-P3HLK4GO.mjs} +6 -6
  130. package/dist/cli/{db-IHAQIKEQ.js → db-MREAQVW6.js} +36 -36
  131. package/dist/cli/{db-LHX5BBCZ.mjs → db-ZYOY3QRQ.mjs} +9 -9
  132. package/dist/cli/describe-IKZFOADR.mjs +49 -0
  133. package/dist/cli/describe-WW3OQRLP.js +49 -0
  134. package/dist/cli/describe-core.d.mts +3 -3
  135. package/dist/cli/describe-core.d.ts +3 -3
  136. package/dist/cli/describe-core.js +5 -5
  137. package/dist/cli/describe-core.mjs +4 -4
  138. package/dist/cli/{executions-CJ5LV23G.js → executions-H5IJ7QSQ.js} +11 -11
  139. package/dist/cli/{executions-UJ6JZUL5.mjs → executions-KTSY5M34.mjs} +9 -9
  140. package/dist/cli/{feedback-TGUBVGRP.js → feedback-724QK3Z5.js} +16 -16
  141. package/dist/cli/{feedback-YGTPJBRJ.mjs → feedback-WWJRIXEU.mjs} +8 -8
  142. package/dist/cli/git-PHYRD56H.js +25 -0
  143. package/dist/cli/{git-3DOTQHJO.mjs → git-R5VRG7X6.mjs} +7 -7
  144. package/dist/cli/index.js +151 -157
  145. package/dist/cli/index.mjs +51 -57
  146. package/dist/cli/{legacy-noops-BHEHVFHI.js → legacy-noops-C6GDEGPU.js} +11 -11
  147. package/dist/cli/{legacy-noops-RBBYRVLG.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
  148. package/dist/cli/{monitors-XECKLAXA.js → monitors-VAVQ4WCE.js} +125 -122
  149. package/dist/cli/{monitors-5AJCG6IV.mjs → monitors-WQSKMHAP.mjs} +19 -16
  150. package/dist/cli/{org-DOBAIYWG.js → org-CWWRWXZQ.js} +89 -89
  151. package/dist/cli/{org-ZAAIEZKB.mjs → org-MAL4QPVF.mjs} +9 -9
  152. package/dist/cli/{play-KLYRMQPF.mjs → play-ILW6MSNG.mjs} +174 -80
  153. package/dist/cli/{play-E74VN6B7.js → play-WJOWK5PQ.js} +690 -596
  154. package/dist/cli/{providers-XTQXV5LB.mjs → providers-4V2NMLZZ.mjs} +9 -9
  155. package/dist/cli/{providers-APZ6SOSK.js → providers-W662ANCH.js} +12 -12
  156. package/dist/cli/{quickstart-S6WN6NWW.js → quickstart-BW6EBUYX.js} +8 -8
  157. package/dist/cli/{quickstart-X7RHHQCH.mjs → quickstart-C22BR743.mjs} +6 -6
  158. package/dist/cli/{run-3YLIJJ57.js → run-KW7KW4FX.js} +50 -53
  159. package/dist/cli/{run-TZPBBSPX.mjs → run-SPAU5IMW.mjs} +31 -34
  160. package/dist/cli/search-HLE54W5G.js +32 -0
  161. package/dist/cli/{search-VLHE2CMZ.mjs → search-XPC75HLM.mjs} +10 -11
  162. package/dist/cli/{search-output-73BYB7UE.mjs → search-output-JKYJSEPM.mjs} +6 -6
  163. package/dist/cli/{search-output-GCT7PQIT.js → search-output-VJYE7USJ.js} +8 -8
  164. package/dist/cli/{secrets-RLOTGKQZ.mjs → secrets-OJG73GXQ.mjs} +9 -9
  165. package/dist/cli/{secrets-J6CEKXKQ.js → secrets-YB57KGSB.js} +18 -18
  166. package/dist/cli/{sessions-7HZ7OZ62.mjs → sessions-7ZL37BW4.mjs} +8 -8
  167. package/dist/cli/sessions-VEBYZIEU.js +22 -0
  168. package/dist/cli/{settings-WRV5XEZC.js → settings-A7DD2ZYE.js} +88 -89
  169. package/dist/cli/{settings-72K5YCIS.mjs → settings-RKSQB7FA.mjs} +15 -16
  170. package/dist/cli/{setup-KQFY6WT4.mjs → setup-NXDUTITY.mjs} +11 -12
  171. package/dist/cli/{setup-QVXWT2EQ.js → setup-S3K5YU62.js} +51 -52
  172. package/dist/cli/skills-NVQ744CN.js +36 -0
  173. package/dist/cli/{skills-C3K3E473.mjs → skills-VMFAIDO6.mjs} +9 -10
  174. package/dist/cli/{tools-4A2OH6MB.mjs → tools-52NTHBSJ.mjs} +20 -21
  175. package/dist/cli/tools-SBDUL3WB.js +56 -0
  176. package/dist/cli/update-HHVFZPCV.js +34 -0
  177. package/dist/cli/{update-BS6USKPR.mjs → update-SAKBEKMV.mjs} +11 -12
  178. package/dist/cli/{views-WB6GFTRX.mjs → views-ACRV7MD6.mjs} +54 -10
  179. package/dist/cli/{views-4NZGAXHL.js → views-C3GJOBDG.js} +66 -22
  180. package/dist/cli/{workflow-2D4WX55R.mjs → workflow-CS22E7TC.mjs} +10 -10
  181. package/dist/cli/{workflow-L2QTQZYV.js → workflow-ZNWCZEGN.js} +20 -20
  182. package/dist/{client-DoUVSkqC.d.mts → client-BlLYQDNo.d.mts} +1 -1
  183. package/dist/{client-DQm56zMs.d.ts → client-DSQlkIDO.d.ts} +1 -1
  184. package/dist/{client-core-C7KkUIE_.d.ts → client-core-CDwapXy5.d.ts} +167 -108
  185. package/dist/{client-core-CPlwsC1Q.d.mts → client-core-rX7n2H8U.d.mts} +167 -108
  186. package/dist/{compiler-manifest-DsxsQP-T.d.mts → compiler-manifest-BHNC4RL-.d.mts} +58 -21
  187. package/dist/{compiler-manifest-DsxsQP-T.d.ts → compiler-manifest-BHNC4RL-.d.ts} +58 -21
  188. package/dist/{errors-qdJUVQ3g.d.mts → errors-D7sPXrvB.d.mts} +1 -1
  189. package/dist/{errors-Bk5h1D-C.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
  190. package/dist/{index-bL66eHYz.d.ts → index-CQTBHXHr.d.ts} +1 -1
  191. package/dist/{index-PaupwX1B.d.mts → index-NaDZq2xf.d.mts} +1 -1
  192. package/dist/index.d.mts +7 -7
  193. package/dist/index.d.ts +7 -7
  194. package/dist/index.js +15 -15
  195. package/dist/index.mjs +11 -11
  196. package/dist/install-integrity.json +131 -132
  197. package/dist/monitor-fleet-contract.d.mts +17 -11
  198. package/dist/monitor-fleet-contract.d.ts +17 -11
  199. package/dist/monitor-fleet-contract.js +3 -3
  200. package/dist/monitor-fleet-contract.mjs +2 -2
  201. package/dist/monitor-input-contract.js +2 -2
  202. package/dist/monitor-input-contract.mjs +1 -1
  203. package/dist/plays/bundle-play-file.d.mts +3 -3
  204. package/dist/plays/bundle-play-file.d.ts +3 -3
  205. package/dist/plays/bundle-play-file.mjs +67 -3
  206. package/dist/plays/csv-data-input.js +3 -3
  207. package/dist/plays/csv-data-input.mjs +2 -2
  208. package/dist/plays/play-description.d.mts +2 -2
  209. package/dist/plays/play-description.d.ts +2 -2
  210. package/dist/plays/run-request.d.mts +2 -2
  211. package/dist/plays/run-request.d.ts +2 -2
  212. package/dist/plays/run-request.js +3 -3
  213. package/dist/plays/run-request.mjs +2 -2
  214. package/dist/release.d.mts +1 -1
  215. package/dist/release.d.ts +1 -1
  216. package/dist/release.js +2 -2
  217. package/dist/release.mjs +1 -1
  218. package/dist/server.d.mts +4 -4
  219. package/dist/server.d.ts +4 -4
  220. package/dist/server.js +12 -12
  221. package/dist/server.mjs +6 -6
  222. package/package.json +1 -1
  223. package/dist/cli/auth-UP2RGPI6.js +0 -43
  224. package/dist/cli/chunk-5LZ5VSOK.mjs +0 -405
  225. package/dist/cli/chunk-D3J2Y2BP.js +0 -405
  226. package/dist/cli/describe-CI4MREFF.mjs +0 -50
  227. package/dist/cli/describe-IVTSD7ST.js +0 -50
  228. package/dist/cli/git-R3W25XIF.js +0 -25
  229. package/dist/cli/pages-FUOSF6BE.mjs +0 -266
  230. package/dist/cli/pages-TLC2N6L7.js +0 -266
  231. package/dist/cli/search-NB5CBALV.js +0 -33
  232. package/dist/cli/sessions-SFCZSB77.js +0 -22
  233. package/dist/cli/skills-WIJEHVLA.js +0 -37
  234. package/dist/cli/tools-VMMERMLO.js +0 -57
  235. package/dist/cli/update-54WZQDTS.js +0 -35
@@ -151,10 +151,10 @@ export const PLAY_AUTHORING_CONTRACT_CHANGELOG =
151
151
  */
152
152
  export const PLAY_AUTHORING_RUNTIME_CAPABILITIES = [
153
153
  {
154
- capability: 'Hosted pages',
155
- surface: '`deepline.pages.write`',
154
+ capability: 'Views',
155
+ surface: '`deepline.views.list`',
156
156
  contract:
157
- 'A write replaces the whole page and must set `public`. The first write sets who can see the page. A later write can make a public page private but never a private page public; that takes `deepline pages set-public <name>`, and `deepline plays check` warns when code asks for it. A completed write is safe to repeat.',
157
+ "Lists this Play's views in its workspace, most recently changed first. Each has `url`, which opens the view at its latest run, and `runUrl`, which opens it at the run that asked; send `runUrl` from the run so the link shows its result. `access` says who can open them. The read is fresh on every call and is not a durable receipt.",
158
158
  },
159
159
  {
160
160
  capability: 'Durable external I/O',
@@ -216,6 +216,7 @@ export const PLAY_AUTHORING_CONTRACT_ISSUE_CODES = [
216
216
  'play_authoring_slack_action_wait_result_ignored',
217
217
  'play_authoring_slack_action_wait_unbounded_loop',
218
218
  'play_authoring_tool_deprecated',
219
+ 'play_authoring_prebuilt_deprecated',
219
220
  'play_authoring_tool_response_raw_deprecated',
220
221
  'play_authoring_replay_unsafe_nondeterminism',
221
222
  'play_authoring_row_sleep_unsupported',
@@ -908,6 +909,32 @@ export type PlayAuthoringBindings<TInput = Record<string, unknown>> = {
908
909
  secrets?: readonly string[];
909
910
  };
910
911
 
912
+ /**
913
+ * The failure classes a durable tool call retries (the Durable retry policy's
914
+ * classes). A class listed in `retry.nonRetryable` reaches the Play after the
915
+ * call's first attempt instead of being retried.
916
+ */
917
+ export const PLAY_TOOL_CALL_RETRY_ERROR_CLASSES = [
918
+ 'never_sent',
919
+ 'provider_unavailable',
920
+ 'provider_ambiguous_500',
921
+ 'timeout_after_send',
922
+ 'rate_limit_429',
923
+ 'billing_insufficient_credits',
924
+ 'billing_monthly_cap',
925
+ ] as const;
926
+ export type PlayToolCallRetryErrorClass =
927
+ (typeof PLAY_TOOL_CALL_RETRY_ERROR_CLASSES)[number];
928
+
929
+ /**
930
+ * One durable tool call's retry policy, like a durable-execution activity
931
+ * retry policy. Omitted fields take the live Durable retry policy for the
932
+ * failure's class. Between attempts the run waits on a durable timer.
933
+ */
934
+ export type PlayToolCallRetryPolicy = Static<
935
+ (typeof PLAY_AUTHORING_FIELD_REGISTRY)['ctx.tools.execute.retry']['schema']
936
+ >;
937
+
911
938
  /** The one public type for durable managed-tool calls. */
912
939
  export type PlayToolExecutionRequest = {
913
940
  id: string;
@@ -918,6 +945,14 @@ export type PlayToolExecutionRequest = {
918
945
  staleAfterSeconds?: DurableCallStaleAfterSeconds;
919
946
  timeoutMs?: PlayRuntimeTimeoutMs;
920
947
  receiptWaitMs?: PlayReceiptWaitMs;
948
+ /**
949
+ * The call's retry policy. The Play sees the call's error only after these
950
+ * retries are spent, or at once for a `nonRetryable` class. Set a small
951
+ * `maximumAttempts` (for example 3) on a call whose failure the Play
952
+ * handles itself, such as a waterfall leg that falls back to the next
953
+ * provider, so it never waits on a durable retry.
954
+ */
955
+ retry?: PlayToolCallRetryPolicy;
921
956
  };
922
957
  export type PlayToolCallOptions = Omit<
923
958
  PlayToolExecutionRequest,
@@ -1502,7 +1537,7 @@ export const PLAY_AUTHORING_DOCUMENTATION = {
1502
1537
  },
1503
1538
  runId: {
1504
1539
  semantics:
1505
- 'deepline.run.rootId is the submitted run: it is stable while Deepline retries or resumes that run, and a separately submitted run receives a new one. deepline.run.id names the Play invocation; it equals rootId in a submitted run, but inside an inline deepline.runPlay child it is the child\'s composition id, which repeats in every parent run that makes the same call with the same input.',
1540
+ "deepline.run.rootId is the submitted run: it is stable while Deepline retries or resumes that run, and a separately submitted run receives a new one. deepline.run.id names the Play invocation; it equals rootId in a submitted run, but inside an inline deepline.runPlay child it is the child's composition id, which repeats in every parent run that makes the same call with the same input.",
1506
1541
  use: 'Build external idempotency keys from deepline.run.rootId plus whatever names the operation, such as a batch index or record id. It is correct in a submitted run and inside an inline child.',
1507
1542
  },
1508
1543
  staticCallKeys: {
@@ -1523,27 +1558,30 @@ export const PLAY_AUTHORING_DOCUMENTATION = {
1523
1558
  export const PLAY_AUTHORING_STATIC_FETCH_KEY_HINT =
1524
1559
  `${PLAY_AUTHORING_DOCUMENTATION.staticCallKeys.workaround} Do not compute the key.` as const;
1525
1560
 
1526
- /** The complete customer-authored `ctx` Interface shared by every Adapter. */
1527
- export type PlayAuthoringPageWriteOptions = {
1528
- /**
1529
- * Who can see the page. Taken from the first write. A later write cannot make
1530
- * a private page public: run `deepline pages set-public <name>` for that.
1531
- */
1532
- public: boolean;
1533
- /** Replaces the page's whole content. A non-string is stored as JSON. */
1534
- content: unknown;
1535
- /** Defaults to text, JSON, or binary according to `content`. */
1536
- contentType?: string;
1537
- description?: string;
1538
- };
1561
+ /**
1562
+ * Hosted pages (`deepline.pages.write`) were removed before launch. `plays
1563
+ * check` refuses code that calls it, and Plays bundled earlier fail with this
1564
+ * message when they reach the call.
1565
+ */
1566
+ export function hostedPagesRemovedMessage(name?: unknown): string {
1567
+ const call =
1568
+ typeof name === 'string' && name
1569
+ ? `deepline.pages.write("${name}")`
1570
+ : 'deepline.pages.write';
1571
+ return `${call} is no longer supported: hosted pages were removed. Remove the call from this Play.`;
1572
+ }
1539
1573
 
1540
- export type PlayAuthoringPageWriteResult = {
1574
+ /** The complete customer-authored `ctx` Interface shared by every Adapter. */
1575
+ /** A view of the running Play, as `deepline.views.list()` returns it. */
1576
+ export type PlayAuthoringViewLink = {
1577
+ id: string;
1541
1578
  name: string;
1579
+ /** Opens the view at its latest run. */
1542
1580
  url: string;
1543
- /** Who can actually see the page after this write. */
1544
- public: boolean;
1545
- created: boolean;
1546
- warnings: string[];
1581
+ /** Opens the view at this run, for a link sent from the run itself. */
1582
+ runUrl: string;
1583
+ /** Who can open the links: workspace members, or anyone. */
1584
+ access: 'workspace' | 'public';
1547
1585
  };
1548
1586
 
1549
1587
  export interface PlayAuthoringRuntimeContext<
@@ -1558,15 +1596,14 @@ export interface PlayAuthoringRuntimeContext<
1558
1596
  entitlements(): Promise<BillingEntitlements>;
1559
1597
  };
1560
1598
 
1561
- pages: {
1599
+ views: {
1562
1600
  /**
1563
- * Replace a named page in this workspace and return its URL.
1564
- * @sdkReference runtime 181 deepline.pages.write(name, options)
1601
+ * List this Play's views in its workspace, most recently changed first, each with a link
1602
+ * to the view and a link to it at this run. Fresh on every call; not a
1603
+ * durable receipt.
1604
+ * @sdkReference runtime 182 deepline.views.list()
1565
1605
  */
1566
- write(
1567
- name: string,
1568
- options: PlayAuthoringPageWriteOptions,
1569
- ): Promise<PlayAuthoringPageWriteResult>;
1606
+ list(): Promise<PlayAuthoringViewLink[]>;
1570
1607
  };
1571
1608
 
1572
1609
  /**
@@ -2359,6 +2396,50 @@ export const PLAY_AUTHORING_FIELD_REGISTRY = {
2359
2396
  errorMessage:
2360
2397
  'staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds.',
2361
2398
  },
2399
+ 'ctx.tools.execute.retry': {
2400
+ schema: Type.Object(
2401
+ {
2402
+ maximumAttempts: Type.Optional(
2403
+ Type.Integer({ minimum: 1, maximum: 65 }),
2404
+ ),
2405
+ initialIntervalMs: Type.Optional(
2406
+ Type.Integer({ minimum: 1_000, maximum: 86_400_000 }),
2407
+ ),
2408
+ backoffCoefficient: Type.Optional(
2409
+ Type.Number({ minimum: 1, maximum: 10 }),
2410
+ ),
2411
+ maximumIntervalMs: Type.Optional(
2412
+ Type.Integer({ minimum: 1_000, maximum: 86_400_000 }),
2413
+ ),
2414
+ nonRetryable: Type.Optional(
2415
+ Type.Array(
2416
+ Type.Union(
2417
+ PLAY_TOOL_CALL_RETRY_ERROR_CLASSES.map((errorClass) =>
2418
+ Type.Literal(errorClass),
2419
+ ),
2420
+ ),
2421
+ { uniqueItems: true },
2422
+ ),
2423
+ ),
2424
+ },
2425
+ { additionalProperties: false },
2426
+ ),
2427
+ fixtures: {
2428
+ valid: { maximumAttempts: 1 },
2429
+ invalid: { maximumAttempts: 0 },
2430
+ absent: undefined,
2431
+ unresolved: { expression: 'retryPolicy' },
2432
+ edition1: { maximumAttempts: 1 },
2433
+ },
2434
+ referenceType: 'PlayToolCallRetryPolicy',
2435
+ required: false,
2436
+ resolution: 'runtime-allowed',
2437
+ issueCode: 'play_authoring_durable_policy_invalid',
2438
+ description:
2439
+ "Optional retry policy for this call, like a durable-execution activity retry policy. Omitted fields take the live Durable retry policy for the failure's class. maximumAttempts counts every request the provider receives for the call, the first included, in-call resends and durable retries alike (1 to 65); initialIntervalMs, backoffCoefficient and maximumIntervalMs set the durable wait before each retry (1 s to 24 h; the coefficient 1 to 10); nonRetryable lists failure classes that reach the Play after the first attempt. The Play sees the error only after the retries are spent. Where the Play handles the failure itself, such as a waterfall leg that falls back, set a small maximumAttempts (for example 3) so the call never waits on a durable retry.",
2440
+ errorMessage:
2441
+ 'retry must be an object with maximumAttempts (1-65), initialIntervalMs and maximumIntervalMs (1000-86400000 ms), backoffCoefficient (1-10) and nonRetryable (failure classes), and nothing else.',
2442
+ },
2362
2443
  'ctx.tools.execute.id': {
2363
2444
  schema: Type.String({ pattern: '\\S' }),
2364
2445
  fixtures: {
@@ -3389,6 +3470,28 @@ export function validateOptionalPlayAuthoringField(
3389
3470
  validatePlayAuthoringField(path, value);
3390
3471
  }
3391
3472
 
3473
+ /**
3474
+ * Validate a per-call `retry` policy: its shape, then that the longest wait
3475
+ * is not shorter than the first.
3476
+ */
3477
+ export function validatePlayToolCallRetryPolicy(
3478
+ value: unknown,
3479
+ ): asserts value is PlayToolCallRetryPolicy {
3480
+ validatePlayAuthoringField('ctx.tools.execute.retry', value);
3481
+ const policy = value as PlayToolCallRetryPolicy;
3482
+ if (
3483
+ policy.initialIntervalMs !== undefined &&
3484
+ policy.maximumIntervalMs !== undefined &&
3485
+ policy.maximumIntervalMs < policy.initialIntervalMs
3486
+ ) {
3487
+ throw new PlayAuthoringFieldValidationError(
3488
+ 'ctx.tools.execute.retry',
3489
+ PLAY_AUTHORING_FIELD_REGISTRY['ctx.tools.execute.retry'].issueCode,
3490
+ 'retry.maximumIntervalMs must be at least retry.initialIntervalMs.',
3491
+ );
3492
+ }
3493
+ }
3494
+
3392
3495
  /** Normalize the deprecated SqlQuery compatibility shape at the contract seam. */
3393
3496
  export function normalizePlayAuthoringCustomerDbStatement(
3394
3497
  statement: PlaySqlQuery | string,
@@ -3437,6 +3540,8 @@ export const PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3437
3540
  `export type DurableCallStaleAfterSeconds = ${cloudReferenceType('ctx.tools.execute.staleAfterSeconds')};`,
3438
3541
  `export type PlayRuntimeTimeoutMs = ${cloudReferenceType('ctx.tools.execute.timeoutMs')};`,
3439
3542
  `export type PlayReceiptWaitMs = ${cloudReferenceType('ctx.tools.execute.receiptWaitMs')};`,
3543
+ `export type PlayToolCallRetryErrorClass = ${PLAY_TOOL_CALL_RETRY_ERROR_CLASSES.map((errorClass) => `'${errorClass}'`).join(' | ')};`,
3544
+ 'export type PlayToolCallRetryPolicy = { readonly maximumAttempts?: number; readonly initialIntervalMs?: number; readonly backoffCoefficient?: number; readonly maximumIntervalMs?: number; readonly nonRetryable?: readonly PlayToolCallRetryErrorClass[] };',
3440
3545
  `export type SqlListenerOperation = ${cloudReferenceType('bindings.sqlListeners[].operations[]')};`,
3441
3546
  'export type SqlListenerFilterScalar = string | number | boolean | null;',
3442
3547
  `export type SqlListenerFilterOperator = { eq?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.eq')}; neq?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.neq')}; in?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.in')}; notIn?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.notIn')}; isNull?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.isNull')}; isNotNull?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.isNotNull')}; ilike?: ${cloudReferenceType('bindings.sqlListeners[].where.*.*.ilike')} };`,
@@ -3453,6 +3558,7 @@ export const PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3453
3558
  ' readonly staleAfterSeconds?: DurableCallStaleAfterSeconds;',
3454
3559
  ' readonly timeoutMs?: PlayRuntimeTimeoutMs;',
3455
3560
  ' readonly receiptWaitMs?: PlayReceiptWaitMs;',
3561
+ ` readonly retry?: ${cloudReferenceType('ctx.tools.execute.retry')};`,
3456
3562
  '};',
3457
3563
  'export type PlayCronInput<TInput> = TInput extends readonly unknown[] ? never : TInput extends object ? TInput : never;',
3458
3564
  'export type PlayBindings<TInput = Record<string, unknown>> = {',
@@ -3525,7 +3631,7 @@ export const PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
3525
3631
  "export type BillingEntitlements = { org_id: string; as_of: number; plan: { sku: string; name: string; catalog_revision: string | null; included_credits: number; interval: 'month' | 'year' | null } | null; benefits: { quickenrichUnlimited?: { status: 'active' | 'past_due'; value: BillingBenefitValues['quickenrichUnlimited']; expiresAt?: number }; peopleSearch?: { status: 'active'; value: BillingBenefitValues['peopleSearch']; expiresAt?: number; usage: { month: string; periodStartsAt?: number; resetsAt?: number; resetsOn?: 'calendar_month' | 'billing_cycle'; limit: number; consumed: number; remaining: number } }; includedStorage?: { status: 'active'; usage: { limit: number; consumed: number; remaining: number; measuredDay: string; overageCharged: boolean } } }; effective_limits: { quickenrichUnlimited?: { baseline: number; effective: number; source: 'plan' | 'override'; override_expires_at?: number } } };",
3526
3632
  'export interface DeeplinePlayRuntimeContext {',
3527
3633
  ' billing: { entitlements(): Promise<BillingEntitlements> };',
3528
- ' pages: { write(name: string, options: { public: boolean; content: unknown; contentType?: string; description?: string }): Promise<{ name: string; url: string; public: boolean; created: boolean; warnings: string[] }> };',
3634
+ " views: { list(): Promise<Array<{ id: string; name: string; url: string; runUrl: string; access: 'workspace' | 'public' }>> };",
3529
3635
  ' csv<T = Record<string, unknown>>(path: string | CsvInput<T & object>, options?: CsvOptions): Promise<PlayDataset<T>>;',
3530
3636
  ' dataset<TSource extends PlayDatasetInput<object>>(key: string, items: TSource): DatasetBuilder<PlayDatasetRow<TSource> & object, PlayDatasetRow<TSource> & object>;',
3531
3637
  ' map<TSource extends PlayDatasetInput<object>>(key: string, items: TSource, options?: DatasetDefinitionOptions<PlayDatasetRow<TSource> & object>): never;',
@@ -97,9 +97,21 @@ function csvRowDataKeys(
97
97
  ? Object.keys(rowSchema.properties)
98
98
  : [];
99
99
  const candidates = rowFields.length > 0 ? rowFields : Object.keys(properties);
100
+ // A Play's other `CsvInput` fields are files of their own, not row data.
101
+ const csvFiles = new Set(
102
+ Array.isArray(schema.csvInputFields)
103
+ ? schema.csvInputFields.filter(
104
+ (field): field is string => typeof field === 'string',
105
+ )
106
+ : [],
107
+ );
100
108
  return new Set(
101
109
  candidates.filter(
102
- (key) => key in properties && key !== csvKey && !controls.has(key),
110
+ (key) =>
111
+ key in properties &&
112
+ key !== csvKey &&
113
+ !controls.has(key) &&
114
+ !csvFiles.has(key),
103
115
  ),
104
116
  );
105
117
  }
@@ -129,6 +129,65 @@ function isRuntimeInputExpression(node: ts.Expression): boolean {
129
129
  return referencesInputIdentifier(node);
130
130
  }
131
131
 
132
+ function containsStringLiteral(node: ts.Node): boolean {
133
+ return (
134
+ ts.isStringLiteralLike(node) ||
135
+ ts.isTemplateExpression(node) ||
136
+ node.getChildren().some(containsStringLiteral)
137
+ );
138
+ }
139
+
140
+ /**
141
+ * Variable names the file initializes from an expression holding a string
142
+ * literal (`'a.csv'`, `('a.csv')`, `'a.csv' as const`, `DIR + '/a.csv'`),
143
+ * anywhere, in any scope.
144
+ */
145
+ function collectStringLiteralBindings(
146
+ sourceFile: ts.SourceFile,
147
+ ): ReadonlySet<string> {
148
+ const names = new Set<string>();
149
+ const visit = (node: ts.Node): void => {
150
+ if (
151
+ ts.isVariableDeclaration(node) &&
152
+ ts.isIdentifier(node.name) &&
153
+ node.initializer &&
154
+ containsStringLiteral(node.initializer)
155
+ ) {
156
+ names.add(node.name.text);
157
+ }
158
+ ts.forEachChild(node, visit);
159
+ };
160
+ visit(sourceFile);
161
+ return names;
162
+ }
163
+
164
+ /**
165
+ * A plain variable (`csv`, `csv!`, `path as CsvInput<Row>`) holds a runtime
166
+ * value, such as a destructured `CsvInput` field or a helper's parameter,
167
+ * unless the file binds a string literal to that name. Then it is a local path
168
+ * this pass cannot follow, and stays an error.
169
+ */
170
+ function isRuntimeVariableExpression(
171
+ node: ts.Expression,
172
+ constants: ConstMap,
173
+ stringLiteralBindings: ReadonlySet<string>,
174
+ ): boolean {
175
+ let value = node;
176
+ while (
177
+ ts.isParenthesizedExpression(value) ||
178
+ ts.isNonNullExpression(value) ||
179
+ ts.isAsExpression(value) ||
180
+ ts.isSatisfiesExpression(value)
181
+ ) {
182
+ value = value.expression;
183
+ }
184
+ return (
185
+ ts.isIdentifier(value) &&
186
+ !constants.has(value.text) &&
187
+ !stringLiteralBindings.has(value.text)
188
+ );
189
+ }
190
+
132
191
  function resolveStringExpression(
133
192
  node: ts.Expression,
134
193
  constants: ConstMap,
@@ -290,6 +349,7 @@ export async function discoverPackagedLocalFiles(
290
349
  ts.ScriptKind.TS,
291
350
  );
292
351
  const constants = collectTopLevelStringConstants(sourceFile);
352
+ const stringLiteralBindings = collectStringLiteralBindings(sourceFile);
293
353
  const runtimeNames = playRuntimeNames(sourceCode);
294
354
  const childVisits: Promise<void>[] = [];
295
355
 
@@ -302,7 +362,14 @@ export async function discoverPackagedLocalFiles(
302
362
  message:
303
363
  'ctx.csv() requires a file path string or input reference.',
304
364
  });
305
- } else if (!isRuntimeInputExpression(argument)) {
365
+ } else if (
366
+ !isRuntimeInputExpression(argument) &&
367
+ !isRuntimeVariableExpression(
368
+ argument,
369
+ constants,
370
+ stringLiteralBindings,
371
+ )
372
+ ) {
306
373
  const resolvedPath = resolveStringExpression(argument, constants);
307
374
  if (resolvedPath == null) {
308
375
  unresolved.push({
@@ -479,6 +479,7 @@ function projectPublicColumnProducer(
479
479
  producer: PlayStaticColumnProducer,
480
480
  depth: number,
481
481
  maxDepth: number,
482
+ includeBindingPaths: boolean,
482
483
  ): PlayStaticColumnProducer {
483
484
  return {
484
485
  id: producer.id,
@@ -493,11 +494,17 @@ function projectPublicColumnProducer(
493
494
  producer.substep,
494
495
  maxDepth === Infinity ? depth + 1 : MAX_PUBLIC_SUBSTEP_DEPTH,
495
496
  maxDepth,
497
+ includeBindingPaths,
496
498
  ),
497
499
  ...(maxDepth === Infinity && producer.steps
498
500
  ? {
499
501
  steps: producer.steps.map((step) =>
500
- projectPublicColumnProducer(step, depth + 1, maxDepth),
502
+ projectPublicColumnProducer(
503
+ step,
504
+ depth + 1,
505
+ maxDepth,
506
+ includeBindingPaths,
507
+ ),
501
508
  ),
502
509
  }
503
510
  : {}),
@@ -507,17 +514,21 @@ function projectPublicColumnProducer(
507
514
  function projectPublicPipeline(
508
515
  pipeline: PlayStaticPipeline,
509
516
  depth: number,
510
- maxDepth = MAX_PUBLIC_SUBSTEP_DEPTH,
517
+ maxDepth: number,
518
+ includeBindingPaths: boolean,
511
519
  ): PlayStaticPipeline {
512
- const safePipeline = buildAppGraphPipeline(pipeline)!;
520
+ const safePipeline = buildProjectedGraphPipeline(
521
+ pipeline,
522
+ includeBindingPaths,
523
+ );
513
524
  if (maxDepth === Infinity) return safePipeline;
514
525
  return {
515
526
  ...safePipeline,
516
527
  stages: (safePipeline.stages ?? []).map((substep) =>
517
- projectPublicSubstep(substep, depth, maxDepth),
528
+ projectPublicSubstep(substep, depth, maxDepth, includeBindingPaths),
518
529
  ),
519
530
  substeps: safePipeline.substeps.map((substep) =>
520
- projectPublicSubstep(substep, depth, maxDepth),
531
+ projectPublicSubstep(substep, depth, maxDepth, includeBindingPaths),
521
532
  ),
522
533
  };
523
534
  }
@@ -526,11 +537,12 @@ function projectPublicSubstep(
526
537
  substep: PlayStaticSubstep,
527
538
  depth: number,
528
539
  maxDepth = MAX_PUBLIC_SUBSTEP_DEPTH,
540
+ includeBindingPaths = false,
529
541
  ): PlayStaticSubstep {
530
542
  const base = publicSubstepBase(substep);
531
543
  const projectChildren = depth < maxDepth;
532
544
  const child = (value: PlayStaticSubstep) =>
533
- projectPublicSubstep(value, depth + 1, maxDepth);
545
+ projectPublicSubstep(value, depth + 1, maxDepth, includeBindingPaths);
534
546
 
535
547
  if (substep.type === 'csv' && maxDepth === Infinity) {
536
548
  return {
@@ -550,7 +562,12 @@ function projectPublicSubstep(
550
562
  source: column.source,
551
563
  ...(column.sqlName ? { sqlName: column.sqlName } : {}),
552
564
  producers: column.producers.map((producer) =>
553
- projectPublicColumnProducer(producer, depth, maxDepth),
565
+ projectPublicColumnProducer(
566
+ producer,
567
+ depth,
568
+ maxDepth,
569
+ includeBindingPaths,
570
+ ),
554
571
  ),
555
572
  })),
556
573
  steps: projectChildren ? (substep.steps ?? []).map(child) : [],
@@ -603,7 +620,12 @@ function projectPublicSubstep(
603
620
  field: substep.field,
604
621
  pipeline:
605
622
  projectChildren && substep.pipeline
606
- ? projectPublicPipeline(substep.pipeline, depth + 1, maxDepth)
623
+ ? projectPublicPipeline(
624
+ substep.pipeline,
625
+ depth + 1,
626
+ maxDepth,
627
+ includeBindingPaths,
628
+ )
607
629
  : null,
608
630
  } as PlayStaticSubstep;
609
631
  }
@@ -615,7 +637,12 @@ function projectPublicSubstep(
615
637
  field: substep.field,
616
638
  pipeline:
617
639
  projectChildren && substep.pipeline
618
- ? projectPublicPipeline(substep.pipeline, depth + 1, maxDepth)
640
+ ? projectPublicPipeline(
641
+ substep.pipeline,
642
+ depth + 1,
643
+ maxDepth,
644
+ includeBindingPaths,
645
+ )
619
646
  : null,
620
647
  } as PlayStaticSubstep;
621
648
  }
@@ -644,11 +671,34 @@ export function buildAppGraphPipeline(
644
671
  staticPipeline: unknown,
645
672
  ): PlayStaticPipeline | null {
646
673
  const pipeline = asPipeline(staticPipeline);
647
- if (!pipeline) return null;
674
+ return pipeline ? buildProjectedGraphPipeline(pipeline, true) : null;
675
+ }
676
+
677
+ function buildProjectedGraphPipeline(
678
+ pipeline: PlayStaticPipeline,
679
+ includeBindingPaths: boolean,
680
+ ): PlayStaticPipeline {
648
681
  const docflow = buildPublicDocflow(pipeline);
682
+ // The authenticated app needs the symbolic bindings to match recorded
683
+ // values to graph nodes. Keep the public share projection unchanged.
684
+ const appDocflow =
685
+ includeBindingPaths && docflow && pipeline.docflow
686
+ ? {
687
+ ...docflow,
688
+ bindings: pipeline.docflow.bindings.map(
689
+ ({ nodeId, line, kind, inputs, outputs }) => ({
690
+ nodeId,
691
+ line,
692
+ ...(kind ? { kind } : {}),
693
+ ...(inputs ? { inputs: [...inputs] } : {}),
694
+ ...(outputs ? { outputs: [...outputs] } : {}),
695
+ }),
696
+ ),
697
+ }
698
+ : docflow;
649
699
  const csvInput = inputFieldFromStaticCsvArg(pipeline.csvArg);
650
700
  return {
651
- ...(docflow ? { docflow } : {}),
701
+ ...(appDocflow ? { docflow: appDocflow } : {}),
652
702
  ...(pipeline.tableNamespace
653
703
  ? { tableNamespace: pipeline.tableNamespace }
654
704
  : {}),
@@ -665,10 +715,10 @@ export function buildAppGraphPipeline(
665
715
  ? { returnFields: pipeline.returnFields.map((field) => ({ ...field })) }
666
716
  : {}),
667
717
  stages: (pipeline.stages ?? []).map((substep) =>
668
- projectPublicSubstep(substep, 0, Infinity),
718
+ projectPublicSubstep(substep, 0, Infinity, includeBindingPaths),
669
719
  ),
670
720
  substeps: pipeline.substeps.map((substep) =>
671
- projectPublicSubstep(substep, 0, Infinity),
721
+ projectPublicSubstep(substep, 0, Infinity, includeBindingPaths),
672
722
  ),
673
723
  ...(pipeline.sheetContract
674
724
  ? { sheetContract: pipeline.sheetContract }
@@ -14,7 +14,10 @@ import {
14
14
  normalizeProductNotificationEmailList,
15
15
  productNotificationValuesEqual,
16
16
  } from './configuration';
17
- import { PRODUCT_NOTIFICATION_SHADOW_TYPES } from './catalog';
17
+ import {
18
+ PRODUCT_NOTIFICATION_SHADOW_TYPES,
19
+ PRODUCT_NOTIFICATION_TYPE_CATALOG,
20
+ } from './catalog';
18
21
  export {
19
22
  createProductNotificationRule,
20
23
  type ProductNotificationPlayFailureSettings as PlayFailureOptions,
@@ -327,6 +330,19 @@ export function buildProductNotificationGroupOperations(
327
330
  continue;
328
331
  // Older editors omit this rule. Its single-rule toggle sends an explicit setting.
329
332
  if (rule.ruleKey === INCLUDED_ALLOWANCE_RULE_KEY) continue;
333
+ // In a customized group, a default rule with no workspace row arrived
334
+ // after the group's last save, and a draft loaded before that omits it.
335
+ // That is not the workspace removing it: the editor turns a single-rule
336
+ // type off with `enabled: false`. Only a type that allows several rules
337
+ // is removed by omission.
338
+ if (
339
+ savedGroup?.configMode === 'replace_default' &&
340
+ rule.source === 'default' &&
341
+ !PRODUCT_NOTIFICATION_TYPE_CATALOG.some(
342
+ (type) => type.id === rule.notificationType && type.allowMultiple,
343
+ )
344
+ )
345
+ continue;
330
346
  if (
331
347
  rule.configMode === 'default' ||
332
348
  rule.configMode === 'replace_default'
@@ -459,6 +475,46 @@ export function buildProductNotificationGroupOperations(
459
475
  });
460
476
  }
461
477
  }
478
+ // Saving a customized group is a snapshot: a rule that arrived since the
479
+ // last save, and that the draft shows, gets a row holding the value shown,
480
+ // so a later change to the group (switching it back on, say) cannot flip
481
+ // it. A rule the draft never showed stays inherited, so replaying the same
482
+ // older draft after its save stays a no-op.
483
+ if (savedGroup?.configMode === 'replace_default' && operations.length > 0) {
484
+ for (const saved of savedRules) {
485
+ const rule = draft.rules.find(
486
+ (candidate) => candidate.ruleKey === saved.ruleKey,
487
+ );
488
+ if (
489
+ !rule ||
490
+ saved.source !== 'default' ||
491
+ operations.some(
492
+ (operation) =>
493
+ (operation.kind === 'put_rule' &&
494
+ operation.rule.ruleKey === saved.ruleKey) ||
495
+ (operation.kind === 'remove_rule' &&
496
+ operation.ruleKey === saved.ruleKey),
497
+ )
498
+ )
499
+ continue;
500
+ operations.push({
501
+ kind: 'put_rule',
502
+ rule: {
503
+ ruleKey: rule.ruleKey,
504
+ groupKey: rule.groupKey,
505
+ enabled: rule.enabled,
506
+ notificationType: rule.notificationType,
507
+ eventName: rule.eventName,
508
+ eventFilter: rule.eventFilter,
509
+ trigger: rule.trigger,
510
+ repeatMode: rule.repeatMode,
511
+ conditionGeneration: rule.conditionGeneration,
512
+ configMode: 'replace_default',
513
+ defaultKey: rule.ruleKey,
514
+ },
515
+ });
516
+ }
517
+ }
462
518
  return operations;
463
519
  }
464
520
 
@@ -418,11 +418,28 @@ export function resolveEffectiveProductNotificationConfiguration(input: {
418
418
  const ruleOverrides = new Map(
419
419
  input.rules.map((rule) => [rule.ruleKey, rule]),
420
420
  );
421
+ const replacedDefaultGroups = input.groups.filter(
422
+ (group) =>
423
+ group.configMode === 'replace_default' && group.groupKey !== 'shadow',
424
+ );
421
425
  const replacedDefaultGroupKeys = new Set(
422
- input.groups
426
+ replacedDefaultGroups.map((group) => group.groupKey),
427
+ );
428
+ // A customized group saved a row for every rule it showed, and removing one
429
+ // leaves a `disable_default` row. So a default rule with no row there was
430
+ // added after the save: it reaches the group, off when the workspace has
431
+ // switched the group, or every rule it saved there, off.
432
+ const customizedGroupsInheritingOff = new Set(
433
+ replacedDefaultGroups
423
434
  .filter(
424
435
  (group) =>
425
- group.configMode === 'replace_default' && group.groupKey !== 'shadow',
436
+ !group.enabled ||
437
+ input.rules.every(
438
+ (rule) =>
439
+ rule.groupKey !== group.groupKey ||
440
+ !rule.enabled ||
441
+ rule.configMode === 'disable_default',
442
+ ),
426
443
  )
427
444
  .map((group) => group.groupKey),
428
445
  );
@@ -543,19 +560,15 @@ export function resolveEffectiveProductNotificationConfiguration(input: {
543
560
  ProductNotificationWorkspaceRule,
544
561
  EffectiveProductNotificationRule
545
562
  >({
546
- defaults: input.policy.rules.filter(
547
- (rule) =>
548
- // An existing group snapshot predates this newly added default.
549
- rule.ruleKey === INCLUDED_ALLOWANCE_RULE_KEY ||
550
- !replacedDefaultGroupKeys.has(rule.groupKey) ||
551
- ruleOverrides.has(rule.ruleKey),
552
- ),
563
+ defaults: input.policy.rules,
553
564
  overrides: input.rules,
554
565
  keyName: 'ruleKey',
555
566
  label: 'rule',
556
567
  defaultVersion: input.policy.version,
557
568
  fromDefault: (value, version) => ({
558
569
  ...withoutLegacyRuleEmission(value),
570
+ enabled:
571
+ value.enabled && !customizedGroupsInheritingOff.has(value.groupKey),
559
572
  repeatMode: normalizeProductNotificationRepeatMode(value.repeatMode),
560
573
  conditionGeneration: normalizeProductNotificationConditionGeneration(
561
574
  value.conditionGeneration,