@bman654/clodex 1.0.4 → 1.2.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/README.md +9 -1
- package/dist/claude-wrapper.js +15 -4
- package/dist/claude-wrapper.js.map +1 -1
- package/dist/cli.js +1138 -440
- package/dist/cli.js.map +1 -1
- package/docs/background-agents.md +6 -1
- package/docs/credential-helpers.md +75 -0
- package/package.json +1 -1
|
@@ -12,6 +12,7 @@ This page explains how to bridge **every** Claude Code process on your machine
|
|
|
12
12
|
- **no live server: env untouched** — `claude` always launches normally, a stopped server never breaks anything.
|
|
13
13
|
- Setting **`CLAUDE_CODE_PROCESS_WRAPPER`** to `clodex-claude` makes Claude Code invoke it as `clodex-claude <claude-binary-path> <args...>` for every process it spawns — agents view sessions and background agents are bridged automatically.
|
|
14
14
|
- For your own terminal sessions, run **`clodex-claude`** instead of `claude` — same auto-discovery, no port or CA path to hardcode anywhere.
|
|
15
|
+
- Set **`CLODEX_REQUIRE_SERVER=1`** in an isolated routed profile when bypassing Clodex must be impossible. `clodex-claude` then exits with an error if no advertised server passes its process and TCP checks. The default remains fail-open for ordinary installations.
|
|
15
16
|
|
|
16
17
|
## Setup steps
|
|
17
18
|
|
|
@@ -79,10 +80,14 @@ This page explains how to bridge **every** Claude Code process on your machine
|
|
|
79
80
|
|
|
80
81
|
Port and CA discovery are automatic via `~/.clodex/server-runtime.json` — do not hardcode `HTTPS_PROXY`, ports, or certificate paths in your profile.
|
|
81
82
|
|
|
83
|
+
For service-manager readiness checks, `clodex-claude --check` exits `0` when an
|
|
84
|
+
advertised server passes the process and TCP checks, and exits `1` otherwise.
|
|
85
|
+
It does not launch Claude.
|
|
86
|
+
|
|
82
87
|
## Troubleshooting
|
|
83
88
|
|
|
84
89
|
- **Is my session bridged?** In a session started via `clodex-claude` (or spawned by Claude Code with the wrapper set), `/model` accepts your `clodex:` model names and aliases (run `clodex models --list` to see them). If those models are rejected and you haven't run `clodex patch`, that's expected for unpatched binaries — but a bridged session still routes them; an unbridged one errors at the API instead.
|
|
85
|
-
- **Server not running:** `clodex-claude`
|
|
90
|
+
- **Server not running:** `clodex-claude` launches plain `claude` by default. With `CLODEX_REQUIRE_SERVER=1`, it exits instead. Check `cat ~/.clodex/server-runtime.json` — a missing file (or records whose `pid` is no longer alive) means no server is advertised; start `clodex server --proxy`. If a server is running but absent from the file, make sure it was not started with `--no-discovery` / `CLODEX_NO_DISCOVERY=1`.
|
|
86
91
|
- **Wrapper variable empty or stale:** run `echo "$CLAUDE_CODE_PROCESS_WRAPPER"` in a **new login shell**. If it is empty, a `$(command -v ...)` in your profile ran before your Node version manager initialized (see the warning in step 3) — switch to a literal path. If it points at a path that no longer exists (a Node upgrade moved the global bin, an fnm/nvm shim directory expired, or it still names an old hand-written script), spawned processes fail to start or silently skip bridging. Verify with `[ -x "$CLAUDE_CODE_PROCESS_WRAPPER" ] && echo OK`.
|
|
87
92
|
- **Agents fail to spawn / `env: node: No such file or directory`:** the wrapper's `#!/usr/bin/env node` shebang could not find Node, typically because Claude Code was launched from a GUI (Spotlight, Raycast, an IDE) with a minimal PATH. Use the launcher script from step 3, which resolves Node by absolute path, and test it with `env -i HOME="$HOME" PATH=/usr/bin:/bin "$CLAUDE_CODE_PROCESS_WRAPPER" --version`.
|
|
88
93
|
- **Port conflicts:** the server default is 17645; `clodex server --proxy --port <n>` picks another. `clodex-claude` reads the actual port from the runtime file, so no other change is needed.
|
|
@@ -0,0 +1,75 @@
|
|
|
1
|
+
# Credential helpers
|
|
2
|
+
|
|
3
|
+
Clodex uses the operating system credential store by default. Headless Linux,
|
|
4
|
+
containers, and WSL installations can instead delegate opaque credential
|
|
5
|
+
storage to an external helper:
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
export CLODEX_CREDENTIAL_HELPER=/absolute/path/to/clodex-credential-helper
|
|
9
|
+
clodex providers auth openai
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
The value must be an absolute path to an executable file. Clodex invokes the
|
|
13
|
+
helper directly without a shell. Provider configuration records a versioned
|
|
14
|
+
`helper:v1:<helper-id>:<account>` reference. The helper ID is a SHA-256 digest
|
|
15
|
+
of the normalized executable path, so the path and username are not written to
|
|
16
|
+
`providers.json`. A helper-backed credential never silently falls back to the
|
|
17
|
+
OS keyring or an environment variable.
|
|
18
|
+
|
|
19
|
+
Changing `CLODEX_CREDENTIAL_HELPER` to a different path does not redirect old
|
|
20
|
+
references. Clodex refuses the operation before starting the new helper. Restore
|
|
21
|
+
the prior path to read or delete the old credential, or reauthenticate to create
|
|
22
|
+
a reference owned by the new helper.
|
|
23
|
+
|
|
24
|
+
Clodex verifies the selected store with a disposable write, read, and delete
|
|
25
|
+
before starting device authorization. It also reads back real credential
|
|
26
|
+
writes.
|
|
27
|
+
|
|
28
|
+
Credential storage is fail-closed. If the selected credential store fails its
|
|
29
|
+
probe, Clodex stops before device authorization and includes the backend
|
|
30
|
+
diagnostic in the error instead of continuing with tokens that cannot be
|
|
31
|
+
durably stored. Set `CLODEX_CREDENTIAL_HELPER` to the absolute path of an
|
|
32
|
+
external helper, then run the authorization command again.
|
|
33
|
+
|
|
34
|
+
## Protocol
|
|
35
|
+
|
|
36
|
+
The helper receives one of these invocations:
|
|
37
|
+
|
|
38
|
+
```text
|
|
39
|
+
helper get clodex <account>
|
|
40
|
+
helper set clodex <account>
|
|
41
|
+
helper delete clodex <account>
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
- `set` reads the complete opaque credential from standard input and produces
|
|
45
|
+
no output.
|
|
46
|
+
- `get` writes the exact credential to standard output without adding a
|
|
47
|
+
newline.
|
|
48
|
+
- `delete` removes the credential.
|
|
49
|
+
- Exit code `0` means success.
|
|
50
|
+
- Exit code `2` means not found for `get` or `delete`.
|
|
51
|
+
- Any other exit code means the credential operation failed.
|
|
52
|
+
|
|
53
|
+
The service and account arguments are identifiers, not secrets. Credential
|
|
54
|
+
contents are never passed in arguments or environment variables. Helper
|
|
55
|
+
standard error is not copied into Clodex diagnostics, and output and runtime
|
|
56
|
+
are bounded.
|
|
57
|
+
|
|
58
|
+
## Security responsibilities
|
|
59
|
+
|
|
60
|
+
The helper owns storage and its security properties. A helper should:
|
|
61
|
+
|
|
62
|
+
- encrypt credentials at rest using a system or user trust root;
|
|
63
|
+
- serialize concurrent updates when its backend requires it;
|
|
64
|
+
- avoid logging standard input or standard output;
|
|
65
|
+
- make `set` replace the prior value atomically;
|
|
66
|
+
- treat `delete` of a missing entry as success or exit code `2`;
|
|
67
|
+
- return the stored bytes exactly from `get`.
|
|
68
|
+
|
|
69
|
+
Users who need helper arguments can point `CLODEX_CREDENTIAL_HELPER` at a small
|
|
70
|
+
executable wrapper. Clodex intentionally does not evaluate a shell command from
|
|
71
|
+
this setting.
|
|
72
|
+
|
|
73
|
+
Existing `keyring:` and `env:` provider references retain their original
|
|
74
|
+
behavior. Enabling a helper affects newly saved credentials; reauthenticate a
|
|
75
|
+
provider to move it to the helper-backed store.
|