@livekit/agents 1.0.49 → 1.0.50
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/ipc/job_proc_lazy_main.cjs +13 -4
- package/dist/ipc/job_proc_lazy_main.cjs.map +1 -1
- package/dist/ipc/job_proc_lazy_main.js +13 -4
- package/dist/ipc/job_proc_lazy_main.js.map +1 -1
- package/dist/version.cjs +1 -1
- package/dist/version.js +1 -1
- package/dist/voice/agent_activity.cjs +3 -0
- package/dist/voice/agent_activity.cjs.map +1 -1
- package/dist/voice/agent_activity.d.ts.map +1 -1
- package/dist/voice/agent_activity.js +3 -0
- package/dist/voice/agent_activity.js.map +1 -1
- package/package.json +1 -1
- package/src/ipc/job_proc_lazy_main.ts +15 -4
- package/src/voice/agent_activity.ts +10 -0
package/package.json
CHANGED
|
@@ -16,11 +16,22 @@ import type { IPCMessage } from './message.js';
|
|
|
16
16
|
const ORPHANED_TIMEOUT = 15 * 1000;
|
|
17
17
|
|
|
18
18
|
const safeSend = (msg: IPCMessage): boolean => {
|
|
19
|
-
|
|
20
|
-
process.send
|
|
21
|
-
|
|
19
|
+
try {
|
|
20
|
+
if (process.connected && process.send) {
|
|
21
|
+
process.send(msg);
|
|
22
|
+
return true;
|
|
23
|
+
}
|
|
24
|
+
return false;
|
|
25
|
+
} catch (error) {
|
|
26
|
+
// Channel closed is expected during graceful shutdown
|
|
27
|
+
// Log at debug level to avoid noise in production logs
|
|
28
|
+
if (error instanceof Error && error.message.includes('Channel closed')) {
|
|
29
|
+
log().debug({ msgCase: msg.case }, 'IPC channel closed, message not sent');
|
|
30
|
+
} else {
|
|
31
|
+
log().error({ error, msgCase: msg.case }, 'IPC send failed unexpectedly');
|
|
32
|
+
}
|
|
33
|
+
return false;
|
|
22
34
|
}
|
|
23
|
-
return false;
|
|
24
35
|
};
|
|
25
36
|
|
|
26
37
|
type JobTask = {
|
|
@@ -1040,6 +1040,16 @@ export class AgentActivity implements RecognitionHooks {
|
|
|
1040
1040
|
throw new Error('Speech queue is empty');
|
|
1041
1041
|
}
|
|
1042
1042
|
const speechHandle = heapItem[2];
|
|
1043
|
+
|
|
1044
|
+
// Skip speech handles that were already interrupted/done before being
|
|
1045
|
+
// picked up from the queue (e.g. interrupted during shutdown before the
|
|
1046
|
+
// main loop had a chance to process them). Calling _authorizeGeneration
|
|
1047
|
+
// on a done handle would create a generation Future that nobody resolves,
|
|
1048
|
+
// causing the main loop to hang forever.
|
|
1049
|
+
if (speechHandle.interrupted || speechHandle.done()) {
|
|
1050
|
+
continue;
|
|
1051
|
+
}
|
|
1052
|
+
|
|
1043
1053
|
this._currentSpeech = speechHandle;
|
|
1044
1054
|
speechHandle._authorizeGeneration();
|
|
1045
1055
|
await speechHandle._waitForGeneration();
|