fix: route agent CLI via gateway

This commit is contained in:
Peter Steinberger
2026-01-06 03:30:27 +01:00
parent e5e8ed4aef
commit 9623bd7763
5 changed files with 342 additions and 9 deletions

View File

@@ -1,6 +1,6 @@
import chalk from "chalk";
import { Command } from "commander";
import { agentCommand } from "../commands/agent.js";
import { agentCliCommand } from "../commands/agent-via-gateway.js";
import { configureCommand } from "../commands/configure.js";
import { doctorCommand } from "../commands/doctor.js";
import { healthCommand } from "../commands/health.js";
@@ -387,9 +387,7 @@ Examples:
program
.command("agent")
.description(
"Talk directly to the configured agent (no chat send; optional delivery)",
)
.description("Run an agent turn via the Gateway (use --local for embedded)")
.requiredOption("-m, --message <text>", "Message body for the agent")
.option(
"-t, --to <number>",
@@ -405,6 +403,11 @@ Examples:
"--provider <provider>",
"Delivery provider: whatsapp|telegram|discord|slack|signal|imessage (default: whatsapp)",
)
.option(
"--local",
"Run the embedded agent locally (requires provider API keys in your shell)",
false,
)
.option(
"--deliver",
"Send the agent's reply back to the selected provider (requires --to)",
@@ -430,9 +433,9 @@ Examples:
typeof opts.verbose === "string" ? opts.verbose.toLowerCase() : "";
setVerbose(verboseLevel === "on");
// Build default deps (keeps parity with other commands; future-proofing).
void createDefaultDeps();
const deps = createDefaultDeps();
try {
await agentCommand(opts, defaultRuntime);
await agentCliCommand(opts, defaultRuntime, deps);
} catch (err) {
defaultRuntime.error(String(err));
defaultRuntime.exit(1);