@agentsdock/server 1.0.10-beta.6 → 1.0.10

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agentsdock/server",
3
- "version": "1.0.10-beta.6",
3
+ "version": "1.0.10",
4
4
  "description": "AgentsDock's self-hosted Python server and explicit installation CLI",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
package/server/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.10-beta.6
1
+ 1.0.10
@@ -913,18 +913,22 @@ def control(instance: Instance, action: str, platform: str = sys.platform):
913
913
  status = service_status(instance, platform)
914
914
  if status == "unknown":
915
915
  raise ValueError("Cannot establish service state; no service changes made.")
916
- if action == "stop":
917
- if status != "stopped":
918
- run(["launchctl", "bootout", target])
919
- elif status == "stopped":
920
- run(["launchctl", "bootstrap", f"gui/{os.getuid()}", str(instance.service_file(platform))])
921
- elif action == "restart":
916
+ if action in {"stop", "restart"} and status != "stopped":
922
917
  run(["launchctl", "bootout", target])
918
+ # bootout may return before launchd has removed the job. Returning
919
+ # early lets a following start see the old job as running and
920
+ # silently do nothing. Stop and restart need the same unload gate.
923
921
  deadline = time.monotonic() + 180
924
- while service_status(instance, platform) != "stopped":
922
+ while True:
923
+ status = service_status(instance, platform)
924
+ if status == "stopped":
925
+ break
926
+ if status == "unknown":
927
+ raise ValueError("Cannot confirm service stopped; no replacement process was started.")
925
928
  if time.monotonic() >= deadline:
926
929
  raise ValueError("Service did not stop; refusing to start a second process.")
927
930
  time.sleep(0.1)
931
+ if action != "stop" and status == "stopped":
928
932
  run(["launchctl", "bootstrap", f"gui/{os.getuid()}", str(instance.service_file(platform))])
929
933
  else:
930
934
  run(["systemctl", "--user", action, service_name(instance.name) + ".service"])