From 2b67a3f76e90c30507a99dc287d4515078bd0889 Mon Sep 17 00:00:00 2001 From: Vincent Koc Date: Tue, 17 Mar 2026 21:00:23 -0700 Subject: [PATCH] Plugins: internalize googlechat SDK imports --- extensions/googlechat/runtime-api.ts | 104 +++++++++++++++++++ extensions/googlechat/src/accounts.ts | 3 +- extensions/googlechat/src/actions.ts | 4 +- extensions/googlechat/src/api.ts | 2 +- extensions/googlechat/src/channel.ts | 8 +- extensions/googlechat/src/group-policy.ts | 2 +- extensions/googlechat/src/monitor-access.ts | 4 +- extensions/googlechat/src/monitor-types.ts | 2 +- extensions/googlechat/src/monitor-webhook.ts | 2 +- extensions/googlechat/src/monitor.ts | 4 +- extensions/googlechat/src/runtime.ts | 2 +- extensions/googlechat/src/types.config.ts | 2 +- 12 files changed, 121 insertions(+), 18 deletions(-) create mode 100644 extensions/googlechat/runtime-api.ts diff --git a/extensions/googlechat/runtime-api.ts b/extensions/googlechat/runtime-api.ts new file mode 100644 index 00000000000..92ede7f483c --- /dev/null +++ b/extensions/googlechat/runtime-api.ts @@ -0,0 +1,104 @@ +// Private runtime barrel for the bundled Google Chat extension. +// Keep this curated to the symbols used by production code under extensions/googlechat/src. + +export { + createActionGate, + jsonResult, + readNumberParam, + readReactionParams, + readStringParam, +} from "../../src/agents/tools/common.js"; +export { + createScopedAccountConfigAccessors, + createScopedChannelConfigBase, + createScopedDmSecurityResolver, +} from "../../src/plugin-sdk/channel-config-helpers.js"; +export { + buildOpenGroupPolicyConfigureRouteAllowlistWarning, + collectAllowlistProviderGroupPolicyWarnings, + resolveMentionGatingWithBypass, +} from "../../src/channels/channel-policy.js"; +export { formatNormalizedAllowFromEntries } from "../../src/channels/allow-from.js"; +export { buildComputedAccountStatusSnapshot } from "../../src/plugin-sdk/status-helpers.js"; +export { + createAccountStatusSink, + runPassiveAccountLifecycle, +} from "../../src/plugin-sdk/channel-lifecycle.js"; +export { buildChannelConfigSchema } from "../../src/channels/plugins/config-schema.js"; +export { + deleteAccountFromConfigSection, + setAccountEnabledInConfigSection, +} from "../../src/channels/plugins/config-helpers.js"; +export { + listDirectoryGroupEntriesFromMapKeys, + listDirectoryUserEntriesFromAllowFrom, +} from "../../src/channels/plugins/directory-config-helpers.js"; +export { formatPairingApproveHint } from "../../src/channels/plugins/helpers.js"; +export { resolveChannelMediaMaxBytes } from "../../src/channels/plugins/media-limits.js"; +export { + addWildcardAllowFrom, + mergeAllowFromEntries, + splitSetupEntries, + setTopLevelChannelDmPolicyWithAllowFrom, +} from "../../src/channels/plugins/setup-wizard-helpers.js"; +export { PAIRING_APPROVED_MESSAGE } from "../../src/channels/plugins/pairing-message.js"; +export { + applyAccountNameToChannelSection, + applySetupAccountConfigPatch, + migrateBaseNameToDefaultAccount, +} from "../../src/channels/plugins/setup-helpers.js"; +export { createAccountListHelpers } from "../../src/channels/plugins/account-helpers.js"; +export type { + ChannelAccountSnapshot, + ChannelMessageActionAdapter, + ChannelMessageActionName, + ChannelStatusIssue, +} from "../../src/channels/plugins/types.js"; +export type { ChannelPlugin } from "../../src/channels/plugins/types.plugin.js"; +export { getChatChannelMeta } from "../../src/channels/registry.js"; +export { createReplyPrefixOptions } from "../../src/channels/reply-prefix.js"; +export type { OpenClawConfig } from "../../src/config/config.js"; +export { isDangerousNameMatchingEnabled } from "../../src/config/dangerous-name-matching.js"; +export { + GROUP_POLICY_BLOCKED_LABEL, + resolveAllowlistProviderRuntimeGroupPolicy, + resolveDefaultGroupPolicy, + warnMissingProviderGroupPolicyFallbackOnce, +} from "../../src/config/runtime-group-policy.js"; +export type { + DmPolicy, + GoogleChatAccountConfig, + GoogleChatConfig, +} from "../../src/config/types.js"; +export { isSecretRef } from "../../src/config/types.secrets.js"; +export { GoogleChatConfigSchema } from "../../src/config/zod-schema.providers-core.js"; +export { fetchWithSsrFGuard } from "../../src/infra/net/fetch-guard.js"; +export { missingTargetError } from "../../src/infra/outbound/target-errors.js"; +export { emptyPluginConfigSchema } from "../../src/plugins/config-schema.js"; +export type { PluginRuntime } from "../../src/plugins/runtime/types.js"; +export type { OpenClawPluginApi } from "../../src/plugins/types.js"; +export { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "../../src/routing/session-key.js"; +export { resolveDmGroupAccessWithLists } from "../../src/security/dm-policy-shared.js"; +export { formatDocsLink } from "../../src/terminal/links.js"; +export type { WizardPrompter } from "../../src/wizard/prompts.js"; +export { resolveInboundRouteEnvelopeBuilderWithRuntime } from "../../src/plugin-sdk/inbound-envelope.js"; +export { createScopedPairingAccess } from "../../src/plugin-sdk/pairing-access.js"; +export { issuePairingChallenge } from "../../src/pairing/pairing-challenge.js"; +export { + evaluateGroupRouteAccessForPolicy, + resolveSenderScopedGroupPolicy, +} from "./src/group-access.js"; +export { extractToolSend } from "../../src/plugin-sdk/tool-send.js"; +export { resolveWebhookPath } from "../../src/plugin-sdk/webhook-path.js"; +export type { WebhookInFlightLimiter } from "../../src/plugin-sdk/webhook-request-guards.js"; +export { + beginWebhookRequestPipelineOrReject, + createWebhookInFlightLimiter, + readJsonWebhookBodyOrReject, +} from "../../src/plugin-sdk/webhook-request-guards.js"; +export { + registerWebhookTargetWithPluginRoute, + resolveWebhookTargets, + resolveWebhookTargetWithAuthOrReject, + withResolvedWebhookRequestPipeline, +} from "../../src/plugin-sdk/webhook-targets.js"; diff --git a/extensions/googlechat/src/accounts.ts b/extensions/googlechat/src/accounts.ts index d864eb3ff37..0e973cbe02f 100644 --- a/extensions/googlechat/src/accounts.ts +++ b/extensions/googlechat/src/accounts.ts @@ -1,6 +1,5 @@ import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id"; -import { isSecretRef } from "openclaw/plugin-sdk/googlechat"; -import { createAccountListHelpers, type OpenClawConfig } from "openclaw/plugin-sdk/googlechat"; +import { isSecretRef, createAccountListHelpers, type OpenClawConfig } from "../runtime-api.js"; import type { GoogleChatAccountConfig } from "./types.config.js"; export type GoogleChatCredentialSource = "file" | "inline" | "env" | "none"; diff --git a/extensions/googlechat/src/actions.ts b/extensions/googlechat/src/actions.ts index 463967bcd54..669de5ac925 100644 --- a/extensions/googlechat/src/actions.ts +++ b/extensions/googlechat/src/actions.ts @@ -2,7 +2,7 @@ import type { ChannelMessageActionAdapter, ChannelMessageActionName, OpenClawConfig, -} from "openclaw/plugin-sdk/googlechat"; +} from "../runtime-api.js"; import { createActionGate, extractToolSend, @@ -10,7 +10,7 @@ import { readNumberParam, readReactionParams, readStringParam, -} from "openclaw/plugin-sdk/googlechat"; +} from "../runtime-api.js"; import { listEnabledGoogleChatAccounts, resolveGoogleChatAccount } from "./accounts.js"; import { createGoogleChatReaction, diff --git a/extensions/googlechat/src/api.ts b/extensions/googlechat/src/api.ts index d9c7b666ff0..391ac844847 100644 --- a/extensions/googlechat/src/api.ts +++ b/extensions/googlechat/src/api.ts @@ -1,5 +1,5 @@ import crypto from "node:crypto"; -import { fetchWithSsrFGuard } from "openclaw/plugin-sdk/googlechat"; +import { fetchWithSsrFGuard } from "../runtime-api.js"; import type { ResolvedGoogleChatAccount } from "./accounts.js"; import { getGoogleChatAccessToken } from "./auth.js"; import type { GoogleChatReaction } from "./types.js"; diff --git a/extensions/googlechat/src/channel.ts b/extensions/googlechat/src/channel.ts index 6c401293003..b82f7635ff1 100644 --- a/extensions/googlechat/src/channel.ts +++ b/extensions/googlechat/src/channel.ts @@ -8,6 +8,8 @@ import { buildOpenGroupPolicyConfigureRouteAllowlistWarning, collectAllowlistProviderGroupPolicyWarnings, } from "openclaw/plugin-sdk/channel-policy"; +import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; +import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js"; import { buildComputedAccountStatusSnapshot, buildChannelConfigSchema, @@ -24,10 +26,8 @@ import { type ChannelPlugin, type ChannelStatusIssue, type OpenClawConfig, -} from "openclaw/plugin-sdk/googlechat"; -import { GoogleChatConfigSchema } from "openclaw/plugin-sdk/googlechat"; -import { createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime"; -import { buildPassiveProbedChannelStatusSummary } from "../../shared/channel-status-summary.js"; +} from "../runtime-api.js"; +import { GoogleChatConfigSchema } from "../runtime-api.js"; import { listGoogleChatAccountIds, resolveDefaultGoogleChatAccountId, diff --git a/extensions/googlechat/src/group-policy.ts b/extensions/googlechat/src/group-policy.ts index 3518ce6e13c..ab10399e529 100644 --- a/extensions/googlechat/src/group-policy.ts +++ b/extensions/googlechat/src/group-policy.ts @@ -1,5 +1,5 @@ import { resolveChannelGroupRequireMention } from "openclaw/plugin-sdk/channel-policy"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/googlechat"; +import type { OpenClawConfig } from "../runtime-api.js"; type GoogleChatGroupContext = { cfg: OpenClawConfig; diff --git a/extensions/googlechat/src/monitor-access.ts b/extensions/googlechat/src/monitor-access.ts index 2136b9672dc..8bc5315b635 100644 --- a/extensions/googlechat/src/monitor-access.ts +++ b/extensions/googlechat/src/monitor-access.ts @@ -10,8 +10,8 @@ import { resolveMentionGatingWithBypass, resolveSenderScopedGroupPolicy, warnMissingProviderGroupPolicyFallbackOnce, -} from "openclaw/plugin-sdk/googlechat"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/googlechat"; + type OpenClawConfig, +} from "../runtime-api.js"; import type { ResolvedGoogleChatAccount } from "./accounts.js"; import { sendGoogleChatMessage } from "./api.js"; import type { GoogleChatCoreRuntime } from "./monitor-types.js"; diff --git a/extensions/googlechat/src/monitor-types.ts b/extensions/googlechat/src/monitor-types.ts index 792eb66bccb..4cddc70ea3b 100644 --- a/extensions/googlechat/src/monitor-types.ts +++ b/extensions/googlechat/src/monitor-types.ts @@ -1,4 +1,4 @@ -import type { OpenClawConfig } from "openclaw/plugin-sdk/googlechat"; +import type { OpenClawConfig } from "../runtime-api.js"; import type { ResolvedGoogleChatAccount } from "./accounts.js"; import type { GoogleChatAudienceType } from "./auth.js"; import { getGoogleChatRuntime } from "./runtime.js"; diff --git a/extensions/googlechat/src/monitor-webhook.ts b/extensions/googlechat/src/monitor-webhook.ts index ff7bee6c59b..cdb89195dad 100644 --- a/extensions/googlechat/src/monitor-webhook.ts +++ b/extensions/googlechat/src/monitor-webhook.ts @@ -4,7 +4,7 @@ import { resolveWebhookTargetWithAuthOrReject, withResolvedWebhookRequestPipeline, type WebhookInFlightLimiter, -} from "openclaw/plugin-sdk/googlechat"; +} from "../runtime-api.js"; import { verifyGoogleChatRequest } from "./auth.js"; import type { WebhookTarget } from "./monitor-types.js"; import type { diff --git a/extensions/googlechat/src/monitor.ts b/extensions/googlechat/src/monitor.ts index ad89a9c74eb..80ba9ff3939 100644 --- a/extensions/googlechat/src/monitor.ts +++ b/extensions/googlechat/src/monitor.ts @@ -1,12 +1,12 @@ import type { IncomingMessage, ServerResponse } from "node:http"; -import type { OpenClawConfig } from "openclaw/plugin-sdk/googlechat"; +import type { OpenClawConfig } from "../runtime-api.js"; import { createWebhookInFlightLimiter, createReplyPrefixOptions, registerWebhookTargetWithPluginRoute, resolveInboundRouteEnvelopeBuilderWithRuntime, resolveWebhookPath, -} from "openclaw/plugin-sdk/googlechat"; +} from "../runtime-api.js"; import { type ResolvedGoogleChatAccount } from "./accounts.js"; import { downloadGoogleChatMedia, diff --git a/extensions/googlechat/src/runtime.ts b/extensions/googlechat/src/runtime.ts index 333a8911cbb..bd8e48e7952 100644 --- a/extensions/googlechat/src/runtime.ts +++ b/extensions/googlechat/src/runtime.ts @@ -1,5 +1,5 @@ -import type { PluginRuntime } from "openclaw/plugin-sdk/googlechat"; import { createPluginRuntimeStore } from "openclaw/plugin-sdk/runtime-store"; +import type { PluginRuntime } from "../runtime-api.js"; const { setRuntime: setGoogleChatRuntime, getRuntime: getGoogleChatRuntime } = createPluginRuntimeStore("Google Chat runtime not initialized"); diff --git a/extensions/googlechat/src/types.config.ts b/extensions/googlechat/src/types.config.ts index cbc1034ae3e..1d9d7b72e0d 100644 --- a/extensions/googlechat/src/types.config.ts +++ b/extensions/googlechat/src/types.config.ts @@ -1,3 +1,3 @@ -import type { GoogleChatAccountConfig, GoogleChatConfig } from "openclaw/plugin-sdk/googlechat"; +import type { GoogleChatAccountConfig, GoogleChatConfig } from "../runtime-api.js"; export type { GoogleChatAccountConfig, GoogleChatConfig };