/** * CapabilityRequest content type for ConvosConnections capability * resolution (agent → device "may I have this capability?"). * * Mirrors the iOS `CapabilityRequestCodec` (PR #771): * - Content type: convos.org/capability_request:1.0 * - Payload: JSON-encoded `CapabilityRequest` * - Fallback: `"The assistant is requesting access to your "` * - shouldPush: false (silent — surfaces via the picker UI) * * The device routes the request into `CapabilityResolver`, which * shows a picker / confirmation card. The user's choice arrives back * as a `CapabilityRequestResult` keyed on the same `requestId`. */ 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 { CapabilitySubject, ProviderID } from "./capabilityTypes.js"; import type { ConnectionCapability } from "./connectionTypes.js"; export declare const ContentTypeCapabilityRequest: ContentTypeId; /** Highest schema version this codec understands. */ export declare const CAPABILITY_REQUEST_SUPPORTED_VERSION = 1; /** Cap on the rationale string. Anything longer is truncated on encode and decode. */ export declare const CAPABILITY_REQUEST_MAX_RATIONALE_LENGTH = 500; /** Cap on preferredProviders entries. Anything longer is truncated on encode and decode. */ export declare const CAPABILITY_REQUEST_MAX_PREFERRED_PROVIDERS = 16; export interface CapabilityRequest { /** Schema version. Must equal `CAPABILITY_REQUEST_SUPPORTED_VERSION` (1) for now. */ version: number; /** Caller-supplied correlation ID echoed back on the result. */ requestId: string; /** * Inbox ID of the agent that issued the request. Required so receivers * (and any other agents in a multi-agent group) can distinguish whose * request this is, and so subsequent grants can be targeted via * `ConnectionEvent.grantedToInboxId`. Mirrors convos-ios#812. */ askerInboxId: string; subject: CapabilitySubject; capability: ConnectionCapability; /** Free-form human-readable reason; rendered verbatim on the picker card. */ rationale: string; /** * Optional agent hint — provider IDs the agent has previously seen * in `profile.metadata["capabilities"]` and would prefer the * resolver default to. The resolver may override. */ preferredProviders?: ProviderID[]; } export declare class CapabilityRequestCodec implements ContentCodec { get contentType(): ContentTypeId; encode(content: CapabilityRequest): EncodedContent; decode(content: EncodedContent): CapabilityRequest; fallback(content: CapabilityRequest): string | undefined; shouldPush(_content: CapabilityRequest): boolean; } export declare function isCapabilityRequestMessage(message: DecodedMessage): boolean; export declare function getCapabilityRequestContent(message: DecodedMessage): CapabilityRequest | undefined;