/** * ConnectionPayload content type for ConvosConnections (device → agent * sensor events). * * Mirrors the iOS `ConnectionPayloadCodec` (PR #767): * - Content type: convos.org/connection_payload:1.0 * - Payload: JSON-encoded `ConnectionPayload` * - Fallback: `payload.summary` * - shouldPush: false (silent — agent consumes via dedicated handler) * * The CLI does not model each per-source payload body type. The body is * carried as `{ type, data: unknown }` so we round-trip every known * source unchanged plus any future types iOS may ship before the CLI * gains explicit support. */ import type { ContentTypeId, EncodedContent } from "@xmtp/node-bindings"; import type { ContentCodec } from "@xmtp/content-type-primitives"; import type { DecodedMessage } from "@xmtp/node-sdk"; import type { ConnectionKind } from "./connectionTypes.js"; export declare const ContentTypeConnectionPayload: ContentTypeId; export declare const CONNECTION_PAYLOAD_CURRENT_SCHEMA_VERSION = 1; /** * Source-specific payload body. `type` is one of the known * `ConnectionKind` raw values OR any other string for forward * compatibility with newer iOS builds. */ export interface ConnectionPayloadBody { type: ConnectionKind | (string & {}); data: unknown; } export interface ConnectionPayload { /** Uppercase UUID (Swift's default UUID encoding). */ id: string; schemaVersion: number; source: ConnectionKind; /** Swift `Date` wire value: seconds since 2001-01-01 reference date. */ capturedAt: number; body: ConnectionPayloadBody; } export declare class ConnectionPayloadCodec implements ContentCodec { get contentType(): ContentTypeId; encode(content: ConnectionPayload): EncodedContent; decode(content: EncodedContent): ConnectionPayload; fallback(content: ConnectionPayload): string | undefined; shouldPush(_content: ConnectionPayload): boolean; } /** * Best-effort human-readable summary, mirroring the per-body `summary` * accessor on iOS. Falls back to the body's discriminator when the * payload doesn't carry an explicit summary string. */ export declare function summarizeConnectionPayload(payload: ConnectionPayload): string; export declare function isConnectionPayloadMessage(message: DecodedMessage): boolean; /** * Extract a `ConnectionPayload` from a DecodedMessage whether the codec * was registered at client creation or not. */ export declare function getConnectionPayloadContent(message: DecodedMessage): ConnectionPayload | undefined;