refactor: rename clawdbot to moltbot with legacy compat

This commit is contained in:
Peter Steinberger
2026-01-27 12:19:58 +00:00
parent 83460df96f
commit 6d16a658e5
1839 changed files with 11250 additions and 11199 deletions

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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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(), "clawdbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
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(), "clawdbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath }, commands: { text: false } } as ClawdbotConfig;
const cfg = { session: { store: storePath }, commands: { text: false } } as MoltbotConfig;
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(), "clawdbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
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(), "clawdbot-abort-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-abort-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import {
loadSessionStore,
resolveStorePath,
@@ -63,7 +63,7 @@ function resolveAbortTargetKey(ctx: MsgContext): string | undefined {
}
function normalizeRequesterSessionKey(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
key: string | undefined,
): string | undefined {
const cleaned = key?.trim();
@@ -73,7 +73,7 @@ function normalizeRequesterSessionKey(
}
export function stopSubagentsForRequester(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
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: ClawdbotConfig;
cfg: MoltbotConfig;
}): 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: clawdbot logs --follow`;
: `⚠️ Agent failed before reply: ${trimmedMessage}.\nLogs: moltbot 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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
followupRun: FollowupRun;
sessionCtx: TemplateContext;
opts?: GetReplyOptions;

View File

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

View File

@@ -123,7 +123,7 @@ 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(), "clawdbot-session-reset-"));
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-reset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
try {
const sessionId = "session-corrupt";
@@ -170,7 +170,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
});
it("keeps sessions intact on other errors", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "clawdbot-session-noreset-"));
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-noreset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
try {
const sessionId = "session-ok";

View File

@@ -127,7 +127,7 @@ 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(), "clawdbot-session-compaction-reset-"));
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-compaction-reset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
try {
const sessionId = "session";
@@ -176,7 +176,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
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(), "clawdbot-session-overflow-reset-"));
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-overflow-reset-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
try {
const sessionId = "session";
@@ -230,7 +230,7 @@ describe("runReplyAgent typing (heartbeat)", () => {
it("resets the session after role ordering payloads", async () => {
const prevStateDir = process.env.CLAWDBOT_STATE_DIR;
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "clawdbot-session-role-ordering-"));
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-role-ordering-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
try {
const sessionId = "session";

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(), "clawdbot-compaction-")),
await fs.mkdtemp(path.join(tmpdir(), "moltbot-compaction-")),
"sessions.json",
);
const sessionEntry = { sessionId: "session", updatedAt: Date.now() };

View File

@@ -123,7 +123,7 @@ 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(), "clawdbot-session-reset-fail-"));
const stateDir = await fs.mkdtemp(path.join(tmpdir(), "moltbot-session-reset-fail-"));
process.env.CLAWDBOT_STATE_DIR = stateDir;
const saveSpy = vi.spyOn(sessions, "saveSessionStore").mockRejectedValueOnce(new Error("boom"));
try {

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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-flush-"));
const tmp = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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(), "clawdbot-session-store-")),
await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig): number {
function resolveForegroundMs(cfg: MoltbotConfig): 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: ClawdbotConfig;
cfg: MoltbotConfig;
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(`clawdbot sandbox explain --session ${params.sessionKey}`)}`,
`See: ${formatCliCommand(`moltbot sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");
@@ -177,7 +177,7 @@ function formatElevatedUnavailableMessage(params: {
export async function handleBashChatCommand(params: {
ctx: MsgContext;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentId?: string;
sessionKey: string;
isGroup: boolean;

View File

@@ -1,6 +1,6 @@
import { getChannelDock } from "../../channels/dock.js";
import { normalizeChannelId } from "../../channels/plugins/index.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig | undefined;
cfg: MoltbotConfig | undefined;
providerKey?: TextChunkProvider;
accountId?: string | null;
}): BlockStreamingCoalesceConfig | undefined {
@@ -51,7 +51,7 @@ export type BlockStreamingCoalescing = {
};
export function resolveBlockStreamingChunking(
cfg: ClawdbotConfig | undefined,
cfg: MoltbotConfig | undefined,
provider?: string,
accountId?: string | null,
): {
@@ -88,7 +88,7 @@ export function resolveBlockStreamingChunking(
}
export function resolveBlockStreamingCoalescing(
cfg: ClawdbotConfig | undefined,
cfg: MoltbotConfig | undefined,
provider?: string,
accountId?: string | null,
chunking?: {

View File

@@ -22,7 +22,7 @@ import {
readChannelAllowFromStore,
removeChannelAllowFromStoreEntry,
} from "../../pairing/pairing-store.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
channelId: ChannelId;
accountId?: string | null;
values: Array<string | number>;
@@ -259,7 +259,7 @@ function resolveChannelAllowFromPaths(
}
async function resolveSlackNames(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
entries: string[];
}) {
@@ -275,7 +275,7 @@ async function resolveSlackNames(params: {
}
async function resolveDiscordNames(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
accountId?: string | null;
entries: string[];
}) {

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: MoltbotConfig, 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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
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 { createClawdbotCodingTools } from "../../agents/pi-tools.js";
import { createMoltbotCodingTools } 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 createClawdbotCodingTools({
return createMoltbotCodingTools({
config: params.cfg,
workspaceDir,
sessionKey: params.sessionKey,

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
commandBodyNormalized: string;
}): Promise<ReplyPayload | null> {
const body = params.commandBodyNormalized.trim();

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: MoltbotConfig, 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 ClawdbotConfig;
} as MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: MoltbotConfig, 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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as unknown as MoltbotConfig;
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 ClawdbotConfig;
} as unknown as MoltbotConfig;
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, triggerClawdbotRestart } from "../../infra/restart.js";
import { scheduleGatewaySigusr1Restart, triggerMoltbotRestart } 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 clawdbot in-process (SIGUSR1); back in a few seconds.",
text: "⚙️ Restarting moltbot in-process (SIGUSR1); back in a few seconds.",
},
};
}
const restartMethod = triggerClawdbotRestart();
const restartMethod = triggerMoltbotRestart();
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 clawdbot via ${restartMethod.method}; give me a few seconds to come back online.`,
text: `⚙️ Restarting moltbot 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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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?: ClawdbotConfig,
cfg?: MoltbotConfig,
sessionEntry?: SessionEntry,
agentDir?: string,
): string | undefined {
@@ -97,7 +97,7 @@ function resolveModelAuthLabel(
}
export async function buildStatusReply(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
command: CommandContext;
sessionEntry?: SessionEntry;
sessionKey: string;

View File

@@ -1,5 +1,5 @@
import type { ChannelId } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
command: CommandContext;
agentId?: string;
directives: InlineDirectives;

View File

@@ -8,7 +8,7 @@ import {
addSubagentRunForTests,
resetSubagentRegistryForTests,
} from "../../agents/subagent-registry.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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(), "clawdbot-commands-"));
testWorkspaceDir = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-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: ClawdbotConfig, ctxOverrides?: Partial<MsgContext>) {
function buildParams(commandBody: string, cfg: MoltbotConfig, 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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig,
cfg: MoltbotConfig,
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: ClawdbotConfig;
cfg: MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
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<ClawdbotConfig["agents"]>["defaults"];
agentCfg?: NonNullable<MoltbotConfig["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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
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: ClawdbotConfig;
cfg: MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig,
cfg: MoltbotConfig,
): { 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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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(): ClawdbotConfig {
function baseConfig(): MoltbotConfig {
return {
commands: { text: true },
agents: { defaults: {} },
} as unknown as ClawdbotConfig;
} as unknown as MoltbotConfig;
}
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 ClawdbotConfig;
const cfg = { commands: { text: true } } as unknown as MoltbotConfig;
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 ClawdbotConfig;
const cfg = { commands: { text: true } } as unknown as MoltbotConfig;
const resolved = resolveModelSelectionFromDirective({
directives,

View File

@@ -6,7 +6,7 @@ import {
resolveConfiguredModelRef,
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
defaultProvider: string;
defaultModel: string;
aliasIndex: ModelAliasIndex;
@@ -153,7 +153,7 @@ function buildModelPickerCatalog(params: {
export async function maybeHandleModelDirectiveInfo(params: {
directives: InlineDirectives;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentDir: string;
activeAgentId: string;
provider: string;
@@ -271,7 +271,7 @@ export async function maybeHandleModelDirectiveInfo(params: {
export function resolveModelSelectionFromDirective(params: {
directives: InlineDirectives;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentDir: string;
defaultProvider: string;
defaultModel: string;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
agentId?: string;
isGroup: boolean;
}): boolean {

View File

@@ -12,7 +12,7 @@ import {
resolveDefaultModelForAgent,
resolveModelRefFromString,
} from "../../agents/model-selection.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
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<ClawdbotConfig["agents"]>["defaults"] | undefined;
agentCfg: NonNullable<MoltbotConfig["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: ClawdbotConfig; agentId?: string }): {
export function resolveDefaultModel(params: { cfg: MoltbotConfig; agentId?: string }): {
defaultProvider: string;
defaultModel: string;
aliasIndex: ModelAliasIndex;

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
channel: string;
sessionEntry?: SessionEntry;
}): ReplyPayload | undefined {

View File

@@ -51,7 +51,7 @@ export function formatElevatedUnavailableText(params: {
}
if (params.sessionKey) {
lines.push(
`See: ${formatCliCommand(`clawdbot sandbox explain --session ${params.sessionKey}`)}`,
`See: ${formatCliCommand(`moltbot 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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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 ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -96,7 +96,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
_opts: GetReplyOptions | undefined,
_cfg: ClawdbotConfig,
_cfg: MoltbotConfig,
) => ({ text: "hi" }) satisfies ReplyPayload;
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
@@ -110,7 +110,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
mocks.routeReply.mockClear();
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -123,7 +123,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
_opts: GetReplyOptions | undefined,
_cfg: ClawdbotConfig,
_cfg: MoltbotConfig,
) => ({ text: "hi" }) satisfies ReplyPayload;
await dispatchReplyFromConfig({ ctx, cfg, dispatcher, replyResolver });
@@ -144,7 +144,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
mocks.routeReply.mockClear();
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -155,7 +155,7 @@ describe("dispatchReplyFromConfig", () => {
const replyResolver = async (
_ctx: MsgContext,
opts: GetReplyOptions | undefined,
_cfg: ClawdbotConfig,
_cfg: MoltbotConfig,
) => {
expect(opts?.onToolResult).toBeUndefined();
return { text: "hi" } satisfies ReplyPayload;
@@ -175,7 +175,7 @@ describe("dispatchReplyFromConfig", () => {
handled: true,
aborted: true,
});
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -197,7 +197,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: true,
stoppedSubagents: 2,
});
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "telegram",
@@ -221,7 +221,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const ctx = buildTestCtx({
Provider: "whatsapp",
OriginatingChannel: "whatsapp",
@@ -252,7 +252,7 @@ describe("dispatchReplyFromConfig", () => {
aborted: false,
});
hookMocks.runner.hasHooks.mockReturnValue(true);
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -302,7 +302,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = { diagnostics: { enabled: true } } as ClawdbotConfig;
const cfg = { diagnostics: { enabled: true } } as MoltbotConfig;
const dispatcher = createDispatcher();
const ctx = buildTestCtx({
Provider: "slack",
@@ -335,7 +335,7 @@ describe("dispatchReplyFromConfig", () => {
handled: false,
aborted: false,
});
const cfg = { diagnostics: { enabled: true } } as ClawdbotConfig;
const cfg = { diagnostics: { enabled: true } } as MoltbotConfig;
const ctx = buildTestCtx({
Provider: "whatsapp",
OriginatingChannel: "whatsapp",

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig,
cfg: MoltbotConfig,
): 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: ClawdbotConfig;
cfg: MoltbotConfig;
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(), "clawdbot-compaction-")),
await fs.mkdtemp(path.join(tmpdir(), "moltbot-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(), "clawdbot-followup-usage-")),
await fs.mkdtemp(path.join(tmpdir(), "moltbot-followup-usage-")),
"sessions.json",
);
const sessionKey = "main";

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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<ClawdbotConfig["agents"]>["defaults"];
type AgentDefaults = NonNullable<MoltbotConfig["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: ClawdbotConfig;
cfg: MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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<ClawdbotConfig["agents"]>["defaults"];
type AgentDefaults = NonNullable<MoltbotConfig["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: ClawdbotConfig;
cfg: MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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 { createClawdbotTools } from "../../agents/clawdbot-tools.js";
import { createMoltbotTools } from "../../agents/moltbot-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: ClawdbotConfig;
cfg: MoltbotConfig;
agentId: string;
agentDir?: string;
sessionEntry?: SessionEntry;
@@ -164,7 +164,7 @@ export async function handleInlineActions(params: {
resolveGatewayMessageChannel(ctx.Provider) ??
undefined;
const tools = createClawdbotTools({
const tools = createMoltbotTools({
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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<ClawdbotConfig["agents"]>["defaults"];
type AgentDefaults = NonNullable<MoltbotConfig["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: ClawdbotConfig;
cfg: MoltbotConfig;
agentId: string;
agentDir: string;
agentCfg: AgentDefaults;
sessionCfg: ClawdbotConfig["session"];
sessionCfg: MoltbotConfig["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 ClawdbotConfig, loadConfig } from "../../config/config.js";
import { type MoltbotConfig, loadConfig } from "../../config/config.js";
import { defaultRuntime } from "../../runtime.js";
import { resolveCommandAuthorization } from "../command-auth.js";
import type { MsgContext } from "../templating.js";
@@ -27,7 +27,7 @@ import { createTypingController } from "./typing.js";
export async function getReplyFromConfig(
ctx: MsgContext,
opts?: GetReplyOptions,
configOverride?: ClawdbotConfig,
configOverride?: MoltbotConfig,
): Promise<ReplyPayload | ReplyPayload[] | undefined> {
const isFastTestEnv = process.env.CLAWDBOT_TEST_FAST === "1";
const cfg = configOverride ?? loadConfig();

View File

@@ -1,6 +1,6 @@
import { getChannelDock } from "../../channels/dock.js";
import { getChannelPlugin, normalizeChannelId } from "../../channels/plugins/index.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
ctx: TemplateContext;
groupResolution?: GroupKeyResolution;
}): boolean {
@@ -54,7 +54,7 @@ export function defaultGroupActivation(requireMention: boolean): "always" | "men
}
export function buildGroupIntro(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
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 Clawdbot 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 Moltbot 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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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?: ClawdbotConfig): MemoryFlushSettings | null {
export function resolveMemoryFlushSettings(cfg?: MoltbotConfig): MemoryFlushSettings | null {
const defaults = cfg?.agents?.defaults?.compaction?.memoryFlush;
const enabled = defaults?.enabled ?? true;
if (!enabled) return null;

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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig | undefined, agentId?: string): string[] {
function resolveMentionPatterns(cfg: MoltbotConfig | 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: ClawdbotConfig | undefined, agentId?: strin
return derived.length > 0 ? derived : [];
}
export function buildMentionRegexes(cfg: ClawdbotConfig | undefined, agentId?: string): RegExp[] {
export function buildMentionRegexes(cfg: MoltbotConfig | undefined, agentId?: string): RegExp[] {
const patterns = normalizeMentionPatterns(resolveMentionPatterns(cfg, agentId));
return patterns
.map((pattern) => {
@@ -113,7 +113,7 @@ export function stripStructuralPrefixes(text: string): string {
export function stripMentions(
text: string,
ctx: MsgContext,
cfg: ClawdbotConfig | undefined,
cfg: MoltbotConfig | undefined,
agentId?: string,
): string {
let result = text;

View File

@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
cfg: MoltbotConfig;
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 ClawdbotConfig;
const cfg = {} as MoltbotConfig;
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 ClawdbotConfig;
const cfg = {} as MoltbotConfig;
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 ClawdbotConfig;
const cfg = {} as MoltbotConfig;
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 ClawdbotConfig;
} as MoltbotConfig;
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 { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } 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: ClawdbotConfig;
agentCfg: NonNullable<NonNullable<ClawdbotConfig["agents"]>["defaults"]> | undefined;
cfg: MoltbotConfig;
agentCfg: NonNullable<NonNullable<MoltbotConfig["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<ClawdbotConfig["agents"]>["defaults"]> | undefined;
agentCfg: NonNullable<NonNullable<MoltbotConfig["agents"]>["defaults"]> | undefined;
model: string;
}): number {
return (

View File

@@ -1,4 +1,4 @@
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { FinalizedMsgContext, MsgContext } from "../templating.js";
import type { GetReplyOptions } from "../types.js";
import type { DispatchInboundResult } from "../dispatch.js";
@@ -13,7 +13,7 @@ import type {
export async function dispatchReplyWithBufferedBlockDispatcher(params: {
ctx: MsgContext | FinalizedMsgContext;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
dispatcherOptions: ReplyDispatcherWithTypingOptions;
replyOptions?: Omit<GetReplyOptions, "onToolResult" | "onBlockReply">;
replyResolver?: typeof import("../reply.js").getReplyFromConfig;
@@ -29,7 +29,7 @@ export async function dispatchReplyWithBufferedBlockDispatcher(params: {
export async function dispatchReplyWithDispatcher(params: {
ctx: MsgContext | FinalizedMsgContext;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
dispatcherOptions: ReplyDispatcherOptions;
replyOptions?: Omit<GetReplyOptions, "onToolResult" | "onBlockReply">;
replyResolver?: typeof import("../reply.js").getReplyFromConfig;

View File

@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { FollowupRun, QueueSettings } from "./queue.js";
import { enqueueFollowupRun, scheduleFollowupDrain } from "./queue.js";
@@ -26,7 +26,7 @@ function createRun(params: {
sessionId: "sess",
sessionFile: "/tmp/session.json",
workspaceDir: "/tmp",
config: {} as ClawdbotConfig,
config: {} as MoltbotConfig,
provider: "openai",
model: "gpt-test",
timeoutMs: 10_000,

View File

@@ -1,5 +1,5 @@
import type { SkillSnapshot } from "../../../agents/skills.js";
import type { ClawdbotConfig } from "../../../config/config.js";
import type { MoltbotConfig } from "../../../config/config.js";
import type { SessionEntry } from "../../../config/sessions.js";
import type { OriginatingChannelType } from "../../templating.js";
import type { ElevatedLevel, ReasoningLevel, ThinkLevel, VerboseLevel } from "../directives.js";
@@ -57,7 +57,7 @@ export type FollowupRun = {
senderE164?: string;
sessionFile: string;
workspaceDir: string;
config: ClawdbotConfig;
config: MoltbotConfig;
skillsSnapshot?: SkillSnapshot;
provider: string;
model: string;
@@ -82,7 +82,7 @@ export type FollowupRun = {
};
export type ResolveQueueSettingsParams = {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
channel?: string;
sessionEntry?: SessionEntry;
inlineMode?: QueueMode;

View File

@@ -2,7 +2,7 @@ import { resolveAgentConfig } from "../../agents/agent-scope.js";
import { getChannelDock } from "../../channels/dock.js";
import { normalizeChannelId } from "../../channels/plugins/index.js";
import { CHAT_CHANNEL_ORDER } from "../../channels/registry.js";
import type { AgentElevatedAllowFromConfig, ClawdbotConfig } from "../../config/config.js";
import type { AgentElevatedAllowFromConfig, MoltbotConfig } from "../../config/config.js";
import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js";
import { formatCliCommand } from "../../cli/command-format.js";
import type { MsgContext } from "../templating.js";
@@ -100,7 +100,7 @@ function isApprovedElevatedSender(params: {
}
export function resolveElevatedPermissions(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
agentId: string;
ctx: MsgContext;
provider: string;
@@ -189,7 +189,7 @@ export function formatElevatedUnavailableMessage(params: {
lines.push("- agents.list[].tools.elevated.allowFrom.<provider>");
if (params.sessionKey) {
lines.push(
`See: ${formatCliCommand(`clawdbot sandbox explain --session ${params.sessionKey}`)}`,
`See: ${formatCliCommand(`moltbot sandbox explain --session ${params.sessionKey}`)}`,
);
}
return lines.join("\n");

View File

@@ -1,11 +1,11 @@
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { HEARTBEAT_TOKEN, SILENT_REPLY_TOKEN } from "../tokens.js";
import { createReplyDispatcher } from "./reply-dispatcher.js";
import { createReplyToModeFilter, resolveReplyToMode } from "./reply-threading.js";
const emptyCfg = {} as ClawdbotConfig;
const emptyCfg = {} as MoltbotConfig;
describe("createReplyDispatcher", () => {
it("drops empty payloads and silent tokens without media", async () => {
@@ -177,7 +177,7 @@ describe("resolveReplyToMode", () => {
discord: { replyToMode: "first" },
slack: { replyToMode: "all" },
},
} as ClawdbotConfig;
} as MoltbotConfig;
expect(resolveReplyToMode(cfg, "telegram")).toBe("all");
expect(resolveReplyToMode(cfg, "discord")).toBe("first");
expect(resolveReplyToMode(cfg, "slack")).toBe("all");
@@ -191,7 +191,7 @@ describe("resolveReplyToMode", () => {
replyToModeByChatType: { direct: "all", group: "first" },
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
expect(resolveReplyToMode(cfg, "slack", null, "direct")).toBe("all");
expect(resolveReplyToMode(cfg, "slack", null, "group")).toBe("first");
expect(resolveReplyToMode(cfg, "slack", null, "channel")).toBe("off");
@@ -205,7 +205,7 @@ describe("resolveReplyToMode", () => {
replyToMode: "first",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
expect(resolveReplyToMode(cfg, "slack", null, "direct")).toBe("first");
expect(resolveReplyToMode(cfg, "slack", null, "channel")).toBe("first");
});
@@ -218,7 +218,7 @@ describe("resolveReplyToMode", () => {
dm: { replyToMode: "all" },
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
expect(resolveReplyToMode(cfg, "slack", null, "direct")).toBe("all");
expect(resolveReplyToMode(cfg, "slack", null, "channel")).toBe("off");
});

View File

@@ -1,12 +1,12 @@
import { getChannelDock } from "../../channels/dock.js";
import { normalizeChannelId } from "../../channels/plugins/index.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { ReplyToMode } from "../../config/types.js";
import type { OriginatingChannelType } from "../templating.js";
import type { ReplyPayload } from "../types.js";
export function resolveReplyToMode(
cfg: ClawdbotConfig,
cfg: MoltbotConfig,
channel?: OriginatingChannelType,
accountId?: string | null,
chatType?: string | null,

View File

@@ -52,16 +52,16 @@ describe("resolveResponsePrefixTemplate", () => {
it("resolves {identity.name} variable", () => {
const result = resolveResponsePrefixTemplate("[{identity.name}]", {
identityName: "Clawdbot",
identityName: "Moltbot",
});
expect(result).toBe("[Clawdbot]");
expect(result).toBe("[Moltbot]");
});
it("resolves {identityName} as alias", () => {
const result = resolveResponsePrefixTemplate("[{identityName}]", {
identityName: "Clawdbot",
identityName: "Moltbot",
});
expect(result).toBe("[Clawdbot]");
expect(result).toBe("[Moltbot]");
});
it("resolves multiple variables", () => {
@@ -104,13 +104,13 @@ describe("resolveResponsePrefixTemplate", () => {
const result = resolveResponsePrefixTemplate(
"[{identity.name}] {provider}/{model} (think:{thinkingLevel})",
{
identityName: "Clawdbot",
identityName: "Moltbot",
provider: "anthropic",
model: "claude-opus-4-5",
thinkingLevel: "high",
},
);
expect(result).toBe("[Clawdbot] anthropic/claude-opus-4-5 (think:high)");
expect(result).toBe("[Moltbot] anthropic/claude-opus-4-5 (think:high)");
});
});

View File

@@ -1,7 +1,7 @@
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import type { ChannelOutboundAdapter, ChannelPlugin } from "../../channels/plugins/types.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { PluginRegistry } from "../../plugins/registry.js";
import { setActivePluginRegistry } from "../../plugins/runtime.js";
import {
@@ -172,8 +172,8 @@ describe("routeReply", () => {
it("applies responsePrefix when routing", async () => {
mocks.sendMessageSlack.mockClear();
const cfg = {
messages: { responsePrefix: "[clawdbot]" },
} as unknown as ClawdbotConfig;
messages: { responsePrefix: "[moltbot]" },
} as unknown as MoltbotConfig;
await routeReply({
payload: { text: "hi" },
channel: "slack",
@@ -182,7 +182,7 @@ describe("routeReply", () => {
});
expect(mocks.sendMessageSlack).toHaveBeenCalledWith(
"channel:C123",
"[clawdbot] hi",
"[moltbot] hi",
expect.any(Object),
);
});
@@ -199,7 +199,7 @@ describe("routeReply", () => {
],
},
messages: {},
} as unknown as ClawdbotConfig;
} as unknown as MoltbotConfig;
await routeReply({
payload: { text: "hi" },
channel: "slack",
@@ -346,7 +346,7 @@ describe("routeReply", () => {
enabled: true,
},
},
} as unknown as ClawdbotConfig;
} as unknown as MoltbotConfig;
await routeReply({
payload: { text: "hi" },
channel: "msteams",

View File

@@ -10,7 +10,7 @@
import { resolveSessionAgentId } from "../../agents/agent-scope.js";
import { resolveEffectiveMessagesConfig } from "../../agents/identity.js";
import { normalizeChannelId } from "../../channels/plugins/index.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { INTERNAL_MESSAGE_CHANNEL } from "../../utils/message-channel.js";
import type { OriginatingChannelType } from "../templating.js";
import type { ReplyPayload } from "../types.js";
@@ -30,7 +30,7 @@ export type RouteReplyParams = {
/** Thread id for replies (Telegram topic id or Matrix thread event id). */
threadId?: string | number;
/** Config for provider-specific settings. */
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
/** Optional abort signal for cooperative cancellation. */
abortSignal?: AbortSignal;
/** Mirror reply into session transcript (default: true when sessionKey is set). */

View File

@@ -6,7 +6,7 @@ import {
resolveModelRefFromString,
type ModelAliasIndex,
} from "../../agents/model-selection.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { SessionEntry } from "../../config/sessions.js";
import { updateSessionStore } from "../../config/sessions.js";
import type { MsgContext, TemplateContext } from "../templating.js";
@@ -79,7 +79,7 @@ function applySelectionToSession(params: {
}
export async function applyResetModelOverride(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
resetTriggered: boolean;
bodyStripped?: string;
sessionCtx: TemplateContext;

View File

@@ -5,7 +5,7 @@ import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import { buildModelAliasIndex } from "../../agents/model-selection.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { enqueueSystemEvent, resetSystemEventsForTest } from "../../infra/system-events.js";
import { initSessionState } from "./session.js";
import { applyResetModelOverride } from "./session-reset-model.js";
@@ -38,7 +38,7 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
});
}
function makeCfg(params: { storePath: string; allowFrom: string[] }): ClawdbotConfig {
function makeCfg(params: { storePath: string; allowFrom: string[] }): MoltbotConfig {
return {
session: { store: params.storePath, idleMinutes: 999 },
channels: {
@@ -47,11 +47,11 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
groupPolicy: "open",
},
},
} as ClawdbotConfig;
} as MoltbotConfig;
}
it("Reset trigger /new works for authorized sender in WhatsApp group", async () => {
const storePath = await createStorePath("clawdbot-group-reset-");
const storePath = await createStorePath("moltbot-group-reset-");
const sessionKey = "agent:main:whatsapp:group:120363406150318674@g.us";
const existingSessionId = "existing-session-123";
await seedSessionStore({
@@ -93,7 +93,7 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
});
it("Reset trigger /new blocked for unauthorized sender in existing session", async () => {
const storePath = await createStorePath("clawdbot-group-reset-unauth-");
const storePath = await createStorePath("moltbot-group-reset-unauth-");
const sessionKey = "agent:main:whatsapp:group:120363406150318674@g.us";
const existingSessionId = "existing-session-123";
@@ -135,7 +135,7 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
});
it("Reset trigger works when RawBody is clean but Body has wrapped context", async () => {
const storePath = await createStorePath("clawdbot-group-rawbody-");
const storePath = await createStorePath("moltbot-group-rawbody-");
const sessionKey = "agent:main:whatsapp:group:g1";
const existingSessionId = "existing-session-123";
await seedSessionStore({
@@ -174,7 +174,7 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
});
it("Reset trigger /new works when SenderId is LID but SenderE164 is authorized", async () => {
const storePath = await createStorePath("clawdbot-group-reset-lid-");
const storePath = await createStorePath("moltbot-group-reset-lid-");
const sessionKey = "agent:main:whatsapp:group:120363406150318674@g.us";
const existingSessionId = "existing-session-123";
await seedSessionStore({
@@ -216,7 +216,7 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
});
it("Reset trigger /new blocked when SenderId is LID but SenderE164 is unauthorized", async () => {
const storePath = await createStorePath("clawdbot-group-reset-lid-unauth-");
const storePath = await createStorePath("moltbot-group-reset-lid-unauth-");
const sessionKey = "agent:main:whatsapp:group:120363406150318674@g.us";
const existingSessionId = "existing-session-123";
await seedSessionStore({
@@ -259,7 +259,7 @@ describe("initSessionState reset triggers in WhatsApp groups", () => {
describe("applyResetModelOverride", () => {
it("selects a model hint and strips it from the body", async () => {
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const aliasIndex = buildModelAliasIndex({ cfg, defaultProvider: "openai" });
const sessionEntry = {
sessionId: "s1",
@@ -289,7 +289,7 @@ describe("applyResetModelOverride", () => {
});
it("clears auth profile overrides when reset applies a model", async () => {
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const aliasIndex = buildModelAliasIndex({ cfg, defaultProvider: "openai" });
const sessionEntry = {
sessionId: "s1",
@@ -322,7 +322,7 @@ describe("applyResetModelOverride", () => {
});
it("skips when resetTriggered is false", async () => {
const cfg = {} as ClawdbotConfig;
const cfg = {} as MoltbotConfig;
const aliasIndex = buildModelAliasIndex({ cfg, defaultProvider: "openai" });
const sessionEntry = {
sessionId: "s1",
@@ -363,7 +363,7 @@ describe("prependSystemEvents", () => {
enqueueSystemEvent("Model switched.", { sessionKey: "agent:main:main" });
const result = await prependSystemEvents({
cfg: {} as ClawdbotConfig,
cfg: {} as MoltbotConfig,
sessionKey: "agent:main:main",
isMainSession: false,
isNewSession: false,

View File

@@ -3,14 +3,14 @@ import crypto from "node:crypto";
import { resolveUserTimezone } from "../../agents/date-time.js";
import { buildWorkspaceSkillSnapshot } from "../../agents/skills.js";
import { ensureSkillsWatcher, getSkillsSnapshotVersion } from "../../agents/skills/refresh.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { type SessionEntry, updateSessionStore } from "../../config/sessions.js";
import { buildChannelSummary } from "../../infra/channel-summary.js";
import { getRemoteSkillEligibility } from "../../infra/skills-remote.js";
import { drainSystemEventEntries } from "../../infra/system-events.js";
export async function prependSystemEvents(params: {
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
sessionKey: string;
isMainSession: boolean;
isNewSession: boolean;
@@ -41,7 +41,7 @@ export async function prependSystemEvents(params: {
}
};
const resolveSystemEventTimezone = (cfg: ClawdbotConfig) => {
const resolveSystemEventTimezone = (cfg: MoltbotConfig) => {
const raw = cfg.agents?.defaults?.envelopeTimezone?.trim();
if (!raw) return { mode: "local" as const };
const lowered = raw.toLowerCase();
@@ -94,7 +94,7 @@ export async function prependSystemEvents(params: {
return `${yyyy}-${mm}-${dd} ${hh}:${min}:${sec}${tz ? ` ${tz}` : ""}`;
};
const formatSystemEventTimestamp = (ts: number, cfg: ClawdbotConfig) => {
const formatSystemEventTimestamp = (ts: number, cfg: MoltbotConfig) => {
const date = new Date(ts);
if (Number.isNaN(date.getTime())) return "unknown-time";
const zone = resolveSystemEventTimezone(cfg);
@@ -132,7 +132,7 @@ export async function ensureSkillSnapshot(params: {
sessionId?: string;
isFirstTurnInSession: boolean;
workspaceDir: string;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
/** If provided, only load skills with these names (for per-channel skill filtering) */
skillFilter?: string[];
}): Promise<{

View File

@@ -4,13 +4,13 @@ import path from "node:path";
import { describe, expect, it, vi } from "vitest";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { saveSessionStore } from "../../config/sessions.js";
import { initSessionState } from "./session.js";
describe("initSessionState thread forking", () => {
it("forks a new session from the parent session file", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-thread-session-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-thread-session-"));
const sessionsDir = path.join(root, "sessions");
await fs.mkdir(sessionsDir, { recursive: true });
@@ -48,7 +48,7 @@ describe("initSessionState thread forking", () => {
const cfg = {
session: { store: storePath },
} as ClawdbotConfig;
} as MoltbotConfig;
const threadSessionKey = "agent:main:slack:channel:c1:thread:123";
const threadLabel = "Slack thread #general: starter";
@@ -82,12 +82,12 @@ describe("initSessionState thread forking", () => {
});
it("records topic-specific session files when MessageThreadId is present", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-topic-session-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-topic-session-"));
const storePath = path.join(root, "sessions.json");
const cfg = {
session: { store: storePath },
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: {
@@ -109,9 +109,9 @@ describe("initSessionState thread forking", () => {
describe("initSessionState RawBody", () => {
it("triggerBodyNormalized correctly extracts commands when Body contains context but RawBody is clean", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-rawbody-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-rawbody-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
const groupMessageCtx = {
Body: `[Chat messages since your last reply - for context]\n[WhatsApp ...] Someone: hello\n\n[Current message - respond to this]\n[WhatsApp ...] Jake: /status\n[from: Jake McInteer (+6421807830)]`,
@@ -130,9 +130,9 @@ describe("initSessionState RawBody", () => {
});
it("Reset triggers (/new, /reset) work with RawBody", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-rawbody-reset-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-rawbody-reset-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
const groupMessageCtx = {
Body: `[Context]\nJake: /new\n[from: Jake]`,
@@ -152,7 +152,7 @@ describe("initSessionState RawBody", () => {
});
it("preserves argument casing while still matching reset triggers case-insensitively", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-rawbody-reset-case-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-rawbody-reset-case-"));
const storePath = path.join(root, "sessions.json");
const cfg = {
@@ -160,7 +160,7 @@ describe("initSessionState RawBody", () => {
store: storePath,
resetTriggers: ["/new"],
},
} as ClawdbotConfig;
} as MoltbotConfig;
const ctx = {
RawBody: "/NEW KeepThisCase",
@@ -180,9 +180,9 @@ describe("initSessionState RawBody", () => {
});
it("falls back to Body when RawBody is undefined", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-rawbody-fallback-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-rawbody-fallback-"));
const storePath = path.join(root, "sessions.json");
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
const ctx = {
Body: "/status",
@@ -204,7 +204,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 5, 0, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-daily-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-daily-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:whatsapp:dm:s1";
const existingSessionId = "daily-session-id";
@@ -216,7 +216,7 @@ describe("initSessionState reset policy", () => {
},
});
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "hello", SessionKey: sessionKey },
cfg,
@@ -234,7 +234,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 3, 0, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-daily-edge-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-daily-edge-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:whatsapp:dm:s-edge";
const existingSessionId = "daily-edge-session";
@@ -246,7 +246,7 @@ describe("initSessionState reset policy", () => {
},
});
const cfg = { session: { store: storePath } } as ClawdbotConfig;
const cfg = { session: { store: storePath } } as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "hello", SessionKey: sessionKey },
cfg,
@@ -264,7 +264,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 5, 30, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-idle-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-idle-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:whatsapp:dm:s2";
const existingSessionId = "idle-session-id";
@@ -281,7 +281,7 @@ describe("initSessionState reset policy", () => {
store: storePath,
reset: { mode: "daily", atHour: 4, idleMinutes: 30 },
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "hello", SessionKey: sessionKey },
cfg,
@@ -299,7 +299,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 5, 0, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-thread-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-thread-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:slack:channel:c1:thread:123";
const existingSessionId = "thread-session-id";
@@ -317,7 +317,7 @@ describe("initSessionState reset policy", () => {
reset: { mode: "daily", atHour: 4 },
resetByType: { thread: { mode: "idle", idleMinutes: 180 } },
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "reply", SessionKey: sessionKey, ThreadLabel: "Slack thread" },
cfg,
@@ -335,7 +335,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 5, 0, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-thread-nosuffix-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-thread-nosuffix-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:discord:channel:c1";
const existingSessionId = "thread-nosuffix";
@@ -352,7 +352,7 @@ describe("initSessionState reset policy", () => {
store: storePath,
resetByType: { thread: { mode: "idle", idleMinutes: 180 } },
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "reply", SessionKey: sessionKey, ThreadLabel: "Discord thread" },
cfg,
@@ -370,7 +370,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 5, 0, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-type-default-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-type-default-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:whatsapp:dm:s4";
const existingSessionId = "type-default-session";
@@ -387,7 +387,7 @@ describe("initSessionState reset policy", () => {
store: storePath,
resetByType: { thread: { mode: "idle", idleMinutes: 60 } },
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "hello", SessionKey: sessionKey },
cfg,
@@ -405,7 +405,7 @@ describe("initSessionState reset policy", () => {
vi.useFakeTimers();
vi.setSystemTime(new Date(2026, 0, 18, 5, 0, 0));
try {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-reset-legacy-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-reset-legacy-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:whatsapp:dm:s3";
const existingSessionId = "legacy-session-id";
@@ -422,7 +422,7 @@ describe("initSessionState reset policy", () => {
store: storePath,
idleMinutes: 240,
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: { Body: "hello", SessionKey: sessionKey },
cfg,
@@ -439,7 +439,7 @@ describe("initSessionState reset policy", () => {
describe("initSessionState channel reset overrides", () => {
it("uses channel-specific reset policy when configured", async () => {
const root = await fs.mkdtemp(path.join(os.tmpdir(), "clawdbot-channel-idle-"));
const root = await fs.mkdtemp(path.join(os.tmpdir(), "moltbot-channel-idle-"));
const storePath = path.join(root, "sessions.json");
const sessionKey = "agent:main:discord:dm:123";
const sessionId = "session-override";
@@ -459,7 +459,7 @@ describe("initSessionState channel reset overrides", () => {
resetByType: { dm: { mode: "idle", idleMinutes: 10 } },
resetByChannel: { discord: { mode: "idle", idleMinutes: 10080 } },
},
} as ClawdbotConfig;
} as MoltbotConfig;
const result = await initSessionState({
ctx: {

View File

@@ -4,7 +4,7 @@ import path from "node:path";
import { CURRENT_SESSION_VERSION, SessionManager } from "@mariozechner/pi-coding-agent";
import { resolveSessionAgentId } from "../../agents/agent-scope.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import type { TtsAutoMode } from "../../config/types.tts.js";
import {
DEFAULT_RESET_TRIGGERS,
@@ -90,7 +90,7 @@ function forkSessionFromParent(params: {
export async function initSessionState(params: {
ctx: MsgContext;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
commandAuthorized: boolean;
}): Promise<SessionInitResult> {
const { ctx, cfg, commandAuthorized } = params;

View File

@@ -3,7 +3,7 @@ import fs from "node:fs/promises";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { ensureSandboxWorkspaceForSession } from "../../agents/sandbox.js";
import type { ClawdbotConfig } from "../../config/config.js";
import type { MoltbotConfig } from "../../config/config.js";
import { logVerbose } from "../../globals.js";
import { CONFIG_DIR } from "../../utils.js";
import type { MsgContext, TemplateContext } from "../templating.js";
@@ -11,7 +11,7 @@ import type { MsgContext, TemplateContext } from "../templating.js";
export async function stageSandboxMedia(params: {
ctx: MsgContext;
sessionCtx: TemplateContext;
cfg: ClawdbotConfig;
cfg: MoltbotConfig;
sessionKey?: string;
workspaceDir: string;
}) {