From f37e4de0ff5f8c7886c2bee5bc6880d275001256 Mon Sep 17 00:00:00 2001 From: Ember Date: Sun, 17 May 2026 08:40:18 -0700 Subject: [PATCH 1/2] fix(cli-linux-x64): externalize sodium-native in compiled binary MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Root cause: Bun --compile embeds JS source but not .node native addons. sodium-native's binding.js uses require-addon to find the .node file relative to __filename, which is set to the build machine's path — non-existent on the target machine. Fix: - Make sodium-native + require-addon external in all --compile commands (44 fewer bundled modules, ~43MB smaller Linux binary) - Add sodium-native and require-addon as dependencies of all platform packages so npm installs them alongside the binary at install time - Remove the workaround from docs/branch-office.md Verified: all 4 platform binaries build successfully (darwin-arm64, darwin-x64, linux-arm64, linux-x64). Test suite unchanged (6 pre-existing failures, 0 new). --- docs/branch-office.md | 19 ------------------- packages/cli-darwin-arm64/package.json | 4 ++++ packages/cli-darwin-x64/package.json | 4 ++++ packages/cli-linux-arm64/package.json | 4 ++++ packages/cli-linux-x64/package.json | 4 ++++ packages/cli/package.json | 8 ++++---- 6 files changed, 20 insertions(+), 23 deletions(-) diff --git a/docs/branch-office.md b/docs/branch-office.md index 438c391..59d3478 100644 --- a/docs/branch-office.md +++ b/docs/branch-office.md @@ -52,19 +52,6 @@ curl -fsSL https://bun.sh/install | bash sudo npm install -g @tpsdev-ai/cli ``` -> **Known issue on Linux**: the `@tpsdev-ai/cli-linux-x64` standalone binary (bundled as an optional dep) currently ships without a working `sodium-native` prebuild and crashes any command that touches branch crypto. Until that's fixed upstream, run `tps` from source: -> ```sh -> mkdir -p ~/src && cd ~/src -> git clone --depth 1 https://github.com/tpsdev-ai/cli.git -> cd cli && bun install -> mkdir -p ~/bin && cat > ~/bin/tps <<'EOF' -> #!/bin/sh -> exec ~/.bun/bin/bun run ~/src/cli/packages/cli/bin/tps.ts "$@" -> EOF -> chmod +x ~/bin/tps -> # Add ~/bin to PATH ahead of /usr/bin -> ``` - ### 2. Initialize the branch Pick a free port (the example uses `33744`) and assign the agent identity: @@ -243,12 +230,6 @@ tps branch stop && tps branch start ``` Then `mv ~/.tps/mail//cur/* ~/.tps/mail//cur/` to consolidate any stranded messages. -### Linux `tps` errors with `Cannot find addon '.' imported from … sodium-native/binding.js` - -**Cause:** The `@tpsdev-ai/cli-linux-x64` standalone binary is missing its sodium-native prebuild ([tracked upstream](https://github.com/tpsdev-ai/cli/issues)). The Bun `--compile` step doesn't bundle the .node addon alongside. - -**Action:** Run `tps` from cloned source via a shim, per the prereqs in [Provisioning](#1-vm-side-prereqs). - ### `tps office join` says "Connecting to localhost:…" then times out **Cause:** The SSH tunnel isn't up, or the branch isn't listening yet. diff --git a/packages/cli-darwin-arm64/package.json b/packages/cli-darwin-arm64/package.json index 182d504..5ba0895 100644 --- a/packages/cli-darwin-arm64/package.json +++ b/packages/cli-darwin-arm64/package.json @@ -15,6 +15,10 @@ "tps", "README.md" ], + "dependencies": { + "sodium-native": "^5.0.10", + "require-addon": "^1.2.0" + }, "license": "Apache-2.0", "publishConfig": { "access": "public" diff --git a/packages/cli-darwin-x64/package.json b/packages/cli-darwin-x64/package.json index 17e8a72..3ff63c5 100644 --- a/packages/cli-darwin-x64/package.json +++ b/packages/cli-darwin-x64/package.json @@ -15,6 +15,10 @@ "tps", "README.md" ], + "dependencies": { + "sodium-native": "^5.0.10", + "require-addon": "^1.2.0" + }, "license": "Apache-2.0", "publishConfig": { "access": "public" diff --git a/packages/cli-linux-arm64/package.json b/packages/cli-linux-arm64/package.json index fffa16a..bfb238b 100644 --- a/packages/cli-linux-arm64/package.json +++ b/packages/cli-linux-arm64/package.json @@ -15,6 +15,10 @@ "tps", "README.md" ], + "dependencies": { + "sodium-native": "^5.0.10", + "require-addon": "^1.2.0" + }, "license": "Apache-2.0", "publishConfig": { "access": "public" diff --git a/packages/cli-linux-x64/package.json b/packages/cli-linux-x64/package.json index 5898863..2f1db8f 100644 --- a/packages/cli-linux-x64/package.json +++ b/packages/cli-linux-x64/package.json @@ -15,6 +15,10 @@ "tps", "README.md" ], + "dependencies": { + "sodium-native": "^5.0.10", + "require-addon": "^1.2.0" + }, "license": "Apache-2.0", "publishConfig": { "access": "public" diff --git a/packages/cli/package.json b/packages/cli/package.json index 6dc1bec..7253a76 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -15,10 +15,10 @@ "scripts": { "build": "tsc", "build:binary": "bun run build:binary:darwin-arm64 && bun run build:binary:darwin-x64 && bun run build:binary:linux-arm64 && bun run build:binary:linux-x64", - "build:binary:darwin-arm64": "bun build --compile bin/tps.ts --target=bun-darwin-arm64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" --outfile=dist/tps-darwin-arm64", - "build:binary:darwin-x64": "bun build --compile bin/tps.ts --target=bun-darwin-x64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" --outfile=dist/tps-darwin-x64", - "build:binary:linux-arm64": "bun build --compile bin/tps.ts --target=bun-linux-arm64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" --outfile=dist/tps-linux-arm64", - "build:binary:linux-x64": "bun build --compile bin/tps.ts --target=bun-linux-x64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" --outfile=dist/tps-linux-x64", + "build:binary:darwin-arm64": "bun build --compile bin/tps.ts --target=bun-darwin-arm64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" -e sodium-native -e require-addon --outfile=dist/tps-darwin-arm64", + "build:binary:darwin-x64": "bun build --compile bin/tps.ts --target=bun-darwin-x64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" -e sodium-native -e require-addon --outfile=dist/tps-darwin-x64", + "build:binary:linux-arm64": "bun build --compile bin/tps.ts --target=bun-linux-arm64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" -e sodium-native -e require-addon --outfile=dist/tps-linux-arm64", + "build:binary:linux-x64": "bun build --compile bin/tps.ts --target=bun-linux-x64 --define \"INJECTED_VERSION=\\\"$npm_package_version\\\"\" -e sodium-native -e require-addon --outfile=dist/tps-linux-x64", "dev": "tsc --watch", "start": "node dist/bin/tps.js", "tps": "node dist/bin/tps.js", From 5047611d3c33dbed11e0391212546936e3b1a6ac Mon Sep 17 00:00:00 2001 From: Flint <263629284+tps-flint@users.noreply.github.com> Date: Sun, 17 May 2026 08:42:48 -0700 Subject: [PATCH 2/2] fix: update bun.lock for sodium-native + require-addon deps Ember added sodium-native + require-addon as deps on all 4 platform packages but didn't update bun.lock. CI runs --frozen-lockfile and failed across 4 jobs (Build / Lint / Binary Smoke / Dependency Audit). Just `bun install` to sync. --- bun.lock | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bun.lock b/bun.lock index c109ea1..796759b 100644 --- a/bun.lock +++ b/bun.lock @@ -76,6 +76,10 @@ "bin": { "tps": "./tps", }, + "dependencies": { + "require-addon": "^1.2.0", + "sodium-native": "^5.0.10", + }, }, "packages/cli-darwin-x64": { "name": "@tpsdev-ai/cli-darwin-x64", @@ -83,6 +87,10 @@ "bin": { "tps": "./tps", }, + "dependencies": { + "require-addon": "^1.2.0", + "sodium-native": "^5.0.10", + }, }, "packages/cli-linux-arm64": { "name": "@tpsdev-ai/cli-linux-arm64", @@ -90,6 +98,10 @@ "bin": { "tps": "./tps", }, + "dependencies": { + "require-addon": "^1.2.0", + "sodium-native": "^5.0.10", + }, }, "packages/cli-linux-x64": { "name": "@tpsdev-ai/cli-linux-x64", @@ -97,6 +109,10 @@ "bin": { "tps": "./tps", }, + "dependencies": { + "require-addon": "^1.2.0", + "sodium-native": "^5.0.10", + }, }, "packages/pi-tps-mail": { "name": "@tpsdev-ai/pi-tps-mail",