@hasna/statusline 0.0.6 → 0.0.8

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.
@@ -0,0 +1,19 @@
1
+ /** The cumulative token usage Codex reports on its `token_count` events. */
2
+ export interface TotalTokenUsage {
3
+ input_tokens?: number;
4
+ cached_input_tokens?: number;
5
+ cache_write_input_tokens?: number;
6
+ }
7
+ /**
8
+ * Newest `rollout-*.jsonl` under `~/.codex/sessions/YYYY/MM/DD/` — the
9
+ * session with the latest activity, by file mtime. Null when nothing exists
10
+ * or the tree cannot be read (statusline degrade rule: never throw).
11
+ */
12
+ export declare function latestCodexSessionPath(home?: string): string | null;
13
+ /**
14
+ * Cache-hit fraction of the newest Codex session: the LAST `event_msg` whose
15
+ * payload is a `token_count`, whose `payload.info.total_token_usage` holds
16
+ * cumulative session totals. Clamped to [0, 1]; null when the file is
17
+ * missing or unreadable, no token_count event exists, or the divisor is 0.
18
+ */
19
+ export declare function codexCacheRate(sessionPath?: string): number | null;
@@ -0,0 +1,16 @@
1
+ export interface OpenCodeCacheRateOptions {
2
+ /** Path to the OpenCode sessions DB (default `~/.local/share/opencode/opencode.db`). */
3
+ dbPath?: string;
4
+ /** A specific session id; omitted = the newest session with usage. */
5
+ sessionId?: string;
6
+ }
7
+ /**
8
+ * Cache-hit fraction from the OpenCode sessions DB: the newest session row's
9
+ * `tokens_cache_read` over the input side (input + cache read + cache write).
10
+ * Read-only `Bun.sqlite` (runtime-available in the bun-target CLI build; no
11
+ * new dependency). Never throws — any open/query failure, a missing file, or
12
+ * a zero divisor degrades to null. When the `session` table has no row with
13
+ * token data (older layouts, or an in-flight session whose usage is not
14
+ * written yet), `session_v2` is tried — both schemas carry the columns.
15
+ */
16
+ export declare function opencodeCacheRate(opts?: OpenCodeCacheRateOptions): number | null;
@@ -1,5 +1,5 @@
1
1
  export interface StatusContext {
2
- provider: "claude";
2
+ provider: "claude" | "codex" | "opencode";
3
3
  cwd: string;
4
4
  projectDir?: string;
5
5
  model?: {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@hasna/statusline",
3
- "version": "0.0.6",
4
- "description": "Tiny composable statusline CLI for AI coding agents \u2014 pre-built toggleable segments for Claude Code, with a provider model for others",
3
+ "version": "0.0.8",
4
+ "description": "Tiny composable statusline CLI for AI coding agents — pre-built toggleable segments for Claude Code, with a provider model for others",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
7
7
  "main": "./dist/index.js",
@@ -39,11 +39,12 @@
39
39
  },
40
40
  "repository": {
41
41
  "type": "git",
42
- "url": "git+https://github.com/hasna/statusline.git"
42
+ "url": "https://github.com/hasna/apps.git",
43
+ "directory": "apps/statusline"
43
44
  },
44
- "homepage": "https://github.com/hasna/statusline#readme",
45
+ "homepage": "https://github.com/hasna/apps/tree/main/apps/statusline#readme",
45
46
  "bugs": {
46
- "url": "https://github.com/hasna/statusline/issues"
47
+ "url": "https://github.com/hasna/apps/issues"
47
48
  },
48
49
  "keywords": [
49
50
  "statusline",
@@ -60,11 +61,12 @@
60
61
  "bun": ">=1.0.0"
61
62
  },
62
63
  "dependencies": {
63
- "@modelcontextprotocol/sdk": "1.12.1",
64
+ "@modelcontextprotocol/sdk": "^1.26.0",
64
65
  "zod": "3.25.76"
65
66
  },
66
67
  "devDependencies": {
67
- "@types/bun": "^1.2.4",
68
- "typescript": "5.9.3"
68
+ "@types/bun": "1.3.14",
69
+ "typescript": "5.9.3",
70
+ "bun-types": "1.3.14"
69
71
  }
70
72
  }