@agentconnect.md/daemon 1.0.0-rc.23 → 1.0.0-rc.231
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/acp-host-CXUQ91Gh.js +10642 -0
- package/dist/acp-host-CXUQ91Gh.js.map +1 -0
- package/dist/agent-list-BAjZvFsO.js +21 -0
- package/dist/agent-list-BAjZvFsO.js.map +1 -0
- package/dist/bridge-DXIVgEzf.js +726 -0
- package/dist/bridge-DXIVgEzf.js.map +1 -0
- package/dist/chat-Di5QFvjw.js +79 -0
- package/dist/chat-Di5QFvjw.js.map +1 -0
- package/dist/commander-B5QVEFzH.js +2965 -0
- package/dist/commander-B5QVEFzH.js.map +1 -0
- package/dist/esm-DrGCKNjx.js +1516 -0
- package/dist/esm-DrGCKNjx.js.map +1 -0
- package/dist/execAsync-C-9b-eWN.js +12 -0
- package/dist/execAsync-C-9b-eWN.js.map +1 -0
- package/dist/getMachineId-bsd-CfqSzACM.js +29 -0
- package/dist/getMachineId-bsd-CfqSzACM.js.map +1 -0
- package/dist/getMachineId-darwin-CDKafrUs.js +26 -0
- package/dist/getMachineId-darwin-CDKafrUs.js.map +1 -0
- package/dist/getMachineId-linux-DG3AvXtg.js +22 -0
- package/dist/getMachineId-linux-DG3AvXtg.js.map +1 -0
- package/dist/getMachineId-unsupported-BIPpTXqb.js +17 -0
- package/dist/getMachineId-unsupported-BIPpTXqb.js.map +1 -0
- package/dist/getMachineId-win-DNO3uByP.js +28 -0
- package/dist/getMachineId-win-DNO3uByP.js.map +1 -0
- package/dist/git-credential-BfkyzKn2.js +99 -0
- package/dist/git-credential-BfkyzKn2.js.map +1 -0
- package/dist/gitcred-server-Dcsq6QJe.js +236 -0
- package/dist/gitcred-server-Dcsq6QJe.js.map +1 -0
- package/dist/index.js +67364 -79992
- package/dist/index.js.map +1 -1
- package/dist/load-agents-tb8Rcwan.js +356 -0
- package/dist/load-agents-tb8Rcwan.js.map +1 -0
- package/dist/lock-CA9Bm8_s.js +66 -0
- package/dist/lock-CA9Bm8_s.js.map +1 -0
- package/dist/login-8pfSiMc2.js +229 -0
- package/dist/login-8pfSiMc2.js.map +1 -0
- package/dist/paths-CcRUjFjy.js +2 -0
- package/dist/paths-DEcUO8lC.js +43 -0
- package/dist/paths-DEcUO8lC.js.map +1 -0
- package/dist/rolldown-runtime-CE-6LUnI.js +44 -0
- package/dist/run-foreground-Cg2ewYjn.js +138640 -0
- package/dist/run-foreground-Cg2ewYjn.js.map +1 -0
- package/dist/run-foreground-DxSBKNXU.js +2 -0
- package/dist/schemas-CQkO9hC5.js +4382 -0
- package/dist/schemas-CQkO9hC5.js.map +1 -0
- package/dist/service-6w0WKhdx.js +2 -0
- package/dist/service-BQVw7wbz.js +245 -0
- package/dist/service-BQVw7wbz.js.map +1 -0
- package/dist/src-DDtlVutj.js +811 -0
- package/dist/src-DDtlVutj.js.map +1 -0
- package/dist/stdio-CwrB9yrX.js +9218 -0
- package/dist/stdio-CwrB9yrX.js.map +1 -0
- package/dist/version-DGaRXjBK.js +7 -0
- package/dist/version-DGaRXjBK.js.map +1 -0
- package/package.json +2 -1
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
import { a as logsDir, l as resolveRoot, n as daemonLogPath } from "./paths-DEcUO8lC.js";
|
|
2
|
+
import { dirname, join } from "node:path";
|
|
3
|
+
import { existsSync, mkdirSync, rmSync, writeFileSync } from "node:fs";
|
|
4
|
+
import { execFile } from "node:child_process";
|
|
5
|
+
import { homedir } from "node:os";
|
|
6
|
+
//#region src/service/exec.ts
|
|
7
|
+
/** Production `Exec`: runs a command via `execFile` and never throws — a non-zero
|
|
8
|
+
* exit (or spawn error) is reported as a resolved `ExecResult`. */
|
|
9
|
+
const defaultExec = (cmd, args) => new Promise((resolve) => {
|
|
10
|
+
execFile(cmd, args, (err, stdout, stderr) => {
|
|
11
|
+
resolve({
|
|
12
|
+
code: err && typeof err.code === "number" ? Number(err.code) : err ? 1 : 0,
|
|
13
|
+
stdout: stdout?.toString() ?? "",
|
|
14
|
+
stderr: stderr?.toString() ?? ""
|
|
15
|
+
});
|
|
16
|
+
});
|
|
17
|
+
});
|
|
18
|
+
//#endregion
|
|
19
|
+
//#region src/service/launchd.ts
|
|
20
|
+
/** macOS launchd controller. Writes a LaunchAgent plist that runs
|
|
21
|
+
* `<node> <cli-entry> run`, and drives it with `launchctl bootstrap/bootout`
|
|
22
|
+
* (falling back to legacy `load/unload` on older macOS). */
|
|
23
|
+
const LABEL = "md.agentconnect.daemon";
|
|
24
|
+
function buildPlist(a) {
|
|
25
|
+
const env = a.includeRootEnv ? ` <key>EnvironmentVariables</key>\n <dict>\n <key>AGENTCONNECT_ROOT</key>\n <string>${a.root}</string>\n </dict>\n` : "";
|
|
26
|
+
return `<?xml version="1.0" encoding="UTF-8"?>
|
|
27
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
28
|
+
<plist version="1.0">
|
|
29
|
+
<dict>
|
|
30
|
+
<key>Label</key>
|
|
31
|
+
<string>${a.label}</string>
|
|
32
|
+
<key>ProgramArguments</key>
|
|
33
|
+
<array>
|
|
34
|
+
<string>${a.execPath}</string>
|
|
35
|
+
<string>${a.cliEntry}</string>
|
|
36
|
+
<string>run</string>
|
|
37
|
+
</array>
|
|
38
|
+
${env} <key>RunAtLoad</key>
|
|
39
|
+
<true/>
|
|
40
|
+
<key>KeepAlive</key>
|
|
41
|
+
<dict>
|
|
42
|
+
<key>SuccessfulExit</key>
|
|
43
|
+
<false/>
|
|
44
|
+
</dict>
|
|
45
|
+
<key>StandardOutPath</key>
|
|
46
|
+
<string>${a.logPath}</string>
|
|
47
|
+
<key>StandardErrorPath</key>
|
|
48
|
+
<string>${a.logPath}</string>
|
|
49
|
+
</dict>
|
|
50
|
+
</plist>
|
|
51
|
+
`;
|
|
52
|
+
}
|
|
53
|
+
var LaunchdController = class {
|
|
54
|
+
deps;
|
|
55
|
+
label = LABEL;
|
|
56
|
+
plistPath;
|
|
57
|
+
constructor(deps) {
|
|
58
|
+
this.deps = deps;
|
|
59
|
+
this.plistPath = join(deps.home, "Library", "LaunchAgents", `${LABEL}.plist`);
|
|
60
|
+
}
|
|
61
|
+
isInstalled() {
|
|
62
|
+
return existsSync(this.plistPath);
|
|
63
|
+
}
|
|
64
|
+
async install(opts) {
|
|
65
|
+
mkdirSync(logsDir(this.deps.root), { recursive: true });
|
|
66
|
+
mkdirSync(dirname(this.plistPath), { recursive: true });
|
|
67
|
+
const plist = buildPlist({
|
|
68
|
+
label: LABEL,
|
|
69
|
+
execPath: opts.execPath,
|
|
70
|
+
cliEntry: opts.cliEntry,
|
|
71
|
+
logPath: daemonLogPath(this.deps.root),
|
|
72
|
+
root: this.deps.root,
|
|
73
|
+
includeRootEnv: opts.includeRootEnv
|
|
74
|
+
});
|
|
75
|
+
writeFileSync(this.plistPath, plist);
|
|
76
|
+
}
|
|
77
|
+
async uninstall() {
|
|
78
|
+
try {
|
|
79
|
+
await this.down();
|
|
80
|
+
} catch {}
|
|
81
|
+
if (this.isInstalled()) rmSync(this.plistPath);
|
|
82
|
+
}
|
|
83
|
+
async up() {
|
|
84
|
+
const domain = `gui/${this.deps.uid}`;
|
|
85
|
+
const r = await this.deps.exec("launchctl", [
|
|
86
|
+
"bootstrap",
|
|
87
|
+
domain,
|
|
88
|
+
this.plistPath
|
|
89
|
+
]);
|
|
90
|
+
if (r.code !== 0) {
|
|
91
|
+
const legacy = await this.deps.exec("launchctl", [
|
|
92
|
+
"load",
|
|
93
|
+
"-w",
|
|
94
|
+
this.plistPath
|
|
95
|
+
]);
|
|
96
|
+
if (legacy.code !== 0) throw new Error(`launchctl could not start the service: ${r.stderr || legacy.stderr}`);
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
async down() {
|
|
100
|
+
if ((await this.deps.exec("launchctl", ["bootout", `gui/${this.deps.uid}/${LABEL}`])).code !== 0) await this.deps.exec("launchctl", [
|
|
101
|
+
"unload",
|
|
102
|
+
"-w",
|
|
103
|
+
this.plistPath
|
|
104
|
+
]);
|
|
105
|
+
}
|
|
106
|
+
async status() {
|
|
107
|
+
const logPath = daemonLogPath(this.deps.root);
|
|
108
|
+
if (!this.isInstalled()) return {
|
|
109
|
+
installed: false,
|
|
110
|
+
running: false,
|
|
111
|
+
label: LABEL,
|
|
112
|
+
logPath
|
|
113
|
+
};
|
|
114
|
+
const r = await this.deps.exec("launchctl", ["print", `gui/${this.deps.uid}/${LABEL}`]);
|
|
115
|
+
const running = r.code === 0;
|
|
116
|
+
const pidMatch = /\bpid = (\d+)/.exec(r.stdout);
|
|
117
|
+
return {
|
|
118
|
+
installed: true,
|
|
119
|
+
running,
|
|
120
|
+
...pidMatch ? { pid: Number(pidMatch[1]) } : {},
|
|
121
|
+
label: LABEL,
|
|
122
|
+
logPath
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
//#endregion
|
|
127
|
+
//#region src/service/systemd.ts
|
|
128
|
+
/** Linux systemd `--user` controller. Writes a unit running `<node> <entry> run`
|
|
129
|
+
* and drives it with `systemctl --user enable/disable --now`. */
|
|
130
|
+
const UNIT = "agentconnect.service";
|
|
131
|
+
function buildSystemdUnit(a) {
|
|
132
|
+
const env = a.includeRootEnv ? `Environment=AGENTCONNECT_ROOT=${a.root}\n` : "";
|
|
133
|
+
return `[Unit]
|
|
134
|
+
Description=AgentConnect daemon
|
|
135
|
+
After=network-online.target
|
|
136
|
+
Wants=network-online.target
|
|
137
|
+
|
|
138
|
+
[Service]
|
|
139
|
+
Type=simple
|
|
140
|
+
ExecStart=${a.execPath} ${a.cliEntry} run
|
|
141
|
+
Restart=always
|
|
142
|
+
RestartSec=3
|
|
143
|
+
${env}
|
|
144
|
+
[Install]
|
|
145
|
+
WantedBy=default.target
|
|
146
|
+
`;
|
|
147
|
+
}
|
|
148
|
+
var SystemdController = class {
|
|
149
|
+
deps;
|
|
150
|
+
label = UNIT;
|
|
151
|
+
unitPath;
|
|
152
|
+
constructor(deps) {
|
|
153
|
+
this.deps = deps;
|
|
154
|
+
this.unitPath = join(deps.home, ".config", "systemd", "user", UNIT);
|
|
155
|
+
}
|
|
156
|
+
isInstalled() {
|
|
157
|
+
return existsSync(this.unitPath);
|
|
158
|
+
}
|
|
159
|
+
async install(opts) {
|
|
160
|
+
mkdirSync(dirname(this.unitPath), { recursive: true });
|
|
161
|
+
writeFileSync(this.unitPath, buildSystemdUnit({
|
|
162
|
+
execPath: opts.execPath,
|
|
163
|
+
cliEntry: opts.cliEntry,
|
|
164
|
+
root: this.deps.root,
|
|
165
|
+
includeRootEnv: opts.includeRootEnv
|
|
166
|
+
}));
|
|
167
|
+
await this.deps.exec("systemctl", ["--user", "daemon-reload"]);
|
|
168
|
+
}
|
|
169
|
+
async uninstall() {
|
|
170
|
+
try {
|
|
171
|
+
await this.down();
|
|
172
|
+
} catch {}
|
|
173
|
+
if (this.isInstalled()) rmSync(this.unitPath);
|
|
174
|
+
await this.deps.exec("systemctl", ["--user", "daemon-reload"]);
|
|
175
|
+
}
|
|
176
|
+
async up() {
|
|
177
|
+
const r = await this.deps.exec("systemctl", [
|
|
178
|
+
"--user",
|
|
179
|
+
"enable",
|
|
180
|
+
"--now",
|
|
181
|
+
UNIT
|
|
182
|
+
]);
|
|
183
|
+
if (r.code !== 0) throw new Error(`systemctl could not start the service: ${r.stderr}`);
|
|
184
|
+
}
|
|
185
|
+
async down() {
|
|
186
|
+
await this.deps.exec("systemctl", [
|
|
187
|
+
"--user",
|
|
188
|
+
"disable",
|
|
189
|
+
"--now",
|
|
190
|
+
UNIT
|
|
191
|
+
]);
|
|
192
|
+
}
|
|
193
|
+
async status() {
|
|
194
|
+
const logPath = `journalctl --user -u ${UNIT}`;
|
|
195
|
+
if (!this.isInstalled()) return {
|
|
196
|
+
installed: false,
|
|
197
|
+
running: false,
|
|
198
|
+
label: UNIT,
|
|
199
|
+
logPath
|
|
200
|
+
};
|
|
201
|
+
const running = (await this.deps.exec("systemctl", [
|
|
202
|
+
"--user",
|
|
203
|
+
"is-active",
|
|
204
|
+
UNIT
|
|
205
|
+
])).stdout.trim() === "active";
|
|
206
|
+
const main = await this.deps.exec("systemctl", [
|
|
207
|
+
"--user",
|
|
208
|
+
"show",
|
|
209
|
+
"-p",
|
|
210
|
+
"MainPID",
|
|
211
|
+
"--value",
|
|
212
|
+
UNIT
|
|
213
|
+
]);
|
|
214
|
+
const pid = Number(main.stdout.trim());
|
|
215
|
+
return {
|
|
216
|
+
installed: true,
|
|
217
|
+
running,
|
|
218
|
+
...Number.isFinite(pid) && pid > 0 ? { pid } : {},
|
|
219
|
+
label: UNIT,
|
|
220
|
+
logPath
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
};
|
|
224
|
+
//#endregion
|
|
225
|
+
//#region src/service/index.ts
|
|
226
|
+
/** Platform dispatch for the OS-service layer. `pickController` chooses launchd
|
|
227
|
+
* vs systemd; `resolveController` builds one from runtime/process info. */
|
|
228
|
+
function pickController(platform, deps) {
|
|
229
|
+
if (platform === "darwin") return new LaunchdController(deps);
|
|
230
|
+
if (platform === "linux") return new SystemdController(deps);
|
|
231
|
+
throw new Error(`system service install is not supported on ${platform} yet — use \`agentconnect run\``);
|
|
232
|
+
}
|
|
233
|
+
function resolveController(opts = {}) {
|
|
234
|
+
const root = resolveRoot(opts.root);
|
|
235
|
+
return pickController(opts.platform ?? process.platform, {
|
|
236
|
+
root,
|
|
237
|
+
home: homedir(),
|
|
238
|
+
uid: typeof process.getuid === "function" ? process.getuid() : 0,
|
|
239
|
+
exec: opts.exec ?? defaultExec
|
|
240
|
+
});
|
|
241
|
+
}
|
|
242
|
+
//#endregion
|
|
243
|
+
export { resolveController as n, pickController as t };
|
|
244
|
+
|
|
245
|
+
//# sourceMappingURL=service-BQVw7wbz.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"service-BQVw7wbz.js","names":[],"sources":["../src/service/exec.ts","../src/service/launchd.ts","../src/service/systemd.ts","../src/service/index.ts"],"sourcesContent":["/** Production `Exec`: runs a command via `execFile` and never throws — a non-zero\n * exit (or spawn error) is reported as a resolved `ExecResult`. */\nimport { execFile } from 'node:child_process'\nimport type { Exec } from './types.js'\n\nexport const defaultExec: Exec = (cmd, args) =>\n new Promise((resolve) => {\n execFile(cmd, args, (err, stdout, stderr) => {\n const code =\n err && typeof (err as NodeJS.ErrnoException & { code?: number }).code === 'number'\n ? Number((err as unknown as { code: number }).code)\n : err\n ? 1\n : 0\n resolve({ code, stdout: stdout?.toString() ?? '', stderr: stderr?.toString() ?? '' })\n })\n })\n","/** macOS launchd controller. Writes a LaunchAgent plist that runs\n * `<node> <cli-entry> run`, and drives it with `launchctl bootstrap/bootout`\n * (falling back to legacy `load/unload` on older macOS). */\nimport { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport { daemonLogPath, logsDir } from '../paths.js'\nimport type { ControllerDeps, InstallOpts, ServiceController, ServiceStatus } from './types.js'\n\nconst LABEL = 'md.agentconnect.daemon'\n\nexport function buildPlist(a: {\n label: string\n execPath: string\n cliEntry: string\n logPath: string\n root: string\n includeRootEnv: boolean\n}): string {\n const env = a.includeRootEnv\n ? ` <key>EnvironmentVariables</key>\\n <dict>\\n <key>AGENTCONNECT_ROOT</key>\\n <string>${a.root}</string>\\n </dict>\\n`\n : ''\n return `<?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>\n <string>${a.label}</string>\n <key>ProgramArguments</key>\n <array>\n <string>${a.execPath}</string>\n <string>${a.cliEntry}</string>\n <string>run</string>\n </array>\n${env} <key>RunAtLoad</key>\n <true/>\n <key>KeepAlive</key>\n <dict>\n <key>SuccessfulExit</key>\n <false/>\n </dict>\n <key>StandardOutPath</key>\n <string>${a.logPath}</string>\n <key>StandardErrorPath</key>\n <string>${a.logPath}</string>\n</dict>\n</plist>\n`\n}\n\nexport class LaunchdController implements ServiceController {\n readonly label = LABEL\n private readonly plistPath: string\n\n constructor(private readonly deps: ControllerDeps) {\n this.plistPath = join(deps.home, 'Library', 'LaunchAgents', `${LABEL}.plist`)\n }\n\n isInstalled(): boolean {\n return existsSync(this.plistPath)\n }\n\n async install(opts: InstallOpts): Promise<void> {\n mkdirSync(logsDir(this.deps.root), { recursive: true })\n mkdirSync(dirname(this.plistPath), { recursive: true })\n const plist = buildPlist({\n label: LABEL,\n execPath: opts.execPath,\n cliEntry: opts.cliEntry,\n logPath: daemonLogPath(this.deps.root),\n root: this.deps.root,\n includeRootEnv: opts.includeRootEnv\n })\n writeFileSync(this.plistPath, plist)\n }\n\n async uninstall(): Promise<void> {\n try {\n await this.down()\n } catch {\n // not loaded — fine\n }\n if (this.isInstalled()) rmSync(this.plistPath)\n }\n\n async up(): Promise<void> {\n const domain = `gui/${this.deps.uid}`\n const r = await this.deps.exec('launchctl', ['bootstrap', domain, this.plistPath])\n if (r.code !== 0) {\n const legacy = await this.deps.exec('launchctl', ['load', '-w', this.plistPath])\n if (legacy.code !== 0) throw new Error(`launchctl could not start the service: ${r.stderr || legacy.stderr}`)\n }\n }\n\n async down(): Promise<void> {\n const r = await this.deps.exec('launchctl', ['bootout', `gui/${this.deps.uid}/${LABEL}`])\n if (r.code !== 0) {\n await this.deps.exec('launchctl', ['unload', '-w', this.plistPath])\n }\n }\n\n async status(): Promise<ServiceStatus> {\n const logPath = daemonLogPath(this.deps.root)\n if (!this.isInstalled()) return { installed: false, running: false, label: LABEL, logPath }\n const r = await this.deps.exec('launchctl', ['print', `gui/${this.deps.uid}/${LABEL}`])\n const running = r.code === 0\n const pidMatch = /\\bpid = (\\d+)/.exec(r.stdout)\n return {\n installed: true,\n running,\n ...(pidMatch ? { pid: Number(pidMatch[1]) } : {}),\n label: LABEL,\n logPath\n }\n }\n}\n","/** Linux systemd `--user` controller. Writes a unit running `<node> <entry> run`\n * and drives it with `systemctl --user enable/disable --now`. */\nimport { existsSync, mkdirSync, rmSync, writeFileSync } from 'node:fs'\nimport { dirname, join } from 'node:path'\nimport type { ControllerDeps, InstallOpts, ServiceController, ServiceStatus } from './types.js'\n\nconst UNIT = 'agentconnect.service'\n\nexport function buildSystemdUnit(a: {\n execPath: string\n cliEntry: string\n root: string\n includeRootEnv: boolean\n}): string {\n const env = a.includeRootEnv ? `Environment=AGENTCONNECT_ROOT=${a.root}\\n` : ''\n return `[Unit]\nDescription=AgentConnect daemon\nAfter=network-online.target\nWants=network-online.target\n\n[Service]\nType=simple\nExecStart=${a.execPath} ${a.cliEntry} run\nRestart=always\nRestartSec=3\n${env}\n[Install]\nWantedBy=default.target\n`\n}\n\nexport class SystemdController implements ServiceController {\n readonly label = UNIT\n private readonly unitPath: string\n\n constructor(private readonly deps: ControllerDeps) {\n this.unitPath = join(deps.home, '.config', 'systemd', 'user', UNIT)\n }\n\n isInstalled(): boolean {\n return existsSync(this.unitPath)\n }\n\n async install(opts: InstallOpts): Promise<void> {\n mkdirSync(dirname(this.unitPath), { recursive: true })\n writeFileSync(\n this.unitPath,\n buildSystemdUnit({\n execPath: opts.execPath,\n cliEntry: opts.cliEntry,\n root: this.deps.root,\n includeRootEnv: opts.includeRootEnv\n })\n )\n await this.deps.exec('systemctl', ['--user', 'daemon-reload'])\n }\n\n async uninstall(): Promise<void> {\n try {\n await this.down()\n } catch {\n // not running — fine\n }\n if (this.isInstalled()) rmSync(this.unitPath)\n await this.deps.exec('systemctl', ['--user', 'daemon-reload'])\n }\n\n async up(): Promise<void> {\n const r = await this.deps.exec('systemctl', ['--user', 'enable', '--now', UNIT])\n if (r.code !== 0) throw new Error(`systemctl could not start the service: ${r.stderr}`)\n }\n\n async down(): Promise<void> {\n await this.deps.exec('systemctl', ['--user', 'disable', '--now', UNIT])\n }\n\n async status(): Promise<ServiceStatus> {\n // systemd captures the daemon's stdout/stderr into the journal (the unit\n // writes no log file), so the \"log path\" is the journalctl command to read it.\n const logPath = `journalctl --user -u ${UNIT}`\n if (!this.isInstalled()) return { installed: false, running: false, label: UNIT, logPath }\n const active = await this.deps.exec('systemctl', ['--user', 'is-active', UNIT])\n const running = active.stdout.trim() === 'active'\n const main = await this.deps.exec('systemctl', ['--user', 'show', '-p', 'MainPID', '--value', UNIT])\n const pid = Number(main.stdout.trim())\n return {\n installed: true,\n running,\n ...(Number.isFinite(pid) && pid > 0 ? { pid } : {}),\n label: UNIT,\n logPath\n }\n }\n}\n","/** Platform dispatch for the OS-service layer. `pickController` chooses launchd\n * vs systemd; `resolveController` builds one from runtime/process info. */\nimport { homedir } from 'node:os'\nimport { resolveRoot } from '../paths.js'\nimport { defaultExec } from './exec.js'\nimport { LaunchdController } from './launchd.js'\nimport { SystemdController } from './systemd.js'\nimport type { ControllerDeps, Exec, ServiceController } from './types.js'\n\nexport type { ServiceController, ServiceStatus, InstallOpts } from './types.js'\n\nexport function pickController(platform: NodeJS.Platform, deps: ControllerDeps): ServiceController {\n if (platform === 'darwin') return new LaunchdController(deps)\n if (platform === 'linux') return new SystemdController(deps)\n throw new Error(`system service install is not supported on ${platform} yet — use \\`agentconnect run\\``)\n}\n\nexport function resolveController(\n opts: { root?: string; exec?: Exec; platform?: NodeJS.Platform } = {}\n): ServiceController {\n const root = resolveRoot(opts.root)\n return pickController(opts.platform ?? process.platform, {\n root,\n home: homedir(),\n uid: typeof process.getuid === 'function' ? process.getuid() : 0,\n exec: opts.exec ?? defaultExec\n })\n}\n"],"mappings":";;;;;;;;AAKA,MAAa,eAAqB,KAAK,SACrC,IAAI,SAAS,YAAY;CACvB,SAAS,KAAK,OAAO,KAAK,QAAQ,WAAW;EAO3C,QAAQ;GAAE,MALR,OAAO,OAAQ,IAAkD,SAAS,WACtE,OAAQ,IAAoC,IAAI,IAChD,MACE,IACA;GACQ,QAAQ,QAAQ,SAAS,KAAK;GAAI,QAAQ,QAAQ,SAAS,KAAK;EA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