@rynx-ai/cli 0.1.11-beta.44 → 0.1.11-beta.45

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.
@@ -2,7 +2,7 @@ import { startStandaloneDaemon, statusStandaloneDaemon, stopStandaloneDaemon, st
2
2
  import { shutdownResidentDaemonIfIdle, waitForResidentDaemonExit, } from "../control-client.js";
3
3
  import { resolveDaemonControlEndpoint } from "../control-endpoint.js";
4
4
  import { refreshAutostart } from "../autostart.js";
5
- import { assertLinuxSystemdInvocation, stopLinuxServiceIfActive, } from "../systemd-service.js";
5
+ import { assertLinuxSystemdInvocation } from "../systemd-service.js";
6
6
  import { clearLegacyMaintenanceState } from "../legacy-maintenance.js";
7
7
  import { fail } from "./errors.js";
8
8
  const SYSTEMD_SERVICE_FLAG = "--systemd-service";
@@ -61,10 +61,6 @@ export async function runLifecycleCommand(command, args, options = {}) {
61
61
  return 5;
62
62
  }
63
63
  }
64
- if (stopLinuxServiceIfActive()) {
65
- clearLegacyMaintenanceAfterStop();
66
- return 0;
67
- }
68
64
  return stopStandaloneAndThenClearLegacyMaintenance();
69
65
  }
70
66
  case "status":
@@ -46,12 +46,6 @@ export declare function disableLinuxAutostart(): void;
46
46
  /** Refresh an existing autostart unit without changing enablement. */
47
47
  export declare function refreshLinuxServiceIfPresent(): boolean;
48
48
  export declare function assertLinuxSystemdInvocation(): void;
49
- /**
50
- * Stop through systemd while the oneshot unit owns the lifecycle state. PM2
51
- * owns its own process tree; systemd only records whether its start hook has
52
- * completed and provides the matching synchronous ExecStop boundary.
53
- */
54
- export declare function stopLinuxServiceIfActive(): boolean;
55
49
  export declare function parseLinuxSystemdShow(output: string): LinuxSystemdServiceState;
56
50
  export declare function inspectLinuxPm2GodProcesses(home: string, deps?: LinuxPm2InspectionDeps): LinuxPm2GodInspection;
57
51
  export declare function scanLinuxPm2GodPids(home: string, deps?: LinuxPm2InspectionDeps): number[];
@@ -8,7 +8,6 @@ export const RYNX_SYSTEMD_SERVICE = "rynx.service";
8
8
  export const RYNX_SYSTEMD_SERVICE_ENV = "RYNX_SYSTEMD_SERVICE";
9
9
  export const RYNX_SERVICE_ENV_KEYS = "RYNX_SERVICE_ENV_KEYS";
10
10
  const COMMAND_TIMEOUT_MS = 5_000;
11
- const STOP_COMMAND_TIMEOUT_MS = 50_000;
12
11
  const AUTOMATIC_SERVICE_ENVIRONMENT = new Set([
13
12
  "ALL_PROXY",
14
13
  "AWS_CA_BUNDLE",
@@ -185,62 +184,6 @@ export function assertLinuxSystemdInvocation() {
185
184
  throw new Error(`--systemd-service requires the ${RYNX_SYSTEMD_SERVICE} cgroup`);
186
185
  }
187
186
  }
188
- /**
189
- * Stop through systemd while the oneshot unit owns the lifecycle state. PM2
190
- * owns its own process tree; systemd only records whether its start hook has
191
- * completed and provides the matching synchronous ExecStop boundary.
192
- */
193
- export function stopLinuxServiceIfActive() {
194
- if (process.platform !== "linux")
195
- return false;
196
- const context = currentContext();
197
- const inspection = inspectLinuxPm2GodProcesses(context.pm2Home);
198
- assertSingleGod(inspection);
199
- if (!linuxUserSystemdAvailable()) {
200
- const unitMode = installedLinuxUnitMode(context);
201
- if (unitMode === "legacy-or-unknown" ||
202
- (unitMode === "absent" && (inspection.kind === "service-cgroup" ||
203
- currentProcessHasLinuxServiceEvidence()))) {
204
- throw new Error(`cannot safely stop a legacy or still-loaded ${RYNX_SYSTEMD_SERVICE} without user systemd; ` +
205
- "retry from a login session where systemctl --user is available");
206
- }
207
- return false;
208
- }
209
- const state = inspectLinuxSystemdService();
210
- if (linuxSystemdServiceIsSettledInactive(state))
211
- return false;
212
- stopLinuxSystemdServiceAndVerify(context);
213
- return true;
214
- }
215
- function stopLinuxSystemdServiceAndVerify(context) {
216
- requireSuccess(run("systemctl", ["--user", "stop", RYNX_SYSTEMD_SERVICE], STOP_COMMAND_TIMEOUT_MS), `systemctl --user stop ${RYNX_SYSTEMD_SERVICE}`);
217
- const remaining = inspectLinuxPm2GodProcesses(context.pm2Home);
218
- if (remaining.kind !== "absent") {
219
- throw new Error(`${RYNX_SYSTEMD_SERVICE} stop completed but the PM2 supervisor is still running: ` +
220
- describeInspection(remaining));
221
- }
222
- }
223
- function linuxSystemdServiceIsSettledInactive(state) {
224
- return state.activeState === "inactive" || state.activeState === "failed";
225
- }
226
- function installedLinuxUnitMode(context) {
227
- if (!existsSync(context.unitPath))
228
- return "absent";
229
- const content = readFileSync(context.unitPath, "utf8");
230
- const type = /^\s*Type\s*=\s*([^\s#]+)\s*$/mi.exec(content)?.[1]?.toLowerCase();
231
- const remains = /^\s*RemainAfterExit\s*=\s*yes\s*$/mi.test(content);
232
- return type === "oneshot" && remains ? "oneshot" : "legacy-or-unknown";
233
- }
234
- function currentProcessHasLinuxServiceEvidence() {
235
- if (process.env[RYNX_SYSTEMD_SERVICE_ENV] === RYNX_SYSTEMD_SERVICE)
236
- return true;
237
- try {
238
- return cgroupHasService(linuxSystemdCgroupForPid(process.pid));
239
- }
240
- catch {
241
- return false;
242
- }
243
- }
244
187
  export function parseLinuxSystemdShow(output) {
245
188
  const values = new Map();
246
189
  for (const line of output.split(/\r?\n/)) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rynx-ai/cli",
3
- "version": "0.1.11-beta.44",
3
+ "version": "0.1.11-beta.45",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/rynx-ai/rynx.git",
@@ -51,12 +51,12 @@
51
51
  "dependencies": {
52
52
  "@clack/prompts": "^1.6.0",
53
53
  "ws": "^8.21.0",
54
- "@rynx-ai/core": "0.1.11-beta.44",
55
- "@rynx-ai/emulator": "0.1.11-beta.44",
56
- "@rynx-ai/protocol": "0.1.11-beta.44",
57
- "@rynx-ai/tmux": "0.1.11-beta.44",
58
- "@rynx-ai/browser-cdp": "0.1.11-beta.44",
59
- "@rynx-ai/daemon": "0.1.11-beta.44"
54
+ "@rynx-ai/core": "0.1.11-beta.45",
55
+ "@rynx-ai/daemon": "0.1.11-beta.45",
56
+ "@rynx-ai/browser-cdp": "0.1.11-beta.45",
57
+ "@rynx-ai/emulator": "0.1.11-beta.45",
58
+ "@rynx-ai/protocol": "0.1.11-beta.45",
59
+ "@rynx-ai/tmux": "0.1.11-beta.45"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/ws": "^8.18.1"