import { CotalEndpoint, type ParsedArgs } from "@cotal-ai/core"; import { type Connection, type OutputWarning } from "@cotal-ai/workspace"; export declare const historyFlags: 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 name: "creds"; readonly type: "string"; readonly value: ""; readonly description: "creds file for an off-registry connection"; }, { readonly name: "dms"; readonly type: "boolean"; readonly description: "also read DM history (needs a DM read grant); with clear, also clear DMs"; }, { readonly name: "force"; readonly type: "boolean"; readonly description: "removed spelling; use history clear --yes"; }, { readonly name: "yes"; readonly short: "y"; readonly type: "boolean"; readonly description: "clear: confirm the selected space-wide purge without prompting"; }, { readonly name: "dry-run"; readonly type: "boolean"; readonly description: "clear: show the selected target and streams without connecting; purge nothing. A space that is prepared but not started is refused"; }, { readonly name: "since"; readonly type: "string"; readonly value: ""; readonly description: "only messages after a time (ISO 8601, or an age such as 30m, 2h, 1d) or a chat stream sequence"; }, { readonly name: "limit"; readonly type: "string"; readonly value: ""; readonly description: "how many of the newest retained messages to read, 1 to 1000 (default 50)"; }, { readonly name: "from"; readonly type: "string"; readonly value: ""; readonly description: "keep messages from this sender name or id (filters the window)"; }, { readonly name: "grep"; readonly type: "string"; readonly value: ""; readonly description: "keep messages whose text contains this, case-insensitive (filters the window)"; }, { readonly name: "follow"; readonly type: "boolean"; readonly description: "keep listening and print each new message (NDJSON with --json)"; }, { readonly name: "json"; readonly short: "j"; readonly type: "boolean"; readonly description: "structured output on stdout"; }, { readonly name: "plain"; readonly type: "boolean"; readonly description: "plain line-oriented output"; }]; /** One retained message as `history` reports it. `seq` is the chat stream sequence; DMs and reads * mediated by the delivery daemon carry none. */ export interface HistoryItem { readonly seq: number | null; readonly id: string; readonly ts: string; readonly channel: string | null; readonly to: string | null; readonly from: { readonly id: string; readonly name: string; }; readonly text: string; } /** What `cotal history` read: the newest `limit` retained messages of its selection, oldest first, * then filtered by `--since`, `--from` and `--grep`. It never claims complete history: `olderRetained` * says whether retained messages older than the window exist, `reachesSince` whether the window goes * back to `--since`, and `retention` names the limits that remove messages and each sender whose * older messages a channel has lost to them. */ export interface HistoryResult { readonly kind: "history"; readonly channels: string[]; readonly dms: boolean; readonly window: { readonly limit: number; readonly read: number; readonly olderRetained: boolean | null; readonly since: string | null; readonly reachesSince: boolean | null; readonly from: string | null; readonly grep: string | null; }; readonly retention: { readonly perSender: number | null; readonly maxAgeMs: number | null; readonly gaps: { readonly channel: string; readonly sender: string; readonly name: string | null; readonly retained: number; }[]; } | null; readonly replay: { readonly channel: string; readonly replay: boolean | null; readonly window: string | null; }[]; readonly denied: string[]; readonly items: HistoryItem[]; } type Since = { kind: "seq"; seq: number; text: string; } | { kind: "time"; ms: number; text: string; }; /** Pure input checks run before shared target preparation or credential issuance. */ export declare function validateHistoryArguments(args: ParsedArgs): void; /** `cotal history [channel]`: the newest retained messages in the selected space within the caller's * read grant, or `history clear`. */ export declare function history(args: ParsedArgs): Promise; interface WindowRequest { readonly channel: string | undefined; readonly dms: boolean; readonly limit: number; readonly since: Since | undefined; readonly from: string | undefined; readonly grep: string | undefined; readonly target: unknown; } export declare function readWindow(ep: CotalEndpoint, conn: Connection, req: WindowRequest): Promise<{ result: HistoryResult; warnings: OutputWarning[]; }>; export {}; //# sourceMappingURL=history.d.ts.map