@agenticmail/core 0.9.19 → 0.9.20

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/index.cjs CHANGED
@@ -7854,7 +7854,9 @@ var ElksRealtimeTransport = class {
7854
7854
  // Historical prefix — `elks-bye` / `elks-closed` etc. are matched by
7855
7855
  // long-standing call sites and tests; do not change.
7856
7856
  endReasonPrefix = "elks";
7857
- openaiAudioFormat = { type: "audio/pcm", rate: 24e3 };
7857
+ // OpenAI rejects `format.rate` as an unknown parameter — `audio/pcm` is
7858
+ // implicitly 24 kHz mono PCM16 in the current Realtime API.
7859
+ openaiAudioFormat = { type: "audio/pcm" };
7858
7860
  parseInbound(raw) {
7859
7861
  const msg = parseElksRealtimeMessage(raw);
7860
7862
  if (msg.t === "hello") {
@@ -7885,9 +7887,9 @@ var TwilioRealtimeTransport = class {
7885
7887
  provider = "twilio";
7886
7888
  endReasonPrefix = "twilio";
7887
7889
  // µ-law @ 8 kHz — Twilio's native format; no transcode end to end.
7888
- // > `audio/pcmu` is the OpenAI GA Realtime µ-law format token; verify
7889
- // > against current OpenAI docs before the live smoke-test.
7890
- openaiAudioFormat = { type: "audio/pcmu", rate: 8e3 };
7890
+ // OpenAI rejects `format.rate` as an unknown parameter; `audio/pcmu` is
7891
+ // implicitly 8 kHz G.711 µ-law in the current Realtime API.
7892
+ openaiAudioFormat = { type: "audio/pcmu" };
7891
7893
  /** Latched from the Twilio `start` frame; required on every outbound. */
7892
7894
  streamSid = "";
7893
7895
  /** The active `streamSid`, once the `start` frame has been seen. */
@@ -8247,7 +8249,7 @@ ${task}`);
8247
8249
  }
8248
8250
  return sections.join("\n\n");
8249
8251
  }
8250
- var DEFAULT_REALTIME_AUDIO_FORMAT = { type: "audio/pcm", rate: REALTIME_AUDIO_SAMPLE_RATE };
8252
+ var DEFAULT_REALTIME_AUDIO_FORMAT = { type: "audio/pcm" };
8251
8253
  function buildRealtimeSessionConfig(opts) {
8252
8254
  const tools = opts.tools ?? [];
8253
8255
  const instructions = opts.instructions?.trim() || buildRealtimeInstructions({
@@ -8350,6 +8352,7 @@ var RealtimeVoiceBridge = class {
8350
8352
  if (this.ended || this.openaiReady) return;
8351
8353
  this.openaiReady = true;
8352
8354
  this.safeSend(this.openai, this.sessionConfig);
8355
+ this.safeSend(this.openai, { type: "response.create" });
8353
8356
  for (const audio of this.pendingAudio.splice(0)) {
8354
8357
  this.safeSend(this.openai, { type: "input_audio_buffer.append", audio });
8355
8358
  }
@@ -9082,7 +9085,8 @@ function buildWebhookUrl(config, path2, missionId) {
9082
9085
  return url.toString();
9083
9086
  }
9084
9087
  function buildRealtimeStreamUrl(webhookBaseUrl, missionId, token) {
9085
- const url = new URL(`${apiBaseUrl(webhookBaseUrl)}${TWILIO_REALTIME_WS_PATH}`);
9088
+ const root = webhookBaseUrl.replace(/\/+$/, "");
9089
+ const url = new URL(`${root}${TWILIO_REALTIME_WS_PATH}`);
9086
9090
  url.protocol = url.protocol === "http:" ? "ws:" : "wss:";
9087
9091
  url.searchParams.set("missionId", missionId);
9088
9092
  url.searchParams.set("token", token);
package/dist/index.d.cts CHANGED
@@ -2498,7 +2498,6 @@ declare class ElksRealtimeTransport implements RealtimeTransportAdapter {
2498
2498
  readonly endReasonPrefix = "elks";
2499
2499
  readonly openaiAudioFormat: {
2500
2500
  type: string;
2501
- rate: number;
2502
2501
  };
2503
2502
  constructor(listenFormat?: ElksRealtimeAudioFormat, sendFormat?: ElksRealtimeAudioFormat);
2504
2503
  parseInbound(raw: string | Record<string, unknown>): RealtimeInboundEvent;
@@ -2523,7 +2522,6 @@ declare class TwilioRealtimeTransport implements RealtimeTransportAdapter {
2523
2522
  readonly endReasonPrefix = "twilio";
2524
2523
  readonly openaiAudioFormat: {
2525
2524
  type: string;
2526
- rate: number;
2527
2525
  };
2528
2526
  /** Latched from the Twilio `start` frame; required on every outbound. */
2529
2527
  private streamSid;
@@ -2997,7 +2995,6 @@ interface RealtimeSessionConfigOptions extends RealtimeInstructionOptions {
2997
2995
  /** Default OpenAI Realtime audio format — linear PCM @ 24 kHz (46elks). */
2998
2996
  declare const DEFAULT_REALTIME_AUDIO_FORMAT: {
2999
2997
  readonly type: "audio/pcm";
3000
- readonly rate: 24000;
3001
2998
  };
3002
2999
  /**
3003
3000
  * Build the `session.update` client event for the GA `gpt-realtime`
package/dist/index.d.ts CHANGED
@@ -2498,7 +2498,6 @@ declare class ElksRealtimeTransport implements RealtimeTransportAdapter {
2498
2498
  readonly endReasonPrefix = "elks";
2499
2499
  readonly openaiAudioFormat: {
2500
2500
  type: string;
2501
- rate: number;
2502
2501
  };
2503
2502
  constructor(listenFormat?: ElksRealtimeAudioFormat, sendFormat?: ElksRealtimeAudioFormat);
2504
2503
  parseInbound(raw: string | Record<string, unknown>): RealtimeInboundEvent;
@@ -2523,7 +2522,6 @@ declare class TwilioRealtimeTransport implements RealtimeTransportAdapter {
2523
2522
  readonly endReasonPrefix = "twilio";
2524
2523
  readonly openaiAudioFormat: {
2525
2524
  type: string;
2526
- rate: number;
2527
2525
  };
2528
2526
  /** Latched from the Twilio `start` frame; required on every outbound. */
2529
2527
  private streamSid;
@@ -2997,7 +2995,6 @@ interface RealtimeSessionConfigOptions extends RealtimeInstructionOptions {
2997
2995
  /** Default OpenAI Realtime audio format — linear PCM @ 24 kHz (46elks). */
2998
2996
  declare const DEFAULT_REALTIME_AUDIO_FORMAT: {
2999
2997
  readonly type: "audio/pcm";
3000
- readonly rate: 24000;
3001
2998
  };
3002
2999
  /**
3003
3000
  * Build the `session.update` client event for the GA `gpt-realtime`
package/dist/index.js CHANGED
@@ -6942,7 +6942,9 @@ var ElksRealtimeTransport = class {
6942
6942
  // Historical prefix — `elks-bye` / `elks-closed` etc. are matched by
6943
6943
  // long-standing call sites and tests; do not change.
6944
6944
  endReasonPrefix = "elks";
6945
- openaiAudioFormat = { type: "audio/pcm", rate: 24e3 };
6945
+ // OpenAI rejects `format.rate` as an unknown parameter — `audio/pcm` is
6946
+ // implicitly 24 kHz mono PCM16 in the current Realtime API.
6947
+ openaiAudioFormat = { type: "audio/pcm" };
6946
6948
  parseInbound(raw) {
6947
6949
  const msg = parseElksRealtimeMessage(raw);
6948
6950
  if (msg.t === "hello") {
@@ -6973,9 +6975,9 @@ var TwilioRealtimeTransport = class {
6973
6975
  provider = "twilio";
6974
6976
  endReasonPrefix = "twilio";
6975
6977
  // µ-law @ 8 kHz — Twilio's native format; no transcode end to end.
6976
- // > `audio/pcmu` is the OpenAI GA Realtime µ-law format token; verify
6977
- // > against current OpenAI docs before the live smoke-test.
6978
- openaiAudioFormat = { type: "audio/pcmu", rate: 8e3 };
6978
+ // OpenAI rejects `format.rate` as an unknown parameter; `audio/pcmu` is
6979
+ // implicitly 8 kHz G.711 µ-law in the current Realtime API.
6980
+ openaiAudioFormat = { type: "audio/pcmu" };
6979
6981
  /** Latched from the Twilio `start` frame; required on every outbound. */
6980
6982
  streamSid = "";
6981
6983
  /** The active `streamSid`, once the `start` frame has been seen. */
@@ -7335,7 +7337,7 @@ ${task}`);
7335
7337
  }
7336
7338
  return sections.join("\n\n");
7337
7339
  }
7338
- var DEFAULT_REALTIME_AUDIO_FORMAT = { type: "audio/pcm", rate: REALTIME_AUDIO_SAMPLE_RATE };
7340
+ var DEFAULT_REALTIME_AUDIO_FORMAT = { type: "audio/pcm" };
7339
7341
  function buildRealtimeSessionConfig(opts) {
7340
7342
  const tools = opts.tools ?? [];
7341
7343
  const instructions = opts.instructions?.trim() || buildRealtimeInstructions({
@@ -7438,6 +7440,7 @@ var RealtimeVoiceBridge = class {
7438
7440
  if (this.ended || this.openaiReady) return;
7439
7441
  this.openaiReady = true;
7440
7442
  this.safeSend(this.openai, this.sessionConfig);
7443
+ this.safeSend(this.openai, { type: "response.create" });
7441
7444
  for (const audio of this.pendingAudio.splice(0)) {
7442
7445
  this.safeSend(this.openai, { type: "input_audio_buffer.append", audio });
7443
7446
  }
@@ -8170,7 +8173,8 @@ function buildWebhookUrl(config, path2, missionId) {
8170
8173
  return url.toString();
8171
8174
  }
8172
8175
  function buildRealtimeStreamUrl(webhookBaseUrl, missionId, token) {
8173
- const url = new URL(`${apiBaseUrl(webhookBaseUrl)}${TWILIO_REALTIME_WS_PATH}`);
8176
+ const root = webhookBaseUrl.replace(/\/+$/, "");
8177
+ const url = new URL(`${root}${TWILIO_REALTIME_WS_PATH}`);
8174
8178
  url.protocol = url.protocol === "http:" ? "ws:" : "wss:";
8175
8179
  url.searchParams.set("missionId", missionId);
8176
8180
  url.searchParams.set("token", token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agenticmail/core",
3
- "version": "0.9.19",
3
+ "version": "0.9.20",
4
4
  "description": "Core SDK for AgenticMail — email, SMS, and phone call-control for AI agents",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",