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:
Jesse Vincent
2026-01-17 17:25:45 -08:00
parent ac3af07af0
commit d494f5a483
6 changed files with 77 additions and 40 deletions

View File

@@ -15,18 +15,25 @@ Use the visual companion when you need to show:
## Lifecycle
```bash
# Start server (returns JSON with URL)
# Start server (returns JSON with URL and session paths)
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/start-server.sh
# Returns: {"type":"server-started","port":52341,"url":"http://localhost:52341",
# "screen_dir":"/tmp/brainstorm-12345-1234567890",
# "screen_file":"/tmp/brainstorm-12345-1234567890/screen.html"}
# Save screen_dir and screen_file from response!
# Tell user to open the URL in their browser
# Write screens to /tmp/brainstorm/screen.html (auto-refreshes)
# Write screens to screen_file (auto-refreshes)
# Wait for user feedback
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/wait-for-event.sh /path/to/server.log
# Wait for user feedback:
# 1. Start watcher in background
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/wait-for-event.sh $SCREEN_DIR/.server.log
# 2. Immediately call TaskOutput(task_id, block=true) to wait for completion
# When done, stop server
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/stop-server.sh
# When done, stop server (pass screen_dir)
${CLAUDE_PLUGIN_ROOT}/lib/brainstorm-server/stop-server.sh $SCREEN_DIR
```
## Writing Screens