cowork-os 0.3.59 → 0.3.61
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/README.md +11 -7
- package/package.json +6 -5
- package/scripts/postinstall.mjs +69 -0
- package/scripts/setup_native.mjs +50 -7
package/README.md
CHANGED
|
@@ -44,8 +44,8 @@ Your AI needs a secure home. CoWork OS provides the runtime, security layers, an
|
|
|
44
44
|
|
|
45
45
|
### macOS App (Recommended)
|
|
46
46
|
|
|
47
|
-
- Download
|
|
48
|
-
-
|
|
47
|
+
- Download the latest build from [GitHub Releases](https://github.com/CoWork-OS/CoWork-OS/releases/latest)
|
|
48
|
+
- In Assets, download the newest Apple Silicon DMG (`CoWork-OS-<version>-arm64.dmg`)
|
|
49
49
|
- Open the `.dmg` and drag **CoWork OS** into **Applications**
|
|
50
50
|
- Eject the mounted DMG after copying, then launch only **/Applications/CoWork OS.app** (prevents duplicate app instances/icons)
|
|
51
51
|
- This app is currently distributed as an unsigned build. On first launch, use **System Settings > Privacy & Security > Open Anyway** once.
|
|
@@ -53,11 +53,11 @@ Your AI needs a secure home. CoWork OS provides the runtime, security layers, an
|
|
|
53
53
|
- If the app closes immediately with a `dyld` signature error, run: `codesign --force --deep --sign - "/Applications/CoWork OS.app"`
|
|
54
54
|
- `spctl --add` / `spctl --enable` are deprecated on newer macOS and may show "This operation is no longer supported"
|
|
55
55
|
|
|
56
|
-
### From Source (Development)
|
|
56
|
+
### From GitHub Source (Development)
|
|
57
57
|
|
|
58
58
|
#### Prerequisites
|
|
59
59
|
|
|
60
|
-
- Node.js
|
|
60
|
+
- Node.js 22+ and npm
|
|
61
61
|
- macOS 12 (Monterey) or later
|
|
62
62
|
- One of: any supported LLM provider credentials (API key/token or AWS credentials) or Ollama installed locally
|
|
63
63
|
- Xcode Command Line Tools (needed to build `better-sqlite3` for Electron): `xcode-select --install`
|
|
@@ -67,7 +67,7 @@ Your AI needs a secure home. CoWork OS provides the runtime, security layers, an
|
|
|
67
67
|
git clone https://github.com/CoWork-OS/CoWork-OS.git
|
|
68
68
|
cd CoWork-OS
|
|
69
69
|
|
|
70
|
-
# Install dependencies and set up native modules
|
|
70
|
+
# Install dependencies and set up native modules (includes automatic macOS retry handling)
|
|
71
71
|
npm run setup
|
|
72
72
|
|
|
73
73
|
# Run in development mode
|
|
@@ -78,9 +78,13 @@ npm run dev
|
|
|
78
78
|
|
|
79
79
|
#### Troubleshooting: macOS "Killed: 9" during setup
|
|
80
80
|
|
|
81
|
-
If
|
|
81
|
+
If you see `Killed: 9` during `npm run setup`, macOS terminated a native build due to memory pressure.
|
|
82
82
|
|
|
83
|
-
|
|
83
|
+
`npm run setup` already retries native setup automatically with backoff. Let it continue until it exits. If it still exits non-zero, close heavy apps and run the same command again:
|
|
84
|
+
|
|
85
|
+
```bash
|
|
86
|
+
npm run setup
|
|
87
|
+
```
|
|
84
88
|
|
|
85
89
|
#### Build for Production
|
|
86
90
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cowork-os",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.61",
|
|
4
4
|
"description": "CoWork OS - The operating system for personal AI assistants",
|
|
5
5
|
"overrides": {
|
|
6
6
|
"undici": "^7.0.0"
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"setup": "npm install --no-audit --no-fund && { sleep 2; i=1; max=${COWORK_SETUP_NATIVE_OUTER_ATTEMPTS:-6}; delay=2; while [ $i -le $max ]; do echo \"[cowork] setup:native (outer attempt $i/$max)\"; sh scripts/setup_native_retry.sh; s=$?; if [ $s -eq 0 ]; then exit 0; fi; if [ $s -ne 137 ] && [ $s -ne 9 ]; then exit $s; fi; echo \"[cowork] setup:native was killed; retrying in ${delay}s...\"; sleep $delay; delay=$((delay * 2)); if [ $delay -gt 20 ]; then delay=20; fi; i=$((i + 1)); done; exit $s; }",
|
|
44
44
|
"setup:native": "sleep 2; i=1; max=${COWORK_SETUP_NATIVE_OUTER_ATTEMPTS:-6}; delay=2; while [ $i -le $max ]; do echo \"[cowork] setup:native (outer attempt $i/$max)\"; sh scripts/setup_native_retry.sh; s=$?; if [ $s -eq 0 ]; then exit 0; fi; if [ $s -ne 137 ] && [ $s -ne 9 ]; then exit $s; fi; echo \"[cowork] setup:native was killed; retrying in ${delay}s...\"; sleep $delay; delay=$((delay * 2)); if [ $delay -gt 20 ]; then delay=20; fi; i=$((i + 1)); done; exit $s",
|
|
45
45
|
"setup:server": "npm install && npm rebuild --ignore-scripts=false better-sqlite3",
|
|
46
|
-
"postinstall": "
|
|
46
|
+
"postinstall": "node scripts/postinstall.mjs",
|
|
47
47
|
"dev": "concurrently \"npm run dev:react\" \"npm run dev:electron\"",
|
|
48
48
|
"dev:react": "vite",
|
|
49
49
|
"dev:electron": "tsc -p tsconfig.electron.json && cross-env NODE_ENV=development electron .",
|
|
@@ -70,8 +70,7 @@
|
|
|
70
70
|
"@pydantic/monty": "^0.0.4",
|
|
71
71
|
"@slack/bolt": "^4.6.0",
|
|
72
72
|
"@types/jszip": "^3.4.1",
|
|
73
|
-
"@whiskeysockets/baileys": "
|
|
74
|
-
"better-sqlite3": "^12.6.2",
|
|
73
|
+
"@whiskeysockets/baileys": "6.7.16",
|
|
75
74
|
"botbuilder": "^4.23.3",
|
|
76
75
|
"chokidar": "^5.0.0",
|
|
77
76
|
"discord.js": "^14.25.1",
|
|
@@ -99,6 +98,9 @@
|
|
|
99
98
|
"ws": "^8.18.0",
|
|
100
99
|
"zod": "^4.3.6"
|
|
101
100
|
},
|
|
101
|
+
"optionalDependencies": {
|
|
102
|
+
"better-sqlite3": "12.6.2"
|
|
103
|
+
},
|
|
102
104
|
"devDependencies": {
|
|
103
105
|
"@electron/rebuild": "^4.0.3",
|
|
104
106
|
"@types/better-sqlite3": "^7.6.8",
|
|
@@ -118,7 +120,6 @@
|
|
|
118
120
|
"cross-env": "^10.1.0",
|
|
119
121
|
"electron": "^40.1.0",
|
|
120
122
|
"electron-builder": "^26.7.0",
|
|
121
|
-
"electron-rebuild": "^3.2.9",
|
|
122
123
|
"eslint": "^9.39.2",
|
|
123
124
|
"globals": "^17.3.0",
|
|
124
125
|
"typescript": "^5.7.3",
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Best-effort postinstall hook.
|
|
4
|
+
*
|
|
5
|
+
* Why this exists:
|
|
6
|
+
* - npm installs of this package can run in environments where some build tools
|
|
7
|
+
* are unavailable.
|
|
8
|
+
* - Postinstall must never hard-fail the whole install for end users.
|
|
9
|
+
*
|
|
10
|
+
* Behavior:
|
|
11
|
+
* - If Electron + better-sqlite3 are present, try native setup.
|
|
12
|
+
* - If setup fails, log a warning and continue (exit 0).
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
import { spawnSync } from "node:child_process";
|
|
16
|
+
import fs from "node:fs";
|
|
17
|
+
import path from "node:path";
|
|
18
|
+
import process from "node:process";
|
|
19
|
+
|
|
20
|
+
function exists(relPath) {
|
|
21
|
+
return fs.existsSync(path.join(process.cwd(), relPath));
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
function log(msg) {
|
|
25
|
+
console.log(`[cowork] ${msg}`);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function warn(msg) {
|
|
29
|
+
console.warn(`[cowork] ${msg}`);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
function main() {
|
|
33
|
+
const hasElectron = exists("node_modules/electron/package.json");
|
|
34
|
+
const hasBetterSqlite3 = exists("node_modules/better-sqlite3/package.json");
|
|
35
|
+
|
|
36
|
+
if (!hasElectron || !hasBetterSqlite3) {
|
|
37
|
+
log(
|
|
38
|
+
"postinstall: skipping native setup (electron or better-sqlite3 not present in this install context)."
|
|
39
|
+
);
|
|
40
|
+
process.exit(0);
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const setupDriver = path.join(process.cwd(), "scripts", "setup_native_driver.mjs");
|
|
44
|
+
if (!fs.existsSync(setupDriver)) {
|
|
45
|
+
warn("postinstall: setup driver not found; skipping native setup.");
|
|
46
|
+
process.exit(0);
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
log("postinstall: running native setup (best effort)...");
|
|
50
|
+
const res = spawnSync(process.execPath, [setupDriver], {
|
|
51
|
+
stdio: "inherit",
|
|
52
|
+
env: process.env,
|
|
53
|
+
cwd: process.cwd(),
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
if (res.status === 0) {
|
|
57
|
+
log("postinstall: native setup complete.");
|
|
58
|
+
process.exit(0);
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const detail = res.signal ? `signal ${res.signal}` : `exit ${res.status ?? 1}`;
|
|
62
|
+
warn(
|
|
63
|
+
`postinstall: native setup failed (${detail}). Install continues. ` +
|
|
64
|
+
"If needed, run `npm run setup` in the CoWork OS project."
|
|
65
|
+
);
|
|
66
|
+
process.exit(0);
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
main();
|
package/scripts/setup_native.mjs
CHANGED
|
@@ -21,6 +21,8 @@ import os from "node:os";
|
|
|
21
21
|
import path from "node:path";
|
|
22
22
|
import process from "node:process";
|
|
23
23
|
|
|
24
|
+
const BETTER_SQLITE3_VERSION = "12.6.2";
|
|
25
|
+
|
|
24
26
|
function run(cmd, args, opts = {}) {
|
|
25
27
|
const pretty = [cmd, ...(args || [])].join(" ");
|
|
26
28
|
console.log(`\n[cowork] $ ${pretty}`);
|
|
@@ -94,6 +96,35 @@ function testBetterSqlite3InElectron(env) {
|
|
|
94
96
|
return res;
|
|
95
97
|
}
|
|
96
98
|
|
|
99
|
+
function ensureBetterSqlite3(env) {
|
|
100
|
+
const pkgPath = path.join(
|
|
101
|
+
process.cwd(),
|
|
102
|
+
"node_modules",
|
|
103
|
+
"better-sqlite3",
|
|
104
|
+
"package.json"
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
if (fs.existsSync(pkgPath)) {
|
|
108
|
+
return { status: 0, signal: null };
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
console.log(
|
|
112
|
+
`[cowork] better-sqlite3 is missing; installing ${BETTER_SQLITE3_VERSION}...`
|
|
113
|
+
);
|
|
114
|
+
return run(
|
|
115
|
+
"npm",
|
|
116
|
+
[
|
|
117
|
+
"install",
|
|
118
|
+
"--no-audit",
|
|
119
|
+
"--no-fund",
|
|
120
|
+
"--ignore-scripts=false",
|
|
121
|
+
"--no-save",
|
|
122
|
+
`better-sqlite3@${BETTER_SQLITE3_VERSION}`,
|
|
123
|
+
],
|
|
124
|
+
{ env }
|
|
125
|
+
);
|
|
126
|
+
}
|
|
127
|
+
|
|
97
128
|
function fail(res, context) {
|
|
98
129
|
const sig = res.signal ? ` (signal ${res.signal})` : "";
|
|
99
130
|
const code =
|
|
@@ -151,6 +182,10 @@ function main() {
|
|
|
151
182
|
});
|
|
152
183
|
if (installRes.status !== 0) return installRes;
|
|
153
184
|
|
|
185
|
+
// If optional dependency install was skipped/failed earlier, recover here.
|
|
186
|
+
const ensureBetterRes = ensureBetterSqlite3(env);
|
|
187
|
+
if (ensureBetterRes.status !== 0) return ensureBetterRes;
|
|
188
|
+
|
|
154
189
|
const electronVersion = getElectronVersion();
|
|
155
190
|
const electronAbi = getElectronModulesAbi(env);
|
|
156
191
|
|
|
@@ -193,15 +228,23 @@ function main() {
|
|
|
193
228
|
}
|
|
194
229
|
|
|
195
230
|
// 3) Fallback: electron-rebuild (most expensive). Keep it sequential and only rebuild the one module.
|
|
231
|
+
const electronRebuildCli = path.join(
|
|
232
|
+
"node_modules",
|
|
233
|
+
"@electron",
|
|
234
|
+
"rebuild",
|
|
235
|
+
"lib",
|
|
236
|
+
"cli.js"
|
|
237
|
+
);
|
|
238
|
+
if (!fs.existsSync(electronRebuildCli)) {
|
|
239
|
+
console.log(
|
|
240
|
+
"[cowork] @electron/rebuild is not installed; skipping fallback rebuild."
|
|
241
|
+
);
|
|
242
|
+
return testBetterSqlite3InElectron(env);
|
|
243
|
+
}
|
|
244
|
+
|
|
196
245
|
const rebuildRes = run(
|
|
197
246
|
process.execPath,
|
|
198
|
-
[
|
|
199
|
-
"node_modules/@electron/rebuild/lib/cli.js",
|
|
200
|
-
"-f",
|
|
201
|
-
"--only",
|
|
202
|
-
"better-sqlite3",
|
|
203
|
-
"--sequential",
|
|
204
|
-
],
|
|
247
|
+
[electronRebuildCli, "-f", "--only", "better-sqlite3", "--sequential"],
|
|
205
248
|
{ env }
|
|
206
249
|
);
|
|
207
250
|
if (rebuildRes.status !== 0) return rebuildRes;
|