BEEOS CLOUD / DEVELOPER REFERENCE
Chat replies and realtime
Send and stream chat replies, read history, and subscribe to realtime events.
Cloud chat delivers each user prompt as the session/prompt runtime method and pre-creates the reply message in the streaming state. The harness converges that reply with patches and finally marks it completed, failed, refused or cancelled.
BoundRuntimeChatReply
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Writes to a reply row that Cloud has already created in the streaming state for a chat prompt. Changes are queued and sent one at a time, each with an idempotency key; the terminal methods read the stored row back and fail unless it matches.
class BoundRuntimeChatReply
new BoundRuntimeChatReply(readonly input: { authority: RuntimeChatAuthorityPort; http: RuntimeChatHttpPort; binding: RuntimeChatRetainedBinding; now?: () => number; })TypeScript · Constructor
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input | { authority: RuntimeChatAuthorityPort; http: RuntimeChatHttpPort; binding: RuntimeChatRetainedBinding; now?: () => number; } | yes | authority supplies the current lease, http sends the requests, binding identifies the reply row and supplies the idempotency keys, and now is an optional clock in milliseconds. |
Properties
| Name | Type | Description |
|---|---|---|
readonly id | string | Identifier of the reply message. |
readonly isTerminated | boolean | true once a terminal method (finalize, fail, refuse or cancel) has been called. |
readonly initialPartCount | number | Number of message parts that the reply row already had when it was bound. The existing parts are kept as they are. |
initialize
Reads the reply row and remembers its body and parts. Rejects when the row is not in the streaming state. bindExistingRuntimeChatReply calls it for you.
async initialize(): Promise<void>TypeScript · Parameters
No parameters.
Returns Promise<void>
opened
Resolves with the snapshot of the reply row that was read at initialisation.
opened(): Promise<RuntimeChatRetainedSnapshot>TypeScript · Parameters
No parameters.
Returns Promise<RuntimeChatRetainedSnapshot>
flush
Resolves when all queued changes have been sent.
flush(): Promise<void>TypeScript · Parameters
No parameters.
Returns Promise<void>
assertTerminalSnapshot
Checks that the final row of the reply still has the state, body, stop reason and parts that the reply finished with. Throws when it does not.
assertTerminalSnapshot(row: RuntimeChatRetainedSnapshot): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
row | RuntimeChatRetainedSnapshot | yes | The final row of the reply, read by the code that owns the reply. |
Returns void
appendBody
Appends text to the reply body. The change is queued and sent with the byte offset where the text starts.
appendBody(chunk: string): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
chunk | string | yes | Text to append. |
Returns void
setBody
Replaces the whole body with the given text.
setBody(body: string): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body | string | yes | The new body text. |
Returns void
addPart
Appends a message part (for example a tool call) as it is.
addPart(part: unknown): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
part | unknown | yes | The part to append, as JSON-compatible data. |
Returns void
addToolResult
Alias of addPart for a tool-result part.
addToolResult(part: unknown): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
part | unknown | yes | The tool-result part to append. |
Returns void
replacePart
Replaces the part at the given index. Throws when the index is outside the existing parts.
replacePart(index: number, part: unknown): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
index | number | yes | Zero-based index of the part to replace. | |
part | unknown | yes | The replacement part. |
Returns void
finalize
Finishes the reply in the completed state, reads the row back and returns it. Rejects when the stored row does not match.
finalize(options?: { stopReason?: string }): Promise<RuntimeChatRetainedSnapshot>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { stopReason?: string } | no | stopReason is stored with the row. |
Returns Promise<RuntimeChatRetainedSnapshot>
fail
Finishes the reply in the failed state, optionally replacing the body, reads the row back and returns it.
fail(options?: { body?: string; stopReason?: string }): Promise<RuntimeChatRetainedSnapshot>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { body?: string; stopReason?: string } | no | body replaces the body (for example with an error text); stopReason is stored with the row. |
Returns Promise<RuntimeChatRetainedSnapshot>
refuse
Finishes the reply in the refused state, reads the row back and returns it.
refuse(options?: { stopReason?: string }): Promise<RuntimeChatRetainedSnapshot>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { stopReason?: string } | no | stopReason is stored with the row. |
Returns Promise<RuntimeChatRetainedSnapshot>
cancel
Finishes the reply in the cancelled state, reads the row back and returns it.
cancel(options?: { stopReason?: string }): Promise<RuntimeChatRetainedSnapshot>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { stopReason?: string } | no | stopReason is stored with the row. |
Returns Promise<RuntimeChatRetainedSnapshot>
CentrifugeClientLike
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
The part of a Centrifuge WebSocket client that the SDK uses. Implement it to supply your own transport, for example in tests.
interface CentrifugeClientLikeon
Registers a listener for a client event: connected, connecting, disconnected, error or publication.
on(event: "publication", listener: (ctx: { data: unknown }) => void): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
event | "publication" | yes | Name of the event to listen for. | |
listener | (ctx: { data: unknown }) => void | yes | Callback invoked with the event context. |
Returns void
connect
Starts connecting.
connect(): voidTypeScript · Parameters
No parameters.
Returns void
disconnect
Closes the connection.
disconnect(): voidTypeScript · Parameters
No parameters.
Returns void
CentrifugeRealtimeFactory
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Creates the realtime client. The default factory uses the centrifuge package with the ws WebSocket.
interface CentrifugeRealtimeFactorycreate
Creates a client for the given URL and connection token.
create(options: { url: string; token: string }): CentrifugeClientLikeTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { url: string; token: string } | yes | url of the realtime endpoint and the connection token. |
Returns CentrifugeClientLike
RuntimeChatAuthorityPort
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Source of the current lease for the chat client. Adapt your registration coordinator to it.
interface RuntimeChatAuthorityPortcurrentLease
Returns the current lease with its credential, or null when there is none.
currentLease(): RuntimeChatLease | nullTypeScript · Parameters
No parameters.
Returns RuntimeChatLease | null
subscribeLease
Optional. Registers a listener that is called with the new lease, or null when it is lost. Returns a function that removes the listener.
subscribeLease?( listener: (lease: RuntimeChatLease | null) => void, ): () => voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
listener | (lease: RuntimeChatLease | null) => void | yes | Callback that receives the new lease, or null. |
Returns () => void
RuntimeChatClient
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Chat client over the current lease: it receives chat messages in real time, sends messages and replies, and reads history. Create it with createRuntimeChatClient.
interface RuntimeChatClientProperties
| Name | Type | Description |
|---|---|---|
readonly connectionState | RuntimeChatConnectionState | Current state of the realtime connection. |
readonly messages | { send(input: RuntimeChatSendInput): Promise<unknown>; startStream(input: RuntimeChatSendInput): RuntimeChatReplyStream; } | Sending: send posts a message, and startStream starts a reply that you fill in piece by piece. |
history
Reads one page of the stored history of a conversation whose id you know. There is no call to list the conversations of an instance, so unknown conversation ids cannot be discovered here.
history( conversationId: string, input?: RuntimeChatHistoryInput, ): Promise<RuntimeChatHistoryPage>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
conversationId | string | yes | Identifier of the conversation. | |
input | RuntimeChatHistoryInput | no | Paging options: cursor from the previous page and limit. |
Returns Promise<RuntimeChatHistoryPage>
syncConversation
Creates or updates the conversation for a session/new operation over the active lease and returns it. The owner is derived from the operation; the request body carries none.
syncConversation( input: RuntimeNativeConversationSyncRequest, ): Promise<RuntimeNativeConversationSyncResponse>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input | RuntimeNativeConversationSyncRequest | yes | The conversation sync request. |
Returns Promise<RuntimeNativeConversationSyncResponse>
on
Registers a listener. Events: message (a chat message arrived), error, connection (the connection state changed) and disconnect (the socket closed, with code and reason). Returns the client.
on( event: "disconnect", listener: (info: { code: number; reason: string }) => void, ): thisTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
event | "disconnect" | yes | Event name: message, error, connection or disconnect. | |
listener | (info: { code: number; reason: string }) => void | yes | Callback invoked with the event payload. |
Returns this
connect
Connects the realtime channel with the current lease. It reconnects with backoff after a drop and renews the session before the token or lease expires.
connect(): Promise<void>TypeScript · Parameters
No parameters.
Returns Promise<void>
disconnect
Closes the realtime connection.
disconnect(): Promise<void>TypeScript · Parameters
No parameters.
Returns Promise<void>
dispose
Closes the connection and removes all listeners. The client cannot be used afterwards.
dispose(): voidTypeScript · Parameters
No parameters.
Returns void
RuntimeChatHttpPort
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
The HTTP calls the chat client needs. createRuntimeChatHttpPort implements it with lease authentication; implement it yourself to change the transport.
interface RuntimeChatHttpPortgetMessage
Optional. Reads one message as a single authoritative snapshot. Required for bindExistingRuntimeChatReply.
getMessage?( lease: RuntimeChatLease, input: { conversationId: string; messageId: string }, ): Promise<RuntimeChatRetainedSnapshot>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. | |
input | { conversationId: string; messageId: string } | yes | conversationId and messageId of the message. |
Returns Promise<RuntimeChatRetainedSnapshot>
personalToken
Requests a realtime connection token for the lease. The answer holds the token, the realtime URL and the channels to follow.
personalToken(lease: RuntimeChatLease): Promise<{ token: string; realtimeUrl: string; channels: string[]; principalId?: string; expiresAt?: number; }>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. |
Returns Promise<{ token: string; realtimeUrl: string; channels: string[]; principalId?: string; expiresAt?: number; }>
getHistory
Reads one page of the stored history of a conversation.
getHistory( lease: RuntimeChatLease, input: { conversationId: string } & RuntimeChatHistoryInput, ): Promise<RuntimeChatHistoryPage>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. | |
input | { conversationId: string } & RuntimeChatHistoryInput | yes | conversationId plus the paging options cursor and limit. |
Returns Promise<RuntimeChatHistoryPage>
syncConversation
Creates or updates the conversation for a runtime operation and returns it.
syncConversation( lease: RuntimeChatLease, input: RuntimeNativeConversationSyncRequest, ): Promise<RuntimeNativeConversationSyncResponse>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. | |
input | RuntimeNativeConversationSyncRequest | yes | The conversation sync request. |
Returns Promise<RuntimeNativeConversationSyncResponse>
sendMessage
Posts a message to a conversation. The answer holds the message id and, when present, the outcome.
sendMessage( lease: RuntimeChatLease, input: { conversationId: string; id: string; type: string; content: unknown; replyTo?: string; }, ): Promise<{ messageId: string; outcome?: string }>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. | |
input | { conversationId: string; id: string; type: string; content: unknown; replyTo?: string; } | yes | conversationId, the message id, its type and content, and optionally replyTo, the id of the message it answers. |
Returns Promise<{ messageId: string; outcome?: string }>
openStream
Creates a message in the streaming state that is then filled in with patchMessage.
openStream( lease: RuntimeChatLease, input: { conversationId: string; id: string; type: string; content: unknown; replyTo?: string; }, ): Promise<{ messageId: string }>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. | |
input | { conversationId: string; id: string; type: string; content: unknown; replyTo?: string; } | yes | conversationId, the message id, its type and content, and optionally replyTo, the id of the message it answers. |
Returns Promise<{ messageId: string }>
patchMessage
Changes a message that is being streamed: replace or append to the body, replace the parts, or set the final state and stopReason.
patchMessage( lease: RuntimeChatLease, input: { conversationId: string; messageId: string; body?: string; bodyAppend?: string; bodyFrom?: number; parts?: readonly unknown[]; state?: string; stopReason?: string; operationKey?: string; }, ): Promise<void>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
lease | RuntimeChatLease | yes | The current runtime lease whose credential authorises the request. | |
input | { conversationId: string; messageId: string; body?: string; bodyAppend?: string; bodyFrom?: number; parts?: readonly unknown[]; state?: string; stopReason?: string; operationKey?: string; } | yes | conversationId and messageId, plus the change: body, or bodyAppend with the byte offset bodyFrom, parts, state, stopReason, and an operationKey that makes the change idempotent. |
Returns Promise<void>
RuntimeChatRealtimePort
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
The realtime transport the chat client needs. createCentrifugoRealtimePort implements it.
interface RuntimeChatRealtimePortopen
Opens the realtime connection and returns a handle whose close() ends it.
open(input: { token: string; url: string; channel: string; onEvent(event: { type: string; data?: unknown }): void; onState(state: "connected" | "connecting" | "disconnected" | "failed"): void; onError(error: unknown): void; }): { close(): void }TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input | { token: string; url: string; channel: string; onEvent(event: { type: string; data?: unknown }): void; onState(state: "connected" | "connecting" | "disconnected" | "failed"): void; onError(error: unknown): void; } | yes | Connection token, url and channel, and the callbacks onEvent, onState and onError. |
Returns { close(): void }
RuntimeChatReplyStream
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
A reply that you fill in piece by piece and then finish in one of four states. Create it with client.messages.startStream.
interface RuntimeChatReplyStreamProperties
| Name | Type | Description |
|---|---|---|
readonly id | string | Identifier of the reply message. |
readonly isTerminated | boolean | true once a terminal method has been called. |
readonly parts | readonly unknown[] | The message parts added so far. |
opened
Resolves when the reply message has been created.
opened(): Promise<unknown>TypeScript · Parameters
No parameters.
Returns Promise<unknown>
flush
Resolves when all queued changes have been sent.
flush(): Promise<void>TypeScript · Parameters
No parameters.
Returns Promise<void>
appendBody
Appends text to the reply body.
appendBody(chunk: string): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
chunk | string | yes | Text to append. |
Returns void
setBody
Replaces the whole body with the given text.
setBody(body: string): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
body | string | yes | The new body text. |
Returns void
addToolResult
Alias of addPart for a tool-result part.
addToolResult(part: unknown): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
part | unknown | yes | The tool-result part to append. |
Returns void
addPart
Appends a message part as it is.
addPart(part: unknown): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
part | unknown | yes | The part to append, as JSON-compatible data. |
Returns void
replacePart
Replaces the part at the given index.
replacePart(index: number, part: unknown): voidTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
index | number | yes | Zero-based index of the part to replace. | |
part | unknown | yes | The replacement part. |
Returns void
finalize
Finishes the reply in the completed state.
finalize(options?: { stopReason?: string }): Promise<unknown>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { stopReason?: string } | no | stopReason is stored with the message. |
Returns Promise<unknown>
fail
Finishes the reply in the failed state, optionally replacing the body.
fail(options?: { body?: string; stopReason?: string }): Promise<unknown>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { body?: string; stopReason?: string } | no | body replaces the body (for example with an error text); stopReason is stored with the message. |
Returns Promise<unknown>
refuse
Finishes the reply in the refused state.
refuse(options?: { stopReason?: string }): Promise<unknown>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { stopReason?: string } | no | stopReason is stored with the message. |
Returns Promise<unknown>
cancel
Finishes the reply in the cancelled state.
cancel(options?: { stopReason?: string }): Promise<unknown>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | { stopReason?: string } | no | stopReason is stored with the message. |
Returns Promise<unknown>
RuntimeRealtimeSubscription
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Handle of an open realtime subscription.
interface RuntimeRealtimeSubscriptionProperties
| Name | Type | Description |
|---|---|---|
token | RuntimeRealtimeToken | The realtime token the subscription was opened with. |
close
Closes the subscription.
close(): voidTypeScript · Parameters
No parameters.
Returns void
bindExistingRuntimeChatReply
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Binds to a reply row that Cloud already created in the streaming state and returns a BoundRuntimeChatReply. It never creates or posts a message itself.
async function bindExistingRuntimeChatReply(input: { authority: RuntimeChatAuthorityPort; http: RuntimeChatHttpPort; binding: RuntimeChatRetainedBinding; now?: () => number; }): Promise<BoundRuntimeChatReply>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input | { authority: RuntimeChatAuthorityPort; http: RuntimeChatHttpPort; binding: RuntimeChatRetainedBinding; now?: () => number; } | yes | authority supplies the current lease, http sends the requests, binding identifies the reply row and supplies the idempotency keys, and now is an optional clock in milliseconds. |
Returns Promise<BoundRuntimeChatReply>
createCentrifugoRealtimePort
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Creates a RuntimeChatRealtimePort on top of Centrifuge. It listens to the publications of the channels that the token grants and never subscribes by itself.
function createCentrifugoRealtimePort(options: CentrifugeRealtimePortOptions = {}): RuntimeChatRealtimePortTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | CentrifugeRealtimePortOptions | no | {} | Optional factory that creates the Centrifuge client; defaults to the real client. |
Returns RuntimeChatRealtimePort
createRuntimeChatClient
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Creates a RuntimeChatClient. Call connect() to start receiving messages.
function createRuntimeChatClient(options: RuntimeChatClientOptions): RuntimeChatClientTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | RuntimeChatClientOptions | yes | authority, http and realtime ports, plus an optional clock, reconnect delay function and logger. |
Returns RuntimeChatClient
createRuntimeChatHttpPort
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Creates a RuntimeChatHttpPort that sends every request with the lease credential as Authorization: Bearer.
function createRuntimeChatHttpPort(options: RuntimeChatHttpPortOptions): RuntimeChatHttpPortTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
options | RuntimeChatHttpPortOptions | yes | baseUrl of the message service, and optional fetchImpl and now. |
Returns RuntimeChatHttpPort
mintRuntimeRealtimeToken
TypeScript @beeos-ai/cloud-harness-sdk · Python beeos_cloud_harness_sdk.realtime
Requests a realtime connection token, with the channels to follow, for the lease. Throws HarnessProtocolError when the answer is incomplete.
async function mintRuntimeRealtimeToken(http: RuntimeLeaseHttp, credential: RuntimeLeaseCredential, signal?: AbortSignal): Promise<RuntimeRealtimeToken>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
http | RuntimeLeaseHttp | yes | Lease-authenticated HTTP client that sends the requests. | |
credential | RuntimeLeaseCredential | yes | Runtime lease credential that authorises the call. | |
signal | AbortSignal | no | Aborting this signal cancels the call. |
Returns Promise<RuntimeRealtimeToken>
Python · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
http | RuntimeLeaseHttp | yes | Lease-authenticated HTTP client that sends the requests. | |
credential | RuntimeLeaseCredential | yes | Runtime lease credential that authorises the call. |
Returns RuntimeRealtimeToken
normalizeMessage
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Converts a raw message object into a RuntimeChatMessage: unknown fields are kept and the camelCase fields id, conversationId, type, content, senderId, replyTo and createdAt are filled in from the snake_case or alternative names. Returns null when the value is not an object or has no id.
function normalizeMessage(value: unknown): RuntimeChatMessage | nullTypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
value | unknown | yes | A raw message object from the realtime channel or the history. |
Returns RuntimeChatMessage | null
subscribeRuntimeRealtime
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Requests a realtime token with the lease and opens the realtime connection. Resolves with a handle that holds the token and closes the subscription.
async function subscribeRuntimeRealtime(input: { origin: string; credential: RuntimeLeaseCredential; onEvent: (event: { type: string; data?: unknown }) => void; onState?: (state: "connecting" | "connected" | "disconnected" | "failed") => void; onError?: (error: unknown) => void; fetch?: typeof fetch; factory?: CentrifugeRealtimeFactory; signal?: AbortSignal; }): Promise<RuntimeRealtimeSubscription>TypeScript · Parameters
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
input | { origin: string; credential: RuntimeLeaseCredential; onEvent: (event: { type: string; data?: unknown }) => void; onState?: (state: "connecting" | "connected" | "disconnected" | "failed") => void; onError?: (error: unknown) => void; fetch?: typeof fetch; factory?: CentrifugeRealtimeFactory; signal?: AbortSignal; } | yes | origin of the message service, the lease credential, the callbacks onEvent, onState and onError, and optionally fetch, factory and signal. |
Returns Promise<RuntimeRealtimeSubscription>
RUNTIME_CHAT_PATHS
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Paths of the chat routes, as strings or functions.
const RUNTIME_CHAT_PATHS: Readonly<{ personalToken: string; conversations: string; conversationMessages: (conversationId: string) => string; conversationMessage: (conversationId: string, messageId: string) => string; }>Entries
| Name | Type | Description |
|---|---|---|
personalToken | string | Path to request a realtime token. |
conversations | string | Path to synchronise conversations. |
conversationMessages | (conversationId: string) => string | Path to post a message to a conversation. |
conversationMessage | (conversationId: string, messageId: string) => string | Path to change one message of a conversation. |
RuntimeChatPreparedClearError
TypeScript @beeos-ai/cloud-harness-sdk · TypeScript only
Thrown by the HTTP port when the original reply is being cleared. The reply then stops writing and keeps the original row; proof identifies the clearing.
class RuntimeChatPreparedClearError extends Error
new RuntimeChatPreparedClearError(readonly proof: RuntimeChatPreparedClearProof)TypeScript · Constructor
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
proof | RuntimeChatPreparedClearProof | yes | Identifies the clearing that stopped the write. |
Properties
| Name | Type | Description |
|---|---|---|
readonly proof | RuntimeChatPreparedClearProof | Identifies the clearing that stopped the write. |
Errors and exceptions
Error types that this module defines. The description of each method says when it raises one.
| Errors | Language | Description |
|---|---|---|
| RuntimeChatPreparedClearError | TypeScript | Thrown by the HTTP port when the original reply is being cleared. The reply then stops writing and keeps the original row; proof identifies the clearing. |