codex-grok-bridge 1.0.1 → 1.0.2
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 +1 -1
- package/package.json +1 -1
- package/src/tools.mjs +17 -3
package/README.md
CHANGED
|
@@ -105,7 +105,7 @@ Codex에 첫 SSE 블록을 쓰기 **전**에 죽은 요청은 한 번 다시 보
|
|
|
105
105
|
- 기본 Responses 경로는 스트림을 전달합니다. 프롬프트 캐시 키는 Codex `prompt_cache_key`를 `x-grok-conv-id`로 넘깁니다.
|
|
106
106
|
- cli-chat-proxy는 function tool 339개 요청을 수락했습니다. 공개 API 문서의 200개 한도는 이 로그인 경로에 적용되지 않습니다.
|
|
107
107
|
- 저장된 루트 작업이 대기 중이면 GPT ↔ Grok 전환을 지원합니다. `turn/start`와 설정 변경 API는 제공자를 바꾸지 못하므로, 래퍼가 구독 해제 → 같은 ID로 제공자를 지정해 재개 → 제공자·권한 확인 후 원래 요청을 전달합니다. 실행 중인 작업, 임시 작업, 하위 에이전트는 제공자 전환을 거부하며, 다른 구독자가 전환을 막으면 추론을 보내지 않습니다. 첫 턴이 저장되기 전에는 새 작업을 시작할 때 원하는 모델을 선택하세요.
|
|
108
|
-
- **이미지 생성도 Grok이 합니다.** 브리지가 상류 요청에 `{ type: "image_generation" }`을 직접 선언하므로, Codex가 이미지 도구를 노출하지 않아도 Grok이 서버 쪽에서 생성합니다. 돌아온 바이트는 `~/.local/share/codex-grok-bridge/generated-images/`에 0600으로 저장하고, Codex에는 파일 경로를 알려주는 assistant 메시지로 전달합니다. Codex가 모르는 `response.image_generation_call.*` 이벤트는 걸러냅니다. `GROK_BRIDGE_IMAGE_GEN=off`로
|
|
108
|
+
- **이미지 생성도 Grok이 합니다.** 브리지가 상류 요청에 `{ type: "image_generation" }`을 직접 선언하므로, Codex가 이미지 도구를 노출하지 않아도 Grok이 서버 쪽에서 생성합니다. 도구가 켜져 있으면 `instructions` 끝에 `Images:` 출처 한 줄을 붙여 Codex `imagegen` 스킬을 읽지 말라고 합니다. 돌아온 바이트는 `~/.local/share/codex-grok-bridge/generated-images/`에 0600으로 저장하고, Codex에는 파일 경로를 알려주는 assistant 메시지로 전달합니다. Codex가 모르는 `response.image_generation_call.*` 이벤트는 걸러냅니다. `GROK_BRIDGE_IMAGE_GEN=off`로 끄면 도구와 그 줄이 같이 빠집니다.
|
|
109
109
|
- **한계도 실측했습니다.** Grok의 `image_generation`은 텍스트→이미지 생성만 제대로 됩니다.
|
|
110
110
|
|
|
111
111
|
| 기능 | 결과 |
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "codex-grok-bridge",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.2",
|
|
4
4
|
"description": "Run Grok 4.6 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",
|
package/src/tools.mjs
CHANGED
|
@@ -290,6 +290,16 @@ export const TRANSPORT_PROVENANCE =
|
|
|
290
290
|
"and permissions. If asked whether Grok is attached to the Codex harness, " +
|
|
291
291
|
"this line is the authoritative answer and no tool call is needed to confirm it.";
|
|
292
292
|
|
|
293
|
+
// Codex still injects its imagegen skill. That skill's fallback is OpenAI
|
|
294
|
+
// (`image_gen` or a Python CLI). The model will read the skill and send the
|
|
295
|
+
// picture to another vendor unless this line says not to. Grok already has
|
|
296
|
+
// image_generation on the request; no Codex tool call is required to pick it.
|
|
297
|
+
export const IMAGE_GENERATION_PROVENANCE =
|
|
298
|
+
"Images: pictures on this transport are generated by Grok's image_generation " +
|
|
299
|
+
"tool, which is already on the request. Do not read Codex's imagegen skill " +
|
|
300
|
+
"and do not use OpenAI, image_gen, or a Python image CLI — those send the " +
|
|
301
|
+
"picture to another vendor.";
|
|
302
|
+
|
|
293
303
|
export function toProxyRequest(body) {
|
|
294
304
|
const { tools, map } = flattenCodexTools(body.tools ?? []);
|
|
295
305
|
const effort = EFFORT[body.reasoning?.effort] ?? "high";
|
|
@@ -307,16 +317,20 @@ export function toProxyRequest(body) {
|
|
|
307
317
|
const declaresImageTool = request.tools.some(
|
|
308
318
|
(tool) => tool?.type === GROK_IMAGE_TOOL.type,
|
|
309
319
|
);
|
|
310
|
-
|
|
320
|
+
const imageGenOn = process.env.GROK_BRIDGE_IMAGE_GEN !== "off";
|
|
321
|
+
if (imageGenOn && !declaresImageTool)
|
|
311
322
|
request.tools = [...request.tools, GROK_IMAGE_TOOL];
|
|
312
323
|
if (tools.length) {
|
|
313
324
|
request.tool_choice = proxyToolChoice(body.tool_choice, map);
|
|
314
325
|
request.parallel_tool_calls = body.parallel_tool_calls !== false;
|
|
315
326
|
}
|
|
327
|
+
const provenance = imageGenOn
|
|
328
|
+
? `${TRANSPORT_PROVENANCE}\n\n${IMAGE_GENERATION_PROVENANCE}`
|
|
329
|
+
: TRANSPORT_PROVENANCE;
|
|
316
330
|
request.instructions =
|
|
317
331
|
typeof body.instructions === "string" && body.instructions
|
|
318
|
-
? `${body.instructions}\n\n${
|
|
319
|
-
:
|
|
332
|
+
? `${body.instructions}\n\n${provenance}`
|
|
333
|
+
: provenance;
|
|
320
334
|
if (typeof body.prompt_cache_key === "string" && body.prompt_cache_key)
|
|
321
335
|
request.prompt_cache_key = body.prompt_cache_key;
|
|
322
336
|
return { request, map };
|