@pi-unipi/info-screen 0.1.21 → 2.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.
- package/README.md +17 -31
- package/core-groups.ts +3 -2
- package/index.ts +10 -9
- package/package.json +1 -1
- package/registry.ts +3 -4
package/README.md
CHANGED
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
# @pi-unipi/info-screen
|
|
2
2
|
|
|
3
|
-
Dashboard
|
|
3
|
+
Dashboard overlay that shows what's running. Displays module status, registered tools, custom data groups, and load times in a tabbed interface.
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pi install npm:@pi-unipi/info-screen
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Or as part of the full suite:
|
|
12
|
-
```bash
|
|
13
|
-
pi install npm:unipi
|
|
14
|
-
```
|
|
5
|
+
Every Unipi module registers itself via `MODULE_READY` events. Info-screen picks these up and builds a live dashboard. Other packages add their own data groups — ralph shows active loops, memory shows counts, compactor shows token savings.
|
|
15
6
|
|
|
16
7
|
## Commands
|
|
17
8
|
|
|
@@ -20,18 +11,11 @@ pi install npm:unipi
|
|
|
20
11
|
| `/unipi:info` | Show info screen dashboard |
|
|
21
12
|
| `/unipi:info-settings` | Configure info display (groups, stats, visibility) |
|
|
22
13
|
|
|
23
|
-
##
|
|
14
|
+
## Special Triggers
|
|
24
15
|
|
|
25
|
-
-
|
|
26
|
-
- **Tabbed groups** — each module registers info groups with custom data providers
|
|
27
|
-
- **Configurable** — per-group and per-stat visibility via settings
|
|
28
|
-
- **Boot overlay** — shows dashboard on session start (configurable)
|
|
29
|
-
- **Styled dialog chrome** — uses pi-tui theme API for consistent borders, scrollable content, and navigation hints (matching the overlay style used by @pi-unipi/btw)
|
|
30
|
-
- **Core groups** — modules, tools, load time, session info out of the box
|
|
16
|
+
Info-screen listens for `MODULE_READY` events from `@pi-unipi/core`. When a module loads, info-screen adds it to the modules group automatically. No registration needed for basic module tracking.
|
|
31
17
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
Other modules register info groups via the global registry:
|
|
18
|
+
Packages that want custom data groups use the registry API:
|
|
35
19
|
|
|
36
20
|
```typescript
|
|
37
21
|
import { infoRegistry } from "@pi-unipi/info-screen";
|
|
@@ -55,11 +39,9 @@ infoRegistry.registerGroup({
|
|
|
55
39
|
});
|
|
56
40
|
```
|
|
57
41
|
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
### `infoRegistry`
|
|
42
|
+
The footer package reads info-screen data for its extension status segment.
|
|
61
43
|
|
|
62
|
-
|
|
44
|
+
## Registry API
|
|
63
45
|
|
|
64
46
|
| Method | Description |
|
|
65
47
|
|--------|-------------|
|
|
@@ -72,12 +54,13 @@ Singleton registry instance. Also available globally via `globalThis.__unipi_inf
|
|
|
72
54
|
| `getVisibleStats(id)` | Get enabled stats for a group |
|
|
73
55
|
| `invalidateCache(id)` | Invalidate cached data |
|
|
74
56
|
|
|
57
|
+
The registry is a singleton, also available globally via `globalThis.__unipi_info_registry`.
|
|
58
|
+
|
|
75
59
|
### Load Tracking
|
|
76
60
|
|
|
77
61
|
```typescript
|
|
78
62
|
import { startLoadTracking, recordLoadTime, finishLoadTracking, recordModuleStart } from "@pi-unipi/info-screen";
|
|
79
63
|
|
|
80
|
-
// Track module load times
|
|
81
64
|
startLoadTracking();
|
|
82
65
|
recordModuleStart("@pi-unipi/memory");
|
|
83
66
|
// ... module loads ...
|
|
@@ -85,9 +68,9 @@ recordLoadTime("@pi-unipi/memory", "module", 150);
|
|
|
85
68
|
finishLoadTracking();
|
|
86
69
|
```
|
|
87
70
|
|
|
88
|
-
##
|
|
71
|
+
## Configurables
|
|
89
72
|
|
|
90
|
-
|
|
73
|
+
Settings in pi `settings.json`:
|
|
91
74
|
|
|
92
75
|
```json
|
|
93
76
|
{
|
|
@@ -106,9 +89,12 @@ Configure in pi `settings.json`:
|
|
|
106
89
|
}
|
|
107
90
|
```
|
|
108
91
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
92
|
+
| Setting | Default | What It Does |
|
|
93
|
+
|---------|---------|--------------|
|
|
94
|
+
| `showOnBoot` | true | Show dashboard when session starts |
|
|
95
|
+
| `bootTimeoutMs` | 8000 | How long to wait for modules before showing |
|
|
96
|
+
| `groups.{id}.show` | true | Toggle group visibility |
|
|
97
|
+
| `groupOrder` | priority sort | Custom group ordering |
|
|
112
98
|
|
|
113
99
|
## License
|
|
114
100
|
|
package/core-groups.ts
CHANGED
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
import { readFileSync, readdirSync, existsSync, statSync } from "node:fs";
|
|
9
9
|
import { join, basename } from "node:path";
|
|
10
10
|
import { homedir } from "node:os";
|
|
11
|
+
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
11
12
|
import { infoRegistry } from "./registry.js";
|
|
12
13
|
import { parseUsageStats, formatTokens, formatCost } from "./usage-parser.js";
|
|
13
14
|
import type { InfoGroup } from "./types.js";
|
|
@@ -309,12 +310,12 @@ const registeredTools: Array<{ name: string; source: string }> = [];
|
|
|
309
310
|
/**
|
|
310
311
|
* Reference to pi API for getting tools.
|
|
311
312
|
*/
|
|
312
|
-
let piApi:
|
|
313
|
+
let piApi: ExtensionAPI | null = null;
|
|
313
314
|
|
|
314
315
|
/**
|
|
315
316
|
* Set the pi API reference.
|
|
316
317
|
*/
|
|
317
|
-
export function setPiApi(api:
|
|
318
|
+
export function setPiApi(api: ExtensionAPI): void {
|
|
318
319
|
piApi = api;
|
|
319
320
|
}
|
|
320
321
|
|
package/index.ts
CHANGED
|
@@ -9,8 +9,8 @@
|
|
|
9
9
|
* /unipi:info-settings - Configure info display
|
|
10
10
|
*/
|
|
11
11
|
|
|
12
|
-
import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
|
|
13
|
-
import { UNIPI_EVENTS, MODULES, UNIPI_PREFIX, emitEvent, getPackageVersion } from "@pi-unipi/core";
|
|
12
|
+
import type { ExtensionAPI, ExtensionContext } from "@mariozechner/pi-coding-agent";
|
|
13
|
+
import { UNIPI_EVENTS, MODULES, UNIPI_PREFIX, emitEvent, getPackageVersion, type UnipiModuleEvent, type UnipiInfoGroupEvent } from "@pi-unipi/core";
|
|
14
14
|
import { infoRegistry } from "./registry.js";
|
|
15
15
|
import { registerCoreGroups, trackModule, trackTool, setPiApi, registerSkillDir, startLoadTracking, recordLoadTime, finishLoadTracking, recordModuleStart } from "./core-groups.js";
|
|
16
16
|
|
|
@@ -69,7 +69,8 @@ export default function (pi: ExtensionAPI) {
|
|
|
69
69
|
}
|
|
70
70
|
|
|
71
71
|
// Listen for module announcements — track and trigger reactive updates
|
|
72
|
-
pi.events.on(UNIPI_EVENTS.MODULE_READY, (
|
|
72
|
+
pi.events.on(UNIPI_EVENTS.MODULE_READY, (data) => {
|
|
73
|
+
const event = data as UnipiModuleEvent;
|
|
73
74
|
if (event.name && event.name !== MODULES.INFO_SCREEN) {
|
|
74
75
|
moduleReadyBatch.push({
|
|
75
76
|
name: event.name,
|
|
@@ -84,7 +85,7 @@ export default function (pi: ExtensionAPI) {
|
|
|
84
85
|
}
|
|
85
86
|
});
|
|
86
87
|
|
|
87
|
-
pi.events.on(UNIPI_EVENTS.INFO_GROUP_REGISTERED, (
|
|
88
|
+
pi.events.on(UNIPI_EVENTS.INFO_GROUP_REGISTERED, (_data) => {
|
|
88
89
|
// Group already registered via globalThis in registerGroup()
|
|
89
90
|
});
|
|
90
91
|
|
|
@@ -104,9 +105,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
104
105
|
* Cache-first: opens with whatever data is cached (even empty).
|
|
105
106
|
* Background: each group fetches independently, overlay re-renders reactively.
|
|
106
107
|
*/
|
|
107
|
-
function showOverlay(ctx:
|
|
108
|
-
ctx.ui.custom(
|
|
109
|
-
(tui
|
|
108
|
+
function showOverlay(ctx: ExtensionContext): void {
|
|
109
|
+
ctx.ui.custom<void>(
|
|
110
|
+
(tui, theme, _keybindings, done) => {
|
|
110
111
|
const overlay = new InfoOverlay();
|
|
111
112
|
overlay.setTheme(theme);
|
|
112
113
|
overlay.onClose = () => {
|
|
@@ -126,9 +127,9 @@ export default function (pi: ExtensionAPI) {
|
|
|
126
127
|
{
|
|
127
128
|
overlay: true,
|
|
128
129
|
overlayOptions: {
|
|
129
|
-
width: "80%",
|
|
130
|
+
width: "80%" as const,
|
|
130
131
|
minWidth: 60,
|
|
131
|
-
anchor: "center",
|
|
132
|
+
anchor: "center" as const,
|
|
132
133
|
margin: 2,
|
|
133
134
|
},
|
|
134
135
|
}
|
package/package.json
CHANGED
package/registry.ts
CHANGED
|
@@ -263,10 +263,9 @@ class InfoRegistry {
|
|
|
263
263
|
export const infoRegistry = new InfoRegistry();
|
|
264
264
|
|
|
265
265
|
// Expose globally so other modules can access without direct imports
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
globalObj.__unipi_info_registry = infoRegistry;
|
|
266
|
+
if (!globalThis.__unipi_info_registry) {
|
|
267
|
+
globalThis.__unipi_info_registry = infoRegistry;
|
|
269
268
|
}
|
|
270
269
|
export const getGlobalRegistry = (): InfoRegistry => {
|
|
271
|
-
return
|
|
270
|
+
return (globalThis.__unipi_info_registry as InfoRegistry | undefined) ?? infoRegistry;
|
|
272
271
|
};
|