deepline 0.3.461 → 0.3.463

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 (297) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +7593 -0
  2. package/dist/bundling-sources/sdk/src/client.ts +8 -7366
  3. package/dist/bundling-sources/sdk/src/http-core.ts +1239 -0
  4. package/dist/bundling-sources/sdk/src/http.ts +6 -1231
  5. package/dist/bundling-sources/sdk/src/index.ts +4 -1
  6. package/dist/bundling-sources/sdk/src/play.ts +5 -5
  7. package/dist/bundling-sources/sdk/src/plays/client-core.ts +437 -0
  8. package/dist/bundling-sources/sdk/src/plays/client.ts +4 -421
  9. package/dist/bundling-sources/sdk/src/plays/input-example.ts +3 -4
  10. package/dist/bundling-sources/sdk/src/plays/play-description.ts +1 -1
  11. package/dist/bundling-sources/sdk/src/plays/run-request.ts +1 -1
  12. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  13. package/dist/bundling-sources/sdk/src/server.ts +43 -0
  14. package/dist/bundling-sources/sdk/src/types.ts +15 -5
  15. package/dist/bundling-sources/shared_libs/integration-contracts/billing-entitlements.ts +15 -0
  16. package/dist/bundling-sources/shared_libs/monitors/billing/tamradar.ts +17 -17
  17. package/dist/bundling-sources/shared_libs/monitors/callback-security.ts +0 -307
  18. package/dist/bundling-sources/shared_libs/monitors/http-error-response.ts +3 -0
  19. package/dist/bundling-sources/shared_libs/monitors/lifecycle-notifications.ts +3 -2
  20. package/dist/bundling-sources/shared_libs/monitors/package.json +2 -0
  21. package/dist/bundling-sources/shared_libs/monitors/provider-callback-verification.ts +34 -0
  22. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-batch-operation.ts +61 -0
  23. package/dist/bundling-sources/shared_libs/monitors/provider-monitor-upstream-identity.ts +122 -2
  24. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-dead-letter.ts +11 -1
  25. package/dist/bundling-sources/shared_libs/monitors/signal-radars/inbound-failure-codes.ts +24 -0
  26. package/dist/bundling-sources/shared_libs/observability/dlq.ts +32 -0
  27. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +57 -3
  28. package/dist/bundling-sources/shared_libs/observability/scheduled-work.ts +1 -0
  29. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +66 -1
  30. package/dist/bundling-sources/shared_libs/play-data-plane/sheet-column-storage.ts +36 -7
  31. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +250 -11
  32. package/dist/bundling-sources/shared_libs/play-runtime/array-input-store.ts +319 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +991 -359
  34. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +17 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-janitor.ts +13 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/daytona-sandbox-reaper.ts +110 -0
  37. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-machines.ts +155 -6
  38. package/dist/bundling-sources/shared_libs/play-runtime/deployment/fly-registry.ts +110 -6
  39. package/dist/bundling-sources/shared_libs/play-runtime/durable-receipt-execution.ts +127 -13
  40. package/dist/bundling-sources/shared_libs/play-runtime/execution-capabilities.ts +14 -1
  41. package/dist/bundling-sources/shared_libs/play-runtime/fixture-behavior.ts +57 -1
  42. package/dist/bundling-sources/shared_libs/play-runtime/free-company-lookup-batching.ts +218 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/gateway-postgres-admission.ts +42 -5
  44. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-budget-state-backend.ts +6 -1
  45. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +92 -31
  46. package/dist/bundling-sources/shared_libs/play-runtime/governor/block-reserving-budget-state-backend.ts +69 -14
  47. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +93 -23
  48. package/dist/bundling-sources/shared_libs/play-runtime/governor/in-memory-rate-state-backend.ts +15 -4
  49. package/dist/bundling-sources/shared_libs/play-runtime/governor/policy.ts +22 -18
  50. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +5 -0
  51. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +2 -0
  52. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +190 -14
  53. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +131 -0
  54. package/dist/bundling-sources/shared_libs/play-runtime/modal-runtime-config.ts +77 -2
  55. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +271 -2
  56. package/dist/bundling-sources/shared_libs/play-runtime/play-run-recovery-policy.ts +51 -0
  57. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/contracts.ts +2 -0
  58. package/dist/bundling-sources/shared_libs/play-runtime/play-runs/sandbox-cleanup/job.ts +27 -1
  59. package/dist/bundling-sources/shared_libs/play-runtime/play-runtime-batching-registry.ts +2 -0
  60. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +3 -0
  61. package/dist/bundling-sources/shared_libs/play-runtime/provider-text-for-log.ts +63 -0
  62. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +19 -0
  63. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger-event-transport.ts +112 -16
  64. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +104 -2
  65. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/index.ts +265 -151
  66. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-gateway-transport.ts +17 -0
  67. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-progress-push.ts +35 -14
  68. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-sheet-persistence-retry.ts +12 -1
  69. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-control-transport.ts +4 -0
  70. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-labels.ts +36 -0
  71. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-launch-transport.ts +136 -70
  72. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-lifecycle.ts +237 -36
  73. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-runtime-watchdog.ts +148 -4
  74. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona-session-execution.ts +6 -0
  75. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/daytona.ts +285 -32
  76. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/backends/modal.ts +251 -56
  77. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/runtime-sandbox-reconciliation.ts +29 -4
  78. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/sandbox-create-outcome.ts +27 -0
  79. package/dist/bundling-sources/shared_libs/play-runtime/runner-backends/types.ts +22 -1
  80. package/dist/bundling-sources/shared_libs/play-runtime/runtime-api.ts +1397 -382
  81. package/dist/bundling-sources/shared_libs/play-runtime/runtime-array-input-receipts.ts +920 -0
  82. package/dist/bundling-sources/shared_libs/play-runtime/runtime-constants.ts +16 -0
  83. package/dist/bundling-sources/shared_libs/play-runtime/runtime-environment.ts +38 -0
  84. package/dist/bundling-sources/shared_libs/play-runtime/runtime-flow.ts +6 -0
  85. package/dist/bundling-sources/shared_libs/play-runtime/runtime-incident-drills.ts +26 -1
  86. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +30 -0
  87. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-store-adapter.ts +14 -3
  88. package/dist/bundling-sources/shared_libs/play-runtime/runtime-receipt-writer.ts +31 -4
  89. package/dist/bundling-sources/shared_libs/play-runtime/runtime-sheet-row-transition.ts +47 -0
  90. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +20 -7
  91. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/contract.ts +12 -0
  92. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/index.ts +9 -0
  93. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-runs/runner-backend-adapter.ts +10 -0
  94. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +4 -0
  95. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +1496 -320
  96. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-worker-required-env.ts +31 -1
  97. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +1389 -129
  98. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/receipt-gateway.ts +36 -0
  99. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-dispatch-authority.ts +4 -0
  100. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/run-ledger-outbox-recovery.ts +162 -23
  101. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-event-search.ts +499 -115
  102. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +377 -9
  103. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-ledger-reconciliation.ts +117 -8
  104. package/dist/bundling-sources/shared_libs/play-runtime/secret-resolution-retry-policy.ts +25 -0
  105. package/dist/bundling-sources/shared_libs/play-runtime/terminal-runtime-performance.ts +391 -0
  106. package/dist/bundling-sources/shared_libs/play-runtime/test-runtime-seams.ts +40 -0
  107. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/index.ts +6 -0
  108. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/mapped-calls.ts +171 -0
  109. package/dist/bundling-sources/shared_libs/play-runtime/tool-call/receipt-cohort.ts +16 -1
  110. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +38 -12
  111. package/dist/bundling-sources/shared_libs/play-runtime/tool-result.ts +33 -9
  112. package/dist/bundling-sources/shared_libs/play-runtime/transport-error-diagnostics.ts +28 -0
  113. package/dist/bundling-sources/shared_libs/play-runtime/work-receipt-storage-contract.ts +55 -5
  114. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +41 -1
  115. package/dist/bundling-sources/shared_libs/plays/contracts.ts +4 -0
  116. package/dist/bundling-sources/shared_libs/plays/dataset.ts +9 -3
  117. package/dist/bundling-sources/shared_libs/plays/deploy/manifest-contract.ts +2 -0
  118. package/dist/bundling-sources/shared_libs/plays/deploy/manifest.ts +3 -2
  119. package/dist/bundling-sources/shared_libs/plays/deploy/project-serializer.ts +2 -2
  120. package/dist/bundling-sources/shared_libs/plays/run-output-summary.ts +66 -0
  121. package/dist/bundling-sources/shared_libs/plays/script-entry.ts +1 -1
  122. package/dist/bundling-sources/shared_libs/product-notifications/catalog.ts +43 -1
  123. package/dist/bundling-sources/shared_libs/product-notifications/content.ts +9 -0
  124. package/dist/bundling-sources/shared_libs/product-notifications/email.ts +91 -13
  125. package/dist/bundling-sources/shared_libs/product-notifications/events.ts +3 -0
  126. package/dist/bundling-sources/shared_libs/product-notifications/slack-delivery.ts +41 -24
  127. package/dist/bundling-sources/shared_libs/security/attested-client-ip.ts +91 -0
  128. package/dist/bundling-sources/shared_libs/security/internal-actor.ts +0 -11
  129. package/dist/cli/{auth-6HJXNWUG.mjs → auth-LZLBR4C3.mjs} +5 -4
  130. package/dist/cli/auth-XPGKBJKB.js +41 -0
  131. package/dist/cli/{billing-6P5HO6QG.js → billing-6TJPNJQD.js} +152 -78
  132. package/dist/cli/{billing-MJ42N7YF.mjs → billing-OTOP5RE4.mjs} +84 -10
  133. package/dist/cli/{chunk-FCAZQ7WV.js → chunk-2NISBXMN.js} +52 -50
  134. package/dist/cli/{chunk-PNATXKLP.js → chunk-2ZIRCBYG.js} +6 -6
  135. package/dist/cli/{chunk-5FDKJQZE.js → chunk-3BOIOCNX.js} +1 -1
  136. package/dist/cli/chunk-3BVLLJ3H.mjs +1038 -0
  137. package/dist/cli/{chunk-FJZILBL7.mjs → chunk-3U5EAP6E.mjs} +5 -5
  138. package/dist/cli/{describe-FRAVCY5F.mjs → chunk-4YZKBBLZ.mjs} +19 -36
  139. package/dist/cli/{chunk-QWRHGGUH.js → chunk-5DRNNC72.js} +20 -2
  140. package/dist/cli/{chunk-Z2GUFYT6.js → chunk-5LEAXRHV.js} +11 -11
  141. package/dist/cli/{chunk-5MDIZX7M.js → chunk-5LHXOIPT.js} +8 -6
  142. package/dist/cli/{chunk-NMJ4D2WO.js → chunk-6PMCRYDA.js} +216 -91
  143. package/dist/cli/{chunk-EBU7LQ64.js → chunk-6V7KVRR5.js} +3 -3
  144. package/dist/cli/{chunk-MGXEUZHL.mjs → chunk-7D6X7IXW.mjs} +7 -5
  145. package/dist/cli/{chunk-SAZFZQRI.js → chunk-7FCYPAPP.js} +2 -2
  146. package/dist/cli/{chunk-ACCR7POB.js → chunk-7XYDDCQ2.js} +27 -27
  147. package/dist/cli/{chunk-5IYOUBFZ.js → chunk-ALZBANZI.js} +28 -54
  148. package/dist/cli/{chunk-3DNKFH2G.mjs → chunk-BAPTQDLF.mjs} +19 -1
  149. package/dist/cli/chunk-BGNWI3KH.js +827 -0
  150. package/dist/cli/{chunk-V7REJRDZ.mjs → chunk-C25QE4CH.mjs} +1 -1
  151. package/dist/cli/{chunk-FGMX4HUZ.js → chunk-CBZP6J3V.js} +29 -27
  152. package/dist/cli/{chunk-QEYHTIV4.mjs → chunk-CTQ56DXP.mjs} +10 -1
  153. package/dist/cli/{chunk-IHHLTHE7.mjs → chunk-CVQ7N5CV.mjs} +267 -38
  154. package/dist/cli/{chunk-7DH2FD7Y.mjs → chunk-D464JW3N.mjs} +5 -85
  155. package/dist/cli/{chunk-MEAIOXJL.mjs → chunk-DHXCBITQ.mjs} +7 -5
  156. package/dist/cli/chunk-F2RHUPVH.mjs +827 -0
  157. package/dist/cli/chunk-F6QV42MC.mjs +91 -0
  158. package/dist/cli/{chunk-OZBWRICM.js → chunk-FK2HNDCN.js} +2 -2
  159. package/dist/cli/{chunk-BGY2PLP7.mjs → chunk-GUT7CLOL.mjs} +23 -49
  160. package/dist/cli/{chunk-RY4IVOU3.mjs → chunk-I624J4H5.mjs} +16 -806
  161. package/dist/cli/{chunk-Z2XUZC34.js → chunk-IAYSWZDJ.js} +188 -76
  162. package/dist/cli/{chunk-FGLKOWSC.mjs → chunk-IKWRUNAP.mjs} +1 -1
  163. package/dist/cli/{chunk-KCCOQ5G5.js → chunk-JVDKZJUH.js} +511 -282
  164. package/dist/cli/{chunk-HDFRJ4IT.mjs → chunk-JVHOS3K3.mjs} +177 -65
  165. package/dist/cli/chunk-LYFKBLJI.mjs +1039 -0
  166. package/dist/cli/{chunk-SLEUWLJE.mjs → chunk-MSY22NQW.mjs} +5 -5
  167. package/dist/cli/{chunk-5FY72YOV.js → chunk-NAPTMYTY.js} +8 -8
  168. package/dist/cli/{chunk-O6QOMHCH.js → chunk-NDHJR2WZ.js} +37 -35
  169. package/dist/cli/{chunk-KXMNM4AQ.js → chunk-NMU3VR5U.js} +4 -5
  170. package/dist/cli/chunk-NTLI6P6Y.mjs +19 -0
  171. package/dist/cli/{chunk-RFONC4WJ.mjs → chunk-O3BJYD6D.mjs} +3 -3
  172. package/dist/cli/{describe-2WQY7ZCY.js → chunk-PVY4DPPF.js} +27 -44
  173. package/dist/cli/{chunk-WIYWSYDS.mjs → chunk-Q2EIZKVX.mjs} +3 -3
  174. package/dist/cli/{chunk-VZBCEA5S.mjs → chunk-RD6IQ2JY.mjs} +223 -92
  175. package/dist/cli/chunk-RGOUCIIZ.js +1039 -0
  176. package/dist/cli/{chunk-EIMG75BT.mjs → chunk-S3A4IXBQ.mjs} +4 -5
  177. package/dist/cli/{chunk-QIW7TVV6.mjs → chunk-S4XQCFES.mjs} +14 -12
  178. package/dist/cli/chunk-SKU6ECIY.js +19 -0
  179. package/dist/cli/{chunk-CRYOUPEB.js → chunk-TIRBDQ3W.js} +16 -16
  180. package/dist/cli/{chunk-G7L27KZB.mjs → chunk-TKAQR3IB.mjs} +31 -21
  181. package/dist/cli/{chunk-MDJPEGVN.js → chunk-UC4SFYNU.js} +392 -261
  182. package/dist/cli/{chunk-3BMLICF7.mjs → chunk-UIURR26V.mjs} +13 -8
  183. package/dist/cli/{chunk-TNMBPMMC.js → chunk-UROQDCVW.js} +13 -4
  184. package/dist/cli/{chunk-R64BGGRQ.mjs → chunk-VDGTTH7K.mjs} +2 -2
  185. package/dist/cli/chunk-VLEVVDWG.js +91 -0
  186. package/dist/cli/{chunk-R2GLGLDR.mjs → chunk-VPHN2HAL.mjs} +216 -91
  187. package/dist/cli/chunk-VY2GBNTX.js +1038 -0
  188. package/dist/cli/{chunk-CFUTOWE4.js → chunk-WG3KGAII.js} +8 -88
  189. package/dist/cli/{chunk-QAJAJPKK.mjs → chunk-WUMIYOXQ.mjs} +4 -2
  190. package/dist/cli/{chunk-SCIR5JXW.js → chunk-WUZS2HK6.js} +56 -51
  191. package/dist/cli/{chunk-T3MVIPHG.mjs → chunk-XDWS2JJT.mjs} +1 -1
  192. package/dist/cli/{chunk-KGQNIA37.js → chunk-XQCTG5OO.js} +44 -34
  193. package/dist/cli/{chunk-KVJ5VHW5.mjs → chunk-XW2JIYG7.mjs} +2 -2
  194. package/dist/cli/chunk-YGGIZ3VT.js +920 -0
  195. package/dist/cli/command-docs.d.mts +5 -0
  196. package/dist/cli/command-docs.d.ts +5 -0
  197. package/dist/cli/command-docs.js +2 -2
  198. package/dist/cli/command-docs.mjs +1 -1
  199. package/dist/cli/{csv-NX7NO3O6.js → csv-EH5QWR4O.js} +13 -12
  200. package/dist/cli/{csv-DQ6GW5B5.mjs → csv-OK45Z5XQ.mjs} +4 -3
  201. package/dist/cli/{db-R72DFMP6.js → db-3ESJKETS.js} +30 -27
  202. package/dist/cli/{db-2YP33M4K.mjs → db-6Z5E4HKN.mjs} +10 -7
  203. package/dist/cli/describe-PNDQB7YS.mjs +48 -0
  204. package/dist/cli/describe-QUF7VTTR.js +48 -0
  205. package/dist/cli/describe-core.d.mts +153 -5
  206. package/dist/cli/describe-core.d.ts +153 -5
  207. package/dist/cli/describe-core.js +9 -5
  208. package/dist/cli/describe-core.mjs +10 -6
  209. package/dist/cli/{executions-WFBU7L2Q.mjs → executions-2NTWQFEG.mjs} +7 -5
  210. package/dist/cli/{executions-ZLHD4QIT.js → executions-KUOBRX5V.js} +9 -7
  211. package/dist/cli/{feedback-CN3HJFVF.mjs → feedback-7RPRMSGY.mjs} +6 -5
  212. package/dist/cli/{feedback-NDV6TPHG.js → feedback-UPHAZJ4C.js} +10 -9
  213. package/dist/cli/getting-started.d.mts +6 -6
  214. package/dist/cli/getting-started.d.ts +6 -6
  215. package/dist/cli/getting-started.js +2 -2
  216. package/dist/cli/getting-started.mjs +1 -1
  217. package/dist/cli/{git-QAD6E3HW.mjs → git-SCYP6WSZ.mjs} +5 -4
  218. package/dist/cli/git-UH653WHV.js +25 -0
  219. package/dist/cli/index.js +152 -142
  220. package/dist/cli/index.mjs +56 -46
  221. package/dist/cli/{legacy-noops-KVC5QJ74.js → legacy-noops-7XMFCVRG.js} +8 -7
  222. package/dist/cli/{legacy-noops-TPTKNBI2.mjs → legacy-noops-A4KYAGI6.mjs} +5 -4
  223. package/dist/cli/{monitors-SV57JFLO.mjs → monitors-FLC5J7RI.mjs} +19 -6
  224. package/dist/cli/{monitors-KCROV6PJ.js → monitors-NZV6IX5H.js} +103 -90
  225. package/dist/cli/{org-NJYX5743.js → org-IZ7UP3XF.js} +70 -67
  226. package/dist/cli/{org-KX6QIR7A.mjs → org-LUETJ7Z5.mjs} +9 -6
  227. package/dist/cli/pages-22ML3O7O.js +252 -0
  228. package/dist/cli/pages-EUX5EAGF.mjs +252 -0
  229. package/dist/cli/{play-IQQ57L7Z.mjs → play-CDHPAKKM.mjs} +512 -1508
  230. package/dist/cli/{play-32L7EQN4.js → play-USJBQADG.js} +1090 -2086
  231. package/dist/cli/{providers-4WEC2EQN.mjs → providers-CCXZ3SQF.mjs} +7 -5
  232. package/dist/cli/{providers-ZQV6QLVQ.js → providers-WFEUNPGC.js} +10 -8
  233. package/dist/cli/{quickstart-HKUSFADF.js → quickstart-O4JSUORZ.js} +13 -12
  234. package/dist/cli/{quickstart-RQ76RIUE.mjs → quickstart-ZUULI635.mjs} +5 -4
  235. package/dist/cli/run-ISDJYJMU.js +443 -0
  236. package/dist/cli/run-QJ4NX5F5.mjs +443 -0
  237. package/dist/cli/{search-ZRAVFBZC.mjs → search-IX3XKZJ3.mjs} +8 -6
  238. package/dist/cli/search-TIFNLRPM.js +32 -0
  239. package/dist/cli/{secrets-CMJOVNVH.mjs → secrets-7VUDXTUZ.mjs} +7 -5
  240. package/dist/cli/{secrets-J3G5Y43U.js → secrets-ELQSNCTR.js} +16 -14
  241. package/dist/cli/{sessions-WY7VN4AE.js → sessions-A3FG3AZX.js} +6 -5
  242. package/dist/cli/{sessions-MDQYY5CB.mjs → sessions-VOIQ62GB.mjs} +5 -4
  243. package/dist/cli/{settings-4RWZPCT5.mjs → settings-S6N6EFBG.mjs} +14 -11
  244. package/dist/cli/{settings-HTNTFKCE.js → settings-ZTXQEMZI.js} +80 -77
  245. package/dist/cli/{setup-P3GYYZWG.mjs → setup-AYPIK4JE.mjs} +12 -10
  246. package/dist/cli/{setup-QGCAP62X.js → setup-Y3WOIFLS.js} +53 -51
  247. package/dist/cli/{skills-7NAE4ICL.mjs → skills-5SF5QWNI.mjs} +7 -6
  248. package/dist/cli/skills-MWFRMG3H.js +31 -0
  249. package/dist/cli/tools-3XNZ4J64.mjs +55 -0
  250. package/dist/cli/tools-XEC4OD3R.js +55 -0
  251. package/dist/cli/{update-GODLRKNB.mjs → update-3U4OVX5R.mjs} +9 -8
  252. package/dist/cli/update-DWYEYTZE.js +33 -0
  253. package/dist/cli/{workflow-4BXOUVEO.mjs → workflow-2M5JP7SA.mjs} +10 -8
  254. package/dist/cli/{workflow-AO3A6LXN.js → workflow-RM7H7555.js} +20 -18
  255. package/dist/client-DS2IWYZF.d.ts +10 -0
  256. package/dist/client-DTwnz_AW.d.mts +10 -0
  257. package/dist/{client-CYqG23K1.d.ts → client-core-B_6HAIBy.d.ts} +385 -12
  258. package/dist/{client-BbU5_j7n.d.mts → client-core-DzBSlY1U.d.mts} +385 -12
  259. package/dist/{compiler-manifest-CWz_sNOQ.d.ts → compiler-manifest-Dcyd3-Zd.d.mts} +43 -1
  260. package/dist/{compiler-manifest-CWz_sNOQ.d.mts → compiler-manifest-Dcyd3-Zd.d.ts} +43 -1
  261. package/dist/errors-d-sTrZhe.d.mts +142 -0
  262. package/dist/errors-yQwfgrcX.d.ts +142 -0
  263. package/dist/{index-BF2JB_Ug.d.mts → index-C6oXchjN.d.mts} +1 -1
  264. package/dist/{index-4NPXDzlD.d.ts → index-P56zy_z5.d.ts} +1 -1
  265. package/dist/index.d.mts +11 -147
  266. package/dist/index.d.ts +11 -147
  267. package/dist/index.js +16 -12
  268. package/dist/index.mjs +15 -11
  269. package/dist/install-integrity.json +141 -104
  270. package/dist/plays/bundle-play-file.d.mts +3 -3
  271. package/dist/plays/bundle-play-file.d.ts +3 -3
  272. package/dist/plays/bundle-play-file.mjs +2 -1
  273. package/dist/plays/play-description.d.mts +2 -2
  274. package/dist/plays/play-description.d.ts +2 -2
  275. package/dist/plays/play-description.js +2 -2
  276. package/dist/plays/play-description.mjs +1 -1
  277. package/dist/plays/run-request.d.mts +2 -2
  278. package/dist/plays/run-request.d.ts +2 -2
  279. package/dist/release.d.mts +1 -1
  280. package/dist/release.d.ts +1 -1
  281. package/dist/release.js +2 -2
  282. package/dist/release.mjs +1 -1
  283. package/dist/server.d.mts +17 -0
  284. package/dist/server.d.ts +17 -0
  285. package/dist/server.js +76 -0
  286. package/dist/server.mjs +76 -0
  287. package/package.json +6 -1
  288. package/dist/cli/auth-IACERYQH.js +0 -40
  289. package/dist/cli/chunk-PQUUWFXY.js +0 -95
  290. package/dist/cli/chunk-YBWAG72P.mjs +0 -95
  291. package/dist/cli/chunk-YQDUODZW.js +0 -1710
  292. package/dist/cli/git-JVI36ZFV.js +0 -24
  293. package/dist/cli/search-75X5LTDE.js +0 -30
  294. package/dist/cli/skills-BKJ53JOQ.js +0 -30
  295. package/dist/cli/tools-COWMIEJ6.mjs +0 -45
  296. package/dist/cli/tools-TASOCE7I.js +0 -45
  297. package/dist/cli/update-SJIKVME6.js +0 -32
@@ -0,0 +1,1038 @@
1
+ import {
2
+ resolveEnabledExecutionProfile
3
+ } from "./chunk-F6QV42MC.mjs";
4
+ import {
5
+ parseLogLevel
6
+ } from "./chunk-RD6IQ2JY.mjs";
7
+ import {
8
+ setDottedInputValue
9
+ } from "./chunk-FAG4DFUC.mjs";
10
+ import {
11
+ argsWantJson,
12
+ jsonFieldArgs,
13
+ parseJsonFields
14
+ } from "./chunk-WUMIYOXQ.mjs";
15
+ import {
16
+ DeeplineError
17
+ } from "./chunk-HBL4PM5Q.mjs";
18
+
19
+ // ../play-runtime/governor/policy.ts
20
+ var DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS = 64;
21
+ var MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS = 1e3;
22
+ var MAX_CONFIGURABLE_CONCURRENT_ROWS = 1e3;
23
+ function resolveMaxConcurrentExternalCalls(requested) {
24
+ if (requested === void 0 || requested === null) {
25
+ return DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS;
26
+ }
27
+ if (!Number.isSafeInteger(requested) || requested < 1 || requested > MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS) {
28
+ throw new Error(
29
+ `maxConcurrentExternalCalls must be a whole number from 1 through ${MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS}.`
30
+ );
31
+ }
32
+ return requested;
33
+ }
34
+ function resolveMaxConcurrentRows(requested) {
35
+ if (requested === void 0 || requested === null) return null;
36
+ if (!Number.isSafeInteger(requested) || requested < 1 || requested > MAX_CONFIGURABLE_CONCURRENT_ROWS) {
37
+ throw new Error(
38
+ `maxConcurrentRows must be a whole number from 1 through ${MAX_CONFIGURABLE_CONCURRENT_ROWS}.`
39
+ );
40
+ }
41
+ return requested;
42
+ }
43
+
44
+ // src/cli/operations/play-run-options.ts
45
+ import { existsSync, readFileSync } from "fs";
46
+ import { resolve } from "path";
47
+
48
+ // ../play-runtime/fixture-behavior.ts
49
+ var FIXTURE_BEHAVIOR_VERSION = 1;
50
+ var FIXTURE_BEHAVIOR_RESPONSE_VERSION = 2;
51
+ var FIXTURE_BEHAVIOR_REPLAY_VERSION = 3;
52
+ var MAX_FIXTURE_RESPONSE_DELAY_SAMPLES = 256;
53
+ var MAX_FIXTURE_RESPONSE_DELAY_MS = 8 * 6e4;
54
+ var MAX_FIXTURE_RESPONSE_ERROR_MESSAGE_LENGTH = 500;
55
+ var MAX_FIXTURE_RETRY_AFTER_MS = 60 * 6e4;
56
+ var FIXTURE_RATE_WINDOWS = [
57
+ { field: "requestsPerSecond", name: "rps", windowMs: 1e3 },
58
+ { field: "requestsPerMinute", name: "rpm", windowMs: 6e4 },
59
+ { field: "requestsPerHour", name: "rph", windowMs: 36e5 }
60
+ ];
61
+ function isFixtureReplaySelectionSeed(value) {
62
+ return typeof value === "string" && /^[A-Za-z0-9._:-]{1,128}$/.test(value);
63
+ }
64
+ function validateFixtureBehavior(value) {
65
+ if (value === void 0 || value === null) {
66
+ return { ok: true, behavior: null };
67
+ }
68
+ if (!value || typeof value !== "object" || Array.isArray(value)) {
69
+ return { ok: false, error: "fixtureBehavior must be a JSON object." };
70
+ }
71
+ const record = value;
72
+ const supportedKeys = record.version === FIXTURE_BEHAVIOR_RESPONSE_VERSION || record.version === FIXTURE_BEHAVIOR_REPLAY_VERSION ? /* @__PURE__ */ new Set([
73
+ "version",
74
+ "responseSamples",
75
+ "transient429",
76
+ "sharedRateLimit",
77
+ ...record.version === FIXTURE_BEHAVIOR_REPLAY_VERSION ? ["replayBundle"] : []
78
+ ]) : /* @__PURE__ */ new Set(["version", "responseDelaySamplesMs"]);
79
+ const unknownKeys = Object.keys(record).filter(
80
+ (key) => !supportedKeys.has(key)
81
+ );
82
+ if (unknownKeys.length > 0) {
83
+ return {
84
+ ok: false,
85
+ error: `Unsupported fixtureBehavior field "${unknownKeys[0]}".`
86
+ };
87
+ }
88
+ if (record.version !== FIXTURE_BEHAVIOR_VERSION && record.version !== FIXTURE_BEHAVIOR_RESPONSE_VERSION && record.version !== FIXTURE_BEHAVIOR_REPLAY_VERSION) {
89
+ return {
90
+ ok: false,
91
+ error: `fixtureBehavior.version must be ${FIXTURE_BEHAVIOR_VERSION} or ${FIXTURE_BEHAVIOR_RESPONSE_VERSION}, or ${FIXTURE_BEHAVIOR_REPLAY_VERSION}.`
92
+ };
93
+ }
94
+ if (record.version === FIXTURE_BEHAVIOR_RESPONSE_VERSION || record.version === FIXTURE_BEHAVIOR_REPLAY_VERSION) {
95
+ if (!Array.isArray(record.responseSamples) || record.responseSamples.length === 0 || record.responseSamples.length > MAX_FIXTURE_RESPONSE_DELAY_SAMPLES) {
96
+ return {
97
+ ok: false,
98
+ error: `fixtureBehavior.responseSamples must contain between 1 and ${MAX_FIXTURE_RESPONSE_DELAY_SAMPLES} values.`
99
+ };
100
+ }
101
+ const samples2 = [];
102
+ for (let index = 0; index < record.responseSamples.length; index += 1) {
103
+ const value2 = record.responseSamples[index];
104
+ if (!value2 || typeof value2 !== "object" || Array.isArray(value2)) {
105
+ return {
106
+ ok: false,
107
+ error: `fixtureBehavior.responseSamples[${index}] must be an object.`
108
+ };
109
+ }
110
+ const sample = value2;
111
+ const sampleUnknownKeys = Object.keys(sample).filter(
112
+ (key) => key !== "delayMs" && key !== "when" && key !== "httpError"
113
+ );
114
+ if (sampleUnknownKeys.length > 0) {
115
+ return {
116
+ ok: false,
117
+ error: `Unsupported fixtureBehavior.responseSamples[${index}] field "${sampleUnknownKeys[0]}".`
118
+ };
119
+ }
120
+ if (typeof sample.delayMs !== "number" || !Number.isSafeInteger(sample.delayMs) || sample.delayMs < 0 || sample.delayMs > MAX_FIXTURE_RESPONSE_DELAY_MS) {
121
+ return {
122
+ ok: false,
123
+ error: `fixtureBehavior.responseSamples[${index}].delayMs must be an integer between 0 and ${MAX_FIXTURE_RESPONSE_DELAY_MS}.`
124
+ };
125
+ }
126
+ let when;
127
+ if (sample.when !== void 0) {
128
+ if (!sample.when || typeof sample.when !== "object" || Array.isArray(sample.when)) {
129
+ return {
130
+ ok: false,
131
+ error: `fixtureBehavior.responseSamples[${index}].when must be an object.`
132
+ };
133
+ }
134
+ const condition = sample.when;
135
+ const conditionUnknownKeys = Object.keys(condition).filter(
136
+ (key) => key !== "provider" && key !== "operation"
137
+ );
138
+ if (conditionUnknownKeys.length > 0) {
139
+ return {
140
+ ok: false,
141
+ error: `Unsupported fixtureBehavior.responseSamples[${index}].when field "${conditionUnknownKeys[0]}".`
142
+ };
143
+ }
144
+ const provider = normalizeFixtureScopeValue(condition.provider, 100);
145
+ const operation = normalizeFixtureScopeValue(condition.operation, 200);
146
+ if (provider.error || operation.error) {
147
+ return {
148
+ ok: false,
149
+ error: `fixtureBehavior.responseSamples[${index}].when ` + (provider.error ?? operation.error)
150
+ };
151
+ }
152
+ if (!provider.value && !operation.value) {
153
+ return {
154
+ ok: false,
155
+ error: `fixtureBehavior.responseSamples[${index}].when must select a provider or operation.`
156
+ };
157
+ }
158
+ when = {
159
+ ...provider.value ? { provider: provider.value } : {},
160
+ ...operation.value ? { operation: operation.value } : {}
161
+ };
162
+ }
163
+ let httpError;
164
+ if (sample.httpError !== void 0) {
165
+ if (!sample.httpError || typeof sample.httpError !== "object" || Array.isArray(sample.httpError)) {
166
+ return {
167
+ ok: false,
168
+ error: `fixtureBehavior.responseSamples[${index}].httpError must be an object.`
169
+ };
170
+ }
171
+ const error = sample.httpError;
172
+ const errorUnknownKeys = Object.keys(error).filter(
173
+ (key) => key !== "status" && key !== "message" && key !== "retryAfterMs" && key !== "retryAfterFormat" && key !== "failuresBeforeSuccess"
174
+ );
175
+ if (errorUnknownKeys.length > 0) {
176
+ return {
177
+ ok: false,
178
+ error: `Unsupported fixtureBehavior.responseSamples[${index}].httpError field "${errorUnknownKeys[0]}".`
179
+ };
180
+ }
181
+ if (typeof error.status !== "number" || !Number.isSafeInteger(error.status) || error.status < 400 || error.status > 599) {
182
+ return {
183
+ ok: false,
184
+ error: `fixtureBehavior.responseSamples[${index}].httpError.status must be an integer between 400 and 599.`
185
+ };
186
+ }
187
+ if (typeof error.message !== "string" || !error.message.trim() || error.message.length > MAX_FIXTURE_RESPONSE_ERROR_MESSAGE_LENGTH) {
188
+ return {
189
+ ok: false,
190
+ error: `fixtureBehavior.responseSamples[${index}].httpError.message must contain 1-${MAX_FIXTURE_RESPONSE_ERROR_MESSAGE_LENGTH} characters.`
191
+ };
192
+ }
193
+ if (error.retryAfterMs !== void 0 && (error.status !== 429 || typeof error.retryAfterMs !== "number" || !Number.isSafeInteger(error.retryAfterMs) || error.retryAfterMs < 1 || error.retryAfterMs > MAX_FIXTURE_RETRY_AFTER_MS)) {
194
+ return {
195
+ ok: false,
196
+ error: `fixtureBehavior.responseSamples[${index}].httpError.retryAfterMs requires status 429 and an integer from 1 through ${MAX_FIXTURE_RETRY_AFTER_MS}.`
197
+ };
198
+ }
199
+ if (error.retryAfterFormat !== void 0 && (error.status !== 429 || error.retryAfterFormat !== "delta_seconds" && error.retryAfterFormat !== "http_date")) {
200
+ return {
201
+ ok: false,
202
+ error: `fixtureBehavior.responseSamples[${index}].httpError.retryAfterFormat requires status 429 and delta_seconds or http_date.`
203
+ };
204
+ }
205
+ if (error.failuresBeforeSuccess !== void 0 && (![429, 500, 502, 503, 504].includes(error.status) || typeof error.failuresBeforeSuccess !== "number" || !Number.isSafeInteger(error.failuresBeforeSuccess) || error.failuresBeforeSuccess < 1 || error.failuresBeforeSuccess > 20)) {
206
+ return {
207
+ ok: false,
208
+ error: `fixtureBehavior.responseSamples[${index}].httpError.failuresBeforeSuccess requires status 429, 500, 502, 503, or 504 and an integer from 1 through 20.`
209
+ };
210
+ }
211
+ httpError = {
212
+ status: error.status,
213
+ message: error.message.trim(),
214
+ ...error.retryAfterMs !== void 0 ? { retryAfterMs: error.retryAfterMs } : {},
215
+ ...error.retryAfterFormat !== void 0 ? {
216
+ retryAfterFormat: error.retryAfterFormat
217
+ } : {},
218
+ ...error.failuresBeforeSuccess !== void 0 ? { failuresBeforeSuccess: error.failuresBeforeSuccess } : {}
219
+ };
220
+ }
221
+ samples2.push({
222
+ delayMs: sample.delayMs,
223
+ ...when ? { when } : {},
224
+ ...httpError ? { httpError } : {}
225
+ });
226
+ }
227
+ let sharedRateLimit;
228
+ if (record.sharedRateLimit !== void 0) {
229
+ const plan = record.sharedRateLimit;
230
+ if (!plan || typeof plan !== "object" || Array.isArray(plan)) {
231
+ return {
232
+ ok: false,
233
+ error: "fixtureBehavior.sharedRateLimit must be an object."
234
+ };
235
+ }
236
+ const planRecord = plan;
237
+ const entries = Object.entries(planRecord);
238
+ const boundaryAfterMs = planRecord.requestsPerHourBoundaryAfterMs;
239
+ const quotaEntries = entries.filter(
240
+ ([name]) => name !== "requestsPerHourBoundaryAfterMs"
241
+ );
242
+ if (quotaEntries.length === 0 || quotaEntries.some(
243
+ ([name, limit]) => !FIXTURE_RATE_WINDOWS.some((window) => window.field === name) || typeof limit !== "number" || !Number.isSafeInteger(limit) || limit < 1
244
+ )) {
245
+ return {
246
+ ok: false,
247
+ error: "fixtureBehavior.sharedRateLimit requires positive integer requestsPerSecond, requestsPerMinute, or requestsPerHour quotas."
248
+ };
249
+ }
250
+ if (boundaryAfterMs !== void 0 && (planRecord.requestsPerHour === void 0 || typeof boundaryAfterMs !== "number" || !Number.isSafeInteger(boundaryAfterMs) || boundaryAfterMs < 1e3 || boundaryAfterMs > 3e5)) {
251
+ return {
252
+ ok: false,
253
+ error: "fixtureBehavior.sharedRateLimit.requestsPerHourBoundaryAfterMs requires requestsPerHour and an integer from 1000 through 300000."
254
+ };
255
+ }
256
+ sharedRateLimit = Object.fromEntries(entries);
257
+ }
258
+ let transient429;
259
+ if (record.transient429 !== void 0) {
260
+ const selected = record.transient429;
261
+ if (!selected || typeof selected !== "object" || Array.isArray(selected)) {
262
+ return {
263
+ ok: false,
264
+ error: "fixtureBehavior.transient429 must be an object."
265
+ };
266
+ }
267
+ const fault = selected;
268
+ const unknownFaultKeys = Object.keys(fault).filter(
269
+ (key) => key !== "everyNthCall" && key !== "retryAfterMs" && key !== "failuresBeforeSuccess" && key !== "when"
270
+ );
271
+ if (unknownFaultKeys.length > 0) {
272
+ return {
273
+ ok: false,
274
+ error: `Unsupported fixtureBehavior.transient429 field "${unknownFaultKeys[0]}".`
275
+ };
276
+ }
277
+ for (const [name, value2, max] of [
278
+ ["everyNthCall", fault.everyNthCall, 1e4],
279
+ ["retryAfterMs", fault.retryAfterMs, MAX_FIXTURE_RETRY_AFTER_MS],
280
+ ["failuresBeforeSuccess", fault.failuresBeforeSuccess, 20]
281
+ ]) {
282
+ if (typeof value2 !== "number" || !Number.isSafeInteger(value2) || value2 < 1 || value2 > max) {
283
+ return {
284
+ ok: false,
285
+ error: `fixtureBehavior.transient429.${name} must be an integer from 1 through ${max}.`
286
+ };
287
+ }
288
+ }
289
+ let when;
290
+ if (fault.when !== void 0) {
291
+ if (!fault.when || typeof fault.when !== "object" || Array.isArray(fault.when)) {
292
+ return {
293
+ ok: false,
294
+ error: "fixtureBehavior.transient429.when must be an object."
295
+ };
296
+ }
297
+ const condition = fault.when;
298
+ const unknownConditionKeys = Object.keys(condition).filter(
299
+ (key) => key !== "provider" && key !== "operation"
300
+ );
301
+ if (unknownConditionKeys.length > 0) {
302
+ return {
303
+ ok: false,
304
+ error: `Unsupported fixtureBehavior.transient429.when field "${unknownConditionKeys[0]}".`
305
+ };
306
+ }
307
+ const provider = normalizeFixtureScopeValue(condition.provider, 100);
308
+ const operation = normalizeFixtureScopeValue(condition.operation, 200);
309
+ if (provider.error || operation.error || !provider.value && !operation.value) {
310
+ return {
311
+ ok: false,
312
+ error: "fixtureBehavior.transient429.when must select a valid provider or operation."
313
+ };
314
+ }
315
+ when = {
316
+ ...provider.value ? { provider: provider.value } : {},
317
+ ...operation.value ? { operation: operation.value } : {}
318
+ };
319
+ }
320
+ transient429 = {
321
+ everyNthCall: fault.everyNthCall,
322
+ retryAfterMs: fault.retryAfterMs,
323
+ failuresBeforeSuccess: fault.failuresBeforeSuccess,
324
+ ...when ? { when } : {}
325
+ };
326
+ }
327
+ let replayBundle;
328
+ if (record.version === FIXTURE_BEHAVIOR_REPLAY_VERSION) {
329
+ if (!record.replayBundle || typeof record.replayBundle !== "object" || Array.isArray(record.replayBundle)) {
330
+ return {
331
+ ok: false,
332
+ error: "fixtureBehavior.replayBundle must be an object."
333
+ };
334
+ }
335
+ const replay = record.replayBundle;
336
+ const replayUnknownKeys = Object.keys(replay).filter(
337
+ (key) => key !== "bundleId" && key !== "manifestSha256" && key !== "syntheticFallbackToolIds" && key !== "selectionSeed"
338
+ );
339
+ if (replayUnknownKeys.length > 0) {
340
+ return {
341
+ ok: false,
342
+ error: `Unsupported fixtureBehavior.replayBundle field "${replayUnknownKeys[0]}".`
343
+ };
344
+ }
345
+ const digestPattern = /^[a-f0-9]{64}$/;
346
+ if (replay.selectionSeed !== void 0 && !isFixtureReplaySelectionSeed(replay.selectionSeed)) {
347
+ return {
348
+ ok: false,
349
+ error: "fixtureBehavior.replayBundle.selectionSeed must contain 1-128 letters, digits, dots, underscores, colons or hyphens."
350
+ };
351
+ }
352
+ if (typeof replay.bundleId !== "string" || !digestPattern.test(replay.bundleId)) {
353
+ return {
354
+ ok: false,
355
+ error: "fixtureBehavior.replayBundle.bundleId must be a lowercase SHA-256 digest."
356
+ };
357
+ }
358
+ if (typeof replay.manifestSha256 !== "string" || !digestPattern.test(replay.manifestSha256)) {
359
+ return {
360
+ ok: false,
361
+ error: "fixtureBehavior.replayBundle.manifestSha256 must be a lowercase SHA-256 digest."
362
+ };
363
+ }
364
+ let syntheticFallbackToolIds;
365
+ if (replay.syntheticFallbackToolIds !== void 0) {
366
+ if (!Array.isArray(replay.syntheticFallbackToolIds) || replay.syntheticFallbackToolIds.length === 0 || replay.syntheticFallbackToolIds.length > 32) {
367
+ return {
368
+ ok: false,
369
+ error: "fixtureBehavior.replayBundle.syntheticFallbackToolIds must contain 1-32 tool ids."
370
+ };
371
+ }
372
+ syntheticFallbackToolIds = [];
373
+ for (const rawToolId of replay.syntheticFallbackToolIds) {
374
+ if (typeof rawToolId !== "string" || rawToolId !== rawToolId.trim().toLowerCase() || !/^[a-z0-9][a-z0-9_.-]*$/.test(rawToolId) || rawToolId.length > 250 || syntheticFallbackToolIds.includes(rawToolId)) {
375
+ return {
376
+ ok: false,
377
+ error: "fixtureBehavior.replayBundle.syntheticFallbackToolIds contains an invalid tool id."
378
+ };
379
+ }
380
+ syntheticFallbackToolIds.push(rawToolId);
381
+ }
382
+ }
383
+ replayBundle = {
384
+ bundleId: replay.bundleId,
385
+ manifestSha256: replay.manifestSha256,
386
+ ...syntheticFallbackToolIds ? { syntheticFallbackToolIds } : {},
387
+ ...replay.selectionSeed !== void 0 ? { selectionSeed: replay.selectionSeed } : {}
388
+ };
389
+ }
390
+ if (record.version === FIXTURE_BEHAVIOR_REPLAY_VERSION) {
391
+ return {
392
+ ok: true,
393
+ behavior: {
394
+ version: FIXTURE_BEHAVIOR_REPLAY_VERSION,
395
+ responseSamples: samples2,
396
+ ...transient429 ? { transient429 } : {},
397
+ ...sharedRateLimit ? { sharedRateLimit } : {},
398
+ replayBundle
399
+ }
400
+ };
401
+ }
402
+ return {
403
+ ok: true,
404
+ behavior: {
405
+ version: FIXTURE_BEHAVIOR_RESPONSE_VERSION,
406
+ responseSamples: samples2,
407
+ ...transient429 ? { transient429 } : {},
408
+ ...sharedRateLimit ? { sharedRateLimit } : {}
409
+ }
410
+ };
411
+ }
412
+ if (!Array.isArray(record.responseDelaySamplesMs) || record.responseDelaySamplesMs.length === 0 || record.responseDelaySamplesMs.length > MAX_FIXTURE_RESPONSE_DELAY_SAMPLES) {
413
+ return {
414
+ ok: false,
415
+ error: `fixtureBehavior.responseDelaySamplesMs must contain between 1 and ${MAX_FIXTURE_RESPONSE_DELAY_SAMPLES} values.`
416
+ };
417
+ }
418
+ const samples = [];
419
+ for (let index = 0; index < record.responseDelaySamplesMs.length; index += 1) {
420
+ const value2 = record.responseDelaySamplesMs[index];
421
+ if (typeof value2 !== "number" || !Number.isSafeInteger(value2) || value2 < 0 || value2 > MAX_FIXTURE_RESPONSE_DELAY_MS) {
422
+ return {
423
+ ok: false,
424
+ error: `fixtureBehavior.responseDelaySamplesMs[${index}] must be an integer between 0 and ${MAX_FIXTURE_RESPONSE_DELAY_MS}.`
425
+ };
426
+ }
427
+ samples.push(value2);
428
+ }
429
+ return {
430
+ ok: true,
431
+ behavior: {
432
+ version: FIXTURE_BEHAVIOR_VERSION,
433
+ responseDelaySamplesMs: samples
434
+ }
435
+ };
436
+ }
437
+ function normalizeFixtureScopeValue(value, maxLength) {
438
+ if (value === void 0) return {};
439
+ if (typeof value !== "string" || !value.trim()) {
440
+ return { error: "values must be non-empty strings." };
441
+ }
442
+ const normalized = value.trim().toLowerCase();
443
+ if (normalized.length > maxLength) {
444
+ return { error: `values must be at most ${maxLength} characters.` };
445
+ }
446
+ return { value: normalized };
447
+ }
448
+
449
+ // src/cli/operations/play-run-options.ts
450
+ var PLAY_RUN_RESERVED_BOOLEAN_FLAGS = /* @__PURE__ */ new Set([
451
+ "--dry-run",
452
+ "--json",
453
+ "--wait",
454
+ "--tail",
455
+ "--watch",
456
+ "--no-wait",
457
+ "--logs",
458
+ "--debug",
459
+ "--full",
460
+ "--force",
461
+ "--force-tool-refresh",
462
+ "--open",
463
+ "--debug-map-latency"
464
+ ]);
465
+ var PLAY_RUN_HEADER_FLAG_USAGE = `--header requires "<name>: <value>", for example: --header 'x-deepline-absurd-release: 2026-09-07.1'`;
466
+ var HTTP_HEADER_NAME_PATTERN = /^[!#$%&'*+\-.^_`|~0-9a-z]+$/;
467
+ function parsePlayRunHeaderFlag(raw) {
468
+ const separator = raw.indexOf(":");
469
+ if (separator < 0) {
470
+ throw new Error(
471
+ `${PLAY_RUN_HEADER_FLAG_USAGE}. Got ${JSON.stringify(raw)} with no ":" separator.`
472
+ );
473
+ }
474
+ const name = raw.slice(0, separator).trim().toLowerCase();
475
+ const value = raw.slice(separator + 1).trim();
476
+ if (!name) {
477
+ throw new Error(
478
+ `${PLAY_RUN_HEADER_FLAG_USAGE}. Got ${JSON.stringify(raw)} with an empty header name.`
479
+ );
480
+ }
481
+ if (!HTTP_HEADER_NAME_PATTERN.test(name)) {
482
+ throw new Error(
483
+ `${PLAY_RUN_HEADER_FLAG_USAGE}. ${JSON.stringify(name)} is not a valid HTTP header name.`
484
+ );
485
+ }
486
+ if (!value) {
487
+ throw new Error(
488
+ `${PLAY_RUN_HEADER_FLAG_USAGE}. Header ${JSON.stringify(name)} was given an empty value.`
489
+ );
490
+ }
491
+ if (/[\u0000-\u001f\u007f]/.test(value)) {
492
+ throw new Error(
493
+ `${PLAY_RUN_HEADER_FLAG_USAGE}. Header ${JSON.stringify(name)} contains a control character.`
494
+ );
495
+ }
496
+ return { name, value };
497
+ }
498
+ function isBarePlayRunDebugFlag(args, index) {
499
+ return args[index] === "--debug" && (args[index + 1] === void 0 || args[index + 1].startsWith("--"));
500
+ }
501
+ function parseReferencedPlayTarget(target) {
502
+ const trimmed = target.trim();
503
+ const slashIndex = trimmed.indexOf("/");
504
+ if (slashIndex <= 0 || slashIndex === trimmed.length - 1) {
505
+ return { ownerSlug: null, playName: trimmed, unqualifiedPlayName: trimmed };
506
+ }
507
+ return {
508
+ ownerSlug: trimmed.slice(0, slashIndex),
509
+ playName: trimmed,
510
+ unqualifiedPlayName: trimmed.slice(slashIndex + 1)
511
+ };
512
+ }
513
+ function isFileTarget(target) {
514
+ return existsSync(resolve(target));
515
+ }
516
+ function looksLikeFilePath(target) {
517
+ if (target.trim().toLowerCase().startsWith("prebuilt/")) {
518
+ return false;
519
+ }
520
+ if (target.startsWith("./") || target.startsWith("../") || target.startsWith("/") || target.startsWith("~/")) {
521
+ return true;
522
+ }
523
+ return target.includes("\\") || /\.(ts|js|mjs|play\.ts)$/.test(target);
524
+ }
525
+ function parsePositiveInteger(value, flagName) {
526
+ const parsed = Number.parseInt(value, 10);
527
+ if (!Number.isFinite(parsed) || parsed <= 0) {
528
+ throw new Error(`${flagName} must be a positive integer.`);
529
+ }
530
+ return parsed;
531
+ }
532
+ function parseJsonInput(raw, flag = "--input") {
533
+ const source = raw.startsWith("@") ? readFileSync(resolve(raw.slice(1)), "utf-8") : raw;
534
+ let parsed;
535
+ try {
536
+ parsed = JSON.parse(source);
537
+ } catch {
538
+ throw new DeeplineError(
539
+ `${flag} expects a valid JSON object or @input.json. A bare file path is not JSON.${flag === "--input" ? " Use the field names and run example from plays check <file> or deepline describe <play>. --csv contacts.csv supplies input.csv only when the Play declares that field." : ""}`,
540
+ void 0,
541
+ "INVALID_JSON"
542
+ );
543
+ }
544
+ if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
545
+ throw new DeeplineError(
546
+ `${flag} must be a JSON object.`,
547
+ void 0,
548
+ "INVALID_JSON"
549
+ );
550
+ }
551
+ return parsed;
552
+ }
553
+ function parseInputFieldFlag(rawFlag, nextArg) {
554
+ const flag = rawFlag.slice(2);
555
+ const equalsIndex = flag.indexOf("=");
556
+ if (equalsIndex > 0) {
557
+ const path = flag.slice(0, equalsIndex).trim();
558
+ const value = flag.slice(equalsIndex + 1);
559
+ if (!path) {
560
+ throw new Error(`Invalid play input flag: ${rawFlag}`);
561
+ }
562
+ return { path, value };
563
+ }
564
+ if (!nextArg || nextArg.startsWith("--")) {
565
+ throw new Error(`Play input flag ${rawFlag} requires a value.`);
566
+ }
567
+ return { path: flag, value: nextArg };
568
+ }
569
+ function parseInputFlagValue(raw) {
570
+ const trimmed = raw.trim();
571
+ if (!trimmed) return "";
572
+ if (trimmed === "true" || trimmed === "false" || trimmed === "null" || trimmed.startsWith("{") || trimmed.startsWith("[") || /^-?\d+(\.\d+)?$/.test(trimmed)) {
573
+ try {
574
+ return JSON.parse(trimmed);
575
+ } catch {
576
+ return raw;
577
+ }
578
+ }
579
+ return raw;
580
+ }
581
+ function parsePlayRunOptions(args, initialInput = null) {
582
+ const selection = parseJsonFields(args, "run");
583
+ args = selection.args;
584
+ const usage = "Usage: deepline plays run <play-name> [--input '{...}'] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run <play-file.ts> [--input '{...}'] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run --file <play-file.ts> [--input '{...}'] [--profile <id>] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--full] [--<input> value]\n deepline plays run --name <name> [--input '{...}'] [--profile <id>] [--live|--latest|--revision-id <id>] [--run-id-file <path>] [--no-wait] [--tail-timeout-ms 30000] [--force] [--open] [--json] [--full] [--<input> value]\n Runs use the Absurd CJS runtime.\n --header '<name>: <value>' may repeat; each is sent on every request for this run.\n Unknown --<input> value flags, such as --limit 5, are passed into play input.\nRun `deepline plays run --help` for idempotent call caching and deepline.dataset guidance.";
585
+ let filePath = null;
586
+ let playName = null;
587
+ let input = initialInput === null ? null : structuredClone(initialInput);
588
+ let revisionId = null;
589
+ let workflowId = null;
590
+ let maxTotalCredits = null;
591
+ let revisionSelector = null;
592
+ const watch = !args.includes("--no-wait");
593
+ const dryRun = args.includes("--dry-run");
594
+ let jsonOutput = dryRun ? argsWantJson(args) : watch ? args.includes("--json") : argsWantJson(args);
595
+ const fullJson = args.includes("--full");
596
+ const force = args.includes("--force");
597
+ const forceToolRefresh = args.includes("--force-tool-refresh");
598
+ const open = args.includes("--open");
599
+ const debugMapLatency = args.includes("--debug-map-latency");
600
+ let logLevel = "info";
601
+ let hasExplicitLogLevel = false;
602
+ let waitTimeoutMs = null;
603
+ let maxConcurrentExternalCalls = null;
604
+ let maxConcurrentRows = null;
605
+ let profile = null;
606
+ let fixtureBehavior = null;
607
+ let runIdFile = null;
608
+ let headers = null;
609
+ for (let index = 0; index < args.length; index += 1) {
610
+ const arg = args[index];
611
+ if (arg === "--workflow-id") {
612
+ const value = args[++index];
613
+ if (!value || value.startsWith("--"))
614
+ throw new Error("--workflow-id requires the original caller run ID.");
615
+ workflowId = value;
616
+ continue;
617
+ }
618
+ if (arg === "--max-total-credits") {
619
+ const value = args[++index];
620
+ if (value === void 0 || value.trim() === "" || !Number.isFinite(Number(value)) || Number(value) < 0)
621
+ throw new Error(
622
+ "--max-total-credits requires a non-negative number, including zero."
623
+ );
624
+ maxTotalCredits = Number(value);
625
+ continue;
626
+ }
627
+ if (arg === "--header" || arg.startsWith("--header=")) {
628
+ const raw = arg === "--header" ? args[index + 1] : arg.slice("--header=".length);
629
+ if (raw === void 0 || arg === "--header" && raw.startsWith("--")) {
630
+ throw new Error(`${PLAY_RUN_HEADER_FLAG_USAGE}. No value was given.`);
631
+ }
632
+ const header = parsePlayRunHeaderFlag(raw);
633
+ headers ??= {};
634
+ headers[header.name] = header.value;
635
+ if (arg === "--header") index += 1;
636
+ continue;
637
+ }
638
+ if (arg === "--file" && args[index + 1]) {
639
+ filePath = args[++index];
640
+ continue;
641
+ }
642
+ if (arg === "--name" && args[index + 1]) {
643
+ playName = parseReferencedPlayTarget(args[++index]).playName;
644
+ continue;
645
+ }
646
+ if ((arg === "--input" || arg === "-i") && args[index + 1]) {
647
+ input = parseJsonInput(args[++index]);
648
+ continue;
649
+ }
650
+ if (arg === "--log-level" || arg.startsWith("--log-level=")) {
651
+ const value = arg === "--log-level" ? args[++index] : arg.slice("--log-level=".length);
652
+ if (!value || value.startsWith("--")) {
653
+ throw new Error(
654
+ "--log-level requires one of: debug, info, warn, error."
655
+ );
656
+ }
657
+ const parsed = parseLogLevel(value);
658
+ if (!parsed) {
659
+ throw new Error(
660
+ `Unsupported --log-level ${JSON.stringify(value)}. Use debug, info, warn, or error.`
661
+ );
662
+ }
663
+ logLevel = parsed;
664
+ hasExplicitLogLevel = true;
665
+ continue;
666
+ }
667
+ if (arg === "--run-id-file") {
668
+ const value = args[index + 1];
669
+ if (!value || value.startsWith("--")) {
670
+ throw new Error("--run-id-file requires a destination path.");
671
+ }
672
+ runIdFile = value;
673
+ index += 1;
674
+ continue;
675
+ }
676
+ if (arg.startsWith("--run-id-file=")) {
677
+ const value = arg.slice("--run-id-file=".length);
678
+ if (!value) {
679
+ throw new Error("--run-id-file requires a destination path.");
680
+ }
681
+ runIdFile = value;
682
+ continue;
683
+ }
684
+ if (arg === "--revision-id" && args[index + 1]) {
685
+ revisionId = args[++index];
686
+ continue;
687
+ }
688
+ if (arg === "--profile") {
689
+ const value = args[index + 1];
690
+ if (!value) {
691
+ throw new Error("--profile requires an execution profile id.");
692
+ }
693
+ profile = value.trim();
694
+ resolveEnabledExecutionProfile(profile);
695
+ index += 1;
696
+ continue;
697
+ }
698
+ if (arg === "--max-concurrent-external-calls") {
699
+ const value = args[index + 1];
700
+ if (!value || value.startsWith("--")) {
701
+ throw new Error(
702
+ "--max-concurrent-external-calls requires a whole number."
703
+ );
704
+ }
705
+ if (!/^[1-9]\d*$/.test(value)) {
706
+ throw new Error(
707
+ "--max-concurrent-external-calls requires a positive whole number."
708
+ );
709
+ }
710
+ maxConcurrentExternalCalls = parsePositiveInteger(
711
+ value,
712
+ "--max-concurrent-external-calls"
713
+ );
714
+ resolveMaxConcurrentExternalCalls(maxConcurrentExternalCalls);
715
+ index += 1;
716
+ continue;
717
+ }
718
+ if (arg === "--max-concurrent-rows") {
719
+ const value = args[index + 1];
720
+ if (!value || value.startsWith("--")) {
721
+ throw new Error("--max-concurrent-rows requires a whole number.");
722
+ }
723
+ if (!/^[1-9]\d*$/.test(value)) {
724
+ throw new Error(
725
+ "--max-concurrent-rows requires a positive whole number."
726
+ );
727
+ }
728
+ maxConcurrentRows = parsePositiveInteger(value, "--max-concurrent-rows");
729
+ resolveMaxConcurrentRows(maxConcurrentRows);
730
+ index += 1;
731
+ continue;
732
+ }
733
+ if (arg === "--fixture-behavior") {
734
+ const value = args[index + 1];
735
+ if (!value) {
736
+ throw new Error(
737
+ "--fixture-behavior requires a JSON object or @file path."
738
+ );
739
+ }
740
+ const parsed = validateFixtureBehavior(
741
+ parseJsonInput(value, "--fixture-behavior")
742
+ );
743
+ if (!parsed.ok || !parsed.behavior) {
744
+ throw new Error(
745
+ parsed.ok ? "--fixture-behavior is required." : parsed.error
746
+ );
747
+ }
748
+ fixtureBehavior = parsed.behavior;
749
+ index += 1;
750
+ continue;
751
+ }
752
+ if (arg === "--live") {
753
+ revisionSelector = "live";
754
+ continue;
755
+ }
756
+ if (arg === "--latest") {
757
+ revisionSelector = "latest";
758
+ continue;
759
+ }
760
+ if (arg === "--out" || arg.startsWith("--out=")) {
761
+ throw new Error(
762
+ "--out is not a plays run flag. Run the play first, then export rows with: deepline runs export <run-id> --out output.csv"
763
+ );
764
+ }
765
+ if (arg === "--no-open" || arg.startsWith("--no-open=")) {
766
+ throw new Error(
767
+ "--no-open was removed for `plays run`. Play page URLs are printed by default; pass --open to launch a browser."
768
+ );
769
+ }
770
+ if (arg === "--poll-interval-ms" || arg === "--interval-ms") {
771
+ throw new Error(
772
+ `${arg} was removed. --watch polls the canonical run snapshot.`
773
+ );
774
+ }
775
+ if ((arg === "--tail-timeout-ms" || arg === "--timeout-ms") && args[index + 1]) {
776
+ waitTimeoutMs = parsePositiveInteger(args[++index], arg);
777
+ continue;
778
+ }
779
+ if (arg === "--debug" && args[index + 1] && !args[index + 1].startsWith("--")) {
780
+ input ??= {};
781
+ setDottedInputValue(input, "debug", parseInputFlagValue(args[++index]));
782
+ continue;
783
+ }
784
+ if (arg.startsWith("--debug=")) {
785
+ input ??= {};
786
+ setDottedInputValue(
787
+ input,
788
+ "debug",
789
+ parseInputFlagValue(arg.slice("--debug=".length))
790
+ );
791
+ continue;
792
+ }
793
+ if (PLAY_RUN_RESERVED_BOOLEAN_FLAGS.has(arg)) {
794
+ if (arg === "--watch") {
795
+ continue;
796
+ }
797
+ if (arg === "--wait") {
798
+ continue;
799
+ }
800
+ if (arg === "--json") {
801
+ jsonOutput = true;
802
+ continue;
803
+ }
804
+ if (arg === "--tail") {
805
+ throw new Error(
806
+ "--tail is removed for `plays run`; run waits and streams completion output by default."
807
+ );
808
+ }
809
+ continue;
810
+ }
811
+ if (arg.startsWith("--")) {
812
+ const { path, value } = parseInputFieldFlag(arg, args[index + 1]);
813
+ input ??= {};
814
+ setDottedInputValue(input, path, parseInputFlagValue(value));
815
+ if (!arg.includes("=")) {
816
+ index += 1;
817
+ }
818
+ continue;
819
+ }
820
+ if (!arg.startsWith("--") && !filePath && !playName) {
821
+ if (isFileTarget(arg) || looksLikeFilePath(arg)) {
822
+ filePath = arg;
823
+ } else {
824
+ playName = parseReferencedPlayTarget(arg).playName;
825
+ }
826
+ continue;
827
+ }
828
+ }
829
+ if (filePath && playName || !filePath && !playName) {
830
+ throw new Error(usage);
831
+ }
832
+ const explicitRevisionSelectors = [
833
+ revisionId ? "--revision-id" : null,
834
+ revisionSelector === "live" ? "--live" : null,
835
+ revisionSelector === "latest" ? "--latest" : null
836
+ ].filter(Boolean);
837
+ if (explicitRevisionSelectors.length > 1) {
838
+ throw new Error(
839
+ `Choose only one revision selector: ${explicitRevisionSelectors.join(", ")}.`
840
+ );
841
+ }
842
+ if (filePath && explicitRevisionSelectors.length > 0) {
843
+ throw new Error(
844
+ "--live, --latest, and --revision-id only apply to named plays."
845
+ );
846
+ }
847
+ if (debugMapLatency && logLevel === "info") logLevel = "debug";
848
+ const usesDebugAlias = args.includes("--logs") || args.some((_, index) => isBarePlayRunDebugFlag(args, index));
849
+ if (usesDebugAlias && hasExplicitLogLevel && logLevel !== "debug") {
850
+ throw new Error(
851
+ "--debug/--logs conflicts with a non-debug --log-level. Use one level selector."
852
+ );
853
+ }
854
+ if (usesDebugAlias) logLevel = "debug";
855
+ const explicitDebugLogs = usesDebugAlias || logLevel === "debug";
856
+ const emitLogs = !jsonOutput || explicitDebugLogs || hasExplicitLogLevel;
857
+ const verboseLogs = explicitDebugLogs || debugMapLatency;
858
+ if (dryRun && !filePath)
859
+ throw new Error("--dry-run currently requires a local Play file.");
860
+ return {
861
+ dryRun,
862
+ target: filePath ? { kind: "file", path: filePath } : { kind: "name", name: playName },
863
+ input,
864
+ revisionId,
865
+ workflowId,
866
+ maxTotalCredits,
867
+ revisionSelector,
868
+ watch,
869
+ emitLogs,
870
+ verboseLogs,
871
+ logLevel,
872
+ jsonOutput,
873
+ fullJson,
874
+ jsonFields: selection.fields,
875
+ waitTimeoutMs,
876
+ force,
877
+ forceToolRefresh,
878
+ maxConcurrentExternalCalls,
879
+ maxConcurrentRows,
880
+ maxCredits: null,
881
+ open,
882
+ profile,
883
+ debugMapLatency,
884
+ fixtureBehavior,
885
+ runIdFile,
886
+ headers
887
+ };
888
+ }
889
+ function resolvePlayRunCliOptions(target, options, inputArgs = [], maintenancePolicy) {
890
+ const stringOption = (value, flag) => {
891
+ if (value !== void 0 && !value.trim())
892
+ throw new Error(`${flag} requires a non-empty value.`);
893
+ return value;
894
+ };
895
+ const file = stringOption(options.file, "--file");
896
+ const name = stringOption(options.name, "--name");
897
+ if (file !== void 0 && name !== void 0)
898
+ throw new Error("Choose only one target: --file or --name.");
899
+ const selectedTarget = file ?? name ?? target;
900
+ let initialInput = options.input === void 0 ? null : parseJsonInput(options.input);
901
+ if (typeof options.debug === "string") {
902
+ initialInput ??= {};
903
+ setDottedInputValue(
904
+ initialInput,
905
+ "debug",
906
+ parseInputFlagValue(options.debug)
907
+ );
908
+ }
909
+ const base = parsePlayRunOptions(
910
+ [...selectedTarget === void 0 ? [] : [selectedTarget], ...inputArgs],
911
+ initialInput
912
+ );
913
+ const resolvedTarget = file !== void 0 ? { kind: "file", path: file } : name !== void 0 ? {
914
+ kind: "name",
915
+ name: parseReferencedPlayTarget(name).playName
916
+ } : base.target;
917
+ const revisionId = stringOption(options.revisionId, "--revision-id") ?? base.revisionId;
918
+ const selectors = [
919
+ revisionId ? "--revision-id" : null,
920
+ options.live ? "--live" : null,
921
+ options.latest ? "--latest" : null
922
+ ].filter(Boolean);
923
+ if (selectors.length > 1)
924
+ throw new Error(
925
+ `Choose only one revision selector: ${selectors.join(", ")}.`
926
+ );
927
+ if (resolvedTarget.kind === "file" && selectors.length)
928
+ throw new Error(
929
+ "--live, --latest, and --revision-id only apply to named plays."
930
+ );
931
+ const dryRun = options.dryRun ?? base.dryRun;
932
+ const maxTotalCredits = options.maxTotalCredits === void 0 ? base.maxTotalCredits : Number(options.maxTotalCredits);
933
+ if (maxTotalCredits !== null && (!Number.isFinite(maxTotalCredits) || maxTotalCredits < 0 || options.maxTotalCredits?.trim() === ""))
934
+ throw new Error(
935
+ "--max-total-credits requires a non-negative number, including zero."
936
+ );
937
+ if (dryRun && resolvedTarget.kind !== "file")
938
+ throw new Error("--dry-run currently requires a local Play file.");
939
+ const profile = stringOption(options.profile, "--profile")?.trim() ?? base.profile;
940
+ if (profile !== null) resolveEnabledExecutionProfile(profile);
941
+ const countOption = (value, flag) => {
942
+ if (value === void 0) return void 0;
943
+ if (!/^[1-9]\d*$/.test(value))
944
+ throw new Error(`${flag} requires a positive whole number.`);
945
+ const count = Number(value);
946
+ if (!Number.isSafeInteger(count))
947
+ throw new Error(`${flag} requires a positive whole number.`);
948
+ return count;
949
+ };
950
+ const externalCalls = countOption(
951
+ options.maxConcurrentExternalCalls,
952
+ "--max-concurrent-external-calls"
953
+ ) ?? base.maxConcurrentExternalCalls;
954
+ if (externalCalls !== null) resolveMaxConcurrentExternalCalls(externalCalls);
955
+ const rows = countOption(options.maxConcurrentRows, "--max-concurrent-rows") ?? base.maxConcurrentRows;
956
+ if (rows !== null) resolveMaxConcurrentRows(rows);
957
+ const maxCredits = options.maxCredits === void 0 ? null : Number(options.maxCredits);
958
+ if (maxCredits !== null && !(maxCredits > 0 && isFinite(maxCredits)))
959
+ throw new Error("--max-credits must be a number greater than 0.");
960
+ const waitTimeoutMs = countOption(options.tailTimeoutMs, "--tail-timeout-ms") ?? base.waitTimeoutMs;
961
+ let fixtureBehavior = base.fixtureBehavior;
962
+ if (options.fixtureBehavior !== void 0) {
963
+ const parsed = validateFixtureBehavior(
964
+ parseJsonInput(options.fixtureBehavior, "--fixture-behavior")
965
+ );
966
+ if (!parsed.ok || !parsed.behavior)
967
+ throw new Error(
968
+ parsed.ok ? "--fixture-behavior is required." : parsed.error
969
+ );
970
+ fixtureBehavior = parsed.behavior;
971
+ }
972
+ const hasExplicitLogLevel = options.logLevel !== void 0 || inputArgs.some(
973
+ (arg) => arg === "--log-level" || arg.startsWith("--log-level=")
974
+ );
975
+ let logLevel = options.logLevel === void 0 ? base.logLevel : parseLogLevel(options.logLevel);
976
+ if (!logLevel)
977
+ throw new Error("--log-level requires one of: debug, info, warn, error.");
978
+ const debugAlias = options.logs || options.debug === true || inputArgs.some(
979
+ (arg, index) => arg === "--logs" || isBarePlayRunDebugFlag(inputArgs, index)
980
+ );
981
+ if (debugAlias && hasExplicitLogLevel && logLevel !== "debug")
982
+ throw new Error(
983
+ "--debug/--logs conflicts with a non-debug --log-level. Use one level selector."
984
+ );
985
+ const debugMapLatency = options.debugMapLatency ?? base.debugMapLatency;
986
+ if (debugAlias || debugMapLatency && logLevel === "info")
987
+ logLevel = "debug";
988
+ const fullJson = options.full ?? base.fullJson;
989
+ const jsonFields = options.json === void 0 ? base.jsonFields : parseJsonFields(
990
+ [...fullJson ? ["--full"] : [], ...jsonFieldArgs(options.json)],
991
+ "run"
992
+ ).fields;
993
+ const watch = options.wait === false ? false : base.watch;
994
+ const explicitJson = options.json !== void 0 ? options.json !== false : base.jsonOutput;
995
+ const jsonOutput = dryRun || !watch ? explicitJson || argsWantJson([]) : explicitJson;
996
+ const verboseLogs = Boolean(
997
+ debugAlias || logLevel === "debug" || debugMapLatency
998
+ );
999
+ return {
1000
+ ...base,
1001
+ ...maintenancePolicy ? { maintenancePolicy } : {},
1002
+ target: resolvedTarget,
1003
+ dryRun,
1004
+ input: base.input,
1005
+ revisionId,
1006
+ workflowId: stringOption(options.workflowId, "--workflow-id") ?? base.workflowId,
1007
+ maxTotalCredits,
1008
+ revisionSelector: options.live ? "live" : options.latest ? "latest" : base.revisionSelector,
1009
+ profile,
1010
+ fixtureBehavior,
1011
+ watch,
1012
+ runIdFile: stringOption(options.runIdFile, "--run-id-file") ?? base.runIdFile,
1013
+ logLevel,
1014
+ emitLogs: !jsonOutput || verboseLogs || hasExplicitLogLevel,
1015
+ verboseLogs,
1016
+ jsonOutput,
1017
+ fullJson,
1018
+ jsonFields,
1019
+ waitTimeoutMs,
1020
+ force: options.force ?? base.force,
1021
+ forceToolRefresh: options.forceToolRefresh ?? base.forceToolRefresh,
1022
+ maxConcurrentExternalCalls: externalCalls,
1023
+ maxConcurrentRows: rows,
1024
+ maxCredits,
1025
+ open: options.open ?? base.open,
1026
+ debugMapLatency
1027
+ };
1028
+ }
1029
+
1030
+ export {
1031
+ DEFAULT_MAX_CONCURRENT_EXTERNAL_CALLS,
1032
+ MAX_CONFIGURABLE_CONCURRENT_EXTERNAL_CALLS,
1033
+ MAX_CONFIGURABLE_CONCURRENT_ROWS,
1034
+ parsePlayRunHeaderFlag,
1035
+ looksLikeFilePath,
1036
+ parsePlayRunOptions,
1037
+ resolvePlayRunCliOptions
1038
+ };