/** * Utilities extracted from @xmtp/cli that convos-cli needs. * * The published @xmtp/cli@0.1.0 only exports { run } — these small * helpers are inlined here so convos-cli can be used with the official * npm package instead of a local fork. */ import { Dm, Group, type DecodedMessage, type Conversation } from "@xmtp/node-sdk"; import { type ConversationCustomMetadata } from "./metadata.js"; import { type ResolvedProfile } from "./profileMessages.js"; export declare function isGroup(conversation: Conversation): conversation is Group; export declare function isDm(conversation: Conversation): conversation is Dm; export declare function requireGroup(conversation: Conversation): Group; export declare function requireDm(conversation: Conversation): Dm; export declare function toHexBytes(hex: string): Uint8Array; export declare function hexToBytes(value: string): Uint8Array; export declare function getAccountAddress(walletKey: string): string; export declare const VALID_ENVS: readonly ["local", "dev", "production"]; /** Map of inboxId (lowercase) → display name. */ export type ProfileMap = Map; /** * Build a ProfileMap from a Group's appData (legacy fallback). */ export declare function buildProfileMap(appData: string): ProfileMap; /** * Build a ProfileMap from both profile messages (primary) and appData (fallback). * Profile messages take precedence over appData. */ export declare function buildProfileMapFromMessages(group: Group, appData: string): Promise; /** Sender profile info included in agent message events. */ export interface SenderProfile { name?: string; image?: string; } /** * Look up a sender's profile from the group's appData (legacy fallback). * Returns a SenderProfile with whatever fields are available, or * undefined if no profile exists for the given inbox ID. */ export declare function getSenderProfile(appData: string, senderInboxId: string): SenderProfile | undefined; /** * Look up a sender's profile from message-sourced profiles first, * falling back to appData. */ export declare function getSenderProfileFromResolved(resolvedProfiles: Map, appData: string, senderInboxId: string): SenderProfile | undefined; /** * Diff two ConversationCustomMetadata objects and produce human-readable * descriptions of what changed (profile updates, invite tag rotation, expiration). * * A single app data update should realistically contain one logical change * (e.g. one person updated their profile, or an invite tag was rotated). * If the profile diff is too complex (more than one profile changed), the * profile descriptions are dropped, but tag and expiration changes are * still reported. * * @param oldMeta - previous metadata (may be empty) * @param newMeta - current metadata * @param initiator - display name of the person who made the change * @param profiles - profile map for resolving inbox IDs to names */ export declare function describeAppDataChange(oldMeta: ConversationCustomMetadata, newMeta: ConversationCustomMetadata, initiator: string, profiles: ProfileMap): string[]; /** * Returns true if the message has a content type we know how to display. * Use this to filter out unknown/binary content types from streams. * Profile messages (ProfileUpdate, ProfileSnapshot) are filtered out — * they are silent metadata messages, not user-visible content. */ export declare function isDisplayableMessage(message: DecodedMessage): boolean; /** * Normalize message content to a string for display. NAPI-backed objects * (like GroupUpdated) don't have enumerable properties, so JSON.stringify * produces `{}` or they coerce to `[object Object]`. This function always * returns a string safe for display. * * @param profiles - optional ProfileMap for resolving inbox IDs to names. * When omitted, unresolved members appear as "Somebody". * @param depth - recursion depth (used internally to limit reply nesting). * Callers should not set this; it defaults to 0 and caps at 1 so that * only the immediate parent of a reply is resolved. */ export declare function normalizeMessageContent(message: DecodedMessage, profiles?: ProfileMap, depth?: number): string; export declare function isTTY(): boolean; export declare function jsonStringify(data: unknown, pretty?: boolean): string; export declare function formatHuman(data: unknown, indent?: number): string; export interface Section { title: string; data: Record; } export declare function formatSections(sections: Section[], indent?: number): string;