import {
  runAgent
} from "./chunk-IUP5IHBD.js";
import "./chunk-CAY57CKF.js";
import "./chunk-KOO5733S.js";

// src/tools/run-agent.ts
async function handleRunAgent(params) {
  let parsedInput = {};
  if (params.input) {
    try {
      parsedInput = JSON.parse(params.input);
    } catch {
      return "Error: `input` must be a valid JSON object.";
    }
  }
  const { agentType, result } = await runAgent(params.id, parsedInput);
  const lines = [];
  lines.push(`Agent executed successfully (type: ${agentType}).
`);
  if (typeof result === "object" && result !== null) {
    const output = result.output;
    if (output !== void 0) {
      lines.push("**Output:**");
      lines.push(typeof output === "string" ? output : JSON.stringify(output, null, 2));
    } else {
      lines.push("**Result:**");
      lines.push(JSON.stringify(result, null, 2));
    }
  }
  return lines.join("\n");
}
export {
  handleRunAgent
};
//# sourceMappingURL=run-agent-7QE3YEH7.js.map