Files
openclaw/src/auto-reply/reply/commands-context-command.ts
2026-06-04 02:35:34 -04:00

22 lines
822 B
TypeScript

// Implements context inspection commands for the active reply session.
import { logVerbose } from "../../globals.js";
import { buildContextReply } from "./commands-context-report.js";
import type { CommandHandler } from "./commands-types.js";
export const handleContextCommand: CommandHandler = async (params, allowTextCommands) => {
if (!allowTextCommands) {
return null;
}
const normalized = params.command.commandBodyNormalized;
if (normalized !== "/context" && !normalized.startsWith("/context ")) {
return null;
}
if (!params.command.isAuthorizedSender) {
logVerbose(
`Ignoring /context from unauthorized sender: ${params.command.senderId || "<unknown>"}`,
);
return { shouldContinue: false };
}
return { shouldContinue: false, reply: await buildContextReply(params) };
};