@hydra-acp/budgeter 0.1.10 → 0.1.11
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.
- package/dist/index.js +2 -2
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -14,7 +14,7 @@ Options:
|
|
|
14
14
|
every session; <name> shows passive mirrors imported from
|
|
15
15
|
that host.
|
|
16
16
|
--min <N> Drop sessions whose active-metric value is <= N (default: 0)
|
|
17
|
-
--histogram Show an ASCII histogram bar next to each row (implies --bucket
|
|
17
|
+
--histogram Show an ASCII histogram bar next to each row (implies --bucket hour if no bucket given)
|
|
18
18
|
--metric <cost|tokens|loc> Display metric (default: cost). "loc" counts net lines of code
|
|
19
19
|
from Edit/Write tool diffs in session history.
|
|
20
20
|
--json Output as JSON
|
|
@@ -24,7 +24,7 @@ Run "hydra budgeter usage --help" for usage.`)}}if(o!==void 0&&o!=="cost"&&o!=="
|
|
|
24
24
|
Run "hydra budgeter usage --help" for usage.`);const a=o==="loc";if(i!==void 0&&!new Set(["dir","session","model","agent","filetype"]).has(i))throw new Error(`Invalid --by value: ${i}. Must be one of: dir, session, model, agent, filetype.
|
|
25
25
|
Run "hydra budgeter usage --help" for usage.`);if(i==="filetype"&&!a)throw new Error(`--by filetype requires --metric loc.
|
|
26
26
|
Run "hydra budgeter usage --help" for usage.`);let y;if(r!==void 0)try{y=V(r)}catch(e){const s=e;throw new Error(`Invalid --since value: ${s.message}
|
|
27
|
-
Run "hydra budgeter usage --help" for usage.`)}t.length===0&&(
|
|
27
|
+
Run "hydra budgeter usage --help" for usage.`)}t.length===0&&(c=!0),c&&n===void 0&&(n="hour");let d=y;if(d===void 0&&n!==void 0){const e=new Date;n==="hour"?(e.setHours(e.getHours()-24),d=e):n==="day"?(e.setDate(e.getDate()-30),d=e):n==="week"?(e.setMonth(e.getMonth()-6),d=e):n==="month"&&(e.setFullYear(e.getFullYear()-2),d=e)}const w=p?!0:void 0,m=o==="tokens",v=f!==void 0?parseFloat(f):void 0,b=await B()??j();(a||i==="filetype")&&await A(b);const E=q(b,{since:d,dir:l,interactive:w,min:v,minMetric:a?"loc":m?"tokens":"cost",host:h??"local"});let k;if(n!==void 0){const e=await _();e!==void 0&&(k=e.map(s=>({sessionId:s.sessionId,ts:s.ts,deltaCost:0,cumulativeCost:s.costCumulative,currency:s.costCurrency,inputTokens:s.contextTokens})))}let S;if(a&&n!==void 0){const e=[];for await(const s of J(E))e.push(s);S=e}const F=u!==void 0?parseInt(u,10):void 0,T=Y(E,k,{by:i,depth:F,bucket:n,since:d,interactive:w,dir:l,tokens:m,loc:a,min:v},S);if(g)process.stdout.write(Z(T)+`
|
|
28
28
|
`);else{const e=K(T,{histogram:c,tokens:m,loc:a});process.stdout.write(e)}}async function X(){const t=N();W(t.debug);const r=I(),n=new x({daemonWsUrl:t.hydraWsUrl,token:t.hydraToken,softLimit:t.softLimit,hardLimit:t.hardLimit,currency:t.currency,rule:M,statePath:r});n.start();const i=u=>{D.info(`${u} received \u2014 shutting down`),n.stop(),setTimeout(()=>process.exit(0),200).unref()};process.on("SIGINT",()=>i("SIGINT")),process.on("SIGTERM",()=>i("SIGTERM")),D.info(`hydra-acp-budgeter up; daemon=${t.hydraDaemonUrl} soft=${t.softLimit} hard=${t.hardLimit} ${t.currency} state=${r}`)}function ee(){process.stdout.write(`hydra-acp-budgeter ${O()}
|
|
29
29
|
|
|
30
30
|
Usage:
|
package/package.json
CHANGED