#!/usr/bin/env node
import {a}from'./chunk-FYDRENK7.js';import {d,c}from'./chunk-EKZDFEJW.js';import'./chunk-XHJ27CER.js';import*as y from'path';import o from'chalk';async function p(g,n){let m=g?y.resolve(g):process.cwd(),s,a$1;if(n.days){let l=parseInt(n.days);s=new Date,s.setDate(s.getDate()-l);}n.from&&(s=new Date(n.from)),n.to&&(a$1=new Date(n.to));let e=new a(m).getCostSummary(s,a$1);if(n.json){console.log(JSON.stringify(e,null,2));return}if(console.log(),console.log(o.blue("\u2501".repeat(50))),console.log(o.blue("  Orchestration Cost Summary")),console.log(o.blue("\u2501".repeat(50))),console.log(),s||a$1){let l=s?s.toISOString().slice(0,10):"beginning",t=a$1?a$1.toISOString().slice(0,10):"now";console.log(o.gray(`  Period: ${l} to ${t}`)),console.log();}if(console.log(o.cyan("  Totals:")),console.log(o.white(`    Orchestrations: ${e.orchestrationCount}`)),console.log(o.white(`    Total tokens: ${d(e.totalTokens)}`)),console.log(o.white(`    Total cost: ${c(e.totalCost)}`)),console.log(),Object.keys(e.byModel).length>0){console.log(o.cyan("  By Model:"));for(let[l,t]of Object.entries(e.byModel)){let c$1=(t.cost/e.totalCost*100).toFixed(1);console.log(o.gray(`    ${l.padEnd(8)} ${c(t.cost).padStart(10)} (${c$1}%) - ${t.count} calls`));}console.log();}if(Object.keys(e.byAgent).length>0&&n.detailed){console.log(o.cyan("  By Agent:"));for(let[l,t]of Object.entries(e.byAgent)){let c$1=(t.cost/e.totalCost*100).toFixed(1);console.log(o.gray(`    ${l.padEnd(12)} ${c(t.cost).padStart(10)} (${c$1}%) - ${t.count} calls`));}console.log();}if(e.byDay.length>0&&n.detailed){console.log(o.cyan("  By Day (recent):"));let l=e.byDay.slice(-7);for(let t of l){let c$1="\u2588".repeat(Math.ceil(t.cost/e.totalCost*20));console.log(o.gray(`    ${t.date} ${c(t.cost).padStart(10)} ${o.blue(c$1)}`));}console.log();}n.detailed&&(console.log(o.cyan("  Model Pricing Reference:")),console.log(o.gray("    opus:   $15.00 / $75.00 per 1M tokens (in/out)")),console.log(o.gray("    sonnet: $3.00 / $15.00 per 1M tokens (in/out)")),console.log(o.gray("    haiku:  $0.25 / $1.25 per 1M tokens (in/out)")),console.log()),e.totalCost>1&&(console.log(o.yellow("  Tips to reduce costs:")),console.log(o.gray("    - Use haiku for builder/tester agents")),console.log(o.gray('    - Set budget limits: --budget "cost=5"')),console.log(o.gray('    - Compare modes: paradigm team orchestrate "..." --compare')),console.log());}export{p as teamCostCommand};