






















@@ -1,8 +1,16 @@
11import fs from "node:fs";
2+import { createRequire } from "node:module";
23import path from "node:path";
34import { describe, expect, it } from "vitest";
45import { resolveAcpxPluginConfig, resolveAcpxPluginRoot } from "./config.js";
567+const requireFromTest = createRequire(import.meta.url);
8+const TSX_IMPORT = requireFromTest.resolve("tsx");
9+10+function expectedSourceMcpServerArgs(entrypoint: string): string[] {
11+return ["--import", TSX_IMPORT, path.resolve(entrypoint)];
12+}
13+614describe("embedded acpx plugin config", () => {
715it("resolves workspace stateDir and cwd by default", () => {
816const workspaceDir = path.resolve("/tmp/openclaw-acpx");
@@ -154,13 +162,10 @@ describe("embedded acpx plugin config", () => {
154162});
155163156164const server = resolved.mcpServers["openclaw-plugin-tools"];
157-expect(server).toMatchObject({
165+expect(server).toEqual({
158166command: process.execPath,
159-args: expect.any(Array),
167+args: expectedSourceMcpServerArgs("src/mcp/plugin-tools-serve.ts"),
160168});
161-expect(server.command).toBe(process.execPath);
162-expect(Array.isArray(server.args)).toBe(true);
163-expect(server.args?.length).toBeGreaterThan(0);
164169});
165170166171it("injects the built-in OpenClaw tools MCP server only when explicitly enabled", () => {
@@ -172,13 +177,10 @@ describe("embedded acpx plugin config", () => {
172177});
173178174179const server = resolved.mcpServers["openclaw-tools"];
175-expect(server).toMatchObject({
180+expect(server).toEqual({
176181command: process.execPath,
177-args: expect.any(Array),
182+args: expectedSourceMcpServerArgs("src/mcp/openclaw-tools-serve.ts"),
178183});
179-expect(server.command).toBe(process.execPath);
180-expect(Array.isArray(server.args)).toBe(true);
181-expect(server.args?.length).toBeGreaterThan(0);
182184});
183185184186it("resolves the plugin root from shared dist chunk paths", () => {
@@ -194,20 +196,90 @@ describe("embedded acpx plugin config", () => {
194196fs.readFileSync(path.join(pluginRoot, "openclaw.plugin.json"), "utf8"),
195197) as { configSchema?: unknown };
196198197-expect(manifest.configSchema).toMatchObject({
199+expect(manifest.configSchema).toStrictEqual({
198200type: "object",
199201additionalProperties: false,
200-properties: expect.objectContaining({
201-cwd: expect.any(Object),
202-stateDir: expect.any(Object),
203-probeAgent: expect.any(Object),
204-timeoutSeconds: expect.objectContaining({
202+properties: {
203+cwd: {
204+type: "string",
205+minLength: 1,
206+},
207+stateDir: {
208+type: "string",
209+minLength: 1,
210+},
211+permissionMode: {
212+type: "string",
213+enum: ["approve-all", "approve-reads", "deny-all"],
214+},
215+nonInteractivePermissions: {
216+type: "string",
217+enum: ["deny", "fail"],
218+},
219+pluginToolsMcpBridge: {
220+type: "boolean",
221+},
222+openClawToolsMcpBridge: {
223+type: "boolean",
224+},
225+strictWindowsCmdWrapper: {
226+type: "boolean",
227+},
228+timeoutSeconds: {
229+type: "number",
230+minimum: 0.001,
205231default: 120,
206-}),
207-agents: expect.any(Object),
208-mcpServers: expect.any(Object),
209-openClawToolsMcpBridge: expect.any(Object),
210-}),
232+},
233+queueOwnerTtlSeconds: {
234+type: "number",
235+minimum: 0,
236+},
237+probeAgent: {
238+type: "string",
239+minLength: 1,
240+},
241+mcpServers: {
242+type: "object",
243+additionalProperties: {
244+type: "object",
245+properties: {
246+command: {
247+type: "string",
248+minLength: 1,
249+description: "Command to run the MCP server",
250+},
251+args: {
252+type: "array",
253+items: { type: "string" },
254+description: "Arguments to pass to the command",
255+},
256+env: {
257+type: "object",
258+additionalProperties: { type: "string" },
259+description: "Environment variables for the MCP server",
260+},
261+},
262+required: ["command"],
263+},
264+},
265+agents: {
266+type: "object",
267+additionalProperties: {
268+type: "object",
269+properties: {
270+command: {
271+type: "string",
272+minLength: 1,
273+},
274+args: {
275+type: "array",
276+items: { type: "string" },
277+},
278+},
279+required: ["command"],
280+},
281+},
282+},
211283});
212284});
213285});
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。