feat: move telemetry out of core into a usage statistics plugin

This commit is contained in:
LukeGus committed 2026-09-30 23:54:38 -05:00
1 parent f8edb5f299
commit 6217b91ae2
56 files changed
+2064 -564

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
/**
* ctx.plugins: which plugins are installed and whether each runs, under
* plugins:read. Ids and versions only, nothing operational.
*/
import type { PluginPlugins } from "@termix/plugin-sdk/backend";
import type { PluginManifest } from "@termix/plugin-sdk/manifest";
import { assertCapability } from "./permissions.js";
export function createPluginPlugins(manifest: PluginManifest): PluginPlugins {
return {
list: async () => {
await assertCapability(
manifest.id,
"plugins:read",
manifest.capabilities,
);
const { getPluginRuntime } = await import("./index.js");
return getPluginRuntime()
.loader.list()
.map((plugin) => ({
id: plugin.id,
version: plugin.manifest.version,
source: plugin.source,
state: plugin.state,
}));
},
};
}
+2
View File
@@ -61,6 +61,7 @@ import { createPluginSchedule } from "./schedule.js";
import { createPluginFetch, createPluginNotify } from "./ctx-notify.js";
import { createPluginProcess } from "./ctx-process.js";
import { createPluginSystem } from "./ctx-system.js";
import { createPluginPlugins } from "./ctx-plugins.js";
import { createPluginCredentials } from "./ctx-credentials.js";
import { isElectronIpcAvailable } from "../utils/electron-ipc-bridge.js";
@@ -945,6 +946,7 @@ export function createPluginContext(
}),
auth: createPluginAuth({ manifest, bag: handle.bag, audit: auditCall }),
system: createPluginSystem({ manifest, bag: handle.bag, audit: auditCall }),
plugins: createPluginPlugins(manifest),
desktop: {
openIsolatedWindow: (request) => desktopOpenIsolatedWindow(request),