mirror of
https://github.com/openclaw/openclaw.git
synced 2026-07-12 16:16:02 +00:00
40 lines
1.5 KiB
TypeScript
40 lines
1.5 KiB
TypeScript
import { resolveAgentWorkspaceDir, resolveDefaultAgentId } from "../agents/agent-scope.js";
|
|
import { loadPluginManifestRegistryForPluginRegistry } from "../plugins/plugin-registry.js";
|
|
import {
|
|
collectChannelSchemaMetadata,
|
|
collectPluginSchemaMetadata,
|
|
} from "./channel-config-metadata.js";
|
|
import { loadConfig, readConfigFileSnapshot } from "./config.js";
|
|
import type { OpenClawConfig } from "./config.js";
|
|
import { buildConfigSchema, type ConfigSchemaResponse } from "./schema.js";
|
|
|
|
function loadManifestRegistry(config: OpenClawConfig, env?: NodeJS.ProcessEnv) {
|
|
const workspaceDir = resolveAgentWorkspaceDir(config, resolveDefaultAgentId(config));
|
|
return loadPluginManifestRegistryForPluginRegistry({
|
|
config,
|
|
cache: false,
|
|
env,
|
|
workspaceDir,
|
|
includeDisabled: true,
|
|
});
|
|
}
|
|
|
|
export function loadGatewayRuntimeConfigSchema(): ConfigSchemaResponse {
|
|
const config = loadConfig();
|
|
const registry = loadManifestRegistry(config);
|
|
return buildConfigSchema({
|
|
plugins: collectPluginSchemaMetadata(registry),
|
|
channels: collectChannelSchemaMetadata(registry),
|
|
});
|
|
}
|
|
|
|
export async function readBestEffortRuntimeConfigSchema(): Promise<ConfigSchemaResponse> {
|
|
const snapshot = await readConfigFileSnapshot();
|
|
const config = snapshot.valid ? snapshot.config : { plugins: { enabled: true } };
|
|
const registry = loadManifestRegistry(config);
|
|
return buildConfigSchema({
|
|
plugins: snapshot.valid ? collectPluginSchemaMetadata(registry) : [],
|
|
channels: collectChannelSchemaMetadata(registry),
|
|
});
|
|
}
|