 d7ad321176
			
		
	
	d7ad321176
	
	
	
		
			
			This comprehensive implementation includes: - FastAPI backend with MCP server integration - React/TypeScript frontend with Vite - PostgreSQL database with Redis caching - Grafana/Prometheus monitoring stack - Docker Compose orchestration - Full MCP protocol support for Claude Code integration Features: - Agent discovery and management across network - Visual workflow editor and execution engine - Real-time task coordination and monitoring - Multi-model support with specialized agents - Distributed development task allocation 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			61 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			61 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { JSONRPCMessageSchema } from "../types.js";
 | |
| const SUBPROTOCOL = "mcp";
 | |
| /**
 | |
|  * Client transport for WebSocket: this will connect to a server over the WebSocket protocol.
 | |
|  */
 | |
| export class WebSocketClientTransport {
 | |
|     constructor(url) {
 | |
|         this._url = url;
 | |
|     }
 | |
|     start() {
 | |
|         if (this._socket) {
 | |
|             throw new Error("WebSocketClientTransport already started! If using Client class, note that connect() calls start() automatically.");
 | |
|         }
 | |
|         return new Promise((resolve, reject) => {
 | |
|             this._socket = new WebSocket(this._url, SUBPROTOCOL);
 | |
|             this._socket.onerror = (event) => {
 | |
|                 var _a;
 | |
|                 const error = "error" in event
 | |
|                     ? event.error
 | |
|                     : new Error(`WebSocket error: ${JSON.stringify(event)}`);
 | |
|                 reject(error);
 | |
|                 (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
 | |
|             };
 | |
|             this._socket.onopen = () => {
 | |
|                 resolve();
 | |
|             };
 | |
|             this._socket.onclose = () => {
 | |
|                 var _a;
 | |
|                 (_a = this.onclose) === null || _a === void 0 ? void 0 : _a.call(this);
 | |
|             };
 | |
|             this._socket.onmessage = (event) => {
 | |
|                 var _a, _b;
 | |
|                 let message;
 | |
|                 try {
 | |
|                     message = JSONRPCMessageSchema.parse(JSON.parse(event.data));
 | |
|                 }
 | |
|                 catch (error) {
 | |
|                     (_a = this.onerror) === null || _a === void 0 ? void 0 : _a.call(this, error);
 | |
|                     return;
 | |
|                 }
 | |
|                 (_b = this.onmessage) === null || _b === void 0 ? void 0 : _b.call(this, message);
 | |
|             };
 | |
|         });
 | |
|     }
 | |
|     async close() {
 | |
|         var _a;
 | |
|         (_a = this._socket) === null || _a === void 0 ? void 0 : _a.close();
 | |
|     }
 | |
|     send(message) {
 | |
|         return new Promise((resolve, reject) => {
 | |
|             var _a;
 | |
|             if (!this._socket) {
 | |
|                 reject(new Error("Not connected"));
 | |
|                 return;
 | |
|             }
 | |
|             (_a = this._socket) === null || _a === void 0 ? void 0 : _a.send(JSON.stringify(message));
 | |
|             resolve();
 | |
|         });
 | |
|     }
 | |
| }
 | |
| //# sourceMappingURL=websocket.js.map
 |