remote-pi 0.4.3 → 0.5.1
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.
- package/README.md +33 -0
- package/dist/daemon/client.js +5 -2
- package/dist/daemon/client.js.map +1 -1
- package/dist/daemon/control_protocol.d.ts +68 -0
- package/dist/daemon/control_protocol.js.map +1 -1
- package/dist/daemon/cron_log.d.ts +45 -0
- package/dist/daemon/cron_log.js +72 -0
- package/dist/daemon/cron_log.js.map +1 -0
- package/dist/daemon/cron_registry.d.ts +80 -0
- package/dist/daemon/cron_registry.js +194 -0
- package/dist/daemon/cron_registry.js.map +1 -0
- package/dist/daemon/id.d.ts +6 -0
- package/dist/daemon/id.js +6 -0
- package/dist/daemon/id.js.map +1 -1
- package/dist/daemon/install.d.ts +41 -3
- package/dist/daemon/install.js +252 -17
- package/dist/daemon/install.js.map +1 -1
- package/dist/daemon/registry.d.ts +17 -1
- package/dist/daemon/registry.js +34 -4
- package/dist/daemon/registry.js.map +1 -1
- package/dist/daemon/rpc_child.d.ts +91 -0
- package/dist/daemon/rpc_child.js +216 -7
- package/dist/daemon/rpc_child.js.map +1 -1
- package/dist/daemon/supervisor.d.ts +44 -0
- package/dist/daemon/supervisor.js +256 -21
- package/dist/daemon/supervisor.js.map +1 -1
- package/dist/index.d.ts +68 -11
- package/dist/index.js +0 -0
- package/dist/index.js.map +1 -1
- package/dist/mcp/mesh_server.js +18 -9
- package/dist/mcp/mesh_server.js.map +1 -1
- package/dist/pairing/qr.d.ts +8 -1
- package/dist/pairing/qr.js +13 -3
- package/dist/pairing/qr.js.map +1 -1
- package/dist/protocol/codec.js +1 -0
- package/dist/protocol/codec.js.map +1 -1
- package/dist/protocol/types.d.ts +11 -0
- package/dist/rooms.d.ts +20 -0
- package/dist/rooms.js +35 -0
- package/dist/rooms.js.map +1 -1
- package/dist/session/broker.d.ts +79 -3
- package/dist/session/broker.js +155 -28
- package/dist/session/broker.js.map +1 -1
- package/dist/session/broker_remote.d.ts +30 -10
- package/dist/session/broker_remote.js +77 -39
- package/dist/session/broker_remote.js.map +1 -1
- package/dist/session/cwd_lock.d.ts +7 -2
- package/dist/session/cwd_lock.js +39 -9
- package/dist/session/cwd_lock.js.map +1 -1
- package/dist/session/global_config.d.ts +12 -2
- package/dist/session/global_config.js +16 -3
- package/dist/session/global_config.js.map +1 -1
- package/dist/session/ipc.d.ts +27 -0
- package/dist/session/ipc.js +22 -0
- package/dist/session/ipc.js.map +1 -0
- package/dist/session/leader_election.js +8 -2
- package/dist/session/leader_election.js.map +1 -1
- package/dist/session/local_config.d.ts +36 -6
- package/dist/session/local_config.js +103 -28
- package/dist/session/local_config.js.map +1 -1
- package/dist/session/mesh_node.d.ts +15 -1
- package/dist/session/mesh_node.js +26 -5
- package/dist/session/mesh_node.js.map +1 -1
- package/dist/session/peer.d.ts +19 -2
- package/dist/session/peer.js +45 -9
- package/dist/session/peer.js.map +1 -1
- package/dist/session/tools.js +14 -12
- package/dist/session/tools.js.map +1 -1
- package/package.json +2 -1
- package/service-templates/task-launcher.vbs.template +10 -0
- package/service-templates/task-scheduler.xml.template +38 -0
- package/skills/agent-network/SKILL.md +63 -26
package/dist/daemon/install.d.ts
CHANGED
|
@@ -19,7 +19,7 @@
|
|
|
19
19
|
* common cases (npm global, pnpm global, local dev clone) and yields a
|
|
20
20
|
* clear error otherwise.
|
|
21
21
|
*/
|
|
22
|
-
export type SupervisorPlatform = "macos" | "linux" | "unsupported";
|
|
22
|
+
export type SupervisorPlatform = "macos" | "linux" | "windows" | "unsupported";
|
|
23
23
|
export declare function detectPlatform(): SupervisorPlatform;
|
|
24
24
|
/**
|
|
25
25
|
* Absolute path to the supervisor's compiled entry. We resolve from
|
|
@@ -43,9 +43,29 @@ export declare function findSupervisorScript(): string;
|
|
|
43
43
|
*/
|
|
44
44
|
export declare function findRemotePiScript(): string;
|
|
45
45
|
export declare function findNodeBinary(): string;
|
|
46
|
-
export declare function findTemplate(name: "systemd" | "launchd"): string;
|
|
46
|
+
export declare function findTemplate(name: "systemd" | "launchd" | "taskscheduler" | "vbs-launcher"): string;
|
|
47
47
|
export declare function systemdUnitPath(): string;
|
|
48
48
|
export declare function launchdPlistPath(): string;
|
|
49
|
+
export declare const LAUNCHD_LABEL = "dev.remotepi.supervisord";
|
|
50
|
+
/** systemd --user unit name (with `.service`) for the supervisor. */
|
|
51
|
+
export declare const SYSTEMD_UNIT = "remote-pi-supervisord.service";
|
|
52
|
+
/** Windows Task Scheduler task name (plan/40). */
|
|
53
|
+
export declare const WINDOWS_TASK_NAME = "RemotePiSupervisor";
|
|
54
|
+
/** Path of the rendered Task Scheduler XML (input to `schtasks /Create /XML`). */
|
|
55
|
+
export declare function taskXmlPath(): string;
|
|
56
|
+
/**
|
|
57
|
+
* Path of the rendered VBScript launcher the Task Scheduler action invokes
|
|
58
|
+
* via `wscript.exe` (plan/40, Windows). Launching node through this hidden
|
|
59
|
+
* wrapper is what keeps the supervisor from flashing a console window.
|
|
60
|
+
*/
|
|
61
|
+
export declare function vbsLauncherPath(): string;
|
|
62
|
+
/**
|
|
63
|
+
* Combined stdout/stderr log for the Windows supervisor. The Task Scheduler
|
|
64
|
+
* launches it hidden via wscript, so without this redirect its output (and the
|
|
65
|
+
* forwarded daemon-child stderr) would vanish — mirrors launchd/systemd, which
|
|
66
|
+
* already log to `~/.pi/remote/supervisord.log`.
|
|
67
|
+
*/
|
|
68
|
+
export declare function supervisordLogPath(): string;
|
|
49
69
|
export interface RenderVars {
|
|
50
70
|
node: string;
|
|
51
71
|
supervisor: string;
|
|
@@ -54,9 +74,15 @@ export interface RenderVars {
|
|
|
54
74
|
/** PATH inherited so `pi --mode rpc` resolves the same way it does
|
|
55
75
|
* interactively. We snapshot `process.env.PATH` at install time. */
|
|
56
76
|
path: string;
|
|
77
|
+
/** Windows only: absolute path of the VBScript launcher the Task Scheduler
|
|
78
|
+
* action runs via `wscript.exe`. Empty on POSIX (templates ignore `{VBS}`). */
|
|
79
|
+
vbs: string;
|
|
80
|
+
/** Windows only: combined stdout/stderr log the hidden supervisor appends to.
|
|
81
|
+
* Empty on POSIX (templates ignore `{LOG}`). */
|
|
82
|
+
logPath: string;
|
|
57
83
|
}
|
|
58
84
|
export declare function defaultRenderVars(): RenderVars;
|
|
59
|
-
/** Replace `{NODE}` / `{SUPERVISOR}` / `{USER}` / `{HOME}` / `{PATH}`. */
|
|
85
|
+
/** Replace `{NODE}` / `{SUPERVISOR}` / `{USER}` / `{HOME}` / `{PATH}` / `{VBS}` / `{LOG}`. */
|
|
60
86
|
export declare function renderTemplate(template: string, vars: RenderVars): string;
|
|
61
87
|
export interface InstallResult {
|
|
62
88
|
platform: SupervisorPlatform;
|
|
@@ -79,6 +105,13 @@ export interface UninstallResult {
|
|
|
79
105
|
log: string[];
|
|
80
106
|
}
|
|
81
107
|
export declare function uninstallService(): UninstallResult;
|
|
108
|
+
/**
|
|
109
|
+
* Build the batch script run elevated. Each command line redirects its output
|
|
110
|
+
* to `logFile` so the (separate, elevated) process's output can be read back by
|
|
111
|
+
* the parent. Control-flow lines (`if`/`exit`/`rem`/`@`) run bare — redirecting
|
|
112
|
+
* them would swallow the exit code. Pure + exported for tests.
|
|
113
|
+
*/
|
|
114
|
+
export declare function buildElevatedCmd(lines: string[], logFile: string): string;
|
|
82
115
|
export interface LinkBinariesResult {
|
|
83
116
|
/** `~/.local/bin/`. The two symlinks land here. */
|
|
84
117
|
binDir: string;
|
|
@@ -113,7 +146,12 @@ export declare function isOnPath(dir: string, envPath?: string): boolean;
|
|
|
113
146
|
export declare function linkCliBinaries(home?: string, paths?: {
|
|
114
147
|
remotePi?: string;
|
|
115
148
|
supervisord?: string;
|
|
149
|
+
}, opts?: {
|
|
150
|
+
node?: string;
|
|
151
|
+
mutatePath?: boolean;
|
|
116
152
|
}): LinkBinariesResult;
|
|
153
|
+
/** A Windows `.cmd` shim that forwards all args to `node "<target>"`. Pure. */
|
|
154
|
+
export declare function buildCmdShim(node: string, target: string): string;
|
|
117
155
|
/**
|
|
118
156
|
* Remove the symlinks `linkCliBinaries` created. Idempotent — missing
|
|
119
157
|
* links are a no-op. Returns whether each link was actually present so
|
package/dist/daemon/install.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { execFileSync } from "node:child_process";
|
|
2
2
|
import { chmodSync, existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, symlinkSync, unlinkSync, writeFileSync } from "node:fs";
|
|
3
3
|
import { delimiter } from "node:path";
|
|
4
|
-
import { homedir, platform, userInfo } from "node:os";
|
|
4
|
+
import { homedir, platform, tmpdir, userInfo } from "node:os";
|
|
5
5
|
import { dirname, join, resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
7
|
export function detectPlatform() {
|
|
8
8
|
switch (platform()) {
|
|
9
9
|
case "darwin": return "macos";
|
|
10
10
|
case "linux": return "linux";
|
|
11
|
+
case "win32": return "windows";
|
|
11
12
|
default: return "unsupported";
|
|
12
13
|
}
|
|
13
14
|
}
|
|
@@ -57,9 +58,10 @@ export function findTemplate(name) {
|
|
|
57
58
|
// same — `service-templates/` is sibling to `dist/`.
|
|
58
59
|
const here = fileURLToPath(import.meta.url); // dist/daemon/install.js
|
|
59
60
|
const pkgRoot = resolve(dirname(dirname(dirname(here)))); // package root
|
|
60
|
-
const file = name === "systemd"
|
|
61
|
-
? "
|
|
62
|
-
|
|
61
|
+
const file = name === "systemd" ? "systemd.service.template" :
|
|
62
|
+
name === "launchd" ? "launchd.plist.template" :
|
|
63
|
+
name === "vbs-launcher" ? "task-launcher.vbs.template" :
|
|
64
|
+
"task-scheduler.xml.template";
|
|
63
65
|
return resolve(pkgRoot, "service-templates", file);
|
|
64
66
|
}
|
|
65
67
|
// ── Service paths ──────────────────────────────────────────────────────────
|
|
@@ -69,7 +71,32 @@ export function systemdUnitPath() {
|
|
|
69
71
|
export function launchdPlistPath() {
|
|
70
72
|
return join(homedir(), "Library", "LaunchAgents", "dev.remotepi.supervisord.plist");
|
|
71
73
|
}
|
|
72
|
-
const LAUNCHD_LABEL = "dev.remotepi.supervisord";
|
|
74
|
+
export const LAUNCHD_LABEL = "dev.remotepi.supervisord";
|
|
75
|
+
/** systemd --user unit name (with `.service`) for the supervisor. */
|
|
76
|
+
export const SYSTEMD_UNIT = "remote-pi-supervisord.service";
|
|
77
|
+
/** Windows Task Scheduler task name (plan/40). */
|
|
78
|
+
export const WINDOWS_TASK_NAME = "RemotePiSupervisor";
|
|
79
|
+
/** Path of the rendered Task Scheduler XML (input to `schtasks /Create /XML`). */
|
|
80
|
+
export function taskXmlPath() {
|
|
81
|
+
return join(homedir(), ".pi", "remote", "RemotePiSupervisor.xml");
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Path of the rendered VBScript launcher the Task Scheduler action invokes
|
|
85
|
+
* via `wscript.exe` (plan/40, Windows). Launching node through this hidden
|
|
86
|
+
* wrapper is what keeps the supervisor from flashing a console window.
|
|
87
|
+
*/
|
|
88
|
+
export function vbsLauncherPath() {
|
|
89
|
+
return join(homedir(), ".pi", "remote", "RemotePiSupervisorLauncher.vbs");
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Combined stdout/stderr log for the Windows supervisor. The Task Scheduler
|
|
93
|
+
* launches it hidden via wscript, so without this redirect its output (and the
|
|
94
|
+
* forwarded daemon-child stderr) would vanish — mirrors launchd/systemd, which
|
|
95
|
+
* already log to `~/.pi/remote/supervisord.log`.
|
|
96
|
+
*/
|
|
97
|
+
export function supervisordLogPath() {
|
|
98
|
+
return join(homedir(), ".pi", "remote", "supervisord.log");
|
|
99
|
+
}
|
|
73
100
|
export function defaultRenderVars() {
|
|
74
101
|
return {
|
|
75
102
|
node: findNodeBinary(),
|
|
@@ -77,16 +104,20 @@ export function defaultRenderVars() {
|
|
|
77
104
|
home: homedir(),
|
|
78
105
|
user: userInfo().username,
|
|
79
106
|
path: process.env["PATH"] ?? "/usr/local/bin:/usr/bin:/bin",
|
|
107
|
+
vbs: vbsLauncherPath(),
|
|
108
|
+
logPath: supervisordLogPath(),
|
|
80
109
|
};
|
|
81
110
|
}
|
|
82
|
-
/** Replace `{NODE}` / `{SUPERVISOR}` / `{USER}` / `{HOME}` / `{PATH}`. */
|
|
111
|
+
/** Replace `{NODE}` / `{SUPERVISOR}` / `{USER}` / `{HOME}` / `{PATH}` / `{VBS}` / `{LOG}`. */
|
|
83
112
|
export function renderTemplate(template, vars) {
|
|
84
113
|
return template
|
|
85
114
|
.replace(/\{NODE\}/g, vars.node)
|
|
86
115
|
.replace(/\{SUPERVISOR\}/g, vars.supervisor)
|
|
87
116
|
.replace(/\{USER\}/g, vars.user)
|
|
88
117
|
.replace(/\{HOME\}/g, vars.home)
|
|
89
|
-
.replace(/\{PATH\}/g, vars.path)
|
|
118
|
+
.replace(/\{PATH\}/g, vars.path)
|
|
119
|
+
.replace(/\{VBS\}/g, vars.vbs)
|
|
120
|
+
.replace(/\{LOG\}/g, vars.logPath);
|
|
90
121
|
}
|
|
91
122
|
/**
|
|
92
123
|
* Writes the unit/plist, runs the platform's activation command. Throws
|
|
@@ -99,22 +130,32 @@ export function installService(vars = defaultRenderVars()) {
|
|
|
99
130
|
const plat = detectPlatform();
|
|
100
131
|
const log = [];
|
|
101
132
|
if (plat === "unsupported") {
|
|
102
|
-
throw new Error(`unsupported platform: ${platform()}. Only macOS and
|
|
133
|
+
throw new Error(`unsupported platform: ${platform()}. Only macOS, Linux, and Windows.`);
|
|
103
134
|
}
|
|
104
135
|
// Sanity: supervisor script must exist on disk.
|
|
105
136
|
if (!existsSync(vars.supervisor)) {
|
|
106
137
|
throw new Error(`supervisor script not found at ${vars.supervisor}. ` +
|
|
107
138
|
"Run `pnpm build` (dev) or `npm install -g remote-pi` (prod) first.");
|
|
108
139
|
}
|
|
109
|
-
const
|
|
140
|
+
const templateName = plat === "macos" ? "launchd" : plat === "linux" ? "systemd" : "taskscheduler";
|
|
141
|
+
const templatePath = findTemplate(templateName);
|
|
110
142
|
if (!existsSync(templatePath)) {
|
|
111
143
|
throw new Error(`service template missing: ${templatePath}`);
|
|
112
144
|
}
|
|
113
145
|
const tpl = readFileSync(templatePath, "utf8");
|
|
114
146
|
const rendered = renderTemplate(tpl, vars);
|
|
115
|
-
const unitPath = plat === "macos" ? launchdPlistPath() : systemdUnitPath();
|
|
147
|
+
const unitPath = plat === "macos" ? launchdPlistPath() : plat === "linux" ? systemdUnitPath() : taskXmlPath();
|
|
116
148
|
mkdirSync(dirname(unitPath), { recursive: true });
|
|
117
|
-
|
|
149
|
+
if (plat === "windows") {
|
|
150
|
+
// `schtasks /Create /XML` requires UTF-16LE + BOM. A UTF-8 file fails with
|
|
151
|
+
// "(1,40)::ERROR: unable to switch the encoding" — the bytes must match the
|
|
152
|
+
// template's `encoding="UTF-16"` declaration. (plan/40 risk #5.)
|
|
153
|
+
const bom = Buffer.from([0xff, 0xfe]); // UTF-16LE byte-order mark
|
|
154
|
+
writeFileSync(unitPath, Buffer.concat([bom, Buffer.from(rendered, "utf16le")]));
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
writeFileSync(unitPath, rendered); // launchd/systemd → UTF-8
|
|
158
|
+
}
|
|
118
159
|
log.push(`wrote ${unitPath}`);
|
|
119
160
|
if (plat === "macos") {
|
|
120
161
|
// Unload first in case a stale entry exists from a prior install —
|
|
@@ -126,30 +167,66 @@ export function installService(vars = defaultRenderVars()) {
|
|
|
126
167
|
_exec("launchctl", ["bootstrap", `gui/${uid}`, unitPath], log);
|
|
127
168
|
log.push(`activated via launchctl bootstrap gui/${uid}`);
|
|
128
169
|
}
|
|
129
|
-
else {
|
|
170
|
+
else if (plat === "linux") {
|
|
130
171
|
_exec("systemctl", ["--user", "daemon-reload"], log);
|
|
131
172
|
_exec("systemctl", ["--user", "enable", "--now", "remote-pi-supervisord.service"], log);
|
|
132
173
|
log.push("activated via systemctl --user enable --now");
|
|
133
174
|
}
|
|
175
|
+
else {
|
|
176
|
+
// windows — Task Scheduler (plan/40). The action runs `wscript.exe
|
|
177
|
+
// <launcher.vbs>` (not node directly) so the supervisor starts hidden,
|
|
178
|
+
// with no console window. Render + write that launcher first.
|
|
179
|
+
const vbsTpl = findTemplate("vbs-launcher");
|
|
180
|
+
if (!existsSync(vbsTpl))
|
|
181
|
+
throw new Error(`vbs launcher template missing: ${vbsTpl}`);
|
|
182
|
+
const vbsPath = vars.vbs;
|
|
183
|
+
writeFileSync(vbsPath, renderTemplate(readFileSync(vbsTpl, "utf8"), vars));
|
|
184
|
+
log.push(`wrote ${vbsPath}`);
|
|
185
|
+
// Only `schtasks /Create` modifies the root task store → that single op
|
|
186
|
+
// needs admin (elevate it via UAC). `/End` (stop a prior instance) and
|
|
187
|
+
// `/Run` (start it) act on a task we already own and work un-elevated — the
|
|
188
|
+
// very ops `remote-pi restart-supervisor` runs without elevation. Keeping
|
|
189
|
+
// them un-elevated narrows the admin surface to the one operation that
|
|
190
|
+
// truly requires it.
|
|
191
|
+
_tryExec("schtasks", ["/End", "/TN", WINDOWS_TASK_NAME], log);
|
|
192
|
+
_execElevatedWindows([
|
|
193
|
+
`schtasks /Create /XML "${unitPath}" /TN ${WINDOWS_TASK_NAME} /F`,
|
|
194
|
+
], log);
|
|
195
|
+
_exec("schtasks", ["/Run", "/TN", WINDOWS_TASK_NAME], log);
|
|
196
|
+
log.push(`activated via schtasks /Create (elevated) + /Run (${WINDOWS_TASK_NAME})`);
|
|
197
|
+
}
|
|
134
198
|
return { platform: plat, unitPath, log };
|
|
135
199
|
}
|
|
136
200
|
export function uninstallService() {
|
|
137
201
|
const plat = detectPlatform();
|
|
138
202
|
const log = [];
|
|
139
203
|
if (plat === "unsupported") {
|
|
140
|
-
throw new Error(`unsupported platform: ${platform()}. Only macOS and
|
|
204
|
+
throw new Error(`unsupported platform: ${platform()}. Only macOS, Linux, and Windows.`);
|
|
141
205
|
}
|
|
142
|
-
const unitPath = plat === "macos" ? launchdPlistPath() : systemdUnitPath();
|
|
206
|
+
const unitPath = plat === "macos" ? launchdPlistPath() : plat === "linux" ? systemdUnitPath() : taskXmlPath();
|
|
143
207
|
if (plat === "macos") {
|
|
144
208
|
const uid = userInfo().uid;
|
|
145
209
|
_tryExec("launchctl", ["bootout", `gui/${uid}`, unitPath], log);
|
|
146
210
|
_tryExec("launchctl", ["unload", unitPath], log);
|
|
147
211
|
log.push("deactivated via launchctl bootout");
|
|
148
212
|
}
|
|
149
|
-
else {
|
|
213
|
+
else if (plat === "linux") {
|
|
150
214
|
_tryExec("systemctl", ["--user", "disable", "--now", "remote-pi-supervisord.service"], log);
|
|
151
215
|
log.push("deactivated via systemctl --user disable --now");
|
|
152
216
|
}
|
|
217
|
+
else {
|
|
218
|
+
// windows — Task Scheduler (plan/40): stop + delete the task. Only
|
|
219
|
+
// `/Delete` modifies the root task store → that's the op that needs admin.
|
|
220
|
+
// `/End` stops the running task and works un-elevated (own task), like
|
|
221
|
+
// restart-supervisor. `exit /b 0` keeps uninstall best-effort: a missing
|
|
222
|
+
// task (already removed) is success, not an error.
|
|
223
|
+
_tryExec("schtasks", ["/End", "/TN", WINDOWS_TASK_NAME], log);
|
|
224
|
+
_execElevatedWindows([
|
|
225
|
+
`schtasks /Delete /TN ${WINDOWS_TASK_NAME} /F`,
|
|
226
|
+
`exit /b 0`,
|
|
227
|
+
], log);
|
|
228
|
+
log.push(`deactivated via elevated schtasks /Delete (${WINDOWS_TASK_NAME})`);
|
|
229
|
+
}
|
|
153
230
|
let removed = false;
|
|
154
231
|
if (existsSync(unitPath)) {
|
|
155
232
|
try {
|
|
@@ -161,6 +238,19 @@ export function uninstallService() {
|
|
|
161
238
|
log.push(`failed to remove ${unitPath}: ${String(e)}`);
|
|
162
239
|
}
|
|
163
240
|
}
|
|
241
|
+
// Windows: also drop the hidden VBScript launcher we wrote alongside the XML.
|
|
242
|
+
if (plat === "windows") {
|
|
243
|
+
const vbsPath = vbsLauncherPath();
|
|
244
|
+
if (existsSync(vbsPath)) {
|
|
245
|
+
try {
|
|
246
|
+
unlinkSync(vbsPath);
|
|
247
|
+
log.push(`removed ${vbsPath}`);
|
|
248
|
+
}
|
|
249
|
+
catch (e) {
|
|
250
|
+
log.push(`failed to remove ${vbsPath}: ${String(e)}`);
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
}
|
|
164
254
|
if (plat === "linux") {
|
|
165
255
|
_tryExec("systemctl", ["--user", "daemon-reload"], log);
|
|
166
256
|
}
|
|
@@ -192,6 +282,76 @@ function _tryExec(cmd, args, log) {
|
|
|
192
282
|
}
|
|
193
283
|
catch { /* expected, suppress */ }
|
|
194
284
|
}
|
|
285
|
+
// ── Windows elevation (plan/40) ────────────────────────────────────────────
|
|
286
|
+
//
|
|
287
|
+
// `schtasks /Create` and `/Delete` register/remove the task in the root folder,
|
|
288
|
+
// which requires administrator rights. We can't elevate the current Node
|
|
289
|
+
// process, so we render the schtasks sequence into a temp `.cmd`, run it
|
|
290
|
+
// through an elevated `cmd.exe` via PowerShell `Start-Process -Verb RunAs`
|
|
291
|
+
// (one UAC prompt), and read the output back from a log file the script
|
|
292
|
+
// redirects into.
|
|
293
|
+
/**
|
|
294
|
+
* Build the batch script run elevated. Each command line redirects its output
|
|
295
|
+
* to `logFile` so the (separate, elevated) process's output can be read back by
|
|
296
|
+
* the parent. Control-flow lines (`if`/`exit`/`rem`/`@`) run bare — redirecting
|
|
297
|
+
* them would swallow the exit code. Pure + exported for tests.
|
|
298
|
+
*/
|
|
299
|
+
export function buildElevatedCmd(lines, logFile) {
|
|
300
|
+
const redirect = ` >> "${logFile}" 2>&1`;
|
|
301
|
+
const body = lines.map((ln) => /^\s*(if|exit|rem|@)/i.test(ln) ? ln : ln + redirect);
|
|
302
|
+
return ["@echo off", ...body].join("\r\n") + "\r\n";
|
|
303
|
+
}
|
|
304
|
+
function _readIfExists(p) {
|
|
305
|
+
try {
|
|
306
|
+
return readFileSync(p, "utf8");
|
|
307
|
+
}
|
|
308
|
+
catch {
|
|
309
|
+
return "";
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* Run a schtasks command sequence elevated (UAC). Throws a clear error when the
|
|
314
|
+
* prompt is declined or the task operation fails (`Start-Process -Verb RunAs`
|
|
315
|
+
* throws → PowerShell exits non-zero → `execFileSync` throws). Captured schtasks
|
|
316
|
+
* output is appended to `log` either way.
|
|
317
|
+
*/
|
|
318
|
+
function _execElevatedWindows(lines, log) {
|
|
319
|
+
const base = join(tmpdir(), `remote-pi-elevate-${process.pid}`);
|
|
320
|
+
const cmdPath = `${base}.cmd`;
|
|
321
|
+
const logFile = `${base}.log`;
|
|
322
|
+
writeFileSync(cmdPath, buildElevatedCmd(lines, logFile));
|
|
323
|
+
try {
|
|
324
|
+
unlinkSync(logFile);
|
|
325
|
+
}
|
|
326
|
+
catch { /* none yet */ }
|
|
327
|
+
let thrown = null;
|
|
328
|
+
try {
|
|
329
|
+
execFileSync("powershell", [
|
|
330
|
+
"-NoProfile", "-NonInteractive", "-Command",
|
|
331
|
+
`$p = Start-Process -FilePath cmd.exe -ArgumentList '/c','"${cmdPath}"' ` +
|
|
332
|
+
"-Verb RunAs -Wait -PassThru -WindowStyle Hidden; exit $p.ExitCode",
|
|
333
|
+
], { stdio: ["ignore", "pipe", "pipe"] });
|
|
334
|
+
}
|
|
335
|
+
catch (e) {
|
|
336
|
+
thrown = e;
|
|
337
|
+
}
|
|
338
|
+
const out = _readIfExists(logFile).trim();
|
|
339
|
+
if (out)
|
|
340
|
+
log.push(out);
|
|
341
|
+
try {
|
|
342
|
+
unlinkSync(cmdPath);
|
|
343
|
+
}
|
|
344
|
+
catch { /* best-effort */ }
|
|
345
|
+
try {
|
|
346
|
+
unlinkSync(logFile);
|
|
347
|
+
}
|
|
348
|
+
catch { /* best-effort */ }
|
|
349
|
+
if (thrown) {
|
|
350
|
+
throw new Error("administrator privileges required — the UAC prompt was declined or the " +
|
|
351
|
+
"schtasks operation failed. Run the command again and accept the Windows " +
|
|
352
|
+
`elevation prompt.${out ? `\n${out}` : ""}`);
|
|
353
|
+
}
|
|
354
|
+
}
|
|
195
355
|
export function userLocalBinDir(home = homedir()) {
|
|
196
356
|
return join(home, ".local", "bin");
|
|
197
357
|
}
|
|
@@ -214,8 +374,14 @@ export function isOnPath(dir, envPath = process.env["PATH"] ?? "") {
|
|
|
214
374
|
* The caller is responsible for surfacing the shell-rc instruction —
|
|
215
375
|
* we don't edit the user's shell config files automatically.
|
|
216
376
|
*/
|
|
217
|
-
export function linkCliBinaries(home = homedir(), paths = {}) {
|
|
377
|
+
export function linkCliBinaries(home = homedir(), paths = {}, opts = {}) {
|
|
218
378
|
const binDir = userLocalBinDir(home);
|
|
379
|
+
// Windows (plan/40): no POSIX symlinks. Installing via Pi (`pi install
|
|
380
|
+
// npm:remote-pi`) never reaches PATH, so write real `.cmd` shims into
|
|
381
|
+
// `~/.local/bin` and add that dir to the user's PATH (HKCU — no admin).
|
|
382
|
+
if (platform() === "win32") {
|
|
383
|
+
return _linkCliBinariesWindows(home, binDir, paths, opts);
|
|
384
|
+
}
|
|
219
385
|
const log = [];
|
|
220
386
|
mkdirSync(binDir, { recursive: true });
|
|
221
387
|
log.push(`ensured ${binDir}`);
|
|
@@ -256,10 +422,79 @@ export function linkCliBinaries(home = homedir(), paths = {}) {
|
|
|
256
422
|
}
|
|
257
423
|
return { binDir, links, onPath, log };
|
|
258
424
|
}
|
|
425
|
+
/**
|
|
426
|
+
* Windows variant of `linkCliBinaries`: writes `remote-pi.cmd` +
|
|
427
|
+
* `pi-supervisord.cmd` shims into `~/.local/bin` and ensures that dir is on the
|
|
428
|
+
* user's PATH (User scope — no admin). `opts.node` overrides the node binary
|
|
429
|
+
* (tests); `opts.mutatePath === false` skips the real PATH mutation (tests).
|
|
430
|
+
*/
|
|
431
|
+
function _linkCliBinariesWindows(home, binDir, paths, opts) {
|
|
432
|
+
void home;
|
|
433
|
+
const log = [];
|
|
434
|
+
mkdirSync(binDir, { recursive: true });
|
|
435
|
+
log.push(`ensured ${binDir}`);
|
|
436
|
+
const node = opts.node ?? findNodeBinary();
|
|
437
|
+
const remotePi = paths.remotePi ?? findRemotePiScript();
|
|
438
|
+
const supervisord = paths.supervisord ?? findSupervisorScript();
|
|
439
|
+
if (!existsSync(remotePi)) {
|
|
440
|
+
throw new Error(`remote-pi script not found at ${remotePi}. ` +
|
|
441
|
+
"Run `pnpm build` (dev) or reinstall the extension.");
|
|
442
|
+
}
|
|
443
|
+
if (!existsSync(supervisord)) {
|
|
444
|
+
throw new Error(`supervisor script not found at ${supervisord}. ` +
|
|
445
|
+
"Run `pnpm build` (dev) or reinstall the extension.");
|
|
446
|
+
}
|
|
447
|
+
const links = [
|
|
448
|
+
{ name: "remote-pi.cmd", path: join(binDir, "remote-pi.cmd"), target: remotePi },
|
|
449
|
+
{ name: "pi-supervisord.cmd", path: join(binDir, "pi-supervisord.cmd"), target: supervisord },
|
|
450
|
+
];
|
|
451
|
+
for (const link of links) {
|
|
452
|
+
writeFileSync(link.path, buildCmdShim(node, link.target));
|
|
453
|
+
log.push(`wrote ${link.path}`);
|
|
454
|
+
}
|
|
455
|
+
const onPath = isOnPath(binDir);
|
|
456
|
+
if (!onPath && opts.mutatePath !== false) {
|
|
457
|
+
try {
|
|
458
|
+
_addUserPath(binDir);
|
|
459
|
+
log.push(`added ${binDir} to your user PATH — open a NEW terminal for \`remote-pi\` to resolve.`);
|
|
460
|
+
}
|
|
461
|
+
catch (e) {
|
|
462
|
+
log.push(`WARNING: ${binDir} is not on PATH and auto-add failed (${String(e)}). ` +
|
|
463
|
+
`Add it manually: setx PATH "%PATH%;${binDir}"`);
|
|
464
|
+
}
|
|
465
|
+
}
|
|
466
|
+
return { binDir, links, onPath, log };
|
|
467
|
+
}
|
|
468
|
+
/** A Windows `.cmd` shim that forwards all args to `node "<target>"`. Pure. */
|
|
469
|
+
export function buildCmdShim(node, target) {
|
|
470
|
+
return `@echo off\r\n"${node}" "${target}" %*\r\n`;
|
|
471
|
+
}
|
|
472
|
+
/**
|
|
473
|
+
* Append `dir` to the User-scope PATH via PowerShell (HKCU\Environment — no
|
|
474
|
+
* admin). Idempotent: skips when `dir` is already an exact PATH segment. Single-
|
|
475
|
+
* quoted PS literal (backslashes are literal in PS single quotes) with embedded
|
|
476
|
+
* `'` doubled.
|
|
477
|
+
*/
|
|
478
|
+
function _addUserPath(dir) {
|
|
479
|
+
const lit = `'${dir.replace(/'/g, "''")}'`;
|
|
480
|
+
execFileSync("powershell", [
|
|
481
|
+
"-NoProfile", "-NonInteractive", "-Command",
|
|
482
|
+
`$d = ${lit}; ` +
|
|
483
|
+
"$p = [Environment]::GetEnvironmentVariable('Path','User'); " +
|
|
484
|
+
"if (-not $p) { $p = '' }; " +
|
|
485
|
+
"$parts = $p.Split(';') | Where-Object { $_ -ne '' }; " +
|
|
486
|
+
"if ($parts -notcontains $d) { " +
|
|
487
|
+
"[Environment]::SetEnvironmentVariable('Path', (($parts + $d) -join ';'), 'User') }",
|
|
488
|
+
], { stdio: ["ignore", "pipe", "pipe"] });
|
|
489
|
+
}
|
|
259
490
|
export function unlinkCliBinaries(home = homedir()) {
|
|
260
491
|
const binDir = userLocalBinDir(home);
|
|
261
492
|
const log = [];
|
|
262
|
-
|
|
493
|
+
// Windows shims are `.cmd` files (linkCliBinaries writes those); POSIX uses
|
|
494
|
+
// extensionless symlinks. Match what was actually created on this platform.
|
|
495
|
+
const names = platform() === "win32"
|
|
496
|
+
? ["remote-pi.cmd", "pi-supervisord.cmd"]
|
|
497
|
+
: ["remote-pi", "pi-supervisord"];
|
|
263
498
|
const removed = [];
|
|
264
499
|
for (const name of names) {
|
|
265
500
|
const path = join(binDir, name);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/daemon/install.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,SAAS,EAAE,YAAY,EAAE,YAAY,EAAE,WAAW,EAAE,UAAU,EAA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ED,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,CAAC;AAClC,CAAC;AAED;;;;;GAKG;AACH,SAAS,eAAe,CAAC,QAAgB,EAAE,MAAc,EAAE,GAAa;IACtE,IAAI,QAAQ,GAAkB,IAAI,CAAC;IACnC,IAAI,CAAC;QACH,QAAQ,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;IACpC,CAAC;IAAC,MAAM,CAAC,CAAC,qCAAqC,CAAC,CAAC;IAEjD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACxB,GAAG,CAAC,IAAI,CAAC,WAAW,QAAQ,MAAM,MAAM,cAAc,CAAC,CAAC;QACxD,OAAO;IACT,CAAC;IAED,sEAAsE;IACtE,IAAI,CAAC;QAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;IAAC,CAAC;IAAC,MAAM,CAAC,CAAC,oBAAoB,CAAC,CAAC;IAC5D,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,CAAC;IAC9B,GAAG,CAAC,IAAI,CAAC,WAAW,QAAQ,MAAM,MAAM,EAAE,CAAC,CAAC;AAC9C,CAAC"}
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
export interface DaemonEntry {
|
|
2
2
|
/** Absolute realpath of the cwd this daemon manages. */
|
|
3
3
|
cwd: string;
|
|
4
|
+
/**
|
|
5
|
+
* Display name (mesh `agent_name`). Persisted here because the supervisor
|
|
6
|
+
* now injects the daemon's config via `REMOTE_PI_DIRECT_CONFIG` at spawn
|
|
7
|
+
* instead of reading a per-cwd `.pi/remote-pi/config.json`. Legacy entries
|
|
8
|
+
* (cwd only) fall back to `defaultAgentName(cwd)`.
|
|
9
|
+
*/
|
|
10
|
+
name?: string;
|
|
4
11
|
}
|
|
5
12
|
export interface DaemonRegistry {
|
|
6
13
|
daemons: DaemonEntry[];
|
|
@@ -22,9 +29,10 @@ export declare function saveRegistry(reg: DaemonRegistry): void;
|
|
|
22
29
|
* present). Returns the derived id + normalized cwd so the caller can
|
|
23
30
|
* report it back to the user.
|
|
24
31
|
*/
|
|
25
|
-
export declare function addDaemon(rawCwd: string): {
|
|
32
|
+
export declare function addDaemon(rawCwd: string, name?: string): {
|
|
26
33
|
id: string;
|
|
27
34
|
cwd: string;
|
|
35
|
+
name: string;
|
|
28
36
|
};
|
|
29
37
|
/**
|
|
30
38
|
* Removes the daemon entry whose derived id matches `id`. Returns the
|
|
@@ -40,7 +48,15 @@ export declare function removeDaemon(id: string): {
|
|
|
40
48
|
export declare function listDaemons(): Array<{
|
|
41
49
|
id: string;
|
|
42
50
|
cwd: string;
|
|
51
|
+
name: string;
|
|
43
52
|
}>;
|
|
53
|
+
/**
|
|
54
|
+
* One-shot migration: backfill `name` (folder-derived) into legacy entries
|
|
55
|
+
* that predate the name field, persisting the change to `daemons.json`.
|
|
56
|
+
* Idempotent — writes only when something was missing. Returns how many
|
|
57
|
+
* entries were backfilled. The supervisor runs this on start.
|
|
58
|
+
*/
|
|
59
|
+
export declare function migrateRegistryNames(): number;
|
|
44
60
|
/** Test/diag-only: returns the on-disk path. Exported so tests can poke
|
|
45
61
|
* at it (e.g. tmpdir override is done via env, but for now the path is
|
|
46
62
|
* hardcoded to ~/.pi/remote/daemons.json). */
|
package/dist/daemon/registry.js
CHANGED
|
@@ -2,6 +2,7 @@ import { existsSync, mkdirSync, readFileSync, realpathSync, writeFileSync } from
|
|
|
2
2
|
import { homedir } from "node:os";
|
|
3
3
|
import { dirname, isAbsolute, join, resolve as resolvePath } from "node:path";
|
|
4
4
|
import { daemonIdForCwd } from "./id.js";
|
|
5
|
+
import { defaultAgentName } from "../session/local_config.js";
|
|
5
6
|
/**
|
|
6
7
|
* The global daemon registry: which working directories are promoted to
|
|
7
8
|
* always-on daemons under the supervisor.
|
|
@@ -64,7 +65,11 @@ export function loadRegistry() {
|
|
|
64
65
|
continue;
|
|
65
66
|
const cwd = item.cwd;
|
|
66
67
|
if (typeof cwd === "string" && cwd.length > 0) {
|
|
67
|
-
|
|
68
|
+
const rawName = item.name;
|
|
69
|
+
const entry = { cwd };
|
|
70
|
+
if (typeof rawName === "string" && rawName.length > 0)
|
|
71
|
+
entry.name = rawName;
|
|
72
|
+
daemons.push(entry);
|
|
68
73
|
}
|
|
69
74
|
}
|
|
70
75
|
return { daemons };
|
|
@@ -82,15 +87,18 @@ export function saveRegistry(reg) {
|
|
|
82
87
|
* present). Returns the derived id + normalized cwd so the caller can
|
|
83
88
|
* report it back to the user.
|
|
84
89
|
*/
|
|
85
|
-
export function addDaemon(rawCwd) {
|
|
90
|
+
export function addDaemon(rawCwd, name) {
|
|
86
91
|
const cwd = normalizeCwd(rawCwd);
|
|
87
92
|
const reg = loadRegistry();
|
|
88
93
|
if (reg.daemons.some((d) => d.cwd === cwd)) {
|
|
89
94
|
throw new Error(`Daemon already registered for cwd: ${cwd}`);
|
|
90
95
|
}
|
|
91
|
-
|
|
96
|
+
// Always persist a name (the registry is the source of truth now that the
|
|
97
|
+
// supervisor injects config via env instead of a local config file).
|
|
98
|
+
const resolvedName = name?.trim() || defaultAgentName(cwd);
|
|
99
|
+
reg.daemons.push({ cwd, name: resolvedName });
|
|
92
100
|
saveRegistry(reg);
|
|
93
|
-
return { id: daemonIdForCwd(cwd), cwd };
|
|
101
|
+
return { id: daemonIdForCwd(cwd), cwd, name: resolvedName };
|
|
94
102
|
}
|
|
95
103
|
/**
|
|
96
104
|
* Removes the daemon entry whose derived id matches `id`. Returns the
|
|
@@ -112,8 +120,30 @@ export function listDaemons() {
|
|
|
112
120
|
return loadRegistry().daemons.map((d) => ({
|
|
113
121
|
id: daemonIdForCwd(d.cwd),
|
|
114
122
|
cwd: d.cwd,
|
|
123
|
+
// Legacy entries (cwd only) fall back to the folder-derived name so a
|
|
124
|
+
// daemon is never nameless. New entries already carry an explicit name.
|
|
125
|
+
name: d.name ?? defaultAgentName(d.cwd),
|
|
115
126
|
}));
|
|
116
127
|
}
|
|
128
|
+
/**
|
|
129
|
+
* One-shot migration: backfill `name` (folder-derived) into legacy entries
|
|
130
|
+
* that predate the name field, persisting the change to `daemons.json`.
|
|
131
|
+
* Idempotent — writes only when something was missing. Returns how many
|
|
132
|
+
* entries were backfilled. The supervisor runs this on start.
|
|
133
|
+
*/
|
|
134
|
+
export function migrateRegistryNames() {
|
|
135
|
+
const reg = loadRegistry();
|
|
136
|
+
let changed = 0;
|
|
137
|
+
for (const d of reg.daemons) {
|
|
138
|
+
if (!d.name) {
|
|
139
|
+
d.name = defaultAgentName(d.cwd);
|
|
140
|
+
changed++;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
if (changed > 0)
|
|
144
|
+
saveRegistry(reg);
|
|
145
|
+
return changed;
|
|
146
|
+
}
|
|
117
147
|
/** Test/diag-only: returns the on-disk path. Exported so tests can poke
|
|
118
148
|
* at it (e.g. tmpdir override is done via env, but for now the path is
|
|
119
149
|
* hardcoded to ~/.pi/remote/daemons.json). */
|