sessionpipe-core 0.13.5 → 0.13.7
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/dist/control.js +1 -1
- package/dist/index.js +1 -1
- package/dist/schema.js +1 -1
- package/dist/service.js +40 -4
- package/dist/service.js.map +2 -2
- package/dist/src/service/index.d.ts +5 -2
- package/dist/src/service/index.d.ts.map +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/control.js
CHANGED
package/dist/index.js
CHANGED
package/dist/schema.js
CHANGED
package/dist/service.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
// sessionpipe-core 0.13.
|
|
1
|
+
// sessionpipe-core 0.13.7 · Apache-2.0 · https://sessionpipe.org
|
|
2
2
|
|
|
3
3
|
// src/service/index.ts
|
|
4
4
|
import { execFileSync } from "node:child_process";
|
|
@@ -68,6 +68,11 @@ function ensureLinger(user, exec = execQuiet) {
|
|
|
68
68
|
};
|
|
69
69
|
}
|
|
70
70
|
var line = (cmd, args) => [cmd, ...args].join(" ");
|
|
71
|
+
var sleepSync = (ms) => {
|
|
72
|
+
Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);
|
|
73
|
+
};
|
|
74
|
+
var LET_GO_MS = 1e4;
|
|
75
|
+
var LOOK_MS = 100;
|
|
71
76
|
function installService(o) {
|
|
72
77
|
const f = serviceFiles(o);
|
|
73
78
|
const platform = o.platform ?? process.platform;
|
|
@@ -90,12 +95,43 @@ function installService(o) {
|
|
|
90
95
|
run("launchctl", ["bootout", `${d}/${uid}/${o.label}`]);
|
|
91
96
|
} catch {
|
|
92
97
|
}
|
|
98
|
+
let refusal;
|
|
99
|
+
const gui = () => {
|
|
100
|
+
try {
|
|
101
|
+
run("launchctl", ["bootstrap", `gui/${uid}`, f.plist.path]);
|
|
102
|
+
return true;
|
|
103
|
+
} catch (e) {
|
|
104
|
+
refusal = e;
|
|
105
|
+
return false;
|
|
106
|
+
}
|
|
107
|
+
};
|
|
108
|
+
const started = { files: [f.plist], commands, manager: "launchd", domain: "gui" };
|
|
109
|
+
if (gui()) return started;
|
|
110
|
+
const has = (target) => {
|
|
111
|
+
try {
|
|
112
|
+
real("launchctl", ["print", target]);
|
|
113
|
+
return true;
|
|
114
|
+
} catch {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
const atScreen = has(`gui/${uid}`);
|
|
119
|
+
const there = () => has(`gui/${uid}/${o.label}`) || has(`user/${uid}/${o.label}`);
|
|
120
|
+
if (atScreen) {
|
|
121
|
+
const sleep = o.sleep ?? sleepSync;
|
|
122
|
+
for (let waited = 0; waited < LET_GO_MS && there(); waited += LOOK_MS) sleep(LOOK_MS);
|
|
123
|
+
if (gui()) return started;
|
|
124
|
+
}
|
|
93
125
|
try {
|
|
94
|
-
run("launchctl", ["bootstrap", `
|
|
95
|
-
return { files: [f.plist], commands, manager: "launchd", domain: "gui" };
|
|
126
|
+
run("launchctl", ["bootstrap", `user/${uid}`, f.plist.path]);
|
|
96
127
|
} catch {
|
|
128
|
+
const code = refusal.status;
|
|
129
|
+
const said = typeof code === "number" ? ` (launchctl answered ${code})` : "";
|
|
130
|
+
const by = `\`launchctl bootstrap gui/${uid} ${f.plist.path}\``;
|
|
131
|
+
throw new Error(
|
|
132
|
+
!atScreen ? `launchd didn't start ${o.label}${said}: no login at this Mac's screen can be seen from here (nobody is logged in there, or launchctl is blocked). From a login at the screen, ${by} starts it (its file is written)` : there() ? `launchd didn't start the new ${o.label}${said}: the one that was running is still loaded. \`launchctl bootout gui/${uid}/${o.label}\`, then ${by} (its file is written)` : `launchd didn't start ${o.label}${said}, and nothing runs it now: ${by} starts it (its file is written)`
|
|
133
|
+
);
|
|
97
134
|
}
|
|
98
|
-
run("launchctl", ["bootstrap", `user/${uid}`, f.plist.path]);
|
|
99
135
|
return { files: [f.plist], commands, manager: "launchd", domain: "user" };
|
|
100
136
|
}
|
|
101
137
|
if (platform === "linux") {
|
package/dist/service.js.map
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"version": 3,
|
|
3
3
|
"sources": ["../src/service/index.ts"],
|
|
4
|
-
"sourcesContent": ["// SPDX-License-Identifier: Apache-2.0\n/** sessionpipe-core/service \u2014 a per-user background service for a sessionpipe process:\n * a launchd agent on macOS, a systemd user unit on Linux. The control daemon runs\n * under it (`org.sessionpipe.control`), and so can a receiver of the person's own (a\n * board on their machine), with the same files and the same commands. Node only: it\n * writes files and runs launchctl, systemctl and loginctl, so it is never part of the\n * root export, which stays Worker- and browser-safe.\n *\n * Both files restart the process when it exits non-zero, and when it exits\n * UPDATE_EXIT (75, sessionpipe-core/version) to come back on new code. The process is\n * told which manager that is in SESSIONPIPE_SERVICE (`launchd`, `systemd`). Nothing\n * here needs root, and a dry run touches nothing: it answers the files it would write\n * and the commands it would run. */\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/** One service, as both managers need it. */\nexport interface ServiceSpec {\n /** The launchd label, also the plist's name: `org.sessionpipe.control`. */\n label: string;\n /** The systemd user unit's file name: `sessionpipe-control.service`. */\n unit: string;\n /** The unit's Description line. */\n description: string;\n /** The program and its arguments, each one argument (never through a shell). */\n argv: string[];\n /** More environment for the process, beside SESSIONPIPE_SERVICE. */\n env?: Record<string, string>;\n /** Where launchd writes its stdout and stderr (journald keeps a unit's). */\n logPath: string;\n /** The home the files go under; the user's own by default. */\n home?: string;\n}\n\n/** A file the service writes, and what is in it. */\nexport interface ServiceFile {\n path: string;\n text: string;\n}\n\n/** Runs one command and answers its stdout; throws when it fails. */\nexport type Exec = (cmd: string, args: string[]) => string;\n\nconst execQuiet: Exec = (cmd, args) =>\n execFileSync(cmd, args, { encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"], timeout: 15_000 });\n\nconst xml = (s: string) => s.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n/** One systemd argument, quoted: backslashes and quotes escaped, `%` doubled (a specifier otherwise). */\nconst sd = (s: string) => `\"${s.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"').replace(/%/g, \"%%\")}\"`;\n\n/** The plist and the unit for a service, and where each goes. */\nexport function serviceFiles(s: ServiceSpec): { plist: ServiceFile; unit: ServiceFile } {\n const home = s.home ?? os.homedir();\n const env = (manager: string) => ({ SESSIONPIPE_SERVICE: manager, ...s.env });\n const plistEnv = Object.entries(env(\"launchd\"))\n .map(([k, v]) => `<key>${xml(k)}</key><string>${xml(v)}</string>`)\n .join(\"\");\n const plist = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>Label</key><string>${xml(s.label)}</string>\n <key>ProgramArguments</key>\n <array>${s.argv.map((a) => `<string>${xml(a)}</string>`).join(\"\")}</array>\n <key>EnvironmentVariables</key><dict>${plistEnv}</dict>\n <key>RunAtLoad</key><true/>\n <key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>\n <key>ProcessType</key><string>Background</string>\n <key>StandardOutPath</key><string>${xml(s.logPath)}</string>\n <key>StandardErrorPath</key><string>${xml(s.logPath)}</string>\n</dict>\n</plist>\n`;\n const unitEnv = Object.entries(env(\"systemd\"))\n .map(([k, v]) => `Environment=${k === \"SESSIONPIPE_SERVICE\" ? `${k}=${v}` : sd(`${k}=${v}`)}`)\n .join(\"\\n\");\n const unit = `[Unit]\nDescription=${s.description.replace(/\\n/g, \" \")}\nAfter=network-online.target\n\n[Service]\nExecStart=${s.argv.map(sd).join(\" \")}\n${unitEnv}\nRestart=on-failure\nRestartForceExitStatus=75\nRestartSec=5\n\n[Install]\nWantedBy=default.target\n`;\n return {\n plist: { path: path.join(home, \"Library\", \"LaunchAgents\", `${s.label}.plist`), text: plist },\n unit: { path: path.join(home, \".config\", \"systemd\", \"user\", s.unit), text: unit },\n };\n}\n\n/** A systemd user service stops when its person's last login ends \u2014 closing the ssh\n * session to a lab workstation or a cloud machine stopped the daemon with it \u2014 unless\n * the user lingers. `loginctl enable-linger` for yourself needs no root on systemd's\n * default policy; where it does, say the one command that does it. */\nexport function ensureLinger(user: string, exec: Exec = execQuiet): { on: boolean; note: string } {\n const lingering = () => {\n try {\n return /^Linger=yes/m.test(exec(\"loginctl\", [\"show-user\", user, \"--property=Linger\"]));\n } catch {\n return false;\n }\n };\n if (lingering()) return { on: true, note: \"it keeps running after you log out (linger was already on)\" };\n try {\n exec(\"loginctl\", [\"enable-linger\", user]);\n } catch {}\n if (lingering()) return { on: true, note: \"it keeps running after you log out (turned linger on)\" };\n return {\n on: false,\n note: `it stops when you log out: run \\`sudo loginctl enable-linger ${user}\\` once to keep it running`,\n };\n}\n\n/** What an install did, or would do in a dry run. */\nexport interface ServicePlan {\n /** The files written (or that would be). */\n files: ServiceFile[];\n /** The commands run (or that would be), one string each, in order. */\n commands: string[];\n /** Which manager runs it now: null on a platform with none, or where it isn't reachable. */\n manager: \"launchd\" | \"systemd\" | null;\n /** launchd: `gui` when someone is at the screen, else `user` (it starts again at the next login there). */\n domain?: \"gui\" | \"user\";\n /** systemd: whether it outlives the login, in words. */\n linger?: { on: boolean; note: string };\n /** The file that was written for a manager that couldn't be reached. */\n unreachable?: string;\n}\n\nexport interface InstallOptions extends ServiceSpec {\n /** Answer the plan and touch nothing. */\n dryRun?: boolean;\n exec?: Exec;\n platform?: NodeJS.Platform;\n /** The user's id (launchd's domains) and name (linger); this process's by default. */\n uid?: string;\n user?: string;\n}\n\nconst line = (cmd: string, args: string[]) => [cmd, ...args].join(\" \");\n\n/** Write the service for this platform and start it now; a service already there is\n * replaced (launchd: booted out first). */\nexport function installService(o: InstallOptions): ServicePlan {\n const f = serviceFiles(o);\n const platform = o.platform ?? process.platform;\n const uid = o.uid ?? String(process.getuid?.() ?? \"\");\n const commands: string[] = [];\n const real = o.exec ?? execQuiet;\n const run: Exec = (cmd, args) => {\n commands.push(line(cmd, args));\n return o.dryRun ? \"\" : real(cmd, args);\n };\n const write = (file: ServiceFile) => {\n if (o.dryRun) return;\n mkdirSync(path.dirname(file.path), { recursive: true });\n writeFileSync(file.path, file.text);\n };\n if (platform === \"darwin\") {\n write(f.plist);\n for (const d of [\"gui\", \"user\"])\n try {\n run(\"launchctl\", [\"bootout\", `${d}/${uid}/${o.label}`]);\n } catch {}\n try {\n run(\"launchctl\", [\"bootstrap\", `gui/${uid}`, f.plist.path]);\n return { files: [f.plist], commands, manager: \"launchd\", domain: \"gui\" };\n } catch {}\n // No one logged in at the screen (an ssh session to a Mac mini): the gui domain\n // doesn't exist. The user domain runs it now; after a restart it starts again at\n // the next login at the screen.\n run(\"launchctl\", [\"bootstrap\", `user/${uid}`, f.plist.path]);\n return { files: [f.plist], commands, manager: \"launchd\", domain: \"user\" };\n }\n if (platform === \"linux\") {\n write(f.unit);\n try {\n run(\"systemctl\", [\"--user\", \"daemon-reload\"]);\n run(\"systemctl\", [\"--user\", \"enable\", \"--now\", o.unit]);\n } catch {\n return { files: [f.unit], commands, manager: null, unreachable: f.unit.path };\n }\n const user = o.user ?? os.userInfo().username;\n if (o.dryRun) {\n commands.push(line(\"loginctl\", [\"enable-linger\", user]));\n return { files: [f.unit], commands, manager: \"systemd\", linger: { on: false, note: \"dry run\" } };\n }\n return { files: [f.unit], commands, manager: \"systemd\", linger: ensureLinger(user, run) };\n }\n return { files: [], commands, manager: null };\n}\n\nexport interface UninstallOptions {\n label: string;\n unit: string;\n home?: string;\n dryRun?: boolean;\n exec?: Exec;\n platform?: NodeJS.Platform;\n uid?: string;\n}\n\n/** Stop the service and remove its file, where this platform has one; nothing where\n * there is none. A manager that says it wasn't loaded is no failure. */\nexport function uninstallService(o: UninstallOptions): { files: string[]; commands: string[] } {\n const f = serviceFiles({ ...o, description: \"\", argv: [], logPath: \"\" });\n const platform = o.platform ?? process.platform;\n const uid = o.uid ?? String(process.getuid?.() ?? \"\");\n const commands: string[] = [];\n const files: string[] = [];\n const real = o.exec ?? execQuiet;\n const run = (cmd: string, args: string[]) => {\n commands.push(line(cmd, args));\n if (o.dryRun) return;\n try {\n real(cmd, args);\n } catch {}\n };\n const remove = (file: string) => {\n files.push(file);\n if (!o.dryRun) unlinkSync(file);\n };\n if (platform === \"darwin\" && existsSync(f.plist.path)) {\n run(\"launchctl\", [\"bootout\", `gui/${uid}/${o.label}`]);\n run(\"launchctl\", [\"bootout\", `user/${uid}/${o.label}`]);\n remove(f.plist.path);\n }\n if (platform === \"linux\" && existsSync(f.unit.path)) {\n run(\"systemctl\", [\"--user\", \"disable\", \"--now\", o.unit]);\n remove(f.unit.path);\n run(\"systemctl\", [\"--user\", \"daemon-reload\"]);\n }\n return { files, commands };\n}\n"],
|
|
5
|
-
"mappings": ";;;AAaA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,YAAY,qBAAqB;AACjE,OAAO,QAAQ;AACf,OAAO,UAAU;AA6BjB,IAAM,YAAkB,CAAC,KAAK,SAC5B,aAAa,KAAK,MAAM,EAAE,UAAU,QAAQ,OAAO,CAAC,UAAU,QAAQ,QAAQ,GAAG,SAAS,KAAO,CAAC;AAEpG,IAAM,MAAM,CAAC,MAAc,EAAE,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AAE9F,IAAM,KAAK,CAAC,MAAc,IAAI,EAAE,QAAQ,OAAO,MAAM,EAAE,QAAQ,MAAM,KAAK,EAAE,QAAQ,MAAM,IAAI,CAAC;AAGxF,SAAS,aAAa,GAA2D;AACtF,QAAM,OAAO,EAAE,QAAQ,GAAG,QAAQ;AAClC,QAAM,MAAM,CAAC,aAAqB,EAAE,qBAAqB,SAAS,GAAG,EAAE,IAAI;AAC3E,QAAM,WAAW,OAAO,QAAQ,IAAI,SAAS,CAAC,EAC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QAAQ;AACN,aAAO;AAAA,IACT;AAAA,EACF;AACA,MAAI,UAAU,EAAG,QAAO,EAAE,IAAI,MAAM,MAAM,6DAA6D;AACvG,MAAI;AACF,SAAK,YAAY,CAAC,iBAAiB,IAAI,CAAC;AAAA,EAC1C,QAAQ;AAAA,EAAC;AACT,MAAI,UAAU,EAAG,QAAO,EAAE,IAAI,MAAM,MAAM,wDAAwD;AAClG,SAAO;AAAA,IACL,IAAI;AAAA,IACJ,MAAM,gEAAgE,IAAI;AAAA,EAC5E;AACF;
|
|
4
|
+
"sourcesContent": ["// SPDX-License-Identifier: Apache-2.0\n/** sessionpipe-core/service \u2014 a per-user background service for a sessionpipe process:\n * a launchd agent on macOS, a systemd user unit on Linux. The control daemon runs\n * under it (`org.sessionpipe.control`), and so can a receiver of the person's own (a\n * board on their machine), with the same files and the same commands. Node only: it\n * writes files and runs launchctl, systemctl and loginctl, so it is never part of the\n * root export, which stays Worker- and browser-safe.\n *\n * Both files restart the process when it exits non-zero, and when it exits\n * UPDATE_EXIT (75, sessionpipe-core/version) to come back on new code. The process is\n * told which manager that is in SESSIONPIPE_SERVICE (`launchd`, `systemd`). Nothing\n * here needs root, and a dry run touches nothing: it answers the files it would write\n * and the commands it would run. */\nimport { execFileSync } from \"node:child_process\";\nimport { existsSync, mkdirSync, unlinkSync, writeFileSync } from \"node:fs\";\nimport os from \"node:os\";\nimport path from \"node:path\";\n\n/** One service, as both managers need it. */\nexport interface ServiceSpec {\n /** The launchd label, also the plist's name: `org.sessionpipe.control`. */\n label: string;\n /** The systemd user unit's file name: `sessionpipe-control.service`. */\n unit: string;\n /** The unit's Description line. */\n description: string;\n /** The program and its arguments, each one argument (never through a shell). */\n argv: string[];\n /** More environment for the process, beside SESSIONPIPE_SERVICE. */\n env?: Record<string, string>;\n /** Where launchd writes its stdout and stderr (journald keeps a unit's). */\n logPath: string;\n /** The home the files go under; the user's own by default. */\n home?: string;\n}\n\n/** A file the service writes, and what is in it. */\nexport interface ServiceFile {\n path: string;\n text: string;\n}\n\n/** Runs one command and answers its stdout; throws when it fails. */\nexport type Exec = (cmd: string, args: string[]) => string;\n\nconst execQuiet: Exec = (cmd, args) =>\n execFileSync(cmd, args, { encoding: \"utf8\", stdio: [\"ignore\", \"pipe\", \"ignore\"], timeout: 15_000 });\n\nconst xml = (s: string) => s.replace(/&/g, \"&\").replace(/</g, \"<\").replace(/>/g, \">\");\n/** One systemd argument, quoted: backslashes and quotes escaped, `%` doubled (a specifier otherwise). */\nconst sd = (s: string) => `\"${s.replace(/\\\\/g, \"\\\\\\\\\").replace(/\"/g, '\\\\\"').replace(/%/g, \"%%\")}\"`;\n\n/** The plist and the unit for a service, and where each goes. */\nexport function serviceFiles(s: ServiceSpec): { plist: ServiceFile; unit: ServiceFile } {\n const home = s.home ?? os.homedir();\n const env = (manager: string) => ({ SESSIONPIPE_SERVICE: manager, ...s.env });\n const plistEnv = Object.entries(env(\"launchd\"))\n .map(([k, v]) => `<key>${xml(k)}</key><string>${xml(v)}</string>`)\n .join(\"\");\n const plist = `<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n<!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\">\n<plist version=\"1.0\">\n<dict>\n <key>Label</key><string>${xml(s.label)}</string>\n <key>ProgramArguments</key>\n <array>${s.argv.map((a) => `<string>${xml(a)}</string>`).join(\"\")}</array>\n <key>EnvironmentVariables</key><dict>${plistEnv}</dict>\n <key>RunAtLoad</key><true/>\n <key>KeepAlive</key><dict><key>SuccessfulExit</key><false/></dict>\n <key>ProcessType</key><string>Background</string>\n <key>StandardOutPath</key><string>${xml(s.logPath)}</string>\n <key>StandardErrorPath</key><string>${xml(s.logPath)}</string>\n</dict>\n</plist>\n`;\n const unitEnv = Object.entries(env(\"systemd\"))\n .map(([k, v]) => `Environment=${k === \"SESSIONPIPE_SERVICE\" ? `${k}=${v}` : sd(`${k}=${v}`)}`)\n .join(\"\\n\");\n const unit = `[Unit]\nDescription=${s.description.replace(/\\n/g, \" \")}\nAfter=network-online.target\n\n[Service]\nExecStart=${s.argv.map(sd).join(\" \")}\n${unitEnv}\nRestart=on-failure\nRestartForceExitStatus=75\nRestartSec=5\n\n[Install]\nWantedBy=default.target\n`;\n return {\n plist: { path: path.join(home, \"Library\", \"LaunchAgents\", `${s.label}.plist`), text: plist },\n unit: { path: path.join(home, \".config\", \"systemd\", \"user\", s.unit), text: unit },\n };\n}\n\n/** A systemd user service stops when its person's last login ends \u2014 closing the ssh\n * session to a lab workstation or a cloud machine stopped the daemon with it \u2014 unless\n * the user lingers. `loginctl enable-linger` for yourself needs no root on systemd's\n * default policy; where it does, say the one command that does it. */\nexport function ensureLinger(user: string, exec: Exec = execQuiet): { on: boolean; note: string } {\n const lingering = () => {\n try {\n return /^Linger=yes/m.test(exec(\"loginctl\", [\"show-user\", user, \"--property=Linger\"]));\n } catch {\n return false;\n }\n };\n if (lingering()) return { on: true, note: \"it keeps running after you log out (linger was already on)\" };\n try {\n exec(\"loginctl\", [\"enable-linger\", user]);\n } catch {}\n if (lingering()) return { on: true, note: \"it keeps running after you log out (turned linger on)\" };\n return {\n on: false,\n note: `it stops when you log out: run \\`sudo loginctl enable-linger ${user}\\` once to keep it running`,\n };\n}\n\n/** What an install did, or would do in a dry run. */\nexport interface ServicePlan {\n /** The files written (or that would be). */\n files: ServiceFile[];\n /** The commands run (or that would be), one string each, in order; launchd's looks\n * at what it has (`launchctl print`) between them aren't among them. */\n commands: string[];\n /** Which manager runs it now: null on a platform with none, or where it isn't reachable. */\n manager: \"launchd\" | \"systemd\" | null;\n /** launchd: `gui` when someone is at the screen, else `user` (it starts again at the next login there). */\n domain?: \"gui\" | \"user\";\n /** systemd: whether it outlives the login, in words. */\n linger?: { on: boolean; note: string };\n /** The file that was written for a manager that couldn't be reached. */\n unreachable?: string;\n}\n\nexport interface InstallOptions extends ServiceSpec {\n /** Answer the plan and touch nothing. */\n dryRun?: boolean;\n exec?: Exec;\n platform?: NodeJS.Platform;\n /** The user's id (launchd's domains) and name (linger); this process's by default. */\n uid?: string;\n user?: string;\n /** How a wait for launchd passes; this thread sleeps by default. */\n sleep?: (ms: number) => void;\n}\n\nconst line = (cmd: string, args: string[]) => [cmd, ...args].join(\" \");\n\nconst sleepSync = (ms: number) => {\n Atomics.wait(new Int32Array(new SharedArrayBuffer(4)), 0, 0, ms);\n};\n\n/** How long launchd is given to let go of a service it was told to boot out. It signals\n * the process and removes the service when that exits, killing it after 5 s by default. */\nconst LET_GO_MS = 10_000;\nconst LOOK_MS = 100;\n\n/** Write the service for this platform and start it now; a service already there is\n * replaced (launchd: booted out first, and started once the old one is gone). */\nexport function installService(o: InstallOptions): ServicePlan {\n const f = serviceFiles(o);\n const platform = o.platform ?? process.platform;\n const uid = o.uid ?? String(process.getuid?.() ?? \"\");\n const commands: string[] = [];\n const real = o.exec ?? execQuiet;\n const run: Exec = (cmd, args) => {\n commands.push(line(cmd, args));\n return o.dryRun ? \"\" : real(cmd, args);\n };\n const write = (file: ServiceFile) => {\n if (o.dryRun) return;\n mkdirSync(path.dirname(file.path), { recursive: true });\n writeFileSync(file.path, file.text);\n };\n if (platform === \"darwin\") {\n write(f.plist);\n for (const d of [\"gui\", \"user\"])\n try {\n run(\"launchctl\", [\"bootout\", `${d}/${uid}/${o.label}`]);\n } catch {}\n let refusal: unknown;\n const gui = (): boolean => {\n try {\n run(\"launchctl\", [\"bootstrap\", `gui/${uid}`, f.plist.path]);\n return true;\n } catch (e) {\n refusal = e;\n return false;\n }\n };\n const started: ServicePlan = { files: [f.plist], commands, manager: \"launchd\", domain: \"gui\" };\n if (gui()) return started;\n // `launchctl print` exits non-zero for a domain or a service launchd doesn't have.\n // A look, not a step: it isn't one of the plan's commands.\n const has = (target: string): boolean => {\n try {\n real(\"launchctl\", [\"print\", target]);\n return true;\n } catch {\n return false;\n }\n };\n const atScreen = has(`gui/${uid}`);\n // A service is in one domain, and a look at the other doesn't see it.\n const there = () => has(`gui/${uid}/${o.label}`) || has(`user/${uid}/${o.label}`);\n if (atScreen) {\n // The gui domain is there, so the refusal is about the service: `bootout` answers\n // at once, and the service it booted out stays until its process has exited. A\n // bootstrap in between is refused (5, or 37 \"Operation already in progress\"), in\n // the user domain too, and the machine is left with no service at all. So: wait\n // for the old one to be gone, then start the new one.\n const sleep = o.sleep ?? sleepSync;\n for (let waited = 0; waited < LET_GO_MS && there(); waited += LOOK_MS) sleep(LOOK_MS);\n if (gui()) return started;\n }\n // No one logged in at the screen (an ssh session to a Mac mini): the gui domain\n // doesn't exist. The user domain runs it now; after a restart it starts again at\n // the next login at the screen.\n try {\n run(\"launchctl\", [\"bootstrap\", `user/${uid}`, f.plist.path]);\n } catch {\n const code = (refusal as { status?: unknown }).status;\n const said = typeof code === \"number\" ? ` (launchctl answered ${code})` : \"\";\n const by = `\\`launchctl bootstrap gui/${uid} ${f.plist.path}\\``;\n throw new Error(\n !atScreen\n ? `launchd didn't start ${o.label}${said}: no login at this Mac's screen can be seen from here (nobody is logged in there, or launchctl is blocked). From a login at the screen, ${by} starts it (its file is written)`\n : there()\n ? `launchd didn't start the new ${o.label}${said}: the one that was running is still loaded. \\`launchctl bootout gui/${uid}/${o.label}\\`, then ${by} (its file is written)`\n : `launchd didn't start ${o.label}${said}, and nothing runs it now: ${by} starts it (its file is written)`,\n );\n }\n return { files: [f.plist], commands, manager: \"launchd\", domain: \"user\" };\n }\n if (platform === \"linux\") {\n write(f.unit);\n try {\n run(\"systemctl\", [\"--user\", \"daemon-reload\"]);\n run(\"systemctl\", [\"--user\", \"enable\", \"--now\", o.unit]);\n } catch {\n return { files: [f.unit], commands, manager: null, unreachable: f.unit.path };\n }\n const user = o.user ?? os.userInfo().username;\n if (o.dryRun) {\n commands.push(line(\"loginctl\", [\"enable-linger\", user]));\n return { files: [f.unit], commands, manager: \"systemd\", linger: { on: false, note: \"dry run\" } };\n }\n return { files: [f.unit], commands, manager: \"systemd\", linger: ensureLinger(user, run) };\n }\n return { files: [], commands, manager: null };\n}\n\nexport interface UninstallOptions {\n label: string;\n unit: string;\n home?: string;\n dryRun?: boolean;\n exec?: Exec;\n platform?: NodeJS.Platform;\n uid?: string;\n}\n\n/** Stop the service and remove its file, where this platform has one; nothing where\n * there is none. A manager that says it wasn't loaded is no failure. */\nexport function uninstallService(o: UninstallOptions): { files: string[]; commands: string[] } {\n const f = serviceFiles({ ...o, description: \"\", argv: [], logPath: \"\" });\n const platform = o.platform ?? process.platform;\n const uid = o.uid ?? String(process.getuid?.() ?? \"\");\n const commands: string[] = [];\n const files: string[] = [];\n const real = o.exec ?? execQuiet;\n const run = (cmd: string, args: string[]) => {\n commands.push(line(cmd, args));\n if (o.dryRun) return;\n try {\n real(cmd, args);\n } catch {}\n };\n const remove = (file: string) => {\n files.push(file);\n if (!o.dryRun) unlinkSync(file);\n };\n if (platform === \"darwin\" && existsSync(f.plist.path)) {\n run(\"launchctl\", [\"bootout\", `gui/${uid}/${o.label}`]);\n run(\"launchctl\", [\"bootout\", `user/${uid}/${o.label}`]);\n remove(f.plist.path);\n }\n if (platform === \"linux\" && existsSync(f.unit.path)) {\n run(\"systemctl\", [\"--user\", \"disable\", \"--now\", o.unit]);\n remove(f.unit.path);\n run(\"systemctl\", [\"--user\", \"daemon-reload\"]);\n }\n return { files, commands };\n}\n"],
|
|
5
|
+
"mappings": ";;;AAaA,SAAS,oBAAoB;AAC7B,SAAS,YAAY,WAAW,YAAY,qBAAqB;AACjE,OAAO,QAAQ;AACf,OAAO,UAAU;AA6BjB,IAAM,YAAkB,CAAC,KAAK,SAC5B,aAAa,KAAK,MAAM,EAAE,UAAU,QAAQ,OAAO,CAAC,UAAU,QAAQ,QAAQ,GAAG,SAAS,KAAO,CAAC;AAEpG,IAAM,MAAM,CAAC,MAAc,EAAE,QAAQ,MAAM,OAAO,EAAE,QAAQ,MAAM,MAAM,EAAE,QAAQ,MAAM,MAAM;AAE9F,IAAM,KAAK,CAAC,MAAc,IAAI,EAAE,QAAQ,OAAO,M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AI,aAAa,EAAE,GAAG,GAAG,aAAa,IAAI,MAAM,CAAC,GAAG,SAAS,GAAG,CAAC;AACvE,QAAM,WAAW,EAAE,YAAY,QAAQ;AACvC,QAAM,MAAM,EAAE,OAAO,OAAO,QAAQ,SAAS,KAAK,EAAE;AACpD,QAAM,WAAqB,CAAC;AAC5B,QAAM,QAAkB,CAAC;AACzB,QAAM,OAAO,EAAE,QAAQ;AACvB,QAAM,MAAM,CAAC,KAAa,SAAmB;AAC3C,aAAS,KAAK,KAAK,KAAK,IAAI,CAAC;AAC7B,QAAI,EAAE,OAAQ;AACd,QAAI;AACF,WAAK,KAAK,IAAI;AAAA,IAChB,QAAQ;AAAA,IAAC;AAAA,EACX;AACA,QAAM,SAAS,CAAC,SAAiB;AAC/B,UAAM,KAAK,IAAI;AACf,QAAI,CAAC,EAAE,OAAQ,YAAW,IAAI;AAAA,EAChC;AACA,MAAI,aAAa,YAAY,WAAW,EAAE,MAAM,IAAI,GAAG;AACrD,QAAI,aAAa,CAAC,WAAW,OAAO,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC;AACrD,QAAI,aAAa,CAAC,WAAW,QAAQ,GAAG,IAAI,EAAE,KAAK,EAAE,CAAC;AACtD,WAAO,EAAE,MAAM,IAAI;AAAA,EACrB;AACA,MAAI,aAAa,WAAW,WAAW,EAAE,KAAK,IAAI,GAAG;AACnD,QAAI,aAAa,CAAC,UAAU,WAAW,SAAS,EAAE,IAAI,CAAC;AACvD,WAAO,EAAE,KAAK,IAAI;AAClB,QAAI,aAAa,CAAC,UAAU,eAAe,CAAC;AAAA,EAC9C;AACA,SAAO,EAAE,OAAO,SAAS;AAC3B;",
|
|
6
6
|
"names": []
|
|
7
7
|
}
|
|
@@ -39,7 +39,8 @@ export declare function ensureLinger(user: string, exec?: Exec): {
|
|
|
39
39
|
export interface ServicePlan {
|
|
40
40
|
/** The files written (or that would be). */
|
|
41
41
|
files: ServiceFile[];
|
|
42
|
-
/** The commands run (or that would be), one string each, in order
|
|
42
|
+
/** The commands run (or that would be), one string each, in order; launchd's looks
|
|
43
|
+
* at what it has (`launchctl print`) between them aren't among them. */
|
|
43
44
|
commands: string[];
|
|
44
45
|
/** Which manager runs it now: null on a platform with none, or where it isn't reachable. */
|
|
45
46
|
manager: "launchd" | "systemd" | null;
|
|
@@ -61,9 +62,11 @@ export interface InstallOptions extends ServiceSpec {
|
|
|
61
62
|
/** The user's id (launchd's domains) and name (linger); this process's by default. */
|
|
62
63
|
uid?: string;
|
|
63
64
|
user?: string;
|
|
65
|
+
/** How a wait for launchd passes; this thread sleeps by default. */
|
|
66
|
+
sleep?: (ms: number) => void;
|
|
64
67
|
}
|
|
65
68
|
/** Write the service for this platform and start it now; a service already there is
|
|
66
|
-
* replaced (launchd: booted out first). */
|
|
69
|
+
* replaced (launchd: booted out first, and started once the old one is gone). */
|
|
67
70
|
export declare function installService(o: InstallOptions): ServicePlan;
|
|
68
71
|
export interface UninstallOptions {
|
|
69
72
|
label: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/service/index.ts"],"names":[],"mappings":"AAkBA,6CAA6C;AAC7C,MAAM,WAAW,WAAW;IAC1B,2EAA2E;IAC3E,KAAK,EAAE,MAAM,CAAC;IACd,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,mCAAmC;IACnC,WAAW,EAAE,MAAM,CAAC;IACpB,gFAAgF;IAChF,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,oEAAoE;IACpE,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7B,4EAA4E;IAC5E,OAAO,EAAE,MAAM,CAAC;IAChB,8DAA8D;IAC9D,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED,oDAAoD;AACpD,MAAM,WAAW,WAAW;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,qEAAqE;AACrE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b,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,QAAQ,CAAC,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC3B,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;yEACyE;AACzE,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,gBAAgB,GAAG;IAAE,KAAK,EAAE,MAAM,EAAE,CAAC;IAAC,QAAQ,EAAE,MAAM,EAAE,CAAA;CAAE,CA6B7F"}
|
package/dist/version.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sessionpipe-core",
|
|
3
|
-
"version": "0.13.
|
|
3
|
+
"version": "0.13.7",
|
|
4
4
|
"description": "sessionpipe core: protocol types, harness adapters, privacy filter and redaction rulesets, outbox and sinks. Zero runtime dependencies. (published unscoped until the @sessionpipe npm org exists; the code is the same)",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|