chat: rename claude_sessions → general_chat_sessions; drop dead chat_sessions

The default /chat working directory is used by both the Claude and OpenCode harnesses
now, so its Claude-specific name was misleading.

- Rename the dir + accessors: getClaudeSessionsCwd → getGeneralChatSessionsCwd,
  ensureClaudeSessionsCwd → ensureGeneralChatSessionsCwd, path segment claude_sessions
  → general_chat_sessions (data-path on disk + code + UI labels/comments). No history
  migration — the old Claude transcript slug is orphaned (intentionally).

- Remove the vestigial chat_sessions dir (leftover from the retired session store):
  it only ever held empty claude/archived/ dirs, recreated by a signin hook. Drop that
  hook (+ its dead imports) and the 4 unused data-path accessors (getUserSessionsDir,
  getClaudeDir, getSessionDir, getArchivedSessionDir), and delete the dir.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-07-25 11:50:48 +00:00
co-authored by Claude Opus 4.8
parent 9a79a76b95
commit 0c3f270419
10 changed files with 107 additions and 60 deletions
+5 -5
View File
@@ -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 { ensureClaudeSessionsCwd, getClaudeSessionsCwd } from './claude-sessions';
import { ensureGeneralChatSessionsCwd, getGeneralChatSessionsCwd } from './claude-sessions';
import * as sidecar from '@@/sidecar-registry';
import { join } from 'path';
import { getHomeDirForRole, getEmailAccountsDir } from '../../../servers/data-path';
@@ -77,7 +77,7 @@ async function resolveEmailCwd(userId: number, ownerEmail: string, accountEmail?
}
// The working directory a chat turn runs in, by context: email → the account dir; /chat → a chosen
// pwd or the default claude_sessions dir; everything else (browser/project/dashboard) → the given cwd.
// pwd or the default general_chat_sessions dir; everything else (browser/project/dashboard) → the given cwd.
async function resolveChatCwd(
msg: { context?: string; contextId?: string; cwd?: string },
email: string,
@@ -86,7 +86,7 @@ async function resolveChatCwd(
): Promise<string> {
if (msg.context === 'email') return resolveEmailCwd(userId, email, msg.contextId);
if (msg.context === 'chat')
return msg.cwd?.trim() ? resolveCwd(email, role, msg.cwd) : ensureClaudeSessionsCwd(email);
return msg.cwd?.trim() ? resolveCwd(email, role, msg.cwd) : ensureGeneralChatSessionsCwd(email);
return resolveCwd(email, role, msg.cwd);
}
@@ -460,8 +460,8 @@ 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 claude_sessions grouping placeholder, so use the user's home.
const workingDir = cwd === getClaudeSessionsCwd(email) ? getHomeDirForRole(email, ws.data.role) : cwd;
// /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({