refactor: rename to openclaw

This commit is contained in:
Peter Steinberger
2026-01-30 03:15:10 +01:00
parent 4583f88626
commit 9a7160786a
2357 changed files with 16688 additions and 16788 deletions

View File

@@ -3,7 +3,7 @@
// the chunk so messages are only split when they truly exceed the limit.
import type { ChannelId } from "../channels/plugins/types.js";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import { findFenceSpanAt, isSafeFenceBreak, parseFenceSpans } from "../markdown/fences.js";
import { normalizeAccountId } from "../routing/session-key.js";
import { INTERNAL_MESSAGE_CHANNEL } from "../utils/message-channel.js";
@@ -52,7 +52,7 @@ function resolveChunkLimitForProvider(
}
export function resolveTextChunkLimit(
cfg: MoltbotConfig | undefined,
cfg: OpenClawConfig | undefined,
provider?: TextChunkProvider,
accountId?: string | null,
opts?: { fallbackLimit?: number },
@@ -98,7 +98,7 @@ function resolveChunkModeForProvider(
}
export function resolveChunkMode(
cfg: MoltbotConfig | undefined,
cfg: OpenClawConfig | undefined,
provider?: TextChunkProvider,
accountId?: string | null,
): ChunkMode {

View File

@@ -2,7 +2,7 @@ import type { ChannelDock } from "../channels/dock.js";
import { getChannelDock, listChannelDocks } from "../channels/dock.js";
import type { ChannelId } from "../channels/plugins/types.js";
import { normalizeAnyChannelId } from "../channels/registry.js";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import type { MsgContext } from "./templating.js";
export type CommandAuthorization = {
@@ -14,7 +14,7 @@ export type CommandAuthorization = {
to?: string;
};
function resolveProviderFromContext(ctx: MsgContext, cfg: MoltbotConfig): ChannelId | undefined {
function resolveProviderFromContext(ctx: MsgContext, cfg: OpenClawConfig): ChannelId | undefined {
const direct =
normalizeAnyChannelId(ctx.Provider) ??
normalizeAnyChannelId(ctx.Surface) ??
@@ -44,7 +44,7 @@ function resolveProviderFromContext(ctx: MsgContext, cfg: MoltbotConfig): Channe
function formatAllowFromList(params: {
dock?: ChannelDock;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
allowFrom: Array<string | number>;
}): string[] {
@@ -58,7 +58,7 @@ function formatAllowFromList(params: {
function normalizeAllowFromEntry(params: {
dock?: ChannelDock;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
value: string;
}): string[] {
@@ -74,7 +74,7 @@ function normalizeAllowFromEntry(params: {
function resolveSenderCandidates(params: {
dock?: ChannelDock;
providerId?: ChannelId;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
senderId?: string | null;
senderE164?: string | null;
@@ -108,7 +108,7 @@ function resolveSenderCandidates(params: {
export function resolveCommandAuthorization(params: {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
commandAuthorized: boolean;
}): CommandAuthorization {
const { ctx, cfg, commandAuthorized } = params;

View File

@@ -1,6 +1,6 @@
import { afterEach, beforeEach, describe, expect, it } from "vitest";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import { setActivePluginRegistry } from "../plugins/runtime.js";
import { createTestRegistry } from "../test-utils/channel-plugins.js";
import { resolveCommandAuthorization } from "./command-auth.js";
@@ -22,7 +22,7 @@ describe("resolveCommandAuthorization", () => {
it("falls back from empty SenderId to SenderE164", () => {
const cfg = {
channels: { whatsapp: { allowFrom: ["+123"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const ctx = {
Provider: "whatsapp",
@@ -45,7 +45,7 @@ describe("resolveCommandAuthorization", () => {
it("falls back from whitespace SenderId to SenderE164", () => {
const cfg = {
channels: { whatsapp: { allowFrom: ["+123"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const ctx = {
Provider: "whatsapp",
@@ -68,7 +68,7 @@ describe("resolveCommandAuthorization", () => {
it("falls back to From when SenderId and SenderE164 are whitespace", () => {
const cfg = {
channels: { whatsapp: { allowFrom: ["+999"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const ctx = {
Provider: "whatsapp",
@@ -91,7 +91,7 @@ describe("resolveCommandAuthorization", () => {
it("falls back from un-normalizable SenderId to SenderE164", () => {
const cfg = {
channels: { whatsapp: { allowFrom: ["+123"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const ctx = {
Provider: "whatsapp",
@@ -114,7 +114,7 @@ describe("resolveCommandAuthorization", () => {
it("prefers SenderE164 when SenderId does not match allowFrom", () => {
const cfg = {
channels: { whatsapp: { allowFrom: ["+41796666864"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const ctx = {
Provider: "whatsapp",
@@ -214,12 +214,12 @@ describe("control command parsing", () => {
it("ignores telegram commands addressed to other bots", () => {
expect(
hasControlCommand("/help@otherbot", undefined, {
botUsername: "moltbot",
botUsername: "openclaw",
}),
).toBe(false);
expect(
hasControlCommand("/help@moltbot", undefined, {
botUsername: "moltbot",
hasControlCommand("/help@openclaw", undefined, {
botUsername: "openclaw",
}),
).toBe(true);
});

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/types.js";
import type { OpenClawConfig } from "../config/types.js";
import {
type CommandNormalizeOptions,
listChatCommands,
@@ -9,7 +9,7 @@ import { isAbortTrigger } from "./reply/abort.js";
export function hasControlCommand(
text?: string,
cfg?: MoltbotConfig,
cfg?: OpenClawConfig,
options?: CommandNormalizeOptions,
): boolean {
if (!text) return false;
@@ -35,7 +35,7 @@ export function hasControlCommand(
export function isControlCommandMessage(
text?: string,
cfg?: MoltbotConfig,
cfg?: OpenClawConfig,
options?: CommandNormalizeOptions,
): boolean {
if (!text) return false;
@@ -61,7 +61,7 @@ export function hasInlineCommandTokens(text?: string): boolean {
export function shouldComputeCommandAuthorized(
text?: string,
cfg?: MoltbotConfig,
cfg?: OpenClawConfig,
options?: CommandNormalizeOptions,
): boolean {
return isControlCommandMessage(text, cfg, options) || hasInlineCommandTokens(text);

View File

@@ -351,7 +351,7 @@ function buildChatCommands(): ChatCommandDefinition[] {
defineChatCommand({
key: "restart",
nativeName: "restart",
description: "Restart Moltbot.",
description: "Restart OpenClaw.",
textAlias: "/restart",
category: "tools",
}),

View File

@@ -147,21 +147,21 @@ describe("commands registry", () => {
});
it("normalizes telegram-style command mentions for the current bot", () => {
expect(normalizeCommandBody("/help@moltbot", { botUsername: "moltbot" })).toBe("/help");
expect(normalizeCommandBody("/help@openclaw", { botUsername: "openclaw" })).toBe("/help");
expect(
normalizeCommandBody("/help@moltbot args", {
botUsername: "moltbot",
normalizeCommandBody("/help@openclaw args", {
botUsername: "openclaw",
}),
).toBe("/help args");
expect(
normalizeCommandBody("/help@moltbot: args", {
botUsername: "moltbot",
normalizeCommandBody("/help@openclaw: args", {
botUsername: "openclaw",
}),
).toBe("/help args");
});
it("keeps telegram-style command mentions for other bots", () => {
expect(normalizeCommandBody("/help@otherbot", { botUsername: "moltbot" })).toBe(
expect(normalizeCommandBody("/help@otherbot", { botUsername: "openclaw" })).toBe(
"/help@otherbot",
);
});

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/types.js";
import type { OpenClawConfig } from "../config/types.js";
import type { SkillCommandSpec } from "../agents/skills.js";
import { getChatCommands, getNativeCommandSurfaces } from "./commands-registry.data.js";
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../agents/defaults.js";
@@ -89,7 +89,7 @@ export function listChatCommands(params?: {
return [...commands, ...buildSkillCommandDefinitions(params.skillCommands)];
}
export function isCommandEnabled(cfg: MoltbotConfig, commandKey: string): boolean {
export function isCommandEnabled(cfg: OpenClawConfig, commandKey: string): boolean {
if (commandKey === "config") return cfg.commands?.config === true;
if (commandKey === "debug") return cfg.commands?.debug === true;
if (commandKey === "bash") return cfg.commands?.bash === true;
@@ -97,7 +97,7 @@ export function isCommandEnabled(cfg: MoltbotConfig, commandKey: string): boolea
}
export function listChatCommandsForConfig(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
params?: { skillCommands?: SkillCommandSpec[] },
): ChatCommandDefinition[] {
const base = getChatCommands().filter((command) => isCommandEnabled(cfg, command.key));
@@ -135,7 +135,7 @@ export function listNativeCommandSpecs(params?: {
}
export function listNativeCommandSpecsForConfig(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
params?: { skillCommands?: SkillCommandSpec[]; provider?: string },
): NativeCommandSpec[] {
return listChatCommandsForConfig(cfg, params)
@@ -240,12 +240,12 @@ export function buildCommandTextFromArgs(
return buildCommandText(commandName, serializeCommandArgs(command, args));
}
function resolveDefaultCommandContext(cfg?: MoltbotConfig): {
function resolveDefaultCommandContext(cfg?: OpenClawConfig): {
provider: string;
model: string;
} {
const resolved = resolveConfiguredModelRef({
cfg: cfg ?? ({} as MoltbotConfig),
cfg: cfg ?? ({} as OpenClawConfig),
defaultProvider: DEFAULT_PROVIDER,
defaultModel: DEFAULT_MODEL,
});
@@ -260,7 +260,7 @@ export type ResolvedCommandArgChoice = { value: string; label: string };
export function resolveCommandArgChoices(params: {
command: ChatCommandDefinition;
arg: CommandArgDefinition;
cfg?: MoltbotConfig;
cfg?: OpenClawConfig;
provider?: string;
model?: string;
}): ResolvedCommandArgChoice[] {
@@ -288,7 +288,7 @@ export function resolveCommandArgChoices(params: {
export function resolveCommandArgMenu(params: {
command: ChatCommandDefinition;
args?: CommandArgs;
cfg?: MoltbotConfig;
cfg?: OpenClawConfig;
}): { arg: CommandArgDefinition; choices: ResolvedCommandArgChoice[]; title?: string } | null {
const { command, args, cfg } = params;
if (!command.args || !command.argsMenu) return null;
@@ -355,7 +355,7 @@ export function isCommandMessage(raw: string): boolean {
return trimmed.startsWith("/");
}
export function getCommandDetection(_cfg?: MoltbotConfig): CommandDetection {
export function getCommandDetection(_cfg?: OpenClawConfig): CommandDetection {
const commands = getChatCommands();
if (cachedDetection && cachedDetectionCommands === commands) return cachedDetection;
const exact = new Set<string>();
@@ -382,7 +382,7 @@ export function getCommandDetection(_cfg?: MoltbotConfig): CommandDetection {
return cachedDetection;
}
export function maybeResolveTextAlias(raw: string, cfg?: MoltbotConfig) {
export function maybeResolveTextAlias(raw: string, cfg?: OpenClawConfig) {
const trimmed = normalizeCommandBody(raw).trim();
if (!trimmed.startsWith("/")) return null;
const detection = getCommandDetection(cfg);
@@ -397,7 +397,7 @@ export function maybeResolveTextAlias(raw: string, cfg?: MoltbotConfig) {
export function resolveTextCommand(
raw: string,
cfg?: MoltbotConfig,
cfg?: OpenClawConfig,
): {
command: ChatCommandDefinition;
args?: string;

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/types.js";
import type { OpenClawConfig } from "../config/types.js";
export type CommandScope = "text" | "native" | "both";
@@ -14,7 +14,7 @@ export type CommandCategory =
export type CommandArgType = "string" | "number" | "boolean";
export type CommandArgChoiceContext = {
cfg?: MoltbotConfig;
cfg?: OpenClawConfig;
provider?: string;
model?: string;
command: ChatCommandDefinition;
@@ -80,7 +80,7 @@ export type CommandDetection = {
};
export type ShouldHandleTextCommandsParams = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
surface: string;
commandSource?: "text" | "native";
};

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import type { FinalizedMsgContext, MsgContext } from "./templating.js";
import type { GetReplyOptions } from "./types.js";
import { finalizeInboundContext } from "./reply/inbound-context.js";
@@ -16,7 +16,7 @@ export type DispatchInboundResult = DispatchFromConfigResult;
export async function dispatchInboundMessage(params: {
ctx: MsgContext | FinalizedMsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
dispatcher: ReplyDispatcher;
replyOptions?: Omit<GetReplyOptions, "onToolResult" | "onBlockReply">;
replyResolver?: typeof import("./reply.js").getReplyFromConfig;
@@ -33,7 +33,7 @@ export async function dispatchInboundMessage(params: {
export async function dispatchInboundMessageWithBufferedDispatcher(params: {
ctx: MsgContext | FinalizedMsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
dispatcherOptions: ReplyDispatcherWithTypingOptions;
replyOptions?: Omit<GetReplyOptions, "onToolResult" | "onBlockReply">;
replyResolver?: typeof import("./reply.js").getReplyFromConfig;
@@ -59,7 +59,7 @@ export async function dispatchInboundMessageWithBufferedDispatcher(params: {
export async function dispatchInboundMessageWithDispatcher(params: {
ctx: MsgContext | FinalizedMsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
dispatcherOptions: ReplyDispatcherOptions;
replyOptions?: Omit<GetReplyOptions, "onToolResult" | "onBlockReply">;
replyResolver?: typeof import("./reply.js").getReplyFromConfig;

View File

@@ -1,7 +1,7 @@
import { resolveUserTimezone } from "../agents/date-time.js";
import { normalizeChatType } from "../channels/chat-type.js";
import { resolveSenderLabel, type SenderLabelParams } from "../channels/sender-label.js";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
export type AgentEnvelopeParams = {
channel: string;
@@ -45,7 +45,7 @@ type ResolvedEnvelopeTimezone =
| { mode: "local" }
| { mode: "iana"; timeZone: string };
export function resolveEnvelopeFormatOptions(cfg?: MoltbotConfig): EnvelopeFormatOptions {
export function resolveEnvelopeFormatOptions(cfg?: OpenClawConfig): EnvelopeFormatOptions {
const defaults = cfg?.agents?.defaults;
return {
timezone: defaults?.envelopeTimezone,

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import type { InboundDebounceByProvider } from "../config/types.messages.js";
const resolveMs = (value: unknown): number | undefined => {
@@ -15,7 +15,7 @@ const resolveChannelOverride = (params: {
};
export function resolveInboundDebounceMs(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
channel: string;
overrideMs?: number;
}): number {

View File

@@ -4,7 +4,7 @@ import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import type { GroupKeyResolution } from "../config/sessions.js";
import { createInboundDebouncer } from "./inbound-debounce.js";
import { applyTemplate, type MsgContext, type TemplateContext } from "./templating.js";
@@ -260,9 +260,9 @@ describe("createInboundDebouncer", () => {
describe("initSessionState sender meta", () => {
it("injects sender meta into BodyStripped for group chats", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-sender-meta-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-sender-meta-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as MoltbotConfig;
const cfg = { session: { store: storePath } } as OpenClawConfig;
const result = await initSessionState({
ctx: {
@@ -281,9 +281,9 @@ describe("initSessionState sender meta", () => {
});
it("does not inject sender meta for direct chats", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-sender-meta-direct-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-sender-meta-direct-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as MoltbotConfig;
const cfg = { session: { store: storePath } } as OpenClawConfig;
const result = await initSessionState({
ctx: {
@@ -305,22 +305,22 @@ describe("mention helpers", () => {
it("builds regexes and skips invalid patterns", () => {
const regexes = buildMentionRegexes({
messages: {
groupChat: { mentionPatterns: ["\\bclawd\\b", "(invalid"] },
groupChat: { mentionPatterns: ["\\bopenclaw\\b", "(invalid"] },
},
});
expect(regexes).toHaveLength(1);
expect(regexes[0]?.test("clawd")).toBe(true);
expect(regexes[0]?.test("openclaw")).toBe(true);
});
it("normalizes zero-width characters", () => {
expect(normalizeMentionText("cl\u200bawd")).toBe("clawd");
expect(normalizeMentionText("open\u200bclaw")).toBe("openclaw");
});
it("matches patterns case-insensitively", () => {
const regexes = buildMentionRegexes({
messages: { groupChat: { mentionPatterns: ["\\bclawd\\b"] } },
messages: { groupChat: { mentionPatterns: ["\\bopenclaw\\b"] } },
});
expect(matchesMentionPatterns("CLAWD: hi", regexes)).toBe(true);
expect(matchesMentionPatterns("OPENCLAW: hi", regexes)).toBe(true);
});
it("uses per-agent mention patterns when configured", () => {
@@ -347,7 +347,7 @@ describe("mention helpers", () => {
describe("resolveGroupRequireMention", () => {
it("respects Discord guild/channel requireMention settings", () => {
const cfg: MoltbotConfig = {
const cfg: OpenClawConfig = {
channels: {
discord: {
guilds: {
@@ -377,7 +377,7 @@ describe("resolveGroupRequireMention", () => {
});
it("respects Slack channel requireMention settings", () => {
const cfg: MoltbotConfig = {
const cfg: OpenClawConfig = {
channels: {
slack: {
channels: {

View File

@@ -25,7 +25,7 @@ vi.mock("../agents/model-catalog.js", () => ({
}));
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
return withTempHomeBase(fn, { prefix: "moltbot-stream-" });
return withTempHomeBase(fn, { prefix: "openclaw-stream-" });
}
describe("block streaming", () => {
@@ -89,7 +89,7 @@ describe("block streaming", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -148,7 +148,7 @@ describe("block streaming", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { telegram: { allowFrom: ["*"] } },
@@ -197,7 +197,7 @@ describe("block streaming", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -255,7 +255,7 @@ describe("block streaming", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { telegram: { allowFrom: ["*"] } },
@@ -297,7 +297,7 @@ describe("block streaming", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { telegram: { allowFrom: ["*"], streamMode: "block" } },

View File

@@ -39,10 +39,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -88,7 +88,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "openai-codex/gpt-5.2-codex",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -116,7 +116,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "openai/gpt-5.2",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -144,7 +144,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "openai/gpt-4.1-mini",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -174,7 +174,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": { alias: " help " },
},
@@ -193,7 +193,7 @@ describe("directive behavior", () => {
it("treats skill commands as reserved for model aliases", async () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();
const workspace = path.join(home, "clawd");
const workspace = path.join(home, "openclaw");
await writeSkill({
workspaceDir: workspace,
name: "demo-skill",
@@ -244,7 +244,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -276,7 +276,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
messages: {
@@ -313,7 +313,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
thinkingDefault: "high",
},
},

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -89,7 +89,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -132,7 +132,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -156,7 +156,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -179,7 +179,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: path.join(home, "sessions.json") },
@@ -203,7 +203,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: storePath },
@@ -229,7 +229,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
thinkingDefault: "high",
},
},
@@ -254,7 +254,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: path.join(home, "sessions.json") },

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -79,7 +79,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: path.join(home, "sessions.json") },
@@ -111,7 +111,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: path.join(home, "sessions.json") },
@@ -146,7 +146,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -181,7 +181,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -220,7 +220,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -254,7 +254,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -82,7 +82,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},
@@ -132,7 +132,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -169,7 +169,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
tools: {

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -72,7 +72,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},
@@ -105,7 +105,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},
@@ -145,7 +145,7 @@ describe("directive behavior", () => {
fallbacks: ["openai/gpt-4.1-mini"],
},
imageModel: { primary: "minimax/MiniMax-M2.1" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: storePath },
@@ -183,7 +183,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},
@@ -223,7 +223,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
},
@@ -251,7 +251,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},
@@ -281,7 +281,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"openai/gpt-4.1-mini": {},
"anthropic/claude-opus-4-5": { alias: "Opus" },

View File

@@ -29,10 +29,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -74,7 +74,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"moonshot/kimi-k2-0905-preview": { alias: "Kimi" },
@@ -116,7 +116,7 @@ describe("directive behavior", () => {
await withTempHome(async (home) => {
vi.mocked(runEmbeddedPiAgent).mockReset();
const storePath = path.join(home, "sessions.json");
const authDir = path.join(home, ".clawdbot", "agents", "main", "agent");
const authDir = path.join(home, ".openclaw", "agents", "main", "agent");
await fs.mkdir(authDir, { recursive: true, mode: 0o700 });
await fs.writeFile(
path.join(authDir, "auth-profiles.json"),
@@ -143,7 +143,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"openai/gpt-4.1-mini": {},
"anthropic/claude-opus-4-5": { alias: "Opus" },
@@ -175,7 +175,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"openai/gpt-4.1-mini": {},
"anthropic/claude-opus-4-5": { alias: "Opus" },
@@ -209,7 +209,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
tools: { elevated: { allowFrom: { whatsapp: ["*"] } } },
@@ -240,7 +240,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "openai/gpt-4.1-mini" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -79,7 +79,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
list: [
{
@@ -126,7 +126,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
list: [
{
@@ -172,7 +172,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
sandbox: { mode: "off" },
},
},
@@ -210,7 +210,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
tools: {
@@ -246,7 +246,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
tools: {

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -79,7 +79,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
tools: {
@@ -123,7 +123,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
list: [
{
@@ -161,7 +161,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -194,7 +194,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -228,7 +228,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -243,7 +243,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -79,7 +79,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
elevatedDefault: "on",
},
},
@@ -107,7 +107,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
elevatedDefault: "on",
},
},
@@ -135,7 +135,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
elevatedDefault: "on",
},
},
@@ -215,7 +215,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
list: [
{

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -71,7 +71,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
verboseDefault: "on",
},
},
@@ -96,7 +96,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
session: { store: path.join(home, "sessions.json") },
@@ -127,7 +127,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
elevatedDefault: "on",
},
},
@@ -163,7 +163,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
tools: {
@@ -207,7 +207,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
elevatedDefault: "on",
},
},
@@ -256,7 +256,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
elevatedDefault: "on",
},
},

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -72,7 +72,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"moonshot/kimi-k2-0905-preview": {},
@@ -120,7 +120,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"moonshot/kimi-k2-0905-preview": {},
@@ -163,7 +163,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"moonshot/kimi-k2-0905-preview": {},
@@ -206,7 +206,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "minimax/MiniMax-M2.1" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"minimax/MiniMax-M2.1": {},
"minimax/MiniMax-M2.1-lightning": {},
@@ -251,7 +251,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "minimax/MiniMax-M2.1" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"minimax/MiniMax-M2.1": {},
"minimax/MiniMax-M2.1-lightning": {},

View File

@@ -27,10 +27,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-reply-",
prefix: "openclaw-reply-",
},
);
}
@@ -101,7 +101,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -159,7 +159,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -174,7 +174,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -199,7 +199,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},
@@ -231,7 +231,7 @@ describe("directive behavior", () => {
agents: {
defaults: {
model: { primary: "anthropic/claude-opus-4-5" },
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
"openai/gpt-4.1-mini": {},

View File

@@ -47,7 +47,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
runEmbeddedPiAgentMock.mockClear();
return await fn(home);
},
{ prefix: "moltbot-typing-" },
{ prefix: "openclaw-typing-" },
);
}
@@ -56,7 +56,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -33,9 +33,9 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_BUNDLED_SKILLS_DIR: (home) => path.join(home, "bundled-skills"),
OPENCLAW_BUNDLED_SKILLS_DIR: (home) => path.join(home, "bundled-skills"),
},
prefix: "moltbot-media-note-",
prefix: "openclaw-media-note-",
},
);
}
@@ -45,7 +45,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },

View File

@@ -36,7 +36,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(runEmbeddedPiAgent).mockReset();
return await fn(home);
},
{ prefix: "moltbot-queue-" },
{ prefix: "openclaw-queue-" },
);
}
@@ -45,7 +45,7 @@ function makeCfg(home: string, queue?: Record<string, unknown>) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },

View File

@@ -24,10 +24,10 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
},
{
env: {
CLAWDBOT_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".clawdbot", "agent"),
OPENCLAW_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
PI_CODING_AGENT_DIR: (home) => path.join(home, ".openclaw", "agent"),
},
prefix: "moltbot-rawbody-",
prefix: "openclaw-rawbody-",
},
);
}
@@ -64,7 +64,7 @@ describe("RawBody directive parsing", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -98,7 +98,7 @@ describe("RawBody directive parsing", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
models: {
"anthropic/claude-opus-4-5": {},
},
@@ -135,7 +135,7 @@ describe("RawBody directive parsing", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },
@@ -173,7 +173,7 @@ describe("RawBody directive parsing", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["+1222"] } },
@@ -221,7 +221,7 @@ describe("RawBody directive parsing", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: path.join(home, "clawd"),
workspace: path.join(home, "openclaw"),
},
},
channels: { whatsapp: { allowFrom: ["*"] } },

View File

@@ -64,12 +64,12 @@ vi.mock("../web/session.js", () => webMocks);
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
return withTempHomeBase(
async (home) => {
await mkdir(join(home, ".clawdbot", "agents", "main", "sessions"), { recursive: true });
await mkdir(join(home, ".openclaw", "agents", "main", "sessions"), { recursive: true });
vi.mocked(runEmbeddedPiAgent).mockClear();
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -78,7 +78,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -68,7 +68,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -77,7 +77,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -141,7 +141,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -187,7 +187,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -196,7 +196,7 @@ describe("trigger handling", () => {
},
},
session: {
store: join(tmpdir(), `moltbot-session-test-${Date.now()}.json`),
store: join(tmpdir(), `openclaw-session-test-${Date.now()}.json`),
},
},
);

View File

@@ -68,7 +68,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -77,7 +77,7 @@ function _makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -100,7 +100,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {
@@ -142,7 +142,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {
@@ -191,7 +191,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {

View File

@@ -69,7 +69,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -78,7 +78,7 @@ function _makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -108,7 +108,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {
@@ -152,7 +152,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {
@@ -197,7 +197,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {

View File

@@ -70,7 +70,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -79,7 +79,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -67,7 +67,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -76,7 +76,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -166,7 +166,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -197,7 +197,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -68,7 +68,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -77,7 +77,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -107,7 +107,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {
@@ -145,7 +145,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: { elevated: { allowFrom: { discord: ["steipete"] } } },
@@ -180,7 +180,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
tools: {

View File

@@ -69,7 +69,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -78,7 +78,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -111,7 +111,7 @@ describe("trigger handling", () => {
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(text).toBe(
"⚠️ Agent failed before reply: sandbox is not defined.\nLogs: moltbot logs --follow",
"⚠️ Agent failed before reply: sandbox is not defined.\nLogs: openclaw logs --follow",
);
expect(runEmbeddedPiAgent).toHaveBeenCalledOnce();
});

View File

@@ -68,7 +68,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -77,7 +77,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -107,7 +107,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -149,7 +149,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -201,7 +201,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -69,7 +69,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -78,7 +78,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -98,7 +98,7 @@ describe("trigger handling", () => {
it("reports active auth profile and key snippet in status", async () => {
await withTempHome(async (home) => {
const cfg = makeCfg(home);
const agentDir = join(home, ".clawdbot", "agents", "main", "agent");
const agentDir = join(home, ".openclaw", "agents", "main", "agent");
await fs.mkdir(agentDir, { recursive: true });
await fs.writeFile(
join(agentDir, "auth-profiles.json"),

View File

@@ -73,7 +73,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -82,7 +82,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -101,7 +101,7 @@ afterEach(() => {
describe("trigger handling", () => {
it("runs /compact as a gated command", async () => {
await withTempHome(async (home) => {
const storePath = join(tmpdir(), `moltbot-session-test-${Date.now()}.json`);
const storePath = join(tmpdir(), `openclaw-session-test-${Date.now()}.json`);
vi.mocked(compactEmbeddedPiSession).mockResolvedValue({
ok: true,
compacted: true,
@@ -124,7 +124,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -68,7 +68,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -77,7 +77,7 @@ function _makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -116,7 +116,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -125,7 +125,7 @@ describe("trigger handling", () => {
},
},
session: {
store: join(tmpdir(), `moltbot-session-test-${Date.now()}.json`),
store: join(tmpdir(), `openclaw-session-test-${Date.now()}.json`),
},
},
);
@@ -150,7 +150,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -159,7 +159,7 @@ describe("trigger handling", () => {
},
},
session: {
store: join(tmpdir(), `moltbot-session-test-${Date.now()}.json`),
store: join(tmpdir(), `openclaw-session-test-${Date.now()}.json`),
},
},
);
@@ -181,7 +181,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -190,7 +190,7 @@ describe("trigger handling", () => {
},
},
session: {
store: join(tmpdir(), `moltbot-session-test-${Date.now()}.json`),
store: join(tmpdir(), `openclaw-session-test-${Date.now()}.json`),
},
},
);

View File

@@ -68,7 +68,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -77,7 +77,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -199,7 +199,7 @@ describe("trigger handling", () => {
makeCfg(home),
);
const text = Array.isArray(res) ? res[0]?.text : res?.text;
expect(text).toContain("Moltbot");
expect(text).toContain("OpenClaw");
expect(runEmbeddedPiAgent).not.toHaveBeenCalled();
});
});

View File

@@ -69,7 +69,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -78,7 +78,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {

View File

@@ -14,7 +14,7 @@ import { ensureSandboxWorkspaceForSession } from "../agents/sandbox.js";
import { stageSandboxMedia } from "./reply/stage-sandbox-media.js";
async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
return withTempHomeBase(async (home) => await fn(home), { prefix: "moltbot-triggers-" });
return withTempHomeBase(async (home) => await fn(home), { prefix: "openclaw-triggers-" });
}
afterEach(() => {
@@ -24,7 +24,7 @@ afterEach(() => {
describe("stageSandboxMedia", () => {
it("stages inbound media into the sandbox workspace", async () => {
await withTempHome(async (home) => {
const inboundDir = join(home, ".clawdbot", "media", "inbound");
const inboundDir = join(home, ".openclaw", "media", "inbound");
await fs.mkdir(inboundDir, { recursive: true });
const mediaPath = join(inboundDir, "photo.jpg");
await fs.writeFile(mediaPath, "test");
@@ -54,7 +54,7 @@ describe("stageSandboxMedia", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
sandbox: {
mode: "non-main",
workspaceRoot: join(home, "sandboxes"),
@@ -65,7 +65,7 @@ describe("stageSandboxMedia", () => {
session: { store: join(home, "sessions.json") },
},
sessionKey: "agent:main:main",
workspaceDir: join(home, "clawd"),
workspaceDir: join(home, "openclaw"),
});
const stagedPath = `media/inbound/${basename(mediaPath)}`;

View File

@@ -70,7 +70,7 @@ async function withTempHome<T>(fn: (home: string) => Promise<T>): Promise<T> {
vi.mocked(abortEmbeddedPiRun).mockClear();
return await fn(home);
},
{ prefix: "moltbot-triggers-" },
{ prefix: "openclaw-triggers-" },
);
}
@@ -79,7 +79,7 @@ function makeCfg(home: string) {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
},
channels: {
@@ -249,7 +249,7 @@ describe("trigger handling", () => {
agents: {
defaults: {
model: "anthropic/claude-opus-4-5",
workspace: join(home, "clawd"),
workspace: join(home, "openclaw"),
},
list: [{ id: "coding", model: "minimax/MiniMax-M2.1" }],
},

View File

@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
import os from "node:os";
import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { isAbortTrigger, tryFastAbortFromMessage } from "./abort.js";
import { enqueueFollowupRun, getFollowupQueueDepth, type FollowupRun } from "./queue.js";
import { initSessionState } from "./session.js";
@@ -29,9 +29,9 @@ vi.mock("../../agents/subagent-registry.js", () => ({
describe("abort detection", () => {
it("triggerBodyNormalized extracts /stop from RawBody for abort detection", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as MoltbotConfig;
const cfg = { session: { store: storePath } } as OpenClawConfig;
const groupMessageCtx = {
Body: `[Context]\nJake: /stop\n[from: Jake]`,
@@ -63,9 +63,9 @@ describe("abort detection", () => {
});
it("fast-aborts even when text commands are disabled", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath }, commands: { text: false } } as MoltbotConfig;
const cfg = { session: { store: storePath }, commands: { text: false } } as OpenClawConfig;
const result = await tryFastAbortFromMessage({
ctx: buildTestCtx({
@@ -85,9 +85,9 @@ describe("abort detection", () => {
});
it("fast-abort clears queued followups and session lane", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as MoltbotConfig;
const cfg = { session: { store: storePath } } as OpenClawConfig;
const sessionKey = "telegram:123";
const sessionId = "session-123";
await fs.writeFile(
@@ -150,9 +150,9 @@ describe("abort detection", () => {
});
it("fast-abort stops active subagent runs for requester session", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as MoltbotConfig;
const cfg = { session: { store: storePath } } as OpenClawConfig;
const sessionKey = "telegram:parent";
const childKey = "agent:main:subagent:child-1";
const sessionId = "session-parent";

View File

@@ -1,7 +1,7 @@
import { resolveSessionAgentId } from "../../agents/agent-scope.js";
import { abortEmbeddedPiRun } from "../../agents/pi-embedded.js";
import { listSubagentRunsForRequester } from "../../agents/subagent-registry.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import {
loadSessionStore,
resolveStorePath,
@@ -63,7 +63,7 @@ function resolveAbortTargetKey(ctx: MsgContext): string | undefined {
}
function normalizeRequesterSessionKey(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
key: string | undefined,
): string | undefined {
const cleaned = key?.trim();
@@ -73,7 +73,7 @@ function normalizeRequesterSessionKey(
}
export function stopSubagentsForRequester(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
requesterSessionKey?: string;
}): { stopped: number } {
const requesterKey = normalizeRequesterSessionKey(params.cfg, params.requesterSessionKey);
@@ -116,7 +116,7 @@ export function stopSubagentsForRequester(params: {
export async function tryFastAbortFromMessage(params: {
ctx: FinalizedMsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
}): Promise<{ handled: boolean; aborted: boolean; stoppedSubagents?: number }> {
const { ctx, cfg } = params;
const targetKey = resolveAbortTargetKey(ctx);

View File

@@ -535,7 +535,7 @@ export async function runAgentTurnWithFallback(params: {
? "⚠️ Context overflow — prompt too large for this model. Try a shorter message or a larger-context model."
: isRoleOrderingError
? "⚠️ Message ordering conflict - please try again. If this persists, use /new to start a fresh session."
: `⚠️ Agent failed before reply: ${trimmedMessage}.\nLogs: moltbot logs --follow`;
: `⚠️ Agent failed before reply: ${trimmedMessage}.\nLogs: openclaw logs --follow`;
return {
kind: "final",

View File

@@ -4,7 +4,7 @@ import { runWithModelFallback } from "../../agents/model-fallback.js";
import { isCliProvider } from "../../agents/model-selection.js";
import { runEmbeddedPiAgent } from "../../agents/pi-embedded.js";
import { resolveSandboxConfigForAgent, resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import {
resolveAgentIdFromSessionKey,
type SessionEntry,
@@ -25,7 +25,7 @@ import type { FollowupRun } from "./queue.js";
import { incrementCompactionCount } from "./session-updates.js";
export async function runMemoryFlushIfNeeded(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
followupRun: FollowupRun;
sessionCtx: TemplateContext;
opts?: GetReplyOptions;

View File

@@ -1,11 +1,11 @@
import { describe, expect, it } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { TemplateContext } from "../templating.js";
import { buildThreadingToolContext } from "./agent-runner-utils.js";
describe("buildThreadingToolContext", () => {
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
it("uses conversation id for WhatsApp", () => {
const sessionCtx = {
@@ -97,7 +97,7 @@ describe("buildThreadingToolContext", () => {
const result = buildThreadingToolContext({
sessionCtx,
config: { channels: { slack: { replyToMode: "all" } } } as MoltbotConfig,
config: { channels: { slack: { replyToMode: "all" } } } as OpenClawConfig,
hasRepliedRef: undefined,
});

View File

@@ -2,7 +2,7 @@ import type { NormalizedUsage } from "../../agents/usage.js";
import { getChannelDock } from "../../channels/dock.js";
import type { ChannelId, ChannelThreadingToolContext } from "../../channels/plugins/types.js";
import { normalizeAnyChannelId, normalizeChannelId } from "../../channels/registry.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { isReasoningTagProvider } from "../../utils/provider-utils.js";
import { estimateUsageCost, formatTokenCount, formatUsd } from "../../utils/usage-format.js";
import type { TemplateContext } from "../templating.js";
@@ -16,7 +16,7 @@ const BUN_FETCH_SOCKET_ERROR_RE = /socket connection was closed unexpectedly/i;
*/
export function buildThreadingToolContext(params: {
sessionCtx: TemplateContext;
config: MoltbotConfig | undefined;
config: OpenClawConfig | undefined;
hasRepliedRef: { value: boolean } | undefined;
}): ChannelThreadingToolContext {
const { sessionCtx, config, hasRepliedRef } = params;

View File

@@ -62,7 +62,7 @@ function createBaseRun(params: { runOverrides?: Partial<FollowupRun["run"]> }) {
skillsSnapshot: {},
provider: "anthropic",
model: "claude-opus",
authProfileId: "anthropic:clawd",
authProfileId: "anthropic:openclaw",
authProfileIdSource: "manual",
thinkLevel: "low",
verboseLevel: "off",
@@ -105,7 +105,7 @@ describe("authProfileId fallback scoping", () => {
runOverrides: {
provider: "anthropic",
model: "claude-opus",
authProfileId: "anthropic:clawd",
authProfileId: "anthropic:openclaw",
authProfileIdSource: "manual",
},
});

View File

@@ -122,9 +122,9 @@ function createMinimalRun(params?: {
describe("runReplyAgent typing (heartbeat)", () => {
it("resets corrupted Gemini sessions and deletes transcripts", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-reset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const prevStateDir = process.env.OPENCLAW_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "openclaw-session-reset-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
try {
const sessionId = "session-corrupt";
const storePath = path.join(stateDir, "sessions", "sessions.json");
@@ -162,16 +162,16 @@ describe("runReplyAgent typing (heartbeat)", () => {
expect(persisted.main).toBeUndefined();
} finally {
if (prevStateDir) {
process.env.CLAWDBOT_STATE_DIR = prevStateDir;
process.env.OPENCLAW_STATE_DIR = prevStateDir;
} else {
delete process.env.CLAWDBOT_STATE_DIR;
delete process.env.OPENCLAW_STATE_DIR;
}
}
});
it("keeps sessions intact on other errors", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-noreset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const prevStateDir = process.env.OPENCLAW_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "openclaw-session-noreset-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
try {
const sessionId = "session-ok";
const storePath = path.join(stateDir, "sessions", "sessions.json");
@@ -207,9 +207,9 @@ describe("runReplyAgent typing (heartbeat)", () => {
expect(persisted.main).toBeDefined();
} finally {
if (prevStateDir) {
process.env.CLAWDBOT_STATE_DIR = prevStateDir;
process.env.OPENCLAW_STATE_DIR = prevStateDir;
} else {
delete process.env.CLAWDBOT_STATE_DIR;
delete process.env.OPENCLAW_STATE_DIR;
}
}
});

View File

@@ -126,9 +126,9 @@ describe("runReplyAgent typing (heartbeat)", () => {
});
it("retries after compaction failure by resetting the session", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-compaction-reset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const prevStateDir = process.env.OPENCLAW_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "openclaw-session-compaction-reset-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
try {
const sessionId = "session";
const storePath = path.join(stateDir, "sessions", "sessions.json");
@@ -167,17 +167,17 @@ describe("runReplyAgent typing (heartbeat)", () => {
expect(persisted.main.sessionId).toBe(sessionStore.main.sessionId);
} finally {
if (prevStateDir) {
process.env.CLAWDBOT_STATE_DIR = prevStateDir;
process.env.OPENCLAW_STATE_DIR = prevStateDir;
} else {
delete process.env.CLAWDBOT_STATE_DIR;
delete process.env.OPENCLAW_STATE_DIR;
}
}
});
it("retries after context overflow payload by resetting the session", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-overflow-reset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const prevStateDir = process.env.OPENCLAW_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "openclaw-session-overflow-reset-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
try {
const sessionId = "session";
const storePath = path.join(stateDir, "sessions", "sessions.json");
@@ -221,17 +221,17 @@ describe("runReplyAgent typing (heartbeat)", () => {
expect(persisted.main.sessionId).toBe(sessionStore.main.sessionId);
} finally {
if (prevStateDir) {
process.env.CLAWDBOT_STATE_DIR = prevStateDir;
process.env.OPENCLAW_STATE_DIR = prevStateDir;
} else {
delete process.env.CLAWDBOT_STATE_DIR;
delete process.env.OPENCLAW_STATE_DIR;
}
}
});
it("resets the session after role ordering payloads", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-role-ordering-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const prevStateDir = process.env.OPENCLAW_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "openclaw-session-role-ordering-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
try {
const sessionId = "session";
const storePath = path.join(stateDir, "sessions", "sessions.json");
@@ -275,9 +275,9 @@ describe("runReplyAgent typing (heartbeat)", () => {
expect(persisted.main.sessionId).toBe(sessionStore.main.sessionId);
} finally {
if (prevStateDir) {
process.env.CLAWDBOT_STATE_DIR = prevStateDir;
process.env.OPENCLAW_STATE_DIR = prevStateDir;
} else {
delete process.env.CLAWDBOT_STATE_DIR;
delete process.env.OPENCLAW_STATE_DIR;
}
}
});

View File

@@ -180,7 +180,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
});
it("announces auto-compaction in verbose mode and tracks count", async () => {
const storePath = path.join(
await fs.mkdtemp(path.join(tmpdir(), "moltbot-compaction-")),
await fs.mkdtemp(path.join(tmpdir(), "openclaw-compaction-")),
"sessions.json",
);
const sessionEntry = { sessionId: "session", updatedAt: Date.now() };

View File

@@ -122,9 +122,9 @@ function createMinimalRun(params?: {
describe("runReplyAgent typing (heartbeat)", () => {
it("still replies even if session reset fails to persist", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-reset-fail-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const prevStateDir = process.env.OPENCLAW_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "openclaw-session-reset-fail-"));
process.env.OPENCLAW_STATE_DIR = stateDir;
const saveSpy = vi.spyOn(sessions, "saveSessionStore").mockRejectedValueOnce(new Error("boom"));
try {
const sessionId = "session-corrupt";
@@ -158,9 +158,9 @@ describe("runReplyAgent typing (heartbeat)", () => {
} finally {
saveSpy.mockRestore();
if (prevStateDir) {
process.env.CLAWDBOT_STATE_DIR = prevStateDir;
process.env.OPENCLAW_STATE_DIR = prevStateDir;
} else {
delete process.env.CLAWDBOT_STATE_DIR;
delete process.env.OPENCLAW_STATE_DIR;
}
}
});

View File

@@ -124,7 +124,7 @@ function createBaseRun(params: {
describe("runReplyAgent memory flush", () => {
it("increments compaction count when flush compaction completes", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {

View File

@@ -124,7 +124,7 @@ function createBaseRun(params: {
describe("runReplyAgent memory flush", () => {
it("runs a memory flush turn and updates session metadata", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {
@@ -186,7 +186,7 @@ describe("runReplyAgent memory flush", () => {
});
it("skips memory flush when disabled in config", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {

View File

@@ -124,7 +124,7 @@ describe("runReplyAgent memory flush", () => {
it("skips memory flush for CLI providers", async () => {
runEmbeddedPiAgentMock.mockReset();
runCliAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {

View File

@@ -123,7 +123,7 @@ function createBaseRun(params: {
describe("runReplyAgent memory flush", () => {
it("skips memory flush when the sandbox workspace is read-only", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {
@@ -188,7 +188,7 @@ describe("runReplyAgent memory flush", () => {
});
it("skips memory flush when the sandbox workspace is none", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {

View File

@@ -124,7 +124,7 @@ function createBaseRun(params: {
describe("runReplyAgent memory flush", () => {
it("uses configured prompts for memory flush runs", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {
@@ -201,7 +201,7 @@ describe("runReplyAgent memory flush", () => {
});
it("skips memory flush after a prior flush in the same compaction cycle", async () => {
runEmbeddedPiAgentMock.mockReset();
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-flush-"));
const storePath = path.join(tmp, "sessions.json");
const sessionKey = "main";
const sessionEntry = {

View File

@@ -154,7 +154,7 @@ describe("runReplyAgent messaging tool suppression", () => {
it("persists usage even when replies are suppressed", async () => {
const storePath = path.join(
await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-session-store-")),
await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-session-store-")),
"sessions.json",
);
const sessionKey = "main";

View File

@@ -3,7 +3,7 @@ import { getFinishedSession, getSession, markExited } from "../../agents/bash-pr
import { createExecTool } from "../../agents/bash-tools.js";
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import { killProcessTree } from "../../agents/shell-utils.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { formatCliCommand } from "../../cli/command-format.js";
import { logVerbose } from "../../globals.js";
import { clampInt } from "../../utils.js";
@@ -33,7 +33,7 @@ type ActiveBashJob =
let activeJob: ActiveBashJob | null = null;
function resolveForegroundMs(cfg: MoltbotConfig): number {
function resolveForegroundMs(cfg: OpenClawConfig): number {
const raw = cfg.commands?.bashForegroundMs;
if (typeof raw !== "number" || Number.isNaN(raw)) return DEFAULT_FOREGROUND_MS;
return clampInt(raw, 0, MAX_FOREGROUND_MS);
@@ -87,7 +87,7 @@ function parseBashRequest(raw: string): BashRequest | null {
function resolveRawCommandBody(params: {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId?: string;
isGroup: boolean;
}) {
@@ -169,7 +169,7 @@ function formatElevatedUnavailableMessage(params: {
lines.push("- agents.list[].tools.elevated.allowFrom.<provider>");
if (params.sessionKey) {
lines.push(
`See: ${formatCliCommand(`moltbot sandbox explain --session ${params.sessionKey}`)}`,
`See: ${formatCliCommand(`openclaw sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");
@@ -177,7 +177,7 @@ function formatElevatedUnavailableMessage(params: {
export async function handleBashChatCommand(params: {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId?: string;
sessionKey: string;
isGroup: boolean;
@@ -189,7 +189,7 @@ export async function handleBashChatCommand(params: {
}): Promise<ReplyPayload> {
if (params.cfg.commands?.bash !== true) {
return {
text: "⚠️ bash is disabled. Set commands.bash=true to enable. Docs: https://docs.molt.bot/tools/slash-commands#config",
text: "⚠️ bash is disabled. Set commands.bash=true to enable. Docs: https://docs.openclaw.ai/tools/slash-commands#config",
};
}

View File

@@ -1,6 +1,6 @@
import { getChannelDock } from "../../channels/dock.js";
import { normalizeChannelId } from "../../channels/plugins/index.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { BlockStreamingCoalesceConfig } from "../../config/types.js";
import { normalizeAccountId } from "../../routing/session-key.js";
import {
@@ -29,7 +29,7 @@ type ProviderBlockStreamingConfig = {
};
function resolveProviderBlockStreamingCoalesce(params: {
cfg: MoltbotConfig | undefined;
cfg: OpenClawConfig | undefined;
providerKey?: TextChunkProvider;
accountId?: string | null;
}): BlockStreamingCoalesceConfig | undefined {
@@ -51,7 +51,7 @@ export type BlockStreamingCoalescing = {
};
export function resolveBlockStreamingChunking(
cfg: MoltbotConfig | undefined,
cfg: OpenClawConfig | undefined,
provider?: string,
accountId?: string | null,
): {
@@ -88,7 +88,7 @@ export function resolveBlockStreamingChunking(
}
export function resolveBlockStreamingCoalescing(
cfg: MoltbotConfig | undefined,
cfg: OpenClawConfig | undefined,
provider?: string,
accountId?: string | null,
chunking?: {

View File

@@ -22,7 +22,7 @@ import {
readChannelAllowFromStore,
removeChannelAllowFromStoreEntry,
} from "../../pairing/pairing-store.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { ChannelId } from "../../channels/plugins/types.js";
import type { CommandHandler } from "./commands-types.js";
@@ -134,7 +134,7 @@ function parseAllowlistCommand(raw: string): AllowlistCommand | null {
}
function normalizeAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
channelId: ChannelId;
accountId?: string | null;
values: Array<string | number>;
@@ -259,7 +259,7 @@ function resolveChannelAllowFromPaths(
}
async function resolveSlackNames(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
entries: string[];
}) {
@@ -275,7 +275,7 @@ async function resolveSlackNames(params: {
}
async function resolveDiscordNames(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
entries: string[];
}) {

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { MsgContext } from "../templating.js";
import { buildCommandContext, handleCommands } from "./commands.js";
import { parseInlineDirectives } from "./directive-handling.js";
@@ -10,7 +10,7 @@ vi.mock("../../gateway/call.js", () => ({
callGateway: vi.fn(),
}));
function buildParams(commandBody: string, cfg: MoltbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: OpenClawConfig, ctxOverrides?: Partial<MsgContext>) {
const ctx = {
Body: commandBody,
CommandBody: commandBody,
@@ -53,7 +53,7 @@ describe("/approve command", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/approve", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -64,7 +64,7 @@ describe("/approve command", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/approve abc allow-once", cfg, { SenderId: "123" });
const mockCallGateway = vi.mocked(callGateway);

View File

@@ -4,7 +4,7 @@ import {
isEmbeddedPiRunActive,
waitForEmbeddedPiRunEnd,
} from "../../agents/pi-embedded.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { resolveSessionFilePath } from "../../config/sessions.js";
import { logVerbose } from "../../globals.js";
import { enqueueSystemEvent } from "../../infra/system-events.js";
@@ -16,7 +16,7 @@ import { incrementCompactionCount } from "./session-updates.js";
function extractCompactInstructions(params: {
rawBody?: string;
ctx: import("../templating.js").MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId?: string;
isGroup: boolean;
}): string | undefined {

View File

@@ -1,6 +1,6 @@
import { resolveSessionAgentIds } from "../../agents/agent-scope.js";
import { resolveBootstrapMaxChars } from "../../agents/pi-embedded-helpers.js";
import { createMoltbotCodingTools } from "../../agents/pi-tools.js";
import { createOpenClawCodingTools } from "../../agents/pi-tools.js";
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
import { getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
@@ -77,7 +77,7 @@ async function resolveContextReport(
});
const tools = (() => {
try {
return createMoltbotCodingTools({
return createOpenClawCodingTools({
config: params.cfg,
workspaceDir,
sessionKey: params.sessionKey,

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { resolveCommandAuthorization } from "../command-auth.js";
import { normalizeCommandBody } from "../commands-registry.js";
import type { MsgContext } from "../templating.js";
@@ -7,7 +7,7 @@ import { stripMentions } from "./mentions.js";
export function buildCommandContext(params: {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId?: string;
sessionKey?: string;
isGroup: boolean;

View File

@@ -7,7 +7,7 @@ import {
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import { DEFAULT_MODEL, DEFAULT_PROVIDER } from "../../agents/defaults.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { ReplyPayload } from "../types.js";
import type { CommandHandler } from "./commands-types.js";
@@ -70,7 +70,7 @@ function parseModelsArgs(raw: string): {
}
export async function resolveModelsCommandReply(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
commandBodyNormalized: string;
}): Promise<ReplyPayload | null> {
const body = params.commandBodyNormalized.trim();

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { MsgContext } from "../templating.js";
import { buildCommandContext, handleCommands } from "./commands.js";
import { extractMessageText } from "./commands-subagents.js";
@@ -8,7 +8,7 @@ import { parseConfigCommand } from "./config-commands.js";
import { parseDebugCommand } from "./debug-commands.js";
import { parseInlineDirectives } from "./directive-handling.js";
function buildParams(commandBody: string, cfg: MoltbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: OpenClawConfig, ctxOverrides?: Partial<MsgContext>) {
const ctx = {
Body: commandBody,
CommandBody: commandBody,
@@ -116,7 +116,7 @@ describe("handleCommands /config configWrites gating", () => {
const cfg = {
commands: { config: true, text: true },
channels: { whatsapp: { allowFrom: ["*"], configWrites: false } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams('/config set messages.ackReaction=":)"', cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { MsgContext } from "../templating.js";
import { buildCommandContext, handleCommands } from "./commands.js";
import { parseInlineDirectives } from "./directive-handling.js";
@@ -56,7 +56,7 @@ vi.mock("../../agents/model-catalog.js", () => ({
]),
}));
function buildParams(commandBody: string, cfg: MoltbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: OpenClawConfig, ctxOverrides?: Partial<MsgContext>) {
const ctx = {
Body: commandBody,
CommandBody: commandBody,
@@ -101,7 +101,7 @@ describe("handleCommands /allowlist", () => {
const cfg = {
commands: { text: true },
channels: { telegram: { allowFrom: ["123", "@Alice"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/allowlist list dm", cfg);
const result = await handleCommands(params);
@@ -130,7 +130,7 @@ describe("handleCommands /allowlist", () => {
const cfg = {
commands: { text: true, config: true },
channels: { telegram: { allowFrom: ["123"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/allowlist add dm 789", cfg);
const result = await handleCommands(params);
@@ -152,7 +152,7 @@ describe("/models command", () => {
const cfg = {
commands: { text: true },
agents: { defaults: { model: { primary: "anthropic/claude-opus-4-5" } } },
} as unknown as MoltbotConfig;
} as unknown as OpenClawConfig;
it.each(["telegram", "discord", "whatsapp"])("lists providers on %s", async (surface) => {
const params = buildParams("/models", cfg, { Provider: surface, Surface: surface });
@@ -212,7 +212,7 @@ describe("/models command", () => {
imageModel: "visionpro/studio-v1",
},
},
} as unknown as MoltbotConfig;
} as unknown as OpenClawConfig;
const providerList = await handleCommands(buildParams("/models", customCfg));
expect(providerList.reply?.text).toContain("localai");

View File

@@ -3,7 +3,7 @@ import type { SessionEntry } from "../../config/sessions.js";
import { updateSessionStore } from "../../config/sessions.js";
import { logVerbose } from "../../globals.js";
import { createInternalHookEvent, triggerInternalHook } from "../../hooks/internal-hooks.js";
import { scheduleGatewaySigusr1Restart, triggerMoltbotRestart } from "../../infra/restart.js";
import { scheduleGatewaySigusr1Restart, triggerOpenClawRestart } from "../../infra/restart.js";
import { parseActivationCommand } from "../group-activation.js";
import { parseSendPolicyCommand } from "../send-policy.js";
import { normalizeUsageDisplay, resolveResponseUsageMode } from "../thinking.js";
@@ -237,11 +237,11 @@ export const handleRestartCommand: CommandHandler = async (params, allowTextComm
return {
shouldContinue: false,
reply: {
text: "⚙️ Restarting moltbot in-process (SIGUSR1); back in a few seconds.",
text: "⚙️ Restarting OpenClaw in-process (SIGUSR1); back in a few seconds.",
},
};
}
const restartMethod = triggerMoltbotRestart();
const restartMethod = triggerOpenClawRestart();
if (!restartMethod.ok) {
const detail = restartMethod.detail ? ` Details: ${restartMethod.detail}` : "";
return {
@@ -254,7 +254,7 @@ export const handleRestartCommand: CommandHandler = async (params, allowTextComm
return {
shouldContinue: false,
reply: {
text: `⚙️ Restarting moltbot via ${restartMethod.method}; give me a few seconds to come back online.`,
text: `⚙️ Restarting OpenClaw via ${restartMethod.method}; give me a few seconds to come back online.`,
},
};
};

View File

@@ -15,7 +15,7 @@ import {
resolveMainSessionAlias,
} from "../../agents/tools/sessions-helpers.js";
import { normalizeProviderId } from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry, SessionScope } from "../../config/sessions.js";
import { logVerbose } from "../../globals.js";
import {
@@ -43,7 +43,7 @@ function formatApiKeySnippet(apiKey: string): string {
function resolveModelAuthLabel(
provider?: string,
cfg?: MoltbotConfig,
cfg?: OpenClawConfig,
sessionEntry?: SessionEntry,
agentDir?: string,
): string | undefined {
@@ -97,7 +97,7 @@ function resolveModelAuthLabel(
}
export async function buildStatusReply(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
command: CommandContext;
sessionEntry?: SessionEntry;
sessionKey: string;

View File

@@ -1,5 +1,5 @@
import type { ChannelId } from "../../channels/plugins/types.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry, SessionScope } from "../../config/sessions.js";
import type { SkillCommandSpec } from "../../agents/skills.js";
import type { MsgContext } from "../templating.js";
@@ -23,7 +23,7 @@ export type CommandContext = {
export type HandleCommandsParams = {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
command: CommandContext;
agentId?: string;
directives: InlineDirectives;

View File

@@ -8,7 +8,7 @@ import {
addSubagentRunForTests,
resetSubagentRegistryForTests,
} from "../../agents/subagent-registry.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import * as internalHooks from "../../hooks/internal-hooks.js";
import { clearPluginCommands, registerPluginCommand } from "../../plugins/commands.js";
import type { MsgContext } from "../templating.js";
@@ -33,7 +33,7 @@ vi.mock("./commands-context-report.js", () => ({
let testWorkspaceDir = os.tmpdir();
beforeAll(async () => {
testWorkspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-commands-"));
testWorkspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-commands-"));
await fs.writeFile(path.join(testWorkspaceDir, "AGENTS.md"), "# Agents\n", "utf-8");
});
@@ -41,7 +41,7 @@ afterAll(async () => {
await fs.rm(testWorkspaceDir, { recursive: true, force: true });
});
function buildParams(commandBody: string, cfg: MoltbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: OpenClawConfig, ctxOverrides?: Partial<MsgContext>) {
const ctx = {
Body: commandBody,
CommandBody: commandBody,
@@ -85,7 +85,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { bash: false, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/bash echo hi", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -97,7 +97,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { bash: true, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/bash echo hi", cfg);
params.elevated = {
enabled: true,
@@ -113,7 +113,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { config: false, debug: false, text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/config show", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -124,7 +124,7 @@ describe("handleCommands gating", () => {
const cfg = {
commands: { config: false, debug: false, text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/debug show", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -138,7 +138,7 @@ describe("handleCommands bash alias", () => {
const cfg = {
commands: { bash: true, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("!poll", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -150,7 +150,7 @@ describe("handleCommands bash alias", () => {
const cfg = {
commands: { bash: true, text: true },
whatsapp: { allowFrom: ["*"] },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("!stop", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -171,7 +171,7 @@ describe("handleCommands plugin commands", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/card", cfg);
const commandResult = await handleCommands(params);
@@ -186,7 +186,7 @@ describe("handleCommands identity", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/whoami", cfg, {
SenderId: "12345",
SenderUsername: "TestUser",
@@ -206,7 +206,7 @@ describe("handleCommands hooks", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/new take notes", cfg);
const spy = vi.spyOn(internalHooks, "triggerInternalHook").mockResolvedValue();
@@ -222,7 +222,7 @@ describe("handleCommands context", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/context", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -234,7 +234,7 @@ describe("handleCommands context", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/context list", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -246,7 +246,7 @@ describe("handleCommands context", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/context detail", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -261,7 +261,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents list", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -283,7 +283,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents list", cfg, {
CommandSource: "native",
CommandTargetSessionKey: "agent:main:main",
@@ -301,7 +301,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/status", cfg);
params.resolvedVerboseLevel = "on";
const result = await handleCommands(params);
@@ -314,7 +314,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents foo", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -326,7 +326,7 @@ describe("handleCommands subagents", () => {
const cfg = {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents info", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -349,7 +349,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/status", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -384,7 +384,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/status", cfg);
params.resolvedVerboseLevel = "on";
const result = await handleCommands(params);
@@ -411,7 +411,7 @@ describe("handleCommands subagents", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
session: { mainKey: "main", scope: "per-sender" },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/subagents info 1", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);
@@ -427,7 +427,7 @@ describe("handleCommands /tts", () => {
commands: { text: true },
channels: { whatsapp: { allowFrom: ["*"] } },
messages: { tts: { prefsPath: path.join(testWorkspaceDir, "tts.json") } },
} as MoltbotConfig;
} as OpenClawConfig;
const params = buildParams("/tts", cfg);
const result = await handleCommands(params);
expect(result.shouldContinue).toBe(false);

View File

@@ -10,7 +10,7 @@ import {
resolveEnvApiKey,
} from "../../agents/model-auth.js";
import { normalizeProviderId } from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { shortenHomePath } from "../../utils.js";
export type ModelAuthDetailMode = "compact" | "verbose";
@@ -24,7 +24,7 @@ const maskApiKey = (value: string): string => {
export const resolveAuthLabel = async (
provider: string,
cfg: MoltbotConfig,
cfg: OpenClawConfig,
modelsPath: string,
agentDir?: string,
mode: ModelAuthDetailMode = "compact",
@@ -201,7 +201,7 @@ export const formatAuthLabel = (auth: { label: string; source: string }) => {
export const resolveProfileOverride = (params: {
rawProfile?: string;
provider: string;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentDir?: string;
}): { profileId?: string; error?: string } => {
const raw = params.rawProfile?.trim();

View File

@@ -1,5 +1,5 @@
import type { ModelAliasIndex } from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { MsgContext } from "../templating.js";
import type { ReplyPayload } from "../types.js";
@@ -12,7 +12,7 @@ export async function applyInlineDirectivesFastLane(params: {
directives: InlineDirectives;
commandAuthorized: boolean;
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId?: string;
isGroup: boolean;
sessionEntry: SessionEntry;
@@ -35,7 +35,7 @@ export async function applyInlineDirectivesFastLane(params: {
model: string;
initialModelLabel: string;
formatModelSwitchEvent: (label: string, alias?: string) => string;
agentCfg?: NonNullable<MoltbotConfig["agents"]>["defaults"];
agentCfg?: NonNullable<OpenClawConfig["agents"]>["defaults"];
modelState: {
resolveDefaultThinkingLevel: () => Promise<ThinkLevel | undefined>;
allowedModelKeys: Set<string>;

View File

@@ -5,7 +5,7 @@ import {
} from "../../agents/agent-scope.js";
import type { ModelAliasIndex } from "../../agents/model-selection.js";
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { type SessionEntry, updateSessionStore } from "../../config/sessions.js";
import type { ExecAsk, ExecHost, ExecSecurity } from "../../infra/exec-approvals.js";
import { enqueueSystemEvent } from "../../infra/system-events.js";
@@ -30,7 +30,7 @@ import {
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "./directives.js";
function resolveExecDefaults(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
sessionEntry?: SessionEntry;
agentId?: string;
}): { host: ExecHost; security: ExecSecurity; ask: ExecAsk; node?: string } {
@@ -60,7 +60,7 @@ function resolveExecDefaults(params: {
}
export async function handleDirectiveOnly(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
directives: InlineDirectives;
sessionEntry: SessionEntry;
sessionStore: Record<string, SessionEntry>;

View File

@@ -1,5 +1,5 @@
import { type ModelRef, normalizeProviderId } from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
export type ModelPickerCatalogEntry = {
provider: string;
@@ -68,7 +68,7 @@ export function buildModelPickerItems(catalog: ModelPickerCatalogEntry[]): Model
export function resolveProviderEndpointLabel(
provider: string,
cfg: MoltbotConfig,
cfg: OpenClawConfig,
): { endpoint?: string; api?: string } {
const normalized = normalizeProviderId(provider);
const providers = (cfg.models?.providers ?? {}) as Record<

View File

@@ -1,7 +1,7 @@
import { describe, expect, it, vi } from "vitest";
import type { ModelAliasIndex } from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import { parseInlineDirectives } from "./directive-handling.js";
import { handleDirectiveOnly } from "./directive-handling.impl.js";
@@ -33,17 +33,17 @@ function baseAliasIndex(): ModelAliasIndex {
return { byAlias: new Map(), byKey: new Map() };
}
function baseConfig(): MoltbotConfig {
function baseConfig(): OpenClawConfig {
return {
commands: { text: true },
agents: { defaults: {} },
} as unknown as MoltbotConfig;
} as unknown as OpenClawConfig;
}
describe("/model chat UX", () => {
it("shows summary for /model with no args", async () => {
const directives = parseInlineDirectives("/model");
const cfg = { commands: { text: true } } as unknown as MoltbotConfig;
const cfg = { commands: { text: true } } as unknown as OpenClawConfig;
const reply = await maybeHandleModelDirectiveInfo({
directives,
@@ -66,7 +66,7 @@ describe("/model chat UX", () => {
it("auto-applies closest match for typos", () => {
const directives = parseInlineDirectives("/model anthropic/claud-opus-4-5");
const cfg = { commands: { text: true } } as unknown as MoltbotConfig;
const cfg = { commands: { text: true } } as unknown as OpenClawConfig;
const resolved = resolveModelSelectionFromDirective({
directives,

View File

@@ -6,7 +6,7 @@ import {
resolveConfiguredModelRef,
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { shortenHomePath } from "../../utils.js";
import type { ReplyPayload } from "../types.js";
import {
@@ -24,7 +24,7 @@ import { resolveModelsCommandReply } from "./commands-models.js";
import { type ModelDirectiveSelection, resolveModelDirectiveSelection } from "./model-selection.js";
function buildModelPickerCatalog(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
defaultProvider: string;
defaultModel: string;
aliasIndex: ModelAliasIndex;
@@ -153,7 +153,7 @@ function buildModelPickerCatalog(params: {
export async function maybeHandleModelDirectiveInfo(params: {
directives: InlineDirectives;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentDir: string;
activeAgentId: string;
provider: string;
@@ -271,7 +271,7 @@ export async function maybeHandleModelDirectiveInfo(params: {
export function resolveModelSelectionFromDirective(params: {
directives: InlineDirectives;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentDir: string;
defaultProvider: string;
defaultModel: string;

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { ExecAsk, ExecHost, ExecSecurity } from "../../infra/exec-approvals.js";
import { extractModelDirective } from "../model.js";
import type { MsgContext } from "../templating.js";
@@ -193,7 +193,7 @@ export function isDirectiveOnly(params: {
directives: InlineDirectives;
cleanedBody: string;
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId?: string;
isGroup: boolean;
}): boolean {

View File

@@ -12,7 +12,7 @@ import {
resolveDefaultModelForAgent,
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { type SessionEntry, updateSessionStore } from "../../config/sessions.js";
import { enqueueSystemEvent } from "../../infra/system-events.js";
import { applyVerboseOverride } from "../../sessions/level-overrides.js";
@@ -25,7 +25,7 @@ import type { ElevatedLevel, ReasoningLevel } from "./directives.js";
export async function persistInlineDirectives(params: {
directives: InlineDirectives;
effectiveModelDirective?: string;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentDir?: string;
sessionEntry?: SessionEntry;
sessionStore?: Record<string, SessionEntry>;
@@ -41,7 +41,7 @@ export async function persistInlineDirectives(params: {
model: string;
initialModelLabel: string;
formatModelSwitchEvent: (label: string, alias?: string) => string;
agentCfg: NonNullable<MoltbotConfig["agents"]>["defaults"] | undefined;
agentCfg: NonNullable<OpenClawConfig["agents"]>["defaults"] | undefined;
}): Promise<{ provider: string; model: string; contextTokens: number }> {
const {
directives,
@@ -227,7 +227,7 @@ export async function persistInlineDirectives(params: {
};
}
export function resolveDefaultModel(params: { cfg: MoltbotConfig; agentId?: string }): {
export function resolveDefaultModel(params: { cfg: OpenClawConfig; agentId?: string }): {
defaultProvider: string;
defaultModel: string;
aliasIndex: ModelAliasIndex;

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { ReplyPayload } from "../types.js";
import type { InlineDirectives } from "./directive-handling.parse.js";
@@ -7,7 +7,7 @@ import { resolveQueueSettings } from "./queue.js";
export function maybeHandleQueueDirective(params: {
directives: InlineDirectives;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
channel: string;
sessionEntry?: SessionEntry;
}): ReplyPayload | undefined {

View File

@@ -51,7 +51,7 @@ export function formatElevatedUnavailableText(params: {
}
if (params.sessionKey) {
lines.push(
`See: ${formatCliCommand(`moltbot sandbox explain --session ${params.sessionKey}`)}`,
`See: ${formatCliCommand(`openclaw sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");

View File

@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { MsgContext } from "../templating.js";
import type { GetReplyOptions, ReplyPayload } from "../types.js";
import type { ReplyDispatcher } from "./reply-dispatcher.js";
@@ -84,7 +84,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
mocks.routeReply.mockClear();
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -96,7 +96,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
_opts: GetReplyOptions | undefined,
_cfg: MoltbotConfig,
_cfg: OpenClawConfig,
) => ({ text: "hi" }) satisfies ReplyPayload;
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
@@ -110,7 +110,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
mocks.routeReply.mockClear();
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -123,7 +123,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
_opts: GetReplyOptions | undefined,
_cfg: MoltbotConfig,
_cfg: OpenClawConfig,
) => ({ text: "hi" }) satisfies ReplyPayload;
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
@@ -144,7 +144,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
mocks.routeReply.mockClear();
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -154,7 +154,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
opts: GetReplyOptions | undefined,
_cfg: ClawdbotConfig,
_cfg: OpenClawConfig,
) => {
expect(opts?.onToolResult).toBeDefined();
expect(typeof opts?.onToolResult).toBe("function");
@@ -170,7 +170,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = {} as ClawdbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -180,7 +180,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
opts: GetReplyOptions | undefined,
_cfg: MoltbotConfig,
_cfg: OpenClawConfig,
) => {
expect(opts?.onToolResult).toBeUndefined();
return { text: "hi" } satisfies ReplyPayload;
@@ -195,7 +195,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = {} as ClawdbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -205,7 +205,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
opts: GetReplyOptions | undefined,
_cfg: ClawdbotConfig,
_cfg: OpenClawConfig,
) => {
// Simulate tool result emission
await opts?.onToolResult?.({ text: "🔧 exec: ls" });
@@ -224,7 +224,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = {} as ClawdbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -235,7 +235,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
opts: GetReplyOptions | undefined,
_cfg: ClawdbotConfig,
_cfg: OpenClawConfig,
) => {
expect(opts?.onToolResult).toBeUndefined();
return { text: "hi" } satisfies ReplyPayload;
@@ -250,7 +250,7 @@ describe("dispatchReplyFromConfig", () => {
handled: true,
aborted: true,
});
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -272,7 +272,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: true,
stoppedSubagents: 2,
});
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -296,7 +296,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const ctx = buildTestCtx({
Provider: "whatsapp",
OriginatingChannel: "whatsapp",
@@ -327,7 +327,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
hookMocks.runner.hasHooks.mockReturnValue(true);
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -377,7 +377,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = { diagnostics: { enabled: true } } as MoltbotConfig;
const cfg = { diagnostics: { enabled: true } } as OpenClawConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -410,7 +410,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = { diagnostics: { enabled: true } } as MoltbotConfig;
const cfg = { diagnostics: { enabled: true } } as OpenClawConfig;
const ctx = buildTestCtx({
Provider: "whatsapp",
OriginatingChannel: "whatsapp",

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { resolveSessionAgentId } from "../../agents/agent-scope.js";
import { loadSessionStore, resolveStorePath } from "../../config/sessions.js";
import { logVerbose } from "../../globals.js";
@@ -49,7 +49,7 @@ const isInboundAudioContext = (ctx: FinalizedMsgContext): boolean => {
const resolveSessionTtsAuto = (
ctx: FinalizedMsgContext,
cfg: MoltbotConfig,
cfg: OpenClawConfig,
): string | undefined => {
const targetSessionKey =
ctx.CommandSource === "native" ? ctx.CommandTargetSessionKey?.trim() : undefined;
@@ -73,7 +73,7 @@ export type DispatchFromConfigResult = {
export async function dispatchReplyFromConfig(params: {
ctx: FinalizedMsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
dispatcher: ReplyDispatcher;
replyOptions?: Omit<GetReplyOptions, "onToolResult" | "onBlockReply">;
replyResolver?: typeof getReplyFromConfig;

View File

@@ -64,7 +64,7 @@ const baseQueuedRun = (messageProvider = "whatsapp"): FollowupRun =>
describe("createFollowupRunner compaction", () => {
it("adds verbose auto-compaction notice and tracks count", async () => {
const storePath = path.join(
await fs.mkdtemp(path.join(tmpdir(), "moltbot-compaction-")),
await fs.mkdtemp(path.join(tmpdir(), "openclaw-compaction-")),
"sessions.json",
);
const sessionEntry: SessionEntry = {
@@ -198,7 +198,7 @@ describe("createFollowupRunner messaging tool dedupe", () => {
it("persists usage even when replies are suppressed", async () => {
const storePath = path.join(
await fs.mkdtemp(path.join(tmpdir(), "moltbot-followup-usage-")),
await fs.mkdtemp(path.join(tmpdir(), "openclaw-followup-usage-")),
"sessions.json",
);
const sessionKey = "main";

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { MsgContext } from "../templating.js";
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../thinking.js";
@@ -14,7 +14,7 @@ import {
import type { createModelSelectionState } from "./model-selection.js";
import type { TypingController } from "./typing.js";
type AgentDefaults = NonNullable<MoltbotConfig["agents"]>["defaults"];
type AgentDefaults = NonNullable<OpenClawConfig["agents"]>["defaults"];
export type ApplyDirectiveResult =
| { kind: "reply"; reply: ReplyPayload | ReplyPayload[] | undefined }
@@ -35,7 +35,7 @@ export type ApplyDirectiveResult =
export async function applyInlineDirectiveOverrides(params: {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
agentDir: string;
agentCfg: AgentDefaults;

View File

@@ -2,7 +2,7 @@ import type { ExecToolDefaults } from "../../agents/bash-tools.js";
import type { ModelAliasIndex } from "../../agents/model-selection.js";
import type { SkillCommandSpec } from "../../agents/skills.js";
import { resolveSandboxRuntimeStatus } from "../../agents/sandbox.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import { listChatCommands, shouldHandleTextCommands } from "../commands-registry.js";
import { listSkillCommandsForWorkspace } from "../skill-commands.js";
@@ -21,7 +21,7 @@ import { formatElevatedUnavailableMessage, resolveElevatedPermissions } from "./
import { stripInlineStatus } from "./reply-inline.js";
import type { TypingController } from "./typing.js";
type AgentDefaults = NonNullable<MoltbotConfig["agents"]>["defaults"];
type AgentDefaults = NonNullable<OpenClawConfig["agents"]>["defaults"];
type ExecOverrides = Pick<ExecToolDefaults, "host" | "security" | "ask" | "node">;
export type ReplyDirectiveContinuation = {
@@ -83,7 +83,7 @@ export type ReplyDirectiveResult =
export async function resolveReplyDirectives(params: {
ctx: MsgContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
agentDir: string;
workspaceDir: string;

View File

@@ -1,6 +1,6 @@
import { getChannelDock } from "../../channels/dock.js";
import type { SkillCommandSpec } from "../../agents/skills.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import type { MsgContext, TemplateContext } from "../templating.js";
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../thinking.js";
@@ -14,7 +14,7 @@ import { extractInlineSimpleCommand } from "./reply-inline.js";
import type { TypingController } from "./typing.js";
import { listSkillCommandsForWorkspace, resolveSkillCommandInvocation } from "../skill-commands.js";
import { logVerbose } from "../../globals.js";
import { createMoltbotTools } from "../../agents/moltbot-tools.js";
import { createOpenClawTools } from "../../agents/openclaw-tools.js";
import { resolveGatewayMessageChannel } from "../../utils/message-channel.js";
export type InlineActionResult =
@@ -50,7 +50,7 @@ function extractTextFromToolResult(result: any): string | null {
export async function handleInlineActions(params: {
ctx: MsgContext;
sessionCtx: TemplateContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
agentDir?: string;
sessionEntry?: SessionEntry;
@@ -164,7 +164,7 @@ export async function handleInlineActions(params: {
resolveGatewayMessageChannel(ctx.Provider) ??
undefined;
const tools = createMoltbotTools({
const tools = createOpenClawTools({
agentSessionKey: sessionKey,
agentChannel: channel,
agentAccountId: (ctx as { AccountId?: string }).AccountId,

View File

@@ -7,7 +7,7 @@ import {
} from "../../agents/pi-embedded.js";
import { resolveSessionAuthProfileOverride } from "../../agents/auth-profiles/session-override.js";
import type { ExecToolDefaults } from "../../agents/bash-tools.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import {
resolveGroupSessionKey,
resolveSessionFilePath,
@@ -44,7 +44,7 @@ import { ensureSkillSnapshot, prependSystemEvents } from "./session-updates.js";
import type { TypingController } from "./typing.js";
import { resolveTypingMode } from "./typing-mode.js";
type AgentDefaults = NonNullable<MoltbotConfig["agents"]>["defaults"];
type AgentDefaults = NonNullable<OpenClawConfig["agents"]>["defaults"];
type ExecOverrides = Pick<ExecToolDefaults, "host" | "security" | "ask" | "node">;
const BARE_SESSION_RESET_PROMPT =
@@ -53,11 +53,11 @@ const BARE_SESSION_RESET_PROMPT =
type RunPreparedReplyParams = {
ctx: MsgContext;
sessionCtx: TemplateContext;
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
agentDir: string;
agentCfg: AgentDefaults;
sessionCfg: MoltbotConfig["session"];
sessionCfg: OpenClawConfig["session"];
commandAuthorized: boolean;
command: ReturnType<typeof buildCommandContext>;
commandSource: string;

View File

@@ -6,7 +6,7 @@ import {
import { resolveModelRefFromString } from "../../agents/model-selection.js";
import { resolveAgentTimeoutMs } from "../../agents/timeout.js";
import { DEFAULT_AGENT_WORKSPACE_DIR, ensureAgentWorkspace } from "../../agents/workspace.js";
import { type MoltbotConfig, loadConfig } from "../../config/config.js";
import { type OpenClawConfig, loadConfig } from "../../config/config.js";
import { defaultRuntime } from "../../runtime.js";
import { resolveCommandAuthorization } from "../command-auth.js";
import type { MsgContext } from "../templating.js";
@@ -27,9 +27,9 @@ import { createTypingController } from "./typing.js";
export async function getReplyFromConfig(
ctx: MsgContext,
opts?: GetReplyOptions,
configOverride?: MoltbotConfig,
configOverride?: OpenClawConfig,
): Promise<ReplyPayload | ReplyPayload[] | undefined> {
const isFastTestEnv = process.env.CLAWDBOT_TEST_FAST === "1";
const isFastTestEnv = process.env.OPENCLAW_TEST_FAST === "1";
const cfg = configOverride ?? loadConfig();
const targetSessionKey =
ctx.CommandSource === "native" ? ctx.CommandTargetSessionKey?.trim() : undefined;

View File

@@ -1,6 +1,6 @@
import { getChannelDock } from "../../channels/dock.js";
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { GroupKeyResolution, SessionEntry } from "../../config/sessions.js";
import { isInternalMessageChannel } from "../../utils/message-channel.js";
import { normalizeGroupActivation } from "../group-activation.js";
@@ -27,7 +27,7 @@ function extractGroupId(raw: string | undefined | null): string | undefined {
}
export function resolveGroupRequireMention(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
ctx: TemplateContext;
groupResolution?: GroupKeyResolution;
}): boolean {
@@ -54,7 +54,7 @@ export function defaultGroupActivation(requireMention: boolean): "always" | "men
}
export function buildGroupIntro(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
sessionCtx: TemplateContext;
sessionEntry?: SessionEntry;
defaultActivation: "always" | "mention";
@@ -95,7 +95,7 @@ export function buildGroupIntro(params: {
: undefined;
const silenceLine =
activation === "always"
? `If no response is needed, reply with exactly "${params.silentToken}" (and nothing else) so Moltbot stays silent. Do not add any other words, punctuation, tags, markdown/code blocks, or explanations.`
? `If no response is needed, reply with exactly "${params.silentToken}" (and nothing else) so OpenClaw stays silent. Do not add any other words, punctuation, tags, markdown/code blocks, or explanations.`
: undefined;
const cautionLine =
activation === "always"

View File

@@ -1,7 +1,7 @@
import { lookupContextTokens } from "../../agents/context.js";
import { DEFAULT_CONTEXT_TOKENS } from "../../agents/defaults.js";
import { DEFAULT_PI_COMPACTION_RESERVE_TOKENS_FLOOR } from "../../agents/pi-settings.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import { SILENT_REPLY_TOKEN } from "../tokens.js";
@@ -33,7 +33,7 @@ const normalizeNonNegativeInt = (value: unknown): number | null => {
return int >= 0 ? int : null;
};
export function resolveMemoryFlushSettings(cfg?: MoltbotConfig): MemoryFlushSettings | null {
export function resolveMemoryFlushSettings(cfg?: OpenClawConfig): MemoryFlushSettings | null {
const defaults = cfg?.agents?.defaults?.compaction?.memoryFlush;
const enabled = defaults?.enabled ?? true;
if (!enabled) return null;

View File

@@ -2,11 +2,11 @@ import { describe, expect, it } from "vitest";
import { matchesMentionWithExplicit } from "./mentions.js";
describe("matchesMentionWithExplicit", () => {
const mentionRegexes = [/\bclawd\b/i];
const mentionRegexes = [/\bopenclaw\b/i];
it("checks mentionPatterns even when explicit mention is available", () => {
const result = matchesMentionWithExplicit({
text: "@clawd hello",
text: "@openclaw hello",
mentionRegexes,
explicit: {
hasAnyMention: true,
@@ -45,7 +45,7 @@ describe("matchesMentionWithExplicit", () => {
it("falls back to regex matching when explicit mention cannot be resolved", () => {
const result = matchesMentionWithExplicit({
text: "clawd please",
text: "openclaw please",
mentionRegexes,
explicit: {
hasAnyMention: true,

View File

@@ -1,7 +1,7 @@
import { resolveAgentConfig } from "../../agents/agent-scope.js";
import { getChannelDock } from "../../channels/dock.js";
import { normalizeChannelId } from "../../channels/plugins/index.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { MsgContext } from "../templating.js";
function escapeRegExp(text: string): string {
@@ -36,7 +36,7 @@ function normalizeMentionPatterns(patterns: string[]): string[] {
return patterns.map(normalizeMentionPattern);
}
function resolveMentionPatterns(cfg: MoltbotConfig | undefined, agentId?: string): string[] {
function resolveMentionPatterns(cfg: OpenClawConfig | undefined, agentId?: string): string[] {
if (!cfg) return [];
const agentConfig = agentId ? resolveAgentConfig(cfg, agentId) : undefined;
const agentGroupChat = agentConfig?.groupChat;
@@ -51,7 +51,7 @@ function resolveMentionPatterns(cfg: MoltbotConfig | undefined, agentId?: string
return derived.length > 0 ? derived : [];
}
export function buildMentionRegexes(cfg: MoltbotConfig | undefined, agentId?: string): RegExp[] {
export function buildMentionRegexes(cfg: OpenClawConfig | undefined, agentId?: string): RegExp[] {
const patterns = normalizeMentionPatterns(resolveMentionPatterns(cfg, agentId));
return patterns
.map((pattern) => {
@@ -115,7 +115,7 @@ export function stripStructuralPrefixes(text: string): string {
export function stripMentions(
text: string,
ctx: MsgContext,
cfg: MoltbotConfig | undefined,
cfg: OpenClawConfig | undefined,
agentId?: string,
): string {
let result = text;

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { createModelSelectionState } from "./model-selection.js";
vi.mock("../../agents/model-catalog.js", () => ({
@@ -21,7 +21,7 @@ const makeEntry = (overrides: Record<string, unknown> = {}) => ({
});
async function resolveState(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
sessionEntry: ReturnType<typeof makeEntry>;
sessionStore: Record<string, ReturnType<typeof makeEntry>>;
sessionKey: string;
@@ -44,7 +44,7 @@ async function resolveState(params: {
describe("createModelSelectionState parent inheritance", () => {
it("inherits parent override from explicit parentSessionKey", async () => {
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const parentKey = "agent:main:discord:channel:c1";
const sessionKey = "agent:main:discord:channel:c1:thread:123";
const parentEntry = makeEntry({
@@ -70,7 +70,7 @@ describe("createModelSelectionState parent inheritance", () => {
});
it("derives parent key from topic session suffix", async () => {
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const parentKey = "agent:main:telegram:group:123";
const sessionKey = "agent:main:telegram:group:123:topic:99";
const parentEntry = makeEntry({
@@ -95,7 +95,7 @@ describe("createModelSelectionState parent inheritance", () => {
});
it("prefers child override over parent", async () => {
const cfg = {} as MoltbotConfig;
const cfg = {} as OpenClawConfig;
const parentKey = "agent:main:telegram:group:123";
const sessionKey = "agent:main:telegram:group:123:topic:99";
const parentEntry = makeEntry({
@@ -131,7 +131,7 @@ describe("createModelSelectionState parent inheritance", () => {
},
},
},
} as MoltbotConfig;
} as OpenClawConfig;
const parentKey = "agent:main:slack:channel:c1";
const sessionKey = "agent:main:slack:channel:c1:thread:123";
const parentEntry = makeEntry({

View File

@@ -9,7 +9,7 @@ import {
resolveModelRefFromString,
resolveThinkingDefault,
} from "../../agents/model-selection.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import { type SessionEntry, updateSessionStore } from "../../config/sessions.js";
import { clearSessionAuthProfileOverride } from "../../agents/auth-profiles/session-override.js";
import { applyModelOverrideToSessionEntry } from "../../sessions/model-overrides.js";
@@ -219,8 +219,8 @@ function scoreFuzzyMatch(params: {
}
export async function createModelSelectionState(params: {
cfg: MoltbotConfig;
agentCfg: NonNullable<NonNullable<MoltbotConfig["agents"]>["defaults"]> | undefined;
cfg: OpenClawConfig;
agentCfg: NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]> | undefined;
sessionEntry?: SessionEntry;
sessionStore?: Record<string, SessionEntry>;
sessionKey?: string;
@@ -502,7 +502,7 @@ export function resolveModelDirectiveSelection(params: {
}
export function resolveContextTokens(params: {
agentCfg: NonNullable<NonNullable<MoltbotConfig["agents"]>["defaults"]> | undefined;
agentCfg: NonNullable<NonNullable<OpenClawConfig["agents"]>["defaults"]> | undefined;
model: string;
}): number {
return (

Some files were not shown because too many files have changed in this diff Show More