chat: run the /email chat from the email account's storage dir
The email chat's working directory now resolves to DATA_PATH/<owner>/email_accounts/<accountEmail> (created if missing), so the agent operates in the selected account's dir (emails.db, attachment_cache, …). - websocket.ts: new resolveChatCwd — context 'email' → the account dir (via a new resolveEmailCwd), 'chat' → the pwd/claude_sessions dir, else the given cwd. Both the Claude and OpenCode handlers use it. The account defaults to the owner's first enabled account for now; the account selector will pass it as contextId later. - OpenCode honors the cwd again: send-opencode passes it as the session `directory` (client.createSession(directory?)) for context-scoped chats; the general /chat still omits it and uses the fixed server's default project. Verified against the live server that directory-bound sessions create + list. No frontend change — the /email panel already sends context:'email'. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -45,7 +45,7 @@ export async function sendOpenCodeStreaming(params: OpenCodeStreamingParams): Pr
|
||||
(params.sessionKey.startsWith('ses_') ? params.sessionKey : undefined) ??
|
||||
params.resumeSessionId;
|
||||
if (!opencodeSessionId) {
|
||||
opencodeSessionId = await conn.createSession();
|
||||
opencodeSessionId = await conn.createSession(params.cwd);
|
||||
}
|
||||
setOpenCodeSession(params.sessionKey, opencodeSessionId);
|
||||
const sessionId = opencodeSessionId;
|
||||
|
||||
Reference in New Issue
Block a user