the install runner: ecosystem entry, sidecar, row, mounts
closes the hole app-store/pm2.ts has carried since 2026-08-13 — "installing a
plugin has to append its entry here before starting it, that is the plugin
system's job and it is not built". this is that job, and it is why nothing in
the app-store catalogue installs end to end either.
verified against a running server with a sidecar in the tree:
install ecosystem added · sidecar started · recorded · mounted /example
route 200, pm2 online
disable sidecar stopped · unmounted
route 404, pm2 stopped
enable sidecar started · mounted
route 200, pm2 online
uninstall record removed · unmounted · sidecar stopped, deleted, entry gone
route 404, not in pm2, tables untouched
afterwards ecosystem.config.cjs is byte-identical to before, pm2 holds the same
five core apps, and plugin_installs is back to zero rows.
the ecosystem file is edited rather than regenerated: the core entries come from
officer-setup's shell array, so the platform does not know that list and a copy
here would be a second thing to drift. the header above module.exports is
preserved verbatim too — officer-setup's explains that bun auto-loads .env from
the working directory and that data-path derives the install root from its
PARENT, so a wrong cwd relocates the whole install rather than failing. losing
that to a plugin install would be a poor trade.
order is the design. bringing up goes outside-in, taking down goes inside-out,
so the worst intermediate state is "recorded but not running" — visible, and
fixed by a retry — never "running but forgotten", which nothing can see.
each verb returns what it actually did, in order, and the detail panel shows it.
an install that mounted routes but could not start a sidecar is a different
outcome from one that worked, and a spinner that stops cannot say which.
the schema push is still deliberately not wired, and the reason is now in the
code: db:push DROPS tables absent from the schema it is given, so an uninstall
that regenerated the barrel would delete a plugin's data as a side effect of
stopping it. offscale does not need it — headscale_servers already ships in the
platform schema.
720 pass, same 10 pre-existing failures.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
@@ -62,6 +62,10 @@ export const PluginDetail = () => {
|
||||
}
|
||||
|
||||
const busy = install.isPending || uninstall.isPending || enable.isPending || disable.isPending;
|
||||
// Whichever verb ran last. They are mutually exclusive in practice — the buttons are disabled while any
|
||||
// is pending — so the first with data is the one that just happened.
|
||||
const last = [install, uninstall, enable, disable].find((m) => m.data || m.error);
|
||||
const result = last?.data;
|
||||
|
||||
return (
|
||||
<div className="h-full overflow-auto p-6">
|
||||
@@ -83,6 +87,21 @@ export const PluginDetail = () => {
|
||||
<Row label="Ships">
|
||||
<Parts has={plugin.has} />
|
||||
</Row>
|
||||
{plugin.has.sidecar ? (
|
||||
<Row label="Sidecar">
|
||||
{/* Enabled but not online is the state worth naming: the plugin is switched on and its
|
||||
process is not running, which is broken rather than off. */}
|
||||
<span
|
||||
className={
|
||||
plugin.enabled && plugin.processStatus !== 'online' && plugin.installed
|
||||
? 'text-amber-600'
|
||||
: 'text-duck-dark'
|
||||
}
|
||||
>
|
||||
{plugin.processStatus ?? 'not started'}
|
||||
</span>
|
||||
</Row>
|
||||
) : null}
|
||||
<Row label="Permissions">
|
||||
{plugin.permissions.length
|
||||
? plugin.permissions.map((p) => `${p.key}${p.ownerOnly ? ' (owner only)' : ''}`).join(', ')
|
||||
@@ -118,6 +137,20 @@ export const PluginDetail = () => {
|
||||
)}
|
||||
</div>
|
||||
|
||||
{/* What the last verb actually did. An install that mounted routes but could not start a sidecar is
|
||||
a different outcome from one that worked, and a spinner that stops cannot say which happened. */}
|
||||
{result ? (
|
||||
<div className="mt-5 rounded-md border border-duck-dark/10 bg-duck-dark/[0.02] p-3">
|
||||
<div className="mb-1 text-xs font-medium text-duck-dark/60">{result.ok ? 'Done' : 'Failed'}</div>
|
||||
<ul className="space-y-0.5 text-xs text-duck-dark/70">
|
||||
{result.steps.map((step, i) => (
|
||||
<li key={i}>· {step}</li>
|
||||
))}
|
||||
</ul>
|
||||
{result.error ? <div className="mt-2 text-xs text-red-600">{result.error}</div> : null}
|
||||
</div>
|
||||
) : null}
|
||||
|
||||
{/* Uninstall keeps every table and row the plugin owns, so this is worth saying rather than
|
||||
leaving someone to guess whether the button destroys their data. */}
|
||||
{plugin.installed ? (
|
||||
|
||||
@@ -27,8 +27,17 @@ export type PluginItem = {
|
||||
installedVersion: string | null;
|
||||
/** The code on disk moved after it was installed — normal while developing, and worth seeing. */
|
||||
outdated: boolean;
|
||||
/**
|
||||
* PM2's word for the sidecar, or null when the plugin has none. `online` while enabled is healthy;
|
||||
* anything else while enabled is the state worth rendering differently — the difference between a
|
||||
* plugin that is off and one that is broken.
|
||||
*/
|
||||
processStatus: string | null;
|
||||
};
|
||||
|
||||
/** What a verb actually did, in order. Shown rather than collapsed to a spinner. */
|
||||
export type PluginActionResult = { ok: boolean; appName: string; steps: string[]; error?: string };
|
||||
|
||||
export type BrokenPlugin = { appName: string; error: string };
|
||||
|
||||
const PLUGINS_KEY = ['plugins'];
|
||||
@@ -52,19 +61,19 @@ export function usePlugins() {
|
||||
// Written out rather than generated in a loop: `useMutation` is a hook, and a hook called from inside a
|
||||
// helper is a rules-of-hooks violation even when the call order happens to be stable.
|
||||
const install = useMutation({
|
||||
mutationFn: (appName: string) => client.post(`/plugins/${appName}/install`, {}),
|
||||
mutationFn: (appName: string) => client.post<PluginActionResult>(`/plugins/${appName}/install`, {}),
|
||||
onSuccess: invalidate,
|
||||
});
|
||||
const uninstall = useMutation({
|
||||
mutationFn: (appName: string) => client.post(`/plugins/${appName}/uninstall`, {}),
|
||||
mutationFn: (appName: string) => client.post<PluginActionResult>(`/plugins/${appName}/uninstall`, {}),
|
||||
onSuccess: invalidate,
|
||||
});
|
||||
const enable = useMutation({
|
||||
mutationFn: (appName: string) => client.post(`/plugins/${appName}/enable`, {}),
|
||||
mutationFn: (appName: string) => client.post<PluginActionResult>(`/plugins/${appName}/enable`, {}),
|
||||
onSuccess: invalidate,
|
||||
});
|
||||
const disable = useMutation({
|
||||
mutationFn: (appName: string) => client.post(`/plugins/${appName}/disable`, {}),
|
||||
mutationFn: (appName: string) => client.post<PluginActionResult>(`/plugins/${appName}/disable`, {}),
|
||||
onSuccess: invalidate,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user