@rivus/gateway 0.21.1 → 0.21.2

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.
@@ -2250,7 +2250,7 @@ function parseLockOwner(value) {
2250
2250
  //#endregion
2251
2251
  //#region src/platform/project/setup/release-descriptor.ts
2252
2252
  const RIVUS_RELEASE_DESCRIPTOR = Object.freeze({
2253
- version: "0.21.1",
2253
+ version: "0.21.2",
2254
2254
  dependencies: Object.freeze({
2255
2255
  "@earendil-works/pi-coding-agent": "0.84.4",
2256
2256
  "@larksuiteoapi/node-sdk": "1.74.0",
@@ -4085,6 +4085,7 @@ function createLaunchdServiceManager(context) {
4085
4085
  if (result.exitCode !== 0) {
4086
4086
  if (/Could not find service ["']?[^\n]+ in domain/u.test(result.stderr)) return {
4087
4087
  loaded: false,
4088
+ stopping: false,
4088
4089
  running: false,
4089
4090
  command: service.command
4090
4091
  };
@@ -4092,6 +4093,8 @@ function createLaunchdServiceManager(context) {
4092
4093
  }
4093
4094
  const state = /^\s*state = ([^\r\n]+)$/mu.exec(result.stdout)?.[1]?.trim();
4094
4095
  const pidText = /^\s*pid = (\d+)\s*$/mu.exec(result.stdout)?.[1];
4096
+ const pid = pidText ? Number(pidText) : void 0;
4097
+ const stopping = state === "SIGTERMed" && Boolean(pid && pid > 0);
4095
4098
  const stoppedStates = [
4096
4099
  "waiting",
4097
4100
  "not running",
@@ -4104,8 +4107,7 @@ function createLaunchdServiceManager(context) {
4104
4107
  "spawning",
4105
4108
  "throttled"
4106
4109
  ];
4107
- if (!state || ![...stoppedStates, ...pendingStates].includes(state)) throw new Error("launchctl print returned an unrecognized service state.");
4108
- const pid = pidText ? Number(pidText) : void 0;
4110
+ if (!state || !stopping && ![...stoppedStates, ...pendingStates].includes(state)) throw new Error("launchctl print returned an unrecognized service state.");
4109
4111
  const running = Boolean(pid && pid > 0) || pendingStates.includes(state);
4110
4112
  const block = /^\s*arguments = \{\r?\n([\s\S]*?)^\s*\}\s*$/mu.exec(result.stdout)?.[1];
4111
4113
  let command = service.command;
@@ -4115,6 +4117,7 @@ function createLaunchdServiceManager(context) {
4115
4117
  }
4116
4118
  return {
4117
4119
  loaded: true,
4120
+ stopping,
4118
4121
  running,
4119
4122
  ...pid ? { pid } : {},
4120
4123
  command
@@ -4141,12 +4144,13 @@ function createLaunchdServiceManager(context) {
4141
4144
  },
4142
4145
  load,
4143
4146
  async inspect(identity) {
4144
- const { loaded: _loaded, ...status } = await query(identity);
4147
+ const { loaded: _loaded, stopping: _stopping, ...status } = await query(identity);
4145
4148
  return status;
4146
4149
  },
4147
4150
  async stop(identity) {
4148
- if ((await query(identity)).loaded) await requireServiceTool(context, "/bin/launchctl", ["bootout", `${domain}/${identity.id}`]);
4149
- await waitForServiceStop(context, () => query(identity));
4151
+ const observed = await query(identity);
4152
+ if (observed.loaded && !observed.stopping) await requireServiceTool(context, "/bin/launchctl", ["bootout", `${domain}/${identity.id}`]);
4153
+ await waitForServiceStop(context, async () => ({ running: (await query(identity)).loaded }));
4150
4154
  },
4151
4155
  async switch(identity, command, backupDirectory) {
4152
4156
  const service = await load(identity);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivus/gateway",
3
- "version": "0.21.1",
3
+ "version": "0.21.2",
4
4
  "description": "Message gateway, channels, host binding, automation, and daemon assembly for Rivus.",
5
5
  "type": "module",
6
6
  "license": "GPL-3.0-only",
@@ -57,8 +57,8 @@
57
57
  "@agentclientprotocol/sdk": "1.5.1",
58
58
  "@larksuiteoapi/node-sdk": "1.74.0",
59
59
  "@resvg/resvg-js": "2.6.2",
60
- "@rivus/platform": "0.21.1",
61
- "@rivus/runtime": "0.21.1",
60
+ "@rivus/platform": "0.21.2",
61
+ "@rivus/runtime": "0.21.2",
62
62
  "axios": "1.20.0",
63
63
  "effect": "^4.0.0",
64
64
  "get-east-asian-width": "1.6.0",