Plugins/bluebubbles: migrate to scoped plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 02:32:54 -05:00
parent c7c25c8902
commit 9cfec9c05e
30 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/bluebubbles";
import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/core"; import { emptyPluginConfigSchema } from "openclaw/plugin-sdk/bluebubbles";
import { bluebubblesPlugin } from "./src/channel.js"; import { bluebubblesPlugin } from "./src/channel.js";
import { setBlueBubblesRuntime } from "./src/runtime.js"; import { setBlueBubblesRuntime } from "./src/runtime.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { normalizeResolvedSecretInputString } from "./secret-input.js"; import { normalizeResolvedSecretInputString } from "./secret-input.js";

View File

@@ -3,7 +3,7 @@ import {
normalizeAccountId, normalizeAccountId,
normalizeOptionalAccountId, normalizeOptionalAccountId,
} from "openclaw/plugin-sdk/account-id"; } from "openclaw/plugin-sdk/account-id";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { hasConfiguredSecretInput, normalizeSecretInputString } from "./secret-input.js"; import { hasConfiguredSecretInput, normalizeSecretInputString } from "./secret-input.js";
import { normalizeBlueBubblesServerUrl, type BlueBubblesAccountConfig } from "./types.js"; import { normalizeBlueBubblesServerUrl, type BlueBubblesAccountConfig } from "./types.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { describe, expect, it, vi, beforeEach } from "vitest"; import { describe, expect, it, vi, beforeEach } from "vitest";
import { bluebubblesMessageActions } from "./actions.js"; import { bluebubblesMessageActions } from "./actions.js";
import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";

View File

@@ -10,7 +10,7 @@ import {
readStringParam, readStringParam,
type ChannelMessageActionAdapter, type ChannelMessageActionAdapter,
type ChannelMessageActionName, type ChannelMessageActionName,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { sendBlueBubblesAttachment } from "./attachments.js"; import { sendBlueBubblesAttachment } from "./attachments.js";
import { import {

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk/compat"; import type { PluginRuntime } from "openclaw/plugin-sdk/bluebubbles";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import "./test-mocks.js"; import "./test-mocks.js";
import { downloadBlueBubblesAttachment, sendBlueBubblesAttachment } from "./attachments.js"; import { downloadBlueBubblesAttachment, sendBlueBubblesAttachment } from "./attachments.js";

View File

@@ -1,6 +1,6 @@
import crypto from "node:crypto"; import crypto from "node:crypto";
import path from "node:path"; import path from "node:path";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesServerAccount } from "./account-resolve.js"; import { resolveBlueBubblesServerAccount } from "./account-resolve.js";
import { postMultipartFormData } from "./multipart.js"; import { postMultipartFormData } from "./multipart.js";
import { import {

View File

@@ -2,7 +2,7 @@ import type {
ChannelAccountSnapshot, ChannelAccountSnapshot,
ChannelPlugin, ChannelPlugin,
OpenClawConfig, OpenClawConfig,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { import {
applyAccountNameToChannelSection, applyAccountNameToChannelSection,
buildChannelConfigSchema, buildChannelConfigSchema,
@@ -17,7 +17,7 @@ import {
resolveBlueBubblesGroupRequireMention, resolveBlueBubblesGroupRequireMention,
resolveBlueBubblesGroupToolPolicy, resolveBlueBubblesGroupToolPolicy,
setAccountEnabledInConfigSection, setAccountEnabledInConfigSection,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { import {
listBlueBubblesAccountIds, listBlueBubblesAccountIds,
type ResolvedBlueBubblesAccount, type ResolvedBlueBubblesAccount,

View File

@@ -1,6 +1,6 @@
import crypto from "node:crypto"; import crypto from "node:crypto";
import path from "node:path"; import path from "node:path";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesServerAccount } from "./account-resolve.js"; import { resolveBlueBubblesServerAccount } from "./account-resolve.js";
import { postMultipartFormData } from "./multipart.js"; import { postMultipartFormData } from "./multipart.js";
import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";

View File

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

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesServerAccount } from "./account-resolve.js"; import { resolveBlueBubblesServerAccount } from "./account-resolve.js";
import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js"; import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js";

View File

@@ -2,7 +2,7 @@ import fs from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { pathToFileURL } from "node:url"; import { pathToFileURL } from "node:url";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/bluebubbles";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { sendBlueBubblesMedia } from "./media-send.js"; import { sendBlueBubblesMedia } from "./media-send.js";
import { setBlueBubblesRuntime } from "./runtime.js"; import { setBlueBubblesRuntime } from "./runtime.js";

View File

@@ -3,7 +3,7 @@ import fs from "node:fs/promises";
import os from "node:os"; import os from "node:os";
import path from "node:path"; import path from "node:path";
import { fileURLToPath } from "node:url"; import { fileURLToPath } from "node:url";
import { resolveChannelMediaMaxBytes, type OpenClawConfig } from "openclaw/plugin-sdk/compat"; import { resolveChannelMediaMaxBytes, type OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { sendBlueBubblesAttachment } from "./attachments.js"; import { sendBlueBubblesAttachment } from "./attachments.js";
import { resolveBlueBubblesMessageId } from "./monitor.js"; import { resolveBlueBubblesMessageId } from "./monitor.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import type { NormalizedWebhookMessage } from "./monitor-normalize.js"; import type { NormalizedWebhookMessage } from "./monitor-normalize.js";
import type { BlueBubblesCoreRuntime, WebhookTarget } from "./monitor-shared.js"; import type { BlueBubblesCoreRuntime, WebhookTarget } from "./monitor-shared.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { import {
DM_GROUP_ACCESS_REASON, DM_GROUP_ACCESS_REASON,
createScopedPairingAccess, createScopedPairingAccess,
@@ -14,7 +14,7 @@ import {
resolveControlCommandGate, resolveControlCommandGate,
stripMarkdown, stripMarkdown,
type HistoryEntry, type HistoryEntry,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { downloadBlueBubblesAttachment } from "./attachments.js"; import { downloadBlueBubblesAttachment } from "./attachments.js";
import { markBlueBubblesChatRead, sendBlueBubblesTyping } from "./chat.js"; import { markBlueBubblesChatRead, sendBlueBubblesTyping } from "./chat.js";
import { fetchBlueBubblesHistory } from "./history.js"; import { fetchBlueBubblesHistory } from "./history.js";

View File

@@ -1,4 +1,4 @@
import { normalizeWebhookPath, type OpenClawConfig } from "openclaw/plugin-sdk/compat"; import { normalizeWebhookPath, type OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import type { ResolvedBlueBubblesAccount } from "./accounts.js"; import type { ResolvedBlueBubblesAccount } from "./accounts.js";
import { getBlueBubblesRuntime } from "./runtime.js"; import { getBlueBubblesRuntime } from "./runtime.js";
import type { BlueBubblesAccountConfig } from "./types.js"; import type { BlueBubblesAccountConfig } from "./types.js";

View File

@@ -1,6 +1,6 @@
import { EventEmitter } from "node:events"; import { EventEmitter } from "node:events";
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/bluebubbles";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js"; import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js";
import type { ResolvedBlueBubblesAccount } from "./accounts.js"; import type { ResolvedBlueBubblesAccount } from "./accounts.js";

View File

@@ -7,7 +7,7 @@ import {
readWebhookBodyOrReject, readWebhookBodyOrReject,
resolveWebhookTargetWithAuthOrRejectSync, resolveWebhookTargetWithAuthOrRejectSync,
resolveWebhookTargets, resolveWebhookTargets,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { createBlueBubblesDebounceRegistry } from "./monitor-debounce.js"; import { createBlueBubblesDebounceRegistry } from "./monitor-debounce.js";
import { normalizeWebhookMessage, normalizeWebhookReaction } from "./monitor-normalize.js"; import { normalizeWebhookMessage, normalizeWebhookReaction } from "./monitor-normalize.js";
import { logVerbose, processMessage, processReaction } from "./monitor-processing.js"; import { logVerbose, processMessage, processReaction } from "./monitor-processing.js";

View File

@@ -1,6 +1,6 @@
import { EventEmitter } from "node:events"; import { EventEmitter } from "node:events";
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/bluebubbles";
import { afterEach, beforeEach, describe, expect, it, vi } from "vitest"; import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js"; import { createPluginRuntimeMock } from "../../test-utils/plugin-runtime-mock.js";
import type { ResolvedBlueBubblesAccount } from "./accounts.js"; import type { ResolvedBlueBubblesAccount } from "./accounts.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { afterEach, describe, expect, it } from "vitest"; import { afterEach, describe, expect, it } from "vitest";
import { createEmptyPluginRegistry } from "../../../src/plugins/registry.js"; import { createEmptyPluginRegistry } from "../../../src/plugins/registry.js";
import { setActivePluginRegistry } from "../../../src/plugins/runtime.js"; import { setActivePluginRegistry } from "../../../src/plugins/runtime.js";

View File

@@ -1,7 +1,7 @@
import type { WizardPrompter } from "openclaw/plugin-sdk/compat"; import type { WizardPrompter } from "openclaw/plugin-sdk/bluebubbles";
import { describe, expect, it, vi } from "vitest"; import { describe, expect, it, vi } from "vitest";
vi.mock("openclaw/plugin-sdk", () => ({ vi.mock("openclaw/plugin-sdk/bluebubbles", () => ({
DEFAULT_ACCOUNT_ID: "default", DEFAULT_ACCOUNT_ID: "default",
addWildcardAllowFrom: vi.fn(), addWildcardAllowFrom: vi.fn(),
formatDocsLink: (_url: string, fallback: string) => fallback, formatDocsLink: (_url: string, fallback: string) => fallback,

View File

@@ -4,7 +4,7 @@ import type {
OpenClawConfig, OpenClawConfig,
DmPolicy, DmPolicy,
WizardPrompter, WizardPrompter,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { import {
DEFAULT_ACCOUNT_ID, DEFAULT_ACCOUNT_ID,
addWildcardAllowFrom, addWildcardAllowFrom,
@@ -12,7 +12,7 @@ import {
mergeAllowFromEntries, mergeAllowFromEntries,
normalizeAccountId, normalizeAccountId,
promptAccountId, promptAccountId,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
import { import {
listBlueBubblesAccountIds, listBlueBubblesAccountIds,
resolveBlueBubblesAccount, resolveBlueBubblesAccount,

View File

@@ -1,4 +1,4 @@
import type { BaseProbeResult } from "openclaw/plugin-sdk/compat"; import type { BaseProbeResult } from "openclaw/plugin-sdk/bluebubbles";
import { normalizeSecretInputString } from "./secret-input.js"; import { normalizeSecretInputString } from "./secret-input.js";
import { buildBlueBubblesApiUrl, blueBubblesFetchWithTimeout } from "./types.js"; import { buildBlueBubblesApiUrl, blueBubblesFetchWithTimeout } from "./types.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesServerAccount } from "./account-resolve.js"; import { resolveBlueBubblesServerAccount } from "./account-resolve.js";
import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";
import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js"; import { blueBubblesFetchWithTimeout, buildBlueBubblesApiUrl } from "./types.js";

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk/compat"; import type { PluginRuntime } from "openclaw/plugin-sdk/bluebubbles";
let runtime: PluginRuntime | null = null; let runtime: PluginRuntime | null = null;
type LegacyRuntimeLogShape = { log?: (message: string) => void }; type LegacyRuntimeLogShape = { log?: (message: string) => void };

View File

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

View File

@@ -1,4 +1,4 @@
import type { PluginRuntime } from "openclaw/plugin-sdk/compat"; import type { PluginRuntime } from "openclaw/plugin-sdk/bluebubbles";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";
import "./test-mocks.js"; import "./test-mocks.js";
import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js"; import { getCachedBlueBubblesPrivateApiStatus } from "./probe.js";

View File

@@ -1,6 +1,6 @@
import crypto from "node:crypto"; import crypto from "node:crypto";
import type { OpenClawConfig } from "openclaw/plugin-sdk/compat"; import type { OpenClawConfig } from "openclaw/plugin-sdk/bluebubbles";
import { stripMarkdown } from "openclaw/plugin-sdk/compat"; import { stripMarkdown } from "openclaw/plugin-sdk/bluebubbles";
import { resolveBlueBubblesAccount } from "./accounts.js"; import { resolveBlueBubblesAccount } from "./accounts.js";
import { import {
getCachedBlueBubblesPrivateApiStatus, getCachedBlueBubblesPrivateApiStatus,

View File

@@ -5,7 +5,7 @@ import {
type ParsedChatTarget, type ParsedChatTarget,
resolveServicePrefixedAllowTarget, resolveServicePrefixedAllowTarget,
resolveServicePrefixedTarget, resolveServicePrefixedTarget,
} from "openclaw/plugin-sdk/compat"; } from "openclaw/plugin-sdk/bluebubbles";
export type BlueBubblesService = "imessage" | "sms" | "auto"; export type BlueBubblesService = "imessage" | "sms" | "auto";

View File

@@ -1,6 +1,6 @@
import type { DmPolicy, GroupPolicy } from "openclaw/plugin-sdk/compat"; import type { DmPolicy, GroupPolicy } from "openclaw/plugin-sdk/bluebubbles";
export type { DmPolicy, GroupPolicy } from "openclaw/plugin-sdk/compat"; export type { DmPolicy, GroupPolicy } from "openclaw/plugin-sdk/bluebubbles";
export type BlueBubblesGroupConfig = { export type BlueBubblesGroupConfig = {
/** If true, only respond in this group when mentioned. */ /** If true, only respond in this group when mentioned. */