[taskboard] auto-dispatch telegram swarm tasks
This commit is contained in:
@@ -205,8 +205,7 @@ function deriveStatus(activeTaskCount: number, heartbeatAt: string | null): Agen
|
||||
async function buildOpenClawAgents() {
|
||||
const config = readOpenClawConfig();
|
||||
const agents = config.agents?.list || [];
|
||||
|
||||
return Promise.all(
|
||||
const concreteAgents = await Promise.all(
|
||||
agents.map(async (agentConfig) => {
|
||||
const agentRoot = path.join(OPENCLAW_AGENTS_DIR, agentConfig.id);
|
||||
const workspace = readWorkspaceAgent(agentRoot, agentConfig.identity?.name || agentConfig.id);
|
||||
@@ -248,6 +247,55 @@ async function buildOpenClawAgents() {
|
||||
} satisfies FleetAgent;
|
||||
}),
|
||||
);
|
||||
|
||||
const swarmAliases = ["openclaw", "openclaw-swarm", "codex", "opencode", "gemini"];
|
||||
const swarmTaskBuckets = await fetchTaskBuckets(swarmAliases);
|
||||
const swarmEventSummary = await fetchAgentEventSummary(swarmAliases);
|
||||
const runtimeWorkspace = path.join(OPENCLAW_RUNTIME_ROOT, "workspace");
|
||||
const heartbeatAt = fs.existsSync(runtimeWorkspace)
|
||||
? fs.statSync(runtimeWorkspace).mtime.toISOString()
|
||||
: swarmEventSummary.lastEvent?.created_at || null;
|
||||
|
||||
const swarmAgent = {
|
||||
slug: "openclaw-swarm",
|
||||
assignmentKey: "openclaw",
|
||||
aliases: swarmAliases,
|
||||
family: "openclaw" as const,
|
||||
name: "OpenClaw Swarm",
|
||||
host: "ubuntu",
|
||||
role: "Swarm execution queue and runner aliases for ubuntu-local OpenClaw work.",
|
||||
runtimePath: OPENCLAW_RUNTIME_ROOT,
|
||||
configPath: OPENCLAW_CONFIG_PATH,
|
||||
defaultDispatchMethod: "openclaw-swarm" as const,
|
||||
model: null,
|
||||
emoji: "O",
|
||||
channels: [
|
||||
{ label: "Family", value: "OpenClaw swarm queue" },
|
||||
{ label: "Queue", value: "OpenClaw swarm registry" },
|
||||
],
|
||||
tools: ["git worktree", "tmux", "taskboard callbacks", "swarm registry"],
|
||||
capabilities: [
|
||||
"Queue and launch swarm tasks backed by git worktrees.",
|
||||
"Map runner aliases like codex, opencode, and gemini into the shared swarm executor.",
|
||||
"Report acknowledgement, completion, and failure back to the taskboard.",
|
||||
],
|
||||
files: [],
|
||||
status: deriveStatus(swarmTaskBuckets.activeTasks.length, heartbeatAt),
|
||||
workload: swarmTaskBuckets.activeTasks.length,
|
||||
activeTasks: swarmTaskBuckets.activeTasks,
|
||||
completedTasks: swarmTaskBuckets.completedTasks,
|
||||
currentTask: swarmTaskBuckets.activeTasks[0]?.title || null,
|
||||
heartbeatAt,
|
||||
heartbeatAgeMinutes: deriveHeartbeatAgeMinutes(heartbeatAt),
|
||||
lastEvent: swarmEventSummary.lastEvent,
|
||||
failureStreak: swarmEventSummary.failureStreak,
|
||||
notes: [
|
||||
"Synthetic fleet agent representing the OpenClaw swarm dispatcher.",
|
||||
"Covers runner aliases used by Telegram and task templates.",
|
||||
],
|
||||
} satisfies FleetAgent;
|
||||
|
||||
return [...concreteAgents, swarmAgent];
|
||||
}
|
||||
|
||||
async function buildZeroClawAgents() {
|
||||
|
||||
@@ -450,7 +450,7 @@ async function dispatchOpenClawTask(taskId: number): Promise<DispatchResult> {
|
||||
|
||||
await execFileAsync("git", ["config", "--global", "--add", "safe.directory", repoPath]);
|
||||
|
||||
const agentName = task.preferred_agent || "codex";
|
||||
const agentName = task.preferred_agent || task.assignee || "codex";
|
||||
const taskKey = `taskboard-${task.id}`;
|
||||
const repoName = path.basename(repoPath);
|
||||
const worktree = path.join(SWARM_WORKTREES_DIR, repoName, taskKey);
|
||||
|
||||
Reference in New Issue
Block a user