import { type DaemonClient } from "../lib/client.js"; import type { ArgsOf, Event, OpArgs, ResultOf } from "../lib/protocol.js"; type TaskArgs = OpArgs["task"]; /** The arguments of `task` action `A`, without the action. */ type Body = Omit, "action">; type Once = { timeoutMs?: number; tag?: string; }; export interface RoostPort { /** Pushed events: subscribe on the daemon and hand each event to `onEvent`. */ subscribe(onEvent: (e: Event) => void): Promise; /** Pushed events, without subscribing; returns the way off. */ listen(onEvent: (e: Event) => void): () => void; /** The place in the stream of the line being handled now. */ position(): number; jobs: { list(args: ArgsOf<"list">): Promise>; /** The list and where its reply was in the stream (events with a higher `position()` came after). */ listAt(args: ArgsOf<"list">): Promise<{ result: ResultOf<"list">; at: number; }>; stop(id: string): Promise>; rm(id: string): Promise>; pin(id: string, pinned: boolean): Promise>; rename(id: string, name: string): Promise>; reorder(ids: string[], key: string): Promise>; respawn(id: string): Promise>; /** M51: sent with a request id, again on the new connection while the daemon restarts. */ reply(args: ArgsOf<"reply">, opts?: Once): Promise>; dispatch(args: ArgsOf<"dispatch">, opts?: Once): Promise>; }; tasks: { list(args?: { project?: string; }): Promise>; add(a: Body<"add">): Promise>; assign(id: number, to: string): Promise>; done(id: number, result?: string): Promise>; drop(id: number): Promise>; release(id: number): Promise>; prepare(id: number): Promise>; start(id: number, launch: Body<"start">["launch"]): Promise>; merge(id: number, mode?: "ff" | "no-ff"): Promise>; back(id: number, note?: string): Promise>; abort(id: number): Promise>; commit(id: number, message?: string): Promise>; /** `dry`: the commands shown; then with the `hash` shown. */ approve(a: Body<"approve">): Promise>; verify(id: number): Promise>; pass(id: number): Promise>; comment(id: number, comment: Body<"comment">["comment"]): Promise>; uncomment(id: number, comment: Body<"uncomment">["comment"]): Promise>; shelve(id: number): Promise>; cleanup(dry: boolean): Promise>; /** `dry`: what it would do; then with the tip shown as `hash`. */ pr(a: Body<"pr">): Promise>; }; concierge: { status(): Promise>; on(launch?: ArgsOf<"dispatch">): Promise>; off(): Promise>; answer(answer: Extract, { action: "answer"; }>["answer"]): Promise>; act(act: boolean): Promise>; undo(): Promise>; /** A question for the concierge; its answer comes as a `concierge` event. */ ask(text: string): Promise>; orders: { list(): Promise>; add(text: string, when?: string): Promise>; rm(id: number): Promise>; }; }; schedules: { list(): Promise>; add(a: ArgsOf<"schedule-add">): Promise>; rm(name: string): Promise>; pause(name: string, paused: boolean): Promise>; run(name: string): Promise>; }; events: { /** The event feed (what happened). */ list(args: ArgsOf<"events">): Promise>; }; } /** The sends that wait through a reconnect: they hold no connection, `via` gives one at each try (M51). */ export type Sends = Pick; export declare function sends(via: (deadline: number) => Promise): Sends; /** * The adapter. `via(deadline)` gives the connection for `reply` and `dispatch` (M51: the hub's * hands the one made again after a restart); by default, this client. */ export declare function roostPort(client: DaemonClient, via?: (deadline: number) => Promise): RoostPort; export {};