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
+1 -1
View File
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { PluginRuntime } from "clawdbot/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk";
import { setMSTeamsRuntime } from "./runtime.js";
const detectMimeMock = vi.fn(async () => "image/png");
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { MoltbotConfig } from "clawdbot/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { msteamsPlugin } from "./channel.js";
@@ -21,7 +21,7 @@ describe("msteams directory", () => {
},
},
},
} as unknown as MoltbotConfig;
} as unknown as OpenClawConfig;
expect(msteamsPlugin.directory).toBeTruthy();
expect(msteamsPlugin.directory?.listPeers).toBeTruthy();
+3 -3
View File
@@ -1,10 +1,10 @@
import type { ChannelMessageActionName, ChannelPlugin, MoltbotConfig } from "clawdbot/plugin-sdk";
import type { ChannelMessageActionName, ChannelPlugin, OpenClawConfig } from "openclaw/plugin-sdk";
import {
buildChannelConfigSchema,
DEFAULT_ACCOUNT_ID,
MSTeamsConfigSchema,
PAIRING_APPROVED_MESSAGE,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import { msteamsOnboardingAdapter } from "./onboarding.js";
import { msteamsOutbound } from "./outbound.js";
@@ -102,7 +102,7 @@ export const msteamsPlugin: ChannelPlugin<ResolvedMSTeamsAccount> = {
},
}),
deleteAccount: ({ cfg }) => {
const next = { ...cfg } as MoltbotConfig;
const next = { ...cfg } as OpenClawConfig;
const nextChannels = { ...cfg.channels };
delete nextChannels.msteams;
if (Object.keys(nextChannels).length > 0) {
@@ -4,7 +4,7 @@ import path from "node:path";
import { beforeEach, describe, expect, it } from "vitest";
import type { PluginRuntime } from "clawdbot/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk";
import type { StoredConversationReference } from "./conversation-store.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import { setMSTeamsRuntime } from "./runtime.js";
@@ -12,10 +12,11 @@ import { setMSTeamsRuntime } from "./runtime.js";
const runtimeStub = {
state: {
resolveStateDir: (env: NodeJS.ProcessEnv = process.env, homedir?: () => string) => {
const override = env.CLAWDBOT_STATE_DIR?.trim();
const override =
env.OPENCLAW_STATE_DIR?.trim() || env.OPENCLAW_STATE_DIR?.trim();
if (override) return override;
const resolvedHome = homedir ? homedir() : os.homedir();
return path.join(resolvedHome, ".clawdbot");
return path.join(resolvedHome, ".openclaw");
},
},
} as unknown as PluginRuntime;
@@ -26,11 +27,11 @@ describe("msteams conversation store (fs)", () => {
});
it("filters and prunes expired entries (but keeps legacy ones)", async () => {
const stateDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "moltbot-msteams-store-"));
const stateDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "openclaw-msteams-store-"));
const env: NodeJS.ProcessEnv = {
...process.env,
CLAWDBOT_STATE_DIR: stateDir,
OPENCLAW_STATE_DIR: stateDir,
};
const store = createMSTeamsConversationStoreFs({ env, ttlMs: 1_000 });
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ChannelDirectoryEntry } from "clawdbot/plugin-sdk";
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk";
import { GRAPH_ROOT } from "./attachments/shared.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
+4 -4
View File
@@ -36,8 +36,8 @@ export async function uploadToOneDrive(params: {
const fetchFn = params.fetchFn ?? fetch;
const token = await params.tokenProvider.getAccessToken(GRAPH_SCOPE);
// Use "MoltbotShared" folder to organize bot-uploaded files
const uploadPath = `/MoltbotShared/${encodeURIComponent(params.filename)}`;
// Use "OpenClawShared" folder to organize bot-uploaded files
const uploadPath = `/OpenClawShared/${encodeURIComponent(params.filename)}`;
const res = await fetchFn(`${GRAPH_ROOT}/me/drive/root:${uploadPath}:/content`, {
method: "PUT",
@@ -179,8 +179,8 @@ export async function uploadToSharePoint(params: {
const fetchFn = params.fetchFn ?? fetch;
const token = await params.tokenProvider.getAccessToken(GRAPH_SCOPE);
// Use "MoltbotShared" folder to organize bot-uploaded files
const uploadPath = `/MoltbotShared/${encodeURIComponent(params.filename)}`;
// Use "OpenClawShared" folder to organize bot-uploaded files
const uploadPath = `/OpenClawShared/${encodeURIComponent(params.filename)}`;
const res = await fetchFn(`${GRAPH_ROOT}/sites/${params.siteId}/drive/root:${uploadPath}:/content`, {
method: "PUT",
+1 -1
View File
@@ -9,7 +9,7 @@ import {
extensionForMime,
extractOriginalFilename,
getFileExtension,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
/**
* Detect MIME type from URL extension or data URL.
+1 -1
View File
@@ -1,6 +1,6 @@
import { beforeEach, describe, expect, it } from "vitest";
import { SILENT_REPLY_TOKEN, type PluginRuntime } from "clawdbot/plugin-sdk";
import { SILENT_REPLY_TOKEN, type PluginRuntime } from "openclaw/plugin-sdk";
import type { StoredConversationReference } from "./conversation-store.js";
import {
type MSTeamsAdapter,
+1 -1
View File
@@ -6,7 +6,7 @@ import {
type MSTeamsReplyStyle,
type ReplyPayload,
SILENT_REPLY_TOKEN,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type { StoredConversationReference } from "./conversation-store.js";
import { classifyMSTeamsSendError } from "./errors.js";
+2 -2
View File
@@ -1,4 +1,4 @@
import type { MoltbotConfig, RuntimeEnv } from "clawdbot/plugin-sdk";
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import {
buildFileInfoCard,
@@ -27,7 +27,7 @@ export type MSTeamsActivityHandler = {
};
export type MSTeamsMessageHandlerDeps = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
runtime: RuntimeEnv;
appId: string;
adapter: MSTeamsAdapter;
@@ -8,7 +8,7 @@ import {
resolveMentionGating,
formatAllowlistMatchMeta,
type HistoryEntry,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import {
buildMSTeamsAttachmentPlaceholder,
+3 -3
View File
@@ -2,9 +2,9 @@ import type { Request, Response } from "express";
import {
mergeAllowlist,
summarizeMapping,
type MoltbotConfig,
type OpenClawConfig,
type RuntimeEnv,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import type { MSTeamsConversationStore } from "./conversation-store.js";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import { formatUnknownError } from "./errors.js";
@@ -20,7 +20,7 @@ import { resolveMSTeamsCredentials } from "./token.js";
import { getMSTeamsRuntime } from "./runtime.js";
export type MonitorMSTeamsOpts = {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
runtime?: RuntimeEnv;
abortSignal?: AbortSignal;
conversationStore?: MSTeamsConversationStore;
+11 -11
View File
@@ -1,16 +1,16 @@
import type {
ChannelOnboardingAdapter,
ChannelOnboardingDmPolicy,
MoltbotConfig,
OpenClawConfig,
DmPolicy,
WizardPrompter,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import {
addWildcardAllowFrom,
DEFAULT_ACCOUNT_ID,
formatDocsLink,
promptChannelAccessConfig,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import { resolveMSTeamsCredentials } from "./token.js";
import {
@@ -21,7 +21,7 @@ import {
const channel = "msteams" as const;
function setMSTeamsDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
function setMSTeamsDmPolicy(cfg: OpenClawConfig, dmPolicy: DmPolicy) {
const allowFrom =
dmPolicy === "open"
? addWildcardAllowFrom(cfg.channels?.msteams?.allowFrom)?.map((entry) => String(entry))
@@ -39,7 +39,7 @@ function setMSTeamsDmPolicy(cfg: MoltbotConfig, dmPolicy: DmPolicy) {
};
}
function setMSTeamsAllowFrom(cfg: MoltbotConfig, allowFrom: string[]): MoltbotConfig {
function setMSTeamsAllowFrom(cfg: OpenClawConfig, allowFrom: string[]): OpenClawConfig {
return {
...cfg,
channels: {
@@ -64,9 +64,9 @@ function looksLikeGuid(value: string): boolean {
}
async function promptMSTeamsAllowFrom(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
prompter: WizardPrompter;
}): Promise<MoltbotConfig> {
}): Promise<OpenClawConfig> {
const existing = params.cfg.channels?.msteams?.allowFrom ?? [];
await params.prompter.note(
[
@@ -144,9 +144,9 @@ async function noteMSTeamsCredentialHelp(prompter: WizardPrompter): Promise<void
}
function setMSTeamsGroupPolicy(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
groupPolicy: "open" | "allowlist" | "disabled",
): MoltbotConfig {
): OpenClawConfig {
return {
...cfg,
channels: {
@@ -161,9 +161,9 @@ function setMSTeamsGroupPolicy(
}
function setMSTeamsTeamsAllowlist(
cfg: MoltbotConfig,
cfg: OpenClawConfig,
entries: Array<{ teamKey: string; channelKey?: string }>,
): MoltbotConfig {
): OpenClawConfig {
const baseTeams = cfg.channels?.msteams?.teams ?? {};
const teams: Record<string, { channels?: Record<string, unknown> }> = { ...baseTeams };
for (const entry of entries) {
+1 -1
View File
@@ -1,4 +1,4 @@
import type { ChannelOutboundAdapter } from "clawdbot/plugin-sdk";
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk";
import { createMSTeamsPollStoreFs } from "./polls.js";
import { getMSTeamsRuntime } from "./runtime.js";
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it } from "vitest";
import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
import {
isMSTeamsGroupAllowed,
resolveMSTeamsReplyPolicy,
+2 -2
View File
@@ -7,14 +7,14 @@ import type {
MSTeamsConfig,
MSTeamsReplyStyle,
MSTeamsTeamConfig,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import {
buildChannelKeyCandidates,
normalizeChannelSlug,
resolveToolsBySender,
resolveChannelEntryMatchWithFallback,
resolveNestedAllowlistDecision,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
export type MSTeamsResolvedRouteConfig = {
teamConfig?: MSTeamsTeamConfig;
+1 -1
View File
@@ -8,7 +8,7 @@ import { createMSTeamsPollStoreFs } from "./polls.js";
import { createMSTeamsPollStoreMemory } from "./polls-store-memory.js";
const createFsStore = async () => {
const stateDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "moltbot-msteams-polls-"));
const stateDir = await fs.promises.mkdtemp(path.join(os.tmpdir(), "openclaw-msteams-polls-"));
return createMSTeamsPollStoreFs({ stateDir });
};
+6 -5
View File
@@ -4,17 +4,18 @@ import path from "node:path";
import { beforeEach, describe, expect, it } from "vitest";
import type { PluginRuntime } from "clawdbot/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk";
import { buildMSTeamsPollCard, createMSTeamsPollStoreFs, extractMSTeamsPollVote } from "./polls.js";
import { setMSTeamsRuntime } from "./runtime.js";
const runtimeStub = {
state: {
resolveStateDir: (env: NodeJS.ProcessEnv = process.env, homedir?: () => string) => {
const override = env.CLAWDBOT_STATE_DIR?.trim();
const override =
env.OPENCLAW_STATE_DIR?.trim() || env.OPENCLAW_STATE_DIR?.trim();
if (override) return override;
const resolvedHome = homedir ? homedir() : os.homedir();
return path.join(resolvedHome, ".clawdbot");
return path.join(resolvedHome, ".openclaw");
},
},
} as unknown as PluginRuntime;
@@ -39,7 +40,7 @@ describe("msteams polls", () => {
it("extracts poll votes from activity values", () => {
const vote = extractMSTeamsPollVote({
value: {
moltbotPollId: "poll-1",
openclawPollId: "poll-1",
choices: "0,1",
},
});
@@ -51,7 +52,7 @@ describe("msteams polls", () => {
});
it("stores and records poll votes", async () => {
const home = await fs.promises.mkdtemp(path.join(os.tmpdir(), "moltbot-msteams-polls-"));
const home = await fs.promises.mkdtemp(path.join(os.tmpdir(), "openclaw-msteams-polls-"));
const store = createMSTeamsPollStoreFs({ homedir: () => home });
await store.createPoll({
id: "poll-2",
+9 -8
View File
@@ -97,13 +97,13 @@ export function extractMSTeamsPollVote(
const value = activity?.value;
if (!value || !isRecord(value)) return null;
const pollId =
readNestedString(value, ["moltbotPollId"]) ??
readNestedString(value, ["openclawPollId"]) ??
readNestedString(value, ["pollId"]) ??
readNestedString(value, ["moltbot", "pollId"]) ??
readNestedString(value, ["moltbot", "poll", "id"]) ??
readNestedString(value, ["data", "moltbotPollId"]) ??
readNestedString(value, ["openclaw", "pollId"]) ??
readNestedString(value, ["openclaw", "poll", "id"]) ??
readNestedString(value, ["data", "openclawPollId"]) ??
readNestedString(value, ["data", "pollId"]) ??
readNestedString(value, ["data", "moltbot", "pollId"]);
readNestedString(value, ["data", "openclaw", "pollId"]);
if (!pollId) return null;
const directSelections = extractSelections(value.choices);
@@ -176,13 +176,14 @@ export function buildMSTeamsPollCard(params: {
type: "Action.Submit",
title: "Vote",
data: {
moltbotPollId: pollId,
openclawPollId: pollId,
pollId,
},
msteams: {
type: "messageBack",
text: "moltbot poll vote",
text: "openclaw poll vote",
displayText: "Vote recorded",
value: { moltbotPollId: pollId },
value: { openclawPollId: pollId, pollId },
},
},
],
+1 -1
View File
@@ -1,6 +1,6 @@
import { describe, expect, it, vi } from "vitest";
import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
const hostMockState = vi.hoisted(() => ({
tokenError: null as Error | null,
+1 -1
View File
@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
import { formatUnknownError } from "./errors.js";
import { loadMSTeamsSdkWithAuth } from "./sdk.js";
import { resolveMSTeamsCredentials } from "./token.js";
+3 -3
View File
@@ -3,10 +3,10 @@ import {
createTypingCallbacks,
logTypingFailure,
resolveChannelMediaMaxBytes,
type MoltbotConfig,
type OpenClawConfig,
type MSTeamsReplyStyle,
type RuntimeEnv,
} from "clawdbot/plugin-sdk";
} from "openclaw/plugin-sdk";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type { StoredConversationReference } from "./conversation-store.js";
import {
@@ -24,7 +24,7 @@ import type { MSTeamsTurnContext } from "./sdk-types.js";
import { getMSTeamsRuntime } from "./runtime.js";
export function createMSTeamsReplyDispatcher(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
agentId: string;
runtime: RuntimeEnv;
log: MSTeamsMonitorLogger;
+1 -1
View File
@@ -1,4 +1,4 @@
import type { PluginRuntime } from "clawdbot/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk";
let runtime: PluginRuntime | null = null;
+2 -2
View File
@@ -1,4 +1,4 @@
import { resolveChannelMediaMaxBytes, type MoltbotConfig, type PluginRuntime } from "clawdbot/plugin-sdk";
import { resolveChannelMediaMaxBytes, type OpenClawConfig, type PluginRuntime } from "openclaw/plugin-sdk";
import type { MSTeamsAccessTokenProvider } from "./attachments/types.js";
import type {
MSTeamsConversationStore,
@@ -84,7 +84,7 @@ async function findConversationReference(recipient: {
}
export async function resolveMSTeamsSendContext(params: {
cfg: MoltbotConfig;
cfg: OpenClawConfig;
to: string;
}): Promise<MSTeamsProactiveContext> {
const msteamsCfg = params.cfg.channels?.msteams;
+5 -5
View File
@@ -1,5 +1,5 @@
import { loadWebMedia, resolveChannelMediaMaxBytes } from "clawdbot/plugin-sdk";
import type { MoltbotConfig } from "clawdbot/plugin-sdk";
import { loadWebMedia, resolveChannelMediaMaxBytes } from "openclaw/plugin-sdk";
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { createMSTeamsConversationStoreFs } from "./conversation-store-fs.js";
import {
classifyMSTeamsSendError,
@@ -21,7 +21,7 @@ import { resolveMSTeamsSendContext, type MSTeamsProactiveContext } from "./send-
export type SendMSTeamsMessageParams = {
/** Full config (for credentials) */
cfg: MoltbotConfig;
cfg: OpenClawConfig;
/** Conversation ID or user ID to send to */
to: string;
/** Message text */
@@ -48,7 +48,7 @@ const MSTEAMS_MAX_MEDIA_BYTES = 100 * 1024 * 1024;
export type SendMSTeamsPollParams = {
/** Full config (for credentials) */
cfg: MoltbotConfig;
cfg: OpenClawConfig;
/** Conversation ID or user ID to send to */
to: string;
/** Poll question */
@@ -67,7 +67,7 @@ export type SendMSTeamsPollResult = {
export type SendMSTeamsCardParams = {
/** Full config (for credentials) */
cfg: MoltbotConfig;
cfg: OpenClawConfig;
/** Conversation ID or user ID to send to */
to: string;
/** Adaptive Card JSON object */
+1 -1
View File
@@ -1,4 +1,4 @@
import type { MSTeamsConfig } from "clawdbot/plugin-sdk";
import type { MSTeamsConfig } from "openclaw/plugin-sdk";
export type MSTeamsCredentials = {
appId: string;