@namzu/cli 51.1.0 → 51.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (407) hide show
  1. package/CHANGELOG.md +35 -0
  2. package/dist/bin.js +1 -1
  3. package/dist/chunks/{acp-YH3ORAMX.js → acp-AMAEXYMD.js} +117 -74
  4. package/dist/chunks/acp-AMAEXYMD.js.map +6 -0
  5. package/dist/chunks/{activity-command-6SLWX5O6.js → activity-command-4IUJ2CE4.js} +12 -12
  6. package/dist/chunks/{add-5DU7SP37.js → add-FT7HDU36.js} +23 -23
  7. package/dist/chunks/{agent-IN76G7FR.js → agent-EHNABCBA.js} +39 -37
  8. package/dist/chunks/agent-session-75E7MVCD.js +71 -0
  9. package/dist/chunks/{archive-X5OO3HYU.js → archive-5JVH6NLF.js} +10 -10
  10. package/dist/chunks/{bin-main-MJURSFNJ.js → bin-main-7SUJ2P6D.js} +8 -8
  11. package/dist/chunks/{binding-6EX5H32J.js → binding-S6NFVWG5.js} +3 -3
  12. package/dist/chunks/{browser-UUSAOFML.js → browser-5GSFFOI3.js} +6 -6
  13. package/dist/chunks/{chat-J2DRST74.js → chat-HROABWUI.js} +15 -15
  14. package/dist/chunks/{chunk-DQGDG63U.js → chunk-2FRFMWVI.js} +5 -5
  15. package/dist/chunks/{chunk-LJ4DIGHQ.js → chunk-2KMRCXGA.js} +9 -9
  16. package/dist/chunks/{chunk-F2I6X667.js → chunk-2MHTEUWP.js} +4 -3
  17. package/dist/chunks/{chunk-VDQQE3Q6.js → chunk-2MLY3HJM.js} +4 -4
  18. package/dist/chunks/{chunk-O6QJXKWZ.js → chunk-2WRNHAVP.js} +5 -5
  19. package/dist/chunks/{chunk-ZYRABJ7J.js → chunk-3PDX3NC2.js} +2 -2
  20. package/dist/chunks/{chunk-HAHNDC7N.js → chunk-3TINX26N.js} +3 -3
  21. package/dist/chunks/{chunk-SRBCU3IJ.js → chunk-4ACKQXK5.js} +2 -2
  22. package/dist/chunks/{chunk-MFRWOJCD.js → chunk-4AF3VDBG.js} +4 -3
  23. package/dist/chunks/{chunk-MFRWOJCD.js.map → chunk-4AF3VDBG.js.map} +1 -1
  24. package/dist/chunks/{chunk-BIWDWFAK.js → chunk-4BEZSMMK.js} +3 -3
  25. package/dist/chunks/chunk-4GIWPKXI.js +221 -0
  26. package/dist/chunks/chunk-4GIWPKXI.js.map +6 -0
  27. package/dist/chunks/{chunk-6J6AEQA4.js → chunk-4HCSIYER.js} +3 -3
  28. package/dist/chunks/{chunk-4GQ5ACCZ.js → chunk-4U245XO5.js} +2 -2
  29. package/dist/chunks/{chunk-B4M4IEOE.js → chunk-5BPI6U3L.js} +3 -3
  30. package/dist/chunks/{chunk-ASITCNWM.js → chunk-5CP365QA.js} +4 -4
  31. package/dist/chunks/{chunk-JETLWXUE.js → chunk-6ITTTCLD.js} +26 -2
  32. package/dist/chunks/chunk-6ITTTCLD.js.map +6 -0
  33. package/dist/chunks/{chunk-K4BMTUBH.js → chunk-77D2J3GS.js} +2 -2
  34. package/dist/chunks/chunk-7COFRJAP.js +60 -0
  35. package/dist/chunks/chunk-7COFRJAP.js.map +6 -0
  36. package/dist/chunks/{chunk-UHYZ64ET.js → chunk-7QIJT537.js} +2 -2
  37. package/dist/chunks/{chunk-R77WPUUF.js → chunk-A4KQCS3B.js} +3 -3
  38. package/dist/chunks/{chunk-DE4WWSBB.js → chunk-AOMD2UUT.js} +12 -12
  39. package/dist/chunks/chunk-BBTPD3DU.js +19 -0
  40. package/dist/chunks/chunk-BBTPD3DU.js.map +6 -0
  41. package/dist/chunks/{chunk-P6CNFKJC.js → chunk-BFAMP45Q.js} +5 -5
  42. package/dist/chunks/chunk-BGODFPA6.js +208 -0
  43. package/dist/chunks/chunk-BGODFPA6.js.map +6 -0
  44. package/dist/chunks/{chunk-GN4BLP6C.js → chunk-BGPJ7MSM.js} +9 -9
  45. package/dist/chunks/{chunk-HSSTV5SF.js → chunk-BLSCBY2C.js} +3 -3
  46. package/dist/chunks/{chunk-RZXNXGRE.js → chunk-BZVF3B6D.js} +2 -2
  47. package/dist/chunks/{chunk-3VKSD45U.js → chunk-CZHAME47.js} +4 -4
  48. package/dist/chunks/{chunk-2XXEIH7D.js → chunk-DAJHQNAH.js} +2 -2
  49. package/dist/chunks/{chunk-CB7VORLS.js → chunk-DC67SNZK.js} +4 -4
  50. package/dist/chunks/{chunk-BNIO5NNW.js → chunk-DFM3INZ3.js} +66 -39
  51. package/dist/chunks/chunk-DFM3INZ3.js.map +6 -0
  52. package/dist/chunks/{chunk-KBLICB2N.js → chunk-FENQC4LO.js} +2 -2
  53. package/dist/chunks/{chunk-FI5EMDFZ.js → chunk-FSVH5R5J.js} +4 -4
  54. package/dist/chunks/{chunk-TF6ZSM2M.js → chunk-G4M6NKL6.js} +2 -2
  55. package/dist/chunks/chunk-G4N43E6M.js +62 -0
  56. package/dist/chunks/chunk-G4N43E6M.js.map +6 -0
  57. package/dist/chunks/{chunk-VONTYDZ3.js → chunk-GDHAOY4Y.js} +3 -3
  58. package/dist/chunks/{chunk-YUDCUW4N.js → chunk-H2SUL7EJ.js} +3 -3
  59. package/dist/chunks/{chunk-XCDXSRY7.js → chunk-H47LSNSP.js} +2 -2
  60. package/dist/chunks/{chunk-2OGJPIGN.js → chunk-IGO3W6WL.js} +14 -14
  61. package/dist/chunks/{chunk-VIJFICIC.js → chunk-IIOWVRGQ.js} +4 -4
  62. package/dist/chunks/{chunk-S4HDKI6L.js → chunk-IJEESVK5.js} +2 -2
  63. package/dist/chunks/{chunk-JE2S7MW2.js → chunk-J7IH3JCJ.js} +2 -2
  64. package/dist/chunks/{chunk-BZC5JPMB.js → chunk-JCXJ3QSC.js} +3 -3
  65. package/dist/chunks/{chunk-YWKZQABS.js → chunk-JPQNCR67.js} +2 -2
  66. package/dist/chunks/{chunk-M3O7WEJF.js → chunk-KCRZA2E3.js} +2 -2
  67. package/dist/chunks/chunk-KD6WL3W7.js +10 -0
  68. package/dist/chunks/chunk-KD6WL3W7.js.map +6 -0
  69. package/dist/chunks/{chunk-QZDNCVK4.js → chunk-KQEX2PNL.js} +331 -371
  70. package/dist/chunks/chunk-KQEX2PNL.js.map +6 -0
  71. package/dist/chunks/chunk-KQYWFHRH.js +214 -0
  72. package/dist/chunks/chunk-KQYWFHRH.js.map +6 -0
  73. package/dist/chunks/{chunk-VPIFXAL6.js → chunk-KROVFC6L.js} +2 -2
  74. package/dist/chunks/{chunk-YU65OZTC.js → chunk-LAR6KRME.js} +2 -2
  75. package/dist/chunks/{chunk-JBQATPG3.js → chunk-LKHMBU72.js} +2 -2
  76. package/dist/chunks/{chunk-RQKE2URW.js → chunk-LWNTLOML.js} +3 -3
  77. package/dist/chunks/{chunk-ZJQYNG27.js → chunk-LXLM4OQO.js} +2 -2
  78. package/dist/chunks/chunk-LYUY2FK2.js +141 -0
  79. package/dist/chunks/chunk-LYUY2FK2.js.map +6 -0
  80. package/dist/chunks/{chunk-QN4WGK62.js → chunk-M5NDHHMG.js} +3 -3
  81. package/dist/chunks/{chunk-ZKOEUHCF.js → chunk-MLYGIG7M.js} +112 -9
  82. package/dist/chunks/chunk-MLYGIG7M.js.map +6 -0
  83. package/dist/chunks/{chunk-76HAMOHW.js → chunk-MNQDNDGD.js} +6 -6
  84. package/dist/chunks/{chunk-MPLS4I5N.js → chunk-MPAS3ZKW.js} +123 -81
  85. package/dist/chunks/chunk-MPAS3ZKW.js.map +6 -0
  86. package/dist/chunks/{chunk-NEKCM2HR.js → chunk-N4B5NJTM.js} +6 -6
  87. package/dist/chunks/{chunk-EK74R563.js → chunk-ONCQ3NZ6.js} +1594 -947
  88. package/dist/chunks/chunk-ONCQ3NZ6.js.map +6 -0
  89. package/dist/chunks/{chunk-AROJAFON.js → chunk-OP4VBHY7.js} +3 -3
  90. package/dist/chunks/{chunk-N7COW4QY.js → chunk-P2DX5J2F.js} +10 -10
  91. package/dist/chunks/{chunk-4MDH3G7P.js → chunk-P4SMB7ZH.js} +4 -4
  92. package/dist/chunks/{chunk-64CDTVEM.js → chunk-PBEK6MTE.js} +14 -14
  93. package/dist/chunks/{chunk-HFLX3ZLT.js → chunk-PXIVFM3R.js} +3 -3
  94. package/dist/chunks/{chunk-5HS5WIS3.js → chunk-QISKJ5SO.js} +2 -2
  95. package/dist/chunks/{chunk-FJZL4BJN.js → chunk-QNS2KLVT.js} +2 -2
  96. package/dist/chunks/{chunk-W5IR3SD3.js → chunk-RLGFYOUI.js} +6 -6
  97. package/dist/chunks/{chunk-3MUNYBIF.js → chunk-RSJVDB4N.js} +9 -8
  98. package/dist/chunks/{chunk-3KNUUOMF.js → chunk-SO322MOO.js} +2 -2
  99. package/dist/chunks/{chunk-BGT2BABA.js → chunk-SSYBTI26.js} +4 -4
  100. package/dist/chunks/chunk-SZOC2LYR.js +625 -0
  101. package/dist/chunks/chunk-SZOC2LYR.js.map +6 -0
  102. package/dist/chunks/{chunk-J267C5O6.js → chunk-TL6X6MAW.js} +2 -2
  103. package/dist/chunks/{chunk-PR3HSIXG.js → chunk-TOGEJIC5.js} +4 -4
  104. package/dist/chunks/{chunk-YOCPU3WT.js → chunk-USJJDXQK.js} +3 -3
  105. package/dist/chunks/{chunk-G2DGASUC.js → chunk-UVYM67LE.js} +2 -2
  106. package/dist/chunks/{chunk-WWC6L5WC.js → chunk-UZ6GL6GO.js} +2 -2
  107. package/dist/chunks/{chunk-ZRM2NW77.js → chunk-UZLAIMHO.js} +5 -5
  108. package/dist/chunks/{chunk-H32MIHLE.js → chunk-V7IK6MHO.js} +2 -2
  109. package/dist/chunks/{chunk-MJW6FQAW.js → chunk-W2IBHK6I.js} +2 -2
  110. package/dist/chunks/{chunk-GTRG5VXA.js → chunk-WFKHAW6M.js} +3 -3
  111. package/dist/chunks/{chunk-DXFPBLQV.js → chunk-WVS354PX.js} +3 -3
  112. package/dist/chunks/{chunk-PYRMWOCP.js → chunk-XC2RVHA4.js} +4 -4
  113. package/dist/chunks/{chunk-4DYB42HG.js → chunk-YEMHAEO5.js} +2 -2
  114. package/dist/chunks/{chunk-LRLMZTZ3.js → chunk-YLSDJOE6.js} +2 -2
  115. package/dist/chunks/{chunk-J4QN36GJ.js → chunk-YUOFGSIR.js} +64 -224
  116. package/dist/chunks/chunk-YUOFGSIR.js.map +6 -0
  117. package/dist/chunks/{chunk-CSWUOY5K.js → chunk-YWLMSOOM.js} +20 -20
  118. package/dist/chunks/chunk-ZC7ZL42B.js +262 -0
  119. package/dist/chunks/chunk-ZC7ZL42B.js.map +6 -0
  120. package/dist/chunks/{chunk-MPUHBR73.js → chunk-ZM7SGAOM.js} +2 -2
  121. package/dist/chunks/{chunk-LNIM2TS3.js → chunk-ZR3FTR77.js} +4 -4
  122. package/dist/chunks/{cli-runtime-YUFSSYYG.js → cli-runtime-OJB72C6H.js} +18 -15
  123. package/dist/chunks/cli-runtime-OJB72C6H.js.map +6 -0
  124. package/dist/chunks/{commands-J7XAMJC5.js → commands-5MHVFUYY.js} +5 -5
  125. package/dist/chunks/cost-XLXGPE4O.js +755 -0
  126. package/dist/chunks/cost-XLXGPE4O.js.map +6 -0
  127. package/dist/chunks/{crash-report-3GPFLNQX.js → crash-report-WMCP5IA4.js} +6 -6
  128. package/dist/chunks/day-CU5J7UAK.js +22 -0
  129. package/dist/chunks/{dist-UXUFCGIX.js → dist-AYALCT3C.js} +2 -2
  130. package/dist/chunks/{dist-5LXAFF2H.js → dist-HOZJYOTI.js} +2 -2
  131. package/dist/chunks/{dist-CO47MPO4.js → dist-K5Z6YPNW.js} +2 -2
  132. package/dist/chunks/{dist-EGCYKNFG.js → dist-NESMLP2I.js} +62 -2
  133. package/dist/chunks/{dist-2EQ3MAWA.js → dist-NVATKUF3.js} +2 -2
  134. package/dist/chunks/{dist-IS662MSA.js → dist-O526SRCF.js} +2 -2
  135. package/dist/chunks/{dist-F36KOHDP.js → dist-WQB34UXN.js} +2 -2
  136. package/dist/chunks/{dist-4TO2X6U4.js → dist-ZJ6G2XMS.js} +2 -2
  137. package/dist/chunks/{doctor-YC6Z7P3P.js → doctor-RBLQ7HI2.js} +19 -19
  138. package/dist/chunks/{drain-5BQHD3KW.js → drain-C3ZPDAX2.js} +9 -9
  139. package/dist/chunks/{entry-ZJWR3CSL.js → entry-IJAMOWTT.js} +6 -6
  140. package/dist/chunks/{eval-JHNFGVGA.js → eval-IF7P6OYF.js} +171 -13
  141. package/dist/chunks/eval-IF7P6OYF.js.map +6 -0
  142. package/dist/chunks/{exec-YADZELFF.js → exec-Z3HA2KFB.js} +45 -41
  143. package/dist/chunks/exec-Z3HA2KFB.js.map +6 -0
  144. package/dist/chunks/{home-EBXWUU6C.js → home-A2HSOG27.js} +3 -3
  145. package/dist/chunks/{host-JU76NQJY.js → host-I3PPCCQ3.js} +10 -10
  146. package/dist/chunks/{host-queries-6TO7AIZE.js → host-queries-6JUQR5OK.js} +17 -16
  147. package/dist/chunks/host-queries-6JUQR5OK.js.map +6 -0
  148. package/dist/chunks/{learn-YGTIACD6.js → learn-T7HNXBBZ.js} +11 -11
  149. package/dist/chunks/{learn-builtin-FND7NEEV.js → learn-builtin-TWYQP7WB.js} +14 -14
  150. package/dist/chunks/{lifecycle-VBNEAO74.js → lifecycle-KH3KX7HU.js} +33 -33
  151. package/dist/chunks/{list-GQEKL3MC.js → list-HQDI3H4N.js} +15 -15
  152. package/dist/chunks/{live-N3PPNKW6.js → live-3MEPPMUV.js} +18 -18
  153. package/dist/chunks/{login-KEFAKXJZ.js → login-C2QJP446.js} +13 -13
  154. package/dist/chunks/{logs-JZEIQMOQ.js → logs-QDXZ6HMD.js} +5 -5
  155. package/dist/chunks/{mcp-7CBDNNY3.js → mcp-CFQMYILA.js} +23 -23
  156. package/dist/chunks/{message-command-JAKH5U6B.js → message-command-NVYMXCYY.js} +47 -45
  157. package/dist/chunks/message-command-NVYMXCYY.js.map +6 -0
  158. package/dist/chunks/{open-Q63ZNCNO.js → open-USUNNL3C.js} +8 -8
  159. package/dist/chunks/{operator-tools-SEK3DCMJ.js → operator-tools-B5EKAIEU.js} +13 -13
  160. package/dist/chunks/{output-schema-ROCYTWMQ.js → output-schema-4JBWQTYX.js} +3 -3
  161. package/dist/chunks/{pal-XOMURPYQ.js → pal-DG7MJFME.js} +16 -16
  162. package/dist/chunks/peers-4JWFI3OJ.js +215 -0
  163. package/dist/chunks/peers-4JWFI3OJ.js.map +6 -0
  164. package/dist/chunks/{peers-JILQNRCW.js → peers-U4NWN44W.js} +6 -6
  165. package/dist/chunks/plugin-MGHRREZ7.js +1043 -0
  166. package/dist/chunks/plugin-MGHRREZ7.js.map +6 -0
  167. package/dist/chunks/{providers-NMMTLTEC.js → providers-QFMAPZK7.js} +11 -11
  168. package/dist/chunks/{pty-KR5RNX54.js → pty-YX7E7UJ6.js} +3 -3
  169. package/dist/chunks/render-QFCCPEEL.js +14 -0
  170. package/dist/chunks/resume-DHAMPNCN.js +23 -0
  171. package/dist/chunks/{resume-command-WOG47T6A.js → resume-command-I7SNRBQE.js} +5 -5
  172. package/dist/chunks/{schedule-V3OHZVHK.js → schedule-K3UQBEGV.js} +8 -8
  173. package/dist/chunks/send-II2KFKIK.js +42 -0
  174. package/dist/chunks/send-person-74VABPSV.js +28 -0
  175. package/dist/chunks/{service-XPJSCHPW.js → service-FSAD7FQU.js} +37 -37
  176. package/dist/chunks/{skills-PGO6KGCD.js → skills-YVKRYB7M.js} +8 -8
  177. package/dist/chunks/{start-check-CLSVKYRW.js → start-check-DNDHNVSL.js} +2 -2
  178. package/dist/chunks/{startup-failure-WN5PCOIE.js → startup-failure-SAPN77LY.js} +2 -2
  179. package/dist/chunks/{state-W72YF7CF.js → state-JUVAH65X.js} +2 -2
  180. package/dist/chunks/{store-SQINHTJO.js → store-CQOALIPR.js} +10 -10
  181. package/dist/chunks/store-CQOALIPR.js.map +6 -0
  182. package/dist/chunks/{store-4RNQ47OD.js → store-EOOW5RU2.js} +6 -6
  183. package/dist/chunks/store-EOOW5RU2.js.map +6 -0
  184. package/dist/chunks/{store-7SESBCUG.js → store-LX7F4E5A.js} +3 -3
  185. package/dist/chunks/store-LX7F4E5A.js.map +6 -0
  186. package/dist/chunks/{store-J4CYKAFS.js → store-RS7ZLTDT.js} +4 -4
  187. package/dist/chunks/store-RS7ZLTDT.js.map +6 -0
  188. package/dist/chunks/{tui-HYKE4V4J.js → tui-RZZ2G3WI.js} +79 -75
  189. package/dist/chunks/tui-RZZ2G3WI.js.map +6 -0
  190. package/dist/chunks/{upgrade-HE5NIE2M.js → upgrade-T47RYB3K.js} +7 -7
  191. package/dist/chunks/watch-BBF3CLMM.js +752 -0
  192. package/dist/chunks/watch-BBF3CLMM.js.map +6 -0
  193. package/dist/chunks/{workspaces-CPOLSOKE.js → workspaces-3F2DSKWC.js} +16 -16
  194. package/dist/chunks/{worktree-TUBWOHUQ.js → worktree-HPE4E4UF.js} +12 -12
  195. package/dist/cli.d.ts.map +1 -1
  196. package/dist/commands/acp.d.ts +20 -1
  197. package/dist/commands/acp.d.ts.map +1 -1
  198. package/dist/commands/cost.d.ts +26 -0
  199. package/dist/commands/cost.d.ts.map +1 -0
  200. package/dist/commands/desktop-host.d.ts.map +1 -1
  201. package/dist/commands/eval-settings.d.ts +19 -0
  202. package/dist/commands/eval-settings.d.ts.map +1 -0
  203. package/dist/commands/eval.d.ts.map +1 -1
  204. package/dist/commands/manifest.d.ts +3 -0
  205. package/dist/commands/manifest.d.ts.map +1 -1
  206. package/dist/commands/plugin.d.ts +18 -0
  207. package/dist/commands/plugin.d.ts.map +1 -0
  208. package/dist/commands/send.d.ts +42 -0
  209. package/dist/commands/send.d.ts.map +1 -0
  210. package/dist/commands/watch.d.ts +10 -0
  211. package/dist/commands/watch.d.ts.map +1 -1
  212. package/dist/context/runtime-message.d.ts +12 -0
  213. package/dist/context/runtime-message.d.ts.map +1 -1
  214. package/dist/desktop-contract.d.ts +21 -0
  215. package/dist/desktop-contract.d.ts.map +1 -0
  216. package/dist/index.d.ts +1 -0
  217. package/dist/index.d.ts.map +1 -1
  218. package/dist/index.js +31 -27
  219. package/dist/integrations/auto-update/install-kind.d.ts.map +1 -1
  220. package/dist/integrations/harness/process.d.ts.map +1 -1
  221. package/dist/integrations/peers/process-ancestry.d.ts +14 -0
  222. package/dist/integrations/peers/process-ancestry.d.ts.map +1 -0
  223. package/dist/integrations/peers/runtime.d.ts +9 -0
  224. package/dist/integrations/peers/runtime.d.ts.map +1 -1
  225. package/dist/integrations/peers/send-once.d.ts +42 -0
  226. package/dist/integrations/peers/send-once.d.ts.map +1 -1
  227. package/dist/integrations/peers/send-person.d.ts +54 -0
  228. package/dist/integrations/peers/send-person.d.ts.map +1 -0
  229. package/dist/integrations/plugins/check-hint.d.ts +5 -0
  230. package/dist/integrations/plugins/check-hint.d.ts.map +1 -0
  231. package/dist/integrations/plugins/files.d.ts +17 -0
  232. package/dist/integrations/plugins/files.d.ts.map +1 -1
  233. package/dist/integrations/plugins/validate.d.ts +75 -0
  234. package/dist/integrations/plugins/validate.d.ts.map +1 -0
  235. package/dist/integrations/sessions/watch-say.d.ts +28 -0
  236. package/dist/integrations/sessions/watch-say.d.ts.map +1 -0
  237. package/dist/integrations/sessions/watch-view.d.ts +9 -0
  238. package/dist/integrations/sessions/watch-view.d.ts.map +1 -1
  239. package/dist/integrations/spend/day.d.ts +26 -0
  240. package/dist/integrations/spend/day.d.ts.map +1 -0
  241. package/dist/integrations/spend/fold.d.ts +136 -0
  242. package/dist/integrations/spend/fold.d.ts.map +1 -0
  243. package/dist/integrations/spend/ledger.d.ts +74 -0
  244. package/dist/integrations/spend/ledger.d.ts.map +1 -0
  245. package/dist/integrations/spend/render.d.ts +6 -0
  246. package/dist/integrations/spend/render.d.ts.map +1 -0
  247. package/dist/integrations/spend/report.d.ts +110 -0
  248. package/dist/integrations/spend/report.d.ts.map +1 -0
  249. package/dist/integrations/telemetry/otlp-export.d.ts +3 -0
  250. package/dist/integrations/telemetry/otlp-export.d.ts.map +1 -1
  251. package/dist/permissions/read-only-gate.d.ts.map +1 -1
  252. package/dist/permissions/send-floor.d.ts +54 -0
  253. package/dist/permissions/send-floor.d.ts.map +1 -0
  254. package/dist/terminal/manager.d.ts.map +1 -1
  255. package/dist/tui/App.d.ts.map +1 -1
  256. package/dist/tui/agent.d.ts.map +1 -1
  257. package/dist/tui/slashCommands.d.ts +5 -0
  258. package/dist/tui/slashCommands.d.ts.map +1 -1
  259. package/dist/user-commands/store.d.ts +14 -0
  260. package/dist/user-commands/store.d.ts.map +1 -1
  261. package/package.json +3 -3
  262. package/dist/chunks/acp-YH3ORAMX.js.map +0 -6
  263. package/dist/chunks/agent-session-5T4QOI6T.js +0 -69
  264. package/dist/chunks/chunk-BNIO5NNW.js.map +0 -6
  265. package/dist/chunks/chunk-EK74R563.js.map +0 -6
  266. package/dist/chunks/chunk-J4QN36GJ.js.map +0 -6
  267. package/dist/chunks/chunk-JETLWXUE.js.map +0 -6
  268. package/dist/chunks/chunk-MPLS4I5N.js.map +0 -6
  269. package/dist/chunks/chunk-QZDNCVK4.js.map +0 -6
  270. package/dist/chunks/chunk-ZKOEUHCF.js.map +0 -6
  271. package/dist/chunks/cli-runtime-YUFSSYYG.js.map +0 -6
  272. package/dist/chunks/eval-JHNFGVGA.js.map +0 -6
  273. package/dist/chunks/exec-YADZELFF.js.map +0 -6
  274. package/dist/chunks/host-queries-6TO7AIZE.js.map +0 -6
  275. package/dist/chunks/message-command-JAKH5U6B.js.map +0 -6
  276. package/dist/chunks/peers-GY5QNN5F.js +0 -417
  277. package/dist/chunks/peers-GY5QNN5F.js.map +0 -6
  278. package/dist/chunks/resume-A3XPV4Z5.js +0 -23
  279. package/dist/chunks/tui-HYKE4V4J.js.map +0 -6
  280. package/dist/chunks/watch-C5YQJNHV.js +0 -978
  281. package/dist/chunks/watch-C5YQJNHV.js.map +0 -6
  282. /package/dist/chunks/{activity-command-6SLWX5O6.js.map → activity-command-4IUJ2CE4.js.map} +0 -0
  283. /package/dist/chunks/{add-5DU7SP37.js.map → add-FT7HDU36.js.map} +0 -0
  284. /package/dist/chunks/{agent-IN76G7FR.js.map → agent-EHNABCBA.js.map} +0 -0
  285. /package/dist/chunks/{agent-session-5T4QOI6T.js.map → agent-session-75E7MVCD.js.map} +0 -0
  286. /package/dist/chunks/{archive-X5OO3HYU.js.map → archive-5JVH6NLF.js.map} +0 -0
  287. /package/dist/chunks/{bin-main-MJURSFNJ.js.map → bin-main-7SUJ2P6D.js.map} +0 -0
  288. /package/dist/chunks/{binding-6EX5H32J.js.map → binding-S6NFVWG5.js.map} +0 -0
  289. /package/dist/chunks/{browser-UUSAOFML.js.map → browser-5GSFFOI3.js.map} +0 -0
  290. /package/dist/chunks/{chat-J2DRST74.js.map → chat-HROABWUI.js.map} +0 -0
  291. /package/dist/chunks/{chunk-DQGDG63U.js.map → chunk-2FRFMWVI.js.map} +0 -0
  292. /package/dist/chunks/{chunk-LJ4DIGHQ.js.map → chunk-2KMRCXGA.js.map} +0 -0
  293. /package/dist/chunks/{chunk-F2I6X667.js.map → chunk-2MHTEUWP.js.map} +0 -0
  294. /package/dist/chunks/{chunk-VDQQE3Q6.js.map → chunk-2MLY3HJM.js.map} +0 -0
  295. /package/dist/chunks/{chunk-O6QJXKWZ.js.map → chunk-2WRNHAVP.js.map} +0 -0
  296. /package/dist/chunks/{chunk-ZYRABJ7J.js.map → chunk-3PDX3NC2.js.map} +0 -0
  297. /package/dist/chunks/{chunk-HAHNDC7N.js.map → chunk-3TINX26N.js.map} +0 -0
  298. /package/dist/chunks/{chunk-SRBCU3IJ.js.map → chunk-4ACKQXK5.js.map} +0 -0
  299. /package/dist/chunks/{chunk-BIWDWFAK.js.map → chunk-4BEZSMMK.js.map} +0 -0
  300. /package/dist/chunks/{chunk-6J6AEQA4.js.map → chunk-4HCSIYER.js.map} +0 -0
  301. /package/dist/chunks/{chunk-4GQ5ACCZ.js.map → chunk-4U245XO5.js.map} +0 -0
  302. /package/dist/chunks/{chunk-B4M4IEOE.js.map → chunk-5BPI6U3L.js.map} +0 -0
  303. /package/dist/chunks/{chunk-ASITCNWM.js.map → chunk-5CP365QA.js.map} +0 -0
  304. /package/dist/chunks/{chunk-K4BMTUBH.js.map → chunk-77D2J3GS.js.map} +0 -0
  305. /package/dist/chunks/{chunk-UHYZ64ET.js.map → chunk-7QIJT537.js.map} +0 -0
  306. /package/dist/chunks/{chunk-R77WPUUF.js.map → chunk-A4KQCS3B.js.map} +0 -0
  307. /package/dist/chunks/{chunk-DE4WWSBB.js.map → chunk-AOMD2UUT.js.map} +0 -0
  308. /package/dist/chunks/{chunk-P6CNFKJC.js.map → chunk-BFAMP45Q.js.map} +0 -0
  309. /package/dist/chunks/{chunk-GN4BLP6C.js.map → chunk-BGPJ7MSM.js.map} +0 -0
  310. /package/dist/chunks/{chunk-HSSTV5SF.js.map → chunk-BLSCBY2C.js.map} +0 -0
  311. /package/dist/chunks/{chunk-RZXNXGRE.js.map → chunk-BZVF3B6D.js.map} +0 -0
  312. /package/dist/chunks/{chunk-3VKSD45U.js.map → chunk-CZHAME47.js.map} +0 -0
  313. /package/dist/chunks/{chunk-2XXEIH7D.js.map → chunk-DAJHQNAH.js.map} +0 -0
  314. /package/dist/chunks/{chunk-CB7VORLS.js.map → chunk-DC67SNZK.js.map} +0 -0
  315. /package/dist/chunks/{chunk-KBLICB2N.js.map → chunk-FENQC4LO.js.map} +0 -0
  316. /package/dist/chunks/{chunk-FI5EMDFZ.js.map → chunk-FSVH5R5J.js.map} +0 -0
  317. /package/dist/chunks/{chunk-TF6ZSM2M.js.map → chunk-G4M6NKL6.js.map} +0 -0
  318. /package/dist/chunks/{chunk-VONTYDZ3.js.map → chunk-GDHAOY4Y.js.map} +0 -0
  319. /package/dist/chunks/{chunk-YUDCUW4N.js.map → chunk-H2SUL7EJ.js.map} +0 -0
  320. /package/dist/chunks/{chunk-XCDXSRY7.js.map → chunk-H47LSNSP.js.map} +0 -0
  321. /package/dist/chunks/{chunk-2OGJPIGN.js.map → chunk-IGO3W6WL.js.map} +0 -0
  322. /package/dist/chunks/{chunk-VIJFICIC.js.map → chunk-IIOWVRGQ.js.map} +0 -0
  323. /package/dist/chunks/{chunk-S4HDKI6L.js.map → chunk-IJEESVK5.js.map} +0 -0
  324. /package/dist/chunks/{chunk-JE2S7MW2.js.map → chunk-J7IH3JCJ.js.map} +0 -0
  325. /package/dist/chunks/{chunk-BZC5JPMB.js.map → chunk-JCXJ3QSC.js.map} +0 -0
  326. /package/dist/chunks/{chunk-YWKZQABS.js.map → chunk-JPQNCR67.js.map} +0 -0
  327. /package/dist/chunks/{chunk-M3O7WEJF.js.map → chunk-KCRZA2E3.js.map} +0 -0
  328. /package/dist/chunks/{chunk-VPIFXAL6.js.map → chunk-KROVFC6L.js.map} +0 -0
  329. /package/dist/chunks/{chunk-YU65OZTC.js.map → chunk-LAR6KRME.js.map} +0 -0
  330. /package/dist/chunks/{chunk-JBQATPG3.js.map → chunk-LKHMBU72.js.map} +0 -0
  331. /package/dist/chunks/{chunk-RQKE2URW.js.map → chunk-LWNTLOML.js.map} +0 -0
  332. /package/dist/chunks/{chunk-ZJQYNG27.js.map → chunk-LXLM4OQO.js.map} +0 -0
  333. /package/dist/chunks/{chunk-QN4WGK62.js.map → chunk-M5NDHHMG.js.map} +0 -0
  334. /package/dist/chunks/{chunk-76HAMOHW.js.map → chunk-MNQDNDGD.js.map} +0 -0
  335. /package/dist/chunks/{chunk-NEKCM2HR.js.map → chunk-N4B5NJTM.js.map} +0 -0
  336. /package/dist/chunks/{chunk-AROJAFON.js.map → chunk-OP4VBHY7.js.map} +0 -0
  337. /package/dist/chunks/{chunk-N7COW4QY.js.map → chunk-P2DX5J2F.js.map} +0 -0
  338. /package/dist/chunks/{chunk-4MDH3G7P.js.map → chunk-P4SMB7ZH.js.map} +0 -0
  339. /package/dist/chunks/{chunk-64CDTVEM.js.map → chunk-PBEK6MTE.js.map} +0 -0
  340. /package/dist/chunks/{chunk-HFLX3ZLT.js.map → chunk-PXIVFM3R.js.map} +0 -0
  341. /package/dist/chunks/{chunk-5HS5WIS3.js.map → chunk-QISKJ5SO.js.map} +0 -0
  342. /package/dist/chunks/{chunk-FJZL4BJN.js.map → chunk-QNS2KLVT.js.map} +0 -0
  343. /package/dist/chunks/{chunk-W5IR3SD3.js.map → chunk-RLGFYOUI.js.map} +0 -0
  344. /package/dist/chunks/{chunk-3MUNYBIF.js.map → chunk-RSJVDB4N.js.map} +0 -0
  345. /package/dist/chunks/{chunk-3KNUUOMF.js.map → chunk-SO322MOO.js.map} +0 -0
  346. /package/dist/chunks/{chunk-BGT2BABA.js.map → chunk-SSYBTI26.js.map} +0 -0
  347. /package/dist/chunks/{chunk-J267C5O6.js.map → chunk-TL6X6MAW.js.map} +0 -0
  348. /package/dist/chunks/{chunk-PR3HSIXG.js.map → chunk-TOGEJIC5.js.map} +0 -0
  349. /package/dist/chunks/{chunk-YOCPU3WT.js.map → chunk-USJJDXQK.js.map} +0 -0
  350. /package/dist/chunks/{chunk-G2DGASUC.js.map → chunk-UVYM67LE.js.map} +0 -0
  351. /package/dist/chunks/{chunk-WWC6L5WC.js.map → chunk-UZ6GL6GO.js.map} +0 -0
  352. /package/dist/chunks/{chunk-ZRM2NW77.js.map → chunk-UZLAIMHO.js.map} +0 -0
  353. /package/dist/chunks/{chunk-H32MIHLE.js.map → chunk-V7IK6MHO.js.map} +0 -0
  354. /package/dist/chunks/{chunk-MJW6FQAW.js.map → chunk-W2IBHK6I.js.map} +0 -0
  355. /package/dist/chunks/{chunk-GTRG5VXA.js.map → chunk-WFKHAW6M.js.map} +0 -0
  356. /package/dist/chunks/{chunk-DXFPBLQV.js.map → chunk-WVS354PX.js.map} +0 -0
  357. /package/dist/chunks/{chunk-PYRMWOCP.js.map → chunk-XC2RVHA4.js.map} +0 -0
  358. /package/dist/chunks/{chunk-4DYB42HG.js.map → chunk-YEMHAEO5.js.map} +0 -0
  359. /package/dist/chunks/{chunk-LRLMZTZ3.js.map → chunk-YLSDJOE6.js.map} +0 -0
  360. /package/dist/chunks/{chunk-CSWUOY5K.js.map → chunk-YWLMSOOM.js.map} +0 -0
  361. /package/dist/chunks/{chunk-MPUHBR73.js.map → chunk-ZM7SGAOM.js.map} +0 -0
  362. /package/dist/chunks/{chunk-LNIM2TS3.js.map → chunk-ZR3FTR77.js.map} +0 -0
  363. /package/dist/chunks/{commands-J7XAMJC5.js.map → commands-5MHVFUYY.js.map} +0 -0
  364. /package/dist/chunks/{crash-report-3GPFLNQX.js.map → crash-report-WMCP5IA4.js.map} +0 -0
  365. /package/dist/chunks/{dist-EGCYKNFG.js.map → day-CU5J7UAK.js.map} +0 -0
  366. /package/dist/chunks/{dist-UXUFCGIX.js.map → dist-AYALCT3C.js.map} +0 -0
  367. /package/dist/chunks/{dist-5LXAFF2H.js.map → dist-HOZJYOTI.js.map} +0 -0
  368. /package/dist/chunks/{dist-CO47MPO4.js.map → dist-K5Z6YPNW.js.map} +0 -0
  369. /package/dist/chunks/{doctor-YC6Z7P3P.js.map → dist-NESMLP2I.js.map} +0 -0
  370. /package/dist/chunks/{dist-2EQ3MAWA.js.map → dist-NVATKUF3.js.map} +0 -0
  371. /package/dist/chunks/{dist-IS662MSA.js.map → dist-O526SRCF.js.map} +0 -0
  372. /package/dist/chunks/{dist-F36KOHDP.js.map → dist-WQB34UXN.js.map} +0 -0
  373. /package/dist/chunks/{dist-4TO2X6U4.js.map → dist-ZJ6G2XMS.js.map} +0 -0
  374. /package/dist/chunks/{home-EBXWUU6C.js.map → doctor-RBLQ7HI2.js.map} +0 -0
  375. /package/dist/chunks/{drain-5BQHD3KW.js.map → drain-C3ZPDAX2.js.map} +0 -0
  376. /package/dist/chunks/{entry-ZJWR3CSL.js.map → entry-IJAMOWTT.js.map} +0 -0
  377. /package/dist/chunks/{host-JU76NQJY.js.map → home-A2HSOG27.js.map} +0 -0
  378. /package/dist/chunks/{lifecycle-VBNEAO74.js.map → host-I3PPCCQ3.js.map} +0 -0
  379. /package/dist/chunks/{learn-YGTIACD6.js.map → learn-T7HNXBBZ.js.map} +0 -0
  380. /package/dist/chunks/{learn-builtin-FND7NEEV.js.map → learn-builtin-TWYQP7WB.js.map} +0 -0
  381. /package/dist/chunks/{live-N3PPNKW6.js.map → lifecycle-KH3KX7HU.js.map} +0 -0
  382. /package/dist/chunks/{list-GQEKL3MC.js.map → list-HQDI3H4N.js.map} +0 -0
  383. /package/dist/chunks/{login-KEFAKXJZ.js.map → live-3MEPPMUV.js.map} +0 -0
  384. /package/dist/chunks/{open-Q63ZNCNO.js.map → login-C2QJP446.js.map} +0 -0
  385. /package/dist/chunks/{logs-JZEIQMOQ.js.map → logs-QDXZ6HMD.js.map} +0 -0
  386. /package/dist/chunks/{mcp-7CBDNNY3.js.map → mcp-CFQMYILA.js.map} +0 -0
  387. /package/dist/chunks/{output-schema-ROCYTWMQ.js.map → open-USUNNL3C.js.map} +0 -0
  388. /package/dist/chunks/{operator-tools-SEK3DCMJ.js.map → operator-tools-B5EKAIEU.js.map} +0 -0
  389. /package/dist/chunks/{peers-JILQNRCW.js.map → output-schema-4JBWQTYX.js.map} +0 -0
  390. /package/dist/chunks/{pal-XOMURPYQ.js.map → pal-DG7MJFME.js.map} +0 -0
  391. /package/dist/chunks/{providers-NMMTLTEC.js.map → peers-U4NWN44W.js.map} +0 -0
  392. /package/dist/chunks/{pty-KR5RNX54.js.map → providers-QFMAPZK7.js.map} +0 -0
  393. /package/dist/chunks/{resume-A3XPV4Z5.js.map → pty-YX7E7UJ6.js.map} +0 -0
  394. /package/dist/chunks/{resume-command-WOG47T6A.js.map → render-QFCCPEEL.js.map} +0 -0
  395. /package/dist/chunks/{start-check-CLSVKYRW.js.map → resume-DHAMPNCN.js.map} +0 -0
  396. /package/dist/chunks/{store-4RNQ47OD.js.map → resume-command-I7SNRBQE.js.map} +0 -0
  397. /package/dist/chunks/{schedule-V3OHZVHK.js.map → schedule-K3UQBEGV.js.map} +0 -0
  398. /package/dist/chunks/{store-7SESBCUG.js.map → send-II2KFKIK.js.map} +0 -0
  399. /package/dist/chunks/{store-J4CYKAFS.js.map → send-person-74VABPSV.js.map} +0 -0
  400. /package/dist/chunks/{service-XPJSCHPW.js.map → service-FSAD7FQU.js.map} +0 -0
  401. /package/dist/chunks/{skills-PGO6KGCD.js.map → skills-YVKRYB7M.js.map} +0 -0
  402. /package/dist/chunks/{store-SQINHTJO.js.map → start-check-DNDHNVSL.js.map} +0 -0
  403. /package/dist/chunks/{startup-failure-WN5PCOIE.js.map → startup-failure-SAPN77LY.js.map} +0 -0
  404. /package/dist/chunks/{state-W72YF7CF.js.map → state-JUVAH65X.js.map} +0 -0
  405. /package/dist/chunks/{upgrade-HE5NIE2M.js.map → upgrade-T47RYB3K.js.map} +0 -0
  406. /package/dist/chunks/{workspaces-CPOLSOKE.js.map → workspaces-3F2DSKWC.js.map} +0 -0
  407. /package/dist/chunks/{worktree-TUBWOHUQ.js.map → worktree-HPE4E4UF.js.map} +0 -0
@@ -0,0 +1,755 @@
1
+ import { createRequire as __namzuCreateRequire } from 'node:module';
2
+ const require = __namzuCreateRequire(import.meta.url);
3
+ import {
4
+ renderSpend
5
+ } from "./chunk-LYUY2FK2.js";
6
+ import {
7
+ DEFAULT_SPEND_DAYS,
8
+ MAX_SPEND_DAYS,
9
+ SLOT_MS,
10
+ createDayKeyer,
11
+ shiftDay,
12
+ slotOf,
13
+ systemClock
14
+ } from "./chunk-G4N43E6M.js";
15
+ import "./chunk-I4GTRFPK.js";
16
+ import {
17
+ createFormatter
18
+ } from "./chunk-KONYGNG6.js";
19
+ import "./chunk-U5UV2YRE.js";
20
+ import {
21
+ EXIT_FAIL,
22
+ EXIT_OK,
23
+ EXIT_USAGE
24
+ } from "./chunk-FTMONTUX.js";
25
+ import "./chunk-UZ6GL6GO.js";
26
+ import {
27
+ VENDOR_RATES,
28
+ resolveModelPricing,
29
+ resolveNamzuHome
30
+ } from "./chunk-ONCQ3NZ6.js";
31
+ import {
32
+ __name
33
+ } from "./chunk-76FLAFCG.js";
34
+
35
+ // src/integrations/spend/ledger.ts
36
+ import { randomUUID } from "node:crypto";
37
+ import { open, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
38
+ import { join } from "node:path";
39
+
40
+ // src/integrations/spend/fold.ts
41
+ var KIND_REPLY = 0;
42
+ var KIND_COMPACTION = 1;
43
+ var KIND_INTERNAL = 2;
44
+ var ZERO = {
45
+ prompt: 0,
46
+ completion: 0,
47
+ total: 0,
48
+ cacheRead: 0,
49
+ cacheWrite: 0,
50
+ cost: 0,
51
+ unpriced: 0
52
+ };
53
+ var ModelTable = class {
54
+ static {
55
+ __name(this, "ModelTable");
56
+ }
57
+ list = [];
58
+ #index = /* @__PURE__ */ new Map();
59
+ constructor(initial = []) {
60
+ for (const key of initial) this.indexOf(key);
61
+ }
62
+ indexOf(key) {
63
+ const id = `${key.provider ?? ""}\0${key.model}`;
64
+ const hit = this.#index.get(id);
65
+ if (hit !== void 0) return hit;
66
+ this.list.push(key);
67
+ this.#index.set(id, this.list.length - 1);
68
+ return this.list.length - 1;
69
+ }
70
+ };
71
+ var INTERESTING = /"type":"(?:session_started|turn_started|request_envelope|provider_fallback|token_usage_updated|turn_completed|turn_failed)"/;
72
+ var num = /* @__PURE__ */ __name((value) => typeof value === "number" && Number.isFinite(value) ? value : 0, "num");
73
+ function cumulativeOf(usage, cost) {
74
+ const u = usage ?? {};
75
+ const c = cost ?? {};
76
+ return {
77
+ prompt: num(u.promptTokens),
78
+ completion: num(u.completionTokens),
79
+ total: num(u.totalTokens),
80
+ cacheRead: num(u.cachedTokens),
81
+ cacheWrite: num(u.cacheWriteTokens),
82
+ cost: num(c.totalCost),
83
+ unpriced: num(c.unpricedTokens)
84
+ };
85
+ }
86
+ __name(cumulativeOf, "cumulativeOf");
87
+ function minus(a, b) {
88
+ return {
89
+ prompt: a.prompt - b.prompt,
90
+ completion: a.completion - b.completion,
91
+ total: a.total - b.total,
92
+ cacheRead: a.cacheRead - b.cacheRead,
93
+ cacheWrite: a.cacheWrite - b.cacheWrite,
94
+ cost: a.cost - b.cost,
95
+ unpriced: a.unpriced - b.unpriced
96
+ };
97
+ }
98
+ __name(minus, "minus");
99
+ function isZero(d) {
100
+ return d.prompt === 0 && d.completion === 0 && d.total === 0 && d.cacheRead === 0 && d.cacheWrite === 0 && d.cost === 0 && d.unpriced === 0;
101
+ }
102
+ __name(isZero, "isZero");
103
+ function freshShare(delta, provider) {
104
+ if (delta.cacheRead === 0) return { fresh: delta.prompt, unknown: 0 };
105
+ const card = provider === null ? void 0 : resolveModelPricing(provider, delta.model);
106
+ if (card?.cache === void 0) return { fresh: 0, unknown: delta.prompt };
107
+ return {
108
+ fresh: card.cache.promptIncludesCacheReads ? Math.max(0, delta.prompt - delta.cacheRead) : delta.prompt,
109
+ unknown: 0
110
+ };
111
+ }
112
+ __name(freshShare, "freshShare");
113
+ var RowSink = class {
114
+ constructor(models) {
115
+ this.models = models;
116
+ }
117
+ models;
118
+ static {
119
+ __name(this, "RowSink");
120
+ }
121
+ #rows = /* @__PURE__ */ new Map();
122
+ add(delta, provider) {
123
+ const share = freshShare(delta, provider);
124
+ const model = this.models.indexOf({ provider, model: delta.model });
125
+ const key = `${delta.slot}:${delta.kind}:${model}`;
126
+ let row = this.#rows.get(key);
127
+ if (row === void 0) {
128
+ row = [delta.slot, delta.kind, model, 0, 0, 0, 0, 0, 0, 0, 0];
129
+ this.#rows.set(key, row);
130
+ }
131
+ row[3] = row[3] + delta.total;
132
+ row[4] = row[4] + share.fresh;
133
+ row[5] = row[5] + share.unknown;
134
+ row[6] = row[6] + delta.cacheRead;
135
+ row[7] = row[7] + delta.cacheWrite;
136
+ row[8] = row[8] + delta.completion;
137
+ row[9] = row[9] + delta.cost;
138
+ row[10] = row[10] + delta.unpriced;
139
+ }
140
+ rows() {
141
+ return [...this.#rows.values()];
142
+ }
143
+ };
144
+ function parseTs(value) {
145
+ if (typeof value !== "string") return void 0;
146
+ const ms = Date.parse(value);
147
+ return Number.isFinite(ms) ? ms : void 0;
148
+ }
149
+ __name(parseTs, "parseTs");
150
+ var LogFolder = class {
151
+ constructor(models, baseOffset) {
152
+ this.models = models;
153
+ this.#settledSink = new RowSink(models);
154
+ this.#openSink = new RowSink(models);
155
+ this.#tailOffset = baseOffset;
156
+ }
157
+ models;
158
+ static {
159
+ __name(this, "LogFolder");
160
+ }
161
+ #settledSink;
162
+ #openSink;
163
+ #facts = {};
164
+ #turn;
165
+ /** Bytes of a line that has not ended yet, and where it starts. */
166
+ #tail = Buffer.alloc(0);
167
+ #tailOffset;
168
+ feed(chunk) {
169
+ const buffer = this.#tail.length === 0 ? chunk : Buffer.concat([this.#tail, chunk]);
170
+ let position = 0;
171
+ while (position < buffer.length) {
172
+ const newline = buffer.indexOf(10, position);
173
+ if (newline === -1) break;
174
+ this.#line(buffer.toString("utf8", position, newline), this.#tailOffset + position);
175
+ position = newline + 1;
176
+ }
177
+ this.#tail = Buffer.from(buffer.subarray(position));
178
+ this.#tailOffset += position;
179
+ }
180
+ #settle(settlement, ts) {
181
+ const current = this.#turn;
182
+ if (current === void 0) return;
183
+ this.#turn = void 0;
184
+ let end;
185
+ if (settlement !== void 0) {
186
+ end = cumulativeOf(settlement.usage, settlement.cost);
187
+ const tail = minus(end, current.previous);
188
+ if (!isZero(tail)) {
189
+ current.deltas.push({
190
+ ...tail,
191
+ slot: slotOf(current.lastTs > ts ? current.lastTs : ts),
192
+ // A turn with no snapshot at all is known only by its settlement,
193
+ // and its calls were the replies; "internal" is what the settlement
194
+ // holds beyond the snapshots the turn did write.
195
+ kind: current.deltas.length === 0 ? KIND_REPLY : KIND_INTERNAL,
196
+ model: current.model,
197
+ provider: current.provider
198
+ });
199
+ }
200
+ }
201
+ const served = typeof settlement?.servingProvider === "string" ? settlement.servingProvider : void 0;
202
+ for (const delta of current.deltas) {
203
+ const provider = delta.provider ?? (current.fellBack ? current.earlyProvider : served) ?? null;
204
+ this.#settledSink.add(delta, provider);
205
+ }
206
+ }
207
+ #line(line, lineStart) {
208
+ if (!INTERESTING.test(line)) return;
209
+ let record;
210
+ try {
211
+ record = JSON.parse(line);
212
+ } catch {
213
+ return;
214
+ }
215
+ const ts = parseTs(record.ts);
216
+ switch (record.type) {
217
+ case "session_started": {
218
+ const parent = record.parent;
219
+ if (parent !== void 0 && typeof parent.kind === "string")
220
+ this.#facts.parentKind = parent.kind;
221
+ else if (parent !== void 0) this.#facts.parentKind = "agent_spawn";
222
+ if (typeof record.cwd === "string") this.#facts.cwd = record.cwd;
223
+ const harness = record.harness;
224
+ if (harness !== void 0 && typeof harness.engineId === "string") {
225
+ this.#facts.engineId = harness.engineId;
226
+ }
227
+ break;
228
+ }
229
+ case "turn_started": {
230
+ const config = record.config;
231
+ this.#turn = {
232
+ startOffset: lineStart,
233
+ deltas: [],
234
+ previous: ZERO,
235
+ model: typeof config?.model === "string" ? config.model : "unknown",
236
+ provider: void 0,
237
+ earlyProvider: void 0,
238
+ fellBack: false,
239
+ lastTs: ts ?? 0
240
+ };
241
+ break;
242
+ }
243
+ case "request_envelope": {
244
+ if (this.#turn !== void 0 && typeof record.model === "string")
245
+ this.#turn.model = record.model;
246
+ break;
247
+ }
248
+ case "provider_fallback": {
249
+ const turn = this.#turn;
250
+ if (turn === void 0) break;
251
+ if (!turn.fellBack) {
252
+ turn.fellBack = true;
253
+ turn.earlyProvider = typeof record.fromProviderId === "string" ? record.fromProviderId : void 0;
254
+ }
255
+ if (typeof record.toProviderId === "string") turn.provider = record.toProviderId;
256
+ if (typeof record.toModel === "string") turn.model = record.toModel;
257
+ break;
258
+ }
259
+ case "token_usage_updated": {
260
+ const turn = this.#turn;
261
+ if (turn === void 0 || ts === void 0) break;
262
+ const now = cumulativeOf(record.usage, record.cost);
263
+ const step = minus(now, turn.previous);
264
+ turn.previous = now;
265
+ turn.lastTs = ts;
266
+ if (isZero(step)) break;
267
+ turn.deltas.push({
268
+ ...step,
269
+ slot: slotOf(ts),
270
+ kind: record.contextMeasuredBy === "estimate" ? KIND_COMPACTION : KIND_REPLY,
271
+ model: turn.model,
272
+ provider: turn.provider
273
+ });
274
+ break;
275
+ }
276
+ case "turn_completed":
277
+ case "turn_failed": {
278
+ const settlement = record.settlement;
279
+ this.#settle(settlement, ts ?? this.#turn?.lastTs ?? 0);
280
+ break;
281
+ }
282
+ }
283
+ }
284
+ finish() {
285
+ let from = this.#tailOffset;
286
+ const turn = this.#turn;
287
+ if (turn !== void 0) {
288
+ from = turn.startOffset;
289
+ const served = turn.fellBack ? turn.earlyProvider : void 0;
290
+ for (const delta of turn.deltas) this.#openSink.add(delta, delta.provider ?? served ?? null);
291
+ }
292
+ return {
293
+ settled: this.#settledSink.rows(),
294
+ open: this.#openSink.rows(),
295
+ from,
296
+ facts: this.#facts
297
+ };
298
+ }
299
+ };
300
+
301
+ // src/integrations/spend/ledger.ts
302
+ var SPEND_LEDGER_VERSION = 3;
303
+ var SPEND_LEDGER_FILE = "spend-ledger.json";
304
+ var UUID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
305
+ async function listDir(dir) {
306
+ try {
307
+ return await readdir(dir, { withFileTypes: true });
308
+ } catch {
309
+ return [];
310
+ }
311
+ }
312
+ __name(listDir, "listDir");
313
+ async function discoverProject(home, slug) {
314
+ const out = [];
315
+ const walk = /* @__PURE__ */ __name(async (dir, rel, nested) => {
316
+ const entries = await listDir(dir);
317
+ const dirs = [];
318
+ for (const entry of entries) {
319
+ if (entry.isFile() && entry.name.endsWith(".jsonl")) {
320
+ const id = entry.name.slice(0, -".jsonl".length);
321
+ if (UUID.test(id) || nested) out.push(`${rel}/${entry.name}`);
322
+ } else if (entry.isDirectory() && UUID.test(entry.name)) {
323
+ dirs.push(entry.name);
324
+ }
325
+ }
326
+ await mapLimit(dirs, 32, async (name) => {
327
+ await walk(join(dir, name, "subagents"), `${rel}/${name}/subagents`, true);
328
+ });
329
+ }, "walk");
330
+ await walk(join(home, "projects", slug), `projects/${slug}`, false);
331
+ return out;
332
+ }
333
+ __name(discoverProject, "discoverProject");
334
+ async function mapLimit(items, limit, run) {
335
+ let next = 0;
336
+ const workers = Array.from({ length: Math.min(limit, items.length) }, async () => {
337
+ while (next < items.length) {
338
+ const item = items[next++];
339
+ await run(item);
340
+ }
341
+ });
342
+ await Promise.all(workers);
343
+ }
344
+ __name(mapLimit, "mapLimit");
345
+ async function discoverLogs(home) {
346
+ const slugs = (await listDir(join(home, "projects"))).filter((e) => e.isDirectory());
347
+ const all = [];
348
+ await mapLimit(slugs, 8, async (slug) => {
349
+ all.push(...await discoverProject(home, slug.name));
350
+ });
351
+ return all.sort();
352
+ }
353
+ __name(discoverLogs, "discoverLogs");
354
+ async function loadLedger(home) {
355
+ let parsed;
356
+ try {
357
+ parsed = JSON.parse(await readFile(join(home, SPEND_LEDGER_FILE), "utf8"));
358
+ } catch {
359
+ return void 0;
360
+ }
361
+ if (parsed === null || typeof parsed !== "object" || parsed.version !== SPEND_LEDGER_VERSION || !Array.isArray(parsed.models) || typeof parsed.sessions !== "object" || parsed.sessions === null) {
362
+ return void 0;
363
+ }
364
+ const sessions = /* @__PURE__ */ new Map();
365
+ for (const [key, entry] of Object.entries(parsed.sessions)) {
366
+ if (!isLedgerSession(entry)) return void 0;
367
+ sessions.set(key, entry);
368
+ }
369
+ if (!parsed.models.every(
370
+ (m) => m !== null && typeof m === "object" && typeof m.model === "string"
371
+ )) {
372
+ return void 0;
373
+ }
374
+ return {
375
+ models: new ModelTable(parsed.models),
376
+ projects: new Map(Object.entries(parsed.projects ?? {})),
377
+ sessions
378
+ };
379
+ }
380
+ __name(loadLedger, "loadLedger");
381
+ var isRow = /* @__PURE__ */ __name((row) => Array.isArray(row) && row.length === 11 && row.every((n) => typeof n === "number" && Number.isFinite(n)), "isRow");
382
+ function isLedgerSession(entry) {
383
+ if (entry === null || typeof entry !== "object") return false;
384
+ const e = entry;
385
+ return typeof e.slug === "string" && typeof e.size === "number" && typeof e.mtimeMs === "number" && typeof e.from === "number" && Array.isArray(e.rows) && e.rows.every(isRow) && Array.isArray(e.open) && e.open.every(isRow);
386
+ }
387
+ __name(isLedgerSession, "isLedgerSession");
388
+ async function saveLedger(home, ledger) {
389
+ const file = {
390
+ version: SPEND_LEDGER_VERSION,
391
+ models: ledger.models.list,
392
+ projects: Object.fromEntries(ledger.projects),
393
+ sessions: Object.fromEntries(ledger.sessions)
394
+ };
395
+ const target = join(home, SPEND_LEDGER_FILE);
396
+ const temp = `${target}.${process.pid}.${randomUUID()}.tmp`;
397
+ try {
398
+ await writeFile(temp, JSON.stringify(file), { mode: 384 });
399
+ await rename(temp, target);
400
+ } catch (cause) {
401
+ await rm(temp, { force: true });
402
+ throw cause;
403
+ }
404
+ }
405
+ __name(saveLedger, "saveLedger");
406
+ var READ_CHUNK_BYTES = 1024 * 1024;
407
+ async function streamRange(path, from, to, folder, chunkBytes) {
408
+ const handle = await open(path, "r");
409
+ try {
410
+ const buffer = Buffer.allocUnsafe(Math.min(chunkBytes, Math.max(0, to - from)));
411
+ let position = from;
412
+ while (position < to) {
413
+ const { bytesRead } = await handle.read(
414
+ buffer,
415
+ 0,
416
+ Math.min(buffer.length, to - position),
417
+ position
418
+ );
419
+ if (bytesRead === 0) break;
420
+ folder.feed(buffer.subarray(0, bytesRead));
421
+ position += bytesRead;
422
+ }
423
+ return position - from;
424
+ } finally {
425
+ await handle.close();
426
+ }
427
+ }
428
+ __name(streamRange, "streamRange");
429
+ async function refreshLedger(options) {
430
+ const home = options.home;
431
+ const chunkBytes = Math.max(1, options.chunkBytes ?? READ_CHUNK_BYTES);
432
+ const loaded = await loadLedger(home);
433
+ const ledger = loaded ?? {
434
+ models: new ModelTable(),
435
+ projects: /* @__PURE__ */ new Map(),
436
+ sessions: /* @__PURE__ */ new Map()
437
+ };
438
+ const rebuilt = loaded === void 0;
439
+ const logs = await discoverLogs(home);
440
+ const present = new Set(logs);
441
+ let changed = rebuilt;
442
+ let read = 0;
443
+ let bytesRead = 0;
444
+ for (const key of [...ledger.sessions.keys()]) {
445
+ if (!present.has(key)) {
446
+ ledger.sessions.delete(key);
447
+ changed = true;
448
+ }
449
+ }
450
+ await mapLimit(logs, 32, async (key) => {
451
+ const path = join(home, key);
452
+ let info;
453
+ try {
454
+ info = await stat(path);
455
+ } catch {
456
+ return;
457
+ }
458
+ const slug = key.split("/")[1];
459
+ let entry = ledger.sessions.get(key);
460
+ if (entry !== void 0 && entry.size === info.size && entry.mtimeMs === info.mtimeMs) return;
461
+ if (entry === void 0 || info.size < entry.size) {
462
+ entry = { slug, size: 0, mtimeMs: 0, from: 0, rows: [], open: [] };
463
+ }
464
+ let result;
465
+ let size = 0;
466
+ try {
467
+ const folder = new LogFolder(ledger.models, entry.from);
468
+ size = await streamRange(path, entry.from, info.size, folder, chunkBytes);
469
+ result = folder.finish();
470
+ } catch {
471
+ return;
472
+ }
473
+ read += 1;
474
+ bytesRead += size;
475
+ const next = {
476
+ slug,
477
+ size: info.size,
478
+ mtimeMs: info.mtimeMs,
479
+ from: result.from,
480
+ rows: result.settled.length > 0 ? [...entry.rows, ...result.settled] : entry.rows,
481
+ open: result.open,
482
+ ...(result.facts.parentKind ?? entry.parentKind) !== void 0 ? { parentKind: result.facts.parentKind ?? entry.parentKind } : {},
483
+ ...(result.facts.engineId ?? entry.engineId) !== void 0 ? { engineId: result.facts.engineId ?? entry.engineId } : {}
484
+ };
485
+ ledger.sessions.set(key, next);
486
+ if (result.facts.cwd !== void 0 && !ledger.projects.has(slug)) {
487
+ ledger.projects.set(slug, result.facts.cwd);
488
+ }
489
+ changed = true;
490
+ });
491
+ let wrote = false;
492
+ if (changed && options.readOnly !== true) {
493
+ try {
494
+ await saveLedger(home, ledger);
495
+ wrote = true;
496
+ } catch {
497
+ }
498
+ }
499
+ return { ledger, stats: { logs: logs.length, read, bytesRead, wrote, rebuilt } };
500
+ }
501
+ __name(refreshLedger, "refreshLedger");
502
+
503
+ // src/integrations/spend/report.ts
504
+ var SPEND_REPORT_SCHEMA_VERSION = 1;
505
+ var TOP_CONVERSATIONS = 10;
506
+ var emptyTotals = /* @__PURE__ */ __name(() => ({
507
+ tokens: 0,
508
+ freshInputTokens: 0,
509
+ unsplitInputTokens: 0,
510
+ cacheReadTokens: 0,
511
+ cacheWriteTokens: 0,
512
+ outputTokens: 0,
513
+ estimatedCostUsd: 0,
514
+ unpricedTokens: 0
515
+ }), "emptyTotals");
516
+ function addRow(into, row) {
517
+ into.tokens += row[3];
518
+ into.freshInputTokens += row[4];
519
+ into.unsplitInputTokens += row[5];
520
+ into.cacheReadTokens += row[6];
521
+ into.cacheWriteTokens += row[7];
522
+ into.outputTokens += row[8];
523
+ into.estimatedCostUsd += row[9];
524
+ into.unpricedTokens += row[10];
525
+ }
526
+ __name(addRow, "addRow");
527
+ var UNMETERED = new Set(VENDOR_RATES.filter((v) => v.unmetered).map((v) => v.providerId));
528
+ function billingOf(provider) {
529
+ return provider !== null && UNMETERED.has(provider) ? "local" : "per-token";
530
+ }
531
+ __name(billingOf, "billingOf");
532
+ function conversationId(key) {
533
+ const name = key.slice(key.lastIndexOf("/") + 1);
534
+ return name.endsWith(".jsonl") ? name.slice(0, -".jsonl".length) : name;
535
+ }
536
+ __name(conversationId, "conversationId");
537
+ function rowsOf(session) {
538
+ return session.open.length === 0 ? session.rows : [...session.rows, ...session.open];
539
+ }
540
+ __name(rowsOf, "rowsOf");
541
+ function kindOf(session, row) {
542
+ if (session.parentKind !== void 0) return "subagents";
543
+ return row[1] === 1 ? "compaction" : row[1] === 2 ? "internal" : "replies";
544
+ }
545
+ __name(kindOf, "kindOf");
546
+ function slot(map, key) {
547
+ let totals = map.get(key);
548
+ if (totals === void 0) {
549
+ totals = emptyTotals();
550
+ map.set(key, totals);
551
+ }
552
+ return totals;
553
+ }
554
+ __name(slot, "slot");
555
+ function buildSpendReport(query) {
556
+ const days = Math.max(1, Math.min(MAX_SPEND_DAYS, Math.floor(query.days ?? DEFAULT_SPEND_DAYS)));
557
+ const { ledger, clock } = query;
558
+ const keyer = createDayKeyer(clock.timeZone);
559
+ const today = keyer(clock.nowMs());
560
+ const from = shiftDay(today, days - 1);
561
+ const total = emptyTotals();
562
+ const byDay = /* @__PURE__ */ new Map();
563
+ const byModel = /* @__PURE__ */ new Map();
564
+ const byProject = /* @__PURE__ */ new Map();
565
+ const byKind = /* @__PURE__ */ new Map();
566
+ const conversations = [];
567
+ const unpricedModelIds = /* @__PURE__ */ new Set();
568
+ let engineConversations = 0;
569
+ let unsplit = 0;
570
+ let ahead = 0;
571
+ for (const [key, session] of ledger.sessions) {
572
+ const mine = emptyTotals();
573
+ let touched = false;
574
+ for (const row of rowsOf(session)) {
575
+ const day = keyer(row[0] * SLOT_MS);
576
+ if (day < from) continue;
577
+ touched = true;
578
+ if (day > today) ahead += row[3];
579
+ addRow(total, row);
580
+ addRow(mine, row);
581
+ let dayEntry = byDay.get(day);
582
+ if (dayEntry === void 0) {
583
+ dayEntry = { totals: emptyTotals(), models: /* @__PURE__ */ new Map() };
584
+ byDay.set(day, dayEntry);
585
+ }
586
+ addRow(dayEntry.totals, row);
587
+ addRow(slot(dayEntry.models, row[2]), row);
588
+ addRow(slot(byModel, row[2]), row);
589
+ addRow(slot(byProject, session.slug), row);
590
+ addRow(slot(byKind, kindOf(session, row)), row);
591
+ if (row[10] > 0) unpricedModelIds.add(row[2]);
592
+ unsplit += row[5];
593
+ }
594
+ if (!touched) continue;
595
+ if (session.engineId !== void 0) engineConversations += 1;
596
+ conversations.push({
597
+ id: conversationId(key),
598
+ slug: session.slug,
599
+ subagent: session.parentKind ?? null,
600
+ ...mine
601
+ });
602
+ }
603
+ const modelRow = /* @__PURE__ */ __name((id, totals) => {
604
+ const key = ledger.models.list[id];
605
+ return {
606
+ provider: key.provider,
607
+ model: key.model,
608
+ billing: billingOf(key.provider),
609
+ priceKnown: totals.unpricedTokens === 0,
610
+ ...totals
611
+ };
612
+ }, "modelRow");
613
+ const byCostThenTokens = /* @__PURE__ */ __name((a, b, name) => b.estimatedCostUsd - a.estimatedCostUsd || b.tokens - a.tokens || (name(a) < name(b) ? -1 : name(a) > name(b) ? 1 : 0), "byCostThenTokens");
614
+ const modelName = /* @__PURE__ */ __name((row) => `${row.provider ?? ""}\0${row.model}`, "modelName");
615
+ const dayRows = [...byDay.entries()].sort(([a], [b]) => a < b ? -1 : a > b ? 1 : 0).map(([date, entry]) => ({
616
+ date,
617
+ ...entry.totals,
618
+ models: [...entry.models.entries()].map(([id, totals]) => modelRow(id, totals)).sort((a, b) => byCostThenTokens(a, b, modelName))
619
+ }));
620
+ const models = [...byModel.entries()].map(([id, totals]) => modelRow(id, totals)).sort((a, b) => byCostThenTokens(a, b, modelName));
621
+ const projects = [...byProject.entries()].map(([slug, totals]) => ({ slug, path: ledger.projects.get(slug) ?? null, ...totals })).sort((a, b) => byCostThenTokens(a, b, (row) => row.slug));
622
+ const kindOrder = ["replies", "subagents", "compaction", "internal"];
623
+ const kinds = kindOrder.filter((kind) => byKind.has(kind)).map((kind) => ({ kind, ...byKind.get(kind) }));
624
+ const unpricedModels = [...unpricedModelIds].map((id) => {
625
+ const key = ledger.models.list[id];
626
+ return key.provider === null ? key.model : `${key.model} (${key.provider})`;
627
+ });
628
+ const notes = [];
629
+ if (unsplit > 0) {
630
+ notes.push(
631
+ `${unsplit.toLocaleString("en-US")} input tokens ran on a route whose rate card is not in the catalogue, so the record cannot say how many of them were read from the cache. They are listed as unsplit input.`
632
+ );
633
+ }
634
+ if (ahead > 0) {
635
+ notes.push(
636
+ `${ahead.toLocaleString("en-US")} tokens are recorded on days after today by this machine's clock (a log written ahead of it). They are included.`
637
+ );
638
+ }
639
+ if (engineConversations > 0) {
640
+ notes.push(
641
+ `${engineConversations} conversation${engineConversations === 1 ? "" : "s"} ran through an outside engine. The record does not say how that engine bills, so its tokens count and its price is shown only where one is known.`
642
+ );
643
+ }
644
+ notes.push(
645
+ "The record marks compaction passes and the replies of sub-agents, so those are shown apart. It does not mark other internal calls: one made between two replies is counted with the next reply, and only what the turn settled beyond its last reply is shown as internal.",
646
+ "Which subscription or free quota paid for a call is not recorded, so none is claimed. A route is called local only when the catalogue says it bills nothing per token."
647
+ );
648
+ return {
649
+ schemaVersion: SPEND_REPORT_SCHEMA_VERSION,
650
+ kind: "spend",
651
+ estimate: true,
652
+ currency: "USD",
653
+ window: { days, from, to: today, timeZone: clock.timeZone },
654
+ totals: {
655
+ ...total,
656
+ partial: total.unpricedTokens > 0,
657
+ unpricedModels,
658
+ conversations: conversations.length
659
+ },
660
+ days: dayRows,
661
+ models,
662
+ projects,
663
+ kinds,
664
+ topConversations: conversations.sort((a, b) => byCostThenTokens(a, b, (row) => row.id)).slice(0, TOP_CONVERSATIONS),
665
+ notes
666
+ };
667
+ }
668
+ __name(buildSpendReport, "buildSpendReport");
669
+
670
+ // src/commands/cost.ts
671
+ var HELP = `namzu cost \u2014 spend across conversations on this machine, by day and model
672
+
673
+ Usage:
674
+ namzu cost [--days <n>] [--json]
675
+
676
+ Shows the last ${DEFAULT_SPEND_DAYS} local days by default: totals by day, model and project,
677
+ and by kind of work (your replies, sub-agents, compaction, other internal calls),
678
+ with cache reads and writes apart from fresh input.
679
+
680
+ Money is an estimate from list prices. A model with no known price shows its
681
+ tokens and "price not known", and the total then says it is partial.
682
+
683
+ --days <n> Days to cover, today included (1 to ${MAX_SPEND_DAYS}).
684
+ --json Print the report as JSON (schemaVersion 1) instead of text.
685
+
686
+ For the latest reply only, use /cost in the terminal.
687
+ `;
688
+ function parseCostArgs(args) {
689
+ let days = DEFAULT_SPEND_DAYS;
690
+ let json = false;
691
+ for (let i = 0; i < args.length; i += 1) {
692
+ const arg = args[i];
693
+ if (arg === "--json") {
694
+ json = true;
695
+ } else if (arg === "--days" || arg.startsWith("--days=")) {
696
+ let value;
697
+ if (arg === "--days") {
698
+ i += 1;
699
+ value = args[i];
700
+ } else {
701
+ value = arg.slice("--days=".length);
702
+ }
703
+ if (value === void 0 || !/^[1-9]\d{0,3}$/.test(value)) return void 0;
704
+ days = Number(value);
705
+ if (days > MAX_SPEND_DAYS) return void 0;
706
+ } else {
707
+ return void 0;
708
+ }
709
+ }
710
+ return { days, json };
711
+ }
712
+ __name(parseCostArgs, "parseCostArgs");
713
+ async function buildCostReport(days, deps) {
714
+ const { ledger } = await refreshLedger({ home: deps.home });
715
+ return buildSpendReport({ ledger, clock: deps.clock, days });
716
+ }
717
+ __name(buildCostReport, "buildCostReport");
718
+ var costCommand = {
719
+ name: "cost",
720
+ description: "Show spend across conversations by day and model, from the session logs",
721
+ passThrough: true,
722
+ help: HELP,
723
+ handler: /* @__PURE__ */ __name(async ({ ctx, rawArgs }) => {
724
+ const parsed = parseCostArgs(rawArgs);
725
+ if (parsed === void 0) {
726
+ ctx.formatter.error({ message: HELP });
727
+ return EXIT_USAGE;
728
+ }
729
+ try {
730
+ const report = await buildCostReport(parsed.days, {
731
+ home: resolveNamzuHome(),
732
+ clock: systemClock()
733
+ });
734
+ if (parsed.json) {
735
+ createFormatter("json", { quiet: false }).print(report);
736
+ } else if (ctx.formatter.name === "text") {
737
+ ctx.formatter.print({ text: renderSpend(report) });
738
+ } else {
739
+ ctx.formatter.print(report);
740
+ }
741
+ return EXIT_OK;
742
+ } catch (cause) {
743
+ ctx.formatter.error({
744
+ message: `Could not read the spend: ${cause instanceof Error ? cause.message : String(cause)}`
745
+ });
746
+ return EXIT_FAIL;
747
+ }
748
+ }, "handler")
749
+ };
750
+ export {
751
+ buildCostReport,
752
+ costCommand,
753
+ parseCostArgs
754
+ };
755
+ //# sourceMappingURL=cost-XLXGPE4O.js.map