rinco-pi-hud 1.0.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 (45) hide show
  1. package/LICENSE +21 -0
  2. package/NOTICE +18 -0
  3. package/README.md +204 -0
  4. package/docs/CONTRIBUTING.md +110 -0
  5. package/docs/README.zh-CN.md +204 -0
  6. package/docs/footer.md +139 -0
  7. package/extensions/hud/commands/settings.ts +765 -0
  8. package/extensions/hud/config/config-counts.ts +87 -0
  9. package/extensions/hud/config/config.ts +65 -0
  10. package/extensions/hud/config/file-io.ts +128 -0
  11. package/extensions/hud/config/normalize.ts +374 -0
  12. package/extensions/hud/config/persist.ts +277 -0
  13. package/extensions/hud/config/schema.ts +303 -0
  14. package/extensions/hud/footer/format.ts +279 -0
  15. package/extensions/hud/footer/index.ts +543 -0
  16. package/extensions/hud/footer/layout.ts +183 -0
  17. package/extensions/hud/footer/render-labels.ts +305 -0
  18. package/extensions/hud/index.ts +466 -0
  19. package/extensions/hud/segments/extension-status.ts +88 -0
  20. package/extensions/hud/segments/git.ts +384 -0
  21. package/extensions/hud/segments/mcp-status.ts +25 -0
  22. package/extensions/hud/segments/package-version.ts +651 -0
  23. package/extensions/hud/segments/project-state.ts +67 -0
  24. package/extensions/hud/segments/runtime-definitions.ts +695 -0
  25. package/extensions/hud/segments/runtime.ts +167 -0
  26. package/extensions/hud/segments/skill-activity.ts +152 -0
  27. package/extensions/hud/session/context.ts +19 -0
  28. package/extensions/hud/session/lifecycle.ts +60 -0
  29. package/extensions/hud/session/live-context.ts +75 -0
  30. package/extensions/hud/state/index.ts +67 -0
  31. package/extensions/hud/state/project-refresh.ts +104 -0
  32. package/extensions/hud/state/telemetry.ts +261 -0
  33. package/extensions/hud/telemetry/codex-usage/LICENSE +21 -0
  34. package/extensions/hud/telemetry/codex-usage/app-server-client.ts +231 -0
  35. package/extensions/hud/telemetry/codex-usage/format.ts +278 -0
  36. package/extensions/hud/telemetry/codex-usage/index.ts +462 -0
  37. package/extensions/hud/telemetry/codex-usage/normalize.ts +264 -0
  38. package/extensions/hud/telemetry/codex-usage/query.ts +207 -0
  39. package/extensions/hud/telemetry/codex-usage/safety.ts +27 -0
  40. package/extensions/hud/telemetry/codex-usage/types.ts +137 -0
  41. package/extensions/hud/telemetry/format.ts +434 -0
  42. package/extensions/hud/telemetry/token-switch.ts +114 -0
  43. package/extensions/hud/ui/icons.ts +239 -0
  44. package/extensions/hud/ui/style.ts +276 -0
  45. package/package.json +56 -0
package/docs/footer.md ADDED
@@ -0,0 +1,139 @@
1
+ # Footer reference
2
+
3
+ ## Default layout
4
+
5
+ When `footerFormat` is empty, the HUD displays a three-line categorized layout:
6
+
7
+ ```text
8
+ ⌂ project · pi-sakura ·  main ·  24.18
9
+ λ session · gpt-5.3 · high · ↺ 8 · ★ 2/3 · ⊕ 2/2
10
+ ◉ usage · 35%/200k · ↑ 4.2k · ↓ 1.1k · $ 0.030
11
+ ```
12
+
13
+ Each line independently computes visible width. Extension statuses are appended to the second line by placement (`left`, `middle`, `right`). When space is tight, lines are truncated at the end with an ellipsis.
14
+
15
+ ## Built-in status segments
16
+
17
+ | Key | Default | Line | Description |
18
+ | --- | --- | --- | --- |
19
+ | `os` | on | 1 | OS icon/text per platform |
20
+ | `username` | off | 1 | `user@hostname` |
21
+ | `cwd` | on | 1 | Current working directory |
22
+ | `gitBranch` | on | 1 | Branch name or `HEAD` when detached |
23
+ | `gitStatus` | on | 1 | Conflicts, staged, modified, untracked, stash, ahead/behind |
24
+ | `gitCounts` | off | sub | Numeric counts for ahead/behind and stash |
25
+ | `gitCommit` | off | 1 | Short commit hash and optional exact tag |
26
+ | `gitMetrics` | off | 1 | Added/deleted lines from `git diff HEAD --numstat` |
27
+ | `packageVersion` | off | 1 | Project manifest version |
28
+ | `runtime` | on | 1 | Detected language/build system and tool version |
29
+ | `configCounts` | off | 1 | Instruction files and installed Pi packages count |
30
+ | `sessionName` | on | 2 | Current Pi session name |
31
+ | `model` | on | 2 | Provider and model ID |
32
+ | `thinking` | on | 2 | Thinking level when reasoning-capable |
33
+ | `turnCount` | on | 2 | Current turn index |
34
+ | `skills` | on | 2 | Active/available skills count, e.g. `★ 1/3` |
35
+ | `mcp` | on | 2 | MCP connected/total servers |
36
+ | `toolActivity` | on | 2 | Native tool completion count or recent running status |
37
+ | `agentActivity` | on | 2 | Active primary agent runs |
38
+ | `context` | on | 3 | Context percentage, window size, and/or gauge |
39
+ | `tokens` | on | 3 | Input, output, cache token summary |
40
+ | `cacheDetails` | on | 3 | Cumulative cache read/write tokens |
41
+ | `cost` | on | 3 | Cumulative session cost |
42
+ | `codexUsage` | on | 3 | Codex weekly quota remaining |
43
+ | `sessionDuration` | off | 3 | Current session duration |
44
+ | `time` | off | 3 | Current time `HH:MM` |
45
+
46
+ ## Template syntax
47
+
48
+ Set a custom template:
49
+
50
+ ```text
51
+ /zentui format "$os $cwd( $git_branch)$fill($context)( $tokens)( $cost)"
52
+ ```
53
+
54
+ Clear it:
55
+
56
+ ```text
57
+ /zentui format clear
58
+ ```
59
+
60
+ ### Variables
61
+
62
+ - `$name` or `${name}` — variable substitution
63
+ - `( ... )` — conditional group; hidden when all contained variables are empty
64
+ - `$fill` — layout partition marker (0 = left only, 1 = left/right, 2 = left/middle/right)
65
+ - `$sep` — styled ` | ` separator, does not cause a conditional group to show
66
+
67
+ ### Variable list
68
+
69
+ | Variable | Content |
70
+ | --- | --- |
71
+ | `$cwd` | Current directory |
72
+ | `$git_branch` | Git icon and branch |
73
+ | `$git_status` | Git file status and ahead/behind |
74
+ | `$git_state` | Rebase, merge, etc. operation state |
75
+ | `$runtime` | Runtime icon and tool version |
76
+ | `$session_duration` | Session duration |
77
+ | `$username` | `user@hostname` |
78
+ | `$os` | OS icon/text |
79
+ | `$time` | Current time |
80
+ | `$context` | Context state |
81
+ | `$tokens` | Token summary |
82
+ | `$cost` | Session cost |
83
+ | `$package` | Package icon and project version |
84
+ | `$package_version` | Plain project version text |
85
+ | `$git_commit` | Short commit hash and optional tag |
86
+ | `$git_tag` | Exact matching tag only |
87
+ | `$git_metrics` | Added/deleted lines |
88
+ | `$git_added` | Added lines only |
89
+ | `$git_deleted` | Deleted lines only |
90
+ | `$session_name` | Session name |
91
+ | `$model` | Provider/Model |
92
+ | `$provider` | Provider ID only |
93
+ | `$model_id` | Model ID only |
94
+ | `$thinking` | Thinking level |
95
+ | `$turn` | Turn index |
96
+ | `$cache_read` | Cumulative cache read tokens |
97
+ | `$cache_write` | Cumulative cache write tokens |
98
+ | `$cache_hit` | Latest cache hit rate |
99
+ | `$codex_usage` | Codex subscription summary |
100
+ | `$instruction_files` | `AGENTS.md` + `CLAUDE.md` total |
101
+ | `$agents_files` | `AGENTS.md` count |
102
+ | `$claude_files` | `CLAUDE.md` count |
103
+ | `$skills` | Active/available skills, e.g. `★ 1/3` |
104
+ | `$active_skills` | Active skills count only |
105
+ | `$extensions` | Installed Pi packages count |
106
+ | `$mcp` | MCP connected/total |
107
+ | `$tool_counts` | Native tool completion counts |
108
+ | `$running_tools` | Recently running tools |
109
+ | `$active_agents` | Active primary agent runs |
110
+ | `$sep` | Styled ` | ` |
111
+ | `$fill` | Layout marker, renders nothing |
112
+
113
+ ### Aliases
114
+
115
+ ```text
116
+ $directory → $cwd
117
+ $branch → $git_branch
118
+ $status → $git_status
119
+ $state → $git_state
120
+ $commit → $git_commit
121
+ $tag → $git_tag
122
+ $duration → $session_duration
123
+ $session → $session_name
124
+ $thinking_level → $thinking
125
+ $turn_count → $turn
126
+ $codex → $codex_usage
127
+ $tools → $tool_counts
128
+ $agents → $active_agents
129
+ $separator → $sep
130
+ ```
131
+
132
+ ## Model quota
133
+
134
+ The status line automatically switches quota display based on model provider:
135
+
136
+ - **openai-codex**: Uses Pi Model Registry's Codex Auth to query ChatGPT usage endpoint; falls back to `codex app-server --listen stdio://`. Shows weekly limit percentage, e.g. `codex 75% wk`.
137
+ - **token-switch**: Uses `TOKEN_SWITCH_API_KEY` environment variable to query billing subscription and usage. Shows available balance, e.g. `token-switch $750.00`.
138
+
139
+ Both queries use 15-second timeout, 5-minute cache, and auto-refresh. Switching models via `/model` forces a refresh.