2 Commits

Author SHA1 Message Date
acd04dd6ac 🎉 BREAKTHROUGH: WebSocket working! Real-time streaming functional
 What's Working:
- WebSocket connections established (patched worker to intercept upgrades)
- Real-time event streaming: Agent → DO → Browser
- Terminal panel showing live command execution
- Agent chat panel showing LLM thoughts
- Full infrastructure: UI → API → DO → SSH Proxy → LangGraph Agent

🔧 Key Changes:
- Created standalone DO worker at workers/bandit-agent-do/
- Deployed DO as separate Worker (bandit-agent-do)
- Updated wrangler.jsonc to reference external DO via script_name
- Modified patch-worker.js to intercept WS upgrades before Next.js
- Added __name polyfill to fix esbuild helper
- Created pnpm workspace config for monorepo

📝 Architecture:
- Frontend (Next.js) → Cloudflare Worker
- Worker intercepts /api/agent/*/ws → forwards to DO
- DO (bandit-agent-do) → manages WebSocket connections
- DO → calls SSH Proxy API
- SSH Proxy → runs LangGraph agent → executes SSH commands
- Events stream back: SSH Proxy → DO → WebSocket → UI

🐛 Known Issue:
- Agent logic needs refinement (not parsing SSH output correctly)
- But core infrastructure is 100% functional!

This resolves all WebSocket and real-time streaming issues.
2025-10-09 15:10:16 -06:00
4a517dfa97 Fix __name polyfill - app now loads without errors
- Added globalThis.__name polyfill in layout.tsx head using dangerouslySetInnerHTML
- Fixed wrangler.jsonc to use inline DO (removed script_name reference)
- Fixed patch-worker.js duplicate detection
- Updated todos: WebSocket still needs debugging but core app is functional
2025-10-09 14:27:03 -06:00