import type { Paths } from "../paths.js"; import type { ServerState } from "../server.js"; import { type MachineInfo, type MachineMode, type PairResponse } from "./protocol.js"; /** What a machine says about itself; `started_at` is the running server's when there is one. */ export declare function machineInfo(state?: Pick, publicUrl?: string): Omit; export interface PairInput { url: string; code?: string; token?: string; mode: MachineMode; machine: Omit; previousMachineId?: string; publicKey?: string; fetchImpl?: typeof fetch; timeoutMs?: number; } /** `POST /api/agent/pair`: a pairing code (from the dashboard) or a token becomes a machine id and a machine token. */ export declare function pairMachine(input: PairInput): Promise; export interface LinkCredentials { token: string; machineId: string; url: string; mode: MachineMode; /** The machine's X25519 private key (values the cloud seals to this machine open with it). */ privateKey?: string; } /** Token first (in `.env`, mode 600), then the addressing keys, then `cloud.enabled: true`, so a crash in between never leaves an enabled link without a token. */ export declare function writeLinkCredentials(paths: Paths, credentials: LinkCredentials): void; /** The reverse order: the link is disabled first; the spool is deleted; the token goes unless asked to keep it. */ export declare function clearLinkCredentials(paths: Paths, options?: { keepToken?: boolean; }): void; export interface CloudStatusView { enabled: boolean; env_disabled: boolean; url: string; machine_id: string | null; mode: MachineMode; token_present: boolean; server_running: boolean; /** The running server's link state, when a server runs. */ link: import("./link.js").LinkStatusView | null; /** * Whether an organisation API key (`skillhook cloud login`) is kept here for the fleet commands and `skillhook mcp * --cloud`, and the cloud kept with it (null: it has none and goes to the machine's, `url`); never the key. */ api_key: { present: boolean; source: "environment" | "env_file" | null; url: string | null; }; } /** What `skillhook cloud status` and the MCP tool `cloud_status` report; never the token itself. */ export declare function cloudStatus(paths: Paths, env: NodeJS.ProcessEnv): Promise; /** `skillhook cloud disconnect` / MCP `cloud_disconnect`: revoke (best effort), clear the local pairing, tell a running server. */ export declare function disconnectCloud(paths: Paths, env: NodeJS.ProcessEnv, options?: { keepToken?: boolean; notify?: (baseUrl: string) => Promise; }): Promise<{ url: string; was_enabled: boolean; token_removed: boolean; revoked: boolean; }>; /** Tells the cloud the token is no longer used. Best effort: never throws. */ export declare function revokeToken(url: string, token: string, fetchImpl?: typeof fetch): Promise;