refactor(agent): dedupe harness and command workflows

This commit is contained in:
Peter Steinberger
2026-02-16 14:52:09 +00:00
parent 04892ee230
commit f717a13039
204 changed files with 7366 additions and 11540 deletions

View File

@@ -5,7 +5,7 @@ import { buildWorkspaceSkillCommandSpecs, type SkillCommandSpec } from "../agent
import { getRemoteSkillEligibility } from "../infra/skills-remote.js";
import { listChatCommands } from "./commands-registry.js";
function resolveReservedCommandNames(): Set<string> {
export function listReservedChatSlashCommandNames(extraNames: string[] = []): Set<string> {
const reserved = new Set<string>();
for (const command of listChatCommands()) {
if (command.nativeName) {
@@ -19,6 +19,12 @@ function resolveReservedCommandNames(): Set<string> {
reserved.add(trimmed.slice(1).toLowerCase());
}
}
for (const name of extraNames) {
const trimmed = name.trim().toLowerCase();
if (trimmed) {
reserved.add(trimmed);
}
}
return reserved;
}
@@ -31,7 +37,7 @@ export function listSkillCommandsForWorkspace(params: {
config: params.cfg,
skillFilter: params.skillFilter,
eligibility: { remote: getRemoteSkillEligibility() },
reservedNames: resolveReservedCommandNames(),
reservedNames: listReservedChatSlashCommandNames(),
});
}
@@ -39,7 +45,7 @@ export function listSkillCommandsForAgents(params: {
cfg: OpenClawConfig;
agentIds?: string[];
}): SkillCommandSpec[] {
const used = resolveReservedCommandNames();
const used = listReservedChatSlashCommandNames();
const entries: SkillCommandSpec[] = [];
const agentIds = params.agentIds ?? listAgentIds(params.cfg);
// Track visited workspace dirs to avoid registering duplicate commands