@tokz/cli 0.2.21 → 0.2.23

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.
@@ -20,7 +20,7 @@ import {
20
20
  sanitizeProjectPath,
21
21
  shortModel,
22
22
  usd
23
- } from "./chunk-T5J7LVH6.js";
23
+ } from "./chunk-YVDSYDGL.js";
24
24
 
25
25
  // src/ui/Root.tsx
26
26
  import { useEffect as useEffect2, useState as useState6 } from "react";
@@ -2775,7 +2775,7 @@ function HelpOverlay() {
2775
2775
  // src/ui/App.tsx
2776
2776
  import { Fragment, jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
2777
2777
  var HINTS = {
2778
- agents: "\u2191\u2193 navigate \xB7 \u23CE select \xB7 ? help \xB7 q quit",
2778
+ agents: "\u2191\u2193 navigate \xB7 \u23CE select \xB7 t timeframe \xB7 ? help \xB7 q quit",
2779
2779
  menu: "\u2191\u2193 navigate \xB7 \u23CE select \xB7 esc agents \xB7 ? help \xB7 q quit",
2780
2780
  list: "\u2191\u2193 move \xB7 \u23CE open \xB7 / filter \xB7 s sort \xB7 a all \xB7 esc back \xB7 ? help \xB7 q quit",
2781
2781
  project: "1\u20136 \u2190\u2192 tabs \xB7 esc back \xB7 ? help \xB7 q quit",
@@ -2832,10 +2832,14 @@ function App({
2832
2832
  const [help, setHelp] = useState5(false);
2833
2833
  const [filterCapture, setFilterCapture] = useState5(false);
2834
2834
  const [timeframe, setTimeframe] = useState5("30d");
2835
- const scoped = useMemo2(
2836
- () => applyTimeframe(activeProjects, timeframeRange(timeframe)),
2837
- [activeProjects, timeframe]
2838
- );
2835
+ const scopedAgentList = useMemo2(() => {
2836
+ const tf = timeframeRange(timeframe);
2837
+ return agentList.map((a) => ({
2838
+ ...a,
2839
+ projects: applyTimeframe(a.projects, tf)
2840
+ }));
2841
+ }, [agentList, timeframe]);
2842
+ const scoped = scopedAgentList[agentIdx]?.projects ?? [];
2839
2843
  const totals = useMemo2(() => aggregate(scoped), [scoped]);
2840
2844
  const activeAdapter = agentList[agentIdx]?.adapter;
2841
2845
  const agentName = activeAdapter ? activeAdapter.name + (activeAdapter.estimated ? " (estimated)" : "") : "";
@@ -2847,7 +2851,7 @@ function App({
2847
2851
  if (filterCapture) return;
2848
2852
  if (input === "q") exit();
2849
2853
  if (input === "?") setHelp(true);
2850
- if (input === "t" && view !== "agents") setTimeframe((tf) => nextTimeframe(tf));
2854
+ if (input === "t") setTimeframe((tf) => nextTimeframe(tf));
2851
2855
  if (key.escape) {
2852
2856
  if (view === "project") setView("list");
2853
2857
  else if (view === "aggregate") setView(aggFrom);
@@ -2865,7 +2869,7 @@ function App({
2865
2869
  content = /* @__PURE__ */ jsx10(
2866
2870
  AgentPicker,
2867
2871
  {
2868
- agents: agentList,
2872
+ agents: scopedAgentList,
2869
2873
  onSelect: (i) => {
2870
2874
  setAgentIdx(i);
2871
2875
  setSelected(void 0);
@@ -6,7 +6,7 @@ import {
6
6
  emptyUsage,
7
7
  shortModel,
8
8
  usd
9
- } from "./chunk-T5J7LVH6.js";
9
+ } from "./chunk-YVDSYDGL.js";
10
10
 
11
11
  // src/blocks.ts
12
12
  var BLOCK_LENGTH_MS = 5 * 60 * 60 * 1e3;
@@ -81,7 +81,7 @@ function costUsd(usage, modelId) {
81
81
  cacheRead += usage.longContextCacheReadTokens / 1e6 * (p.inputPerMTok * 2) * readMult;
82
82
  }
83
83
  if (usage.longContextOutputTokens) {
84
- output += usage.longContextOutputTokens / 1e6 * (p.outputPerMTok * 2);
84
+ output += usage.longContextOutputTokens / 1e6 * (p.outputPerMTok * 1.5);
85
85
  }
86
86
  const write1h = Math.min(usage.cacheCreation1hTokens ?? 0, usage.cacheCreationTokens);
87
87
  const write5m = usage.cacheCreationTokens - write1h;
@@ -99,6 +99,9 @@ function addUsage(acc, u) {
99
99
  acc.cacheCreation1hTokens = (acc.cacheCreation1hTokens ?? 0) + (u.cacheCreation1hTokens ?? 0);
100
100
  acc.outputTokens += u.outputTokens;
101
101
  acc.turns += u.turns;
102
+ acc.longContextInputTokens = (acc.longContextInputTokens ?? 0) + (u.longContextInputTokens ?? 0);
103
+ acc.longContextCacheReadTokens = (acc.longContextCacheReadTokens ?? 0) + (u.longContextCacheReadTokens ?? 0);
104
+ acc.longContextOutputTokens = (acc.longContextOutputTokens ?? 0) + (u.longContextOutputTokens ?? 0);
102
105
  }
103
106
  function cacheSavings(usageByModel) {
104
107
  let saved = 0;
package/dist/cli.js CHANGED
@@ -2,7 +2,7 @@
2
2
  import {
3
3
  buildBlocks,
4
4
  renderBlocksReport
5
- } from "./chunk-VXWHRHQU.js";
5
+ } from "./chunk-Q5AEDWTI.js";
6
6
  import {
7
7
  findMcpServers
8
8
  } from "./chunk-65BQE6TI.js";
@@ -17,7 +17,7 @@ import {
17
17
  setTimezone,
18
18
  tok,
19
19
  usd
20
- } from "./chunk-T5J7LVH6.js";
20
+ } from "./chunk-YVDSYDGL.js";
21
21
 
22
22
  // src/cli.ts
23
23
  import { createRequire } from "module";
@@ -234,7 +234,7 @@ program.command("blocks").description("Claude usage grouped into rolling 5-hour
234
234
  });
235
235
  program.command("statusline").description("compact usage line for Claude Code's statusLine hook (reads hook JSON on stdin)").argument("[action]", '"enable" writes the hook into ~/.claude/settings.json, "disable" removes it').option("--cost-source <mode>", "session cost source: auto | cc | calc | both", "auto").action(async (action, opts) => {
236
236
  const globals = applyGlobals();
237
- const sl = await import("./statusline-4UN2Q6BT.js");
237
+ const sl = await import("./statusline-ES3W3TEU.js");
238
238
  if (action === "enable" || action === "disable") {
239
239
  try {
240
240
  console.log(action === "enable" ? await sl.enableStatusline() : await sl.disableStatusline());
@@ -276,7 +276,7 @@ program.action(async () => {
276
276
  const [{ render }, React, { Root }, { Fullscreen }] = await Promise.all([
277
277
  import("ink"),
278
278
  import("react"),
279
- import("./Root-D7W7HP7D.js"),
279
+ import("./Root-UTHGAOXG.js"),
280
280
  import("./Fullscreen-GK2ZYXHV.js")
281
281
  ]);
282
282
  render(React.createElement(Fullscreen, null, React.createElement(Root)));
@@ -3,7 +3,7 @@ import {
3
3
  buildBlocks,
4
4
  burnRate,
5
5
  fmtMs
6
- } from "./chunk-VXWHRHQU.js";
6
+ } from "./chunk-Q5AEDWTI.js";
7
7
  import {
8
8
  compact,
9
9
  costUsd,
@@ -12,7 +12,7 @@ import {
12
12
  parseTranscript,
13
13
  shortModel,
14
14
  usd
15
- } from "./chunk-T5J7LVH6.js";
15
+ } from "./chunk-YVDSYDGL.js";
16
16
 
17
17
  // src/statusline.ts
18
18
  import { mkdir, readFile, stat, writeFile } from "fs/promises";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tokz/cli",
3
- "version": "0.2.21",
3
+ "version": "0.2.23",
4
4
  "description": "See where your coding agents' tokens and dollars actually go.",
5
5
  "keywords": [
6
6
  "claude",