refactor: rename to openclaw

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

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../config/config.js";
import type { OpenClawConfig } from "../config/config.js";
import type { IMessageAccountConfig } from "../config/types.js";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../routing/session-key.js";
@@ -10,26 +10,26 @@ export type ResolvedIMessageAccount = {
configured: boolean;
};
function listConfiguredAccountIds(cfg: MoltbotConfig): string[] {
function listConfiguredAccountIds(cfg: OpenClawConfig): string[] {
const accounts = cfg.channels?.imessage?.accounts;
if (!accounts || typeof accounts !== "object") return [];
return Object.keys(accounts).filter(Boolean);
}
export function listIMessageAccountIds(cfg: MoltbotConfig): string[] {
export function listIMessageAccountIds(cfg: OpenClawConfig): string[] {
const ids = listConfiguredAccountIds(cfg);
if (ids.length === 0) return [DEFAULT_ACCOUNT_ID];
return ids.sort((a, b) => a.localeCompare(b));
}
export function resolveDefaultIMessageAccountId(cfg: MoltbotConfig): string {
export function resolveDefaultIMessageAccountId(cfg: OpenClawConfig): string {
const ids = listIMessageAccountIds(cfg);
if (ids.includes(DEFAULT_ACCOUNT_ID)) return DEFAULT_ACCOUNT_ID;
return ids[0] ?? DEFAULT_ACCOUNT_ID;
}
function resolveAccountConfig(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
accountId: string,
): IMessageAccountConfig | undefined {
const accounts = cfg.channels?.imessage?.accounts;
@@ -37,7 +37,7 @@ function resolveAccountConfig(
return accounts[accountId] as IMessageAccountConfig | undefined;
}
function mergeIMessageAccountConfig(cfg: MoltbotConfig, accountId: string): IMessageAccountConfig {
function mergeIMessageAccountConfig(cfg: OpenClawConfig, accountId: string): IMessageAccountConfig {
const { accounts: _ignored, ...base } = (cfg.channels?.imessage ??
{}) as IMessageAccountConfig & { accounts?: unknown };
const account = resolveAccountConfig(cfg, accountId) ?? {};
@@ -45,7 +45,7 @@ function mergeIMessageAccountConfig(cfg: MoltbotConfig, accountId: string): IMes
}
export function resolveIMessageAccount(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
accountId?: string | null;
}): ResolvedIMessageAccount {
const accountId = normalizeAccountId(params.accountId);
@@ -75,7 +75,7 @@ export function resolveIMessageAccount(params: {
};
}
export function listEnabledIMessageAccounts(cfg: MoltbotConfig): ResolvedIMessageAccount[] {
export function listEnabledIMessageAccounts(cfg: OpenClawConfig): ResolvedIMessageAccount[] {
return listIMessageAccountIds(cfg)
.map((accountId) => resolveIMessageAccount({ cfg, accountId }))
.filter((account) => account.enabled);

View File

@@ -36,7 +36,7 @@ vi.mock("../pairing/pairing-store.js", () => ({
}));
vi.mock("../config/sessions.js", () => ({
resolveStorePath: vi.fn(() => "/tmp/moltbot-sessions.json"),
resolveStorePath: vi.fn(() => "/tmp/openclaw-sessions.json"),
updateLastRoute: (...args: unknown[]) => updateLastRouteMock(...args),
readSessionUpdatedAt: vi.fn(() => undefined),
recordSessionMetaFromInbound: vi.fn().mockResolvedValue(undefined),
@@ -80,7 +80,7 @@ beforeEach(() => {
},
session: { mainKey: "main" },
messages: {
groupChat: { mentionPatterns: ["@clawd"] },
groupChat: { mentionPatterns: ["@openclaw"] },
},
};
requestMock.mockReset().mockImplementation((method: string) => {
@@ -219,7 +219,7 @@ describe("monitorIMessageProvider", () => {
chat_id: 123,
sender: "+15550001111",
is_from_me: false,
text: "@clawd hello",
text: "@openclaw hello",
is_group: true,
},
},
@@ -364,7 +364,7 @@ describe("monitorIMessageProvider", () => {
chat_id: 42,
sender: "+15550002222",
is_from_me: false,
text: "@clawd ping",
text: "@openclaw ping",
is_group: true,
chat_name: "Lobster Squad",
participants: ["+1555", "+1556"],
@@ -413,7 +413,7 @@ describe("monitorIMessageProvider", () => {
chat_id: 202,
sender: "+15550003333",
is_from_me: false,
text: "@clawd hi",
text: "@openclaw hi",
is_group: true,
},
},
@@ -448,7 +448,7 @@ describe("monitorIMessageProvider", () => {
chat_id: 303,
sender: "+15550003333",
is_from_me: false,
text: "@clawd hi",
text: "@openclaw hi",
is_group: true,
},
},
@@ -474,7 +474,7 @@ describe("monitorIMessageProvider", () => {
chat_name: "Test Group",
sender: "+15550001111",
is_from_me: false,
text: "@clawd hi",
text: "@openclaw hi",
is_group: true,
created_at: "2026-01-17T00:00:00Z",
},
@@ -489,7 +489,7 @@ describe("monitorIMessageProvider", () => {
const ctx = replyMock.mock.calls[0]?.[0];
const body = ctx?.Body ?? "";
expect(body).toContain("Test Group id:99");
expect(body).toContain("+15550001111: @clawd hi");
expect(body).toContain("+15550001111: @openclaw hi");
});
it("includes reply context when imessage reply metadata is present", async () => {

View File

@@ -36,7 +36,7 @@ vi.mock("../pairing/pairing-store.js", () => ({
}));
vi.mock("../config/sessions.js", () => ({
resolveStorePath: vi.fn(() => "/tmp/moltbot-sessions.json"),
resolveStorePath: vi.fn(() => "/tmp/openclaw-sessions.json"),
updateLastRoute: (...args: unknown[]) => updateLastRouteMock(...args),
readSessionUpdatedAt: vi.fn(() => undefined),
recordSessionMetaFromInbound: vi.fn().mockResolvedValue(undefined),
@@ -80,7 +80,7 @@ beforeEach(() => {
},
session: { mainKey: "main" },
messages: {
groupChat: { mentionPatterns: ["@clawd"] },
groupChat: { mentionPatterns: ["@openclaw"] },
},
};
requestMock.mockReset().mockImplementation((method: string) => {

View File

@@ -58,7 +58,7 @@ import type { IMessagePayload, MonitorIMessageOpts } from "./types.js";
/**
* Try to detect remote host from an SSH wrapper script like:
* exec ssh -T moltbot@192.168.64.3 /opt/homebrew/bin/imsg "$@"
* exec ssh -T openclaw@192.168.64.3 /opt/homebrew/bin/imsg "$@"
* exec ssh -T mac-mini imsg "$@"
* Returns the user@host or host portion if found, undefined otherwise.
*/
@@ -70,7 +70,7 @@ async function detectRemoteHostFromCliPath(cliPath: string): Promise<string | un
: cliPath;
const content = await fs.readFile(expanded, "utf8");
// Match user@host pattern first (e.g., moltbot@192.168.64.3)
// Match user@host pattern first (e.g., openclaw@192.168.64.3)
const userHostMatch = content.match(/\bssh\b[^\n]*?\s+([a-zA-Z0-9._-]+@[a-zA-Z0-9._-]+)/);
if (userHostMatch) return userHostMatch[1];

View File

@@ -1,4 +1,4 @@
import type { MoltbotConfig } from "../../config/config.js";
import type { OpenClawConfig } from "../../config/config.js";
import type { RuntimeEnv } from "../../runtime.js";
export type IMessageAttachment = {
@@ -31,7 +31,7 @@ export type MonitorIMessageOpts = {
cliPath?: string;
dbPath?: string;
accountId?: string;
config?: MoltbotConfig;
config?: OpenClawConfig;
allowFrom?: Array<string | number>;
groupAllowFrom?: Array<string | number>;
includeAttachments?: boolean;