@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.
- 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 +14 -2
- package/dist/cli.js.map +1 -1
- package/dist/{client-rmWhZJOx.d.cts → client-7mkrdRI0.d.cts} +4 -2
- package/dist/{client-rmWhZJOx.d.ts → client-7mkrdRI0.d.ts} +4 -2
- 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 +14 -2
- 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 +14 -2
- package/dist/index.js.map +1 -1
- package/dist/{intercept-C0XODsy9.d.cts → intercept-CGQhwAom.d.cts} +1 -1
- package/dist/{intercept-veMDudKV.d.ts → intercept-CT0vglsd.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-Cs7h5C4Y.d.ts → shared-Bf84jr3Y.d.ts} +1 -1
- package/dist/{shared-zaTBum17.d.cts → shared-CxAwOcZI.d.cts} +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-CX7nvQig.d.cts → webhook-DE3HsGkb.d.cts} +1 -1
- package/dist/{webhook-2V5QgnKI.d.ts → webhook-QxYgxE6_.d.ts} +1 -1
- package/dist/whatsapp.d.cts +2 -2
- package/dist/whatsapp.d.ts +2 -2
- package/package.json +1 -1
|
@@ -6377,8 +6377,8 @@ interface ObjectTimelineParams {
|
|
|
6377
6377
|
* the round trip to the region once when it starts (`VoiceOptions.probe`) and adds it on top, so an
|
|
6378
6378
|
* agent far from the region (Sao Paulo is 170 ms from us-east-2) is not timed out by the network.
|
|
6379
6379
|
* A value you set is a ceiling the SDK keeps; when the measured round trip plus 50 ms exceeds it,
|
|
6380
|
-
* the client logs one warning, since every such read would run out of time.
|
|
6381
|
-
*
|
|
6380
|
+
* the client logs one warning, since every such read would run out of time. While the probe is on its
|
|
6381
|
+
* way, `connect` goes on top of them instead; a probe that failed, or `probe: false`, leaves them as they are.
|
|
6382
6382
|
*/
|
|
6383
6383
|
interface Timeouts {
|
|
6384
6384
|
/** `context()` for every view except `voice`. */
|
|
@@ -6743,6 +6743,8 @@ declare class Niadra {
|
|
|
6743
6743
|
/** The read budgets the caller left at their defaults: they take the measured round trip on top. */
|
|
6744
6744
|
private readonly defaultReads;
|
|
6745
6745
|
private voiceStarted;
|
|
6746
|
+
/** A probe is on its way: until it ends, default read budgets get `timeouts.connect` on top. */
|
|
6747
|
+
private measuring;
|
|
6746
6748
|
private voiceWarned;
|
|
6747
6749
|
private readonly strict;
|
|
6748
6750
|
/** Where the client reports what it swallows in fail-open mode. */
|
|
@@ -6377,8 +6377,8 @@ interface ObjectTimelineParams {
|
|
|
6377
6377
|
* the round trip to the region once when it starts (`VoiceOptions.probe`) and adds it on top, so an
|
|
6378
6378
|
* agent far from the region (Sao Paulo is 170 ms from us-east-2) is not timed out by the network.
|
|
6379
6379
|
* A value you set is a ceiling the SDK keeps; when the measured round trip plus 50 ms exceeds it,
|
|
6380
|
-
* the client logs one warning, since every such read would run out of time.
|
|
6381
|
-
*
|
|
6380
|
+
* the client logs one warning, since every such read would run out of time. While the probe is on its
|
|
6381
|
+
* way, `connect` goes on top of them instead; a probe that failed, or `probe: false`, leaves them as they are.
|
|
6382
6382
|
*/
|
|
6383
6383
|
interface Timeouts {
|
|
6384
6384
|
/** `context()` for every view except `voice`. */
|
|
@@ -6743,6 +6743,8 @@ declare class Niadra {
|
|
|
6743
6743
|
/** The read budgets the caller left at their defaults: they take the measured round trip on top. */
|
|
6744
6744
|
private readonly defaultReads;
|
|
6745
6745
|
private voiceStarted;
|
|
6746
|
+
/** A probe is on its way: until it ends, default read budgets get `timeouts.connect` on top. */
|
|
6747
|
+
private measuring;
|
|
6746
6748
|
private voiceWarned;
|
|
6747
6749
|
private readonly strict;
|
|
6748
6750
|
/** Where the client reports what it swallows in fail-open mode. */
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ToolSet } from 'ai';
|
|
2
|
-
import { c as Niadra, g as Handle, g3 as TurnOptions, f as ModelUsage } from './client-
|
|
2
|
+
import { c as Niadra, g as Handle, g3 as TurnOptions, f as ModelUsage } from './client-7mkrdRI0.cjs';
|
|
3
3
|
import { NiadraMiddleware } from './ai-sdk.cjs';
|
|
4
|
-
import { b as Session, a as ProofSource, A as AgentMemoryOption } from './shared-
|
|
5
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
4
|
+
import { b as Session, a as ProofSource, A as AgentMemoryOption } from './shared-CxAwOcZI.cjs';
|
|
5
|
+
export { P as Proof, c as attestationProof } from './shared-CxAwOcZI.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Niadra for the Cloudflare Agents SDK (`agents` 0.x): one helper per `Agent` instance (a Durable
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ToolSet } from 'ai';
|
|
2
|
-
import { c as Niadra, g as Handle, g3 as TurnOptions, f as ModelUsage } from './client-
|
|
2
|
+
import { c as Niadra, g as Handle, g3 as TurnOptions, f as ModelUsage } from './client-7mkrdRI0.js';
|
|
3
3
|
import { NiadraMiddleware } from './ai-sdk.js';
|
|
4
|
-
import { b as Session, a as ProofSource, A as AgentMemoryOption } from './shared-
|
|
5
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
4
|
+
import { b as Session, a as ProofSource, A as AgentMemoryOption } from './shared-Bf84jr3Y.js';
|
|
5
|
+
export { P as Proof, c as attestationProof } from './shared-Bf84jr3Y.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Niadra for the Cloudflare Agents SDK (`agents` 0.x): one helper per `Agent` instance (a Durable
|
package/dist/elevenlabs.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as Niadra, g as Handle } from './client-
|
|
2
|
-
import { P as Proof, A as AgentMemoryOption } from './shared-
|
|
3
|
-
export { c as attestationProof } from './shared-
|
|
4
|
-
import { H as HeadersLike, W as WebhookResponse, C as CallStore } from './webhook-
|
|
5
|
-
export { a as CallRecord, m as memoryCallStore } from './webhook-
|
|
1
|
+
import { c as Niadra, g as Handle } from './client-7mkrdRI0.cjs';
|
|
2
|
+
import { P as Proof, A as AgentMemoryOption } from './shared-CxAwOcZI.cjs';
|
|
3
|
+
export { c as attestationProof } from './shared-CxAwOcZI.cjs';
|
|
4
|
+
import { H as HeadersLike, W as WebhookResponse, C as CallStore } from './webhook-DE3HsGkb.cjs';
|
|
5
|
+
export { a as CallRecord, m as memoryCallStore } from './webhook-DE3HsGkb.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Niadra for the ElevenLabs Agents Platform, on the server side: a phone call reaches ElevenLabs,
|
package/dist/elevenlabs.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { c as Niadra, g as Handle } from './client-
|
|
2
|
-
import { P as Proof, A as AgentMemoryOption } from './shared-
|
|
3
|
-
export { c as attestationProof } from './shared-
|
|
4
|
-
import { H as HeadersLike, W as WebhookResponse, C as CallStore } from './webhook-
|
|
5
|
-
export { a as CallRecord, m as memoryCallStore } from './webhook-
|
|
1
|
+
import { c as Niadra, g as Handle } from './client-7mkrdRI0.js';
|
|
2
|
+
import { P as Proof, A as AgentMemoryOption } from './shared-Bf84jr3Y.js';
|
|
3
|
+
export { c as attestationProof } from './shared-Bf84jr3Y.js';
|
|
4
|
+
import { H as HeadersLike, W as WebhookResponse, C as CallStore } from './webhook-QxYgxE6_.js';
|
|
5
|
+
export { a as CallRecord, m as memoryCallStore } from './webhook-QxYgxE6_.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Niadra for the ElevenLabs Agents Platform, on the server side: a phone call reaches ElevenLabs,
|
package/dist/genkit.d.cts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModelMiddleware } from 'genkit/model';
|
|
2
2
|
import { ToolAction } from 'genkit/tool';
|
|
3
|
-
import { f as ModelUsage } from './client-
|
|
4
|
-
import { a as ProofSource, A as AgentMemoryOption, S as SessionResolver, b as Session } from './shared-
|
|
5
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
3
|
+
import { f as ModelUsage } from './client-7mkrdRI0.cjs';
|
|
4
|
+
import { a as ProofSource, A as AgentMemoryOption, S as SessionResolver, b as Session } from './shared-CxAwOcZI.cjs';
|
|
5
|
+
export { P as Proof, c as attestationProof } from './shared-CxAwOcZI.cjs';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Niadra for Genkit (`genkit` 1.x, Firebase Genkit for JavaScript): a model middleware for
|
package/dist/genkit.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ModelMiddleware } from 'genkit/model';
|
|
2
2
|
import { ToolAction } from 'genkit/tool';
|
|
3
|
-
import { f as ModelUsage } from './client-
|
|
4
|
-
import { a as ProofSource, A as AgentMemoryOption, S as SessionResolver, b as Session } from './shared-
|
|
5
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
3
|
+
import { f as ModelUsage } from './client-7mkrdRI0.js';
|
|
4
|
+
import { a as ProofSource, A as AgentMemoryOption, S as SessionResolver, b as Session } from './shared-Bf84jr3Y.js';
|
|
5
|
+
export { P as Proof, c as attestationProof } from './shared-Bf84jr3Y.js';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Niadra for Genkit (`genkit` 1.x, Firebase Genkit for JavaScript): a model middleware for
|
package/dist/google-adk.d.cts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, LlmRequest, LlmResponse, BaseTool, ReadonlyContext } from '@google/adk';
|
|
2
|
-
import { f as ModelUsage } from './client-
|
|
3
|
-
import { b as Session, a as ProofSource, A as AgentMemoryOption } from './shared-
|
|
4
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
2
|
+
import { f as ModelUsage } from './client-7mkrdRI0.cjs';
|
|
3
|
+
import { b as Session, a as ProofSource, A as AgentMemoryOption } 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 Agent Development Kit for TypeScript (`@google/adk` 2.x): model callbacks and the
|
package/dist/google-adk.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Context, LlmRequest, LlmResponse, BaseTool, ReadonlyContext } from '@google/adk';
|
|
2
|
-
import { f as ModelUsage } from './client-
|
|
3
|
-
import { b as Session, a as ProofSource, A as AgentMemoryOption } from './shared-
|
|
4
|
-
export { P as Proof, c as attestationProof } from './shared-
|
|
2
|
+
import { f as ModelUsage } from './client-7mkrdRI0.js';
|
|
3
|
+
import { b as Session, a as ProofSource, A as AgentMemoryOption } 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 Agent Development Kit for TypeScript (`@google/adk` 2.x): model callbacks and the
|
package/dist/google-genai.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-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 the Google Gen AI SDK (`@google/genai`), as `wrap()` is for OpenAI.
|
package/dist/google-genai.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-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 the Google Gen AI SDK (`@google/genai`), as `wrap()` is for OpenAI.
|
package/dist/index.cjs
CHANGED
|
@@ -525,7 +525,7 @@ function internalRecord(span, ref, act) {
|
|
|
525
525
|
}
|
|
526
526
|
|
|
527
527
|
// src/version.ts
|
|
528
|
-
var VERSION = "0.10.
|
|
528
|
+
var VERSION = "0.10.4";
|
|
529
529
|
|
|
530
530
|
// src/transport.ts
|
|
531
531
|
var RETRYABLE_WRITE_STATUS = /* @__PURE__ */ new Set([408, 421, 429, 500, 502, 503, 504]);
|
|
@@ -543,6 +543,10 @@ var Transport = class {
|
|
|
543
543
|
grantedAt;
|
|
544
544
|
/** When the client last sent a request of its own (`RequestSpec.activity`), in epoch milliseconds. */
|
|
545
545
|
lastActivityAt;
|
|
546
|
+
/** Likely: an answer came within `keepAliveMs`. When not, the next budgeted call gets `coldAllowanceMs`. */
|
|
547
|
+
connectionOpen() {
|
|
548
|
+
return this.answeredAt !== void 0 && Date.now() - this.answeredAt <= (this.config.keepAliveMs ?? 0);
|
|
549
|
+
}
|
|
546
550
|
async request(spec) {
|
|
547
551
|
if (spec.activity !== false) this.lastActivityAt = Date.now();
|
|
548
552
|
const budgeted = this.withAllowance(spec);
|
|
@@ -8545,6 +8549,8 @@ var Niadra = class _Niadra {
|
|
|
8545
8549
|
/** The read budgets the caller left at their defaults: they take the measured round trip on top. */
|
|
8546
8550
|
defaultReads;
|
|
8547
8551
|
voiceStarted = false;
|
|
8552
|
+
/** A probe is on its way: until it ends, default read budgets get `timeouts.connect` on top. */
|
|
8553
|
+
measuring = false;
|
|
8548
8554
|
voiceWarned = false;
|
|
8549
8555
|
strict;
|
|
8550
8556
|
/** Where the client reports what it swallows in fail-open mode. */
|
|
@@ -9612,6 +9618,7 @@ var Niadra = class _Niadra {
|
|
|
9612
9618
|
/** Measures the round trip to the region once per client, in the background. */
|
|
9613
9619
|
probe(core) {
|
|
9614
9620
|
if (!this.voice.claimProbe()) return;
|
|
9621
|
+
this.measuring = true;
|
|
9615
9622
|
void (async () => {
|
|
9616
9623
|
const samples = [];
|
|
9617
9624
|
for (let i = 0; i < 2; i++) {
|
|
@@ -9625,12 +9632,14 @@ var Niadra = class _Niadra {
|
|
|
9625
9632
|
});
|
|
9626
9633
|
} catch (error) {
|
|
9627
9634
|
this.logger.debug(`round trip probe failed: ${describe(toNiadraError(error))}`);
|
|
9635
|
+
this.measuring = false;
|
|
9628
9636
|
return;
|
|
9629
9637
|
}
|
|
9630
9638
|
samples.push(Date.now() - started);
|
|
9631
9639
|
}
|
|
9632
9640
|
const rtt = Math.min(...samples);
|
|
9633
9641
|
this.voice.rtt = rtt;
|
|
9642
|
+
this.measuring = false;
|
|
9634
9643
|
this.logger.debug(`round trip to the region ${Math.round(rtt)} ms`);
|
|
9635
9644
|
const explicit = ["context", "navigation"].filter((name) => !this.defaultReads.has(name));
|
|
9636
9645
|
for (const warning of budgetWarnings(rtt, this.timeouts, explicit)) this.logger.warn(warning);
|
|
@@ -9643,8 +9652,11 @@ var Niadra = class _Niadra {
|
|
|
9643
9652
|
* timed out by the network; one the caller set is a ceiling.
|
|
9644
9653
|
*/
|
|
9645
9654
|
readBudget(name) {
|
|
9655
|
+
if (!this.defaultReads.has(name)) return this.timeouts[name];
|
|
9646
9656
|
const rtt = this.voice.rtt;
|
|
9647
|
-
|
|
9657
|
+
if (rtt !== null) return this.timeouts[name] + rtt;
|
|
9658
|
+
const open = this.core?.transport.connectionOpen() ?? false;
|
|
9659
|
+
return this.measuring && open ? this.timeouts[name] + this.timeouts.connect : this.timeouts[name];
|
|
9648
9660
|
}
|
|
9649
9661
|
/** The client reads in voice: the voice budgets' warnings matter from now on. */
|
|
9650
9662
|
startVoice(core) {
|