Adds the Architect role for design/architecture investigations with persistent sessions and structured design proposals. ## New Features - **Architect role** with opus (complex) and sonnet (standard) levels - **design_task tool** — Creates To Design issues and dispatches architect - **Workflow states:** To Design → Designing → Planning - **Completion rules:** architect:done → Planning, architect:blocked → Refining - **Auto-level selection** based on complexity keywords ## Files Changed (22 files, 546 additions) ### New Files - lib/tools/design-task.ts — design_task tool implementation - lib/tools/design-task.test.ts — 16 tests for architect functionality ### Core Changes - lib/tiers.ts — ARCHITECT_LEVELS, WorkerRole type, models, emoji - lib/workflow.ts — toDesign/designing states, completion rules - lib/projects.ts — architect WorkerState on Project type - lib/dispatch.ts — architect role support in dispatch pipeline - lib/services/pipeline.ts — architect completion rules - lib/model-selector.ts — architect level selection heuristic ### Integration - index.ts — Register design_task tool, architect config schema - lib/notify.ts — architect role in notifications - lib/bootstrap-hook.ts — architect session key parsing - lib/services/tick.ts — architect in queue processing - lib/services/heartbeat.ts — architect in health checks - lib/tools/health.ts — architect in health scans - lib/tools/status.ts — architect in status dashboard - lib/tools/work-start.ts — architect role option - lib/tools/work-finish.ts — architect validation - lib/tools/project-register.ts — architect labels + role scaffolding - lib/templates.ts — architect instructions + AGENTS.md updates - lib/setup/workspace.ts — architect role file scaffolding - lib/setup/smart-model-selector.ts — architect in model assignment - lib/setup/llm-model-selector.ts — architect in LLM prompt
111 lines
3.7 KiB
TypeScript
111 lines
3.7 KiB
TypeScript
/**
|
|
* status — Lightweight queue + worker state dashboard.
|
|
*
|
|
* Shows worker state and queue counts per project. No health checks
|
|
* (use `health` tool), no complex sequencing.
|
|
*/
|
|
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
|
|
import { jsonResult } from "openclaw/plugin-sdk";
|
|
import type { ToolContext } from "../types.js";
|
|
import { readProjects, getProject } from "../projects.js";
|
|
import { log as auditLog } from "../audit.js";
|
|
import { fetchProjectQueues, getTotalQueuedCount, getQueueLabelsWithPriority } from "../services/queue.js";
|
|
import { requireWorkspaceDir, getPluginConfig } from "../tool-helpers.js";
|
|
import { DEFAULT_WORKFLOW } from "../workflow.js";
|
|
|
|
export function createStatusTool(api: OpenClawPluginApi) {
|
|
return (ctx: ToolContext) => ({
|
|
name: "status",
|
|
label: "Status",
|
|
description: `Show task queue and worker state per project. Use \`health\` tool for worker health checks.`,
|
|
parameters: {
|
|
type: "object",
|
|
properties: {
|
|
projectGroupId: { type: "string", description: "Filter to specific project. Omit for all." },
|
|
},
|
|
},
|
|
|
|
async execute(_id: string, params: Record<string, unknown>) {
|
|
const workspaceDir = requireWorkspaceDir(ctx);
|
|
const groupId = params.projectGroupId as string | undefined;
|
|
|
|
const pluginConfig = getPluginConfig(api);
|
|
const projectExecution = (pluginConfig?.projectExecution as string) ?? "parallel";
|
|
|
|
// TODO: Load per-project workflow when supported
|
|
const workflow = DEFAULT_WORKFLOW;
|
|
|
|
const data = await readProjects(workspaceDir);
|
|
const projectIds = groupId ? [groupId] : Object.keys(data.projects);
|
|
|
|
// Build project summaries with queue counts
|
|
const projects = await Promise.all(
|
|
projectIds.map(async (pid) => {
|
|
const project = getProject(data, pid);
|
|
if (!project) return null;
|
|
|
|
const queues = await fetchProjectQueues(project, workflow);
|
|
|
|
// Build dynamic queue object with counts
|
|
const queueCounts: Record<string, number> = {};
|
|
for (const [label, issues] of Object.entries(queues)) {
|
|
queueCounts[label] = issues.length;
|
|
}
|
|
|
|
return {
|
|
name: project.name,
|
|
groupId: pid,
|
|
roleExecution: project.roleExecution ?? "parallel",
|
|
dev: {
|
|
active: project.dev.active,
|
|
issueId: project.dev.issueId,
|
|
level: project.dev.level,
|
|
startTime: project.dev.startTime,
|
|
},
|
|
qa: {
|
|
active: project.qa.active,
|
|
issueId: project.qa.issueId,
|
|
level: project.qa.level,
|
|
startTime: project.qa.startTime,
|
|
},
|
|
architect: {
|
|
active: project.architect.active,
|
|
issueId: project.architect.issueId,
|
|
level: project.architect.level,
|
|
startTime: project.architect.startTime,
|
|
},
|
|
queue: queueCounts,
|
|
};
|
|
}),
|
|
);
|
|
|
|
const filtered = projects.filter(Boolean) as NonNullable<typeof projects[number]>[];
|
|
|
|
// Calculate total queued across all projects
|
|
const totalQueued = filtered.reduce(
|
|
(sum, p) => sum + Object.values(p.queue).reduce((s, c) => s + c, 0),
|
|
0,
|
|
);
|
|
|
|
await auditLog(workspaceDir, "status", {
|
|
projectCount: filtered.length,
|
|
totalQueued,
|
|
});
|
|
|
|
// Include queue labels in response for context
|
|
const queueLabels = getQueueLabelsWithPriority(workflow).map((q) => ({
|
|
label: q.label,
|
|
role: q.role,
|
|
priority: q.priority,
|
|
}));
|
|
|
|
return jsonResult({
|
|
success: true,
|
|
execution: { projectExecution },
|
|
queueLabels,
|
|
projects: filtered,
|
|
});
|
|
},
|
|
});
|
|
}
|