Plugins/matrix: migrate to scoped plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 02:33:03 -05:00
parent a5f56e8b4e
commit b69b2a7ae0
35 changed files with 37 additions and 37 deletions

View File

@@ -1,5 +1,5 @@
import type { OpenClawPluginApi } from "openclaw/plugin-sdk/core"; import type { OpenClawPluginApi } from "openclaw/plugin-sdk/matrix";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/matrix";
import { matrixPlugin } from "./src/channel.js"; import { matrixPlugin } from "./src/channel.js";
import { ensureMatrixCryptoRuntime } from "./src/matrix/deps.js"; import { ensureMatrixCryptoRuntime } from "./src/matrix/deps.js";
import { setMatrixRuntime } from "./src/runtime.js"; import { setMatrixRuntime } from "./src/runtime.js";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
import { resolveAllowlistMatchByCandidates, type AllowlistMatch } from "openclaw/plugin-sdk/compat"; import { resolveAllowlistMatchByCandidates, type AllowlistMatch } from "openclaw/plugin-sdk/matrix";
function normalizeAllowList(list?: Array<string | number>) { function normalizeAllowList(list?: Array<string | number>) {
return (list ?? []).map((entry) => String(entry).trim()).filter(Boolean); 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 { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { RuntimeEnv } from "openclaw/plugin-sdk/compat"; import type { RuntimeEnv } from "openclaw/plugin-sdk/matrix";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import type { CoreConfig } from "../../types.js"; import type { CoreConfig } from "../../types.js";
import { loadMatrixSdk } from "../sdk-runtime.js"; import { loadMatrixSdk } from "../sdk-runtime.js";

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@@ -1,5 +1,5 @@
import type { MatrixClient } from "@vector-im/matrix-bot-sdk"; import type { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/compat"; import type { PluginRuntime, RuntimeEnv } from "openclaw/plugin-sdk/matrix";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";
const sendMessageMatrixMock = vi.hoisted(() => vi.fn().mockResolvedValue({ messageId: "mx-1" })); 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 { MatrixClient } from "@vector-im/matrix-bot-sdk";
import type { MarkdownTableMode, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk/compat"; import type { MarkdownTableMode, ReplyPayload, RuntimeEnv } from "openclaw/plugin-sdk/matrix";
import { getMatrixRuntime } from "../../runtime.js"; import { getMatrixRuntime } from "../../runtime.js";
import { sendMessageMatrix } from "../send.js"; import { sendMessageMatrix } from "../send.js";

View File

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

View File

@@ -7,7 +7,7 @@
* - m.poll.end - Closes a poll * - m.poll.end - Closes a poll
*/ */
import type { PollInput } from "openclaw/plugin-sdk/compat"; import type { PollInput } from "openclaw/plugin-sdk/matrix";
export const M_POLL_START = "m.poll.start" as const; export const M_POLL_START = "m.poll.start" as const;
export const M_POLL_RESPONSE = "m.poll.response" 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/compat"; import type { BaseProbeResult } from "openclaw/plugin-sdk/matrix";
import { createMatrixClient, isBunRuntime } from "./client.js"; import { createMatrixClient, isBunRuntime } from "./client.js";
export type MatrixProbe = BaseProbeResult & { export type MatrixProbe = BaseProbeResult & {

View File

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

View File

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

View File

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

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk/matrix";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";
const mocks = vi.hoisted(() => ({ const mocks = vi.hoisted(() => ({

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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