mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-26 16:06:16 +00:00
refactor(plugins): move remaining channel and provider ownership out of src
This commit is contained in:
@@ -63,7 +63,7 @@ export {
|
||||
resolveServicePrefixedAllowTarget,
|
||||
resolveServicePrefixedTarget,
|
||||
} from "../../extensions/imessage/api.js";
|
||||
export { stripMarkdown } from "../line/markdown-to-line.js";
|
||||
export { stripMarkdown } from "./text-runtime.js";
|
||||
export { parseFiniteNumber } from "../infra/parse-finite-number.js";
|
||||
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
export type { PluginRuntime } from "../plugins/runtime/types.js";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Shared feedback helpers for typing indicators, ack reactions, and status reactions.
|
||||
export {
|
||||
removeAckReactionAfterReply,
|
||||
shouldAckReaction,
|
||||
@@ -8,6 +7,7 @@ export {
|
||||
type WhatsAppAckReactionMode,
|
||||
} from "../channels/ack-reactions.js";
|
||||
export { logAckFailure, logTypingFailure, type LogFn } from "../channels/logging.js";
|
||||
export { missingTargetError } from "../infra/outbound/target-errors.js";
|
||||
export {
|
||||
CODING_TOOL_TOKENS,
|
||||
createStatusReactionController,
|
||||
|
||||
@@ -10,7 +10,11 @@ export * from "../channels/plugins/normalize/whatsapp.js";
|
||||
export * from "../channels/plugins/outbound/interactive.js";
|
||||
export * from "../channels/plugins/whatsapp-heartbeat.js";
|
||||
export * from "../polls.js";
|
||||
export * from "../whatsapp/normalize.js";
|
||||
export {
|
||||
isWhatsAppGroupJid,
|
||||
isWhatsAppUserTarget,
|
||||
normalizeWhatsAppTarget,
|
||||
} from "../../extensions/whatsapp/src/normalize-target.js";
|
||||
export {
|
||||
createAccountStatusSink,
|
||||
keepHttpServerTaskAlive,
|
||||
|
||||
@@ -3,4 +3,5 @@
|
||||
export * from "../cli/command-format.js";
|
||||
export * from "../cli/parse-duration.js";
|
||||
export * from "../cli/wait.js";
|
||||
export { stylePromptTitle } from "../terminal/prompt-style.js";
|
||||
export * from "../version.js";
|
||||
|
||||
@@ -7,6 +7,8 @@ export {
|
||||
readConfigFileSnapshotForWrite,
|
||||
writeConfigFile,
|
||||
} from "../config/io.js";
|
||||
export { logConfigUpdated } from "../config/logging.js";
|
||||
export { updateConfig } from "../commands/models/shared.js";
|
||||
export { resolveMarkdownTableMode } from "../config/markdown-tables.js";
|
||||
export {
|
||||
resolveChannelGroupPolicy,
|
||||
|
||||
@@ -87,6 +87,7 @@ export {
|
||||
unregisterSessionBindingAdapter,
|
||||
} from "../infra/outbound/session-binding-service.js";
|
||||
export * from "../pairing/pairing-challenge.js";
|
||||
export { resolvePairingIdLabel } from "../pairing/pairing-labels.js";
|
||||
export * from "../pairing/pairing-messages.js";
|
||||
export * from "../pairing/pairing-store.js";
|
||||
export {
|
||||
@@ -106,3 +107,4 @@ export {
|
||||
resolvePluginConversationBindingApproval,
|
||||
toPluginConversationBinding,
|
||||
} from "../plugins/conversation-binding.js";
|
||||
export { resolvePinnedMainDmOwnerFromAllowlist } from "../security/dm-policy-shared.js";
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
export type { OpenClawConfig } from "../config/config.js";
|
||||
export type { LineChannelData, LineConfig } from "../line/types.js";
|
||||
export type { LineChannelData, LineConfig } from "../../extensions/line/api.js";
|
||||
export {
|
||||
createTopLevelChannelDmPolicy,
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
@@ -14,10 +14,10 @@ export {
|
||||
normalizeAccountId,
|
||||
resolveDefaultLineAccountId,
|
||||
resolveLineAccount,
|
||||
} from "../line/accounts.js";
|
||||
export { resolveExactLineGroupConfigKey } from "../line/group-keys.js";
|
||||
export type { ResolvedLineAccount } from "../line/types.js";
|
||||
export { LineConfigSchema } from "../line/config-schema.js";
|
||||
} from "../../extensions/line/api.js";
|
||||
export { resolveExactLineGroupConfigKey } from "../../extensions/line/api.js";
|
||||
export type { ResolvedLineAccount } from "../../extensions/line/api.js";
|
||||
export { LineConfigSchema } from "../../extensions/line/api.js";
|
||||
export {
|
||||
createActionCard,
|
||||
createImageCard,
|
||||
@@ -26,5 +26,5 @@ export {
|
||||
createReceiptCard,
|
||||
type CardAction,
|
||||
type ListItem,
|
||||
} from "../line/flex-templates.js";
|
||||
export { processLineMessage } from "../line/markdown-to-line.js";
|
||||
} from "../../extensions/line/api.js";
|
||||
export { processLineMessage } from "../../extensions/line/api.js";
|
||||
|
||||
9
src/plugin-sdk/line-runtime.ts
Normal file
9
src/plugin-sdk/line-runtime.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
// Private runtime surface for the bundled LINE plugin. Keep runtime ownership
|
||||
// in the plugin package.
|
||||
|
||||
export * from "../../extensions/line/src/bot-access.js";
|
||||
export * from "../../extensions/line/src/bot-handlers.js";
|
||||
export * from "../../extensions/line/src/bot-message-context.js";
|
||||
export * from "../../extensions/line/src/bot.js";
|
||||
export * from "../../extensions/line/src/download.js";
|
||||
export * from "../../extensions/line/src/monitor.js";
|
||||
@@ -31,16 +31,22 @@ export {
|
||||
normalizeAccountId,
|
||||
resolveDefaultLineAccountId,
|
||||
resolveLineAccount,
|
||||
} from "../line/accounts.js";
|
||||
export { LineConfigSchema } from "../line/config-schema.js";
|
||||
export type { LineChannelData, LineConfig, ResolvedLineAccount } from "../line/types.js";
|
||||
} from "../../extensions/line/api.js";
|
||||
export { LineConfigSchema } from "../../extensions/line/api.js";
|
||||
export type { LineChannelData, LineConfig, ResolvedLineAccount } from "../../extensions/line/api.js";
|
||||
export type { LineProbeResult } from "../../extensions/line/api.js";
|
||||
export {
|
||||
createActionCard,
|
||||
createAgendaCard,
|
||||
createAppleTvRemoteCard,
|
||||
createDeviceControlCard,
|
||||
createEventCard,
|
||||
createImageCard,
|
||||
createInfoCard,
|
||||
createListCard,
|
||||
createMediaPlayerCard,
|
||||
createReceiptCard,
|
||||
type CardAction,
|
||||
type ListItem,
|
||||
} from "../line/flex-templates.js";
|
||||
export { processLineMessage } from "../line/markdown-to-line.js";
|
||||
} from "../../extensions/line/api.js";
|
||||
export { processLineMessage } from "../../extensions/line/api.js";
|
||||
|
||||
@@ -18,7 +18,7 @@ export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js
|
||||
export * from "./agent-media-payload.js";
|
||||
export * from "../media-understanding/audio-preflight.ts";
|
||||
export * from "../media-understanding/defaults.js";
|
||||
export * from "../media-understanding/providers/image-runtime.ts";
|
||||
export * from "../media-understanding/image-runtime.ts";
|
||||
export * from "../media-understanding/runner.js";
|
||||
export * from "../polls.js";
|
||||
export {
|
||||
|
||||
@@ -16,12 +16,12 @@ export type {
|
||||
export {
|
||||
describeImageWithModel,
|
||||
describeImagesWithModel,
|
||||
} from "../media-understanding/providers/image-runtime.js";
|
||||
export { transcribeOpenAiCompatibleAudio } from "../media-understanding/providers/openai-compatible-audio.js";
|
||||
} from "../media-understanding/image-runtime.js";
|
||||
export { transcribeOpenAiCompatibleAudio } from "../media-understanding/openai-compatible-audio.js";
|
||||
export {
|
||||
assertOkOrThrowHttpError,
|
||||
normalizeBaseUrl,
|
||||
postJsonRequest,
|
||||
postTranscriptionRequest,
|
||||
requireTranscriptionText,
|
||||
} from "../media-understanding/providers/shared.js";
|
||||
} from "../media-understanding/shared.js";
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
export { loginChutes } from "../commands/chutes-oauth.js";
|
||||
export { loginOpenAICodexOAuth } from "../plugins/provider-openai-codex-oauth.js";
|
||||
export { githubCopilotLoginCommand } from "../providers/github-copilot-auth.js";
|
||||
export { githubCopilotLoginCommand } from "../../extensions/github-copilot/login.js";
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
// Curated auth + onboarding helpers for provider plugins.
|
||||
// Keep this surface focused on reusable provider-owned login flows.
|
||||
// Public auth/onboarding helpers for provider plugins.
|
||||
|
||||
export type { OpenClawConfig } from "../config/config.js";
|
||||
export type { SecretInput } from "../config/types.secrets.js";
|
||||
@@ -16,6 +15,7 @@ export {
|
||||
resolveOAuthApiKeyMarker,
|
||||
resolveNonEnvSecretRefApiKeyMarker,
|
||||
} from "../agents/model-auth-markers.js";
|
||||
export { requireApiKey, resolveApiKeyForProvider } from "../agents/model-auth.js";
|
||||
export {
|
||||
formatApiKeyPreview,
|
||||
normalizeApiKeyInput,
|
||||
|
||||
@@ -7,7 +7,7 @@ import {
|
||||
KILOCODE_DEFAULT_MAX_TOKENS,
|
||||
KILOCODE_DEFAULT_MODEL_ID,
|
||||
KILOCODE_DEFAULT_MODEL_NAME,
|
||||
} from "../providers/kilocode-shared.js";
|
||||
} from "../../extensions/kilocode/shared.js";
|
||||
|
||||
export type { ModelApi, ModelProviderConfig } from "../config/types.models.js";
|
||||
export type { ModelDefinitionConfig } from "../config/types.models.js";
|
||||
@@ -35,7 +35,11 @@ export {
|
||||
applyOpenAIConfig,
|
||||
OPENAI_CODEX_DEFAULT_MODEL,
|
||||
OPENAI_DEFAULT_AUDIO_TRANSCRIPTION_MODEL,
|
||||
OPENAI_DEFAULT_EMBEDDING_MODEL,
|
||||
OPENAI_DEFAULT_IMAGE_MODEL,
|
||||
OPENAI_DEFAULT_MODEL,
|
||||
OPENAI_DEFAULT_TTS_MODEL,
|
||||
OPENAI_DEFAULT_TTS_VOICE,
|
||||
} from "../plugins/provider-model-defaults.js";
|
||||
export { OPENCODE_GO_DEFAULT_MODEL_REF } from "../plugins/provider-model-defaults.js";
|
||||
export { OPENCODE_ZEN_DEFAULT_MODEL } from "../plugins/provider-model-defaults.js";
|
||||
@@ -107,7 +111,7 @@ export {
|
||||
KILOCODE_DEFAULT_MODEL_ID,
|
||||
KILOCODE_DEFAULT_MODEL_NAME,
|
||||
KILOCODE_MODEL_CATALOG,
|
||||
} from "../providers/kilocode-shared.js";
|
||||
} from "../../extensions/kilocode/shared.js";
|
||||
export {
|
||||
discoverVercelAiGatewayModels,
|
||||
VERCEL_AI_GATEWAY_BASE_URL,
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
// off direct src/auto-reply imports by routing common reply primitives here.
|
||||
|
||||
export {
|
||||
chunkMarkdownText,
|
||||
chunkMarkdownTextWithMode,
|
||||
chunkText,
|
||||
chunkTextWithMode,
|
||||
|
||||
@@ -3,5 +3,7 @@
|
||||
export { buildElevenLabsSpeechProvider } from "../../extensions/elevenlabs/speech-provider.js";
|
||||
export { buildMicrosoftSpeechProvider } from "../../extensions/microsoft/speech-provider.js";
|
||||
export { buildOpenAISpeechProvider } from "../../extensions/openai/speech-provider.js";
|
||||
export { edgeTTS, elevenLabsTTS, inferEdgeExtension, openaiTTS } from "../tts/tts-core.js";
|
||||
export { OPENAI_TTS_MODELS, OPENAI_TTS_VOICES } from "../tts/tts-core.js";
|
||||
export { parseTtsDirectives } from "../tts/tts-core.js";
|
||||
export type { SpeechVoiceOption } from "../tts/provider-types.js";
|
||||
|
||||
@@ -19,7 +19,7 @@ describe("buildRandomTempFilePath", () => {
|
||||
it("sanitizes prefix and extension to avoid path traversal segments", () => {
|
||||
const tmpRoot = path.resolve(resolvePreferredOpenClawTmpDir());
|
||||
const result = buildRandomTempFilePath({
|
||||
prefix: "../../line/../media",
|
||||
prefix: "../../channels/../media",
|
||||
extension: "/../.jpg",
|
||||
now: 123,
|
||||
uuid: "abc",
|
||||
@@ -54,7 +54,7 @@ describe("withTempDownloadPath", () => {
|
||||
let capturedPath = "";
|
||||
await withTempDownloadPath(
|
||||
{
|
||||
prefix: "../../line/../media",
|
||||
prefix: "../../channels/../media",
|
||||
fileName: "../../evil.bin",
|
||||
},
|
||||
async (tmpPath) => {
|
||||
|
||||
@@ -10,13 +10,13 @@ export * from "../markdown/render.js";
|
||||
export * from "../markdown/tables.js";
|
||||
export * from "../markdown/whatsapp.js";
|
||||
export * from "../shared/global-singleton.js";
|
||||
export * from "../shared/scoped-expiring-id-cache.js";
|
||||
export * from "../shared/string-normalization.js";
|
||||
export * from "../shared/string-sample.js";
|
||||
export * from "../shared/text/assistant-visible-text.js";
|
||||
export * from "../shared/text/auto-linked-file-ref.js";
|
||||
export * from "../shared/text/code-regions.js";
|
||||
export * from "../shared/text/reasoning-tags.js";
|
||||
export * from "../shared/text/strip-markdown.js";
|
||||
export * from "../terminal/safe-text.js";
|
||||
export * from "../utils.js";
|
||||
export * from "../utils/chunk-items.js";
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
// Curated webhook helpers for plugin-owned HTTP ingress and webhook targets.
|
||||
export {
|
||||
createBoundedCounter,
|
||||
createFixedWindowRateLimiter,
|
||||
@@ -41,3 +40,4 @@ export {
|
||||
type WebhookTargetMatchResult,
|
||||
} from "./webhook-targets.js";
|
||||
export { normalizeWebhookPath, resolveWebhookPath } from "./webhook-path.js";
|
||||
export { normalizePluginHttpPath } from "../plugins/http-path.js";
|
||||
|
||||
@@ -23,5 +23,5 @@ export {
|
||||
readStringParam,
|
||||
} from "../agents/tools/common.js";
|
||||
export { WhatsAppConfigSchema } from "../config/zod-schema.providers-whatsapp.js";
|
||||
export { resolveWhatsAppOutboundTarget } from "../whatsapp/resolve-outbound-target.js";
|
||||
export { resolveWhatsAppOutboundTarget } from "../../extensions/whatsapp/src/resolve-outbound-target.js";
|
||||
export { normalizeE164 } from "../utils.js";
|
||||
|
||||
@@ -11,4 +11,8 @@ export {
|
||||
normalizeWhatsAppMessagingTarget,
|
||||
} from "../channels/plugins/normalize/whatsapp.js";
|
||||
export { resolveWhatsAppHeartbeatRecipients } from "../channels/plugins/whatsapp-heartbeat.js";
|
||||
export { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "../whatsapp/normalize.js";
|
||||
export {
|
||||
isWhatsAppGroupJid,
|
||||
isWhatsAppUserTarget,
|
||||
normalizeWhatsAppTarget,
|
||||
} from "../../extensions/whatsapp/src/normalize-target.js";
|
||||
|
||||
@@ -39,8 +39,12 @@ export {
|
||||
collectOpenGroupPolicyRouteAllowlistWarnings,
|
||||
} from "../channels/plugins/group-policy-warnings.js";
|
||||
export { buildAccountScopedDmSecurityPolicy } from "../channels/plugins/helpers.js";
|
||||
export { resolveWhatsAppOutboundTarget } from "../whatsapp/resolve-outbound-target.js";
|
||||
export { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "../whatsapp/normalize.js";
|
||||
export { resolveWhatsAppOutboundTarget } from "../../extensions/whatsapp/src/resolve-outbound-target.js";
|
||||
export {
|
||||
isWhatsAppGroupJid,
|
||||
isWhatsAppUserTarget,
|
||||
normalizeWhatsAppTarget,
|
||||
} from "../../extensions/whatsapp/src/normalize-target.js";
|
||||
|
||||
export {
|
||||
resolveAllowlistProviderRuntimeGroupPolicy,
|
||||
|
||||
Reference in New Issue
Block a user