Skip to content

🤯 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.

780 B
Raw Blame
import {
  type GetCommandOutputParams,
  type KillCommandParams,
  runCommand as runCommandCore,
  type RunCommandParams,
  ShellProcessManager,
} from '@lobechat/local-file-shell';

import { log } from '../utils/logger';

const processManager = new ShellProcessManager();

export const getActiveShellCount = () => processManager.activeCount;

export function cleanupAllProcesses() {
  processManager.cleanupAll();
}

export async function runCommand(params: RunCommandParams) {
  return runCommandCore(params, { logger: log, processManager });
}

export async function getCommandOutput(params: GetCommandOutputParams) {
  return processManager.getOutput(params);
}

export async function killCommand(params: KillCommandParams) {
  return processManager.kill(params.shell_id);
}