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
- Load existing messages when reopening sessions
- Implement OpenCode Server API for real-time SSE streaming
Moved from considerations to active tasks.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
When reopening an existing OpenCode session via `--session <id>`, the web UI shows an empty chat. Previous messages should be loaded and displayed before accepting new input.
111
+
112
+
**Fix**:
113
+
1. When session ID is provided, first fetch session history from OpenCode storage
114
+
2. Parse existing messages from session file (check `~/.local/share/opencode/storage/`)
115
+
3. Send historical messages to web client before enabling input
116
+
4. Use existing session parser logic from `src/sessions/parser.ts` if applicable
117
+
118
+
#### Implement OpenCode Server API for real-time streaming
119
+
**Files**: `src/chat/opencode-handler.ts`, possibly new `src/chat/opencode-server.ts`
120
+
121
+
Current implementation uses `opencode run --format json` which works but spawns a new process per message. OpenCode has a built-in server (`opencode serve`) with SSE streaming that would provide:
122
+
- Persistent sessions across page reloads
123
+
- Real-time status updates
124
+
- More efficient connection (single long-lived connection vs process-per-message)
125
+
126
+
**Fix**:
127
+
1. Research: Check if `opencode serve` can run in container and expose API
128
+
2. Start `opencode serve` on container startup or on-demand
129
+
3. Create new handler that connects to OpenCode's HTTP API
130
+
4. Use SSE for streaming responses instead of parsing stdout
131
+
5. Keep CLI fallback for environments where server can't run
@@ -137,15 +169,6 @@ This makes typecheck failures more visible in CI output.
137
169
138
170
> Add items here to discuss with project owner before promoting to tasks.
139
171
140
-
### OpenCode Server API Integration (Optional Enhancement)
141
-
142
-
Research document: [docs/research/RESEARCH_AGENT_TERMINAL.md](./docs/research/RESEARCH_AGENT_TERMINAL.md)
143
-
144
-
OpenCode chat is now implemented using CLI passthrough (`opencode run --format json`). This works well and matches the Claude Code integration pattern. Future enhancement could use OpenCode's built-in server API (`opencode serve`) for:
145
-
- Persistent sessions across page reloads
146
-
- Real-time status updates via SSE
147
-
- More granular message streaming
148
-
149
172
### Design Document Updates (Pending Review)
150
173
151
174
- **Port range discrepancy**: Design says "starts at 4200" but implementation uses 2200-2400
0 commit comments