 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>
		
			
				
	
	
		
			125 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			125 lines
		
	
	
		
			4.8 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| import { isNumericalString } from '../../utils/is-numerical-string.mjs';
 | |
| import { isZeroValueString } from '../../utils/is-zero-value-string.mjs';
 | |
| import { resolveFinalValueInKeyframes } from '../../utils/resolve-value.mjs';
 | |
| import { motionValue } from '../../value/index.mjs';
 | |
| import { complex } from '../../value/types/complex/index.mjs';
 | |
| import { getAnimatableNone } from '../dom/value-types/animatable-none.mjs';
 | |
| import { findValueType } from '../dom/value-types/find.mjs';
 | |
| import { resolveVariant } from './resolve-dynamic-variants.mjs';
 | |
| 
 | |
| /**
 | |
|  * Set VisualElement's MotionValue, creating a new MotionValue for it if
 | |
|  * it doesn't exist.
 | |
|  */
 | |
| function setMotionValue(visualElement, key, value) {
 | |
|     if (visualElement.hasValue(key)) {
 | |
|         visualElement.getValue(key).set(value);
 | |
|     }
 | |
|     else {
 | |
|         visualElement.addValue(key, motionValue(value));
 | |
|     }
 | |
| }
 | |
| function setTarget(visualElement, definition) {
 | |
|     const resolved = resolveVariant(visualElement, definition);
 | |
|     let { transitionEnd = {}, transition = {}, ...target } = resolved ? visualElement.makeTargetAnimatable(resolved, false) : {};
 | |
|     target = { ...target, ...transitionEnd };
 | |
|     for (const key in target) {
 | |
|         const value = resolveFinalValueInKeyframes(target[key]);
 | |
|         setMotionValue(visualElement, key, value);
 | |
|     }
 | |
| }
 | |
| function setVariants(visualElement, variantLabels) {
 | |
|     const reversedLabels = [...variantLabels].reverse();
 | |
|     reversedLabels.forEach((key) => {
 | |
|         const variant = visualElement.getVariant(key);
 | |
|         variant && setTarget(visualElement, variant);
 | |
|         if (visualElement.variantChildren) {
 | |
|             visualElement.variantChildren.forEach((child) => {
 | |
|                 setVariants(child, variantLabels);
 | |
|             });
 | |
|         }
 | |
|     });
 | |
| }
 | |
| function setValues(visualElement, definition) {
 | |
|     if (Array.isArray(definition)) {
 | |
|         return setVariants(visualElement, definition);
 | |
|     }
 | |
|     else if (typeof definition === "string") {
 | |
|         return setVariants(visualElement, [definition]);
 | |
|     }
 | |
|     else {
 | |
|         setTarget(visualElement, definition);
 | |
|     }
 | |
| }
 | |
| function checkTargetForNewValues(visualElement, target, origin) {
 | |
|     var _a, _b;
 | |
|     const newValueKeys = Object.keys(target).filter((key) => !visualElement.hasValue(key));
 | |
|     const numNewValues = newValueKeys.length;
 | |
|     if (!numNewValues)
 | |
|         return;
 | |
|     for (let i = 0; i < numNewValues; i++) {
 | |
|         const key = newValueKeys[i];
 | |
|         const targetValue = target[key];
 | |
|         let value = null;
 | |
|         /**
 | |
|          * If the target is a series of keyframes, we can use the first value
 | |
|          * in the array. If this first value is null, we'll still need to read from the DOM.
 | |
|          */
 | |
|         if (Array.isArray(targetValue)) {
 | |
|             value = targetValue[0];
 | |
|         }
 | |
|         /**
 | |
|          * If the target isn't keyframes, or the first keyframe was null, we need to
 | |
|          * first check if an origin value was explicitly defined in the transition as "from",
 | |
|          * if not read the value from the DOM. As an absolute fallback, take the defined target value.
 | |
|          */
 | |
|         if (value === null) {
 | |
|             value = (_b = (_a = origin[key]) !== null && _a !== void 0 ? _a : visualElement.readValue(key)) !== null && _b !== void 0 ? _b : target[key];
 | |
|         }
 | |
|         /**
 | |
|          * If value is still undefined or null, ignore it. Preferably this would throw,
 | |
|          * but this was causing issues in Framer.
 | |
|          */
 | |
|         if (value === undefined || value === null)
 | |
|             continue;
 | |
|         if (typeof value === "string" &&
 | |
|             (isNumericalString(value) || isZeroValueString(value))) {
 | |
|             // If this is a number read as a string, ie "0" or "200", convert it to a number
 | |
|             value = parseFloat(value);
 | |
|         }
 | |
|         else if (!findValueType(value) && complex.test(targetValue)) {
 | |
|             value = getAnimatableNone(key, targetValue);
 | |
|         }
 | |
|         visualElement.addValue(key, motionValue(value, { owner: visualElement }));
 | |
|         if (origin[key] === undefined) {
 | |
|             origin[key] = value;
 | |
|         }
 | |
|         if (value !== null)
 | |
|             visualElement.setBaseTarget(key, value);
 | |
|     }
 | |
| }
 | |
| function getOriginFromTransition(key, transition) {
 | |
|     if (!transition)
 | |
|         return;
 | |
|     const valueTransition = transition[key] || transition["default"] || transition;
 | |
|     return valueTransition.from;
 | |
| }
 | |
| function getOrigin(target, transition, visualElement) {
 | |
|     const origin = {};
 | |
|     for (const key in target) {
 | |
|         const transitionOrigin = getOriginFromTransition(key, transition);
 | |
|         if (transitionOrigin !== undefined) {
 | |
|             origin[key] = transitionOrigin;
 | |
|         }
 | |
|         else {
 | |
|             const value = visualElement.getValue(key);
 | |
|             if (value) {
 | |
|                 origin[key] = value.get();
 | |
|             }
 | |
|         }
 | |
|     }
 | |
|     return origin;
 | |
| }
 | |
| 
 | |
| export { checkTargetForNewValues, getOrigin, getOriginFromTransition, setTarget, setValues };
 |