@akshar5/cohall 0.4.4 → 0.4.6

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.
@@ -1,7 +1,8 @@
1
1
  [Unit]
2
2
  Description=Cohall relay
3
- After=network-online.target
3
+ After=network-online.target cohall-relay.socket
4
4
  Wants=network-online.target
5
+ Requires=cohall-relay.socket
5
6
 
6
7
  [Service]
7
8
  Type=simple
@@ -9,6 +10,7 @@ User=cohall
9
10
  Group=cohall
10
11
  EnvironmentFile=/etc/cohall/relay.env
11
12
  ExecStart=/usr/local/bin/cohall relay
13
+ Sockets=cohall-relay.socket
12
14
  Restart=on-failure
13
15
  RestartSec=3
14
16
  UMask=0077
@@ -0,0 +1,11 @@
1
+ [Unit]
2
+ Description=Cohall relay socket
3
+
4
+ [Socket]
5
+ ListenStream=127.0.0.1:8787
6
+ NoDelay=true
7
+ FileDescriptorName=cohall-relay
8
+ Service=cohall-relay.service
9
+
10
+ [Install]
11
+ WantedBy=sockets.target
package/docs/install.md CHANGED
@@ -71,9 +71,11 @@ Configuration locations:
71
71
  Use `COHALL_CONFIG` to override the path. On Unix, Cohall enforces directory
72
72
  mode `0700` and file mode `0600`.
73
73
 
74
- The relay must stay online so devices and clients can reach it. A target device
75
- must be online only while it is accepting or running work; queued tasks remain
76
- durable on the relay while it is offline.
74
+ The relay must be reachable to submit new work or read its status. A target
75
+ device only needs to be online while accepting or running work; accepted tasks
76
+ wait durably on the relay while it is offline. Accepted tasks also survive a
77
+ relay restart when its data directory is persistent. A client cannot submit a
78
+ new task while the relay itself is offline.
77
79
 
78
80
  `--providers` is an optional comma-separated allowlist. It prevents an installed
79
81
  but unauthenticated provider executable from being advertised. Run `cohall
@@ -94,8 +96,9 @@ services. Active services restart even when the package files are already
94
96
  current, so a process left on old code by a direct package-manager update is
95
97
  replaced. If a service points to a different global installation, Cohall stops
96
98
  with its executable path instead of reporting a misleading successful restart.
97
- Run that executable's `upgrade` command or update the service definition. Choose an exact version with `cohall upgrade --to 1.2.3`. Use `--dry-run` to inspect the plan or
98
- `--no-restart` to leave active services pending a manual restart.
99
+ Run that executable's `upgrade` command or update the service definition. Choose
100
+ an exact version with `cohall upgrade --to 1.2.3`. Use `--dry-run` to inspect the
101
+ plan or `--no-restart` to leave active services pending a manual restart.
99
102
 
100
103
  Back up the data directory before upgrading a production relay; SQLite schema
101
104
  migrations run in place. A system-level relay may require running the command
@@ -87,6 +87,4 @@ owner or device token in an MCP client configuration.
87
87
  CLI and MCP are equivalent entry points. Use one per delegated task.
88
88
  Both expose redacted task tracing through `cohall trace <task-id>` and the
89
89
  `task_trace` MCP tool.
90
- Replace the `npx`, `-y`, `@akshar5/cohall` command prefix with `bunx`,
91
- `@akshar5/cohall` or `pnpm`, `dlx`, `@akshar5/cohall` when that better matches
92
- the host.
90
+ Use `bunx @akshar5/cohall` with Bun. Use `pnpm dlx @akshar5/cohall` with pnpm.
package/docs/releasing.md CHANGED
@@ -8,7 +8,6 @@ Before merging a release:
8
8
  ```bash
9
9
  bun install --frozen-lockfile
10
10
  bun run check
11
- bun run check
12
11
  npm pack --dry-run
13
12
  ```
14
13
 
package/docs/services.md CHANGED
@@ -4,6 +4,19 @@ Interactive use should use `npx -y @akshar5/cohall`. Unattended services
4
4
  install the same npm package so the operating system has a stable executable
5
5
  path.
6
6
 
7
+ ## Startup behavior
8
+
9
+ | Component | Starts again | Offline behavior |
10
+ | -------------- | -------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
11
+ | Linux relay | At boot when its systemd socket and service are enabled | Cannot accept new tasks while down; persisted tasks resume after startup |
12
+ | Linux device | With the user's systemd manager; at boot without login when lingering is enabled | Accepted tasks wait on the relay and dispatch after reconnect |
13
+ | macOS device | At user login through launchd | Accepted tasks wait while the Mac is off, asleep, or logged out |
14
+ | Windows device | At user logon through Task Scheduler | Accepted tasks wait while the PC is off or logged out |
15
+
16
+ The relay's data directory must be persistent. Cohall uses at-least-once delivery:
17
+ work interrupted during execution can run again after recovery, so consequential
18
+ tasks should be idempotent.
19
+
7
20
  ## Linux device daemon
8
21
 
9
22
  Install and pair as the user that will run the daemon:
@@ -25,7 +38,15 @@ journalctl --user -u cohall-device -f
25
38
  loginctl enable-linger "$USER"
26
39
  ```
27
40
 
28
- Linger is optional; it keeps the daemon running after logout.
41
+ Linger is optional. Without it, the user service starts after login and stops
42
+ with the user's service manager. With it, the service starts at boot and remains
43
+ available after logout. Verify the configuration with:
44
+
45
+ ```bash
46
+ systemctl --user is-enabled cohall-device
47
+ systemctl --user is-active cohall-device
48
+ loginctl show-user "$USER" -p Linger
49
+ ```
29
50
 
30
51
  ## Linux relay
31
52
 
@@ -41,16 +62,30 @@ COHALL_TOKEN=replace-with-a-random-owner-token
41
62
  COHALL_DATA_DIR=/var/lib/cohall
42
63
  ```
43
64
 
44
- Install `deploy/systemd/cohall-relay.service`, then:
65
+ Install `deploy/systemd/cohall-relay.service` and
66
+ `deploy/systemd/cohall-relay.socket`. The packaged socket listens on loopback;
67
+ change `ListenStream` to the relay's private Tailscale address when devices
68
+ connect directly over Tailscale. Then:
45
69
 
46
70
  ```bash
47
71
  systemctl daemon-reload
72
+ systemctl enable --now cohall-relay.socket
48
73
  systemctl enable --now cohall-relay
49
74
  journalctl -u cohall-relay -f
50
75
  ```
51
76
 
77
+ Verify both units are enabled and active:
78
+
79
+ ```bash
80
+ systemctl is-enabled cohall-relay.socket cohall-relay.service
81
+ systemctl is-active cohall-relay.socket cohall-relay.service
82
+ ```
83
+
52
84
  Expose the relay only through a private network such as Tailscale or an HTTPS
53
- reverse proxy. Device connections are outbound WebSockets.
85
+ reverse proxy. Device connections are outbound WebSockets. The socket unit keeps
86
+ the listener available across relay service restarts: new connections wait for
87
+ the replacement process instead of failing. Existing WebSockets reconnect, and
88
+ durable tasks resume after the replacement relay starts.
54
89
 
55
90
  ## macOS
56
91
 
@@ -69,6 +104,14 @@ launchctl bootstrap gui/"$(id -u)" ~/Library/LaunchAgents/com.cohall.device.plis
69
104
  launchctl kickstart -k gui/"$(id -u)"/com.cohall.device
70
105
  ```
71
106
 
107
+ The packaged LaunchAgent uses `RunAtLoad` and `KeepAlive`: it starts at login,
108
+ restarts after failure, and reconnects when the network returns. It cannot run
109
+ before that user logs in. Check it with:
110
+
111
+ ```bash
112
+ launchctl print gui/"$(id -u)"/com.cohall.device
113
+ ```
114
+
72
115
  The relay and device worker may run on the same machine. Configure the worker
73
116
  with the relay's private Tailscale URL and install both services independently.
74
117
 
@@ -82,14 +125,16 @@ powershell -ExecutionPolicy Bypass -File deploy\windows\install-device.ps1
82
125
  ```
83
126
 
84
127
  The script registers a per-user scheduled task that starts `cohall device` at
85
- logon and restarts it after failures.
128
+ logon and restarts it after failures. It does not run before that user logs on.
86
129
 
87
130
  ## Upgrade running services
88
131
 
89
132
  Run `cohall upgrade` from a global npm, Bun, or pnpm installation. It updates
90
133
  that installation and restarts only active managed Cohall services, with relays
91
134
  restarted before device daemons. Active services restart even when the installed
92
- files already match the requested version. A delegated upgrade can finish after
135
+ files already match the requested version. A systemd relay installed with the
136
+ packaged socket unit keeps accepting new connections while its process restarts.
137
+ A delegated upgrade can finish after
93
138
  restarting its own device daemon: a durable receipt records the restart attempt,
94
139
  and a delegated caller leaves that marker for the replacement task to consume
95
140
  after reconnecting, even when a service manager returns before ending the old process.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@akshar5/cohall",
3
- "version": "0.4.4",
3
+ "version": "0.4.6",
4
4
  "description": "Let coding agents delegate work across your own devices.",
5
5
  "keywords": [
6
6
  "agents",