Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
chore: remove dead code and stale ignore entries
trohitgdbcdf75c8a42
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.ymldeleted file mode 100644index e9ac150c..00000000--- a/.github/workflows/docs.yml+++ /dev/null@@ -1,26 +0,0 @@-# Deploy Mintlify docs on push to docs-OpenCompany/.-name: Deploy Docs--on:- push:- branches: [main]- paths:- - 'docs-OpenCompany/**'- workflow_dispatch:--permissions:- contents: read--jobs:- deploy:- runs-on: ubuntu-latest- steps:- - uses: actions/checkout@v4- - uses: actions/setup-node@v4- with:- node-version: '22'- - run: npm install -g mintlify- - working-directory: docs-OpenCompany- env:- MINTLIFY_TOKEN: ${{ secrets.MINTLIFY_TOKEN }}- run: mintlify deploydiff --git a/.gitignore b/.gitignoreindex 49be0dd6..fd1c9920 100644--- a/.gitignore+++ b/.gitignore@@ -162,12 +162,6 @@ pnpm-store/server/tests/_test_machina_root/server/tests/_test_opencompany_root/-# =============================================================================-# Documentation (the hosted docs tree is a separate project)-# =============================================================================-docs-OpenCompany/-docs-MachinaOs/-# =============================================================================# Experiments (work in progress)# =============================================================================diff --git a/.npmignore b/.npmignoreindex 9038ffbd..8a1f3484 100644--- a/.npmignore+++ b/.npmignore@@ -88,10 +88,6 @@ CLAUDE.md# Experiments (work in progress)server/experiments/-# Duplicate folders-OpenCompany/-MachinaOS/-# WhatsApp RPC is now an npm dependency (@anthropic/whatsapp-rpc)# No local whatsapp-rpc directory to excludediff --git a/client/src/components/GenericNode.tsx b/client/src/components/GenericNode.tsxdeleted file mode 100644index a3090770..00000000--- a/client/src/components/GenericNode.tsx+++ /dev/null@@ -1,246 +0,0 @@-import React, { memo, useCallback } from 'react';-import { nodePropsEqual } from './nodeMemoEquality';-import { Handle, Position, NodeProps } from 'reactflow';-import { resolveNodeDescription } from '../lib/nodeSpec';-import { NodeIcon } from '../assets/icons';-import { useNodeSpec } from '../lib/nodeSpec';-import { NodeData, NodeStyle } from '../types/NodeTypes';-import { INodeInputDefinition, INodeOutputDefinition, NodeConnectionType } from '../types/INodeProperties';-import { useAppStore } from '../store/useAppStore';-import { useNodeStatus } from '../contexts/WebSocketContext';-import EditableNodeLabel from './ui/EditableNodeLabel';--const GenericNode: React.FC<NodeProps<NodeData>> = ({ id, type, data, isConnectable, selected }) => {- const setSelectedNode = useAppStore((s) => s.setSelectedNode);- const setRenamingNodeId = useAppStore((s) => s.setRenamingNodeId);- const updateNodeData = useAppStore((s) => s.updateNodeData);- const isDisabled = data?.disabled === true;-- // Per-id slice subscription so an unrelated node's status update does- // not re-render this generic node. Wave 21: visual execution state- // moved to per-theme CSS via the `.executing` class on the wrapper —- // we keep the subscription so future state-driven CSS toggles can- // read it without refactoring.- useNodeStatus(id);-- // Wave 6 Phase 3e: backend NodeSpec -> legacy fallback- const definition = type ? resolveNodeDescription(type) : null;- // Wave 10.B: reactive spec subscription keeps the icon fresh the- // moment the prefetch lands (no waiting for parent re-render).- const iconSpec = useNodeSpec(type);-- const defaultLabel = definition?.displayName || type || '';- const handleLabelChange = useCallback(- (newLabel: string) => updateNodeData(id, { label: newLabel }),- [id, updateNodeData]- );- const handleLabelActivate = useCallback(- () => setRenamingNodeId(id),- [id, setRenamingNodeId]- );-- const handleParametersClick = (e: React.MouseEvent) => {- e.stopPropagation();- setSelectedNode({ id, type, data, position: { x: 0, y: 0 } });- };-- if (!type || !definition) {- return (- <div style={{- padding: '8px 12px',- backgroundColor: 'var(--destructive)',- color: 'white',- borderRadius: '8px',- fontSize: '12px',- minWidth: '120px',- textAlign: 'center'- }}>- Unknown node type- </div>- );- }-- // Helper functions to get inputs/outputs for both enhanced and legacy nodes- const getNodeInputs = (): INodeInputDefinition[] => {- if (!definition.inputs) return [];-- // Enhanced nodes: array of input objects- if (definition.inputs.length > 0 && typeof definition.inputs[0] === 'object') {- return definition.inputs as INodeInputDefinition[];- }-- // Legacy nodes: array of strings - convert to input objects- return (definition.inputs as string[]).map((input, index) => ({- name: `input_${index}`,- displayName: 'Input',- type: (input as NodeConnectionType) || 'main',- description: 'Node input connection'- }));- };-- const getNodeOutputs = (): INodeOutputDefinition[] => {- if (!definition.outputs) return [];-- // Enhanced nodes: array of output objects- if (definition.outputs.length > 0 && typeof definition.outputs[0] === 'object') {- return definition.outputs as INodeOutputDefinition[];- }-- // Legacy nodes: array of strings - convert to output objects- return (definition.outputs as string[]).map((output, index) => ({- name: `output_${index}`,- displayName: 'Output',- type: (output as NodeConnectionType) || 'main',- description: 'Node output connection'- }));- };-- const nodeInputs = getNodeInputs();- const nodeOutputs = getNodeOutputs();-- // Node accent color — feeds the `--node-color` CSS custom property- // on the wrapper. Handle borders/backgrounds are now owned by- // `.node-handle` in base.css + per-theme overrides (Wave 26.C).- const getNodeColor = () => definition.defaults.color || 'var(--fg-muted)';-- return (- // `node` + `selected` co-classes activate per-theme generic-node- // decorations (wax seal on Renaissance, neon LED on Cyber, etc.).- <div- className={`node ${selected ? 'selected' : ''}`}- style={{- '--node-color': getNodeColor(),- position: 'relative',- padding: '12px 32px 12px 16px',- minWidth: '160px',- minHeight: '60px',- color: 'white',- fontFamily: 'system-ui, -apple-system, sans-serif',- fontSize: '14px',- fontWeight: '600',- textAlign: 'center',- cursor: 'pointer',- transition: 'transform 0.2s ease, border-color 0.2s ease, opacity 0.2s ease',- overflow: 'visible',- opacity: isDisabled ? 0.5 : 1,- } as NodeStyle}- >- {/* Disabled Overlay */}- {isDisabled && (- <div style={{- position: 'absolute',- top: 0,- left: 0,- right: 0,- bottom: 0,- backgroundColor: 'color-mix(in srgb, var(--fg-faint) 40%, transparent)',- borderRadius: 'inherit',- zIndex: 25,- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- pointerEvents: 'none',- }}>- <span style={{ fontSize: '24px', opacity: 0.8 }}>||</span>- </div>- )}- {/* Input Handles - Multiple handles based on node definition.- Visual styling (background, border) owned by `.node-handle.in`- in base.css + per-theme overrides. Inline keeps layout only. */}- {nodeInputs.map((input, index) => {- const totalInputs = nodeInputs.length;- const topPosition = totalInputs === 1 ? '50%' :- `${20 + (60 * index) / Math.max(totalInputs - 1, 1)}%`;-- return (- <Handle- key={`input-${input.name}-${index}`}- id={`input-${input.name}`}- type="target"- position={Position.Left}- isConnectable={isConnectable}- className="node-handle in"- style={{- position: 'absolute',- left: '-6px',- top: topPosition,- transform: 'translateY(-50%)',- width: '12px',- height: '12px',- borderRadius: '50%'- }}- title={`${input.displayName}: ${input.description}`}- />- );- })}--- {/* Parameters Button — visual styles (background, border, hover)- owned by `.node-gear` in base.css + per-theme overrides.- Inline keeps positioning + label color only. */}- <button- onClick={handleParametersClick}- className="node-gear absolute top-2 right-2 z-20 flex h-5 w-5 cursor-pointer items-center justify-center rounded-full text-[10px] font-semibold transition-all duration-200 hover:scale-115"- style={{ color: getNodeColor() }}- title="Edit Parameters"- >- ⚙️- </button>-- <div style={{- display: 'flex',- alignItems: 'center',- justifyContent: 'center',- gap: '8px',- position: 'relative',- zIndex: 10,- paddingRight: '4px'- }}>- <NodeIcon- icon={iconSpec?.icon ?? definition.icon}- className="h-6 w-6 text-2xl"- />- <EditableNodeLabel- nodeId={id}- label={data?.label}- defaultLabel={defaultLabel}- onLabelChange={handleLabelChange}- onActivate={handleLabelActivate}- className="m-0 max-w-full truncate"- />- </div>--- {/* Output Handles - Multiple handles based on node definition.- Visual styling owned by `.node-handle.out` in base.css. */}- {nodeOutputs.map((output, index) => {- const totalOutputs = nodeOutputs.length;- const topPosition = totalOutputs === 1 ? '50%' :- `${20 + (60 * index) / Math.max(totalOutputs - 1, 1)}%`;-- return (- <Handle- key={`output-${output.name}-${index}`}- id={`output-${output.name}`}- type="source"- position={Position.Right}- isConnectable={isConnectable}- className="node-handle out"- style={{- position: 'absolute',- right: '-6px',- top: topPosition,- transform: 'translateY(-50%)',- width: '12px',- height: '12px',- borderRadius: '50%'- }}- title={`${output.displayName}: ${output.description}`}- />- );- })}- </div>- );-};--export default memo(GenericNode, nodePropsEqual);\ No newline at end of filediff --git a/client/src/components/OutputPanel.tsx b/client/src/components/OutputPanel.tsxdeleted file mode 100644index dcdd796f..00000000--- a/client/src/components/OutputPanel.tsx+++ /dev/null@@ -1,391 +0,0 @@-import React, { useState } from 'react';-import { useAppStore } from '../store/useAppStore';-import { INodeOutputDefinition, NodeConnectionType } from '../types/INodeProperties';-import { useDragVariable } from '../hooks/useDragVariable';-import { isNodeInBackendGroup } from '../lib/nodeSpec';--import { resolveNodeDescription } from '../lib/nodeSpec';-interface OutputPanelProps {- nodeId: string;-}--interface ConnectedNodeData {- nodeId: string;- nodeName: string;- outputs: INodeOutputDefinition[];-}--// Android node output schemas - matches the flattened output structure from backend-// These are shown as draggable outputs for template variable creation-const ANDROID_OUTPUT_SCHEMAS: Record<string, Record<string, string>> = {- batteryMonitor: {- battery_level: 'number',- is_charging: 'boolean',- temperature_celsius: 'number',- health: 'string',- voltage: 'number'- },- systemInfo: {- device_model: 'string',- android_version: 'string',- api_level: 'number',- manufacturer: 'string',- total_memory: 'number',- available_memory: 'number'- },- networkMonitor: {- connected: 'boolean',- type: 'string',- ssid: 'string',- ip_address: 'string',- signal_strength: 'number'- },- wifiAutomation: {- enabled: 'boolean',- connected: 'boolean',- ssid: 'string',- networks: 'array'- },- bluetoothAutomation: {- enabled: 'boolean',- connected: 'boolean',- paired_devices: 'array'- },- audioAutomation: {- media_volume: 'number',- ring_volume: 'number',- muted: 'boolean'- },- location: {- latitude: 'number',- longitude: 'number',- accuracy: 'number',- provider: 'string',- altitude: 'number',- speed: 'number',- bearing: 'number'- },- appLauncher: {- package_name: 'string',- launched: 'boolean',- app_name: 'string'- },- appList: {- apps: 'array',- count: 'number'- },- deviceStateAutomation: {- airplane_mode: 'boolean',- screen_on: 'boolean',- brightness: 'number'- },- screenControlAutomation: {- brightness: 'number',- auto_brightness: 'boolean',- screen_timeout: 'number'- },- motionDetection: {- acceleration_x: 'number',- acceleration_y: 'number',- acceleration_z: 'number',- is_moving: 'boolean'- },- environmentalSensors: {- temperature: 'number',- humidity: 'number',- pressure: 'number',- light: 'number'- },- cameraControl: {- cameras: 'array',- photo_path: 'string'- },- mediaControl: {- playing: 'boolean',- volume: 'number',- track: 'string'- },- airplaneModeControl: {- enabled: 'boolean'- }-};--// List of Android service node types-const ANDROID_NODE_TYPES = [- 'batteryMonitor', 'systemInfo', 'networkMonitor', 'location',- 'wifiAutomation', 'bluetoothAutomation', 'audioAutomation',- 'deviceStateAutomation', 'screenControlAutomation', 'airplaneModeControl',- 'motionDetection', 'environmentalSensors', 'cameraControl', 'mediaControl',- 'appLauncher', 'appList'-];--const OutputPanel: React.FC<OutputPanelProps> = ({ nodeId }) => {- const currentWorkflow = useAppStore((s) => s.currentWorkflow);- const [expandedNode, setExpandedNode] = useState<string | null>(null);- const [isDragging, setIsDragging] = useState(false);- const [draggedParam, setDraggedParam] = useState<{ nodeId: string; output: string } | null>(null);-- // Use the same template variable naming as InputSection for consistency- const { getTemplateVariableName } = useDragVariable(nodeId);-- // Helper to get outputs from a node definition- const getNodeOutputs = (nodeType: string): INodeOutputDefinition[] => {- // Wave 6 Phase 5.b: backend group → legacy fallback- const isAndroid = isNodeInBackendGroup(nodeType, 'android') ?? ANDROID_NODE_TYPES.includes(nodeType);- if (isAndroid) {- const schema = ANDROID_OUTPUT_SCHEMAS[nodeType];- if (schema) {- return Object.entries(schema).map(([name, type]) => ({- name,- displayName: name.split('_').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '),- type: type as NodeConnectionType,- description: `${type} value`- }));- }- }-- const definition = resolveNodeDescription(nodeType);- if (!definition) return [];-- if (!definition.outputs) {- return [{- name: 'output',- displayName: 'Output',- type: 'main' as NodeConnectionType,- description: 'Node output'- }];- } else if (Array.isArray(definition.outputs)) {- if (typeof definition.outputs[0] === 'string') {- return (definition.outputs as string[]).map(outputName => ({- name: outputName,- displayName: outputName.charAt(0).toUpperCase() + outputName.slice(1),- type: 'main' as NodeConnectionType,- description: `${outputName} output`- }));- } else {- return definition.outputs as INodeOutputDefinition[];- }- }- return [{- name: 'output',- displayName: 'Output',- type: 'main' as NodeConnectionType,- description: 'Node output'- }];- };-- // Helper to check if a handle is a config/auxiliary handle (not main data flow)- const isConfigHandle = (handle: string | null | undefined): boolean => {- if (!handle) return false;- // Config handles follow pattern: input-<type> where type is not 'main', 'chat', or 'task'- // Examples: input-memory, input-tools, input-model- // Non-config (data flow) handles: input-main, input-chat, input-task- if (handle.startsWith('input-') && handle !== 'input-main' && handle !== 'input-chat' && handle !== 'input-task') {- return true;- }- return false;- };-- // Helper to check if a node is a config/auxiliary node (connects to config handles).- // Backend auto-derives `uiHints.isConfigNode` from group membership- // (`memory` / `tool`) at registration time — see- // services/plugin/base.py::_derive_auto_ui_hints. Plugins can also- // set the flag explicitly to override.- const isConfigNode = (nodeType: string | undefined): boolean => {- if (!nodeType) return false;- const definition = resolveNodeDescription(nodeType);- return definition?.uiHints?.isConfigNode === true;- };-- // Get connected nodes with their outputs- const getConnectedNodes = (): ConnectedNodeData[] => {- if (!currentWorkflow || !nodeId) return [];-- const connectedNodes: ConnectedNodeData[] = [];- const addedNodeIds = new Set<string>();-- // Helper to add a node to connected list- const addConnectedNode = (sourceNodeId: string, label?: string) => {- if (addedNodeIds.has(sourceNodeId)) return;-- const sourceNode = currentWorkflow.nodes.find(n => n.id === sourceNodeId);- if (!sourceNode?.type) return;-- const sourceDefinition = resolveNodeDescription(sourceNode.type);- if (!sourceDefinition) return;-- addedNodeIds.add(sourceNodeId);- connectedNodes.push({- nodeId: sourceNode.id,- nodeName: label ? `${sourceDefinition.displayName} (${label})` : sourceDefinition.displayName,- outputs: getNodeOutputs(sourceNode.type)- });- };-- // Find all edges that connect TO the current node- const incomingEdges = currentWorkflow.edges.filter(edge => edge.target === nodeId);-- // Get current node info- const currentNode = currentWorkflow.nodes.find(n => n.id === nodeId);- const currentNodeType = currentNode?.type;-- for (const edge of incomingEdges) {- // Skip config handle connections - they're for auxiliary nodes, not main data flow- if (isConfigHandle(edge.targetHandle)) {- continue;- }- addConnectedNode(edge.source);- }-- // If current node is a config node (memory, tool), inherit parent node's main inputs- if (isConfigNode(currentNodeType)) {- // Find which parent node this config node is connected to- const outgoingEdges = currentWorkflow.edges.filter(edge => edge.source === nodeId);-- for (const edge of outgoingEdges) {- // Check if connected to a config handle on the target- if (isConfigHandle(edge.targetHandle)) {- const targetNode = currentWorkflow.nodes.find(n => n.id === edge.target);- if (!targetNode) continue;-- const targetDef = resolveNodeDescription(targetNode.type || '');- const targetName = targetDef?.displayName || targetNode.type;-- // Find nodes connected to the parent's main input (non-config handles)- const parentInputEdges = currentWorkflow.edges.filter(- e => e.target === targetNode.id && !isConfigHandle(e.targetHandle)- );-- for (const parentEdge of parentInputEdges) {- addConnectedNode(parentEdge.source, `via ${targetName}`);- }- }- }- }-- return connectedNodes;- };-- const connectedNodes = getConnectedNodes();-- const handleDragStart = (e: React.DragEvent, sourceNodeId: string, outputName: string) => {- setIsDragging(true);- setDraggedParam({ nodeId: sourceNodeId, output: outputName });- e.dataTransfer.effectAllowed = 'copy';-- // Use the same template naming as InputSection for consistency- // This ensures Android nodes and all other nodes work properly with template variables- const templateName = getTemplateVariableName(sourceNodeId);-- e.dataTransfer.setData('text/plain', `{{${templateName}.${outputName}}}`);- };-- const handleDragEnd = () => {- setIsDragging(false);- setDraggedParam(null);- };-- if (connectedNodes.length === 0) {- return (- <div- className="flex h-full flex-col items-center justify-center border-r border-border-default bg-bg-panel p-3"- style={{ width: '300px' }}- >- <p className="m-0 text-center text-sm italic text-fg-muted">- No connected nodes.- <br />- Connect nodes to see their outputs here.- </p>- </div>- );- }-- return (- <div- className="flex h-full flex-col border-r border-border-default bg-bg-panel"- style={{ width: '300px' }}- >- {/* Header */}- <div className="border-b border-border-default bg-bg-panel p-3 font-display text-sm font-semibold tracking-[var(--type-tracking-display)] text-fg-default [text-transform:var(--type-uppercase)]">- Connected Outputs- </div>-- {/* Scrollable content */}- <div className="flex-1 overflow-y-auto p-2">- {connectedNodes.map((node) => (- <div- key={node.nodeId}- className="mb-1 overflow-hidden rounded-sm border border-border-default bg-bg-elevated"- >- <div- onClick={() => setExpandedNode(expandedNode === node.nodeId ? null : node.nodeId)}- className="flex cursor-pointer items-center justify-between bg-bg-panel p-2 transition-colors"- >- <span className="text-sm font-medium text-fg-default">- {node.nodeName}- </span>- <span- className="text-xs text-fg-muted"- style={{- transform: expandedNode === node.nodeId ? 'rotate(180deg)' : 'rotate(0deg)',- transition: 'transform 0.2s ease'- }}- >- ▼- </span>- </div>-- {expandedNode === node.nodeId && (- <div className="border-t border-border-default p-2">- {node.outputs.length === 0 ? (- <p className="m-0 p-1 text-xs italic text-fg-muted">- No output parameters available- </p>- ) : (- node.outputs.map((output) => {- const isActiveDrag =- isDragging &&- draggedParam?.nodeId === node.nodeId &&- draggedParam?.output === output.name;- return (- <div- key={output.name}- draggable- onDragStart={(e) => handleDragStart(e, node.nodeId, output.name)}- onDragEnd={handleDragEnd}- className={`mb-1 cursor-grab rounded-sm border border-border-default p-1 transition-colors ${- isActiveDrag ? 'bg-accent' : 'bg-bg-panel'- }`}- >- <div className="flex items-center justify-between">- <div>- <div className="mb-0.5 text-sm font-medium text-fg-default">- {output.displayName}- </div>- <div className="text-xs text-fg-muted">- {output.type} • {output.description}- </div>- </div>- <div className="rounded-sm border border-border-default bg-bg-elevated px-1 py-0.5 font-mono text-xs text-fg-muted">- {output.name}- </div>- </div>- </div>- );- })- )}- </div>- )}- </div>- ))}- </div>-- {/* Footer */}- <div className="border-t border-border-default bg-bg-panel p-2 text-center text-xs text-fg-muted">- Drag outputs to parameter fields- </div>- </div>- );-};--export default OutputPanel;diff --git a/client/src/components/parameterPanel/__tests__/OutputSection.test.tsx b/client/src/components/parameterPanel/__tests__/OutputSection.test.tsxindex ab14d808..ab74cbea 100644--- a/client/src/components/parameterPanel/__tests__/OutputSection.test.tsx+++ b/client/src/components/parameterPanel/__tests__/OutputSection.test.tsx@@ -2,7 +2,7 @@* Tests for OutputSection -- specifically the combineResults logic.** Locks in:- * - executionResults are passed through to NodeOutputPanel+ * - executionResults are passed through to the output panel* - nodeStatus from WebSocket is folded in (newest first) when not already present* - Duplicate detection compares outputs via JSON.stringify* - visible=false renders nothingdiff --git a/client/src/components/ui/EditableNodeLabel.tsx b/client/src/components/ui/EditableNodeLabel.tsxindex 14969713..d72f7f27 100644--- a/client/src/components/ui/EditableNodeLabel.tsx+++ b/client/src/components/ui/EditableNodeLabel.tsx@@ -2,7 +2,7 @@* EditableNodeLabel — shared inline-rename input for canvas node components.** Encapsulates the dup'd pattern across StartNode, SquareNode, TriggerNode,- * ToolkitNode, GenericNode:+ * ToolkitNode:* - sync local edit state with the global `useAppStore.renamingNodeId`* - focus + select the input on enter* - Enter saves, Escape cancels, blur savesdiff --git a/client/src/components/ui/OutputDisplayPanel.tsx b/client/src/components/ui/OutputDisplayPanel.tsxdeleted file mode 100644index 703051da..00000000--- a/client/src/components/ui/OutputDisplayPanel.tsx+++ /dev/null@@ -1,294 +0,0 @@-import React, { useState } from 'react';-import Prism from 'prismjs';-import 'prismjs/components/prism-json';-import {- Play,- CheckCircle2,- XCircle,- ChevronRight,- Trash2,- Copy,-} from 'lucide-react';-import { Badge } from '@/components/ui/badge';-import { Button } from '@/components/ui/button';-import { cn } from '@/lib/utils';-import { ExecutionResult } from '../../services/executionService';-import { copyToClipboard, formatTimestamp } from '../../utils/formatters';--interface OutputDisplayPanelProps {- results: ExecutionResult[];- onClear?: () => void;- selectedNode?: any;- currentWorkflow?: any;-}--// ----------------------------------------------------------------------------// Output transforms — render structured tool output as readable text.-// -----------------------------------------------------------------------------const getExecutionData = (result: ExecutionResult) => {- if (result.outputs) return result.outputs;- if (result.data?.data) return result.data.data;- return { message: 'No output data' };-};--const formatFilesystemOutput = (data: any): string | null => {- const r = data?.result || data;- if (!r) return null;-- if (r.content && r.file_path) {- return `File: ${r.file_path}\n\n${r.content}`;- }- if (r.operation === 'write' && r.file_path) {- return `Written: ${r.file_path}`;- }- if (r.operation === 'edit' && r.file_path) {- return `Edited: ${r.file_path} (${r.occurrences || 1} replacement${(r.occurrences || 1) > 1 ? 's' : ''})`;- }- if (r.command !== undefined && r.stdout !== undefined) {- const status = r.exit_code === 0 ? 'OK' : `Exit ${r.exit_code}`;- const output = r.stdout || '(no output)';- return `$ ${r.command}\n[${status}]\n\n${output}`;- }- if (r.entries && Array.isArray(r.entries)) {- const lines = r.entries.map((e: any) =>- `${e.type === 'dir' ? '[DIR]' : ' '} ${e.name}${e.size != null ? ` (${e.size} bytes)` : ''}`- );- return `${r.path || '.'} (${r.count || r.entries.length} items)\n\n${lines.join('\n')}`;- }- if (r.matches && Array.isArray(r.matches)) {- if (r.matches.length === 0) return `No matches for "${r.pattern}"`;- const lines = r.matches.slice(0, 50).map((m: any) =>- m.line ? `${m.path}:${m.line}: ${m.text}` : (m.path || JSON.stringify(m))- );- const suffix = r.count > 50 ? `\n... and ${r.count - 50} more` : '';- return `${r.count || r.matches.length} match${(r.count || r.matches.length) > 1 ? 'es' : ''} for "${r.pattern}"\n\n${lines.join('\n')}${suffix}`;- }- return null;-};--const formatTodoOutput = (data: any): string | null => {- const r = data?.result || data;- if (!r) return null;-- let todos: any[] = [];- if (typeof r.todos === 'string') {- try { todos = JSON.parse(r.todos); } catch { return null; }- } else if (Array.isArray(r.todos)) {- todos = r.todos;- } else {- return null;- }-- if (todos.length === 0) return r.message || 'Todo list is empty.';-- const statusIcon: Record<string, string> = {- pending: '[ ]',- in_progress: '[~]',- completed: '[x]',- };- const lines = todos.map((t: any, i: number) => {- const icon = statusIcon[t.status] || '[ ]';- return `${i + 1}. ${icon} ${t.content}`;- });-- const counts = {- pending: todos.filter((t: any) => t.status === 'pending').length,- in_progress: todos.filter((t: any) => t.status === 'in_progress').length,- completed: todos.filter((t: any) => t.status === 'completed').length,- };- const summary = `${todos.length} items: ${counts.completed} done, ${counts.in_progress} active, ${counts.pending} pending`;-- return `${summary}\n\n${lines.join('\n')}`;-};--const getMainResponse = (result: ExecutionResult): string | null => {- const data = getExecutionData(result);-- const fsOutput = formatFilesystemOutput(data);- if (fsOutput) return fsOutput;-- const todoOutput = formatTodoOutput(data);- if (todoOutput) return todoOutput;-- if (data?.result?.response) return data.result.response;- if (data?.response) return data.response;- if (data?.result?.text) return data.result.text;- if (data?.text) return data.text;- if (data?.result?.content) return data.result.content;- if (data?.content) return data.content;- if (data?.result?.message) return data.result.message;- if (data?.message && typeof data.message === 'string') return data.message;- return null;-};--// ----------------------------------------------------------------------------// Main panel-// -----------------------------------------------------------------------------const OutputDisplayPanel: React.FC<OutputDisplayPanelProps> = ({ results, onClear }) => {- const [expandedResults, setExpandedResults] = useState<Set<string>>(new Set());-- const toggleExpand = (key: string) => {- setExpandedResults(prev => {- const next = new Set(prev);- if (next.has(key)) next.delete(key);- else next.add(key);- return next;- });- };-- if (results.length === 0) {- return (- <div className="flex h-full flex-col items-center justify-center bg-muted p-12 text-muted-foreground">- <Play className="mb-4 h-12 w-12 stroke-1" />- <div className="mb-1 text-base font-medium text-foreground">No executions yet</div>- <div className="text-center text-sm text-muted-foreground">- Run nodes to see their<br />execution results here- </div>- </div>- );- }-- return (- <div className="flex h-full flex-col bg-muted">- {/* Header */}- <div className="flex items-center justify-between border-b border-border bg-background px-4 py-3">- <div className="flex items-center gap-2">- <Play className="h-4 w-4 text-success" />- <span className="font-display text-sm font-semibold tracking-[var(--type-tracking-display)] text-fg-default [text-transform:var(--type-uppercase)]">Execution Results</span>- <Badge variant="secondary" className="text-xs">{results.length}</Badge>- </div>- {onClear && (- <Button variant="outline" size="sm" onClick={onClear}>- <Trash2 className="h-3 w-3" />- Clear- </Button>- )}- </div>-- {/* Results List */}- <div className="flex-1 space-y-3 overflow-y-auto p-3">- {results.map((result, index) => {- const resultKey = `${result.nodeId}-${result.timestamp}-${index}`;- const isExpanded = expandedResults.has(resultKey);- const mainResponse = getMainResponse(result);- const executionData = getExecutionData(result);-- return (- <div- key={resultKey}- className={cn(- 'overflow-hidden rounded-md border bg-background',- result.success ? 'border-success/40' : 'border-destructive/40'- )}- >- {/* Result Header */}- <div- className={cn(- 'flex items-center justify-between border-b px-3 py-2',- result.success- ? 'border-success/30 bg-success/10'- : 'border-destructive/30 bg-destructive/10'- )}- >- <div className="flex items-center gap-2">- {result.success ? (- <CheckCircle2 className="h-4 w-4 text-success" />- ) : (- <XCircle className="h-4 w-4 text-destructive" />- )}- <span className="text-sm font-semibold text-foreground">- {result.nodeName}- </span>- <Badge variant={result.success ? 'success' : 'destructive'} className="text-xs">- {result.success ? 'SUCCESS' : 'FAILED'}- </Badge>- </div>- <div className="flex items-center gap-3 text-xs text-muted-foreground">- <span>{result.executionTime.toFixed(2)}ms</span>- <span>{formatTimestamp(result.timestamp)}</span>- </div>- </div>-- {/* Error Display */}- {result.error && (- <div className="border-b border-destructive/30 bg-destructive/10 p-3">- <pre className="m-0 font-mono text-sm whitespace-pre-wrap break-words text-destructive">- {result.error}- </pre>- </div>- )}-- {/* Main Response (for AI / tool results) */}- {mainResponse && (- <div className="border-b border-border p-3">- <div className="mb-2 text-xs font-medium tracking-wider text-muted-foreground uppercase">- Response- </div>- <div className="text-sm leading-relaxed whitespace-pre-wrap break-words text-foreground">- {mainResponse}- </div>- </div>- )}-- {/* JSON Output Toggle */}- <div className="p-3">- <div- onClick={() => toggleExpand(resultKey)}- className="flex cursor-pointer items-center justify-between rounded-sm bg-muted px-3 py-2 transition-colors hover:bg-card"- >- <div className="flex items-center gap-2">- <ChevronRight- className={cn(- 'h-3 w-3 text-muted-foreground transition-transform',- isExpanded && 'rotate-90'- )}- />- <span className="text-xs font-medium text-muted-foreground">- {isExpanded ? 'Hide' : 'Show'} Raw JSON- </span>- </div>- <Button- variant="outline"- size="xs"- onClick={(e) => {- e.stopPropagation();- copyToClipboard(executionData, 'JSON copied to clipboard!');- }}- >- <Copy className="h-3 w-3" />- Copy- </Button>- </div>-- {/* Expanded JSON with prismjs highlighting via shared- * .code-editor-container palette (see index.css). */}- {isExpanded && (- <div className="code-editor-container mt-2 max-h-[300px] overflow-auto rounded-sm border border-border bg-muted p-3 font-mono text-xs text-foreground">- <code- dangerouslySetInnerHTML={{- __html: Prism.highlight(- JSON.stringify(executionData, null, 2),- Prism.languages.json,- 'json',- ),- }}- />- </div>- )}- </div>- </div>- );- })}- </div>-- {/* Footer */}- <div className="border-t border-border bg-background px-4 py-2 text-center text-xs text-muted-foreground">- Results displayed in execution order- </div>- </div>- );-};--export default OutputDisplayPanel;diff --git a/client/src/styles/theme.ts b/client/src/styles/theme.tsindex cf594ff8..3bc19e33 100644--- a/client/src/styles/theme.ts+++ b/client/src/styles/theme.ts@@ -547,8 +547,8 @@ export const styles = {backgroundColor: theme.colors.background,},- // Code block / syntax highlighted JSON (prismjs) — used by- // NodeOutputPanel, OutputDisplayPanel, and any future JSON display.+ // Code block / syntax highlighted JSON (prismjs) — used by JSON+ // display surfaces (active renderer: components/output/OutputPanel).// Token colors use dracula palette for consistency with CodeEditor.codeBlock: {container: {