Record Replay Protocol

Methods

Nut.addRecording

Add an existing recording to the context of a chat.

parameters
chatId
ChatId

Chat to add the recording to.

name
string

Name to use for the recording. Not necessary if only one recording is in the chat.

recordingId
Recording.RecordingId

Recording to add to the chat.

Nut.addSimulation

Add simulation data that can create a recording to the context of a chat.

parameters
chatId
ChatId

Chat to add the simulation data to.

name
string

Name to use for the recording associated with the simulation. Not necessary if only one recording is in the chat.

version
string

Version of the simulation data which will be provided.

simulationData
array[ SimulationPacket ]

Initial version dependent simulation data.

completeData
boolean

True if the simulation data is complete and no further data will be provided. If false, addSimulationData commands can be sent until a finishSimulationData command is sent.

saveRecording
boolean

Whether to save the newly created recording. If set a recordingCreated event will be emitted when the recording has finished being saved.

Return Object
recordingId
Recording.RecordingId

Identifier for the newly created recording. Only returned if completeData and saveRecording are both true.

Nut.addSimulationData

Add more simulation data to a chat.

parameters
chatId
ChatId

Chat whose simulation data is being updated.

name
string

Name of the recording associated with the simulation data.

simulationData
array[ SimulationPacket ]

Version dependent simulation data to add.

Nut.deployRepository

Deploy the contents of a repository to another service.

parameters
repositoryId
RepositoryId

The repository to deploy.

settings
object

Settings and authentication credentials for use during deployment.

Return Object
result
object

Information about the deployment result.

Nut.finishChat

Finish an existing chat.

parameters
chatId
ChatId

Chat to finish.

Nut.finishSimulationData

Finish the simulation data for a chat.

parameters
chatId
ChatId

Chat whose simulation data is being updated.

name
string

Name of the recording being finished.

Return Object
recordingId
Recording.RecordingId

Identifier for the recording being finished. Only returned if saveRecording was true when adding the simulation.

Nut.getRepository

Get information about a repository.

parameters
repositoryId
RepositoryId

The ID of the repository to get information about.

Return Object
repositoryContents
RepositoryContents

The contents of the repository.

Nut.resumeChatMessage

Resumes a chat message started by a previous connection. All events associated with that chat message will be emitted again. Does not return until the message has finished.

parameters
chatId
ChatId

Chat to send the message to.

responseId
ChatResponseId

Identifier associated with responses to this messsage.

Nut.sendChatMessage

Send a message to an existing chat. Before returning this will emit one or more chatResponsePart events with the contents of the response. Additional chatTitle and/or chatStatus events may be emitted as well.

parameters
chatId
ChatId

Chat to send the message to.

responseId
ChatResponseId

Identifier associated with responses to this messsage.

mode
string

Controls how the chat message is handled. Possible modes are used for internal testing and are not described by the protocol.

messages
array[ ChatMessage ]

Previous messages in the chat, in chronological order. The response will be to these messages.

references
array[ ChatReference ]

Any references that should be considered when responding to the message.

Nut.setUserId

Set the user to associate with any chats on this connection.

parameters
userId
UserId

ID for the user.

Nut.startChat

Start a new chat with no associated recordings.

Return Object
chatId
ChatId

Identifier for the new chat.

Events

Nut.chatResponsePart

A piece of a response to a chat message.

parameters
chatId
ChatId

Chat to which the message belongs.

responseId
ChatResponseId

Identifier for the initiating sendChatMessage command.

message
ChatMessage

A piece of the response message, will have the "assistant" role.

Nut.chatStatus

Event sent to describe the transient status of the chat for displaying to users.

parameters
chatId
ChatId

Chat to which the message belongs.

responseId
ChatResponseId

Identifier for the initiating sendChatMessage command.

status
string

Updated status for the chat.

Nut.chatTitle

Event sent to indicate a suggested title for a chat based on its contents.

parameters
chatId
ChatId

Chat to which the message belongs.

responseId
ChatResponseId

Identifier for the initiating sendChatMessage command.

title
string

New title for the chat.

Types

Nut.ChatId

Unique identifier for a chat session.

Type: string

Nut.ChatMessage

Any messages that can appear in a chat.

Type: object

Nut.ChatMessageBase

Members common to all chat messages.

Type: object

properties
id
string

Identifier for the message in the chat.

role
ChatMessageRole

Role which generated the message.

level
ChatMessageLevel

Level of detail of this message. The same message can have content at multiple levels so that it can be displayed in multiple ways.

createTime
string

The time when the message was created, if available.

repositoryId
RepositoryId

If this message is associated with code changes, the new version of the repository. This will only be associated with 'assistant' messages.

repositoryURL
string

Permanent URL for loading the repository.

peanuts
number

For 'assistant' messages, describes the backend resources used to produce the message. This is measured as a count in peanuts, which are $0.01 each.

Nut.ChatMessageImage

A message used by a chat with an image.

Type: ChatMessageBase

properties
type
"image"
dataURL
string

The image content as a data URL like data:image/jpeg;base64,...

Nut.ChatMessageLevel

Levels of detail of chat message content.

Allowed Values: summary, detailed

Type: string

Nut.ChatMessageRole

The role of a message in a chat.

Allowed Values: user, assistant

Type: string

Nut.ChatMessageText

A message used by a chat with text content.

Type: ChatMessageBase

properties
type
"text"
content
string

The message's content.

Nut.ChatReference

An external reference in a chat message not captured by the text itself.

Allowed Values: ChatReferenceElement

Type: object

Nut.ChatReferenceElement

A reference to an element on the page.

Type: object

properties
kind
"element"
selector
string

The selector of the element that was clicked.

width
number

The width of the element that was clicked.

height
number

The height of the element that was clicked.

x
number

The x coordinate within the element that was clicked.

y
number

The y coordinate within the element that was clicked.

Nut.ChatResponseId

Identifier for correlating chatResponsePart events with a sendChatMessage command. they are responding to.

Type: string

Nut.RepositoryContents

The contents of a repository, as a base64 encoded zip file.

Type: string

Nut.RepositoryId

Unique identifier for an immutable state of a code repository that can be operated on.

Type: string

Nut.SimulationPacket

A packet of simulation data. The contents of this are version dependent.

Type: object

Nut.UserId

Unique identifier for a user.

Type: string