@niadra/sdk 0.10.3 → 0.10.4

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.
Files changed (56) hide show
  1. package/CHANGELOG.md +10 -0
  2. package/dist/ai-sdk.d.cts +3 -3
  3. package/dist/ai-sdk.d.ts +3 -3
  4. package/dist/anthropic.d.cts +4 -4
  5. package/dist/anthropic.d.ts +4 -4
  6. package/dist/bedrock.d.cts +4 -4
  7. package/dist/bedrock.d.ts +4 -4
  8. package/dist/cli.js +14 -2
  9. package/dist/cli.js.map +1 -1
  10. package/dist/{client-rmWhZJOx.d.cts → client-7mkrdRI0.d.cts} +4 -2
  11. package/dist/{client-rmWhZJOx.d.ts → client-7mkrdRI0.d.ts} +4 -2
  12. package/dist/cloudflare-agents.d.cts +3 -3
  13. package/dist/cloudflare-agents.d.ts +3 -3
  14. package/dist/elevenlabs.d.cts +5 -5
  15. package/dist/elevenlabs.d.ts +5 -5
  16. package/dist/genkit.d.cts +3 -3
  17. package/dist/genkit.d.ts +3 -3
  18. package/dist/google-adk.d.cts +3 -3
  19. package/dist/google-adk.d.ts +3 -3
  20. package/dist/google-genai.d.cts +4 -4
  21. package/dist/google-genai.d.ts +4 -4
  22. package/dist/index.cjs +14 -2
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +3 -3
  25. package/dist/index.d.ts +3 -3
  26. package/dist/index.js +14 -2
  27. package/dist/index.js.map +1 -1
  28. package/dist/{intercept-C0XODsy9.d.cts → intercept-CGQhwAom.d.cts} +1 -1
  29. package/dist/{intercept-veMDudKV.d.ts → intercept-CT0vglsd.d.ts} +1 -1
  30. package/dist/langchain.d.cts +3 -3
  31. package/dist/langchain.d.ts +3 -3
  32. package/dist/livekit.d.cts +3 -3
  33. package/dist/livekit.d.ts +3 -3
  34. package/dist/llamaindex.d.cts +3 -3
  35. package/dist/llamaindex.d.ts +3 -3
  36. package/dist/mastra.d.cts +3 -3
  37. package/dist/mastra.d.ts +3 -3
  38. package/dist/openai-agents.d.cts +3 -3
  39. package/dist/openai-agents.d.ts +3 -3
  40. package/dist/retell.d.cts +5 -5
  41. package/dist/retell.d.ts +5 -5
  42. package/dist/{shared-Cs7h5C4Y.d.ts → shared-Bf84jr3Y.d.ts} +1 -1
  43. package/dist/{shared-zaTBum17.d.cts → shared-CxAwOcZI.d.cts} +1 -1
  44. package/dist/strands.d.cts +3 -3
  45. package/dist/strands.d.ts +3 -3
  46. package/dist/twilio.d.cts +4 -4
  47. package/dist/twilio.d.ts +4 -4
  48. package/dist/vapi.d.cts +5 -5
  49. package/dist/vapi.d.ts +5 -5
  50. package/dist/voltagent.d.cts +3 -3
  51. package/dist/voltagent.d.ts +3 -3
  52. package/dist/{webhook-CX7nvQig.d.cts → webhook-DE3HsGkb.d.cts} +1 -1
  53. package/dist/{webhook-2V5QgnKI.d.ts → webhook-QxYgxE6_.d.ts} +1 -1
  54. package/dist/whatsapp.d.cts +2 -2
  55. package/dist/whatsapp.d.ts +2 -2
  56. package/package.json +1 -1
package/CHANGELOG.md CHANGED
@@ -4,6 +4,16 @@ All notable changes to this package are documented here. The format follows [Kee
4
4
 
5
5
  ## [Unreleased]
6
6
 
7
+ ## [0.10.4] - 2026-10-03
8
+
9
+ ### Fixed
10
+
11
+ - A read made before the startup probe measured the round trip used the bare default budget, and timed out
12
+ from Sao Paulo (the first context read carrying the customer's turn took 674 ms). While the probe is on its
13
+ way and a connection is open, `timeouts.context` and `timeouts.navigation` you did not set get
14
+ `timeouts.connect` on top; with no connection open the transport already adds it, never twice. A probe that
15
+ failed, or `voice: { probe: false }`, leaves the defaults as they are.
16
+
7
17
  ## [0.10.3] - 2026-10-03
8
18
 
9
19
  ### Added
package/dist/ai-sdk.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ToolSet } from 'ai';
2
- import { f as ModelUsage, g5 as TurnParams, f_ as TurnFrame } from './client-rmWhZJOx.cjs';
3
- import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-zaTBum17.cjs';
4
- export { P as Proof, c as attestationProof } from './shared-zaTBum17.cjs';
2
+ import { f as ModelUsage, g5 as TurnParams, f_ as TurnFrame } from './client-7mkrdRI0.cjs';
3
+ import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-CxAwOcZI.cjs';
4
+ export { P as Proof, c as attestationProof } from './shared-CxAwOcZI.cjs';
5
5
 
6
6
  /**
7
7
  * Niadra for the Vercel AI SDK (`ai` 5, 6 and 7), the idiomatic way: a language model middleware
package/dist/ai-sdk.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ToolSet } from 'ai';
2
- import { f as ModelUsage, g5 as TurnParams, f_ as TurnFrame } from './client-rmWhZJOx.js';
3
- import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-Cs7h5C4Y.js';
4
- export { P as Proof, c as attestationProof } from './shared-Cs7h5C4Y.js';
2
+ import { f as ModelUsage, g5 as TurnParams, f_ as TurnFrame } from './client-7mkrdRI0.js';
3
+ import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-Bf84jr3Y.js';
4
+ export { P as Proof, c as attestationProof } from './shared-Bf84jr3Y.js';
5
5
 
6
6
  /**
7
7
  * Niadra for the Vercel AI SDK (`ai` 5, 6 and 7), the idiomatic way: a language model middleware
@@ -1,7 +1,7 @@
1
- import { W as WrapOptions } from './intercept-C0XODsy9.cjs';
2
- import { S as SessionResolver } from './shared-zaTBum17.cjs';
3
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-zaTBum17.cjs';
4
- import './client-rmWhZJOx.cjs';
1
+ import { W as WrapOptions } from './intercept-CGQhwAom.cjs';
2
+ import { S as SessionResolver } from './shared-CxAwOcZI.cjs';
3
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-CxAwOcZI.cjs';
4
+ import './client-7mkrdRI0.cjs';
5
5
 
6
6
  /**
7
7
  * Niadra for the Anthropic TypeScript SDK (`@anthropic-ai/sdk`), as `wrap()` is for OpenAI.
@@ -1,7 +1,7 @@
1
- import { W as WrapOptions } from './intercept-veMDudKV.js';
2
- import { S as SessionResolver } from './shared-Cs7h5C4Y.js';
3
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-Cs7h5C4Y.js';
4
- import './client-rmWhZJOx.js';
1
+ import { W as WrapOptions } from './intercept-CT0vglsd.js';
2
+ import { S as SessionResolver } from './shared-Bf84jr3Y.js';
3
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-Bf84jr3Y.js';
4
+ import './client-7mkrdRI0.js';
5
5
 
6
6
  /**
7
7
  * Niadra for the Anthropic TypeScript SDK (`@anthropic-ai/sdk`), as `wrap()` is for OpenAI.
@@ -1,7 +1,7 @@
1
- import { f as ModelUsage } from './client-rmWhZJOx.cjs';
2
- import { W as WrapOptions } from './intercept-C0XODsy9.cjs';
3
- import { S as SessionResolver } from './shared-zaTBum17.cjs';
4
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-zaTBum17.cjs';
1
+ import { f as ModelUsage } from './client-7mkrdRI0.cjs';
2
+ import { W as WrapOptions } from './intercept-CGQhwAom.cjs';
3
+ import { S as SessionResolver } from './shared-CxAwOcZI.cjs';
4
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-CxAwOcZI.cjs';
5
5
 
6
6
  /**
7
7
  * Niadra for Amazon Bedrock's Converse API (`@aws-sdk/client-bedrock-runtime`), as `wrap()` is for
package/dist/bedrock.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { f as ModelUsage } from './client-rmWhZJOx.js';
2
- import { W as WrapOptions } from './intercept-veMDudKV.js';
3
- import { S as SessionResolver } from './shared-Cs7h5C4Y.js';
4
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-Cs7h5C4Y.js';
1
+ import { f as ModelUsage } from './client-7mkrdRI0.js';
2
+ import { W as WrapOptions } from './intercept-CT0vglsd.js';
3
+ import { S as SessionResolver } from './shared-Bf84jr3Y.js';
4
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-Bf84jr3Y.js';
5
5
 
6
6
  /**
7
7
  * Niadra for Amazon Bedrock's Converse API (`@aws-sdk/client-bedrock-runtime`), as `wrap()` is for
package/dist/cli.js CHANGED
@@ -510,7 +510,7 @@ function internalRecord(span, ref, act) {
510
510
  }
511
511
 
512
512
  // src/version.ts
513
- var VERSION = "0.10.3";
513
+ var VERSION = "0.10.4";
514
514
 
515
515
  // src/transport.ts
516
516
  var RETRYABLE_WRITE_STATUS = /* @__PURE__ */ new Set([408, 421, 429, 500, 502, 503, 504]);
@@ -528,6 +528,10 @@ var Transport = class {
528
528
  grantedAt;
529
529
  /** When the client last sent a request of its own (`RequestSpec.activity`), in epoch milliseconds. */
530
530
  lastActivityAt;
531
+ /** Likely: an answer came within `keepAliveMs`. When not, the next budgeted call gets `coldAllowanceMs`. */
532
+ connectionOpen() {
533
+ return this.answeredAt !== void 0 && Date.now() - this.answeredAt <= (this.config.keepAliveMs ?? 0);
534
+ }
531
535
  async request(spec) {
532
536
  if (spec.activity !== false) this.lastActivityAt = Date.now();
533
537
  const budgeted = this.withAllowance(spec);
@@ -8488,6 +8492,8 @@ var Niadra = class _Niadra {
8488
8492
  /** The read budgets the caller left at their defaults: they take the measured round trip on top. */
8489
8493
  defaultReads;
8490
8494
  voiceStarted = false;
8495
+ /** A probe is on its way: until it ends, default read budgets get `timeouts.connect` on top. */
8496
+ measuring = false;
8491
8497
  voiceWarned = false;
8492
8498
  strict;
8493
8499
  /** Where the client reports what it swallows in fail-open mode. */
@@ -9555,6 +9561,7 @@ var Niadra = class _Niadra {
9555
9561
  /** Measures the round trip to the region once per client, in the background. */
9556
9562
  probe(core) {
9557
9563
  if (!this.voice.claimProbe()) return;
9564
+ this.measuring = true;
9558
9565
  void (async () => {
9559
9566
  const samples = [];
9560
9567
  for (let i = 0; i < 2; i++) {
@@ -9568,12 +9575,14 @@ var Niadra = class _Niadra {
9568
9575
  });
9569
9576
  } catch (error) {
9570
9577
  this.logger.debug(`round trip probe failed: ${describe(toNiadraError(error))}`);
9578
+ this.measuring = false;
9571
9579
  return;
9572
9580
  }
9573
9581
  samples.push(Date.now() - started);
9574
9582
  }
9575
9583
  const rtt = Math.min(...samples);
9576
9584
  this.voice.rtt = rtt;
9585
+ this.measuring = false;
9577
9586
  this.logger.debug(`round trip to the region ${Math.round(rtt)} ms`);
9578
9587
  const explicit = ["context", "navigation"].filter((name) => !this.defaultReads.has(name));
9579
9588
  for (const warning of budgetWarnings(rtt, this.timeouts, explicit)) this.logger.warn(warning);
@@ -9586,8 +9595,11 @@ var Niadra = class _Niadra {
9586
9595
  * timed out by the network; one the caller set is a ceiling.
9587
9596
  */
9588
9597
  readBudget(name) {
9598
+ if (!this.defaultReads.has(name)) return this.timeouts[name];
9589
9599
  const rtt = this.voice.rtt;
9590
- return rtt !== null && this.defaultReads.has(name) ? this.timeouts[name] + rtt : this.timeouts[name];
9600
+ if (rtt !== null) return this.timeouts[name] + rtt;
9601
+ const open = this.core?.transport.connectionOpen() ?? false;
9602
+ return this.measuring && open ? this.timeouts[name] + this.timeouts.connect : this.timeouts[name];
9591
9603
  }
9592
9604
  /** The client reads in voice: the voice budgets' warnings matter from now on. */
9593
9605
  startVoice(core) {