mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 11:31:23 +00:00
refactor(agent): dedupe harness and command workflows
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user