@niadra/sdk 0.11.0 → 0.11.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.
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 +32 -10
  9. package/dist/cli.js.map +1 -1
  10. package/dist/{client-CG257pe3.d.cts → client-CdkRzWz6.d.cts} +11 -0
  11. package/dist/{client-CG257pe3.d.ts → client-CdkRzWz6.d.ts} +11 -0
  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 +32 -10
  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 +32 -10
  27. package/dist/index.js.map +1 -1
  28. package/dist/{intercept-CvbXtKsU.d.cts → intercept-C_9uxSRY.d.cts} +1 -1
  29. package/dist/{intercept-EqNiV5f2.d.ts → intercept-tVhq4GNK.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-Dmo7pRV5.d.cts → shared-DH_QGnci.d.cts} +1 -1
  43. package/dist/{shared--OTV6MgP.d.ts → shared-SqZSrkls.d.ts} +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-Bcgl38Nz.d.ts → webhook-BNvRGq0g.d.ts} +1 -1
  53. package/dist/{webhook-CPc6wZKf.d.cts → webhook-DIHeQ7DO.d.cts} +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.11.1] - 2026-10-05
8
+
9
+ ### Fixed
10
+
11
+ - The first read of a conversation, task or object in a client gets `timeouts.contextFirst` (1,000 ms, plus
12
+ the measured round trip) when `context` is left at its default, and so does the first `agentMemory()` read.
13
+ The API compiles the pack on that read: one right after a customer's first message took 410 ms on the
14
+ server, the 300 ms default plus the round trip cut it short, and the agent answered without memory. Later
15
+ reads of the same key keep the short budget. A `context` you set stays a ceiling.
16
+
7
17
  ## [0.11.0] - 2026-10-05
8
18
 
9
19
  The server gives every item one id, a bare UUID, on every surface. This release follows it and removes the
package/dist/ai-sdk.d.cts CHANGED
@@ -1,7 +1,7 @@
1
1
  import { ToolSet } from 'ai';
2
- import { f as ModelUsage, ga as TurnParams, g3 as TurnFrame } from './client-CG257pe3.cjs';
3
- import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-Dmo7pRV5.cjs';
4
- export { P as Proof, c as attestationProof } from './shared-Dmo7pRV5.cjs';
2
+ import { f as ModelUsage, ga as TurnParams, g3 as TurnFrame } from './client-CdkRzWz6.cjs';
3
+ import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-DH_QGnci.cjs';
4
+ export { P as Proof, c as attestationProof } from './shared-DH_QGnci.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, ga as TurnParams, g3 as TurnFrame } from './client-CG257pe3.js';
3
- import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared--OTV6MgP.js';
4
- export { P as Proof, c as attestationProof } from './shared--OTV6MgP.js';
2
+ import { f as ModelUsage, ga as TurnParams, g3 as TurnFrame } from './client-CdkRzWz6.js';
3
+ import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-SqZSrkls.js';
4
+ export { P as Proof, c as attestationProof } from './shared-SqZSrkls.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-CvbXtKsU.cjs';
2
- import { S as SessionResolver } from './shared-Dmo7pRV5.cjs';
3
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-Dmo7pRV5.cjs';
4
- import './client-CG257pe3.cjs';
1
+ import { W as WrapOptions } from './intercept-C_9uxSRY.cjs';
2
+ import { S as SessionResolver } from './shared-DH_QGnci.cjs';
3
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-DH_QGnci.cjs';
4
+ import './client-CdkRzWz6.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-EqNiV5f2.js';
2
- import { S as SessionResolver } from './shared--OTV6MgP.js';
3
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared--OTV6MgP.js';
4
- import './client-CG257pe3.js';
1
+ import { W as WrapOptions } from './intercept-tVhq4GNK.js';
2
+ import { S as SessionResolver } from './shared-SqZSrkls.js';
3
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-SqZSrkls.js';
4
+ import './client-CdkRzWz6.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-CG257pe3.cjs';
2
- import { W as WrapOptions } from './intercept-CvbXtKsU.cjs';
3
- import { S as SessionResolver } from './shared-Dmo7pRV5.cjs';
4
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-Dmo7pRV5.cjs';
1
+ import { f as ModelUsage } from './client-CdkRzWz6.cjs';
2
+ import { W as WrapOptions } from './intercept-C_9uxSRY.cjs';
3
+ import { S as SessionResolver } from './shared-DH_QGnci.cjs';
4
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-DH_QGnci.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-CG257pe3.js';
2
- import { W as WrapOptions } from './intercept-EqNiV5f2.js';
3
- import { S as SessionResolver } from './shared--OTV6MgP.js';
4
- export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared--OTV6MgP.js';
1
+ import { f as ModelUsage } from './client-CdkRzWz6.js';
2
+ import { W as WrapOptions } from './intercept-tVhq4GNK.js';
3
+ import { S as SessionResolver } from './shared-SqZSrkls.js';
4
+ export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-SqZSrkls.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.11.0";
513
+ var VERSION = "0.11.1";
514
514
 
515
515
  // src/transport.ts
516
516
  var RETRYABLE_WRITE_STATUS = /* @__PURE__ */ new Set([408, 421, 429, 500, 502, 503, 504]);
@@ -7657,6 +7657,7 @@ var consoleLogger = {
7657
7657
  // src/options.ts
7658
7658
  var DEFAULT_TIMEOUTS = {
7659
7659
  context: 300,
7660
+ contextFirst: 1e3,
7660
7661
  contextVoice: 200,
7661
7662
  contextVoiceStart: 1500,
7662
7663
  navigation: 600,
@@ -8467,6 +8468,7 @@ function rttWarnings(rttMs, timeouts) {
8467
8468
  }
8468
8469
 
8469
8470
  // src/client.ts
8471
+ var READ_KEYS_KEPT = 4096;
8470
8472
  function readEnv(name) {
8471
8473
  try {
8472
8474
  const env = globalThis.process?.env;
@@ -8494,6 +8496,8 @@ var Niadra = class _Niadra {
8494
8496
  voiceStarted = false;
8495
8497
  /** A probe is on its way: until it ends, default read budgets get `timeouts.connect` on top. */
8496
8498
  measuring = false;
8499
+ /** The keys whose read answered in this client, oldest first: a first read gets `timeouts.contextFirst`. */
8500
+ answeredReads = /* @__PURE__ */ new Map();
8497
8501
  voiceWarned = false;
8498
8502
  strict;
8499
8503
  /** Where the client reports what it swallows in fail-open mode. */
@@ -8680,14 +8684,28 @@ var Niadra = class _Niadra {
8680
8684
  if (this.content.registered && result2.state) result2.state = await this.content.fill(result2.state);
8681
8685
  return result2;
8682
8686
  }
8683
- readContext(core, params, request, options) {
8684
- const timeout = options.timeout ?? (request.view === "voice" ? this.timeouts.contextVoice : this.readBudget("context"));
8687
+ async readContext(core, params, request, options) {
8685
8688
  const { query: own2, ...pinned2 } = request;
8686
8689
  const query = turnText(own2 ?? params.turn);
8690
+ const readKey = cacheKey(pinned2);
8691
+ const first = !this.answeredReads.has(readKey);
8692
+ const timeout = options.timeout ?? (request.view === "voice" ? this.timeouts.contextVoice : this.readBudget("context", first));
8687
8693
  const voiceCache = this.voiceCache(core, pinned2, options.cache);
8688
- if (voiceCache) return this.voiceContext(core, voiceCache, pinned2, query, timeout, options);
8689
- if (query !== null) return this.turnContext(core, pinned2, query, timeout, options);
8690
- return this.pinnedContext(core, pinned2, timeout, options);
8694
+ let result2;
8695
+ if (voiceCache) result2 = await this.voiceContext(core, voiceCache, pinned2, query, timeout, options);
8696
+ else if (query !== null) result2 = await this.turnContext(core, pinned2, query, timeout, options);
8697
+ else result2 = await this.pinnedContext(core, pinned2, timeout, options);
8698
+ if (result2.error === null) this.readAnswered(readKey);
8699
+ return result2;
8700
+ }
8701
+ readAnswered(key2) {
8702
+ this.answeredReads.delete(key2);
8703
+ this.answeredReads.set(key2, true);
8704
+ while (this.answeredReads.size > READ_KEYS_KEPT) {
8705
+ const oldest = this.answeredReads.keys().next().value;
8706
+ if (oldest === void 0) break;
8707
+ this.answeredReads.delete(oldest);
8708
+ }
8691
8709
  }
8692
8710
  /**
8693
8711
  * The SDK profile of this key's space: the features it turned on, the claim contract and the summarized
@@ -9095,7 +9113,9 @@ var Niadra = class _Niadra {
9095
9113
  const key2 = AgentMemoryCache.key(params);
9096
9114
  const fresh = cache?.fresh(key2);
9097
9115
  if (fresh) return blockResult(fresh, "cache");
9098
- const timeout = options.timeout ?? (params.view === "voice" ? this.timeouts.contextVoice : this.readBudget("context"));
9116
+ const readKey = `agent-memory:${key2}`;
9117
+ const first = !this.answeredReads.has(readKey);
9118
+ const timeout = options.timeout ?? (params.view === "voice" ? this.timeouts.contextVoice : this.readBudget("context", first));
9099
9119
  const spec = this.readSpec("GET", "/v1/agent-memory/block", void 0, timeout, options);
9100
9120
  spec.query = {
9101
9121
  max_tokens: String(params.max_tokens ?? 300),
@@ -9106,6 +9126,7 @@ var Niadra = class _Niadra {
9106
9126
  if (etag) spec.headers = { ...options.headers, "if-none-match": etag };
9107
9127
  try {
9108
9128
  const response = await core.transport.request(spec);
9129
+ this.readAnswered(readKey);
9109
9130
  cache?.store(key2, response.data);
9110
9131
  return blockResult(response.data, "network");
9111
9132
  } catch (error) {
@@ -9594,12 +9615,13 @@ var Niadra = class _Niadra {
9594
9615
  * to the region goes on top, so an agent far from the region (Sao Paulo, 170 ms from us-east-2) is not
9595
9616
  * timed out by the network; one the caller set is a ceiling.
9596
9617
  */
9597
- readBudget(name) {
9618
+ readBudget(name, first = false) {
9598
9619
  if (!this.defaultReads.has(name)) return this.timeouts[name];
9620
+ const base = first && name === "context" ? Math.max(this.timeouts.context, this.timeouts.contextFirst) : this.timeouts[name];
9599
9621
  const rtt = this.voice.rtt;
9600
- if (rtt !== null) return this.timeouts[name] + rtt;
9622
+ if (rtt !== null) return base + rtt;
9601
9623
  const open = this.core?.transport.connectionOpen() ?? false;
9602
- return this.measuring && open ? this.timeouts[name] + this.timeouts.connect : this.timeouts[name];
9624
+ return this.measuring && open ? base + this.timeouts.connect : base;
9603
9625
  }
9604
9626
  /** The client reads in voice: the voice budgets' warnings matter from now on. */
9605
9627
  startVoice(core) {