chat: read the /chat session list from Claude's own transcript store
First slice of making Claude's session store the source of truth. Adds a reader (api/chat/claude-sessions.ts) that lists sessions straight from Claude's JSONL transcripts under $HOME/.claude/projects/<cwd-slug>/, plus GET /chat/sessions over a dedicated per-user claude_sessions working directory. No bookkeeping layer — Claude's files are authoritative. Verified against real transcripts. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { createRouter } from '../../create-router';
|
||||
import { getClaudeSessionsCwd, listClaudeSessions } from './claude-sessions';
|
||||
|
||||
export const chatRouter = createRouter();
|
||||
|
||||
// GET /chat/sessions — the /chat route's conversations, read straight from Claude's own transcript
|
||||
// store for the dedicated claude_sessions working directory (Claude is the source of truth).
|
||||
chatRouter.get('/sessions', (ctx) => {
|
||||
const email = ctx.get('user').email;
|
||||
const sessions = listClaudeSessions(email, getClaudeSessionsCwd(email));
|
||||
return ctx.json({ sessions });
|
||||
});
|
||||
Reference in New Issue
Block a user