


















@@ -145,6 +145,10 @@ describe("registerPreActionHooks", () => {
145145program.command("onboard").action(() => {});
146146const channels = program.command("channels");
147147channels.command("add").action(() => {});
148+channels
149+.command("send")
150+.option("--json")
151+.action(() => {});
148152program
149153.command("plugins")
150154.command("install")
@@ -229,7 +233,7 @@ describe("registerPreActionHooks", () => {
229233processTitleSetSpy.mockRestore();
230234});
231235232-it("loads plugins for local agent runs", async () => {
236+it("loads plugins for text local agent runs", async () => {
233237await runPreAction({
234238parseArgv: ["agent"],
235239processArgv: ["node", "openclaw", "agent", "--local", "--message", "hi"],
@@ -242,6 +246,20 @@ describe("registerPreActionHooks", () => {
242246expect(ensurePluginRegistryLoadedMock).toHaveBeenCalledWith({ scope: "all" });
243247});
244248249+it("skips broad plugin preload for json local agent runs", async () => {
250+await runPreAction({
251+parseArgv: ["agent"],
252+processArgv: ["node", "openclaw", "agent", "--local", "--message", "hi", "--json"],
253+});
254+255+expect(ensureConfigReadyMock).toHaveBeenCalledWith({
256+runtime: runtimeMock,
257+commandPath: ["agent", "hi"],
258+suppressDoctorStdout: true,
259+});
260+expect(ensurePluginRegistryLoadedMock).not.toHaveBeenCalled();
261+});
262+245263it("keeps setup alias and channels add manifest-first", async () => {
246264await runPreAction({
247265parseArgv: ["onboard"],
@@ -394,8 +412,8 @@ describe("registerPreActionHooks", () => {
394412395413it("routes logs to stderr in --json mode so stdout stays clean", async () => {
396414await runPreAction({
397-parseArgv: ["agent"],
398-processArgv: ["node", "openclaw", "agent", "--message", "hi", "--json"],
415+parseArgv: ["channels", "send"],
416+processArgv: ["node", "openclaw", "channels", "send", "--json"],
399417});
400418401419expect(routeLogsToStderrMock).toHaveBeenCalledOnce();
@@ -484,8 +502,8 @@ describe("registerPreActionHooks", () => {
484502});
485503486504await runPreAction({
487-parseArgv: ["agent"],
488-processArgv: ["node", "openclaw", "agent", "--local", "--message", "hi", "--json"],
505+parseArgv: ["channels", "send"],
506+processArgv: ["node", "openclaw", "channels", "send", "--json"],
489507});
490508491509expect(ensurePluginRegistryLoadedMock).toHaveBeenCalled();
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。