Files
openclaw/src/cli/resume-cli.ts
T
Peter Steinberger 917fd92686 feat(cli): openclaw resume attaches the TUI to a recent session (#120664)
* feat(cli): openclaw resume attaches the TUI to a recent session

Implements docs/plan/runners.md milestone 2.

* fix(cli): resume covers global sessions and preflights TTY

* fix(cli): require a terminal before resume

* fix(cli): adapt resume gateway disconnect state

* fix(cli): preserve global resume ownership

* test(cli): prove qualified global resume crosses the gateway boundary
2026-08-09 02:52:06 -07:00

37 lines
1.3 KiB
TypeScript

// Registers the recent-session resume verb while keeping its TUI runtime lazy.
import type { Command } from "commander";
import { formatDocsLink } from "../../packages/terminal-core/src/links.js";
import { theme } from "../../packages/terminal-core/src/theme.js";
import { defaultRuntime } from "../runtime.js";
import { addTuiOptions } from "./tui-cli-options.js";
export type ResumeCliOptions = {
url?: string;
token?: string;
password?: string;
tlsFingerprint?: string;
};
/** Register the Gateway-backed session resume command. */
export function registerResumeCli(program: Command) {
const command = program
.command("resume")
.description("Resume a recent Gateway session in the TUI")
.argument("[query]", "Session key, display name, or label");
addTuiOptions(command)
.addHelpText(
"after",
() =>
`\n${theme.muted("Docs:")} ${formatDocsLink("/cli/resume", "docs.openclaw.ai/cli/resume")}\n`,
)
.action(async (query: string | undefined, opts: ResumeCliOptions) => {
try {
const { runResumeCommand } = await import("./resume-cli.runtime.js");
await runResumeCommand(query, opts);
} catch (error) {
defaultRuntime.error(String(error));
defaultRuntime.exit(1);
}
});
}