feat: Add slash commands and help dialog
- Restore slash command autocomplete (type "/" to see suggestions) - Add /compact command to trigger context compaction - Add /clear command to clear chat history - Add /help command with styled modal dialog - Add HelpDialog component with command list - Add system event handler for context warnings - Add debug logging for all Claude events to /tmp/claude-events-debug.jsonl TODO: Parse context warning from Claude events when identified 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -837,6 +837,20 @@ wss.on('connection', async (ws, req) => {
|
||||
// Note: ExitPlanMode is now handled exclusively via Control Protocol (can_use_tool)
|
||||
// to avoid tool_result/control_response confusion and message compaction issues
|
||||
|
||||
// Debug: Write all events to file for context analysis
|
||||
const debugLogPath = '/tmp/claude-events-debug.jsonl';
|
||||
const debugEntry = {
|
||||
timestamp: new Date().toISOString(),
|
||||
sessionId,
|
||||
event
|
||||
};
|
||||
try {
|
||||
const fs = await import('fs');
|
||||
fs.appendFileSync(debugLogPath, JSON.stringify(debugEntry) + '\n');
|
||||
} catch (e) {
|
||||
// Ignore write errors
|
||||
}
|
||||
|
||||
sendToClient('claude_event', { event });
|
||||
} catch (e) {
|
||||
// Non-JSON output, send as raw
|
||||
@@ -848,10 +862,26 @@ wss.on('connection', async (ws, req) => {
|
||||
});
|
||||
|
||||
// Handle stderr
|
||||
claudeProcess.stderr.on('data', (data) => {
|
||||
claudeProcess.stderr.on('data', async (data) => {
|
||||
const content = data.toString();
|
||||
// Always log stderr for SSH connections (exit code 255 debugging)
|
||||
if (DEBUG || isSSH) console.log(`[${sessionId}] stderr:`, content);
|
||||
|
||||
// Debug: Write stderr to file for context analysis
|
||||
const debugLogPath = '/tmp/claude-events-debug.jsonl';
|
||||
const debugEntry = {
|
||||
timestamp: new Date().toISOString(),
|
||||
sessionId,
|
||||
type: 'stderr',
|
||||
content
|
||||
};
|
||||
try {
|
||||
const fs = await import('fs');
|
||||
fs.appendFileSync(debugLogPath, JSON.stringify(debugEntry) + '\n');
|
||||
} catch (e) {
|
||||
// Ignore write errors
|
||||
}
|
||||
|
||||
sendToClient('stderr', { content });
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user