pi-usage-hub 1.0.4 → 1.0.5
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 +11 -11
- package/examples/custom-provider.ts +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -97,7 +97,17 @@ These are companion packages, not npm peer dependencies:
|
|
|
97
97
|
|
|
98
98
|
pi-usage-hub only reads those credentials; it does not run their OAuth flows.
|
|
99
99
|
|
|
100
|
-
Built-in providers
|
|
100
|
+
Built-in providers cover the integrations used and smoke-tested by the author. To support another provider, register a custom provider from an extension, or fork the package and submit a PR.
|
|
101
|
+
|
|
102
|
+
### Add a custom provider
|
|
103
|
+
|
|
104
|
+
See [`examples/custom-provider.ts`](./examples/custom-provider.ts) for a self-contained extension that implements and registers a provider. Copy it into `~/.pi/agent/extensions/`, then adapt the endpoint, credentials, response shape, and labels.
|
|
105
|
+
|
|
106
|
+
```ts
|
|
107
|
+
pi.events.on("pi-usage-hub:ready", (hub) => hub.register(myProvider));
|
|
108
|
+
pi.events.emit("pi-usage-hub:register", myProvider);
|
|
109
|
+
pi.events.emit("pi-usage-hub:unregister", { key: "my-relay" });
|
|
110
|
+
```
|
|
101
111
|
|
|
102
112
|
## Pull API
|
|
103
113
|
|
|
@@ -157,16 +167,6 @@ pi.on("session_shutdown", async () => {
|
|
|
157
167
|
});
|
|
158
168
|
```
|
|
159
169
|
|
|
160
|
-
### L2 provider registration
|
|
161
|
-
|
|
162
|
-
See [`examples/custom-provider.ts`](./examples/custom-provider.ts) for a self-contained extension that implements and registers a provider. Copy it into `~/.pi/agent/extensions/`, then adapt the endpoint, credentials, response shape, and labels.
|
|
163
|
-
|
|
164
|
-
```ts
|
|
165
|
-
pi.events.on("pi-usage-hub:ready", (hub) => hub.register(myProvider));
|
|
166
|
-
pi.events.emit("pi-usage-hub:register", myProvider);
|
|
167
|
-
pi.events.emit("pi-usage-hub:unregister", { key: "my-relay" });
|
|
168
|
-
```
|
|
169
|
-
|
|
170
170
|
## License
|
|
171
171
|
|
|
172
172
|
MIT
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Example: register a custom usage provider through the
|
|
2
|
+
* Example: register a custom usage provider through the event API.
|
|
3
3
|
*
|
|
4
4
|
* Copy this file into ~/.pi/agent/extensions/ and adapt the endpoint,
|
|
5
5
|
* credentials, response shape, and labels for your provider.
|