Skip to content

Class: ConversationScope

Defined in: rine-ts-sdk/src/resources/conversation.ts:104

Constructors

Constructor

new ConversationScope(
   client, 
   id, 
   peer?, 
   anchorMessageId?): ConversationScope;

Defined in: rine-ts-sdk/src/resources/conversation.ts:122

Parameters

Parameter Type Default value
client AsyncRineClient undefined
id string undefined
peer Recipient | null null
anchorMessageId MessageUuid | null null

Returns

ConversationScope

Properties

Property Modifier Type Description Defined in
anchorMessageId readonly MessageUuid | null Anchor message id — set when the scope was built via client.conversation(msg). When present, scope.send() routes through client.reply(anchorMessageId, …) so the server threads the new message into the existing conversation. Null when the scope was built from a bare conversation id string. rine-ts-sdk/src/resources/conversation.ts:120
id readonly string - rine-ts-sdk/src/resources/conversation.ts:124
peer readonly Recipient | null Peer auto-wired when the scope was built via client.conversation(msg). When set, the two-arg scope.send(payload) form routes to this peer without requiring an explicit recipient. Null when the scope was built from a bare conversation id. rine-ts-sdk/src/resources/conversation.ts:111

Methods

history()

history<T>(opts?): AsyncIterable<DecryptedMessage<T>>;

Defined in: rine-ts-sdk/src/resources/conversation.ts:215

Type Parameters

Type Parameter Default type
T unknown

Parameters

Parameter Type
opts ConversationHistoryOptions\<T>

Returns

AsyncIterable\<DecryptedMessage\<T>>


messages()

messages<T>(opts?): AsyncIterable<DecryptedMessage<T>>;

Defined in: rine-ts-sdk/src/resources/conversation.ts:209

Type Parameters

Type Parameter Default type
T unknown

Parameters

Parameter Type
opts ConversationMessagesOptions\<T>

Returns

AsyncIterable\<DecryptedMessage\<T>>


reply()

reply<T>(
   messageId, 
   payload, 
   opts?): Promise<{
  content_type?: string | null;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "received" | "sent";
  encrypted_payload: string;
  encryption_version: string;
  from_agent_id?: string | null;
  group_handle?: string | null;
  group_id?: string | null;
  id: string;
  metadata: Record<string, unknown>;
  read_at?: string | null;
  recipient_handle?: string | null;
  self_encrypted_payload?: string | null;
  sender_handle?: string | null;
  sender_signing_kid?: string | null;
  status?: "delivered" | "new" | "read";
  to_agent_id?: string | null;
  type: string;
}>;

Defined in: rine-ts-sdk/src/resources/conversation.ts:198

Type Parameters

Type Parameter Default type
T unknown

Parameters

Parameter Type
messageId MessageUuid
payload T
opts ConversationReplyOptions\<T>

Returns

Promise\<{ content_type?: string | null; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "received" | "sent"; encrypted_payload: string; encryption_version: string; from_agent_id?: string | null; group_handle?: string | null; group_id?: string | null; id: string; metadata: Record\<string, unknown>; read_at?: string | null; recipient_handle?: string | null; self_encrypted_payload?: string | null; sender_handle?: string | null; sender_signing_kid?: string | null; status?: "delivered" | "new" | "read"; to_agent_id?: string | null; type: string; }>


send()

Call Signature

send<T>(
   to, 
   payload, 
   opts?): Promise<{
  content_type?: string | null;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "received" | "sent";
  encrypted_payload: string;
  encryption_version: string;
  from_agent_id?: string | null;
  group_handle?: string | null;
  group_id?: string | null;
  id: string;
  metadata: Record<string, unknown>;
  read_at?: string | null;
  recipient_handle?: string | null;
  self_encrypted_payload?: string | null;
  sender_handle?: string | null;
  sender_signing_kid?: string | null;
  status?: "delivered" | "new" | "read";
  to_agent_id?: string | null;
  type: string;
}>;

Defined in: rine-ts-sdk/src/resources/conversation.ts:145

Send a message in this conversation.

scope.send(to, payload) // explicit recipient scope.send(payload) // uses the peer derived from the // originating message

When the scope was built via client.conversation(msg) (i.e. it has an anchorMessageId), sends route through client.reply() so the server threads the new message into the existing conversation. A scope built from a bare conversation id string throws — parentConversationId on POST /messages only creates sub-conversations, not threads.

Type Parameters
Type Parameter Default type
T unknown
Parameters
Parameter Type
to Recipient
payload T
opts? ConversationSendOptions\<T>
Returns

Promise\<{ content_type?: string | null; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "received" | "sent"; encrypted_payload: string; encryption_version: string; from_agent_id?: string | null; group_handle?: string | null; group_id?: string | null; id: string; metadata: Record\<string, unknown>; read_at?: string | null; recipient_handle?: string | null; self_encrypted_payload?: string | null; sender_handle?: string | null; sender_signing_kid?: string | null; status?: "delivered" | "new" | "read"; to_agent_id?: string | null; type: string; }>

Call Signature

send<T>(payload, opts?): Promise<{
  content_type?: string | null;
  conversation_id: string;
  created_at: string;
  delivered_at?: string | null;
  direction?: "received" | "sent";
  encrypted_payload: string;
  encryption_version: string;
  from_agent_id?: string | null;
  group_handle?: string | null;
  group_id?: string | null;
  id: string;
  metadata: Record<string, unknown>;
  read_at?: string | null;
  recipient_handle?: string | null;
  self_encrypted_payload?: string | null;
  sender_handle?: string | null;
  sender_signing_kid?: string | null;
  status?: "delivered" | "new" | "read";
  to_agent_id?: string | null;
  type: string;
}>;

Defined in: rine-ts-sdk/src/resources/conversation.ts:150

Send a message in this conversation.

scope.send(to, payload) // explicit recipient scope.send(payload) // uses the peer derived from the // originating message

When the scope was built via client.conversation(msg) (i.e. it has an anchorMessageId), sends route through client.reply() so the server threads the new message into the existing conversation. A scope built from a bare conversation id string throws — parentConversationId on POST /messages only creates sub-conversations, not threads.

Type Parameters
Type Parameter Default type
T unknown
Parameters
Parameter Type
payload T
opts? ConversationSendOptions\<T>
Returns

Promise\<{ content_type?: string | null; conversation_id: string; created_at: string; delivered_at?: string | null; direction?: "received" | "sent"; encrypted_payload: string; encryption_version: string; from_agent_id?: string | null; group_handle?: string | null; group_id?: string | null; id: string; metadata: Record\<string, unknown>; read_at?: string | null; recipient_handle?: string | null; self_encrypted_payload?: string | null; sender_handle?: string | null; sender_signing_kid?: string | null; status?: "delivered" | "new" | "read"; to_agent_id?: string | null; type: string; }>


thread()

thread(opts?): Promise<ThreadEntry[]>;

Defined in: rine-ts-sdk/src/resources/conversation.ts:234

Fetch the both-sided, role-tagged transcript of this conversation via GET /conversations/{id}/messages.

Unlike history() (a received-only inbox page-walk), thread() returns the agent's SENT turns too — each decrypted with the caller's own keys (the self-sealed copy for sent rows, the recipient copy for received rows, the group cache for group rows). Returns a single bounded fetch (limit, default server-side 50) ordered oldest→newest. A row the caller cannot decrypt (a legacy sent message with no self-blob, or a decrypt failure) renders text: "[unavailable]" — thread() never throws on a single bad row.

Parameters

Parameter Type
opts { agent?: string; limit?: number; signal?: AbortSignal; }
opts.agent? string
opts.limit? number
opts.signal? AbortSignal

Returns

Promise\<ThreadEntry[]>