Revert "chat: root the OpenCode server at the chat cwd (email chat now runs in the account dir)"
This reverts commit d60c73b3a3.
This commit is contained in:
@@ -105,10 +105,13 @@ class ServerConnection {
|
||||
return (await res.json()) as T;
|
||||
}
|
||||
|
||||
async createSession(title?: string): Promise<string> {
|
||||
// OpenCode has no per-session `directory` — the working dir is the server's cwd (server-manager
|
||||
// roots the server at the desired dir). So we only optionally set a title here.
|
||||
const session = await this.postJson<{ id?: string }>('/session', title ? { title } : {});
|
||||
async createSession(directory?: string, title?: string): Promise<string> {
|
||||
// `directory` binds the session's working dir (e.g. an email account dir). Omit it for the general
|
||||
// /chat, so the session lives in the fixed server's own project (its cwd).
|
||||
const body: Record<string, unknown> = {};
|
||||
if (directory) body.directory = directory;
|
||||
if (title) body.title = title;
|
||||
const session = await this.postJson<{ id?: string }>('/session', body);
|
||||
if (!session.id) throw new Error('opencode POST /session returned no id');
|
||||
return session.id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user