feat: harden plugin api for separate repos, signed updates and generic external login

This commit is contained in:
LukeGus committed 2026-09-29 18:11:59 -05:00
1 parent fb9c168b6b
commit 80944301dd
310 files changed
+6577 -4927

No files matched your search

+8 -2
View File
@@ -22,7 +22,8 @@
"db:own",
"network:serve",
"ui:surface",
"events:core"
"events:core",
"users:impersonate"
],
"provides": [
{
@@ -153,7 +154,12 @@
"advanced": {
"columns": 4
}
}
},
"uses": [
"homepage.hostMetrics",
"homepage.widgets",
"terminal.toolbarStatus"
]
},
"locales": "locales",
"platforms": ["linux", "win32", "darwin"]
+22 -2
View File
@@ -6,10 +6,30 @@
"scripts": {
"build": "termix-plugin build",
"test": "termix-plugin test",
"typecheck": "tsc -b ../../tsconfig.plugins.backend.json ../../tsconfig.plugins.frontend.json",
"typecheck": "tsc -p .",
"validate": "termix-plugin validate"
},
"dependencies": {
"lucide-react": "^1.33.0"
},
"devDependencies": {
"@termix/plugin-sdk": "*"
"@termix/plugin-sdk": "^1.0.0",
"@testing-library/dom": "^10.4.2",
"@testing-library/jest-dom": "^7.0.1",
"@testing-library/react": "^16.3.3",
"@types/node": "^26.2.0",
"@types/react": "^19.2.18",
"@types/react-dom": "^19.2.4",
"better-sqlite3": "^13.0.3",
"jsdom": "^30.0.1",
"vitest": "^4.1.11"
},
"peerDependencies": {
"@termix/plugin-sdk": "^1.0.0",
"drizzle-orm": "^0.45.2",
"express": "^5.2.1",
"react": "^19.2.8",
"sonner": "^2.0.8",
"ssh2": "^1.17.0"
}
}
@@ -26,7 +26,6 @@ type PluginSettingsBag = Record<string, Record<string, unknown>>;
*/
export function HostStatsTab({
form,
setField,
updateForm,
host,
}: HostEditorSectionProps) {
@@ -27,7 +27,7 @@ function RowBar({ label, value }: { label: string; value: number }) {
);
}
/** CPU, RAM and disk bars in a dashboard host row ("dashboard.hostMetrics"). */
/** CPU, RAM and disk bars in a dashboard host row ("dashboard.hostRow"). */
export function createDashboardHostMetrics(store: MetricsSummaryStore) {
return function DashboardHostMetrics(props: Record<string, unknown>) {
const { t } = useTranslation();
@@ -13,13 +13,6 @@ import { useTranslation } from "@termix/plugin-sdk/frontend";
import { type MetricsHistoryRow, useHostMetricsApi } from "../host-metrics-api";
import { CardTimeTabs, type HistoryTab } from "./CardTimeTabs";
function computeChartData(rows: MetricsHistoryRow[]) {
return {
data: rows.map((r) => r.cpu_percent),
timestamps: rows.map((r) => r.ts),
};
}
export function CpuCard({
metrics,
history,
+1 -1
View File
@@ -111,7 +111,7 @@ export async function activate(app: TermixApp): Promise<void> {
});
// The usage bars in the dashboard's host status card.
app.registerSlotContribution("dashboard.hostMetrics", {
app.registerSlotContribution("dashboard.hostRow", {
actionId: "host-metrics.dashboardHost",
titleKey: "nav.hostMetrics",
kind: "component",
@@ -32,8 +32,10 @@ describe("deriveEnabledWidgets", () => {
it("output is always a subset of the 10 known WidgetTypes", () => {
const slots = METRIC_CARD_IDS.map((id) => ({ id })).concat([
{ id: "user_manager" } as { id: (typeof METRIC_CARD_IDS)[number] },
{ id: "bogus" } as { id: (typeof METRIC_CARD_IDS)[number] },
{ id: "user_manager" } as unknown as {
id: (typeof METRIC_CARD_IDS)[number];
},
{ id: "bogus" } as unknown as { id: (typeof METRIC_CARD_IDS)[number] },
]);
const out = deriveEnabledWidgets(slots);
expect(out).toEqual(METRIC_CARD_IDS);
@@ -40,7 +40,7 @@ describe(`${manifest.id} activate`, () => {
it("fills core's metric slots and offers disk usage to other plugins", async () => {
rendered = await renderWithApp(plugin, { manifest, locales });
expect(rendered.registered.slot("dashboard.hostMetrics")).toEqual([
expect(rendered.registered.slot("dashboard.hostRow")).toEqual([
"host-metrics.dashboardHost",
]);
expect(rendered.registered.slot("homepage.hostMetrics")).toEqual([