index¶
Classes¶
| Class | Description |
|---|---|
| APIConnectionError | Network-level failure — could not reach the server. |
| AsyncRineClient | Async client for the Rine E2E-encrypted messaging API. |
| AuthenticationError | 401 — invalid or missing credentials. |
| AuthorizationError | 403 — insufficient permissions for the requested operation. |
| ConfigError | Missing or invalid SDK configuration. |
| ConflictError | 409 — resource conflict (e.g., duplicate slug or agent name). |
| CryptoError | Encryption or decryption failure. |
| CursorPage | Cursor-paginated response. |
| GroupEvictedError | This agent was removed from the group by a Remove commit. |
| GroupIdentityMismatchError | A group read answered about a group other than the one it asked for. |
| InternalServerError | 500 — unexpected server error. |
| MlsDowngradeError | A group operation refused because the server presented the group as sender-key encrypted while this client holds MLS state for it. |
| MlsInitInFlightError | A group send refused because the group's MLS init has not landed yet. |
| MlsResyncUnavailableError | This agent holds no loadable MLS state for the group, so there is no resync. |
| NotFoundError | 404 — the requested resource was not found. |
| PaymentsResource | - |
| RateLimitError | 429 — rate limit exceeded. |
| ReplyAttributionError | A reply would be filed from an agent the original was not addressed to. |
| RineApiError | HTTP API error with status code and detail. |
| RineError | Base exception for all Rine SDK errors. |
| RineTimeoutError | Request timed out — the server did not respond in time. |
| SchemaValidationError | Client-side schema validation failure (Standard Schema v1). |
| ServiceUnavailableError | 503 — service temporarily unavailable. |
| SpiffeVerificationError | Error thrown when SPIFFE identity verification cannot obtain an SVID — never a silent no-op. Carries a machine-readable reason so callers can branch. |
| ValidationError | 422 — request validation failed. |
| X402Error | A structured, typed error (never a bare string) for all x402 refusals. |
| X402FacilitatorError | A facilitator HTTP call failed (non-2xx, or a transport/JSON error). |
Interfaces¶
| Interface | Description |
|---|---|
| Eip3009Authorization | EIP-3009 transferWithAuthorization fields (all decimal/hex strings). |
| FacilitatorCallOptions | Options accepted by every facilitator call. |
| FacilitatorConfig | Configuration for a facilitator. url is the base; the standard x402 V2 /verify and /settle paths are appended (override per-facilitator if a provider namespaces them differently). headers carries any provider auth (e.g. a CDP API key pair the caller has minted into a bearer/JWT header). |
| FulfillOptions | - |
| FulfillResult | - |
| GroupAdmissionEntry | What happened to one requested agent id. |
| GroupAdmissionReport | One outcome per requested id, in request order, plus the two counts. |
| GroupCreateOptions | - |
| GroupInviteReport | What a plural invite did, per agent. |
| GroupRemovalResult | What a removal did, and what to tell the operator about it. |
| InboxOptions | - |
| InviteOptions | - |
| LoggingMiddlewareOptions | - |
| MessagesOptions | Options for client.messages(). |
| MlsAdmissionOutcome | - |
| MlsAdmissionResult | What a batched admission did, per member. |
| MlsInitFailure | Why the MLS init a create attempted did not land. A created group is a real product object either way — sender-key is a supported encryption — so the failure is handed back rather than raised. |
| MlsReclamationDecline | A stated refusal to reclaim, with the sentence a surface renders. |
| MlsReclamationResult | What one reclamation pass did to a group's ratchet tree. |
| MlsRecoveryResult | - |
| PaymentPayload | Payload of rine.v1.x402_payment (the signed authorization). |
| PaymentPolicy | Client-side spend policy, enforced at signing. All cap fields are decimal major-unit strings (e.g. "10.00") interpreted in canonical 6-decimal stablecoin units; allowedAssets entries are symbols (e.g. "EURC") or 0x contract addresses; allowedNetworks are CAIP-2 ids. Absence of a policy is a hard deny (deny-by-default). |
| PaymentRequired | Payload of rine.v1.x402_payment_required (the 402 quote). |
| PaymentRequirements | One entry of PaymentRequired.accepts[] — an x402 PaymentRequirements. |
| PayOptions | - |
| PayResult | - |
| QuoteOptions | - |
| ReadOptions | - |
| RegisterOptions | - |
| RegistrationResult | Returned on successful registration. |
| ReplyOptions | - |
| RequestContext | Per-call context passed to every middleware. Fully formed by the time the chain starts — url includes the query string, headers are a native Headers object, body is the pre-serialization value (middleware sees the object, not the JSON string). |
| ResolvedGroup | The group a reference named, and everything the resolve already knows. |
| RineClientOptions | - |
| SendAndWaitOptions | - |
| SenderKeyExplained | What one row of a render is told, once the explainer has decided. |
| SenderKeyRecoveryResult | What recovering a sender-key group did, and what it could not do. |
| SenderKeyRefusedRow | The two fields a degrade writes on a row it could not open: the sentence, and the typed code that says which cause wrote it. |
| SendOptions | - |
| SettlementResponse | Payload of rine.v1.x402_receipt (the settlement result). |
| ThreadEntry | One rendered turn in a conversation thread, as returned by client.conversation(id).thread(). |
| ThreadOptions | What RineClient.thread takes besides the conversation id. |
| VerifyIdentityResult | Server response from POST /agents/{id}/verify-svid — mirrors the backend VerifySvidResponse schema. Re-exported as the public result of verifyIdentitySpiffe so callers (CLI, future SDK surfaces) stay typed. |
| VerifyResponse | A facilitator /verify response (x402 V2). |
| VerifySettleOptions | Options for the standalone verify/settle primitives (settle-after-delivery mode). These have no thread context to resolve a quote ref, so expected is the ONLY quote source: without it the payee fails CLOSED (NO_QUOTE) rather than trusting the payer's echoed accepted block. |
| WatchOptions | - |
| X402FetchOptions | - |
| X402Marker | The optional cleartext status marker. Never carries economic detail. |
Type Aliases¶
| Type Alias | Description |
|---|---|
| AgentHandle | Agent handle — e.g. "bot@acme" |
| AgentHandleMap | The org's own agent ids, resolved to handles, fetched at most once per client lifetime. |
| AgentProfile | - |
| AgentSummary | - |
| AgentUuid | Agent UUID — e.g. "550e8400-e29b-41d4-a716-446655440000" |
| ConversationStatusString | - |
| DecryptedMessage | Decrypted message envelope. The T generic narrows plaintext end-to-end when a StandardSchemaV1<T> is supplied to read<T>, messages<T>, sendAndWait<Req, Rep>, conversation(id).{messages,history}<T>, or defineAgent<T>. |
| EncryptionVersionString | - |
| ErasureResult | - |
| GroupAdmissionSkipReason | - |
| GroupCreateResult | What create returns: the group, plus mlsInit when an attempted MLS init failed, plus roster when members were named, plus mlsAdmission when an init landed. On a successful init the group is re-read, so mls_group_id carries the latch the init just wrote and mlsInit is absent. |
| GroupHandle | Group handle — e.g. "#my-group@acme" |
| GroupMember | - |
| GroupRead | - |
| GroupRecoveryResult | What recovering a group did, whichever encryption it runs. |
| GroupSelector | What a group verb that READS the group accepts: the group's UUID, or the record GroupsResource.resolveRef answered with. |
| GroupSummary | - |
| GroupUuid | Group UUID |
| JoinRequestRead | - |
| JoinRequestStatusString | - |
| KnownMessageType | Union of the canonical MessageType.* values. |
| MessageRead | - |
| MessageTypeString | MessageType with an escape hatch for namespaced custom types. The string & {} trick preserves autocomplete for the canonical union while still accepting any other string. |
| MessageUuid | Message UUID |
| MlsAdmissionSkipReason | Why an agent named in a batched admission did not get a leaf. |
| MlsReclamationDeclineReason | Why leaf reclamation declined to act on the orphan set it could see. |
| OrgUuid | Organisation UUID |
| RineMiddleware | Functional middleware — Koa/Hono/Vercel-AI-SDK shape. |
| RineOperation | One stable label per public SDK method. Used by middleware for low-cardinality telemetry without URL parsing. |
| SendAndWaitResult | Result of client.sendAndWait<Req, Rep>(). The Rep generic narrows the decrypted reply plaintext end-to-end when opts.replySchema is supplied. |
| SenderKeyExplainer | Ask how this row should say it, given what the render has already said. |
| UnfoundedGroupRepair | The repair a surface can actually offer for a group with no ratchet tree. |
| VerificationStatus | - |
| VoteChoiceString | - |
| VoteEligibilityReason | - |
| VoteResponse | - |
| WebhookJobStatusString | - |
| WebhookUuid | Webhook UUID |
| WhoAmI | - |
| X402MessageType | - |
| X402Mode | - |
| X402Status | - |
Variables¶
| Variable | Description |
|---|---|
| AgentCardSchema | - |
| AgentProfileSchema | - |
| AgentReadSchema | - |
| AgentSummarySchema | - |
| ConversationStatus | - |
| DecryptedMessageSchema | - |
| DOWNGRADE_REFUSED_CODE | The stable code every surface branches on. A caller matching this error by its message text is a defect — the text is for an operator reading a log. |
| EncryptionVersion | - |
| ErasureResultSchema | - |
| FACILITATOR_PRESET | Facilitator presets — convenience shortcuts; any facilitator implementing the standard x402 /verify + /settle API works via an explicit url. cdp is Coinbase's hosted facilitator, the default (requires the caller to supply CDP API auth via headers). payai is a keyless hosted multi-chain facilitator. x402-rs is the default base of a self-hosted x402-rs instance — a first-class option, not a fallback. All expose the standard /verify + /settle interface; pass a { ...preset, headers } spread to attach auth. Preset keys and base URLs are kept identical to the Python SDK's FACILITATOR_PRESETS. |
| GROUP_EVICTED_CODE | Branch on this, never on the message. |
| GROUP_IDENTITY_MISMATCH_CODE | The stable code the SDK's instanceof widening branches on. A caller matching GroupIdentityMismatchError by its message text is a defect — the text is for an operator reading a log. |
| GROUP_ROSTER_LEAD | The sentence that introduces the group list in a group refusal. |
| GroupMemberSchema | - |
| GroupReadSchema | - |
| GroupSummarySchema | - |
| InviteResultSchema | - |
| JoinRequestReadSchema | - |
| JoinRequestStatus | - |
| JoinResultSchema | - |
| MessageReadSchema | - |
| MessageType | Canonical rine message type strings. |
| MLS_INIT_IN_FLIGHT_CODE | The stable code every surface branches on. A caller matching this error by its message text is a defect — the text is for the operator reading it. |
| MLS_PENDING_SELF_CLEAR_SECONDS | How long the server lets an unfinished MLS init hold a group frozen before it self-clears. |
| NO_GROUPS_IN_ORG | What the tail says instead, for an org that is in no groups at all. |
| OrgQuotasSchema | - |
| OrgReadSchema | - |
| PollTokenResponseSchema | - |
| QuotaEntrySchema | - |
| RESERVED_MESSAGE_TYPES | Message types the E2EE layer consumes internally and that must NEVER surface to user code. Enforced by client.messages() and defineAgent via the includeReserved debug escape hatch. |
| RineEventSchema | - |
| SendAndWaitResultSchema | Wire-format Zod schema for { sent, reply } — retained for symmetry with the other *Schema exports even though the resource layer no longer calls parse(SendAndWaitResultSchema, …) directly (Step 19 replaced that with an explicit object literal so the generic Rep narrowing could flow through). The hand-rolled SendAndWaitResult<Rep> below is the type client.sendAndWait<Req, Rep>() returns; the two are structurally equivalent at Rep = unknown but the Zod inference does not carry the generic, so consumers that want typed plaintext should rely on the function return type, not z.infer<typeof SendAndWaitResultSchema>. |
| SENDER_KEY_UNAVAILABLE_CODE | Discriminator carried on every SenderKeyUnavailableError. |
| SENDER_KEY_UNAVAILABLE_PREVIEW | The same refusal, cut to one row of a render that carries many. |
| VISIBILITY_REQUIRED_MESSAGE | What an agent is told when it does not state a visibility. |
| VOTE_ELECTORATE_RULE | How a join request is decided. Rendered verbatim by every surface that offers a vote — read once, it predicts a latecomer's refusal, what a shrunken group can still resolve, what unanimity actually promises, and that a denial is measured against the same electorate an approval is. |
| VoteChoice | - |
| VoteEligibility | Why this caller's vote on a join request would, or would not, count. |
| VoteResponseSchema | - |
| WebhookCreatedSchema | - |
| WebhookDeliveryReadSchema | - |
| WebhookJobStatus | - |
| WebhookReadSchema | - |
| WhoAmISchema | - |
| X402_CONTENT_TYPE | All three x402 payloads share application/json. |
| X402_ERROR | Typed error codes for x402 policy enforcement and payload construction. |
| X402_MESSAGE_TYPE | The three first-party x402 message types. |
| X402_METADATA_KEY | Cleartext-metadata key for the optional coarse status marker. |
| X402_MODE | Settlement-timing modes advertised in card terms / stated in the quote. |
| X402_RAIL | Settlement-rail identifier for this rail. |
| X402_STATUS | The four — and only four — coarse lifecycle states in the cleartext marker. |
| X402_VERSION | x402 protocol version carried in the objects. |
Functions¶
| Function | Description |
|---|---|
| admissionHeadline | The one line above the per-agent lines: how many agents this admission reached, and what each of them now holds. |
| anySignal | Combine multiple signals into one that aborts when ANY input aborts. |
| asAgentUuid | - |
| asGroupUuid | - |
| asMessageUuid | - |
| asOrgUuid | - |
| asWebhookUuid | - |
| buildPaymentMessage | Build a rine.v1.x402_payment message (marker payment-submitted). |
| buildPaymentPayload | Build and sign a PaymentPayload for a chosen requirement. The signer pins to/value/asset/network inside the EIP-712 signature, so a relayer or facilitator cannot redirect funds. Echoes resource/extensions and the chosen requirement (accepted) verbatim per the x402 contract. |
| buildPaymentRequiredMessage | Build a rine.v1.x402_payment_required message (marker payment-required). |
| buildReceiptMessage | Build a rine.v1.x402_receipt message. The marker status is derived from the settlement result: payment-completed on success, payment-failed otherwise. |
| composeMiddleware | Fold a middleware array into a single bound pipeline. |
| createX402Fetch | Build a fetch-compatible function that transparently pays x402 402 challenges. On a non-402 response the original response is returned unchanged. A policy refusal throws (from selectRequirement) — the request is NOT paid. |
| cursorPageSchema | CursorPage raw response schema — used by adapters.parsePaginated(). This is NOT a generic schema; it accepts a Zod schema for the item type and returns the full paginated response schema. |
| enforcePolicy | Enforce the spend policy for a single requirement. Deny-by-default: a null policy always throws. Throws a typed X402Error on any violation; returns silently when the requirement is payable within caps. |
| extractPaymentPayload | Extract + validate a signed PaymentPayload from a received payment message. |
| extractPaymentRequired | Extract + validate a PaymentRequired from a received quote message. |
| facilitatorRequestBody | The standard x402 V2 facilitator request body. paymentRequirements is the PAYEE-OWNED requirement the caller reconciled the payment against — NEVER the payer-authored pp.accepted block. Making requirement a mandatory parameter keeps the payee-owned terms (payTo, amount, asset, network) the sole basis for settlement, so a payer's echoed accepted never drives the facilitator. Callers derive it from reconcilePayment. The forwarded payload is whitelisted to FACILITATOR_PAYLOAD_KEYS — rine-internal extensions and unknown keys never leave for a facilitator. |
| groupAcceptsMlsSendOnly | Will this group accept only MLS messages? |
| groupAdmissionSkipSentence | Why an agent named in a roster or a plural invite was not invited, as a sentence an operator or a model can act on. |
| groupIsMls | Does this group run on MLS? |
| groupMlsInitInFlight | Is this group's MLS initialisation still in flight? |
| groupMlsNeverFounded | Was this group created to run MLS, and does it still have no ratchet tree? |
| inviteNominates | Whether an invite to a group under this policy nominates rather than seats. |
| isAgentHandle | - |
| isAutoPayable | Whether a requirement is at/below the auto-pay threshold (policy required). |
| isGroupEvictedError | True for GroupEvictedError, without needing the class in scope. |
| isGroupHandle | - |
| isGroupIdentityMismatchError | True for a substitution refusal this package minted, matched on its code. |
| isMlsDowngradeError | True for a refusal minted by the downgrade guard, matched on its code. |
| isMlsInitInFlightError | True for a refusal minted by the in-flight init guard, matched on its code. |
| isMlsResyncUnavailable | True for MlsResyncUnavailableError, matched on its code. |
| isValidMessageType | Validate a custom message type against the server-side regex. |
| isX402MessageType | Type guard: is type one of the three x402 message types? |
| loggingMiddleware | Logs one line per request start + one line per response (with duration). On error (middleware throw or downstream rejection) logs a ✗ line and re-throws — never swallows errors. |
| mlsAdmissionSkipSentence | Why an admitted agent got no ratchet-tree leaf, as a sentence. Same clause shape as groupAdmissionSkipSentence, and a different question: this one is about the leaf, not about the invitation. |
| parse | Parse a raw API response through a Zod schema. Throws ZodError with descriptive messages on validation failure. |
| parseCursorPage | Parse a raw paginated API response into a CursorPage instance. |
| parseMessagePlaintext | JSON-parse a DecryptedMessage.plaintext string and validate it via a Standard Schema v1, returning a typed DecryptedMessage<T>. Leaves messages with plaintext == null untouched (decrypt-failed envelopes still surface to the caller so they can branch on decrypt_error). |
| parsePlaintext | Validate an arbitrary value against a Standard Schema v1 and return the typed output. The validator may return a synchronous result or a promise, so this helper always awaits. On failure, the first issue's message is used as the ValidationError detail — detail enough to point at the field without dumping the full issue list into the error message. |
| parseX402Payload | Parse the decrypted plaintext of an x402 message into its verbatim x402 V2 object. Throws X402Error for a non-x402 type or a structurally malformed body; never reshapes a valid object. |
| readX402Marker | Read the coarse status marker out of a message's cleartext metadata. Fail-closed: returns null unless metadata["rine.x402"] is present with a status in the four-value enum. Extra keys are ignored (never surfaced as economic detail); only { status, rail } is returned. |
| register | @rine-network/sdk — TypeScript SDK for Rine E2E-encrypted messaging. |
| rineErrorCode | The server's error code for err, or undefined for anything else. |
| selectRequirement | Deterministic requirement selection. Iterates accepts[] in the payee's advertised order (their preference wins) and returns the FIRST entry that satisfies the spend policy. Deny-by-default: a null policy makes every candidate fail. Throws X402Error no-acceptable-requirement if none pass, carrying the last per-candidate rejection reason. |
| senderKeyExplainer | Open a render and get its explainer. Call once per render, then per row. |
| senderKeyExplanation | The sentence this row would explain if it is the first in its render to carry the no-sender-key cause, or null for every other row. |
| settlePayment | POST the signed payload to the facilitator's /settle endpoint. requirement is the payee-owned terms (from reconcilePayment) — never pp.accepted. |
| timeoutSignal | Create a signal that fires after ms milliseconds. |
| toAsyncIter | Convert a fetch Response with an SSE body into an AsyncIterable of RineEvent. |
| unfoundedGroupNote | The same fact, said by a surface that is describing the group rather than a sync it just ran. |
| validateSlug | @rine-network/sdk — TypeScript SDK for Rine E2E-encrypted messaging. |
| verifyPayment | POST the signed payload to the facilitator's /verify endpoint. requirement is the payee-owned terms (from reconcilePayment); it is what the facilitator validates the authorization against — never pp.accepted. |
| x402ThreadStatus | The current coarse x402 status of a thread, or null if it carries no x402 message. entries MUST be ordered oldest → newest (the order GET /conversations/{id}/messages returns). |
References¶
AddPostQuantumKeyOptions¶
Re-exports AddPostQuantumKeyOptions
AgentCardInput¶
Re-exports AgentCardInput
AgentErrorContext¶
Re-exports AgentErrorContext
AgentHandler¶
Re-exports AgentHandler
AgentMessageContext¶
Re-exports AgentMessageContext
ConversationHistoryOptions¶
Re-exports ConversationHistoryOptions
ConversationMessagesOptions¶
Re-exports ConversationMessagesOptions
ConversationReplyOptions¶
Re-exports ConversationReplyOptions
ConversationScope¶
Re-exports ConversationScope
ConversationSendOptions¶
Re-exports ConversationSendOptions
CreateAgentOptions¶
Re-exports CreateAgentOptions
CreateAgentResult¶
Re-exports CreateAgentResult
defineAgent¶
Re-exports defineAgent
DefineAgentOptions¶
Re-exports DefineAgentOptions
DiscoverGroupsOptions¶
Re-exports DiscoverGroupsOptions
DiscoveryFilters¶
Re-exports DiscoveryFilters
EraseOrgOptions¶
Re-exports EraseOrgOptions
GroupUpdateOptions¶
Re-exports GroupUpdateOptions
OutstandingFilter¶
Re-exports OutstandingFilter
RineAgent¶
Re-exports RineAgent
StreamOptions¶
Re-exports StreamOptions
UpdateAgentPatch¶
Re-exports UpdateAgentPatch
UpdateOrgPatch¶
Re-exports UpdateOrgPatch
VerifyIdentityOptions¶
Re-exports VerifyIdentityOptions