






















@@ -1,10 +1,7 @@
11import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
2+import { getBundledChannelSetupPlugin } from "../channels/plugins/bundled.js";
23import { resolveChannelDefaultAccountId } from "../channels/plugins/helpers.js";
3-import {
4-getChannelSetupPlugin,
5-listActiveChannelSetupPlugins,
6-listChannelSetupPlugins,
7-} from "../channels/plugins/setup-registry.js";
4+import { listActiveChannelSetupPlugins } from "../channels/plugins/setup-registry.js";
85import type {
96ChannelSetupPlugin,
107ChannelSetupWizardAdapter,
@@ -113,7 +110,6 @@ export async function setupChannels(
113110): Promise<OpenClawConfig> {
114111let next = cfg;
115112const deferStatusUntilSelection = options?.deferStatusUntilSelection === true;
116-const includeRegistryBeforeSelection = !deferStatusUntilSelection;
117113const forceAllowFromChannels = new Set(options?.forceAllowFromChannels ?? []);
118114const accountOverrides: Partial<Record<ChannelChoice, string>> = {
119115 ...options?.accountIds,
@@ -131,17 +127,10 @@ export async function setupChannels(
131127return plugin;
132128};
133129const getVisibleChannelPlugin = (channel: ChannelChoice): ChannelSetupPlugin | undefined =>
134-scopedPluginsById.get(channel) ??
135-activePluginsById.get(channel) ??
136-(deferStatusUntilSelection ? undefined : getChannelSetupPlugin(channel));
137-const listVisibleInstalledPlugins = (params?: {
138-includeRegistry?: boolean;
139-}): ChannelSetupPlugin[] => {
140-const includeRegistry = params?.includeRegistry ?? includeRegistryBeforeSelection;
130+scopedPluginsById.get(channel) ?? activePluginsById.get(channel);
131+const listVisibleInstalledPlugins = (): ChannelSetupPlugin[] => {
141132const merged = new Map<string, ChannelSetupPlugin>();
142-const registryPlugins = includeRegistry
143- ? listChannelSetupPlugins()
144- : listActiveChannelSetupPlugins().map(rememberActivePlugin);
133+const registryPlugins = listActiveChannelSetupPlugins().map(rememberActivePlugin);
145134for (const plugin of registryPlugins) {
146135if (shouldShowChannelInSetup(plugin.meta)) {
147136merged.set(plugin.id, plugin);
@@ -154,10 +143,10 @@ export async function setupChannels(
154143}
155144return Array.from(merged.values());
156145};
157-const resolveVisibleChannelEntries = (params?: { includeRegistry?: boolean }) =>
146+const resolveVisibleChannelEntries = () =>
158147resolveChannelSetupEntries({
159148cfg: next,
160-installedPlugins: listVisibleInstalledPlugins(params),
149+installedPlugins: listVisibleInstalledPlugins(),
161150workspaceDir: resolveWorkspaceDir(),
162151});
163152const loadScopedChannelPlugin = async (
@@ -189,6 +178,11 @@ export async function setupChannels(
189178rememberScopedPlugin(plugin);
190179return plugin;
191180}
181+const bundledPlugin = getBundledChannelSetupPlugin(channel);
182+if (bundledPlugin) {
183+rememberScopedPlugin(bundledPlugin);
184+return bundledPlugin;
185+}
192186return undefined;
193187};
194188const getVisibleSetupFlowAdapter = (channel: ChannelChoice) => {
@@ -200,6 +194,7 @@ export async function setupChannels(
200194};
201195const preloadConfiguredExternalPlugins = async () => {
202196// Keep setup memory bounded by snapshot-loading only configured external plugins.
197+listVisibleInstalledPlugins();
203198const workspaceDir = resolveWorkspaceDir();
204199const preloadTasks: Promise<unknown>[] = [];
205200// Security: keep trusted workspace overrides eligible during setup while
@@ -246,9 +241,7 @@ export async function setupChannels(
246241return cfg;
247242}
248243249-const primerChannels = resolveVisibleChannelEntries({
250-includeRegistry: includeRegistryBeforeSelection,
251-}).entries.map((entry) => ({
244+const primerChannels = resolveVisibleChannelEntries().entries.map((entry) => ({
252245id: entry.id,
253246label: entry.meta.label,
254247blurb: entry.meta.blurb,
@@ -314,9 +307,7 @@ export async function setupChannels(
314307};
315308316309const getChannelEntries = () => {
317-const resolved = resolveVisibleChannelEntries({
318-includeRegistry: includeRegistryBeforeSelection,
319-});
310+const resolved = resolveVisibleChannelEntries();
320311return {
321312entries: resolved.entries,
322313catalogById: resolved.installableCatalogById,
@@ -657,9 +648,7 @@ export async function setupChannels(
657648658649const selectedLines = resolveChannelSelectionNoteLines({
659650cfg: next,
660-installedPlugins: listVisibleInstalledPlugins({
661-includeRegistry: includeRegistryBeforeSelection,
662-}),
651+installedPlugins: listVisibleInstalledPlugins(),
663652 selection,
664653});
665654if (selectedLines.length > 0) {
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。