@ours.network/cowork 1.0.7 → 1.0.8
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/dist/cli.js +8 -4
- package/docs/09-service-management.md +3 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -5719,7 +5719,11 @@ function serviceEnvironment(config) {
|
|
|
5719
5719
|
};
|
|
5720
5720
|
}
|
|
5721
5721
|
function validateServiceConfiguration(config) {
|
|
5722
|
-
const values = {
|
|
5722
|
+
const values = {
|
|
5723
|
+
node_executable: process.execPath,
|
|
5724
|
+
cowork_cli: SELF,
|
|
5725
|
+
...serviceEnvironment(config)
|
|
5726
|
+
};
|
|
5723
5727
|
for (const [label, value] of Object.entries(values)) {
|
|
5724
5728
|
if (/[\x00-\x1f\x7f-\x9f]/.test(value)) {
|
|
5725
5729
|
throw new CliError(EXIT.invalidState, "invalid_state", `${label} contains a control character unsafe for a service definition`);
|
|
@@ -5731,7 +5735,7 @@ function systemdValueQuote(value) {
|
|
|
5731
5735
|
}
|
|
5732
5736
|
function systemdExecutableQuote(value) {
|
|
5733
5737
|
if (value.includes('"') || /[\0\n\r]/.test(value)) {
|
|
5734
|
-
throw new CliError(EXIT.invalidState, "invalid_state", "
|
|
5738
|
+
throw new CliError(EXIT.invalidState, "invalid_state", "node_executable contains a character unsupported by systemd ExecStart");
|
|
5735
5739
|
}
|
|
5736
5740
|
return `"${value.replaceAll("\\", "\\\\").replaceAll("%", "%%")}"`;
|
|
5737
5741
|
}
|
|
@@ -5761,7 +5765,7 @@ StartLimitIntervalSec=0
|
|
|
5761
5765
|
|
|
5762
5766
|
[Service]
|
|
5763
5767
|
Type=simple
|
|
5764
|
-
ExecStart=${systemdExecutableQuote(SELF)} serve
|
|
5768
|
+
ExecStart=${systemdExecutableQuote(process.execPath)} ${systemdValueQuote(SELF)} serve
|
|
5765
5769
|
${environment}
|
|
5766
5770
|
Restart=on-failure
|
|
5767
5771
|
RestartSec=5
|
|
@@ -5798,7 +5802,7 @@ function installLaunchd(config) {
|
|
|
5798
5802
|
<plist version="1.0"><dict>
|
|
5799
5803
|
<key>Label</key><string>${LAUNCHD_LABEL}</string>
|
|
5800
5804
|
<key>ProgramArguments</key><array>
|
|
5801
|
-
<string>${xml(SELF)}</string><string>serve</string>
|
|
5805
|
+
<string>${xml(process.execPath)}</string><string>${xml(SELF)}</string><string>serve</string>
|
|
5802
5806
|
</array>
|
|
5803
5807
|
<key>EnvironmentVariables</key><dict>
|
|
5804
5808
|
${environment}
|
|
@@ -7,8 +7,10 @@ ours-cowork install-service
|
|
|
7
7
|
ours-cowork uninstall-service
|
|
8
8
|
```
|
|
9
9
|
|
|
10
|
-
Linux uses `ours-cowork.service` under the systemd user directory. macOS uses the `network.ours.cowork` launchd agent. Both definitions
|
|
10
|
+
Linux uses `ours-cowork.service` under the systemd user directory. macOS uses the `network.ours.cowork` launchd agent. Both definitions capture the installing process's absolute Node executable and the canonical installed cowork CLI path, then execute that pair in `serve` mode without relying on service-manager `PATH` lookup or the CLI's `#!/usr/bin/env node` shebang. They preserve the cowork state directory and optional REST port. They also preserve a non-secret SDK-standard `OURS_CONFIG`, `OURS_PORT`, or `OURS_STATE_DIR` selection present during installation. They never copy `OURS_API_TOKEN` or broker settings.
|
|
11
11
|
|
|
12
12
|
Install and start the shared daemon's own service first with `ours daemon install-service --yes`. Cowork never manages that service. Both cowork definitions restart on failure and keep retrying at a fixed interval for as long as the failure lasts. The systemd unit sets `StartLimitIntervalSec=0` with `RestartSec=5`, so an unavailable shared daemon does not permanently exhaust the start limit. A clean cowork stop is still final. The launchd agent uses `KeepAlive` and retries on launchd's own interval.
|
|
13
13
|
|
|
14
14
|
Installation rejects service values containing NUL, newline, carriage return, or other unsafe control characters before creating or replacing a definition. It then stops a manually detached cowork daemon through the authenticated control session before the service takes ownership. Uninstall first requires systemd to disable/stop the unit or launchd to unload the agent. If that operation fails, uninstall reports failure and retains the service definition for inspection or retry. After a successful unload, uninstall retains cowork configuration, room metadata and archives, and every identity in the shared daemon.
|
|
15
|
+
|
|
16
|
+
Re-run `ours-cowork install-service` after relocating or replacing either the Node runtime or the installed package. Reinstallation replaces the managed definition with the current absolute paths and remains safe to repeat; an old definition cannot follow a removed version-manager runtime or package location by itself.
|