feat: add sendToClaude helper and wait-for-event tool

- Add sendToClaude() function to browser helper that shows confirmation
- Add wait-for-event.sh script for watching server output (tail -f | grep -m 1)
- Enables clean event-driven loop: background bash waits for event, completion triggers Claude's turn
This commit is contained in:
Jesse Vincent
2026-01-17 16:38:21 -08:00
parent 7c1ac86878
commit fd51e8a6b7
2 changed files with 39 additions and 1 deletions

View File

@@ -87,10 +87,28 @@
}, 500); // 500ms debounce
});
// Send to Claude - triggers server to exit and return all events
function sendToClaude(feedback) {
send({
type: 'send-to-claude',
feedback: feedback || null
});
// Show confirmation to user
document.body.innerHTML = `
<div style="display: flex; align-items: center; justify-content: center; height: 100vh; font-family: system-ui, sans-serif;">
<div style="text-align: center; color: #666;">
<h2 style="color: #333;">✓ Sent to Claude</h2>
<p>Return to the terminal to see Claude's response.</p>
</div>
</div>
`;
}
// Expose for explicit use if needed
window.brainstorm = {
send: send,
choice: (value, metadata = {}) => send({ type: 'choice', value, ...metadata })
choice: (value, metadata = {}) => send({ type: 'choice', value, ...metadata }),
sendToClaude: sendToClaude
};
connect();