@stratusagent/cli 0.2.2 → 0.3.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.
- package/README.md +240 -5
- package/dist/bin.js +13 -4
- package/dist/bin.js.map +1 -1
- package/dist/index.d.ts +148 -50
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2041 -671
- package/dist/index.js.map +1 -1
- package/dist/logs.d.ts +123 -0
- package/dist/logs.d.ts.map +1 -0
- package/dist/logs.js +358 -0
- package/dist/logs.js.map +1 -0
- package/dist/service.d.ts +82 -0
- package/dist/service.d.ts.map +1 -0
- package/dist/service.js +380 -0
- package/dist/service.js.map +1 -0
- package/package.json +23 -8
package/dist/service.js
ADDED
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { mkdir, readFile, rm, writeFile } from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
/** Reverse-DNS on macOS, a plain unit name on Linux. */
|
|
5
|
+
export const SERVICE_LABEL = 'com.stratusagent.stratusd';
|
|
6
|
+
export const SYSTEMD_UNIT = 'stratusd.service';
|
|
7
|
+
export const servicePlatform = (env = {}) => {
|
|
8
|
+
const platform = env.platform ?? process.platform;
|
|
9
|
+
if (platform === 'darwin') {
|
|
10
|
+
return 'launchd';
|
|
11
|
+
}
|
|
12
|
+
if (platform === 'linux') {
|
|
13
|
+
return 'systemd';
|
|
14
|
+
}
|
|
15
|
+
return undefined;
|
|
16
|
+
};
|
|
17
|
+
const homeOf = (env) => env.homeDir ?? os.homedir();
|
|
18
|
+
export const serviceUnitPath = (env = {}) => servicePlatform(env) === 'launchd'
|
|
19
|
+
? path.join(homeOf(env), 'Library', 'LaunchAgents', `${SERVICE_LABEL}.plist`)
|
|
20
|
+
: path.join(homeOf(env), '.config', 'systemd', 'user', SYSTEMD_UNIT);
|
|
21
|
+
/** Escapes text for an XML property list value. */
|
|
22
|
+
const xml = (value) => value
|
|
23
|
+
.replace(/&/g, '&')
|
|
24
|
+
.replace(/</g, '<')
|
|
25
|
+
.replace(/>/g, '>');
|
|
26
|
+
export const launchdPlist = (definition) => `<?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>${SERVICE_LABEL}</string>
|
|
32
|
+
<key>ProgramArguments</key>
|
|
33
|
+
<array>
|
|
34
|
+
${definition.argv.map((argument) => ` <string>${xml(argument)}</string>`).join('\n')}
|
|
35
|
+
</array>
|
|
36
|
+
<key>RunAtLoad</key>
|
|
37
|
+
<${definition.runAtLogin ? 'true' : 'false'}/>
|
|
38
|
+
${definition.runAtLogin ? ` <key>KeepAlive</key>
|
|
39
|
+
<dict>
|
|
40
|
+
<key>SuccessfulExit</key>
|
|
41
|
+
<false/>
|
|
42
|
+
</dict>
|
|
43
|
+
` : ''} <key>WorkingDirectory</key>
|
|
44
|
+
<string>${xml(definition.workingDirectory)}</string>
|
|
45
|
+
<key>StandardOutPath</key>
|
|
46
|
+
<string>${xml(path.join(definition.logDir, 'stratusd.out.log'))}</string>
|
|
47
|
+
<key>StandardErrorPath</key>
|
|
48
|
+
<string>${xml(path.join(definition.logDir, 'stratusd.err.log'))}</string>
|
|
49
|
+
<key>ProcessType</key>
|
|
50
|
+
<string>Background</string>
|
|
51
|
+
</dict>
|
|
52
|
+
</plist>
|
|
53
|
+
`;
|
|
54
|
+
/**
|
|
55
|
+
* systemd expands `%` specifiers in unit values — including inside quoted
|
|
56
|
+
* ExecStart arguments — so a path containing one (say a directory named
|
|
57
|
+
* `100%`) would silently become something else entirely, or a nonexistent
|
|
58
|
+
* executable. systemd.unit(5) spells a literal percent `%%`.
|
|
59
|
+
*/
|
|
60
|
+
const systemdValue = (value) => value.replace(/%/g, '%%');
|
|
61
|
+
/**
|
|
62
|
+
* ExecStart is a command line, so systemd expands `${VAR}` there on top of
|
|
63
|
+
* the `%` specifiers — and JSON quoting does not disable it. A path
|
|
64
|
+
* containing a literal `${HOME}` would reach the daemon as something else
|
|
65
|
+
* entirely. systemd.service(5) spells a literal dollar `$$`.
|
|
66
|
+
*/
|
|
67
|
+
const systemdArgument = (value) => systemdValue(value).replace(/\$/g, '$$$$');
|
|
68
|
+
export const systemdUnit = (definition) => `[Unit]
|
|
69
|
+
Description=Stratus Agent daemon (stratusd)
|
|
70
|
+
After=network-online.target
|
|
71
|
+
|
|
72
|
+
[Service]
|
|
73
|
+
Type=simple
|
|
74
|
+
ExecStart=${definition.argv.map((argument) => systemdArgument(JSON.stringify(argument))).join(' ')}
|
|
75
|
+
WorkingDirectory=${systemdValue(definition.workingDirectory)}
|
|
76
|
+
Restart=on-failure
|
|
77
|
+
RestartSec=5
|
|
78
|
+
KillSignal=SIGTERM
|
|
79
|
+
TimeoutStopSec=30
|
|
80
|
+
|
|
81
|
+
[Install]
|
|
82
|
+
WantedBy=default.target
|
|
83
|
+
`;
|
|
84
|
+
export const serviceDefinition = (env, runAtLogin, configPath) => ({
|
|
85
|
+
// The node binary and script are resolved from the running process, not
|
|
86
|
+
// from PATH: a service manager starts with a minimal environment, and a
|
|
87
|
+
// bare `stratus` would depend on a shell profile it never loads.
|
|
88
|
+
argv: [
|
|
89
|
+
env.execPath ?? process.execPath,
|
|
90
|
+
// The flags this process needed to load its own entrypoint. Running
|
|
91
|
+
// from a source checkout, that is --experimental-strip-types for a
|
|
92
|
+
// .ts bin — drop it and the managed daemon cannot start at all while
|
|
93
|
+
// the foreground command works. Inspector flags are filtered: they
|
|
94
|
+
// would leave the service waiting on a debugger or holding a port.
|
|
95
|
+
...(env.execArgv ?? process.execArgv).filter((flag) => !flag.startsWith('--inspect')),
|
|
96
|
+
env.scriptPath ?? process.argv[1] ?? 'stratus',
|
|
97
|
+
'serve',
|
|
98
|
+
// launchd redirects stdout to a plain file it holds open, and nothing
|
|
99
|
+
// rotates it — a daemon printing an event line per Slack dispatch
|
|
100
|
+
// would grow that file for its whole lifetime. Every one of those
|
|
101
|
+
// lines is already in ~/.stratus/logs, which DOES rotate and is what
|
|
102
|
+
// `stratus logs` reads, so the managed process keeps stdout to
|
|
103
|
+
// lifecycle and warnings instead of duplicating the stream.
|
|
104
|
+
'--no-events',
|
|
105
|
+
...(configPath ? ['--config', configPath] : []),
|
|
106
|
+
],
|
|
107
|
+
logDir: path.join(homeOf(env), '.stratus', 'logs'),
|
|
108
|
+
// Where the install ran, not the home directory: a config's `soul` (and
|
|
109
|
+
// any other relative path in it) resolves against the process working
|
|
110
|
+
// directory, so forcing home would make the service load a different —
|
|
111
|
+
// or missing — soul than `stratus serve --config …` does from the same
|
|
112
|
+
// project. Falls back to home when there is nothing better.
|
|
113
|
+
workingDirectory: env.cwd ?? homeOf(env),
|
|
114
|
+
runAtLogin,
|
|
115
|
+
});
|
|
116
|
+
/** A service command that has not answered by now is not going to. */
|
|
117
|
+
export const SERVICE_COMMAND_TIMEOUT_MS = 15_000;
|
|
118
|
+
const defaultRunner = async (command, args) => {
|
|
119
|
+
const { spawn } = await import('node:child_process');
|
|
120
|
+
return new Promise((resolve) => {
|
|
121
|
+
const child = spawn(command, args, { stdio: ['ignore', 'pipe', 'pipe'] });
|
|
122
|
+
let stdout = '';
|
|
123
|
+
let stderr = '';
|
|
124
|
+
let settled = false;
|
|
125
|
+
const finish = (result) => {
|
|
126
|
+
if (settled) {
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
settled = true;
|
|
130
|
+
clearTimeout(timer);
|
|
131
|
+
resolve(result);
|
|
132
|
+
};
|
|
133
|
+
// systemctl --user blocks indefinitely without a session bus, and
|
|
134
|
+
// launchctl can wedge on a broken domain. Setup and `stratus service`
|
|
135
|
+
// must report a problem rather than hang on someone's terminal.
|
|
136
|
+
const timer = setTimeout(() => {
|
|
137
|
+
child.kill('SIGKILL');
|
|
138
|
+
finish({ code: 124, stdout, stderr: `${command} did not respond within ${SERVICE_COMMAND_TIMEOUT_MS / 1000}s` });
|
|
139
|
+
}, SERVICE_COMMAND_TIMEOUT_MS);
|
|
140
|
+
timer.unref?.();
|
|
141
|
+
child.stdout?.on('data', (chunk) => { stdout += chunk.toString('utf8'); });
|
|
142
|
+
child.stderr?.on('data', (chunk) => { stderr += chunk.toString('utf8'); });
|
|
143
|
+
child.on('error', (error) => finish({ code: 127, stdout, stderr: String(error) }));
|
|
144
|
+
child.on('close', (code) => finish({ code: code ?? 0, stdout, stderr }));
|
|
145
|
+
});
|
|
146
|
+
};
|
|
147
|
+
const runnerFor = (env) => env.run ?? defaultRunner;
|
|
148
|
+
const uidOf = (env) => env.uid ?? (typeof process.getuid === 'function' ? process.getuid() : 0);
|
|
149
|
+
/** What `systemctl is-enabled` prints when it actually knows the answer. */
|
|
150
|
+
const KNOWN_ENABLEMENT_STATES = new Set([
|
|
151
|
+
'enabled', 'enabled-runtime', 'linked', 'linked-runtime', 'alias',
|
|
152
|
+
'masked', 'masked-runtime', 'static', 'indirect', 'disabled', 'generated', 'transient',
|
|
153
|
+
]);
|
|
154
|
+
export const readServiceStatus = async (env = {}) => {
|
|
155
|
+
const platform = servicePlatform(env);
|
|
156
|
+
if (!platform) {
|
|
157
|
+
return undefined;
|
|
158
|
+
}
|
|
159
|
+
const unitPath = serviceUnitPath(env);
|
|
160
|
+
const run = runnerFor(env);
|
|
161
|
+
// Whether a daemon is alive is the manager's answer, never the file's —
|
|
162
|
+
// asked the same way whatever the unit file turned out to be.
|
|
163
|
+
const isRunning = async () => {
|
|
164
|
+
if (platform === 'launchd') {
|
|
165
|
+
const printed = await run('launchctl', ['print', `gui/${uidOf(env)}/${SERVICE_LABEL}`]);
|
|
166
|
+
// `state = running` appears only while the process is alive; a
|
|
167
|
+
// loaded but stopped job prints `state = not running`.
|
|
168
|
+
return printed.code === 0 && /state\s*=\s*running/.test(printed.stdout);
|
|
169
|
+
}
|
|
170
|
+
return (await run('systemctl', ['--user', 'is-active', SYSTEMD_UNIT])).stdout.trim() === 'active';
|
|
171
|
+
};
|
|
172
|
+
let contents;
|
|
173
|
+
try {
|
|
174
|
+
contents = await readFile(unitPath, 'utf8');
|
|
175
|
+
}
|
|
176
|
+
catch (error) {
|
|
177
|
+
if (error.code !== 'ENOENT') {
|
|
178
|
+
// The unit is there and we cannot read it. Reporting "not installed"
|
|
179
|
+
// would hide a live daemon, and asserting it is stopped without
|
|
180
|
+
// asking would do the same — so the manager still gets asked.
|
|
181
|
+
return {
|
|
182
|
+
platform,
|
|
183
|
+
installed: true,
|
|
184
|
+
running: await isRunning(),
|
|
185
|
+
runAtLogin: undefined,
|
|
186
|
+
unitPath,
|
|
187
|
+
detail: `${unitPath} exists but could not be read (${error instanceof Error ? error.message : String(error)})`,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
return { platform, installed: false, running: false, runAtLogin: false, unitPath };
|
|
191
|
+
}
|
|
192
|
+
// A unit on disk that the manager has not been told about is installed
|
|
193
|
+
// but inert, so "installed" and "running" are asked separately.
|
|
194
|
+
// launchd's answer is in the plist; systemd's is the enablement symlink,
|
|
195
|
+
// which the unit file itself says nothing about — a unit installed with
|
|
196
|
+
// --no-login would otherwise be reported as starting at login.
|
|
197
|
+
let runAtLogin;
|
|
198
|
+
if (platform === 'launchd') {
|
|
199
|
+
runAtLogin = /<key>RunAtLoad<\/key>\s*<true\/>/.test(contents);
|
|
200
|
+
}
|
|
201
|
+
else {
|
|
202
|
+
const enabled = await run('systemctl', ['--user', 'is-enabled', SYSTEMD_UNIT]);
|
|
203
|
+
const state = enabled.stdout.trim();
|
|
204
|
+
// is-enabled exits non-zero for "disabled", so the exit code alone
|
|
205
|
+
// cannot separate a real answer from a broken user bus or a timeout.
|
|
206
|
+
// Reading silence as "disabled" would let a transient failure turn an
|
|
207
|
+
// enabled service into a --no-login one on the next save.
|
|
208
|
+
runAtLogin = KNOWN_ENABLEMENT_STATES.has(state) ? state === 'enabled' : undefined;
|
|
209
|
+
}
|
|
210
|
+
return {
|
|
211
|
+
platform,
|
|
212
|
+
installed: true,
|
|
213
|
+
running: await isRunning(),
|
|
214
|
+
runAtLogin,
|
|
215
|
+
unitPath,
|
|
216
|
+
};
|
|
217
|
+
};
|
|
218
|
+
export const installService = async (env = {}, options = {}) => {
|
|
219
|
+
const platform = servicePlatform(env);
|
|
220
|
+
if (!platform) {
|
|
221
|
+
return {
|
|
222
|
+
ok: false,
|
|
223
|
+
messages: [`No service manager for ${env.platform ?? process.platform}. Run \`stratus serve\` yourself, or supervise it however you prefer.`],
|
|
224
|
+
};
|
|
225
|
+
}
|
|
226
|
+
const runAtLogin = options.runAtLogin ?? true;
|
|
227
|
+
const unitPath = serviceUnitPath(env);
|
|
228
|
+
const definition = serviceDefinition(env, runAtLogin, options.configPath);
|
|
229
|
+
await mkdir(path.dirname(unitPath), { recursive: true });
|
|
230
|
+
await mkdir(definition.logDir, { recursive: true, mode: 0o700 });
|
|
231
|
+
await writeFile(unitPath, platform === 'launchd' ? launchdPlist(definition) : systemdUnit(definition), { mode: 0o644 });
|
|
232
|
+
const run = runnerFor(env);
|
|
233
|
+
const messages = [`Wrote ${unitPath}`];
|
|
234
|
+
if (platform === 'launchd') {
|
|
235
|
+
const domain = `gui/${uidOf(env)}`;
|
|
236
|
+
// Replacing an existing job: bootout first, or bootstrap refuses with
|
|
237
|
+
// "service already loaded" and the new unit never takes effect.
|
|
238
|
+
await run('launchctl', ['bootout', `${domain}/${SERVICE_LABEL}`]);
|
|
239
|
+
const result = await run('launchctl', ['bootstrap', domain, unitPath]);
|
|
240
|
+
if (result.code !== 0) {
|
|
241
|
+
return { ok: false, messages: [...messages, `launchctl bootstrap failed: ${result.stderr.trim() || result.stdout.trim()}`] };
|
|
242
|
+
}
|
|
243
|
+
if (!runAtLogin) {
|
|
244
|
+
// RunAtLoad is false, so bootstrap alone loads the job without
|
|
245
|
+
// starting it. KeepAlive is omitted in that case too: launchd's
|
|
246
|
+
// SuccessfulExit condition implies RunAtLoad, which would restart
|
|
247
|
+
// the job at every login and quietly contradict --no-login.
|
|
248
|
+
const started = await run('launchctl', ['kickstart', `${domain}/${SERVICE_LABEL}`]);
|
|
249
|
+
if (started.code !== 0) {
|
|
250
|
+
return { ok: false, messages: [...messages, `launchctl kickstart failed: ${started.stderr.trim() || started.stdout.trim()}`] };
|
|
251
|
+
}
|
|
252
|
+
messages.push('stratusd is running. It will not start at login, and will not be restarted if it crashes.');
|
|
253
|
+
return { ok: true, messages };
|
|
254
|
+
}
|
|
255
|
+
messages.push('stratusd is running, and will start again when you log in.');
|
|
256
|
+
// Said plainly rather than left to be discovered: a LaunchAgent is
|
|
257
|
+
// tied to a login session, so a headless machine that reboots without
|
|
258
|
+
// one comes back with no agents running.
|
|
259
|
+
messages.push('Note: a LaunchAgent starts at login, not at power-on. For a machine that should recover from a reboot unattended, turn on automatic login in System Settings.');
|
|
260
|
+
return { ok: true, messages };
|
|
261
|
+
}
|
|
262
|
+
const reload = await run('systemctl', ['--user', 'daemon-reload']);
|
|
263
|
+
if (reload.code !== 0) {
|
|
264
|
+
return { ok: false, messages: [...messages, `systemctl daemon-reload failed: ${reload.stderr.trim()}`] };
|
|
265
|
+
}
|
|
266
|
+
if (!runAtLogin) {
|
|
267
|
+
// A prior `install` left an enablement symlink; `start` alone would
|
|
268
|
+
// leave it in place and the unit would keep starting at login. A
|
|
269
|
+
// failure here has to stop us claiming otherwise.
|
|
270
|
+
const disable = await run('systemctl', ['--user', 'disable', SYSTEMD_UNIT]);
|
|
271
|
+
const notEnabled = /not (?:enabled|found)|No such file/i.test(`${disable.stderr} ${disable.stdout}`);
|
|
272
|
+
if (disable.code !== 0 && !notEnabled) {
|
|
273
|
+
return {
|
|
274
|
+
ok: false,
|
|
275
|
+
messages: [...messages, `Could not remove the login trigger: ${disable.stderr.trim() || disable.stdout.trim()}`],
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
const enable = await run('systemctl', ['--user', ...(runAtLogin ? ['enable', '--now'] : ['start']), SYSTEMD_UNIT]);
|
|
280
|
+
if (enable.code !== 0) {
|
|
281
|
+
return { ok: false, messages: [...messages, `systemctl failed: ${enable.stderr.trim()}`] };
|
|
282
|
+
}
|
|
283
|
+
// `enable --now` and `start` both no-op on an already-active unit, so a
|
|
284
|
+
// rerun would report the new argv as installed while the old process —
|
|
285
|
+
// with the old config path — kept running. launchd needs no equivalent:
|
|
286
|
+
// bootout + bootstrap replaces the job outright.
|
|
287
|
+
const restart = await run('systemctl', ['--user', 'restart', SYSTEMD_UNIT]);
|
|
288
|
+
if (restart.code !== 0) {
|
|
289
|
+
return { ok: false, messages: [...messages, `systemctl restart failed: ${restart.stderr.trim() || restart.stdout.trim()}`] };
|
|
290
|
+
}
|
|
291
|
+
messages.push(runAtLogin
|
|
292
|
+
? 'stratusd is running, and will start again when you log in.'
|
|
293
|
+
: 'stratusd is running. It will not start automatically.');
|
|
294
|
+
if (runAtLogin) {
|
|
295
|
+
messages.push('Note: a user service starts at login. `loginctl enable-linger` keeps it running on a machine you do not stay logged in to.');
|
|
296
|
+
}
|
|
297
|
+
return { ok: true, messages };
|
|
298
|
+
};
|
|
299
|
+
export const uninstallService = async (env = {}) => {
|
|
300
|
+
const platform = servicePlatform(env);
|
|
301
|
+
if (!platform) {
|
|
302
|
+
return { ok: false, messages: [`No service manager for ${env.platform ?? process.platform}.`] };
|
|
303
|
+
}
|
|
304
|
+
const unitPath = serviceUnitPath(env);
|
|
305
|
+
const run = runnerFor(env);
|
|
306
|
+
const stopped = platform === 'launchd'
|
|
307
|
+
? await run('launchctl', ['bootout', `gui/${uidOf(env)}/${SERVICE_LABEL}`])
|
|
308
|
+
: await run('systemctl', ['--user', 'disable', '--now', SYSTEMD_UNIT]);
|
|
309
|
+
// Removing the unit after a FAILED stop would strand a live daemon with
|
|
310
|
+
// nothing left to stop it by, while telling the user it was shut down.
|
|
311
|
+
// A job that was never loaded is not a failure — there is nothing to stop.
|
|
312
|
+
const alreadyGone = /not (?:find|loaded)|No such process|could not find/i.test(`${stopped.stderr} ${stopped.stdout}`);
|
|
313
|
+
if (stopped.code !== 0 && !alreadyGone) {
|
|
314
|
+
return {
|
|
315
|
+
ok: false,
|
|
316
|
+
messages: [
|
|
317
|
+
`Could not stop stratusd: ${stopped.stderr.trim() || stopped.stdout.trim()}`,
|
|
318
|
+
`${unitPath} was left in place — removing it would leave the daemon running with nothing to stop it by.`,
|
|
319
|
+
],
|
|
320
|
+
};
|
|
321
|
+
}
|
|
322
|
+
await rm(unitPath, { force: true });
|
|
323
|
+
if (platform === 'systemd') {
|
|
324
|
+
await run('systemctl', ['--user', 'daemon-reload']);
|
|
325
|
+
}
|
|
326
|
+
return { ok: true, messages: [`Removed ${unitPath}. stratusd is stopped and will not start at login.`] };
|
|
327
|
+
};
|
|
328
|
+
export const startService = async (env = {}) => {
|
|
329
|
+
const platform = servicePlatform(env);
|
|
330
|
+
if (!platform) {
|
|
331
|
+
return { ok: false, messages: [`No service manager for ${env.platform ?? process.platform}.`] };
|
|
332
|
+
}
|
|
333
|
+
const run = runnerFor(env);
|
|
334
|
+
if (platform === 'systemd') {
|
|
335
|
+
const result = await run('systemctl', ['--user', 'restart', SYSTEMD_UNIT]);
|
|
336
|
+
return result.code === 0
|
|
337
|
+
? { ok: true, messages: ['stratusd started.'] }
|
|
338
|
+
: { ok: false, messages: [`Could not start stratusd: ${result.stderr.trim() || result.stdout.trim()}`, 'Is it installed? Run `stratus service install`.'] };
|
|
339
|
+
}
|
|
340
|
+
// `stop` boots the job out of the domain entirely, and kickstart only
|
|
341
|
+
// runs a job that is already there — so start after stop would fail
|
|
342
|
+
// until something bootstrapped the plist again. Bootstrapping first
|
|
343
|
+
// makes the documented stop/start pair work; it is expected to fail
|
|
344
|
+
// when the job is still loaded, which is fine.
|
|
345
|
+
const domain = `gui/${uidOf(env)}`;
|
|
346
|
+
await run('launchctl', ['bootstrap', domain, serviceUnitPath(env)]);
|
|
347
|
+
// -k restarts a job that is already running, which is what "start"
|
|
348
|
+
// means after a config change.
|
|
349
|
+
const result = await run('launchctl', ['kickstart', '-k', `${domain}/${SERVICE_LABEL}`]);
|
|
350
|
+
return result.code === 0
|
|
351
|
+
? { ok: true, messages: ['stratusd started.'] }
|
|
352
|
+
: { ok: false, messages: [`Could not start stratusd: ${result.stderr.trim() || result.stdout.trim()}`, 'Is it installed? Run `stratus service install`.'] };
|
|
353
|
+
};
|
|
354
|
+
export const stopService = async (env = {}) => {
|
|
355
|
+
const platform = servicePlatform(env);
|
|
356
|
+
if (!platform) {
|
|
357
|
+
return { ok: false, messages: [`No service manager for ${env.platform ?? process.platform}.`] };
|
|
358
|
+
}
|
|
359
|
+
const run = runnerFor(env);
|
|
360
|
+
// Asked before stopping, while the job is still there to ask about: a
|
|
361
|
+
// unit installed with --no-login will NOT come back at the next login,
|
|
362
|
+
// and telling someone it will leaves their agents offline indefinitely.
|
|
363
|
+
const status = await readServiceStatus(env);
|
|
364
|
+
const result = platform === 'launchd'
|
|
365
|
+
? await run('launchctl', ['bootout', `gui/${uidOf(env)}/${SERVICE_LABEL}`])
|
|
366
|
+
: await run('systemctl', ['--user', 'stop', SYSTEMD_UNIT]);
|
|
367
|
+
return result.code === 0
|
|
368
|
+
? {
|
|
369
|
+
ok: true,
|
|
370
|
+
messages: [status?.runAtLogin === undefined
|
|
371
|
+
// The manager could not say, so neither can we — promising either
|
|
372
|
+
// outcome is how agents end up offline while someone waits.
|
|
373
|
+
? 'stratusd stopped. Whether it starts again at login could not be determined — check `stratus service status`.'
|
|
374
|
+
: status.runAtLogin
|
|
375
|
+
? 'stratusd stopped. It will start again at your next login unless you uninstall it.'
|
|
376
|
+
: 'stratusd stopped. It will NOT start again on its own — run `stratus service start` when you want it back.'],
|
|
377
|
+
}
|
|
378
|
+
: { ok: false, messages: [`Could not stop stratusd: ${result.stderr.trim() || result.stdout.trim()}`] };
|
|
379
|
+
};
|
|
380
|
+
//# sourceMappingURL=service.js.map
|
|
@@ -0,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|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"types": "./dist/index.d.ts",
|
|
@@ -16,17 +16,24 @@
|
|
|
16
16
|
"files": [
|
|
17
17
|
"dist"
|
|
18
18
|
],
|
|
19
|
+
"engines": {
|
|
20
|
+
"node": ">=22.13 <23 || >=23.4"
|
|
21
|
+
},
|
|
19
22
|
"dependencies": {
|
|
20
|
-
"@stratusagent/
|
|
21
|
-
"@stratusagent/
|
|
22
|
-
"@stratusagent/
|
|
23
|
-
"@stratusagent/
|
|
24
|
-
"@stratusagent/
|
|
25
|
-
"@stratusagent/provider-claude-code": "0.
|
|
23
|
+
"@stratusagent/core": "0.3.0",
|
|
24
|
+
"@stratusagent/agents": "0.3.0",
|
|
25
|
+
"@stratusagent/gateway": "0.3.0",
|
|
26
|
+
"@stratusagent/permissions": "0.3.0",
|
|
27
|
+
"@stratusagent/provider-anthropic": "0.3.0",
|
|
28
|
+
"@stratusagent/provider-claude-code": "0.3.0",
|
|
29
|
+
"@stratusagent/providers": "0.3.0",
|
|
30
|
+
"@stratusagent/state": "0.3.0",
|
|
31
|
+
"@stratusagent/executor-local": "0.3.0"
|
|
26
32
|
},
|
|
27
33
|
"devDependencies": {
|
|
28
34
|
"@types/node": "^24.6.0",
|
|
29
|
-
"typescript": "^5.9.3"
|
|
35
|
+
"typescript": "^5.9.3",
|
|
36
|
+
"@stratusagent/channel-slack": "0.3.0"
|
|
30
37
|
},
|
|
31
38
|
"license": "MIT",
|
|
32
39
|
"repository": {
|
|
@@ -44,6 +51,14 @@
|
|
|
44
51
|
"publishConfig": {
|
|
45
52
|
"access": "public"
|
|
46
53
|
},
|
|
54
|
+
"peerDependencies": {
|
|
55
|
+
"@stratusagent/channel-slack": "0.3.0"
|
|
56
|
+
},
|
|
57
|
+
"peerDependenciesMeta": {
|
|
58
|
+
"@stratusagent/channel-slack": {
|
|
59
|
+
"optional": true
|
|
60
|
+
}
|
|
61
|
+
},
|
|
47
62
|
"scripts": {
|
|
48
63
|
"build": "tsc -b",
|
|
49
64
|
"cli": "node --experimental-strip-types ./src/bin.ts",
|