 85bf1341f3
			
		
	
	85bf1341f3
	
	
	
		
			
			Frontend Enhancements: - Complete React TypeScript frontend with modern UI components - Distributed workflows management interface with real-time updates - Socket.IO integration for live agent status monitoring - Agent management dashboard with cluster visualization - Project management interface with metrics and task tracking - Responsive design with proper error handling and loading states Backend Infrastructure: - Distributed coordinator for multi-agent workflow orchestration - Cluster management API with comprehensive agent operations - Enhanced database models for agents and projects - Project service for filesystem-based project discovery - Performance monitoring and metrics collection - Comprehensive API documentation and error handling Documentation: - Complete distributed development guide (README_DISTRIBUTED.md) - Comprehensive development report with architecture insights - System configuration templates and deployment guides The platform now provides a complete web interface for managing the distributed AI cluster with real-time monitoring, workflow orchestration, and agent coordination capabilities. 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
		
			
				
	
	
		
			69 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			69 lines
		
	
	
		
			2.2 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { PACKET_TYPES } from "./commons.js";
 | |
| const withNativeBlob = typeof Blob === "function" ||
 | |
|     (typeof Blob !== "undefined" &&
 | |
|         Object.prototype.toString.call(Blob) === "[object BlobConstructor]");
 | |
| const withNativeArrayBuffer = typeof ArrayBuffer === "function";
 | |
| // ArrayBuffer.isView method is not defined in IE10
 | |
| const isView = (obj) => {
 | |
|     return typeof ArrayBuffer.isView === "function"
 | |
|         ? ArrayBuffer.isView(obj)
 | |
|         : obj && obj.buffer instanceof ArrayBuffer;
 | |
| };
 | |
| const encodePacket = ({ type, data }, supportsBinary, callback) => {
 | |
|     if (withNativeBlob && data instanceof Blob) {
 | |
|         if (supportsBinary) {
 | |
|             return callback(data);
 | |
|         }
 | |
|         else {
 | |
|             return encodeBlobAsBase64(data, callback);
 | |
|         }
 | |
|     }
 | |
|     else if (withNativeArrayBuffer &&
 | |
|         (data instanceof ArrayBuffer || isView(data))) {
 | |
|         if (supportsBinary) {
 | |
|             return callback(data);
 | |
|         }
 | |
|         else {
 | |
|             return encodeBlobAsBase64(new Blob([data]), callback);
 | |
|         }
 | |
|     }
 | |
|     // plain string
 | |
|     return callback(PACKET_TYPES[type] + (data || ""));
 | |
| };
 | |
| const encodeBlobAsBase64 = (data, callback) => {
 | |
|     const fileReader = new FileReader();
 | |
|     fileReader.onload = function () {
 | |
|         const content = fileReader.result.split(",")[1];
 | |
|         callback("b" + (content || ""));
 | |
|     };
 | |
|     return fileReader.readAsDataURL(data);
 | |
| };
 | |
| function toArray(data) {
 | |
|     if (data instanceof Uint8Array) {
 | |
|         return data;
 | |
|     }
 | |
|     else if (data instanceof ArrayBuffer) {
 | |
|         return new Uint8Array(data);
 | |
|     }
 | |
|     else {
 | |
|         return new Uint8Array(data.buffer, data.byteOffset, data.byteLength);
 | |
|     }
 | |
| }
 | |
| let TEXT_ENCODER;
 | |
| export function encodePacketToBinary(packet, callback) {
 | |
|     if (withNativeBlob && packet.data instanceof Blob) {
 | |
|         return packet.data.arrayBuffer().then(toArray).then(callback);
 | |
|     }
 | |
|     else if (withNativeArrayBuffer &&
 | |
|         (packet.data instanceof ArrayBuffer || isView(packet.data))) {
 | |
|         return callback(toArray(packet.data));
 | |
|     }
 | |
|     encodePacket(packet, false, (encoded) => {
 | |
|         if (!TEXT_ENCODER) {
 | |
|             TEXT_ENCODER = new TextEncoder();
 | |
|         }
 | |
|         callback(TEXT_ENCODER.encode(encoded));
 | |
|     });
 | |
| }
 | |
| export { encodePacket };
 |