feat: implement work heartbeat service for health checks and task dispatching
- Introduced a new heartbeat service that runs at defined intervals to perform health checks on workers and fill available task slots based on priority. - Added a health tool to scan worker health across projects with optional auto-fix capabilities. - Updated the status tool to provide a lightweight overview of worker states and queue counts without health checks. - Enhanced task creation tool descriptions to clarify task state handling. - Implemented tests for the work heartbeat logic, ensuring proper project resolution, worker state management, and task prioritization.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
import fs from "node:fs/promises";
|
||||
import path from "node:path";
|
||||
import type { Tier } from "../tiers.js";
|
||||
import { HEARTBEAT_DEFAULTS } from "../services/heartbeat.js";
|
||||
|
||||
function openclawConfigPath(): string {
|
||||
return path.join(process.env.HOME ?? "/home/lauren", ".openclaw", "openclaw.json");
|
||||
@@ -35,6 +36,7 @@ export async function writePluginConfig(
|
||||
config.plugins.entries.devclaw.config.projectExecution = projectExecution;
|
||||
}
|
||||
|
||||
ensureHeartbeatDefaults(config);
|
||||
configureSubagentCleanup(config);
|
||||
|
||||
if (agentId) {
|
||||
@@ -86,3 +88,10 @@ function addToolRestrictions(config: Record<string, unknown>, agentId: string):
|
||||
delete agent.tools.allow;
|
||||
}
|
||||
}
|
||||
|
||||
function ensureHeartbeatDefaults(config: Record<string, unknown>): void {
|
||||
const devclaw = (config as any).plugins.entries.devclaw.config;
|
||||
if (!devclaw.work_heartbeat) {
|
||||
devclaw.work_heartbeat = { ...HEARTBEAT_DEFAULTS };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user