Skip to content

Commit 5fdb9af

Browse files
committed
Prioritize requested repo updates
1 parent 6b69ff6 commit 5fdb9af

File tree

10 files changed

+443
-615
lines changed

10 files changed

+443
-615
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,17 @@
22

33
A macOS desktop app for monitoring and interacting with [OpenCode](https://github.com/sst/opencode) agents across multiple workspaces.
44

5-
Forked from [CodexMonitor](https://github.com/Dimillian/CodexMonitor) by Dimillian, adapted to use OpenCode's ACP (Agent Communication Protocol) instead of the Codex app-server protocol.
5+
Forked from [CodexMonitor](https://github.com/Dimillian/CodexMonitor) by Dimillian, adapted to use OpenCode's REST API + SSE backend while preserving CodexMonitor frontend event compatibility.
66

77
## Status
88

9-
**Active development**ACP backend migration is live for thread/session lifecycle, event translation, and model discovery. Remaining work focuses on parity polish and UX cleanup.
9+
**Active development**the REST/SSE backend is live for thread/session lifecycle, event translation, messaging, model discovery, and image attachments. Remaining work focuses on feature-parity polish and OpenCode-specific UX cleanup.
1010

1111
## Architecture
1212

1313
- **Frontend**: React 19 + Vite + TypeScript
14-
- **Backend**: Tauri 2 (Rust) — spawns `opencode acp` child processes via stdio JSON-RPC
15-
- **Protocol**: OpenCode ACP v1 (nd-JSON-RPC over stdio)
14+
- **Backend**: Tauri 2 (Rust) — runs against `opencode serve` (HTTP REST + SSE)
15+
- **Protocol**: OpenCode REST API + SSE, translated in Rust to CodexMonitor-shaped frontend events
1616

1717
## Development
1818

docs/shaping/rest-api-migration.md

Lines changed: 50 additions & 428 deletions
Large diffs are not rendered by default.

src-tauri/src/backend/app_server.rs

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -263,6 +263,34 @@ impl WorkspaceSession {
263263
// Parse as bool; fall back to true on success status.
264264
Ok(text.trim().parse::<bool>().unwrap_or(true))
265265
}
266+
267+
/// Send a PATCH request to the OpenCode REST API, scoped to this workspace.
268+
pub(crate) async fn rest_patch(&self, path: &str, body: Value) -> Result<Value, String> {
269+
let separator = if path.contains('?') { "&" } else { "?" };
270+
let url = format!(
271+
"{}{path}{separator}directory={}",
272+
self.base_url,
273+
urlencoding::encode(&self.entry.path)
274+
);
275+
let resp = self
276+
.http_client
277+
.patch(&url)
278+
.json(&body)
279+
.send()
280+
.await
281+
.map_err(|e| e.to_string())?;
282+
let status = resp.status();
283+
if !status.is_success() {
284+
let body = resp.text().await.unwrap_or_default();
285+
return Err(format!("REST PATCH {path} failed ({status}): {body}"));
286+
}
287+
let text = resp.text().await.map_err(|e| e.to_string())?;
288+
if text.trim().is_empty() {
289+
return Ok(Value::Null);
290+
}
291+
serde_json::from_str(&text)
292+
.map_err(|e| format!("Failed to parse response from {path}: {e}"))
293+
}
266294
}
267295

268296
// ---------------------------------------------------------------------------

0 commit comments

Comments
 (0)