# Room Code Image Upload - Implementation Status

## Phase 1: Research (IN PROGRESS)

### 1.1 Enhanced WebSocket Monitor ✅ COMPLETE
- Added binary WebSocket frame detection
- Added HTTP request/response logging
- Added file chooser event handling
- Added automatic file upload triggering (with manual fallback)
- Logs to both console and `image-upload-capture.log`

### 1.2 Capture Real Upload ⏳ WAITING FOR USER
**Action Required:** Run the monitor and upload an image

```bash
cd /Users/erikfredericks/dev-ai/HSO/irc-kosmi-relay
./monitor-ws
```

Then manually upload `blurt.jpg` in the Kosmi chat interface.

**What We're Looking For:**
1. HTTP endpoint for image upload (POST/PUT request)
2. Request format (multipart/form-data, JSON, binary)
3. Required headers (Authorization, Content-Type, etc.)
4. Response format (JSON with URL?)
5. OR: GraphQL mutation for file upload via WebSocket

### 1.3 Document Findings ⏳ PENDING
Once upload is captured, create `KOSMI_IMAGE_UPLOAD.md` with:
- Upload method (HTTP vs WebSocket)
- Endpoint URL
- Authentication requirements
- Request/response format
- Go implementation strategy

## Phase 2: Image Generation (READY TO IMPLEMENT)

Can proceed independently of Phase 1 research.

### 2.1 Room Code Image Generator
Create `bridge/jackbox/roomcode_image.go`:
- Black background (RGB 0,0,0)
- White monospace text
- 200x100 pixels
- Best-fit font size with padding
- Centered text
- Returns PNG bytes

### 2.2 Configuration
Add to `matterbridge.toml`:
```toml
EnableRoomCodeImage=false
```

## Phase 3: Kosmi Upload Client (BLOCKED)

Waiting for Phase 1.2 findings.

## Phase 4: IRC Formatting (READY TO IMPLEMENT)

Can proceed independently.

### 4.1 IRC Formatting Helper
Create `bridge/irc/formatting.go`:
- `FormatRoomCode(code string) string`
- Returns `"\x02\x11" + code + "\x0F"`
- IRC codes: 0x02=bold, 0x11=monospace, 0x0F=reset

## Phase 5: Integration (BLOCKED)

Waiting for Phases 2, 3, and 4.

## Phase 6: Testing (BLOCKED)

Waiting for Phase 5.

## Current Blockers

1. **Phase 1.2** - Need user to run monitor and capture image upload
2. **Phase 1.3** - Need to analyze captured traffic and document findings
3. **Phase 3** - Need Phase 1 findings to implement upload client

## Can Proceed Now

- Phase 2 (Image Generation) - Independent task
- Phase 4 (IRC Formatting) - Independent task

## Next Steps

**Immediate (User Action):**
1. Run `./monitor-ws`
2. Upload `blurt.jpg` in Kosmi chat
3. Press Ctrl+C when done
4. Share `image-upload-capture.log` contents

**After Capture:**
1. Analyze log file
2. Document upload protocol
3. Implement upload client
4. Continue with integration

**Meanwhile (Can Start Now):**
1. Implement image generation (Phase 2)
2. Implement IRC formatting (Phase 4)

