@voicelayer/sdk 0.6.1 → 0.6.2

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/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, 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-C4Z59gG4.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-C4Z59gG4.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-B-T33y5P.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-B-T33y5P.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';
@@ -450,6 +450,58 @@ declare const CallPlan: z.ZodObject<{
450
450
  }>>>;
451
451
  tags: z.ZodOptional<z.ZodOptional<z.ZodArray<z.ZodString, "many">>>;
452
452
  brainConnectorId: z.ZodOptional<z.ZodOptional<z.ZodNullable<z.ZodString>>>;
453
+ callLimits: z.ZodOptional<z.ZodOptional<z.ZodObject<{
454
+ maxDurationMinutes: z.ZodOptional<z.ZodNumber>;
455
+ wrapUpWarningSeconds: z.ZodOptional<z.ZodNumber>;
456
+ wrapUpMessage: z.ZodOptional<z.ZodString>;
457
+ goodbyeMessage: z.ZodOptional<z.ZodString>;
458
+ callerRateLimit: z.ZodOptional<z.ZodObject<{
459
+ enabled: z.ZodOptional<z.ZodBoolean>;
460
+ perTenMinutes: z.ZodOptional<z.ZodNumber>;
461
+ perDay: z.ZodOptional<z.ZodNumber>;
462
+ withheldPerTenMinutes: z.ZodOptional<z.ZodNumber>;
463
+ withheldPerDay: z.ZodOptional<z.ZodNumber>;
464
+ }, "strip", z.ZodTypeAny, {
465
+ enabled?: boolean | undefined;
466
+ perTenMinutes?: number | undefined;
467
+ perDay?: number | undefined;
468
+ withheldPerTenMinutes?: number | undefined;
469
+ withheldPerDay?: number | undefined;
470
+ }, {
471
+ enabled?: boolean | undefined;
472
+ perTenMinutes?: number | undefined;
473
+ perDay?: number | undefined;
474
+ withheldPerTenMinutes?: number | undefined;
475
+ withheldPerDay?: number | undefined;
476
+ }>>;
477
+ rateLimitedMessage: z.ZodOptional<z.ZodString>;
478
+ }, "strip", z.ZodTypeAny, {
479
+ maxDurationMinutes?: number | undefined;
480
+ wrapUpWarningSeconds?: number | undefined;
481
+ wrapUpMessage?: string | undefined;
482
+ goodbyeMessage?: string | undefined;
483
+ callerRateLimit?: {
484
+ enabled?: boolean | undefined;
485
+ perTenMinutes?: number | undefined;
486
+ perDay?: number | undefined;
487
+ withheldPerTenMinutes?: number | undefined;
488
+ withheldPerDay?: number | undefined;
489
+ } | undefined;
490
+ rateLimitedMessage?: string | undefined;
491
+ }, {
492
+ maxDurationMinutes?: number | undefined;
493
+ wrapUpWarningSeconds?: number | undefined;
494
+ wrapUpMessage?: string | undefined;
495
+ goodbyeMessage?: string | undefined;
496
+ callerRateLimit?: {
497
+ enabled?: boolean | undefined;
498
+ perTenMinutes?: number | undefined;
499
+ perDay?: number | undefined;
500
+ withheldPerTenMinutes?: number | undefined;
501
+ withheldPerDay?: number | undefined;
502
+ } | undefined;
503
+ rateLimitedMessage?: string | undefined;
504
+ }>>>;
453
505
  modeLocked: z.ZodOptional<z.ZodOptional<z.ZodBoolean>>;
454
506
  requiredInfo: z.ZodOptional<z.ZodDefault<z.ZodArray<z.ZodObject<{
455
507
  name: z.ZodString;
@@ -562,6 +614,20 @@ declare const CallPlan: z.ZodObject<{
562
614
  } | undefined;
563
615
  tags?: string[] | undefined;
564
616
  brainConnectorId?: string | null | undefined;
617
+ callLimits?: {
618
+ maxDurationMinutes?: number | undefined;
619
+ wrapUpWarningSeconds?: number | undefined;
620
+ wrapUpMessage?: string | undefined;
621
+ goodbyeMessage?: string | undefined;
622
+ callerRateLimit?: {
623
+ enabled?: boolean | undefined;
624
+ perTenMinutes?: number | undefined;
625
+ perDay?: number | undefined;
626
+ withheldPerTenMinutes?: number | undefined;
627
+ withheldPerDay?: number | undefined;
628
+ } | undefined;
629
+ rateLimitedMessage?: string | undefined;
630
+ } | undefined;
565
631
  modeLocked?: boolean | undefined;
566
632
  requiredInfo?: {
567
633
  type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
@@ -662,6 +728,20 @@ declare const CallPlan: z.ZodObject<{
662
728
  } | undefined;
663
729
  tags?: string[] | undefined;
664
730
  brainConnectorId?: string | null | undefined;
731
+ callLimits?: {
732
+ maxDurationMinutes?: number | undefined;
733
+ wrapUpWarningSeconds?: number | undefined;
734
+ wrapUpMessage?: string | undefined;
735
+ goodbyeMessage?: string | undefined;
736
+ callerRateLimit?: {
737
+ enabled?: boolean | undefined;
738
+ perTenMinutes?: number | undefined;
739
+ perDay?: number | undefined;
740
+ withheldPerTenMinutes?: number | undefined;
741
+ withheldPerDay?: number | undefined;
742
+ } | undefined;
743
+ rateLimitedMessage?: string | undefined;
744
+ } | undefined;
665
745
  modeLocked?: boolean | undefined;
666
746
  requiredInfo?: {
667
747
  type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
@@ -833,6 +913,20 @@ declare const CallPlan: z.ZodObject<{
833
913
  } | undefined;
834
914
  tags?: string[] | undefined;
835
915
  brainConnectorId?: string | null | undefined;
916
+ callLimits?: {
917
+ maxDurationMinutes?: number | undefined;
918
+ wrapUpWarningSeconds?: number | undefined;
919
+ wrapUpMessage?: string | undefined;
920
+ goodbyeMessage?: string | undefined;
921
+ callerRateLimit?: {
922
+ enabled?: boolean | undefined;
923
+ perTenMinutes?: number | undefined;
924
+ perDay?: number | undefined;
925
+ withheldPerTenMinutes?: number | undefined;
926
+ withheldPerDay?: number | undefined;
927
+ } | undefined;
928
+ rateLimitedMessage?: string | undefined;
929
+ } | undefined;
836
930
  modeLocked?: boolean | undefined;
837
931
  requiredInfo?: {
838
932
  type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
@@ -974,6 +1068,20 @@ declare const CallPlan: z.ZodObject<{
974
1068
  } | undefined;
975
1069
  tags?: string[] | undefined;
976
1070
  brainConnectorId?: string | null | undefined;
1071
+ callLimits?: {
1072
+ maxDurationMinutes?: number | undefined;
1073
+ wrapUpWarningSeconds?: number | undefined;
1074
+ wrapUpMessage?: string | undefined;
1075
+ goodbyeMessage?: string | undefined;
1076
+ callerRateLimit?: {
1077
+ enabled?: boolean | undefined;
1078
+ perTenMinutes?: number | undefined;
1079
+ perDay?: number | undefined;
1080
+ withheldPerTenMinutes?: number | undefined;
1081
+ withheldPerDay?: number | undefined;
1082
+ } | undefined;
1083
+ rateLimitedMessage?: string | undefined;
1084
+ } | undefined;
977
1085
  modeLocked?: boolean | undefined;
978
1086
  requiredInfo?: {
979
1087
  type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
@@ -1384,6 +1492,58 @@ declare const AgentConfig: z.ZodObject<{
1384
1492
  }>>>;
1385
1493
  tags: z.ZodOptional<z.ZodArray<z.ZodString, "many">>;
1386
1494
  brainConnectorId: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1495
+ callLimits: z.ZodOptional<z.ZodObject<{
1496
+ maxDurationMinutes: z.ZodOptional<z.ZodNumber>;
1497
+ wrapUpWarningSeconds: z.ZodOptional<z.ZodNumber>;
1498
+ wrapUpMessage: z.ZodOptional<z.ZodString>;
1499
+ goodbyeMessage: z.ZodOptional<z.ZodString>;
1500
+ callerRateLimit: z.ZodOptional<z.ZodObject<{
1501
+ enabled: z.ZodOptional<z.ZodBoolean>;
1502
+ perTenMinutes: z.ZodOptional<z.ZodNumber>;
1503
+ perDay: z.ZodOptional<z.ZodNumber>;
1504
+ withheldPerTenMinutes: z.ZodOptional<z.ZodNumber>;
1505
+ withheldPerDay: z.ZodOptional<z.ZodNumber>;
1506
+ }, "strip", z.ZodTypeAny, {
1507
+ enabled?: boolean | undefined;
1508
+ perTenMinutes?: number | undefined;
1509
+ perDay?: number | undefined;
1510
+ withheldPerTenMinutes?: number | undefined;
1511
+ withheldPerDay?: number | undefined;
1512
+ }, {
1513
+ enabled?: boolean | undefined;
1514
+ perTenMinutes?: number | undefined;
1515
+ perDay?: number | undefined;
1516
+ withheldPerTenMinutes?: number | undefined;
1517
+ withheldPerDay?: number | undefined;
1518
+ }>>;
1519
+ rateLimitedMessage: z.ZodOptional<z.ZodString>;
1520
+ }, "strip", z.ZodTypeAny, {
1521
+ maxDurationMinutes?: number | undefined;
1522
+ wrapUpWarningSeconds?: number | undefined;
1523
+ wrapUpMessage?: string | undefined;
1524
+ goodbyeMessage?: string | undefined;
1525
+ callerRateLimit?: {
1526
+ enabled?: boolean | undefined;
1527
+ perTenMinutes?: number | undefined;
1528
+ perDay?: number | undefined;
1529
+ withheldPerTenMinutes?: number | undefined;
1530
+ withheldPerDay?: number | undefined;
1531
+ } | undefined;
1532
+ rateLimitedMessage?: string | undefined;
1533
+ }, {
1534
+ maxDurationMinutes?: number | undefined;
1535
+ wrapUpWarningSeconds?: number | undefined;
1536
+ wrapUpMessage?: string | undefined;
1537
+ goodbyeMessage?: string | undefined;
1538
+ callerRateLimit?: {
1539
+ enabled?: boolean | undefined;
1540
+ perTenMinutes?: number | undefined;
1541
+ perDay?: number | undefined;
1542
+ withheldPerTenMinutes?: number | undefined;
1543
+ withheldPerDay?: number | undefined;
1544
+ } | undefined;
1545
+ rateLimitedMessage?: string | undefined;
1546
+ }>>;
1387
1547
  source: z.ZodOptional<z.ZodEnum<["sdk", "flow", "playbook", "connector"]>>;
1388
1548
  modeLocked: z.ZodOptional<z.ZodBoolean>;
1389
1549
  requiredInfo: z.ZodDefault<z.ZodArray<z.ZodObject<{
@@ -1510,6 +1670,20 @@ declare const AgentConfig: z.ZodObject<{
1510
1670
  } | undefined;
1511
1671
  tags?: string[] | undefined;
1512
1672
  brainConnectorId?: string | null | undefined;
1673
+ callLimits?: {
1674
+ maxDurationMinutes?: number | undefined;
1675
+ wrapUpWarningSeconds?: number | undefined;
1676
+ wrapUpMessage?: string | undefined;
1677
+ goodbyeMessage?: string | undefined;
1678
+ callerRateLimit?: {
1679
+ enabled?: boolean | undefined;
1680
+ perTenMinutes?: number | undefined;
1681
+ perDay?: number | undefined;
1682
+ withheldPerTenMinutes?: number | undefined;
1683
+ withheldPerDay?: number | undefined;
1684
+ } | undefined;
1685
+ rateLimitedMessage?: string | undefined;
1686
+ } | undefined;
1513
1687
  modeLocked?: boolean | undefined;
1514
1688
  draftUpdatedAt?: string | undefined;
1515
1689
  }, {
@@ -1607,6 +1781,20 @@ declare const AgentConfig: z.ZodObject<{
1607
1781
  } | undefined;
1608
1782
  tags?: string[] | undefined;
1609
1783
  brainConnectorId?: string | null | undefined;
1784
+ callLimits?: {
1785
+ maxDurationMinutes?: number | undefined;
1786
+ wrapUpWarningSeconds?: number | undefined;
1787
+ wrapUpMessage?: string | undefined;
1788
+ goodbyeMessage?: string | undefined;
1789
+ callerRateLimit?: {
1790
+ enabled?: boolean | undefined;
1791
+ perTenMinutes?: number | undefined;
1792
+ perDay?: number | undefined;
1793
+ withheldPerTenMinutes?: number | undefined;
1794
+ withheldPerDay?: number | undefined;
1795
+ } | undefined;
1796
+ rateLimitedMessage?: string | undefined;
1797
+ } | undefined;
1610
1798
  modeLocked?: boolean | undefined;
1611
1799
  requiredInfo?: {
1612
1800
  type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
@@ -1619,9 +1807,246 @@ declare const AgentConfig: z.ZodObject<{
1619
1807
  }>;
1620
1808
  type AgentConfig = z.infer<typeof AgentConfig>;
1621
1809
 
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")[]]>;
1810
+ /** POST /v1/calls/:id/finalize — sent once, at the session's close, after the worker's last write for the call. */
1811
+ declare const CallFinalizeInput: z.ZodEffects<z.ZodObject<{
1812
+ fields: z.ZodArray<z.ZodObject<{
1813
+ name: z.ZodString;
1814
+ type: z.ZodEnum<["string", "string[]", "number", "boolean", "datetime", "email", "phone"]>;
1815
+ required: z.ZodBoolean;
1816
+ filled: z.ZodBoolean;
1817
+ value: z.ZodUnion<[z.ZodString, z.ZodNumber, z.ZodBoolean, z.ZodArray<z.ZodString, "many">, z.ZodNull]>;
1818
+ }, "strip", z.ZodTypeAny, {
1819
+ value: string | number | boolean | string[] | null;
1820
+ type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
1821
+ name: string;
1822
+ required: boolean;
1823
+ filled: boolean;
1824
+ }, {
1825
+ value: string | number | boolean | string[] | null;
1826
+ type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
1827
+ name: string;
1828
+ required: boolean;
1829
+ filled: boolean;
1830
+ }>, "many">;
1831
+ }, "strip", z.ZodTypeAny, {
1832
+ fields: {
1833
+ value: string | number | boolean | string[] | null;
1834
+ type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
1835
+ name: string;
1836
+ required: boolean;
1837
+ filled: boolean;
1838
+ }[];
1839
+ }, {
1840
+ fields: {
1841
+ value: string | number | boolean | string[] | null;
1842
+ type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
1843
+ name: string;
1844
+ required: boolean;
1845
+ filled: boolean;
1846
+ }[];
1847
+ }>, {
1848
+ fields: {
1849
+ value: string | number | boolean | string[] | null;
1850
+ type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
1851
+ name: string;
1852
+ required: boolean;
1853
+ filled: boolean;
1854
+ }[];
1855
+ }, {
1856
+ fields: {
1857
+ value: string | number | boolean | string[] | null;
1858
+ type: "string" | "number" | "boolean" | "email" | "string[]" | "datetime" | "phone";
1859
+ name: string;
1860
+ required: boolean;
1861
+ filled: boolean;
1862
+ }[];
1863
+ }>;
1864
+ type CallFinalizeInput = z.infer<typeof CallFinalizeInput>;
1865
+
1866
+ declare const FLOW_BOOT_FAILURES: readonly ["schema_fetch_failed", "no_process_schema", "missing_agent_id", "no_api_key", "worker_identity_refused", "provider_unavailable"];
1867
+ type FlowBootFailure = (typeof FLOW_BOOT_FAILURES)[number];
1868
+ type AgentEndReasonValue = `flow_boot:${FlowBootFailure}` | 'max_duration';
1869
+ declare const AgentEndReason: z.ZodEnum<[AgentEndReasonValue, ...AgentEndReasonValue[]]>;
1623
1870
  type AgentEndReason = z.infer<typeof AgentEndReason>;
1624
1871
 
1872
+ declare const CallAdmissionRequest: z.ZodObject<{
1873
+ roomName: z.ZodString;
1874
+ /** From the dispatch metadata: lets the API admit (gate) a room whose call row doesn't exist yet. */
1875
+ agentId: z.ZodOptional<z.ZodString>;
1876
+ phoneNumberId: z.ZodOptional<z.ZodString>;
1877
+ caller: z.ZodObject<{
1878
+ channel: z.ZodEnum<["phone", "web"]>;
1879
+ /** The caller's number as the carrier presented it; null / absent / not E.164 ⇒ the withheld bucket. */
1880
+ number: z.ZodOptional<z.ZodNullable<z.ZodString>>;
1881
+ }, "strip", z.ZodTypeAny, {
1882
+ channel: "phone" | "web";
1883
+ number?: string | null | undefined;
1884
+ }, {
1885
+ channel: "phone" | "web";
1886
+ number?: string | null | undefined;
1887
+ }>;
1888
+ }, "strip", z.ZodTypeAny, {
1889
+ caller: {
1890
+ channel: "phone" | "web";
1891
+ number?: string | null | undefined;
1892
+ };
1893
+ roomName: string;
1894
+ agentId?: string | undefined;
1895
+ phoneNumberId?: string | undefined;
1896
+ }, {
1897
+ caller: {
1898
+ channel: "phone" | "web";
1899
+ number?: string | null | undefined;
1900
+ };
1901
+ roomName: string;
1902
+ agentId?: string | undefined;
1903
+ phoneNumberId?: string | undefined;
1904
+ }>;
1905
+ type CallAdmissionRequest = z.infer<typeof CallAdmissionRequest>;
1906
+ declare const CallAdmissionResponse: z.ZodDiscriminatedUnion<"admitted", [z.ZodObject<{
1907
+ admitted: z.ZodLiteral<true>;
1908
+ limits: z.ZodObject<{
1909
+ /** The agent's own ceiling (already clamped to the plan), or null when it set none. */
1910
+ agentMaxSeconds: z.ZodNullable<z.ZodNumber>;
1911
+ /** The plan ceiling — the platform bound no call outlives. */
1912
+ ceilingSeconds: z.ZodNumber;
1913
+ wrapUpWarningSeconds: z.ZodNumber;
1914
+ wrapUpMessage: z.ZodString;
1915
+ goodbyeMessage: z.ZodString;
1916
+ }, "strip", z.ZodTypeAny, {
1917
+ wrapUpWarningSeconds: number;
1918
+ wrapUpMessage: string;
1919
+ goodbyeMessage: string;
1920
+ agentMaxSeconds: number | null;
1921
+ ceilingSeconds: number;
1922
+ }, {
1923
+ wrapUpWarningSeconds: number;
1924
+ wrapUpMessage: string;
1925
+ goodbyeMessage: string;
1926
+ agentMaxSeconds: number | null;
1927
+ ceilingSeconds: number;
1928
+ }>;
1929
+ }, "strip", z.ZodTypeAny, {
1930
+ admitted: true;
1931
+ limits: {
1932
+ wrapUpWarningSeconds: number;
1933
+ wrapUpMessage: string;
1934
+ goodbyeMessage: string;
1935
+ agentMaxSeconds: number | null;
1936
+ ceilingSeconds: number;
1937
+ };
1938
+ }, {
1939
+ admitted: true;
1940
+ limits: {
1941
+ wrapUpWarningSeconds: number;
1942
+ wrapUpMessage: string;
1943
+ goodbyeMessage: string;
1944
+ agentMaxSeconds: number | null;
1945
+ ceilingSeconds: number;
1946
+ };
1947
+ }>, z.ZodObject<{
1948
+ admitted: z.ZodLiteral<false>;
1949
+ /** 'rate_limited:caller' | 'inbound_refused:<code>' — already recorded as the call's end reason. */
1950
+ endReason: z.ZodString;
1951
+ /** The fixed line to speak before hanging up. */
1952
+ message: z.ZodString;
1953
+ }, "strip", z.ZodTypeAny, {
1954
+ message: string;
1955
+ admitted: false;
1956
+ endReason: string;
1957
+ }, {
1958
+ message: string;
1959
+ admitted: false;
1960
+ endReason: string;
1961
+ }>]>;
1962
+ type CallAdmissionResponse = z.infer<typeof CallAdmissionResponse>;
1963
+
1964
+ declare const PipelineKeys: z.ZodObject<{
1965
+ llm: z.ZodOptional<z.ZodObject<{
1966
+ /** The provider as the slot reports it (LiveKit's label: `openai`, `api.openai.com`, `Deepgram`, …). */
1967
+ provider: z.ZodString;
1968
+ /** true = the workspace's own key built it; false = the platform's. */
1969
+ byok: z.ZodBoolean;
1970
+ }, "strip", z.ZodTypeAny, {
1971
+ provider: string;
1972
+ byok: boolean;
1973
+ }, {
1974
+ provider: string;
1975
+ byok: boolean;
1976
+ }>>;
1977
+ stt: z.ZodOptional<z.ZodObject<{
1978
+ /** The provider as the slot reports it (LiveKit's label: `openai`, `api.openai.com`, `Deepgram`, …). */
1979
+ provider: z.ZodString;
1980
+ /** true = the workspace's own key built it; false = the platform's. */
1981
+ byok: z.ZodBoolean;
1982
+ }, "strip", z.ZodTypeAny, {
1983
+ provider: string;
1984
+ byok: boolean;
1985
+ }, {
1986
+ provider: string;
1987
+ byok: boolean;
1988
+ }>>;
1989
+ tts: z.ZodOptional<z.ZodObject<{
1990
+ /** The provider as the slot reports it (LiveKit's label: `openai`, `api.openai.com`, `Deepgram`, …). */
1991
+ provider: z.ZodString;
1992
+ /** true = the workspace's own key built it; false = the platform's. */
1993
+ byok: z.ZodBoolean;
1994
+ }, "strip", z.ZodTypeAny, {
1995
+ provider: string;
1996
+ byok: boolean;
1997
+ }, {
1998
+ provider: string;
1999
+ byok: boolean;
2000
+ }>>;
2001
+ realtime: z.ZodOptional<z.ZodObject<{
2002
+ /** The provider as the slot reports it (LiveKit's label: `openai`, `api.openai.com`, `Deepgram`, …). */
2003
+ provider: z.ZodString;
2004
+ /** true = the workspace's own key built it; false = the platform's. */
2005
+ byok: z.ZodBoolean;
2006
+ }, "strip", z.ZodTypeAny, {
2007
+ provider: string;
2008
+ byok: boolean;
2009
+ }, {
2010
+ provider: string;
2011
+ byok: boolean;
2012
+ }>>;
2013
+ }, "strip", z.ZodTypeAny, {
2014
+ llm?: {
2015
+ provider: string;
2016
+ byok: boolean;
2017
+ } | undefined;
2018
+ stt?: {
2019
+ provider: string;
2020
+ byok: boolean;
2021
+ } | undefined;
2022
+ tts?: {
2023
+ provider: string;
2024
+ byok: boolean;
2025
+ } | undefined;
2026
+ realtime?: {
2027
+ provider: string;
2028
+ byok: boolean;
2029
+ } | undefined;
2030
+ }, {
2031
+ llm?: {
2032
+ provider: string;
2033
+ byok: boolean;
2034
+ } | undefined;
2035
+ stt?: {
2036
+ provider: string;
2037
+ byok: boolean;
2038
+ } | undefined;
2039
+ tts?: {
2040
+ provider: string;
2041
+ byok: boolean;
2042
+ } | undefined;
2043
+ realtime?: {
2044
+ provider: string;
2045
+ byok: boolean;
2046
+ } | undefined;
2047
+ }>;
2048
+ type PipelineKeys = z.infer<typeof PipelineKeys>;
2049
+
1625
2050
  interface ApiCredential {
1626
2051
  readonly apiKey: string;
1627
2052
  readonly baseUrl: string;
@@ -1991,16 +2416,18 @@ interface CallUsageReport {
1991
2416
  readonly model: string;
1992
2417
  readonly inputTokens: number;
1993
2418
  readonly outputTokens: number;
1994
- /** Whose key paid, when the worker knows (its own helper calls): true waives the line, false bills it. */
2419
+ /** Whose key paid: true = the customer's (passed through at $0), false or absent = the platform's (at cost). */
1995
2420
  readonly byok?: boolean;
1996
2421
  }[];
1997
2422
  readonly tts: readonly {
1998
2423
  readonly provider: string;
1999
2424
  readonly chars: number;
2425
+ readonly byok?: boolean;
2000
2426
  }[];
2001
2427
  readonly stt: readonly {
2002
2428
  readonly provider: string;
2003
2429
  readonly seconds: number;
2430
+ readonly byok?: boolean;
2004
2431
  }[];
2005
2432
  }
2006
2433
  interface AppendTranscriptInput {
@@ -2028,6 +2455,11 @@ interface EnsureCallByRoomInput {
2028
2455
  readonly participants?: CallParticipantInput[];
2029
2456
  readonly legs?: CallLegInput[];
2030
2457
  readonly startedAt?: string;
2458
+ /** Whose key each pipeline slot runs on (metering F-16). The API pins it on the call only from the call's own worker
2459
+ * token; every billing path prices from it. */
2460
+ readonly pipelineKeys?: PipelineKeys;
2461
+ /** This worker will finalize the call at its close (POST /v1/calls/:id/finalize); `call.ended` waits for it. */
2462
+ readonly finalizes?: boolean;
2031
2463
  }
2032
2464
  interface CallParticipantInput {
2033
2465
  readonly participantKey: string;
@@ -2065,9 +2497,25 @@ declare class CallsClient {
2065
2497
  constructor(transport: Transport);
2066
2498
  getByRoom(roomName: string): Promise<CallSummary>;
2067
2499
  ensureByRoom(input: EnsureCallByRoomInput): Promise<CallSummary>;
2500
+ /**
2501
+ * The call's admission (burn-down G-41/G-42/G-43), asked once right after the caller joins and before the agent
2502
+ * speaks: admitted with its duration limits, or refused with the end reason the platform recorded and the line to
2503
+ * speak before hanging up. Throws on a transport / server error — the runtime retries, then refuses (fail closed).
2504
+ */
2505
+ admit(input: CallAdmissionRequest): Promise<CallAdmissionResponse>;
2068
2506
  syncState(callId: string, input: SyncCallStateInput): Promise<void>;
2069
2507
  appendTranscriptSegment(callId: string, input: AppendTranscriptInput): Promise<void>;
2070
- reportUsage(callId: string, report: CallUsageReport): Promise<void>;
2508
+ reportUsage(callId: string, report: CallUsageReport, opts?: {
2509
+ readonly signal?: AbortSignal;
2510
+ }): Promise<void>;
2511
+ /**
2512
+ * The worker's last word on a call (burn-down G-20): what the call captured — every declared field — sent at the
2513
+ * session's close after the worker's other writes for the call have landed. The API keeps the fields on the call
2514
+ * and releases the call's held `call.ended` webhook. Idempotent.
2515
+ */
2516
+ finalize(callId: string, input: CallFinalizeInput, opts?: {
2517
+ readonly signal?: AbortSignal;
2518
+ }): Promise<void>;
2071
2519
  appendDtmfEvent(callId: string, input: AppendDtmfEventInput): Promise<void>;
2072
2520
  /**
2073
2521
  * Append a structured call event — consultation lifecycle kinds, or the
@@ -2081,7 +2529,7 @@ declare class CallsClient {
2081
2529
  * is visible in the dashboard, not just the spoken transcript.
2082
2530
  */
2083
2531
  appendEvent(callId: string, input: {
2084
- readonly kind: 'consultation.requested' | 'consultation.resolved' | `tool.${string}` | `handoff.${string}` | `lookup.${string}` | `record.${string}` | `notify.${string}`;
2532
+ readonly kind: 'consultation.requested' | 'consultation.resolved' | 'turn.latency' | `tool.${string}` | `handoff.${string}` | `lookup.${string}` | `record.${string}` | `notify.${string}`;
2085
2533
  readonly payload: Record<string, unknown>;
2086
2534
  }): Promise<void>;
2087
2535
  }