 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>
		
			
				
	
	
		
			93 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			93 lines
		
	
	
		
			5.0 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { getDefaultOptions } from "../_lib/defaultOptions/index.js";
 | |
| import differenceInCalendarDays from "../differenceInCalendarDays/index.js";
 | |
| import format from "../format/index.js";
 | |
| import defaultLocale from "../_lib/defaultLocale/index.js";
 | |
| import subMilliseconds from "../subMilliseconds/index.js";
 | |
| import toDate from "../toDate/index.js";
 | |
| import getTimezoneOffsetInMilliseconds from "../_lib/getTimezoneOffsetInMilliseconds/index.js";
 | |
| import requiredArgs from "../_lib/requiredArgs/index.js";
 | |
| import toInteger from "../_lib/toInteger/index.js";
 | |
| /**
 | |
|  * @name formatRelative
 | |
|  * @category Common Helpers
 | |
|  * @summary Represent the date in words relative to the given base date.
 | |
|  *
 | |
|  * @description
 | |
|  * Represent the date in words relative to the given base date.
 | |
|  *
 | |
|  * | Distance to the base date | Result                    |
 | |
|  * |---------------------------|---------------------------|
 | |
|  * | Previous 6 days           | last Sunday at 04:30 AM   |
 | |
|  * | Last day                  | yesterday at 04:30 AM     |
 | |
|  * | Same day                  | today at 04:30 AM         |
 | |
|  * | Next day                  | tomorrow at 04:30 AM      |
 | |
|  * | Next 6 days               | Sunday at 04:30 AM        |
 | |
|  * | Other                     | 12/31/2017                |
 | |
|  *
 | |
|  * @param {Date|Number} date - the date to format
 | |
|  * @param {Date|Number} baseDate - the date to compare with
 | |
|  * @param {Object} [options] - an object with options.
 | |
|  * @param {Locale} [options.locale=defaultLocale] - the locale object. See [Locale]{@link https://date-fns.org/docs/Locale}
 | |
|  * @param {0|1|2|3|4|5|6} [options.weekStartsOn=0] - the index of the first day of the week (0 - Sunday)
 | |
|  * @returns {String} the date in words
 | |
|  * @throws {TypeError} 2 arguments required
 | |
|  * @throws {RangeError} `date` must not be Invalid Date
 | |
|  * @throws {RangeError} `baseDate` must not be Invalid Date
 | |
|  * @throws {RangeError} `options.weekStartsOn` must be between 0 and 6
 | |
|  * @throws {RangeError} `options.locale` must contain `localize` property
 | |
|  * @throws {RangeError} `options.locale` must contain `formatLong` property
 | |
|  * @throws {RangeError} `options.locale` must contain `formatRelative` property
 | |
|  *
 | |
|  * @example
 | |
|  * // Represent the date of 6 days ago in words relative to the given base date. In this example, today is Wednesday
 | |
|  * const result = formatRelative(addDays(new Date(), -6), new Date())
 | |
|  * //=> "last Thursday at 12:45 AM"
 | |
|  */
 | |
| export default function formatRelative(dirtyDate, dirtyBaseDate, options) {
 | |
|   var _ref, _options$locale, _ref2, _ref3, _ref4, _options$weekStartsOn, _options$locale2, _options$locale2$opti, _defaultOptions$local, _defaultOptions$local2;
 | |
|   requiredArgs(2, arguments);
 | |
|   var date = toDate(dirtyDate);
 | |
|   var baseDate = toDate(dirtyBaseDate);
 | |
|   var defaultOptions = getDefaultOptions();
 | |
|   var locale = (_ref = (_options$locale = options === null || options === void 0 ? void 0 : options.locale) !== null && _options$locale !== void 0 ? _options$locale : defaultOptions.locale) !== null && _ref !== void 0 ? _ref : defaultLocale;
 | |
|   var weekStartsOn = toInteger((_ref2 = (_ref3 = (_ref4 = (_options$weekStartsOn = options === null || options === void 0 ? void 0 : options.weekStartsOn) !== null && _options$weekStartsOn !== void 0 ? _options$weekStartsOn : options === null || options === void 0 ? void 0 : (_options$locale2 = options.locale) === null || _options$locale2 === void 0 ? void 0 : (_options$locale2$opti = _options$locale2.options) === null || _options$locale2$opti === void 0 ? void 0 : _options$locale2$opti.weekStartsOn) !== null && _ref4 !== void 0 ? _ref4 : defaultOptions.weekStartsOn) !== null && _ref3 !== void 0 ? _ref3 : (_defaultOptions$local = defaultOptions.locale) === null || _defaultOptions$local === void 0 ? void 0 : (_defaultOptions$local2 = _defaultOptions$local.options) === null || _defaultOptions$local2 === void 0 ? void 0 : _defaultOptions$local2.weekStartsOn) !== null && _ref2 !== void 0 ? _ref2 : 0);
 | |
|   if (!locale.localize) {
 | |
|     throw new RangeError('locale must contain localize property');
 | |
|   }
 | |
|   if (!locale.formatLong) {
 | |
|     throw new RangeError('locale must contain formatLong property');
 | |
|   }
 | |
|   if (!locale.formatRelative) {
 | |
|     throw new RangeError('locale must contain formatRelative property');
 | |
|   }
 | |
|   var diff = differenceInCalendarDays(date, baseDate);
 | |
|   if (isNaN(diff)) {
 | |
|     throw new RangeError('Invalid time value');
 | |
|   }
 | |
|   var token;
 | |
|   if (diff < -6) {
 | |
|     token = 'other';
 | |
|   } else if (diff < -1) {
 | |
|     token = 'lastWeek';
 | |
|   } else if (diff < 0) {
 | |
|     token = 'yesterday';
 | |
|   } else if (diff < 1) {
 | |
|     token = 'today';
 | |
|   } else if (diff < 2) {
 | |
|     token = 'tomorrow';
 | |
|   } else if (diff < 7) {
 | |
|     token = 'nextWeek';
 | |
|   } else {
 | |
|     token = 'other';
 | |
|   }
 | |
|   var utcDate = subMilliseconds(date, getTimezoneOffsetInMilliseconds(date));
 | |
|   var utcBaseDate = subMilliseconds(baseDate, getTimezoneOffsetInMilliseconds(baseDate));
 | |
|   var formatStr = locale.formatRelative(token, utcDate, utcBaseDate, {
 | |
|     locale: locale,
 | |
|     weekStartsOn: weekStartsOn
 | |
|   });
 | |
|   return format(date, formatStr, {
 | |
|     locale: locale,
 | |
|     weekStartsOn: weekStartsOn
 | |
|   });
 | |
| } |