deepline 0.3.409 → 0.3.410

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 (213) hide show
  1. package/dist/bundling-sources/sdk/src/agent-runtime.ts +18 -1
  2. package/dist/bundling-sources/sdk/src/client.ts +206 -333
  3. package/dist/bundling-sources/sdk/src/compat.ts +45 -2
  4. package/dist/bundling-sources/sdk/src/db/query.ts +9 -10
  5. package/dist/bundling-sources/sdk/src/http.ts +38 -20
  6. package/dist/bundling-sources/sdk/src/index.ts +4 -5
  7. package/dist/bundling-sources/sdk/src/play.ts +10 -10
  8. package/dist/bundling-sources/sdk/src/plays/bundle-play-file.ts +6 -4
  9. package/dist/bundling-sources/sdk/src/plays/check-local-play-graph.ts +114 -0
  10. package/dist/bundling-sources/sdk/src/plays/client.ts +431 -0
  11. package/dist/bundling-sources/sdk/src/plays/local-play-execution.ts +2 -2
  12. package/dist/bundling-sources/sdk/src/plays/run-request.ts +106 -16
  13. package/dist/bundling-sources/sdk/src/release.ts +13 -7
  14. package/dist/bundling-sources/sdk/src/runs/read-errors.ts +8 -0
  15. package/dist/bundling-sources/sdk/src/runs/watch-polling.ts +124 -13
  16. package/dist/bundling-sources/sdk/src/tool-calls.ts +108 -19
  17. package/dist/bundling-sources/sdk/src/types.ts +18 -0
  18. package/dist/bundling-sources/shared_libs/integration-contracts/execute-retry-contract.ts +37 -0
  19. package/dist/bundling-sources/shared_libs/integration-contracts/package.json +3 -0
  20. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +3 -1
  21. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +277 -76
  22. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +6 -0
  23. package/dist/bundling-sources/shared_libs/play-runtime/dataset-row-input.ts +124 -0
  24. package/dist/bundling-sources/shared_libs/play-runtime/durable-call-cache.ts +6 -62
  25. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +1 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/durable-tool-identity.ts +67 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/execute-server-timing.ts +64 -6
  28. package/dist/bundling-sources/shared_libs/play-runtime/freshness-receipt-execution.ts +1 -5
  29. package/dist/bundling-sources/shared_libs/play-runtime/ledger-safe-payload.ts +1 -1
  30. package/dist/bundling-sources/shared_libs/play-runtime/play-artifact-runtime-contract.ts +3 -0
  31. package/dist/bundling-sources/shared_libs/play-runtime/play-http-request.ts +10 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/query-result-dataset.ts +3 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/egress-probe.ts +3 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +26 -16
  35. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-heartbeat.ts +36 -11
  36. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-terminal-push.ts +35 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +21 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-payload-transport.ts +21 -6
  39. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +11 -2
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +85 -20
  41. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +71 -13
  42. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-execution-queries.ts +100 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-pool.ts +9 -5
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +337 -146
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-shared.ts +26 -12
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +3 -1
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +425 -102
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
  49. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +4 -0
  50. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +9 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +181 -124
  52. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-worker-wake.ts +152 -0
  53. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +5 -3
  54. package/dist/bundling-sources/shared_libs/play-runtime/tool-cache-policy.ts +31 -0
  55. package/dist/bundling-sources/shared_libs/play-runtime/transient-service-error.ts +10 -0
  56. package/dist/bundling-sources/shared_libs/plays/ambiguous-write-error.ts +25 -0
  57. package/dist/bundling-sources/shared_libs/plays/artifact-types.ts +4 -0
  58. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +63 -68
  59. package/dist/bundling-sources/shared_libs/plays/bundling/index.ts +129 -63
  60. package/dist/bundling-sources/shared_libs/plays/contracts.ts +14 -0
  61. package/dist/bundling-sources/shared_libs/plays/enrich-play-compiler.ts +58 -16
  62. package/dist/bundling-sources/shared_libs/plays/fetch-http-error.ts +50 -0
  63. package/dist/bundling-sources/shared_libs/plays/source-authoring-edition.ts +351 -0
  64. package/dist/bundling-sources/shared_libs/plays/tool-list-getter-mode.ts +9 -0
  65. package/dist/bundling-sources/shared_libs/plays/tool-result-types.ts +1 -1
  66. package/dist/cli/{auth-5HIIACF7.mjs → auth-LLXLIILR.mjs} +6 -6
  67. package/dist/cli/auth-UG4WOYGL.js +40 -0
  68. package/dist/cli/{billing-EVZ3ZWKC.mjs → billing-5FVXZYAC.mjs} +8 -8
  69. package/dist/cli/{billing-4275N7FL.js → billing-NFPK7GYP.js} +84 -84
  70. package/dist/cli/{chunk-ZAAKSJAS.js → chunk-27GJKC5Q.js} +17 -10
  71. package/dist/cli/{chunk-UHNDVD3P.js → chunk-2H4EY7KH.js} +100 -41
  72. package/dist/cli/{chunk-TQNHMWUR.mjs → chunk-2YR7BIIC.mjs} +5 -2
  73. package/dist/cli/{chunk-AU4OFDFX.js → chunk-36AHOWVS.js} +26 -26
  74. package/dist/cli/{chunk-OSDXE27V.mjs → chunk-4PG4ARL2.mjs} +17 -10
  75. package/dist/cli/{chunk-PBZYY7VZ.mjs → chunk-4XQLVUC7.mjs} +734 -511
  76. package/dist/cli/chunk-5TUGWDEB.js +313 -0
  77. package/dist/cli/{chunk-DEC3JECC.js → chunk-5UUQAGJS.js} +5 -2
  78. package/dist/cli/{chunk-JRAVVJ3T.mjs → chunk-5V5Y37BC.mjs} +2 -2
  79. package/dist/cli/{chunk-PMVFAYL7.mjs → chunk-63ILLN5H.mjs} +2 -2
  80. package/dist/cli/{chunk-V76R6HMV.js → chunk-63S7X326.js} +1029 -806
  81. package/dist/cli/{chunk-VWBTTJYQ.mjs → chunk-6PGATQ6L.mjs} +6 -3
  82. package/dist/cli/{chunk-6BJK4EJ3.mjs → chunk-AARWVK4C.mjs} +2132 -65
  83. package/dist/cli/{chunk-FERRDNMO.js → chunk-AD47BXN2.js} +5 -5
  84. package/dist/cli/{chunk-GAICVLKL.js → chunk-D37FEBES.js} +2 -2
  85. package/dist/cli/{chunk-S6R3OX7B.js → chunk-E4CABWXL.js} +25 -2
  86. package/dist/cli/{chunk-NXGCO4JB.mjs → chunk-E4IXDAZI.mjs} +5 -0
  87. package/dist/cli/chunk-EQ4Z7RJW.mjs +35 -0
  88. package/dist/cli/chunk-FR2ILQ4G.mjs +8 -0
  89. package/dist/cli/{chunk-FJCIUF34.js → chunk-FVLNYDI4.js} +128 -376
  90. package/dist/cli/{chunk-O3VSXP2F.js → chunk-FZJAM576.js} +50 -50
  91. package/dist/cli/{chunk-BZAMOCPA.mjs → chunk-IMZ56EOH.mjs} +3 -3
  92. package/dist/cli/{chunk-N44JHMKY.mjs → chunk-IPG42SD2.mjs} +452 -138
  93. package/dist/cli/chunk-J33TSWO5.js +8 -0
  94. package/dist/cli/{chunk-BEVLCKXG.mjs → chunk-JNXJZ577.mjs} +1 -1
  95. package/dist/cli/{chunk-JI2B4RZP.mjs → chunk-KCC3FKIW.mjs} +71 -12
  96. package/dist/cli/{chunk-6IKARAYD.mjs → chunk-L2VKAASU.mjs} +23 -0
  97. package/dist/cli/{chunk-WLOCMJWV.js → chunk-LTFL4JRN.js} +426 -721
  98. package/dist/cli/{chunk-YHPYUZZX.mjs → chunk-MAMVGOSC.mjs} +1 -1
  99. package/dist/cli/{chunk-NZSF57UO.mjs → chunk-MN2OWLFA.mjs} +2 -2
  100. package/dist/cli/{chunk-YD7B53RW.js → chunk-NF4V5DTY.js} +12 -12
  101. package/dist/cli/{chunk-Q2E4E4FJ.js → chunk-NPBJI7RE.js} +8 -8
  102. package/dist/cli/chunk-NTVLGHFM.js +501 -0
  103. package/dist/cli/{chunk-HQXL5526.mjs → chunk-NUX2QHNC.mjs} +1 -1
  104. package/dist/cli/{chunk-JGHG4NBA.js → chunk-OBB4QXHA.js} +19 -4
  105. package/dist/cli/{chunk-SEFMGO3Z.js → chunk-OQQOXSYA.js} +2184 -117
  106. package/dist/cli/chunk-OZ6E3IRZ.js +6084 -0
  107. package/dist/cli/{chunk-7P5AA3SN.js → chunk-PPDBRJRW.js} +6 -1
  108. package/dist/cli/{chunk-FHPCKULR.mjs → chunk-PZSLPBDA.mjs} +2 -2
  109. package/dist/cli/{chunk-ILHRA7AD.js → chunk-QADCFSGH.js} +7 -7
  110. package/dist/cli/{chunk-RTCDW2GU.js → chunk-QJI5FIOW.js} +170 -49
  111. package/dist/cli/{chunk-WYQO2CBS.mjs → chunk-QL22Y56M.mjs} +149 -28
  112. package/dist/cli/{chunk-2PRO2JTX.mjs → chunk-RFB25DSQ.mjs} +36 -284
  113. package/dist/cli/chunk-T44IIOT6.mjs +501 -0
  114. package/dist/cli/chunk-VK2LZ5IP.js +35 -0
  115. package/dist/cli/chunk-VKKVSFRD.js +62 -0
  116. package/dist/cli/{chunk-2GI3QD3L.js → chunk-VYKV5XHL.js} +644 -330
  117. package/dist/cli/{chunk-GSK6NHVM.js → chunk-WU4U6VSB.js} +5 -5
  118. package/dist/cli/chunk-XHLKJOTN.mjs +313 -0
  119. package/dist/cli/{chunk-IT3XBJQR.mjs → chunk-XIHWSXSV.mjs} +330 -625
  120. package/dist/cli/chunk-XNZJKRJA.mjs +6084 -0
  121. package/dist/cli/chunk-ZCALLYF6.mjs +62 -0
  122. package/dist/cli/{chunk-WHG43Z67.js → chunk-ZFZ427HN.js} +11 -8
  123. package/dist/cli/{chunk-J6DCKJNM.mjs → chunk-ZKYEW55U.mjs} +16 -1
  124. package/dist/cli/{csv-BBOTCGQY.js → csv-7U3FJYKZ.js} +14 -14
  125. package/dist/cli/{csv-A2MP6EFV.mjs → csv-ZWLDMM4A.mjs} +5 -5
  126. package/dist/cli/{db-G4CODDCA.js → db-DNCGV5PC.js} +42 -47
  127. package/dist/cli/{db-3W5DMTUX.mjs → db-IMYXVMGI.mjs} +15 -20
  128. package/dist/cli/{describe-XYJ2ZT4M.mjs → describe-Q23DWJUK.mjs} +20 -15
  129. package/dist/cli/{describe-PQTQ5B6F.js → describe-S34JUX5W.js} +27 -22
  130. package/dist/cli/describe-core.d.mts +2 -2
  131. package/dist/cli/describe-core.d.ts +2 -2
  132. package/dist/cli/describe-core.js +6 -6
  133. package/dist/cli/describe-core.mjs +5 -5
  134. package/dist/cli/{executions-UR67CA5H.mjs → executions-A73EUGSI.mjs} +8 -8
  135. package/dist/cli/{executions-TLANVR7Y.js → executions-XOMPX2YJ.js} +10 -10
  136. package/dist/cli/{feedback-WHCMGEIL.mjs → feedback-N4GJ2POI.mjs} +11 -7
  137. package/dist/cli/{feedback-6C2YTRJL.js → feedback-QTCHNJJH.js} +13 -9
  138. package/dist/cli/{git-GWLB6VSA.mjs → git-4Q3JIQYZ.mjs} +6 -6
  139. package/dist/cli/git-I6CPBEVG.js +24 -0
  140. package/dist/cli/index.js +236 -348
  141. package/dist/cli/index.mjs +162 -274
  142. package/dist/cli/{legacy-noops-KF4XIFEF.mjs → legacy-noops-3SOVGFF7.mjs} +6 -6
  143. package/dist/cli/{legacy-noops-ZUFA7RWI.js → legacy-noops-4OSHZM34.js} +9 -9
  144. package/dist/cli/{monitors-TB3K2IVE.js → monitors-LVE2KZNG.js} +94 -94
  145. package/dist/cli/{monitors-6UOIDIMB.mjs → monitors-QP2XID2B.mjs} +8 -8
  146. package/dist/cli/{org-WGHHMVDZ.mjs → org-IVRETVQA.mjs} +8 -8
  147. package/dist/cli/{org-CKWMBPIR.js → org-XFLK5IAP.js} +68 -68
  148. package/dist/cli/{play-LYPAXCLD.mjs → play-DE7VH6NU.mjs} +533 -98
  149. package/dist/cli/{play-N2B3KAVS.js → play-XXTPPP23.js} +1067 -632
  150. package/dist/cli/{providers-UR42MD6Z.js → providers-DLD3I4JF.js} +11 -11
  151. package/dist/cli/{providers-6DI5BVZJ.mjs → providers-GX2NIZQQ.mjs} +8 -8
  152. package/dist/cli/{quickstart-MNA2S6PO.mjs → quickstart-72B4L4PK.mjs} +5 -5
  153. package/dist/cli/{quickstart-FCJG4XGB.js → quickstart-XNS3HSWC.js} +7 -7
  154. package/dist/cli/search-6NCH4HB5.js +30 -0
  155. package/dist/cli/{search-VPPYUJ2M.mjs → search-SUTRANJI.mjs} +9 -9
  156. package/dist/cli/{secrets-QOSMVO36.js → secrets-6OBLOVEV.js} +17 -17
  157. package/dist/cli/{secrets-DRI4W7Z5.mjs → secrets-FPFXXNUH.mjs} +8 -8
  158. package/dist/cli/sessions-235532DR.js +16 -0
  159. package/dist/cli/{sessions-DQNUKP43.mjs → sessions-R25I4QKN.mjs} +6 -6
  160. package/dist/cli/{settings-DWDK3Y2R.mjs → settings-AOP6F5PZ.mjs} +12 -12
  161. package/dist/cli/{settings-JUGGCOPS.js → settings-VL5FOFPN.js} +79 -79
  162. package/dist/cli/{setup-AWBHNYXK.js → setup-BSC67YT3.js} +45 -44
  163. package/dist/cli/{setup-D5DWVNY4.mjs → setup-ZMPHBHVJ.mjs} +11 -10
  164. package/dist/cli/skills-3IWLYYRL.js +29 -0
  165. package/dist/cli/{skills-YV2XR35J.mjs → skills-KF65TVFO.mjs} +7 -7
  166. package/dist/cli/tools-LR66SPYU.js +44 -0
  167. package/dist/cli/{tools-VFJYHNV2.mjs → tools-SX4XIPM7.mjs} +19 -14
  168. package/dist/cli/{update-IM6VOTGL.mjs → update-QRMFRAQQ.mjs} +11 -9
  169. package/dist/cli/update-SP7UEO53.js +31 -0
  170. package/dist/cli/{workflow-26URBWPV.mjs → workflow-FOEEEB7G.mjs} +44 -20
  171. package/dist/cli/{workflow-3BS6U6SL.js → workflow-KOCK2FLW.js} +54 -30
  172. package/dist/{client-BfInrZPB.d.mts → client-74k4IPh6.d.mts} +135 -54
  173. package/dist/{client-BMjJFpan.d.ts → client-C1IK1f8c.d.ts} +135 -54
  174. package/dist/{compiler-manifest-Ycx-hoAr.d.mts → compiler-manifest-lzWpbV3w.d.mts} +83 -66
  175. package/dist/{compiler-manifest-Ycx-hoAr.d.ts → compiler-manifest-lzWpbV3w.d.ts} +83 -66
  176. package/dist/{index-CZXgiN3E.d.mts → index-C8Cy-YTm.d.ts} +5 -1
  177. package/dist/{index-NPG5pqxQ.d.ts → index-CtNK-0nI.d.mts} +5 -1
  178. package/dist/index.d.mts +47 -9
  179. package/dist/index.d.ts +47 -9
  180. package/dist/index.js +17 -14
  181. package/dist/index.mjs +13 -10
  182. package/dist/install-integrity.json +118 -102
  183. package/dist/plays/bundle-play-file.d.mts +3 -3
  184. package/dist/plays/bundle-play-file.d.ts +3 -3
  185. package/dist/plays/bundle-play-file.mjs +5 -4
  186. package/dist/plays/csv-data-input.js +3 -3
  187. package/dist/plays/csv-data-input.mjs +2 -2
  188. package/dist/plays/play-description.d.mts +2 -2
  189. package/dist/plays/play-description.d.ts +2 -2
  190. package/dist/plays/run-request.d.mts +2 -2
  191. package/dist/plays/run-request.d.ts +2 -2
  192. package/dist/plays/run-request.js +11 -3
  193. package/dist/plays/run-request.mjs +10 -2
  194. package/dist/release.d.mts +15 -6
  195. package/dist/release.d.ts +15 -6
  196. package/dist/release.js +2 -2
  197. package/dist/release.mjs +1 -1
  198. package/package.json +2 -2
  199. package/dist/cli/auth-F6BX32XZ.js +0 -40
  200. package/dist/cli/chunk-264PC2RN.mjs +0 -83
  201. package/dist/cli/chunk-44ZTYHMQ.mjs +0 -155
  202. package/dist/cli/chunk-53HN7WZN.js +0 -392
  203. package/dist/cli/chunk-7AALNGTA.mjs +0 -392
  204. package/dist/cli/chunk-ALD4COBH.js +0 -155
  205. package/dist/cli/chunk-CLJGSOVM.mjs +0 -1716
  206. package/dist/cli/chunk-WNUR6VP5.js +0 -83
  207. package/dist/cli/chunk-Z4VNJOF7.js +0 -1716
  208. package/dist/cli/git-VQFF6D7C.js +0 -24
  209. package/dist/cli/search-NCEEONMQ.js +0 -30
  210. package/dist/cli/sessions-3WYKQABW.js +0 -16
  211. package/dist/cli/skills-AKPAJVSO.js +0 -29
  212. package/dist/cli/tools-RBKEK6PM.js +0 -39
  213. package/dist/cli/update-VFNUBLDA.js +0 -29
@@ -3,23 +3,23 @@
3
3
  var _chunk3KC45UVFjs = require('./chunk-3KC45UVF.js');
4
4
 
5
5
 
6
- var _chunkZ4VNJOF7js = require('./chunk-Z4VNJOF7.js');
7
6
 
8
7
 
9
8
 
10
9
 
11
10
 
12
11
 
13
- var _chunkS6R3OX7Bjs = require('./chunk-S6R3OX7B.js');
14
12
 
13
+ var _chunkE4CABWXLjs = require('./chunk-E4CABWXL.js');
15
14
 
16
- var _chunk7P5AA3SNjs = require('./chunk-7P5AA3SN.js');
15
+
16
+
17
+ var _chunkPPDBRJRWjs = require('./chunk-PPDBRJRW.js');
17
18
 
18
19
 
19
20
  var _chunkOG64RBACjs = require('./chunk-OG64RBAC.js');
20
21
 
21
22
  // src/plays/bundle-play-file.ts
22
- var _os = require('os');
23
23
  var _path = require('path');
24
24
  var _url = require('url');
25
25
  var _fs = require('fs');
@@ -29,7 +29,7 @@ var _promises = require('fs/promises');
29
29
  var _crypto = require('crypto');
30
30
 
31
31
 
32
-
32
+ var _os = require('os');
33
33
 
34
34
 
35
35
 
@@ -47,17 +47,1822 @@ var _acorn = require('acorn');
47
47
 
48
48
  var _esbuild = require('esbuild');
49
49
 
50
+ // ../plays/authoring-contract.ts
51
+ var _typebox = require('@sinclair/typebox');
52
+ var _value = require('@sinclair/typebox/value');
53
+ var LEGACY_PLAY_AUTHORING_CONTRACT_EDITION = 1;
54
+ var PLAY_AUTHORING_CONTRACT_EDITION = 11;
55
+ var EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION = [
56
+ "Edition 11 requires an explicit choice.",
57
+ "`0` starts a fresh logical call, though a matching operation receipt may recover that same operation after resume;",
58
+ "`null` allows indefinite result reuse;",
59
+ "a positive integer is the maximum result age in seconds.",
60
+ "Omitted values retain legacy behavior in older editions."
61
+ ].join(" ");
62
+ var SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS = [
63
+ 1,
64
+ 2,
65
+ 3,
66
+ 4,
67
+ 5,
68
+ 6,
69
+ 7,
70
+ 8,
71
+ 9,
72
+ 10,
73
+ 11
74
+ ];
75
+ var PLAY_AUTHORING_CONTRACT_CHANGELOG_DETAILS = [
76
+ {
77
+ changed: "Historical extraction semantics. Invalid or unresolved optional authoring fields may normalize to absence.",
78
+ compatibilityOwner: "Plays Runtime",
79
+ newWritesEnd: "2026-11-03",
80
+ readerRemoval: "After every retained edition 1 artifact has a materialized admitted snapshot."
81
+ },
82
+ {
83
+ changed: "Pins admitted authoring snapshots and rejects ambiguous billing, secret, webhook, fetch, timeout, receipt-wait, and freshness contracts.",
84
+ compatibilityOwner: "Plays Runtime",
85
+ newWritesEnd: "2026-08-03",
86
+ readerRemoval: "After every retained edition 2 artifact has an admitted input schema or has been republished."
87
+ },
88
+ {
89
+ changed: "Materializes the declared input schema in the admitted snapshot so launch never reparses current source.",
90
+ compatibilityOwner: "Plays Runtime",
91
+ newWritesEnd: "2026-08-19",
92
+ readerRemoval: null
93
+ },
94
+ {
95
+ changed: "ctx.secrets.get(name) resolves an allowed secret to a plaintext string for ordinary Play code. Editions 1\u20133 retain opaque secret handles.",
96
+ compatibilityOwner: "Plays Runtime",
97
+ newWritesEnd: null,
98
+ readerRemoval: null
99
+ },
100
+ {
101
+ changed: "ctx.fetch throws a typed, redacted CtxFetchHttpError for non-2xx responses. Editions 1\u20134 continue to return the response record for every HTTP status.",
102
+ compatibilityOwner: "Plays Runtime",
103
+ newWritesEnd: null,
104
+ readerRemoval: null
105
+ },
106
+ {
107
+ changed: "Adds static cron input and rejects unknown definePlay and binding fields during new admission. Editions 1\u20135 retain their admitted binding semantics.",
108
+ compatibilityOwner: "Plays Runtime",
109
+ newWritesEnd: null,
110
+ readerRemoval: null
111
+ },
112
+ {
113
+ changed: "Slack HITL calls that omit timeout wait one week. Editions 1\u20136 retain the historical 24-hour default.",
114
+ compatibilityOwner: "Plays Runtime",
115
+ newWritesEnd: null,
116
+ readerRemoval: null
117
+ },
118
+ {
119
+ changed: "Lets an inline scalar child execute without a stored static pipeline. Dataset creation and suspension remain rejected by the authoritative runtime capability boundary; editions 1\u20137 retain static-contract preflight rejection.",
120
+ compatibilityOwner: "Plays Runtime",
121
+ newWritesEnd: null,
122
+ readerRemoval: null
123
+ },
124
+ {
125
+ changed: "Projects native-batch rawV2 to the logical source response at the Play boundary. Editions 1\u20138 retain their admitted response nesting; completed tool receipts and provider identities are unchanged.",
126
+ compatibilityOwner: "Plays Runtime",
127
+ newWritesEnd: null,
128
+ readerRemoval: null
129
+ },
130
+ {
131
+ changed: "List getters return ordinary arrays from the complete resident tool response. Lazy database datasets require an explicit dataset read; incomplete historical previews fail rather than masquerade as complete arrays. Editions 1\u20139 retain dataset-valued getters; stored tool receipts are unchanged.",
132
+ compatibilityOwner: "Plays Runtime",
133
+ newWritesEnd: null,
134
+ readerRemoval: null
135
+ },
136
+ {
137
+ changed: 'Requires explicit freshness and semantic identity for supported durable calls, and gives edition 11 CSV datasets source-row occurrence identity so every input occurrence is processed even when key or rowIdentity: "key" is supplied. Edition 10 retains its list-getter behavior; editions 1\u201310 retain their admitted CSV identity and completed receipts. Non-CSV datasets keep explicit key deduplication.',
138
+ compatibilityOwner: "Plays Runtime",
139
+ newWritesEnd: null,
140
+ readerRemoval: null
141
+ }
142
+ ];
143
+ var PLAY_AUTHORING_CONTRACT_CHANGELOG = SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS.map((edition, index) => ({
144
+ edition,
145
+ ...PLAY_AUTHORING_CONTRACT_CHANGELOG_DETAILS[index]
146
+ }));
147
+ var PLAY_SQL_LISTENER_WHERE_OPERATORS = [
148
+ "eq",
149
+ "neq",
150
+ "in",
151
+ "notIn",
152
+ "isNull",
153
+ "isNotNull",
154
+ "ilike"
155
+ ];
156
+ var PLAY_SQL_LISTENER_ID_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*$/;
157
+ var PLAY_SQL_LISTENER_TOOL_PATTERN = /^[a-zA-Z][a-zA-Z0-9_-]*\.[a-zA-Z][a-zA-Z0-9_-]*$/;
158
+ var PLAY_SQL_LISTENER_WHERE_OPERATOR_SET = new Set(
159
+ PLAY_SQL_LISTENER_WHERE_OPERATORS
160
+ );
161
+ var PLAY_AUTHORING_BINDING_FIELDS = {
162
+ root: [
163
+ "displayName",
164
+ "billing",
165
+ "compatibility",
166
+ "cron",
167
+ "inline",
168
+ "runtime",
169
+ "secrets",
170
+ "sqlListeners",
171
+ "webhook"
172
+ ],
173
+ cron: ["schedule", "timezone", "input"],
174
+ webhook: ["auth", "hmac"],
175
+ sqlListener: [
176
+ "id",
177
+ "tool",
178
+ "stream",
179
+ "where",
180
+ "table",
181
+ "monitor",
182
+ "output",
183
+ "operations"
184
+ ]
185
+ };
186
+ var PLAY_AUTHORING_DEFINE_PLAY_OPTION_FIELDS = [
187
+ "id",
188
+ "name",
189
+ "description",
190
+ "input",
191
+ "run",
192
+ "bindings",
193
+ ...PLAY_AUTHORING_BINDING_FIELDS.root
194
+ ];
195
+ var PLAY_AUTHORING_DOCUMENTATION = {
196
+ fetchBatching: {
197
+ warning: "A static ctx.fetch key inside a loop is a warning because every iteration must still have distinct method, URL, body, or safe headers. One durable receipt must never stand in for every request.",
198
+ guidance: "Keep the static fetch label. For a mutating batch, make the body distinct and use a replay-stable external Idempotency-Key such as `${ctx.run.id}:signals:${batchIndex}`."
199
+ },
200
+ runId: {
201
+ semantics: "ctx.run.id is stable while Deepline retries or resumes one durable run. A separately submitted run receives a new id.",
202
+ use: "Use it when deriving an external idempotency key for a sequence of batches."
203
+ },
204
+ staticCallKeys: {
205
+ constraint: "Durable call keys \u2014 the ctx.fetch key, the ctx.dataset key, the ctx.step id \u2014 must be static string literals. The key names a durable receipt, so check, publish, and replay have to agree on it before the body runs. A key computed at runtime cannot be resolved at check time and is rejected.",
206
+ consequence: "This is an architectural constraint, not a style rule. A play cannot loop over a computed key, so it cannot page a large table with a helper like page(pageNumber). Unrolling one literal key per page is not a design at any real page count.",
207
+ workaround: "Push the aggregation server-side and call it once: a SQL function, a view, or a provider endpoint that returns the whole result. Keep unrolled literal keys only for a handful of genuinely distinct calls. To fan out over rows, use ctx.dataset with a static key \u2014 the per-row receipt identity comes from the row, not from the key."
208
+ }
209
+ };
210
+ var PLAY_AUTHORING_STATIC_FETCH_KEY_HINT = `${PLAY_AUTHORING_DOCUMENTATION.staticCallKeys.workaround} Do not compute the key.`;
211
+ var SecretEnvironmentNameSchema = _typebox.Type.String({
212
+ pattern: "^[A-Z][A-Z0-9_]{1,63}$",
213
+ description: "An uppercase environment variable name beginning with a letter."
214
+ });
215
+ var SqlListenerFilterScalarSchema = _typebox.Type.Union([
216
+ _typebox.Type.String(),
217
+ _typebox.Type.Number(),
218
+ _typebox.Type.Boolean(),
219
+ _typebox.Type.Null()
220
+ ]);
221
+ var PLAY_AUTHORING_FIELD_REGISTRY = {
222
+ displayName: {
223
+ schema: _typebox.Type.String(),
224
+ fixtures: {
225
+ valid: "Find verified emails",
226
+ invalid: 42,
227
+ absent: void 0,
228
+ unresolved: { expression: "displayName" },
229
+ edition1: "Legacy play"
230
+ },
231
+ referenceType: "string",
232
+ required: false,
233
+ resolution: "static-required",
234
+ issueCode: "play_authoring_binding_invalid",
235
+ description: "Optional human-readable Play name; empty uses the derived identifier.",
236
+ errorMessage: "displayName must be a static string."
237
+ },
238
+ description: {
239
+ schema: _typebox.Type.String({ minLength: 1 }),
240
+ fixtures: {
241
+ valid: "Enrich a company.",
242
+ invalid: "",
243
+ absent: void 0,
244
+ unresolved: { expression: "description" },
245
+ edition1: "Legacy play."
246
+ },
247
+ referenceType: "string",
248
+ required: false,
249
+ resolution: "static-required",
250
+ issueCode: "play_authoring_binding_invalid",
251
+ description: "Optional non-empty human-readable summary of the Play.",
252
+ errorMessage: "description must be a non-empty static string."
253
+ },
254
+ "compatibility.toolErrorSchemaVersion": {
255
+ schema: _typebox.Type.Union([_typebox.Type.Literal(0), _typebox.Type.Literal(1)]),
256
+ fixtures: {
257
+ valid: 1,
258
+ invalid: 2,
259
+ absent: void 0,
260
+ unresolved: { expression: "version" },
261
+ edition1: 0
262
+ },
263
+ referenceType: "0 | 1",
264
+ required: false,
265
+ resolution: "static-required",
266
+ issueCode: "play_authoring_binding_invalid",
267
+ description: "Artifact-pinned tool error behavior, either 0 or 1.",
268
+ errorMessage: "compatibility.toolErrorSchemaVersion must be the static literal 0 or 1."
269
+ },
270
+ "compatibility.authoringContract": {
271
+ schema: _typebox.Type.Literal("explicit-freshness"),
272
+ fixtures: {
273
+ valid: "explicit-freshness",
274
+ invalid: "legacy",
275
+ absent: void 0,
276
+ unresolved: { expression: "authoringContract" },
277
+ edition1: void 0
278
+ },
279
+ referenceType: "'explicit-freshness'",
280
+ required: false,
281
+ resolution: "static-required",
282
+ issueCode: "play_authoring_binding_invalid",
283
+ description: "Opts new source into the current explicit-freshness authoring edition; an already-pinned edition-10 artifact retains its admitted behavior.",
284
+ errorMessage: 'compatibility.authoringContract must be the static literal "explicit-freshness".'
285
+ },
286
+ "compatibility.toolResponseReceiptRevision": {
287
+ schema: _typebox.Type.String({
288
+ minLength: 1,
289
+ maxLength: 64,
290
+ pattern: "^[A-Za-z0-9][A-Za-z0-9._-]{0,63}$"
291
+ }),
292
+ fixtures: {
293
+ valid: "raw-v2-receipt-v1",
294
+ invalid: "has spaces",
295
+ absent: void 0,
296
+ unresolved: { expression: "revision" },
297
+ edition1: void 0
298
+ },
299
+ referenceType: "string",
300
+ required: false,
301
+ resolution: "static-required",
302
+ issueCode: "play_authoring_binding_invalid",
303
+ description: "Explicit durable-receipt revision for a response transformation; bump only when serialized tool output changes.",
304
+ errorMessage: "compatibility.toolResponseReceiptRevision must be a non-empty static identifier using letters, numbers, dots, underscores, or hyphens."
305
+ },
306
+ inline: {
307
+ schema: _typebox.Type.Boolean(),
308
+ fixtures: {
309
+ valid: true,
310
+ invalid: "true",
311
+ absent: void 0,
312
+ unresolved: { expression: "inline" },
313
+ edition1: false
314
+ },
315
+ referenceType: "boolean",
316
+ required: false,
317
+ resolution: "static-required",
318
+ issueCode: "play_authoring_binding_invalid",
319
+ description: "Compiler hint for an inline named Play handler.",
320
+ errorMessage: "inline must be a static boolean."
321
+ },
322
+ "billing.maxCreditsPerRun": {
323
+ schema: _typebox.Type.Number({ exclusiveMinimum: 0 }),
324
+ fixtures: {
325
+ valid: 1,
326
+ invalid: 0,
327
+ absent: void 0,
328
+ unresolved: { expression: "cap" },
329
+ edition1: 1
330
+ },
331
+ referenceType: "number",
332
+ required: false,
333
+ resolution: "static-required",
334
+ issueCode: "play_authoring_billing_limit_invalid",
335
+ description: "Maximum Deepline credits permitted for one Play Run.",
336
+ errorMessage: "billing.maxCreditsPerRun must be a static number greater than 0. Remove it for no run cap."
337
+ },
338
+ "bindings.webhook.hmac.secretEnv": {
339
+ schema: SecretEnvironmentNameSchema,
340
+ fixtures: {
341
+ valid: "WEBHOOK_SECRET",
342
+ invalid: "webhook_secret",
343
+ absent: void 0,
344
+ unresolved: { expression: "secretEnv" },
345
+ edition1: "WEBHOOK_SECRET"
346
+ },
347
+ referenceType: "string",
348
+ required: true,
349
+ resolution: "static-required",
350
+ issueCode: "play_authoring_webhook_hmac_invalid",
351
+ description: "Environment variable containing the webhook HMAC secret.",
352
+ errorMessage: "bindings.webhook.hmac.secretEnv must be an uppercase environment variable name beginning with a letter."
353
+ },
354
+ "bindings.webhook.hmac.algorithm": {
355
+ schema: _typebox.Type.Literal("sha256"),
356
+ fixtures: {
357
+ valid: "sha256",
358
+ invalid: "sha1",
359
+ absent: void 0,
360
+ unresolved: { expression: "algorithm" },
361
+ edition1: "sha256"
362
+ },
363
+ referenceType: "'sha256'",
364
+ required: false,
365
+ resolution: "static-required",
366
+ issueCode: "play_authoring_webhook_hmac_invalid",
367
+ description: "Webhook signature hash algorithm. Only sha256 is supported.",
368
+ errorMessage: 'bindings.webhook.hmac.algorithm must be the static literal "sha256".'
369
+ },
370
+ "bindings.webhook.hmac.header": {
371
+ schema: _typebox.Type.String({ minLength: 1 }),
372
+ fixtures: {
373
+ valid: "x-signature",
374
+ invalid: "",
375
+ absent: void 0,
376
+ unresolved: { expression: "header" },
377
+ edition1: "x-signature"
378
+ },
379
+ referenceType: "string",
380
+ required: false,
381
+ resolution: "static-required",
382
+ issueCode: "play_authoring_webhook_hmac_invalid",
383
+ description: "HTTP header containing the webhook signature.",
384
+ errorMessage: "bindings.webhook.hmac.header must be a non-empty static string."
385
+ },
386
+ "bindings.webhook.hmac.signaturePrefix": {
387
+ schema: _typebox.Type.String(),
388
+ fixtures: {
389
+ valid: "",
390
+ invalid: { expression: "signaturePrefix" },
391
+ absent: void 0,
392
+ unresolved: { expression: "signaturePrefix" },
393
+ edition1: void 0
394
+ },
395
+ referenceType: "string",
396
+ required: false,
397
+ resolution: "static-required",
398
+ issueCode: "play_authoring_webhook_hmac_invalid",
399
+ description: "Optional literal before the lowercase hexadecimal HMAC. Set to an empty string for providers that send a bare digest; defaults to sha256= when a signature header is configured.",
400
+ errorMessage: "bindings.webhook.hmac.signaturePrefix must be a static string literal."
401
+ },
402
+ "bindings.webhook.auth.type": {
403
+ schema: _typebox.Type.Literal("standard-webhooks"),
404
+ fixtures: {
405
+ valid: "standard-webhooks",
406
+ invalid: "svix",
407
+ absent: void 0,
408
+ unresolved: { expression: "type" },
409
+ edition1: void 0
410
+ },
411
+ referenceType: "'standard-webhooks'",
412
+ // auth itself is optional; once present, the AST adapter requires this
413
+ // field together with headerFamily and signingSecrets.
414
+ required: false,
415
+ resolution: "static-required",
416
+ issueCode: "play_authoring_standard_webhooks_invalid",
417
+ description: "Uses the Standard Webhooks v1 symmetric signing scheme.",
418
+ errorMessage: 'bindings.webhook.auth.type must be the static literal "standard-webhooks".'
419
+ },
420
+ "bindings.webhook.auth.headerFamily": {
421
+ schema: _typebox.Type.Union([_typebox.Type.Literal("standard"), _typebox.Type.Literal("svix")]),
422
+ fixtures: {
423
+ valid: "svix",
424
+ invalid: "webhook",
425
+ absent: void 0,
426
+ unresolved: { expression: "headerFamily" },
427
+ edition1: void 0
428
+ },
429
+ referenceType: "'standard' | 'svix'",
430
+ // auth itself is optional; once present, the AST adapter requires this
431
+ // field together with type and signingSecrets.
432
+ required: false,
433
+ resolution: "static-required",
434
+ issueCode: "play_authoring_standard_webhooks_invalid",
435
+ description: "Header namespace expected from the webhook provider.",
436
+ errorMessage: 'bindings.webhook.auth.headerFamily must be the static literal "standard" or "svix".'
437
+ },
438
+ "bindings.webhook.auth.signingSecrets[]": {
439
+ schema: SecretEnvironmentNameSchema,
440
+ fixtures: {
441
+ valid: "VECTOR_WEBHOOK_SECRET",
442
+ invalid: "vector_webhook_secret",
443
+ absent: void 0,
444
+ unresolved: { expression: "secret" },
445
+ edition1: void 0
446
+ },
447
+ referenceType: "string",
448
+ // auth itself is optional; once present, the AST adapter requires this
449
+ // field together with type and headerFamily.
450
+ required: false,
451
+ resolution: "static-required",
452
+ issueCode: "play_authoring_standard_webhooks_invalid",
453
+ description: "Deepline Secret name used to verify Standard Webhooks.",
454
+ errorMessage: "bindings.webhook.auth.signingSecrets entries must be uppercase Deepline Secret names beginning with a letter."
455
+ },
456
+ "bindings.webhook.auth.toleranceSeconds": {
457
+ schema: _typebox.Type.Integer({ minimum: 1, maximum: 3600 }),
458
+ fixtures: {
459
+ valid: 300,
460
+ invalid: 0,
461
+ absent: void 0,
462
+ unresolved: { expression: "toleranceSeconds" },
463
+ edition1: void 0
464
+ },
465
+ referenceType: "number",
466
+ required: false,
467
+ resolution: "static-required",
468
+ issueCode: "play_authoring_standard_webhooks_invalid",
469
+ description: "Accepted delivery timestamp skew in seconds, from 1 through 3600.",
470
+ errorMessage: "bindings.webhook.auth.toleranceSeconds must be a static whole number from 1 through 3600."
471
+ },
472
+ "bindings.cron.schedule": {
473
+ schema: _typebox.Type.String({ minLength: 1 }),
474
+ fixtures: {
475
+ valid: "0 9 * * *",
476
+ invalid: "",
477
+ absent: void 0,
478
+ unresolved: { expression: "schedule" },
479
+ edition1: "0 9 * * *"
480
+ },
481
+ referenceType: "string",
482
+ required: true,
483
+ resolution: "static-required",
484
+ issueCode: "play_authoring_binding_invalid",
485
+ description: "Five-field cron expression.",
486
+ errorMessage: "bindings.cron.schedule must be a non-empty static string."
487
+ },
488
+ "bindings.cron.timezone": {
489
+ schema: _typebox.Type.String({ minLength: 1 }),
490
+ fixtures: {
491
+ valid: "UTC",
492
+ invalid: "",
493
+ absent: void 0,
494
+ unresolved: { expression: "timezone" },
495
+ edition1: "UTC"
496
+ },
497
+ referenceType: "string",
498
+ required: false,
499
+ resolution: "static-required",
500
+ issueCode: "play_authoring_cron_timezone_invalid",
501
+ description: "IANA timezone. Omitted means UTC.",
502
+ errorMessage: "bindings.cron.timezone must be a valid non-empty IANA timezone string."
503
+ },
504
+ "bindings.cron.input": {
505
+ schema: _typebox.Type.Object({}, { additionalProperties: true }),
506
+ fixtures: {
507
+ valid: { apply: true },
508
+ invalid: ["apply"],
509
+ absent: void 0,
510
+ unresolved: ["cronInput"],
511
+ edition1: void 0
512
+ },
513
+ referenceType: "Record<string, unknown>",
514
+ required: false,
515
+ resolution: "static-required",
516
+ issueCode: "play_authoring_binding_invalid",
517
+ description: "Static JSON object passed to every run created by this cron binding.",
518
+ errorMessage: "bindings.cron.input must be a static JSON object (no variables, spreads, or functions)."
519
+ },
520
+ "bindings.sqlListeners": {
521
+ schema: _typebox.Type.Array(_typebox.Type.Object({}, { additionalProperties: true })),
522
+ fixtures: {
523
+ valid: [],
524
+ invalid: "listeners",
525
+ absent: void 0,
526
+ unresolved: { expression: "listeners" },
527
+ edition1: []
528
+ },
529
+ referenceType: "SqlListener[]",
530
+ required: false,
531
+ resolution: "static-required",
532
+ issueCode: "play_authoring_binding_invalid",
533
+ description: "Static provider-monitor listener declarations.",
534
+ errorMessage: "bindings.sqlListeners must be a static array of objects."
535
+ },
536
+ "bindings.sqlListeners[].id": {
537
+ schema: _typebox.Type.String({ pattern: PLAY_SQL_LISTENER_ID_PATTERN.source }),
538
+ fixtures: {
539
+ valid: "job-openings",
540
+ invalid: "1-job-openings",
541
+ absent: void 0,
542
+ unresolved: { expression: "listenerId" },
543
+ edition1: "job-openings"
544
+ },
545
+ referenceType: "string",
546
+ required: true,
547
+ resolution: "static-required",
548
+ issueCode: "sql_listener_binding_shape",
549
+ description: "Unique static listener identifier within one Play.",
550
+ errorMessage: "bindings.sqlListeners[].id must begin with a letter and contain only letters, numbers, underscores, or hyphens."
551
+ },
552
+ "bindings.sqlListeners[].tool": {
553
+ schema: _typebox.Type.String({ pattern: PLAY_SQL_LISTENER_TOOL_PATTERN.source }),
554
+ fixtures: {
555
+ valid: "deepline_native.company_radar",
556
+ invalid: "company_radar",
557
+ absent: void 0,
558
+ unresolved: { expression: "toolId" },
559
+ edition1: "deepline_native.company_radar"
560
+ },
561
+ referenceType: "string",
562
+ required: true,
563
+ resolution: "static-required",
564
+ issueCode: "sql_listener_binding_shape",
565
+ description: "Modeled provider monitor tool id in provider.tool form.",
566
+ errorMessage: "bindings.sqlListeners[].tool must use static provider.tool syntax."
567
+ },
568
+ "bindings.sqlListeners[].stream": {
569
+ schema: _typebox.Type.String({ pattern: PLAY_SQL_LISTENER_ID_PATTERN.source }),
570
+ fixtures: {
571
+ valid: "company_job_openings",
572
+ invalid: "1-company-job-openings",
573
+ absent: void 0,
574
+ unresolved: { expression: "stream" },
575
+ edition1: "company_job_openings"
576
+ },
577
+ referenceType: "string",
578
+ required: true,
579
+ resolution: "static-required",
580
+ issueCode: "sql_listener_binding_shape",
581
+ description: "Static output stream key exposed by the monitor tool.",
582
+ errorMessage: "bindings.sqlListeners[].stream must be a static stream identifier."
583
+ },
584
+ "bindings.sqlListeners[].operations[]": {
585
+ schema: _typebox.Type.Union([
586
+ _typebox.Type.Literal("INSERT"),
587
+ _typebox.Type.Literal("UPDATE"),
588
+ _typebox.Type.Literal("DELETE")
589
+ ]),
590
+ fixtures: {
591
+ valid: "INSERT",
592
+ invalid: "UPSERT",
593
+ absent: void 0,
594
+ unresolved: { expression: "operation" },
595
+ edition1: "UPDATE"
596
+ },
597
+ referenceType: "'INSERT' | 'UPDATE' | 'DELETE'",
598
+ required: false,
599
+ resolution: "static-required",
600
+ issueCode: "sql_listener_binding_shape",
601
+ description: "Database operation that wakes the listener.",
602
+ errorMessage: "bindings.sqlListeners[].operations entries must be INSERT, UPDATE, or DELETE."
603
+ },
604
+ "bindings.sqlListeners[].where.before": {
605
+ schema: _typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()),
606
+ fixtures: {
607
+ valid: { status: { eq: "open" } },
608
+ invalid: "status=open",
609
+ absent: void 0,
610
+ unresolved: "beforeFilter",
611
+ edition1: { status: { eq: "open" } }
612
+ },
613
+ referenceType: "Record<string, SqlListenerFilterOperator>",
614
+ required: false,
615
+ resolution: "static-required",
616
+ issueCode: "sql_listener_binding_shape",
617
+ description: "Column filters evaluated against the row before mutation.",
618
+ errorMessage: "bindings.sqlListeners[].where.before must be a static object keyed by column."
619
+ },
620
+ "bindings.sqlListeners[].where.after": {
621
+ schema: _typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()),
622
+ fixtures: {
623
+ valid: { status: { eq: "open" } },
624
+ invalid: "status=open",
625
+ absent: void 0,
626
+ unresolved: "afterFilter",
627
+ edition1: { status: { eq: "open" } }
628
+ },
629
+ referenceType: "Record<string, SqlListenerFilterOperator>",
630
+ required: false,
631
+ resolution: "static-required",
632
+ issueCode: "sql_listener_binding_shape",
633
+ description: "Column filters evaluated against the row after mutation.",
634
+ errorMessage: "bindings.sqlListeners[].where.after must be a static object keyed by column."
635
+ },
636
+ "bindings.sqlListeners[].where.*.*.eq": {
637
+ schema: SqlListenerFilterScalarSchema,
638
+ fixtures: {
639
+ valid: "open",
640
+ invalid: { nested: true },
641
+ absent: void 0,
642
+ unresolved: { expression: "equalsValue" },
643
+ edition1: "open"
644
+ },
645
+ referenceType: "SqlListenerFilterScalar",
646
+ required: false,
647
+ resolution: "static-required",
648
+ issueCode: "sql_listener_binding_shape",
649
+ description: "Scalar equality condition.",
650
+ errorMessage: "SQL listener eq must compare a scalar value."
651
+ },
652
+ "bindings.sqlListeners[].where.*.*.neq": {
653
+ schema: SqlListenerFilterScalarSchema,
654
+ fixtures: {
655
+ valid: "closed",
656
+ invalid: { nested: true },
657
+ absent: void 0,
658
+ unresolved: { expression: "notEqualsValue" },
659
+ edition1: "closed"
660
+ },
661
+ referenceType: "SqlListenerFilterScalar",
662
+ required: false,
663
+ resolution: "static-required",
664
+ issueCode: "sql_listener_binding_shape",
665
+ description: "Scalar inequality condition.",
666
+ errorMessage: "SQL listener neq must compare a scalar value."
667
+ },
668
+ "bindings.sqlListeners[].where.*.*.in": {
669
+ schema: _typebox.Type.Array(SqlListenerFilterScalarSchema, { minItems: 1 }),
670
+ fixtures: {
671
+ valid: ["open", "pending"],
672
+ invalid: [],
673
+ absent: void 0,
674
+ unresolved: { expression: "acceptedValues" },
675
+ edition1: ["open"]
676
+ },
677
+ referenceType: "readonly SqlListenerFilterScalar[]",
678
+ required: false,
679
+ resolution: "static-required",
680
+ issueCode: "sql_listener_binding_shape",
681
+ description: "Non-empty scalar membership condition.",
682
+ errorMessage: "SQL listener in must contain at least one scalar value."
683
+ },
684
+ "bindings.sqlListeners[].where.*.*.notIn": {
685
+ schema: _typebox.Type.Array(SqlListenerFilterScalarSchema, { minItems: 1 }),
686
+ fixtures: {
687
+ valid: ["closed"],
688
+ invalid: [],
689
+ absent: void 0,
690
+ unresolved: { expression: "rejectedValues" },
691
+ edition1: ["closed"]
692
+ },
693
+ referenceType: "readonly SqlListenerFilterScalar[]",
694
+ required: false,
695
+ resolution: "static-required",
696
+ issueCode: "sql_listener_binding_shape",
697
+ description: "Non-empty scalar exclusion condition.",
698
+ errorMessage: "SQL listener notIn must contain at least one scalar value."
699
+ },
700
+ "bindings.sqlListeners[].where.*.*.isNull": {
701
+ schema: _typebox.Type.Literal(true),
702
+ fixtures: {
703
+ valid: true,
704
+ invalid: false,
705
+ absent: void 0,
706
+ unresolved: { expression: "isNull" },
707
+ edition1: true
708
+ },
709
+ referenceType: "true",
710
+ required: false,
711
+ resolution: "static-required",
712
+ issueCode: "sql_listener_binding_shape",
713
+ description: "Matches null values when set to true.",
714
+ errorMessage: "SQL listener isNull must be the static literal true."
715
+ },
716
+ "bindings.sqlListeners[].where.*.*.isNotNull": {
717
+ schema: _typebox.Type.Literal(true),
718
+ fixtures: {
719
+ valid: true,
720
+ invalid: false,
721
+ absent: void 0,
722
+ unresolved: { expression: "isNotNull" },
723
+ edition1: true
724
+ },
725
+ referenceType: "true",
726
+ required: false,
727
+ resolution: "static-required",
728
+ issueCode: "sql_listener_binding_shape",
729
+ description: "Matches non-null values when set to true.",
730
+ errorMessage: "SQL listener isNotNull must be the static literal true."
731
+ },
732
+ "bindings.sqlListeners[].where.*.*.ilike": {
733
+ schema: _typebox.Type.String(),
734
+ fixtures: {
735
+ valid: "%software%",
736
+ invalid: 1,
737
+ absent: void 0,
738
+ unresolved: { expression: "pattern" },
739
+ edition1: "%software%"
740
+ },
741
+ referenceType: "string",
742
+ required: false,
743
+ resolution: "static-required",
744
+ issueCode: "sql_listener_binding_shape",
745
+ description: "Case-insensitive SQL pattern condition.",
746
+ errorMessage: "SQL listener ilike must be a string pattern."
747
+ },
748
+ "bindings.secrets[]": {
749
+ schema: SecretEnvironmentNameSchema,
750
+ fixtures: {
751
+ valid: "API_TOKEN",
752
+ invalid: "api_token",
753
+ absent: void 0,
754
+ unresolved: { expression: "secret" },
755
+ edition1: "API_TOKEN"
756
+ },
757
+ referenceType: "string",
758
+ required: false,
759
+ resolution: "static-required",
760
+ issueCode: "play_authoring_secret_invalid",
761
+ description: "Environment variable made available to the Play.",
762
+ errorMessage: "bindings.secrets entries must be uppercase environment variable names beginning with a letter."
763
+ },
764
+ "ctx.tools.execute.staleAfterSeconds": {
765
+ schema: _typebox.Type.Union([_typebox.Type.Null(), _typebox.Type.Integer({ minimum: 0 })]),
766
+ fixtures: {
767
+ valid: 0,
768
+ invalid: -1,
769
+ absent: void 0,
770
+ unresolved: { expression: "ttl" },
771
+ edition1: null
772
+ },
773
+ referenceType: "number | null",
774
+ required: false,
775
+ resolution: "runtime-allowed",
776
+ issueCode: "play_authoring_durable_policy_invalid",
777
+ description: EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION,
778
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
779
+ },
780
+ "ctx.tools.execute.id": {
781
+ schema: _typebox.Type.String({ pattern: "\\S" }),
782
+ fixtures: {
783
+ valid: "company-enrichment",
784
+ invalid: "",
785
+ absent: void 0,
786
+ unresolved: { expression: "receiptId" },
787
+ edition1: "company-enrichment"
788
+ },
789
+ referenceType: "string",
790
+ required: true,
791
+ resolution: "runtime-allowed",
792
+ issueCode: "play_authoring_tool_request_invalid",
793
+ description: "Stable durable receipt identity within one execution scope.",
794
+ errorMessage: "ctx.tools.execute id must be a non-empty string."
795
+ },
796
+ "ctx.tools.execute.tool": {
797
+ schema: _typebox.Type.String({ pattern: "\\S" }),
798
+ fixtures: {
799
+ valid: "openmart_enrich_company",
800
+ invalid: "",
801
+ absent: void 0,
802
+ unresolved: { expression: "toolId" },
803
+ edition1: "openmart_enrich_company"
804
+ },
805
+ referenceType: "K",
806
+ required: true,
807
+ resolution: "runtime-allowed",
808
+ issueCode: "play_authoring_tool_request_invalid",
809
+ description: "Integration tool id resolved against the generated ToolMap.",
810
+ errorMessage: "ctx.tools.execute tool must be a non-empty tool id."
811
+ },
812
+ "ctx.tools.execute.input": {
813
+ schema: _typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()),
814
+ fixtures: {
815
+ valid: { domain: "example.com" },
816
+ invalid: "example.com",
817
+ absent: void 0,
818
+ unresolved: "toolInput",
819
+ edition1: {}
820
+ },
821
+ referenceType: "K extends keyof ToolMap ? ToolMap[K]['input'] : Record<string, unknown>",
822
+ required: true,
823
+ resolution: "runtime-allowed",
824
+ issueCode: "play_authoring_tool_request_invalid",
825
+ description: "Tool-specific input object.",
826
+ errorMessage: "ctx.tools.execute input must be an object."
827
+ },
828
+ "ctx.tools.execute.description": {
829
+ schema: _typebox.Type.String(),
830
+ fixtures: {
831
+ valid: "Enrich the company.",
832
+ invalid: 1,
833
+ absent: void 0,
834
+ unresolved: { expression: "description" },
835
+ edition1: "Enrich the company."
836
+ },
837
+ referenceType: "string",
838
+ required: false,
839
+ resolution: "runtime-allowed",
840
+ issueCode: "play_authoring_tool_request_invalid",
841
+ description: "Human-readable purpose of the durable tool call.",
842
+ errorMessage: "ctx.tools.execute description must be a string."
843
+ },
844
+ "ctx.tools.execute.force": {
845
+ schema: _typebox.Type.Boolean(),
846
+ fixtures: {
847
+ valid: true,
848
+ invalid: "true",
849
+ absent: void 0,
850
+ unresolved: { expression: "force" },
851
+ edition1: false
852
+ },
853
+ referenceType: "boolean",
854
+ required: false,
855
+ resolution: "runtime-allowed",
856
+ issueCode: "play_authoring_tool_request_invalid",
857
+ description: "Explicitly bypasses a completed durable tool receipt.",
858
+ errorMessage: "ctx.tools.execute force must be a boolean."
859
+ },
860
+ "ctx.tools.execute.timeoutMs": {
861
+ schema: _typebox.Type.Integer({ minimum: 1 }),
862
+ fixtures: {
863
+ valid: 1,
864
+ invalid: 0,
865
+ absent: void 0,
866
+ unresolved: { expression: "timeout" },
867
+ edition1: 1
868
+ },
869
+ referenceType: "number",
870
+ required: false,
871
+ resolution: "runtime-allowed",
872
+ issueCode: "play_authoring_durable_policy_invalid",
873
+ description: "Positive whole-number runtime transport timeout in milliseconds.",
874
+ errorMessage: "timeoutMs must be a positive whole number of milliseconds."
875
+ },
876
+ "ctx.tools.execute.receiptWaitMs": {
877
+ schema: _typebox.Type.Integer({ minimum: 1 }),
878
+ fixtures: {
879
+ valid: 1,
880
+ invalid: 0,
881
+ absent: void 0,
882
+ unresolved: { expression: "receiptWait" },
883
+ edition1: 1
884
+ },
885
+ referenceType: "number",
886
+ required: false,
887
+ resolution: "runtime-allowed",
888
+ issueCode: "play_authoring_durable_policy_invalid",
889
+ description: "Positive whole-number durable receipt wait budget in milliseconds.",
890
+ errorMessage: "receiptWaitMs must be a positive whole number of milliseconds."
891
+ },
892
+ "ctx.csv.options.description": {
893
+ schema: _typebox.Type.String({ minLength: 1 }),
894
+ fixtures: {
895
+ valid: "Load account rows.",
896
+ invalid: "",
897
+ absent: void 0,
898
+ unresolved: { expression: "description" },
899
+ edition1: "Load rows."
900
+ },
901
+ referenceType: "string",
902
+ required: false,
903
+ resolution: "static-when-present",
904
+ issueCode: "play_authoring_csv_option_invalid",
905
+ description: "Non-empty description for a staged CSV load.",
906
+ errorMessage: "ctx.csv options.description must be non-empty."
907
+ },
908
+ "ctx.csv.options.columns": {
909
+ schema: _typebox.Type.Record(
910
+ _typebox.Type.String(),
911
+ _typebox.Type.Union([
912
+ _typebox.Type.String({ minLength: 1 }),
913
+ _typebox.Type.Array(_typebox.Type.String({ minLength: 1 }), { minItems: 1 })
914
+ ])
915
+ ),
916
+ fixtures: {
917
+ valid: { domain: ["domain", "Company Domain"] },
918
+ invalid: { domain: [] },
919
+ absent: void 0,
920
+ unresolved: { expression: { dynamic: true } },
921
+ edition1: { domain: "domain" }
922
+ },
923
+ referenceType: "CsvRenameMap",
924
+ required: false,
925
+ resolution: "runtime-allowed",
926
+ issueCode: "play_authoring_csv_option_invalid",
927
+ description: "Canonical field-to-header aliases for a staged CSV.",
928
+ errorMessage: "ctx.csv options.columns values must be a non-empty header or alias list."
929
+ },
930
+ "ctx.csv.options.rename": {
931
+ schema: _typebox.Type.Record(
932
+ _typebox.Type.String(),
933
+ _typebox.Type.Union([
934
+ _typebox.Type.String({ minLength: 1 }),
935
+ _typebox.Type.Array(_typebox.Type.String({ minLength: 1 }), { minItems: 1 })
936
+ ])
937
+ ),
938
+ fixtures: {
939
+ valid: { domain: "Company Domain" },
940
+ invalid: { domain: "" },
941
+ absent: void 0,
942
+ unresolved: { expression: { dynamic: true } },
943
+ edition1: { domain: "domain" }
944
+ },
945
+ referenceType: "CsvRenameMap",
946
+ required: false,
947
+ resolution: "static-when-present",
948
+ issueCode: "play_authoring_csv_option_invalid",
949
+ description: "Legacy header rename aliases for a staged CSV.",
950
+ errorMessage: "ctx.csv options.rename values must be a non-empty header or alias list."
951
+ },
952
+ "ctx.csv.options.required": {
953
+ schema: _typebox.Type.Array(_typebox.Type.String({ minLength: 1 })),
954
+ fixtures: {
955
+ valid: ["domain"],
956
+ invalid: [""],
957
+ absent: void 0,
958
+ unresolved: { expression: "requiredColumns" },
959
+ edition1: []
960
+ },
961
+ referenceType: "readonly string[]",
962
+ required: false,
963
+ resolution: "static-when-present",
964
+ issueCode: "play_authoring_csv_option_invalid",
965
+ description: "Canonical columns required after CSV normalization.",
966
+ errorMessage: "ctx.csv options.required entries must be non-empty column names."
967
+ },
968
+ "ctx.dataset.key": {
969
+ schema: _typebox.Type.String({ minLength: 1 }),
970
+ fixtures: {
971
+ valid: "accounts",
972
+ invalid: "",
973
+ absent: void 0,
974
+ unresolved: { expression: "datasetKey" },
975
+ edition1: "rows"
976
+ },
977
+ referenceType: "string",
978
+ required: true,
979
+ resolution: "static-required",
980
+ issueCode: "play_authoring_dataset_option_invalid",
981
+ description: "Stable durable identity for one dataset.",
982
+ errorMessage: "ctx.dataset key must be a non-empty static string."
983
+ },
984
+ "ctx.dataset.run.description": {
985
+ schema: _typebox.Type.String({ minLength: 1 }),
986
+ fixtures: {
987
+ valid: "Enrich account rows.",
988
+ invalid: "",
989
+ absent: void 0,
990
+ unresolved: { expression: "description" },
991
+ edition1: "Process rows."
992
+ },
993
+ referenceType: "string",
994
+ required: false,
995
+ resolution: "static-when-present",
996
+ issueCode: "play_authoring_dataset_option_invalid",
997
+ description: "Non-empty description for one dataset execution.",
998
+ errorMessage: "ctx.dataset run description must be non-empty."
999
+ },
1000
+ "ctx.dataset.run.key": {
1001
+ schema: _typebox.Type.Union([
1002
+ _typebox.Type.String({ minLength: 1 }),
1003
+ _typebox.Type.Array(_typebox.Type.String({ minLength: 1 }), { minItems: 1 }),
1004
+ _typebox.Type.Function(
1005
+ [_typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()), _typebox.Type.Integer()],
1006
+ _typebox.Type.Union([
1007
+ _typebox.Type.String(),
1008
+ _typebox.Type.Number(),
1009
+ _typebox.Type.Readonly(_typebox.Type.Array(_typebox.Type.Unknown()))
1010
+ ])
1011
+ )
1012
+ ]),
1013
+ fixtures: {
1014
+ valid: (row) => String(row.domain),
1015
+ invalid: [],
1016
+ absent: void 0,
1017
+ unresolved: { expression: "rowKey" },
1018
+ edition1: ["domain"]
1019
+ },
1020
+ referenceType: "DatasetRowKey<InputRow>",
1021
+ required: false,
1022
+ resolution: "runtime-dynamic",
1023
+ issueCode: "play_authoring_dataset_option_invalid",
1024
+ description: "Stable field or fields used for durable row identity.",
1025
+ errorMessage: "ctx.dataset run key must be a non-empty field, field list, or key function."
1026
+ },
1027
+ "ctx.dataset.run.rowIdentity": {
1028
+ schema: _typebox.Type.Union([_typebox.Type.Literal("source_row"), _typebox.Type.Literal("key")]),
1029
+ fixtures: {
1030
+ valid: "source_row",
1031
+ invalid: "dedupe",
1032
+ absent: void 0,
1033
+ unresolved: { expression: "rowIdentity" },
1034
+ edition1: "key"
1035
+ },
1036
+ referenceType: "'source_row' | 'key'",
1037
+ required: false,
1038
+ resolution: "static-when-present",
1039
+ issueCode: "play_authoring_dataset_option_invalid",
1040
+ description: 'Edition 11 requires explicit freshness and semantic identity for supported durable calls. CSV inputs always use source-row occurrence identity, even with rowIdentity: "key"; key-based dedup remains available for non-CSV inputs and editions 1\u201310.',
1041
+ errorMessage: 'ctx.dataset run rowIdentity must be "source_row" or "key".'
1042
+ },
1043
+ "ctx.dataset.run.onRowError": {
1044
+ schema: _typebox.Type.Union([_typebox.Type.Literal("isolate"), _typebox.Type.Literal("fail")]),
1045
+ fixtures: {
1046
+ valid: "isolate",
1047
+ invalid: "continue",
1048
+ absent: void 0,
1049
+ unresolved: { expression: "rowErrorPolicy" },
1050
+ edition1: "fail"
1051
+ },
1052
+ referenceType: "'isolate' | 'fail'",
1053
+ required: false,
1054
+ resolution: "static-when-present",
1055
+ issueCode: "play_authoring_dataset_option_invalid",
1056
+ description: "Whether row failures isolate or fail the whole dataset.",
1057
+ errorMessage: 'ctx.dataset run onRowError must be "isolate" or "fail".'
1058
+ },
1059
+ "ctx.dataset.run.mode": {
1060
+ schema: _typebox.Type.Union([_typebox.Type.Literal("upsert"), _typebox.Type.Literal("net_new")]),
1061
+ fixtures: {
1062
+ valid: "upsert",
1063
+ invalid: "append",
1064
+ absent: void 0,
1065
+ unresolved: { expression: "datasetMode" },
1066
+ edition1: "upsert"
1067
+ },
1068
+ referenceType: "'upsert' | 'net_new'",
1069
+ required: false,
1070
+ resolution: "static-when-present",
1071
+ issueCode: "play_authoring_dataset_option_invalid",
1072
+ description: "Whether the dataset returns all rows or only newly admitted rows.",
1073
+ errorMessage: 'ctx.dataset run mode must be "upsert" or "net_new".'
1074
+ },
1075
+ "ctx.dataset.run.undrawnColumns": {
1076
+ schema: _typebox.Type.Array(_typebox.Type.String({ minLength: 1 }), { minItems: 1 }),
1077
+ fixtures: {
1078
+ valid: ["miss_reason"],
1079
+ invalid: [],
1080
+ absent: void 0,
1081
+ unresolved: { expression: "undrawnColumns" },
1082
+ edition1: ["miss_reason"]
1083
+ },
1084
+ referenceType: "readonly string[]",
1085
+ required: false,
1086
+ resolution: "static-when-present",
1087
+ issueCode: "play_authoring_dataset_option_invalid",
1088
+ description: "Computed columns deliberately left out of the authored @mermaid diagram.",
1089
+ errorMessage: "ctx.dataset run undrawnColumns must be a non-empty array of static column-name strings."
1090
+ },
1091
+ "ctx.step.id": {
1092
+ schema: _typebox.Type.String({ minLength: 1 }),
1093
+ fixtures: {
1094
+ valid: "load-settings",
1095
+ invalid: "",
1096
+ absent: void 0,
1097
+ unresolved: { expression: "stepId" },
1098
+ edition1: "step"
1099
+ },
1100
+ referenceType: "string",
1101
+ required: true,
1102
+ resolution: "static-required",
1103
+ issueCode: "play_authoring_step_option_invalid",
1104
+ description: "Stable durable identity for one scalar checkpoint.",
1105
+ errorMessage: "ctx.step id must be a non-empty static string."
1106
+ },
1107
+ "ctx.step.semanticKey": {
1108
+ schema: _typebox.Type.String({ minLength: 1 }),
1109
+ fixtures: {
1110
+ valid: "account:stripe.com",
1111
+ invalid: "",
1112
+ absent: void 0,
1113
+ unresolved: { expression: "semanticKey" },
1114
+ edition1: "account"
1115
+ },
1116
+ referenceType: "string",
1117
+ required: false,
1118
+ resolution: "runtime-dynamic",
1119
+ issueCode: "play_authoring_step_option_invalid",
1120
+ description: "Optional semantic receipt identity for a scalar checkpoint.",
1121
+ errorMessage: "ctx.step semanticKey must be a non-empty string."
1122
+ },
1123
+ "ctx.step.staleAfterSeconds": {
1124
+ schema: _typebox.Type.Union([_typebox.Type.Null(), _typebox.Type.Integer({ minimum: 0 })]),
1125
+ fixtures: {
1126
+ valid: 0,
1127
+ invalid: -1,
1128
+ absent: void 0,
1129
+ unresolved: { expression: "ttl" },
1130
+ edition1: null
1131
+ },
1132
+ referenceType: "number | null",
1133
+ required: false,
1134
+ resolution: "runtime-dynamic",
1135
+ issueCode: "play_authoring_durable_policy_invalid",
1136
+ description: EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION,
1137
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
1138
+ },
1139
+ "ctx.fetch.key": {
1140
+ schema: _typebox.Type.String({ minLength: 1 }),
1141
+ fixtures: {
1142
+ valid: "notify-crm",
1143
+ invalid: "",
1144
+ absent: void 0,
1145
+ unresolved: { expression: "fetchKey" },
1146
+ edition1: "fetch"
1147
+ },
1148
+ referenceType: "string",
1149
+ required: true,
1150
+ resolution: "static-required",
1151
+ issueCode: "play_authoring_durable_policy_invalid",
1152
+ description: "Stable durable identity for one external HTTP request.",
1153
+ errorMessage: "ctx.fetch key must be a non-empty static string.",
1154
+ unresolvedHint: PLAY_AUTHORING_STATIC_FETCH_KEY_HINT
1155
+ },
1156
+ "ctx.fetch.staleAfterSeconds": {
1157
+ schema: _typebox.Type.Union([_typebox.Type.Null(), _typebox.Type.Integer({ minimum: 0 })]),
1158
+ fixtures: {
1159
+ valid: null,
1160
+ invalid: 1.5,
1161
+ absent: void 0,
1162
+ unresolved: { expression: "ttl" },
1163
+ edition1: 0
1164
+ },
1165
+ referenceType: "number | null",
1166
+ required: false,
1167
+ resolution: "runtime-dynamic",
1168
+ issueCode: "play_authoring_durable_policy_invalid",
1169
+ description: EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION,
1170
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
1171
+ },
1172
+ "ctx.runPlay.key": {
1173
+ schema: _typebox.Type.String({ minLength: 1 }),
1174
+ fixtures: {
1175
+ valid: "enrich-company",
1176
+ invalid: "",
1177
+ absent: void 0,
1178
+ unresolved: { expression: "callKey" },
1179
+ edition1: "child"
1180
+ },
1181
+ referenceType: "string",
1182
+ required: true,
1183
+ resolution: "runtime-dynamic",
1184
+ issueCode: "play_authoring_run_play_option_invalid",
1185
+ description: "Stable identity for one inline child Play call.",
1186
+ errorMessage: "ctx.runPlay key must be a non-empty string."
1187
+ },
1188
+ "ctx.runPlay.playRef": {
1189
+ schema: _typebox.Type.Union([
1190
+ _typebox.Type.String({ minLength: 1 }),
1191
+ _typebox.Type.Union([
1192
+ _typebox.Type.Object(
1193
+ { playName: _typebox.Type.String({ minLength: 1 }) },
1194
+ { additionalProperties: true }
1195
+ ),
1196
+ _typebox.Type.Object(
1197
+ { name: _typebox.Type.String({ minLength: 1 }) },
1198
+ { additionalProperties: true }
1199
+ )
1200
+ ])
1201
+ ]),
1202
+ fixtures: {
1203
+ valid: "prebuilt/company-lookup",
1204
+ invalid: {},
1205
+ absent: void 0,
1206
+ unresolved: { expression: "playRef" },
1207
+ edition1: { name: "company-lookup" }
1208
+ },
1209
+ referenceType: "string | PlayReferenceLike",
1210
+ required: true,
1211
+ resolution: "runtime-dynamic",
1212
+ issueCode: "play_authoring_run_play_option_invalid",
1213
+ description: "Child Play name or typed Play definition handle.",
1214
+ errorMessage: "ctx.runPlay playRef must be a non-empty Play name or definition handle."
1215
+ },
1216
+ "ctx.runPlay.input": {
1217
+ schema: _typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()),
1218
+ fixtures: {
1219
+ valid: { domain: "example.com" },
1220
+ invalid: "example.com",
1221
+ absent: void 0,
1222
+ unresolved: "childInput",
1223
+ edition1: {}
1224
+ },
1225
+ referenceType: "Record<string, unknown>",
1226
+ required: true,
1227
+ resolution: "runtime-dynamic",
1228
+ issueCode: "play_authoring_run_play_option_invalid",
1229
+ description: "Scalar input object submitted to the child Play.",
1230
+ errorMessage: "ctx.runPlay input must be an object."
1231
+ },
1232
+ "ctx.runPlay.options.description": {
1233
+ schema: _typebox.Type.String({ minLength: 1 }),
1234
+ fixtures: {
1235
+ valid: "Enrich the company.",
1236
+ invalid: "",
1237
+ absent: void 0,
1238
+ unresolved: { expression: "description" },
1239
+ edition1: "Run child."
1240
+ },
1241
+ referenceType: "string",
1242
+ required: true,
1243
+ resolution: "runtime-dynamic",
1244
+ issueCode: "play_authoring_run_play_option_invalid",
1245
+ description: "Non-empty purpose for one inline child Play call.",
1246
+ errorMessage: "ctx.runPlay options.description must be non-empty."
1247
+ },
1248
+ "ctx.runPlay.options.execution": {
1249
+ schema: _typebox.Type.Literal("inline"),
1250
+ fixtures: {
1251
+ valid: "inline",
1252
+ invalid: "child-workflow",
1253
+ absent: void 0,
1254
+ unresolved: { expression: "execution" },
1255
+ edition1: "inline"
1256
+ },
1257
+ referenceType: "'inline'",
1258
+ required: false,
1259
+ resolution: "static-required",
1260
+ issueCode: "play_authoring_run_play_option_invalid",
1261
+ description: "Child composition strategy. Only inline is supported.",
1262
+ errorMessage: 'ctx.runPlay execution must be "inline".'
1263
+ },
1264
+ "ctx.runPlay.options.timeoutMs": {
1265
+ schema: _typebox.Type.Undefined(),
1266
+ fixtures: {
1267
+ valid: void 0,
1268
+ invalid: 1e3,
1269
+ absent: void 0,
1270
+ unresolved: { expression: "timeoutMs" },
1271
+ edition1: void 0
1272
+ },
1273
+ referenceType: "never",
1274
+ required: false,
1275
+ resolution: "unsupported",
1276
+ issueCode: "play_authoring_run_play_option_invalid",
1277
+ description: "Unsupported legacy child-workflow timeout.",
1278
+ errorMessage: "ctx.runPlay timeoutMs is unsupported because child Plays execute inline."
1279
+ },
1280
+ "ctx.runPlayAsync.key": {
1281
+ schema: _typebox.Type.String({ minLength: 1 }),
1282
+ fixtures: {
1283
+ valid: "request-approval",
1284
+ invalid: "",
1285
+ absent: void 0,
1286
+ unresolved: { expression: "callKey" },
1287
+ edition1: "request-approval"
1288
+ },
1289
+ referenceType: "string",
1290
+ required: true,
1291
+ resolution: "runtime-dynamic",
1292
+ issueCode: "play_authoring_run_play_option_invalid",
1293
+ description: "Stable identity for one independent child Play Run.",
1294
+ errorMessage: "ctx.runPlayAsync key must be a non-empty string."
1295
+ },
1296
+ "ctx.runPlayAsync.playRef": {
1297
+ schema: _typebox.Type.Union([
1298
+ _typebox.Type.String({ minLength: 1 }),
1299
+ _typebox.Type.Union([
1300
+ _typebox.Type.Object(
1301
+ { playName: _typebox.Type.String({ minLength: 1 }) },
1302
+ { additionalProperties: true }
1303
+ ),
1304
+ _typebox.Type.Object(
1305
+ { name: _typebox.Type.String({ minLength: 1 }) },
1306
+ { additionalProperties: true }
1307
+ )
1308
+ ])
1309
+ ]),
1310
+ fixtures: {
1311
+ valid: "request-approval",
1312
+ invalid: {},
1313
+ absent: void 0,
1314
+ unresolved: { expression: "playRef" },
1315
+ edition1: "request-approval"
1316
+ },
1317
+ referenceType: "string | PlayReferenceLike",
1318
+ required: true,
1319
+ resolution: "runtime-dynamic",
1320
+ issueCode: "play_authoring_run_play_option_invalid",
1321
+ description: "Independently published scalar child Play name or strongly typed definition handle.",
1322
+ errorMessage: "ctx.runPlayAsync playRef must be a non-empty Play name or definition handle."
1323
+ },
1324
+ "ctx.runPlayAsync.input": {
1325
+ schema: _typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()),
1326
+ fixtures: {
1327
+ valid: { draftId: "draft-1" },
1328
+ invalid: "draft-1",
1329
+ absent: void 0,
1330
+ unresolved: "childInput",
1331
+ edition1: {}
1332
+ },
1333
+ referenceType: "Record<string, unknown>",
1334
+ required: true,
1335
+ resolution: "runtime-dynamic",
1336
+ issueCode: "play_authoring_run_play_option_invalid",
1337
+ description: "Scalar input object submitted to the independent child Run.",
1338
+ errorMessage: "ctx.runPlayAsync input must be an object."
1339
+ },
1340
+ "ctx.runPlayAsync.options.description": {
1341
+ schema: _typebox.Type.String({ minLength: 1 }),
1342
+ fixtures: {
1343
+ valid: "Request approval.",
1344
+ invalid: "",
1345
+ absent: void 0,
1346
+ unresolved: { expression: "description" },
1347
+ edition1: "Request approval."
1348
+ },
1349
+ referenceType: "string",
1350
+ required: true,
1351
+ resolution: "runtime-dynamic",
1352
+ issueCode: "play_authoring_run_play_option_invalid",
1353
+ description: "Non-empty purpose for one independent child Play Run.",
1354
+ errorMessage: "ctx.runPlayAsync options.description must be non-empty."
1355
+ },
1356
+ "runtime.timeout": {
1357
+ schema: _typebox.Type.String({ pattern: "^\\d+\\s*[mh]$" }),
1358
+ fixtures: {
1359
+ valid: "90m",
1360
+ invalid: "90s",
1361
+ absent: void 0,
1362
+ unresolved: { expression: "timeout" },
1363
+ edition1: "90m"
1364
+ },
1365
+ referenceType: "string",
1366
+ required: false,
1367
+ resolution: "static-required",
1368
+ issueCode: "play_authoring_binding_invalid",
1369
+ description: "Play-level sandbox deadline. The default is 30m; use a static duration such as 90m or 2h, up to 4h.",
1370
+ errorMessage: 'runtime.timeout must be a static duration such as "90m" or "2h".'
1371
+ },
1372
+ "runtime.size": {
1373
+ schema: _typebox.Type.Literal("standard"),
1374
+ fixtures: {
1375
+ valid: "standard",
1376
+ invalid: "large",
1377
+ absent: void 0,
1378
+ unresolved: { expression: "size" },
1379
+ edition1: "standard"
1380
+ },
1381
+ referenceType: "'standard'",
1382
+ required: false,
1383
+ resolution: "static-required",
1384
+ issueCode: "play_authoring_binding_invalid",
1385
+ description: "Deepline-managed sandbox size. Only standard is supported.",
1386
+ errorMessage: 'runtime.size must be the static literal "standard".'
1387
+ },
1388
+ "ctx.customerDb.query.statement": {
1389
+ schema: _typebox.Type.Union([
1390
+ _typebox.Type.String({ minLength: 1 }),
1391
+ _typebox.Type.Object(
1392
+ {
1393
+ kind: _typebox.Type.Optional(_typebox.Type.Literal("sql.query")),
1394
+ text: _typebox.Type.String({ minLength: 1 }),
1395
+ values: _typebox.Type.Optional(_typebox.Type.Array(_typebox.Type.Unknown(), { maxItems: 0 }))
1396
+ },
1397
+ { additionalProperties: false }
1398
+ )
1399
+ ]),
1400
+ fixtures: {
1401
+ valid: { kind: "sql.query", text: "select 1", values: [] },
1402
+ invalid: { kind: "sql.query", text: "select $1", values: [1] },
1403
+ absent: void 0,
1404
+ unresolved: { expression: "statement" },
1405
+ edition1: "select 1"
1406
+ },
1407
+ referenceType: "SqlQuery",
1408
+ required: true,
1409
+ resolution: "runtime-dynamic",
1410
+ issueCode: "play_authoring_tool_request_invalid",
1411
+ description: "One non-empty Customer DB SQL string; the deprecated SqlQuery object is accepted only without parameter values.",
1412
+ errorMessage: "ctx.customerDb.query statement must be a non-empty SQL string. Deprecated SqlQuery objects cannot contain parameter values."
1413
+ },
1414
+ "ctx.customerDb.query.options.id": {
1415
+ schema: _typebox.Type.String({ pattern: "\\S" }),
1416
+ fixtures: {
1417
+ valid: "customer-report-read",
1418
+ invalid: "",
1419
+ absent: void 0,
1420
+ unresolved: { expression: "operationId" },
1421
+ edition1: "query"
1422
+ },
1423
+ referenceType: "string",
1424
+ required: true,
1425
+ resolution: "runtime-dynamic",
1426
+ issueCode: "play_authoring_tool_request_invalid",
1427
+ description: "Stable operation identity for Customer DB query recovery.",
1428
+ errorMessage: "ctx.customerDb.query options.id must be a non-empty stable string."
1429
+ },
1430
+ "ctx.customerDb.query.options.staleAfterSeconds": {
1431
+ schema: _typebox.Type.Literal(0),
1432
+ fixtures: {
1433
+ valid: 0,
1434
+ invalid: 1,
1435
+ absent: void 0,
1436
+ unresolved: { expression: "ttl" },
1437
+ edition1: 0
1438
+ },
1439
+ referenceType: "number | null",
1440
+ required: false,
1441
+ resolution: "runtime-dynamic",
1442
+ issueCode: "play_authoring_durable_policy_invalid",
1443
+ description: "Customer DB queries always execute with freshness 0.",
1444
+ errorMessage: "Customer DB queries must use staleAfterSeconds: 0."
1445
+ },
1446
+ "ctx.customerDb.query.options.maxRows": {
1447
+ schema: _typebox.Type.Integer({ minimum: 1 }),
1448
+ fixtures: {
1449
+ valid: 100,
1450
+ invalid: 0,
1451
+ absent: void 0,
1452
+ unresolved: { expression: "maxRows" },
1453
+ edition1: 100
1454
+ },
1455
+ referenceType: "number",
1456
+ required: false,
1457
+ resolution: "runtime-dynamic",
1458
+ issueCode: "play_authoring_tool_request_invalid",
1459
+ description: "Positive whole-number Customer DB response row limit.",
1460
+ errorMessage: "ctx.customerDb.query options.maxRows must be a positive whole number."
1461
+ },
1462
+ "ctx.customerDb.query.options.timeoutMs": {
1463
+ schema: _typebox.Type.Integer({ minimum: 1 }),
1464
+ fixtures: {
1465
+ valid: 1e3,
1466
+ invalid: 0,
1467
+ absent: void 0,
1468
+ unresolved: { expression: "timeoutMs" },
1469
+ edition1: 1e3
1470
+ },
1471
+ referenceType: "number",
1472
+ required: false,
1473
+ resolution: "runtime-dynamic",
1474
+ issueCode: "play_authoring_durable_policy_invalid",
1475
+ description: "Positive whole-number Customer DB timeout in milliseconds.",
1476
+ errorMessage: "ctx.customerDb.query options.timeoutMs must be a positive whole number of milliseconds."
1477
+ },
1478
+ "ctx.tool.key": {
1479
+ schema: _typebox.Type.String({ minLength: 1 }),
1480
+ fixtures: {
1481
+ valid: "company",
1482
+ invalid: "",
1483
+ absent: void 0,
1484
+ unresolved: { expression: "key" },
1485
+ edition1: "tool"
1486
+ },
1487
+ referenceType: "string",
1488
+ required: true,
1489
+ resolution: "runtime-dynamic",
1490
+ issueCode: "play_authoring_tool_request_invalid",
1491
+ description: "Stable receipt identity for the tool shorthand.",
1492
+ errorMessage: "ctx.tool key must be a non-empty string."
1493
+ },
1494
+ "ctx.tool.tool": {
1495
+ schema: _typebox.Type.String({ minLength: 1 }),
1496
+ fixtures: {
1497
+ valid: "openmart_enrich_company",
1498
+ invalid: "",
1499
+ absent: void 0,
1500
+ unresolved: { expression: "tool" },
1501
+ edition1: "openmart_enrich_company"
1502
+ },
1503
+ referenceType: "string",
1504
+ required: true,
1505
+ resolution: "runtime-dynamic",
1506
+ issueCode: "play_authoring_tool_request_invalid",
1507
+ description: "Integration tool id for the tool shorthand.",
1508
+ errorMessage: "ctx.tool tool must be a non-empty tool id."
1509
+ },
1510
+ "ctx.tool.input": {
1511
+ schema: _typebox.Type.Record(_typebox.Type.String(), _typebox.Type.Unknown()),
1512
+ fixtures: {
1513
+ valid: { domain: "example.com" },
1514
+ invalid: "example.com",
1515
+ absent: void 0,
1516
+ unresolved: "toolInput",
1517
+ edition1: {}
1518
+ },
1519
+ referenceType: "Record<string, unknown>",
1520
+ required: true,
1521
+ resolution: "runtime-dynamic",
1522
+ issueCode: "play_authoring_tool_request_invalid",
1523
+ description: "Tool-specific input object for the shorthand.",
1524
+ errorMessage: "ctx.tool input must be an object."
1525
+ },
1526
+ "ctx.tool.options.description": {
1527
+ schema: _typebox.Type.String({ minLength: 1 }),
1528
+ fixtures: {
1529
+ valid: "Enrich the company.",
1530
+ invalid: "",
1531
+ absent: void 0,
1532
+ unresolved: { expression: "description" },
1533
+ edition1: "Run tool."
1534
+ },
1535
+ referenceType: "string",
1536
+ required: false,
1537
+ resolution: "runtime-dynamic",
1538
+ issueCode: "play_authoring_tool_request_invalid",
1539
+ description: "Non-empty purpose for the tool shorthand.",
1540
+ errorMessage: "ctx.tool options.description must be non-empty."
1541
+ },
1542
+ "ctx.runSteps.options.description": {
1543
+ schema: _typebox.Type.String({ minLength: 1 }),
1544
+ fixtures: {
1545
+ valid: "Score the account.",
1546
+ invalid: "",
1547
+ absent: void 0,
1548
+ unresolved: { expression: "description" },
1549
+ edition1: "Run steps."
1550
+ },
1551
+ referenceType: "string",
1552
+ required: false,
1553
+ resolution: "runtime-dynamic",
1554
+ issueCode: "play_authoring_step_option_invalid",
1555
+ description: "Non-empty purpose for a reusable step program.",
1556
+ errorMessage: "ctx.runSteps options.description must be non-empty."
1557
+ },
1558
+ "ctx.runSteps.options.staleAfterSeconds": {
1559
+ schema: _typebox.Type.Union([_typebox.Type.Null(), _typebox.Type.Integer({ minimum: 0 })]),
1560
+ fixtures: {
1561
+ valid: 0,
1562
+ invalid: -1,
1563
+ absent: void 0,
1564
+ unresolved: { expression: "ttl" },
1565
+ edition1: null
1566
+ },
1567
+ referenceType: "number | null",
1568
+ required: false,
1569
+ resolution: "runtime-dynamic",
1570
+ issueCode: "play_authoring_durable_policy_invalid",
1571
+ description: EXPLICIT_FRESHNESS_STALE_AFTER_SECONDS_DESCRIPTION,
1572
+ errorMessage: "staleAfterSeconds must be null, 0 (always execute), or a positive whole number of seconds."
1573
+ },
1574
+ "ctx.sleep.ms": {
1575
+ schema: _typebox.Type.Integer({ minimum: 0 }),
1576
+ fixtures: {
1577
+ valid: 0,
1578
+ invalid: -1,
1579
+ absent: void 0,
1580
+ unresolved: { expression: "delayMs" },
1581
+ edition1: 1e3
1582
+ },
1583
+ referenceType: "number",
1584
+ required: true,
1585
+ resolution: "runtime-dynamic",
1586
+ issueCode: "play_authoring_step_option_invalid",
1587
+ description: "Non-negative whole-number sleep duration in milliseconds.",
1588
+ errorMessage: "ctx.sleep ms must be a non-negative whole number."
1589
+ },
1590
+ "ctx.fetch.url": {
1591
+ schema: _typebox.Type.String({ minLength: 1 }),
1592
+ fixtures: {
1593
+ valid: "https://example.com",
1594
+ invalid: "",
1595
+ absent: void 0,
1596
+ unresolved: { expression: "url" },
1597
+ edition1: "https://example.com"
1598
+ },
1599
+ referenceType: "string",
1600
+ required: true,
1601
+ resolution: "runtime-allowed",
1602
+ issueCode: "play_authoring_fetch_secret_requires_tls",
1603
+ description: "HTTP request URL. Secret authentication requires HTTPS.",
1604
+ errorMessage: "ctx.fetch URL must be a non-empty URL string."
1605
+ },
1606
+ "ctx.fetch.init.method": {
1607
+ schema: _typebox.Type.String({ minLength: 1 }),
1608
+ fixtures: {
1609
+ valid: "GET",
1610
+ invalid: "",
1611
+ absent: void 0,
1612
+ unresolved: { expression: "method" },
1613
+ edition1: "GET"
1614
+ },
1615
+ referenceType: "string",
1616
+ required: false,
1617
+ resolution: "runtime-allowed",
1618
+ issueCode: "play_authoring_fetch_idempotency_required",
1619
+ description: "HTTP method. Mutating methods require an Idempotency-Key.",
1620
+ errorMessage: "ctx.fetch method must be a non-empty string."
1621
+ },
1622
+ "ctx.fetch.init.headers.Idempotency-Key": {
1623
+ schema: _typebox.Type.String({ minLength: 1 }),
1624
+ fixtures: {
1625
+ valid: "contact-123-update",
1626
+ invalid: "",
1627
+ absent: void 0,
1628
+ unresolved: { expression: "idempotencyKey" },
1629
+ edition1: "contact-123-update"
1630
+ },
1631
+ referenceType: "string",
1632
+ required: false,
1633
+ resolution: "runtime-allowed",
1634
+ issueCode: "play_authoring_fetch_idempotency_required",
1635
+ description: "Required for mutating HTTP methods. The provider must support idempotency, and the same key must be retained across retries and replay.",
1636
+ errorMessage: "Idempotency-Key must be a non-empty string when provided."
1637
+ }
1638
+ };
1639
+ var UnsupportedPlayAuthoringContractEditionError = class extends Error {
1640
+ constructor(value) {
1641
+ super(
1642
+ `Unsupported Play authoring contract edition ${String(value)}. Supported editions: ${SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS.join(", ")}.`
1643
+ );
1644
+ this.name = "UnsupportedPlayAuthoringContractEditionError";
1645
+ }
1646
+ };
1647
+ var PlayAuthoringContractViolationError = class extends Error {
1648
+ constructor(path, code, detail, hint) {
1649
+ super(`[${code} path=${path}] ${detail}`);
1650
+ this.path = path;
1651
+ this.code = code;
1652
+ this.detail = detail;
1653
+ this.hint = hint;
1654
+ this.name = "PlayAuthoringContractViolationError";
1655
+ }
1656
+ };
1657
+ var PlayAuthoringFieldValidationError = class extends PlayAuthoringContractViolationError {
1658
+ constructor(path, code, message) {
1659
+ super(path, code, message);
1660
+ this.name = "PlayAuthoringFieldValidationError";
1661
+ }
1662
+ };
1663
+ function normalizePlayAuthoringContractEdition(value) {
1664
+ const edition = _nullishCoalesce(value, () => ( LEGACY_PLAY_AUTHORING_CONTRACT_EDITION));
1665
+ if (!SUPPORTED_PLAY_AUTHORING_CONTRACT_EDITIONS.includes(
1666
+ edition
1667
+ )) {
1668
+ throw new UnsupportedPlayAuthoringContractEditionError(edition);
1669
+ }
1670
+ return edition;
1671
+ }
1672
+ function validatePlayAuthoringField(path, value) {
1673
+ const definition = PLAY_AUTHORING_FIELD_REGISTRY[path];
1674
+ if (_value.Value.Check(definition.schema, value)) return;
1675
+ throw new PlayAuthoringFieldValidationError(
1676
+ path,
1677
+ definition.issueCode,
1678
+ definition.errorMessage
1679
+ );
1680
+ }
1681
+ function cloudReferenceType(path) {
1682
+ return PLAY_AUTHORING_FIELD_REGISTRY[path].referenceType;
1683
+ }
1684
+ var PLAY_AUTHORING_CLOUD_TYPE_DECLARATIONS = [
1685
+ `export type DurableCallStaleAfterSeconds = ${cloudReferenceType("ctx.tools.execute.staleAfterSeconds")};`,
1686
+ `export type PlayRuntimeTimeoutMs = ${cloudReferenceType("ctx.tools.execute.timeoutMs")};`,
1687
+ `export type PlayReceiptWaitMs = ${cloudReferenceType("ctx.tools.execute.receiptWaitMs")};`,
1688
+ `export type SqlListenerOperation = ${cloudReferenceType("bindings.sqlListeners[].operations[]")};`,
1689
+ "export type SqlListenerFilterScalar = string | number | boolean | null;",
1690
+ `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")} };`,
1691
+ `export type SqlListenerWhere = { before?: ${cloudReferenceType("bindings.sqlListeners[].where.before")}; after?: ${cloudReferenceType("bindings.sqlListeners[].where.after")} };`,
1692
+ `export type SqlListenerDeclaration = { id: ${cloudReferenceType("bindings.sqlListeners[].id")}; tool: ${cloudReferenceType("bindings.sqlListeners[].tool")}; stream: ${cloudReferenceType("bindings.sqlListeners[].stream")}; operations?: readonly SqlListenerOperation[]; where?: SqlListenerWhere };`,
1693
+ "export type SqlListenerEvent<T extends object = Record<string, unknown>> = { tool: string; stream: string; operation: SqlListenerOperation; before: T | null; after: T | null; changedAt: string; metadata: { outboxId: string; listenerId: string; table: string } };",
1694
+ "export type SqlQuery = string | { kind?: 'sql.query'; text: string; values?: readonly unknown[] };",
1695
+ "export type ToolExecutionRequest<K extends string> = {",
1696
+ ` readonly id: ${cloudReferenceType("ctx.tools.execute.id")};`,
1697
+ ` readonly tool: ${cloudReferenceType("ctx.tools.execute.tool")};`,
1698
+ ` readonly input: ${cloudReferenceType("ctx.tools.execute.input")};`,
1699
+ ` readonly description?: ${cloudReferenceType("ctx.tools.execute.description")};`,
1700
+ ` readonly force?: ${cloudReferenceType("ctx.tools.execute.force")};`,
1701
+ " readonly staleAfterSeconds?: DurableCallStaleAfterSeconds;",
1702
+ " readonly timeoutMs?: PlayRuntimeTimeoutMs;",
1703
+ " readonly receiptWaitMs?: PlayReceiptWaitMs;",
1704
+ "};",
1705
+ "export type PlayCronInput<TInput> = TInput extends readonly unknown[] ? never : TInput extends object ? TInput : never;",
1706
+ "export type PlayBindings<TInput = Record<string, unknown>> = {",
1707
+ ` displayName?: ${cloudReferenceType("displayName")};`,
1708
+ ` description?: ${cloudReferenceType("description")};`,
1709
+ ` compatibility?: { authoringContract?: ${cloudReferenceType("compatibility.authoringContract")}; toolErrorSchemaVersion?: ${cloudReferenceType("compatibility.toolErrorSchemaVersion")}; toolResponseReceiptRevision?: ${cloudReferenceType("compatibility.toolResponseReceiptRevision")} };`,
1710
+ ` inline?: ${cloudReferenceType("inline")};`,
1711
+ ` billing?: { maxCreditsPerRun?: ${cloudReferenceType("billing.maxCreditsPerRun")} };`,
1712
+ ` runtime?: { timeout?: ${cloudReferenceType("runtime.timeout")}; size?: ${cloudReferenceType("runtime.size")} };`,
1713
+ ` webhook?: { hmac?: { algorithm?: ${cloudReferenceType("bindings.webhook.hmac.algorithm")}; header?: ${cloudReferenceType("bindings.webhook.hmac.header")}; signaturePrefix?: ${cloudReferenceType("bindings.webhook.hmac.signaturePrefix")}; secretEnv: ${cloudReferenceType("bindings.webhook.hmac.secretEnv")} }; auth?: { type: ${cloudReferenceType("bindings.webhook.auth.type")}; headerFamily: ${cloudReferenceType("bindings.webhook.auth.headerFamily")}; signingSecrets: readonly ${cloudReferenceType("bindings.webhook.auth.signingSecrets[]")}[]; toleranceSeconds?: ${cloudReferenceType("bindings.webhook.auth.toleranceSeconds")} } };`,
1714
+ ` cron?: { schedule: ${cloudReferenceType("bindings.cron.schedule")}; timezone?: ${cloudReferenceType("bindings.cron.timezone")}; input?: PlayCronInput<TInput> };`,
1715
+ " sqlListeners?: readonly SqlListenerDeclaration[];",
1716
+ ` secrets?: readonly ${cloudReferenceType("bindings.secrets[]")}[];`,
1717
+ "};",
1718
+ "declare const SECRET_HANDLE_BRAND: unique symbol;",
1719
+ "declare const SECRET_PROMISE_BRAND: unique symbol;",
1720
+ "export type SecretHandle = { readonly [SECRET_HANDLE_BRAND]: never; readonly name: string; toString(): string; toJSON(): never };",
1721
+ "export type SecretPromise = Promise<string> & { readonly [SECRET_PROMISE_BRAND]: never };",
1722
+ "export type SecretValue = SecretHandle;",
1723
+ "export type SecretAuth = { readonly kind: 'bearer' | 'header'; readonly secret: string | SecretPromise | SecretHandle; readonly header?: string };",
1724
+ "export type SecretAuthInput = SecretAuth | readonly SecretAuth[];",
1725
+ "export type PlayInputContract<TInput> = { readonly schema: Record<string, unknown>; readonly __inputType?: TInput };",
1726
+ "export type PlayReturnObject = Record<string, unknown> & { readonly _metadata?: never };",
1727
+ "export type CsvRenameMap = Record<string, string | readonly string[]>;",
1728
+ "export type FileInput<TMetadata = unknown> = string & { readonly __deeplineFileInputMetadata?: TMetadata };",
1729
+ "export type CsvInput<TRow extends object = Record<string, unknown>> = FileInput<{ readonly kind: 'csv'; readonly row: TRow }>;",
1730
+ "export type ColumnMap<TRow extends object> = { [K in keyof TRow & string]?: string | readonly string[] };",
1731
+ `export type CsvOptions = { description?: ${cloudReferenceType("ctx.csv.options.description")}; columns?: ${cloudReferenceType("ctx.csv.options.columns")}; rename?: ${cloudReferenceType("ctx.csv.options.rename")}; required?: ${cloudReferenceType("ctx.csv.options.required")} };`,
1732
+ "export type PlayCallExecution = 'inline';",
1733
+ `export type PlayCallOptions = { description: ${cloudReferenceType("ctx.runPlay.options.description")}; execution?: ${cloudReferenceType("ctx.runPlay.options.execution")}; timeoutMs?: ${cloudReferenceType("ctx.runPlay.options.timeoutMs")} };`,
1734
+ `export type PlayAsyncCallOptions = { description: ${cloudReferenceType("ctx.runPlayAsync.options.description")} };`,
1735
+ "declare const PLAY_RUN_ID_BRAND: unique symbol;",
1736
+ "export type PlayRunId = string & { readonly [PLAY_RUN_ID_BRAND]: 'PlayRunId' };",
1737
+ "export type AsyncPlayRunRef = Readonly<{ runId: PlayRunId }>;",
1738
+ `export type RuntimeStepOptions = { semanticKey?: ${cloudReferenceType("ctx.step.semanticKey")}; staleAfterSeconds?: ${cloudReferenceType("ctx.step.staleAfterSeconds")} };`,
1739
+ `export type FetchOptions = { staleAfterSeconds?: ${cloudReferenceType("ctx.fetch.staleAfterSeconds")}; transient?: boolean };`,
1740
+ "export type CallFreshnessMetadata = { requestedStaleAfterSeconds: number | null; effectiveStaleAfterSeconds: number | null; source: 'executed' | 'operation_recovery' | 'reusable_result' | 'live_observation'; resultAgeMs: number; completedAt: number; operationReceiptKey?: string; unavailableReason?: string };",
1741
+ "export type ToolResultExecutionMetadata = { idempotent: true; cached: boolean; source: 'live' | 'checkpoint' | 'cache' | 'in_flight' | 'source_run'; cacheKey?: string; receiptRole?: 'owner' | 'follower'; receiptKey?: string; resultReceiptKey?: string; attachedToReceiptKey?: string; freshness?: CallFreshnessMetadata; completedAt?: number };",
1742
+ "export type PlayFetchResponse = { freshness?: CallFreshnessMetadata; ok: boolean; status: number; statusText: string; url: string; headers: Record<string, string>; bodyText: string; json: unknown | null };",
1743
+ "export declare class CtxFetchAmbiguousWriteError extends Error { readonly code: 'CTX_FETCH_WRITE_OUTCOME_UNKNOWN'; readonly outcome: 'unknown'; readonly method: string; readonly origin: string; }",
1744
+ "export declare class CtxFetchHttpError extends Error { readonly code: 'CTX_FETCH_HTTP_ERROR'; readonly response: PlayFetchResponse; readonly status: number; readonly statusText: string; readonly url: string; readonly headers: Record<string, string>; readonly bodyText: string; readonly json: unknown | null; }",
1745
+ "export type StepResolver<Row, Value> = (row: Row, ctx: DeeplinePlayRuntimeContext, index: number, previousCell?: PreviousCell<Value>) => Value | Promise<Value>;",
1746
+ "export type DatasetColumnRunInput<Row, Value> = { readonly row: Row; readonly ctx: DeeplinePlayRuntimeContext; readonly index: number; readonly previousCell?: PreviousCell<Value> };",
1747
+ "export type DatasetColumnDefinition<Row, Value> = { readonly run: (input: DatasetColumnRunInput<Row, Value>) => Value | Promise<Value>; readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean> };",
1748
+ "export type ConditionalStepResolver<Row, Value, Else = null> = { readonly kind: 'conditional'; readonly when: (row: Row, index: number) => boolean | Promise<boolean>; readonly run: StepResolver<Row, Value>; readonly elseValue: Else; else<ValueElse>(value: ValueElse): ConditionalStepResolver<Row, Value, ValueElse>; };",
1749
+ "export type StepOptions<Row, Value = unknown> = { readonly runIf?: (row: Row, index: number) => boolean | Promise<boolean>; readonly recompute?: boolean; readonly recomputeOnError?: boolean; readonly staleAfterSeconds?: DurableCallStaleAfterSeconds };",
1750
+ "export type StepProgramOptions = { readonly continueOnProviderUnavailable?: boolean };",
1751
+ "export type StepProgram<Input, Output, Return = Output> = { readonly kind: 'steps'; readonly steps: readonly PlayStepProgramStep[]; readonly returnResolver?: StepResolver<Output, Return>; readonly continueOnProviderUnavailable?: boolean; readonly __inputType?: (input: Input) => void; step<Name extends string, Value>(name: Name, resolver: StepResolver<Output, Value> | ConditionalStepResolver<Output, Value> | StepProgramResolver<Output, Value>): StepProgram<Input, Output & Record<Name, Value>, Return>; step<Name extends string, Value, Options extends StepOptions<Output, Value>>(name: Name, resolver: StepResolver<Output, Value> | StepProgramResolver<Output, Value>, options: Options): StepProgram<Input, Output & Record<Name, 'runIf' extends keyof Options ? Value | null : Value>, Return>; return<Value>(resolver: StepResolver<Output, Value>): StepProgram<Input, Output, Value>; };",
1752
+ "export type StepProgramResolver<Input, Return> = { readonly kind: 'steps'; readonly steps: readonly PlayStepProgramStep[]; readonly returnResolver?: StepResolver<never, Return>; readonly __inputType?: (input: Input) => void };",
1753
+ "export type RunnableStepProgram<Input, Return> = Pick<StepProgram<Input, never, Return>, 'kind' | 'steps' | 'returnResolver' | '__inputType'>;",
1754
+ "export type RunnableColumnStepProgram<Return> = Pick<StepProgramResolver<unknown, Return>, 'kind' | 'steps' | 'returnResolver'>;",
1755
+ "export type PlayStepProgramStep = { readonly name: string; readonly recompute?: boolean; readonly recomputeOnError?: boolean; readonly staleAfterSeconds?: DurableCallStaleAfterSeconds; readonly resolver: StepResolver<Record<string, unknown>, unknown> | ConditionalStepResolver<Record<string, unknown>, unknown> | StepProgramResolver<Record<string, unknown>, unknown> };",
1756
+ "export type ColumnResolver<Row, Value> = StepResolver<Row, Value> | ConditionalStepResolver<Row, Value> | RunnableColumnStepProgram<Value>;",
1757
+ "export type StepProgramOutput<TProgram> = TProgram extends StepProgram<unknown, infer Output, unknown> ? Output : never;",
1758
+ "export type DatasetRowKey<InputRow extends object> = (keyof InputRow & string) | readonly (keyof InputRow & string)[] | ((row: InputRow, index: number) => string | number | readonly unknown[]);",
1759
+ "export type DatasetDefinitionOptions<InputRow extends object> = { key?: DatasetRowKey<InputRow> };",
1760
+ `export type DatasetRunOptions<InputRow extends object> = { description?: ${cloudReferenceType("ctx.dataset.run.description")}; key?: DatasetRowKey<InputRow>; rowIdentity?: ${cloudReferenceType("ctx.dataset.run.rowIdentity")}; onRowError?: ${cloudReferenceType("ctx.dataset.run.onRowError")}; mode?: ${cloudReferenceType("ctx.dataset.run.mode")}; undrawnColumns?: ${cloudReferenceType("ctx.dataset.run.undrawnColumns")} };`,
1761
+ "export type DatasetBuilder<InputRow extends object, OutputRow extends object> = {",
1762
+ " withColumn<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;",
1763
+ " withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value> & { readonly runIf: (row: OutputRow, index: number) => boolean | Promise<boolean> }): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;",
1764
+ " withColumn<Name extends string, Value>(name: Name, definition: DatasetColumnDefinition<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value>>;",
1765
+ " withColumn<Name extends string, Value>(name: Name, resolver: StepResolver<OutputRow, Value> | RunnableColumnStepProgram<Value>, options: StepOptions<OutputRow, Value>): DatasetBuilder<InputRow, OutputRow & Record<Name, Value | null>>;",
1766
+ " withColumns<ProgramOutput extends OutputRow, Return>(program: StepProgram<OutputRow, ProgramOutput, Return>): DatasetBuilder<InputRow, ProgramOutput>;",
1767
+ " step<Name extends string, Value>(name: Name, resolver: ColumnResolver<OutputRow, Value>): never;",
1768
+ " run(options?: DatasetRunOptions<InputRow>): Promise<PlayDataset<OutputRow>>;",
1769
+ "};",
1770
+ "export type PlayReferenceLike<TInput extends Record<string, unknown> = Record<string, unknown>> = ({ readonly playName: string; readonly name?: string } | { readonly name: string; readonly playName?: string }) & { readonly __inputType?: TInput };",
1771
+ "export type BillingBenefitValues = { quickenrichUnlimited: { enabled: boolean; requestsPerMinute: number } };",
1772
+ "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 } }; effective_limits: { quickenrichUnlimited?: { baseline: number; effective: number; source: 'plan' | 'override'; override_expires_at?: number } } };",
1773
+ "export interface DeeplinePlayRuntimeContext {",
1774
+ " billing: { entitlements(): Promise<BillingEntitlements> };",
1775
+ " csv<T = Record<string, unknown>>(path: string | CsvInput<T & object>, options?: CsvOptions): Promise<PlayDataset<T>>;",
1776
+ " dataset<TSource extends PlayDatasetInput<object>>(key: string, items: TSource): DatasetBuilder<PlayDatasetRow<TSource> & object, PlayDatasetRow<TSource> & object>;",
1777
+ " map<TSource extends PlayDatasetInput<object>>(key: string, items: TSource, options?: DatasetDefinitionOptions<PlayDatasetRow<TSource> & object>): never;",
1778
+ " readonly run: { readonly id: string };",
1779
+ ` runSteps<TInput extends Record<string, unknown>, TOutput>(program: RunnableStepProgram<TInput, TOutput>, input: TInput, options?: { description?: ${cloudReferenceType("ctx.runSteps.options.description")}; staleAfterSeconds?: ${cloudReferenceType("ctx.runSteps.options.staleAfterSeconds")} }): Promise<TOutput>;`,
1780
+ " tools: { execute<K extends string>(request: ToolExecutionRequest<K>): Promise<ToolExecutionOutput<K>> };",
1781
+ ` customerDb: { query<TRow extends Record<string, unknown> = Record<string, unknown>>(statement: SqlQuery, options?: { id?: ${cloudReferenceType("ctx.customerDb.query.options.id")}; staleAfterSeconds?: ${cloudReferenceType("ctx.customerDb.query.options.staleAfterSeconds")}; maxRows?: ${cloudReferenceType("ctx.customerDb.query.options.maxRows")}; timeoutMs?: ${cloudReferenceType("ctx.customerDb.query.options.timeoutMs")} }): Promise<TRow[]> };`,
1782
+ ` tool<K extends string>(key: ${cloudReferenceType("ctx.tool.key")}, toolId: K, input: ${cloudReferenceType("ctx.tool.input")}, options?: { description?: ${cloudReferenceType("ctx.tool.options.description")}; staleAfterSeconds?: DurableCallStaleAfterSeconds }): Promise<ToolExecutionOutput<K>>;`,
1783
+ " step<T>(id: string, run: () => T | Promise<T>, options?: RuntimeStepOptions): Promise<T>;",
1784
+ " fetch(key: string, url: string | URL, init?: RequestInit & { headers?: HeadersInit & { 'Idempotency-Key'?: string; 'X-Idempotency-Key'?: string }; auth?: SecretAuthInput }, options?: FetchOptions): Promise<PlayFetchResponse>;",
1785
+ " secrets: { get(name: string): SecretPromise; bearer(secret: string | SecretPromise | SecretHandle): SecretAuth; header(header: string, secret: string | SecretPromise | SecretHandle): SecretAuth };",
1786
+ ` runPlay<TOutput = unknown>(key: string, playRef: ${cloudReferenceType("ctx.runPlay.playRef")}, input: ${cloudReferenceType("ctx.runPlay.input")}, options: PlayCallOptions): Promise<TOutput>;`,
1787
+ " runPlayAsync<TInput extends Record<string, unknown>>(key: string, playRef: PlayReferenceLike<TInput>, input: NoInfer<TInput>, options: PlayAsyncCallOptions): Promise<AsyncPlayRunRef>;",
1788
+ " runPlayAsync(key: string, playRef: string, input: Record<string, unknown>, options: PlayAsyncCallOptions): Promise<AsyncPlayRunRef>;",
1789
+ " log(message: string, options?: { level?: 'debug' | 'info' | 'warn' | 'error'; context?: Readonly<Record<string, string | number | boolean>> }): void;",
1790
+ ` sleep(ms: ${cloudReferenceType("ctx.sleep.ms")}): Promise<void>;`,
1791
+ "}",
1792
+ "export type DefinePlayConfig<TInput, TOutput extends PlayReturnObject> = { id: string; displayName?: string; description?: string; input: PlayInputContract<TInput>; run: (ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>; bindings?: PlayBindings<TInput>; billing?: PlayBindings<TInput>['billing']; runtime?: PlayBindings<TInput>['runtime']; compatibility?: PlayBindings<TInput>['compatibility'] };",
1793
+ "export type DefinedPlay<TInput, TOutput extends PlayReturnObject> = ((ctx: DeeplinePlayRuntimeContext, input: TInput) => Promise<TOutput>) & { readonly name: string; readonly __inputType?: TInput; readonly __outputType?: TOutput; readonly bindings?: PlayBindings<TInput>; readonly runtime?: PlayBindings<TInput>['runtime']; readonly compatibility?: PlayBindings<TInput>['compatibility'] };",
1794
+ "export type PlayHandlerInput<THandler> = THandler extends (context: DeeplinePlayRuntimeContext, input: infer TInput) => Promise<PlayReturnObject> ? TInput : never;",
1795
+ "export type PlayHandlerOutput<THandler> = THandler extends (context: DeeplinePlayRuntimeContext, input: unknown) => Promise<infer TOutput extends PlayReturnObject> ? TOutput : never;"
1796
+ ];
1797
+
50
1798
  // ../plays/contracts.ts
51
1799
  var PLAY_ARTIFACT_VERSION = _chunkOG64RBACjs.CURRENT_PLAY_ARTIFACT_CONTRACT_VERSION;
1800
+ var UnsupportedPlayToolErrorSchemaVersionError = class extends Error {
1801
+ constructor(value) {
1802
+ super(
1803
+ `Unsupported Play tool error schema version ${String(value)}. Supported versions: ${_chunkPPDBRJRWjs.SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS.join(", ")}.`
1804
+ );
1805
+ this.name = "UnsupportedPlayToolErrorSchemaVersionError";
1806
+ }
1807
+ };
1808
+ var InvalidPlayContractCompatibilityError = class extends Error {
1809
+ constructor(message = "Play artifact compatibility must be an object.") {
1810
+ super(message);
1811
+ this.name = "InvalidPlayContractCompatibilityError";
1812
+ }
1813
+ };
1814
+ function normalizePlayContractCompatibility(compatibility) {
1815
+ if (!compatibility || typeof compatibility !== "object" || Array.isArray(compatibility)) {
1816
+ throw new InvalidPlayContractCompatibilityError();
1817
+ }
1818
+ const requestedToolErrorSchemaVersion = _nullishCoalesce(compatibility.toolErrorSchemaVersion, () => ( _chunkPPDBRJRWjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION));
1819
+ if (compatibility.datasetRowInput !== void 0 && compatibility.datasetRowInput !== "current_run") {
1820
+ throw new InvalidPlayContractCompatibilityError(
1821
+ `Unsupported dataset row input policy ${String(compatibility.datasetRowInput)}.`
1822
+ );
1823
+ }
1824
+ if (!_chunkPPDBRJRWjs.SUPPORTED_TOOL_EXECUTION_ERROR_SCHEMA_VERSIONS.includes(
1825
+ requestedToolErrorSchemaVersion
1826
+ )) {
1827
+ throw new UnsupportedPlayToolErrorSchemaVersionError(
1828
+ requestedToolErrorSchemaVersion
1829
+ );
1830
+ }
1831
+ let toolResponseContract;
1832
+ let toolResponseReceiptRevision;
1833
+ try {
1834
+ toolResponseContract = _chunkE4CABWXLjs.normalizeToolResponseContract.call(void 0,
1835
+ compatibility.toolResponseContract
1836
+ );
1837
+ toolResponseReceiptRevision = _chunkE4CABWXLjs.normalizeToolResponseReceiptRevision.call(void 0,
1838
+ compatibility.toolResponseReceiptRevision
1839
+ );
1840
+ } catch (error) {
1841
+ if (error instanceof _chunkE4CABWXLjs.UnsupportedToolResponseContractError || error instanceof _chunkE4CABWXLjs.InvalidToolResponseReceiptRevisionError) {
1842
+ throw new InvalidPlayContractCompatibilityError(error.message);
1843
+ }
1844
+ throw error;
1845
+ }
1846
+ return {
1847
+ ...compatibility,
1848
+ toolErrorSchemaVersion: _chunkPPDBRJRWjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION,
1849
+ toolResponseContract,
1850
+ ...toolResponseReceiptRevision ? { toolResponseReceiptRevision } : {},
1851
+ authoringContractEdition: normalizePlayAuthoringContractEdition(
1852
+ compatibility.authoringContractEdition
1853
+ )
1854
+ };
1855
+ }
52
1856
  function buildPlayContractCompatibility(input) {
53
1857
  return {
54
1858
  artifactVersion: PLAY_ARTIFACT_VERSION,
55
- runtimeBackend: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _ => _.runtimeBackend]), () => ( null)),
56
- toolErrorSchemaVersion: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _2 => _2.toolErrorSchemaVersion]), () => ( _chunk7P5AA3SNjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION)),
57
- authoringContractEdition: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _3 => _3.authoringContractEdition]), () => ( _chunkZ4VNJOF7js.PLAY_AUTHORING_CONTRACT_EDITION)),
58
- toolResponseContract: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _4 => _4.toolResponseContract]), () => ( _chunkS6R3OX7Bjs.RAW_V2_TOOL_RESPONSE_CONTRACT)),
59
- toolResponseReceiptRevision: _chunkS6R3OX7Bjs.normalizeToolResponseReceiptRevision.call(void 0,
60
- _nullishCoalesce(_optionalChain([input, 'optionalAccess', _5 => _5.toolResponseReceiptRevision]), () => ( _chunkS6R3OX7Bjs.RAW_V2_TOOL_RESPONSE_RECEIPT_REVISION))
1859
+ ..._optionalChain([input, 'optionalAccess', _ => _.datasetRowInput]) ? { datasetRowInput: input.datasetRowInput } : {},
1860
+ runtimeBackend: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _2 => _2.runtimeBackend]), () => ( null)),
1861
+ toolErrorSchemaVersion: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _3 => _3.toolErrorSchemaVersion]), () => ( _chunkPPDBRJRWjs.TOOL_EXECUTION_ERROR_SCHEMA_VERSION)),
1862
+ authoringContractEdition: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _4 => _4.authoringContractEdition]), () => ( PLAY_AUTHORING_CONTRACT_EDITION)),
1863
+ toolResponseContract: _nullishCoalesce(_optionalChain([input, 'optionalAccess', _5 => _5.toolResponseContract]), () => ( _chunkE4CABWXLjs.RAW_V2_TOOL_RESPONSE_CONTRACT)),
1864
+ toolResponseReceiptRevision: _chunkE4CABWXLjs.normalizeToolResponseReceiptRevision.call(void 0,
1865
+ _nullishCoalesce(_optionalChain([input, 'optionalAccess', _6 => _6.toolResponseReceiptRevision]), () => ( _chunkE4CABWXLjs.RAW_V2_TOOL_RESPONSE_RECEIPT_REVISION))
61
1866
  )
62
1867
  };
63
1868
  }
@@ -119,7 +1924,7 @@ function isDefinePlayCall(node) {
119
1924
  }
120
1925
  function stringLiteralValue(node) {
121
1926
  const expression = unwrapStaticExpression(node);
122
- return _optionalChain([expression, 'optionalAccess', _6 => _6.type]) === "Literal" && typeof expression.value === "string" ? expression.value : null;
1927
+ return _optionalChain([expression, 'optionalAccess', _7 => _7.type]) === "Literal" && typeof expression.value === "string" ? expression.value : null;
123
1928
  }
124
1929
  function definePlayName(node) {
125
1930
  const expression = unwrapStaticExpression(node);
@@ -127,12 +1932,12 @@ function definePlayName(node) {
127
1932
  const first = unwrapStaticExpression(
128
1933
  _nullishCoalesce(astArray(expression.arguments)[0], () => ( null))
129
1934
  );
130
- if (_optionalChain([first, 'optionalAccess', _7 => _7.type]) !== "ObjectExpression") return stringLiteralValue(first);
1935
+ if (_optionalChain([first, 'optionalAccess', _8 => _8.type]) !== "ObjectExpression") return stringLiteralValue(first);
131
1936
  let id = null;
132
1937
  for (const property of astArray(first.properties)) {
133
1938
  if (property.type !== "Property" || property.computed) continue;
134
1939
  const key = isAstNode(property.key) ? property.key : null;
135
- const keyName = _nullishCoalesce(getIdentifierName(key), () => ( (_optionalChain([key, 'optionalAccess', _8 => _8.type]) === "Literal" && typeof key.value === "string" ? key.value : null)));
1940
+ const keyName = _nullishCoalesce(getIdentifierName(key), () => ( (_optionalChain([key, 'optionalAccess', _9 => _9.type]) === "Literal" && typeof key.value === "string" ? key.value : null)));
136
1941
  if (keyName !== "id") continue;
137
1942
  id = stringLiteralValue(isAstNode(property.value) ? property.value : null);
138
1943
  }
@@ -209,7 +2014,7 @@ function listPlayFileExports(sourceCode) {
209
2014
  return exports;
210
2015
  }
211
2016
  function canonicalPlayExportName(exportName, exports) {
212
- const requested = _optionalChain([exportName, 'optionalAccess', _9 => _9.trim, 'call', _10 => _10()]) || PLAY_DEFAULT_EXPORT;
2017
+ const requested = _optionalChain([exportName, 'optionalAccess', _10 => _10.trim, 'call', _11 => _11()]) || PLAY_DEFAULT_EXPORT;
213
2018
  for (const entry of exports) {
214
2019
  if (entry.name === requested || entry.aliases.includes(requested)) {
215
2020
  return entry.name;
@@ -287,7 +2092,7 @@ function parseAttributes(source, line, errors) {
287
2092
  const validAttributes = MERMAID_NODE_ATTRIBUTES;
288
2093
  let cursor = 0;
289
2094
  while (cursor < source.length) {
290
- cursor += _nullishCoalesce(_optionalChain([/^\s*/, 'access', _11 => _11.exec, 'call', _12 => _12(source.slice(cursor)), 'optionalAccess', _13 => _13[0], 'access', _14 => _14.length]), () => ( 0));
2095
+ cursor += _nullishCoalesce(_optionalChain([/^\s*/, 'access', _12 => _12.exec, 'call', _13 => _13(source.slice(cursor)), 'optionalAccess', _14 => _14[0], 'access', _15 => _15.length]), () => ( 0));
291
2096
  if (cursor >= source.length) break;
292
2097
  ATTRIBUTE.lastIndex = cursor;
293
2098
  const match = ATTRIBUTE.exec(source);
@@ -330,12 +2135,12 @@ var SHAPE_KINDS = {
330
2135
  };
331
2136
  var MERMAID_LABEL_LOOKS_LIKE_SOURCE = /^(?:\[|\{|\(|>)/;
332
2137
  function parseMermaidNodeAtStart(source) {
333
- const leadingWhitespace = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _15 => _15.exec, 'call', _16 => _16(source), 'optionalAccess', _17 => _17[0], 'access', _18 => _18.length]), () => ( 0));
2138
+ const leadingWhitespace = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _16 => _16.exec, 'call', _17 => _17(source), 'optionalAccess', _18 => _18[0], 'access', _19 => _19.length]), () => ( 0));
334
2139
  const idMatch = MERMAID_NODE_ID.exec(source.slice(leadingWhitespace));
335
2140
  if (!idMatch) return null;
336
2141
  const id = idMatch[0];
337
2142
  let cursor = leadingWhitespace + id.length;
338
- cursor += _nullishCoalesce(_optionalChain([/^\s*/, 'access', _19 => _19.exec, 'call', _20 => _20(source.slice(cursor)), 'optionalAccess', _21 => _21[0], 'access', _22 => _22.length]), () => ( 0));
2143
+ cursor += _nullishCoalesce(_optionalChain([/^\s*/, 'access', _20 => _20.exec, 'call', _21 => _21(source.slice(cursor)), 'optionalAccess', _22 => _22[0], 'access', _23 => _23.length]), () => ( 0));
339
2144
  const shape = MERMAID_NODE_SHAPES.find(
340
2145
  ([open2]) => source.startsWith(open2, cursor)
341
2146
  );
@@ -353,7 +2158,7 @@ function parseMermaidNodeAtStart(source) {
353
2158
  continue;
354
2159
  }
355
2160
  if (source[index] !== openingQuote) continue;
356
- const whitespace = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _23 => _23.exec, 'call', _24 => _24(source.slice(index + 1)), 'optionalAccess', _25 => _25[0], 'access', _26 => _26.length]), () => ( 0));
2161
+ const whitespace = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _24 => _24.exec, 'call', _25 => _25(source.slice(index + 1)), 'optionalAccess', _26 => _26[0], 'access', _27 => _27.length]), () => ( 0));
357
2162
  const candidate = index + 1 + whitespace;
358
2163
  if (source.startsWith(close, candidate)) {
359
2164
  labelEnd = candidate;
@@ -387,12 +2192,12 @@ function parseShapedMermaidNodes(fragment) {
387
2192
  const nodes = [];
388
2193
  let cursor = 0;
389
2194
  while (cursor < fragment.length) {
390
- const identifier = /[A-Za-z][\w-]*/.exec(fragment.slice(cursor));
391
- if (!identifier) break;
392
- const start = cursor + (_nullishCoalesce(identifier.index, () => ( 0)));
2195
+ const identifier2 = /[A-Za-z][\w-]*/.exec(fragment.slice(cursor));
2196
+ if (!identifier2) break;
2197
+ const start = cursor + (_nullishCoalesce(identifier2.index, () => ( 0)));
393
2198
  const parsed = parseMermaidNodeAtStart(fragment.slice(start));
394
- if (_optionalChain([parsed, 'optionalAccess', _27 => _27.shaped]) || _optionalChain([parsed, 'optionalAccess', _28 => _28.unterminated])) nodes.push(parsed);
395
- cursor = start + Math.max(_nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _29 => _29.length]), () => ( identifier[0].length)), 1);
2199
+ if (_optionalChain([parsed, 'optionalAccess', _28 => _28.shaped]) || _optionalChain([parsed, 'optionalAccess', _29 => _29.unterminated])) nodes.push(parsed);
2200
+ cursor = start + Math.max(_nullishCoalesce(_optionalChain([parsed, 'optionalAccess', _30 => _30.length]), () => ( identifier2[0].length)), 1);
396
2201
  }
397
2202
  return nodes;
398
2203
  }
@@ -409,7 +2214,7 @@ function parseEdgeChain(line) {
409
2214
  remaining = remaining.slice(connector[0].length);
410
2215
  const next = parseMermaidNodeAtStart(remaining);
411
2216
  if (!next) return null;
412
- labels.push(_optionalChain([connector, 'access', _30 => _30[1], 'optionalAccess', _31 => _31.trim, 'call', _32 => _32()]) || void 0);
2217
+ labels.push(_optionalChain([connector, 'access', _31 => _31[1], 'optionalAccess', _32 => _32.trim, 'call', _33 => _33()]) || void 0);
413
2218
  nodes.push(next);
414
2219
  remaining = remaining.slice(next.length);
415
2220
  }
@@ -433,10 +2238,10 @@ function inferBindingIo(statement) {
433
2238
  const expression2 = returned[1].replace(/(['"`])(?:\\.|(?!\1).)*\1/g, "");
434
2239
  IDENTIFIER.lastIndex = 0;
435
2240
  for (const match of expression2.matchAll(IDENTIFIER)) {
436
- const identifier = match[0];
2241
+ const identifier2 = match[0];
437
2242
  const index = _nullishCoalesce(match.index, () => ( 0));
438
- if (JS_WORDS.has(identifier) || expression2[index - 1] === ".") continue;
439
- inputs2.add(identifier);
2243
+ if (JS_WORDS.has(identifier2) || expression2[index - 1] === ".") continue;
2244
+ inputs2.add(identifier2);
440
2245
  }
441
2246
  return {
442
2247
  inputs: [...inputs2],
@@ -454,14 +2259,14 @@ function inferBindingIo(statement) {
454
2259
  const inputs = /* @__PURE__ */ new Set();
455
2260
  IDENTIFIER.lastIndex = 0;
456
2261
  for (const match of expression.matchAll(IDENTIFIER)) {
457
- const identifier = match[0];
2262
+ const identifier2 = match[0];
458
2263
  const index = _nullishCoalesce(match.index, () => ( 0));
459
2264
  const previous = _nullishCoalesce(expression[index - 1], () => ( ""));
460
- const next = _nullishCoalesce(expression[index + identifier.length], () => ( ""));
461
- if (JS_WORDS.has(identifier) || identifier === output || previous === "." || next === ":" || /^\s*\(/.test(expression.slice(index + identifier.length))) {
2265
+ const next = _nullishCoalesce(expression[index + identifier2.length], () => ( ""));
2266
+ if (JS_WORDS.has(identifier2) || identifier2 === output || previous === "." || next === ":" || /^\s*\(/.test(expression.slice(index + identifier2.length))) {
462
2267
  continue;
463
2268
  }
464
- inputs.add(identifier);
2269
+ inputs.add(identifier2);
465
2270
  }
466
2271
  return {
467
2272
  inputs: [...inputs],
@@ -490,7 +2295,7 @@ function blockLabel(block) {
490
2295
  }
491
2296
  function parseDocflowBlockGraph(mermaidSource, errors) {
492
2297
  const docLines = mermaidSource.split(/\r?\n/).filter((line) => line.trim() && !line.trim().startsWith("%%"));
493
- const direction = _optionalChain([FLOW_START, 'access', _33 => _33.exec, 'call', _34 => _34(_nullishCoalesce(docLines[0], () => ( ""))), 'optionalAccess', _35 => _35[1], 'optionalAccess', _36 => _36.toUpperCase, 'call', _37 => _37()]);
2298
+ const direction = _optionalChain([FLOW_START, 'access', _34 => _34.exec, 'call', _35 => _35(_nullishCoalesce(docLines[0], () => ( ""))), 'optionalAccess', _36 => _36[1], 'optionalAccess', _37 => _37.toUpperCase, 'call', _38 => _38()]);
494
2299
  if (!direction) {
495
2300
  errors.push(
496
2301
  "Docflow must start with `flowchart` or `graph` and direction `LR`, `RL`, `TB`, `TD`, or `BT`."
@@ -542,12 +2347,12 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
542
2347
  const at = subgraph.memberIds.indexOf(id);
543
2348
  if (at !== -1) subgraph.memberIds.splice(at, 1);
544
2349
  }
545
- _optionalChain([subgraphStack, 'access', _38 => _38[subgraphStack.length - 1], 'optionalAccess', _39 => _39.memberIds, 'access', _40 => _40.push, 'call', _41 => _41(id)]);
2350
+ _optionalChain([subgraphStack, 'access', _39 => _39[subgraphStack.length - 1], 'optionalAccess', _40 => _40.memberIds, 'access', _41 => _41.push, 'call', _42 => _42(id)]);
546
2351
  } else if (existing && existing.label !== label) {
547
2352
  errors.push(`Docflow node "${id}" has conflicting labels.`);
548
2353
  } else if (!existing) {
549
2354
  nodes.set(id, { id, label, kind });
550
- _optionalChain([subgraphStack, 'access', _42 => _42[subgraphStack.length - 1], 'optionalAccess', _43 => _43.memberIds, 'access', _44 => _44.push, 'call', _45 => _45(id)]);
2355
+ _optionalChain([subgraphStack, 'access', _43 => _43[subgraphStack.length - 1], 'optionalAccess', _44 => _44.memberIds, 'access', _45 => _45.push, 'call', _46 => _46(id)]);
551
2356
  }
552
2357
  }
553
2358
  return sawDeclaration;
@@ -556,7 +2361,7 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
556
2361
  const opened = SUBGRAPH_OPEN.exec(line);
557
2362
  if (opened) {
558
2363
  const id = opened[1];
559
- const rawLabel = _nullishCoalesce(_optionalChain([opened, 'access', _46 => _46[2], 'optionalAccess', _47 => _47.trim, 'call', _48 => _48()]), () => ( ""));
2364
+ const rawLabel = _nullishCoalesce(_optionalChain([opened, 'access', _47 => _47[2], 'optionalAccess', _48 => _48.trim, 'call', _49 => _49()]), () => ( ""));
560
2365
  const label = rawLabel.length >= 2 && (rawLabel.startsWith('"') && rawLabel.endsWith('"') || rawLabel.startsWith("'") && rawLabel.endsWith("'")) ? rawLabel.slice(1, -1) : rawLabel;
561
2366
  const parent = subgraphStack[subgraphStack.length - 1];
562
2367
  const subgraph = {
@@ -609,7 +2414,7 @@ function parseDocflowBlockGraph(mermaidSource, errors) {
609
2414
  const existing = nodes.get(node.id);
610
2415
  if (!existing) {
611
2416
  nodes.set(node.id, node);
612
- _optionalChain([subgraphStack, 'access', _49 => _49[subgraphStack.length - 1], 'optionalAccess', _50 => _50.memberIds, 'access', _51 => _51.push, 'call', _52 => _52(node.id)]);
2417
+ _optionalChain([subgraphStack, 'access', _50 => _50[subgraphStack.length - 1], 'optionalAccess', _51 => _51.memberIds, 'access', _52 => _52.push, 'call', _53 => _53(node.id)]);
613
2418
  } else if (existing.label === existing.id && node.label !== node.id) {
614
2419
  existing.label = node.label;
615
2420
  existing.kind = node.kind;
@@ -764,7 +2569,7 @@ function playExportSourceRanges(sourceCode) {
764
2569
  const recordDeclarations = (declaration, exported) => {
765
2570
  for (const declarator of astArray(declaration.declarations)) {
766
2571
  const id = isAstNode(declarator.id) ? declarator.id : null;
767
- const name = _optionalChain([id, 'optionalAccess', _53 => _53.type]) === "Identifier" && typeof id.name === "string" ? id.name : null;
2572
+ const name = _optionalChain([id, 'optionalAccess', _54 => _54.type]) === "Identifier" && typeof id.name === "string" ? id.name : null;
768
2573
  if (!name) continue;
769
2574
  declarations.set(
770
2575
  name,
@@ -786,7 +2591,7 @@ function playExportSourceRanges(sourceCode) {
786
2591
  for (const specifier of astArray(statement.specifiers)) {
787
2592
  const local = isAstNode(specifier.local) ? specifier.local : null;
788
2593
  const exported = isAstNode(specifier.exported) ? specifier.exported : null;
789
- if (_optionalChain([local, 'optionalAccess', _54 => _54.type]) === "Identifier" && typeof local.name === "string" && _optionalChain([exported, 'optionalAccess', _55 => _55.type]) === "Identifier" && typeof exported.name === "string") {
2594
+ if (_optionalChain([local, 'optionalAccess', _55 => _55.type]) === "Identifier" && typeof local.name === "string" && _optionalChain([exported, 'optionalAccess', _56 => _56.type]) === "Identifier" && typeof exported.name === "string") {
790
2595
  namedExports.set(exported.name, local.name);
791
2596
  }
792
2597
  }
@@ -823,7 +2628,7 @@ function projectRecordedArms(block, errors) {
823
2628
  for (const binding of block.bindings) {
824
2629
  if (!binding.arm) continue;
825
2630
  const incoming = block.edges.filter(
826
- (edge2) => edge2.to === binding.nodeId && _optionalChain([block, 'access', _56 => _56.nodes, 'access', _57 => _57.get, 'call', _58 => _58(edge2.from), 'optionalAccess', _59 => _59.kind]) === "decision"
2631
+ (edge2) => edge2.to === binding.nodeId && _optionalChain([block, 'access', _57 => _57.nodes, 'access', _58 => _58.get, 'call', _59 => _59(edge2.from), 'optionalAccess', _60 => _60.kind]) === "decision"
827
2632
  );
828
2633
  if (incoming.length === 0) {
829
2634
  errors.push(
@@ -934,7 +2739,7 @@ function parseDocflowBindingsInSource(source, errors, rejectedNodeIds) {
934
2739
  MERMAID_NODE.lastIndex = 0;
935
2740
  const mermaidMatch = _nullishCoalesce(MERMAID_NODE.exec(lines[index]), () => ( null));
936
2741
  if (!mermaidMatch) continue;
937
- const annotatedId = _optionalChain([mermaidMatch, 'access', _60 => _60[1], 'optionalAccess', _61 => _61.trim, 'call', _62 => _62()]);
2742
+ const annotatedId = _optionalChain([mermaidMatch, 'access', _61 => _61[1], 'optionalAccess', _62 => _62.trim, 'call', _63 => _63()]);
938
2743
  if (annotatedId) rejectedNodeIds.add(annotatedId);
939
2744
  const attributes = parseAttributes(
940
2745
  _nullishCoalesce(mermaidMatch[2], () => ( "")),
@@ -942,7 +2747,7 @@ function parseDocflowBindingsInSource(source, errors, rejectedNodeIds) {
942
2747
  errors
943
2748
  );
944
2749
  if (!attributes) continue;
945
- const id = _optionalChain([(_nullishCoalesce(annotatedId, () => ( attributes.id))), 'optionalAccess', _63 => _63.trim, 'call', _64 => _64()]);
2750
+ const id = _optionalChain([(_nullishCoalesce(annotatedId, () => ( attributes.id))), 'optionalAccess', _64 => _64.trim, 'call', _65 => _65()]);
946
2751
  if (!id) {
947
2752
  errors.push(`Docflow annotation on line ${index + 1} requires id:"\u2026".`);
948
2753
  continue;
@@ -1038,7 +2843,7 @@ function findDocflowBoundStatement(ast, line, lineStarts) {
1038
2843
  const node = pending.pop();
1039
2844
  const bounds = astNodeBounds(node);
1040
2845
  if (bounds && bounds.start < lineEnd && bounds.end > lineStart && statementTypes.has(node.type)) {
1041
- if (!match || bounds.end - bounds.start < (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _65 => _65(match), 'optionalAccess', _66 => _66.end]), () => ( 0))) - (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _67 => _67(match), 'optionalAccess', _68 => _68.start]), () => ( 0)))) {
2846
+ if (!match || bounds.end - bounds.start < (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _66 => _66(match), 'optionalAccess', _67 => _67.end]), () => ( 0))) - (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _68 => _68(match), 'optionalAccess', _69 => _69.start]), () => ( 0)))) {
1042
2847
  match = node;
1043
2848
  }
1044
2849
  }
@@ -1057,7 +2862,7 @@ var DOCFLOW_STATEMENT_TYPES = /* @__PURE__ */ new Set([
1057
2862
  "VariableDeclaration"
1058
2863
  ]);
1059
2864
  function docflowOutputRoot(binding) {
1060
- const first = _optionalChain([binding, 'access', _69 => _69.outputs, 'optionalAccess', _70 => _70[0]]);
2865
+ const first = _optionalChain([binding, 'access', _70 => _70.outputs, 'optionalAccess', _71 => _71[0]]);
1061
2866
  if (!first) return null;
1062
2867
  const root = first.split(".")[0];
1063
2868
  if (!root || root === "$output") return null;
@@ -1266,8 +3071,220 @@ function resolveDocflowBinding(ast, binding, lineStarts, parents) {
1266
3071
  // ../plays/bundling/limits.ts
1267
3072
  var MAX_PLAY_BUNDLE_BYTES = 30 * 1024 * 1024;
1268
3073
 
3074
+ // ../plays/source-authoring-edition.ts
3075
+ function unwrap(node) {
3076
+ let current = node;
3077
+ while (current && [
3078
+ "TSAsExpression",
3079
+ "TSSatisfiesExpression",
3080
+ "TSTypeAssertion",
3081
+ "TSNonNullExpression",
3082
+ "ParenthesizedExpression"
3083
+ ].includes(current.type)) {
3084
+ current = isAstNode(current.expression) ? current.expression : null;
3085
+ }
3086
+ return current;
3087
+ }
3088
+ function identifier(node) {
3089
+ return isAstNode(node) && node.type === "Identifier" && typeof node.name === "string" ? node.name : null;
3090
+ }
3091
+ function extractPlaySourceAuthoringEdition(ast, exportName = null) {
3092
+ const declarations = /* @__PURE__ */ new Map();
3093
+ const exports = /* @__PURE__ */ new Map();
3094
+ const legacyExports = /* @__PURE__ */ new Map();
3095
+ const definitions = [];
3096
+ const defineAliases = /* @__PURE__ */ new Set();
3097
+ const record = (statement, exported) => {
3098
+ for (const declaration of astArray(statement.declarations)) {
3099
+ const name = identifier(declaration.id);
3100
+ const initializer = isAstNode(declaration.init) ? declaration.init : null;
3101
+ if (!name) continue;
3102
+ declarations.set(
3103
+ name,
3104
+ statement.kind === "const" || isDefinePlayCall(initializer) ? initializer : null
3105
+ );
3106
+ if (initializer && isDefinePlayCall(initializer))
3107
+ definitions.push(initializer);
3108
+ if (exported) exports.set(name, { type: "Identifier", name });
3109
+ }
3110
+ };
3111
+ for (const statement of astArray(ast.body)) {
3112
+ if (statement.type === "ImportDeclaration") {
3113
+ for (const specifier of astArray(statement.specifiers)) {
3114
+ if (specifier.type === "ImportSpecifier" && ["definePlay", "defineWorkflow"].includes(
3115
+ _nullishCoalesce(identifier(specifier.imported), () => ( ""))
3116
+ )) {
3117
+ const name = identifier(specifier.local);
3118
+ if (name) defineAliases.add(name);
3119
+ }
3120
+ }
3121
+ }
3122
+ if (statement.type === "VariableDeclaration") record(statement, false);
3123
+ if (statement.type === "ExportDefaultDeclaration" && isAstNode(statement.declaration)) {
3124
+ exports.set("default", statement.declaration);
3125
+ }
3126
+ if (statement.type === "TSExportAssignment" && isAstNode(statement.expression)) {
3127
+ legacyExports.set("default", statement.expression);
3128
+ }
3129
+ if (statement.type === "ExportNamedDeclaration") {
3130
+ if (isAstNode(statement.source) || statement.exportKind === "type")
3131
+ continue;
3132
+ if (isAstNode(statement.declaration) && statement.declaration.type === "VariableDeclaration") {
3133
+ record(statement.declaration, true);
3134
+ }
3135
+ for (const specifier of astArray(statement.specifiers)) {
3136
+ if (specifier.exportKind === "type") continue;
3137
+ const local2 = identifier(specifier.local);
3138
+ const exported = _nullishCoalesce(identifier(specifier.exported), () => ( (isAstNode(specifier.exported) && specifier.exported.type === "Literal" && typeof specifier.exported.value === "string" ? specifier.exported.value : null)));
3139
+ if (local2 && exported)
3140
+ exports.set(exported, { type: "Identifier", name: local2 });
3141
+ }
3142
+ }
3143
+ if (statement.type === "ExpressionStatement" && isAstNode(statement.expression) && statement.expression.type === "AssignmentExpression") {
3144
+ const left = isAstNode(statement.expression.left) ? statement.expression.left : null;
3145
+ const right = isAstNode(statement.expression.right) ? statement.expression.right : null;
3146
+ if (_optionalChain([left, 'optionalAccess', _72 => _72.type]) === "MemberExpression" && !left.computed && right) {
3147
+ const object = isAstNode(left.object) ? left.object : null;
3148
+ if (identifier(object) === "module" && identifier(left.property) === "exports") {
3149
+ legacyExports.set("default", right);
3150
+ } else if (identifier(object) === "exports" && identifier(left.property) === "default") {
3151
+ legacyExports.set("default", right);
3152
+ }
3153
+ }
3154
+ }
3155
+ }
3156
+ const resolve4 = (node, seen = /* @__PURE__ */ new Set()) => {
3157
+ const value2 = unwrap(node);
3158
+ if (_optionalChain([value2, 'optionalAccess', _73 => _73.type]) === "UnaryExpression" && value2.operator === "void") {
3159
+ const operand = unwrap(isAstNode(value2.argument) ? value2.argument : null);
3160
+ if (_optionalChain([operand, 'optionalAccess', _74 => _74.type]) === "Literal")
3161
+ return { type: "Literal", value: void 0 };
3162
+ }
3163
+ const name = identifier(value2);
3164
+ if (!name) return value2;
3165
+ if (name === "undefined" && !declarations.has(name))
3166
+ return { type: "Literal", value: void 0 };
3167
+ if (seen.has(name)) return null;
3168
+ return resolve4(_nullishCoalesce(declarations.get(name), () => ( null)), new Set(seen).add(name));
3169
+ };
3170
+ const staticKey = (node) => {
3171
+ const value2 = resolve4(node);
3172
+ if (_optionalChain([value2, 'optionalAccess', _75 => _75.type]) === "Literal" && (typeof value2.value === "string" || typeof value2.value === "number")) {
3173
+ return String(value2.value);
3174
+ }
3175
+ if (_optionalChain([value2, 'optionalAccess', _76 => _76.type]) === "TemplateLiteral" && astArray(value2.expressions).length === 0) {
3176
+ const quasi = astArray(value2.quasis)[0];
3177
+ const cooked = _optionalChain([quasi, 'optionalAccess', _77 => _77.value]) && typeof quasi.value === "object" ? quasi.value.cooked : null;
3178
+ return typeof cooked === "string" ? cooked : null;
3179
+ }
3180
+ return null;
3181
+ };
3182
+ const property = (node, key, ancestors = /* @__PURE__ */ new Set()) => {
3183
+ if (!node) return { kind: "absent" };
3184
+ const object = resolve4(node);
3185
+ if (_optionalChain([object, 'optionalAccess', _78 => _78.type]) === "Literal" && object.value == null)
3186
+ return { kind: "absent" };
3187
+ if (_optionalChain([object, 'optionalAccess', _79 => _79.type]) !== "ObjectExpression" || ancestors.has(object))
3188
+ return { kind: "unknown" };
3189
+ const next = new Set(ancestors).add(object);
3190
+ for (const entry of astArray(object.properties).reverse()) {
3191
+ if (entry.type === "SpreadElement") {
3192
+ const spread = property(
3193
+ isAstNode(entry.argument) ? entry.argument : null,
3194
+ key,
3195
+ next
3196
+ );
3197
+ if (spread.kind !== "absent") return spread;
3198
+ continue;
3199
+ }
3200
+ if (entry.type !== "Property") return { kind: "unknown" };
3201
+ const name = entry.computed ? staticKey(isAstNode(entry.key) ? entry.key : null) : _nullishCoalesce(identifier(entry.key), () => ( staticKey(isAstNode(entry.key) ? entry.key : null)));
3202
+ if (name === null) return { kind: "unknown" };
3203
+ if (name !== key) continue;
3204
+ if (entry.kind !== "init" || entry.method) return { kind: "unknown" };
3205
+ return isAstNode(entry.value) ? { kind: "found", value: entry.value } : { kind: "unknown" };
3206
+ }
3207
+ return { kind: "absent" };
3208
+ };
3209
+ const callMarker = (call) => {
3210
+ const args = astArray(call.arguments);
3211
+ const first = resolve4(_nullishCoalesce(args[0], () => ( null)));
3212
+ const objectForm = _optionalChain([first, 'optionalAccess', _80 => _80.type]) === "ObjectExpression" || args.length === 1;
3213
+ const options = objectForm ? _nullishCoalesce(args[0], () => ( null)) : _nullishCoalesce(args[2], () => ( null));
3214
+ const direct = property(options, "compatibility");
3215
+ let compatibility = direct;
3216
+ if (direct.kind === "absent" || direct.kind === "found" && _optionalChain([resolve4, 'call', _81 => _81(direct.value), 'optionalAccess', _82 => _82.type]) === "Literal" && _optionalChain([resolve4, 'call', _83 => _83(direct.value), 'optionalAccess', _84 => _84.value]) == null) {
3217
+ const bindings = objectForm ? property(options, "bindings") : { kind: "absent" };
3218
+ compatibility = bindings.kind === "found" ? property(bindings.value, "compatibility") : bindings;
3219
+ }
3220
+ return compatibility.kind === "found" ? property(compatibility.value, "authoringContract") : compatibility;
3221
+ };
3222
+ const reachesMarker = (node, seen = /* @__PURE__ */ new Set()) => {
3223
+ const value2 = resolve4(node);
3224
+ if (!value2 || seen.has(value2)) return false;
3225
+ seen.add(value2);
3226
+ if ([
3227
+ "FunctionExpression",
3228
+ "ArrowFunctionExpression",
3229
+ "FunctionDeclaration"
3230
+ ].includes(value2.type))
3231
+ return false;
3232
+ if ((isDefinePlayCall(value2) || value2.type === "CallExpression" && defineAliases.has(_nullishCoalesce(identifier(value2.callee), () => ( "")))) && callMarker(value2).kind !== "absent")
3233
+ return true;
3234
+ return Object.values(value2).some(
3235
+ (child) => isAstNode(child) ? reachesMarker(child, seen) : Array.isArray(child) && astArray(child).some((entry) => reachesMarker(entry, seen))
3236
+ );
3237
+ };
3238
+ const requested = _nullishCoalesce(exportName, () => ( "default"));
3239
+ const local = exports.get(requested);
3240
+ const expression = resolve4(
3241
+ _nullishCoalesce(_nullishCoalesce(local, () => ( legacyExports.get(requested))), () => ( (exportName === null ? _nullishCoalesce(definitions[0], () => ( null)) : null)))
3242
+ );
3243
+ if (!expression || expression.type !== "CallExpression") {
3244
+ return {
3245
+ marker: {
3246
+ kind: local && !expression || reachesMarker(expression) ? "unknown" : "absent"
3247
+ },
3248
+ localExport: false
3249
+ };
3250
+ }
3251
+ const recognized = isDefinePlayCall(expression);
3252
+ const marker = callMarker(expression);
3253
+ if (!recognized && marker.kind === "absent" && reachesMarker(expression)) {
3254
+ return { marker: { kind: "unknown" }, localExport: false };
3255
+ }
3256
+ if (marker.kind !== "found") return { marker, localExport: Boolean(local) };
3257
+ if (!recognized) return { marker: { kind: "unknown" }, localExport: false };
3258
+ const value = resolve4(marker.value);
3259
+ return {
3260
+ marker: _optionalChain([value, 'optionalAccess', _85 => _85.type]) === "Literal" ? { kind: "value", value: value.value } : { kind: "unknown" },
3261
+ localExport: Boolean(local),
3262
+ definition: expression
3263
+ };
3264
+ }
3265
+ function resolvePlaySourceAuthoringContractEdition(marker, pinnedEdition) {
3266
+ if (marker.kind === "unknown") {
3267
+ throw new PlayAuthoringFieldValidationError(
3268
+ "compatibility.authoringContract",
3269
+ "play_authoring_binding_invalid",
3270
+ 'compatibility.authoringContract must be statically resolvable; declare "explicit-freshness" to opt into explicit freshness.'
3271
+ );
3272
+ }
3273
+ if (marker.kind === "absent")
3274
+ return _nullishCoalesce(pinnedEdition, () => ( PLAY_AUTHORING_CONTRACT_EDITION));
3275
+ validatePlayAuthoringField("compatibility.authoringContract", marker.value);
3276
+ if (pinnedEdition !== void 0 && pinnedEdition !== 10 && pinnedEdition !== PLAY_AUTHORING_CONTRACT_EDITION) {
3277
+ throw new PlayAuthoringFieldValidationError(
3278
+ "compatibility.authoringContract",
3279
+ "play_authoring_binding_invalid",
3280
+ `The source explicit-freshness contract requires authoringContractEdition ${PLAY_AUTHORING_CONTRACT_EDITION}; artifact-pinned edition 10 remains valid only for an already-published artifact.`
3281
+ );
3282
+ }
3283
+ return pinnedEdition === 10 ? 10 : PLAY_AUTHORING_CONTRACT_EDITION;
3284
+ }
3285
+
1269
3286
  // ../plays/bundling/index.ts
1270
- var PLAY_BUNDLE_CACHE_NAMESPACE = "deepline-play-artifacts-docflow-jsdoc";
3287
+ var PLAY_BUNDLE_CACHE_NAMESPACE = "deepline-play-artifacts-docflow-jsdoc-pure-contracts";
1271
3288
  var PLAY_ARTIFACT_CACHE_DIR = _path.join.call(void 0, _os.tmpdir.call(void 0, ), PLAY_BUNDLE_CACHE_NAMESPACE);
1272
3289
  var PLAY_PROXY_NAMESPACE = "deepline-play-runtime-ref";
1273
3290
  var SOURCE_EXTENSIONS = [
@@ -1436,7 +3453,7 @@ function findSourceImportReferences(sourceCode) {
1436
3453
  );
1437
3454
  }
1438
3455
  function extractDefinedPlayName(sourceCode) {
1439
- return _nullishCoalesce(_optionalChain([extractDefinedPlayMetadata, 'call', _71 => _71(sourceCode, null), 'optionalAccess', _72 => _72.name]), () => ( null));
3456
+ return _nullishCoalesce(_optionalChain([extractDefinedPlayMetadata, 'call', _86 => _86(sourceCode, null), 'optionalAccess', _87 => _87.name]), () => ( null));
1440
3457
  }
1441
3458
  function parsePlaySourceAst(sourceCode) {
1442
3459
  try {
@@ -1616,14 +3633,14 @@ function staticStringFromExpression(node, context, seen = /* @__PURE__ */ new Se
1616
3633
  false
1617
3634
  );
1618
3635
  const value = left !== null && right !== null ? `${left}${right}` : null;
1619
- if (!_optionalChain([value, 'optionalAccess', _73 => _73.trim, 'call', _74 => _74()])) return null;
3636
+ if (!_optionalChain([value, 'optionalAccess', _88 => _88.trim, 'call', _89 => _89()])) return null;
1620
3637
  return trimResult ? value.trim() : value;
1621
3638
  }
1622
- const identifier = getIdentifierName3(expression);
1623
- if (!identifier || seen.has(identifier)) return null;
1624
- seen.add(identifier);
3639
+ const identifier2 = getIdentifierName3(expression);
3640
+ if (!identifier2 || seen.has(identifier2)) return null;
3641
+ seen.add(identifier2);
1625
3642
  return staticStringFromExpression(
1626
- context.declarations.get(identifier),
3643
+ context.declarations.get(identifier2),
1627
3644
  context,
1628
3645
  seen,
1629
3646
  trimResult
@@ -1647,11 +3664,11 @@ function objectExpressionFromNode(node, context, seen = /* @__PURE__ */ new Set(
1647
3664
  const expression = unwrapStaticExpression2(node);
1648
3665
  if (!expression) return null;
1649
3666
  if (expression.type === "ObjectExpression") return expression;
1650
- const identifier = getIdentifierName3(expression);
1651
- if (!identifier || seen.has(identifier)) return null;
1652
- seen.add(identifier);
3667
+ const identifier2 = getIdentifierName3(expression);
3668
+ if (!identifier2 || seen.has(identifier2)) return null;
3669
+ seen.add(identifier2);
1653
3670
  return objectExpressionFromNode(
1654
- context.declarations.get(identifier),
3671
+ context.declarations.get(identifier2),
1655
3672
  context,
1656
3673
  seen
1657
3674
  );
@@ -1719,27 +3736,42 @@ function staticNumberFromExpression(node, context, seen = /* @__PURE__ */ new Se
1719
3736
  if (expression.type === "Literal" && typeof expression.value === "number") {
1720
3737
  return expression.value;
1721
3738
  }
1722
- const identifier = getIdentifierName3(expression);
1723
- if (!identifier || seen.has(identifier)) return null;
1724
- seen.add(identifier);
3739
+ const identifier2 = getIdentifierName3(expression);
3740
+ if (!identifier2 || seen.has(identifier2)) return null;
3741
+ seen.add(identifier2);
1725
3742
  return staticNumberFromExpression(
1726
- context.declarations.get(identifier),
3743
+ context.declarations.get(identifier2),
1727
3744
  context,
1728
3745
  seen
1729
3746
  );
1730
3747
  }
1731
- function toolErrorSchemaVersionFromOptions(node, context) {
1732
- const directCompatibility = resolveStaticProperty(
1733
- node,
1734
- "compatibility",
1735
- context
1736
- );
1737
- if (directCompatibility.kind === "unknown") return null;
3748
+ function compatibilityFromOptions(node, context) {
3749
+ const direct = resolveStaticProperty(node, "compatibility", context);
3750
+ if (direct.kind !== "found") {
3751
+ if (direct.kind === "unknown") return direct;
3752
+ } else {
3753
+ let value = unwrapStaticExpression2(direct.value);
3754
+ const seen = /* @__PURE__ */ new Set();
3755
+ while (_optionalChain([value, 'optionalAccess', _90 => _90.type]) === "Identifier") {
3756
+ const name = getIdentifierName3(value);
3757
+ if (name === "undefined" && !context.declarations.has(name)) {
3758
+ value = { type: "Literal", value: void 0 };
3759
+ break;
3760
+ }
3761
+ if (seen.has(name)) return { kind: "unknown" };
3762
+ seen.add(name);
3763
+ value = unwrapStaticExpression2(context.declarations.get(name));
3764
+ }
3765
+ const nullish = _optionalChain([value, 'optionalAccess', _91 => _91.type]) === "Literal" && value.value == null;
3766
+ const voidLiteral = _optionalChain([value, 'optionalAccess', _92 => _92.type]) === "UnaryExpression" && value.operator === "void" && isAstNode(value.argument) && value.argument.type === "Literal";
3767
+ if (!nullish && !voidLiteral) return direct;
3768
+ }
1738
3769
  const bindings = resolveStaticProperty(node, "bindings", context);
1739
- if (bindings.kind === "unknown") return null;
1740
- const bindingCompatibility = bindings.kind === "found" ? resolveStaticProperty(bindings.value, "compatibility", context) : { kind: "absent" };
1741
- if (bindingCompatibility.kind === "unknown") return null;
1742
- const compatibility = directCompatibility.kind === "found" ? directCompatibility : bindingCompatibility;
3770
+ return bindings.kind === "found" ? resolveStaticProperty(bindings.value, "compatibility", context) : bindings;
3771
+ }
3772
+ function toolErrorSchemaVersionFromOptions(node, context) {
3773
+ const compatibility = compatibilityFromOptions(node, context);
3774
+ if (compatibility.kind === "unknown") return null;
1743
3775
  if (compatibility.kind === "absent") return void 0;
1744
3776
  const schema = resolveStaticProperty(
1745
3777
  compatibility.value,
@@ -1753,17 +3785,8 @@ function toolErrorSchemaVersionFromOptions(node, context) {
1753
3785
  return null;
1754
3786
  }
1755
3787
  function toolResponseReceiptRevisionFromOptions(node, context) {
1756
- const directCompatibility = resolveStaticProperty(
1757
- node,
1758
- "compatibility",
1759
- context
1760
- );
1761
- if (directCompatibility.kind === "unknown") return null;
1762
- const bindings = resolveStaticProperty(node, "bindings", context);
1763
- if (bindings.kind === "unknown") return null;
1764
- const bindingCompatibility = bindings.kind === "found" ? resolveStaticProperty(bindings.value, "compatibility", context) : { kind: "absent" };
1765
- if (bindingCompatibility.kind === "unknown") return null;
1766
- const compatibility = directCompatibility.kind === "found" ? directCompatibility : bindingCompatibility;
3788
+ const compatibility = compatibilityFromOptions(node, context);
3789
+ if (compatibility.kind === "unknown") return null;
1767
3790
  if (compatibility.kind === "absent") return void 0;
1768
3791
  const revision = resolveStaticProperty(
1769
3792
  compatibility.value,
@@ -2123,7 +4146,7 @@ function findDocflowContext(input) {
2123
4146
  if (!isAstNode(value)) continue;
2124
4147
  if (isDefinePlayCallExpression(value)) {
2125
4148
  const bounds = astNodeBounds(value);
2126
- if (bounds && bounds.start < lineEnd && bounds.end > lineStart && (!best || bounds.end - bounds.start < (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _75 => _75(best), 'optionalAccess', _76 => _76.end]), () => ( 0))) - (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _77 => _77(best), 'optionalAccess', _78 => _78.start]), () => ( 0))))) {
4149
+ if (bounds && bounds.start < lineEnd && bounds.end > lineStart && (!best || bounds.end - bounds.start < (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _93 => _93(best), 'optionalAccess', _94 => _94.end]), () => ( 0))) - (_nullishCoalesce(_optionalChain([astNodeBounds, 'call', _95 => _95(best), 'optionalAccess', _96 => _96.start]), () => ( 0))))) {
2127
4150
  best = value;
2128
4151
  }
2129
4152
  }
@@ -2227,7 +4250,7 @@ function instrumentPlayDocflowRuntimeHits(sourceCode) {
2227
4250
  }
2228
4251
  const lineStart = lineStarts[binding.line - 1];
2229
4252
  if (lineStart !== void 0) {
2230
- const indentationLength = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _79 => _79.exec, 'call', _80 => _80(sourceCode.slice(lineStart)), 'optionalAccess', _81 => _81[0], 'access', _82 => _82.length]), () => ( 0));
4253
+ const indentationLength = _nullishCoalesce(_optionalChain([/^\s*/, 'access', _97 => _97.exec, 'call', _98 => _98(sourceCode.slice(lineStart)), 'optionalAccess', _99 => _99[0], 'access', _100 => _100.length]), () => ( 0));
2231
4254
  replacements.push({
2232
4255
  start: lineStart + indentationLength,
2233
4256
  end: lineStart + indentationLength,
@@ -2559,20 +4582,35 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
2559
4582
  })).sort((left, right) => left.filePath.localeCompare(right.filePath))
2560
4583
  })
2561
4584
  );
2562
- const metadata = _nullishCoalesce(extractDefinedPlayMetadata(sourceCode, exportName), () => ( (exportName === "default" ? extractDefinedPlayMetadata(sourceCode, null) : null)));
2563
- if (_optionalChain([metadata, 'optionalAccess', _83 => _83.toolErrorSchemaVersionUnknown])) {
4585
+ const sourceAst = parsePlaySourceAst(sourceCode);
4586
+ if (!sourceAst)
2564
4587
  throw new Error(
2565
- "definePlay compatibility.toolErrorSchemaVersion must be the static literal 0 or 1."
2566
- );
2567
- }
2568
- if (_optionalChain([metadata, 'optionalAccess', _84 => _84.toolResponseReceiptRevisionUnknown])) {
2569
- throw new Error(
2570
- "definePlay compatibility.toolResponseReceiptRevision must be a static non-empty string."
4588
+ "Play source syntax must be valid before selecting its authoring edition."
2571
4589
  );
4590
+ const selection = extractPlaySourceAuthoringEdition(
4591
+ sourceAst,
4592
+ exportName === "default" ? null : exportName
4593
+ );
4594
+ const metadata = _nullishCoalesce((selection.marker.kind === "value" && selection.definition ? playMetadataFromDefinePlayCall(
4595
+ selection.definition,
4596
+ buildPlayMetadataContext(sourceAst)
4597
+ ) : extractDefinedPlayMetadata(sourceCode, exportName)), () => ( (exportName === "default" ? extractDefinedPlayMetadata(sourceCode, null) : null)));
4598
+ const compatibilityDiagnostic = _optionalChain([metadata, 'optionalAccess', _101 => _101.toolErrorSchemaVersionUnknown]) ? "definePlay compatibility.toolErrorSchemaVersion must be the static literal 0 or 1." : _optionalChain([metadata, 'optionalAccess', _102 => _102.toolResponseReceiptRevisionUnknown]) ? "definePlay compatibility.toolResponseReceiptRevision must be a static non-empty string." : null;
4599
+ try {
4600
+ resolvePlaySourceAuthoringContractEdition(selection.marker);
4601
+ } catch (error) {
4602
+ if (compatibilityDiagnostic && selection.marker.kind === "unknown") {
4603
+ throw new Error(
4604
+ `${compatibilityDiagnostic}
4605
+ ${error instanceof Error ? error.message : String(error)}`
4606
+ );
4607
+ }
4608
+ throw error;
2572
4609
  }
2573
- const playName = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _85 => _85.name]), () => ( null));
2574
- const playDescription = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _86 => _86.description]), () => ( null));
2575
- const sandboxRuntimeDeclaration = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _87 => _87.sandboxRuntimeDeclaration]), () => ( null));
4610
+ if (compatibilityDiagnostic) throw new Error(compatibilityDiagnostic);
4611
+ const playName = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _103 => _103.name]), () => ( null));
4612
+ const playDescription = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _104 => _104.description]), () => ( null));
4613
+ const sandboxRuntimeDeclaration = _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _105 => _105.sandboxRuntimeDeclaration]), () => ( null));
2576
4614
  return {
2577
4615
  sourceCode,
2578
4616
  sourceFiles: Object.fromEntries(
@@ -2590,8 +4628,10 @@ async function analyzeSourceGraph(entryFile, adapter, exportName) {
2590
4628
  playName,
2591
4629
  playDescription,
2592
4630
  sandboxRuntimeDeclaration,
2593
- toolErrorSchemaVersion: _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _88 => _88.toolErrorSchemaVersion]), () => ( null)),
2594
- toolResponseReceiptRevision: _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _89 => _89.toolResponseReceiptRevision]), () => ( null)),
4631
+ toolErrorSchemaVersion: _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _106 => _106.toolErrorSchemaVersion]), () => ( null)),
4632
+ toolResponseReceiptRevision: _nullishCoalesce(_optionalChain([metadata, 'optionalAccess', _107 => _107.toolResponseReceiptRevision]), () => ( null)),
4633
+ sourceAuthoringEdition: selection.marker,
4634
+ sourceHasLocalPlayExport: selection.localExport,
2595
4635
  importedPlayDependencies: [...importedPlayDependencies.values()].sort(
2596
4636
  (left, right) => left.filePath.localeCompare(right.filePath)
2597
4637
  )
@@ -2633,7 +4673,7 @@ async function writeArtifactCache(artifact, adapter) {
2633
4673
  /* turbopackIgnore: true */
2634
4674
  artifactCachePath(
2635
4675
  artifact.graphHash,
2636
- _nullishCoalesce(artifact.artifactKind, () => ( _chunkS6R3OX7Bjs.PLAY_ARTIFACT_KINDS.cjsNode20)),
4676
+ _nullishCoalesce(artifact.artifactKind, () => ( _chunkE4CABWXLjs.PLAY_ARTIFACT_KINDS.cjsNode20)),
2637
4677
  adapter
2638
4678
  ),
2639
4679
  JSON.stringify(artifact),
@@ -2705,9 +4745,9 @@ async function runEsbuildForCjsNode(entryFile, customerSourceFilePaths, imported
2705
4745
  (plugin) => plugin != null
2706
4746
  )
2707
4747
  });
2708
- const codeFile = _optionalChain([result, 'access', _90 => _90.outputFiles, 'optionalAccess', _91 => _91.find, 'call', _92 => _92((f) => f.path.endsWith(".cjs"))]);
2709
- const mapFile = _optionalChain([result, 'access', _93 => _93.outputFiles, 'optionalAccess', _94 => _94.find, 'call', _95 => _95((f) => f.path.endsWith(".cjs.map"))]);
2710
- if (!_optionalChain([codeFile, 'optionalAccess', _96 => _96.text]) || !_optionalChain([mapFile, 'optionalAccess', _97 => _97.text])) {
4748
+ const codeFile = _optionalChain([result, 'access', _108 => _108.outputFiles, 'optionalAccess', _109 => _109.find, 'call', _110 => _110((f) => f.path.endsWith(".cjs"))]);
4749
+ const mapFile = _optionalChain([result, 'access', _111 => _111.outputFiles, 'optionalAccess', _112 => _112.find, 'call', _113 => _113((f) => f.path.endsWith(".cjs.map"))]);
4750
+ if (!_optionalChain([codeFile, 'optionalAccess', _114 => _114.text]) || !_optionalChain([mapFile, 'optionalAccess', _115 => _115.text])) {
2711
4751
  return ["Play bundling produced incomplete output."];
2712
4752
  }
2713
4753
  return {
@@ -2718,22 +4758,39 @@ async function runEsbuildForCjsNode(entryFile, customerSourceFilePaths, imported
2718
4758
  }
2719
4759
  async function bundlePlayFile(filePath, options) {
2720
4760
  const adapter = options.adapter;
2721
- const target = _nullishCoalesce(options.target, () => ( _chunkS6R3OX7Bjs.PLAY_ARTIFACT_KINDS.cjsNode20));
2722
- const exportName = _optionalChain([options, 'access', _98 => _98.exportName, 'optionalAccess', _99 => _99.trim, 'call', _100 => _100()]) || "default";
4761
+ const target = _nullishCoalesce(options.target, () => ( _chunkE4CABWXLjs.PLAY_ARTIFACT_KINDS.cjsNode20));
4762
+ const exportName = _optionalChain([options, 'access', _116 => _116.exportName, 'optionalAccess', _117 => _117.trim, 'call', _118 => _118()]) || "default";
2723
4763
  assertValidExportName(exportName);
2724
4764
  const absolutePath = await normalizeLocalPath(filePath);
2725
4765
  const sourceIdentityRoot = adapter.sourceIdentityRoot;
2726
- _optionalChain([adapter, 'access', _101 => _101.warnAboutNonDevelopmentBundling, 'optionalCall', _102 => _102(absolutePath)]);
4766
+ _optionalChain([adapter, 'access', _119 => _119.warnAboutNonDevelopmentBundling, 'optionalCall', _120 => _120(absolutePath)]);
2727
4767
  try {
4768
+ const preservedCompatibility = options.compatibility === void 0 ? void 0 : {
4769
+ ...options.compatibility,
4770
+ authoringContractEdition: normalizePlayContractCompatibility(
4771
+ options.compatibility
4772
+ ).authoringContractEdition
4773
+ };
2728
4774
  const analysis = await analyzeSourceGraph(
2729
4775
  absolutePath,
2730
4776
  adapter,
2731
4777
  exportName
2732
4778
  );
4779
+ const edition = resolvePlaySourceAuthoringContractEdition(
4780
+ analysis.sourceAuthoringEdition,
4781
+ _optionalChain([preservedCompatibility, 'optionalAccess', _121 => _121.authoringContractEdition])
4782
+ );
4783
+ const markedSource = analysis.sourceAuthoringEdition.kind === "value";
4784
+ if (markedSource && !analysis.sourceHasLocalPlayExport) {
4785
+ throw new Error(
4786
+ "Edition 10 source must select a local ESM definePlay export."
4787
+ );
4788
+ }
2733
4789
  analysis.graphHash = sha256(
2734
4790
  `${analysis.graphHash}
2735
4791
  entry-export:${exportName}
2736
- authoring-contract-edition:${_chunkZ4VNJOF7js.PLAY_AUTHORING_CONTRACT_EDITION}`
4792
+ authoring-contract-edition:${edition}${edition >= 10 ? "\nimported-proxy-options:description" : ""}${preservedCompatibility === void 0 ? "\ndataset-row-input:current_run" : `
4793
+ preserved-compatibility:${JSON.stringify(preservedCompatibility)}`}`
2737
4794
  );
2738
4795
  const sourceFiles = Object.fromEntries(
2739
4796
  Object.entries(analysis.sourceFiles).map(([sourcePath, sourceCode]) => [
@@ -2758,7 +4815,7 @@ authoring-contract-edition:${_chunkZ4VNJOF7js.PLAY_AUTHORING_CONTRACT_EDITION}`
2758
4815
  };
2759
4816
  }
2760
4817
  const typecheckErrors = [
2761
- ...await _asyncNullishCoalesce(await _optionalChain([adapter, 'access', _103 => _103.typecheckPlaySource, 'optionalCall', _104 => _104({
4818
+ ...await _asyncNullishCoalesce(await _optionalChain([adapter, 'access', _122 => _122.typecheckPlaySource, 'optionalCall', _123 => _123({
2762
4819
  sourceCode: analysis.sourceCode,
2763
4820
  sourcePath: absolutePath,
2764
4821
  importedFilePaths: [
@@ -2799,13 +4856,16 @@ authoring-contract-edition:${_chunkZ4VNJOF7js.PLAY_AUTHORING_CONTRACT_EDITION}`
2799
4856
  success: true,
2800
4857
  artifact: {
2801
4858
  ...cachedArtifact,
4859
+ ...markedSource ? { exportName } : {},
2802
4860
  entryFile,
2803
4861
  sourceHash: analysis.sourceHash,
2804
4862
  importPolicy,
2805
- compatibility: buildPlayContractCompatibility({
4863
+ compatibility: _nullishCoalesce(preservedCompatibility, () => ( buildPlayContractCompatibility({
4864
+ authoringContractEdition: edition,
4865
+ datasetRowInput: "current_run",
2806
4866
  toolErrorSchemaVersion: _nullishCoalesce(analysis.toolErrorSchemaVersion, () => ( void 0)),
2807
4867
  toolResponseReceiptRevision: _nullishCoalesce(analysis.toolResponseReceiptRevision, () => ( void 0))
2808
- }),
4868
+ }))),
2809
4869
  cacheHit: true
2810
4870
  },
2811
4871
  sourceCode: analysis.sourceCode,
@@ -2858,6 +4918,7 @@ authoring-contract-edition:${_chunkZ4VNJOF7js.PLAY_AUTHORING_CONTRACT_EDITION}`
2858
4918
  };
2859
4919
  }
2860
4920
  const artifact = {
4921
+ ...markedSource ? { exportName } : {},
2861
4922
  codeFormat: "cjs_module",
2862
4923
  artifactKind: target,
2863
4924
  entryFile,
@@ -2869,10 +4930,12 @@ authoring-contract-edition:${_chunkZ4VNJOF7js.PLAY_AUTHORING_CONTRACT_EDITION}`
2869
4930
  bundledCode: executableCode,
2870
4931
  sourceMap: normalizedSourceMap,
2871
4932
  importPolicy,
2872
- compatibility: buildPlayContractCompatibility({
4933
+ compatibility: _nullishCoalesce(preservedCompatibility, () => ( buildPlayContractCompatibility({
4934
+ authoringContractEdition: edition,
4935
+ datasetRowInput: "current_run",
2873
4936
  toolErrorSchemaVersion: _nullishCoalesce(analysis.toolErrorSchemaVersion, () => ( void 0)),
2874
4937
  toolResponseReceiptRevision: _nullishCoalesce(analysis.toolResponseReceiptRevision, () => ( void 0))
2875
- }),
4938
+ }))),
2876
4939
  generatedAt: Date.now(),
2877
4940
  cacheHit: false
2878
4941
  };
@@ -2943,8 +5006,8 @@ var PLAY_RUNTIME_PROVIDERS = {
2943
5006
  // Server runs execute on Daytona; the local-dev/test shape swaps the runner
2944
5007
  // axis to local_process (same as the local profile) via an explicit
2945
5008
  // runtimeBackend override at submit while tests drive local_process.
2946
- runner: _chunkS6R3OX7Bjs.PLAY_RUNTIME_BACKENDS.daytona,
2947
- artifactKind: _chunkS6R3OX7Bjs.PLAY_ARTIFACT_KINDS.cjsNode20,
5009
+ runner: _chunkE4CABWXLjs.PLAY_RUNTIME_BACKENDS.daytona,
5010
+ artifactKind: _chunkE4CABWXLjs.PLAY_ARTIFACT_KINDS.cjsNode20,
2948
5011
  label: "Absurd (Postgres-native durable) scheduler + one-shot Daytona runner"
2949
5012
  }
2950
5013
  };
@@ -2952,7 +5015,7 @@ function defaultPlayRuntimeProvider() {
2952
5015
  return PLAY_RUNTIME_PROVIDERS.absurd;
2953
5016
  }
2954
5017
  function resolvePlayRuntimeProvider(override) {
2955
- if (_optionalChain([override, 'optionalAccess', _105 => _105.trim, 'call', _106 => _106()])) {
5018
+ if (_optionalChain([override, 'optionalAccess', _124 => _124.trim, 'call', _125 => _125()])) {
2956
5019
  const id = override.trim();
2957
5020
  if (id in PLAY_RUNTIME_PROVIDERS) {
2958
5021
  return PLAY_RUNTIME_PROVIDERS[id];
@@ -2978,7 +5041,7 @@ function resolveExecutionProfile(override) {
2978
5041
  try {
2979
5042
  return resolvePlayRuntimeProvider(override);
2980
5043
  } catch (error) {
2981
- if (_optionalChain([override, 'optionalAccess', _107 => _107.trim, 'call', _108 => _108()])) {
5044
+ if (_optionalChain([override, 'optionalAccess', _126 => _126.trim, 'call', _127 => _127()])) {
2982
5045
  throw new Error(
2983
5046
  `Unknown execution profile "${override.trim()}". Expected one of: ${Object.keys(
2984
5047
  PLAY_EXECUTION_PROFILES
@@ -2992,7 +5055,7 @@ function resolveEnabledExecutionProfile(override) {
2992
5055
  try {
2993
5056
  return resolveEnabledPlayRuntimeProvider(override);
2994
5057
  } catch (error) {
2995
- if (_optionalChain([override, 'optionalAccess', _109 => _109.trim, 'call', _110 => _110()]) && error instanceof Error && /Unsupported play runtime provider/.test(error.message)) {
5058
+ if (_optionalChain([override, 'optionalAccess', _128 => _128.trim, 'call', _129 => _129()]) && error instanceof Error && /Unsupported play runtime provider/.test(error.message)) {
2996
5059
  throw new Error(
2997
5060
  `Unknown execution profile "${override.trim()}". Expected one of: ${Object.keys(
2998
5061
  PLAY_EXECUTION_PROFILES
@@ -3219,7 +5282,7 @@ function localImportSpecifiers(sourceCode) {
3219
5282
  for (const match of source.matchAll(
3220
5283
  /\b(?:import|export)\s+(?!type\b)(?:[\s\S]*?\s+from\s*)?['"]([^'"]+)['"]/g
3221
5284
  )) {
3222
- if (_optionalChain([match, 'access', _111 => _111[1], 'optionalAccess', _112 => _112.startsWith, 'call', _113 => _113(".")])) specifiers.push(match[1]);
5285
+ if (_optionalChain([match, 'access', _130 => _130[1], 'optionalAccess', _131 => _131.startsWith, 'call', _132 => _132(".")])) specifiers.push(match[1]);
3223
5286
  }
3224
5287
  for (const match of source.matchAll(
3225
5288
  /\brequire\s*\(\s*(['"])(\.[^'"]*)\1\s*\)/g
@@ -3400,7 +5463,10 @@ function createSdkPlayBundlingAdapter() {
3400
5463
  return {
3401
5464
  projectRoot: PROJECT_ROOT,
3402
5465
  nodeModulesDir: HAS_PACKAGED_BUNDLING_SOURCES ? _path.resolve.call(void 0, SDK_PACKAGE_ROOT, "node_modules") : _path.resolve.call(void 0, PROJECT_ROOT, "node_modules"),
3403
- cacheDir: _path.join.call(void 0, _os.tmpdir.call(void 0, ), PLAY_BUNDLE_CACHE_NAMESPACE),
5466
+ // Emit the current SDK/compiler implementation on every invocation. The
5467
+ // customer graph hash does not include SDK/compiler source bytes, so reusing an
5468
+ // artifact can silently retain an older compiler or SDK implementation.
5469
+ cacheDir: null,
3404
5470
  sdkSourceRoot: SDK_SOURCE_ROOT,
3405
5471
  sdkPackageJson: SDK_PACKAGE_JSON,
3406
5472
  sdkEntryFile: SDK_ENTRY_FILE,
@@ -3417,6 +5483,7 @@ async function bundlePlayFile2(filePath, options = {}) {
3417
5483
  const result = await bundlePlayFile(filePath, {
3418
5484
  target: _nullishCoalesce(options.target, () => ( defaultPlayBundleTarget())),
3419
5485
  exportName: options.exportName,
5486
+ compatibility: options.compatibility,
3420
5487
  adapter: {
3421
5488
  ...createSdkPlayBundlingAdapter(),
3422
5489
  sourceIdentityRoot,
@@ -3429,7 +5496,7 @@ async function bundlePlayFile2(filePath, options = {}) {
3429
5496
  }
3430
5497
  async function bundleDeployPlayFile(entryFile, options) {
3431
5498
  return bundlePlayFile(entryFile, {
3432
- target: _chunkS6R3OX7Bjs.PLAY_ARTIFACT_KINDS.cjsNode20,
5499
+ target: _chunkE4CABWXLjs.PLAY_ARTIFACT_KINDS.cjsNode20,
3433
5500
  adapter: {
3434
5501
  ...createSdkPlayBundlingAdapter(),
3435
5502
  sourceIdentityRoot: options.sourceIdentityRoot,