deepline 0.3.534 → 0.3.536

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/dist/bundling-sources/sdk/src/client-core.ts +254 -147
  2. package/dist/bundling-sources/sdk/src/index.ts +4 -0
  3. package/dist/bundling-sources/sdk/src/plays/local-file-discovery.ts +27 -1
  4. package/dist/bundling-sources/sdk/src/plays/run-request.ts +16 -5
  5. package/dist/bundling-sources/sdk/src/release.ts +1 -1
  6. package/dist/bundling-sources/sdk/src/types.ts +2 -23
  7. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-fleet-contract.ts +26 -14
  8. package/dist/bundling-sources/shared_libs/integration-contracts/monitor-input-contract.ts +33 -8
  9. package/dist/bundling-sources/shared_libs/monitors/fleets/count-drift-alert.ts +121 -0
  10. package/dist/bundling-sources/shared_libs/monitors/fleets/limits.ts +8 -0
  11. package/dist/bundling-sources/shared_libs/monitors/fleets/plan.ts +14 -82
  12. package/dist/bundling-sources/shared_libs/monitors/package.json +1 -0
  13. package/dist/bundling-sources/shared_libs/observability/scheduled-jobs.json +4 -4
  14. package/dist/bundling-sources/shared_libs/play-data-plane/r2.ts +0 -26
  15. package/dist/bundling-sources/shared_libs/play-runtime/activity-observation.ts +36 -0
  16. package/dist/bundling-sources/shared_libs/play-runtime/app-runtime-api.ts +21 -31
  17. package/dist/bundling-sources/shared_libs/play-runtime/call-requeue-state-machine.ts +420 -0
  18. package/dist/bundling-sources/shared_libs/play-runtime/context.ts +727 -102
  19. package/dist/bundling-sources/shared_libs/play-runtime/ctx-types.ts +26 -0
  20. package/dist/bundling-sources/shared_libs/play-runtime/durable-retry-policy.ts +624 -0
  21. package/dist/bundling-sources/shared_libs/play-runtime/durable-runs-rollout.ts +12 -10
  22. package/dist/bundling-sources/shared_libs/play-runtime/durable-summary-events.ts +3 -1
  23. package/dist/bundling-sources/shared_libs/play-runtime/governor/app-runtime-rate-state-backend.ts +71 -2
  24. package/dist/bundling-sources/shared_libs/play-runtime/governor/governor.ts +60 -1
  25. package/dist/bundling-sources/shared_libs/play-runtime/governor/rate-state-backend.ts +2 -0
  26. package/dist/bundling-sources/shared_libs/play-runtime/launch-identity.ts +1 -0
  27. package/dist/bundling-sources/shared_libs/play-runtime/map-memory-limits.ts +372 -10
  28. package/dist/bundling-sources/shared_libs/play-runtime/memory-ledger.ts +15 -2
  29. package/dist/bundling-sources/shared_libs/play-runtime/output-size-limits.ts +21 -0
  30. package/dist/bundling-sources/shared_libs/play-runtime/prebuilt-result-quality.ts +1 -1
  31. package/dist/bundling-sources/shared_libs/play-runtime/protocol.ts +6 -0
  32. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/fixture-capacity-simulator.ts +1 -0
  33. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/gradient2-concurrency-controller.ts +41 -0
  34. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-capacity-policy.ts +6 -0
  35. package/dist/bundling-sources/shared_libs/play-runtime/provider-capacity/provider-concurrency-policy.ts +9 -0
  36. package/dist/bundling-sources/shared_libs/play-runtime/provider-no-progress.ts +6 -2
  37. package/dist/bundling-sources/shared_libs/play-runtime/resource-governor.ts +17 -0
  38. package/dist/bundling-sources/shared_libs/play-runtime/run-failure.ts +2 -2
  39. package/dist/bundling-sources/shared_libs/play-runtime/run-ledger.ts +5 -2
  40. package/dist/bundling-sources/shared_libs/play-runtime/runner-app/runtime-tool-hooks.ts +63 -3
  41. package/dist/bundling-sources/shared_libs/play-runtime/runtime-operation-contract.ts +7 -0
  42. package/dist/bundling-sources/shared_libs/play-runtime/sandbox-compute-usage.ts +31 -0
  43. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backend.ts +6 -0
  44. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/absurd-runtime-worker.ts +26 -1
  45. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-scope.ts +11 -4
  46. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres-rate-state.ts +73 -18
  47. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/postgres.ts +169 -2
  48. package/dist/bundling-sources/shared_libs/play-runtime/scheduler-backends/runtime-sandbox-capacity.ts +26 -4
  49. package/dist/bundling-sources/shared_libs/play-runtime/tool-execute-retry-policy.ts +90 -49
  50. package/dist/bundling-sources/shared_libs/plays/authoring-contract.ts +136 -30
  51. package/dist/bundling-sources/shared_libs/plays/launch/input-contract.ts +13 -1
  52. package/dist/bundling-sources/shared_libs/plays/local-file-discovery.ts +68 -1
  53. package/dist/bundling-sources/shared_libs/plays/share/static-pipeline-summary.ts +63 -13
  54. package/dist/bundling-sources/shared_libs/product-notifications/configuration-draft.ts +57 -1
  55. package/dist/bundling-sources/shared_libs/product-notifications/configuration.ts +22 -9
  56. package/dist/cli/auth-6XQKFOLG.js +43 -0
  57. package/dist/cli/{auth-MHQYIMVX.mjs → auth-KCTCUO7P.mjs} +7 -7
  58. package/dist/cli/{billing-YQLNP4S5.js → billing-4VBGZ3CT.js} +273 -112
  59. package/dist/cli/{billing-LX2PSBJ4.mjs → billing-OOJHKLNS.mjs} +185 -24
  60. package/dist/cli/{chunk-DGKTHWWH.js → chunk-2B4IOGFD.js} +406 -382
  61. package/dist/cli/{chunk-MQORQ7WL.js → chunk-2FCSUOYN.js} +55 -55
  62. package/dist/cli/{chunk-T2N3B7IQ.js → chunk-2GJZLIKW.js} +8 -8
  63. package/dist/cli/{chunk-6IFZPEJE.mjs → chunk-2YWJS76L.mjs} +1 -1
  64. package/dist/cli/{chunk-E7TP25I2.mjs → chunk-3PCYV6ZJ.mjs} +2 -2
  65. package/dist/cli/{chunk-LGRZCHKC.js → chunk-4E5JXZ3W.js} +18 -20
  66. package/dist/cli/{chunk-R4RG4FV5.mjs → chunk-4KWD3MX2.mjs} +13 -10
  67. package/dist/cli/{chunk-SUWTLXCV.js → chunk-6BBGUQJJ.js} +67 -146
  68. package/dist/cli/{chunk-JBBJDFUJ.js → chunk-6VUGBQZQ.js} +5 -5
  69. package/dist/cli/{chunk-2P3NVX65.mjs → chunk-AB2GBOD4.mjs} +40 -27
  70. package/dist/cli/{chunk-62SOZ67Y.mjs → chunk-ANUKBZ6W.mjs} +475 -11
  71. package/dist/cli/{chunk-MG6YL4M7.mjs → chunk-BASLYGXK.mjs} +101 -77
  72. package/dist/cli/{chunk-SQWET4SL.js → chunk-BBTKAASQ.js} +2 -1
  73. package/dist/cli/{chunk-NRO3NTVO.js → chunk-CBV7AKWM.js} +5 -5
  74. package/dist/cli/{chunk-RH3YRMUY.js → chunk-CIDN5K23.js} +1 -1
  75. package/dist/cli/{chunk-QNHHZ63P.mjs → chunk-CQBIO6HW.mjs} +1 -1
  76. package/dist/cli/{chunk-2KHUFWTK.js → chunk-CQDQNZGH.js} +42 -37
  77. package/dist/cli/{chunk-UWNVFAFN.js → chunk-CWSLUNA6.js} +33 -33
  78. package/dist/cli/{chunk-5FXMEEF4.mjs → chunk-CXTW7SRW.mjs} +67 -146
  79. package/dist/cli/{chunk-O53LHONF.mjs → chunk-DA2I2M7D.mjs} +2 -2
  80. package/dist/cli/{chunk-EYXUAJAU.mjs → chunk-DQHUJMCL.mjs} +5 -5
  81. package/dist/cli/{chunk-7GFR5Y4J.mjs → chunk-DUYAMLOC.mjs} +1 -1
  82. package/dist/cli/{chunk-OMVVHX4U.mjs → chunk-E24UGPGG.mjs} +13 -15
  83. package/dist/cli/{chunk-STR5LXK4.mjs → chunk-FSIVF2SI.mjs} +1 -1
  84. package/dist/cli/{chunk-KJVY7V2X.mjs → chunk-GF32SBST.mjs} +1 -1
  85. package/dist/cli/{chunk-AK622KIG.mjs → chunk-GHLDCLSC.mjs} +1 -1
  86. package/dist/cli/{chunk-A6HNT4EE.js → chunk-GTVZKY3F.js} +2 -2
  87. package/dist/cli/{chunk-BXIUZM5N.mjs → chunk-HAJQGP5V.mjs} +2 -2
  88. package/dist/cli/{chunk-6CEUQYMB.js → chunk-HWDKRN7L.js} +3 -3
  89. package/dist/cli/{chunk-5YAJGRWB.js → chunk-IPVRMYWT.js} +7 -7
  90. package/dist/cli/{chunk-ZPGGW27Q.mjs → chunk-JL2OTMSG.mjs} +1 -0
  91. package/dist/cli/{chunk-WR4WETRU.mjs → chunk-JUHDJNSI.mjs} +4 -4
  92. package/dist/cli/{chunk-TQH3533L.mjs → chunk-KPQHUVYW.mjs} +5 -5
  93. package/dist/cli/{chunk-V7SCRUFQ.js → chunk-KWYGWO4Y.js} +9 -6
  94. package/dist/cli/{chunk-DZS4JC7I.js → chunk-LDGZFDUB.js} +2 -2
  95. package/dist/cli/{chunk-EGTUOYYG.js → chunk-LN6RXDTB.js} +523 -59
  96. package/dist/cli/{chunk-DQ5ADV2J.mjs → chunk-LZXZQPA2.mjs} +4 -1
  97. package/dist/cli/{chunk-MYSKWJMA.js → chunk-MSP4DTSD.js} +13 -13
  98. package/dist/cli/{chunk-BNH4Y35W.mjs → chunk-OLH2PHMC.mjs} +2 -2
  99. package/dist/cli/{chunk-NNAE7E23.mjs → chunk-OUDTOMZC.mjs} +7 -9
  100. package/dist/cli/{chunk-GESIFFQX.mjs → chunk-OVX3Q5Q3.mjs} +1 -1
  101. package/dist/cli/{chunk-ENCA6O2D.mjs → chunk-PNY3BWHP.mjs} +2 -2
  102. package/dist/cli/{chunk-KSA2XE4T.js → chunk-Q4MNUOS4.js} +316 -303
  103. package/dist/cli/{chunk-GTXSUPCJ.js → chunk-Q5CXV3E3.js} +2 -2
  104. package/dist/cli/{chunk-VAG5YKP6.mjs → chunk-RVSSQPQO.mjs} +1 -1
  105. package/dist/cli/{chunk-VE7ZPLN2.js → chunk-SLPJ3LXI.js} +22 -22
  106. package/dist/cli/{chunk-IX45S5VC.js → chunk-TX5TUHJN.js} +17 -19
  107. package/dist/cli/{chunk-IF75RD6U.js → chunk-U2LVWCTD.js} +18 -6
  108. package/dist/cli/{chunk-ZS2WHWWL.js → chunk-UNDLNT3V.js} +1 -1
  109. package/dist/cli/{chunk-NDFNBJGL.js → chunk-VBDZIMWD.js} +26 -26
  110. package/dist/cli/{chunk-GVGQ6NZW.js → chunk-W7AEIGZR.js} +41 -41
  111. package/dist/cli/{chunk-WDNRPZED.mjs → chunk-WC5M3JXE.mjs} +2 -2
  112. package/dist/cli/{chunk-C374C22Y.js → chunk-WOQO3GV4.js} +14 -11
  113. package/dist/cli/{chunk-MQX363YF.js → chunk-XBAH3TKU.js} +5 -5
  114. package/dist/cli/{chunk-BDWZBMGV.mjs → chunk-XJD2GYUP.mjs} +5 -5
  115. package/dist/cli/{chunk-XRZJKHUA.mjs → chunk-XVZRJJDS.mjs} +4 -4
  116. package/dist/cli/{chunk-TVINIDHB.js → chunk-Y2NTPYGS.js} +17 -17
  117. package/dist/cli/{chunk-6GTGWZJG.mjs → chunk-YBMHOH6H.mjs} +4 -4
  118. package/dist/cli/{chunk-TG2UB3A5.mjs → chunk-YRLAUGQY.mjs} +3 -3
  119. package/dist/cli/{chunk-FKD3KL5Q.mjs → chunk-Z2XA6YU4.mjs} +10 -5
  120. package/dist/cli/{chunk-KXQCUX3X.mjs → chunk-Z7UIOGW4.mjs} +3 -3
  121. package/dist/cli/{chunk-HCD36BP6.js → chunk-ZEV2Y56V.js} +44 -44
  122. package/dist/cli/{chunk-MI6ZP7XI.mjs → chunk-ZG7BOECV.mjs} +18 -6
  123. package/dist/cli/{chunk-XBK6WCVA.js → chunk-ZILSRDIN.js} +8 -8
  124. package/dist/cli/{chunk-B2AS3R5W.js → chunk-ZISEH7OL.js} +16 -16
  125. package/dist/cli/{chunk-HPJAE6PP.js → chunk-ZZ4MF2GI.js} +6 -6
  126. package/dist/cli/command-docs.js +2 -2
  127. package/dist/cli/command-docs.mjs +1 -1
  128. package/dist/cli/{csv-U3M2G76R.js → csv-2V2DIFNG.js} +15 -15
  129. package/dist/cli/{csv-4ID4E5W3.mjs → csv-P3HLK4GO.mjs} +6 -6
  130. package/dist/cli/{db-IHAQIKEQ.js → db-MREAQVW6.js} +36 -36
  131. package/dist/cli/{db-LHX5BBCZ.mjs → db-ZYOY3QRQ.mjs} +9 -9
  132. package/dist/cli/describe-IKZFOADR.mjs +49 -0
  133. package/dist/cli/describe-WW3OQRLP.js +49 -0
  134. package/dist/cli/describe-core.d.mts +3 -3
  135. package/dist/cli/describe-core.d.ts +3 -3
  136. package/dist/cli/describe-core.js +5 -5
  137. package/dist/cli/describe-core.mjs +4 -4
  138. package/dist/cli/{executions-CJ5LV23G.js → executions-H5IJ7QSQ.js} +11 -11
  139. package/dist/cli/{executions-UJ6JZUL5.mjs → executions-KTSY5M34.mjs} +9 -9
  140. package/dist/cli/{feedback-TGUBVGRP.js → feedback-724QK3Z5.js} +16 -16
  141. package/dist/cli/{feedback-YGTPJBRJ.mjs → feedback-WWJRIXEU.mjs} +8 -8
  142. package/dist/cli/git-PHYRD56H.js +25 -0
  143. package/dist/cli/{git-3DOTQHJO.mjs → git-R5VRG7X6.mjs} +7 -7
  144. package/dist/cli/index.js +151 -157
  145. package/dist/cli/index.mjs +51 -57
  146. package/dist/cli/{legacy-noops-BHEHVFHI.js → legacy-noops-C6GDEGPU.js} +11 -11
  147. package/dist/cli/{legacy-noops-RBBYRVLG.mjs → legacy-noops-PWZ5XLAO.mjs} +8 -8
  148. package/dist/cli/{monitors-XECKLAXA.js → monitors-VAVQ4WCE.js} +125 -122
  149. package/dist/cli/{monitors-5AJCG6IV.mjs → monitors-WQSKMHAP.mjs} +19 -16
  150. package/dist/cli/{org-DOBAIYWG.js → org-CWWRWXZQ.js} +89 -89
  151. package/dist/cli/{org-ZAAIEZKB.mjs → org-MAL4QPVF.mjs} +9 -9
  152. package/dist/cli/{play-KLYRMQPF.mjs → play-ILW6MSNG.mjs} +174 -80
  153. package/dist/cli/{play-E74VN6B7.js → play-WJOWK5PQ.js} +690 -596
  154. package/dist/cli/{providers-XTQXV5LB.mjs → providers-4V2NMLZZ.mjs} +9 -9
  155. package/dist/cli/{providers-APZ6SOSK.js → providers-W662ANCH.js} +12 -12
  156. package/dist/cli/{quickstart-S6WN6NWW.js → quickstart-BW6EBUYX.js} +8 -8
  157. package/dist/cli/{quickstart-X7RHHQCH.mjs → quickstart-C22BR743.mjs} +6 -6
  158. package/dist/cli/{run-3YLIJJ57.js → run-KW7KW4FX.js} +50 -53
  159. package/dist/cli/{run-TZPBBSPX.mjs → run-SPAU5IMW.mjs} +31 -34
  160. package/dist/cli/search-HLE54W5G.js +32 -0
  161. package/dist/cli/{search-VLHE2CMZ.mjs → search-XPC75HLM.mjs} +10 -11
  162. package/dist/cli/{search-output-73BYB7UE.mjs → search-output-JKYJSEPM.mjs} +6 -6
  163. package/dist/cli/{search-output-GCT7PQIT.js → search-output-VJYE7USJ.js} +8 -8
  164. package/dist/cli/{secrets-RLOTGKQZ.mjs → secrets-OJG73GXQ.mjs} +9 -9
  165. package/dist/cli/{secrets-J6CEKXKQ.js → secrets-YB57KGSB.js} +18 -18
  166. package/dist/cli/{sessions-7HZ7OZ62.mjs → sessions-7ZL37BW4.mjs} +8 -8
  167. package/dist/cli/sessions-VEBYZIEU.js +22 -0
  168. package/dist/cli/{settings-WRV5XEZC.js → settings-A7DD2ZYE.js} +88 -89
  169. package/dist/cli/{settings-72K5YCIS.mjs → settings-RKSQB7FA.mjs} +15 -16
  170. package/dist/cli/{setup-KQFY6WT4.mjs → setup-NXDUTITY.mjs} +11 -12
  171. package/dist/cli/{setup-QVXWT2EQ.js → setup-S3K5YU62.js} +51 -52
  172. package/dist/cli/skills-NVQ744CN.js +36 -0
  173. package/dist/cli/{skills-C3K3E473.mjs → skills-VMFAIDO6.mjs} +9 -10
  174. package/dist/cli/{tools-4A2OH6MB.mjs → tools-52NTHBSJ.mjs} +20 -21
  175. package/dist/cli/tools-SBDUL3WB.js +56 -0
  176. package/dist/cli/update-HHVFZPCV.js +34 -0
  177. package/dist/cli/{update-BS6USKPR.mjs → update-SAKBEKMV.mjs} +11 -12
  178. package/dist/cli/{views-WB6GFTRX.mjs → views-ACRV7MD6.mjs} +54 -10
  179. package/dist/cli/{views-4NZGAXHL.js → views-C3GJOBDG.js} +66 -22
  180. package/dist/cli/{workflow-2D4WX55R.mjs → workflow-CS22E7TC.mjs} +10 -10
  181. package/dist/cli/{workflow-L2QTQZYV.js → workflow-ZNWCZEGN.js} +20 -20
  182. package/dist/{client-DoUVSkqC.d.mts → client-BlLYQDNo.d.mts} +1 -1
  183. package/dist/{client-DQm56zMs.d.ts → client-DSQlkIDO.d.ts} +1 -1
  184. package/dist/{client-core-C7KkUIE_.d.ts → client-core-CDwapXy5.d.ts} +167 -108
  185. package/dist/{client-core-CPlwsC1Q.d.mts → client-core-rX7n2H8U.d.mts} +167 -108
  186. package/dist/{compiler-manifest-DsxsQP-T.d.mts → compiler-manifest-BHNC4RL-.d.mts} +58 -21
  187. package/dist/{compiler-manifest-DsxsQP-T.d.ts → compiler-manifest-BHNC4RL-.d.ts} +58 -21
  188. package/dist/{errors-qdJUVQ3g.d.mts → errors-D7sPXrvB.d.mts} +1 -1
  189. package/dist/{errors-Bk5h1D-C.d.ts → errors-lhtIWG5Z.d.ts} +1 -1
  190. package/dist/{index-bL66eHYz.d.ts → index-CQTBHXHr.d.ts} +1 -1
  191. package/dist/{index-PaupwX1B.d.mts → index-NaDZq2xf.d.mts} +1 -1
  192. package/dist/index.d.mts +7 -7
  193. package/dist/index.d.ts +7 -7
  194. package/dist/index.js +15 -15
  195. package/dist/index.mjs +11 -11
  196. package/dist/install-integrity.json +131 -132
  197. package/dist/monitor-fleet-contract.d.mts +17 -11
  198. package/dist/monitor-fleet-contract.d.ts +17 -11
  199. package/dist/monitor-fleet-contract.js +3 -3
  200. package/dist/monitor-fleet-contract.mjs +2 -2
  201. package/dist/monitor-input-contract.js +2 -2
  202. package/dist/monitor-input-contract.mjs +1 -1
  203. package/dist/plays/bundle-play-file.d.mts +3 -3
  204. package/dist/plays/bundle-play-file.d.ts +3 -3
  205. package/dist/plays/bundle-play-file.mjs +67 -3
  206. package/dist/plays/csv-data-input.js +3 -3
  207. package/dist/plays/csv-data-input.mjs +2 -2
  208. package/dist/plays/play-description.d.mts +2 -2
  209. package/dist/plays/play-description.d.ts +2 -2
  210. package/dist/plays/run-request.d.mts +2 -2
  211. package/dist/plays/run-request.d.ts +2 -2
  212. package/dist/plays/run-request.js +3 -3
  213. package/dist/plays/run-request.mjs +2 -2
  214. package/dist/release.d.mts +1 -1
  215. package/dist/release.d.ts +1 -1
  216. package/dist/release.js +2 -2
  217. package/dist/release.mjs +1 -1
  218. package/dist/server.d.mts +4 -4
  219. package/dist/server.d.ts +4 -4
  220. package/dist/server.js +12 -12
  221. package/dist/server.mjs +6 -6
  222. package/package.json +1 -1
  223. package/dist/cli/auth-UP2RGPI6.js +0 -43
  224. package/dist/cli/chunk-5LZ5VSOK.mjs +0 -405
  225. package/dist/cli/chunk-D3J2Y2BP.js +0 -405
  226. package/dist/cli/describe-CI4MREFF.mjs +0 -50
  227. package/dist/cli/describe-IVTSD7ST.js +0 -50
  228. package/dist/cli/git-R3W25XIF.js +0 -25
  229. package/dist/cli/pages-FUOSF6BE.mjs +0 -266
  230. package/dist/cli/pages-TLC2N6L7.js +0 -266
  231. package/dist/cli/search-NB5CBALV.js +0 -33
  232. package/dist/cli/sessions-SFCZSB77.js +0 -22
  233. package/dist/cli/skills-WIJEHVLA.js +0 -37
  234. package/dist/cli/tools-VMMERMLO.js +0 -57
  235. package/dist/cli/update-54WZQDTS.js +0 -35
@@ -1,17 +1,17 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
2
2
 
3
- var _chunkMQX363YFjs = require('./chunk-MQX363YF.js');
3
+ var _chunkXBAH3TKUjs = require('./chunk-XBAH3TKU.js');
4
4
 
5
5
 
6
6
 
7
- var _chunkDGKTHWWHjs = require('./chunk-DGKTHWWH.js');
7
+ var _chunk2B4IOGFDjs = require('./chunk-2B4IOGFD.js');
8
8
  require('./chunk-E4CABWXL.js');
9
- require('./chunk-2KHUFWTK.js');
9
+ require('./chunk-CQDQNZGH.js');
10
10
  require('./chunk-PMH4GLMD.js');
11
11
  require('./chunk-XDVT3GOM.js');
12
12
 
13
13
 
14
- var _chunkSUWTLXCVjs = require('./chunk-SUWTLXCV.js');
14
+ var _chunk6BBGUQJJjs = require('./chunk-6BBGUQJJ.js');
15
15
  require('./chunk-R7J7CJPZ.js');
16
16
 
17
17
 
@@ -22,18 +22,18 @@ var _chunkYGCKMI5Pjs = require('./chunk-YGCKMI5P.js');
22
22
 
23
23
 
24
24
 
25
- var _chunkEGTUOYYGjs = require('./chunk-EGTUOYYG.js');
26
- require('./chunk-XBK6WCVA.js');
27
- require('./chunk-UWNVFAFN.js');
25
+ var _chunkLN6RXDTBjs = require('./chunk-LN6RXDTB.js');
26
+ require('./chunk-ZILSRDIN.js');
27
+ require('./chunk-CWSLUNA6.js');
28
28
 
29
29
 
30
30
 
31
- var _chunkT2N3B7IQjs = require('./chunk-T2N3B7IQ.js');
31
+ var _chunk2GJZLIKWjs = require('./chunk-2GJZLIKW.js');
32
32
  require('./chunk-XNYIZMNQ.js');
33
33
 
34
34
 
35
- var _chunkSQWET4SLjs = require('./chunk-SQWET4SL.js');
36
- require('./chunk-RH3YRMUY.js');
35
+ var _chunkBBTKAASQjs = require('./chunk-BBTKAASQ.js');
36
+ require('./chunk-CIDN5K23.js');
37
37
  require('./chunk-OG64RBAC.js');
38
38
  require('./chunk-COGTRVWW.js');
39
39
 
@@ -48,7 +48,7 @@ var SUBSCRIPTION_CANCEL_PATH = "/api/v2/billing/subscription/cancel";
48
48
  var BILLING_TOP_UP_PATH = "/api/v2/billing/top-up";
49
49
  var DEFAULT_BALANCE_RECOVERY_CREDITS = 100;
50
50
  function billingFailureFromError(error, options) {
51
- if (error instanceof _chunkT2N3B7IQjs.AuthError) {
51
+ if (error instanceof _chunk2GJZLIKWjs.AuthError) {
52
52
  return {
53
53
  exitCode: 3,
54
54
  code: "AUTH_ERROR",
@@ -56,7 +56,7 @@ function billingFailureFromError(error, options) {
56
56
  next: "deepline auth status"
57
57
  };
58
58
  }
59
- if (!(error instanceof _chunkSQWET4SLjs.DeeplineError) || typeof error.statusCode !== "number") {
59
+ if (!(error instanceof _chunkBBTKAASQjs.DeeplineError) || typeof error.statusCode !== "number") {
60
60
  return null;
61
61
  }
62
62
  if (error.statusCode === 404 || error.statusCode === 409) {
@@ -82,7 +82,7 @@ function reportBillingFailure(failure, options) {
82
82
  if (failure.next) {
83
83
  textLines.push(`Next: ${failure.next}`);
84
84
  }
85
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
85
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
86
86
  {
87
87
  ok: false,
88
88
  exitCode: failure.exitCode,
@@ -103,7 +103,7 @@ function parseTopUpCredits(raw) {
103
103
  return parsed;
104
104
  }
105
105
  function topUpIdempotencyKey(raw) {
106
- return raw === void 0 ? `cli_topup:${Date.now()}:${_crypto.randomUUID.call(void 0, )}` : _chunkDGKTHWWHjs.requireBillingIdempotencyKey.call(void 0, raw);
106
+ return raw === void 0 ? `cli_topup:${Date.now()}:${_crypto.randomUUID.call(void 0, )}` : _chunk2B4IOGFDjs.requireBillingIdempotencyKey.call(void 0, raw);
107
107
  }
108
108
  function targetBillingIdempotencyKey(raw) {
109
109
  return typeof raw === "string" ? raw : `cli_target_billing:${Date.now()}:${_crypto.randomUUID.call(void 0, )}`;
@@ -140,7 +140,7 @@ function apiErrorCode(error) {
140
140
  return _nullishCoalesce(error.code, () => ( "BILLING_API_ERROR"));
141
141
  }
142
142
  function billingTopUpFailureFromError(error, input) {
143
- if (error instanceof _chunkT2N3B7IQjs.AuthError || error instanceof _chunkT2N3B7IQjs.ConfigError) {
143
+ if (error instanceof _chunk2GJZLIKWjs.AuthError || error instanceof _chunk2GJZLIKWjs.ConfigError) {
144
144
  return {
145
145
  exitCode: 3,
146
146
  code: "AUTH_ERROR",
@@ -148,8 +148,8 @@ function billingTopUpFailureFromError(error, input) {
148
148
  next: "deepline auth status"
149
149
  };
150
150
  }
151
- if (!(error instanceof _chunkSQWET4SLjs.DeeplineError) || typeof error.statusCode !== "number") {
152
- if (error instanceof _chunkSQWET4SLjs.DeeplineError) {
151
+ if (!(error instanceof _chunkBBTKAASQjs.DeeplineError) || typeof error.statusCode !== "number") {
152
+ if (error instanceof _chunkBBTKAASQjs.DeeplineError) {
153
153
  return {
154
154
  exitCode: 5,
155
155
  code: "TOP_UP_STATUS_UNKNOWN",
@@ -322,7 +322,7 @@ function defaultLedgerExportPath() {
322
322
  );
323
323
  }
324
324
  async function handleBalance(options) {
325
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
325
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
326
326
  const payload = await http.get(
327
327
  "/api/v2/billing/balance"
328
328
  );
@@ -406,7 +406,7 @@ async function handleBalance(options) {
406
406
  ...options.verbose ? detail : [],
407
407
  ...lines.slice(1)
408
408
  ];
409
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
409
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
410
410
  {
411
411
  ...payload,
412
412
  ...recovery ? { recovery } : {},
@@ -442,7 +442,7 @@ async function handleUsageEvents(options) {
442
442
  );
443
443
  return;
444
444
  }
445
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
445
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
446
446
  let payload;
447
447
  try {
448
448
  payload = await client.billing.usageEvents({
@@ -451,7 +451,7 @@ async function handleUsageEvents(options) {
451
451
  ...options.runId === void 0 ? {} : { runId: options.runId }
452
452
  });
453
453
  } catch (error) {
454
- if (error instanceof _chunkSQWET4SLjs.DeeplineError && error.code === "INVALID_USAGE_EVENTS_OPTIONS") {
454
+ if (error instanceof _chunkBBTKAASQjs.DeeplineError && error.code === "INVALID_USAGE_EVENTS_OPTIONS") {
455
455
  reportBillingFailure(
456
456
  {
457
457
  exitCode: 2,
@@ -473,7 +473,7 @@ async function handleUsageEvents(options) {
473
473
  ),
474
474
  ...nextPage ? [`Next page: ${nextPage}`] : []
475
475
  ];
476
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
476
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
477
477
  {
478
478
  ...payload,
479
479
  next: { page: nextPage },
@@ -495,7 +495,7 @@ async function handleUsage(options) {
495
495
  return;
496
496
  }
497
497
  if (options.events) return handleUsageEvents(options);
498
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
498
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
499
499
  const params = new URLSearchParams();
500
500
  if (options.requestId !== void 0) {
501
501
  const requestId = options.requestId.trim();
@@ -536,7 +536,7 @@ async function handleUsage(options) {
536
536
  `/api/v2/billing/usage${suffix}`
537
537
  );
538
538
  } catch (error) {
539
- if (options.requestId && error instanceof _chunkSQWET4SLjs.DeeplineError && error.statusCode === 404) {
539
+ if (options.requestId && error instanceof _chunkBBTKAASQjs.DeeplineError && error.statusCode === 404) {
540
540
  reportBillingFailure(
541
541
  {
542
542
  exitCode: 4,
@@ -579,7 +579,7 @@ async function handleUsage(options) {
579
579
  "No continuation is available for this view. Use deepline billing ledger export all for the full ledger."
580
580
  ] : []
581
581
  ];
582
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
582
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
583
583
  {
584
584
  ...payload,
585
585
  recent: {
@@ -593,7 +593,7 @@ async function handleUsage(options) {
593
593
  );
594
594
  }
595
595
  async function handleLimit(options) {
596
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
596
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
597
597
  const payload = await http.get(
598
598
  "/api/v2/billing/limit"
599
599
  );
@@ -601,7 +601,7 @@ async function handleLimit(options) {
601
601
  `Monthly usage cap: ${_nullishCoalesce(payload.monthly_credits_limit, () => ( "(unknown)"))}`,
602
602
  "Enforcement: checked before new calls; in-flight work can exceed the cap."
603
603
  ] : ["Monthly usage cap: off"];
604
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
604
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
605
605
  {
606
606
  ...payload,
607
607
  render: { sections: [{ title: "billing limit", lines }] }
@@ -610,12 +610,12 @@ async function handleLimit(options) {
610
610
  );
611
611
  }
612
612
  async function handleSetLimit(credits, options) {
613
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
613
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
614
614
  const payload = await http.request("/api/v2/billing/limit", {
615
615
  method: "PUT",
616
616
  body: { monthly_credits_limit: Number.parseInt(credits, 10) }
617
617
  });
618
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
618
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
619
619
  {
620
620
  ...payload,
621
621
  render: {
@@ -631,11 +631,11 @@ async function handleSetLimit(credits, options) {
631
631
  );
632
632
  }
633
633
  async function handleLimitOff(options) {
634
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
634
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
635
635
  const payload = await http.request("/api/v2/billing/limit", {
636
636
  method: "DELETE"
637
637
  });
638
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
638
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
639
639
  {
640
640
  ...payload,
641
641
  render: {
@@ -655,7 +655,7 @@ async function exportLedger(http, outputPath, options) {
655
655
  let initialized = false;
656
656
  let pageNumber = 0;
657
657
  console.error(`Exporting billing ledger to ${outputPath}`);
658
- for await (const entries of _chunkDGKTHWWHjs.iterateCursorPages.call(void 0, async (cursor) => {
658
+ for await (const entries of _chunk2B4IOGFDjs.iterateCursorPages.call(void 0, async (cursor) => {
659
659
  pageNumber += 1;
660
660
  console.error(
661
661
  `Fetching page ${pageNumber}; ${summary.row_count} rows written.`
@@ -694,7 +694,7 @@ async function exportLedger(http, outputPath, options) {
694
694
  return summary;
695
695
  }
696
696
  async function handleHistory(options) {
697
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
697
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
698
698
  const windows = {
699
699
  "1d": 86400,
700
700
  "1w": 604800,
@@ -706,10 +706,10 @@ async function handleHistory(options) {
706
706
  process.cwd(),
707
707
  "deepline",
708
708
  "data",
709
- _chunkEGTUOYYGjs.createTimestampedName.call(void 0, `billing-history-${options.time}`, "csv")
709
+ _chunkLN6RXDTBjs.createTimestampedName.call(void 0, `billing-history-${options.time}`, "csv")
710
710
  );
711
711
  const summary = await exportLedger(http, outputPath, { sinceAt });
712
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
712
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
713
713
  {
714
714
  output_path: outputPath,
715
715
  row_count: summary.row_count,
@@ -746,14 +746,14 @@ async function handleLedgerExportAll(options) {
746
746
  );
747
747
  return;
748
748
  }
749
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
749
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
750
750
  const outputPath = options.output ? _path.resolve.call(void 0, String(options.output)) : defaultLedgerExportPath();
751
751
  const summary = await exportLedger(http, outputPath, {
752
752
  sinceAt,
753
753
  runId: options.runId,
754
754
  operation: options.operation
755
755
  });
756
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
756
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
757
757
  {
758
758
  output_path: outputPath,
759
759
  row_count: summary.row_count,
@@ -790,24 +790,32 @@ function planPriceText(priceUsd, priceInterval) {
790
790
  }
791
791
  function targetPlanLine(plan) {
792
792
  const firstMonth = plan.first_month_price_usd != null ? ` (first month $${plan.first_month_price_usd})` : "";
793
- return `${plan.name} (${plan.sku}) | ${planPriceText(plan.recurring_price_usd, plan.interval)}${firstMonth} | ${plan.included_credits} included credits/month | $${plan.purchased_credit_price_usd}/purchased credit | ${plan.acquisition_enabled ? "available" : "unavailable"}`;
793
+ const bonus = plan.bonus_credits != null ? ` (+${plan.bonus_credits} bonus credits once paid)` : "";
794
+ return `${_nullishCoalesce(plan.display_name, () => ( plan.name))} (${plan.sku}) | ${planPriceText(plan.recurring_price_usd, plan.interval)}${firstMonth}${bonus} | ${plan.included_credits} included credits/month | $${plan.purchased_credit_price_usd}/purchased credit | ${plan.acquisition_enabled ? "available" : "unavailable"}`;
794
795
  }
795
796
  async function handlePlans(options) {
796
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
797
- const payload = await client.billing.targetPlans();
797
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
798
+ const payload = await client.billing.targetPlans(
799
+ options.promoCode ? { promoCode: options.promoCode } : void 0
800
+ );
801
+ const promo = payload.promo_code;
798
802
  const listedCurrentPlan = payload.plans.find(
799
803
  (plan) => plan.sku === payload.current_plan_sku
800
804
  );
801
805
  const currentPlan = await _asyncNullishCoalesce(listedCurrentPlan, async () => ( (await client.billing.targetStatus()).plan));
806
+ const pendingPlan = payload.pending_plan_display_name && payload.pending_plan_sku ? `${payload.pending_plan_display_name} (${payload.pending_plan_sku})` : _nullishCoalesce(payload.pending_plan_sku, () => ( "none"));
802
807
  const lines = [
803
- `Current plan: ${currentPlan.name} (${currentPlan.sku}) | ${planPriceText(currentPlan.recurring_price_usd, currentPlan.interval)} | ${_nullishCoalesce(currentPlan.included_credits, () => ( "(unknown)"))} included credits/month`,
804
- `Pending plan: ${_nullishCoalesce(payload.pending_plan_sku, () => ( "none"))}`,
808
+ `Current plan: ${_nullishCoalesce(currentPlan.display_name, () => ( currentPlan.name))} (${currentPlan.sku}) | ${planPriceText(currentPlan.recurring_price_usd, currentPlan.interval)} | ${_nullishCoalesce(currentPlan.included_credits, () => ( "(unknown)"))} included credits/month`,
809
+ `Pending plan: ${pendingPlan}`,
805
810
  `Plan changes: ${payload.acquisition_enabled ? "enabled" : "disabled"}`,
811
+ ...promo ? [
812
+ promo.status === "applied" ? `Promo code ${promo.code}: applied to ${promo.plan_skus.join(", ")}${promo.expires_at ? ` (until ${promo.expires_at})` : ""}` : `Promo code ${promo.code}: ${promo.status.replaceAll("_", " ")}`
813
+ ] : [],
806
814
  ...payload.plans.length === 0 ? ["Plans: none available"] : ["Plans:", ...payload.plans.map(targetPlanLine)],
807
- "Change plan: deepline billing change-plan <plan_sku>"
815
+ _optionalChain([promo, 'optionalAccess', _8 => _8.status]) === "applied" ? `Change plan: deepline billing change-plan <plan_sku> --promo-code ${promo.code}` : "Change plan: deepline billing change-plan <plan_sku>"
808
816
  ];
809
- const legacyPayload = _chunkEGTUOYYGjs.shouldEmitJson.call(void 0, options.json) ? await client.billing.plans() : null;
810
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
817
+ const legacyPayload = _chunkLN6RXDTBjs.shouldEmitJson.call(void 0, options.json) ? await client.billing.plans() : null;
818
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
811
819
  {
812
820
  ..._nullishCoalesce(legacyPayload, () => ( payload)),
813
821
  ...legacyPayload ? { target_billing: payload } : {},
@@ -817,7 +825,7 @@ async function handlePlans(options) {
817
825
  );
818
826
  }
819
827
  async function handleSubscribe(planVersionId, options) {
820
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
828
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
821
829
  const payload = await http.request(
822
830
  "/api/v2/billing/subscription/checkout",
823
831
  {
@@ -826,8 +834,8 @@ async function handleSubscribe(planVersionId, options) {
826
834
  }
827
835
  );
828
836
  const url = String(payload.checkout_url || "");
829
- if (!options.json && options.open !== false && url) _chunkEGTUOYYGjs.openInBrowser.call(void 0, url);
830
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
837
+ if (!options.json && options.open !== false && url) _chunkLN6RXDTBjs.openInBrowser.call(void 0, url);
838
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
831
839
  {
832
840
  ...payload,
833
841
  render: {
@@ -843,11 +851,11 @@ async function handleSubscribe(planVersionId, options) {
843
851
  );
844
852
  }
845
853
  async function handleSubscriptionStatus(options) {
846
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
854
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
847
855
  const payload = await client.billing.subscription.status();
848
856
  const pools = _nullishCoalesce(payload.credit_pools, () => ( []));
849
857
  const lines = [
850
- `Plan: ${_nullishCoalesce(payload.plan_name, () => ( "(unknown)"))} (${_nullishCoalesce(payload.plan_version_id, () => ( "(unknown)"))})`,
858
+ `Plan: ${_nullishCoalesce(_nullishCoalesce(payload.plan_display_name, () => ( payload.plan_name)), () => ( "(unknown)"))} (${_nullishCoalesce(payload.plan_version_id, () => ( "(unknown)"))})`,
851
859
  `Subscribed: ${payload.subscribed ? "yes" : "no"}`,
852
860
  ...payload.cancel_at_period_end ? [
853
861
  `Cancellation scheduled: ends ${_nullishCoalesce(payload.current_period_end, () => ( "(unknown)"))} at period end (credits are kept)`
@@ -863,7 +871,7 @@ async function handleSubscriptionStatus(options) {
863
871
  ],
864
872
  `Assigned by: ${_nullishCoalesce(payload.assigned_by, () => ( "default"))}`
865
873
  ];
866
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
874
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
867
875
  {
868
876
  ...payload,
869
877
  render: { sections: [{ title: "billing subscription", lines }] }
@@ -872,7 +880,7 @@ async function handleSubscriptionStatus(options) {
872
880
  );
873
881
  }
874
882
  async function handleSubscriptionCancel(options) {
875
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
883
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
876
884
  const action = options.undo ? "undo_cancel" : "cancel";
877
885
  if (options.dryRun) {
878
886
  const status = await client.billing.subscription.status();
@@ -889,13 +897,14 @@ async function handleSubscriptionCancel(options) {
889
897
  return;
890
898
  }
891
899
  const consequence = action === "cancel" ? `Would schedule cancellation at period end${status.current_period_end ? ` (${status.current_period_end})` : ""}. The subscription stays active until then and remaining credits are kept.` : "Would reverse the pending cancellation; the subscription would renew normally.";
892
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
900
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
893
901
  {
894
902
  ok: true,
895
903
  dry_run: true,
896
904
  action,
897
905
  plan_version_id: status.plan_version_id,
898
906
  plan_name: status.plan_name,
907
+ plan_display_name: status.plan_display_name,
899
908
  cancel_at_period_end: status.cancel_at_period_end,
900
909
  current_period_end: status.current_period_end,
901
910
  consequence,
@@ -909,7 +918,7 @@ async function handleSubscriptionCancel(options) {
909
918
  {
910
919
  title: "billing subscription cancel (dry run)",
911
920
  lines: [
912
- `Plan: ${status.plan_name} (${status.plan_version_id})`,
921
+ `Plan: ${_nullishCoalesce(status.plan_display_name, () => ( status.plan_name))} (${status.plan_version_id})`,
913
922
  `Planned request: POST ${SUBSCRIPTION_CANCEL_PATH} {"action":"${action}"}`,
914
923
  consequence,
915
924
  "No request was sent. Re-run without --dry-run to apply."
@@ -944,7 +953,7 @@ async function handleSubscriptionCancel(options) {
944
953
  "Remaining credits are yours to keep \u2014 cancellation never removes credits.",
945
954
  "Undo with: deepline billing subscription cancel --undo"
946
955
  ];
947
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
956
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
948
957
  {
949
958
  ok: true,
950
959
  ...result,
@@ -998,7 +1007,7 @@ async function handleInvoices(options) {
998
1007
  return;
999
1008
  }
1000
1009
  }
1001
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
1010
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
1002
1011
  let payload;
1003
1012
  try {
1004
1013
  payload = await client.billing.invoices.list(
@@ -1027,7 +1036,7 @@ async function handleInvoices(options) {
1027
1036
  url: entry.url
1028
1037
  }))
1029
1038
  } : { ...payload, count: entries.length };
1030
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1039
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1031
1040
  {
1032
1041
  ...envelope,
1033
1042
  render: { sections: [{ title: "billing invoices", lines }] }
@@ -1036,7 +1045,7 @@ async function handleInvoices(options) {
1036
1045
  );
1037
1046
  }
1038
1047
  async function handleCheckout(options) {
1039
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
1048
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
1040
1049
  const payload = await http.post(
1041
1050
  "/api/v2/billing/checkout",
1042
1051
  {
@@ -1046,8 +1055,8 @@ async function handleCheckout(options) {
1046
1055
  }
1047
1056
  );
1048
1057
  const url = String(payload.url || payload.checkout_url || "");
1049
- if (!options.json && !options.noOpen && url) _chunkEGTUOYYGjs.openInBrowser.call(void 0, url);
1050
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1058
+ if (!options.json && !options.noOpen && url) _chunkLN6RXDTBjs.openInBrowser.call(void 0, url);
1059
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1051
1060
  {
1052
1061
  ...payload,
1053
1062
  render: {
@@ -1080,7 +1089,7 @@ async function handleTopUp(creditsRaw, options) {
1080
1089
  try {
1081
1090
  idempotencyKey = topUpIdempotencyKey(options.idempotencyKey);
1082
1091
  } catch (error) {
1083
- if (!(error instanceof _chunkSQWET4SLjs.DeeplineError)) throw error;
1092
+ if (!(error instanceof _chunkBBTKAASQjs.DeeplineError)) throw error;
1084
1093
  reportBillingFailure(
1085
1094
  {
1086
1095
  exitCode: 2,
@@ -1092,7 +1101,7 @@ async function handleTopUp(creditsRaw, options) {
1092
1101
  return;
1093
1102
  }
1094
1103
  if (options.dryRun) {
1095
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1104
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1096
1105
  {
1097
1106
  ok: true,
1098
1107
  dry_run: true,
@@ -1122,7 +1131,7 @@ async function handleTopUp(creditsRaw, options) {
1122
1131
  );
1123
1132
  return;
1124
1133
  }
1125
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
1134
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
1126
1135
  let payload;
1127
1136
  try {
1128
1137
  payload = await client.billing.topUpWithReceipt({
@@ -1139,7 +1148,7 @@ async function handleTopUp(creditsRaw, options) {
1139
1148
  return;
1140
1149
  }
1141
1150
  if (payload.status === "pending") {
1142
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1151
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1143
1152
  {
1144
1153
  ok: true,
1145
1154
  ...payload,
@@ -1166,9 +1175,9 @@ async function handleTopUp(creditsRaw, options) {
1166
1175
  const amountText = invoiceAmountText(payload.amount_cents, payload.currency);
1167
1176
  const appliedCredits = "applied_credits" in payload ? payload.applied_credits : payload.credits;
1168
1177
  const paymentMethod = "payment_method" in payload ? payload.payment_method : void 0;
1169
- const paymentLabel = _nullishCoalesce(_optionalChain([paymentMethod, 'optionalAccess', _8 => _8.label]), () => ( [
1170
- _optionalChain([paymentMethod, 'optionalAccess', _9 => _9.brand]) ? humanize(paymentMethod.brand) : null,
1171
- _optionalChain([paymentMethod, 'optionalAccess', _10 => _10.last4]) ? `ending in ${paymentMethod.last4}` : null
1178
+ const paymentLabel = _nullishCoalesce(_optionalChain([paymentMethod, 'optionalAccess', _9 => _9.label]), () => ( [
1179
+ _optionalChain([paymentMethod, 'optionalAccess', _10 => _10.brand]) ? humanize(paymentMethod.brand) : null,
1180
+ _optionalChain([paymentMethod, 'optionalAccess', _11 => _11.last4]) ? `ending in ${paymentMethod.last4}` : null
1172
1181
  ].filter(Boolean).join(" ")));
1173
1182
  const compactEnvelope = {
1174
1183
  ok: true,
@@ -1203,17 +1212,17 @@ async function handleTopUp(creditsRaw, options) {
1203
1212
  ]
1204
1213
  }
1205
1214
  };
1206
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0, options.compact ? compactEnvelope : fullEnvelope, {
1215
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0, options.compact ? compactEnvelope : fullEnvelope, {
1207
1216
  json: options.json
1208
1217
  });
1209
1218
  }
1210
1219
  async function handleTargetStatus(options) {
1211
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
1220
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
1212
1221
  const payload = await client.billing.targetStatus();
1213
1222
  const balanceCommand = "deepline billing balance";
1214
1223
  const recentChargesCommand = "deepline billing usage --limit 5";
1215
1224
  const exactChargeCommand = "deepline billing usage --request-id <job_id>";
1216
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1225
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1217
1226
  {
1218
1227
  ok: true,
1219
1228
  ...payload,
@@ -1227,7 +1236,7 @@ async function handleTargetStatus(options) {
1227
1236
  {
1228
1237
  title: "billing status",
1229
1238
  lines: [
1230
- `Plan: ${payload.plan.name} (${payload.plan.sku})`,
1239
+ `Plan: ${_nullishCoalesce(payload.plan.display_name, () => ( payload.plan.name))} (${payload.plan.sku})`,
1231
1240
  `State: ${payload.state}`,
1232
1241
  `Payment: ${payload.payment_state}`,
1233
1242
  `Automatic recharge: ${payload.recharge_state}`,
@@ -1251,13 +1260,13 @@ function formatComputeAmount(minutes, credits) {
1251
1260
  return `${time} ${minutes === 1 ? "minute" : "minutes"} (${cost} ${credits === 1 ? "credit" : "credits"})`;
1252
1261
  }
1253
1262
  async function handleIncludedCompute(options) {
1254
- const client = new (0, _chunkMQX363YFjs.DeeplineClient)();
1263
+ const client = new (0, _chunkXBAH3TKUjs.DeeplineClient)();
1255
1264
  const payload = options.enable ? await client.billing.enableIncludedCompute({ includeOverage: true }) : await client.billing.includedCompute({ includeOverage: true });
1256
1265
  const rate = _nullishCoalesce(payload.credits_per_minute, () => ( 0));
1257
1266
  const includedCredits = _nullishCoalesce(payload.included_credits_used, () => ( payload.included_minutes_used * rate));
1258
1267
  const includedMinutes = payload.included_credits_used !== void 0 && rate > 0 ? includedCredits / rate : payload.included_minutes_used;
1259
1268
  const overage = payload.overage_credits;
1260
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1269
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1261
1270
  {
1262
1271
  ok: true,
1263
1272
  ...payload,
@@ -1272,12 +1281,12 @@ async function handleIncludedCompute(options) {
1272
1281
  ] : [],
1273
1282
  `Standard sandbox price: ${formatComputeAmount(60, Math.round(rate * 60))}`,
1274
1283
  `Allowance resets: ${payload.period_end_at.slice(0, 10)} (UTC)`,
1275
- _chunkSUWTLXCVjs.PLAY_RUNTIME_PRICING_NOTE
1284
+ _chunk6BBGUQJJjs.PLAY_RUNTIME_PRICING_NOTE
1276
1285
  ] : payload.status === "off" ? [
1277
1286
  "Included compute: off; Play compute is billed at provider cost.",
1278
1287
  `Allowance if enabled: ${formatComputeAmount(payload.plan.included_minutes, payload.plan.included_minutes * payload.plan.credits_per_minute)} per month`,
1279
1288
  `Standard sandbox price if enabled: ${formatComputeAmount(60, Math.round(payload.plan.credits_per_minute * 60))}`,
1280
- _chunkSUWTLXCVjs.PLAY_RUNTIME_PRICING_NOTE,
1289
+ _chunk6BBGUQJJjs.PLAY_RUNTIME_PRICING_NOTE,
1281
1290
  "Run deepline billing compute --enable to turn on included compute. It cannot be turned off again."
1282
1291
  ] : [
1283
1292
  "Included compute is not available for this workspace yet."
@@ -1290,8 +1299,8 @@ async function handleIncludedCompute(options) {
1290
1299
  );
1291
1300
  }
1292
1301
  async function handleEntitlements(options) {
1293
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.entitlements();
1294
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1302
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.entitlements();
1303
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1295
1304
  {
1296
1305
  ok: true,
1297
1306
  ...payload,
@@ -1300,7 +1309,7 @@ async function handleEntitlements(options) {
1300
1309
  {
1301
1310
  title: "billing entitlements",
1302
1311
  lines: [
1303
- `Plan: ${_nullishCoalesce(_optionalChain([payload, 'access', _11 => _11.plan, 'optionalAccess', _12 => _12.name]), () => ( "Legacy billing"))}`,
1312
+ `Plan: ${_nullishCoalesce(_optionalChain([payload, 'access', _12 => _12.plan, 'optionalAccess', _13 => _13.name]), () => ( "Legacy billing"))}`,
1304
1313
  ...Object.entries(payload.benefits).flatMap(
1305
1314
  ([key, grant]) => "value" in grant ? [
1306
1315
  `${key}: ${grant.status}, ${JSON.stringify(grant.value)}${grant.expiresAt === void 0 ? "" : `, expires ${new Date(grant.expiresAt).toISOString()}`}`
@@ -1324,7 +1333,7 @@ async function handleEntitlements(options) {
1324
1333
  );
1325
1334
  }
1326
1335
  async function handleAutoRechargeStatus(options) {
1327
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.autoRecharge.get();
1336
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.autoRecharge.get();
1328
1337
  const state = payload.available ? payload.enabled ? "on" : "off" : "unavailable";
1329
1338
  const lines = [
1330
1339
  `State: ${state}`,
@@ -1334,7 +1343,7 @@ async function handleAutoRechargeStatus(options) {
1334
1343
  `Automatic credit purchase cap: ${payload.purchase_limit_credits} credits per rolling 30 days`
1335
1344
  ] : []
1336
1345
  ];
1337
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1346
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1338
1347
  {
1339
1348
  ok: true,
1340
1349
  ...payload,
@@ -1383,7 +1392,7 @@ async function handleAutoRechargeSet(options) {
1383
1392
  }
1384
1393
  const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
1385
1394
  if (options.dryRun) {
1386
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1395
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1387
1396
  {
1388
1397
  ok: true,
1389
1398
  dry_run: true,
@@ -1404,7 +1413,7 @@ async function handleAutoRechargeSet(options) {
1404
1413
  );
1405
1414
  return;
1406
1415
  }
1407
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.autoRecharge.update({
1416
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.autoRecharge.update({
1408
1417
  enabled: true,
1409
1418
  thresholdCredits,
1410
1419
  refillToCredits,
@@ -1412,7 +1421,7 @@ async function handleAutoRechargeSet(options) {
1412
1421
  ...rollingLimitCredits !== void 0 ? { purchaseLimitCredits: rollingLimitCredits } : {},
1413
1422
  idempotencyKey
1414
1423
  });
1415
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1424
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1416
1425
  { ok: true, idempotency_key: idempotencyKey, ...payload },
1417
1426
  { json: options.json }
1418
1427
  );
@@ -1420,7 +1429,7 @@ async function handleAutoRechargeSet(options) {
1420
1429
  async function handleAutoRechargeOff(options) {
1421
1430
  const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
1422
1431
  if (options.dryRun) {
1423
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1432
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1424
1433
  {
1425
1434
  ok: true,
1426
1435
  dry_run: true,
@@ -1435,15 +1444,128 @@ async function handleAutoRechargeOff(options) {
1435
1444
  );
1436
1445
  return;
1437
1446
  }
1438
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.autoRecharge.update({
1447
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.autoRecharge.update({
1439
1448
  enabled: false,
1440
1449
  idempotencyKey
1441
1450
  });
1442
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1451
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1443
1452
  { ok: true, idempotency_key: idempotencyKey, ...payload },
1444
1453
  { json: options.json }
1445
1454
  );
1446
1455
  }
1456
+ function savedCardLine(card) {
1457
+ const expiry = card.exp_month !== null && card.exp_year !== null ? ` exp ${String(card.exp_month).padStart(2, "0")}/${card.exp_year}` : "";
1458
+ const marks = [
1459
+ card.is_default ? "default" : null,
1460
+ card.expired ? "expired" : null,
1461
+ card.kind === "legacy_source" ? "cannot be changed here" : null
1462
+ ].filter(Boolean);
1463
+ return `${card.id} ${card.label}${expiry}${marks.length > 0 ? ` (${marks.join(", ")})` : ""}`;
1464
+ }
1465
+ function savedCardLines(cards, hasMore) {
1466
+ if (cards.length === 0) {
1467
+ return ["No saved cards. Add one with: deepline billing cards add"];
1468
+ }
1469
+ return [
1470
+ ...cards.map(savedCardLine),
1471
+ ...hasMore ? ["More cards exist: pass --cursor with next_cursor."] : []
1472
+ ];
1473
+ }
1474
+ async function handleCardsList(options) {
1475
+ const limit = options.limit === void 0 ? void 0 : Number(options.limit);
1476
+ if (limit !== void 0 && (!Number.isInteger(limit) || limit < 1 || limit > 100)) {
1477
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1478
+ { ok: false, error: "--limit must be a whole number from 1 to 100." },
1479
+ { json: options.json }
1480
+ );
1481
+ process.exitCode = 1;
1482
+ return;
1483
+ }
1484
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.cards.list({
1485
+ ...limit !== void 0 ? { limit } : {},
1486
+ ...options.cursor ? { cursor: options.cursor } : {}
1487
+ });
1488
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1489
+ {
1490
+ ok: true,
1491
+ ...payload,
1492
+ render: {
1493
+ sections: [
1494
+ {
1495
+ title: "Saved cards",
1496
+ lines: savedCardLines(payload.cards, payload.has_more)
1497
+ }
1498
+ ]
1499
+ }
1500
+ },
1501
+ { json: options.json }
1502
+ );
1503
+ }
1504
+ async function handleCardsAdd(options) {
1505
+ const makeDefault = options.makeDefault === true;
1506
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.cards.add({ makeDefault });
1507
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1508
+ {
1509
+ ok: true,
1510
+ make_default: makeDefault,
1511
+ ...payload,
1512
+ render: {
1513
+ sections: [
1514
+ {
1515
+ title: "Add a card",
1516
+ lines: [
1517
+ `Open this page to enter the card: ${payload.checkout_url}`,
1518
+ makeDefault ? "It will become the default card." : "Your current default card stays the default. With no saved card yet, this one becomes it.",
1519
+ "Then check: deepline billing cards list"
1520
+ ]
1521
+ }
1522
+ ]
1523
+ }
1524
+ },
1525
+ { json: options.json }
1526
+ );
1527
+ }
1528
+ async function handleCardChange(action, cardId, options) {
1529
+ const changeId = _nullishCoalesce(options.changeId, () => ( _crypto.randomUUID.call(void 0, )));
1530
+ const path = `/api/v2/billing/payment-methods/${action}`;
1531
+ if (options.dryRun) {
1532
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1533
+ {
1534
+ ok: true,
1535
+ dry_run: true,
1536
+ change_id: changeId,
1537
+ planned_request: {
1538
+ method: "POST",
1539
+ path,
1540
+ body: { card_id: cardId, change_id: changeId }
1541
+ }
1542
+ },
1543
+ { json: options.json }
1544
+ );
1545
+ return;
1546
+ }
1547
+ const cards = new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.cards;
1548
+ const payload = action === "default" ? await cards.setDefault({ cardId, changeId }) : await cards.remove({ cardId, changeId });
1549
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1550
+ {
1551
+ ...payload,
1552
+ render: {
1553
+ sections: [
1554
+ {
1555
+ title: action === "default" ? "Default card changed" : "Card removed",
1556
+ lines: [
1557
+ ...action === "default" ? [
1558
+ "Later top-ups, auto top-up and invoices use this card. Charges already made are not moved."
1559
+ ] : [],
1560
+ ...savedCardLines(payload.cards, payload.has_more)
1561
+ ]
1562
+ }
1563
+ ]
1564
+ }
1565
+ },
1566
+ { json: options.json }
1567
+ );
1568
+ }
1447
1569
  async function handleBuyCredits(creditsRaw, options) {
1448
1570
  const credits = parseTopUpCredits(creditsRaw);
1449
1571
  if (credits === null) {
@@ -1458,11 +1580,11 @@ async function handleBuyCredits(creditsRaw, options) {
1458
1580
  return;
1459
1581
  }
1460
1582
  const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
1461
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.purchaseCredits({
1583
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.purchaseCredits({
1462
1584
  credits,
1463
1585
  idempotencyKey
1464
1586
  });
1465
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1587
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1466
1588
  { ok: true, idempotency_key: idempotencyKey, ...payload },
1467
1589
  { json: options.json }
1468
1590
  );
@@ -1480,7 +1602,7 @@ async function handleTopUpRecover(creditsRaw, options) {
1480
1602
  );
1481
1603
  return;
1482
1604
  }
1483
- const failure = !_optionalChain([options, 'access', _13 => _13.orgId, 'optionalAccess', _14 => _14.trim, 'call', _15 => _15()]) || options.orgId !== options.orgId.trim() ? {
1605
+ const failure = !_optionalChain([options, 'access', _14 => _14.orgId, 'optionalAccess', _15 => _15.trim, 'call', _16 => _16()]) || options.orgId !== options.orgId.trim() ? {
1484
1606
  code: "INVALID_ORG_ID",
1485
1607
  message: "--org-id must be the original workspace ID without surrounding whitespace."
1486
1608
  } : !options.idempotencyKey || options.idempotencyKey.length > 200 || options.idempotencyKey !== options.idempotencyKey.trim() ? {
@@ -1498,7 +1620,7 @@ async function handleTopUpRecover(creditsRaw, options) {
1498
1620
  return;
1499
1621
  }
1500
1622
  if (options.dryRun) {
1501
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1623
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1502
1624
  {
1503
1625
  ok: true,
1504
1626
  dry_run: true,
@@ -1511,62 +1633,63 @@ async function handleTopUpRecover(creditsRaw, options) {
1511
1633
  );
1512
1634
  return;
1513
1635
  }
1514
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.recoverCreditPurchase({
1636
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.recoverCreditPurchase({
1515
1637
  credits,
1516
1638
  orgId: options.orgId,
1517
1639
  idempotencyKey: options.idempotencyKey
1518
1640
  });
1519
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1641
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1520
1642
  { ok: true, idempotency_key: options.idempotencyKey, ...payload },
1521
1643
  { json: options.json }
1522
1644
  );
1523
1645
  }
1524
1646
  async function handleTargetPlan(planSku, options) {
1525
- if (planSku !== "payg-v1" && planSku !== "builder-v1" && planSku !== "growth-v1" && // Retained Canary requests may replay their original operation. The API
1647
+ if (planSku !== "payg-v1" && planSku !== "builder-v1" && planSku !== "growth-v1" && planSku !== "team-v2" && // Retained Canary requests may replay their original operation. The API
1526
1648
  // rejects new acquisition even when a caller supplies an idempotency key.
1527
1649
  !(planSku === "growth-canary-v1" && options.idempotencyKey) && planSku !== "team-v1") {
1528
1650
  reportBillingFailure(
1529
1651
  {
1530
1652
  exitCode: 2,
1531
1653
  code: "INVALID_PLAN",
1532
- message: "Plan must be payg-v1, builder-v1, growth-v1, or team-v1."
1654
+ message: "Plan must be payg-v1, builder-v1, growth-v1, team-v1, or team-v2."
1533
1655
  },
1534
1656
  options
1535
1657
  );
1536
1658
  return;
1537
1659
  }
1538
1660
  const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
1539
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.transitionPlan({
1661
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.transitionPlan({
1540
1662
  action: "start_or_change",
1541
1663
  targetPlanSku: planSku,
1542
1664
  ...options.billingEmail ? { billingEmail: options.billingEmail } : {},
1665
+ ...options.promoCode ? { promoCode: options.promoCode } : {},
1543
1666
  idempotencyKey
1544
1667
  });
1545
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1668
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1546
1669
  { ok: true, idempotency_key: idempotencyKey, ...payload },
1547
1670
  { json: options.json }
1548
1671
  );
1549
1672
  }
1550
1673
  async function handleTargetPlanCancellation(options) {
1551
1674
  const idempotencyKey = targetBillingIdempotencyKey(options.idempotencyKey);
1552
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.transitionPlan({
1675
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.transitionPlan({
1553
1676
  action: options.undo ? "undo_cancel" : "cancel",
1554
1677
  idempotencyKey
1555
1678
  });
1556
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1679
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1557
1680
  { ok: true, idempotency_key: idempotencyKey, ...payload },
1558
1681
  { json: options.json }
1559
1682
  );
1560
1683
  }
1561
1684
  async function handleTargetPortal(options) {
1562
- const payload = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.portalSession(
1685
+ const payload = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.portalSession(
1563
1686
  options.billingAddress ? { flow: "customer_update" } : void 0
1564
1687
  );
1565
- if (!options.json && !options.noOpen) _chunkEGTUOYYGjs.openInBrowser.call(void 0, payload.url);
1566
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0, { ok: true, ...payload }, { json: options.json });
1688
+ if (!options.json && !options.noOpen) _chunkLN6RXDTBjs.openInBrowser.call(void 0, payload.url);
1689
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0, { ok: true, ...payload }, { json: options.json });
1567
1690
  }
1568
1691
  async function handleRedeemCode(code, options) {
1569
- const { http } = _chunkEGTUOYYGjs.getAuthedHttpClient.call(void 0, );
1692
+ const { http } = _chunkLN6RXDTBjs.getAuthedHttpClient.call(void 0, );
1570
1693
  const payload = await http.post(
1571
1694
  "/api/v2/billing/checkout",
1572
1695
  {
@@ -1574,8 +1697,8 @@ async function handleRedeemCode(code, options) {
1574
1697
  }
1575
1698
  );
1576
1699
  const url = String(payload.url || payload.checkout_url || "");
1577
- if (!options.json && !options.noOpen && url) _chunkEGTUOYYGjs.openInBrowser.call(void 0, url);
1578
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0,
1700
+ if (!options.json && !options.noOpen && url) _chunkLN6RXDTBjs.openInBrowser.call(void 0, url);
1701
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0,
1579
1702
  {
1580
1703
  ...payload,
1581
1704
  render: {
@@ -1636,14 +1759,14 @@ Examples:
1636
1759
  if (!Number.isSafeInteger(quantity) || quantity <= 0) {
1637
1760
  throw new Error("--quantity must be a positive safe integer.");
1638
1761
  }
1639
- const quote = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.quote({
1762
+ const quote = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.quote({
1640
1763
  quantity,
1641
1764
  sandbox_runtime: {
1642
1765
  timeout: options.sandboxTimeout,
1643
1766
  size: options.sandboxSize
1644
1767
  }
1645
1768
  });
1646
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0, quote, {
1769
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0, quote, {
1647
1770
  json: options.json,
1648
1771
  text: `Sandbox session ceiling: ${quote.maximum_credits} Deepline credits (${quote.quantity} session${quote.quantity === 1 ? "" : "s"}).
1649
1772
  ${quote.explanation}
@@ -1891,13 +2014,48 @@ Examples:
1891
2014
  new (0, _commander.Command)("trigger").description(
1892
2015
  "Evaluate capped automatic recharge and resume any pending purchase."
1893
2016
  ).option("--json", "Emit JSON output").action(async (options) => {
1894
- const result = await new (0, _chunkMQX363YFjs.DeeplineClient)().billing.autoRecharge.trigger();
1895
- _chunkEGTUOYYGjs.printCommandEnvelope.call(void 0, { ok: true, ...result }, { json: options.json });
2017
+ const result = await new (0, _chunkXBAH3TKUjs.DeeplineClient)().billing.autoRecharge.trigger();
2018
+ _chunkLN6RXDTBjs.printCommandEnvelope.call(void 0, { ok: true, ...result }, { json: options.json });
1896
2019
  })
1897
2020
  );
1898
- billing.command("change-plan").description("Start or change the target billing plan.").argument("<plan_sku>", "payg-v1, builder-v1, growth-v1, or team-v1").option(
2021
+ billing.command("cards").description("List, add, choose the default of, and remove saved cards.").addHelpText(
2022
+ "after",
2023
+ `
2024
+ The default card pays for top-ups, auto top-up and invoices. Changing it does
2025
+ not move a charge already made. To remove the default card, make another card
2026
+ the default first.
2027
+
2028
+ Examples:
2029
+ deepline billing cards list
2030
+ deepline billing cards add
2031
+ deepline billing cards add --make-default
2032
+ deepline billing cards default <card_id> --dry-run
2033
+ deepline billing cards remove <card_id>
2034
+ `
2035
+ ).addCommand(
2036
+ new (0, _commander.Command)("list").description("Show saved cards, default first.").option("--limit <n>", "Cards per page (1-100, default 20)").option("--cursor <cursor>", "next_cursor from the previous page").option("--json", "Emit JSON output").action(handleCardsList)
2037
+ ).addCommand(
2038
+ new (0, _commander.Command)("add").description(
2039
+ "Print a secure page for entering a card. Keeps the current default unless --make-default is set."
2040
+ ).option("--make-default", "Make the new card the default").option("--json", "Emit JSON output").action(handleCardsAdd)
2041
+ ).addCommand(
2042
+ new (0, _commander.Command)("default").description("Use a saved card for later top-ups and invoices.").argument("<card_id>", "Card id from: deepline billing cards list").option("--change-id <uuid>", "Reuse to retry the same request").option("--dry-run", "Print the planned request without sending it").option("--json", "Emit JSON output").action(
2043
+ (cardId, options) => handleCardChange("default", cardId, options)
2044
+ )
2045
+ ).addCommand(
2046
+ new (0, _commander.Command)("remove").description("Remove a saved card that is not the default.").argument("<card_id>", "Card id from: deepline billing cards list").option("--change-id <uuid>", "Reuse to retry the same request").option("--dry-run", "Print the planned request without sending it").option("--json", "Emit JSON output").action(
2047
+ (cardId, options) => handleCardChange("remove", cardId, options)
2048
+ )
2049
+ );
2050
+ billing.command("change-plan").description("Start or change the target billing plan.").argument(
2051
+ "<plan_sku>",
2052
+ "payg-v1, builder-v1, growth-v1, team-v1, or team-v2"
2053
+ ).option(
1899
2054
  "--billing-email <email>",
1900
2055
  "Invoice recipient when the account has no billing email"
2056
+ ).option(
2057
+ "--promo-code <code>",
2058
+ "Plan promo code; an unknown, expired, or used code refuses the change"
1901
2059
  ).option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlan);
1902
2060
  billing.command("cancel-plan").description("Cancel a target subscription at period end, or undo it.").option("--undo", "Undo a pending period-end cancellation").option("--idempotency-key <key>", "Stable retry key").option("--json", "Emit JSON output").action(handleTargetPlanCancellation);
1903
2061
  billing.command("portal").description("Open the Stripe-hosted billing recovery portal.").option("--billing-address", "Open the billing address editor directly").option("--no-open", "Print the URL without opening a browser").option("--json", "Emit JSON output").action(handleTargetPortal);
@@ -1909,13 +2067,16 @@ Notes:
1909
2067
  visible plan's recurring price, included credits, purchased-credit price,
1910
2068
  and current acquisition availability. All amounts are Deepline credits and
1911
2069
  Deepline-facing USD, never raw provider spend. Change to an available plan
1912
- with: deepline billing change-plan <plan_sku>
2070
+ with: deepline billing change-plan <plan_sku>. A first-month price or bonus
2071
+ credits appear on a plan when the workspace is offered them. With
2072
+ --promo-code, prices are quoted with that code and its outcome is shown;
2073
+ pass the same code to change-plan.
1913
2074
 
1914
2075
  Examples:
1915
2076
  deepline billing plans
1916
- deepline billing plans
2077
+ deepline billing plans --promo-code <code>
1917
2078
  `
1918
- ).option("--json", "Emit JSON output").action(handlePlans);
2079
+ ).option("--promo-code <code>", "Quote plan prices with a promo code").option("--json", "Emit JSON output").action(handlePlans);
1919
2080
  billing.command("subscribe").description(
1920
2081
  "Start a subscription checkout for a plan and optionally open it in your browser."
1921
2082
  ).addHelpText(