🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.
TypeScript agentagent-collaborationagent-harnessloop-engineeringmcppersonal-assistantproactive-agentskillssuper-agenttask-management
import type { RunCommandParams } from '@lobechat/electron-client-ipc';
import type { BuiltinInterventionProps } from '@lobechat/types';
import { Flexbox, Highlighter } from '@lobehub/ui';
import { Text } from '@lobehub/ui';
import { memo } from 'react';
const formatTimeout = (ms?: number) => {
if (!ms) return null;
const seconds = ms / 1000;
// >= 60s show minutes
if (seconds >= 60) {
const minutes = seconds / 60;
return `${minutes.toFixed(1)}min`;
}
// >= 1s show seconds
if (seconds >= 1) {
return `${seconds.toFixed(1)}s`;
}
// < 1s show milliseconds
return `${ms}ms`;
};
const RunCommand = memo<BuiltinInterventionProps<RunCommandParams>>(({ args }) => {
const { description, command, timeout } = args;
return (
<Flexbox gap={8}>
<Flexbox horizontal justify={'space-between'}>
{description && <Text>{description}</Text>}
{timeout && (
<Text style={{ fontSize: 12 }} type={'secondary'}>
timeout: {formatTimeout(timeout)}
</Text>
)}
</Flexbox>
{command && (
<Highlighter
wrap
language={'sh'}
showLanguage={false}
style={{ padding: '4px 8px' }}
variant={'outlined'}
>
{command}
</Highlighter>
)}
</Flexbox>
);
});
export default RunCommand;