Extensions: migrate matrix plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 01:20:10 -05:00
parent b7df821372
commit 15f7e329c2
33 changed files with 34 additions and 34 deletions

View File

@@ -6,7 +6,7 @@ import {
type ChannelMessageActionContext,
type ChannelMessageActionName,
type ChannelToolSend,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { resolveMatrixAccount } from "./matrix/accounts.js";
import { handleMatrixAction } from "./tool-actions.js";
import type { CoreConfig } from "./types.js";

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk";
import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { matrixPlugin } from "./channel.js";
import { setMatrixRuntime } from "./runtime.js";

View File

@@ -11,7 +11,7 @@ import {
resolveDefaultGroupPolicy,
setAccountEnabledInConfigSection,
type ChannelPlugin,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { matrixMessageActions } from "./actions.js";
import { MatrixConfigSchema } from "./config-schema.js";
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";

View File

@@ -1,4 +1,4 @@
import { MarkdownConfigSchema, ToolPolicySchema } from "openclaw/plugin-sdk";
import { MarkdownConfigSchema, ToolPolicySchema } from "openclaw/plugin-sdk/compat";
import { z } from "zod";
import { buildSecretInputSchema } from "./secret-input.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk";
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/compat";
import { resolveMatrixAuth } from "./matrix/client.js";
type MatrixUserResult = {

View File

@@ -1,4 +1,4 @@
import type { ChannelGroupContext, GroupToolPolicyConfig } from "openclaw/plugin-sdk";
import type { ChannelGroupContext, GroupToolPolicyConfig } from "openclaw/plugin-sdk/compat";
import { resolveMatrixAccountConfig } from "./matrix/accounts.js";
import { resolveMatrixRoomConfig } from "./matrix/monitor/rooms.js";
import type { CoreConfig } from "./types.js";

View File

@@ -1,5 +1,5 @@
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/compat";
import { getMatrixRuntime } from "../../runtime.js";
import {
normalizeResolvedSecretInputString,

View File

@@ -2,7 +2,7 @@ import fs from "node:fs";
import { createRequire } from "node:module";
import path from "node:path";
import { fileURLToPath } from "node:url";
import { runPluginCommandWithTimeout, type RuntimeEnv } from "openclaw/plugin-sdk";
import { runPluginCommandWithTimeout, type RuntimeEnv } from "openclaw/plugin-sdk/compat";
const MATRIX_SDK_PACKAGE = "@vector-im/matrix-bot-sdk";
const MATRIX_CRYPTO_DOWNLOAD_HELPER = "@matrix-org/matrix-sdk-crypto-nodejs/download-lib.js";

View File

@@ -3,7 +3,7 @@ import {
issuePairingChallenge,
readStoreAllowFromForDmPolicy,
resolveDmGroupAccessWithLists,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import {
normalizeMatrixAllowList,
resolveMatrixAllowListMatch,

View File

@@ -1,4 +1,4 @@
import { resolveAllowlistMatchByCandidates, type AllowlistMatch } from "openclaw/plugin-sdk";
import { resolveAllowlistMatchByCandidates, type AllowlistMatch } from "openclaw/plugin-sdk/compat";
function normalizeAllowList(list?: Array<string | number>) {
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean);

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { RuntimeEnv } from "openclaw/plugin-sdk";
import type { RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { getMatrixRuntime } from "../../runtime.js";
import type { CoreConfig } from "../../types.js";
import { loadMatrixSdk } from "../sdk-runtime.js";

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PluginRuntime, RuntimeLogger } from "openclaw/plugin-sdk";
import type { PluginRuntime, RuntimeLogger } from "openclaw/plugin-sdk/compat";
import { beforeEach, describe, expect, it, vi } from "vitest";
import type { MatrixAuth } from "../client.js";
import { registerMatrixMonitorEvents } from "./events.js";

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PluginRuntime, RuntimeLogger } from "openclaw/plugin-sdk";
import type { PluginRuntime, RuntimeLogger } from "openclaw/plugin-sdk/compat";
import type { MatrixAuth } from "../client.js";
import { sendReadReceiptMatrix } from "../send.js";
import type { MatrixRawEvent } from "./types.js";

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PluginRuntime, RuntimeEnv, RuntimeLogger } from "openclaw/plugin-sdk";
import type { PluginRuntime, RuntimeEnv, RuntimeLogger } from "openclaw/plugin-sdk/compat";
import { describe, expect, it, vi } from "vitest";
import { createMatrixRoomMessageHandler } from "./handler.js";
import { EventType, type MatrixRawEvent } from "./types.js";

View File

@@ -11,7 +11,7 @@ import {
type PluginRuntime,
type RuntimeEnv,
type RuntimeLogger,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import type { CoreConfig, MatrixRoomConfig, ReplyToMode } from "../../types.js";
import { fetchEventSummary } from "../actions/summary.js";
import {

View File

@@ -7,7 +7,7 @@ import {
summarizeMapping,
warnMissingProviderGroupPolicyFallbackOnce,
type RuntimeEnv,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { resolveMatrixTargets } from "../../resolve-targets.js";
import { getMatrixRuntime } from "../../runtime.js";
import type { CoreConfig, MatrixConfig, MatrixRoomConfig, ReplyToMode } from "../../types.js";

View File

@@ -3,7 +3,7 @@ import {
formatLocationText,
toLocationContext,
type NormalizedLocation,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { EventType } from "./types.js";
export type MatrixLocationPayload = {

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
import { beforeEach, describe, expect, it, vi } from "vitest";
import { setMatrixRuntime } from "../../runtime.js";
import { downloadMatrixMedia } from "./media.js";

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk";
import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { beforeEach, describe, expect, it, vi } from "vitest";
const sendMessageMatrixMock = vi.hoisted(() => vi.fn().mockResolvedValue({ messageId: "mx-1" }));

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { MarkdownTableMode, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk";
import type { MarkdownTableMode, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { getMatrixRuntime } from "../../runtime.js";
import { sendMessageMatrix } from "../send.js";

View File

@@ -1,4 +1,4 @@
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "openclaw/plugin-sdk";
import { buildChannelKeyCandidates, resolveChannelEntryMatch } from "openclaw/plugin-sdk/compat";
import type { MatrixRoomConfig } from "../../types.js";
export type MatrixRoomConfigResolved = {

View File

@@ -7,7 +7,7 @@
* - m.poll.end - Closes a poll
*/
import type { PollInput } from "openclaw/plugin-sdk";
import type { PollInput } from "openclaw/plugin-sdk/compat";
export const M_POLL_START = "m.poll.start" as const;
export const M_POLL_RESPONSE = "m.poll.response" as const;

View File

@@ -1,4 +1,4 @@
import type { BaseProbeResult } from "openclaw/plugin-sdk";
import type { BaseProbeResult } from "openclaw/plugin-sdk/compat";
import { createMatrixClient, isBunRuntime } from "./client.js";
export type MatrixProbe = BaseProbeResult & {

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
import { beforeAll, beforeEach, describe, expect, it, vi } from "vitest";
import { setMatrixRuntime } from "../runtime.js";

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PollInput } from "openclaw/plugin-sdk";
import type { PollInput } from "openclaw/plugin-sdk/compat";
import { getMatrixRuntime } from "../runtime.js";
import { buildPollStartContent, M_POLL_START } from "./poll-types.js";
import { enqueueSend } from "./send-queue.js";

View File

@@ -1,4 +1,4 @@
import type { DmPolicy } from "openclaw/plugin-sdk";
import type { DmPolicy } from "openclaw/plugin-sdk/compat";
import {
addWildcardAllowFrom,
formatResolvedUnresolvedNote,
@@ -11,7 +11,7 @@ import {
type ChannelOnboardingAdapter,
type ChannelOnboardingDmPolicy,
type WizardPrompter,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { listMatrixDirectoryGroupsLive } from "./directory-live.js";
import { resolveMatrixAccount } from "./matrix/accounts.js";
import { ensureMatrixSdkInstalled, isMatrixSdkAvailable } from "./matrix/deps.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk";
import type { ChannelOutboundAdapter } from "openclaw/plugin-sdk/compat";
import { sendMessageMatrix, sendPollMatrix } from "./matrix/send.js";
import { getMatrixRuntime } from "./runtime.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk";
import type { ChannelDirectoryEntry } from "openclaw/plugin-sdk/compat";
import { describe, expect, it, vi, beforeEach } from "vitest";
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
import { resolveMatrixTargets } from "./resolve-targets.js";

View File

@@ -3,7 +3,7 @@ import type {
ChannelResolveKind,
ChannelResolveResult,
RuntimeEnv,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { listMatrixDirectoryGroupsLive, listMatrixDirectoryPeersLive } from "./directory-live.js";
function findExactDirectoryMatches(

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk";
import type { PluginRuntime } from "openclaw/plugin-sdk/compat";
let runtime: PluginRuntime | null = null;

View File

@@ -2,7 +2,7 @@ import {
hasConfiguredSecretInput,
normalizeResolvedSecretInputString,
normalizeSecretInputString,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import { z } from "zod";
export { hasConfiguredSecretInput, normalizeResolvedSecretInputString, normalizeSecretInputString };

View File

@@ -5,7 +5,7 @@ import {
readNumberParam,
readReactionParams,
readStringParam,
} from "openclaw/plugin-sdk";
} from "openclaw/plugin-sdk/compat";
import {
deleteMatrixMessage,
editMatrixMessage,

View File

@@ -1,4 +1,4 @@
import type { DmPolicy, GroupPolicy, SecretInput } from "openclaw/plugin-sdk";
import type { DmPolicy, GroupPolicy, SecretInput } from "openclaw/plugin-sdk/compat";
export type { DmPolicy, GroupPolicy };
export type ReplyToMode = "off" | "first" | "all";