pi-usage-hub 1.0.1 → 1.0.2
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 +7 -6
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -101,7 +101,7 @@ Built-in providers are the ones already used and smoke-tested by the author. The
|
|
|
101
101
|
|
|
102
102
|
## Pull API
|
|
103
103
|
|
|
104
|
-
The hub caches results for 60 seconds and deduplicates concurrent requests. It never pushes footer text: consumers
|
|
104
|
+
The hub caches results for 60 seconds and deduplicates concurrent requests. It never pushes footer text: consumers start refreshes without blocking lifecycle events, read the cached summary, and re-render when notified.
|
|
105
105
|
|
|
106
106
|
| API | Role |
|
|
107
107
|
|-----|------|
|
|
@@ -135,14 +135,15 @@ const offUpdated = pi.events.on("pi-usage-hub:updated", () => {
|
|
|
135
135
|
requestRender?.();
|
|
136
136
|
});
|
|
137
137
|
|
|
138
|
-
|
|
138
|
+
// Pi awaits lifecycle handlers; refresh in the background and re-render on pi-usage-hub:updated.
|
|
139
|
+
pi.on("session_start", (_event, ctx) => {
|
|
139
140
|
void usageHub?.refresh({ model: ctx.model, force: true });
|
|
140
141
|
});
|
|
141
|
-
pi.on("model_select",
|
|
142
|
-
|
|
142
|
+
pi.on("model_select", (event) => {
|
|
143
|
+
void usageHub?.refresh({ model: event.model, force: true });
|
|
143
144
|
});
|
|
144
|
-
pi.on("agent_end",
|
|
145
|
-
|
|
145
|
+
pi.on("agent_end", (_event, ctx) => {
|
|
146
|
+
void usageHub?.refresh({ model: ctx.model, force: true });
|
|
146
147
|
});
|
|
147
148
|
|
|
148
149
|
// Inside footer render():
|