@mbeato/contextscope 0.2.0 → 0.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 (72) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/build-manifest.json +3 -3
  3. package/.next/standalone/.next/server/app/_global-error/page.js +1 -1
  4. package/.next/standalone/.next/server/app/_global-error/page.js.nft.json +1 -1
  5. package/.next/standalone/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  6. package/.next/standalone/.next/server/app/_global-error.html +1 -1
  7. package/.next/standalone/.next/server/app/_global-error.rsc +1 -1
  8. package/.next/standalone/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  9. package/.next/standalone/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  10. package/.next/standalone/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  11. package/.next/standalone/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  12. package/.next/standalone/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  14. package/.next/standalone/.next/server/app/_not-found/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  17. package/.next/standalone/.next/server/app/_not-found.rsc +3 -3
  18. package/.next/standalone/.next/server/app/_not-found.segments/_full.segment.rsc +3 -3
  19. package/.next/standalone/.next/server/app/_not-found.segments/_head.segment.rsc +1 -1
  20. package/.next/standalone/.next/server/app/_not-found.segments/_index.segment.rsc +2 -2
  21. package/.next/standalone/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +1 -1
  22. package/.next/standalone/.next/server/app/_not-found.segments/_not-found.segment.rsc +1 -1
  23. package/.next/standalone/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  24. package/.next/standalone/.next/server/app/context/page.js +1 -1
  25. package/.next/standalone/.next/server/app/context/page.js.nft.json +1 -1
  26. package/.next/standalone/.next/server/app/context/page_client-reference-manifest.js +1 -1
  27. package/.next/standalone/.next/server/app/items/page.js +5 -4
  28. package/.next/standalone/.next/server/app/items/page.js.nft.json +1 -1
  29. package/.next/standalone/.next/server/app/items/page_client-reference-manifest.js +1 -1
  30. package/.next/standalone/.next/server/app/page.js +3 -3
  31. package/.next/standalone/.next/server/app/page.js.nft.json +1 -1
  32. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  33. package/.next/standalone/.next/server/app/sessions/page.js +4 -4
  34. package/.next/standalone/.next/server/app/sessions/page.js.nft.json +1 -1
  35. package/.next/standalone/.next/server/app/sessions/page_client-reference-manifest.js +1 -1
  36. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__03arzl5._.js +3 -0
  37. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__07faxtq._.js +3 -0
  38. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0kqilnd._.js +3 -0
  39. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0lri6iu._.js +3 -0
  40. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0vgyaoz._.js +3 -0
  41. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0xi7j~6._.js +3 -0
  42. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__120ysu3._.js +3 -0
  43. package/.next/standalone/.next/server/chunks/ssr/{[root-of-the-server]__0vvlth5._.js → [root-of-the-server]__13joim.._.js} +2 -2
  44. package/.next/standalone/.next/server/chunks/ssr/app_components_RangeToggle_tsx_0ju_23s._.js +3 -0
  45. package/.next/standalone/.next/server/chunks/ssr/app_page_tsx_0fwe3kl._.js +1 -1
  46. package/.next/standalone/.next/server/chunks/ssr/{_0yajrcg._.js → node_modules_next_0w2y7fz._.js} +2 -2
  47. package/.next/standalone/.next/server/middleware-build-manifest.js +3 -3
  48. package/.next/standalone/.next/server/pages/404.html +1 -1
  49. package/.next/standalone/.next/server/pages/500.html +1 -1
  50. package/.next/standalone/app/components/RangeToggle.tsx +46 -0
  51. package/.next/standalone/app/items/page.tsx +14 -5
  52. package/.next/standalone/app/page.tsx +21 -17
  53. package/.next/standalone/app/sessions/page.tsx +10 -6
  54. package/.next/standalone/lib/model-prices.json +8 -1
  55. package/.next/standalone/lib/range.ts +14 -0
  56. package/.next/standalone/package.json +1 -1
  57. package/.next/standalone/tsconfig.tsbuildinfo +1 -1
  58. package/.next/static/chunks/07x8pd.nd96z3.js +1 -0
  59. package/.next/static/chunks/0p9gmsrksfcbl.css +1 -0
  60. package/lib/model-prices.json +8 -1
  61. package/package.json +1 -1
  62. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__08l_yt3._.js +0 -3
  63. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__09hgk-7._.js +0 -3
  64. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0j40w4k._.js +0 -3
  65. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0p2sxww._.js +0 -3
  66. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0q3rzj9._.js +0 -3
  67. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0wj0exw._.js +0 -3
  68. package/.next/standalone/.next/server/chunks/ssr/[root-of-the-server]__0x3h1uu._.js +0 -3
  69. package/.next/static/chunks/0pb14~6.l8.f9.css +0 -1
  70. /package/.next/static/{JpNIY4MdsJTSd7Guhgw3Z → st94RnE_4fLMSmCKDOk0S}/_buildManifest.js +0 -0
  71. /package/.next/static/{JpNIY4MdsJTSd7Guhgw3Z → st94RnE_4fLMSmCKDOk0S}/_clientMiddlewareManifest.js +0 -0
  72. /package/.next/static/{JpNIY4MdsJTSd7Guhgw3Z → st94RnE_4fLMSmCKDOk0S}/_ssgManifest.js +0 -0
@@ -2,9 +2,10 @@ import { homedir } from "node:os";
2
2
  import { getSessions, summarizeSessions } from "@/lib/sessions";
3
3
  import { formatUsd } from "@/lib/pricing";
4
4
  import { Receipt, Stat } from "../components/Receipt";
5
+ import { RangeToggle } from "../components/RangeToggle";
6
+ import { parseDays } from "@/lib/range";
5
7
 
6
8
  const fmt = new Intl.NumberFormat("en-US");
7
- const DAYS = 30;
8
9
  const HOME = homedir();
9
10
 
10
11
  function tildify(p: string): string {
@@ -20,7 +21,12 @@ function shortNumber(n: number): string {
20
21
  return String(n);
21
22
  }
22
23
 
23
- export default async function SessionsPage() {
24
+ export default async function SessionsPage({
25
+ searchParams,
26
+ }: {
27
+ searchParams: Promise<{ days?: string }>;
28
+ }) {
29
+ const DAYS = parseDays((await searchParams).days);
24
30
  const sessions = await getSessions(DAYS);
25
31
  const s = summarizeSessions(sessions);
26
32
  const maxDayTokens = Math.max(1, ...s.dailyBurn.map((d) => d.tokens));
@@ -38,9 +44,7 @@ export default async function SessionsPage() {
38
44
  ~/.claude/projects · {DAYS}-day window
39
45
  </p>
40
46
  </div>
41
- <span className="text-[10px] uppercase tracking-widest text-zinc-500">
42
- {DAYS}-day window
43
- </span>
47
+ <RangeToggle />
44
48
  </header>
45
49
 
46
50
  {s.count === 0 ? (
@@ -57,7 +61,7 @@ export default async function SessionsPage() {
57
61
  <Stat label="sessions" value={fmt.format(s.count)} hint={`avg ${shortNumber(s.averageSessionTokens)}`} />
58
62
  </Receipt>
59
63
  <Receipt pad="default">
60
- <Stat label="30d total" value={shortNumber(s.totalTokens)} hint={`${formatUsd(s.totalCostUsd)} api`} />
64
+ <Stat label={`${DAYS}d total`} value={shortNumber(s.totalTokens)} hint={`${formatUsd(s.totalCostUsd)} api`} />
61
65
  </Receipt>
62
66
  <Receipt pad="default">
63
67
  <Stat label="median" value={shortNumber(s.medianSessionTokens)} hint="per session" />
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "_source": "https://raw.githubusercontent.com/BerriAI/litellm/main/model_prices_and_context_window.json",
3
- "_refreshedAt": "2026-05-27T17:24:45.345Z",
3
+ "_refreshedAt": "2026-05-30T19:17:56.836Z",
4
4
  "_description": "Anthropic model prices in USD per token (input, output, cache_read, cache_creation 5min default). Refresh with `npm run refresh-prices`.",
5
5
  "models": {
6
6
  "claude-3-7-sonnet-20250219": {
@@ -115,6 +115,13 @@
115
115
  "cache_creation_5m": 0.00000625,
116
116
  "cache_creation_1h": 0.00001
117
117
  },
118
+ "claude-opus-4-8": {
119
+ "input": 0.000005,
120
+ "output": 0.000025,
121
+ "cache_read": 5e-7,
122
+ "cache_creation_5m": 0.00000625,
123
+ "cache_creation_1h": 0.00001
124
+ },
118
125
  "claude-sonnet-4-20250514": {
119
126
  "input": 0.000003,
120
127
  "output": 0.000015,
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Time-range window shared by the dashboard pages and the <RangeToggle> chips.
3
+ * The data layer (getSessions/getUsage/getAllTranscripts) honors any daysBack,
4
+ * but the UI only exposes these fixed windows — parseDays clamps to them so a
5
+ * hand-edited ?days= can't trigger an unbounded transcript scan.
6
+ */
7
+ export const RANGES = [7, 30, 90] as const;
8
+ export const DEFAULT_DAYS = 30;
9
+
10
+ export function parseDays(raw?: string | string[]): number {
11
+ const v = Array.isArray(raw) ? raw[0] : raw;
12
+ const n = Number(v);
13
+ return (RANGES as readonly number[]).includes(n) ? n : DEFAULT_DAYS;
14
+ }
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mbeato/contextscope",
3
- "version": "0.2.0",
3
+ "version": "0.3.0",
4
4
  "description": "Local dashboard auditing Claude Code's per-turn token context (skills, agents, commands, CLAUDE.md, MEMORY.md, hooks, MCP) with toggle-based disable and session analytics.",
5
5
  "type": "module",
6
6
  "bin": {