import { type CompletionResult, type ParsedArgs } from "@cotal-ai/core"; import { type MeshTarget } from "@cotal-ai/workspace"; import { type FrontEnd } from "../chat/frontend.js"; import type { CloseReport } from "../chat/session.js"; export declare const chatFlags: readonly [{ readonly name: "space"; readonly short: "s"; readonly type: "string"; readonly value: ""; readonly description: "target space (default: the resolved mesh)"; }, { readonly name: "server"; readonly type: "string"; readonly value: ""; readonly description: "broker URL (overrides the mesh registry entry)"; }, { readonly description: "an explicit credential file (not available for chat yet)"; readonly name: "creds"; readonly type: "string"; readonly value: ""; }, { readonly name: "plain"; readonly type: "boolean"; readonly description: "plain line-oriented output"; }, { readonly name: "stdio"; readonly type: "boolean"; readonly description: "exchange the NDJSON participant protocol on stdin and stdout instead of the terminal view"; }, { readonly name: "name"; readonly type: "string"; readonly value: ""; readonly description: "the session's display label (default: @ and a short suffix)"; }, { readonly name: "role"; readonly type: "string"; readonly value: ""; readonly description: "a presence role (not available for chat yet)"; }, { readonly name: "kind"; readonly type: "string"; readonly value: ""; readonly description: "the session's presence kind; only endpoint, the default, is accepted"; }, { readonly name: "link"; readonly type: "string"; readonly value: ""; readonly description: "the space and auth from a join link (not available for chat yet)"; }, { readonly name: "token"; readonly type: "string"; readonly value: ""; readonly description: "the space and auth from a join token (not available for chat yet)"; }, { readonly name: "lifecycle-uid"; readonly type: "string"; readonly value: ""; readonly description: "the lifecycle UID paired with --creds (not available for chat yet)"; }]; /** A user-mode session asks for the auth service's whole lifetime cap, 8 hours, which it never * extends. Each bearer within it still lasts at most 15 minutes. */ export declare const USER_CHAT_TTL_SEC: number; export interface ChatInput { readonly channel?: string; readonly label?: string; readonly frontEnd: FrontEnd; } /** Check the grammar and choose the front end, before any target, connector or connection. */ export declare function chatArguments(args: ParsedArgs): ChatInput; /** What one admission asks for, by the target's recorded mode. A named channel is the session's * initial channel, read ceiling and post list. Without one, an authenticated session starts on no * channel and can neither join nor post to one; an open session routes anywhere. */ export type ChatAdmission = { readonly mode: "open"; readonly label: string; readonly channels: readonly string[]; } | { readonly mode: "auth"; readonly label: string; readonly subscribe: readonly string[]; readonly allowPublish: readonly string[]; } | { readonly mode: "user"; readonly label: string; readonly channels: readonly string[]; readonly read: readonly string[]; readonly post: readonly string[]; readonly ttlSec: number; }; export declare function chatAdmission(mode: MeshTarget["mode"], label: string, channel: string | undefined): ChatAdmission; /** The exit code of a session that ended by leaving, end of input, expiry or loss. Only a confirmed * close is 0. A session that ended itself because it could not continue is 5. Retirement asked * for and not confirmed is 4. An unknown outcome, an unconfirmed connection close, or no close * report is 3. */ export declare function closeExitCode(close: CloseReport | undefined): number; /** Hold SIGINT, SIGTERM and SIGHUP until a front end has installed its own handling, so no signal * kills the process while a session is being admitted or is admitted. The first signal is kept and * later ones are absorbed. */ export declare function holdSignals(): { readonly caught: () => number | undefined; readonly release: () => void; }; /** The line that discloses a named channel before admission. `registered` is undefined when the * registry could not be read. */ export declare function channelDisclosure(channel: string, registered: boolean | undefined): string; export declare function chat(args: ParsedArgs): Promise; /** Complete `--space` from the registry and the channel from the target mesh's persona catalog, * offline. Other values have nothing to offer. */ export declare function chatComplete(argv: string[]): CompletionResult; //# sourceMappingURL=chat.d.ts.map