chat: OpenCode /chat cwd = general_chat_sessions (match Claude), drop home special-case
Both harnesses now use the resolved chat cwd as their working directory: Claude runs in it natively, and OpenCode is told the same via its system prompt. Removes the earlier special-case that pointed OpenCode at the user's home for /chat, so `workingDir` collapses into `cwd` — which now both tags the session (metadata.officer.cwd) and drives the Officer system prompt. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -4,7 +4,7 @@ import type { ClientMessage, ServerMessage, Message, ChatEvent } from './types';
|
||||
import { sessionManager } from './session-manager';
|
||||
import { sendClaudeCodeStreaming } from '@@/channels/send-claude-code';
|
||||
import { sendOpenCodeStreaming } from '@@/channels/send-opencode';
|
||||
import { ensureGeneralChatSessionsCwd, getGeneralChatSessionsCwd } from './claude-sessions';
|
||||
import { ensureGeneralChatSessionsCwd } from './claude-sessions';
|
||||
import * as sidecar from '@@/sidecar-registry';
|
||||
import { join } from 'path';
|
||||
import { getHomeDirForRole, getEmailAccountsDir } from '../../../servers/data-path';
|
||||
@@ -459,10 +459,6 @@ async function handleOpenCodeChat(
|
||||
|
||||
const onEvent = createEventHandler(sessionId, model, cwd);
|
||||
|
||||
// The dir the OpenCode model should treat as its cwd (via the Officer system prompt). For the general
|
||||
// /chat, the resolved cwd is just the general_chat_sessions grouping placeholder, so use the user's home.
|
||||
const workingDir = cwd === getGeneralChatSessionsCwd(email) ? getHomeDirForRole(email, ws.data.role) : cwd;
|
||||
|
||||
try {
|
||||
const handle = await sendOpenCodeStreaming({
|
||||
userId,
|
||||
@@ -471,7 +467,6 @@ async function handleOpenCodeChat(
|
||||
prompt: effectivePrompt,
|
||||
sessionKey: sessionId,
|
||||
cwd,
|
||||
workingDir,
|
||||
model,
|
||||
role: ws.data.role,
|
||||
resumeSessionId: msg.resumeSessionId,
|
||||
|
||||
Reference in New Issue
Block a user