@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.
@@ -1,5 +1,5 @@
1
1
 
2
- > @alexkroman1/aai@1.7.0 build /home/runner/work/agent/agent/packages/aai
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
  ℹ tsdown v0.21.7 powered by rolldown v1.0.0-rc.12
@@ -8,7 +8,7 @@
8
8
  ℹ target: node22
9
9
  ℹ tsconfig: tsconfig.json
10
10
  ℹ Build start
11
- ℹ dist/host/runtime-barrel.js 113.08 kB │ gzip: 32.35 kB
11
+ ℹ dist/host/runtime-barrel.js 113.03 kB │ gzip: 32.35 kB
12
12
  ℹ dist/sdk/protocol.js  5.70 kB │ gzip: 1.92 kB
13
13
  ℹ dist/index.js  2.88 kB │ gzip: 1.24 kB
14
14
  ℹ dist/sdk/manifest-barrel.js  0.36 kB │ gzip: 0.20 kB
@@ -26,5 +26,5 @@
26
26
  ℹ dist/rime-58p9mDR8.js  1.08 kB │ gzip: 0.51 kB
27
27
  ℹ dist/s3-BtCMvCod.js  0.76 kB │ gzip: 0.29 kB
28
28
  ℹ dist/pinecone-CeJ69aRs.js  0.48 kB │ gzip: 0.24 kB
29
- ℹ 18 files, total: 144.78 kB
29
+ ℹ 18 files, total: 144.72 kB
30
30
  ✔ Build complete in 54ms
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 WebSocket, { WebSocketServer } from "ws";
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 WebSocket(SONIOX_WS_URL);
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 !== WebSocket.OPEN) return;
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 WebSocket(url, { headers: { Authorization: `Bearer ${apiKey}` } });
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 !== WebSocket.OPEN) return;
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 !== WebSocket.OPEN) return;
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 === WebSocket.OPEN) ws.send(JSON.stringify({ operation: "clear" }));
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 WebSocket(url, { headers: opts.headers });
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
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alexkroman1/aai",
3
- "version": "1.7.0",
3
+ "version": "1.7.1",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": {