@koreanhole/opencodex 2.95.10 → 2.97.0
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/AGENTS_INSTALL.md +33 -6
- package/README.md +100 -31
- package/package.json +6 -2
- package/src/adapters/cli-agent/acp-client.ts +545 -0
- package/src/adapters/cli-agent/cline/acp.ts +15 -279
- package/src/adapters/cli-agent/cline/adapter.ts +3 -3
- package/src/adapters/cli-agent/cline/live-models.ts +6 -5
- package/src/adapters/cli-agent/cline/stream.ts +6 -37
- package/src/adapters/cli-agent/gemini/acp.ts +656 -0
- package/src/adapters/cli-agent/gemini/adapter.ts +253 -0
- package/src/adapters/cli-agent/gemini/binary.ts +23 -0
- package/src/adapters/cli-agent/gemini/live-models.ts +154 -0
- package/src/adapters/cli-agent/gemini/model-metadata.ts +291 -0
- package/src/adapters/cli-agent/mcp-server.ts +29 -4
- package/src/adapters/cli-agent/tool-intent.ts +71 -0
- package/src/cli/index.ts +81 -19
- package/src/config.ts +50 -9
- package/src/index.ts +1 -0
- package/src/lib/codex-catalog.ts +318 -0
- package/src/lib/redact.ts +4 -1
- package/src/server/index.ts +46 -13
- package/src/server/messages.ts +9 -8
- package/src/server/responses.ts +126 -12
- package/src/types.ts +14 -0
package/AGENTS_INSTALL.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Installing and Operating the Cline
|
|
1
|
+
# Installing and Operating the Cline + Gemini CLI Proxy
|
|
2
2
|
|
|
3
3
|
This file is for an agent that is installing or operating this package, not for
|
|
4
4
|
an agent changing its source code.
|
|
@@ -19,14 +19,36 @@ ocx provider add cline-cli --set-default
|
|
|
19
19
|
ocx start
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
+
To use Gemini instead, authenticate it through its official CLI and select the
|
|
23
|
+
provider:
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
gemini # configure a Gemini Developer API or Vertex AI API key
|
|
27
|
+
ocx provider add gemini-cli --set-default
|
|
28
|
+
ocx start
|
|
29
|
+
ocx codex sync
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
`ocx codex sync` refreshes the Codex app catalog with locally discovered Gemini
|
|
33
|
+
models and reasoning levels. Restart the Codex app/app-server after refresh. The
|
|
34
|
+
catalog file is written only when `model_catalog_json` names an opencodex catalog
|
|
35
|
+
or through the documented default path; unrelated Codex settings are not changed.
|
|
36
|
+
|
|
22
37
|
## Credential rules
|
|
23
38
|
|
|
24
|
-
- Use the operator's existing Cline CLI sign-in. Do not copy vendor
|
|
25
|
-
config, environment files, logs, prompts, or package content.
|
|
39
|
+
- Use the operator's existing Cline or Gemini CLI sign-in. Do not copy vendor
|
|
40
|
+
tokens into config, environment files, logs, prompts, or package content.
|
|
26
41
|
- Do not authenticate on a request path. If Cline reports `auth_required`, stop
|
|
27
42
|
and ask the operator to run `ocx login cline-cli`.
|
|
28
43
|
- Do not edit the operator's real Cline provider store unless the operator asks.
|
|
29
|
-
-
|
|
44
|
+
- Do not import or replay Gemini OAuth/API-key material; the Gemini CLI remains
|
|
45
|
+
the authentication authority.
|
|
46
|
+
- Third-party use must use a Gemini Developer API key or Vertex AI GenAI API key.
|
|
47
|
+
Gemini CLI's official FAQ identifies third-party use of its personal Google
|
|
48
|
+
OAuth authentication as a terms violation. OAuth is not a supported
|
|
49
|
+
opencodex setup path.
|
|
50
|
+
- The proxy writes under `$OPENCODEX_HOME` (default `~/.opencodex`) and may update
|
|
51
|
+
the active opencodex Codex model catalog selected by `model_catalog_json`.
|
|
30
52
|
|
|
31
53
|
## Operation
|
|
32
54
|
|
|
@@ -46,7 +68,12 @@ Before claiming the proxy works, run:
|
|
|
46
68
|
```bash
|
|
47
69
|
bun run typecheck
|
|
48
70
|
bun test tests/e2e/cline-only.test.ts
|
|
71
|
+
bun run test:e2e:gemini
|
|
72
|
+
bun run test:e2e:gemini-tool
|
|
73
|
+
bun run test:e2e:gemini-reasoning
|
|
49
74
|
```
|
|
50
75
|
|
|
51
|
-
Report whether
|
|
52
|
-
binary/account.
|
|
76
|
+
Report whether each evidence path used a deterministic ACP fixture or a real
|
|
77
|
+
vendor binary/account. The Gemini command above is a hard live gate: missing
|
|
78
|
+
binaries, authentication, a Flash Lite model, or cleanup evidence must fail.
|
|
79
|
+
Never report a skipped or synthetic run as a real login.
|
package/README.md
CHANGED
|
@@ -1,112 +1,181 @@
|
|
|
1
|
-
# opencodex: Cline
|
|
1
|
+
# opencodex: Cline + Gemini CLI proxy
|
|
2
2
|
|
|
3
3
|
`ocx` is a small local proxy that lets OpenAI Codex and Claude Code use a locally
|
|
4
|
-
installed Cline CLI as their model transport.
|
|
4
|
+
installed Cline CLI or Gemini CLI as their model transport.
|
|
5
5
|
|
|
6
|
-
This fork contains only
|
|
7
|
-
widget, client-config integration writer,
|
|
6
|
+
This fork contains only those two local CLI paths. There is no dashboard, desktop
|
|
7
|
+
app, macOS widget, client-config integration writer, account pool, docs site, or
|
|
8
8
|
GitHub Actions workflow.
|
|
9
9
|
|
|
10
10
|
## Requirements
|
|
11
11
|
|
|
12
12
|
- Bun 1.4.4 (the npm launcher installs the pinned runtime)
|
|
13
|
-
- A locally installed and authenticated
|
|
13
|
+
- A locally installed and authenticated Cline CLI, Gemini CLI, or both
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
npm install -g cline
|
|
17
17
|
cline auth
|
|
18
|
+
|
|
19
|
+
npm install -g @google/gemini-cli
|
|
20
|
+
gemini # configure GEMINI_API_KEY before using it through opencodex
|
|
18
21
|
```
|
|
19
22
|
|
|
23
|
+
Gemini authentication remains in Gemini CLI's own home/settings. The proxy never
|
|
24
|
+
copies, logs, or stores an API key, OAuth token, bearer token, or full request
|
|
25
|
+
body.
|
|
26
|
+
|
|
27
|
+
For third-party clients such as opencodex, use a Gemini Developer API key
|
|
28
|
+
(Google AI Studio) or a Vertex AI GenAI API key. Do not use Gemini CLI's
|
|
29
|
+
personal Google OAuth flow: Gemini CLI's official FAQ identifies third-party
|
|
30
|
+
software piggybacking on its OAuth authentication as a terms violation and says
|
|
31
|
+
the supported third-party method is an API key.
|
|
32
|
+
|
|
20
33
|
## Install
|
|
21
34
|
|
|
22
35
|
```bash
|
|
23
36
|
bun install
|
|
24
|
-
bun run src/cli/index.ts login cline-cli
|
|
25
37
|
bun run src/cli/index.ts provider add cline-cli --set-default
|
|
26
38
|
bun run src/cli/index.ts start
|
|
27
39
|
```
|
|
28
40
|
|
|
41
|
+
Select the Gemini transport instead with:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
bun run src/cli/index.ts provider add gemini-cli --set-default
|
|
45
|
+
bun run src/cli/index.ts start
|
|
46
|
+
```
|
|
47
|
+
|
|
29
48
|
The default config is `~/.opencodex/config.json`; set `OPENCODEX_HOME` to isolate
|
|
30
|
-
it. The proxy listens on `http://127.0.0.1:10100/v1` by default.
|
|
49
|
+
it. The proxy listens on `http://127.0.0.1:10100/v1` by default. Existing
|
|
50
|
+
Cline-only configs load unchanged and keep Cline as the default.
|
|
31
51
|
|
|
32
52
|
## Codex
|
|
33
53
|
|
|
34
54
|
Use a Responses provider pointed at the proxy:
|
|
35
55
|
|
|
36
56
|
```toml
|
|
37
|
-
model = "
|
|
57
|
+
model = "gemini-cli/gemini-3.5-flash-lite"
|
|
38
58
|
model_provider = "opencodex"
|
|
39
59
|
|
|
40
60
|
[model_providers.opencodex]
|
|
41
|
-
name = "opencodex (Cline CLI)"
|
|
61
|
+
name = "opencodex (Cline or Gemini CLI)"
|
|
42
62
|
base_url = "http://127.0.0.1:10100/v1"
|
|
43
63
|
wire_api = "responses"
|
|
44
64
|
requires_openai_auth = false
|
|
65
|
+
model_catalog_url = "http://127.0.0.1:10100/v1/model-catalog"
|
|
45
66
|
```
|
|
46
67
|
|
|
47
|
-
The model list is live
|
|
48
|
-
`
|
|
68
|
+
The model list is live. Cline ACP models are exposed as `cline-cli/<encoded-id>`;
|
|
69
|
+
Gemini ACP models are exposed as `gemini-cli/<encoded-id>`. Each provider keeps a
|
|
70
|
+
`default` selector. A provider prefix routes only to that vendor; unprefixed
|
|
71
|
+
`default` uses the configured default provider.
|
|
72
|
+
|
|
73
|
+
Gemini model IDs and reasoning ladders are discovered from the installed Gemini
|
|
74
|
+
CLI. Thinking-capable models expose the locally supported levels; non-thinking
|
|
75
|
+
models do not get an invented ladder. For a running Codex app, refresh the active
|
|
76
|
+
catalog and reload the app/app-server:
|
|
77
|
+
|
|
78
|
+
```bash
|
|
79
|
+
bun run src/cli/index.ts codex sync
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
The command updates the root `model_catalog_json` target when it names an
|
|
83
|
+
opencodex catalog, otherwise it writes `$CODEX_HOME/opencodex-catalog.json` and
|
|
84
|
+
prints the activation setting. `model_catalog_url` avoids the file when the app
|
|
85
|
+
catalog is fetched dynamically.
|
|
49
86
|
|
|
50
87
|
## Claude Code
|
|
51
88
|
|
|
52
89
|
```bash
|
|
53
90
|
ANTHROPIC_BASE_URL=http://127.0.0.1:10100 \
|
|
54
91
|
ANTHROPIC_AUTH_TOKEN=local \
|
|
55
|
-
ANTHROPIC_MODEL=
|
|
92
|
+
ANTHROPIC_MODEL=gemini-cli/gemini-3.5-flash-lite \
|
|
56
93
|
claude
|
|
57
94
|
```
|
|
58
95
|
|
|
59
|
-
|
|
60
|
-
JSON or SSE.
|
|
96
|
+
Use a `cline-cli/...` model to route the same Messages surface to Cline.
|
|
61
97
|
|
|
62
98
|
## Security boundary
|
|
63
99
|
|
|
64
|
-
- Cline receives
|
|
65
|
-
-
|
|
66
|
-
|
|
67
|
-
|
|
100
|
+
- Neither Cline nor Gemini receives filesystem or terminal capability from the proxy.
|
|
101
|
+
- Gemini native tools are removed by a per-turn deny policy; permission requests
|
|
102
|
+
are cancelled, and no ACP filesystem/terminal client capabilities are advertised.
|
|
103
|
+
User MCP servers, extensions, skills, and hooks are disabled for the session; only
|
|
104
|
+
the isolated `opencodex` MCP catalog can receive a client tool call.
|
|
105
|
+
- Declared client tools are exposed only through a request-scoped MCP process that
|
|
106
|
+
records bounded intent and never executes; Codex owns approval and execution.
|
|
107
|
+
- Vendor credentials remain in the vendor's real home or authenticated
|
|
108
|
+
environment. The proxy stores no vendor token.
|
|
68
109
|
- Request-path traffic never starts an interactive login.
|
|
69
110
|
- The listener is loopback-only by default; a non-loopback listener requires an
|
|
70
111
|
explicit API token.
|
|
71
|
-
- Image, video, and audio input are rejected before a
|
|
112
|
+
- Image, video, and audio input are rejected before a vendor process starts.
|
|
72
113
|
|
|
73
114
|
## Commands
|
|
74
115
|
|
|
75
116
|
```bash
|
|
76
117
|
bun run src/cli/index.ts login cline-cli [--json] [--no-wait]
|
|
77
|
-
bun run src/cli/index.ts provider add cline-cli [--set-default]
|
|
78
|
-
bun run src/cli/index.ts provider use cline-cli
|
|
118
|
+
bun run src/cli/index.ts provider add <cline-cli|gemini-cli> [--set-default]
|
|
119
|
+
bun run src/cli/index.ts provider use <cline-cli|gemini-cli>
|
|
79
120
|
bun run src/cli/index.ts provider list [--json]
|
|
80
121
|
bun run src/cli/index.ts start [--port 10100] [--host 127.0.0.1]
|
|
81
122
|
bun run src/cli/index.ts status [--json]
|
|
82
123
|
bun run src/cli/index.ts stop [--json]
|
|
83
124
|
```
|
|
84
125
|
|
|
126
|
+
Gemini has no proxy login command. Authenticate it through the official CLI
|
|
127
|
+
(`gemini` or its API-key configuration); `ocx login gemini-cli` returns that
|
|
128
|
+
guidance without prompting for or accepting a credential.
|
|
129
|
+
|
|
85
130
|
## Tests
|
|
86
131
|
|
|
87
132
|
```bash
|
|
88
133
|
bun run typecheck
|
|
89
134
|
bun test tests
|
|
90
135
|
bun run test:e2e
|
|
136
|
+
bun run test:e2e:gemini
|
|
137
|
+
bun run test:e2e:gemini-tool
|
|
138
|
+
bun run test:e2e:gemini-reasoning
|
|
91
139
|
bun run privacy:scan
|
|
92
140
|
bun run structure:check
|
|
93
141
|
```
|
|
94
142
|
|
|
95
|
-
The
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
143
|
+
The deterministic suite uses ACP fixtures for both providers and fails rather than
|
|
144
|
+
skipping missing fixture/process behavior. `test:e2e` covers Cline HTTP behavior.
|
|
145
|
+
|
|
146
|
+
`test:e2e:gemini` is the one-completion text gate. It starts an isolated
|
|
147
|
+
opencodex listener, discovers the real authenticated Gemini roster, chooses an
|
|
148
|
+
advertised Flash Lite model, writes an isolated `CODEX_HOME`, runs one real Codex
|
|
149
|
+
prompt, and asserts the response marker, observed model, and child cleanup.
|
|
150
|
+
|
|
151
|
+
`test:e2e:gemini-tool` exercises the two-completion tool loop: Gemini requests
|
|
152
|
+
Codex's `exec_command`, Codex executes a fixed read-only `printf`, and Gemini
|
|
153
|
+
returns the final answer. Both commands use no retries. Missing binaries,
|
|
154
|
+
authentication, or a Flash Lite model cause a hard failure.
|
|
155
|
+
|
|
156
|
+
`test:e2e:gemini-reasoning` discovers a thinking-capable model and level from the
|
|
157
|
+
local Gemini CLI, validates the refreshed Codex catalog, and runs one minimal
|
|
158
|
+
reasoning-enabled turn. It fails when the authenticated account cannot execute
|
|
159
|
+
the discovered model.
|
|
99
160
|
|
|
100
|
-
|
|
101
|
-
the same test. A real account is not required by the automated fixture; never
|
|
102
|
-
describe synthetic evidence as a real-account verification.
|
|
161
|
+
Optional overrides are `CLINE_BIN_PATH`, `GEMINI_BIN_PATH`, and `CODEX_BIN_PATH`.
|
|
103
162
|
|
|
104
163
|
## Troubleshooting
|
|
105
164
|
|
|
106
165
|
- **Cline not found**: install `cline` and verify `cline --help` works.
|
|
107
|
-
- **
|
|
108
|
-
- **ACP unavailable**: the adapter falls back to the one-shot JSON path when
|
|
109
|
-
model is `default`; native model selection requires ACP.
|
|
166
|
+
- **Cline authentication required**: run `ocx login cline-cli`, then retry.
|
|
167
|
+
- **Cline ACP unavailable**: the adapter falls back to the one-shot JSON path when
|
|
168
|
+
the model is `default`; native model selection requires ACP.
|
|
169
|
+
- **Gemini not found**: install it and verify `gemini --help` works, or set
|
|
170
|
+
`GEMINI_BIN_PATH`.
|
|
171
|
+
- **Gemini authentication required**: configure a Gemini Developer API key or
|
|
172
|
+
Vertex AI API key for Gemini CLI; do not use personal Google OAuth with this
|
|
173
|
+
third-party proxy and do not pass the key to opencodex.
|
|
174
|
+
- **Gemini ACP unavailable**: upgrade Gemini CLI to a version advertising `--acp`.
|
|
175
|
+
- **Gemini Pro quota exhausted**: reasoning-capable models may require paid Pro
|
|
176
|
+
quota; the catalog stays accurate but that model cannot complete a live turn.
|
|
177
|
+
- **Codex model picker is stale**: run `ocx codex sync`, then restart the Codex
|
|
178
|
+
app/app-server.
|
|
110
179
|
- **Port in use**: choose another port with `ocx start --port <port>`.
|
|
111
180
|
- **Stale runtime state**: run `ocx stop`; it removes stale state only when the
|
|
112
181
|
recorded process and health endpoint cannot be verified.
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@koreanhole/opencodex",
|
|
3
|
-
"version": "2.
|
|
4
|
-
"description": "Cline CLI
|
|
3
|
+
"version": "2.97.0",
|
|
4
|
+
"description": "Cline and Gemini CLI provider proxy for OpenAI Codex and Claude Code",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./bin/package-main.mjs",
|
|
7
7
|
"exports": {
|
|
@@ -30,6 +30,9 @@
|
|
|
30
30
|
"start": "bun run src/cli/index.ts start",
|
|
31
31
|
"test": "bun test tests",
|
|
32
32
|
"test:e2e": "bun test tests/e2e/cline-only.test.ts",
|
|
33
|
+
"test:e2e:gemini": "bun test ./tests/e2e/gemini-codex.live.ts -t \"one minimal Flash Lite completion\"",
|
|
34
|
+
"test:e2e:gemini-tool": "bun test ./tests/e2e/gemini-codex.live.ts -t \"one short Gemini tool call\"",
|
|
35
|
+
"test:e2e:gemini-reasoning": "bun test ./tests/e2e/gemini-reasoning.live.ts",
|
|
33
36
|
"typecheck": "bun check --no-script --noEmit",
|
|
34
37
|
"privacy:scan": "bun scripts/privacy-scan.ts",
|
|
35
38
|
"structure:check": "bun scripts/structure-check.ts",
|
|
@@ -47,6 +50,7 @@
|
|
|
47
50
|
},
|
|
48
51
|
"keywords": [
|
|
49
52
|
"cline",
|
|
53
|
+
"gemini",
|
|
50
54
|
"codex",
|
|
51
55
|
"claude-code",
|
|
52
56
|
"proxy",
|