@voicelayer/sdk 0.5.1 → 0.6.0

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.
@@ -628,7 +628,15 @@ var ProcessToolDTO = z.object({
628
628
  * Self-hosted workers only: allow a private / loopback address (a localhost service of your own). A platform
629
629
  * worker (it holds the internal service token) never honours it.
630
630
  */
631
- allowPrivateNetwork: z.boolean().optional()
631
+ allowPrivateNetwork: z.boolean().optional(),
632
+ /**
633
+ * Burn-down G-33: the model reads the caller's PII as tokens (`<PII_PHONE_1>`). `true` — this tool's arguments carry
634
+ * the caller's real values instead, when its URL fixes the host (publish refuses it on a host the call fills in).
635
+ * Absent — real values only when it signs in with a connection; otherwise the endpoint gets the tokens. `false` —
636
+ * always the tokens.
637
+ * (packages/sdk/test/tool-detokenise.test.ts)
638
+ */
639
+ sendRealValues: z.boolean().optional()
632
640
  });
633
641
  var ProcessSchemaDTO = z.object({
634
642
  id: z.string().min(1).max(64),
@@ -1188,8 +1196,14 @@ var AgentConfig = z.object({
1188
1196
  // collects nothing structured. DERIVED from the agents row; read-only.
1189
1197
  requiredInfo: z.array(RequiredInfoField).max(64).default([]),
1190
1198
  createdAt: z.string().datetime(),
1191
- // Optimistic-lock token. PATCH must echo this in If-Match.
1192
- updatedAt: z.string().datetime()
1199
+ // On the draft view: when the draft row last changed. On the published view (GET /config's default): when what runs
1200
+ // last changed — the published version's createdAt. Only the draft's is the PATCH lock token: send draftUpdatedAt.
1201
+ updatedAt: z.string().datetime(),
1202
+ // The optimistic-lock token PATCH /v1/agents/:id/config checks (If-Match; also sent, quoted, as the ETag): the DRAFT
1203
+ // row's updatedAt. Always on the draft view; on the published view only while the draft equals what's published —
1204
+ // otherwise absent, and an editor reads ?view=draft, so it never writes over unpublished changes it didn't see
1205
+ // (burn-down G-37). A projection of the existing column, not a stored field (agents DECISIONS A-7 stands).
1206
+ draftUpdatedAt: z.string().datetime().optional()
1193
1207
  });
1194
1208
 
1195
1209
  // ../contracts/src/call-plan.ts
@@ -1522,21 +1536,27 @@ z.object({
1522
1536
 
1523
1537
  // ../contracts/src/providers.ts
1524
1538
  var PROVIDERS = {
1525
- openai: { id: "openai", label: "OpenAI", capabilities: ["llm", "tts", "realtime"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-..." },
1526
- anthropic: { id: "anthropic", label: "Anthropic", capabilities: ["llm"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-ant-..." },
1527
- deepgram: { id: "deepgram", label: "Deepgram", capabilities: ["stt", "tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "Deepgram API key" },
1528
- elevenlabs: { id: "elevenlabs", label: "ElevenLabs", capabilities: ["tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "ElevenLabs API key" },
1529
- cartesia: { id: "cartesia", label: "Cartesia", capabilities: ["stt", "tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "Cartesia API key" },
1530
- assemblyai: { id: "assemblyai", label: "AssemblyAI", capabilities: ["stt"], byok: true, supportsBaseUrl: false, keyPlaceholder: "AssemblyAI API key" },
1531
- google: { id: "google", label: "Google (Gemini)", capabilities: ["llm", "realtime"], byok: true, supportsBaseUrl: false, keyPlaceholder: "AIza..." },
1532
- groq: { id: "groq", label: "Groq", capabilities: ["llm"], byok: true, supportsBaseUrl: true, keyPlaceholder: "gsk_..." },
1539
+ openai: { id: "openai", label: "OpenAI", capabilities: ["llm", "tts", "realtime"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-...", runsOn: { llm: ["voice", "text"], tts: ["voice"], realtime: ["voice"] }, platformKeyEnv: "OPENAI_API_KEY" },
1540
+ // No platform runtime: LiveKit's anthropic plugin needs @livekit/agents >= 1.5 (the workers pin 1.4.0 — the 1.7 audio
1541
+ // regression), and the API's text replies run OpenAI only (burn-down G-9).
1542
+ anthropic: { id: "anthropic", label: "Anthropic", capabilities: ["llm"], byok: true, supportsBaseUrl: true, keyPlaceholder: "sk-ant-...", runsOn: { llm: [] }, platformKeyEnv: "ANTHROPIC_API_KEY" },
1543
+ deepgram: { id: "deepgram", label: "Deepgram", capabilities: ["stt", "tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "Deepgram API key", runsOn: { stt: ["voice"], tts: ["voice"] }, platformKeyEnv: "DEEPGRAM_API_KEY" },
1544
+ elevenlabs: { id: "elevenlabs", label: "ElevenLabs", capabilities: ["tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "ElevenLabs API key", runsOn: { tts: ["voice"] }, platformKeyEnv: "ELEVEN_API_KEY" },
1545
+ // Cartesia's LiveKit plugin (1.4.0) ships TTS only: its speech-to-text has no runtime.
1546
+ cartesia: { id: "cartesia", label: "Cartesia", capabilities: ["stt", "tts"], byok: true, supportsBaseUrl: false, keyPlaceholder: "Cartesia API key", runsOn: { stt: [], tts: ["voice"] }, platformKeyEnv: "CARTESIA_API_KEY" },
1547
+ assemblyai: { id: "assemblyai", label: "AssemblyAI", capabilities: ["stt"], byok: true, supportsBaseUrl: false, keyPlaceholder: "AssemblyAI API key", runsOn: { stt: ["voice"] }, platformKeyEnv: "ASSEMBLYAI_API_KEY" },
1548
+ // Gemini on text waits on burn-down G-9 (the API's text replies run OpenAI only).
1549
+ google: { id: "google", label: "Google (Gemini)", capabilities: ["llm", "realtime"], byok: true, supportsBaseUrl: false, keyPlaceholder: "AIza...", runsOn: { llm: ["voice"], realtime: ["voice"] }, platformKeyEnv: "GOOGLE_API_KEY" },
1550
+ groq: { id: "groq", label: "Groq", capabilities: ["llm"], byok: true, supportsBaseUrl: true, keyPlaceholder: "gsk_...", runsOn: { llm: [] }, platformKeyEnv: "GROQ_API_KEY" },
1533
1551
  // Runtime-only providers (no external key): local VAD.
1534
- silero: { id: "silero", label: "Silero", capabilities: ["vad"], byok: false, supportsBaseUrl: false }
1552
+ silero: { id: "silero", label: "Silero", capabilities: ["vad"], byok: false, supportsBaseUrl: false, runsOn: { vad: ["voice"] } }
1535
1553
  };
1536
1554
  function byokProviders() {
1537
1555
  return Object.values(PROVIDERS).filter((p) => p.byok);
1538
1556
  }
1539
1557
  var ProviderKind = z.enum(["llm", "stt", "tts", "realtime"]);
1558
+ var ModelSurface = z.enum(["voice", "text"]);
1559
+ var ProviderKeySource = z.enum(["workspace", "platform", "none"]);
1540
1560
  var CatalogVoice = z.object({
1541
1561
  id: z.string().min(1).max(128),
1542
1562
  label: z.string().min(1).max(128),
@@ -1570,7 +1590,12 @@ var CatalogProvider = z.object({
1570
1590
  // Populated for tts / realtime providers.
1571
1591
  voices: z.array(CatalogVoice).optional(),
1572
1592
  // Pre-selected when the provider is chosen.
1573
- defaultModel: z.string().max(128).optional()
1593
+ defaultModel: z.string().max(128).optional(),
1594
+ // The surfaces the platform runs this provider's models on (contracts PROVIDERS `runsOn`). A picker offers the
1595
+ // provider only for a surface listed here; absent means none, so an unrunnable provider is never offered by default.
1596
+ surfaces: z.array(ModelSurface).default([]),
1597
+ // Whose key this provider would run on for the requesting workspace; unknown means none.
1598
+ key: ProviderKeySource.default("none")
1574
1599
  });
1575
1600
  z.object({
1576
1601
  llm: z.array(CatalogProvider).default([]),
@@ -1625,8 +1650,26 @@ z.object({
1625
1650
  // The assumptions actually used (after defaults) — drives the UI footnote.
1626
1651
  assumptions: CostEstimateAssumptions.required()
1627
1652
  });
1653
+
1654
+ // ../contracts/src/openai-models.ts
1655
+ function categorizeOpenAiModel(id) {
1656
+ const s = id.toLowerCase();
1657
+ if (s.includes("realtime")) return "realtime";
1658
+ if (s.includes("transcribe") || s.includes("whisper")) return "stt";
1659
+ if (s.includes("tts") || s.includes("audio-speech")) return "tts";
1660
+ if (/embedding|moderation|dall-e|image|^omni-|^text-|search|rerank|babbage|davinci|codex/.test(s)) {
1661
+ return null;
1662
+ }
1663
+ if (/-pro\b|deep-research|computer-use/.test(s)) return null;
1664
+ if (/^(gpt|o[0-9]|chatgpt)/.test(s)) return "llm";
1665
+ return null;
1666
+ }
1667
+ function isOpenAiChatModel(id) {
1668
+ return categorizeOpenAiModel(id) === "llm";
1669
+ }
1628
1670
  var EvaluationMetric = z.enum(["rating", "binary", "options", "text"]);
1629
1671
  var EvaluationStatus = z.enum(["pending", "scored", "failed"]);
1672
+ var EvaluationJudgeModel = z.string().min(1).max(128).refine(isOpenAiChatModel, { message: "The judge runs OpenAI chat models only (e.g. gpt-4o-mini)." });
1630
1673
  var EvaluationOption = z.object({
1631
1674
  value: z.string().min(1).max(64),
1632
1675
  label: z.string().min(1).max(120),
@@ -1638,6 +1681,7 @@ z.object({
1638
1681
  name: z.string().min(1).max(120),
1639
1682
  criteria: z.string().max(4e3),
1640
1683
  metric: EvaluationMetric,
1684
+ // a stored row may predate the judge-model rule; it is judged on the default (EVALUATION_JUDGE_SUGGESTIONS)
1641
1685
  model: z.string().min(1).max(128),
1642
1686
  minValue: z.number().int().nullable(),
1643
1687
  minLabel: z.string().nullable(),
@@ -1653,7 +1697,7 @@ var EvaluationInput = z.object({
1653
1697
  name: z.string().min(1).max(120),
1654
1698
  criteria: z.string().max(4e3).default(""),
1655
1699
  metric: EvaluationMetric.default("rating"),
1656
- model: z.string().min(1).max(128).default("gpt-4o-mini"),
1700
+ model: EvaluationJudgeModel.default("gpt-4o-mini"),
1657
1701
  minValue: z.number().int().nullable().optional(),
1658
1702
  minLabel: z.string().max(200).nullable().optional(),
1659
1703
  maxValue: z.number().int().nullable().optional(),
@@ -1815,7 +1859,10 @@ var ToolCallAudit = z.object({
1815
1859
  ok: z.boolean(),
1816
1860
  // refused by the Action Guard before it ran
1817
1861
  blocked: z.boolean(),
1818
- errorMessage: z.string().optional()
1862
+ errorMessage: z.string().optional(),
1863
+ // Burn-down G-33: the call's PII tokens swapped back for the caller's real values in this tool's arguments (it went to
1864
+ // a trusted destination) — how many, and the host they went to (null: the agent's own code). Never a value.
1865
+ detokenized: z.object({ count: z.number().int().min(1), destinationHost: z.string().nullable() }).optional()
1819
1866
  });
1820
1867
  var McpInteractionAudit = z.object({
1821
1868
  // One of the four runtime tools — closed set, no growth allowed.
@@ -2481,7 +2528,14 @@ z.discriminatedUnion("kind", [
2481
2528
  BrainRequestFrame,
2482
2529
  BrainCancelFrame
2483
2530
  ]);
2484
- var FLOW_BOOT_FAILURES = ["schema_fetch_failed", "no_process_schema", "missing_agent_id", "no_api_key", "worker_identity_refused"];
2531
+ var FLOW_BOOT_FAILURES = [
2532
+ "schema_fetch_failed",
2533
+ "no_process_schema",
2534
+ "missing_agent_id",
2535
+ "no_api_key",
2536
+ "worker_identity_refused",
2537
+ "provider_unavailable"
2538
+ ];
2485
2539
  z.enum(
2486
2540
  FLOW_BOOT_FAILURES.map((cause) => `flow_boot:${cause}`)
2487
2541
  );
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { A as AgentEnvironment, P as ProcessSchemaDTO, R as ReadinessProbe, a as AgentLifecycleEvent, b as AgentDTO, c as AgentEventEmitter, d as AgentContext, e as AgentConfig$1, f as ProcessField, M as ModelConfig, C as ConnectorInstance, g as ProviderFactory, S as STTProvider, T as TTSProvider, L as LLMProvider, h as RealtimeProvider, i as TurnDetectorProvider, V as VADProvider, j as ProcessDefinition, k as TriggerDefinition, H as HandoffConfig, l as MemoryConfig, m as ToolDefinition$1, n as SpeechConfig, o as ToolExecutor, p as HostLookup } from './text-session-BbG3VG50.js';
2
- export { q as AgentEventListener, r as AgentTurnEvent, s as AudioProfile, t as AudioSurface, u as CallInfo, v as CallOutcomeSummary, w as ChannelKind, x as CompletionStrategy, y as ComplianceTag, z as ConsultationPolicy, D as DtmfEvent, B as DtmfHandler, E as EndCallControllerHandle, F as EndCallInfo, G as EndCallOutcome, I as EndCallPolicy, J as EndCallTrigger, K as EndpointingConfig, N as FakeSessionAdapter, O as FloorControlConfig, Q as InboundOptions, U as InferProcessData, W as InterruptionConfig, X as LK_AGENT_STATE_MAP, Y as MemoryHandle, Z as MemoryScope, _ as MetricsEvent, $ as NON_BUSY_STATES, a0 as Participant, a1 as ParticipantId, a2 as ParticipantKind, a3 as ParticipantSet, a4 as ParticipantsConfig, a5 as ProcessBackendAck, a6 as ProcessFieldType, a7 as ProcessSnapshot, a8 as ReadinessReport, a9 as ReadinessResult, aa as RespondOptions, ab as Room, ac as RouteEntry, ad as RoutingRule, ae as RoutingSnapshot, af as RunTextSessionOptions, ag as RunTextTranscriptOptions, ah as SayOptions, ai as SecurityConfig, aj as SendDtmfOptions, ak as SessionAdapter, al as SessionCapabilities, am as SessionErrorEvent, an as SessionEvent, ao as SessionEventMap, ap as SessionFactory, aq as SessionFactoryInput, ar as SessionOutbound, as as SessionState, at as ShorthandPrimitive, au as SpeechResult, av as SpeechTarget, aw as StateChangeEvent, ax as TextSession, ay as TextTranscriptResult, az as ToolInputShape, aA as TriggerAction, aB as TriggerCondition, aC as TtsVoiceConfig, aD as TurnEvent, aE as Unsubscribe, aF as UserInputEvent, aG as UserStateEvent, aH as UserTurn, aI as VoiceLayerAuthError, aJ as VoiceLayerError, aK as VoiceLayerHttpError, aL as VoiceLayerNetworkError, aM as VoiceLayerValidationError, aN as applySpeechTurnHandling, aO as asyncProbe, aP as defineProcess, aQ as dtmfCodeToDigit, aR as dtmfDigitToCode, aS as duck, aT as envProbe, aU as mute, aV as normalizeState, a1 as participantId, aW as passthrough, aX as runProbes, aY as runTextSession, aZ as runTextTranscript, a_ as transform, a$ as urlProbe } from './text-session-BbG3VG50.js';
1
+ import { A as AgentEnvironment, P as ProcessSchemaDTO, R as ReadinessProbe, a as AgentLifecycleEvent, b as AgentDTO, c as AgentEventEmitter, T as ToolDefinition, d as AgentConfig$1, e as ProcessField, M as ModelConfig, C as ConnectorInstance, f as ProviderFactory, S as STTProvider, g as TTSProvider, L as LLMProvider, h as RealtimeProvider, i as TurnDetectorProvider, V as VADProvider, j as ProcessDefinition, k as TriggerDefinition, H as HandoffConfig, l as MemoryConfig, m as SpeechConfig, n as ToolExecutor, o as AgentContext, p as ToolRunInfo, q as HostLookup } from './text-session-CoyEcdmg.js';
2
+ export { r as AgentEventListener, s as AgentTurnEvent, t as AudioProfile, u as AudioSurface, v as CallInfo, w as CallOutcomeSummary, x as ChannelKind, y as CompletionStrategy, z as ComplianceTag, B as ConsultationPolicy, D as DtmfEvent, E as DtmfHandler, F as EndCallControllerHandle, G as EndCallInfo, I as EndCallOutcome, J as EndCallPolicy, K as EndCallTrigger, N as EndpointingConfig, O as FakeSessionAdapter, Q as FloorControlConfig, U as InboundOptions, W as InferProcessData, X as InterruptionConfig, Y as LK_AGENT_STATE_MAP, Z as MemoryHandle, _ as MemoryScope, $ as MetricsEvent, a0 as NON_BUSY_STATES, a1 as Participant, a2 as ParticipantId, a3 as ParticipantKind, a4 as ParticipantSet, a5 as ParticipantsConfig, a6 as ProcessBackendAck, a7 as ProcessFieldType, a8 as ProcessSnapshot, a9 as ReadinessReport, aa as ReadinessResult, ab as RespondOptions, ac as Room, ad as RouteEntry, ae as RoutingRule, af as RoutingSnapshot, ag as RunTextSessionOptions, ah as RunTextTranscriptOptions, ai as SayOptions, aj as SecurityConfig, ak as SendDtmfOptions, al as SessionAdapter, am as SessionCapabilities, an as SessionErrorEvent, ao as SessionEvent, ap as SessionEventMap, aq as SessionFactory, ar as SessionFactoryInput, as as SessionOutbound, at as SessionState, au as ShorthandPrimitive, av as SpeechResult, aw as SpeechTarget, ax as StateChangeEvent, ay as TextSession, az as TextTranscriptResult, aA as ToolInputShape, aB as TriggerAction, aC as TriggerCondition, aD as TtsVoiceConfig, aE as TurnEvent, aF as Unsubscribe, aG as UserInputEvent, aH as UserStateEvent, aI as UserTurn, aJ as VoiceLayerAuthError, aK as VoiceLayerError, aL as VoiceLayerHttpError, aM as VoiceLayerNetworkError, aN as VoiceLayerValidationError, aO as applySpeechTurnHandling, aP as asyncProbe, aQ as defineProcess, aR as dtmfCodeToDigit, aS as dtmfDigitToCode, aT as duck, aU as envProbe, aV as mute, aW as normalizeState, a2 as participantId, aX as passthrough, aY as runProbes, aZ as runTextSession, a_ as runTextTranscript, a$ as transform, b0 as urlProbe } from './text-session-CoyEcdmg.js';
3
3
  import { z, ZodType } from 'zod';
4
4
  import { O as OnQuery, B as BrainTransport } from './types-KqrAfY85.js';
5
5
  export { a as BrainCallMetadata, b as BrainCapabilities, c as BrainChunk, d as BrainMessage, e as BrainRequest, f as OnQueryContext, g as OnQueryResult } from './types-KqrAfY85.js';
@@ -470,6 +470,7 @@ declare const CallPlan: z.ZodObject<{
470
470
  enum?: string[] | undefined;
471
471
  description?: string | undefined;
472
472
  }>, "many">>>;
473
+ draftUpdatedAt: z.ZodOptional<z.ZodOptional<z.ZodString>>;
473
474
  }, "strip", z.ZodTypeAny, {
474
475
  stt?: {
475
476
  provider: "deepgram" | "cartesia" | "assemblyai";
@@ -569,6 +570,7 @@ declare const CallPlan: z.ZodObject<{
569
570
  enum?: string[] | undefined;
570
571
  description?: string | undefined;
571
572
  }[] | undefined;
573
+ draftUpdatedAt?: string | undefined;
572
574
  }, {
573
575
  stt?: {
574
576
  provider: "deepgram" | "cartesia" | "assemblyai";
@@ -668,6 +670,7 @@ declare const CallPlan: z.ZodObject<{
668
670
  enum?: string[] | undefined;
669
671
  description?: string | undefined;
670
672
  }[] | undefined;
673
+ draftUpdatedAt?: string | undefined;
671
674
  }>>;
672
675
  openQuestions: z.ZodDefault<z.ZodArray<z.ZodObject<{
673
676
  id: z.ZodString;
@@ -838,6 +841,7 @@ declare const CallPlan: z.ZodObject<{
838
841
  enum?: string[] | undefined;
839
842
  description?: string | undefined;
840
843
  }[] | undefined;
844
+ draftUpdatedAt?: string | undefined;
841
845
  };
842
846
  openQuestions: {
843
847
  kind: "decision" | "auth" | "fact";
@@ -978,6 +982,7 @@ declare const CallPlan: z.ZodObject<{
978
982
  enum?: string[] | undefined;
979
983
  description?: string | undefined;
980
984
  }[] | undefined;
985
+ draftUpdatedAt?: string | undefined;
981
986
  } | undefined;
982
987
  openQuestions?: {
983
988
  kind: "decision" | "auth" | "fact";
@@ -1402,6 +1407,7 @@ declare const AgentConfig: z.ZodObject<{
1402
1407
  }>, "many">>;
1403
1408
  createdAt: z.ZodString;
1404
1409
  updatedAt: z.ZodString;
1410
+ draftUpdatedAt: z.ZodOptional<z.ZodString>;
1405
1411
  }, "strip", z.ZodTypeAny, {
1406
1412
  voice: {
1407
1413
  provider: "deepgram" | "elevenlabs" | "openai" | "cartesia";
@@ -1505,6 +1511,7 @@ declare const AgentConfig: z.ZodObject<{
1505
1511
  tags?: string[] | undefined;
1506
1512
  brainConnectorId?: string | null | undefined;
1507
1513
  modeLocked?: boolean | undefined;
1514
+ draftUpdatedAt?: string | undefined;
1508
1515
  }, {
1509
1516
  voice: {
1510
1517
  provider: "deepgram" | "elevenlabs" | "openai" | "cartesia";
@@ -1608,10 +1615,11 @@ declare const AgentConfig: z.ZodObject<{
1608
1615
  enum?: string[] | undefined;
1609
1616
  description?: string | undefined;
1610
1617
  }[] | undefined;
1618
+ draftUpdatedAt?: string | undefined;
1611
1619
  }>;
1612
1620
  type AgentConfig = z.infer<typeof AgentConfig>;
1613
1621
 
1614
- declare const AgentEndReason: z.ZodEnum<["flow_boot:schema_fetch_failed" | "flow_boot:no_process_schema" | "flow_boot:missing_agent_id" | "flow_boot:no_api_key" | "flow_boot:worker_identity_refused", ...("flow_boot:schema_fetch_failed" | "flow_boot:no_process_schema" | "flow_boot:missing_agent_id" | "flow_boot:no_api_key" | "flow_boot:worker_identity_refused")[]]>;
1622
+ declare const AgentEndReason: z.ZodEnum<["flow_boot:schema_fetch_failed" | "flow_boot:no_process_schema" | "flow_boot:missing_agent_id" | "flow_boot:no_api_key" | "flow_boot:worker_identity_refused" | "flow_boot:provider_unavailable", ...("flow_boot:schema_fetch_failed" | "flow_boot:no_process_schema" | "flow_boot:missing_agent_id" | "flow_boot:no_api_key" | "flow_boot:worker_identity_refused" | "flow_boot:provider_unavailable")[]]>;
1615
1623
  type AgentEndReason = z.infer<typeof AgentEndReason>;
1616
1624
 
1617
1625
  interface ApiCredential {
@@ -1886,6 +1894,7 @@ declare class AgentsClient {
1886
1894
  headers?: Record<string, string> | undefined;
1887
1895
  connectionRef?: string | undefined;
1888
1896
  allowPrivateNetwork?: boolean | undefined;
1897
+ sendRealValues?: boolean | undefined;
1889
1898
  }[] | undefined;
1890
1899
  displayName?: string | undefined;
1891
1900
  program?: {
@@ -2284,14 +2293,6 @@ declare function mergeMetadata(user: Record<string, unknown> | undefined, defaul
2284
2293
  type ShorthandPrimitive = 'string' | 'number' | 'boolean';
2285
2294
  /** What the user passes for a tool's input shape. */
2286
2295
  type ToolInputShape = Record<string, ShorthandPrimitive> | z.ZodTypeAny;
2287
- interface ToolDefinition<I = unknown, R = unknown> {
2288
- readonly description: string;
2289
- readonly input: ToolInputShape;
2290
- /** Implementation. Receives parsed input and the agent context. */
2291
- readonly run: (input: I, ctx: AgentContext) => Promise<R> | R;
2292
- /** Capability required for Action Guard. Defaults to `tool.<name>`. */
2293
- readonly capability?: string;
2294
- }
2295
2296
 
2296
2297
  interface ResendCredentials {
2297
2298
  /** Resend API key — find under "API Keys" in the Resend dashboard. */
@@ -2574,7 +2575,7 @@ interface CompiledAgentParts {
2574
2575
  readonly triggers?: Record<string, TriggerDefinition>;
2575
2576
  readonly handoff?: HandoffConfig;
2576
2577
  readonly memory?: MemoryConfig;
2577
- readonly tools?: Record<string, ToolDefinition$1>;
2578
+ readonly tools?: Record<string, ToolDefinition>;
2578
2579
  /** Voice turn-taking from the flow's speech capability (schema.speech →
2579
2580
  * AgentConfig.speech → applySpeechTurnHandling). */
2580
2581
  readonly speech?: SpeechConfig;
@@ -2720,7 +2721,9 @@ declare abstract class BaseTool<I = unknown, R = unknown> {
2720
2721
  abstract readonly description: string;
2721
2722
  abstract readonly input: ToolInputShape;
2722
2723
  readonly capability?: string;
2723
- abstract run(input: I, ctx: AgentContext): Promise<R> | R;
2724
+ /** `false`: this tool gets the call's PII tokens, not the caller's real values (see ToolDefinition.sendRealValues). */
2725
+ readonly sendRealValues?: boolean;
2726
+ abstract run(input: I, ctx: AgentContext, info?: ToolRunInfo): Promise<R> | R;
2724
2727
  /** The ToolDefinition the runtime consumes. */
2725
2728
  toDefinition(): ToolDefinition<I, R>;
2726
2729
  /** `{ [name]: definition }` — spread straight into `defineAgent({ tools })`. */
@@ -2732,7 +2735,9 @@ declare function defineTool<I = unknown, R = unknown>(spec: {
2732
2735
  readonly description: string;
2733
2736
  readonly input: ToolInputShape;
2734
2737
  readonly capability?: string;
2735
- readonly run: (input: I, ctx: AgentContext) => Promise<R> | R;
2738
+ /** `false`: this tool gets the call's PII tokens, not the caller's real values (see ToolDefinition.sendRealValues). */
2739
+ readonly sendRealValues?: boolean;
2740
+ readonly run: (input: I, ctx: AgentContext, info?: ToolRunInfo) => Promise<R> | R;
2736
2741
  }): Record<string, ToolDefinition>;
2737
2742
  interface HttpToolResult {
2738
2743
  readonly ok: boolean;
@@ -2763,17 +2768,13 @@ interface HttpToolSpec {
2763
2768
  * sets it, and its server-side executor has no such switch.
2764
2769
  */
2765
2770
  readonly allowPrivateNetwork?: boolean;
2771
+ /**
2772
+ * The model reads the caller's PII as tokens (`<PII_PHONE_1>`). `true`: this endpoint gets the caller's real values
2773
+ * instead — only when `url` fixes the host (a `{placeholder}` in the host keeps the tokens), and a redirect to another
2774
+ * origin is then refused. Otherwise it gets the tokens. (burn-down G-33 — test/tool-detokenise.test.ts)
2775
+ */
2776
+ readonly sendRealValues?: boolean;
2766
2777
  }
2767
- /**
2768
- * A config-only HTTP tool — no subclass needed for the common "call an API"
2769
- * case. Use this for public/no-auth endpoints (e.g. an n8n webhook). Secrets
2770
- * should NOT be inlined here; vault-backed credentials resolve server-side.
2771
- *
2772
- * Safe by default (runtime/safe-fetch.ts): http(s) only, never a private /
2773
- * loopback / link-local / metadata address (checked again after DNS and on every
2774
- * redirect hop), a timeout, and a capped body. A refused request is a failed
2775
- * result `{ ok: false, status: 0, data: { kind: 'blocked', reason } }`, never a throw.
2776
- */
2777
2778
  declare function httpTool(spec: HttpToolSpec): Record<string, ToolDefinition>;
2778
2779
 
2779
- export { Agent, AgentConfig$1 as AgentConfig, AgentContext, AgentEventEmitter, AgentLifecycleEvent, type ApiCredential, type AppendDtmfEventInput, type AppendTranscriptInput, BaseTool, BrainTransport, type CallAttributeValue, type CallLegInput, type CallParticipantInput, type CallStatus, type CallSummary, CallsClient, type CompiledAgentParts, ConnectorInstance, type ConnectorLLMConfig, type CreateClientOptions, type CreatedFormSession, type DefaultMetadata, type DtmfDirection, EmailClient, type SendEmailInput as EmailSendInput, type EnsureCallByRoomInput, type ExchangeWorkerTokenInput, type CreateFormSessionInput as FormCreateInput, type FormToolsOptions, FormsClient, HandoffConfig, type HttpToolResult, type HttpToolSpec, LLMProvider, MemoryConfig, ModelConfig, OnQuery, type PipelineConfig, PlansClient, ProcessDefinition, ProcessField, type PronunciationDict, ProviderFactory, type PublicFormSessionView, ReadinessProbe, RealtimeProvider, type RegisterInput, type RegisterOptions, type RegisteredAgent, type ResendCredentials, type ResendEmailToolOptions, STTProvider, type SentEmail, SpeechConfig, StaleRouteError, type SyncCallStateInput, TTSProvider, ToolDefinition$1 as ToolDefinition, TriggerDefinition, TurnDetectorProvider, VADProvider, type VoiceLayerClient, type WebhookApi, type WebhookConfig, type WorkerIdentity, type WorkerIdentityResolution, type WrapOptions, admitCallIdentity, applyPronunciations, assemblyai, cartesia, collectDefaultMetadata, connector, createClient, createNoOpLLM, deepgram, defineAgent, defineFlowRuntime, defineTool, elevenlabs, exchangeWorkerToken, formTools, google, httpTool, livekitTurn, mergeMetadata, openai, processSchemaToAgentParts, processSchemaToDefinition, resendEmailTool, resolveWorkerClient, resolveWorkerIdentity, silero, webhook, wrap };
2780
+ export { Agent, AgentConfig$1 as AgentConfig, AgentContext, AgentEventEmitter, AgentLifecycleEvent, type ApiCredential, type AppendDtmfEventInput, type AppendTranscriptInput, BaseTool, BrainTransport, type CallAttributeValue, type CallLegInput, type CallParticipantInput, type CallStatus, type CallSummary, CallsClient, type CompiledAgentParts, ConnectorInstance, type ConnectorLLMConfig, type CreateClientOptions, type CreatedFormSession, type DefaultMetadata, type DtmfDirection, EmailClient, type SendEmailInput as EmailSendInput, type EnsureCallByRoomInput, type ExchangeWorkerTokenInput, type CreateFormSessionInput as FormCreateInput, type FormToolsOptions, FormsClient, HandoffConfig, type HttpToolResult, type HttpToolSpec, LLMProvider, MemoryConfig, ModelConfig, OnQuery, type PipelineConfig, PlansClient, ProcessDefinition, ProcessField, type PronunciationDict, ProviderFactory, type PublicFormSessionView, ReadinessProbe, RealtimeProvider, type RegisterInput, type RegisterOptions, type RegisteredAgent, type ResendCredentials, type ResendEmailToolOptions, STTProvider, type SentEmail, SpeechConfig, StaleRouteError, type SyncCallStateInput, TTSProvider, ToolDefinition, ToolRunInfo, TriggerDefinition, TurnDetectorProvider, VADProvider, type VoiceLayerClient, type WebhookApi, type WebhookConfig, type WorkerIdentity, type WorkerIdentityResolution, type WrapOptions, admitCallIdentity, applyPronunciations, assemblyai, cartesia, collectDefaultMetadata, connector, createClient, createNoOpLLM, deepgram, defineAgent, defineFlowRuntime, defineTool, elevenlabs, exchangeWorkerToken, formTools, google, httpTool, livekitTurn, mergeMetadata, openai, processSchemaToAgentParts, processSchemaToDefinition, resendEmailTool, resolveWorkerClient, resolveWorkerIdentity, silero, webhook, wrap };