codex-grok-bridge 1.8.3 → 1.8.5
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 +17 -5
- package/src/diagnostics.mjs +1 -1
- package/src/errors.mjs +6 -0
- package/src/imagegen.mjs +11 -8
- package/src/provider-align.mjs +231 -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 +177 -2
- package/src/voice.mjs +16 -2
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,21 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.8.5 — 2026-11-10
|
|
4
|
+
|
|
5
|
+
- 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.
|
|
6
|
+
- Tracked Codex CLI is 0.167.0 (https://github.com/openai/codex/releases/tag/rust-v0.167.0). verify-app-server passed.
|
|
7
|
+
- Tracked Grok CLI is 1.0.77 (https://x.ai/build/changelog). No bridge change.
|
|
8
|
+
- 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`.
|
|
9
|
+
- 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.
|
|
10
|
+
- 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.
|
|
11
|
+
- Resume strips stored Grok ciphertext. That rewrite shipped in 1.8.2 and was missing from the notes.
|
|
12
|
+
- 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.
|
|
13
|
+
|
|
14
|
+
## 1.8.4 — 2026-10-25
|
|
15
|
+
|
|
16
|
+
- Tracked Codex CLI is 0.164.0 (https://github.com/openai/codex/releases/tag/rust-v0.164.0). No protocol change.
|
|
17
|
+
- Tracked Grok CLI is 1.0.70 (https://x.ai/build/changelog). No bridge change.
|
|
18
|
+
|
|
3
19
|
## 1.8.3 — 2026-10-06
|
|
4
20
|
|
|
5
21
|
- Tracked Grok CLI is 1.0.46 (https://x.ai/build/changelog). No bridge 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.5 — 2026-11-10
|
|
59
|
+
|
|
60
|
+
- 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.
|
|
61
|
+
- Tracked Codex CLI is 0.167.0 (https://github.com/openai/codex/releases/tag/rust-v0.167.0). verify-app-server passed.
|
|
62
|
+
- Tracked Grok CLI is 1.0.77 (https://x.ai/build/changelog). No bridge change.
|
|
63
|
+
- 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`.
|
|
64
|
+
- 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.
|
|
65
|
+
- 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.
|
|
66
|
+
- Resume strips stored Grok ciphertext. That rewrite shipped in 1.8.2 and was missing from the notes.
|
|
67
|
+
- 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.
|
|
68
|
+
|
|
69
|
+
### 1.8.4 — 2026-10-25
|
|
70
|
+
|
|
71
|
+
- Tracked Codex CLI is 0.164.0 (https://github.com/openai/codex/releases/tag/rust-v0.164.0). No protocol change.
|
|
72
|
+
- Tracked Grok CLI is 1.0.70 (https://x.ai/build/changelog). No bridge change.
|
|
73
|
+
|
|
58
74
|
### 1.8.3 — 2026-10-06
|
|
59
75
|
|
|
60
76
|
- Tracked Grok CLI is 1.0.46 (https://x.ai/build/changelog). No bridge change.
|
|
@@ -120,7 +136,7 @@ The `.command` launcher resolves paths from its own location, so moving the
|
|
|
120
136
|
folder does not require edits. Set `NODE=/path/to/node` if `node` is not on
|
|
121
137
|
`PATH`.
|
|
122
138
|
|
|
123
|
-
Verified against: Codex 0.
|
|
139
|
+
Verified against: Codex CLI 0.167.0, Grok CLI 1.0.77, Node 22.
|
|
124
140
|
An app update that changes `CODEX_CLI_PATH` or the app-server protocol needs
|
|
125
141
|
re-verification.
|
|
126
142
|
|
|
@@ -142,7 +158,7 @@ starts, and tears the provider down with that process.
|
|
|
142
158
|
```sh
|
|
143
159
|
git clone https://github.com/deximple/codex-grok-bridge.git
|
|
144
160
|
cd codex-grok-bridge
|
|
145
|
-
npm test #
|
|
161
|
+
npm test # 315 tests, no network, no inference
|
|
146
162
|
node scripts/codex-grok.mjs
|
|
147
163
|
```
|
|
148
164
|
|
|
@@ -231,11 +247,11 @@ appended, not substituted for the history.
|
|
|
231
247
|
|
|
232
248
|
Measured, not guessed:
|
|
233
249
|
|
|
234
|
-
- Mixed catalog of the
|
|
235
|
-
routing, on a real app-server.
|
|
250
|
+
- Mixed catalog of the GPT models plus `grok-4.7` and `grok-4.6`, with Grok
|
|
251
|
+
provider routing, on a real app-server.
|
|
236
252
|
- Live Grok CLI → Codex `exec_command` → result → Grok final reply
|
|
237
253
|
(`BRIDGE_TOOL_OK`).
|
|
238
|
-
- A separate Codex window showing `Grok 4.
|
|
254
|
+
- A separate Codex window showing `Grok 4.7 / xAI`. `grok-4.6` stays on the list.
|
|
239
255
|
- cli-chat-proxy accepted a 339-function-tool request. The public API’s 200-tool
|
|
240
256
|
cap does not apply on this login path.
|
|
241
257
|
|
|
@@ -250,6 +266,9 @@ When image generation is on, an `Images:` line is appended as well: pictures on
|
|
|
250
266
|
this transport use Grok’s `image_generation` tool already on the request; do
|
|
251
267
|
not read Codex’s `imagegen` skill and do not send the picture to OpenAI.
|
|
252
268
|
`GROK_BRIDGE_IMAGE_GEN=off` drops both the tool and that line.
|
|
269
|
+
`POST /v1/images/generations` and `POST /v1/images/edits` are proxied to
|
|
270
|
+
Imagine with the same grok login. When video generation is on, a `Videos:`
|
|
271
|
+
line is appended too. `GROK_BRIDGE_VIDEO_GEN=off` drops that tool and that line.
|
|
253
272
|
|
|
254
273
|
### Reasoning
|
|
255
274
|
|
|
@@ -261,7 +280,7 @@ multi-call turn can continue its own reasoning. The upstream has been observed
|
|
|
261
280
|
to accept this shape. The same pass keeps only the fields Grok’s Responses
|
|
262
281
|
input accepts on each item and content part — `status`, unknown Codex keys,
|
|
263
282
|
and every `internal_*` field are dropped so a new client field cannot 422 the
|
|
264
|
-
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.
|
|
283
|
+
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.
|
|
265
284
|
|
|
266
285
|
### Concurrency
|
|
267
286
|
|
|
@@ -380,8 +399,8 @@ Completed turns are logged too: an empty log on failure means the bridge was
|
|
|
380
399
|
never called.
|
|
381
400
|
|
|
382
401
|
`turn_failed.kind` is one of: `aborted`, `auth`, `dns`, `connect`,
|
|
383
|
-
`upstream_timeout`, `upstream_closed`, `
|
|
384
|
-
`internal`. Codex UI shows the same class as `bridge_<kind>`.
|
|
402
|
+
`upstream_timeout`, `upstream_closed`, `upstream_status`, `upstream_protocol`,
|
|
403
|
+
`payload`, `internal`. Codex UI shows the same class as `bridge_<kind>`.
|
|
385
404
|
|
|
386
405
|
Start here when something breaks. Do not open `~/.grok/auth.json` or
|
|
387
406
|
`~/.codex/auth.json` to “check” the bridge.
|
|
@@ -391,17 +410,22 @@ Start here when something breaks. Do not open `~/.grok/auth.json` or
|
|
|
391
410
|
| Variable | Effect |
|
|
392
411
|
|---|---|
|
|
393
412
|
| `GROK_BRIDGE_IMAGE_GEN=off` | Do not declare Grok `image_generation`; do not append the `Images:` line |
|
|
413
|
+
| `GROK_BRIDGE_VIDEO_GEN=off` | Do not declare `grok_bridge_generate_video`; do not append the `Videos:` line |
|
|
394
414
|
| `GROK_BRIDGE_TRANSPORT=fetch` | Use Node `fetch` instead of `node:http(s)` |
|
|
395
415
|
| `GROK_BRIDGE_INFERENCE=cli` | Fall back to the CLI envelope path |
|
|
396
416
|
| `GROK_BRIDGE_DIAGNOSTICS=off` | Do not write the JSONL log |
|
|
397
417
|
| `GROK_BRIDGE_MODELS` | Extra `grok-*` catalog ids (comma or space) beyond `grok-4.7` and `grok-4.6` |
|
|
398
418
|
| `NODE` | Absolute `node` binary for the `.command` launcher / desktop scripts |
|
|
419
|
+
| `CODEX_BINARY` | Codex CLI binary. Overrides the bundled path |
|
|
420
|
+
| `CODEX_DESKTOP_APP` | Desktop app to launch. Overrides Codex.app / ChatGPT |
|
|
421
|
+
| `GROK_BINARY` | `grok` binary. Overrides `~/.grok/bin/grok` |
|
|
422
|
+
| `CODEX_GROK_PLATFORM` | `darwin`, `linux`, or `win32` for install and launch scripts |
|
|
399
423
|
| `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`) |
|
|
400
424
|
|
|
401
425
|
## Verify
|
|
402
426
|
|
|
403
427
|
```sh
|
|
404
|
-
npm test #
|
|
428
|
+
npm test # 315 tests, no remote inference
|
|
405
429
|
npm run test:coverage # 80% line / branch / function gate
|
|
406
430
|
npm run verify:app-server # real app-server routing; also runs against an installed bundle
|
|
407
431
|
npm audit --omit=dev
|
|
@@ -483,7 +507,7 @@ Grok 4.7을 Codex 모델 목록에 넣고, Codex의 `/v1/responses`를
|
|
|
483
507
|
calling으로 옮기고, 상류 Responses 스트림을 전달한 뒤, Codex가 알아보는
|
|
484
508
|
이름으로 되돌립니다.
|
|
485
509
|
|
|
486
|
-
`src/` 아래 파일
|
|
510
|
+
`src/` 아래 파일 22개. 로컬 음성용 런타임 의존성은 `opusscript`와 `werift`입니다. Node.js 22 이상. 1.5.0부터 npm
|
|
487
511
|
`"os"`는 `darwin` / `linux` / `win32`입니다.
|
|
488
512
|
|
|
489
513
|
코드 리뷰 전용 제품이 아니고 Grok 네이티브 검색 제품도 아닙니다. 피커에는
|
|
@@ -496,6 +520,22 @@ Codex `web_search`는 브리지가 실행하는 함수가 아니라 xAI 서버
|
|
|
496
520
|
|
|
497
521
|
최근 버전이 더한 것입니다. 그 이전은 `CHANGELOG.md`에 있습니다.
|
|
498
522
|
|
|
523
|
+
### 1.8.5 — 2026-11-10
|
|
524
|
+
|
|
525
|
+
- Codex CLI 0.166부터는 스레드 제공자와 앱 서버에 설정된 제공자가 다르면 턴을 거절합니다. 데스크톱 래퍼가 그 프로세스의 `model_provider`를 맞추고, 저장된 스레드 제공자를 갱신한 뒤, 메모리에 있는 스레드를 archive/unarchive해서 Codex가 다시 읽게 합니다. `thread/resume` 전에 합니다. 새 Grok 턴과 openai ↔ `grok_build_cli` 전환이 `verify-app-server`를 통과합니다. 래퍼가 끝나면 이전 `model_provider` 값으로 되돌립니다.
|
|
526
|
+
- 추적하는 Codex CLI는 0.167.0입니다 (https://github.com/openai/codex/releases/tag/rust-v0.167.0). verify-app-server를 통과했습니다.
|
|
527
|
+
- 추적하는 Grok CLI는 1.0.77입니다 (https://x.ai/build/changelog). 브리지 변경은 없습니다.
|
|
528
|
+
- 64 KiB 이상 음성 사이드밴드 프레임은 WebSocket 64비트 길이를 씁니다. DNS 캐시 키에 `options.all`이 들어갑니다. 멈춘 상류 소켓은 120초 뒤 `ETIMEDOUT`으로 끊습니다.
|
|
529
|
+
- 순환 참조나 외부 `$ref`가 있는 MCP 도구 하나가 턴 전체를 막지 않습니다. `o3`, `o4-mini`, `codex-*`는 Grok 스레드에서 OpenAI로 돌아갑니다. 영상 후속 단계는 같이 나온 도구 호출을 유지하고, 단계 한도에 도달하면 `grok_bridge_generate_video`를 숨기며, 사용량을 합치고, 영상 HTTP 호출에 시간 제한을 둡니다.
|
|
530
|
+
- HTTP 401/403, 400/422, 429/5xx는 `auth`, `payload`, `upstream_status`입니다. 프록시 오류는 로그인 토큰을 지웁니다. `model: gpt-*`만 있는 롤아웃 줄은 Grok을 벗어납니다. 마이그레이션은 심볼릭 링크를 따라가지 않고 호출마다 다른 임시 파일을 씁니다.
|
|
531
|
+
- 재개할 때 저장된 Grok 암호문을 지웁니다. 이 동작은 1.8.2에 들어갔고 기록에 없었습니다.
|
|
532
|
+
- Windows 설치기는 경로를 UTF-8로 씁니다. macOS 런처는 사용자 `PATH`를 유지하고 node 경로를 따옴표로 감쌉니다. 배포 패키지에 `npm run verify:app-server`가 들어 있습니다.
|
|
533
|
+
|
|
534
|
+
### 1.8.4 — 2026-10-25
|
|
535
|
+
|
|
536
|
+
- 추적하는 Codex CLI는 0.164.0입니다 (https://github.com/openai/codex/releases/tag/rust-v0.164.0). 프로토콜 변경은 없습니다.
|
|
537
|
+
- 추적하는 Grok CLI는 1.0.70입니다 (https://x.ai/build/changelog). 브리지 변경은 없습니다.
|
|
538
|
+
|
|
499
539
|
### 1.8.3 — 2026-10-06
|
|
500
540
|
|
|
501
541
|
- 추적하는 Grok CLI는 1.0.46입니다 (https://x.ai/build/changelog). 브리지 변경은 없습니다.
|
|
@@ -560,7 +600,7 @@ Codex `web_search`는 브리지가 실행하는 함수가 아니라 xAI 서버
|
|
|
560
600
|
`.command` 런처는 자기 위치를 기준으로 경로를 잡으므로 폴더를 옮겨도 수정할
|
|
561
601
|
필요가 없습니다. `PATH`에 `node`가 없으면 `NODE=/path/to/node`로 지정합니다.
|
|
562
602
|
|
|
563
|
-
검증 버전: Codex 0.
|
|
603
|
+
검증 버전: Codex CLI 0.167.0, Grok CLI 1.0.77, Node 22.
|
|
564
604
|
앱 업데이트가 `CODEX_CLI_PATH`나 app-server 프로토콜을 바꾸면 재검증이
|
|
565
605
|
필요합니다.
|
|
566
606
|
|
|
@@ -582,7 +622,7 @@ codex-grok exec --skip-git-repo-check --sandbox workspace-write '작업 내용'
|
|
|
582
622
|
```sh
|
|
583
623
|
git clone https://github.com/deximple/codex-grok-bridge.git
|
|
584
624
|
cd codex-grok-bridge
|
|
585
|
-
npm test #
|
|
625
|
+
npm test # 315건, 네트워크·추론 없음
|
|
586
626
|
node scripts/codex-grok.mjs
|
|
587
627
|
```
|
|
588
628
|
|
|
@@ -665,7 +705,7 @@ Responses 경로가 이상하면 `GROK_BRIDGE_INFERENCE=cli`로 이전 CLI 봉
|
|
|
665
705
|
|
|
666
706
|
추측이 아니라 실측입니다.
|
|
667
707
|
|
|
668
|
-
- 실제 app-server에서 GPT
|
|
708
|
+
- 실제 app-server에서 GPT 모델과 `grok-4.7`, `grok-4.6`의 혼합 목록, Grok 제공자 라우팅.
|
|
669
709
|
- 실제 Grok CLI → Codex `exec_command` → 결과 → Grok 최종 응답
|
|
670
710
|
(`BRIDGE_TOOL_OK`).
|
|
671
711
|
- 별도 Codex 창에 `Grok 4.6 / xAI Extra High` 표시.
|
|
@@ -682,7 +722,9 @@ Codex는 provider·model을 프롬프트에 넣지 않습니다. 브리지는 `i
|
|
|
682
722
|
이미지 생성이 켜져 있으면 `Images:` 줄도 붙습니다. 이 전송의 그림은 요청에 이미
|
|
683
723
|
있는 Grok `image_generation` 도구로 만들고, Codex `imagegen` 스킬을 읽거나
|
|
684
724
|
OpenAI로 보내지 말라는 뜻입니다. `GROK_BRIDGE_IMAGE_GEN=off`면 도구와 그 줄이
|
|
685
|
-
같이 빠집니다.
|
|
725
|
+
같이 빠집니다. `POST /v1/images/generations`와 `POST /v1/images/edits`는 같은
|
|
726
|
+
grok 로그인으로 Imagine에 넘깁니다. 영상 생성이 켜져 있으면 `Videos:` 줄도
|
|
727
|
+
붙습니다. `GROK_BRIDGE_VIDEO_GEN=off`면 그 도구와 그 줄이 빠집니다.
|
|
686
728
|
|
|
687
729
|
### reasoning
|
|
688
730
|
|
|
@@ -692,7 +734,7 @@ Codex `reasoning` 항목의 평문 요약은 상류로 전달합니다. 요약
|
|
|
692
734
|
턴에서 모델이 자기 추론을 이어받게 하기 위한 것이며, 상류가 이 형태를 수락하는
|
|
693
735
|
것을 확인했습니다. 같은 과정에서 아이템과 content part는 Grok Responses가
|
|
694
736
|
받는 필드만 남깁니다. `status`, 알 수 없는 Codex 키, `internal_*` 필드는
|
|
695
|
-
버려서 새 클라이언트 필드가 상류 422를 내지 않게 합니다. 응답으로 돌아가는 암호문도 빼서, 나중에 OpenAI 모델로 바꿔도 Grok 추론 blob을 복호화하려 하지 않습니다.
|
|
737
|
+
버려서 새 클라이언트 필드가 상류 422를 내지 않게 합니다. 응답으로 돌아가는 암호문도 빼서, 나중에 OpenAI 모델로 바꿔도 Grok 추론 blob을 복호화하려 하지 않습니다. 재개와 fork도 저장된 Grok 롤아웃의 암호문을 지웁니다. OpenAI만 있는 롤아웃은 바이트 그대로입니다.
|
|
696
738
|
|
|
697
739
|
### 동시성
|
|
698
740
|
|
|
@@ -805,8 +847,8 @@ URL과 저장한 파일 경로를 함께 넣습니다. 다운로드가 실패하
|
|
|
805
847
|
것입니다.
|
|
806
848
|
|
|
807
849
|
`turn_failed.kind`는 다음 중 하나입니다 — `aborted`, `auth`, `dns`, `connect`,
|
|
808
|
-
`upstream_timeout`, `upstream_closed`, `
|
|
809
|
-
`internal`. Codex UI에는 같은 분류가 `bridge_<kind>`로 보입니다.
|
|
850
|
+
`upstream_timeout`, `upstream_closed`, `upstream_status`, `upstream_protocol`,
|
|
851
|
+
`payload`, `internal`. Codex UI에는 같은 분류가 `bridge_<kind>`로 보입니다.
|
|
810
852
|
|
|
811
853
|
문제가 있으면 여기부터 봅니다. 브리지를 “확인”하려고 `~/.grok/auth.json`이나
|
|
812
854
|
`~/.codex/auth.json`을 열지 마세요.
|
|
@@ -816,17 +858,22 @@ URL과 저장한 파일 경로를 함께 넣습니다. 다운로드가 실패하
|
|
|
816
858
|
| 변수 | 효과 |
|
|
817
859
|
|---|---|
|
|
818
860
|
| `GROK_BRIDGE_IMAGE_GEN=off` | Grok `image_generation`을 선언하지 않고 `Images:` 줄도 붙이지 않음 |
|
|
861
|
+
| `GROK_BRIDGE_VIDEO_GEN=off` | `grok_bridge_generate_video`를 선언하지 않고 `Videos:` 줄도 붙이지 않음 |
|
|
819
862
|
| `GROK_BRIDGE_TRANSPORT=fetch` | `node:http(s)` 대신 Node `fetch` |
|
|
820
863
|
| `GROK_BRIDGE_INFERENCE=cli` | CLI 봉투 경로로 폴백 |
|
|
821
864
|
| `GROK_BRIDGE_DIAGNOSTICS=off` | JSONL 로그를 쓰지 않음 |
|
|
822
865
|
| `GROK_BRIDGE_MODELS` | `grok-4.7`과 `grok-4.6` 외에 카탈로그에 더할 `grok-*` id (쉼표/공백) |
|
|
823
866
|
| `NODE` | `.command` / 데스크톱 스크립트가 쓸 `node` 절대 경로 |
|
|
867
|
+
| `CODEX_BINARY` | Codex CLI 바이너리. 번들 경로보다 우선 |
|
|
868
|
+
| `CODEX_DESKTOP_APP` | 실행할 데스크톱 앱. Codex.app / ChatGPT보다 우선 |
|
|
869
|
+
| `GROK_BINARY` | `grok` 바이너리. `~/.grok/bin/grok`보다 우선 |
|
|
870
|
+
| `CODEX_GROK_PLATFORM` | 설치·실행 스크립트용 `darwin`, `linux`, `win32` |
|
|
824
871
|
| `CODEX_GROK_APP` | 데스크톱 설치기가 쓸 앱 경로 (macOS: `/Applications/Codex Grok.app`; Linux: `~/.local/share/codex-grok-bridge/app`; Windows: `%LOCALAPPDATA%\codex-grok-bridge\app`) |
|
|
825
872
|
|
|
826
873
|
## 검증
|
|
827
874
|
|
|
828
875
|
```sh
|
|
829
|
-
npm test #
|
|
876
|
+
npm test # 315건, 외부 추론 없음
|
|
830
877
|
npm run test:coverage # line/branch/function 80% 게이트
|
|
831
878
|
npm run verify:app-server # 실제 app-server 라우팅. 설치된 앱 번들에서도 실행
|
|
832
879
|
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.5",
|
|
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();
|