mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 17:10:49 +00:00
refactor(hooks): centralize live plugin config lookup
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import { resolvePluginConfigObject } from "openclaw/plugin-sdk/config-runtime";
|
||||
import { definePluginEntry, resolveDefaultAgentId } from "./api.js";
|
||||
import { resolveConfig } from "./src/config.js";
|
||||
import { buildWorkshopGuidance } from "./src/prompt.js";
|
||||
@@ -6,12 +7,6 @@ import { createProposalFromMessages } from "./src/signals.js";
|
||||
import { createSkillWorkshopTool } from "./src/tool.js";
|
||||
import { applyOrStoreProposal, createStoreForContext } from "./src/workshop.js";
|
||||
|
||||
function asRecord(value: unknown): Record<string, unknown> | undefined {
|
||||
return value && typeof value === "object" && !Array.isArray(value)
|
||||
? (value as Record<string, unknown>)
|
||||
: undefined;
|
||||
}
|
||||
|
||||
export default definePluginEntry({
|
||||
id: "skill-workshop",
|
||||
name: "Skill Workshop",
|
||||
@@ -24,10 +19,8 @@ export default definePluginEntry({
|
||||
}
|
||||
const resolveCurrentConfig = () => {
|
||||
const runtimeConfig = api.runtime.config?.loadConfig?.();
|
||||
const runtimePlugins = asRecord(asRecord(runtimeConfig)?.plugins);
|
||||
const runtimeEntries = asRecord(runtimePlugins?.entries);
|
||||
const runtimePluginConfig =
|
||||
asRecord(runtimeEntries?.["skill-workshop"])?.config ?? api.pluginConfig;
|
||||
resolvePluginConfigObject(runtimeConfig, "skill-workshop") ?? api.pluginConfig;
|
||||
return resolveConfig(runtimePluginConfig);
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user