refactor: remove context awareness documentation and related code; streamline tool registration and context detection

This commit is contained in:
Lauren ten Hoor
2026-02-12 00:25:34 +08:00
parent dc3a7fcf9e
commit e4b54646da
15 changed files with 51 additions and 488 deletions

View File

@@ -3,22 +3,20 @@
*
* Shows worker state and queue counts per project. No health checks
* (use `health` tool), no complex sequencing.
* Context-aware: auto-filters to project in group chats.
*/
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 { generateGuardrails } from "../context-guard.js";
import { log as auditLog } from "../audit.js";
import { fetchProjectQueues, type QueueLabel } from "../services/queue.js";
import { requireWorkspaceDir, resolveContext, getPluginConfig } from "../tool-helpers.js";
import { requireWorkspaceDir, getPluginConfig } from "../tool-helpers.js";
export function createStatusTool(api: OpenClawPluginApi) {
return (ctx: ToolContext) => ({
name: "status",
label: "Status",
description: `Show task queue and worker state per project. Context-aware: auto-filters in group chats. Use \`health\` tool for worker health checks.`,
description: `Show task queue and worker state per project. Use \`health\` tool for worker health checks.`,
parameters: {
type: "object",
properties: {
@@ -28,20 +26,7 @@ export function createStatusTool(api: OpenClawPluginApi) {
async execute(_id: string, params: Record<string, unknown>) {
const workspaceDir = requireWorkspaceDir(ctx);
const context = await resolveContext(ctx, api);
if (context.type === "via-agent") {
return jsonResult({
success: false,
warning: "status is for operational use, not setup.",
recommendation: "Use onboard instead for DevClaw setup.",
contextGuidance: generateGuardrails(context),
});
}
// Auto-filter in group context
let groupId = params.projectGroupId as string | undefined;
if (context.type === "group" && !groupId) groupId = context.groupId;
const groupId = params.projectGroupId as string | undefined;
const pluginConfig = getPluginConfig(api);
const projectExecution = (pluginConfig?.projectExecution as string) ?? "parallel";
@@ -80,11 +65,6 @@ export function createStatusTool(api: OpenClawPluginApi) {
success: true,
execution: { projectExecution },
projects: filtered,
context: {
type: context.type,
...(context.type === "group" && { projectName: context.projectName, autoFiltered: !params.projectGroupId }),
},
contextGuidance: generateGuardrails(context),
});
},
});