mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-24 19:35:28 -06:00
917fd92686
* 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
37 lines
1.3 KiB
TypeScript
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);
|
|
}
|
|
});
|
|
}
|