mirror of https://github.com/openclaw/openclaw.git
47 lines
1.2 KiB
TypeScript
47 lines
1.2 KiB
TypeScript
import type { OpenClawConfig } from "../../config/config.js";
|
|
import type { MsgContext } from "../templating.js";
|
|
import { buildCommandContext } from "./commands.js";
|
|
import { parseInlineDirectives } from "./directive-handling.js";
|
|
|
|
export function buildCommandTestParams(
|
|
commandBody: string,
|
|
cfg: OpenClawConfig,
|
|
ctxOverrides?: Partial<MsgContext>,
|
|
) {
|
|
const ctx = {
|
|
Body: commandBody,
|
|
CommandBody: commandBody,
|
|
CommandSource: "text",
|
|
CommandAuthorized: true,
|
|
Provider: "whatsapp",
|
|
Surface: "whatsapp",
|
|
...ctxOverrides,
|
|
} as MsgContext;
|
|
|
|
const command = buildCommandContext({
|
|
ctx,
|
|
cfg,
|
|
isGroup: false,
|
|
triggerBodyNormalized: commandBody.trim().toLowerCase(),
|
|
commandAuthorized: true,
|
|
});
|
|
|
|
return {
|
|
ctx,
|
|
cfg,
|
|
command,
|
|
directives: parseInlineDirectives(commandBody),
|
|
elevated: { enabled: true, allowed: true, failures: [] },
|
|
sessionKey: "agent:main:main",
|
|
workspaceDir: "/tmp",
|
|
defaultGroupActivation: () => "mention",
|
|
resolvedVerboseLevel: "off" as const,
|
|
resolvedReasoningLevel: "off" as const,
|
|
resolveDefaultThinkingLevel: async () => undefined,
|
|
provider: "whatsapp",
|
|
model: "test-model",
|
|
contextTokens: 0,
|
|
isGroup: false,
|
|
};
|
|
}
|