refactor: harden plugin metadata and bundled channel entry seams

This commit is contained in:
Peter Steinberger
2026-04-06 00:15:29 +01:00
parent 95079949c3
commit 8cb85ff85f
43 changed files with 607 additions and 199 deletions

View File

@@ -2,7 +2,8 @@ import fs from "node:fs";
import os from "node:os";
import path from "node:path";
import { resolveDefaultAgentId } from "../agents/agent-scope.js";
import { listBootstrapChannelPlugins } from "../channels/plugins/bootstrap-registry.js";
import { listBundledChannelPluginIds } from "../channels/plugins/bundled-ids.js";
import { hasBundledChannelPersistedAuthState } from "../channels/plugins/persisted-auth-state.js";
import { formatCliCommand } from "../cli/command-format.js";
import type { OpenClawConfig } from "../config/config.js";
import { resolveOAuthDir, resolveStateDir } from "../config/paths.js";
@@ -463,8 +464,8 @@ function shouldRequireOAuthDir(cfg: OpenClawConfig, env: NodeJS.ProcessEnv): boo
if (!isRecord(channels)) {
return false;
}
for (const plugin of listBootstrapChannelPlugins()) {
if (plugin.config.hasPersistedAuthState?.({ cfg, env })) {
for (const channelId of listBundledChannelPluginIds()) {
if (hasBundledChannelPersistedAuthState({ channelId, cfg, env })) {
return true;
}
}

View File

@@ -1,4 +1,4 @@
import { listBootstrapChannelPlugins } from "../../../channels/plugins/bootstrap-registry.js";
import { iterateBootstrapChannelPlugins } from "../../../channels/plugins/bootstrap-registry.js";
import type { OpenClawConfig } from "../../../config/types.js";
export function applyChannelDoctorCompatibilityMigrations(cfg: Record<string, unknown>): {
@@ -7,7 +7,7 @@ export function applyChannelDoctorCompatibilityMigrations(cfg: Record<string, un
} {
let nextCfg = cfg as OpenClawConfig & Record<string, unknown>;
const changes: string[] = [];
for (const plugin of listBootstrapChannelPlugins()) {
for (const plugin of iterateBootstrapChannelPlugins()) {
const mutation = plugin.doctor?.normalizeCompatibilityConfig?.({ cfg: nextCfg });
if (!mutation || mutation.changes.length === 0) {
continue;