import { r as KlawConfig } from "./types.klaw-xKUw_Rz7.js"; import { T as ReplyToMode } from "./types.base-Dkv2492C.js"; import { n as ChannelConfigSchema } from "./types.config-D44pO5LU.js"; import { n as ChatChannelId } from "./channel-id.types-B_AcMzNT.js"; import { b as OutboundDeliveryResult, n as ChannelOutboundAdapter } from "./outbound.types-P0E6jGE1.js"; import { A as ChannelPollResult, D as ChannelOutboundSessionRoute, E as ChannelMeta, R as ChannelThreadingAdapter, T as ChannelMessagingAdapter } from "./types.core-BSyOg0vX.js"; import { u as KlawPluginApi } from "./types-CAmC_cW72.js"; import { V as ChannelSecurityAdapter } from "./types.adapters-DatL0h_D.js"; import { t as ChannelPairingAdapter } from "./pairing.types-BWE6gvH4.js"; import { n as ChannelPlugin } from "./types.public-BSMobFik.js"; import { n as PluginRuntime } from "./types-yybOtwsl.js"; import { n as ResolvedConfiguredAcpBinding } from "./persistent-bindings.resolve-Dv8Pr26N.js"; //#region src/shared/gateway-bind-url.d.ts type GatewayBindUrlResult = { url: string; source: "gateway.bind=custom" | "gateway.bind=tailnet" | "gateway.bind=lan"; } | { error: string; } | null; declare function resolveGatewayBindUrl(params: { bind?: string; customBindHost?: string; scheme: "ws" | "wss"; port: number; pickTailnetHost: () => string | null; pickLanHost: () => string | null; }): GatewayBindUrlResult; //#endregion //#region src/shared/tailscale-status.d.ts type TailscaleStatusCommandResult = { code: number | null; stdout: string; }; type TailscaleStatusCommandRunner = (argv: string[], opts: { timeoutMs: number; }) => Promise; declare function resolveTailnetHostWithRunner(runCommandWithTimeout?: TailscaleStatusCommandRunner): Promise; //#endregion //#region src/plugin-sdk/core.d.ts declare function ensureConfiguredAcpBindingReady(params: { cfg: KlawConfig; configuredBinding: ResolvedConfiguredAcpBinding | null; }): Promise<{ ok: true; } | { ok: false; error: string; }>; type ChannelOutboundSessionRouteParams = Parameters>[0]; declare function getChatChannelMeta(id: ChatChannelId): ChannelMeta; /** Remove one of the known provider prefixes from a free-form target string. */ declare function stripChannelTargetPrefix(raw: string, ...providers: string[]): string; /** Remove generic target-kind prefixes such as `user:` or `group:`. */ declare function stripTargetKindPrefix(raw: string): string; /** * Build the canonical outbound session route payload returned by channel * message adapters. */ declare function buildChannelOutboundSessionRoute(params: { cfg: KlawConfig; agentId: string; channel: string; accountId?: string | null; peer: { kind: "direct" | "group" | "channel"; id: string; }; chatType: "direct" | "group" | "channel"; from: string; to: string; threadId?: string | number; }): ChannelOutboundSessionRoute; type ThreadAwareOutboundSessionRouteThreadSource = "replyToId" | "threadId" | "currentSession"; type ThreadAwareOutboundSessionRouteRecoveryContext = { route: ChannelOutboundSessionRoute; currentBaseSessionKey: string; currentThreadId: string; }; declare function recoverCurrentThreadSessionId(params: { route: ChannelOutboundSessionRoute; currentSessionKey?: string | null; canRecover?: (context: ThreadAwareOutboundSessionRouteRecoveryContext) => boolean; }): string | undefined; declare function buildThreadAwareOutboundSessionRoute(params: { route: ChannelOutboundSessionRoute; replyToId?: string | number | null; threadId?: string | number | null; currentSessionKey?: string | null; precedence?: readonly ThreadAwareOutboundSessionRouteThreadSource[]; useSuffix?: boolean; parentSessionKey?: string; normalizeThreadId?: (threadId: string) => string; canRecoverCurrentThread?: (context: ThreadAwareOutboundSessionRouteRecoveryContext) => boolean; }): ChannelOutboundSessionRoute; /** Options for a channel plugin entry that should register a channel capability. */ type ChannelEntryConfigSchema = TPlugin extends ChannelPlugin ? NonNullable : ChannelConfigSchema; type DefineChannelPluginEntryOptions = { id: string; name: string; description: string; plugin: TPlugin; configSchema?: ChannelEntryConfigSchema | (() => ChannelEntryConfigSchema); setRuntime?: (runtime: PluginRuntime) => void; registerCliMetadata?: (api: KlawPluginApi) => void; registerFull?: (api: KlawPluginApi) => void; }; type DefinedChannelPluginEntry = { id: string; name: string; description: string; configSchema: ChannelEntryConfigSchema; register: (api: KlawPluginApi) => void; channelPlugin: TPlugin; setChannelRuntime?: (runtime: PluginRuntime) => void; }; type CreateChannelPluginBaseOptions = { id: ChannelPlugin["id"]; meta?: Partial["meta"]>>; setupWizard?: NonNullable["setupWizard"]>; capabilities?: ChannelPlugin["capabilities"]; commands?: ChannelPlugin["commands"]; doctor?: ChannelPlugin["doctor"]; agentPrompt?: ChannelPlugin["agentPrompt"]; streaming?: ChannelPlugin["streaming"]; reload?: ChannelPlugin["reload"]; gatewayMethods?: ChannelPlugin["gatewayMethods"]; gatewayMethodDescriptors?: ChannelPlugin["gatewayMethodDescriptors"]; configSchema?: ChannelPlugin["configSchema"]; config?: ChannelPlugin["config"]; security?: ChannelPlugin["security"]; setup: NonNullable["setup"]>; groups?: ChannelPlugin["groups"]; }; type CreatedChannelPluginBase = Pick, "id" | "meta" | "setup"> & Partial, "setupWizard" | "capabilities" | "commands" | "doctor" | "agentPrompt" | "streaming" | "reload" | "gatewayMethods" | "gatewayMethodDescriptors" | "configSchema" | "config" | "security" | "groups">>; /** * Canonical entry helper for channel plugins. * * This wraps `definePluginEntry(...)`, registers the channel capability, and * optionally exposes extra full-runtime registration such as tools or gateway * handlers that only make sense outside setup-only registration modes. */ declare function defineChannelPluginEntry({ id, name, description, plugin, configSchema, setRuntime, registerCliMetadata, registerFull }: DefineChannelPluginEntryOptions): DefinedChannelPluginEntry; /** * Minimal setup-entry helper for channels that ship a separate `setup-entry.ts`. * * The setup entry only needs to export `{ plugin }`, but using this helper * keeps the shape explicit in examples and generated typings. */ declare function defineSetupPluginEntry(plugin: TPlugin): { plugin: TPlugin; }; type ChatChannelPluginBase = Omit, "security" | "pairing" | "threading" | "outbound"> & Partial, "security" | "pairing" | "threading" | "outbound">>; type ChatChannelSecurityOptions = { dm: { channelKey: string; resolvePolicy: (account: TResolvedAccount) => string | null | undefined; resolveAllowFrom: (account: TResolvedAccount) => Array | null | undefined; resolveFallbackAccountId?: (account: TResolvedAccount) => string | null | undefined; defaultPolicy?: string; allowFromPathSuffix?: string; policyPathSuffix?: string; approveChannelId?: string; approveHint?: string; normalizeEntry?: (raw: string) => string; inheritSharedDefaultsFromDefaultAccount?: boolean; }; collectWarnings?: ChannelSecurityAdapter["collectWarnings"]; collectAuditFindings?: ChannelSecurityAdapter["collectAuditFindings"]; }; type ChatChannelPairingOptions = { text: { idLabel: string; message: string; normalizeAllowEntry?: ChannelPairingAdapter["normalizeAllowEntry"]; notify: (params: Parameters>[0] & { message: string; }) => Promise | void; }; }; type ChatChannelThreadingReplyModeOptions = { topLevelReplyToMode: string; } | { scopedAccountReplyToMode: { resolveAccount: (cfg: KlawConfig, accountId?: string | null) => TResolvedAccount; resolveReplyToMode: (account: TResolvedAccount, chatType?: string | null) => ReplyToMode | null | undefined; fallback?: ReplyToMode; }; } | { resolveReplyToMode: NonNullable; }; type ChatChannelThreadingOptions = ChatChannelThreadingReplyModeOptions & Omit; type ChatChannelAttachedOutboundOptions = { base: Omit; attachedResults: { channel: string; sendText?: (ctx: Parameters>[0]) => MaybePromise>; sendMedia?: (ctx: Parameters>[0]) => MaybePromise>; sendPoll?: (ctx: Parameters>[0]) => MaybePromise>; }; }; type MaybePromise = T | Promise; declare function createChatChannelPlugin(params: { base: ChatChannelPluginBase; security?: ChannelSecurityAdapter | ChatChannelSecurityOptions; pairing?: ChannelPairingAdapter | ChatChannelPairingOptions; threading?: ChannelThreadingAdapter | ChatChannelThreadingOptions; outbound?: ChannelOutboundAdapter | ChatChannelAttachedOutboundOptions; }): ChannelPlugin; declare function createChannelPluginBase(params: CreateChannelPluginBaseOptions): CreatedChannelPluginBase; //#endregion export { resolveTailnetHostWithRunner as _, buildThreadAwareOutboundSessionRoute as a, defineChannelPluginEntry as c, getChatChannelMeta as d, recoverCurrentThreadSessionId as f, TailscaleStatusCommandRunner as g, TailscaleStatusCommandResult as h, buildChannelOutboundSessionRoute as i, defineSetupPluginEntry as l, stripTargetKindPrefix as m, ThreadAwareOutboundSessionRouteRecoveryContext as n, createChannelPluginBase as o, stripChannelTargetPrefix as p, ThreadAwareOutboundSessionRouteThreadSource as r, createChatChannelPlugin as s, ChannelOutboundSessionRouteParams as t, ensureConfiguredAcpBindingReady as u, GatewayBindUrlResult as v, resolveGatewayBindUrl as y };