mirror of
https://github.com/getpaseo/paseo.git
synced 2026-11-06 08:24:46 +00:00
Restart reconstructed launch inputs and address fallback could redirect a home-selected shutdown to another daemon. Let supervisors publish bound endpoints, retain their worker restart contract, and share captured local lifecycle ownership between CLI and Desktop.
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
import type { Command } from "commander";
|
|
import type { ListResult } from "../../output/index.js";
|
|
import {
|
|
createScheduleInspectRows,
|
|
createScheduleInspectSchema,
|
|
type ScheduleInspectRow,
|
|
} from "./schema.js";
|
|
import {
|
|
connectScheduleClient,
|
|
toScheduleCommandError,
|
|
type ScheduleCommandOptions,
|
|
} from "./shared.js";
|
|
|
|
export async function runInspectCommand(
|
|
id: string,
|
|
options: ScheduleCommandOptions,
|
|
_command: Command,
|
|
): Promise<ListResult<ScheduleInspectRow>> {
|
|
const { client } = await connectScheduleClient(options.daemonTarget);
|
|
try {
|
|
const payload = await client.scheduleInspect({ id });
|
|
if (payload.error || !payload.schedule) {
|
|
throw new Error(payload.error ?? `Schedule not found: ${id}`);
|
|
}
|
|
if (payload.schedule.target.type !== "new-agent") {
|
|
throw new Error(`Schedule not found: ${id}`);
|
|
}
|
|
const rows = createScheduleInspectRows(payload.schedule);
|
|
return {
|
|
type: "list",
|
|
data: rows,
|
|
schema: createScheduleInspectSchema(payload.schedule),
|
|
};
|
|
} catch (error) {
|
|
throw toScheduleCommandError("SCHEDULE_INSPECT_FAILED", "inspect schedule", error);
|
|
} finally {
|
|
await client.close().catch(() => {});
|
|
}
|
|
}
|