refactor(usage): shape sources as fetch functions

Keep the plugin usage API limited to stable report and presentation helpers. Source-local parsers and timeout handling preserve credential and response parity while the cases move alongside each source.
This commit is contained in:
Mohamed Boudra
2026-09-26 20:52:37 +02:00
parent 0f2f6a3b89
commit 2e53a5b9b5
40 changed files with 2628 additions and 2396 deletions
@@ -1,6 +1,6 @@
import type { PluginServerContext } from "@getpaseo/plugin/server";
import { inputSchema } from "./shared/input.js";
import { CopilotQuotaProvider } from "./server/usage.js";
import { fetchUsage } from "./server/usage.js";
export default function contribute(server: PluginServerContext) {
server.registerUsageSource({
@@ -9,7 +9,7 @@ export default function contribute(server: PluginServerContext) {
icon: "icon.svg",
input: inputSchema,
discover: async () => [{}],
fetch: async (_input) => new CopilotQuotaProvider({ logger: console }).fetchUsage(),
fetch: fetchUsage,
});
return () => {};
}