Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions controller/src/client/js/components/canvas_ui/ProcessGrid.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,9 @@ const ProcessGrid: React.FC<ProcessGridProps> = ({ onProcessSelect }) => {

const colors = isCoreProcess
? {
rgb: `0 0 0`,
bgColor: `rgba(255 255 255)`,
textColor: `rgba(0 0 0 / 0.9)`,
rgb: '0 0 0',
bgColor: 'rgba(255 255 255)',
textColor: 'rgba(0 0 0 / 0.9)',
}
: process.colors;

Expand Down
16 changes: 10 additions & 6 deletions controller/src/client/js/components/column_ui/ChatColumn.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -549,14 +549,16 @@ const ChatColumn: React.FC<ChatColumnProps> = ({
<>
{!isPaused && !isFirstProcess && isAudioEnabled && (
<i
className={`bi bi-volume-up-fill text-primary me-3`}
className={
'bi bi-volume-up-fill text-primary me-3'
}
/>
)}
{!isPaused && !isFirstProcess && isTelegramEnabled && (
<i className={`bi bi-telegram text-primary me-3`} />
<i className={'bi bi-telegram text-primary me-3'} />
)}
<i
className={`bi bi-circle-fill me-3`}
className={'bi bi-circle-fill me-3'}
style={{
color: isPaused
? '#00000'
Expand Down Expand Up @@ -773,7 +775,7 @@ const ChatColumn: React.FC<ChatColumnProps> = ({

{/* Version Manager Button */}
<button
className={`btn btn-sm btn-primary text-white`}
className={'btn btn-sm btn-primary text-white'}
onClick={() =>
setShowVersionManager(!showVersionManager)
}
Expand Down Expand Up @@ -831,9 +833,11 @@ const ChatColumn: React.FC<ChatColumnProps> = ({
toolCallMessage.toolParams.document
) {
document = (
<div className={`mt-2`}>
<div className={'mt-2'}>
<div
className={`d-inline-block p-3 rounded-top-3 bg-white text-black border border-light-subtle rounded-end-3 font-monospace`}
className={
'd-inline-block p-3 rounded-top-3 bg-white text-black border border-light-subtle rounded-end-3 font-monospace'
}
>
<div
style={{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import CustomToolsViewer, { CustomTool } from '../CustomToolsViewer';
import { PRIMARY_RGB } from '../../utils/constants';
import { ProcessData, ProcessStatus } from '../../context/SocketContext';

interface ColumnLayoutProps {}
// No props for now; using explicit empty object type for clarity
type ColumnLayoutProps = Record<string, never>;

const ColumnLayout: React.FC<ColumnLayoutProps> = () => {
const { processes, coreProcessId, costData, isPaused, togglePauseState } =
Expand Down
2 changes: 1 addition & 1 deletion controller/src/client/js/components/column_ui/TreeNode.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ const TreeNode: React.FC<TreeNodeProps> = ({
return (
<div className="tree-node">
<div
className={`d-flex p-2 rounded-2 shadow-sm mb-2`}
className={'d-flex p-2 rounded-2 shadow-sm mb-2'}
style={{
cursor: 'pointer',
marginLeft: `${level * 15}px`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/**
* ToolCallMessage Component compact JSONfirst view (June2025)
* ToolCallMessage Component - compact JSON-first view (June 2025)
* ------------------------------------------------------------------
* • Parameters are now shown ONLY as an interactive JSON tree.
* • The tool/function name wraps the tree with "name(" … ")" lines so it
Expand Down
14 changes: 0 additions & 14 deletions controller/src/client/js/components/message/ToolResultMessage.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,20 +34,6 @@ const ToolResultMessage: React.FC<ToolResultMessageProps> = ({
content = '';
}

const getPreviewText = (): string => {
if (imagePath) {
return `${prepareToolName(message.toolName)} Result (with image)`;
}
if (content) {
const preview =
content.length > 100
? content.substring(0, 100) + '...'
: content;
return `${prepareToolName(message.toolName)} Result: ${preview}`;
}
return `${prepareToolName(message.toolName)} Result`;
};

// If this follows a tool call directly, don't wrap in BaseMessage
if (followsCall) {
return (
Expand Down
2 changes: 1 addition & 1 deletion controller/src/client/js/components/ui/AudioVisualizer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ const AudioVisualizer: React.FC<AudioVisualizerProps> = ({
if (source) {
source.disconnect(analyserRef.current);
}
} catch (e) {
} catch {
// Node might already be disconnected, which is fine
console.debug(
'AudioVisualizer cleanup: Node already disconnected'
Expand Down
2 changes: 1 addition & 1 deletion controller/src/client/js/components/ui/CostDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ const CostDisplay: React.FC<CostDisplayProps> = ({ forceExpand = false }) => {
const formatDateTime = (dateString: string): string => {
try {
return dateTimeFormatter.format(new Date(dateString));
} catch (e) {
} catch {
return 'Invalid Date';
}
};
Expand Down
2 changes: 1 addition & 1 deletion controller/src/client/js/components/ui/LogsViewer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ const LogsViewer: React.FC<LogsViewerProps> = ({
return `${providerPart} (${timeAgo})`;
}
return fileName;
} catch (e) {
} catch {
return fileName;
}
};
Expand Down
2 changes: 1 addition & 1 deletion controller/src/client/js/components/ui/MessageContent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ const MessageContent: React.FC<MessageContentProps> = ({ content }) => {
if (parsed.contentArray && Array.isArray(parsed.contentArray)) {
return <MessageContent content={parsed.contentArray} />;
}
} catch (e) {
} catch {
// Not JSON, render as text
}

Expand Down
3 changes: 2 additions & 1 deletion controller/src/client/js/components/ui/StatusDisplay.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ import * as React from 'react';
import { useSocket } from '../../context/SocketContext';

// No props needed for StatusDisplay
interface StatusDisplayProps {}
// Component does not accept props at the moment
type StatusDisplayProps = Record<string, never>;

/**
* Status Display Component
Expand Down
2 changes: 1 addition & 1 deletion controller/src/client/js/components/ui/TimelinePlayer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -696,7 +696,7 @@ const TimelinePlayer: React.FC<TimelinePlayerProps> = ({
currentPoint.screenshot
);
(e.target as HTMLImageElement).src =
`https://placehold.co/600x400/CCCCCC/4F4F4F?text=Error+Loading+Image`;
'https://placehold.co/600x400/CCCCCC/4F4F4F?text=Error+Loading+Image';
}}
/>
{mode === 'design' &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,9 @@ export const getToolResultContent = (
if (jsonFormat) {
resultContent = JSON.stringify(jsonFormat, null, 4);
}
} catch (e) {}
} catch {
// Ignore invalid JSON
}

return { content: resultContent, imagePath };
};
16 changes: 9 additions & 7 deletions controller/src/client/js/context/SocketContext.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ import {
ConsoleEvent,
DesignEvent,
AgentStatusEvent,
AudioEvent,
} from '../../../types/shared-types';
// Comment out direct import - we'll use simpler approach to avoid TypeScript errors
// import { ContainerConnection, MagiMessage } from '../../../server/managers/communication_manager';
Expand Down Expand Up @@ -284,7 +283,7 @@ export const SocketProvider: React.FC<SocketProviderProps> = ({ children }) => {

// Handle complete app settings updates from the server
socketInstance.on('app_settings_update', (settings: AppSettings) => {
console.log(`Received app_settings_update:`, settings);
console.log('Received app_settings_update:', settings);

// Apply all settings
if (settings.uiMode) {
Expand Down Expand Up @@ -316,7 +315,7 @@ export const SocketProvider: React.FC<SocketProviderProps> = ({ children }) => {
) {
messageContent = parsed.contentArray;
}
} catch (e) {
} catch {
// Not JSON, use as-is
}

Expand Down Expand Up @@ -413,7 +412,7 @@ export const SocketProvider: React.FC<SocketProviderProps> = ({ children }) => {
].includes(event.message.event.type))
) {
console.log(
`process:message`,
'process:message',
event.id,
event.message.event.type,
event.message
Expand Down Expand Up @@ -802,8 +801,11 @@ export const SocketProvider: React.FC<SocketProviderProps> = ({ children }) => {
toolParams = JSON.parse(
toolCall.function.arguments
);
} catch (e) {
console.error('Error parsing tool arguments:', e);
} catch (_error) {
console.error(
'Error parsing tool arguments:',
_error
);
}

// Generate command representation for certain tool types
Expand Down Expand Up @@ -1306,7 +1308,7 @@ export const SocketProvider: React.FC<SocketProviderProps> = ({ children }) => {
) {
messageContent = parsed.contentArray;
}
} catch (e) {
} catch {
// Not JSON, use as-is
}

Expand Down
48 changes: 23 additions & 25 deletions controller/src/server/managers/communication_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import { existsSync, mkdirSync } from 'fs';
import path from 'path';
import { talk } from '../utils/talk';
import { loadData } from '../utils/storage';
import {
CostUpdateData,
CostUpdateEvent,
Expand Down Expand Up @@ -207,10 +208,10 @@

// Process the message based on type
await this.processContainerMessage(processId, message);
} catch (err) {
} catch (_error) {
console.error(
'Error processing WebSocket message:',
err
_error
);
}
});
Expand Down Expand Up @@ -261,8 +262,8 @@
};

ws.send(JSON.stringify(connectMessage));
} catch (err) {
console.error('Error handling WebSocket connection:', err);
} catch (_error) {
console.error('Error handling WebSocket connection:', _error);
ws.close(1011, 'Internal server error');
}
});
Expand Down Expand Up @@ -373,7 +374,7 @@
* and triggers global recalculation/emission.
* @param payload - The event payload containing processId and the single ModelUsage increment.
*/
public handleModelUsage(processId: string, event: CostUpdateEvent): void {
public async handleModelUsage(processId: string, event: CostUpdateEvent): Promise<void> {

Check failure on line 377 in controller/src/server/managers/communication_manager.ts

View workflow job for this annotation

GitHub Actions / lint-and-type-check

Replace `processId:·string,·event:·CostUpdateEvent` with `⏎········processId:·string,⏎········event:·CostUpdateEvent⏎····`
// Extract usage data from the event object
const { usage } = event; // Get usage from the event parameter

Expand Down Expand Up @@ -475,7 +476,7 @@
);

// --- Recalculate Global State & Emit ---
this.recalculateAndEmitGlobalState();
await this.recalculateAndEmitGlobalState();
} catch (error) {
console.error(
`Error handling model usage for process ${processId}:`,
Expand All @@ -487,7 +488,7 @@
/**
* Recalculates the global state and emits it. Called after any change.
*/
private recalculateAndEmitGlobalState(): void {
private async recalculateAndEmitGlobalState(): Promise<void> {
try {
const aggregatedGlobalUsage = this.calculateGlobalCostData();
const elapsedMinutes = (Date.now() - this.costStartTime) / 60000;
Expand All @@ -506,7 +507,7 @@
this.processManager.io.emit('cost:info', emitPayload);

// Check cost limit and emit warnings if needed
this.checkCostLimitAndNotify(aggregatedGlobalUsage.cost.total);
await this.checkCostLimitAndNotify(aggregatedGlobalUsage.cost.total);

Check failure on line 510 in controller/src/server/managers/communication_manager.ts

View workflow job for this annotation

GitHub Actions / lint-and-type-check

Replace `aggregatedGlobalUsage.cost.total` with `⏎················aggregatedGlobalUsage.cost.total⏎············`
} catch (error) {
console.error(
'Error recalculating and emitting global state:',
Expand Down Expand Up @@ -540,11 +541,11 @@
* Triggers recalculation and emission of the global state.
* @param processId - The identifier of the process to remove.
*/
public removeProcessData(processId: string): void {
public async removeProcessData(processId: string): Promise<void> {
if (this.processCostData[processId]) {
console.log(`Removing cost data for process: ${processId}`);
delete this.processCostData[processId];
this.recalculateAndEmitGlobalState();
await this.recalculateAndEmitGlobalState();
}
}

Expand Down Expand Up @@ -807,7 +808,7 @@
}
}
} else if (event.type === 'cost_update' && 'usage' in event) {
this.handleModelUsage(
await this.handleModelUsage(
processId,
event as unknown as CostUpdateEvent
);
Expand Down Expand Up @@ -909,7 +910,7 @@
);
command = textContent ? textContent.text : '';
}
} catch (e) {
} catch {
// Not JSON, treat as regular text command
}

Expand All @@ -925,10 +926,10 @@
};

return this.sendMessage(processId, JSON.stringify(commandMessage));
} catch (err) {
} catch (_error) {
console.error(
`Error sending command to process ${processId}:`,
err
_error
);
return false;
}
Expand All @@ -945,10 +946,10 @@
};

return this.sendMessage(processId, JSON.stringify(commandMessage));
} catch (err) {
} catch (_error) {
console.error(
`Error sending command to process ${processId}:`,
err
_error
);
return false;
}
Expand All @@ -968,10 +969,10 @@
try {
connection.send(message);
return true;
} catch (err) {
} catch (_error) {
console.error(
`Error sending message to process ${processId}:`,
err
_error
);
return false;
}
Expand All @@ -987,10 +988,10 @@
id: processId,
message,
});
} catch (err) {
} catch (_error) {
console.error(
`Error broadcasting message for process ${processId}:`,
err
_error
);
}
}
Expand Down Expand Up @@ -1134,12 +1135,9 @@
/**
* Check if cost limit is exceeded and notify users
*/
private checkCostLimitAndNotify(currentCost: number): void {
// Import loadData function
const { loadData } = require('../utils/storage');

private async checkCostLimitAndNotify(currentCost: number): Promise<void> {
// Load cost limit from storage
const costLimitStr = loadData('dailyCostLimit.json');
const costLimitStr = await loadData('dailyCostLimit.json');
if (!costLimitStr) return;

let dailyLimit: number | null = null;
Expand Down
Loading
Loading