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

@@ -1,7 +1,7 @@
/**
* setup/config.ts — Plugin config writer (openclaw.json).
*
* Handles: model level config, devClawAgentIds, tool restrictions, subagent cleanup.
* Handles: model level config, tool restrictions, subagent cleanup.
*/
import type { OpenClawPluginApi } from "openclaw/plugin-sdk";
import { HEARTBEAT_DEFAULTS } from "../services/heartbeat.js";
@@ -9,7 +9,7 @@ import { HEARTBEAT_DEFAULTS } from "../services/heartbeat.js";
type ModelConfig = { dev: Record<string, string>; qa: Record<string, string> };
/**
* Write DevClaw model level config and devClawAgentIds to openclaw.json plugins section.
* Write DevClaw model level config to openclaw.json plugins section.
*
* Also configures:
* - Tool restrictions (deny sessions_spawn, sessions_send) for DevClaw agents
@@ -36,7 +36,6 @@ export async function writePluginConfig(
configureSubagentCleanup(config);
if (agentId) {
addDevClawAgentId(config, agentId);
addToolRestrictions(config, agentId);
}
@@ -66,14 +65,6 @@ function configureSubagentCleanup(config: Record<string, unknown>): void {
(defaults.subagents as Record<string, unknown>).archiveAfterMinutes = 43200;
}
function addDevClawAgentId(config: Record<string, unknown>, agentId: string): void {
const devclaw = (config as any).plugins.entries.devclaw.config;
const existing: string[] = devclaw.devClawAgentIds ?? [];
if (!existing.includes(agentId)) {
devclaw.devClawAgentIds = [...existing, agentId];
}
}
function addToolRestrictions(config: Record<string, unknown>, agentId: string): void {
const agent = (config as any).agents?.list?.find((a: { id: string }) => a.id === agentId);
if (agent) {