@yefengr/remote-pi 0.7.16 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/README.md +44 -95
  2. package/dist/actions/handlers.js +1 -1
  3. package/dist/actions/handlers.js.map +1 -1
  4. package/dist/actions/registry.d.ts +1 -1
  5. package/dist/actions/registry.js +1 -1
  6. package/dist/{daemon/commands.d.ts → commands.d.ts} +3 -4
  7. package/dist/{daemon/commands.js → commands.js} +8 -151
  8. package/dist/commands.js.map +1 -0
  9. package/dist/index.d.ts +1 -0
  10. package/dist/index.js +20 -38
  11. package/dist/index.js.map +1 -1
  12. package/dist/pairing/storage.js +4 -4
  13. package/dist/pairing/storage.js.map +1 -1
  14. package/dist/protocol/v2/schemas.d.ts +4 -4
  15. package/dist/session/local_config.d.ts +0 -5
  16. package/dist/session/local_config.js +6 -29
  17. package/dist/session/local_config.js.map +1 -1
  18. package/dist/transport/relay_client.js.map +1 -1
  19. package/package.json +1 -8
  20. package/dist/bin/supervisord.d.ts +0 -2
  21. package/dist/bin/supervisord.js +0 -78
  22. package/dist/bin/supervisord.js.map +0 -1
  23. package/dist/daemon/cli-links.d.ts +0 -30
  24. package/dist/daemon/cli-links.js +0 -134
  25. package/dist/daemon/cli-links.js.map +0 -1
  26. package/dist/daemon/client.d.ts +0 -20
  27. package/dist/daemon/client.js +0 -131
  28. package/dist/daemon/client.js.map +0 -1
  29. package/dist/daemon/commands.js.map +0 -1
  30. package/dist/daemon/control_protocol.d.ts +0 -198
  31. package/dist/daemon/control_protocol.js +0 -40
  32. package/dist/daemon/control_protocol.js.map +0 -1
  33. package/dist/daemon/cron_log.d.ts +0 -24
  34. package/dist/daemon/cron_log.js +0 -57
  35. package/dist/daemon/cron_log.js.map +0 -1
  36. package/dist/daemon/cron_registry.d.ts +0 -43
  37. package/dist/daemon/cron_registry.js +0 -149
  38. package/dist/daemon/cron_registry.js.map +0 -1
  39. package/dist/daemon/install-runtime.d.ts +0 -10
  40. package/dist/daemon/install-runtime.js +0 -81
  41. package/dist/daemon/install-runtime.js.map +0 -1
  42. package/dist/daemon/install.d.ts +0 -110
  43. package/dist/daemon/install.js +0 -263
  44. package/dist/daemon/install.js.map +0 -1
  45. package/dist/daemon/registry.d.ts +0 -51
  46. package/dist/daemon/registry.js +0 -207
  47. package/dist/daemon/registry.js.map +0 -1
  48. package/dist/daemon/rpc_child.d.ts +0 -135
  49. package/dist/daemon/rpc_child.js +0 -472
  50. package/dist/daemon/rpc_child.js.map +0 -1
  51. package/dist/daemon/status.d.ts +0 -45
  52. package/dist/daemon/status.js +0 -87
  53. package/dist/daemon/status.js.map +0 -1
  54. package/dist/daemon/supervisor-ipc.d.ts +0 -2
  55. package/dist/daemon/supervisor-ipc.js +0 -20
  56. package/dist/daemon/supervisor-ipc.js.map +0 -1
  57. package/dist/daemon/supervisor.d.ts +0 -70
  58. package/dist/daemon/supervisor.js +0 -637
  59. package/dist/daemon/supervisor.js.map +0 -1
  60. package/dist/session/ipc.d.ts +0 -6
  61. package/dist/session/ipc.js +0 -15
  62. package/dist/session/ipc.js.map +0 -1
  63. package/docs/daemon.md +0 -175
  64. package/service-templates/launchd.plist.template +0 -35
  65. package/service-templates/systemd.service.template +0 -19
  66. package/service-templates/task-launcher.vbs.template +0 -10
  67. package/service-templates/task-scheduler.xml.template +0 -38
@@ -1,263 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync } from "node:fs";
2
- import { homedir, platform, userInfo } from "node:os";
3
- import { dirname, join, resolve } from "node:path";
4
- import { fileURLToPath } from "node:url";
5
- import { execCommand as _exec, execElevatedWindows as _execElevatedWindows, tryExecCommand as _tryExec } from "./install-runtime.js";
6
- export { buildElevatedCmd } from "./install-runtime.js";
7
- export { buildCmdShim, isOnPath, linkCliBinaries, unlinkCliBinaries, userLocalBinDir, } from "./cli-links.js";
8
- export function detectPlatform() {
9
- switch (platform()) {
10
- case "darwin": return "macos";
11
- case "linux": return "linux";
12
- case "win32": return "windows";
13
- default: return "unsupported";
14
- }
15
- }
16
- // ── Path resolution ────────────────────────────────────────────────────────
17
- /**
18
- * Absolute path to the supervisor's compiled entry. We resolve from
19
- * `import.meta.url` (this file's location) since wherever the daemon
20
- * module lives, `bin/supervisord.js` is a sibling of `daemon/` under
21
- * `dist/`.
22
- *
23
- * After build: `dist/daemon/install.js` → `dist/bin/supervisord.js`.
24
- * In dev (`tsx`): same path resolution still lands inside `src/`, which
25
- * isn't directly runnable by `node` — dev install isn't expected.
26
- */
27
- export function findSupervisorScript() {
28
- const here = fileURLToPath(import.meta.url); // dist/daemon/install.js
29
- const daemonDir = dirname(here); // dist/daemon
30
- const distRoot = dirname(daemonDir); // dist
31
- return resolve(distRoot, "bin/supervisord.js");
32
- }
33
- /**
34
- * Absolute path to the extension's CLI entry (`dist/index.js`). This is
35
- * the file we symlink to `~/.local/bin/remote-pi` so the user can run
36
- * `remote-pi <subcommand>` from any shell after installing the extension
37
- * through Pi (`pi install npm:@yefengr/remote-pi`).
38
- *
39
- * Same resolution strategy as `findSupervisorScript`: from
40
- * `dist/daemon/install.js` → `dist/index.js`.
41
- */
42
- export function findRemotePiScript() {
43
- const here = fileURLToPath(import.meta.url); // dist/daemon/install.js
44
- const daemonDir = dirname(here); // dist/daemon
45
- const distRoot = dirname(daemonDir); // dist
46
- return resolve(distRoot, "index.js");
47
- }
48
- export function findNodeBinary() {
49
- // `process.execPath` is always absolute and points at the current Node
50
- // binary. Embedding it in the service unit means the user gets the
51
- // exact same Node version they invoked `remote-pi install` with — no
52
- // PATH ambiguity at boot time.
53
- return process.execPath;
54
- }
55
- export function findTemplate(name) {
56
- // Templates ship next to the compiled `dist/` (via `files` in package.json).
57
- // From `dist/daemon/install.js` go up two levels and into
58
- // `service-templates/`. In the published npm tarball the layout is the
59
- // same — `service-templates/` is sibling to `dist/`.
60
- const here = fileURLToPath(import.meta.url); // dist/daemon/install.js
61
- const pkgRoot = resolve(dirname(dirname(dirname(here)))); // package root
62
- const file = name === "systemd" ? "systemd.service.template" :
63
- name === "launchd" ? "launchd.plist.template" :
64
- name === "vbs-launcher" ? "task-launcher.vbs.template" :
65
- "task-scheduler.xml.template";
66
- return resolve(pkgRoot, "service-templates", file);
67
- }
68
- // ── Service paths ──────────────────────────────────────────────────────────
69
- export function systemdUnitPath() {
70
- return join(homedir(), ".config", "systemd", "user", "remote-pi-supervisord.service");
71
- }
72
- export function launchdPlistPath() {
73
- return join(homedir(), "Library", "LaunchAgents", "dev.remotepi.supervisord.plist");
74
- }
75
- export const LAUNCHD_LABEL = "dev.remotepi.supervisord";
76
- /** systemd --user unit name (with `.service`) for the supervisor. */
77
- export const SYSTEMD_UNIT = "remote-pi-supervisord.service";
78
- /** Windows Task Scheduler task name (plan/40). */
79
- export const WINDOWS_TASK_NAME = "RemotePiSupervisor";
80
- /** Path of the rendered Task Scheduler XML (input to `schtasks /Create /XML`). */
81
- export function taskXmlPath() {
82
- return join(homedir(), ".pi", "remote", "RemotePiSupervisor.xml");
83
- }
84
- /**
85
- * Path of the rendered VBScript launcher the Task Scheduler action invokes
86
- * via `wscript.exe` (plan/40, Windows). Launching node through this hidden
87
- * wrapper is what keeps the supervisor from flashing a console window.
88
- */
89
- export function vbsLauncherPath() {
90
- return join(homedir(), ".pi", "remote", "RemotePiSupervisorLauncher.vbs");
91
- }
92
- /**
93
- * Combined stdout/stderr log for the Windows supervisor. The Task Scheduler
94
- * launches it hidden via wscript, so without this redirect its output (and the
95
- * forwarded daemon-child stderr) would vanish — mirrors launchd/systemd, which
96
- * already log to `~/.pi/remote/supervisord.log`.
97
- */
98
- export function supervisordLogPath() {
99
- return join(homedir(), ".pi", "remote", "supervisord.log");
100
- }
101
- export function defaultRenderVars() {
102
- return {
103
- node: findNodeBinary(),
104
- supervisor: findSupervisorScript(),
105
- home: homedir(),
106
- user: userInfo().username,
107
- path: process.env["PATH"] ?? "/usr/local/bin:/usr/bin:/bin",
108
- vbs: vbsLauncherPath(),
109
- logPath: supervisordLogPath(),
110
- };
111
- }
112
- /** Replace `{NODE}` / `{SUPERVISOR}` / `{USER}` / `{HOME}` / `{PATH}` / `{VBS}` / `{LOG}`. */
113
- export function renderTemplate(template, vars) {
114
- return template
115
- .replace(/\{NODE\}/g, vars.node)
116
- .replace(/\{SUPERVISOR\}/g, vars.supervisor)
117
- .replace(/\{USER\}/g, vars.user)
118
- .replace(/\{HOME\}/g, vars.home)
119
- .replace(/\{PATH\}/g, vars.path)
120
- .replace(/\{VBS\}/g, vars.vbs)
121
- .replace(/\{LOG\}/g, vars.logPath);
122
- }
123
- /**
124
- * Writes the unit/plist, runs the platform's activation command. Throws
125
- * on unsupported OS or when the supervisor script isn't found.
126
- *
127
- * Idempotent: re-running re-writes the unit (paths could have changed)
128
- * and re-activates via the platform tool's idempotent flag.
129
- */
130
- export function installService(vars = defaultRenderVars()) {
131
- const plat = detectPlatform();
132
- const log = [];
133
- if (plat === "unsupported") {
134
- throw new Error(`unsupported platform: ${platform()}. Only macOS, Linux, and Windows.`);
135
- }
136
- // Sanity: supervisor script must exist on disk.
137
- if (!existsSync(vars.supervisor)) {
138
- throw new Error(`supervisor script not found at ${vars.supervisor}. ` +
139
- "Run `pnpm build` (dev) or `npm install -g @yefengr/remote-pi` (prod) first.");
140
- }
141
- const templateName = plat === "macos" ? "launchd" : plat === "linux" ? "systemd" : "taskscheduler";
142
- const templatePath = findTemplate(templateName);
143
- if (!existsSync(templatePath)) {
144
- throw new Error(`service template missing: ${templatePath}`);
145
- }
146
- const tpl = readFileSync(templatePath, "utf8");
147
- const rendered = renderTemplate(tpl, vars);
148
- const unitPath = plat === "macos" ? launchdPlistPath() : plat === "linux" ? systemdUnitPath() : taskXmlPath();
149
- mkdirSync(dirname(unitPath), { recursive: true });
150
- if (plat === "windows") {
151
- // `schtasks /Create /XML` requires UTF-16LE + BOM. A UTF-8 file fails with
152
- // "(1,40)::ERROR: unable to switch the encoding" — the bytes must match the
153
- // template's `encoding="UTF-16"` declaration. (plan/40 risk #5.)
154
- const bom = Buffer.from([0xff, 0xfe]); // UTF-16LE byte-order mark
155
- writeFileSync(unitPath, Buffer.concat([bom, Buffer.from(rendered, "utf16le")]));
156
- }
157
- else {
158
- writeFileSync(unitPath, rendered); // launchd/systemd → UTF-8
159
- }
160
- log.push(`wrote ${unitPath}`);
161
- if (plat === "macos") {
162
- // Unload first in case a stale entry exists from a prior install —
163
- // `launchctl bootstrap` errors out otherwise. `bootout` is the modern
164
- // API; `unload` is the legacy fallback. Either may fail silently.
165
- const uid = userInfo().uid;
166
- _tryExec("launchctl", ["bootout", `gui/${uid}`, unitPath], log);
167
- _tryExec("launchctl", ["unload", unitPath], log);
168
- _exec("launchctl", ["bootstrap", `gui/${uid}`, unitPath], log);
169
- log.push(`activated via launchctl bootstrap gui/${uid}`);
170
- }
171
- else if (plat === "linux") {
172
- _exec("systemctl", ["--user", "daemon-reload"], log);
173
- _exec("systemctl", ["--user", "enable", "--now", "remote-pi-supervisord.service"], log);
174
- log.push("activated via systemctl --user enable --now");
175
- }
176
- else {
177
- // windows — Task Scheduler (plan/40). The action runs `wscript.exe
178
- // <launcher.vbs>` (not node directly) so the supervisor starts hidden,
179
- // with no console window. Render + write that launcher first.
180
- const vbsTpl = findTemplate("vbs-launcher");
181
- if (!existsSync(vbsTpl))
182
- throw new Error(`vbs launcher template missing: ${vbsTpl}`);
183
- const vbsPath = vars.vbs;
184
- writeFileSync(vbsPath, renderTemplate(readFileSync(vbsTpl, "utf8"), vars));
185
- log.push(`wrote ${vbsPath}`);
186
- // Only `schtasks /Create` modifies the root task store → that single op
187
- // needs admin (elevate it via UAC). `/End` (stop a prior instance) and
188
- // `/Run` (start it) act on a task we already own and work un-elevated — the
189
- // very ops `remote-pi restart-supervisor` runs without elevation. Keeping
190
- // them un-elevated narrows the admin surface to the one operation that
191
- // truly requires it.
192
- _tryExec("schtasks", ["/End", "/TN", WINDOWS_TASK_NAME], log);
193
- _execElevatedWindows([
194
- `schtasks /Create /XML "${unitPath}" /TN ${WINDOWS_TASK_NAME} /F`,
195
- ], log);
196
- _exec("schtasks", ["/Run", "/TN", WINDOWS_TASK_NAME], log);
197
- log.push(`activated via schtasks /Create (elevated) + /Run (${WINDOWS_TASK_NAME})`);
198
- }
199
- return { platform: plat, unitPath, log };
200
- }
201
- export function uninstallService() {
202
- const plat = detectPlatform();
203
- const log = [];
204
- if (plat === "unsupported") {
205
- throw new Error(`unsupported platform: ${platform()}. Only macOS, Linux, and Windows.`);
206
- }
207
- const unitPath = plat === "macos" ? launchdPlistPath() : plat === "linux" ? systemdUnitPath() : taskXmlPath();
208
- if (plat === "macos") {
209
- const uid = userInfo().uid;
210
- _tryExec("launchctl", ["bootout", `gui/${uid}`, unitPath], log);
211
- _tryExec("launchctl", ["unload", unitPath], log);
212
- log.push("deactivated via launchctl bootout");
213
- }
214
- else if (plat === "linux") {
215
- _tryExec("systemctl", ["--user", "disable", "--now", "remote-pi-supervisord.service"], log);
216
- log.push("deactivated via systemctl --user disable --now");
217
- }
218
- else {
219
- // windows — Task Scheduler (plan/40): stop + delete the task. Only
220
- // `/Delete` modifies the root task store → that's the op that needs admin.
221
- // `/End` stops the running task and works un-elevated (own task), like
222
- // restart-supervisor. `exit /b 0` keeps uninstall best-effort: a missing
223
- // task (already removed) is success, not an error.
224
- _tryExec("schtasks", ["/End", "/TN", WINDOWS_TASK_NAME], log);
225
- _execElevatedWindows([
226
- `schtasks /Delete /TN ${WINDOWS_TASK_NAME} /F`,
227
- `exit /b 0`,
228
- ], log);
229
- log.push(`deactivated via elevated schtasks /Delete (${WINDOWS_TASK_NAME})`);
230
- }
231
- let removed = false;
232
- if (existsSync(unitPath)) {
233
- try {
234
- unlinkSync(unitPath);
235
- removed = true;
236
- log.push(`removed ${unitPath}`);
237
- }
238
- catch (e) {
239
- log.push(`failed to remove ${unitPath}: ${String(e)}`);
240
- }
241
- }
242
- // Windows: also drop the hidden VBScript launcher we wrote alongside the XML.
243
- if (plat === "windows") {
244
- const vbsPath = vbsLauncherPath();
245
- if (existsSync(vbsPath)) {
246
- try {
247
- unlinkSync(vbsPath);
248
- log.push(`removed ${vbsPath}`);
249
- }
250
- catch (e) {
251
- log.push(`failed to remove ${vbsPath}: ${String(e)}`);
252
- }
253
- }
254
- }
255
- if (plat === "linux") {
256
- _tryExec("systemctl", ["--user", "daemon-reload"], log);
257
- }
258
- // Hint about the label for users that want to verify manually.
259
- if (plat === "macos")
260
- log.push(`(label: ${LAUNCHD_LABEL})`);
261
- return { platform: plat, unitPath, removed, log };
262
- }
263
- //# sourceMappingURL=install.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/daemon/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACzF,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AACtD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,WAAW,IAAI,KAAK,EAAE,mBAAmB,IAAI,oBAAoB,EAAE,cAAc,IAAI,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAErI,OAAO,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AACxD,OAAO,EACL,YAAY,EAAE,QAAQ,EAAE,eAAe,EAAE,iBAAiB,EAAE,eAAe,GAC5E,MAAM,gBAAgB,CAAC;AA6BxB,MAAM,UAAU,cAAc;IAC5B,QAAQ,QAAQ,EAAE,EAAE,CAAC;QACnB,KAAK,QAAQ,CAAC,CAAC,OAAO,OAAO,CAAC;QAC9B,KAAK,OAAO,CAAC,CAAC,OAAO,OAAO,CAAC;QAC7B,KAAK,OAAO,CAAC,CAAC,OAAO,SAAS,CAAC;QAC/B,OAAO,CAA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AAI,CAAC;gBAAC,UAAU,CAAC,OAAO,CAAC,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,WAAW,OAAO,EAAE,CAAC,CAAC;YAAC,CAAC;YAC5D,OAAO,CAAC,EAAE,CAAC;gBAAC,GAAG,CAAC,IAAI,CAAC,oBAAoB,OAAO,KAAK,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC;YAAC,CAAC;QACtE,CAAC;IACH,CAAC;IAED,IAAI,IAAI,KAAK,OAAO,EAAE,CAAC;QACrB,QAAQ,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE,eAAe,CAAC,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IAED,+DAA+D;IAC/D,IAAI,IAAI,KAAK,OAAO;QAAE,GAAG,CAAC,IAAI,CAAC,WAAW,aAAa,GAAG,CAAC,CAAC;IAE5D,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AACpD,CAAC"}
@@ -1,51 +0,0 @@
1
- /** Persisted desired lifecycle for a daemon registration. */
2
- export type DesiredState = "running" | "stopped";
3
- /** Versioned daemon registry v2. Do not silently coerce an older shape. */
4
- export interface DaemonEntry {
5
- /** Stable opaque endpoint identity. Never derived from cwd. */
6
- id: string;
7
- /** Absolute filesystem realpath captured at registration time. */
8
- cwd: string;
9
- name: string;
10
- desired_state: DesiredState;
11
- /** Epoch milliseconds. */
12
- created_at: number;
13
- }
14
- export interface DaemonRegistry {
15
- version: 2;
16
- daemons: DaemonEntry[];
17
- }
18
- export type RegistryErrorCode = "registry_schema_invalid" | "registry_schema_unsupported";
19
- /**
20
- * A malformed or old registry is an operator-visible error, not an empty
21
- * registry. Treating it as empty could overwrite valid registrations on the
22
- * next save, which is destructive.
23
- */
24
- export declare class RegistrySchemaError extends Error {
25
- readonly code: RegistryErrorCode;
26
- constructor(code: RegistryErrorCode, message: string);
27
- }
28
- /** Canonicalizes a supplied cwd and rejects nonexistent paths. */
29
- export declare function normalizeCwd(input: string): string;
30
- /** Missing file is empty v2; every existing file must be valid v2. */
31
- export declare function loadRegistry(): DaemonRegistry;
32
- /** Validates before atomically replacing the on-disk registry. */
33
- export declare function saveRegistry(registry: DaemonRegistry): void;
34
- /** Explicit registration always starts in the desired running state. */
35
- export declare function addDaemon(rawCwd: string, name?: string): DaemonEntry;
36
- export declare function removeDaemon(id: string): {
37
- removed: boolean;
38
- cwd?: string;
39
- };
40
- /** Finds a registration by canonical cwd for external lifecycle integrations. */
41
- export declare function findDaemonByCwd(rawCwd: string): DaemonEntry | undefined;
42
- /** Persists intended lifecycle independently from process state. */
43
- export declare function setDaemonDesiredState(id: string, desiredState: DesiredState): DaemonEntry | undefined;
44
- /** Returns v2 entries in insertion order. */
45
- export declare function listDaemons(): DaemonEntry[];
46
- /**
47
- * Backward compatible export name only. v2 deliberately has no in-place
48
- * migration: an old registry must be explicitly replaced by its operator.
49
- */
50
- export declare function migrateRegistryNames(): number;
51
- export declare function registryPath(): string;
@@ -1,207 +0,0 @@
1
- import { existsSync, mkdirSync, readFileSync, realpathSync, renameSync, writeFileSync } from "node:fs";
2
- import { randomUUID } from "node:crypto";
3
- import { homedir } from "node:os";
4
- import { dirname, isAbsolute, join, resolve as resolvePath } from "node:path";
5
- import { defaultAgentName } from "../session/local_config.js";
6
- /**
7
- * A malformed or old registry is an operator-visible error, not an empty
8
- * registry. Treating it as empty could overwrite valid registrations on the
9
- * next save, which is destructive.
10
- */
11
- export class RegistrySchemaError extends Error {
12
- code;
13
- constructor(code, message) {
14
- super(message);
15
- this.code = code;
16
- this.name = "RegistrySchemaError";
17
- }
18
- }
19
- function registryPathInternal() {
20
- const root = process.env["REMOTE_PI_HOME"] || homedir();
21
- return join(root, ".pi", "remote", "daemons.json");
22
- }
23
- function emptyRegistry() {
24
- return { version: 2, daemons: [] };
25
- }
26
- /** Canonicalizes a supplied cwd and rejects nonexistent paths. */
27
- export function normalizeCwd(input) {
28
- if (!input || !input.trim())
29
- throw new Error("cwd is required");
30
- let path = input.trim();
31
- if (path === "~")
32
- path = homedir();
33
- else if (path.startsWith("~/"))
34
- path = join(homedir(), path.slice(2));
35
- if (!isAbsolute(path))
36
- path = resolvePath(process.cwd(), path);
37
- return realpathSync(path);
38
- }
39
- function registryError(message, code = "registry_schema_invalid") {
40
- throw new RegistrySchemaError(code, message);
41
- }
42
- function isOpaqueId(value) {
43
- // UUID is generated by this registry. Accept UUID variants to keep the
44
- // persisted identifier opaque without coupling validation to a display form.
45
- return typeof value === "string" && /^[0-9a-f]{8}-[0-9a-f]{4}-[1-8][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(value);
46
- }
47
- function parseEntry(value, index) {
48
- if (!value || typeof value !== "object")
49
- registryError(`registry daemon[${index}] must be an object`);
50
- const entry = value;
51
- if (!isOpaqueId(entry["id"]))
52
- registryError(`registry daemon[${index}].id must be an opaque UUID`);
53
- if (typeof entry["cwd"] !== "string" || !isAbsolute(entry["cwd"]) || entry["cwd"].length === 0) {
54
- registryError(`registry daemon[${index}].cwd must be an absolute path`);
55
- }
56
- // A vanished cwd stays loadable long enough for supervisor reconcile to
57
- // remove it. Existing paths must already be their canonical realpath.
58
- if (existsSync(entry["cwd"]) && realpathSync(entry["cwd"]) !== entry["cwd"]) {
59
- registryError(`registry daemon[${index}].cwd must be a filesystem realpath`);
60
- }
61
- if (typeof entry["name"] !== "string" || entry["name"].trim().length === 0) {
62
- registryError(`registry daemon[${index}].name must be a non-empty string`);
63
- }
64
- if (entry["desired_state"] !== "running" && entry["desired_state"] !== "stopped") {
65
- registryError(`registry daemon[${index}].desired_state must be running or stopped`);
66
- }
67
- if (typeof entry["created_at"] !== "number" || !Number.isFinite(entry["created_at"]) || entry["created_at"] < 0) {
68
- registryError(`registry daemon[${index}].created_at must be an epoch timestamp`);
69
- }
70
- return {
71
- id: entry["id"],
72
- cwd: entry["cwd"],
73
- name: entry["name"].trim(),
74
- desired_state: entry["desired_state"],
75
- created_at: entry["created_at"],
76
- };
77
- }
78
- function validateRegistry(value) {
79
- if (!value || typeof value !== "object" || Array.isArray(value)) {
80
- registryError("registry root must be an object");
81
- }
82
- const root = value;
83
- if (root["version"] !== 2) {
84
- const code = root["version"] === undefined || root["version"] === 1
85
- ? "registry_schema_unsupported"
86
- : "registry_schema_invalid";
87
- registryError(`unsupported daemon registry version ${String(root["version"])}; remove or replace ~/.pi/remote/daemons.json before registering daemons`, code);
88
- }
89
- if (!Array.isArray(root["daemons"]))
90
- registryError("registry.daemons must be an array");
91
- const daemons = root["daemons"].map((entry, index) => parseEntry(entry, index));
92
- const ids = new Set();
93
- const cwds = new Set();
94
- for (const entry of daemons) {
95
- if (ids.has(entry.id))
96
- registryError(`registry contains duplicate id ${entry.id}`);
97
- if (cwds.has(entry.cwd))
98
- registryError(`registry contains duplicate cwd ${entry.cwd}`);
99
- ids.add(entry.id);
100
- cwds.add(entry.cwd);
101
- }
102
- return { version: 2, daemons };
103
- }
104
- /** Missing file is empty v2; every existing file must be valid v2. */
105
- export function loadRegistry() {
106
- const path = registryPathInternal();
107
- if (!existsSync(path))
108
- return emptyRegistry();
109
- let raw;
110
- try {
111
- raw = readFileSync(path, "utf8");
112
- }
113
- catch (error) {
114
- throw new RegistrySchemaError("registry_schema_invalid", `cannot read daemon registry: ${String(error)}`);
115
- }
116
- let parsed;
117
- try {
118
- parsed = JSON.parse(raw);
119
- }
120
- catch (error) {
121
- throw new RegistrySchemaError("registry_schema_invalid", `invalid daemon registry JSON: ${String(error)}`);
122
- }
123
- return validateRegistry(parsed);
124
- }
125
- /** Validates before atomically replacing the on-disk registry. */
126
- export function saveRegistry(registry) {
127
- const valid = validateRegistry(registry);
128
- const path = registryPathInternal();
129
- mkdirSync(dirname(path), { recursive: true });
130
- const temp = `${path}.${process.pid}.${randomUUID()}.tmp`;
131
- try {
132
- writeFileSync(temp, JSON.stringify(valid, null, 2) + "\n", "utf8");
133
- renameSync(temp, path);
134
- }
135
- catch (error) {
136
- throw new Error(`failed to save daemon registry: ${String(error)}`);
137
- }
138
- }
139
- /** Explicit registration always starts in the desired running state. */
140
- export function addDaemon(rawCwd, name) {
141
- const cwd = normalizeCwd(rawCwd);
142
- const registry = loadRegistry();
143
- if (registry.daemons.some((entry) => entry.cwd === cwd)) {
144
- throw new Error(`Daemon already registered for cwd: ${cwd}`);
145
- }
146
- const entry = {
147
- id: randomUUID(),
148
- cwd,
149
- name: name?.trim() || defaultAgentName(cwd),
150
- desired_state: "running",
151
- created_at: Date.now(),
152
- };
153
- registry.daemons.push(entry);
154
- saveRegistry(registry);
155
- return entry;
156
- }
157
- export function removeDaemon(id) {
158
- const registry = loadRegistry();
159
- const index = registry.daemons.findIndex((entry) => entry.id === id);
160
- if (index === -1)
161
- return { removed: false };
162
- const [removed] = registry.daemons.splice(index, 1);
163
- saveRegistry(registry);
164
- return { removed: true, cwd: removed.cwd };
165
- }
166
- /** Finds a registration by canonical cwd for external lifecycle integrations. */
167
- export function findDaemonByCwd(rawCwd) {
168
- let cwd;
169
- try {
170
- cwd = normalizeCwd(rawCwd);
171
- }
172
- catch {
173
- let path = rawCwd.trim();
174
- if (path === "~")
175
- path = homedir();
176
- else if (path.startsWith("~/"))
177
- path = join(homedir(), path.slice(2));
178
- cwd = isAbsolute(path) ? resolvePath(path) : resolvePath(process.cwd(), path);
179
- }
180
- return loadRegistry().daemons.find((entry) => entry.cwd === cwd);
181
- }
182
- /** Persists intended lifecycle independently from process state. */
183
- export function setDaemonDesiredState(id, desiredState) {
184
- const registry = loadRegistry();
185
- const entry = registry.daemons.find((item) => item.id === id);
186
- if (!entry)
187
- return undefined;
188
- entry.desired_state = desiredState;
189
- saveRegistry(registry);
190
- return entry;
191
- }
192
- /** Returns v2 entries in insertion order. */
193
- export function listDaemons() {
194
- return loadRegistry().daemons;
195
- }
196
- /**
197
- * Backward compatible export name only. v2 deliberately has no in-place
198
- * migration: an old registry must be explicitly replaced by its operator.
199
- */
200
- export function migrateRegistryNames() {
201
- loadRegistry();
202
- return 0;
203
- }
204
- export function registryPath() {
205
- return registryPathInternal();
206
- }
207
- //# sourceMappingURL=registry.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"registry.js","sourceRoot":"","sources":["../../src/daemon/registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,UAAU,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACvG,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,UAAU,EAAE,IAAI,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,WAAW,CAAC;AAC9E,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAwB9D;;;;GAIG;AACH,MAAM,OAAO,mBAAoB,SAAQ,KAAK;IAE1B;IADlB,YACkB,IAAuB,EACvC,OAAe;QAEf,KAAK,CAAC,OAAO,CAAC,CAAC;QAHC,SAAI,GAAJ,IAAI,CAAmB;QAIvC,IAAI,CAAC,IAAI,GAAG,qBAAqB,CAAC;IACpC,CAAC;CACF;AAED,SAAS,oBAAoB;IAC3B,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,IAAI,OAAO,EAAE,CAAC;IACxD,OAAO,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,QAAQ,EAAE,cAAc,CAAC,CAAC;AACrD,CAAC;AAED,SAAS,aAAa;IACpB,OAAO,EAAE,OAAO,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC;AACrC,CAAC;AAED,kEAAkE;AAClE,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,IAAI,CAAC,KAAK,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;QAAE,MAAM,IAAI,KAAK,CAAC,iBAAiB,CAAC,CAAC;IAChE,IAAI,IAAI,GAAG,KA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