Plugins: internalize zalo SDK imports

This commit is contained in:
Vincent Koc 2026-03-17 21:40:10 -07:00
parent 2ef28a7a3e
commit 645c5bda2c
17 changed files with 31 additions and 26 deletions

View File

@ -0,0 +1 @@
export * from "openclaw/plugin-sdk/zalo";

View File

@ -1,6 +1,6 @@
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
import { createAccountListHelpers, type OpenClawConfig } from "openclaw/plugin-sdk/zalo";
import { resolveZaloToken } from "./token.js";
import { createAccountListHelpers, type OpenClawConfig } from "./runtime-api.js";
import type { ResolvedZaloAccount, ZaloAccountConfig, ZaloConfig } from "./types.js";
export type { ResolvedZaloAccount };

View File

@ -3,8 +3,8 @@ import type {
ChannelMessageActionAdapter,
ChannelMessageActionName,
OpenClawConfig,
} from "openclaw/plugin-sdk/zalo";
import { extractToolSend, jsonResult, readStringParam } from "openclaw/plugin-sdk/zalo";
} from "./runtime-api.js";
import { extractToolSend, jsonResult, readStringParam } from "./runtime-api.js";
import { listEnabledZaloAccounts } from "./accounts.js";
const loadZaloActionsRuntime = createLazyRuntimeNamedExport(

View File

@ -1,12 +1,16 @@
import { createAccountStatusSink } from "openclaw/plugin-sdk/channel-lifecycle";
import { PAIRING_APPROVED_MESSAGE } from "openclaw/plugin-sdk/zalo";
import { probeZalo } from "./probe.js";
import { resolveZaloProxyFetch } from "./proxy.js";
import { normalizeSecretInputString } from "./secret-input.js";
import { sendMessageZalo } from "./send.js";
import {
PAIRING_APPROVED_MESSAGE,
type ChannelPlugin,
type OpenClawConfig,
} from "./runtime-api.js";
export async function notifyZaloPairingApproval(params: {
cfg: import("openclaw/plugin-sdk/zalo").OpenClawConfig;
cfg: OpenClawConfig;
id: string;
}) {
const { resolveZaloAccount } = await import("./accounts.js");
@ -42,7 +46,7 @@ export async function probeZaloAccount(params: {
export async function startZaloGatewayAccount(
ctx: Parameters<
NonNullable<
NonNullable<import("openclaw/plugin-sdk/zalo").ChannelPlugin["gateway"]>["startAccount"]
NonNullable<ChannelPlugin["gateway"]>["startAccount"]
>
>[0],
) {

View File

@ -9,11 +9,6 @@ import {
collectOpenProviderGroupPolicyWarnings,
} from "openclaw/plugin-sdk/channel-policy";
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
import type {
ChannelAccountSnapshot,
ChannelPlugin,
OpenClawConfig,
} from "openclaw/plugin-sdk/zalo";
import {
buildBaseAccountStatusSnapshot,
buildChannelConfigSchema,
@ -25,7 +20,10 @@ import {
listDirectoryUserEntriesFromAllowFrom,
isNumericTargetId,
sendPayloadWithChunkedTextAndMedia,
} from "openclaw/plugin-sdk/zalo";
type ChannelAccountSnapshot,
type ChannelPlugin,
type OpenClawConfig,
} from "./runtime-api.js";
import {
listZaloAccountIds,
resolveDefaultZaloAccountId,

View File

@ -4,9 +4,9 @@ import {
DmPolicySchema,
GroupPolicySchema,
} from "openclaw/plugin-sdk/channel-config-schema";
import { MarkdownConfigSchema } from "openclaw/plugin-sdk/zalo";
import { z } from "zod";
import { buildSecretInputSchema } from "./secret-input.js";
import { MarkdownConfigSchema } from "./runtime-api.js";
const zaloAccountSchema = z.object({
name: z.string().optional(),

View File

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

View File

@ -3,7 +3,7 @@ import type {
MarkdownTableMode,
OpenClawConfig,
OutboundReplyPayload,
} from "openclaw/plugin-sdk/zalo";
} from "./runtime-api.js";
import {
createTypingCallbacks,
createScopedPairingAccess,
@ -19,7 +19,7 @@ import {
resolveWebhookPath,
waitForAbortSignal,
warnMissingProviderGroupPolicyFallbackOnce,
} from "openclaw/plugin-sdk/zalo";
} from "./runtime-api.js";
import type { ResolvedZaloAccount } from "./accounts.js";
import {
ZaloApiError,

View File

@ -1,6 +1,5 @@
import { timingSafeEqual } from "node:crypto";
import type { IncomingMessage, ServerResponse } from "node:http";
import type { OpenClawConfig } from "openclaw/plugin-sdk/zalo";
import {
createDedupeCache,
createFixedWindowRateLimiter,
@ -16,7 +15,8 @@ import {
WEBHOOK_ANOMALY_COUNTER_DEFAULTS,
WEBHOOK_RATE_LIMIT_DEFAULTS,
resolveClientIp,
} from "openclaw/plugin-sdk/zalo";
type OpenClawConfig,
} from "./runtime-api.js";
import type { ResolvedZaloAccount } from "./accounts.js";
import type { ZaloFetch, ZaloUpdate } from "./api.js";
import type { ZaloRuntimeEnv } from "./monitor.js";

View File

@ -1,5 +1,5 @@
import type { BaseProbeResult } from "openclaw/plugin-sdk/zalo";
import { getMe, ZaloApiError, type ZaloBotInfo, type ZaloFetch } from "./api.js";
import type { BaseProbeResult } from "./runtime-api.js";
export type ZaloProbeResult = BaseProbeResult<string> & {
bot?: ZaloBotInfo;

View File

@ -0,0 +1 @@
export * from "../runtime-api.js";

View File

@ -1,5 +1,5 @@
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store";
import type { PluginRuntime } from "openclaw/plugin-sdk/zalo";
import type { PluginRuntime } from "./runtime-api.js";
const { setRuntime: setZaloRuntime, getRuntime: getZaloRuntime } =
createPluginRuntimeStore<PluginRuntime>("Zalo runtime not initialized");

View File

@ -3,7 +3,7 @@ import {
hasConfiguredSecretInput,
normalizeResolvedSecretInputString,
normalizeSecretInputString,
} from "openclaw/plugin-sdk/zalo";
} from "./runtime-api.js";
export {
buildSecretInputSchema,

View File

@ -1,9 +1,9 @@
import type { OpenClawConfig } from "openclaw/plugin-sdk/zalo";
import { resolveZaloAccount } from "./accounts.js";
import type { ZaloFetch } from "./api.js";
import { sendMessage, sendPhoto } from "./api.js";
import { resolveZaloProxyFetch } from "./proxy.js";
import { resolveZaloToken } from "./token.js";
import type { OpenClawConfig } from "./runtime-api.js";
export type ZaloSendOptions = {
token?: string;

View File

@ -1,5 +1,5 @@
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "openclaw/plugin-sdk/zalo";
import { coerceStatusIssueAccountId, readStatusIssueFields } from "../../shared/status-issues.js";
import type { ChannelAccountSnapshot, ChannelStatusIssue } from "./runtime-api.js";
const ZALO_STATUS_FIELDS = ["accountId", "enabled", "configured", "dmPolicy"] as const;

View File

@ -1,8 +1,8 @@
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
import { tryReadSecretFileSync } from "openclaw/plugin-sdk/infra-runtime";
import type { BaseTokenResolution } from "openclaw/plugin-sdk/zalo";
import { normalizeResolvedSecretInputString, normalizeSecretInputString } from "./secret-input.js";
import type { ZaloConfig } from "./types.js";
import type { BaseTokenResolution } from "./runtime-api.js";
export type ZaloTokenResolution = BaseTokenResolution & {
source: "env" | "config" | "configFile" | "none";

View File

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