@tumnel/codex 0.1.1

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 ADDED
@@ -0,0 +1,64 @@
1
+ # @tumnel/codex
2
+
3
+ Standalone connector that bridges the Codex CLI agent to Tumnel web clients. It spawns the same
4
+ `codex` binary used by ChatGPT and Codex Desktop (`@openai/codex-sdk` over stdio), exposes it
5
+ through the Tumnel bridge protocol, and lets Tumnel web clients build and control Codex threads
6
+ with the same experience as the OpenCode connector: sessions, streaming turns, tools, and pairing.
7
+
8
+ ## Run the connector
9
+
10
+ ```sh
11
+ npx @tumnel/codex connect
12
+ ```
13
+
14
+ The connector starts the Codex agent bridge and keeps it connected to the Tumnel relay until
15
+ interrupted:
16
+
17
+ ```sh
18
+ npx @tumnel/codex --model gpt-5-mini --sandbox workspace-write --approval-policy on-request
19
+ ```
20
+
21
+ It binds a pairing-only endpoint to `127.0.0.1:43817` (use `--port` to override). It accepts
22
+ approved OpenBridge origins, returns short-lived signed proofs, and never exposes Codex API keys
23
+ or model credentials over localhost.
24
+
25
+ The host identity is an Ed25519 key pair stored at `~/.config/tumnel/identity.json`. When OpenCode
26
+ was installed first, Codex adopts its existing identity so the computer remains one paired Tumnel
27
+ host. Codex still has an isolated connector channel, project/session state, events, and preferences.
28
+ Legacy Codex identities are migrated automatically when no shared or OpenCode identity exists.
29
+
30
+ ## Configuration
31
+
32
+ | Flag | Environment | Default |
33
+ | --- | --- | --- |
34
+ | `--relay-url` | `TUMNEL_RELAY_URL` | `https://openbridge.jlfloressanchez01.workers.dev` |
35
+ | `--port` | `TUMNEL_LOCAL_PORT` | `43817` |
36
+ | `--model` | `CODEX_MODEL` | Codex default |
37
+ | `--sandbox` | `CODEX_SANDBOX` | `workspace-write` |
38
+ | `--approval-policy` | `CODEX_APPROVAL_POLICY` | `on-request` |
39
+ | — | `CODEX_REASONING_EFFORT` | — |
40
+ | — | `CODEX_WEB_SEARCH` | — |
41
+ | — | `CODEX_NETWORK_ACCESS` | `false` |
42
+ | — | `CODEX_SKIP_GIT_REPO_CHECK` | `false` |
43
+ | — | `CODEX_HOME` | `~/.codex` |
44
+
45
+ ## Architecture
46
+
47
+ - `buildUserMessage`/`itemPart` map Codex thread items (`agent_message`, `reasoning`,
48
+ `command_execution`, `file_change`, `mcp_tool_call`, `web_search`) to the frontend message/part
49
+ shape used by the OpenCode connector.
50
+ - A turn (`session.prompt`) runs `thread.runStreamed(input, { signal })`; every thread event is
51
+ relayed as a `session.status` / `message.updated` / `message.part.updated` / `session.idle`
52
+ bridge event, and the observed messages are served back through `session.messages`.
53
+ - Threads are discovered from `~/.codex/sessions/**/rollout-*.jsonl`, so sessions started in the
54
+ Codex CLI or app appear in the web UI and can be resumed.
55
+
56
+ ## Known limitations
57
+
58
+ - `session.fork` is not supported (the Codex SDK has no fork API).
59
+ - Permission prompts are configured through `CODEX_APPROVAL_POLICY`; `codex exec` is
60
+ non-interactive, so `permission.list` returns no pending approvals and the web approval cards
61
+ are not shown for this connector.
62
+ - `session.messages` reconstructs the visible history for discovered sessions from Codex rollout
63
+ JSONL files, including user/assistant text and supported tool call output.
64
+ - Only text and local `file` parts are forwarded; other attachment types are skipped.