@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.
- package/CHANGELOG.md +10 -0
- package/dist/ai-sdk.d.cts +3 -3
- package/dist/ai-sdk.d.ts +3 -3
- package/dist/anthropic.d.cts +4 -4
- package/dist/anthropic.d.ts +4 -4
- package/dist/bedrock.d.cts +4 -4
- package/dist/bedrock.d.ts +4 -4
- package/dist/cli.js +32 -10
- package/dist/cli.js.map +1 -1
- package/dist/{client-CG257pe3.d.cts → client-CdkRzWz6.d.cts} +11 -0
- package/dist/{client-CG257pe3.d.ts → client-CdkRzWz6.d.ts} +11 -0
- package/dist/cloudflare-agents.d.cts +3 -3
- package/dist/cloudflare-agents.d.ts +3 -3
- package/dist/elevenlabs.d.cts +5 -5
- package/dist/elevenlabs.d.ts +5 -5
- package/dist/genkit.d.cts +3 -3
- package/dist/genkit.d.ts +3 -3
- package/dist/google-adk.d.cts +3 -3
- package/dist/google-adk.d.ts +3 -3
- package/dist/google-genai.d.cts +4 -4
- package/dist/google-genai.d.ts +4 -4
- package/dist/index.cjs +32 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +32 -10
- package/dist/index.js.map +1 -1
- package/dist/{intercept-CvbXtKsU.d.cts → intercept-C_9uxSRY.d.cts} +1 -1
- package/dist/{intercept-EqNiV5f2.d.ts → intercept-tVhq4GNK.d.ts} +1 -1
- package/dist/langchain.d.cts +3 -3
- package/dist/langchain.d.ts +3 -3
- package/dist/livekit.d.cts +3 -3
- package/dist/livekit.d.ts +3 -3
- package/dist/llamaindex.d.cts +3 -3
- package/dist/llamaindex.d.ts +3 -3
- package/dist/mastra.d.cts +3 -3
- package/dist/mastra.d.ts +3 -3
- package/dist/openai-agents.d.cts +3 -3
- package/dist/openai-agents.d.ts +3 -3
- package/dist/retell.d.cts +5 -5
- package/dist/retell.d.ts +5 -5
- package/dist/{shared-Dmo7pRV5.d.cts → shared-DH_QGnci.d.cts} +1 -1
- package/dist/{shared--OTV6MgP.d.ts → shared-SqZSrkls.d.ts} +1 -1
- package/dist/strands.d.cts +3 -3
- package/dist/strands.d.ts +3 -3
- package/dist/twilio.d.cts +4 -4
- package/dist/twilio.d.ts +4 -4
- package/dist/vapi.d.cts +5 -5
- package/dist/vapi.d.ts +5 -5
- package/dist/voltagent.d.cts +3 -3
- package/dist/voltagent.d.ts +3 -3
- package/dist/{webhook-Bcgl38Nz.d.ts → webhook-BNvRGq0g.d.ts} +1 -1
- package/dist/{webhook-CPc6wZKf.d.cts → webhook-DIHeQ7DO.d.cts} +1 -1
- package/dist/whatsapp.d.cts +2 -2
- package/dist/whatsapp.d.ts +2 -2
- 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-
|
|
3
|
-
import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared-
|
|
4
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
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-
|
|
3
|
-
import { a as ProofSource, A as AgentMemoryOption, b as Session, S as SessionResolver } from './shared
|
|
4
|
-
export { P as Proof, c as attestationProof } from './shared
|
|
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
|
package/dist/anthropic.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as WrapOptions } from './intercept-
|
|
2
|
-
import { S as SessionResolver } from './shared-
|
|
3
|
-
export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-
|
|
4
|
-
import './client-
|
|
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.
|
package/dist/anthropic.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { W as WrapOptions } from './intercept-
|
|
2
|
-
import { S as SessionResolver } from './shared
|
|
3
|
-
export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared
|
|
4
|
-
import './client-
|
|
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.
|
package/dist/bedrock.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { f as ModelUsage } from './client-
|
|
2
|
-
import { W as WrapOptions } from './intercept-
|
|
3
|
-
import { S as SessionResolver } from './shared-
|
|
4
|
-
export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared-
|
|
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-
|
|
2
|
-
import { W as WrapOptions } from './intercept-
|
|
3
|
-
import { S as SessionResolver } from './shared
|
|
4
|
-
export { A as AgentMemoryOption, P as Proof, a as ProofSource, b as Session, c as attestationProof } from './shared
|
|
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.
|
|
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
|
-
|
|
8689
|
-
if (
|
|
8690
|
-
|
|
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
|
|
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
|
|
9622
|
+
if (rtt !== null) return base + rtt;
|
|
9601
9623
|
const open = this.core?.transport.connectionOpen() ?? false;
|
|
9602
|
-
return this.measuring && open ?
|
|
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) {
|