osdy-pi 0.1.9 → 1.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 (50) hide show
  1. package/README.md +333 -155
  2. package/bin/osdy-pi.mjs +150 -0
  3. package/bin/osdy.mjs +43 -0
  4. package/extensions/osdy-pi/account-profiles.test.ts +531 -0
  5. package/extensions/osdy-pi/account-profiles.ts +510 -0
  6. package/extensions/osdy-pi/animation.test.ts +84 -0
  7. package/extensions/osdy-pi/animation.ts +62 -11
  8. package/extensions/osdy-pi/codex-usage-ui.test.ts +1145 -0
  9. package/extensions/osdy-pi/codex-usage-ui.ts +728 -0
  10. package/extensions/osdy-pi/codex-usage.test.ts +276 -0
  11. package/extensions/osdy-pi/codex-usage.ts +276 -0
  12. package/extensions/osdy-pi/constants.ts +412 -133
  13. package/extensions/osdy-pi/context-usage-ui.test.ts +168 -0
  14. package/extensions/osdy-pi/context-usage-ui.ts +60 -0
  15. package/extensions/osdy-pi/diff-panel.ts +6 -14
  16. package/extensions/osdy-pi/editor-settings.test.ts +261 -0
  17. package/extensions/osdy-pi/editor-settings.ts +148 -0
  18. package/extensions/osdy-pi/metrics.test.ts +95 -0
  19. package/extensions/osdy-pi/metrics.ts +47 -136
  20. package/extensions/osdy-pi/plugin-events.ts +26 -0
  21. package/extensions/osdy-pi/profile-label.ts +29 -0
  22. package/extensions/osdy-pi/runtime-helpers.test.ts +245 -0
  23. package/extensions/osdy-pi/runtime-helpers.ts +117 -51
  24. package/extensions/osdy-pi/runtime.test.ts +410 -0
  25. package/extensions/osdy-pi/runtime.ts +557 -87
  26. package/extensions/osdy-pi/types.ts +59 -11
  27. package/extensions/osdy-pi/ui.test.ts +179 -0
  28. package/extensions/osdy-pi/ui.ts +323 -122
  29. package/extensions/osdy-pi/utils.ts +43 -1
  30. package/extensions/osdy-pi/working-tree.ts +25 -6
  31. package/package.json +25 -5
  32. package/scripts/osdy-pi-account-profiles.mjs +946 -0
  33. package/scripts/osdy-pi-gentle-coexistence.mjs +200 -0
  34. package/scripts/osdy-pi-profile-setup.mjs +175 -0
  35. package/themes/osdy-pi-catppuccin-frappe.json +98 -0
  36. package/themes/osdy-pi-catppuccin-latte.json +98 -0
  37. package/themes/osdy-pi-catppuccin-macchiato.json +98 -0
  38. package/themes/osdy-pi-catppuccin-mocha.json +98 -0
  39. package/themes/osdy-pi-dark.json +6 -8
  40. package/themes/osdy-pi-dracula.json +87 -0
  41. package/themes/osdy-pi-kanagawa-dragon.json +95 -0
  42. package/themes/osdy-pi-kanagawa-lotus.json +96 -0
  43. package/themes/osdy-pi-kanagawa-wave.json +95 -0
  44. package/themes/osdy-pi-lucent-orange.json +84 -0
  45. package/themes/osdy-pi-matrix.json +87 -0
  46. package/themes/osdy-pi-new.json +95 -0
  47. package/themes/osdy-pi-sexy.json +88 -0
  48. package/themes/osdy-pi-tokyo-night.json +87 -0
  49. package/themes/osdy-pi-light.json +0 -84
  50. package/themes/osdy-pi-simple.json +0 -83
package/README.md CHANGED
@@ -1,184 +1,357 @@
1
- # Osdy Pi
1
+ # Osdy Pi — a themed, responsive Pi workspace
2
2
 
3
- <img width="1857" height="847" alt="image" src="https://github.com/user-attachments/assets/028eeb14-3f43-4f1c-9603-0c55a8d2856d" />
3
+ Osdy Pi gives [Pi](https://github.com/earendil-works/pi) a themed, responsive terminal presentation with a header, editor, working indicator, and Git view. Visit the [Osdy landing page](https://landing-osdy.vercel.app/).
4
4
 
5
- Theme package for [Pi](https://github.com/earendil-works/pi) with the Osdy terminal style: neon pink/purple colors, a custom ASCII header, and a framed editor experience.
5
+ <img width="1857" height="847" alt="Osdy Pi interface" src="https://github.com/user-attachments/assets/028eeb14-3f43-4f1c-9603-0c55a8d2856d" />
6
6
 
7
- Visit the Osdy landing page: [landing-osdy.vercel.app](https://landing-osdy.vercel.app/).
7
+ ## Release highlights
8
8
 
9
- ## What you get
9
+ | Area | What ships |
10
+ | --- | --- |
11
+ | Message cards | Pi-native, theme-aware user and assistant cards; assistant accents follow the theme and user accents are white. |
12
+ | Header and mascot | A theme-aware `neon` header and selectable `bts` mascot, both responsive and persisted independently. |
13
+ | Accounts | `/osdy-account` switches Codex profiles in place with atomic activation, rollback, bounded auth files, and process-safe locks. |
14
+ | Quota | `/usage` and compact bars emphasize remaining Codex quota at warning (40% or less) and error (15% or less) thresholds. |
10
15
 
11
- - **Dark theme:** `osdy-pi-dark`, enabled by default when the package starts.
12
- - **Light theme:** `osdy-pi-light`, with the same Osdy palette adapted for light terminals.
13
- - **Simple theme:** `osdy-pi-simple`, a blue/red/slate console theme for the full Pi interface.
14
- - **Custom header:** two selectable header styles with responsive status metadata: `osdy-theme` (default) and `classic`.
15
- - **Custom editor:** full-width framed input area with model, thinking, token, cost, and context status.
16
- - **Custom working indicator:** a dedicated working widget/spinner appears above the text box, outside the editor frame.
17
- - **Clean layout:** the built-in working row is hidden while Osdy Pi is enabled to avoid duplicated UI.
18
- - **Optional audio notifications:** configurable `.mp3`/`.wav` files for `completion`, `error`, `permission`, and `question` events on macOS and Windows.
16
+ ## Prerequisites
19
17
 
20
- <img width="1280" height="433" alt="image" src="https://github.com/user-attachments/assets/20c7624d-9ad8-4494-97fb-6b6d81aaf328" />
18
+ - [Pi](https://github.com/earendil-works/pi)
19
+ - Node.js **22.19.0 or later**
20
+ - Git, for Osdy Pi's working-tree and diff features (and for Git-based installs)
21
21
 
22
- ## Install in Pi
22
+ ## Quick start
23
23
 
24
- Install the published package from npm:
24
+ 1. Install Osdy Pi from npm:
25
+
26
+ ```bash
27
+ pi install npm:osdy-pi
28
+ ```
29
+
30
+ Or install directly from GitHub:
31
+
32
+ ```bash
33
+ pi install git:github.com/OsdyOrtiz/Osdy-Pi
34
+ ```
35
+
36
+ 2. Start Pi:
37
+
38
+ ```bash
39
+ pi
40
+ ```
41
+
42
+ Osdy Pi's own extension and all **14 themes** are bundled with this installation—do not install them separately. Launch through `osdy-pi` (or `npm run pi:dev`) to activate a valid Osdy default account into Pi's shared agent directory before Pi starts. With no default, Pi remains unmanaged; run `/osdy-account` to create a profile and establish a default. On session start, Osdy Pi restores its persisted enabled state when a UI is available and preserves your selected Pi theme. When disabled, it leaves Gentle Shell (or Pi's native UI) untouched.
43
+
44
+ ### Optional: isolated `osdy` command
45
+
46
+ Use this path when you want **installed, normal Pi** with Osdy-specific settings and sessions, without changing the official Pi profile. `pi install` loads package resources in Pi; it does not guarantee that package executables are available on your shell's `PATH`. To use the packaged commands, install the CLI separately (or run the scripts directly from a checkout):
47
+
48
+ ```bash
49
+ npm install --global osdy-pi
50
+ osdy-pi setup
51
+ osdy
52
+ ```
53
+
54
+ From an Osdy Pi checkout, `node bin/osdy-pi.mjs setup` or `node bin/osdy.mjs setup` works without a global CLI installation; `node bin/osdy.mjs` launches Pi. `osdy-pi setup` is explicit and repeatable; `osdy` also checks/reconciles the isolated profile before each launch and forwards its arguments to the installed `pi` executable. The default source is `~/.pi/agent`, the isolated destination is `~/.pi/osdy-agent`, and the Osdy source is the package containing the CLI. Set `OSDY_PI_SOURCE_AGENT_DIR`, `OSDY_PI_AGENT_DIR`, or `OSDY_PI_EXTENSION_ROOT` to override them with absolute paths. The setup needs one valid local `gentle-pi` checkout declared as an absolute source in official Pi's package settings; if none or several match, set `GENTLE_PI_EXTENSION_ROOT=/absolute/path/to/gentle-pi` before setup and launch. Missing or invalid Gentle sources fail with an actionable error rather than silently omitting Gentle. No Pi fork, build, or PATH shim is required.
55
+
56
+ **What is isolated?** Official `~/.pi/agent/settings.json` is read but never rewritten by `osdy-pi setup` or `osdy`. Osdy keeps its own settings, selected theme, sessions, crash logs, and command history. Other existing top-level official resources are linked into the isolated profile only when absent—including `auth.json`, so credentials are **shared**, not isolated. Existing isolated files and symlinks are not replaced; the managed isolated settings are reconciled atomically. Named Codex accounts under `/osdy-account` are a separate feature, not this profile separation.
57
+
58
+ **Already have `~/.local/bin/osdy`?** Check `type -a osdy` (or `command -v osdy`) before using the new command: a home-local launcher earlier on `PATH` still wins. Setup does **not** remove or replace it. To try the packaged launcher without changing PATH, use `node "$(npm root -g)/osdy-pi/bin/osdy.mjs" --version` after installing the CLI; `node "$(npm root -g)/osdy-pi/bin/osdy.mjs" setup` runs the same explicit setup. Compare `pi --version` and `osdy --version` once the intended command resolves. Keep the old launcher until you confirm which executable you want; migration/removal is manual.
59
+
60
+ ## Optional: complete Osdy Pi suite
61
+
62
+ Add these maintained extensions after installing Osdy Pi. They are optional; each extends Pi independently.
63
+
64
+ | Package | Purpose |
65
+ | --- | --- |
66
+ | `gentle-engram` | Persistent memory shared across sessions, compactions, and MCP agents. |
67
+ | `pi-intercom` | Brokered communication between Pi agents and sessions. |
68
+ | `@juicesharp/rpiv-ask-user-question` | Structured, typed questionnaires when an agent needs clarification. |
69
+ | `pi-web-access` | Web search and URL fetching, plus repository, PDF, YouTube, and local-video analysis. |
70
+ | `pi-lens` | Real-time code feedback through LSP, linters, formatters, type checking, and structural analysis. |
71
+ | `pi-btw` | Parallel side conversations through `/btw`. |
72
+ | `@open-pets/pi` | OpenPets integration for Pi. |
73
+ | `pi-playwright` | Playwright browser-automation skills. |
74
+ | `pi-mcp-adapter` | MCP server and tool adapter for Pi. |
75
+ | `pi-subagents-j0k3r` | Markdown-defined subagents, delegation tools, history, and model profiles. |
76
+ | `@juicesharp/rpiv-todo` | A persistent live todo overlay for the agent. |
77
+ | `gentle-pi` | The Gentle senior-architect harness, with SDD/OpenSpec, subagents, TDD evidence, and skills. |
78
+
79
+ Install the ordinary npm packages once:
25
80
 
26
81
  ```bash
27
- pi install npm:osdy-pi
82
+ pi install npm:gentle-engram
83
+ pi install npm:pi-intercom
84
+ pi install npm:@juicesharp/rpiv-ask-user-question
85
+ pi install npm:pi-web-access
86
+ pi install npm:pi-lens
87
+ pi install npm:pi-btw
88
+ pi install npm:@open-pets/pi
89
+ pi install npm:pi-playwright
90
+ pi install npm:pi-mcp-adapter
91
+ pi install npm:pi-subagents-j0k3r
92
+ pi install npm:@juicesharp/rpiv-todo
28
93
  ```
29
94
 
30
- You can also install it directly from GitHub:
95
+ `gentle-pi` is deliberately not included in that package-install block: clone and register it through the coexistence setup below, which applies Osdy-specific exclusions instead of adding a duplicate ordinary package entry.
31
96
 
32
97
  ```bash
33
- pi install git:github.com/OsdyOrtiz/Osdy-Pi
98
+ git clone https://github.com/Gentleman-Programming/gentle-pi.git
99
+ osdy-pi gentle setup "$(pwd)/gentle-pi"
34
100
  ```
35
101
 
36
- Then start Pi normally:
102
+ ## Gentle coexistence setup
103
+
104
+ To load a local `gentle-pi` checkout while keeping Osdy Pi's UI authoritative, run:
37
105
 
38
106
  ```bash
39
- pi
107
+ osdy-pi gentle setup /absolute/path/to/gentle-pi
40
108
  ```
41
109
 
42
- Osdy Pi enables the `osdy-pi-dark` theme and custom UI automatically on `session_start`.
110
+ The command validates that the absolute source is a readable `gentle-pi` package with Gentle's todo and agents extensions before atomically updating `$PI_CODING_AGENT_DIR/settings.json` (or `~/.pi/agent/settings.json`). It registers the local package immediately before the first configured Osdy Pi package entry, so Gentle Shell initializes first, with exclusions only for Gentle's `gentle-todo.ts` and `gentle-agents.ts`, plus `themes: []`. Restart Pi or run `/reload` after setup.
43
111
 
44
- ## Choose the theme manually
112
+ Gentle Shell intentionally remains fully active underneath Osdy, including its footer and widgets. While Osdy is enabled, Osdy claims the footer and editor; disabling Osdy restores the editor Gentle Shell provided at session startup. Gentle's changes widget may coexist with Osdy's visual widgets.
45
113
 
46
- If you only want to switch themes, open Pi settings:
114
+ The exclusions prevent Gentle's todo and agents extensions from competing with the suite. `@juicesharp/rpiv-todo` remains the authoritative todo overlay, `pi-subagents-j0k3r` remains the authoritative subagent system, and `@juicesharp/rpiv-ask-user-question` remains the authoritative structured-question plugin; their package entries are left untouched.
47
115
 
48
- ```text
49
- /settings
116
+ ## OpenAI account profiles
117
+
118
+ Osdy Pi can keep multiple ChatGPT Plus/Pro accounts authenticated and let you choose which one starts Pi. `personal` and `work` are only examples—you can create as many named profiles as you need.
119
+
120
+ ### Create and use profiles
121
+
122
+ **In Pi, run `/osdy-account`** to open the complete account manager:
123
+
124
+ | Action | Behavior |
125
+ | --- | --- |
126
+ | **Switch** | Waits for idle, safely replaces Pi's canonical auth with the selected profile, and updates active/default together without restarting Pi. |
127
+ | **Add** | Creates an isolated profile without restarting or changing the default. Select it with **Switch**, then run `/login`. |
128
+ | **Default** | Shows, changes, or clears the profile used by future plain installed `pi` and `npm run pi:dev` launches. It does not switch the current process. |
129
+ | **Rename** | Renames an inactive profile. The default follows the new name when applicable. |
130
+ | **Remove** | Permanently deletes an inactive profile after exact-name confirmation. Removing the default requires a replacement. |
131
+ | **Account info** | Shows the available profiles and marks the active and default profiles without reading credentials. |
132
+
133
+ Pi does not expose a supported API for extensions to invoke its OAuth login dialog. After switching to a newly created profile, run Pi's native `/login` and choose **ChatGPT Plus/Pro (Codex)**. This is the only step that remains a separate Pi command; it does not require leaving Pi or opening another terminal.
134
+
135
+ Terminal commands remain available as recovery and automation alternatives:
136
+
137
+ ```bash
138
+ # Create a profile without launching or changing the default.
139
+ osdy-pi account create personal
140
+
141
+ # Legacy recovery flow: create a profile and open Pi for /login.
142
+ osdy-pi account add work
143
+
144
+ # List profiles, choose the default, or launch one now.
145
+ osdy-pi account list
146
+ osdy-pi account default personal
147
+ osdy-pi account default
148
+ osdy-pi account use personal
149
+
150
+ # Rename a profile, or permanently remove an inactive profile.
151
+ osdy-pi account rename work consulting
152
+ osdy-pi account remove consulting --confirm consulting
153
+
154
+ # Removing the default requires an existing replacement.
155
+ osdy-pi account remove personal --confirm personal --replacement work
156
+
157
+ # Remove the preference without removing any profile.
158
+ osdy-pi account default --clear
50
159
  ```
51
160
 
52
- Then select one of these theme names:
161
+ Profile names accept ASCII letters, numbers, and hyphens, up to 63 characters, preserving their spelling (for example, `Personal` or `WORK`). Spaces, paths, and the reserved names `default`, `profiles`, and `auth.json` (in any casing) are rejected. Profile identity is case-insensitive, so names that differ only by casing cannot coexist. `account add` opens a profile for login but does not change the default.
162
+
163
+ ### See and switch the active account
164
+
165
+ When Pi was launched through a profile, Osdy Pi shows its profile name in the editor:
166
+
167
+ - **Simple/native editor:** beside the model, for example `gpt-5.6-sol · personal · think high`.
168
+ - **Extended/framed editor:** `personal` replaces the `Osdy-Pi` title.
169
+ - **No managed profile:** the existing model line and `Osdy-Pi` title remain unchanged.
170
+
171
+ `account use <name>` activates the profile in Pi's shared agent directory, saves it as active/default, then starts Pi. Inside Pi, `/osdy-account` waits for active work to finish and swaps the canonical `auth.json` in place; the next request resolves the new account without a spawn, shutdown, session handoff, or restart.
172
+
173
+ To resume a specific session directly from the terminal:
174
+
175
+ ```bash
176
+ osdy-pi account use work -- --session /absolute/path/to/session.jsonl
177
+ ```
178
+
179
+ > **Privacy:** each profile keeps a private `auth.json`; Pi runs against its canonical shared `auth.json`. Osdy Pi atomically copies opaque auth files between those private locations only to activate or preserve an account; it never parses, prints, logs, or passes OAuth credentials. Session history, settings, installed packages, and extension resources are shared, so every profile can access that local state. It keeps Pi's canonical `openai-codex` provider and delegates authentication to Pi's built-in `/login` flow.
180
+
181
+ Account switching is serialized in-process and protected by a private cross-process lock. Osdy Pi accepts only bounded regular auth files, refuses symlink-based auth sources, writes replacements with private permissions, and restores the previous canonical auth and account metadata when activation fails. A separate namespace lock protects concurrent profile creation, rename, and removal. Launchers activate the selected auth before starting Pi while continuing to use the shared agent directory; existing managed-directory links from earlier profile layouts are resolved for compatibility.
182
+
183
+ ### Rename and permanently remove profiles
184
+
185
+ Use `osdy-pi account rename <old> <new>` to rename an existing inactive profile. If it was the default, its default selection follows the new name.
186
+
187
+ Use `osdy-pi account remove <name> --confirm <name>` for a non-default profile. This permanently deletes its isolated profile directory. Removing the default additionally requires `--replacement <other>`; the existing, different replacement becomes the default before deletion. A replacement is rejected for non-default removal.
188
+
189
+ Before rename or removal, close this Pi process when it uses the target and **manually close every other Pi process using that target profile**. Osdy Pi does not scan or stop other processes. Inside Pi, use `/osdy-account` (or `/osdy-account rename` / `remove`); the guided flow shows the active profile but refuses changes to it until you Switch first, asks for a new default when needed, and requires typing the exact profile name. Cancellation changes nothing. Do not start two Pi processes with the same `--session` path.
190
+
191
+ ## What ships
192
+
193
+ | Area | Included behavior |
194
+ | --- | --- |
195
+ | Themes | 14 built-in themes, including Osdy, Kanagawa, Dracula, Catppuccin, Matrix, and Lucent Orange palettes |
196
+ | Header and mascot | Independently selectable `osdy-theme`/`neon` headers and `current`/`bts` mascots |
197
+ | Messages | Pi-native, theme-aware user and assistant message cards |
198
+ | Input | Responsive auto editor by default, with selectable simple Pi-native or extended framed modes |
199
+ | Status | Custom working spinner, responsive footer metrics, dynamic extension statuses, and Codex subscription quota with low-capacity emphasis |
200
+ | Git | Working-tree summary and a centered, filterable diff panel |
201
+ | Audio | Optional event sounds on macOS and Windows |
202
+
203
+ <img width="1280" height="433" alt="Osdy Pi header and editor" src="https://github.com/user-attachments/assets/20c7624d-9ad8-4494-97fb-6b6d81aaf328" />
204
+
205
+ ## Appearance
206
+
207
+ ### Themes
208
+
209
+ | Theme | Use |
210
+ | --- | --- |
211
+ | `osdy-pi-new` | Landing palette: cyan, violet, silver, and navy. |
212
+ | `osdy-pi-dark` | Dark alternative. |
213
+ | `osdy-pi-sexy` | Gentleman neon pink palette. |
214
+ | `osdy-pi-tokyo-night` | Tokyo Night dark palette. |
215
+ | `osdy-pi-kanagawa-wave` | Kanagawa Wave dark palette. |
216
+ | `osdy-pi-kanagawa-dragon` | Kanagawa Dragon dark palette. |
217
+ | `osdy-pi-kanagawa-lotus` | Kanagawa Lotus light palette. |
218
+ | `osdy-pi-dracula` | Dracula Classic dark palette. |
219
+ | `osdy-pi-catppuccin-latte` | Catppuccin Latte light palette. |
220
+ | `osdy-pi-catppuccin-frappe` | Catppuccin Frappé dark palette. |
221
+ | `osdy-pi-catppuccin-macchiato` | Catppuccin Macchiato dark palette. |
222
+ | `osdy-pi-catppuccin-mocha` | Catppuccin Mocha dark palette. |
223
+ | `osdy-pi-matrix` | OpenCode Matrix dark palette. |
224
+ | `osdy-pi-lucent-orange` | Lucent Orange dark palette with terminal-background passthrough. |
225
+
226
+ Osdy Pi preserves your selected Pi theme when it enables, reapplies, or disables its UI. Choose any theme in Pi:
53
227
 
54
228
  ```text
55
- osdy-pi-dark
56
- osdy-pi-light
57
- osdy-pi-simple
229
+ /settings
58
230
  ```
59
231
 
60
- You can also set it in your Pi `settings.json`:
232
+ Or set the theme in Pi's `settings.json`:
61
233
 
62
234
  ```json
63
235
  {
64
- "theme": "osdy-pi-dark"
236
+ "theme": "osdy-pi-sexy"
65
237
  }
66
238
  ```
67
239
 
68
- Use `osdy-pi-light` if you prefer the light version, or `osdy-pi-simple` if you want the blue/red/slate palette across the whole console.
240
+ ### Header, mascot, and animation
241
+
242
+ Header and mascot choices are independent:
243
+
244
+ | Element | Choices | Command |
245
+ | --- | --- | --- |
246
+ | Header | `osdy-theme` (default), `neon` | `/osdy-pi header osdy-theme|neon` |
247
+ | Mascot | `current` (default), `bts` | `/osdy-pi mascot current|bts` |
248
+
249
+ Both commands update the UI immediately. Add `status` instead of a choice to inspect the current selection. Choices persist in the global Osdy Pi settings across reloads and sessions. The old top-level style commands and `classic` header aliases are no longer registered.
250
+
251
+ In normal mode, the selected header and mascot render side by side. The Neon header derives its highlights from the active theme rather than using one fixed palette. Each mascot keeps its own tone map while its animated edge glow can resolve through theme colors. Header and mascot scaling remain independent, so any combination follows the same responsive layout rules.
252
+
253
+ Animation is enabled by default with an intro animation. Configure it through `OSDY_PI_ANIMATION`:
254
+
255
+ | Value | Result |
256
+ | --- | --- |
257
+ | `0`, `off` | Static art |
258
+ | `1`, `on`, `continuous` | Continuous animation |
259
+ | `intro` | Intro animation, then static art |
260
+
261
+ ### Responsive layout
262
+
263
+ | Terminal mode | Header and mascot | Editor and Git | Footer |
264
+ | --- | --- | --- | --- |
265
+ | Normal | Full selected header and mascot side by side | Auto mode shows the framed editor by default; simple selects Pi's native editor and extended selects the framed editor; Git summary when enabled | Native editor: model/thinking, usage, path/branch, then statuses; framed editor: path/branch then statuses |
266
+ | Compact (72+ columns) | Proportionally scaled mascot above a readable header, reduced only when needed | Selected editor mode and Git behavior | Same editor-aware footer behavior as normal/small modes |
267
+ | Small (<72 columns) | Mascot only; art and tone map scale proportionally | Pi native editor for every editor mode; Git summary hidden | Model + styled thinking level, usage, path/branch, then dynamic extension statuses (except Pi Lens) |
268
+
269
+ In the extended framed editor, the active thinking level is rendered in bold in the top-right model metadata so it remains easy to scan.
270
+
271
+ Small and compact modes trim only fully empty mascot-art and tone-map margins before applying one proportional width-and-height scale; mascot width starts near four-fifths of the available width. The header moves below the mascot as soon as side-by-side width would force the mascot into an additional width-limited reduction. Compact headers retain their source art when it fits and reduce proportionally only when a width or row bound requires it. Compact headers and mascots share a bounded terminal-row budget, so the header is omitted rather than collapsed into an unreadable one-row logo when there is not enough vertical space. The small-mode footer places the model and styled bare thinking level above usage, path/branch, and dynamic extension statuses. Pi Lens's footer status is hidden in small mode, but Pi Lens continues running. Usage includes input/output/cache-read/cache-write tokens, cost, and context. Extension statuses are supplied dynamically by Pi/extensions and may include Osdy Pi, MCP, or LSP; they are not hardcoded.
272
+
273
+ The enabled state, editor mode, working-tree visibility preference, header, and mascot persist globally across Pi reloads and sessions, shared by all projects. They are saved in `$PI_CODING_AGENT_DIR/extensions/osdy-pi/settings.json`, or `~/.pi/agent/extensions/osdy-pi/settings.json` when `PI_CODING_AGENT_DIR` is unset. Existing settings without the new visual fields safely default to `osdy-theme` and `current`; the former `raccoon` mascot value migrates to `bts`. The selected editor mode and working-tree placement are restored when the terminal moves normal → small → normal.
69
274
 
70
275
  ## Commands
71
276
 
72
- Osdy Pi includes a small command group:
277
+ | Group | Command |
278
+ | --- | --- |
279
+ | Main | `/osdy-pi` |
280
+ | Main | `/osdy-pi enable\|disable\|on\|off\|status` |
281
+ | Accounts | `/osdy-account` |
282
+ | Header | `/osdy-pi header osdy-theme\|neon\|status` |
283
+ | Mascot | `/osdy-pi mascot current\|bts\|status` |
284
+ | Editor | `/osdy-pi editor auto\|extended\|simple\|on\|off\|toggle\|status` |
285
+ | Working tree | `/osdy-pi working-tree on\|off\|toggle\|status` |
286
+ | Working tree | `/osdy-pi working-tree position top\|bottom\|status` |
287
+ | Audio | `/osdy-pi sound setup` |
288
+ | Diff | `/osdy-pi diff` |
289
+ | Codex subscription | `/usage` |
73
290
 
74
- ```text
75
- /osdy-pi enable
76
- /osdy-pi disable
77
- /osdy-pi status
78
- /osdy-pi sound setup
79
- /osdy-pi working-tree on
80
- /osdy-pi working-tree off
81
- /osdy-pi working-tree toggle
82
- /osdy-pi working-tree status
83
- /osdy-pi working-tree position top
84
- /osdy-pi working-tree position bottom
85
- /osdy-pi diff
86
- /osdy-pi osdy-theme
87
- /osdy-pi classic
88
- /osdy-pi-osdy-theme
89
- /osdy-pi-classic
90
- ```
291
+ `/osdy-pi` reports status. `enable` (or `on`) applies the Osdy Pi UI without changing the selected Pi theme; `disable` (or `off`) restores the Gentle Shell or Pi UI captured at session startup while preserving that theme. The enabled state, editor mode, working-tree visibility, and sound configuration persist globally.
91
292
 
92
- - `enable` applies the dark Osdy theme, custom header, custom editor, and clean layout.
93
- - `disable` restores Pi's built-in header, editor, footer, and working visibility, then switches back to the previous theme or `dark`.
94
- - `status` shows whether the Osdy Pi UI is currently enabled, including the active style.
95
- - `sound setup` opens the guided global sound-setup wizard for audio notifications.
96
- - `working-tree on|off|toggle|status` controls the persistent git working-tree summary widget.
97
- - `working-tree position top|bottom` moves the summary widget above or below the editor.
98
- - `diff` opens a floating centered diff window to inspect the current per-file diff without leaving Pi.
99
- - `osdy-theme` is the default OsdyTheme header with pink, cyan, and purple styling, plus the mascot glow on the right edge.
100
- - `classic` keeps the previous classic header shape with the shared mascot.
101
- - `/osdy-pi-osdy-theme` and `/osdy-pi-classic` are direct aliases.
293
+ ### Codex subscription usage
102
294
 
103
- After changing a local extension, run `/reload` or restart Pi so the updated commands are registered.
295
+ Run `/usage` to open the Codex subscription dashboard for the active managed `openai-codex` profile and model. Press `r` to refresh; `esc` or `q` closes it. The dashboard shows these controls at the bottom.
104
296
 
105
- ### Working tree widget
297
+ The main windows are labeled **Session** and **Weekly** (the API/domain remains primary/secondary). Their remaining-capacity bars are full at 100% remaining and empty at 0%; labels use the active theme's bold accent, Session uses the accent fill, Weekly uses `mdLink`, and empty segments are muted. The remaining percentage stays muted above 40%, changes to the theme's warning color at 40% or less, and changes to its error color at 15% or less. The same thresholds apply in the `/usage` dashboard and compact footer/editor quota bars. A double themed frame, section dividers, and spacing separate the display. Detail cards show each duration and relative, local, and UTC reset times. Plan, availability, credits/reset count, and additional buckets appear only when the service supplies them; absent optional values are omitted.
106
298
 
107
- Osdy Pi can show a persistent git working-tree summary above or below the editor.
299
+ At wide widths, the modal pairs the Session and Weekly detail cards. Below 72 content columns, cards and bars stack and account/model data wraps. The native footer and extended editor also show compact Session/Weekly remaining-capacity bars below model and thinking metadata whenever a current Codex snapshot exists. Wide widths combine those bars; narrow widths stack them. Additional buckets appear only in `/usage`.
108
300
 
109
- Current behavior:
301
+ Usage loads once when the session starts and refreshes when the modal opens or `r` is pressed; it does not poll. A refresh clears the previous snapshot before authentication resolves, and shutdown clears state, so quota data cannot cross account or profile boundaries.
110
302
 
111
- - shows file count, `+/-` totals, and staged/unstaged/new counts;
112
- - previews the top changed files;
113
- - refreshes automatically when Pi finishes mutating tools such as `edit`, `write`, `ast_grep_replace`, or `bash`;
114
- - is intentionally scoped to changes observed during Pi-driven work for now.
303
+ > **Privacy:** OAuth is resolved only through Pi's `modelRegistry`. Osdy Pi does not read `auth.json`, persist or log credentials, or display account IDs, tokens, response bodies, or endpoint internals in the UI. Requests use a fixed HTTPS endpoint with bounded timeout, response size, and redirects.
115
304
 
116
- Use these commands to control it:
305
+ ## Native message cards
117
306
 
118
- ```text
119
- /osdy-pi working-tree on
120
- /osdy-pi working-tree off
121
- /osdy-pi working-tree toggle
122
- /osdy-pi working-tree status
123
- /osdy-pi working-tree position top
124
- /osdy-pi working-tree position bottom
125
- /osdy-pi diff
126
- ```
307
+ Osdy Pi delegates conversation rendering to Pi's native message-card components. It does not install a Markdown transformer or inject card markup into assistant responses. This preserves Pi's own streaming, selection, and Markdown behavior while allowing every bundled Osdy theme to style the native cards.
127
308
 
128
- The `/osdy-pi diff` viewer now opens in the most viable floating-window form for Osdy Pi: a centered floating dialog with a selector step and a patch step.
309
+ User and assistant cards have separate background, text, and accent tokens. Assistant accents follow each theme's primary accent; user accents are white for a consistent visual distinction. Disabling Osdy Pi continues to restore the underlying Gentle Shell or Pi presentation normally.
129
310
 
130
- 1. select a changed file in the floating window
131
- 2. open its patch in the same centered floating window
132
- 3. return with `esc` / `backspace` or close with `q`
311
+ ## Editor and working indicator
133
312
 
134
- Controls:
313
+ The default `auto` editor mode preserves the responsive behavior: it uses the framed editor when space permits and Pi's native editor on small terminals. Select `simple` for Pi's native editor at every width, or `extended` to request the framed editor explicitly: `/osdy-pi editor auto|extended|simple`. Simple mode actually unmounts the custom editor component rather than hiding it. Small terminals always use Pi's native editor, including when `extended` is selected. The legacy commands remain compatible where feasible: `on` maps to `extended`, `off` maps to `simple`, and `toggle` switches between extended and simple.
135
314
 
136
- - selector: type to filter, `↑` / `↓` or `j` / `k`, then `enter` or `→`
137
- - patch view: `PgUp` / `PgDn`
138
- - back: `esc` / `backspace` or `←`
139
- - close: `q`
315
+ In auto or extended mode at a non-small width, the framed editor shows the model and thinking level in its title and session usage in its footer. For an account-profile launch, the left title shows the active profile name instead of `Osdy-Pi`. When the native editor is effective (simple mode or any small terminal), the Osdy footer instead shows model, active profile when present, thinking, and usage rows before its path/branch and status rows. It uses the currently active Pi/Osdy theme palette; no separate editor theme selector exists. Usage covers input, output, cache read, cache write when present, cost, and context. If Pi supports autocomplete, the editor uses Pi's native autocomplete rendering while the completion UI is visible.
140
316
 
141
- ## Audio notifications
317
+ A custom spinner appears above the editor while work is active. Osdy Pi hides Pi's built-in working row while enabled to avoid a duplicate indicator.
142
318
 
143
- Osdy Pi can play your own sound files for these product-level events:
319
+ ## Working tree and diff
144
320
 
145
- - `completion`: the full orchestrator flow finishes and Pi returns control to input.
146
- - `error`: a real tool execution failure occurs during the flow.
147
- - `permission`: reserved for future explicit Pi approval hooks, dormant by default today.
148
- - `question`: reserved for future explicit Pi question hooks, dormant by default today.
321
+ The working-tree summary is enabled by default. It reads the repository state at session start, including existing changes, and reports staged, unstaged, and untracked counts with total `+/-` changes. It also has clean and unavailable states. `working-tree off` unregisters the widget completely, and a persisted disabled preference leaves it unmounted when the next session starts. `working-tree on` remounts and refreshes it without requiring a restart. After successful `edit`, `write`, `ast_grep_replace`, or `bash` tool execution, it refreshes.
149
322
 
150
- Initial audio playback support is implemented for:
323
+ Use `working-tree position top` or `bottom` to place the summary above or below the editor. The widget supplies trailing blank space and adds leading separation when it is below the editor or the spinner is active, keeping the surrounding layout readable without promising a fixed number of blank lines in every state.
151
324
 
152
- - macOS
153
- - Windows
325
+ `/osdy-pi diff` opens a centered diff panel. Type to filter paths, then inspect staged, unstaged, or untracked patches for a file.
154
326
 
155
- Unsupported platforms fall back safely without crashing Osdy Pi.
327
+ | Action | Controls |
328
+ | --- | --- |
329
+ | Move selection | Arrow keys or `j` / `k` |
330
+ | Open a patch | `enter`, `right`, `space`, or `l` |
331
+ | Scroll a patch | `PgUp` / `PgDn` (or `space` forward) |
332
+ | Go back | `esc`, `backspace`, `left`, or `h` |
333
+ | Close | `q` or `ctrl+c` |
156
334
 
157
- ### Supported files
335
+ ## Audio notifications
158
336
 
159
- Only readable `.mp3` and `.wav` files are accepted.
337
+ Osdy Pi can play readable `.mp3` or `.wav` files on macOS and Windows. Other platforms safely skip playback. macOS playback requires the system `afplay` command; Windows playback requires `powershell.exe` and the Windows Media Player COM component (`WMPlayer.OCX`).
160
338
 
161
- ### Configure sounds
339
+ | Event | Current meaning |
340
+ | --- | --- |
341
+ | `completion` | An agent run ends. |
342
+ | `error` | The first failed tool execution in an agent run. |
343
+ | `permission` | Hook is available but dormant until an explicit Pi approval integration uses it. |
344
+ | `question` | Hook is available but dormant until an explicit Pi question integration uses it. |
162
345
 
163
- The preferred setup path is the guided Osdy Pi wizard:
346
+ Run the guided wizard:
164
347
 
165
348
  ```text
166
349
  /osdy-pi sound setup
167
350
  ```
168
351
 
169
- The wizard:
170
-
171
- - walks through `completion`, `error`, `permission`, and `question`;
172
- - lets you keep, replace, clear, or skip each event;
173
- - validates every selected path before save;
174
- - blocks save if any selected file is missing, unreadable, not a regular file, or not `.mp3`/`.wav`;
175
- - stores accepted settings globally at `~/.pi/agent/extensions/osdy-pi/audio-notifications.json` (or `$PI_CODING_AGENT_DIR/extensions/osdy-pi/audio-notifications.json` when that env var is set).
352
+ It configures `completion`, `error`, `permission`, and `question`; validates selected readable audio files; and saves global settings to `~/.pi/agent/extensions/osdy-pi/audio-notifications.json`, or `$PI_CODING_AGENT_DIR/extensions/osdy-pi/audio-notifications.json` when `PI_CODING_AGENT_DIR` is set.
176
353
 
177
- Saved global sound paths apply across restarts and projects that use Osdy Pi.
178
-
179
- ### Startup flags still work
180
-
181
- You can still pass sound paths as Pi flags when starting the session:
354
+ Startup flags can override a saved path per event:
182
355
 
183
356
  ```bash
184
357
  pi \
@@ -188,63 +361,55 @@ pi \
188
361
  --osdy-pi-sound-question /absolute/path/question.wav
189
362
  ```
190
363
 
191
- Precedence is per event:
364
+ Precedence is startup flag, then saved global setting, then unconfigured. Empty flags do not override saved settings; relative startup paths resolve from the current working directory, while the wizard saves normalized absolute paths. Missing, unreadable, or unsupported files are skipped safely.
192
365
 
193
- 1. startup flag
194
- 2. saved global Osdy Pi setting
195
- 3. unconfigured
366
+ ## Local install and development
196
367
 
197
- Notes:
368
+ For the normal in-Pi development flow, no global `osdy-pi` link is required:
198
369
 
199
- - Empty or omitted flags mean that event does not override the saved global setting.
200
- - Relative startup-flag paths resolve from the current working directory.
201
- - The setup wizard saves normalized absolute paths for global settings.
202
- - `~` expands to your home directory.
203
- - Invalid, unreadable, or unsupported files are skipped at playback time without changing existing UI behavior.
204
- - If a file was valid when saved but later disappears or becomes unreadable, Osdy Pi fails safely and skips playback for that event.
205
- - Audio notifications and sound setup are additive only, they do not change the current header, editor, footer, working indicator, theme, or commands.
370
+ 1. Install the checkout's dependencies:
206
371
 
207
- ## Local install
372
+ ```bash
373
+ npm install
374
+ ```
208
375
 
209
- If you cloned this repository and want to test it locally without colliding with an already installed global `osdy-pi`, use the isolated dev launcher:
376
+ 2. Start the local extension:
210
377
 
211
- ```bash
212
- npm run pi:dev
213
- ```
378
+ ```bash
379
+ npm run pi:dev
380
+ ```
214
381
 
215
- This command runs `pi -e .` with `PI_CODING_AGENT_DIR=.pi-dev`, so it uses a separate local Pi config/package/extensions directory and does not load your global installed `osdy-pi` package.
382
+ 3. Inside Pi, run `/osdy-account`.
383
+ 4. Choose **Add**, enter a profile name, then choose **Switch** and select it.
384
+ 5. Without restarting, run `/login` and choose **ChatGPT Plus/Pro (Codex)**.
385
+ 6. From then on, `npm run pi:dev` starts the default profile automatically. Use `/osdy-account` for every profile-management action.
216
386
 
217
- You can still launch it manually if needed:
387
+ The terminal interface remains available for recovery and automated testing:
218
388
 
219
389
  ```bash
220
- PI_CODING_AGENT_DIR="$PWD/.pi-dev" pi -e .
390
+ npm run pi:dev -- account create personal
391
+ npm run pi:dev -- account list
392
+ npm run pi:dev -- account use personal
393
+ npm run pi:dev -- account default personal
394
+ npm run pi:dev -- account rename personal private
395
+ npm run pi:dev -- account remove private --confirm private
221
396
  ```
222
397
 
223
- To install it from a local path:
398
+ `npm run pi:dev` launches `pi -e <absolute repository root>` with `PI_CODING_AGENT_DIR=<absolute repository root>/.pi-dev`. If its `.pi-dev` metadata names a valid profile, it activates that profile's auth before launching Pi and retains `-e <absolute repository root>`. The development `.pi-dev` profile store and the installed Pi profile store are separate. Account commands use this checkout's local launcher, so no global `osdy-pi` link is needed. The development extension root remains loaded after an in-process `/osdy-account` switch. The manual equivalent is:
224
399
 
225
400
  ```bash
226
- pi install /absolute/path/to/Osdy-Pi
401
+ PI_CODING_AGENT_DIR="$PWD/.pi-dev" OSDY_PI_DEV_EXTENSION_ROOT="$PWD" pi -e "$PWD"
227
402
  ```
228
403
 
229
- ![Osdy Pi preview](https://raw.githubusercontent.com/OsdyOrtiz/Osdy-Pi/main/mapche1.png)
230
-
231
- ## Package contents
404
+ Install a local checkout into Pi with:
232
405
 
233
- ```text
234
- themes/osdy-pi-dark.json
235
- themes/osdy-pi-light.json
236
- themes/osdy-pi-simple.json
237
- extensions/osdy-pi.ts
238
- extensions/osdy-pi/
406
+ ```bash
407
+ pi install /absolute/path/to/Osdy-Pi
239
408
  ```
240
409
 
241
- `extensions/osdy-pi.ts` is the package entrypoint. The implementation lives in the modular `extensions/osdy-pi/` folder (runtime, UI, metrics, working controller, animation, border, and formatting helpers).
242
-
243
- The Pi manifest is declared in `package.json` through `pi.themes` and `pi.extensions`, so Pi can discover the themes and extension after installation.
410
+ After changing a local extension, run `/reload` or restart Pi.
244
411
 
245
- ## Development
246
-
247
- If you are working on the package locally, you can run:
412
+ For package checks and local development:
248
413
 
249
414
  ```bash
250
415
  npm run typecheck
@@ -252,16 +417,29 @@ npm run lint
252
417
  npm run pi:dev
253
418
  ```
254
419
 
255
- ## Uninstall or turn off
420
+ ![Osdy Pi preview](https://raw.githubusercontent.com/OsdyOrtiz/Osdy-Pi/main/mapche1.png)
421
+
422
+ ## Limits and troubleshooting
423
+
424
+ - The custom UI requires a Pi session with a UI; otherwise it does not mount.
425
+ - A compact terminal stacks a scaled mascot over a source-size header when it fits, reducing the header only when needed; below 72 columns it switches to mascot-only, native editor, and no Git summary until space returns.
426
+ - The Git summary reports unavailable when Git commands cannot read a working tree.
427
+ - Diff patches depend on readable repository files; a file whose patch cannot load shows the reported error in the panel.
428
+ - Audio playback is limited to macOS and Windows and to readable `.mp3`/`.wav` files.
429
+ - `/usage` requires an active `openai-codex` login. Run `/login` and choose **ChatGPT Plus/Pro (Codex)**; run `/reload` after local extension changes.
430
+ - A `401` indicates an expired session, while a `403` means usage is unavailable. Optional backend fields may be absent and simply do not render.
431
+
432
+ ## Disable, uninstall, and license
256
433
 
257
- To temporarily turn off the custom UI inside Pi:
434
+ Turn off the custom UI persistently (including across `/reload`):
258
435
 
259
436
  ```text
260
437
  /osdy-pi disable
438
+ # Alias: /osdy-pi off
261
439
  ```
262
440
 
263
- To remove the package completely, use Pi's package management command for installed packages.
441
+ Restore it with `/osdy-pi enable` or `/osdy-pi on`.
264
442
 
265
- ## License
443
+ To remove the package, use Pi's package-management command for installed packages.
266
444
 
267
445
  MIT