mirror of
https://github.com/obra/superpowers.git
synced 2026-04-27 03:59:04 +08:00
fix: session isolation and blocking wait for visual companion
- Each session gets unique temp directory (/tmp/brainstorm-{pid}-{timestamp})
- Server outputs screen_dir and screen_file in startup JSON
- stop-server.sh takes screen_dir arg and cleans up session directory
- Document blocking TaskOutput pattern: 10-min timeouts, retry up to 3x,
then prompt user "let me know when you want to continue"
This commit is contained in:
@@ -6,32 +6,34 @@ Quick reference for using the visual brainstorming companion.
|
||||
|
||||
| File | Purpose |
|
||||
|------|---------|
|
||||
| `lib/brainstorm-server/start-server.sh` | Start server, outputs JSON with URL |
|
||||
| `lib/brainstorm-server/stop-server.sh` | Stop server and clean up |
|
||||
| `lib/brainstorm-server/start-server.sh` | Start server, outputs JSON with URL and session paths |
|
||||
| `lib/brainstorm-server/stop-server.sh` | Stop server and clean up session directory |
|
||||
| `lib/brainstorm-server/wait-for-event.sh` | Wait for user feedback |
|
||||
| `lib/brainstorm-server/frame-template.html` | Base HTML template with CSS |
|
||||
| `lib/brainstorm-server/CLAUDE-INSTRUCTIONS.md` | Detailed usage guide |
|
||||
| `/tmp/brainstorm/screen.html` | Write your screens here |
|
||||
| `/tmp/brainstorm/.server.log` | Server output (for watcher) |
|
||||
|
||||
## Quick Start
|
||||
|
||||
```bash
|
||||
# 1. Start server
|
||||
# 1. Start server (creates unique session directory)
|
||||
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/start-server.sh
|
||||
# Returns: {"type":"server-started","port":52341,"url":"http://localhost:52341"}
|
||||
# Returns: {"type":"server-started","port":52341,"url":"http://localhost:52341",
|
||||
# "screen_dir":"/tmp/brainstorm-12345-1234567890",
|
||||
# "screen_file":"/tmp/brainstorm-12345-1234567890/screen.html"}
|
||||
|
||||
# 2. Write screen
|
||||
# Write HTML to /tmp/brainstorm/screen.html
|
||||
# 2. Write screen to the session's screen_file
|
||||
# Use Bash with heredoc to write HTML
|
||||
|
||||
# 3. Wait for feedback (background)
|
||||
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/wait-for-event.sh /tmp/brainstorm/.server.log
|
||||
|
||||
# 4. Read watcher output when it completes
|
||||
# 3. Wait for feedback using TaskOutput with block=true
|
||||
# Start watcher in background:
|
||||
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/wait-for-event.sh $SCREEN_DIR/.server.log
|
||||
# Then call TaskOutput(task_id, block=true, timeout=600000) to wait
|
||||
# If timeout, call TaskOutput again (watcher still running)
|
||||
# After 3 timeouts (30 min), say "Let me know when you want to continue"
|
||||
# Returns: {"choice":"a","feedback":"user notes"}
|
||||
|
||||
# 5. Clean up when done
|
||||
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/stop-server.sh
|
||||
# 4. Clean up when done (pass screen_dir as argument)
|
||||
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/stop-server.sh $SCREEN_DIR
|
||||
```
|
||||
|
||||
## CSS Classes
|
||||
|
||||
Reference in New Issue
Block a user