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.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.sendChatMessage

Send a message to an existing chat. Before returning this will emit one or more chatResponsePart events with the contents of the new message. If developerFiles is set then chatModifiedFile events may also be emitted.

parameters
chatId
ChatId

Chat to send the message to.

responseId
ChatResponseId

Identifier associated with responses to this messsage.

messages
array[ ChatMessage ]

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

developerFiles
array[ ChatFile ]

If the chat message is allowed to modify or create files, array of the existing files in the project (which could be empty).

Nut.startChat

Start a new chat with no associated recordings.

Return Object
chatId
ChatId

Identifier for the new chat.

Events

Nut.chatModifiedFile

A file that was modified or created by a chat message.

parameters
chatId
ChatId

Chat to which the message belongs.

responseId
ChatResponseId

Identifier for the initiating sendChatMessage command.

file
ChatFile

The file that was modified or created.

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.

Types

Nut.ChatFile

A file that can be modified or created by a chat message.

Type: object

properties
path
string

Relative path to the file.

content
string

Contents of the file, in plain text or base64 depending on the base64 property.

base64
boolean

If true, the provided content is in base64. Required for binary files.

Nut.ChatId

Unique identifier for a chat session.

Type: string

Nut.ChatMessage

Any messages that can appear in a chat.

Type: object

Nut.ChatMessageImage

A message used by a chat with an image.

Type: object

properties
type
"image"
role
ChatMessageRole

Role which generated the message.

dataURL
string

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

Nut.ChatMessageRole

The role of a message in a chat.

Allowed Values: user, assistant, system

Type: string

Nut.ChatMessageText

A message used by a chat with text content.

Type: object

properties
type
"text"
role
ChatMessageRole

Role which generated the message.

content
string

The message's content.

Nut.ChatResponseId

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

Type: string

Nut.SimulationPacket

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

Type: object