feat: start-at-login is a Settings switch, off by default (v2.5.0)
- Settings → About → "Start AgentHub automatically" (AutostartSettings.tsx,
GET/PUT /api/settings/autostart, server/lib/autostart.js). The switch is
the systemd --user unit's / LaunchAgent's enabled state: on writes a unit
for the running server when none exists and enables it, off disables it;
neither starts or stops the server. A foreign unit is never touched
(409 EFOREIGN)
- The plugin bootstrap no longer installs a unit on every install: it
installs or starts one only while the user has it enabled, and a rewrite
keeps the enabled state (writeUserService({ enable })). An install that
already had the unit enabled stays on. A stale-but-enabled unit beside a
live detached server is repointed, no longer started onto the bound port
- unitIsEnabled / setUnitEnabled in systemd-service.js and launchd-service.js
Also:
- fix(workspace): status bar no longer covers the chat box below md (#61)
This commit is contained in:
@@ -4,6 +4,8 @@
|
||||
* - GET /api/sessions/facets (Sessions)
|
||||
* - GET /api/settings/claude-home (Settings)
|
||||
* - PUT /api/settings/claude-home (Settings)
|
||||
* - GET /api/settings/autostart (Settings)
|
||||
* - PUT /api/settings/autostart (Settings)
|
||||
* - GET /api/workflows/runs (Workflows)
|
||||
* - GET /api/workflows/runs/{runId} (Workflows)
|
||||
* - GET /api/remote-sources (Remote Sources)
|
||||
@@ -1009,6 +1011,70 @@ const paths = {
|
||||
},
|
||||
},
|
||||
|
||||
"/api/settings/autostart": (() => {
|
||||
const status = {
|
||||
description: "Start-at-login state",
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["available", "kind", "enabled", "foreign"],
|
||||
properties: {
|
||||
available: {
|
||||
type: "boolean",
|
||||
description: "False with no systemd --user (Linux) or GUI login (macOS)",
|
||||
},
|
||||
kind: { type: "string", enum: ["systemd", "launchd"] },
|
||||
enabled: { type: "boolean" },
|
||||
foreign: {
|
||||
type: "boolean",
|
||||
description: "A unit named agenthub exists that AgentHub did not write",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
};
|
||||
return {
|
||||
get: {
|
||||
tags: ["Settings"],
|
||||
summary: "Whether the dashboard starts at boot/login",
|
||||
description:
|
||||
"The per-user service's enabled state (a systemd `--user` unit, or a LaunchAgent on macOS). Off by default.",
|
||||
operationId: "getAutostart",
|
||||
responses: { 200: status },
|
||||
},
|
||||
put: {
|
||||
tags: ["Settings"],
|
||||
summary: "Turn start-at-login on or off",
|
||||
description:
|
||||
"Enables or disables the unit, writing one for the running server first when none exists. Never starts or stops the server. Same-origin only.",
|
||||
operationId: "setAutostart",
|
||||
requestBody: {
|
||||
required: true,
|
||||
content: {
|
||||
"application/json": {
|
||||
schema: {
|
||||
type: "object",
|
||||
required: ["enabled"],
|
||||
properties: { enabled: { type: "boolean" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
responses: {
|
||||
200: { ...status, description: "The new state" },
|
||||
400: {
|
||||
description:
|
||||
"EBADVALUE: `enabled` is not a boolean; EUNAVAILABLE: no systemd --user / launchd GUI session",
|
||||
},
|
||||
403: { description: "EBADORIGIN: another site asked" },
|
||||
409: { description: "EFOREIGN: a unit named agenthub that AgentHub did not write" },
|
||||
},
|
||||
},
|
||||
};
|
||||
})(),
|
||||
|
||||
"/api/settings/codex-hooks": (() => {
|
||||
const status = {
|
||||
description: "Where AgentHub's Codex hooks stand",
|
||||
|
||||
Reference in New Issue
Block a user