openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
37 lines (36 loc) • 1.54 kB
JavaScript
import { a as writeRuntimeJson, r as defaultRuntime } from "./runtime-DlO3PTAd.mjs";
import { p as shortenHomePath } from "./utils-DgZn2dLu.mjs";
import { t as formatCliCommand } from "./command-format-DwEdrDKL.mjs";
import { t as ExpectedCliError } from "./failure-output-gtb9zaTk.mjs";
import { t as createAgentTeam } from "./agent-team-DBsCgfW6.mjs";
//#region src/commands/agents.commands.team.ts
async function agentsTeamCreateCommand(opts, runtime = defaultRuntime) {
const result = await createAgentTeam(opts);
if (result.status === "error") throw new ExpectedCliError({
message: result.message,
humanOutput: result.message,
machineOutput: result.message
});
const note = result.ambientOwnerId !== result.coordinatorId ? `ambient owner stays ${result.ambientOwnerId}; talk to the coordinator by name` : void 0;
const agents = result.agents.map(({ agentId, name, workspace, agentDir }) => ({
agentId,
name,
workspace,
agentDir
}));
if (opts.json) {
writeRuntimeJson(runtime, {
coordinatorId: result.coordinatorId,
agents,
ambientOwnerId: result.ambientOwnerId,
...note ? { note } : {}
});
return;
}
runtime.log(`Created team with coordinator "${result.coordinatorId}":`);
for (const agent of agents) runtime.log(`- ${agent.agentId}: ${shortenHomePath(agent.workspace)}`);
if (note) runtime.log(note);
runtime.log(`Talk to the coordinator: ${formatCliCommand(`openclaw agent --agent ${result.coordinatorId} --message "Describe your task"`)}`);
}
//#endregion
export { agentsTeamCreateCommand };