mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 19:50:43 +00:00
refactor(config): migrate plugin config access
This commit is contained in:
@@ -234,7 +234,7 @@ describe("skill-workshop", () => {
|
||||
pluginConfig: { approvalPolicy: "auto" },
|
||||
runtime: {
|
||||
config: {
|
||||
loadConfig: () => configFile,
|
||||
current: () => configFile,
|
||||
},
|
||||
} as never,
|
||||
on,
|
||||
@@ -288,7 +288,7 @@ describe("skill-workshop", () => {
|
||||
resolveStateDir: () => stateDir,
|
||||
},
|
||||
config: {
|
||||
loadConfig: () => configFile,
|
||||
current: () => configFile,
|
||||
},
|
||||
} as never,
|
||||
registerTool(registered) {
|
||||
@@ -346,7 +346,7 @@ describe("skill-workshop", () => {
|
||||
resolveStateDir: () => stateDir,
|
||||
},
|
||||
config: {
|
||||
loadConfig: () => configFile,
|
||||
current: () => configFile,
|
||||
},
|
||||
} as never,
|
||||
registerTool(registered) {
|
||||
@@ -405,7 +405,7 @@ describe("skill-workshop", () => {
|
||||
resolveStateDir: () => stateDir,
|
||||
},
|
||||
config: {
|
||||
loadConfig: () => configFile,
|
||||
current: () => configFile,
|
||||
},
|
||||
} as never,
|
||||
on,
|
||||
@@ -492,7 +492,7 @@ describe("skill-workshop", () => {
|
||||
resolveStateDir: () => stateDir,
|
||||
},
|
||||
config: {
|
||||
loadConfig: () => configFile,
|
||||
current: () => configFile,
|
||||
},
|
||||
} as never,
|
||||
on,
|
||||
|
||||
@@ -1,4 +1,7 @@
|
||||
import { resolveLivePluginConfigObject } from "openclaw/plugin-sdk/config-runtime";
|
||||
import {
|
||||
resolveLivePluginConfigObject,
|
||||
type OpenClawConfig,
|
||||
} from "openclaw/plugin-sdk/config-runtime";
|
||||
import { definePluginEntry, resolveDefaultAgentId } from "./api.js";
|
||||
import { resolveConfig } from "./src/config.js";
|
||||
import { buildWorkshopGuidance } from "./src/prompt.js";
|
||||
@@ -15,7 +18,9 @@ export default definePluginEntry({
|
||||
register(api) {
|
||||
const resolveCurrentConfig = () => {
|
||||
const runtimePluginConfig = resolveLivePluginConfigObject(
|
||||
api.runtime.config?.loadConfig,
|
||||
api.runtime.config?.current
|
||||
? () => api.runtime.config.current() as OpenClawConfig
|
||||
: undefined,
|
||||
"skill-workshop",
|
||||
api.pluginConfig as Record<string, unknown>,
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user