openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
41 lines (40 loc) • 1.74 kB
JavaScript
import { o as writeRuntimeJson, r as defaultRuntime } from "./runtime-B-SLYP-m.mjs";
import { r as terminalText } from "./safe-text-C80HAQ2e.mjs";
import { a as displayPath } from "./utils-C8YECn2Q.mjs";
import { t as formatCliCommand } from "./command-format-CqdwUgPk.mjs";
import { d as throwExpectedCliError } from "./failure-output-DVVDqwuu.mjs";
import { t as runWithLocalStateOwner } from "./local-state-owner-DTl7OHpC.mjs";
import { t as createAgentTeam } from "./agent-team-CGTg_tnC.mjs";
//#region src/commands/agents.commands.team.ts
async function agentsTeamCreateCommand(e) {
const t = await runWithLocalStateOwner({
method: "agents.team.create",
params: {},
target: "agent team",
onForeignOwner: "refuse",
runLocal: () => createAgentTeam(e)
});
if (t.status === "error") throwExpectedCliError(t.message);
const n = t.ambientOwnerId !== t.coordinatorId ? `ambient owner stays ${t.ambientOwnerId}; talk to the coordinator by name` : void 0;
const r = t.agents.map(({ agentId: e, name: t, workspace: n, agentDir: r }) => ({
agentId: e,
name: t,
workspace: n,
agentDir: r
}));
if (e.json) {
writeRuntimeJson(defaultRuntime, {
coordinatorId: t.coordinatorId,
agents: r,
ambientOwnerId: t.ambientOwnerId,
...n ? { note: n } : {}
});
return;
}
defaultRuntime.log(terminalText`Created team with coordinator "${t.coordinatorId}":`);
for (const e of r) defaultRuntime.log(terminalText`- ${e.agentId}: ${displayPath(e.workspace)}`);
if (n) defaultRuntime.log(terminalText`${n}`);
defaultRuntime.log(`Talk to the coordinator: ${formatCliCommand(terminalText`openclaw agent --agent ${t.coordinatorId} --message "Describe your task"`)}`);
}
//#endregion
export { agentsTeamCreateCommand };