feat: Add first-class infer CLI for inference workflows (#62129)

* refresh infer branch onto latest main

* flatten infer media commands

* fix tts runtime facade export

* validate explicit web search providers

* fix infer auth logout persistence
This commit is contained in:
Tak Hoffman
2026-04-07 07:11:19 -05:00
committed by GitHub
parent dfb6c9c920
commit 97c031a8db
28 changed files with 3724 additions and 28 deletions

View File

@@ -26,9 +26,18 @@ const { registerQaCli } = vi.hoisted(() => ({
}),
}));
const { inferAction, registerCapabilityCli } = vi.hoisted(() => {
const action = vi.fn();
const register = vi.fn((program: Command) => {
program.command("infer").alias("capability").action(action);
});
return { inferAction: action, registerCapabilityCli: register };
});
vi.mock("../acp-cli.js", () => ({ registerAcpCli }));
vi.mock("../nodes-cli.js", () => ({ registerNodesCli }));
vi.mock("../qa-cli.js", () => ({ registerQaCli }));
vi.mock("../capability-cli.js", () => ({ registerCapabilityCli }));
describe("registerSubCliCommands", () => {
const originalArgv = process.argv;
@@ -54,6 +63,8 @@ describe("registerSubCliCommands", () => {
acpAction.mockClear();
registerNodesCli.mockClear();
nodesAction.mockClear();
registerCapabilityCli.mockClear();
inferAction.mockClear();
});
afterEach(() => {
@@ -98,6 +109,17 @@ describe("registerSubCliCommands", () => {
expect(nodesAction).toHaveBeenCalledTimes(1);
});
it("registers the infer placeholder and dispatches through the capability registrar", async () => {
const program = createRegisteredProgram(["node", "openclaw", "infer"], "openclaw");
expect(program.commands.map((cmd) => cmd.name())).toEqual(["infer"]);
await program.parseAsync(["infer"], { from: "user" });
expect(registerCapabilityCli).toHaveBeenCalledTimes(1);
expect(inferAction).toHaveBeenCalledTimes(1);
});
it("replaces placeholder when registering a subcommand by name", async () => {
const program = createRegisteredProgram(["node", "openclaw", "acp", "--help"], "openclaw");

View File

@@ -74,6 +74,11 @@ const entrySpecs: readonly CommandGroupDescriptorSpec<SubCliRegistrar>[] = [
loadModule: () => import("../models-cli.js"),
exportName: "registerModelsCli",
},
{
commandNames: ["infer", "capability"],
loadModule: () => import("../capability-cli.js"),
exportName: "registerCapabilityCli",
},
{
commandNames: ["approvals"],
loadModule: () => import("../exec-approvals-cli.js"),

View File

@@ -22,6 +22,16 @@ const subCliCommandCatalog = defineCommandDescriptorCatalog([
description: "Discover, scan, and configure models",
hasSubcommands: true,
},
{
name: "infer",
description: "Run provider-backed inference commands",
hasSubcommands: true,
},
{
name: "capability",
description: "Run provider-backed inference commands (fallback alias: infer)",
hasSubcommands: true,
},
{
name: "approvals",
description: "Manage exec approvals (gateway or node host)",