mirror of
https://github.com/moltbot/moltbot.git
synced 2026-04-24 07:01:49 +00:00
refactor: finalize plugin sdk legacy boundary cleanup
This commit is contained in:
7
src/plugin-sdk/channel-config-schema.ts
Normal file
7
src/plugin-sdk/channel-config-schema.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/** Shared config-schema primitives for channel plugins with DM/group policy knobs. */
|
||||
export {
|
||||
AllowFromListSchema,
|
||||
buildCatchallMultiAccountChannelSchema,
|
||||
buildNestedDmConfigSchema,
|
||||
} from "../channels/plugins/config-schema.js";
|
||||
export { DmPolicySchema, GroupPolicySchema } from "../config/zod-schema.core.js";
|
||||
19
src/plugin-sdk/channel-policy.ts
Normal file
19
src/plugin-sdk/channel-policy.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
/** Shared policy warnings and DM/group policy helpers for channel plugins. */
|
||||
export {
|
||||
buildOpenGroupPolicyConfigureRouteAllowlistWarning,
|
||||
buildOpenGroupPolicyRestrictSendersWarning,
|
||||
buildOpenGroupPolicyWarning,
|
||||
collectAllowlistProviderGroupPolicyWarnings,
|
||||
collectAllowlistProviderRestrictSendersWarnings,
|
||||
collectOpenGroupPolicyRestrictSendersWarnings,
|
||||
collectOpenGroupPolicyRouteAllowlistWarnings,
|
||||
collectOpenProviderGroupPolicyWarnings,
|
||||
} from "../channels/plugins/group-policy-warnings.js";
|
||||
export { buildAccountScopedDmSecurityPolicy } from "../channels/plugins/helpers.js";
|
||||
export { resolveChannelGroupRequireMention } from "../config/group-policy.js";
|
||||
export {
|
||||
DM_GROUP_ACCESS_REASON,
|
||||
readStoreAllowFromForDmPolicy,
|
||||
resolveDmGroupAccessWithLists,
|
||||
resolveEffectiveAllowFromLists,
|
||||
} from "../security/dm-policy-shared.js";
|
||||
@@ -42,6 +42,7 @@ export * from "../channels/plugins/status-issues/shared.js";
|
||||
export * from "../channels/plugins/whatsapp-heartbeat.js";
|
||||
export * from "../infra/outbound/send-deps.js";
|
||||
export * from "../utils/message-channel.js";
|
||||
export * from "./channel-lifecycle.js";
|
||||
export type {
|
||||
InteractiveButtonStyle,
|
||||
InteractiveReplyButton,
|
||||
|
||||
@@ -1 +1,28 @@
|
||||
export * from "./index.js";
|
||||
// Legacy compat surface for external plugins that still depend on older
|
||||
// broad plugin-sdk imports. Keep this file intentionally small.
|
||||
|
||||
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
export { resolveControlCommandGate } from "../channels/command-gating.js";
|
||||
|
||||
export { createAccountStatusSink } from "./channel-lifecycle.js";
|
||||
export { createPluginRuntimeStore } from "./runtime-store.js";
|
||||
export { KeyedAsyncQueue } from "./keyed-async-queue.js";
|
||||
|
||||
export {
|
||||
createScopedAccountConfigAccessors,
|
||||
createScopedChannelConfigBase,
|
||||
createScopedDmSecurityResolver,
|
||||
mapAllowFromEntries,
|
||||
} from "./channel-config-helpers.js";
|
||||
export { formatAllowFromLowercase, formatNormalizedAllowFromEntries } from "./allow-from.js";
|
||||
export * from "./channel-config-schema.js";
|
||||
export * from "./channel-policy.js";
|
||||
export * from "./reply-history.js";
|
||||
export * from "./directory-runtime.js";
|
||||
export { mapAllowlistResolutionInputs } from "./allowlist-resolution.js";
|
||||
|
||||
export {
|
||||
resolveBlueBubblesGroupRequireMention,
|
||||
resolveBlueBubblesGroupToolPolicy,
|
||||
} from "../channels/plugins/group-mentions.js";
|
||||
export { collectBlueBubblesStatusIssues } from "../channels/plugins/status-issues/bluebubbles.js";
|
||||
|
||||
@@ -39,36 +39,9 @@ export type {
|
||||
UsageProviderId,
|
||||
UsageWindow,
|
||||
} from "../infra/provider-usage.types.js";
|
||||
export type {
|
||||
ChannelMessageActionContext,
|
||||
ChannelPlugin,
|
||||
OpenClawPluginApi,
|
||||
PluginRuntime,
|
||||
} from "./channel-plugin-common.js";
|
||||
export type { ChannelMessageActionContext } from "../channels/plugins/types.js";
|
||||
export type { ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
export type { OpenClawPluginApi } from "../plugins/types.js";
|
||||
export type { PluginRuntime } from "../plugins/runtime/types.js";
|
||||
|
||||
export { emptyPluginConfigSchema } from "./channel-plugin-common.js";
|
||||
export { buildOauthProviderAuthResult } from "./provider-auth-result.js";
|
||||
export {
|
||||
DEFAULT_SECRET_FILE_MAX_BYTES,
|
||||
loadSecretFileSync,
|
||||
readSecretFileSync,
|
||||
tryReadSecretFileSync,
|
||||
} from "../infra/secret-file.js";
|
||||
export type { SecretFileReadOptions, SecretFileReadResult } from "../infra/secret-file.js";
|
||||
|
||||
export { resolveGatewayBindUrl } from "../shared/gateway-bind-url.js";
|
||||
export type { GatewayBindUrlResult } from "../shared/gateway-bind-url.js";
|
||||
|
||||
export { resolveTailnetHostWithRunner } from "../shared/tailscale-status.js";
|
||||
export type {
|
||||
TailscaleStatusCommandResult,
|
||||
TailscaleStatusCommandRunner,
|
||||
} from "../shared/tailscale-status.js";
|
||||
export {
|
||||
buildAgentSessionKey,
|
||||
type RoutePeer,
|
||||
type RoutePeerKind,
|
||||
} from "../routing/resolve-route.js";
|
||||
export { resolveThreadSessionKeys } from "../routing/session-key.js";
|
||||
export { runPassiveAccountLifecycle } from "./channel-lifecycle.js";
|
||||
export { createLoggerBackedRuntime } from "./runtime.js";
|
||||
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
|
||||
9
src/plugin-sdk/directory-runtime.ts
Normal file
9
src/plugin-sdk/directory-runtime.ts
Normal file
@@ -0,0 +1,9 @@
|
||||
/** Shared directory listing helpers for plugins that derive users/groups from config maps. */
|
||||
export {
|
||||
applyDirectoryQueryAndLimit,
|
||||
listDirectoryGroupEntriesFromMapKeys,
|
||||
listDirectoryGroupEntriesFromMapKeysAndAllowFrom,
|
||||
listDirectoryUserEntriesFromAllowFrom,
|
||||
listDirectoryUserEntriesFromAllowFromAndMapKeys,
|
||||
toDirectoryEntries,
|
||||
} from "../channels/plugins/directory-config-helpers.js";
|
||||
@@ -58,62 +58,11 @@ describe("plugin-sdk exports", () => {
|
||||
}
|
||||
});
|
||||
|
||||
// Verify critical functions that extensions depend on are exported and callable.
|
||||
// Regression guard for #27569 where isDangerousNameMatchingEnabled was missing
|
||||
// from the compiled output, breaking mattermost/googlechat/msteams/irc plugins.
|
||||
it("exports critical functions used by channel extensions", () => {
|
||||
const requiredFunctions = [
|
||||
"isDangerousNameMatchingEnabled",
|
||||
"createAccountListHelpers",
|
||||
"buildAgentMediaPayload",
|
||||
"createReplyPrefixOptions",
|
||||
"createTypingCallbacks",
|
||||
"logInboundDrop",
|
||||
"logTypingFailure",
|
||||
"buildPendingHistoryContextFromMap",
|
||||
"clearHistoryEntriesIfEnabled",
|
||||
"recordPendingHistoryEntryIfEnabled",
|
||||
"resolveControlCommandGate",
|
||||
"resolveDmGroupAccessWithLists",
|
||||
"resolveAllowlistProviderRuntimeGroupPolicy",
|
||||
"resolveDefaultGroupPolicy",
|
||||
"resolveChannelMediaMaxBytes",
|
||||
"warnMissingProviderGroupPolicyFallbackOnce",
|
||||
"createDedupeCache",
|
||||
"formatInboundFromLabel",
|
||||
"resolveRuntimeGroupPolicy",
|
||||
"emptyPluginConfigSchema",
|
||||
"normalizePluginHttpPath",
|
||||
"registerPluginHttpRoute",
|
||||
"buildBaseAccountStatusSnapshot",
|
||||
"buildBaseChannelStatusSummary",
|
||||
"buildTokenChannelStatusSummary",
|
||||
"collectStatusIssuesFromLastError",
|
||||
"createDefaultChannelRuntimeState",
|
||||
"resolveChannelEntryMatch",
|
||||
"resolveChannelEntryMatchWithFallback",
|
||||
"normalizeChannelSlug",
|
||||
"buildChannelKeyCandidates",
|
||||
];
|
||||
|
||||
for (const key of requiredFunctions) {
|
||||
expect(sdk).toHaveProperty(key);
|
||||
expect(typeof (sdk as Record<string, unknown>)[key]).toBe("function");
|
||||
}
|
||||
});
|
||||
|
||||
// Verify critical constants that extensions depend on are exported.
|
||||
it("exports critical constants used by channel extensions", () => {
|
||||
const requiredConstants = [
|
||||
"DEFAULT_GROUP_HISTORY_LIMIT",
|
||||
"DEFAULT_ACCOUNT_ID",
|
||||
"SILENT_REPLY_TOKEN",
|
||||
"PAIRING_APPROVED_MESSAGE",
|
||||
];
|
||||
|
||||
for (const key of requiredConstants) {
|
||||
expect(sdk).toHaveProperty(key);
|
||||
}
|
||||
it("keeps the root runtime surface intentionally small", () => {
|
||||
expect(typeof sdk.emptyPluginConfigSchema).toBe("function");
|
||||
expect(Object.prototype.hasOwnProperty.call(sdk, "resolveControlCommandGate")).toBe(false);
|
||||
expect(Object.prototype.hasOwnProperty.call(sdk, "buildAgentSessionKey")).toBe(false);
|
||||
expect(Object.prototype.hasOwnProperty.call(sdk, "isDangerousNameMatchingEnabled")).toBe(false);
|
||||
});
|
||||
|
||||
it("emits importable bundled subpath entries", { timeout: 240_000 }, async () => {
|
||||
|
||||
@@ -1,829 +1,49 @@
|
||||
export { createAccountListHelpers } from "../channels/plugins/account-helpers.js";
|
||||
export { createAccountActionGate } from "../channels/plugins/account-action-gate.js";
|
||||
export { CHANNEL_MESSAGE_ACTION_NAMES } from "../channels/plugins/message-action-names.js";
|
||||
export {
|
||||
BLUEBUBBLES_ACTIONS,
|
||||
BLUEBUBBLES_ACTION_NAMES,
|
||||
BLUEBUBBLES_GROUP_ACTIONS,
|
||||
} from "../channels/plugins/bluebubbles-actions.js";
|
||||
// Shared root plugin-sdk surface.
|
||||
// Keep this entry intentionally tiny. Channel/provider helpers belong on
|
||||
// dedicated subpaths or, for legacy consumers, the compat surface.
|
||||
|
||||
export type {
|
||||
ChannelAccountSnapshot,
|
||||
ChannelAccountState,
|
||||
ChannelAgentTool,
|
||||
ChannelAgentToolFactory,
|
||||
ChannelAuthAdapter,
|
||||
ChannelCapabilities,
|
||||
ChannelCommandAdapter,
|
||||
ChannelConfigAdapter,
|
||||
ChannelDirectoryAdapter,
|
||||
ChannelDirectoryEntry,
|
||||
ChannelDirectoryEntryKind,
|
||||
ChannelElevatedAdapter,
|
||||
ChannelGatewayAdapter,
|
||||
ChannelGatewayContext,
|
||||
ChannelGroupAdapter,
|
||||
ChannelGroupContext,
|
||||
ChannelHeartbeatAdapter,
|
||||
ChannelHeartbeatDeps,
|
||||
ChannelId,
|
||||
ChannelLogSink,
|
||||
ChannelLoginWithQrStartResult,
|
||||
ChannelLoginWithQrWaitResult,
|
||||
ChannelLogoutContext,
|
||||
ChannelLogoutResult,
|
||||
ChannelMentionAdapter,
|
||||
ChannelMessageActionAdapter,
|
||||
ChannelMessageActionContext,
|
||||
ChannelMessageActionName,
|
||||
ChannelMessagingAdapter,
|
||||
ChannelMeta,
|
||||
ChannelOutboundAdapter,
|
||||
ChannelOutboundContext,
|
||||
ChannelOutboundTargetMode,
|
||||
ChannelPairingAdapter,
|
||||
ChannelPollContext,
|
||||
ChannelPollResult,
|
||||
ChannelResolveKind,
|
||||
ChannelResolveResult,
|
||||
ChannelResolverAdapter,
|
||||
ChannelSecurityAdapter,
|
||||
ChannelSecurityContext,
|
||||
ChannelSecurityDmPolicy,
|
||||
ChannelSetupAdapter,
|
||||
ChannelSetupInput,
|
||||
ChannelStatusAdapter,
|
||||
ChannelStatusIssue,
|
||||
ChannelStreamingAdapter,
|
||||
ChannelThreadingAdapter,
|
||||
ChannelThreadingContext,
|
||||
ChannelThreadingToolContext,
|
||||
ChannelToolSend,
|
||||
BaseProbeResult,
|
||||
BaseTokenResolution,
|
||||
} from "../channels/plugins/types.js";
|
||||
export type { ChannelConfigSchema, ChannelPlugin } from "../channels/plugins/types.plugin.js";
|
||||
export type {
|
||||
ChannelSetupConfigureContext,
|
||||
ChannelSetupDmPolicy,
|
||||
ChannelSetupInteractiveContext,
|
||||
ChannelSetupPlugin,
|
||||
ChannelSetupResult,
|
||||
ChannelSetupStatus,
|
||||
ChannelSetupStatusContext,
|
||||
ChannelSetupWizardAdapter,
|
||||
} from "../channels/plugins/setup-wizard-types.js";
|
||||
export type { ChannelSetupAdapter, ChannelSetupInput } from "../channels/plugins/types.js";
|
||||
export type {
|
||||
ChannelSetupWizard,
|
||||
ChannelSetupWizardAllowFromEntry,
|
||||
ChannelSetupWizardCredential,
|
||||
ChannelSetupWizardCredentialState,
|
||||
ChannelSetupWizardFinalize,
|
||||
ChannelSetupWizardGroupAccess,
|
||||
ChannelSetupWizardPrepare,
|
||||
ChannelSetupWizardStatus,
|
||||
ChannelSetupWizardTextInput,
|
||||
} from "../channels/plugins/setup-wizard.js";
|
||||
export type {
|
||||
AcpRuntimeCapabilities,
|
||||
AcpRuntimeControl,
|
||||
AcpRuntimeDoctorReport,
|
||||
AcpRuntime,
|
||||
AcpRuntimeEnsureInput,
|
||||
AcpRuntimeEvent,
|
||||
AcpRuntimeHandle,
|
||||
AcpRuntimePromptMode,
|
||||
AcpSessionUpdateTag,
|
||||
AcpRuntimeSessionMode,
|
||||
AcpRuntimeStatus,
|
||||
AcpRuntimeTurnInput,
|
||||
} from "../acp/runtime/types.js";
|
||||
export type { AcpRuntimeBackend } from "../acp/runtime/registry.js";
|
||||
export {
|
||||
getAcpRuntimeBackend,
|
||||
registerAcpRuntimeBackend,
|
||||
requireAcpRuntimeBackend,
|
||||
unregisterAcpRuntimeBackend,
|
||||
} from "../acp/runtime/registry.js";
|
||||
export { ACP_ERROR_CODES, AcpRuntimeError } from "../acp/runtime/errors.js";
|
||||
export type { AcpRuntimeErrorCode } from "../acp/runtime/errors.js";
|
||||
export type {
|
||||
AnyAgentTool,
|
||||
MediaUnderstandingProviderPlugin,
|
||||
OpenClawPluginConfigSchema,
|
||||
OpenClawPluginApi,
|
||||
OpenClawPluginService,
|
||||
OpenClawPluginServiceContext,
|
||||
PluginHookInboundClaimContext,
|
||||
PluginHookInboundClaimEvent,
|
||||
PluginHookInboundClaimResult,
|
||||
PluginInteractiveDiscordHandlerContext,
|
||||
PluginInteractiveHandlerRegistration,
|
||||
PluginInteractiveSlackHandlerContext,
|
||||
PluginInteractiveTelegramHandlerContext,
|
||||
OpenClawPluginConfigSchema,
|
||||
PluginLogger,
|
||||
ProviderAuthContext,
|
||||
ProviderAuthDoctorHintContext,
|
||||
ProviderAuthResult,
|
||||
ProviderAugmentModelCatalogContext,
|
||||
ProviderBuiltInModelSuppressionContext,
|
||||
ProviderBuiltInModelSuppressionResult,
|
||||
ProviderBuildMissingAuthMessageContext,
|
||||
ProviderCacheTtlEligibilityContext,
|
||||
ProviderDefaultThinkingPolicyContext,
|
||||
ProviderFetchUsageSnapshotContext,
|
||||
ProviderModernModelPolicyContext,
|
||||
ProviderPreparedRuntimeAuth,
|
||||
ProviderResolvedUsageAuth,
|
||||
ProviderPrepareExtraParamsContext,
|
||||
ProviderPrepareDynamicModelContext,
|
||||
ProviderPrepareRuntimeAuthContext,
|
||||
ProviderResolveUsageAuthContext,
|
||||
ProviderResolveDynamicModelContext,
|
||||
ProviderNormalizeResolvedModelContext,
|
||||
ProviderRuntimeModel,
|
||||
SpeechProviderPlugin,
|
||||
ProviderThinkingPolicyContext,
|
||||
ProviderWrapStreamFnContext,
|
||||
} from "../plugins/types.js";
|
||||
export type {
|
||||
ProviderUsageSnapshot,
|
||||
UsageProviderId,
|
||||
UsageWindow,
|
||||
} from "../infra/provider-usage.types.js";
|
||||
export type {
|
||||
ConversationRef,
|
||||
SessionBindingBindInput,
|
||||
SessionBindingCapabilities,
|
||||
SessionBindingRecord,
|
||||
SessionBindingService,
|
||||
SessionBindingUnbindInput,
|
||||
} from "../infra/outbound/session-binding-service.js";
|
||||
export type {
|
||||
GatewayRequestHandler,
|
||||
GatewayRequestHandlerOptions,
|
||||
RespondFn,
|
||||
} from "../gateway/server-methods/types.js";
|
||||
export type {
|
||||
PluginRuntime,
|
||||
RuntimeLogger,
|
||||
SubagentRunParams,
|
||||
SubagentRunResult,
|
||||
SubagentWaitParams,
|
||||
SubagentWaitResult,
|
||||
SubagentGetSessionMessagesParams,
|
||||
SubagentGetSessionMessagesResult,
|
||||
SubagentGetSessionParams,
|
||||
SubagentGetSessionResult,
|
||||
SubagentDeleteSessionParams,
|
||||
} from "../plugins/runtime/types.js";
|
||||
export { normalizePluginHttpPath } from "../plugins/http-path.js";
|
||||
export { registerPluginHttpRoute } from "../plugins/http-registry.js";
|
||||
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
export type { OpenClawConfig } from "../config/config.js";
|
||||
/** @deprecated Use OpenClawConfig instead */
|
||||
export type { OpenClawConfig as ClawdbotConfig } from "../config/config.js";
|
||||
export { isDangerousNameMatchingEnabled } from "../config/dangerous-name-matching.js";
|
||||
export * from "./speech.js";
|
||||
|
||||
export type { FileLockHandle, FileLockOptions } from "./file-lock.js";
|
||||
export { acquireFileLock, withFileLock } from "./file-lock.js";
|
||||
export * from "./media-understanding.js";
|
||||
export {
|
||||
mapAllowlistResolutionInputs,
|
||||
mapBasicAllowlistResolutionEntries,
|
||||
type BasicAllowlistResolutionEntry,
|
||||
} from "./allowlist-resolution.js";
|
||||
export * from "./provider-web-search.js";
|
||||
export { resolveRequestUrl } from "./request-url.js";
|
||||
export {
|
||||
buildDiscordSendMediaOptions,
|
||||
buildDiscordSendOptions,
|
||||
tagDiscordChannelResult,
|
||||
} from "./discord-send.js";
|
||||
export type { KeyedAsyncQueueHooks } from "./keyed-async-queue.js";
|
||||
export { enqueueKeyedTask, KeyedAsyncQueue } from "./keyed-async-queue.js";
|
||||
export { normalizeWebhookPath, resolveWebhookPath } from "./webhook-path.js";
|
||||
export {
|
||||
registerWebhookTarget,
|
||||
registerWebhookTargetWithPluginRoute,
|
||||
rejectNonPostWebhookRequest,
|
||||
resolveWebhookTargetWithAuthOrReject,
|
||||
resolveWebhookTargetWithAuthOrRejectSync,
|
||||
resolveSingleWebhookTarget,
|
||||
resolveSingleWebhookTargetAsync,
|
||||
resolveWebhookTargets,
|
||||
withResolvedWebhookRequestPipeline,
|
||||
} from "./webhook-targets.js";
|
||||
export type {
|
||||
RegisterWebhookPluginRouteOptions,
|
||||
RegisterWebhookTargetOptions,
|
||||
WebhookTargetMatchResult,
|
||||
} from "./webhook-targets.js";
|
||||
export {
|
||||
applyBasicWebhookRequestGuards,
|
||||
beginWebhookRequestPipelineOrReject,
|
||||
createWebhookInFlightLimiter,
|
||||
isJsonContentType,
|
||||
readWebhookBodyOrReject,
|
||||
readJsonWebhookBodyOrReject,
|
||||
WEBHOOK_BODY_READ_DEFAULTS,
|
||||
WEBHOOK_IN_FLIGHT_DEFAULTS,
|
||||
} from "./webhook-request-guards.js";
|
||||
export type { WebhookBodyReadProfile, WebhookInFlightLimiter } from "./webhook-request-guards.js";
|
||||
export {
|
||||
createAccountStatusSink,
|
||||
keepHttpServerTaskAlive,
|
||||
runPassiveAccountLifecycle,
|
||||
waitUntilAbort,
|
||||
} from "./channel-lifecycle.js";
|
||||
export type { AgentMediaPayload } from "./agent-media-payload.js";
|
||||
export { buildAgentMediaPayload } from "./agent-media-payload.js";
|
||||
export {
|
||||
buildBaseAccountStatusSnapshot,
|
||||
buildBaseChannelStatusSummary,
|
||||
buildComputedAccountStatusSnapshot,
|
||||
buildProbeChannelStatusSummary,
|
||||
buildRuntimeAccountStatusSnapshot,
|
||||
buildTokenChannelStatusSummary,
|
||||
collectStatusIssuesFromLastError,
|
||||
createDefaultChannelRuntimeState,
|
||||
} from "./status-helpers.js";
|
||||
export {
|
||||
normalizeAllowFromEntries,
|
||||
noteChannelLookupFailure,
|
||||
noteChannelLookupSummary,
|
||||
parseMentionOrPrefixedId,
|
||||
parseSetupEntriesAllowingWildcard,
|
||||
patchChannelConfigForAccount,
|
||||
promptLegacyChannelAllowFrom,
|
||||
promptParsedAllowFromForScopedChannel,
|
||||
promptResolvedAllowFrom,
|
||||
resolveSetupAccountId,
|
||||
setAccountGroupPolicyForChannel,
|
||||
setChannelDmPolicyWithAllowFrom,
|
||||
setLegacyChannelDmPolicyWithAllowFrom,
|
||||
setSetupChannelEnabled,
|
||||
splitSetupEntries,
|
||||
promptSingleChannelSecretInput,
|
||||
type SingleChannelSecretInputPromptResult,
|
||||
} from "../channels/plugins/setup-wizard-helpers.js";
|
||||
export { buildOauthProviderAuthResult } from "./provider-auth-result.js";
|
||||
export { formatResolvedUnresolvedNote } from "./resolution-notes.js";
|
||||
export { buildChannelSendResult } from "./channel-send-result.js";
|
||||
export type { ChannelSendRawResult } from "./channel-send-result.js";
|
||||
export { createPluginRuntimeStore } from "./runtime-store.js";
|
||||
export { createScopedChannelConfigBase } from "./channel-config-helpers.js";
|
||||
export {
|
||||
buildAccountScopedAllowlistConfigEditor,
|
||||
resolveLegacyDmAllowlistConfigPaths,
|
||||
} from "./allowlist-config-edit.js";
|
||||
export {
|
||||
AllowFromEntrySchema,
|
||||
AllowFromListSchema,
|
||||
buildNestedDmConfigSchema,
|
||||
buildCatchallMultiAccountChannelSchema,
|
||||
} from "../channels/plugins/config-schema.js";
|
||||
export { getChatChannelMeta } from "../channels/registry.js";
|
||||
export {
|
||||
compileAllowlist,
|
||||
resolveAllowlistCandidates,
|
||||
resolveAllowlistMatchByCandidates,
|
||||
} from "../channels/allowlist-match.js";
|
||||
export type {
|
||||
BlockStreamingCoalesceConfig,
|
||||
DmPolicy,
|
||||
DmConfig,
|
||||
GroupPolicy,
|
||||
GroupToolPolicyConfig,
|
||||
GroupToolPolicyBySenderConfig,
|
||||
MarkdownConfig,
|
||||
MarkdownTableMode,
|
||||
GoogleChatAccountConfig,
|
||||
GoogleChatConfig,
|
||||
GoogleChatDmConfig,
|
||||
GoogleChatGroupConfig,
|
||||
GoogleChatActionConfig,
|
||||
MSTeamsChannelConfig,
|
||||
MSTeamsConfig,
|
||||
MSTeamsReplyStyle,
|
||||
MSTeamsTeamConfig,
|
||||
} from "../config/types.js";
|
||||
export {
|
||||
GROUP_POLICY_BLOCKED_LABEL,
|
||||
resetMissingProviderGroupPolicyFallbackWarningsForTesting,
|
||||
resolveAllowlistProviderRuntimeGroupPolicy,
|
||||
resolveDefaultGroupPolicy,
|
||||
resolveOpenProviderRuntimeGroupPolicy,
|
||||
resolveRuntimeGroupPolicy,
|
||||
type GroupPolicyDefaultsConfig,
|
||||
type RuntimeGroupPolicyResolution,
|
||||
type RuntimeGroupPolicyParams,
|
||||
type ResolveProviderRuntimeGroupPolicyParams,
|
||||
warnMissingProviderGroupPolicyFallbackOnce,
|
||||
} from "../config/runtime-group-policy.js";
|
||||
export {
|
||||
DiscordConfigSchema,
|
||||
GoogleChatConfigSchema,
|
||||
IMessageConfigSchema,
|
||||
MSTeamsConfigSchema,
|
||||
SignalConfigSchema,
|
||||
SlackConfigSchema,
|
||||
TelegramConfigSchema,
|
||||
} from "../config/zod-schema.providers-core.js";
|
||||
export { WhatsAppConfigSchema } from "../config/zod-schema.providers-whatsapp.js";
|
||||
export {
|
||||
BlockStreamingCoalesceSchema,
|
||||
DmConfigSchema,
|
||||
DmPolicySchema,
|
||||
GroupPolicySchema,
|
||||
MarkdownConfigSchema,
|
||||
MarkdownTableModeSchema,
|
||||
normalizeAllowFrom,
|
||||
ReplyRuntimeConfigSchemaShape,
|
||||
requireOpenAllowFrom,
|
||||
SecretInputSchema,
|
||||
TtsAutoSchema,
|
||||
TtsConfigSchema,
|
||||
TtsModeSchema,
|
||||
TtsProviderSchema,
|
||||
} from "../config/zod-schema.core.js";
|
||||
export {
|
||||
assertSecretInputResolved,
|
||||
hasConfiguredSecretInput,
|
||||
isSecretRef,
|
||||
normalizeResolvedSecretInputString,
|
||||
normalizeSecretInputString,
|
||||
} from "../config/types.secrets.js";
|
||||
export type { SecretInput, SecretRef } from "../config/types.secrets.js";
|
||||
export { ToolPolicySchema } from "../config/zod-schema.agent-runtime.js";
|
||||
export type { RuntimeEnv } from "../runtime.js";
|
||||
export type { WizardPrompter } from "../wizard/prompts.js";
|
||||
export {
|
||||
DEFAULT_ACCOUNT_ID,
|
||||
normalizeAccountId,
|
||||
normalizeAgentId,
|
||||
resolveThreadSessionKeys,
|
||||
} from "../routing/session-key.js";
|
||||
export { buildAgentSessionKey, type RoutePeer } from "../routing/resolve-route.js";
|
||||
export {
|
||||
formatAllowFromLowercase,
|
||||
formatNormalizedAllowFromEntries,
|
||||
isAllowedParsedChatSender,
|
||||
isNormalizedSenderAllowed,
|
||||
} from "./allow-from.js";
|
||||
export {
|
||||
evaluateGroupRouteAccessForPolicy,
|
||||
evaluateMatchedGroupAccessForPolicy,
|
||||
evaluateSenderGroupAccess,
|
||||
evaluateSenderGroupAccessForPolicy,
|
||||
resolveSenderScopedGroupPolicy,
|
||||
type GroupRouteAccessDecision,
|
||||
type GroupRouteAccessReason,
|
||||
type MatchedGroupAccessDecision,
|
||||
type MatchedGroupAccessReason,
|
||||
type SenderGroupAccessDecision,
|
||||
type SenderGroupAccessReason,
|
||||
} from "./group-access.js";
|
||||
export {
|
||||
resolveDirectDmAuthorizationOutcome,
|
||||
resolveSenderCommandAuthorization,
|
||||
resolveSenderCommandAuthorizationWithRuntime,
|
||||
} from "./command-auth.js";
|
||||
export type { CommandAuthorizationRuntime } from "./command-auth.js";
|
||||
export { createScopedPairingAccess } from "./pairing-access.js";
|
||||
export {
|
||||
createInboundEnvelopeBuilder,
|
||||
resolveInboundRouteEnvelopeBuilder,
|
||||
resolveInboundRouteEnvelopeBuilderWithRuntime,
|
||||
} from "./inbound-envelope.js";
|
||||
export { resolveInboundSessionEnvelopeContext } from "../channels/session-envelope.js";
|
||||
export {
|
||||
listConfiguredAccountIds,
|
||||
resolveAccountWithDefaultFallback,
|
||||
} from "./account-resolution.js";
|
||||
export { resolveAccountEntry } from "../routing/account-lookup.js";
|
||||
export { issuePairingChallenge } from "../pairing/pairing-challenge.js";
|
||||
export { handleSlackMessageAction } from "./slack-message-actions.js";
|
||||
export { extractToolSend } from "./tool-send.js";
|
||||
export {
|
||||
createNormalizedOutboundDeliverer,
|
||||
formatTextWithAttachmentLinks,
|
||||
isNumericTargetId,
|
||||
normalizeOutboundReplyPayload,
|
||||
resolveOutboundMediaUrls,
|
||||
sendPayloadWithChunkedTextAndMedia,
|
||||
sendMediaWithLeadingCaption,
|
||||
} from "./reply-payload.js";
|
||||
export type { OutboundReplyPayload } from "./reply-payload.js";
|
||||
export {
|
||||
buildInboundReplyDispatchBase,
|
||||
dispatchInboundReplyWithBase,
|
||||
dispatchReplyFromConfigWithSettledDispatcher,
|
||||
recordInboundSessionAndDispatchReply,
|
||||
} from "./inbound-reply-dispatch.js";
|
||||
export type { OutboundMediaLoadOptions } from "./outbound-media.js";
|
||||
export { loadOutboundMediaFromUrl } from "./outbound-media.js";
|
||||
export { resolveChannelAccountConfigBasePath } from "./config-paths.js";
|
||||
export { buildMediaPayload } from "../channels/plugins/media-payload.js";
|
||||
export type { MediaPayload, MediaPayloadInput } from "../channels/plugins/media-payload.js";
|
||||
export {
|
||||
createLoggerBackedRuntime,
|
||||
resolveRuntimeEnv,
|
||||
resolveRuntimeEnvWithUnavailableExit,
|
||||
} from "./runtime.js";
|
||||
export { detectBinary } from "../plugins/setup-binary.js";
|
||||
export { installSignalCli } from "../plugins/signal-cli-install.js";
|
||||
export { chunkTextForOutbound } from "./text-chunking.js";
|
||||
export { resolveTextChunkLimit } from "../auto-reply/chunk.js";
|
||||
export { readBooleanParam } from "./boolean-param.js";
|
||||
export { readJsonFileWithFallback, writeJsonFileAtomically } from "./json-store.js";
|
||||
export { generatePkceVerifierChallenge, toFormUrlEncoded } from "./oauth-utils.js";
|
||||
export { buildRandomTempFilePath, withTempDownloadPath } from "./temp-path.js";
|
||||
export {
|
||||
applyWindowsSpawnProgramPolicy,
|
||||
materializeWindowsSpawnProgram,
|
||||
resolveWindowsExecutablePath,
|
||||
resolveWindowsSpawnProgramCandidate,
|
||||
resolveWindowsSpawnProgram,
|
||||
} from "./windows-spawn.js";
|
||||
export type {
|
||||
ResolveWindowsSpawnProgramCandidateParams,
|
||||
ResolveWindowsSpawnProgramParams,
|
||||
WindowsSpawnCandidateResolution,
|
||||
WindowsSpawnInvocation,
|
||||
WindowsSpawnProgramCandidate,
|
||||
WindowsSpawnProgram,
|
||||
WindowsSpawnResolution,
|
||||
} from "./windows-spawn.js";
|
||||
export { resolvePreferredOpenClawTmpDir } from "../infra/tmp-openclaw-dir.js";
|
||||
export {
|
||||
runPluginCommandWithTimeout,
|
||||
type PluginCommandRunOptions,
|
||||
type PluginCommandRunResult,
|
||||
} from "./run-command.js";
|
||||
export { resolveGatewayBindUrl } from "../shared/gateway-bind-url.js";
|
||||
export type { GatewayBindUrlResult } from "../shared/gateway-bind-url.js";
|
||||
export { resolveTailnetHostWithRunner } from "../shared/tailscale-status.js";
|
||||
export type {
|
||||
TailscaleStatusCommandResult,
|
||||
TailscaleStatusCommandRunner,
|
||||
} from "../shared/tailscale-status.js";
|
||||
export type { ChatType } from "../channels/chat-type.js";
|
||||
export { normalizeChatType } from "../channels/chat-type.js";
|
||||
/** @deprecated Use ChatType instead */
|
||||
export type { RoutePeerKind } from "../routing/resolve-route.js";
|
||||
export { resolveAckReaction } from "../agents/identity.js";
|
||||
export type { ReplyPayload } from "../auto-reply/types.js";
|
||||
export type { ChunkMode } from "../auto-reply/chunk.js";
|
||||
export { SILENT_REPLY_TOKEN, isSilentReplyText } from "../auto-reply/tokens.js";
|
||||
export { formatInboundFromLabel } from "../auto-reply/envelope.js";
|
||||
export {
|
||||
createScopedAccountConfigAccessors,
|
||||
formatTrimmedAllowFromEntries,
|
||||
mapAllowFromEntries,
|
||||
resolveOptionalConfigString,
|
||||
createScopedDmSecurityResolver,
|
||||
formatWhatsAppConfigAllowFromEntries,
|
||||
resolveIMessageConfigAllowFrom,
|
||||
resolveIMessageConfigDefaultTo,
|
||||
resolveWhatsAppConfigAllowFrom,
|
||||
resolveWhatsAppConfigDefaultTo,
|
||||
} from "./channel-config-helpers.js";
|
||||
export {
|
||||
approveDevicePairing,
|
||||
listDevicePairing,
|
||||
rejectDevicePairing,
|
||||
} from "../infra/device-pairing.js";
|
||||
export { createDedupeCache } from "../infra/dedupe.js";
|
||||
export type { DedupeCache } from "../infra/dedupe.js";
|
||||
export { createPersistentDedupe } from "./persistent-dedupe.js";
|
||||
export type {
|
||||
PersistentDedupe,
|
||||
PersistentDedupeCheckOptions,
|
||||
PersistentDedupeOptions,
|
||||
} from "./persistent-dedupe.js";
|
||||
export { formatErrorMessage } from "../infra/errors.js";
|
||||
export { resolveFetch } from "../infra/fetch.js";
|
||||
export {
|
||||
formatUtcTimestamp,
|
||||
formatZonedTimestamp,
|
||||
resolveTimezone,
|
||||
} from "../infra/format-time/format-datetime.js";
|
||||
export {
|
||||
DEFAULT_WEBHOOK_BODY_TIMEOUT_MS,
|
||||
DEFAULT_WEBHOOK_MAX_BODY_BYTES,
|
||||
RequestBodyLimitError,
|
||||
installRequestBodyLimitGuard,
|
||||
isRequestBodyLimitError,
|
||||
readJsonBodyWithLimit,
|
||||
readRequestBodyWithLimit,
|
||||
requestBodyErrorToText,
|
||||
} from "../infra/http-body.js";
|
||||
export {
|
||||
WEBHOOK_ANOMALY_COUNTER_DEFAULTS,
|
||||
WEBHOOK_ANOMALY_STATUS_CODES,
|
||||
WEBHOOK_RATE_LIMIT_DEFAULTS,
|
||||
createBoundedCounter,
|
||||
createFixedWindowRateLimiter,
|
||||
createWebhookAnomalyTracker,
|
||||
} from "./webhook-memory-guards.js";
|
||||
export type {
|
||||
BoundedCounter,
|
||||
FixedWindowRateLimiter,
|
||||
WebhookAnomalyTracker,
|
||||
} from "./webhook-memory-guards.js";
|
||||
|
||||
export { fetchWithSsrFGuard } from "../infra/net/fetch-guard.js";
|
||||
export {
|
||||
SsrFBlockedError,
|
||||
isBlockedHostname,
|
||||
isBlockedHostnameOrIp,
|
||||
isPrivateIpAddress,
|
||||
} from "../infra/net/ssrf.js";
|
||||
export type { LookupFn, SsrFPolicy } from "../infra/net/ssrf.js";
|
||||
export {
|
||||
buildHostnameAllowlistPolicyFromSuffixAllowlist,
|
||||
isHttpsUrlAllowedByHostnameSuffixAllowlist,
|
||||
normalizeHostnameSuffixAllowlist,
|
||||
} from "./ssrf-policy.js";
|
||||
export { fetchWithBearerAuthScopeFallback } from "./fetch-auth.js";
|
||||
export type { ScopeTokenProvider } from "./fetch-auth.js";
|
||||
export { rawDataToString } from "../infra/ws.js";
|
||||
export { isWSLSync, isWSL2Sync, isWSLEnv } from "../infra/wsl.js";
|
||||
export { isTruthyEnvValue } from "../infra/env.js";
|
||||
export { resolveChannelGroupRequireMention, resolveToolsBySender } from "../config/group-policy.js";
|
||||
export {
|
||||
buildPendingHistoryContextFromMap,
|
||||
clearHistoryEntries,
|
||||
clearHistoryEntriesIfEnabled,
|
||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||
evictOldHistoryKeys,
|
||||
recordPendingHistoryEntry,
|
||||
recordPendingHistoryEntryIfEnabled,
|
||||
} from "../auto-reply/reply/history.js";
|
||||
export type { HistoryEntry } from "../auto-reply/reply/history.js";
|
||||
export { mergeAllowlist, summarizeMapping } from "../channels/allowlists/resolve-utils.js";
|
||||
export {
|
||||
resolveMentionGating,
|
||||
resolveMentionGatingWithBypass,
|
||||
} from "../channels/mention-gating.js";
|
||||
export type {
|
||||
AckReactionGateParams,
|
||||
AckReactionScope,
|
||||
WhatsAppAckReactionMode,
|
||||
} from "../channels/ack-reactions.js";
|
||||
export {
|
||||
removeAckReactionAfterReply,
|
||||
shouldAckReaction,
|
||||
shouldAckReactionForWhatsApp,
|
||||
} from "../channels/ack-reactions.js";
|
||||
export { createTypingCallbacks } from "../channels/typing.js";
|
||||
export { createReplyPrefixContext, createReplyPrefixOptions } from "../channels/reply-prefix.js";
|
||||
export { logAckFailure, logInboundDrop, logTypingFailure } from "../channels/logging.js";
|
||||
export { resolveChannelMediaMaxBytes } from "../channels/plugins/media-limits.js";
|
||||
export type { NormalizedLocation } from "../channels/location.js";
|
||||
export { formatLocationText, toLocationContext } from "../channels/location.js";
|
||||
export { resolveControlCommandGate } from "../channels/command-gating.js";
|
||||
export {
|
||||
resolveBlueBubblesGroupRequireMention,
|
||||
resolveDiscordGroupRequireMention,
|
||||
resolveGoogleChatGroupRequireMention,
|
||||
resolveIMessageGroupRequireMention,
|
||||
resolveSlackGroupRequireMention,
|
||||
resolveTelegramGroupRequireMention,
|
||||
resolveWhatsAppGroupRequireMention,
|
||||
resolveBlueBubblesGroupToolPolicy,
|
||||
resolveDiscordGroupToolPolicy,
|
||||
resolveGoogleChatGroupToolPolicy,
|
||||
resolveIMessageGroupToolPolicy,
|
||||
resolveSlackGroupToolPolicy,
|
||||
resolveTelegramGroupToolPolicy,
|
||||
resolveWhatsAppGroupToolPolicy,
|
||||
} from "../channels/plugins/group-mentions.js";
|
||||
export { recordInboundSession } from "../channels/session.js";
|
||||
export {
|
||||
buildChannelKeyCandidates,
|
||||
normalizeChannelSlug,
|
||||
resolveChannelEntryMatch,
|
||||
resolveChannelEntryMatchWithFallback,
|
||||
resolveNestedAllowlistDecision,
|
||||
} from "../channels/plugins/channel-config.js";
|
||||
export {
|
||||
listDiscordDirectoryGroupsFromConfig,
|
||||
listDiscordDirectoryPeersFromConfig,
|
||||
listSlackDirectoryGroupsFromConfig,
|
||||
listSlackDirectoryPeersFromConfig,
|
||||
listTelegramDirectoryGroupsFromConfig,
|
||||
listTelegramDirectoryPeersFromConfig,
|
||||
listWhatsAppDirectoryGroupsFromConfig,
|
||||
listWhatsAppDirectoryPeersFromConfig,
|
||||
} from "../channels/plugins/directory-config.js";
|
||||
export type { AllowlistMatch } from "../channels/plugins/allowlist-match.js";
|
||||
export {
|
||||
formatAllowlistMatchMeta,
|
||||
resolveAllowlistMatchSimple,
|
||||
} from "../channels/plugins/allowlist-match.js";
|
||||
export { optionalStringEnum, stringEnum } from "../agents/schema/typebox.js";
|
||||
export type { PollInput } from "../polls.js";
|
||||
|
||||
export { buildChannelConfigSchema } from "../channels/plugins/config-schema.js";
|
||||
export {
|
||||
listDirectoryGroupEntriesFromMapKeys,
|
||||
listDirectoryGroupEntriesFromMapKeysAndAllowFrom,
|
||||
listDirectoryUserEntriesFromAllowFrom,
|
||||
listDirectoryUserEntriesFromAllowFromAndMapKeys,
|
||||
} from "../channels/plugins/directory-config-helpers.js";
|
||||
export {
|
||||
clearAccountEntryFields,
|
||||
deleteAccountFromConfigSection,
|
||||
setAccountEnabledInConfigSection,
|
||||
} from "../channels/plugins/config-helpers.js";
|
||||
export {
|
||||
applyAccountNameToChannelSection,
|
||||
applySetupAccountConfigPatch,
|
||||
migrateBaseNameToDefaultAccount,
|
||||
patchScopedAccountConfig,
|
||||
} from "../channels/plugins/setup-helpers.js";
|
||||
export {
|
||||
buildOpenGroupPolicyConfigureRouteAllowlistWarning,
|
||||
buildOpenGroupPolicyNoRouteAllowlistWarning,
|
||||
buildOpenGroupPolicyRestrictSendersWarning,
|
||||
buildOpenGroupPolicyWarning,
|
||||
collectAllowlistProviderGroupPolicyWarnings,
|
||||
collectAllowlistProviderRestrictSendersWarnings,
|
||||
collectOpenProviderGroupPolicyWarnings,
|
||||
collectOpenGroupPolicyConfiguredRouteWarnings,
|
||||
collectOpenGroupPolicyRestrictSendersWarnings,
|
||||
collectOpenGroupPolicyRouteAllowlistWarnings,
|
||||
} from "../channels/plugins/group-policy-warnings.js";
|
||||
export {
|
||||
buildAccountScopedDmSecurityPolicy,
|
||||
formatPairingApproveHint,
|
||||
} from "../channels/plugins/helpers.js";
|
||||
export { PAIRING_APPROVED_MESSAGE } from "../channels/plugins/pairing-message.js";
|
||||
|
||||
export {
|
||||
createActionGate,
|
||||
jsonResult,
|
||||
readNumberParam,
|
||||
readReactionParams,
|
||||
readStringParam,
|
||||
} from "../agents/tools/common.js";
|
||||
export { formatDocsLink } from "../terminal/links.js";
|
||||
export { formatCliCommand } from "../cli/command-format.js";
|
||||
export {
|
||||
DM_GROUP_ACCESS_REASON,
|
||||
readStoreAllowFromForDmPolicy,
|
||||
resolveDmAllowState,
|
||||
resolveDmGroupAccessDecision,
|
||||
resolveDmGroupAccessWithCommandGate,
|
||||
resolveDmGroupAccessWithLists,
|
||||
resolveEffectiveAllowFromLists,
|
||||
} from "../security/dm-policy-shared.js";
|
||||
export type { DmGroupAccessReasonCode } from "../security/dm-policy-shared.js";
|
||||
export type { HookEntry } from "../hooks/types.js";
|
||||
export {
|
||||
clamp,
|
||||
escapeRegExp,
|
||||
isRecord,
|
||||
normalizeE164,
|
||||
pathExists,
|
||||
resolveUserPath,
|
||||
safeParseJson,
|
||||
sleep,
|
||||
} from "../utils.js";
|
||||
export { fetchWithTimeout } from "../utils/fetch-timeout.js";
|
||||
export {
|
||||
DEFAULT_SECRET_FILE_MAX_BYTES,
|
||||
loadSecretFileSync,
|
||||
readSecretFileSync,
|
||||
tryReadSecretFileSync,
|
||||
} from "../infra/secret-file.js";
|
||||
export { stripAnsi } from "../terminal/ansi.js";
|
||||
export { missingTargetError } from "../infra/outbound/target-errors.js";
|
||||
export { registerLogTransport } from "../logging/logger.js";
|
||||
export type { LogTransport, LogTransportRecord } from "../logging/logger.js";
|
||||
export {
|
||||
emitDiagnosticEvent,
|
||||
isDiagnosticsEnabled,
|
||||
onDiagnosticEvent,
|
||||
} from "../infra/diagnostic-events.js";
|
||||
export type {
|
||||
DiagnosticEventPayload,
|
||||
DiagnosticHeartbeatEvent,
|
||||
DiagnosticLaneDequeueEvent,
|
||||
DiagnosticLaneEnqueueEvent,
|
||||
DiagnosticMessageProcessedEvent,
|
||||
DiagnosticMessageQueuedEvent,
|
||||
DiagnosticRunAttemptEvent,
|
||||
DiagnosticSessionState,
|
||||
DiagnosticSessionStateEvent,
|
||||
DiagnosticSessionStuckEvent,
|
||||
DiagnosticUsageEvent,
|
||||
DiagnosticWebhookErrorEvent,
|
||||
DiagnosticWebhookProcessedEvent,
|
||||
DiagnosticWebhookReceivedEvent,
|
||||
} from "../infra/diagnostic-events.js";
|
||||
export { loadConfig } from "../config/config.js";
|
||||
export { runCommandWithTimeout } from "../process/exec.js";
|
||||
export { detectMime, extensionForMime, getFileExtension } from "../media/mime.js";
|
||||
export { extractOriginalFilename } from "../media/store.js";
|
||||
export { listSkillCommandsForAgents } from "../auto-reply/skill-commands.js";
|
||||
export type { SkillCommandSpec } from "../agents/skills.js";
|
||||
export type { ReplyPayload } from "../auto-reply/types.js";
|
||||
export type { WizardPrompter } from "../wizard/prompts.js";
|
||||
|
||||
// Channel: WhatsApp — WhatsApp-specific exports moved to extensions/whatsapp/src/
|
||||
export { isWhatsAppGroupJid, normalizeWhatsAppTarget } from "../whatsapp/normalize.js";
|
||||
export { resolveWhatsAppOutboundTarget } from "../whatsapp/resolve-outbound-target.js";
|
||||
|
||||
// Channel: BlueBubbles
|
||||
export { collectBlueBubblesStatusIssues } from "../channels/plugins/status-issues/bluebubbles.js";
|
||||
|
||||
// Channel: LINE
|
||||
export {
|
||||
listLineAccountIds,
|
||||
lineSetupAdapter,
|
||||
lineSetupWizard,
|
||||
normalizeAccountId as normalizeLineAccountId,
|
||||
resolveDefaultLineAccountId,
|
||||
resolveLineAccount,
|
||||
LineConfigSchema,
|
||||
} from "./line.js";
|
||||
export type {
|
||||
LineConfig,
|
||||
LineAccountConfig,
|
||||
ResolvedLineAccount,
|
||||
LineChannelData,
|
||||
} from "../line/types.js";
|
||||
export {
|
||||
createInfoCard,
|
||||
createListCard,
|
||||
createImageCard,
|
||||
createActionCard,
|
||||
createReceiptCard,
|
||||
type CardAction,
|
||||
type ListItem,
|
||||
} from "../line/flex-templates.js";
|
||||
export {
|
||||
processLineMessage,
|
||||
hasMarkdownToConvert,
|
||||
stripMarkdown,
|
||||
} from "../line/markdown-to-line.js";
|
||||
export type { ProcessedLineMessage } from "../line/markdown-to-line.js";
|
||||
|
||||
// Media utilities
|
||||
export { loadWebMedia, type WebMediaResult } from "./web-media.js";
|
||||
|
||||
// Context engine
|
||||
export type {
|
||||
ContextEngine,
|
||||
ContextEngineInfo,
|
||||
AssembleResult,
|
||||
CompactResult,
|
||||
IngestResult,
|
||||
IngestBatchResult,
|
||||
BootstrapResult,
|
||||
SubagentSpawnPreparation,
|
||||
SubagentEndReason,
|
||||
} from "../context-engine/types.js";
|
||||
export { registerContextEngine } from "../context-engine/registry.js";
|
||||
export type { ContextEngineFactory } from "../context-engine/registry.js";
|
||||
|
||||
// Model authentication types for plugins.
|
||||
// Plugins should use runtime.modelAuth (which strips unsafe overrides like
|
||||
// agentDir/store) rather than importing raw helpers directly.
|
||||
export { requireApiKey } from "../agents/model-auth.js";
|
||||
export type { ResolvedProviderAuth } from "../agents/model-auth.js";
|
||||
export type {
|
||||
ProviderCatalogContext,
|
||||
ProviderCatalogResult,
|
||||
ProviderDiscoveryContext,
|
||||
} from "../plugins/types.js";
|
||||
export {
|
||||
applyProviderDefaultModel,
|
||||
promptAndConfigureOpenAICompatibleSelfHostedProvider,
|
||||
SELF_HOSTED_DEFAULT_CONTEXT_WINDOW,
|
||||
SELF_HOSTED_DEFAULT_COST,
|
||||
SELF_HOSTED_DEFAULT_MAX_TOKENS,
|
||||
} from "../plugins/provider-self-hosted-setup.js";
|
||||
export {
|
||||
OLLAMA_DEFAULT_BASE_URL,
|
||||
OLLAMA_DEFAULT_MODEL,
|
||||
configureOllamaNonInteractive,
|
||||
ensureOllamaModelPulled,
|
||||
promptAndConfigureOllama,
|
||||
} from "../plugins/provider-ollama-setup.js";
|
||||
export {
|
||||
VLLM_DEFAULT_BASE_URL,
|
||||
VLLM_DEFAULT_CONTEXT_WINDOW,
|
||||
VLLM_DEFAULT_COST,
|
||||
VLLM_DEFAULT_MAX_TOKENS,
|
||||
promptAndConfigureVllm,
|
||||
} from "../plugins/provider-vllm-setup.js";
|
||||
export {
|
||||
buildOllamaProvider,
|
||||
buildSglangProvider,
|
||||
buildVllmProvider,
|
||||
} from "../agents/models-config.providers.discovery.js";
|
||||
|
||||
// Security utilities
|
||||
export { redactSensitiveText } from "../logging/redact.js";
|
||||
export { emptyPluginConfigSchema } from "../plugins/config-schema.js";
|
||||
|
||||
@@ -4,6 +4,7 @@ export type { OpenClawConfig } from "../config/config.js";
|
||||
export type { SecretInput } from "../config/types.secrets.js";
|
||||
export type { ProviderAuthResult } from "../plugins/types.js";
|
||||
export type { AuthProfileStore, OAuthCredential } from "../agents/auth-profiles/types.js";
|
||||
export { buildOauthProviderAuthResult } from "./provider-auth-result.js";
|
||||
|
||||
export {
|
||||
CLAUDE_CLI_PROFILE_ID,
|
||||
|
||||
@@ -1,10 +1,16 @@
|
||||
// Public model/catalog helpers for provider plugins.
|
||||
|
||||
export type {
|
||||
ModelApi,
|
||||
ModelDefinitionConfig,
|
||||
ModelProviderConfig,
|
||||
} from "../config/types.models.js";
|
||||
import type { ModelDefinitionConfig } from "../config/types.models.js";
|
||||
import {
|
||||
KILOCODE_DEFAULT_CONTEXT_WINDOW,
|
||||
KILOCODE_DEFAULT_COST,
|
||||
KILOCODE_DEFAULT_MAX_TOKENS,
|
||||
KILOCODE_DEFAULT_MODEL_ID,
|
||||
KILOCODE_DEFAULT_MODEL_NAME,
|
||||
} from "../providers/kilocode-shared.js";
|
||||
|
||||
export type { ModelApi, ModelProviderConfig } from "../config/types.models.js";
|
||||
export type { ModelDefinitionConfig } from "../config/types.models.js";
|
||||
export type { ProviderPlugin } from "../plugins/types.js";
|
||||
|
||||
export { DEFAULT_CONTEXT_TOKENS } from "../agents/defaults.js";
|
||||
@@ -19,8 +25,48 @@ export { applyOpenAIConfig, OPENAI_DEFAULT_MODEL } from "../plugins/provider-mod
|
||||
export { OPENCODE_GO_DEFAULT_MODEL_REF } from "../plugins/provider-model-defaults.js";
|
||||
export { OPENCODE_ZEN_DEFAULT_MODEL } from "../plugins/provider-model-defaults.js";
|
||||
export { OPENCODE_ZEN_DEFAULT_MODEL_REF } from "../agents/opencode-zen-models.js";
|
||||
|
||||
export * from "../plugins/provider-model-definitions.js";
|
||||
export {
|
||||
buildMinimaxApiModelDefinition,
|
||||
DEFAULT_MINIMAX_BASE_URL,
|
||||
MINIMAX_API_BASE_URL,
|
||||
MINIMAX_CN_API_BASE_URL,
|
||||
MINIMAX_HOSTED_COST,
|
||||
MINIMAX_HOSTED_MODEL_ID,
|
||||
MINIMAX_HOSTED_MODEL_REF,
|
||||
MINIMAX_LM_STUDIO_COST,
|
||||
} from "../../extensions/minimax/model-definitions.js";
|
||||
export {
|
||||
buildMistralModelDefinition,
|
||||
MISTRAL_BASE_URL,
|
||||
MISTRAL_DEFAULT_MODEL_ID,
|
||||
MISTRAL_DEFAULT_MODEL_REF,
|
||||
} from "../../extensions/mistral/model-definitions.js";
|
||||
export {
|
||||
buildModelStudioDefaultModelDefinition,
|
||||
buildModelStudioModelDefinition,
|
||||
MODELSTUDIO_CN_BASE_URL,
|
||||
MODELSTUDIO_DEFAULT_MODEL_ID,
|
||||
MODELSTUDIO_DEFAULT_MODEL_REF,
|
||||
MODELSTUDIO_GLOBAL_BASE_URL,
|
||||
} from "../../extensions/modelstudio/model-definitions.js";
|
||||
export { MOONSHOT_BASE_URL } from "../../extensions/moonshot/provider-catalog.js";
|
||||
export { MOONSHOT_CN_BASE_URL } from "../../extensions/moonshot/onboard.js";
|
||||
export {
|
||||
buildXaiModelDefinition,
|
||||
XAI_BASE_URL,
|
||||
XAI_DEFAULT_MODEL_ID,
|
||||
XAI_DEFAULT_MODEL_REF,
|
||||
} from "../../extensions/xai/model-definitions.js";
|
||||
export {
|
||||
buildZaiModelDefinition,
|
||||
resolveZaiBaseUrl,
|
||||
ZAI_CODING_CN_BASE_URL,
|
||||
ZAI_CODING_GLOBAL_BASE_URL,
|
||||
ZAI_CN_BASE_URL,
|
||||
ZAI_DEFAULT_MODEL_ID,
|
||||
ZAI_DEFAULT_MODEL_REF,
|
||||
ZAI_GLOBAL_BASE_URL,
|
||||
} from "../../extensions/zai/model-definitions.js";
|
||||
|
||||
export {
|
||||
buildCloudflareAiGatewayModelDefinition,
|
||||
@@ -84,3 +130,15 @@ export {
|
||||
discoverVercelAiGatewayModels,
|
||||
VERCEL_AI_GATEWAY_BASE_URL,
|
||||
} from "../agents/vercel-ai-gateway.js";
|
||||
|
||||
export function buildKilocodeModelDefinition(): ModelDefinitionConfig {
|
||||
return {
|
||||
id: KILOCODE_DEFAULT_MODEL_ID,
|
||||
name: KILOCODE_DEFAULT_MODEL_NAME,
|
||||
reasoning: true,
|
||||
input: ["text", "image"],
|
||||
cost: KILOCODE_DEFAULT_COST,
|
||||
contextWindow: KILOCODE_DEFAULT_CONTEXT_WINDOW,
|
||||
maxTokens: KILOCODE_DEFAULT_MAX_TOKENS,
|
||||
};
|
||||
}
|
||||
|
||||
14
src/plugin-sdk/reply-history.ts
Normal file
14
src/plugin-sdk/reply-history.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
/** Shared reply-history helpers for plugins that keep short per-thread context windows. */
|
||||
export type { HistoryEntry } from "../auto-reply/reply/history.js";
|
||||
export {
|
||||
DEFAULT_GROUP_HISTORY_LIMIT,
|
||||
buildHistoryContext,
|
||||
buildHistoryContextFromEntries,
|
||||
buildHistoryContextFromMap,
|
||||
buildPendingHistoryContextFromMap,
|
||||
clearHistoryEntries,
|
||||
clearHistoryEntriesIfEnabled,
|
||||
evictOldHistoryKeys,
|
||||
recordPendingHistoryEntry,
|
||||
recordPendingHistoryEntryIfEnabled,
|
||||
} from "../auto-reply/reply/history.js";
|
||||
@@ -84,7 +84,7 @@ function loadMonolithicSdk() {
|
||||
|
||||
const jiti = getJiti();
|
||||
|
||||
const distCandidate = path.resolve(__dirname, "..", "..", "dist", "plugin-sdk", "index.js");
|
||||
const distCandidate = path.resolve(__dirname, "..", "..", "dist", "plugin-sdk", "compat.js");
|
||||
if (fs.existsSync(distCandidate)) {
|
||||
try {
|
||||
monolithicSdk = jiti(distCandidate);
|
||||
@@ -94,7 +94,7 @@ function loadMonolithicSdk() {
|
||||
}
|
||||
}
|
||||
|
||||
monolithicSdk = jiti(path.join(__dirname, "index.ts"));
|
||||
monolithicSdk = jiti(path.join(__dirname, "compat.ts"));
|
||||
return monolithicSdk;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ import * as msteamsSdk from "openclaw/plugin-sdk/msteams";
|
||||
import * as nostrSdk from "openclaw/plugin-sdk/nostr";
|
||||
import * as ollamaSetupSdk from "openclaw/plugin-sdk/ollama-setup";
|
||||
import * as providerSetupSdk from "openclaw/plugin-sdk/provider-setup";
|
||||
import * as routingSdk from "openclaw/plugin-sdk/routing";
|
||||
import * as runtimeSdk from "openclaw/plugin-sdk/runtime";
|
||||
import * as sandboxSdk from "openclaw/plugin-sdk/sandbox";
|
||||
import * as selfHostedProviderSetupSdk from "openclaw/plugin-sdk/self-hosted-provider-setup";
|
||||
import * as setupSdk from "openclaw/plugin-sdk/setup";
|
||||
@@ -45,17 +47,25 @@ describe("plugin-sdk subpath exports", () => {
|
||||
expect(typeof compatSdk.resolveControlCommandGate).toBe("function");
|
||||
});
|
||||
|
||||
it("exports core routing helpers", () => {
|
||||
expect(typeof coreSdk.buildAgentSessionKey).toBe("function");
|
||||
expect(typeof coreSdk.resolveThreadSessionKeys).toBe("function");
|
||||
expect(typeof coreSdk.runPassiveAccountLifecycle).toBe("function");
|
||||
expect(typeof coreSdk.createLoggerBackedRuntime).toBe("function");
|
||||
it("keeps core focused on generic shared exports", () => {
|
||||
expect(typeof coreSdk.emptyPluginConfigSchema).toBe("function");
|
||||
expect("runPassiveAccountLifecycle" in asExports(coreSdk)).toBe(false);
|
||||
expect("createLoggerBackedRuntime" in asExports(coreSdk)).toBe(false);
|
||||
expect("registerSandboxBackend" in asExports(coreSdk)).toBe(false);
|
||||
expect("promptAndConfigureOpenAICompatibleSelfHostedProviderAuth" in asExports(coreSdk)).toBe(
|
||||
false,
|
||||
);
|
||||
});
|
||||
|
||||
it("exports routing helpers from the dedicated subpath", () => {
|
||||
expect(typeof routingSdk.buildAgentSessionKey).toBe("function");
|
||||
expect(typeof routingSdk.resolveThreadSessionKeys).toBe("function");
|
||||
});
|
||||
|
||||
it("exports runtime helpers from the dedicated subpath", () => {
|
||||
expect(typeof runtimeSdk.createLoggerBackedRuntime).toBe("function");
|
||||
});
|
||||
|
||||
it("exports provider setup helpers from the dedicated subpath", () => {
|
||||
expect(typeof providerSetupSdk.buildVllmProvider).toBe("function");
|
||||
expect(typeof providerSetupSdk.discoverOpenAICompatibleSelfHostedProvider).toBe("function");
|
||||
|
||||
Reference in New Issue
Block a user