@siduri-x/api 2.0.7 → 2.0.8

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/app.js CHANGED
@@ -229,12 +229,14 @@ function createApp(runtimes = new Map()) {
229
229
  res.flushHeaders?.();
230
230
  const abortController = new AbortController();
231
231
  const onClose = () => {
232
- abortController.abort('client_disconnect');
233
- if (runtime.mouth && typeof runtime.mouth.interrupt === 'function') {
234
- runtime.mouth.interrupt('client_disconnect');
232
+ if (!res.writableEnded) {
233
+ abortController.abort('client_disconnect');
234
+ if (runtime.mouth && typeof runtime.mouth.interrupt === 'function') {
235
+ runtime.mouth.interrupt('client_disconnect');
236
+ }
235
237
  }
236
238
  };
237
- req.on('close', onClose);
239
+ res.on('close', onClose);
238
240
  try {
239
241
  const response = await (0, runtime_1.dispatchCompanionChat)(runtime, {
240
242
  id: companionId,
@@ -290,7 +292,7 @@ function createApp(runtimes = new Map()) {
290
292
  res.end();
291
293
  }
292
294
  finally {
293
- req.removeListener('close', onClose);
295
+ res.removeListener('close', onClose);
294
296
  }
295
297
  });
296
298
  // INTERRUPTION / BARGE-IN
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@siduri-x/api",
3
- "version": "2.0.7",
3
+ "version": "2.0.8",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -23,8 +23,8 @@
23
23
  "@siduri-x/mouth": "2.0.2",
24
24
  "@siduri-x/observation": "2.0.1",
25
25
  "@siduri-x/self": "2.0.4",
26
- "@siduri-x/voice": "2.0.2",
27
- "@siduri-x/vision": "2.0.1"
26
+ "@siduri-x/vision": "2.0.1",
27
+ "@siduri-x/voice": "2.0.2"
28
28
  },
29
29
  "devDependencies": {
30
30
  "@types/cors": "^2.8.19",
package/src/app.ts CHANGED
@@ -264,12 +264,14 @@ export function createApp(runtimes: Map<string, SiduriRuntime> = new Map()): App
264
264
 
265
265
  const abortController = new AbortController();
266
266
  const onClose = () => {
267
- abortController.abort('client_disconnect');
268
- if (runtime.mouth && typeof runtime.mouth.interrupt === 'function') {
269
- runtime.mouth.interrupt('client_disconnect');
267
+ if (!res.writableEnded) {
268
+ abortController.abort('client_disconnect');
269
+ if (runtime.mouth && typeof runtime.mouth.interrupt === 'function') {
270
+ runtime.mouth.interrupt('client_disconnect');
271
+ }
270
272
  }
271
273
  };
272
- req.on('close', onClose);
274
+ res.on('close', onClose);
273
275
 
274
276
  try {
275
277
  const response = await dispatchCompanionChat(runtime, {
@@ -329,7 +331,7 @@ export function createApp(runtimes: Map<string, SiduriRuntime> = new Map()): App
329
331
  }
330
332
  res.end();
331
333
  } finally {
332
- req.removeListener('close', onClose);
334
+ res.removeListener('close', onClose);
333
335
  }
334
336
  });
335
337