codex-grok-bridge 1.8.4 → 1.8.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.
- package/CHANGELOG.md +16 -0
- package/README.md +66 -19
- package/package.json +2 -1
- package/scripts/codex-grok.mjs +7 -1
- package/scripts/codex-wrapper.mjs +9 -1
- package/scripts/install-codex-grok-app.ps1 +14 -6
- package/scripts/install-codex-grok-app.sh +47 -21
- package/scripts/launch-desktop.mjs +19 -22
- package/scripts/verify-app-server.mjs +133 -0
- package/src/bridge.mjs +59 -17
- package/src/diagnostics.mjs +1 -1
- package/src/errors.mjs +6 -0
- package/src/imagegen.mjs +11 -8
- package/src/provider-align.mjs +367 -0
- package/src/proxy.mjs +60 -9
- package/src/rollout.mjs +36 -5
- package/src/router.mjs +40 -22
- package/src/runtime.mjs +2 -0
- package/src/tools.mjs +11 -6
- package/src/transport.mjs +37 -5
- package/src/videogen.mjs +215 -2
- package/src/voice.mjs +16 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.6 — 2026-11-10
|
|
4
|
+
|
|
5
|
+
- Two app-server wrappers that share `CODEX_HOME` keep a live owner on the provider baseline. Startup recovery and exit restore no longer treat another running wrapper's marker as a crash, so the configured provider returns to its original value only after the last wrapper exits.
|
|
6
|
+
- A video response that also contains an ordinary Codex tool call is handed to Codex first. The video result is sent upstream only after that tool's output arrives, instead of being submitted beside an unanswered function call.
|
|
7
|
+
|
|
8
|
+
## 1.8.5 — 2026-11-10
|
|
9
|
+
|
|
10
|
+
- Codex CLI 0.166 and newer reject a turn when the thread's provider differs from the app-server's configured provider. The desktop wrapper sets `model_provider` for that process, updates the saved thread provider, and archives then unarchives the loaded thread so Codex reloads it, before `thread/resume`. A new Grok turn and an openai ↔ `grok_build_cli` switch both pass `verify-app-server`. The previous `model_provider` value is restored when the wrapper exits.
|
|
11
|
+
- Tracked Codex CLI is 0.167.0 (https://github.com/openai/codex/releases/tag/rust-v0.167.0). verify-app-server passed.
|
|
12
|
+
- Tracked Grok CLI is 1.0.77 (https://x.ai/build/changelog). No bridge change.
|
|
13
|
+
- A voice sideband frame of 64 KiB or more uses the WebSocket 64-bit length. The DNS cache key includes `options.all`. A stalled upstream socket is destroyed after 120s with `ETIMEDOUT`.
|
|
14
|
+
- One MCP tool with a cyclic or external `$ref` no longer fails the whole turn. `o3`, `o4-mini`, and `codex-*` switch back to OpenAI from a Grok thread. Video follow-ups keep sibling tool calls, hide `grok_bridge_generate_video` after the step limit, add usage across steps, and time out each videos HTTP call.
|
|
15
|
+
- HTTP 401/403, 400/422, and 429/5xx are `auth`, `payload`, and `upstream_status`. Proxy errors redact the login token. A rollout line with `model: gpt-*` and no provider leaves Grok. Migration does not follow a symlink and uses a per-call temp file.
|
|
16
|
+
- Resume strips stored Grok ciphertext. That rewrite shipped in 1.8.2 and was missing from the notes.
|
|
17
|
+
- The Windows installer writes UTF-8 paths. The macOS launcher keeps the user `PATH` and quotes the node path. `npm run verify:app-server` is included in the published package.
|
|
18
|
+
|
|
3
19
|
## 1.8.4 — 2026-10-25
|
|
4
20
|
|
|
5
21
|
- Tracked Codex CLI is 0.164.0 (https://github.com/openai/codex/releases/tag/rust-v0.164.0). No protocol change.
|
package/README.md
CHANGED
|
@@ -43,7 +43,7 @@ The bridge does **not** execute Grok-native tools. It translates Codex tools int
|
|
|
43
43
|
function calling, streams the upstream Responses events, and rewrites names back
|
|
44
44
|
so Codex still recognizes them.
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Twenty-two files under `src/`. Runtime dependencies are `opusscript` and `werift` for local voice. Node.js ≥ 22.
|
|
47
47
|
|
|
48
48
|
This is not a second-opinion review product and not a Grok-native search
|
|
49
49
|
product. The picker shows `grok-4.7` (Grok 4.7 / xAI) and keeps `grok-4.6`.
|
|
@@ -55,6 +55,22 @@ the bridge runs. See Release history.
|
|
|
55
55
|
|
|
56
56
|
What each recent version added. Older cuts are in `CHANGELOG.md`.
|
|
57
57
|
|
|
58
|
+
### 1.8.6 — 2026-11-10
|
|
59
|
+
|
|
60
|
+
- Two app-server wrappers that share `CODEX_HOME` keep a live owner on the provider baseline. Startup recovery and exit restore no longer treat another running wrapper's marker as a crash, so the configured provider returns to its original value only after the last wrapper exits.
|
|
61
|
+
- A video response that also contains an ordinary Codex tool call is handed to Codex first. The video result is sent upstream only after that tool's output arrives, instead of being submitted beside an unanswered function call.
|
|
62
|
+
|
|
63
|
+
### 1.8.5 — 2026-11-10
|
|
64
|
+
|
|
65
|
+
- Codex CLI 0.166 and newer reject a turn when the thread's provider differs from the app-server's configured provider. The desktop wrapper sets `model_provider` for that process, updates the saved thread provider, and archives then unarchives the loaded thread so Codex reloads it, before `thread/resume`. A new Grok turn and an openai ↔ `grok_build_cli` switch both pass `verify-app-server`. The previous `model_provider` value is restored when the wrapper exits.
|
|
66
|
+
- Tracked Codex CLI is 0.167.0 (https://github.com/openai/codex/releases/tag/rust-v0.167.0). verify-app-server passed.
|
|
67
|
+
- Tracked Grok CLI is 1.0.77 (https://x.ai/build/changelog). No bridge change.
|
|
68
|
+
- A voice sideband frame of 64 KiB or more uses the WebSocket 64-bit length. The DNS cache key includes `options.all`. A stalled upstream socket is destroyed after 120s with `ETIMEDOUT`.
|
|
69
|
+
- One MCP tool with a cyclic or external `$ref` no longer fails the whole turn. `o3`, `o4-mini`, and `codex-*` switch back to OpenAI from a Grok thread. Video follow-ups keep sibling tool calls, hide `grok_bridge_generate_video` after the step limit, add usage across steps, and time out each videos HTTP call.
|
|
70
|
+
- HTTP 401/403, 400/422, and 429/5xx are `auth`, `payload`, and `upstream_status`. Proxy errors redact the login token. A rollout line with `model: gpt-*` and no provider leaves Grok. Migration does not follow a symlink and uses a per-call temp file.
|
|
71
|
+
- Resume strips stored Grok ciphertext. That rewrite shipped in 1.8.2 and was missing from the notes.
|
|
72
|
+
- The Windows installer writes UTF-8 paths. The macOS launcher keeps the user `PATH` and quotes the node path. `npm run verify:app-server` is included in the published package.
|
|
73
|
+
|
|
58
74
|
### 1.8.4 — 2026-10-25
|
|
59
75
|
|
|
60
76
|
- Tracked Codex CLI is 0.164.0 (https://github.com/openai/codex/releases/tag/rust-v0.164.0). No protocol change.
|
|
@@ -125,7 +141,7 @@ The `.command` launcher resolves paths from its own location, so moving the
|
|
|
125
141
|
folder does not require edits. Set `NODE=/path/to/node` if `node` is not on
|
|
126
142
|
`PATH`.
|
|
127
143
|
|
|
128
|
-
Verified against: Codex 0.
|
|
144
|
+
Verified against: Codex CLI 0.167.0, Grok CLI 1.0.77, Node 22.
|
|
129
145
|
An app update that changes `CODEX_CLI_PATH` or the app-server protocol needs
|
|
130
146
|
re-verification.
|
|
131
147
|
|
|
@@ -147,7 +163,7 @@ starts, and tears the provider down with that process.
|
|
|
147
163
|
```sh
|
|
148
164
|
git clone https://github.com/deximple/codex-grok-bridge.git
|
|
149
165
|
cd codex-grok-bridge
|
|
150
|
-
npm test #
|
|
166
|
+
npm test # 317 tests, no network, no inference
|
|
151
167
|
node scripts/codex-grok.mjs
|
|
152
168
|
```
|
|
153
169
|
|
|
@@ -236,11 +252,11 @@ appended, not substituted for the history.
|
|
|
236
252
|
|
|
237
253
|
Measured, not guessed:
|
|
238
254
|
|
|
239
|
-
- Mixed catalog of the
|
|
240
|
-
routing, on a real app-server.
|
|
255
|
+
- Mixed catalog of the GPT models plus `grok-4.7` and `grok-4.6`, with Grok
|
|
256
|
+
provider routing, on a real app-server.
|
|
241
257
|
- Live Grok CLI → Codex `exec_command` → result → Grok final reply
|
|
242
258
|
(`BRIDGE_TOOL_OK`).
|
|
243
|
-
- A separate Codex window showing `Grok 4.
|
|
259
|
+
- A separate Codex window showing `Grok 4.7 / xAI`. `grok-4.6` stays on the list.
|
|
244
260
|
- cli-chat-proxy accepted a 339-function-tool request. The public API’s 200-tool
|
|
245
261
|
cap does not apply on this login path.
|
|
246
262
|
|
|
@@ -255,6 +271,9 @@ When image generation is on, an `Images:` line is appended as well: pictures on
|
|
|
255
271
|
this transport use Grok’s `image_generation` tool already on the request; do
|
|
256
272
|
not read Codex’s `imagegen` skill and do not send the picture to OpenAI.
|
|
257
273
|
`GROK_BRIDGE_IMAGE_GEN=off` drops both the tool and that line.
|
|
274
|
+
`POST /v1/images/generations` and `POST /v1/images/edits` are proxied to
|
|
275
|
+
Imagine with the same grok login. When video generation is on, a `Videos:`
|
|
276
|
+
line is appended too. `GROK_BRIDGE_VIDEO_GEN=off` drops that tool and that line.
|
|
258
277
|
|
|
259
278
|
### Reasoning
|
|
260
279
|
|
|
@@ -266,7 +285,7 @@ multi-call turn can continue its own reasoning. The upstream has been observed
|
|
|
266
285
|
to accept this shape. The same pass keeps only the fields Grok’s Responses
|
|
267
286
|
input accepts on each item and content part — `status`, unknown Codex keys,
|
|
268
287
|
and every `internal_*` field are dropped so a new client field cannot 422 the
|
|
269
|
-
upstream. The same ciphertext is removed from the stream back to Codex, so a later switch to an OpenAI model does not try to decrypt a Grok reasoning blob.
|
|
288
|
+
upstream. The same ciphertext is removed from the stream back to Codex, so a later switch to an OpenAI model does not try to decrypt a Grok reasoning blob. Resume and fork also strip that ciphertext from a stored Grok rollout. An OpenAI-only rollout stays byte-identical.
|
|
270
289
|
|
|
271
290
|
### Concurrency
|
|
272
291
|
|
|
@@ -385,8 +404,8 @@ Completed turns are logged too: an empty log on failure means the bridge was
|
|
|
385
404
|
never called.
|
|
386
405
|
|
|
387
406
|
`turn_failed.kind` is one of: `aborted`, `auth`, `dns`, `connect`,
|
|
388
|
-
`upstream_timeout`, `upstream_closed`, `
|
|
389
|
-
`internal`. Codex UI shows the same class as `bridge_<kind>`.
|
|
407
|
+
`upstream_timeout`, `upstream_closed`, `upstream_status`, `upstream_protocol`,
|
|
408
|
+
`payload`, `internal`. Codex UI shows the same class as `bridge_<kind>`.
|
|
390
409
|
|
|
391
410
|
Start here when something breaks. Do not open `~/.grok/auth.json` or
|
|
392
411
|
`~/.codex/auth.json` to “check” the bridge.
|
|
@@ -396,17 +415,22 @@ Start here when something breaks. Do not open `~/.grok/auth.json` or
|
|
|
396
415
|
| Variable | Effect |
|
|
397
416
|
|---|---|
|
|
398
417
|
| `GROK_BRIDGE_IMAGE_GEN=off` | Do not declare Grok `image_generation`; do not append the `Images:` line |
|
|
418
|
+
| `GROK_BRIDGE_VIDEO_GEN=off` | Do not declare `grok_bridge_generate_video`; do not append the `Videos:` line |
|
|
399
419
|
| `GROK_BRIDGE_TRANSPORT=fetch` | Use Node `fetch` instead of `node:http(s)` |
|
|
400
420
|
| `GROK_BRIDGE_INFERENCE=cli` | Fall back to the CLI envelope path |
|
|
401
421
|
| `GROK_BRIDGE_DIAGNOSTICS=off` | Do not write the JSONL log |
|
|
402
422
|
| `GROK_BRIDGE_MODELS` | Extra `grok-*` catalog ids (comma or space) beyond `grok-4.7` and `grok-4.6` |
|
|
403
423
|
| `NODE` | Absolute `node` binary for the `.command` launcher / desktop scripts |
|
|
424
|
+
| `CODEX_BINARY` | Codex CLI binary. Overrides the bundled path |
|
|
425
|
+
| `CODEX_DESKTOP_APP` | Desktop app to launch. Overrides Codex.app / ChatGPT |
|
|
426
|
+
| `GROK_BINARY` | `grok` binary. Overrides `~/.grok/bin/grok` |
|
|
427
|
+
| `CODEX_GROK_PLATFORM` | `darwin`, `linux`, or `win32` for install and launch scripts |
|
|
404
428
|
| `CODEX_GROK_APP` | Alternate app path for the desktop installer (macOS: `/Applications/Codex Grok.app`; Linux: `~/.local/share/codex-grok-bridge/app`; Windows: `%LOCALAPPDATA%\codex-grok-bridge\app`) |
|
|
405
429
|
|
|
406
430
|
## Verify
|
|
407
431
|
|
|
408
432
|
```sh
|
|
409
|
-
npm test #
|
|
433
|
+
npm test # 317 tests, no remote inference
|
|
410
434
|
npm run test:coverage # 80% line / branch / function gate
|
|
411
435
|
npm run verify:app-server # real app-server routing; also runs against an installed bundle
|
|
412
436
|
npm audit --omit=dev
|
|
@@ -488,7 +512,7 @@ Grok 4.7을 Codex 모델 목록에 넣고, Codex의 `/v1/responses`를
|
|
|
488
512
|
calling으로 옮기고, 상류 Responses 스트림을 전달한 뒤, Codex가 알아보는
|
|
489
513
|
이름으로 되돌립니다.
|
|
490
514
|
|
|
491
|
-
`src/` 아래 파일
|
|
515
|
+
`src/` 아래 파일 22개. 로컬 음성용 런타임 의존성은 `opusscript`와 `werift`입니다. Node.js 22 이상. 1.5.0부터 npm
|
|
492
516
|
`"os"`는 `darwin` / `linux` / `win32`입니다.
|
|
493
517
|
|
|
494
518
|
코드 리뷰 전용 제품이 아니고 Grok 네이티브 검색 제품도 아닙니다. 피커에는
|
|
@@ -501,6 +525,22 @@ Codex `web_search`는 브리지가 실행하는 함수가 아니라 xAI 서버
|
|
|
501
525
|
|
|
502
526
|
최근 버전이 더한 것입니다. 그 이전은 `CHANGELOG.md`에 있습니다.
|
|
503
527
|
|
|
528
|
+
### 1.8.6 — 2026-11-10
|
|
529
|
+
|
|
530
|
+
- `CODEX_HOME`을 같이 쓰는 앱 서버 래퍼 둘은 제공자 기준값에 살아있는 소유자를 남깁니다. 시작 복구와 종료 복원은 다른 래퍼가 쓰는 마커를 비정상 종료로 보지 않으므로, 설정된 제공자는 마지막 래퍼가 끝난 뒤에만 원래 값으로 돌아갑니다.
|
|
531
|
+
- 영상 응답에 Codex 도구 호출이 같이 있으면 그 호출을 먼저 Codex에 넘깁니다. 영상 결과는 그 도구 출력이 도착한 뒤에만 상류로 보내고, 답이 없는 함수 호출 옆에 붙이지 않습니다.
|
|
532
|
+
|
|
533
|
+
### 1.8.5 — 2026-11-10
|
|
534
|
+
|
|
535
|
+
- Codex CLI 0.166부터는 스레드 제공자와 앱 서버에 설정된 제공자가 다르면 턴을 거절합니다. 데스크톱 래퍼가 그 프로세스의 `model_provider`를 맞추고, 저장된 스레드 제공자를 갱신한 뒤, 메모리에 있는 스레드를 archive/unarchive해서 Codex가 다시 읽게 합니다. `thread/resume` 전에 합니다. 새 Grok 턴과 openai ↔ `grok_build_cli` 전환이 `verify-app-server`를 통과합니다. 래퍼가 끝나면 이전 `model_provider` 값으로 되돌립니다.
|
|
536
|
+
- 추적하는 Codex CLI는 0.167.0입니다 (https://github.com/openai/codex/releases/tag/rust-v0.167.0). verify-app-server를 통과했습니다.
|
|
537
|
+
- 추적하는 Grok CLI는 1.0.77입니다 (https://x.ai/build/changelog). 브리지 변경은 없습니다.
|
|
538
|
+
- 64 KiB 이상 음성 사이드밴드 프레임은 WebSocket 64비트 길이를 씁니다. DNS 캐시 키에 `options.all`이 들어갑니다. 멈춘 상류 소켓은 120초 뒤 `ETIMEDOUT`으로 끊습니다.
|
|
539
|
+
- 순환 참조나 외부 `$ref`가 있는 MCP 도구 하나가 턴 전체를 막지 않습니다. `o3`, `o4-mini`, `codex-*`는 Grok 스레드에서 OpenAI로 돌아갑니다. 영상 후속 단계는 같이 나온 도구 호출을 유지하고, 단계 한도에 도달하면 `grok_bridge_generate_video`를 숨기며, 사용량을 합치고, 영상 HTTP 호출에 시간 제한을 둡니다.
|
|
540
|
+
- HTTP 401/403, 400/422, 429/5xx는 `auth`, `payload`, `upstream_status`입니다. 프록시 오류는 로그인 토큰을 지웁니다. `model: gpt-*`만 있는 롤아웃 줄은 Grok을 벗어납니다. 마이그레이션은 심볼릭 링크를 따라가지 않고 호출마다 다른 임시 파일을 씁니다.
|
|
541
|
+
- 재개할 때 저장된 Grok 암호문을 지웁니다. 이 동작은 1.8.2에 들어갔고 기록에 없었습니다.
|
|
542
|
+
- Windows 설치기는 경로를 UTF-8로 씁니다. macOS 런처는 사용자 `PATH`를 유지하고 node 경로를 따옴표로 감쌉니다. 배포 패키지에 `npm run verify:app-server`가 들어 있습니다.
|
|
543
|
+
|
|
504
544
|
### 1.8.4 — 2026-10-25
|
|
505
545
|
|
|
506
546
|
- 추적하는 Codex CLI는 0.164.0입니다 (https://github.com/openai/codex/releases/tag/rust-v0.164.0). 프로토콜 변경은 없습니다.
|
|
@@ -570,7 +610,7 @@ Codex `web_search`는 브리지가 실행하는 함수가 아니라 xAI 서버
|
|
|
570
610
|
`.command` 런처는 자기 위치를 기준으로 경로를 잡으므로 폴더를 옮겨도 수정할
|
|
571
611
|
필요가 없습니다. `PATH`에 `node`가 없으면 `NODE=/path/to/node`로 지정합니다.
|
|
572
612
|
|
|
573
|
-
검증 버전: Codex 0.
|
|
613
|
+
검증 버전: Codex CLI 0.167.0, Grok CLI 1.0.77, Node 22.
|
|
574
614
|
앱 업데이트가 `CODEX_CLI_PATH`나 app-server 프로토콜을 바꾸면 재검증이
|
|
575
615
|
필요합니다.
|
|
576
616
|
|
|
@@ -592,7 +632,7 @@ codex-grok exec --skip-git-repo-check --sandbox workspace-write '작업 내용'
|
|
|
592
632
|
```sh
|
|
593
633
|
git clone https://github.com/deximple/codex-grok-bridge.git
|
|
594
634
|
cd codex-grok-bridge
|
|
595
|
-
npm test #
|
|
635
|
+
npm test # 317건, 네트워크·추론 없음
|
|
596
636
|
node scripts/codex-grok.mjs
|
|
597
637
|
```
|
|
598
638
|
|
|
@@ -675,7 +715,7 @@ Responses 경로가 이상하면 `GROK_BRIDGE_INFERENCE=cli`로 이전 CLI 봉
|
|
|
675
715
|
|
|
676
716
|
추측이 아니라 실측입니다.
|
|
677
717
|
|
|
678
|
-
- 실제 app-server에서 GPT
|
|
718
|
+
- 실제 app-server에서 GPT 모델과 `grok-4.7`, `grok-4.6`의 혼합 목록, Grok 제공자 라우팅.
|
|
679
719
|
- 실제 Grok CLI → Codex `exec_command` → 결과 → Grok 최종 응답
|
|
680
720
|
(`BRIDGE_TOOL_OK`).
|
|
681
721
|
- 별도 Codex 창에 `Grok 4.6 / xAI Extra High` 표시.
|
|
@@ -692,7 +732,9 @@ Codex는 provider·model을 프롬프트에 넣지 않습니다. 브리지는 `i
|
|
|
692
732
|
이미지 생성이 켜져 있으면 `Images:` 줄도 붙습니다. 이 전송의 그림은 요청에 이미
|
|
693
733
|
있는 Grok `image_generation` 도구로 만들고, Codex `imagegen` 스킬을 읽거나
|
|
694
734
|
OpenAI로 보내지 말라는 뜻입니다. `GROK_BRIDGE_IMAGE_GEN=off`면 도구와 그 줄이
|
|
695
|
-
같이 빠집니다.
|
|
735
|
+
같이 빠집니다. `POST /v1/images/generations`와 `POST /v1/images/edits`는 같은
|
|
736
|
+
grok 로그인으로 Imagine에 넘깁니다. 영상 생성이 켜져 있으면 `Videos:` 줄도
|
|
737
|
+
붙습니다. `GROK_BRIDGE_VIDEO_GEN=off`면 그 도구와 그 줄이 빠집니다.
|
|
696
738
|
|
|
697
739
|
### reasoning
|
|
698
740
|
|
|
@@ -702,7 +744,7 @@ Codex `reasoning` 항목의 평문 요약은 상류로 전달합니다. 요약
|
|
|
702
744
|
턴에서 모델이 자기 추론을 이어받게 하기 위한 것이며, 상류가 이 형태를 수락하는
|
|
703
745
|
것을 확인했습니다. 같은 과정에서 아이템과 content part는 Grok Responses가
|
|
704
746
|
받는 필드만 남깁니다. `status`, 알 수 없는 Codex 키, `internal_*` 필드는
|
|
705
|
-
버려서 새 클라이언트 필드가 상류 422를 내지 않게 합니다. 응답으로 돌아가는 암호문도 빼서, 나중에 OpenAI 모델로 바꿔도 Grok 추론 blob을 복호화하려 하지 않습니다.
|
|
747
|
+
버려서 새 클라이언트 필드가 상류 422를 내지 않게 합니다. 응답으로 돌아가는 암호문도 빼서, 나중에 OpenAI 모델로 바꿔도 Grok 추론 blob을 복호화하려 하지 않습니다. 재개와 fork도 저장된 Grok 롤아웃의 암호문을 지웁니다. OpenAI만 있는 롤아웃은 바이트 그대로입니다.
|
|
706
748
|
|
|
707
749
|
### 동시성
|
|
708
750
|
|
|
@@ -815,8 +857,8 @@ URL과 저장한 파일 경로를 함께 넣습니다. 다운로드가 실패하
|
|
|
815
857
|
것입니다.
|
|
816
858
|
|
|
817
859
|
`turn_failed.kind`는 다음 중 하나입니다 — `aborted`, `auth`, `dns`, `connect`,
|
|
818
|
-
`upstream_timeout`, `upstream_closed`, `
|
|
819
|
-
`internal`. Codex UI에는 같은 분류가 `bridge_<kind>`로 보입니다.
|
|
860
|
+
`upstream_timeout`, `upstream_closed`, `upstream_status`, `upstream_protocol`,
|
|
861
|
+
`payload`, `internal`. Codex UI에는 같은 분류가 `bridge_<kind>`로 보입니다.
|
|
820
862
|
|
|
821
863
|
문제가 있으면 여기부터 봅니다. 브리지를 “확인”하려고 `~/.grok/auth.json`이나
|
|
822
864
|
`~/.codex/auth.json`을 열지 마세요.
|
|
@@ -826,17 +868,22 @@ URL과 저장한 파일 경로를 함께 넣습니다. 다운로드가 실패하
|
|
|
826
868
|
| 변수 | 효과 |
|
|
827
869
|
|---|---|
|
|
828
870
|
| `GROK_BRIDGE_IMAGE_GEN=off` | Grok `image_generation`을 선언하지 않고 `Images:` 줄도 붙이지 않음 |
|
|
871
|
+
| `GROK_BRIDGE_VIDEO_GEN=off` | `grok_bridge_generate_video`를 선언하지 않고 `Videos:` 줄도 붙이지 않음 |
|
|
829
872
|
| `GROK_BRIDGE_TRANSPORT=fetch` | `node:http(s)` 대신 Node `fetch` |
|
|
830
873
|
| `GROK_BRIDGE_INFERENCE=cli` | CLI 봉투 경로로 폴백 |
|
|
831
874
|
| `GROK_BRIDGE_DIAGNOSTICS=off` | JSONL 로그를 쓰지 않음 |
|
|
832
875
|
| `GROK_BRIDGE_MODELS` | `grok-4.7`과 `grok-4.6` 외에 카탈로그에 더할 `grok-*` id (쉼표/공백) |
|
|
833
876
|
| `NODE` | `.command` / 데스크톱 스크립트가 쓸 `node` 절대 경로 |
|
|
877
|
+
| `CODEX_BINARY` | Codex CLI 바이너리. 번들 경로보다 우선 |
|
|
878
|
+
| `CODEX_DESKTOP_APP` | 실행할 데스크톱 앱. Codex.app / ChatGPT보다 우선 |
|
|
879
|
+
| `GROK_BINARY` | `grok` 바이너리. `~/.grok/bin/grok`보다 우선 |
|
|
880
|
+
| `CODEX_GROK_PLATFORM` | 설치·실행 스크립트용 `darwin`, `linux`, `win32` |
|
|
834
881
|
| `CODEX_GROK_APP` | 데스크톱 설치기가 쓸 앱 경로 (macOS: `/Applications/Codex Grok.app`; Linux: `~/.local/share/codex-grok-bridge/app`; Windows: `%LOCALAPPDATA%\codex-grok-bridge\app`) |
|
|
835
882
|
|
|
836
883
|
## 검증
|
|
837
884
|
|
|
838
885
|
```sh
|
|
839
|
-
npm test #
|
|
886
|
+
npm test # 317건, 외부 추론 없음
|
|
840
887
|
npm run test:coverage # line/branch/function 80% 게이트
|
|
841
888
|
npm run verify:app-server # 실제 app-server 라우팅. 설치된 앱 번들에서도 실행
|
|
842
889
|
npm audit --omit=dev
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-grok-bridge",
|
|
3
|
-
"version": "1.8.
|
|
3
|
+
"version": "1.8.6",
|
|
4
4
|
"description": "Run Grok 4.7 as the model inside Codex, with Codex still owning tools, permissions, history and MCP. Uses the grok login session, not an API key.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -39,6 +39,7 @@
|
|
|
39
39
|
"scripts/install-codex-grok-app.sh",
|
|
40
40
|
"scripts/install-codex-grok-app.ps1",
|
|
41
41
|
"scripts/launch-desktop.mjs",
|
|
42
|
+
"scripts/verify-app-server.mjs",
|
|
42
43
|
"Open Codex with Grok.command",
|
|
43
44
|
"README.md",
|
|
44
45
|
"CHANGELOG.md",
|
package/scripts/codex-grok.mjs
CHANGED
|
@@ -3,6 +3,12 @@ import { spawn } from "node:child_process";
|
|
|
3
3
|
import { startRuntime } from "../src/runtime.mjs";
|
|
4
4
|
import { resolveCodexBinary } from "../src/paths.mjs";
|
|
5
5
|
import { DEFAULT_GROK_MODEL } from "../src/models.mjs";
|
|
6
|
+
|
|
7
|
+
function spawnResolved(file, fileArgs, options) {
|
|
8
|
+
if (file.endsWith(".mjs"))
|
|
9
|
+
return spawn(process.execPath, [file, ...fileArgs], options);
|
|
10
|
+
return spawn(file, fileArgs, options);
|
|
11
|
+
}
|
|
6
12
|
const runtime = await startRuntime();
|
|
7
13
|
const userArgs = process.argv.slice(2);
|
|
8
14
|
const overrides = [
|
|
@@ -18,7 +24,7 @@ const args =
|
|
|
18
24
|
userArgs[0] === "exec"
|
|
19
25
|
? [userArgs[0], ...overrides, ...userArgs.slice(1)]
|
|
20
26
|
: [...overrides, ...userArgs];
|
|
21
|
-
const child =
|
|
27
|
+
const child = spawnResolved(resolveCodexBinary(), args, {
|
|
22
28
|
stdio: "inherit",
|
|
23
29
|
env: { ...process.env, CODEX_GROK_BRIDGE_TOKEN: runtime.token },
|
|
24
30
|
});
|
|
@@ -6,6 +6,7 @@ import { startRuntime } from "../src/runtime.mjs";
|
|
|
6
6
|
import { Router } from "../src/router.mjs";
|
|
7
7
|
import { resolveCodexBinary } from "../src/paths.mjs";
|
|
8
8
|
import { codexHomeFromEnv, migrateResumePath, migrateSessionRollouts } from "../src/rollout.mjs";
|
|
9
|
+
import { captureProviderBaseline, restoreProviderBaseline } from "../src/provider-align.mjs";
|
|
9
10
|
|
|
10
11
|
const binary = resolveCodexBinary();
|
|
11
12
|
const args = process.argv.slice(2);
|
|
@@ -16,10 +17,16 @@ function spawnResolved(file, fileArgs, options) {
|
|
|
16
17
|
}
|
|
17
18
|
if (!args.includes("app-server")) {
|
|
18
19
|
const child = spawnResolved(binary, args, { stdio: "inherit" });
|
|
20
|
+
child.on("error", () => {
|
|
21
|
+
process.stderr.write("Could not start bundled Codex\n");
|
|
22
|
+
process.exit(1);
|
|
23
|
+
});
|
|
19
24
|
child.on("exit", (code) => process.exit(code ?? 1));
|
|
20
25
|
} else {
|
|
21
26
|
const runtime = await startRuntime();
|
|
22
|
-
const
|
|
27
|
+
const codexHome = codexHomeFromEnv();
|
|
28
|
+
captureProviderBaseline(codexHome);
|
|
29
|
+
const router = new Router(runtime.catalogPath, { codexHome });
|
|
23
30
|
await migrateSessionRollouts(codexHomeFromEnv());
|
|
24
31
|
const child = spawnResolved(binary, [...args, ...runtime.args], {
|
|
25
32
|
stdio: ["pipe", "pipe", "inherit"],
|
|
@@ -106,6 +113,7 @@ if (!args.includes("app-server")) {
|
|
|
106
113
|
);
|
|
107
114
|
child.on("close", async (code) => {
|
|
108
115
|
input.close();
|
|
116
|
+
restoreProviderBaseline(codexHome);
|
|
109
117
|
await runtime.close();
|
|
110
118
|
process.exit(code ?? 1);
|
|
111
119
|
});
|
|
@@ -15,15 +15,20 @@ if ($App -match "(?i)WindowsApps") {
|
|
|
15
15
|
|
|
16
16
|
if (-not $Force) {
|
|
17
17
|
$hit = Get-CimInstance Win32_Process -ErrorAction SilentlyContinue |
|
|
18
|
-
Where-Object { $_.CommandLine -and $_.CommandLine
|
|
18
|
+
Where-Object { $_.CommandLine -and $_.CommandLine.Contains("--user-data-dir=$UserData") }
|
|
19
19
|
if ($hit) {
|
|
20
20
|
Write-Error "Codex Grok is running. Close its window first, or pass -Force."
|
|
21
21
|
}
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
New-Item -ItemType Directory -Force -Path (Join-Path $App "scripts"), (Join-Path $App "src") | Out-Null
|
|
25
|
-
|
|
25
|
+
foreach ($name in @("codex-grok.mjs", "codex-wrapper.mjs", "launch-desktop.mjs")) {
|
|
26
|
+
Copy-Item (Join-Path $Root "scripts\$name") (Join-Path $App "scripts") -Force
|
|
27
|
+
}
|
|
26
28
|
Copy-Item (Join-Path $Root "src\*.mjs") (Join-Path $App "src") -Force
|
|
29
|
+
Get-ChildItem (Join-Path $App "scripts\*.mjs") -ErrorAction SilentlyContinue | Where-Object {
|
|
30
|
+
$_.Name -notin @("codex-grok.mjs", "codex-wrapper.mjs", "launch-desktop.mjs")
|
|
31
|
+
} | Remove-Item -Force
|
|
27
32
|
|
|
28
33
|
function Resolve-NodeExe {
|
|
29
34
|
$cmd = Get-Command node -ErrorAction SilentlyContinue
|
|
@@ -73,7 +78,7 @@ if (-not $npm -or -not (Test-Path -LiteralPath $npm)) {
|
|
|
73
78
|
"werift": "0.24.4"
|
|
74
79
|
}
|
|
75
80
|
}
|
|
76
|
-
"@ | Set-Content -Path (Join-Path $App "package.json") -Encoding
|
|
81
|
+
"@ | Set-Content -Path (Join-Path $App "package.json") -Encoding utf8
|
|
77
82
|
Push-Location $App
|
|
78
83
|
try {
|
|
79
84
|
& $npm install --omit=dev --no-fund --no-audit
|
|
@@ -83,11 +88,13 @@ try {
|
|
|
83
88
|
}
|
|
84
89
|
|
|
85
90
|
$Launcher = Join-Path $App "codex-grok-desktop.cmd"
|
|
86
|
-
|
|
91
|
+
$utf8 = New-Object System.Text.UTF8Encoding $false
|
|
92
|
+
[System.IO.File]::WriteAllText($Launcher, @"
|
|
87
93
|
@echo off
|
|
94
|
+
chcp 65001 >nul
|
|
88
95
|
set ROOT=%~dp0
|
|
89
96
|
"$Node" "%ROOT%scripts\launch-desktop.mjs" %*
|
|
90
|
-
"
|
|
97
|
+
"@, $utf8)
|
|
91
98
|
|
|
92
99
|
$StartDir = Join-Path $env:APPDATA "Microsoft\Windows\Start Menu\Programs"
|
|
93
100
|
New-Item -ItemType Directory -Force -Path $StartDir | Out-Null
|
|
@@ -108,7 +115,8 @@ function Write-StorePointer([string]$Name, [string[]]$Filters) {
|
|
|
108
115
|
if (-not $hit) { $hit = $hits | Select-Object -First 1 }
|
|
109
116
|
if (-not $hit) { continue }
|
|
110
117
|
New-Item -ItemType Directory -Force -Path $pointerDir | Out-Null
|
|
111
|
-
|
|
118
|
+
$utf8 = New-Object System.Text.UTF8Encoding $false
|
|
119
|
+
[System.IO.File]::WriteAllText((Join-Path $pointerDir $Name), $hit.FullName, $utf8)
|
|
112
120
|
Write-Output "store pointer $Name=$($hit.FullName)"
|
|
113
121
|
return
|
|
114
122
|
}
|
|
@@ -38,6 +38,10 @@ else
|
|
|
38
38
|
BRIDGE="$APP/Contents/Resources/bridge"
|
|
39
39
|
fi
|
|
40
40
|
|
|
41
|
+
if command -v python3 >/dev/null 2>&1; then
|
|
42
|
+
APP="$(python3 -c 'import os,sys; print(os.path.realpath(sys.argv[1]))' "$APP")"
|
|
43
|
+
fi
|
|
44
|
+
|
|
41
45
|
FULL=0
|
|
42
46
|
FORCE=0
|
|
43
47
|
for arg in "$@"; do
|
|
@@ -49,8 +53,9 @@ for arg in "$@"; do
|
|
|
49
53
|
esac
|
|
50
54
|
done
|
|
51
55
|
|
|
52
|
-
|
|
53
|
-
|
|
56
|
+
app_key="$(printf '%s' "$APP" | tr '[:upper:]' '[:lower:]')"
|
|
57
|
+
case "$app_key" in
|
|
58
|
+
/usr/lib/chatgpt|/usr/lib/chatgpt/*|/usr/bin/chatgpt|/usr/share/applications/chatgpt.desktop|/applications/codex.app|/applications/codex.app/*|*windowsapps*)
|
|
54
59
|
echo "refusing to install into the stock ChatGPT/Codex prefix: $APP" >&2
|
|
55
60
|
exit 1
|
|
56
61
|
;;
|
|
@@ -61,36 +66,56 @@ if [ "$PLATFORM" != linux ] && [ "$PLATFORM" != win32 ] && [ ! -d "$APP/Contents
|
|
|
61
66
|
exit 1
|
|
62
67
|
fi
|
|
63
68
|
|
|
64
|
-
if [ "$FORCE" -eq 0 ] && [ "$PLATFORM" != win32 ] &&
|
|
69
|
+
if [ "$FORCE" -eq 0 ] && [ "$PLATFORM" != win32 ] && USER_DATA="$USER_DATA" python3 -c 'import os,sys
|
|
70
|
+
needle = "--user-data-dir=" + os.environ["USER_DATA"]
|
|
71
|
+
lines = os.popen("ps -axo command=").read().splitlines()
|
|
72
|
+
sys.exit(0 if any(needle in line for line in lines) else 1)'; then
|
|
65
73
|
echo "Codex Grok is running. Close its window first, or pass --force to swap" >&2
|
|
66
74
|
echo "the files under it (the running window keeps its loaded code either way)." >&2
|
|
67
75
|
exit 1
|
|
68
76
|
fi
|
|
69
77
|
|
|
70
78
|
mkdir -p "$BRIDGE/scripts" "$BRIDGE/src"
|
|
71
|
-
|
|
79
|
+
if [ "$PLATFORM" = linux ] || [ "$PLATFORM" = win32 ]; then
|
|
80
|
+
chmod 700 "$(dirname "$APP")" 2>/dev/null || true
|
|
81
|
+
fi
|
|
82
|
+
for name in codex-grok.mjs codex-wrapper.mjs launch-desktop.mjs; do
|
|
83
|
+
cp "$ROOT/scripts/$name" "$BRIDGE/scripts/$name"
|
|
84
|
+
done
|
|
72
85
|
cp "$ROOT"/src/*.mjs "$BRIDGE/src/"
|
|
73
86
|
|
|
74
|
-
#
|
|
75
|
-
for
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
87
|
+
# Runtime scripts only. Maintainer scripts stay in the checkout.
|
|
88
|
+
for installed in "$BRIDGE/scripts"/*.mjs; do
|
|
89
|
+
[ -e "$installed" ] || continue
|
|
90
|
+
case "$(basename "$installed")" in
|
|
91
|
+
codex-grok.mjs|codex-wrapper.mjs|launch-desktop.mjs) ;;
|
|
92
|
+
*)
|
|
79
93
|
rm -f "$installed"
|
|
80
|
-
echo "pruned
|
|
81
|
-
|
|
82
|
-
|
|
94
|
+
echo "pruned scripts/$(basename "$installed")"
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
done
|
|
98
|
+
for installed in "$BRIDGE/src"/*.mjs; do
|
|
99
|
+
[ -e "$installed" ] || continue
|
|
100
|
+
if [ ! -e "$ROOT/src/$(basename "$installed")" ]; then
|
|
101
|
+
rm -f "$installed"
|
|
102
|
+
echo "pruned src/$(basename "$installed")"
|
|
103
|
+
fi
|
|
83
104
|
done
|
|
84
105
|
|
|
85
106
|
status=0
|
|
86
|
-
for
|
|
87
|
-
|
|
88
|
-
name
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
107
|
+
for name in codex-grok.mjs codex-wrapper.mjs launch-desktop.mjs; do
|
|
108
|
+
if ! cmp -s "$ROOT/scripts/$name" "$BRIDGE/scripts/$name"; then
|
|
109
|
+
echo "MISMATCH scripts/$name" >&2
|
|
110
|
+
status=1
|
|
111
|
+
fi
|
|
112
|
+
done
|
|
113
|
+
for source in "$ROOT"/src/*.mjs; do
|
|
114
|
+
name="$(basename "$source")"
|
|
115
|
+
if ! cmp -s "$source" "$BRIDGE/src/$name"; then
|
|
116
|
+
echo "MISMATCH src/$name" >&2
|
|
117
|
+
status=1
|
|
118
|
+
fi
|
|
94
119
|
done
|
|
95
120
|
[ "$status" -eq 0 ] || { echo "bundle did not match the checkout" >&2; exit 1; }
|
|
96
121
|
|
|
@@ -187,7 +212,8 @@ elif [ "$FULL" -eq 1 ]; then
|
|
|
187
212
|
LAUNCH="$BRIDGE/scripts/launch-desktop.mjs"
|
|
188
213
|
TMP="$(mktemp -d)"
|
|
189
214
|
trap 'rm -rf "$TMP"' EXIT
|
|
190
|
-
|
|
215
|
+
sq() { printf "'%s'" "$(printf '%s' "$1" | sed "s/'/'\\\\''/g")"; }
|
|
216
|
+
osacompile -o "$TMP/tmp.app" -e "do shell script \"$(sq "$NODE") $(sq "$LAUNCH")\""
|
|
191
217
|
cp "$TMP/tmp.app/Contents/MacOS/applet" "$APP/Contents/MacOS/applet"
|
|
192
218
|
cp "$TMP/tmp.app/Contents/Resources/Scripts/main.scpt" "$APP/Contents/Resources/Scripts/main.scpt"
|
|
193
219
|
chmod +x "$APP/Contents/MacOS/applet"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { execFileSync, spawn } from "node:child_process";
|
|
2
|
-
import { appendFileSync, mkdirSync } from "node:fs";
|
|
2
|
+
import { appendFileSync, mkdirSync, renameSync, statSync } from "node:fs";
|
|
3
3
|
import path from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import {
|
|
@@ -20,7 +20,12 @@ mkdirSync(userData, { recursive: true, mode: 0o700 });
|
|
|
20
20
|
mkdirSync(path.dirname(logFile), { recursive: true, mode: 0o700 });
|
|
21
21
|
|
|
22
22
|
function log(message) {
|
|
23
|
-
|
|
23
|
+
try {
|
|
24
|
+
if (statSync(logFile).size > 1024 * 1024) renameSync(logFile, `${logFile}.1`);
|
|
25
|
+
} catch {
|
|
26
|
+
// The first line creates the file.
|
|
27
|
+
}
|
|
28
|
+
appendFileSync(logFile, `${new Date().toISOString()} ${message}\n`, { mode: 0o600 });
|
|
24
29
|
}
|
|
25
30
|
|
|
26
31
|
function grokPidWin32() {
|
|
@@ -53,7 +58,7 @@ function queryWin32Processes() {
|
|
|
53
58
|
[
|
|
54
59
|
"-NoProfile",
|
|
55
60
|
"-Command",
|
|
56
|
-
`Get-CimInstance Win32_Process | Where-Object { $_.ProcessId -ne $PID -and $_.CommandLine -
|
|
61
|
+
`Get-CimInstance Win32_Process | Where-Object { $_.ProcessId -ne $PID -and $_.CommandLine -and $_.CommandLine.Contains(${JSON.stringify(`--user-data-dir=${userData}`)}) } | Select-Object ProcessId, CommandLine | ConvertTo-Json -Compress`,
|
|
57
62
|
],
|
|
58
63
|
{ encoding: "utf8", windowsHide: true, timeout: 15000 },
|
|
59
64
|
);
|
|
@@ -142,25 +147,17 @@ function startLinux(wrapper) {
|
|
|
142
147
|
}
|
|
143
148
|
|
|
144
149
|
function startDarwin(wrapper) {
|
|
145
|
-
|
|
146
|
-
const
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
"--env",
|
|
157
|
-
`CODEX_ELECTRON_USER_DATA_PATH=${userData}`,
|
|
158
|
-
"/Applications/Codex.app",
|
|
159
|
-
"--args",
|
|
160
|
-
`--user-data-dir=${userData}`,
|
|
161
|
-
],
|
|
162
|
-
{ stdio: "inherit" },
|
|
163
|
-
);
|
|
150
|
+
const app = resolveDesktopApp();
|
|
151
|
+
const env = desktopLaunchEnv({
|
|
152
|
+
wrapper,
|
|
153
|
+
userData,
|
|
154
|
+
pathPrefix: `${path.dirname(process.execPath)}:/usr/local/bin:/opt/homebrew/bin:/usr/bin:/bin:/usr/sbin:/sbin`,
|
|
155
|
+
});
|
|
156
|
+
const args = ["-n"];
|
|
157
|
+
for (const [key, value] of Object.entries(env)) args.push("--env", `${key}=${value}`);
|
|
158
|
+
args.push(app, "--args", ...desktopLaunchArgs(userData));
|
|
159
|
+
log(`start darwin app=${app} wrapper=${wrapper}`);
|
|
160
|
+
const child = spawn("/usr/bin/open", args, { stdio: "inherit" });
|
|
164
161
|
child.on("exit", (code) => {
|
|
165
162
|
log(`open exit=${code}`);
|
|
166
163
|
const pid = grokPid();
|