























@@ -437,6 +437,26 @@ describe("capability cli", () => {
437437expect(mocks.runtime.writeJson).not.toHaveBeenCalled();
438438});
439439440+it.each(["", " ", "\n\t"])(
441+"rejects empty model run prompts before local dispatch (%j)",
442+async (prompt) => {
443+await expect(
444+runRegisteredCli({
445+register: registerCapabilityCli as (program: Command) => void,
446+argv: ["capability", "model", "run", "--prompt", prompt, "--json"],
447+}),
448+).rejects.toThrow("exit 1");
449+450+expect(mocks.runtime.error).toHaveBeenCalledWith(
451+expect.stringContaining("--prompt cannot be empty or whitespace-only."),
452+);
453+expect(mocks.prepareSimpleCompletionModelForAgent).not.toHaveBeenCalled();
454+expect(mocks.completeWithPreparedSimpleCompletionModel).not.toHaveBeenCalled();
455+expect(mocks.callGateway).not.toHaveBeenCalled();
456+expect(mocks.runtime.writeJson).not.toHaveBeenCalled();
457+},
458+);
459+440460it("runs gateway model probes without chat-agent prompt policy or tools", async () => {
441461await runRegisteredCli({
442462register: registerCapabilityCli as (program: Command) => void,
@@ -455,6 +475,21 @@ describe("capability cli", () => {
455475);
456476});
457477478+it("rejects empty model run prompts before gateway dispatch", async () => {
479+await expect(
480+runRegisteredCli({
481+register: registerCapabilityCli as (program: Command) => void,
482+argv: ["capability", "model", "run", "--prompt", " ", "--gateway", "--json"],
483+}),
484+).rejects.toThrow("exit 1");
485+486+expect(mocks.runtime.error).toHaveBeenCalledWith(
487+expect.stringContaining("--prompt cannot be empty or whitespace-only."),
488+);
489+expect(mocks.callGateway).not.toHaveBeenCalled();
490+expect(mocks.runtime.writeJson).not.toHaveBeenCalled();
491+});
492+458493it("defaults tts status to gateway transport", async () => {
459494await runRegisteredCli({
460495register: registerCapabilityCli as (program: Command) => void,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。