@eiei114/pi-sub-bar 1.5.1
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/CHANGELOG.md +201 -0
- package/README.md +200 -0
- package/index.ts +1103 -0
- package/package.json +39 -0
- package/src/core-settings.ts +25 -0
- package/src/dividers.ts +48 -0
- package/src/errors.ts +71 -0
- package/src/formatting.ts +937 -0
- package/src/paths.ts +21 -0
- package/src/providers/extras.ts +21 -0
- package/src/providers/metadata.ts +199 -0
- package/src/providers/settings.ts +359 -0
- package/src/providers/windows.ts +23 -0
- package/src/settings/display.ts +786 -0
- package/src/settings/menu.ts +183 -0
- package/src/settings/themes.ts +378 -0
- package/src/settings/ui.ts +1388 -0
- package/src/settings-types.ts +651 -0
- package/src/settings-ui.ts +5 -0
- package/src/settings.ts +176 -0
- package/src/share.ts +75 -0
- package/src/status.ts +103 -0
- package/src/storage.ts +61 -0
- package/src/types.ts +25 -0
- package/src/ui/keybindings.ts +92 -0
- package/src/ui/settings-list.ts +304 -0
- package/src/usage/types.ts +5 -0
- package/src/utils.ts +42 -0
- package/test/all.test.ts +6 -0
- package/test/dividers.test.ts +34 -0
- package/test/formatting.test.ts +437 -0
- package/test/keybindings.test.ts +59 -0
- package/test/providers.test.ts +42 -0
- package/test/settings.test.ts +336 -0
- package/test/status.test.ts +27 -0
- package/tsconfig.json +5 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
# @marckrenn/pi-sub-bar
|
|
2
|
+
|
|
3
|
+
## 1.5.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [[`ad79e93`](https://github.com/eiei114/pi-sub/commit/ad79e935cd51239b0e74657aabe067885ad59b82), [`ad79e93`](https://github.com/eiei114/pi-sub/commit/ad79e935cd51239b0e74657aabe067885ad59b82)]:
|
|
8
|
+
- @eiei114/pi-sub-core@1.5.1
|
|
9
|
+
- @eiei114/pi-sub-shared@1.5.1
|
|
10
|
+
|
|
11
|
+
## 1.5.0
|
|
12
|
+
|
|
13
|
+
### Minor Changes
|
|
14
|
+
|
|
15
|
+
- [#56](https://github.com/marckrenn/pi-sub/pull/56) [`864cc1b`](https://github.com/marckrenn/pi-sub/commit/864cc1bbc91897d934c0545a29f508862231963c) - Prioritize usage windows that match the active model before emitting `sub-core:update-current`, so compact status clients show the correct quota windows (including Codex Spark and Antigravity model-specific windows).
|
|
16
|
+
|
|
17
|
+
Also make settings list navigation compatible with both old and new `@mariozechner/pi-tui` keybinding APIs, preventing crashes in submenus on older Pi runtimes where `getEditorKeybindings()` is unavailable.
|
|
18
|
+
|
|
19
|
+
Thanks [@dnouri](https://github.com/dnouri) for [#54](https://github.com/marckrenn/pi-sub/pull/54).
|
|
20
|
+
|
|
21
|
+
### Patch Changes
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`864cc1b`](https://github.com/marckrenn/pi-sub/commit/864cc1bbc91897d934c0545a29f508862231963c)]:
|
|
24
|
+
- @marckrenn/pi-sub-core@1.5.0
|
|
25
|
+
- @marckrenn/pi-sub-shared@1.5.0
|
|
26
|
+
|
|
27
|
+
## 1.4.0
|
|
28
|
+
|
|
29
|
+
### Minor Changes
|
|
30
|
+
|
|
31
|
+
- [#51](https://github.com/marckrenn/pi-sub/pull/51) [`477ee48`](https://github.com/marckrenn/pi-sub/commit/477ee480ae1a3841808f1e46b0541e11adcf0651) Thanks [@marckrenn](https://github.com/marckrenn)! - Align `sub-bar`, `sub-core`, and `sub-shared` to `1.4.0` in lockstep.
|
|
32
|
+
|
|
33
|
+
No functional changes in this bump; this release normalizes package versions after the previous publish.
|
|
34
|
+
|
|
35
|
+
### Patch Changes
|
|
36
|
+
|
|
37
|
+
- Updated dependencies [[`477ee48`](https://github.com/marckrenn/pi-sub/commit/477ee480ae1a3841808f1e46b0541e11adcf0651)]:
|
|
38
|
+
- @marckrenn/pi-sub-core@1.4.0
|
|
39
|
+
- @marckrenn/pi-sub-shared@1.4.0
|
|
40
|
+
|
|
41
|
+
## 1.3.1
|
|
42
|
+
|
|
43
|
+
### Patch Changes
|
|
44
|
+
|
|
45
|
+
- [#49](https://github.com/marckrenn/pi-sub/pull/49) [`833c19d`](https://github.com/marckrenn/pi-sub/commit/833c19db675f7c8ec7a9bb7fd04323607eb3aa1a) Thanks [@marckrenn](https://github.com/marckrenn)! - Set bundled default themes to use transparent widget background (`backgroundColor: none`) by default.
|
|
46
|
+
|
|
47
|
+
Thanks [@marckrenn](https://github.com/marckrenn) for aligning bundled defaults in this release line.
|
|
48
|
+
|
|
49
|
+
- [#49](https://github.com/marckrenn/pi-sub/pull/49) [`3296415`](https://github.com/marckrenn/pi-sub/commit/3296415732cc1abb3a1687322b078931d5a142b6) Thanks [@marckrenn](https://github.com/marckrenn)! - Fix the status-line placement defaults and behavior:
|
|
50
|
+
- Keep `widgetPlacement` defaulting to `belowEditor` for merged settings state.
|
|
51
|
+
- In `widgetPlacement: "status"`, force left alignment and truncate-only overflow.
|
|
52
|
+
- Status-line placement: hide status-only alignment/overflow controls and apply compact formatting; disable right padding in footer mode where trailing spaces are not safely preservable. Left padding remains applied.
|
|
53
|
+
|
|
54
|
+
Thanks [@marckrenn](https://github.com/marckrenn) for the follow-up integration in this branch and [@pasky](https://github.com/pasky) for the original status-line work in PR [#44](https://github.com/marckrenn/pi-sub/pull/44).
|
|
55
|
+
|
|
56
|
+
- [#49](https://github.com/marckrenn/pi-sub/pull/49) [`3296415`](https://github.com/marckrenn/pi-sub/commit/3296415732cc1abb3a1687322b078931d5a142b6) Thanks [@marckrenn](https://github.com/marckrenn)! - Add a new built-in **Default Footer** display theme preset, applying a status-line optimized footer layout directly from the theme picker.
|
|
57
|
+
|
|
58
|
+
Thanks [@marckrenn](https://github.com/marckrenn) for PR [#49](https://github.com/marckrenn/pi-sub/pull/49).
|
|
59
|
+
|
|
60
|
+
- [#49](https://github.com/marckrenn/pi-sub/pull/49) [`5e2b792`](https://github.com/marckrenn/pi-sub/commit/5e2b792f469a934ecfdddef8f31079442e496c1f) Thanks [@marckrenn](https://github.com/marckrenn)! - Add support for a transparent widget background so users can disable background coloring when it reduces readability in their terminal theme.
|
|
61
|
+
|
|
62
|
+
This introduces an explicit `none` background choice in display settings and preserves that preference through settings updates, so the bar can render without forced background ANSI styling.
|
|
63
|
+
|
|
64
|
+
Thanks [@airtonix](https://github.com/airtonix) for implementing this in PR [#47](https://github.com/marckrenn/pi-sub/pull/47).
|
|
65
|
+
|
|
66
|
+
- Updated dependencies []:
|
|
67
|
+
- @marckrenn/pi-sub-core@1.3.1
|
|
68
|
+
- @marckrenn/pi-sub-shared@1.3.1
|
|
69
|
+
|
|
70
|
+
## 1.3.0
|
|
71
|
+
|
|
72
|
+
### Minor Changes
|
|
73
|
+
|
|
74
|
+
- [#42](https://github.com/marckrenn/pi-sub/pull/42) [`8bf29f3`](https://github.com/marckrenn/pi-sub/commit/8bf29f34c8f9418284cf30631a3325799c3e0f48) Thanks [@marckrenn](https://github.com/marckrenn)! - - Added an optional `showContextBar` setting (default: off), as introduced in [#10](https://github.com/marckrenn/pi-sub/pull/10) by [@pasky](https://github.com/pasky), to render the current context usage as an optional leftmost `Ctx` bar in sub-bar usage output.
|
|
75
|
+
- Support for Codex Spark usage (auto-selected for `gpt-5.3-codex-spark`), including model-specific window labeling behavior.
|
|
76
|
+
- OpenAI Status provider now surfaces the Codex-specific status endpoint instead of the generic status summary when available.
|
|
77
|
+
- [`80b49b1`](https://github.com/marckrenn/pi-sub/commit/80b49b16c20c942135764bcf6c4cd0516e868ce2) Fixed API key auth format handling for the z.ai provider.
|
|
78
|
+
|
|
79
|
+
### Patch Changes
|
|
80
|
+
|
|
81
|
+
- Updated dependencies [[`8bf29f3`](https://github.com/marckrenn/pi-sub/commit/8bf29f34c8f9418284cf30631a3325799c3e0f48)]:
|
|
82
|
+
- @marckrenn/pi-sub-core@1.3.0
|
|
83
|
+
- @marckrenn/pi-sub-shared@1.3.0
|
|
84
|
+
|
|
85
|
+
## 1.2.0
|
|
86
|
+
|
|
87
|
+
### Minor Changes
|
|
88
|
+
|
|
89
|
+
- Added optional context-window support via `showContextBar` (default: off). When enabled, a `Ctx` bar can appear as the leftmost usage window.
|
|
90
|
+
- Kept model-specific Codex Spark handling behavior.
|
|
91
|
+
|
|
92
|
+
### Updated dependencies:
|
|
93
|
+
|
|
94
|
+
- @marckrenn/pi-sub-core@1.2.0
|
|
95
|
+
- @marckrenn/pi-sub-shared@1.2.0
|
|
96
|
+
|
|
97
|
+
## 1.1.0
|
|
98
|
+
|
|
99
|
+
### Minor Changes
|
|
100
|
+
|
|
101
|
+
- [`e9c1c39`](https://github.com/marckrenn/pi-sub/commit/e9c1c394286b302e018c2c824d16978b2b4d3d44) Thanks [@plesiv](https://github.com/plesiv)! - Make keybindings configurable
|
|
102
|
+
|
|
103
|
+
### Patch Changes
|
|
104
|
+
|
|
105
|
+
- Updated dependencies [[`7ce2a92`](https://github.com/marckrenn/pi-sub/commit/7ce2a92b15e766fd85a4b7eb85d6fc5c5aa32dca)]:
|
|
106
|
+
- @marckrenn/pi-sub-core@1.1.0
|
|
107
|
+
- @marckrenn/pi-sub-shared@1.1.0
|
|
108
|
+
|
|
109
|
+
## 1.0.6
|
|
110
|
+
|
|
111
|
+
### Patch Changes
|
|
112
|
+
|
|
113
|
+
- Remove `bundleDependencies`/`bundledDependencies` from `@marckrenn/pi-sub-bar` to fix `npm install -g @marckrenn/pi-sub-bar` failing with `protobufjs` postinstall (missing `scripts/postinstall.js`) on Node 24+/npm.
|
|
114
|
+
|
|
115
|
+
Also include a second extension path (`../pi-sub-core/index.ts`) so `sub-core` is discovered whether npm installs `@marckrenn/pi-sub-core` nested or hoisted, restoring `/sub-core:settings`.
|
|
116
|
+
|
|
117
|
+
- Updated dependencies []:
|
|
118
|
+
- @marckrenn/pi-sub-core@1.0.6
|
|
119
|
+
- @marckrenn/pi-sub-shared@1.0.6
|
|
120
|
+
|
|
121
|
+
## 1.0.5
|
|
122
|
+
|
|
123
|
+
### Patch Changes
|
|
124
|
+
|
|
125
|
+
- [#35](https://github.com/marckrenn/pi-sub/pull/35) [`59e2b45`](https://github.com/marckrenn/pi-sub/commit/59e2b456e0e5c41479dccedcef93f9175cc4aa55) Thanks [@marckrenn](https://github.com/marckrenn)! - Improve startup responsiveness by deferring refreshes and watchers, skipping headless UI work, and unref-ing long-lived timers so pi CLI commands exit cleanly.
|
|
126
|
+
|
|
127
|
+
- Updated dependencies [[`59e2b45`](https://github.com/marckrenn/pi-sub/commit/59e2b456e0e5c41479dccedcef93f9175cc4aa55)]:
|
|
128
|
+
- @marckrenn/pi-sub-core@1.0.5
|
|
129
|
+
- @marckrenn/pi-sub-shared@1.0.5
|
|
130
|
+
|
|
131
|
+
## 1.0.4
|
|
132
|
+
|
|
133
|
+
### Patch Changes
|
|
134
|
+
|
|
135
|
+
- [#28](https://github.com/marckrenn/pi-sub/pull/28) [`2e35657`](https://github.com/marckrenn/pi-sub/commit/2e3565776a98ec133537fe0bacbc099cd4afadbe) Thanks [@marckrenn](https://github.com/marckrenn)! - Default Anthropic “Show Extra Window” provider setting to off.
|
|
136
|
+
|
|
137
|
+
- [#29](https://github.com/marckrenn/pi-sub/pull/29) [`7e6b7a0`](https://github.com/marckrenn/pi-sub/commit/7e6b7a08d69cf1cd456d2add406ec89c5c86f5df) Thanks [@marckrenn](https://github.com/marckrenn)! - Split display padding into left/right settings and migrate legacy paddingX values to both sides.
|
|
138
|
+
|
|
139
|
+
- [#22](https://github.com/marckrenn/pi-sub/pull/22) [`3e5a026`](https://github.com/marckrenn/pi-sub/commit/3e5a026ea3dc113561ff32466a8aa03b91c6d876) Thanks [@marckrenn](https://github.com/marckrenn)! - Store sub-core and sub-bar settings in agent-level JSON files so updates no longer overwrite user configuration. Legacy extension `settings.json` files are migrated into the new files and removed after a successful migration.
|
|
140
|
+
|
|
141
|
+
Manual migration (if you want to do it yourself before updating):
|
|
142
|
+
|
|
143
|
+
```
|
|
144
|
+
cp ~/.pi/agent/extensions/sub-core/settings.json ~/.pi/agent/pi-sub-core-settings.json
|
|
145
|
+
cp ~/.pi/agent/extensions/sub-bar/settings.json ~/.pi/agent/pi-sub-bar-settings.json
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Existing users should move legacy settings from the extension folders to:
|
|
149
|
+
- `~/.pi/agent/pi-sub-core-settings.json`
|
|
150
|
+
- `~/.pi/agent/pi-sub-bar-settings.json`
|
|
151
|
+
|
|
152
|
+
- [#23](https://github.com/marckrenn/pi-sub/pull/23) [`9c324fc`](https://github.com/marckrenn/pi-sub/commit/9c324fc7daae2a874816f600ac1ea422f3799dd2) Thanks [@marckrenn](https://github.com/marckrenn)! - Auto-post theme share strings when saving, add a “Share theme” menu entry, allow share strings without a name when importing, and post raw share strings (without the `/sub-bar:import` prefix).
|
|
153
|
+
|
|
154
|
+
- [#25](https://github.com/marckrenn/pi-sub/pull/25) [`ab97c8f`](https://github.com/marckrenn/pi-sub/commit/ab97c8f13c567c32581bb82fe5b0406b3f2464ca) Thanks [@marckrenn](https://github.com/marckrenn)! - Refine the theme menu ordering/labels and add rename support for saved themes in the Manage & Load flow.
|
|
155
|
+
|
|
156
|
+
- [#27](https://github.com/marckrenn/pi-sub/pull/27) [`549c6fe`](https://github.com/marckrenn/pi-sub/commit/549c6fe3eb57374a54bfc69ad70c91862250a186) Thanks [@marckrenn](https://github.com/marckrenn)! - Move Themes to the root settings menu, rename Display Settings to Adv. Display Settings, and rename “Manage & Load themes” to “Load & Manage themes”.
|
|
157
|
+
|
|
158
|
+
- [#26](https://github.com/marckrenn/pi-sub/pull/26) [`af28d98`](https://github.com/marckrenn/pi-sub/commit/af28d9820f80bc1d045783644afbcc4d7cd114f1) Thanks [@marckrenn](https://github.com/marckrenn)! - Prompt to upload theme share strings as secret GitHub gists and post the gist URL when accepted.
|
|
159
|
+
|
|
160
|
+
- Updated dependencies [[`af0828a`](https://github.com/marckrenn/pi-sub/commit/af0828a8d2e529497a1acff95e388a0a3eabb90e), [`3e5a026`](https://github.com/marckrenn/pi-sub/commit/3e5a026ea3dc113561ff32466a8aa03b91c6d876), [`a6c0d33`](https://github.com/marckrenn/pi-sub/commit/a6c0d33c8d19d2876a4a8a1a0a69302a3c63f5e8), [`7da1e08`](https://github.com/marckrenn/pi-sub/commit/7da1e082e634f4e4dee2560b4d490527d1543ade), [`1f5e451`](https://github.com/marckrenn/pi-sub/commit/1f5e45173b9868b0d6645ae35a084142a0ac56a5), [`35eb185`](https://github.com/marckrenn/pi-sub/commit/35eb18590f369db4cda931b8e11099d0f3ddb4ec)]:
|
|
161
|
+
- @marckrenn/pi-sub-core@1.0.4
|
|
162
|
+
- @marckrenn/pi-sub-shared@1.0.4
|
|
163
|
+
|
|
164
|
+
## 1.0.3
|
|
165
|
+
|
|
166
|
+
### Patch Changes
|
|
167
|
+
|
|
168
|
+
- [`6fa2736`](https://github.com/marckrenn/pi-sub/commit/6fa27363573f34c38a372a6d7b8b74e756716724) Thanks [@marckrenn](https://github.com/marckrenn)! - Update extension tool execute signature order for compatibility with latest Pi API.
|
|
169
|
+
|
|
170
|
+
- Updated dependencies [[`6fa2736`](https://github.com/marckrenn/pi-sub/commit/6fa27363573f34c38a372a6d7b8b74e756716724)]:
|
|
171
|
+
- @marckrenn/pi-sub-core@1.0.3
|
|
172
|
+
- @marckrenn/pi-sub-shared@1.0.3
|
|
173
|
+
|
|
174
|
+
## 1.0.2
|
|
175
|
+
|
|
176
|
+
### Patch Changes
|
|
177
|
+
|
|
178
|
+
- [#3](https://github.com/marckrenn/pi-sub/pull/3) [`4ceb5ad`](https://github.com/marckrenn/pi-sub/commit/4ceb5ad133166237652d197ba9296ad1589a813c) Thanks [@marckrenn](https://github.com/marckrenn)! - Bundle sub-core with sub-bar, refresh Antigravity quotas + settings, and update UI copy/controls.
|
|
179
|
+
|
|
180
|
+
- Updated dependencies [[`4ceb5ad`](https://github.com/marckrenn/pi-sub/commit/4ceb5ad133166237652d197ba9296ad1589a813c)]:
|
|
181
|
+
- @marckrenn/pi-sub-core@1.0.2
|
|
182
|
+
- @marckrenn/pi-sub-shared@1.0.2
|
|
183
|
+
|
|
184
|
+
## 1.0.1
|
|
185
|
+
|
|
186
|
+
### Patch Changes
|
|
187
|
+
|
|
188
|
+
- Align repo version with npm publish.
|
|
189
|
+
- Updated dependencies:
|
|
190
|
+
- @marckrenn/pi-sub-shared@1.0.1
|
|
191
|
+
|
|
192
|
+
## 1.0.0
|
|
193
|
+
|
|
194
|
+
### Major Changes
|
|
195
|
+
|
|
196
|
+
- [`9bedd80`](https://github.com/marckrenn/pi-sub/commit/9bedd80b0037b723e70f0376019fff59a617e7cb) Thanks [@marckrenn](https://github.com/marckrenn)! - Initial 1.0.0 release.
|
|
197
|
+
|
|
198
|
+
### Patch Changes
|
|
199
|
+
|
|
200
|
+
- Updated dependencies [[`9bedd80`](https://github.com/marckrenn/pi-sub/commit/9bedd80b0037b723e70f0376019fff59a617e7cb)]:
|
|
201
|
+
- @marckrenn/pi-sub-shared@1.0.0
|
package/README.md
ADDED
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
# sub-bar
|
|
2
|
+
|
|
3
|
+
Usage widget extension for [pi-coding-agent](https://github.com/badlogic/pi-mono/tree/main/packages/coding-agent).
|
|
4
|
+
|
|
5
|
+
Displays current provider usage in a widget below the editor. Fetching and caching are handled by `sub-core`.
|
|
6
|
+
|
|
7
|
+
### Impressions
|
|
8
|
+
|
|
9
|
+
https://github.com/user-attachments/assets/d61d82f6-afd0-45fc-82f3-69910543aa7a
|
|
10
|
+
|
|
11
|
+

|
|
12
|
+

|
|
13
|
+

|
|
14
|
+
|
|
15
|
+
## Overview
|
|
16
|
+
|
|
17
|
+
### Features
|
|
18
|
+
|
|
19
|
+
- Displays realtime usage quotas for multiple AI providers
|
|
20
|
+
- Auto-detects provider from current model (via sub-core)
|
|
21
|
+
- Shows rate limit windows with visual progress bars
|
|
22
|
+
- Status indicators from provider status pages
|
|
23
|
+
- Theme save/share/import and `sub-bar:import` preview flow
|
|
24
|
+
- Provider Shown selector to pin the displayed provider
|
|
25
|
+
- **Extensive settings UI** via `sub-bar:settings`
|
|
26
|
+
- Cycle through providers with `Ctrl+Alt+P`
|
|
27
|
+
|
|
28
|
+
### Supported Providers
|
|
29
|
+
|
|
30
|
+
| Provider | Usage Data | Status Page |
|
|
31
|
+
|----------|-----------|-------------|
|
|
32
|
+
| Anthropic (Claude) | 5h/Week windows, extra usage | ✅ |
|
|
33
|
+
| GitHub Copilot | Monthly quota, requests | ✅ |
|
|
34
|
+
| Google Gemini | Pro/Flash quotas | ✅ |
|
|
35
|
+
| Antigravity | Model quotas | ✅ |
|
|
36
|
+
| OpenAI Codex | Primary/secondary windows | ✅ |
|
|
37
|
+
| AWS Kiro | Credits | - |
|
|
38
|
+
| z.ai | Tokens/monthly limits | - |
|
|
39
|
+
|
|
40
|
+
### Provider Feature Matrix
|
|
41
|
+
|
|
42
|
+
| Provider | Usage Windows | Extra Info | Status Indicator | Tested | Notes |
|
|
43
|
+
|----------|--------------|------------|------------------|--------|-------|
|
|
44
|
+
| Anthropic (Claude) | 5h, Week, Extra | Extra usage label | ✅ | ✅ | Extra usage can show on/off state |
|
|
45
|
+
| GitHub Copilot | Month | Model multiplier + requests left | ✅ | ✅ | Requests left uses model multiplier |
|
|
46
|
+
| Google Gemini | Pro, Flash | - | ✅ | - | Quotas aggregated per model family |
|
|
47
|
+
| Antigravity | Models | - | ✅ | ✅ | Sandbox Cloud Code Assist quotas |
|
|
48
|
+
| OpenAI Codex | Primary, Secondary | - | ✅ | ✅ | Credits not yet supported (PRs welcome!) |
|
|
49
|
+
| AWS Kiro | Credits | - | - | - | - |
|
|
50
|
+
| z.ai | Tokens, Monthly | - | - | - | API quota limits |
|
|
51
|
+
|
|
52
|
+
## Installation
|
|
53
|
+
|
|
54
|
+
Install via the pi package manager (recommended). `sub-bar` bundles `sub-core`, so you only need to install sub-bar:
|
|
55
|
+
|
|
56
|
+
```bash
|
|
57
|
+
pi install npm:@eiei114/pi-sub-bar
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Use `-l` to install into project settings instead of global:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
pi install -l npm:@eiei114/pi-sub-bar
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
If you previously installed `sub-core` separately, remove it from `~/.pi/agent/extensions` or `~/.pi/agent/settings.json` to avoid duplicate core instances.
|
|
67
|
+
|
|
68
|
+
Manual install (local development):
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
git clone https://github.com/eiei114/pi-sub.git
|
|
72
|
+
cd pi-sub
|
|
73
|
+
npm install
|
|
74
|
+
|
|
75
|
+
ln -s /path/to/pi-sub/packages/sub-bar ~/.pi/agent/extensions/sub-bar
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
For local development, also ensure sub-core is available (either link it separately or link it into `packages/sub-bar/node_modules`).
|
|
79
|
+
|
|
80
|
+
Alternative (no symlink): add sub-bar to `~/.pi/agent/settings.json`:
|
|
81
|
+
|
|
82
|
+
```json
|
|
83
|
+
{
|
|
84
|
+
"extensions": [
|
|
85
|
+
"/path/to/pi-sub/packages/sub-bar/index.ts"
|
|
86
|
+
]
|
|
87
|
+
}
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## Usage
|
|
91
|
+
|
|
92
|
+
The extension loads automatically. Use:
|
|
93
|
+
|
|
94
|
+
- `sub-bar:settings` - Open display + provider UI settings (includes Provider Shown)
|
|
95
|
+
- `sub-bar:import <share string>` - Preview a shared theme and choose to save/apply
|
|
96
|
+
- `sub-core:settings` - Configure provider enablement/order + usage/status refresh settings
|
|
97
|
+
- `Ctrl+Alt+P` - Cycle through available providers (configurable)
|
|
98
|
+
- `Ctrl+Alt+R` - Toggle reset timer format (configurable)
|
|
99
|
+
|
|
100
|
+
**Keybindings:**
|
|
101
|
+
|
|
102
|
+
Shortcuts are configurable via `sub-bar:settings` → Keybindings. Enter any valid key combo (e.g. `ctrl+alt+p`, `ctrl+shift+s`) or `none` to disable a shortcut. Keybinding changes take effect after pi restart.
|
|
103
|
+
|
|
104
|
+
**Caching:**
|
|
105
|
+
- Handled by sub-core at `~/.pi/agent/cache/sub-core/cache.json`
|
|
106
|
+
- Cache TTL matches your auto-refresh interval setting
|
|
107
|
+
- Lock file prevents race conditions between multiple pi windows
|
|
108
|
+
|
|
109
|
+
## Communication with sub-core
|
|
110
|
+
|
|
111
|
+
`sub-bar` is a display client. It listens for `sub-core:update-current`/`sub-core:ready` events and renders the widget. On startup it requests the current state via `sub-core:request`.
|
|
112
|
+
|
|
113
|
+
`sub-bar` manages display settings and UI-only provider options (window visibility, labels, status indicator). Provider enablement lives in sub-core, but the sub-bar settings UI can toggle Enabled (auto/on/off) and forwards changes to `sub-core:settings:patch`. Ordering and refresh behavior are configured in `sub-core:settings`, and sub-core broadcasts updates that sub-bar consumes. The cycle command forwards to `sub-core:action` so core updates provider selection and then broadcasts the new state.
|
|
114
|
+
|
|
115
|
+
## Settings
|
|
116
|
+
|
|
117
|
+
Display and provider UI settings are stored in `~/.pi/agent/pi-sub-bar-settings.json` (migrated from the legacy extension `settings.json` when present; the legacy file is removed after a successful migration). Core settings are managed by sub-core, and the sub-bar settings menu includes a shortcut that points you to `sub-core:settings` for additional options.
|
|
118
|
+
|
|
119
|
+
**Settings migrations:** settings are merged with defaults on load, but renames/removals are not migrated automatically. When adding new settings or changing schema, update the defaults/merge logic and provide a migration (or instruct users to reset `pi-sub-bar-settings.json`).
|
|
120
|
+
|
|
121
|
+
### Provider UI Settings
|
|
122
|
+
|
|
123
|
+
Use `sub-bar:settings` → Provider Settings to control enabled state (auto/on/off), status indicators, and per-provider window visibility.
|
|
124
|
+
|
|
125
|
+
### Core Settings
|
|
126
|
+
|
|
127
|
+
Use `sub-core:settings` to configure provider enablement (auto/on/off), fetch status, usage refresh settings, status refresh settings, and provider order.
|
|
128
|
+
|
|
129
|
+
### Display Settings
|
|
130
|
+
|
|
131
|
+
Use Display Settings → Theme to save, load, import, and randomize display themes.
|
|
132
|
+
|
|
133
|
+
Display Settings cover layout, bars, labels/text, reset timers, status indicators, dividers, and color tuning. Open `sub-bar:settings` → Display Settings to explore the full list in the UI.
|
|
134
|
+
|
|
135
|
+
## Credentials
|
|
136
|
+
|
|
137
|
+
Credentials are loaded by sub-core from:
|
|
138
|
+
|
|
139
|
+
- `~/.pi/agent/auth.json` - pi's auth file
|
|
140
|
+
- Provider-specific locations (e.g., `~/.codex/auth.json`, `~/.gemini/oauth_creds.json`)
|
|
141
|
+
- macOS Keychain for Claude Code credentials
|
|
142
|
+
- Environment variables (e.g., `Z_AI_API_KEY`)
|
|
143
|
+
|
|
144
|
+
## Development
|
|
145
|
+
|
|
146
|
+
### Packaging notes (pi install compatibility)
|
|
147
|
+
|
|
148
|
+
Pi packages use a `pi` field in `package.json` plus the `pi-package` keyword for discoverability. This repo already declares `pi.extensions`, so you can install via:
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
pi install npm:@eiei114/pi-sub-core
|
|
152
|
+
pi install npm:@eiei114/pi-sub-bar
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
Manual paths/symlinks still work for local development as documented above.
|
|
156
|
+
|
|
157
|
+
### Architecture
|
|
158
|
+
|
|
159
|
+
```
|
|
160
|
+
sub-bar/
|
|
161
|
+
├── index.ts # Extension entry point (display client)
|
|
162
|
+
├── src/
|
|
163
|
+
│ ├── formatting.ts # UI formatting
|
|
164
|
+
│ ├── status.ts # Status indicator helpers
|
|
165
|
+
│ ├── utils.ts # Display helpers
|
|
166
|
+
│ ├── providers/ # Display metadata + visibility rules
|
|
167
|
+
│ ├── settings/ # Settings UI helpers
|
|
168
|
+
│ ├── settings-types.ts # Settings type definitions
|
|
169
|
+
│ ├── settings.ts # Settings persistence
|
|
170
|
+
│ └── usage/types.ts # Shared usage types
|
|
171
|
+
├── package.json
|
|
172
|
+
└── tsconfig.json
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
### Adding a New Provider
|
|
176
|
+
|
|
177
|
+
Update both sub-core (fetch) and sub-bar (display). See `sub-core/README.md` for the full checklist.
|
|
178
|
+
|
|
179
|
+
### Feature placement (UI vs core)
|
|
180
|
+
|
|
181
|
+
- **sub-bar** owns presentation (formatting, layout, status indicators, UI settings).
|
|
182
|
+
- **sub-core** owns data fetching, caching, provider selection, and shared settings/events.
|
|
183
|
+
- Add shared types to **sub-shared** when both layers reference them.
|
|
184
|
+
|
|
185
|
+
See the root README “Developer guide” for the full decision checklist and examples.
|
|
186
|
+
|
|
187
|
+
### Commands
|
|
188
|
+
|
|
189
|
+
```bash
|
|
190
|
+
npm run check
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Credits
|
|
194
|
+
|
|
195
|
+
- ~Hannes~ Helmut Januschka ([usage-bar.ts](https://github.com/hjanuschka/shitty-extensions?tab=readme-ov-file#usage-barts), [@hjanuschka](https://x.com/hjanuschka))
|
|
196
|
+
- Peter Steinberger ([CodexBar](https://github.com/steipete/CodexBar), [@steipete](https://x.com/steipete))
|
|
197
|
+
|
|
198
|
+
## License
|
|
199
|
+
|
|
200
|
+
MIT
|