@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.
- package/README.md +86 -29
- package/dist/accounts.d.ts +24 -0
- package/dist/cli.js +421 -51
- package/dist/context-window.d.ts +22 -0
- package/dist/index.d.ts +3 -1
- package/dist/index.js +427 -52
- package/dist/mcp/index.js +19802 -6343
- package/dist/providers/codex.d.ts +19 -0
- package/dist/providers/opencode.d.ts +16 -0
- package/dist/providers/types.d.ts +1 -1
- package/package.json +10 -8
package/dist/context-window.d.ts
CHANGED
|
@@ -7,8 +7,30 @@ export interface ContextUsage {
|
|
|
7
7
|
/** Context window size in tokens. */
|
|
8
8
|
window: number;
|
|
9
9
|
}
|
|
10
|
+
/** The raw `message.usage` object of the last assistant entry that carries one. */
|
|
11
|
+
export interface UsageBlock {
|
|
12
|
+
input_tokens: number;
|
|
13
|
+
cache_creation_input_tokens?: number;
|
|
14
|
+
cache_read_input_tokens?: number;
|
|
15
|
+
output_tokens?: number;
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Scan the session transcript (JSONL) from the end and return the raw usage
|
|
19
|
+
* block of the last assistant entry that carries one — the block that
|
|
20
|
+
* reflects what the context window currently holds. Lines that are malformed
|
|
21
|
+
* or whose usage block lacks a numeric `input_tokens` are skipped, exactly
|
|
22
|
+
* like `contextUsage` used to skip them inline.
|
|
23
|
+
*/
|
|
24
|
+
export declare function lastUsageBlock(ctx: StatusContext): UsageBlock | null;
|
|
10
25
|
/**
|
|
11
26
|
* Derive context usage from the session transcript (JSONL). The last
|
|
12
27
|
* assistant entry's usage block reflects what the context window holds.
|
|
13
28
|
*/
|
|
14
29
|
export declare function contextUsage(ctx: StatusContext): ContextUsage | null;
|
|
30
|
+
/**
|
|
31
|
+
* Fraction of input-side tokens served from cache, dispatched on the
|
|
32
|
+
* context's provider: the Claude transcript usage block, the Codex session
|
|
33
|
+
* rollout's latest token_count, or the OpenCode sessions DB. Null when the
|
|
34
|
+
* source is absent or the divisor is zero — never a wrong number.
|
|
35
|
+
*/
|
|
36
|
+
export declare function cacheRate(ctx: StatusContext): number | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { type StatuslineConfig } from "./config.js";
|
|
2
2
|
export { sessionAccount, sessionAccountEmail, sessionConfigDir, sessionStateFile, type SessionAccount, } from "./accounts.js";
|
|
3
3
|
export { defaultConfig, loadConfig, saveConfig, configPath, type StatuslineConfig } from "./config.js";
|
|
4
|
-
export { contextUsage, type ContextUsage } from "./context-window.js";
|
|
4
|
+
export { cacheRate, contextUsage, lastUsageBlock, type ContextUsage, type UsageBlock } from "./context-window.js";
|
|
5
5
|
export { compactAge, compactDuration, compactNum, money } from "./format.js";
|
|
6
6
|
export { gitBranch, gitProjectName, gitRoot, lastCommitEpoch, trackedLineCount } from "./git.js";
|
|
7
7
|
export { claudeSettingsPath, installClaude } from "./install.js";
|
|
8
|
+
export { codexCacheRate, latestCodexSessionPath, type TotalTokenUsage } from "./providers/codex.js";
|
|
9
|
+
export { opencodeCacheRate, type OpenCodeCacheRateOptions } from "./providers/opencode.js";
|
|
8
10
|
export { parseClaudeInput } from "./providers/claude.js";
|
|
9
11
|
export type { Segment, SegmentColor, StatusContext } from "./providers/types.js";
|
|
10
12
|
export { renderLine } from "./render.js";
|