clawdex-mobile 5.0.2 → 5.0.4
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 +59 -193
- package/bin/clawdex.js +2 -1
- package/docs/setup-and-operations.md +39 -1
- package/package.json +11 -1
- package/scripts/bridge-binary.js +24 -3
- package/scripts/setup-secure-dev.sh +14 -0
- package/scripts/setup-wizard.sh +143 -5
- package/services/rust-bridge/Cargo.lock +1 -1
- package/services/rust-bridge/Cargo.toml +1 -1
- package/services/rust-bridge/src/main.rs +5893 -1907
- package/vendor/bridge-binaries/darwin-arm64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/darwin-x64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/linux-arm64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/linux-armv7l/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/linux-x64/codex-rust-bridge +0 -0
- package/vendor/bridge-binaries/win32-x64/codex-rust-bridge.exe +0 -0
package/README.md
CHANGED
|
@@ -1,245 +1,111 @@
|
|
|
1
1
|
# Clawdex Mobile
|
|
2
2
|
|
|
3
3
|
<p align="center">
|
|
4
|
-
<img src="https://raw.githubusercontent.com/Mohit-Patil/clawdex-mobile/main/
|
|
4
|
+
<img src="https://raw.githubusercontent.com/Mohit-Patil/clawdex-mobile/main/screenshots/social/clawdex-social-poster-1200x675.png" alt="Clawdex social banner" width="100%" />
|
|
5
5
|
</p>
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Run Codex or OpenCode from your phone. `clawdex-mobile` ships the bridge CLI plus bundled Rust bridge binaries for supported hosts, and the mobile app pairs to that bridge over Tailscale or local LAN.
|
|
8
8
|
|
|
9
|
-
This project is
|
|
9
|
+
This project is for trusted/private networking only. Do not expose the bridge publicly.
|
|
10
10
|
|
|
11
11
|
## What You Get
|
|
12
12
|
|
|
13
|
-
- Mobile chat
|
|
14
|
-
-
|
|
15
|
-
-
|
|
16
|
-
-
|
|
17
|
-
-
|
|
18
|
-
- File/image attachments from workspace and phone
|
|
19
|
-
- Chat-scoped Git actions (status/diff/commit/push)
|
|
20
|
-
- Bridge-backed terminal execution
|
|
13
|
+
- Mobile chat for Codex and OpenCode
|
|
14
|
+
- Live run updates over WebSocket
|
|
15
|
+
- Approval and clarification flows in-app
|
|
16
|
+
- Voice-to-text, attachments, terminal, and Git actions
|
|
17
|
+
- One mobile shell backed by a private host bridge
|
|
21
18
|
|
|
22
19
|
## Quick Start
|
|
23
20
|
|
|
24
|
-
|
|
21
|
+
Before you start:
|
|
25
22
|
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
-
|
|
23
|
+
- Node.js 20+
|
|
24
|
+
- npm 10+
|
|
25
|
+
- `git`
|
|
26
|
+
- `codex` in `PATH` for the default Codex flow
|
|
27
|
+
- `opencode` in `PATH` if you want the OpenCode flow
|
|
29
28
|
|
|
30
|
-
|
|
29
|
+
Install the mobile app:
|
|
31
30
|
|
|
32
|
-
-
|
|
33
|
-
-
|
|
31
|
+
- Android APK: <https://github.com/Mohit-Patil/clawdex-mobile/releases/latest>
|
|
32
|
+
- iOS: <https://apple.co/4rNAHRF>
|
|
34
33
|
|
|
35
|
-
|
|
34
|
+
Install the CLI and start the bridge:
|
|
36
35
|
|
|
37
36
|
```bash
|
|
38
37
|
npm install -g clawdex-mobile@latest
|
|
39
38
|
clawdex init
|
|
40
39
|
```
|
|
41
40
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
Published npm releases bundle prebuilt Rust bridge binaries for `darwin-arm64`, `darwin-x64`, `linux-x64`, and `win32-x64`, so supported hosts do not need to compile the bridge during normal startup. The interactive shell-based setup helpers are still macOS/Linux-oriented today.
|
|
45
|
-
|
|
46
|
-
`clawdex init` does not run a project-local `npm install`. The global package install is the only npm install needed for the published bridge flow.
|
|
47
|
-
|
|
48
|
-
The published CLI package is bridge-only. It does not install Expo, React Native, or the mobile app source tree.
|
|
41
|
+
Then open the mobile app and scan the pairing QR.
|
|
49
42
|
|
|
50
|
-
|
|
43
|
+
The npm package is bridge-only. It does not install Expo or the mobile source tree. On supported macOS, Linux, and Windows hosts it uses bundled bridge binaries, so normal startup does not compile Rust.
|
|
44
|
+
The current interactive setup helpers are still macOS/Linux-oriented.
|
|
51
45
|
|
|
52
|
-
|
|
53
|
-
2. secure bridge config generation (`.env.secure`)
|
|
54
|
-
3. phone readiness checks for selected mode
|
|
55
|
-
4. optional bridge launch in the foreground (release build)
|
|
56
|
-
|
|
57
|
-
This flow is bridge-only. The mobile app is already shipped, so no Expo dev server is required to pair your phone.
|
|
58
|
-
|
|
59
|
-
When the bridge starts, it prints a pairing QR:
|
|
60
|
-
|
|
61
|
-
- preferred: QR contains both `bridgeUrl + bridgeToken` (one-scan onboarding)
|
|
62
|
-
- fallback: token-only QR if host is not a phone-connectable address
|
|
63
|
-
|
|
64
|
-
Typical lifecycle:
|
|
46
|
+
Typical operator flow:
|
|
65
47
|
|
|
66
48
|
```bash
|
|
67
|
-
# install/update once
|
|
68
49
|
npm install -g clawdex-mobile@latest
|
|
69
|
-
|
|
70
|
-
# onboarding + start bridge
|
|
71
50
|
clawdex init
|
|
72
|
-
|
|
73
|
-
# stop services later
|
|
74
51
|
clawdex stop
|
|
75
52
|
```
|
|
76
53
|
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
```bash
|
|
80
|
-
npm install
|
|
81
|
-
npm run setup:wizard
|
|
82
|
-
```
|
|
83
|
-
|
|
84
|
-
Use `npm run setup:wizard -- --no-start` to configure only (no bridge start).
|
|
85
|
-
|
|
86
|
-
## Project Layout
|
|
87
|
-
|
|
88
|
-
- `apps/mobile`: Expo client (UI + API client)
|
|
89
|
-
- `services/rust-bridge`: primary bridge (WebSocket JSON-RPC + `codex app-server` adapter)
|
|
90
|
-
- `services/mac-bridge`: legacy TypeScript bridge (reference only)
|
|
91
|
-
- `scripts/`: onboarding/runtime helper scripts
|
|
92
|
-
- `docs/`: setup, troubleshooting, architecture notes
|
|
54
|
+
## OpenCode Setup
|
|
93
55
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
- macOS or Linux
|
|
97
|
-
- Node.js 20+
|
|
98
|
-
- npm 10+
|
|
99
|
-
- `codex` CLI in `PATH`
|
|
100
|
-
- `git` in `PATH`
|
|
101
|
-
- iOS app installed (TestFlight/App Store/dev build)
|
|
102
|
-
- Tailscale on host + phone (recommended for remote/private networking)
|
|
103
|
-
|
|
104
|
-
Optional for simulators/emulators:
|
|
105
|
-
|
|
106
|
-
- Xcode + iOS Simulator
|
|
107
|
-
- Android Studio + Android Emulator
|
|
108
|
-
|
|
109
|
-
## Day-to-Day Commands
|
|
110
|
-
|
|
111
|
-
From repo root:
|
|
112
|
-
|
|
113
|
-
- `npm run setup:wizard` — guided secure setup + optional bridge start
|
|
114
|
-
- `npm run stop:services` — stop running bridge (and local Expo if running)
|
|
115
|
-
- `npm run secure:setup` — generate/update secure env
|
|
116
|
-
- `npm run secure:bridge` — start rust bridge from `.env.secure` (release profile)
|
|
117
|
-
- `npm run secure:bridge:dev` — start rust bridge in dev profile
|
|
118
|
-
- `npm run mobile` — start Expo
|
|
119
|
-
- `npm run ios` — start Expo (iOS target)
|
|
120
|
-
- `npm run android` — start Expo (Android target)
|
|
121
|
-
- `npm run teardown` — interactive cleanup
|
|
122
|
-
- `npm run lint` / `npm run typecheck` / `npm run build`
|
|
123
|
-
|
|
124
|
-
Published CLI:
|
|
125
|
-
|
|
126
|
-
- `clawdex init`
|
|
127
|
-
- `clawdex stop`
|
|
128
|
-
- `clawdex upgrade` / `clawdex update`
|
|
129
|
-
- `clawdex version`
|
|
130
|
-
|
|
131
|
-
## Bridge Start Flow
|
|
132
|
-
|
|
133
|
-
Recommended:
|
|
56
|
+
OpenCode is supported directly from the CLI now.
|
|
134
57
|
|
|
135
58
|
```bash
|
|
59
|
+
npm install -g opencode-ai
|
|
136
60
|
npm install -g clawdex-mobile@latest
|
|
137
|
-
clawdex init
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
Monorepo/manual flow:
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
# from repo root
|
|
144
|
-
npm install
|
|
145
|
-
npm run secure:setup
|
|
146
|
-
npm run secure:bridge
|
|
61
|
+
clawdex init --engine opencode
|
|
147
62
|
```
|
|
148
63
|
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
On supported published installs, this uses the bundled bridge binary directly instead of compiling Rust on startup. Source checkouts still build from Cargo when a packaged binary is unavailable.
|
|
64
|
+
That writes `BRIDGE_ACTIVE_ENGINE=opencode` to `.env.secure` and uses OpenCode as the preferred runtime when the bridge starts.
|
|
152
65
|
|
|
153
|
-
|
|
66
|
+
Notes:
|
|
154
67
|
|
|
155
|
-
|
|
68
|
+
- `clawdex init` without `--engine` still defaults to Codex.
|
|
69
|
+
- If both CLIs are installed, the bridge can surface chats from both engines in the mobile app.
|
|
70
|
+
- To switch later, rerun `clawdex init --engine codex` or `clawdex init --engine opencode`.
|
|
156
71
|
|
|
157
|
-
|
|
158
|
-
- fallback: enter the bridge URL and token manually
|
|
72
|
+
## Monorepo Development
|
|
159
73
|
|
|
160
|
-
|
|
74
|
+
If you are working from source:
|
|
161
75
|
|
|
162
76
|
```bash
|
|
77
|
+
npm install
|
|
78
|
+
npm run setup:wizard
|
|
163
79
|
npm run mobile
|
|
164
80
|
```
|
|
165
81
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
On first launch (or after reset):
|
|
169
|
-
|
|
170
|
-
1. start the bridge on your server
|
|
171
|
-
2. scan bridge QR to autofill URL + token
|
|
172
|
-
3. use `Test Connection` (health + authenticated RPC check)
|
|
173
|
-
4. tap `Continue`
|
|
174
|
-
|
|
175
|
-
## EAS Builds (Short)
|
|
176
|
-
|
|
177
|
-
Run EAS commands from `apps/mobile` (that is where `app.json` and `eas.json` live):
|
|
178
|
-
|
|
179
|
-
```bash
|
|
180
|
-
cd apps/mobile
|
|
181
|
-
eas build --platform ios --profile preview
|
|
182
|
-
eas build --platform android --profile preview
|
|
183
|
-
```
|
|
184
|
-
|
|
185
|
-
For complete build/submit guidance, see [`docs/eas-builds.md`](docs/eas-builds.md).
|
|
186
|
-
|
|
187
|
-
## Local Builds (No EAS Cloud)
|
|
188
|
-
|
|
189
|
-
Run from `apps/mobile`:
|
|
190
|
-
|
|
191
|
-
```bash
|
|
192
|
-
cd apps/mobile
|
|
193
|
-
```
|
|
194
|
-
|
|
195
|
-
iOS:
|
|
82
|
+
For an OpenCode-first repo checkout:
|
|
196
83
|
|
|
197
84
|
```bash
|
|
198
|
-
|
|
199
|
-
npx expo run:ios
|
|
200
|
-
|
|
201
|
-
# Connected iPhone
|
|
202
|
-
npx expo run:ios --device
|
|
203
|
-
```
|
|
204
|
-
|
|
205
|
-
Android:
|
|
206
|
-
|
|
207
|
-
```bash
|
|
208
|
-
# Android emulator or connected Android device
|
|
209
|
-
npx expo run:android
|
|
85
|
+
npm run setup:wizard -- --engine opencode
|
|
210
86
|
```
|
|
211
87
|
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
```bash
|
|
215
|
-
# Requires local Android SDK / Xcode setup
|
|
216
|
-
eas build --platform android --profile preview --local
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
## Documentation Map
|
|
220
|
-
|
|
221
|
-
- Setup + operations: [`docs/setup-and-operations.md`](docs/setup-and-operations.md)
|
|
222
|
-
- Troubleshooting: [`docs/troubleshooting.md`](docs/troubleshooting.md)
|
|
223
|
-
- Realtime sync limits/mitigations: [`docs/realtime-streaming-limitations.md`](docs/realtime-streaming-limitations.md)
|
|
224
|
-
- Voice transcription internals: [`docs/voice-transcription.md`](docs/voice-transcription.md)
|
|
225
|
-
- Open-source license obligations: [`docs/open-source-license-requirements.md`](docs/open-source-license-requirements.md)
|
|
226
|
-
- App review template: [`docs/app-review-notes.md`](docs/app-review-notes.md)
|
|
227
|
-
- App-server/CLI gap tracking: [`docs/codex-app-server-cli-gap-tracker.md`](docs/codex-app-server-cli-gap-tracker.md)
|
|
88
|
+
Use `npm run setup:wizard -- --no-start` if you only want to write config.
|
|
228
89
|
|
|
229
|
-
##
|
|
90
|
+
## Main Commands
|
|
230
91
|
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
- `
|
|
234
|
-
- `
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
npm run
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
92
|
+
- `clawdex init [--engine codex|opencode] [--no-start]`
|
|
93
|
+
- `clawdex stop`
|
|
94
|
+
- `clawdex upgrade` / `clawdex update`
|
|
95
|
+
- `clawdex version`
|
|
96
|
+
- `npm run setup:wizard`
|
|
97
|
+
- `npm run secure:bridge`
|
|
98
|
+
- `npm run mobile`
|
|
99
|
+
- `npm run ios`
|
|
100
|
+
- `npm run android`
|
|
101
|
+
- `npm run stop:services`
|
|
102
|
+
- `npm run teardown`
|
|
103
|
+
|
|
104
|
+
## Docs
|
|
105
|
+
|
|
106
|
+
- Setup + operations: <https://github.com/Mohit-Patil/clawdex-mobile/blob/main/docs/setup-and-operations.md>
|
|
107
|
+
- Troubleshooting: <https://github.com/Mohit-Patil/clawdex-mobile/blob/main/docs/troubleshooting.md>
|
|
108
|
+
- Realtime sync limits/mitigations: <https://github.com/Mohit-Patil/clawdex-mobile/blob/main/docs/realtime-streaming-limitations.md>
|
|
109
|
+
- Voice transcription internals: <https://github.com/Mohit-Patil/clawdex-mobile/blob/main/docs/voice-transcription.md>
|
|
110
|
+
- EAS builds: <https://github.com/Mohit-Patil/clawdex-mobile/blob/main/docs/eas-builds.md>
|
|
111
|
+
- Open-source/license notes: <https://github.com/Mohit-Patil/clawdex-mobile/blob/main/docs/open-source-license-requirements.md>
|
package/bin/clawdex.js
CHANGED
|
@@ -10,10 +10,11 @@ function printUsage() {
|
|
|
10
10
|
console.log(`Usage: clawdex <command> [options]
|
|
11
11
|
|
|
12
12
|
Commands:
|
|
13
|
-
init [--no-start]
|
|
13
|
+
init [--no-start] [--engine codex|opencode]
|
|
14
14
|
Run interactive bridge onboarding and secure setup.
|
|
15
15
|
By default, this also starts the secure bridge in the foreground.
|
|
16
16
|
Use --no-start to configure only.
|
|
17
|
+
Use --engine to set the preferred backend written to .env.secure.
|
|
17
18
|
|
|
18
19
|
stop
|
|
19
20
|
Stop bridge services for this project.
|
|
@@ -2,6 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
This guide is the detailed companion to the top-level `README.md`.
|
|
4
4
|
|
|
5
|
+
## Choosing a Runtime
|
|
6
|
+
|
|
7
|
+
The bridge defaults to `codex`.
|
|
8
|
+
|
|
9
|
+
Use the setup wizard to make `opencode` the preferred engine:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
clawdex init --engine opencode
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
From a source checkout, the equivalent command is:
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm run setup:wizard -- --engine opencode
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
That writes `BRIDGE_ACTIVE_ENGINE=opencode` into `.env.secure`. To switch back, rerun setup with `--engine codex` or edit `.env.secure` directly.
|
|
22
|
+
|
|
5
23
|
## Onboarding Output Cues
|
|
6
24
|
|
|
7
25
|
After `clawdex init`, expected sequence:
|
|
@@ -11,7 +29,7 @@ After `clawdex init`, expected sequence:
|
|
|
11
29
|
3. A pairing QR is printed for the mobile app
|
|
12
30
|
4. Bridge logs stay attached until you stop the process
|
|
13
31
|
|
|
14
|
-
Published npm releases bundle prebuilt bridge binaries for `darwin-arm64`, `darwin-x64`, `linux-x64`, and `win32-x64`. On those hosts, normal bridge startup does not require a Rust compile.
|
|
32
|
+
Published npm releases bundle prebuilt bridge binaries for `darwin-arm64`, `darwin-x64`, `linux-x64`, `linux-arm64`, `linux-armv7l`, and `win32-x64`. On those hosts, normal bridge startup does not require a Rust compile.
|
|
15
33
|
|
|
16
34
|
`clawdex init` does not run a project-local `npm install` for the published CLI path. The only required npm install there is `npm install -g clawdex-mobile@latest`.
|
|
17
35
|
|
|
@@ -31,6 +49,12 @@ npm install
|
|
|
31
49
|
npm run secure:setup
|
|
32
50
|
```
|
|
33
51
|
|
|
52
|
+
To generate OpenCode-first config instead:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
BRIDGE_ACTIVE_ENGINE=opencode npm run secure:setup
|
|
56
|
+
```
|
|
57
|
+
|
|
34
58
|
Creates/updates:
|
|
35
59
|
|
|
36
60
|
- `.env.secure` (bridge runtime config + token)
|
|
@@ -42,6 +66,14 @@ Creates/updates:
|
|
|
42
66
|
npm run secure:bridge
|
|
43
67
|
```
|
|
44
68
|
|
|
69
|
+
If you want a one-off OpenCode launch without rewriting `.env.secure`:
|
|
70
|
+
|
|
71
|
+
```bash
|
|
72
|
+
BRIDGE_ACTIVE_ENGINE=opencode npm run secure:bridge
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
`codex` remains the default. When both CLIs are available, the bridge can start both backends and merge chat lists while still routing each thread by engine.
|
|
76
|
+
|
|
45
77
|
### 4) Pair from the mobile app
|
|
46
78
|
|
|
47
79
|
Open the installed mobile app on your phone, then scan the bridge QR. If needed, enter the bridge URL manually (for example `http://100.x.y.z:8787` or `http://192.168.x.y:8787`). The chosen bridge URL is stored on-device and can be changed later in Settings.
|
|
@@ -96,6 +128,12 @@ npm run teardown -- --yes
|
|
|
96
128
|
| `BRIDGE_AUTH_TOKEN` | required auth token |
|
|
97
129
|
| `BRIDGE_ALLOW_QUERY_TOKEN_AUTH` | query-token auth fallback |
|
|
98
130
|
| `CODEX_CLI_BIN` | codex executable |
|
|
131
|
+
| `BRIDGE_ACTIVE_ENGINE` | preferred backend (`codex` default, `opencode` optional) |
|
|
132
|
+
| `OPENCODE_CLI_BIN` | opencode executable for dual-engine startup |
|
|
133
|
+
| `BRIDGE_OPENCODE_HOST` | loopback host for spawned opencode server |
|
|
134
|
+
| `BRIDGE_OPENCODE_PORT` | loopback port for spawned opencode server |
|
|
135
|
+
| `BRIDGE_OPENCODE_SERVER_USERNAME` | basic-auth username passed to opencode server |
|
|
136
|
+
| `BRIDGE_OPENCODE_SERVER_PASSWORD` | basic-auth password passed to opencode server |
|
|
99
137
|
| `BRIDGE_WORKDIR` | absolute working directory for terminal/git |
|
|
100
138
|
| `BRIDGE_ALLOW_OUTSIDE_ROOT_CWD` | allow terminal/git `cwd` outside `BRIDGE_WORKDIR` |
|
|
101
139
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,16 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "clawdex-mobile",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.4",
|
|
4
|
+
"description": "Private-network mobile bridge and CLI for Codex and OpenCode",
|
|
5
|
+
"keywords": [
|
|
6
|
+
"codex",
|
|
7
|
+
"opencode",
|
|
8
|
+
"mobile",
|
|
9
|
+
"bridge",
|
|
10
|
+
"expo",
|
|
11
|
+
"react-native"
|
|
12
|
+
],
|
|
13
|
+
"license": "MIT",
|
|
4
14
|
"homepage": "https://github.com/Mohit-Patil/clawdex-mobile#readme",
|
|
5
15
|
"repository": {
|
|
6
16
|
"type": "git",
|
package/scripts/bridge-binary.js
CHANGED
|
@@ -24,6 +24,19 @@ const SUPPORTED_RUNTIME_TARGETS = {
|
|
|
24
24
|
rustTarget: "x86_64-unknown-linux-gnu",
|
|
25
25
|
binaryName: "codex-rust-bridge",
|
|
26
26
|
},
|
|
27
|
+
"linux-arm64": {
|
|
28
|
+
platform: "linux",
|
|
29
|
+
arch: "arm64",
|
|
30
|
+
rustTarget: "aarch64-unknown-linux-gnu",
|
|
31
|
+
binaryName: "codex-rust-bridge",
|
|
32
|
+
},
|
|
33
|
+
"linux-armv7l": {
|
|
34
|
+
platform: "linux",
|
|
35
|
+
arch: "arm",
|
|
36
|
+
machine: ["armv7l", "armv8l"],
|
|
37
|
+
rustTarget: "armv7-unknown-linux-gnueabihf",
|
|
38
|
+
binaryName: "codex-rust-bridge",
|
|
39
|
+
},
|
|
27
40
|
"win32-x64": {
|
|
28
41
|
platform: "win32",
|
|
29
42
|
arch: "x64",
|
|
@@ -36,11 +49,19 @@ function repoRoot() {
|
|
|
36
49
|
return path.resolve(__dirname, "..");
|
|
37
50
|
}
|
|
38
51
|
|
|
39
|
-
function
|
|
52
|
+
function currentMachine() {
|
|
53
|
+
return typeof os.machine === "function" ? os.machine() : "";
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
function resolveRuntimeTarget(platform = os.platform(), arch = os.arch(), machine = currentMachine()) {
|
|
40
57
|
for (const [target, metadata] of Object.entries(SUPPORTED_RUNTIME_TARGETS)) {
|
|
41
|
-
if (metadata.platform
|
|
42
|
-
|
|
58
|
+
if (metadata.platform !== platform || metadata.arch !== arch) {
|
|
59
|
+
continue;
|
|
60
|
+
}
|
|
61
|
+
if (metadata.machine && !metadata.machine.includes(machine)) {
|
|
62
|
+
continue;
|
|
43
63
|
}
|
|
64
|
+
return target;
|
|
44
65
|
}
|
|
45
66
|
return null;
|
|
46
67
|
}
|
|
@@ -9,6 +9,8 @@ fi
|
|
|
9
9
|
SECURE_ENV_FILE="$ROOT_DIR/.env.secure"
|
|
10
10
|
MOBILE_ENV_FILE="$ROOT_DIR/apps/mobile/.env"
|
|
11
11
|
MOBILE_ENV_EXAMPLE="$ROOT_DIR/apps/mobile/.env.example"
|
|
12
|
+
BRIDGE_ACTIVE_ENGINE="${BRIDGE_ACTIVE_ENGINE:-codex}"
|
|
13
|
+
OPENCODE_CLI_BIN="${OPENCODE_CLI_BIN:-opencode}"
|
|
12
14
|
|
|
13
15
|
upsert_env_key() {
|
|
14
16
|
local file="$1"
|
|
@@ -226,6 +228,15 @@ case "$BRIDGE_NETWORK_MODE" in
|
|
|
226
228
|
;;
|
|
227
229
|
esac
|
|
228
230
|
|
|
231
|
+
case "$BRIDGE_ACTIVE_ENGINE" in
|
|
232
|
+
codex|opencode)
|
|
233
|
+
;;
|
|
234
|
+
*)
|
|
235
|
+
echo "error: BRIDGE_ACTIVE_ENGINE must be 'codex' or 'opencode'." >&2
|
|
236
|
+
exit 1
|
|
237
|
+
;;
|
|
238
|
+
esac
|
|
239
|
+
|
|
229
240
|
if [[ -n "$BRIDGE_HOST" ]]; then
|
|
230
241
|
HOST_SOURCE="override"
|
|
231
242
|
else
|
|
@@ -257,7 +268,9 @@ BRIDGE_HOST=$BRIDGE_HOST
|
|
|
257
268
|
BRIDGE_PORT=$BRIDGE_PORT
|
|
258
269
|
BRIDGE_AUTH_TOKEN=$BRIDGE_TOKEN
|
|
259
270
|
BRIDGE_ALLOW_QUERY_TOKEN_AUTH=true
|
|
271
|
+
BRIDGE_ACTIVE_ENGINE=$BRIDGE_ACTIVE_ENGINE
|
|
260
272
|
CODEX_CLI_BIN=codex
|
|
273
|
+
OPENCODE_CLI_BIN=$OPENCODE_CLI_BIN
|
|
261
274
|
BRIDGE_WORKDIR=$ROOT_DIR
|
|
262
275
|
EOT
|
|
263
276
|
|
|
@@ -276,6 +289,7 @@ echo ""
|
|
|
276
289
|
echo "Bridge network mode: $BRIDGE_NETWORK_MODE"
|
|
277
290
|
echo "Bridge host: $BRIDGE_HOST ($HOST_SOURCE)"
|
|
278
291
|
echo "Bridge port: $BRIDGE_PORT"
|
|
292
|
+
echo "Preferred engine: $BRIDGE_ACTIVE_ENGINE"
|
|
279
293
|
echo "Token source: $SECURE_ENV_FILE"
|
|
280
294
|
if has_local_mobile_workspace; then
|
|
281
295
|
echo "Mobile env updated: $MOBILE_ENV_FILE"
|