chat: send cwd on every message instead of reading it back from session metadata
Simpler + more efficient than the previous per-turn GET /session: the client already has the selected cwd, so it now sends it on every message (it's constant for a session). The server uses msg.cwd directly for OpenCode's per-turn working-directory system prompt, and still tags the cwd at creation for listing. Drops the getSession round-trip. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -146,12 +146,6 @@ class ServerConnection {
|
||||
return (await res.json()) as OpenCodeSessionInfo[];
|
||||
}
|
||||
|
||||
async getSession(sessionId: string): Promise<OpenCodeSessionInfo | null> {
|
||||
const res = await fetch(`${this.baseUrl}/session/${sessionId}`);
|
||||
if (!res.ok) return null;
|
||||
return (await res.json()) as OpenCodeSessionInfo;
|
||||
}
|
||||
|
||||
async getMessages(sessionId: string): Promise<OpenCodeStoredMessage[]> {
|
||||
const res = await fetch(`${this.baseUrl}/session/${sessionId}/message`);
|
||||
if (!res.ok) throw new Error(`opencode GET /session/${sessionId}/message → ${res.status}`);
|
||||
|
||||
Reference in New Issue
Block a user