@alexkroman1/aai 1.7.0 → 1.7.1
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/.turbo/turbo-build.log +3 -3
- package/CHANGELOG.md +6 -0
- package/dist/host/runtime-barrel.js +9 -12
- package/host/s2s.ts +1 -4
- package/package.json +1 -1
package/.turbo/turbo-build.log
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
|
|
2
|
-
> @alexkroman1/aai@1.7.
|
|
2
|
+
> @alexkroman1/aai@1.7.1 build /home/runner/work/agent/agent/packages/aai
|
|
3
3
|
> tsdown && tsc -p tsconfig.build.json
|
|
4
4
|
|
|
5
5
|
[34mℹ[39m [34mtsdown v0.21.7[39m powered by [38;2;255;126;23mrolldown v1.0.0-rc.12[39m
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
[34mℹ[39m target: [34mnode22[39m
|
|
9
9
|
[34mℹ[39m tsconfig: [34mtsconfig.json[39m
|
|
10
10
|
[34mℹ[39m Build start
|
|
11
|
-
[34mℹ[39m [2mdist/[22m[1mhost/runtime-barrel.js[22m [2m113.
|
|
11
|
+
[34mℹ[39m [2mdist/[22m[1mhost/runtime-barrel.js[22m [2m113.03 kB[22m [2m│ gzip: 32.35 kB[22m
|
|
12
12
|
[34mℹ[39m [2mdist/[22m[1msdk/protocol.js[22m [2m 5.70 kB[22m [2m│ gzip: 1.92 kB[22m
|
|
13
13
|
[34mℹ[39m [2mdist/[22m[1mindex.js[22m [2m 2.88 kB[22m [2m│ gzip: 1.24 kB[22m
|
|
14
14
|
[34mℹ[39m [2mdist/[22m[1msdk/manifest-barrel.js[22m [2m 0.36 kB[22m [2m│ gzip: 0.20 kB[22m
|
|
@@ -26,5 +26,5 @@
|
|
|
26
26
|
[34mℹ[39m [2mdist/[22mrime-58p9mDR8.js [2m 1.08 kB[22m [2m│ gzip: 0.51 kB[22m
|
|
27
27
|
[34mℹ[39m [2mdist/[22ms3-BtCMvCod.js [2m 0.76 kB[22m [2m│ gzip: 0.29 kB[22m
|
|
28
28
|
[34mℹ[39m [2mdist/[22mpinecone-CeJ69aRs.js [2m 0.48 kB[22m [2m│ gzip: 0.24 kB[22m
|
|
29
|
-
[34mℹ[39m 18 files, total: 144.
|
|
29
|
+
[34mℹ[39m 18 files, total: 144.72 kB
|
|
30
30
|
[32m✔[39m Build complete in [32m54ms[39m
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# @alexkroman1/aai
|
|
2
2
|
|
|
3
|
+
## 1.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 3c711da: Stop per-frame debug log spam when S2S socket is closed; sendAudio now silently drops frames matching sendAudioRaw and pipeline/STT behavior. Closure is still logged once via the WebSocket close event.
|
|
8
|
+
|
|
3
9
|
## 1.7.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
|
@@ -24,7 +24,7 @@ import { createNanoEvents } from "nanoevents";
|
|
|
24
24
|
import { DeepgramClient } from "@deepgram/sdk";
|
|
25
25
|
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
|
|
26
26
|
import { AudioFormat, CommitStrategy, RealtimeEvents } from "@elevenlabs/elevenlabs-js/wrapper/realtime/index.js";
|
|
27
|
-
import
|
|
27
|
+
import WsWebSocket, { WebSocketServer } from "ws";
|
|
28
28
|
import { Cartesia } from "@cartesia/cartesia-js";
|
|
29
29
|
import { createStorage, prefixStorage } from "unstorage";
|
|
30
30
|
import pTimeout from "p-timeout";
|
|
@@ -814,7 +814,7 @@ function openSoniox(opts = {}) {
|
|
|
814
814
|
async open(openOpts) {
|
|
815
815
|
const apiKey = openOpts.apiKey || process.env.SONIOX_API_KEY;
|
|
816
816
|
if (!apiKey) throw makeSttError("stt_auth_failed", "Soniox STT: missing API key. Set SONIOX_API_KEY in the agent env.");
|
|
817
|
-
const ws = new
|
|
817
|
+
const ws = new WsWebSocket(SONIOX_WS_URL);
|
|
818
818
|
const emitter = createNanoEvents();
|
|
819
819
|
let closed = false;
|
|
820
820
|
const finalBuf = { value: "" };
|
|
@@ -852,7 +852,7 @@ function openSoniox(opts = {}) {
|
|
|
852
852
|
else openOpts.signal.addEventListener("abort", () => void close(), { once: true });
|
|
853
853
|
return {
|
|
854
854
|
sendAudio(pcm) {
|
|
855
|
-
if (closed || ws.readyState !==
|
|
855
|
+
if (closed || ws.readyState !== WsWebSocket.OPEN) return;
|
|
856
856
|
ws.send(new Uint8Array(pcm.buffer, pcm.byteOffset, pcm.byteLength), { binary: true });
|
|
857
857
|
},
|
|
858
858
|
on(event, fn) {
|
|
@@ -1164,7 +1164,7 @@ function openRime(opts) {
|
|
|
1164
1164
|
const url = `wss://users-ws.rime.ai/ws2?speaker=${encodeURIComponent(voice)}&modelId=${encodeURIComponent(model)}&audioFormat=pcm&samplingRate=${sampleRate}&lang=${encodeURIComponent(lang)}`;
|
|
1165
1165
|
let ws;
|
|
1166
1166
|
try {
|
|
1167
|
-
ws = new
|
|
1167
|
+
ws = new WsWebSocket(url, { headers: { Authorization: `Bearer ${apiKey}` } });
|
|
1168
1168
|
} catch (cause) {
|
|
1169
1169
|
throw makeTtsError("tts_connect_failed", `Rime TTS: failed to create WebSocket: ${cause instanceof Error ? cause.message : String(cause)}`);
|
|
1170
1170
|
}
|
|
@@ -1224,19 +1224,19 @@ function openRime(opts) {
|
|
|
1224
1224
|
return {
|
|
1225
1225
|
sendText(text) {
|
|
1226
1226
|
if (closed || text.length === 0) return;
|
|
1227
|
-
if (ws.readyState !==
|
|
1227
|
+
if (ws.readyState !== WsWebSocket.OPEN) return;
|
|
1228
1228
|
doneEmitted = false;
|
|
1229
1229
|
ws.send(JSON.stringify({ text }));
|
|
1230
1230
|
},
|
|
1231
1231
|
flush() {
|
|
1232
1232
|
if (closed) return;
|
|
1233
|
-
if (ws.readyState !==
|
|
1233
|
+
if (ws.readyState !== WsWebSocket.OPEN) return;
|
|
1234
1234
|
ws.send(JSON.stringify({ text: "." }));
|
|
1235
1235
|
armFirstAudioTimer();
|
|
1236
1236
|
},
|
|
1237
1237
|
cancel() {
|
|
1238
1238
|
if (closed) return;
|
|
1239
|
-
if (ws.readyState ===
|
|
1239
|
+
if (ws.readyState === WsWebSocket.OPEN) ws.send(JSON.stringify({ operation: "clear" }));
|
|
1240
1240
|
emitDoneOnce();
|
|
1241
1241
|
},
|
|
1242
1242
|
on(event, fn) {
|
|
@@ -2325,7 +2325,7 @@ function createPipelineTransport(opts) {
|
|
|
2325
2325
|
//#region host/s2s.ts
|
|
2326
2326
|
const uint8ToBase64 = (bytes) => Buffer.from(bytes).toString("base64");
|
|
2327
2327
|
const base64ToUint8 = (base64) => new Uint8Array(Buffer.from(base64, "base64"));
|
|
2328
|
-
const defaultCreateS2sWebSocket = (url, opts) => new
|
|
2328
|
+
const defaultCreateS2sWebSocket = (url, opts) => new WsWebSocket(url, { headers: opts.headers });
|
|
2329
2329
|
const S2sMessageSchema = z.discriminatedUnion("type", [
|
|
2330
2330
|
z.object({
|
|
2331
2331
|
type: z.literal("session.ready"),
|
|
@@ -2445,10 +2445,7 @@ function connectS2s(opts) {
|
|
|
2445
2445
|
}
|
|
2446
2446
|
const handle = {
|
|
2447
2447
|
sendAudio(audio) {
|
|
2448
|
-
if (ws.readyState !== 1)
|
|
2449
|
-
log.debug("S2S sendAudio dropped: socket not open");
|
|
2450
|
-
return;
|
|
2451
|
-
}
|
|
2448
|
+
if (ws.readyState !== 1) return;
|
|
2452
2449
|
ws.send(`{"type":"input.audio","audio":"${uint8ToBase64(audio)}"}`);
|
|
2453
2450
|
},
|
|
2454
2451
|
sendAudioRaw(jsonFrame) {
|
package/host/s2s.ts
CHANGED
|
@@ -246,10 +246,7 @@ export function connectS2s(opts: ConnectS2sOptions): Promise<S2sHandle> {
|
|
|
246
246
|
|
|
247
247
|
const handle: S2sHandle = {
|
|
248
248
|
sendAudio(audio: Uint8Array): void {
|
|
249
|
-
if (ws.readyState !== WS_OPEN)
|
|
250
|
-
log.debug("S2S sendAudio dropped: socket not open");
|
|
251
|
-
return;
|
|
252
|
-
}
|
|
249
|
+
if (ws.readyState !== WS_OPEN) return;
|
|
253
250
|
ws.send(`{"type":"input.audio","audio":"${uint8ToBase64(audio)}"}`);
|
|
254
251
|
},
|
|
255
252
|
|