mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 09:30:43 +00:00
fix(cli): load plugins for local JSON agent runs
This commit is contained in:
@@ -52,7 +52,7 @@ export const cliCommandCatalog: readonly CliCommandCatalogEntry[] = [
|
||||
{
|
||||
commandPath: ["agent"],
|
||||
policy: {
|
||||
loadPlugins: "text-only",
|
||||
loadPlugins: ({ argv, jsonOutputMode }) => hasFlag(argv, "--local") || !jsonOutputMode,
|
||||
networkProxy: ({ argv }) => (hasFlag(argv, "--local") ? "default" : "bypass"),
|
||||
},
|
||||
},
|
||||
|
||||
@@ -70,7 +70,7 @@ describe("command-path-policy", () => {
|
||||
expect(resolveCliCommandPathPolicy(["agent"])).toEqual({
|
||||
bypassConfigGuard: false,
|
||||
routeConfigGuard: "never",
|
||||
loadPlugins: "text-only",
|
||||
loadPlugins: expect.any(Function),
|
||||
hideBanner: false,
|
||||
ensureCliPath: true,
|
||||
networkProxy: expect.any(Function),
|
||||
|
||||
@@ -92,6 +92,27 @@ describe("command-startup-policy", () => {
|
||||
jsonOutputMode: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
expect(
|
||||
shouldLoadPluginsForCommandPath({
|
||||
argv: ["node", "openclaw", "agent", "--json"],
|
||||
commandPath: ["agent"],
|
||||
jsonOutputMode: true,
|
||||
}),
|
||||
).toBe(false);
|
||||
expect(
|
||||
shouldLoadPluginsForCommandPath({
|
||||
argv: ["node", "openclaw", "agent", "--json", "--local"],
|
||||
commandPath: ["agent"],
|
||||
jsonOutputMode: true,
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
shouldLoadPluginsForCommandPath({
|
||||
argv: ["node", "openclaw", "agent"],
|
||||
commandPath: ["agent"],
|
||||
jsonOutputMode: false,
|
||||
}),
|
||||
).toBe(true);
|
||||
expect(
|
||||
shouldLoadPluginsForCommandPath({
|
||||
commandPath: ["agents", "list"],
|
||||
|
||||
Reference in New Issue
Block a user