import { type AgentDependencies } from "./agents.js"; import { type CodingAgentId } from "./coding-agents.js"; import { type RuntimeFound, type RuntimeId, type RuntimeSniffContext } from "./runtime-sniff.js"; import { type HostedMcp } from "./hosted-mcp.js"; import { type RelayConsoleSession } from "./config.js"; import { type InteractivePrompts } from "./interactive.js"; import { CliError, type CliErrorCode } from "./error-codes.js"; import { type TerminalObserver } from "./terminal-watch.js"; /** Still used by agent-driver.ts for its Claude plugin hint. */ export declare const CLAUDE_PLUGIN_ID = "relay@relay-messenger"; export declare const REPLY_TIMEOUT_MS = 300000; export { MCP_SERVER_NAME } from "./hosted-mcp.js"; /** Our plugins for the two gateways, as Relay-Docs integrations/hermes.mdx and openclaw.mdx install them. */ export declare const HERMES_PLUGIN_SOURCE = "RelayMessenger/Relay-Hermes"; export declare const openclawPluginSpec: (version?: string) => string; /** The one required choice when no runtime was named and stdin is unavailable. */ export declare const NO_TTY_SENTENCE = "Interactive prompt required but stdin is not a TTY. Nothing was connected."; export declare const NO_TTY_NEXT_STEP = "Name the runtime, or use --json for machine-readable output."; export interface ConnectOptions { new?: boolean; handle?: string; name?: string; subtitle?: string; description?: string; image?: string; /** A PNG or JPEG on this computer; `--image` also takes an https:// address. */ avatar?: string; token?: string; allow?: string; yes?: boolean; dryRun?: boolean; /** Commander delivers `--no-start` and `--no-skill` as false. */ start?: boolean; skill?: boolean; json?: boolean; apiUrl?: string; /** The caller said never to ask (`--non-interactive`), so the plan is stated, not put as a question. */ nonInteractive?: boolean; } export interface ConnectCommandResult { code: number; stdout: string; stderr: string; } export interface ConnectDependencies { agents: AgentDependencies; env: NodeJS.ProcessEnv; home: string; cwd: string; platform?: NodeJS.Platform; profile?: string; stdout(value: string): void; stderr(value: string): void; /** Absent means there is no terminal, so nothing may be asked. */ prompts?: InteractivePrompts; /** The runtime this command is running inside, when one announced itself. */ drivingAgent?: RuntimeId; sniff?: (context: RuntimeSniffContext) => Promise; /** Runs one of the agent's own commands and waits for it. */ runCommand?: (file: string, args: readonly string[]) => Promise; /** Hands this terminal to the agent. */ startCommand?: (file: string, args: readonly string[]) => Promise; observer?: (token: string, apiURL: string) => TerminalObserver | undefined; /** * Keeps answering this agent's Relay messages with the runtime's own * headless command, until the person stops it. Codex reaches it over its * `app-server` (`kind: "codex"`, coding-agents/codex.ts); Cursor, Gemini CLI * and OpenCode reach it over the Agent Client Protocol (`kind: "acp"`, * coding-agents/{cursor,gemini-cli,opencode}.ts). */ bridge?: (input: { kind: "codex" | "acp" | "pi" | "claude"; token: string; apiURL: string; /** The agent that answers, so its threads or sessions are kept apart from another's. */ handle: string; command: string; /** For an ACP agent, the words that put it in ACP mode, e.g. ["acp"]. */ acpArgs?: readonly string[]; /** Relay's hosted MCP server, handed to the agent's session with this * agent's token, so its tools travel with it (hosted-mcp.ts). */ mcpURL: string; label: string; cwd: string; say(line: string): void; }) => Promise; renderQR?: (url: string) => string; version?: string; fetch?: typeof globalThis.fetch; offerSkill?: () => Promise; /** Authenticated Console session used when a new organization Agent is created. */ consoleLogin?: () => Promise; /** Console API request boundary for organization-owned Agent creation. */ consoleRequest?: (path: string, init?: RequestInit) => Promise; } /** * A failure a person can act on: the sentence, and the next thing to run. The * next thing sits inside the sentence, because the envelope's `next_step` is * one fixed sentence per code (error-codes.ts). */ export declare class ConnectFailure extends CliError { readonly nextStep: string; constructor(message: string, nextStep: string, code?: CliErrorCode); } export interface ConnectAgent { profile: string; handle: string; displayName: string; apiURL: string; shareURL: string; token: string; created: boolean; } /** Derive Relay's default handle from an optional display name flag. */ export declare const handleFromName: (name: string) => string | undefined; /** The avatar's path when it is a PNG or JPEG that exists; undefined otherwise. */ export declare const avatarFile: (input: string, context: { cwd: string; home: string; }) => string | undefined; /** The line a re-run in a linked folder says, and the flag that makes another agent. */ export declare const linkedLine: (handle: string) => string; export declare const SAY_HI = "Say hi from your phone"; /** What one runtime's part of the plan touches. */ export interface AgentPlan { agent: CodingAgentId; steps: string[]; /** The files this command writes for that agent, in full. */ files: string[]; /** The agent's own commands this command runs, as one line each. */ commands: string[]; } export interface ConnectPlan { headline: string; steps: string[]; agents: AgentPlan[]; } export interface PlanContext { env: NodeJS.ProcessEnv; home: string; platform: NodeJS.Platform; version: string; /** The folder connect runs in: the project scope of an agent that has one. */ cwd: string; handle: string; /** What the person allowed with --allow, when anything. */ allow: readonly string[]; /** The agent's token and API address, once an agent exists: OpenClaw's own * `channels add` takes them as flags. Absent before an agent exists. */ token?: string; apiURL?: string; start: boolean; /** The agents whose file already holds a token for someone else. */ replacing?: Partial>; /** Codex's own config still runs the retired local Relay MCP server as * `relay` (`retiredCodexServer`), so connect replaces that entry. */ retiredCodexServer?: boolean; /** Present when the plan creates a new agent: what was chosen for it, when anything was. */ create?: AgentIdentity; /** How a command or a path is marked inside a step. Absent means unmarked, so * every caller that prints the steps as data gets them byte for byte. */ mark?: (value: string) => string; } /** Relay's hosted MCP server as this agent reaches it: the server of the API * the agent lives on, and the agent's own token (hosted-mcp.ts). */ export declare const hostedMcp: (context: { version: string; token: string; apiURL?: string; }) => HostedMcp; export declare const hermesStateDir: (context: PlanContext) => string; /** A command line a person may read: the value after `--token` is never shown. */ export declare const shownCommandLine: (words: readonly string[]) => string; /** The agent's own command lines, exactly as this command runs them. */ export declare const agentCommands: (agent: CodingAgentId, context: PlanContext) => string[][]; /** The files this command writes for the agent, in full. */ export declare const agentFiles: (agent: CodingAgentId, context: PlanContext) => string[]; /** * Every file this command writes and every command it runs for one agent, as * the lines the plan screen shows. */ export declare const agentPlan: (agent: CodingAgentId, context: PlanContext) => AgentPlan; /** What a person chose for a new agent; every field is optional. */ export interface AgentIdentity { handle?: string; name?: string; subtitle?: string; description?: string; /** A resolved path to a PNG or JPEG on this computer. */ avatar?: string; } /** The plan's first line when an agent will be created: unchanged when nothing * was chosen; otherwise the handle, the name, and the rest as dim words. */ export declare const createLine: (create: AgentIdentity | undefined, mark?: (value: string) => string) => string; /** * Every file this command writes and every command it runs, for every chosen * agent, on one screen before anything changes. */ export declare const runtimeConnectPlan: (input: PlanContext & { agents: readonly CodingAgentId[]; ask?: boolean; }) => ConnectPlan; /** * True when Codex's own `config.toml` still lists `relay` as the retired local * package (`npx -y @relaymessenger/mcp …`, written by earlier versions of this * command through `codex mcp add`). A `relay` entry that is anything else is * the person's own and is never touched. An unreadable file counts as none. */ export declare const hasRetiredCodexServer: (home: string, platform?: NodeJS.Platform) => Promise; /** * Adds `mcpServers.relay` to Cline's MCP settings file, every other entry * kept (hosted-mcp.ts, `clineMcpEntry`). The entry holds the agent's token, so * the file is written owner-only on every platform (private-file.ts). */ export declare const writeMcpSettingsEntry: (path: string, mcp: HostedMcp, platform?: NodeJS.Platform) => Promise; /** Adds `.relay` to an agent's MCP config file, every other entry * kept. The entry carries the agent's token, so the file is written owner-only. */ export declare const writeMcpFileEntry: (path: string, shape: "vscode", mcp: HostedMcp) => Promise; export declare const runConnect: (requested: string | undefined, options: ConnectOptions, deps: ConnectDependencies) => Promise; //# sourceMappingURL=connect.d.ts.map