@pi-unipi/info-screen 0.1.8 → 0.1.10

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 ADDED
@@ -0,0 +1,114 @@
1
+ # @pi-unipi/info-screen
2
+
3
+ Dashboard and module registry for [Unipi](https://github.com/Neuron-Mr-White/unipi). Shows a configurable info overlay on boot with tabbed groups from all registered modules.
4
+
5
+ ## Install
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
+ ```
15
+
16
+ ## Commands
17
+
18
+ | Command | Description |
19
+ |---------|-------------|
20
+ | `/unipi:info` | Show info screen dashboard |
21
+ | `/unipi:info-settings` | Configure info display (groups, stats, visibility) |
22
+
23
+ ## Features
24
+
25
+ - **Module discovery** — listens for `MODULE_READY` events, tracks all registered modules
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
+ - **Core groups** — modules, tools, load time, session info out of the box
30
+
31
+ ## Registering a Group
32
+
33
+ Other modules register info groups via the global registry:
34
+
35
+ ```typescript
36
+ import { infoRegistry } from "@pi-unipi/info-screen";
37
+
38
+ infoRegistry.registerGroup({
39
+ id: "my-module",
40
+ name: "My Module",
41
+ icon: "📦",
42
+ priority: 60,
43
+ config: {
44
+ showByDefault: true,
45
+ stats: [
46
+ { id: "status", label: "Status", show: true },
47
+ { id: "count", label: "Count", show: true },
48
+ ],
49
+ },
50
+ dataProvider: async () => ({
51
+ status: { value: "running" },
52
+ count: { value: "42", detail: "items processed" },
53
+ }),
54
+ });
55
+ ```
56
+
57
+ ## API
58
+
59
+ ### `infoRegistry`
60
+
61
+ Singleton registry instance. Also available globally via `globalThis.__unipi_info_registry`.
62
+
63
+ | Method | Description |
64
+ |--------|-------------|
65
+ | `registerGroup(group)` | Register an info group |
66
+ | `unregisterGroup(id)` | Remove a group |
67
+ | `getGroups()` | Get visible groups (sorted by priority) |
68
+ | `getAllGroups()` | Get all groups (including hidden) |
69
+ | `getGroupData(id)` | Get data for a group (cached) |
70
+ | `updateGroupData(id, data)` | Manually update group data |
71
+ | `getVisibleStats(id)` | Get enabled stats for a group |
72
+ | `invalidateCache(id)` | Invalidate cached data |
73
+
74
+ ### Load Tracking
75
+
76
+ ```typescript
77
+ import { startLoadTracking, recordLoadTime, finishLoadTracking, recordModuleStart } from "@pi-unipi/info-screen";
78
+
79
+ // Track module load times
80
+ startLoadTracking();
81
+ recordModuleStart("@pi-unipi/memory");
82
+ // ... module loads ...
83
+ recordLoadTime("@pi-unipi/memory", "module", 150);
84
+ finishLoadTracking();
85
+ ```
86
+
87
+ ## Settings
88
+
89
+ Configure in pi `settings.json`:
90
+
91
+ ```json
92
+ {
93
+ "unipi": {
94
+ "infoScreen": {
95
+ "showOnBoot": true,
96
+ "bootTimeoutMs": 8000,
97
+ "groups": {
98
+ "modules": { "show": true },
99
+ "ralph": { "show": true },
100
+ "memory": { "show": false }
101
+ },
102
+ "groupOrder": ["modules", "ralph", "subagents"]
103
+ }
104
+ }
105
+ }
106
+ ```
107
+
108
+ ## Dependencies
109
+
110
+ - `@pi-unipi/core` — shared constants and events
111
+
112
+ ## License
113
+
114
+ MIT
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pi-unipi/info-screen",
3
- "version": "0.1.8",
3
+ "version": "0.1.10",
4
4
  "description": "Dashboard and module registry for Unipi — configurable info overlay with tabbed groups",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -87,13 +87,21 @@ export class InfoOverlay implements Component {
87
87
  }
88
88
 
89
89
  try {
90
- // Load data for all groups in parallel
91
- const promises = this.groups.map(async (group) => {
92
- const data = await infoRegistry.getGroupData(group.id);
93
- this.groupData.set(group.id, data);
90
+ // Load data for all groups in parallel with timeout
91
+ const loadPromises = this.groups.map(async (group) => {
92
+ try {
93
+ const data = await Promise.race([
94
+ infoRegistry.getGroupData(group.id),
95
+ new Promise<never>((_, reject) => setTimeout(() => reject(new Error('timeout')), 3000)),
96
+ ]);
97
+ this.groupData.set(group.id, data);
98
+ } catch {
99
+ // Use empty data on timeout/error
100
+ this.groupData.set(group.id, {});
101
+ }
94
102
  });
95
103
 
96
- await Promise.all(promises);
104
+ await Promise.all(loadPromises);
97
105
  } catch (error) {
98
106
  this.error = error instanceof Error ? error.message : String(error);
99
107
  }