From 614a294afa4af9b3972ac54053608ac0468652a3 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Sat, 2 May 2026 05:02:51 +0100 Subject: [PATCH] refactor: trim contract helper exports --- .../duckduckgo/src/ddg-search-provider.shared.ts | 4 +++- src/channels/plugins/contracts/inbound-testkit.ts | 12 ------------ .../test-helpers/bundled-channel-plugin-loader.ts | 7 ------- .../plugins/contracts/test-helpers/manifest.ts | 2 -- src/memory-host-sdk/host/test-helpers/ssrf.ts | 15 --------------- 5 files changed, 3 insertions(+), 37 deletions(-) delete mode 100644 src/memory-host-sdk/host/test-helpers/ssrf.ts diff --git a/extensions/duckduckgo/src/ddg-search-provider.shared.ts b/extensions/duckduckgo/src/ddg-search-provider.shared.ts index 4f252c88f83..573ec718cba 100644 --- a/extensions/duckduckgo/src/ddg-search-provider.shared.ts +++ b/extensions/duckduckgo/src/ddg-search-provider.shared.ts @@ -1,11 +1,13 @@ import { createWebSearchProviderContractFields } from "openclaw/plugin-sdk/provider-web-search-contract"; +const DUCKDUCKGO_ONBOARDING_SCOPES: Array<"text-inference"> = ["text-inference"]; + export function createDuckDuckGoWebSearchProviderBase() { return { id: "duckduckgo", label: "DuckDuckGo Search (experimental)", hint: "Free web search fallback with no API key required", - onboardingScopes: ["text-inference"] as const, + onboardingScopes: [...DUCKDUCKGO_ONBOARDING_SCOPES], requiresCredential: false, envVars: [], placeholder: "(no key needed)", diff --git a/src/channels/plugins/contracts/inbound-testkit.ts b/src/channels/plugins/contracts/inbound-testkit.ts index f99dcd2868d..1f33d074e2d 100644 --- a/src/channels/plugins/contracts/inbound-testkit.ts +++ b/src/channels/plugins/contracts/inbound-testkit.ts @@ -25,15 +25,3 @@ export function buildDispatchInboundCaptureMock>() => Promise, - capture: InboundContextCapture, -) { - const actual = await loadActual(); - return buildDispatchInboundCaptureMock(actual, (ctx) => { - capture.ctx = ctx as MsgContext; - }); -} - -export const inboundCtxCapture = createInboundContextCapture(); diff --git a/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts b/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts index 108f00d1ba6..99b0284c5a5 100644 --- a/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts +++ b/src/channels/plugins/contracts/test-helpers/bundled-channel-plugin-loader.ts @@ -66,10 +66,3 @@ export async function getBundledChannelPluginAsync( channelPluginPromiseCache.set(id, loading); return (await loading) ?? undefined; } - -export function listBundledChannelPlugins(): readonly ChannelPlugin[] { - return listBundledChannelPluginIds().flatMap((id) => { - const plugin = getBundledChannelPlugin(id); - return plugin ? [plugin] : []; - }); -} diff --git a/src/channels/plugins/contracts/test-helpers/manifest.ts b/src/channels/plugins/contracts/test-helpers/manifest.ts index 239324bc847..d0f6e9566f1 100644 --- a/src/channels/plugins/contracts/test-helpers/manifest.ts +++ b/src/channels/plugins/contracts/test-helpers/manifest.ts @@ -9,8 +9,6 @@ export const channelPluginSurfaceKeys = [ "gateway", ] as const; -export type ChannelPluginSurface = (typeof channelPluginSurfaceKeys)[number]; - export const sessionBindingContractChannelIds = [ "bluebubbles", "discord", diff --git a/src/memory-host-sdk/host/test-helpers/ssrf.ts b/src/memory-host-sdk/host/test-helpers/ssrf.ts deleted file mode 100644 index 9fc6bd90a7c..00000000000 --- a/src/memory-host-sdk/host/test-helpers/ssrf.ts +++ /dev/null @@ -1,15 +0,0 @@ -import { vi } from "vitest"; -import * as ssrf from "../../../infra/net/ssrf.js"; -import { normalizeLowercaseStringOrEmpty } from "../../../shared/string-coerce.js"; - -export function mockPublicPinnedHostname() { - return vi.spyOn(ssrf, "resolvePinnedHostnameWithPolicy").mockImplementation(async (hostname) => { - const normalized = normalizeLowercaseStringOrEmpty(hostname).replace(/\.$/, ""); - const addresses = ["93.184.216.34"]; - return { - hostname: normalized, - addresses, - lookup: ssrf.createPinnedLookup({ hostname: normalized, addresses }), - }; - }); -}