- Emit "stop" event when stopListening is called without a microphone.
- Add
disconnect
method to disconnect from the server.
- Add
timeout
argument tostartListening
methods.
- Fix reconnection logic with a timer between attempts.
- Add
audio.outputServiceSetVolume
to set the volume of character speech.
- Add sttUrl to AudioManagerOptions.
- Add missing file extensions
- Add exports for
AudioManagerOptions
andAudioOutputsServicePlayOptions
.
BREAKING
- Added
AudioManager
class to handle audio input and output. - Removed
Microphone
andSpeaker
classes. Replaced withAudioManager
methods. - Use AudioContext API for better browser compatibility.
- Updated types SpeechRecognitionStartEvent, SpeechRecognitionResponse, SpeechRecognitionParameters with traceId.
- Add orientation type to ImageLayer.
- Speech recognition now uses the correct sample rate in Firefox.
- Stopping the microphone now stops the underlying
MediaStreamTrack
, removing the red 'listening' icon.
- Fixed an issue where speech recognition was using an incorrect sample rate.
- BREAKING: This packages now exports ES Module only.
- BREAKING: An implementation of
fetch
is no longer included with this library. Consumers of this library should ensure their environment supportsfetch
. - BREAKING: This library now relies on having
URLSearchParams
available in the environment. - BREAKING: This library now relies on having
BigInt
available in the environment. - BREAKING:
playthroughId
s andconversationId
s have been changed fromnumber
tostring
type everywhere in this SDK, and renamed toplaythroughUuid
andconversationUuid
. - BREAKING:
api.createPlaythroughToken
,api.createConversation
andapi.createCharacterConversation
all now return an object instead of a scalar, to facilitate any future changes to these methods. - BREAKING:
memories
ingetPlaythroughInfo
and in themessage
event now returnsaveValue
s as JSON instead of only as strings. For example, counter memories are now actuallynumber
s and boolean memories are now actuallyboolean
s. - BREAKING:
getMessageHistory
has been removed, andgetEventHistory
added as a more fully-featured alternative with much greater support for filtering, and can return all event types. setMemory
now accepts any JSON values instead of only strings.- BREAKING: Speech recognition stream now uses common objects to start up, deliver results and stop, regardless of which downstream service is selected.
- Add start and stop events to the speech recognition stream.
- Added
result
event toMicrophone
so clients can subscribe to rawSpeechRecognition
events. recognise
andrecognise-interim
now emit the text of the last result instead of the first result in theSpeechRecognition
event ifcontinuous
istrue
.
- Multiple memories can now be set at once using the
setMemory
call.
- Add support for
forkPlaythrough
API. This enables a player to upgrade to the latest published version from their old playthrough, copying across memories and emotions into the new playthrough, and returning the new token. Note that conversations are not carried across.
problem
events scoped to a conversation can now be listened to viaconversation.on("problem", ...)
- It's now possible to specify multiple supported speech encodings in
speechConfig
by passing an array instead of a string. Charisma will use the first encoding that the voice synthesis service supports. - Added experimental support for intermediate client events. These events can be sent to Charisma to prevent characters from talking if the player is still speaking or typing. This can only be enabled for a story by getting in touch at hello@charisma.ai.
- Added support for Decentraland.
- SDK info is now also sent upon reconnection to the room.
package.json
now references correct emitted types location.
- Added
languageCode
option tocreatePlaythroughToken
, to play Charisma stories in languages other than English. - Added SDK info to joining a room, for Charisma to track which SDK versions are in use.
- It's now possible to subscribe to events that are sent from other players, such as other players' messages. This can be done by adding a subscriber to a conversation to listen for the corresponding event, e.g.
conversation.on("reply", () => { /* remote player's reply */ })
. These handlers will not be fired for messages sent from the local connected client, only for remote clients. - Add missing
graphId: number
toMessagePathItem
type. - Updated dependencies.
- Added
startGraphId
andstartGraphReferenceId
toStartEvent
to start from a specific graph ID. - Added experimental
pause
andplay
methods toPlaythrough
.
- Support for action node/event.
SpeechRecognitionStopOptions
is now exported.
There is a new emotion engine in Charisma! As a result...
message.characterMoods
has been removed and replaced withmessage.emotions
. This contains each character's current mood and relationship with the player, and any active feeling effects.setMood
has been removed. We may add an equivalent API for the new emotion engine in the future. Let us know about your use case if this interests you!
Microphone.stopListening()
now accepts anoptions
parameter with a single optionwaitForLastResult
. If set totrue
, then therecognise
will be called a final time with the result of the audio captured so far. Iffalse
, the operation will be aborted, so no additionalrecognise
event will occur.
Speaker.play()
now accepts anoptions
parameter as its second parameter instead of a boolean value (which used to representinterrupt
). This change is backwards compatible, but the old boolean way is deprecated and will be removed in the next major release.options
contains two parameters:trackId
andinterrupt
.trackId
can be used to interrupt only a particular track, for example, to prevent a character talking over themselves.interrupt
can now be configured toall
(interrupt all playing audio),track
(interrupt the specifiedtrackId
if playing), ornone
(don't interrupt any audio).
- Adds the option to pass an
apiKey
to use for authentication for playthrough token creation. This is now the recommended way to authenticate as API keys do not expire (unless regenerated) and are more secure than theuserToken
.userToken
should no longer be used.
This release makes several breaking changes. The main change is replacing socket.io
with colyseus.js
.
- Replaces
socket.io
withcolyseus.js
.- Due to how Colyseus serializes data,
audio
is now anArrayBuffer
instead of an object with thedata
property.
- Due to how Colyseus serializes data,
- API methods and the
Playthrough
constructor now accept abaseUrl
option, which is used in preference toglobalBaseUrl
.globalBaseUrl
is now set withsetGlobalBaseUrl
instead ofsetBaseUrl
. - API methods are now individually exported instead of being static methods on the Charisma class, as well as being exported under a bracket
api
object. - Improved the implementation of
Microphone
. - Replace multiple connection events from
Charisma
(connect
,disconnect
etc) with singleconnection-status
event. - The
Charisma
class has been renamed toPlaythrough
. - The
cleanup
function has been renamed todisconnect
.
- Change
imageLayers
field to an array of object, each includingurl
,resizeMode
andpoints
.
- Add
isImpactShareable
andimpactImageUrl
fields to impacts, and fix the type of impactid
s to bestring
s.
- BREAKING CHANGE:
eventId
s are now emitted asstring
s. Please upgrade to this version to continue using the reconnection "catch-up" logic (though everything else should work).
Speaker
will no longer try to play audio if the context's state is notrunning
. This resolves an issue where the user has not granted permission for the audio context to play sound, and so theplay(...)
promise never resolves.
- Reconnecting will now fetch and emit messages that were emitted from the server after the last received message.
- Add
impacts
field toGetPlaythroughResult
type.
- Pass through more events:
reconnect
,reconnecting
,disconnect
andproblem
. - Added types for new
panel
message, and added bubble-related types onto themedia
key. - Adjusted
setMemory
type to acceptnull
. - Removes
scene-complete
event andstopOnSceneComplete
option. - Adds
episode-complete
event. The chat engine automatically stops on episode end if the episode is started by an app user. - Adds
restartFromEpisodeId
andrestartFromEpisodeIndex
methods and removesrestartFromScene
method.
- GET requests no longer try to add a body to the request.
- Add
start
andstop
events toSpeaker
.
- Adds support for use in Node.js.
Microphone.startListening(timeout)
now has a timeout parameter to automatically stop the microphone aftertimeout
milliseconds.Microphone.resetTimeout(timeout)
will reset the timeout totimeout
milliseconds.
- Microphone now emits
start
andstop
events, particularly useful in conjuction with timeout.
- Add an
interrupt
option toSpeaker
to ensure replies don't overlap. - Breaking: Target ES2018; drop support for pre-ES2018 environments.
- Add
restartFromScene
method to SDK. This can be used to reset the playthrough to the state it was in at the beginning of a particular scene. - Exports more types and adjusts message types to include
eventId
,timestamp
andmemories
.
- Add
resume
event to SDK. This can be used to resume a conversation from where it left off.
- Use
webkitAudioContext
forSpeaker
on Safari.
- Export the
Impact
type.
impacts
are now objects containing their ID as well as theimpact
string.
- Rename
setStopOnSceneEnd
tosetStopOnSceneComplete
to ensure consistency with the event name.
- Fix
createPlaythroughToken
throwing an error when bothversion
anduserToken
are not provided.
- Initial stable release.
- Completely overhauls the SDK API, please see the README for more details on how to use the newer, conversation-based API.
- Pass data (containing
impacts
) through on scene complete event.
- Pass
stopOnSceneComplete
through to theCharismaInstance
.
- Add
stopOnSceneComplete
option to prevent automatically continuing between scenes.
- Add
media
field onto the character message type.
- Add
tapToContinue
to message history type.
- Add
timestamp
to messages returned fromgetMessageHistory
. - Improved type for
getMessageHistory
.
- Can now specify
playthroughToken
to re-use a playthrough instead of creating a new one when connecting. - Can now fetch message history of the playthrough using
charisma.getMessageHistory
.
- Fix
IMessageCharacter.speech
type.
ISynthesisConfig
and some additional types are now exported.
speech
now takes a config object as well as a boolean. It can specify the audio encoding to use and whether it returns the raw audio data, or a link to an audio file.
- BREAKING: The
reply
event has been renamed tomessage
, and now has atype
field on the payload to distinguish betweencharacter
andmedia
events. Other fields have been refactored, such ascharacter
andspeech
. Please consult src/types.ts to find the new message format. - A new
tap
event is available for the client to send.
- Accidentally published version, but never tagged as
latest
.
- Fix broken 0.5.0 publish.
- Removed
browser
field frompackage.json
. Consumers can use the UMD directly from unpkg. - Removed
actIndex
as it is no longer supported.
- Buffer
set-memory
events untilstatus: 'ready'
is received.
actIndex
andsceneIndex
can now be set on thestart
event to start from a specific story scene.
- BREAKING: UMD name changed from
Charisma
toCharismaSDK
. The ES/CJS builds now don't bundle their dependencies. - Added
setMemory
method to directly set a memory. - Fixed all ID types to be
number
, notstring
.
- Passing no
version
to theconnect
method now results in using the latest published version, rather than the draft version.
- Package renamed (rescoped) to
@charisma-ai/sdk
.
- The
debug
option has been replaced with theversion
option, which defaults toundefined
(the latest published story version).
- The microphone now stops listening when a reply with
endStory
set totrue
is emitted.
AudioContext
is now created on-demand rather than on initialisation.
- Socket.io now forces websockets, skipping the long-polling check.
- Fixed issue where audio was not working on Safari.
- Microphone keeps better track of whether to resume speech recognition after speaking.
- Support for recording speech-to-text via Chrome SpeechRecognition.
- New events
recognise-interim
andrecognise
. - Speech recognition is paused while the audio is played.
- New events
- Initial release.
- Support for
reply
andstart
client events, andreply
,start-typing
andstop-typing
server events. - Support for playing text-to-speech audio.