Extensions: migrate zalo plugin-sdk imports

This commit is contained in:
Gustavo Madeira Santana
2026-03-04 01:20:20 -05:00
parent b361cac753
commit dda86af866
19 changed files with 29 additions and 25 deletions

View File

@@ -1,9 +1,9 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk";
import { import {
DEFAULT_ACCOUNT_ID, DEFAULT_ACCOUNT_ID,
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 { resolveZaloToken } from "./token.js"; import { resolveZaloToken } from "./token.js";
import type { ResolvedZaloAccount, ZaloAccountConfig, ZaloConfig } from "./types.js"; import type { ResolvedZaloAccount, ZaloAccountConfig, ZaloConfig } from "./types.js";

View File

@@ -2,8 +2,8 @@ import type {
ChannelMessageActionAdapter, ChannelMessageActionAdapter,
ChannelMessageActionName, ChannelMessageActionName,
OpenClawConfig, OpenClawConfig,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import { extractToolSend, jsonResult, readStringParam } from "openclaw/plugin-sdk"; import { extractToolSend, jsonResult, readStringParam } from "openclaw/plugin-sdk/compat";
import { listEnabledZaloAccounts } from "./accounts.js"; import { listEnabledZaloAccounts } from "./accounts.js";
import { sendMessageZalo } from "./send.js"; import { sendMessageZalo } from "./send.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk"; import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk/compat";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { zaloPlugin } from "./channel.js"; import { zaloPlugin } from "./channel.js";

View File

@@ -1,4 +1,4 @@
import type { ReplyPayload } from "openclaw/plugin-sdk"; import type { ReplyPayload } from "openclaw/plugin-sdk/compat";
import { beforeEach, describe, expect, it, vi } from "vitest"; import { beforeEach, describe, expect, it, vi } from "vitest";
import { zaloPlugin } from "./channel.js"; import { zaloPlugin } from "./channel.js";

View File

@@ -3,7 +3,7 @@ import type {
ChannelDock, ChannelDock,
ChannelPlugin, ChannelPlugin,
OpenClawConfig, OpenClawConfig,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import { import {
applyAccountNameToChannelSection, applyAccountNameToChannelSection,
buildChannelConfigSchema, buildChannelConfigSchema,
@@ -20,7 +20,7 @@ import {
resolveOpenProviderRuntimeGroupPolicy, resolveOpenProviderRuntimeGroupPolicy,
resolveChannelAccountConfigBasePath, resolveChannelAccountConfigBasePath,
setAccountEnabledInConfigSection, setAccountEnabledInConfigSection,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import { import {
listZaloAccountIds, listZaloAccountIds,
resolveDefaultZaloAccountId, resolveDefaultZaloAccountId,

View File

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

View File

@@ -1,9 +1,9 @@
import type { GroupPolicy, SenderGroupAccessDecision } from "openclaw/plugin-sdk"; import type { GroupPolicy, SenderGroupAccessDecision } from "openclaw/plugin-sdk/compat";
import { import {
evaluateSenderGroupAccess, evaluateSenderGroupAccess,
isNormalizedSenderAllowed, isNormalizedSenderAllowed,
resolveOpenProviderRuntimeGroupPolicy, resolveOpenProviderRuntimeGroupPolicy,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
const ZALO_ALLOW_FROM_PREFIX_RE = /^(zalo|zl):/i; const ZALO_ALLOW_FROM_PREFIX_RE = /^(zalo|zl):/i;

View File

@@ -1,5 +1,9 @@
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import type { MarkdownTableMode, OpenClawConfig, OutboundReplyPayload } from "openclaw/plugin-sdk"; import type {
MarkdownTableMode,
OpenClawConfig,
OutboundReplyPayload,
} from "openclaw/plugin-sdk/compat";
import { import {
createScopedPairingAccess, createScopedPairingAccess,
createReplyPrefixOptions, createReplyPrefixOptions,
@@ -11,7 +15,7 @@ import {
sendMediaWithLeadingCaption, sendMediaWithLeadingCaption,
resolveWebhookPath, resolveWebhookPath,
warnMissingProviderGroupPolicyFallbackOnce, warnMissingProviderGroupPolicyFallbackOnce,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import type { ResolvedZaloAccount } from "./accounts.js"; import type { ResolvedZaloAccount } from "./accounts.js";
import { import {
ZaloApiError, ZaloApiError,

View File

@@ -1,6 +1,6 @@
import { createServer, type RequestListener } from "node:http"; import { createServer, type RequestListener } from "node:http";
import type { AddressInfo } from "node:net"; import type { AddressInfo } from "node:net";
import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk"; import type { OpenClawConfig, PluginRuntime } from "openclaw/plugin-sdk/compat";
import { afterEach, describe, expect, it, vi } from "vitest"; import { afterEach, describe, expect, it, vi } 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,6 +1,6 @@
import { timingSafeEqual } from "node:crypto"; import { timingSafeEqual } from "node:crypto";
import type { IncomingMessage, ServerResponse } from "node:http"; import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { import {
createDedupeCache, createDedupeCache,
createFixedWindowRateLimiter, createFixedWindowRateLimiter,
@@ -15,7 +15,7 @@ import {
resolveWebhookTargets, resolveWebhookTargets,
WEBHOOK_ANOMALY_COUNTER_DEFAULTS, WEBHOOK_ANOMALY_COUNTER_DEFAULTS,
WEBHOOK_RATE_LIMIT_DEFAULTS, WEBHOOK_RATE_LIMIT_DEFAULTS,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import type { ResolvedZaloAccount } from "./accounts.js"; import type { ResolvedZaloAccount } from "./accounts.js";
import type { ZaloFetch, ZaloUpdate } from "./api.js"; import type { ZaloFetch, ZaloUpdate } from "./api.js";
import type { ZaloRuntimeEnv } from "./monitor.js"; import type { ZaloRuntimeEnv } from "./monitor.js";

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { describe, expect, it } from "vitest"; import { describe, expect, it } from "vitest";
import { zaloOnboardingAdapter } from "./onboarding.js"; import { zaloOnboardingAdapter } from "./onboarding.js";

View File

@@ -4,7 +4,7 @@ import type {
OpenClawConfig, OpenClawConfig,
SecretInput, SecretInput,
WizardPrompter, WizardPrompter,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import { import {
addWildcardAllowFrom, addWildcardAllowFrom,
DEFAULT_ACCOUNT_ID, DEFAULT_ACCOUNT_ID,
@@ -13,7 +13,7 @@ import {
normalizeAccountId, normalizeAccountId,
promptAccountId, promptAccountId,
promptSingleChannelSecretInput, promptSingleChannelSecretInput,
} from "openclaw/plugin-sdk"; } from "openclaw/plugin-sdk/compat";
import { listZaloAccountIds, resolveDefaultZaloAccountId, resolveZaloAccount } from "./accounts.js"; import { listZaloAccountIds, resolveDefaultZaloAccountId, resolveZaloAccount } from "./accounts.js";
const channel = "zalo" as const; const channel = "zalo" as const;

View File

@@ -1,4 +1,4 @@
import type { BaseProbeResult } from "openclaw/plugin-sdk"; import type { BaseProbeResult } from "openclaw/plugin-sdk/compat";
import { getMe, ZaloApiError, type ZaloBotInfo, type ZaloFetch } from "./api.js"; import { getMe, ZaloApiError, type ZaloBotInfo, type ZaloFetch } from "./api.js";
export type ZaloProbeResult = BaseProbeResult<string> & { export type ZaloProbeResult = BaseProbeResult<string> & {

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; let runtime: PluginRuntime | null = null;

View File

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

View File

@@ -1,4 +1,4 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk"; import type { OpenClawConfig } from "openclaw/plugin-sdk/compat";
import { resolveZaloAccount } from "./accounts.js"; import { resolveZaloAccount } from "./accounts.js";
import type { ZaloFetch } from "./api.js"; import type { ZaloFetch } from "./api.js";
import { sendMessage, sendPhoto } from "./api.js"; import { sendMessage, sendPhoto } from "./api.js";

View File

@@ -1,4 +1,4 @@
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "openclaw/plugin-sdk"; import type { ChannelAccountSnapshot, ChannelStatusIssue } from "openclaw/plugin-sdk/compat";
type ZaloAccountStatus = { type ZaloAccountStatus = {
accountId?: unknown; accountId?: unknown;

View File

@@ -1,6 +1,6 @@
import { readFileSync } from "node:fs"; import { readFileSync } from "node:fs";
import type { BaseTokenResolution } from "openclaw/plugin-sdk";
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id"; import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
import type { BaseTokenResolution } from "openclaw/plugin-sdk/compat";
import { normalizeResolvedSecretInputString, normalizeSecretInputString } from "./secret-input.js"; import { normalizeResolvedSecretInputString, normalizeSecretInputString } from "./secret-input.js";
import type { ZaloConfig } from "./types.js"; import type { ZaloConfig } from "./types.js";

View File

@@ -1,4 +1,4 @@
import type { SecretInput } from "openclaw/plugin-sdk"; import type { SecretInput } from "openclaw/plugin-sdk/compat";
export type ZaloAccountConfig = { export type ZaloAccountConfig = {
/** Optional display name for this account (used in CLI/UI lists). */ /** Optional display name for this account (used in CLI/UI lists). */