Files
openclaw/extensions/telegram/src/setup-plugin.ts
Peter Steinberger ccc1920068 improve(telegram): cut cold channel setup import latency (#122955)
* perf(telegram): keep setup entry on light graph

* fix(plugin-sdk): complete private UI hint boundaries
2026-08-13 01:55:47 -07:00

58 lines
1.7 KiB
TypeScript

// Telegram plugin module composes the setup-safe channel surface.
import type { ChannelPlugin } from "openclaw/plugin-sdk/channel-core";
import { getChatChannelMeta } from "openclaw/plugin-sdk/channel-plugin-common";
import type { ResolvedTelegramAccount } from "./accounts.js";
import { createTelegramPluginConfig } from "./config-adapter.js";
import { TelegramChannelConfigSchema } from "./config-schema.js";
import { collectRuntimeConfigAssignments, secretTargetRegistryEntries } from "./secret-contract.js";
const TELEGRAM_CHANNEL = "telegram" as const;
export function createTelegramSetupPluginBase(params: {
setupWizard: NonNullable<ChannelPlugin<ResolvedTelegramAccount>["setupWizard"]>;
setupContract: NonNullable<ChannelPlugin<ResolvedTelegramAccount>["setupContract"]>;
}): Pick<
ChannelPlugin<ResolvedTelegramAccount>,
| "id"
| "meta"
| "setupWizard"
| "capabilities"
| "reload"
| "configSchema"
| "config"
| "setupContract"
| "secrets"
> {
return {
id: TELEGRAM_CHANNEL,
setupContract: params.setupContract,
meta: {
...getChatChannelMeta(TELEGRAM_CHANNEL),
quickstartAllowFrom: true,
},
setupWizard: params.setupWizard,
capabilities: {
chatTypes: ["direct", "group", "channel", "thread"],
reactions: true,
threads: true,
media: true,
tts: {
voice: {
synthesisTarget: "voice-note",
captionedFinalText: true,
},
},
polls: true,
nativeCommands: true,
blockStreaming: true,
},
reload: { configPrefixes: ["channels.telegram"] },
configSchema: TelegramChannelConfigSchema,
config: createTelegramPluginConfig(),
secrets: {
secretTargetRegistryEntries,
collectRuntimeConfigAssignments,
},
};
}