@absolutejs/voice 0.0.22-beta.565 → 0.0.22-beta.567

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/vue/index.js CHANGED
@@ -10677,8 +10677,15 @@ var serverMessageToAction = (message) => {
10677
10677
  case "assistant":
10678
10678
  return {
10679
10679
  text: message.text,
10680
+ turnId: message.turnId,
10680
10681
  type: "assistant"
10681
10682
  };
10683
+ case "assistant_delta":
10684
+ return {
10685
+ delta: message.delta,
10686
+ turnId: message.turnId,
10687
+ type: "assistant_delta"
10688
+ };
10682
10689
  case "complete":
10683
10690
  return {
10684
10691
  sessionId: message.sessionId,
@@ -11097,6 +11104,7 @@ var createInitialReconnectState = () => ({
11097
11104
  });
11098
11105
  var createInitialState = () => ({
11099
11106
  assistantAudio: [],
11107
+ assistantStreamingText: "",
11100
11108
  assistantTexts: [],
11101
11109
  call: null,
11102
11110
  error: null,
@@ -11134,9 +11142,16 @@ var createVoiceStreamStore = () => {
11134
11142
  case "assistant":
11135
11143
  state = {
11136
11144
  ...state,
11145
+ assistantStreamingText: "",
11137
11146
  assistantTexts: [...state.assistantTexts, action.text]
11138
11147
  };
11139
11148
  break;
11149
+ case "assistant_delta":
11150
+ state = {
11151
+ ...state,
11152
+ assistantStreamingText: `${state.assistantStreamingText}${action.delta}`
11153
+ };
11154
+ break;
11140
11155
  case "complete":
11141
11156
  state = {
11142
11157
  ...state,
@@ -11204,6 +11219,7 @@ var createVoiceStreamStore = () => {
11204
11219
  case "replay":
11205
11220
  state = {
11206
11221
  ...state,
11222
+ assistantStreamingText: "",
11207
11223
  assistantTexts: [...action.assistantTexts],
11208
11224
  call: action.call ?? null,
11209
11225
  error: null,
@@ -11315,6 +11331,9 @@ var createVoiceStream = (path, options = {}) => {
11315
11331
  get assistantTexts() {
11316
11332
  return store.getSnapshot().assistantTexts;
11317
11333
  },
11334
+ get assistantStreamingText() {
11335
+ return store.getSnapshot().assistantStreamingText;
11336
+ },
11318
11337
  get call() {
11319
11338
  return store.getSnapshot().call;
11320
11339
  },
@@ -11383,6 +11402,7 @@ var createVoiceStream = (path, options = {}) => {
11383
11402
  function useVoiceStream(path, options = {}) {
11384
11403
  const stream = createVoiceStream(path, options);
11385
11404
  const assistantAudio = shallowRef20([]);
11405
+ const assistantStreamingText = ref16("");
11386
11406
  const assistantTexts = shallowRef20([]);
11387
11407
  const call = shallowRef20(null);
11388
11408
  const error = ref16(null);
@@ -11395,6 +11415,7 @@ function useVoiceStream(path, options = {}) {
11395
11415
  const turns = shallowRef20([]);
11396
11416
  const sync = () => {
11397
11417
  assistantAudio.value = [...stream.assistantAudio];
11418
+ assistantStreamingText.value = stream.assistantStreamingText;
11398
11419
  assistantTexts.value = [...stream.assistantTexts];
11399
11420
  call.value = stream.call;
11400
11421
  error.value = stream.error;
@@ -11415,6 +11436,7 @@ function useVoiceStream(path, options = {}) {
11415
11436
  onUnmounted21(destroy);
11416
11437
  return {
11417
11438
  assistantAudio,
11439
+ assistantStreamingText,
11418
11440
  assistantTexts,
11419
11441
  call,
11420
11442
  error,
@@ -11896,6 +11918,7 @@ var resolveVoiceRuntimePreset = (name = "default") => {
11896
11918
  // src/client/controller.ts
11897
11919
  var createInitialState2 = (stream) => ({
11898
11920
  assistantAudio: [...stream.assistantAudio],
11921
+ assistantStreamingText: stream.assistantStreamingText,
11899
11922
  assistantTexts: [...stream.assistantTexts],
11900
11923
  call: stream.call,
11901
11924
  error: stream.error,
@@ -11928,6 +11951,7 @@ var createVoiceController = (path, options = {}) => {
11928
11951
  state = {
11929
11952
  ...state,
11930
11953
  assistantAudio: [...stream.assistantAudio],
11954
+ assistantStreamingText: stream.assistantStreamingText,
11931
11955
  assistantTexts: [...stream.assistantTexts],
11932
11956
  call: stream.call,
11933
11957
  error: stream.error,
@@ -12021,6 +12045,9 @@ var createVoiceController = (path, options = {}) => {
12021
12045
  get assistantTexts() {
12022
12046
  return state.assistantTexts;
12023
12047
  },
12048
+ get assistantStreamingText() {
12049
+ return state.assistantStreamingText;
12050
+ },
12024
12051
  bindHTMX(bindingOptions) {
12025
12052
  return bindVoiceHTMX(stream, bindingOptions);
12026
12053
  },
@@ -12086,6 +12113,7 @@ var createVoiceController = (path, options = {}) => {
12086
12113
  function useVoiceController(path, options = {}) {
12087
12114
  const controller = createVoiceController(path, options);
12088
12115
  const assistantAudio = shallowRef21([]);
12116
+ const assistantStreamingText = ref17("");
12089
12117
  const assistantTexts = shallowRef21([]);
12090
12118
  const error = ref17(null);
12091
12119
  const isConnected = ref17(false);
@@ -12098,6 +12126,7 @@ function useVoiceController(path, options = {}) {
12098
12126
  const turns = shallowRef21([]);
12099
12127
  const sync = () => {
12100
12128
  assistantAudio.value = [...controller.assistantAudio];
12129
+ assistantStreamingText.value = controller.assistantStreamingText;
12101
12130
  assistantTexts.value = [...controller.assistantTexts];
12102
12131
  error.value = controller.error;
12103
12132
  isConnected.value = controller.isConnected;
@@ -12118,6 +12147,7 @@ function useVoiceController(path, options = {}) {
12118
12147
  onUnmounted22(destroy);
12119
12148
  return {
12120
12149
  assistantAudio,
12150
+ assistantStreamingText,
12121
12151
  assistantTexts,
12122
12152
  bindHTMX: controller.bindHTMX,
12123
12153
  error,
@@ -11,6 +11,7 @@ export declare function useVoiceController<TResult = unknown>(path: string, opti
11
11
  receivedAt: number;
12
12
  turnId?: string;
13
13
  }[]>;
14
+ assistantStreamingText: import("vue").Ref<string, string>;
14
15
  assistantTexts: import("vue").ShallowRef<string[], string[]>;
15
16
  bindHTMX: (options: import("..").VoiceHTMXBindingOptions) => () => void;
16
17
  error: import("vue").Ref<string | null, string | null>;
@@ -11,6 +11,7 @@ export declare function useVoiceStream<TResult = unknown>(path: string, options?
11
11
  receivedAt: number;
12
12
  turnId?: string;
13
13
  }[]>;
14
+ assistantStreamingText: import("vue").Ref<string, string>;
14
15
  assistantTexts: import("vue").ShallowRef<string[], string[]>;
15
16
  call: import("vue").ShallowRef<import("..").VoiceCallLifecycleState | null, import("..").VoiceCallLifecycleState | null>;
16
17
  error: import("vue").Ref<string | null, string | null>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@absolutejs/voice",
3
- "version": "0.0.22-beta.565",
3
+ "version": "0.0.22-beta.567",
4
4
  "description": "Voice primitives and Elysia plugin for AbsoluteJS",
5
5
  "repository": {
6
6
  "type": "git",