From e816235c2d49e7d95e80698af5d27bceac8cf5b4 Mon Sep 17 00:00:00 2001 From: Peter Steinberger Date: Fri, 1 May 2026 08:18:47 +0100 Subject: [PATCH] refactor: narrow dead reexports --- extensions/msteams/src/attachments.ts | 8 +----- .../src/engine/gateway/inbound-attachments.ts | 6 ++-- src/agents/pi-embedded-runner.ts | 12 +------- src/agents/pi-embedded-runtime.types.ts | 8 ------ src/agents/pi-embedded-subscribe.ts | 6 +--- .../subagent-announce-delivery.runtime.ts | 1 - src/agents/subagent-announce.runtime.ts | 7 +---- src/agents/subagent-spawn.runtime.ts | 4 --- src/auto-reply/thinking.shared.ts | 28 ------------------- src/config/commands.ts | 2 +- src/hooks/hooks.ts | 11 ++------ src/infra/exec-safe-bin-policy.ts | 1 - src/infra/exec-wrapper-resolution.ts | 1 - src/media-understanding/attachments.ts | 2 -- src/plugins/runtime/types-core.ts | 8 ++++-- 15 files changed, 15 insertions(+), 90 deletions(-) delete mode 100644 src/agents/pi-embedded-runtime.types.ts diff --git a/extensions/msteams/src/attachments.ts b/extensions/msteams/src/attachments.ts index bf678545e7a..880102ac2c6 100644 --- a/extensions/msteams/src/attachments.ts +++ b/extensions/msteams/src/attachments.ts @@ -1,13 +1,8 @@ export { - downloadMSTeamsBotFrameworkAttachment, downloadMSTeamsBotFrameworkAttachments, isBotFrameworkPersonalChatId, } from "./attachments/bot-framework.js"; -export { - downloadMSTeamsAttachments, - /** @deprecated Use `downloadMSTeamsAttachments` instead. */ - downloadMSTeamsImageAttachments, -} from "./attachments/download.js"; +export { downloadMSTeamsAttachments } from "./attachments/download.js"; export { buildMSTeamsGraphMessageUrls, downloadMSTeamsGraphMedia } from "./attachments/graph.js"; export { buildMSTeamsAttachmentPlaceholder, @@ -18,7 +13,6 @@ export { buildMSTeamsMediaPayload } from "./attachments/payload.js"; export type { MSTeamsAccessTokenProvider, MSTeamsAttachmentLike, - MSTeamsGraphMediaResult, MSTeamsHtmlAttachmentSummary, MSTeamsInboundMedia, } from "./attachments/types.js"; diff --git a/extensions/qqbot/src/engine/gateway/inbound-attachments.ts b/extensions/qqbot/src/engine/gateway/inbound-attachments.ts index d93c4a9584d..0a6ee8dc39e 100644 --- a/extensions/qqbot/src/engine/gateway/inbound-attachments.ts +++ b/extensions/qqbot/src/engine/gateway/inbound-attachments.ts @@ -3,13 +3,11 @@ import { downloadFile } from "../utils/file-utils.js"; import { getQQBotMediaDir } from "../utils/platform.js"; import { normalizeOptionalString } from "../utils/string-normalize.js"; import { transcribeAudio, resolveSTTConfig } from "../utils/stt.js"; -// Re-export formatVoiceText from core/. -export { formatVoiceText } from "../utils/voice-text.js"; // Re-export the port type for convenience. export type { AudioConvertPort } from "../adapter/audio.port.js"; -export interface RawAttachment { +interface RawAttachment { content_type: string; url: string; filename?: string; @@ -17,7 +15,7 @@ export interface RawAttachment { asr_refer_text?: string; } -export type TranscriptSource = "stt" | "asr" | "fallback"; +type TranscriptSource = "stt" | "asr" | "fallback"; /** Normalized attachment output consumed by the gateway. */ export interface ProcessedAttachments { diff --git a/src/agents/pi-embedded-runner.ts b/src/agents/pi-embedded-runner.ts index efd1c0cce95..7f861a9b855 100644 --- a/src/agents/pi-embedded-runner.ts +++ b/src/agents/pi-embedded-runner.ts @@ -2,18 +2,8 @@ export { compactEmbeddedPiSession, compactEmbeddedPiSession as compactEmbeddedAgentSession, } from "./pi-embedded-runner/compact.queued.js"; -export { - applyExtraParamsToAgent, - resolveAgentTransportOverride, - resolveExtraParams, - resolvePreparedExtraParams, -} from "./pi-embedded-runner/extra-params.js"; +export { applyExtraParamsToAgent } from "./pi-embedded-runner/extra-params.js"; -export { - getDmHistoryLimitFromSessionKey, - getHistoryLimitFromSessionKey, - limitHistoryTurns, -} from "./pi-embedded-runner/history.js"; export { resolveEmbeddedSessionLane } from "./pi-embedded-runner/lanes.js"; export { runEmbeddedPiAgent, diff --git a/src/agents/pi-embedded-runtime.types.ts b/src/agents/pi-embedded-runtime.types.ts deleted file mode 100644 index ad5b92184d0..00000000000 --- a/src/agents/pi-embedded-runtime.types.ts +++ /dev/null @@ -1,8 +0,0 @@ -import type { RunEmbeddedPiAgentParams } from "./pi-embedded-runner/run/params.js"; -import type { EmbeddedPiRunResult } from "./pi-embedded-runner/types.js"; - -export type RunEmbeddedPiAgentFn = ( - params: RunEmbeddedPiAgentParams, -) => Promise; - -export type RunEmbeddedAgentFn = RunEmbeddedPiAgentFn; diff --git a/src/agents/pi-embedded-subscribe.ts b/src/agents/pi-embedded-subscribe.ts index a7ce827f36a..6b7833227c0 100644 --- a/src/agents/pi-embedded-subscribe.ts +++ b/src/agents/pi-embedded-subscribe.ts @@ -111,11 +111,7 @@ function collectPendingMediaFromInternalEvents( return pending; } -export type { - BlockReplyChunking, - SubscribeEmbeddedPiSessionParams, - ToolResultFormat, -} from "./pi-embedded-subscribe.types.js"; +export type { SubscribeEmbeddedPiSessionParams } from "./pi-embedded-subscribe.types.js"; export function subscribeEmbeddedPiSession(params: SubscribeEmbeddedPiSessionParams) { const reasoningMode = params.reasoningMode ?? "off"; diff --git a/src/agents/subagent-announce-delivery.runtime.ts b/src/agents/subagent-announce-delivery.runtime.ts index 34f09f979fd..582a03c0e8c 100644 --- a/src/agents/subagent-announce-delivery.runtime.ts +++ b/src/agents/subagent-announce-delivery.runtime.ts @@ -2,7 +2,6 @@ export { getRuntimeConfig } from "../config/config.js"; export { loadSessionStore, resolveAgentIdFromSessionKey, - resolveMainSessionKey, resolveStorePath, } from "../config/sessions.js"; export { callGateway } from "../gateway/call.js"; diff --git a/src/agents/subagent-announce.runtime.ts b/src/agents/subagent-announce.runtime.ts index bd9eadb1108..31f2aafc329 100644 --- a/src/agents/subagent-announce.runtime.ts +++ b/src/agents/subagent-announce.runtime.ts @@ -2,12 +2,7 @@ export { getRuntimeConfig } from "../config/config.js"; export { loadSessionStore, resolveAgentIdFromSessionKey, - resolveMainSessionKey, resolveStorePath, } from "../config/sessions.js"; export { callGateway } from "../gateway/call.js"; -export { - isEmbeddedPiRunActive, - queueEmbeddedPiMessage, - waitForEmbeddedPiRunEnd, -} from "./pi-embedded-runner/runs.js"; +export { isEmbeddedPiRunActive, waitForEmbeddedPiRunEnd } from "./pi-embedded-runner/runs.js"; diff --git a/src/agents/subagent-spawn.runtime.ts b/src/agents/subagent-spawn.runtime.ts index 91b0f89ce33..8f6b584e223 100644 --- a/src/agents/subagent-spawn.runtime.ts +++ b/src/agents/subagent-spawn.runtime.ts @@ -1,4 +1,3 @@ -export { formatThinkingLevels, normalizeThinkLevel } from "../auto-reply/thinking.js"; export { DEFAULT_SUBAGENT_MAX_CHILDREN_PER_AGENT, DEFAULT_SUBAGENT_MAX_SPAWN_DEPTH, @@ -22,11 +21,8 @@ export { mergeDeliveryContext, normalizeDeliveryContext, } from "../utils/delivery-context.shared.js"; -export { resolveConversationDeliveryTarget } from "../utils/delivery-context.js"; -export { getSessionBindingService } from "../infra/outbound/session-binding-service.js"; export { resolveAgentConfig } from "./agent-scope.js"; export { AGENT_LANE_SUBAGENT } from "./lanes.js"; -export { resolveSubagentSpawnModelSelection } from "./model-selection.js"; export { resolveSandboxRuntimeStatus } from "./sandbox/runtime-status.js"; export { buildSubagentSystemPrompt } from "./subagent-system-prompt.js"; export { diff --git a/src/auto-reply/thinking.shared.ts b/src/auto-reply/thinking.shared.ts index 932a8910073..989057de0ef 100644 --- a/src/auto-reply/thinking.shared.ts +++ b/src/auto-reply/thinking.shared.ts @@ -42,12 +42,6 @@ export const THINKING_LEVEL_RANKS: Record = { xhigh: 60, max: 70, }; -const NO_THINKING_LEVELS: ThinkLevel[] = [...BASE_THINKING_LEVELS]; - -export function isBinaryThinkingProvider(provider?: string | null): boolean { - void provider; - return false; -} // Normalize user-provided thinking level strings to the canonical enum. export function normalizeThinkLevel(raw?: string | null): ThinkLevel | undefined { @@ -89,28 +83,6 @@ export function normalizeThinkLevel(raw?: string | null): ThinkLevel | undefined return undefined; } -export function listThinkingLevels( - _provider?: string | null, - _model?: string | null, -): ThinkLevel[] { - return [...NO_THINKING_LEVELS]; -} - -export function listThinkingLevelLabels(provider?: string | null, model?: string | null): string[] { - if (isBinaryThinkingProvider(provider)) { - return ["off", "on"]; - } - return listThinkingLevels(provider, model); -} - -export function formatThinkingLevels( - provider?: string | null, - model?: string | null, - separator = ", ", -): string { - return listThinkingLevelLabels(provider, model).join(separator); -} - export function formatXHighModelHint(): string { return "provider models that advertise xhigh reasoning"; } diff --git a/src/config/commands.ts b/src/config/commands.ts index 68818077386..b2926c8da2d 100644 --- a/src/config/commands.ts +++ b/src/config/commands.ts @@ -4,7 +4,7 @@ import type { ChannelId } from "../channels/plugins/types.public.js"; import { normalizeOptionalLowercaseString } from "../shared/string-coerce.js"; import type { NativeCommandsSetting } from "./types.js"; import type { OpenClawConfig } from "./types.openclaw.js"; -export { isCommandFlagEnabled, isRestartEnabled, type CommandFlagKey } from "./commands.flags.js"; +export { isCommandFlagEnabled, isRestartEnabled } from "./commands.flags.js"; function resolveAutoDefault( providerId: ChannelId | undefined, diff --git a/src/hooks/hooks.ts b/src/hooks/hooks.ts index 422cc22d75c..7996fc32266 100644 --- a/src/hooks/hooks.ts +++ b/src/hooks/hooks.ts @@ -1,14 +1,7 @@ -export * from "./internal-hooks.js"; - -export type HookEventType = import("./internal-hooks.js").InternalHookEventType; -export type HookEvent = import("./internal-hooks.js").InternalHookEvent; export type HookHandler = import("./internal-hook-types.js").InternalHookHandler; +export type { AgentBootstrapHookContext } from "./internal-hooks.js"; export { - registerInternalHook as registerHook, - unregisterInternalHook as unregisterHook, - clearInternalHooks as clearHooks, - getRegisteredEventKeys as getRegisteredHookEventKeys, - triggerInternalHook as triggerHook, createInternalHookEvent as createHookEvent, + isAgentBootstrapEvent, } from "./internal-hooks.js"; diff --git a/src/infra/exec-safe-bin-policy.ts b/src/infra/exec-safe-bin-policy.ts index 09f06e0b038..1ca9456a7a9 100644 --- a/src/infra/exec-safe-bin-policy.ts +++ b/src/infra/exec-safe-bin-policy.ts @@ -7,7 +7,6 @@ export { normalizeSafeBinProfileFixtures, renderDefaultSafeBinsDocText, renderSafeBinDeniedFlagsDocBullets, - resolveSafeBinDeniedFlags, resolveSafeBinProfiles, type SafeBinProfile, type SafeBinProfileFixture, diff --git a/src/infra/exec-wrapper-resolution.ts b/src/infra/exec-wrapper-resolution.ts index ad1f3bc9a73..91ca1e3a4c9 100644 --- a/src/infra/exec-wrapper-resolution.ts +++ b/src/infra/exec-wrapper-resolution.ts @@ -18,4 +18,3 @@ export { resolveShellWrapperTransportArgv, unwrapKnownShellMultiplexerInvocation, } from "./shell-wrapper-resolution.js"; -export { resolveExecWrapperTrustPlan } from "./exec-wrapper-trust-plan.js"; diff --git a/src/media-understanding/attachments.ts b/src/media-understanding/attachments.ts index 4b19da17515..3d4264448ee 100644 --- a/src/media-understanding/attachments.ts +++ b/src/media-understanding/attachments.ts @@ -1,7 +1,5 @@ export { isAudioAttachment, - isImageAttachment, - isVideoAttachment, normalizeAttachments, resolveAttachmentKind, } from "./attachments.normalize.js"; diff --git a/src/plugins/runtime/types-core.ts b/src/plugins/runtime/types-core.ts index 051d6a830ad..2d76d7bed7b 100644 --- a/src/plugins/runtime/types-core.ts +++ b/src/plugins/runtime/types-core.ts @@ -77,6 +77,10 @@ export type RunHeartbeatOnceOptions = { heartbeat?: { target?: string }; }; +type RuntimeRunEmbeddedPiAgent = ( + params: import("../../agents/pi-embedded-runner/run/params.js").RunEmbeddedPiAgentParams, +) => Promise; + /** Core runtime helpers exposed to trusted native plugins. */ export type PluginRuntimeCore = { version: string; @@ -135,8 +139,8 @@ export type PluginRuntimeCore = { resolveThinkingPolicy: ( params: PluginRuntimeThinkingPolicyRequest, ) => PluginRuntimeThinkingPolicy; - runEmbeddedAgent: import("../../agents/pi-embedded-runtime.types.js").RunEmbeddedAgentFn; - runEmbeddedPiAgent: import("../../agents/pi-embedded-runtime.types.js").RunEmbeddedPiAgentFn; + runEmbeddedAgent: RuntimeRunEmbeddedPiAgent; + runEmbeddedPiAgent: RuntimeRunEmbeddedPiAgent; resolveAgentTimeoutMs: typeof import("../../agents/timeout.js").resolveAgentTimeoutMs; ensureAgentWorkspace: typeof import("../../agents/workspace.js").ensureAgentWorkspace; session: {