import { type EditRequest } from "./editVerb.js"; import type { AttachRecord } from "../../debugger/attach/registry.js"; import type { DebuggerCommand } from "../../debugger/types.js"; import { readSourceMap, sourceAround, sourcePathFor } from "./readers.js"; import type { Visit } from "./visit.js"; export type CommandResult = { text: string; json: unknown; exitCode: number; }; /** 0 an answer, 1 a refusal, 2 the program ended, 3 `wait` ran out. */ export declare const EXIT: { readonly ok: 0; readonly refused: 1; readonly ended: 2; readonly stillRunning: 3; }; export type CommandDeps = { cwd: string; readSourceMap: typeof readSourceMap; sourcePathFor: typeof sourcePathFor; sourceAround: typeof sourceAround; /** How long a moving verb waits for the next stop before saying the * program is running. */ moveWaitMs: number; }; export declare const defaultCommandDeps: (cwd: string) => CommandDeps; export type SessionCommand = { name: "where"; } | { name: "frame"; index?: number; globals: boolean; } | { name: "stack"; } | { name: "threads"; } | { name: "thread"; label?: string; last: number; } | { name: "branches"; } | { name: "branch"; key: string; } | { name: "guards"; } | { name: "source"; context: number; } | { name: "checkpoints"; } | { name: "step"; } | { name: "next"; } | { name: "in"; } | { name: "out"; } | { name: "continue"; } | { name: "wait"; forMs: number; } | { name: "pause"; } | { name: "back"; } | { name: "rewind"; id: number; } | { name: "set"; varName: string; value: unknown; } | { name: "checkpoint"; label?: string; } | { name: "save"; path: string; } | { name: "load"; path: string; } | { name: "answer"; value: unknown; } | ({ name: "edit"; } & EditRequest) | { name: "detach"; }; export declare function where(visit: Visit, record: AttachRecord, deps: CommandDeps): CommandResult; export declare function frame(visit: Visit, record: AttachRecord, index: number | undefined, globals: boolean): CommandResult; export declare function stack(visit: Visit, record: AttachRecord): CommandResult; export declare function threads(visit: Visit, record: AttachRecord): CommandResult; export declare function thread(visit: Visit, record: AttachRecord, label: string | undefined, last: number): CommandResult; export declare function branches(visit: Visit, record: AttachRecord): CommandResult; export declare function branch(visit: Visit, record: AttachRecord, key: string): CommandResult; export declare function guards(visit: Visit, record: AttachRecord): CommandResult; export declare function source(visit: Visit, record: AttachRecord, context: number, deps: CommandDeps): CommandResult; /** How long `continue` waits after its reply for the run to refuse it * (another party answered the stop first) before reporting the program * running. The refusal comes with the reply's round trip; a stop may * not come for an hour. */ export declare const ANSWER_GRACE_MS = 300; /** Answer the pending request with `command` and report what followed: * `where` at the next stop, the refusal when another party answered * first, the program's end, or that it is running. */ export declare function move(visit: Visit, record: AttachRecord, command: DebuggerCommand, deps: CommandDeps, waitMs: number): Promise; export declare function moveVerb(visit: Visit, record: AttachRecord, name: "step" | "next" | "in" | "out" | "continue" | "back", deps: CommandDeps): Promise; /** Reply to the question the program is waiting on, a guard trip, a * node's arguments, or `input()`, with `value` as the answer. The run * checks the answer's shape for the question and drops the visit on a * wrong one, so the shape is checked here first. */ export declare function answer(visit: Visit, record: AttachRecord, value: unknown, deps: CommandDeps): Promise; export declare function wait(visit: Visit, record: AttachRecord, forMs: number, deps: CommandDeps): Promise; export declare function pause(visit: Visit, record: AttachRecord): CommandResult; /** `edit`: with no action, the edits this stop takes; with one, queue it * and print the driver's line for what it will change; `--drop` clears * the queue. The rows and flags come from the debugger's action table, * so an agent sees the edits a person sees on the pane rows. */ export declare function edit(visit: Visit, record: AttachRecord, request: EditRequest, deps: CommandDeps): Promise; export declare function set(visit: Visit, record: AttachRecord, varName: string, value: unknown, deps: CommandDeps): Promise; export declare function checkpoint(visit: Visit, record: AttachRecord, label: string | undefined, deps: CommandDeps): Promise; export declare function saveOrLoad(visit: Visit, record: AttachRecord, name: "save" | "load", filePath: string, deps: CommandDeps): Promise; /** The rolling window and the pinned checkpoints: the stop is answered * with `showCheckpoints`, the driver asks the visit to show the panel, * and the visit prints the list instead and closes the panel. */ export declare function checkpoints(visit: Visit, record: AttachRecord, deps: CommandDeps): Promise; /** Rewind to the checkpoint with `id`: the stop is answered with * `rewind`, the driver asks the visit to pick one, and the visit picks * by id. */ export declare function rewind(visit: Visit, record: AttachRecord, id: number, deps: CommandDeps): Promise; /** Leave the session: the CLI's hold is released. With no terminal * attached the program runs on with no debugger; with one, the * terminal keeps driving, and the program stays where it is. */ export declare function detach(visit: Visit, record: AttachRecord): CommandResult;