fix(agent): align tools + preserve indentation

This commit is contained in:
Peter Steinberger
2026-01-05 17:55:20 +00:00
parent 196eb86e38
commit 7c89ce93b5
12 changed files with 88 additions and 46 deletions

View File

@@ -424,7 +424,11 @@ async function maybeInstallDaemon(params: {
if (shouldCheckLinger) {
await ensureSystemdUserLingerInteractive({
runtime: params.runtime,
prompter: { confirm, note },
prompter: {
confirm: async (p) =>
guardCancel(await confirm(p), params.runtime) === true,
note,
},
reason:
"Linux installs use a systemd user service. Without lingering, systemd stops the user session on logout/idle and kills the Gateway.",
requireConfirm: true,

View File

@@ -31,13 +31,13 @@ import type { RuntimeEnv } from "../runtime.js";
import { defaultRuntime } from "../runtime.js";
import { resolveUserPath, sleep } from "../utils.js";
import { healthCommand } from "./health.js";
import { ensureSystemdUserLingerInteractive } from "./systemd-linger.js";
import {
applyWizardMetadata,
DEFAULT_WORKSPACE,
guardCancel,
printWizardHeader,
} from "./onboard-helpers.js";
import { ensureSystemdUserLingerInteractive } from "./systemd-linger.js";
function resolveMode(cfg: ClawdbotConfig): "local" | "remote" {
return cfg.gateway?.mode === "remote" ? "remote" : "local";
@@ -612,7 +612,7 @@ export async function doctorCommand(runtime: RuntimeEnv = defaultRuntime) {
await ensureSystemdUserLingerInteractive({
runtime,
prompter: {
confirm: (params) => guardCancel(confirm(params), runtime),
confirm: async (p) => guardCancel(await confirm(p), runtime) === true,
note,
},
reason:

View File

@@ -13,7 +13,6 @@ import { resolveGatewayService } from "../daemon/service.js";
import type { RuntimeEnv } from "../runtime.js";
import { defaultRuntime } from "../runtime.js";
import { resolveUserPath, sleep } from "../utils.js";
import { ensureSystemdUserLingerNonInteractive } from "./systemd-linger.js";
import { healthCommand } from "./health.js";
import { applyMinimaxConfig, setAnthropicApiKey } from "./onboard-auth.js";
import {
@@ -27,6 +26,7 @@ import type {
OnboardMode,
OnboardOptions,
} from "./onboard-types.js";
import { ensureSystemdUserLingerNonInteractive } from "./systemd-linger.js";
export async function runNonInteractiveOnboarding(
opts: OnboardOptions,

View File

@@ -7,9 +7,10 @@ import {
import type { RuntimeEnv } from "../runtime.js";
export type LingerPrompter = {
confirm?: (params: { message: string; initialValue?: boolean }) => Promise<
boolean
>;
confirm?: (params: {
message: string;
initialValue?: boolean;
}) => Promise<boolean>;
note: (message: string, title?: string) => Promise<void> | void;
};
@@ -43,10 +44,7 @@ export async function ensureSystemdUserLingerInteractive(params: {
const actionNote = params.requireConfirm
? "We can enable lingering now (needs sudo; writes /var/lib/systemd/linger)."
: "Enabling lingering now (needs sudo; writes /var/lib/systemd/linger).";
await prompter.note(
`${reason}\n${actionNote}`,
title,
);
await prompter.note(`${reason}\n${actionNote}`, title);
if (params.requireConfirm && prompter.confirm) {
const ok = await prompter.confirm({
@@ -68,10 +66,7 @@ export async function ensureSystemdUserLingerInteractive(params: {
sudoMode: "prompt",
});
if (result.ok) {
await prompter.note(
`Enabled systemd lingering for ${status.user}.`,
title,
);
await prompter.note(`Enabled systemd lingering for ${status.user}.`, title);
return;
}