You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: AGENTS.md
+23-29Lines changed: 23 additions & 29 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -9,41 +9,37 @@ Detailed navigation/runbooks live in:
9
9
10
10
-`docs/codebase-map.md` (task-oriented file map: "if you need X, edit Y")
11
11
-`README.md` (setup, build, release, and broader project docs)
12
+
-`docs/shaping/rest-api-migration.md` (architecture decision: ACP to REST API migration)
12
13
13
-
## Project Snapshot
14
+
## Project Purpose
14
15
15
-
OpenCodeMonitor is a fork of [CodexMonitor](https://github.com/Dimillian/CodexMonitor) — a Tauri desktop app that orchestrates coding agents across local workspaces. The backend has been replaced: instead of Codex CLI, it spawns **OpenCode ACP** (`opencode acp`) as the agent process and translates between ACP's protocol and the original CodexMonitor frontend event shapes.
16
+
OpenCodeMonitor is a fork of [CodexMonitor](https://github.com/Dimillian/CodexMonitor) — a Tauri desktop app that orchestrates coding agents across local workspaces. The fork replaces the Codex CLI backend with [OpenCode](https://opencode.ai) and translates between OpenCode's protocol and the original CodexMonitor frontend event shapes.
17
+
18
+
We pull upstream CodexMonitor changes regularly (weekly/monthly). The fork's translation layer is isolated to three Rust files so frontend merges stay clean.
19
+
20
+
## Architecture
16
21
17
22
- Frontend: React + Vite (`src/`)
18
23
- Backend app: Tauri Rust process (`src-tauri/src/lib.rs`)
19
24
- Backend daemon: JSON-RPC process (`src-tauri/src/bin/codex_monitor_daemon.rs`)
20
25
- Shared backend source of truth: `src-tauri/src/shared/*`
The frontend thread reducer receives events in the **same shape** as original CodexMonitor. All ACP-to-CodexMonitor translation happens in Rust. This is the core design invariant.
30
+
The frontend thread reducer receives events in the **same shape** as original CodexMonitor. All OpenCode-to-CodexMonitor translation happens in Rust, never in the frontend.
26
31
27
-
Key differences from upstream CodexMonitor:
32
+
### Backend: Migrating from ACP to REST API
28
33
29
-
-**Process spawn**: `opencode acp --port <N> --cwd <path>` instead of Codex CLI. Ports allocated from `AtomicU16` starting at 14096.
-**No turn concept in ACP**: Synthetic `turn/started` and `turn/completed` events are emitted around `session/prompt` calls.
32
-
-**Permission requests**: ACP's `requestPermission` is translated to `codex/requestApproval`. Currently auto-approved by ACP — the approval UI is wired but dormant.
Internal Rust module paths (`codex_core.rs`, `codex/mod.rs`, etc.) are **not renamed** — only user-facing strings. This minimizes merge conflicts with upstream.
34
+
The backend is migrating from `opencode acp` (JSON-RPC over stdio) to `opencode serve` (HTTP REST + SSE). See `docs/shaping/rest-api-migration.md` for the full rationale, requirements, and implementation slices.
36
35
37
-
### Key Translation Files
36
+
The migration touches three files — the same three already diverged from upstream:
Internal Rust module paths (`codex_core.rs`, `codex/mod.rs`, etc.) are **not renamed** — only user-facing strings. This minimizes merge conflicts with upstream.
47
43
48
44
## Non-Negotiable Architecture Rules
49
45
@@ -52,7 +48,7 @@ These Codex-specific features return empty/no-op responses:
Unknown ACP `sessionUpdate` values are ignored (debug builds log them to stderr).
58
-
59
44
## Background Helper Routing
60
45
61
46
When translated events include a `params.threadId` that matches a registered background helper callback, the backend sends those translated events to the callback channel instead of the app event sink.
@@ -64,13 +49,14 @@ This prevents helper traffic from leaking into the visible thread stream while s
64
49
65
50
## Synthetic Turn Lifecycle
66
51
67
-
ACP has no native turn lifecycle notifications. OpenCode Monitor emits:
52
+
OpenCode has no native turn lifecycle notifications. The backend emits:
68
53
69
-
-`turn/started` before `session/prompt`
70
-
-`turn/completed`only after a successful `session/prompt` response
54
+
-`turn/started` before sending a prompt
55
+
-`turn/completed` after a successful prompt response
71
56
-`error` for failed prompt paths (instead of emitting `turn/completed`)
72
57
73
58
## Notes
74
59
75
-
- All ACP translation stays in Rust by design.
76
-
- Frontend should continue consuming CodexMonitor-shaped events and avoid protocol-specific logic.
60
+
- All protocol translation stays in Rust by design.
61
+
- Frontend consumes CodexMonitor-shaped events and avoids protocol-specific logic.
62
+
- For the protocol-to-CodexMonitor event mapping, see `docs/shaping/rest-api-migration.md`.
0 commit comments