supafone-labs 0.4.14 → 0.5.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/README.md CHANGED
@@ -132,6 +132,26 @@ The first configured language owns the opening, and a non-English primary
132
132
  greeting is translated during provisioning. See
133
133
  [Live Language and Voice Routing](../gitbook/live-language-voice-routing.md).
134
134
 
135
+ Outbound agents can opt into temporary, bounded phone-tree navigation without
136
+ changing their normal campaign objective:
137
+
138
+ ```ts
139
+ await supafone.labs.agents.createOutbound({
140
+ name: "Benefits verification",
141
+ outboundCallMode: {
142
+ enabled: true,
143
+ maxDurationSeconds: 180,
144
+ maxKeypresses: 12,
145
+ },
146
+ });
147
+ ```
148
+
149
+ The SDK stores this provider-neutral contract and exposes fail-closed adapter
150
+ readiness checks. Supafone-managed, Twilio, Telnyx, Plivo, SignalWire, and
151
+ SIP/BYOC use the same public shape; private detection and DTMF execution stay in
152
+ the managed runtime. See
153
+ [Outbound IVR Call Mode](../docs/outbound-ivr-call-mode.md).
154
+
135
155
  BYOK is advanced and split into three independent lanes:
136
156
 
137
157
  | Lane | Examples |
@@ -515,6 +535,10 @@ and `const { Supafone } = require("supafone-labs")` both work, with full types.
515
535
  | `labs.capabilities()` | `GET /api/v1/labs/capabilities` on the Supafone API |
516
536
  | `labs.agents.create/createInbound/createOutbound/list/get` | `/api/v1/labs/agents*` on the Supafone API |
517
537
  | `labs.agents.createInboundWithNumber/createOutboundWithNumber` | Agent creation plus Supafone-managed number buy/assign |
538
+ | `labs.agents.update/readiness/activate/pause/delete` | Durable agent lifecycle using `agent_key` |
539
+ | `labs.agents.startWebRtcCall` | Browser voice test using the durable `agent.id` |
540
+ | `labs.agents.syncKnowledge/detachWebsiteKnowledge/reindexKnowledge` | Managed website corpus lifecycle using `agent.id` |
541
+ | `labs.agents.uploadKnowledgeDocument/deleteKnowledgeDocument/chatKnowledge` | Account-isolated document and grounded-query methods |
518
542
  | `labs.phoneNumbers.search/buy/assign/list/buyAndAssign` | `/api/v1/labs/phone-numbers*` |
519
543
  | `labs.billing.checkout/status/portal` | Stripe-hosted Checkout, payment polling, and Customer Portal |
520
544
  | `labs.telephony.get/configure/useSupafoneManaged` | `/api/v1/labs/telephony` |
@@ -257,16 +257,37 @@ export interface LabsVoiceProviderTraits {
257
257
  is_public?: boolean | null;
258
258
  is_owner?: boolean | null;
259
259
  }
260
+ /** Stable provider presentation metadata returned by the hosted catalog. */
261
+ export interface LabsVoiceProviderBrand {
262
+ /** Canonical provider key used for filtering and grouping. */
263
+ key: string;
264
+ /** Human-readable provider/company name. */
265
+ name: string;
266
+ /** Stable local asset slug when Supafone has an official provider mark. */
267
+ logo_slug?: string | null;
268
+ /** Absolute, browser-ready provider logo URL. */
269
+ logo_url?: string | null;
270
+ /** Provider's official product or company website. */
271
+ website_url?: string | null;
272
+ }
260
273
  export interface LabsVoiceCatalogItem {
261
274
  /** Stable runtime reference, including provider prefix when required. */
262
275
  id: string;
263
276
  voice_id: string;
264
277
  /** Human-readable provider display name. */
265
278
  provider: string;
279
+ /** Canonical brand display name for the synthesis provider. */
280
+ provider_label?: string;
281
+ /** Browser-ready official provider mark, or null for an unknown provider. */
282
+ provider_logo_url?: string | null;
283
+ /** Branding for the provider that renders the voice. */
284
+ provider_brand?: LabsVoiceProviderBrand;
266
285
  /** Canonical SDK/runtime provider key. */
267
286
  provider_key: string;
268
287
  /** Runtime adapter used to place the voice on an Ultravox call. */
269
288
  runtime_provider_key: string;
289
+ /** Branding for the realtime runtime, which can differ from synthesis. */
290
+ runtime_provider_brand?: LabsVoiceProviderBrand;
270
291
  /** Actual TTS engine behind the voice (can differ for Ultravox built-ins). */
271
292
  synthesis_provider_key: string;
272
293
  /** Raw identifier used by the provider API. */
@@ -622,6 +643,95 @@ export interface LabsUltravoxRuntime {
622
643
  sip?: LabsCustomSipConfig;
623
644
  [extra: string]: unknown;
624
645
  }
646
+ export interface OutboundCallModeObservability {
647
+ enabled?: boolean;
648
+ includeTrigger?: boolean;
649
+ includeTransitions?: boolean;
650
+ includeTerminationReason?: boolean;
651
+ metadata?: Record<string, unknown>;
652
+ }
653
+ /** Public, provider-neutral controls for temporary outbound IVR navigation. */
654
+ export interface OutboundCallModeConfig {
655
+ enabled?: boolean;
656
+ autoDetect?: boolean;
657
+ dtmfToolEnabled?: boolean;
658
+ maxDurationSeconds?: number;
659
+ maxKeypresses?: number;
660
+ repeatedMenuLimit?: number;
661
+ noProgressTimeoutSeconds?: number;
662
+ humanDetectionEnabled?: boolean;
663
+ resumeOnHuman?: boolean;
664
+ observability?: OutboundCallModeObservability;
665
+ }
666
+ /** Capabilities positively reported by the active telephony/runtime adapter. */
667
+ export interface OutboundCallModeCapabilities {
668
+ provider?: string;
669
+ dtmf?: boolean;
670
+ statePersistence?: boolean;
671
+ humanDetection?: boolean;
672
+ observability?: boolean;
673
+ metadata?: Record<string, unknown>;
674
+ }
675
+ export interface OutboundCallModeReadiness {
676
+ ready: boolean;
677
+ status: "disabled" | "ready" | "unknown" | "unsupported";
678
+ provider: string;
679
+ transportFamily: string;
680
+ requiredCapabilities: string[];
681
+ missingCapabilities: string[];
682
+ unsupportedCapabilities: string[];
683
+ reasons: string[];
684
+ }
685
+ export declare const OUTBOUND_CALL_MODE_BOUNDS: {
686
+ readonly maxDurationSeconds: {
687
+ readonly default: 180;
688
+ readonly min: 30;
689
+ readonly max: 900;
690
+ };
691
+ readonly maxKeypresses: {
692
+ readonly default: 12;
693
+ readonly min: 1;
694
+ readonly max: 64;
695
+ };
696
+ readonly repeatedMenuLimit: {
697
+ readonly default: 3;
698
+ readonly min: 1;
699
+ readonly max: 10;
700
+ };
701
+ readonly noProgressTimeoutSeconds: {
702
+ readonly default: 30;
703
+ readonly min: 5;
704
+ readonly max: 120;
705
+ };
706
+ };
707
+ export declare const OUTBOUND_CALL_MODE_DEFAULTS: {
708
+ readonly enabled: false;
709
+ readonly autoDetect: true;
710
+ readonly dtmfToolEnabled: true;
711
+ readonly maxDurationSeconds: 180;
712
+ readonly maxKeypresses: 12;
713
+ readonly repeatedMenuLimit: 3;
714
+ readonly noProgressTimeoutSeconds: 30;
715
+ readonly humanDetectionEnabled: true;
716
+ readonly resumeOnHuman: true;
717
+ readonly observability: {
718
+ readonly enabled: true;
719
+ readonly includeTrigger: true;
720
+ readonly includeTransitions: true;
721
+ readonly includeTerminationReason: true;
722
+ };
723
+ };
724
+ export interface OutboundCallModeProviderProfile {
725
+ contractSupported: boolean;
726
+ execution: "adapter_runtime_dependent";
727
+ capabilityPolicy: "fail_closed";
728
+ transportFamily: string;
729
+ providers: readonly string[];
730
+ requiredCapabilities: readonly string[];
731
+ }
732
+ export declare const OUTBOUND_CALL_MODE_PROVIDER_MATRIX: Record<string, OutboundCallModeProviderProfile>;
733
+ export declare function outboundCallModeProviderProfile(provider: string): OutboundCallModeProviderProfile;
734
+ export declare function outboundCallModeReadiness(config?: OutboundCallModeConfig, capabilities?: OutboundCallModeCapabilities): OutboundCallModeReadiness;
625
735
  export interface CreateLabsAgentRequest {
626
736
  agencyId?: string;
627
737
  agency_id?: string;
@@ -706,6 +816,9 @@ export interface CreateLabsAgentRequest {
706
816
  voice_watcher?: boolean;
707
817
  voiceWatcherModel?: string;
708
818
  voice_watcher_model?: string;
819
+ /** Opt-in outbound IVR mode. Execution depends on adapter-reported readiness. */
820
+ outboundCallMode?: OutboundCallModeConfig;
821
+ outbound_call_mode?: OutboundCallModeConfig;
709
822
  metadata?: Record<string, unknown>;
710
823
  }
711
824
  export interface ListLabsAgentsOptions {
@@ -728,6 +841,41 @@ export interface DeleteLabsAgentResponse {
728
841
  released_numbers?: unknown[];
729
842
  [extra: string]: unknown;
730
843
  }
844
+ export type LabsAgentLifecycle = "draft" | "active" | "paused" | "archived" | string;
845
+ export interface LabsAgentReadiness {
846
+ ready: boolean;
847
+ status?: string;
848
+ checks?: Array<Record<string, unknown>>;
849
+ [extra: string]: unknown;
850
+ }
851
+ export type UpdateLabsAgentRequest = Partial<CreateLabsAgentRequest>;
852
+ export interface LabsAgentLifecycleResponse {
853
+ success?: boolean;
854
+ agent?: LabsAgentResponse;
855
+ lifecycle?: LabsAgentLifecycle;
856
+ readiness?: LabsAgentReadiness;
857
+ [extra: string]: unknown;
858
+ }
859
+ export interface LabsKnowledgeSyncRequest {
860
+ websiteUrl?: string;
861
+ website_url?: string;
862
+ url?: string;
863
+ }
864
+ export interface LabsKnowledgeSyncResponse {
865
+ agent: LabsAgentResponse;
866
+ chunks_indexed?: number;
867
+ scraped_ok?: boolean;
868
+ last_error?: string | null;
869
+ website_detached?: boolean;
870
+ }
871
+ export interface LabsKnowledgeChatTurn {
872
+ role: "user" | "assistant";
873
+ content: string;
874
+ }
875
+ export interface LabsKnowledgeChatResponse {
876
+ reply: string;
877
+ sources: string[];
878
+ }
731
879
  export interface LabsCapabilitiesResponse {
732
880
  product: string;
733
881
  api_namespace: string;
@@ -778,7 +926,10 @@ export interface LabsVoiceListResponse {
778
926
  configured: boolean;
779
927
  voice_count: number;
780
928
  error?: string | null;
929
+ brand?: LabsVoiceProviderBrand;
781
930
  }>;
931
+ /** Distinct synthesis-provider brands represented in the complete result. */
932
+ provider_brands?: LabsVoiceProviderBrand[];
782
933
  provider_accounts?: Record<string, unknown>;
783
934
  errors?: Record<string, string>;
784
935
  catalog?: {
@@ -1068,6 +1219,8 @@ export interface LabsAgentResponse {
1068
1219
  display_name?: string;
1069
1220
  runtime_mode?: string;
1070
1221
  preset_key?: string;
1222
+ status?: string;
1223
+ lifecycle?: LabsAgentLifecycle;
1071
1224
  profile?: Record<string, unknown>;
1072
1225
  runtime?: Record<string, unknown>;
1073
1226
  [extra: string]: unknown;
@@ -1100,6 +1253,9 @@ export interface ListLabsAgentsResponse {
1100
1253
  }
1101
1254
  export interface GetLabsAgentResponse {
1102
1255
  agent: LabsAgentResponse;
1256
+ runtime?: Record<string, unknown>;
1257
+ widget?: Record<string, unknown>;
1258
+ readiness?: LabsAgentReadiness;
1103
1259
  }
1104
1260
  export interface STTResult {
1105
1261
  transcript: string;
@@ -1394,6 +1550,8 @@ export declare class SupafoneLabs {
1394
1550
  request<T>(method: string, path: string, body?: unknown, useSession?: boolean): Promise<T>;
1395
1551
  /** @internal Authenticated JSON request to the Supafone app API (`/api/v1/labs/*`). */
1396
1552
  requestSupafoneApi<T>(method: string, path: string, body?: unknown): Promise<T>;
1553
+ /** @internal Multipart upload to the Supafone product API with the Labs key. */
1554
+ requestSupafoneUpload<T>(path: string, file: Uint8Array | ArrayBuffer | Blob, filename: string): Promise<T>;
1397
1555
  /** @internal Authenticated binary request to the Supafone app API. */
1398
1556
  requestSupafoneBinary(path: string): Promise<LabsVoicePreview>;
1399
1557
  /**
@@ -1625,6 +1783,14 @@ export interface CampaignLiveView {
1625
1783
  portal_url: string;
1626
1784
  stats?: Record<string, unknown> | null;
1627
1785
  }
1786
+ export interface CampaignCreateInput {
1787
+ name?: string;
1788
+ goal?: string;
1789
+ agentId?: string;
1790
+ accountId?: string;
1791
+ settings?: Record<string, unknown>;
1792
+ outboundCallMode?: OutboundCallModeConfig;
1793
+ }
1628
1794
  export interface CampaignUpdateInput {
1629
1795
  name?: string;
1630
1796
  goal?: string;
@@ -1636,6 +1802,7 @@ export interface CampaignUpdateInput {
1636
1802
  delay_hours: number;
1637
1803
  }[];
1638
1804
  settings?: Record<string, unknown>;
1805
+ outboundCallMode?: OutboundCallModeConfig;
1639
1806
  }
1640
1807
  export interface BrandScanResult {
1641
1808
  url: string;
@@ -1699,12 +1866,7 @@ declare class CampaignsNamespace {
1699
1866
  }): Promise<{
1700
1867
  campaigns: CampaignSummary[];
1701
1868
  }>;
1702
- create(opts?: {
1703
- name?: string;
1704
- goal?: string;
1705
- agentId?: string;
1706
- accountId?: string;
1707
- }): Promise<{
1869
+ create(opts?: CampaignCreateInput): Promise<{
1708
1870
  campaign: CampaignSummary;
1709
1871
  }>;
1710
1872
  get(campaignId: string): Promise<{
@@ -1912,6 +2074,32 @@ declare class LabsAgentsNamespace {
1912
2074
  list(opts?: ListLabsAgentsOptions): Promise<ListLabsAgentsResponse>;
1913
2075
  /** Fetch one durable agent by key. */
1914
2076
  get(agentKey: string, opts?: GetLabsAgentOptions): Promise<GetLabsAgentResponse>;
2077
+ /** Update an existing durable agent without changing omitted fields. */
2078
+ update(agentKey: string, input: UpdateLabsAgentRequest, opts?: GetLabsAgentOptions): Promise<LabsAgentLifecycleResponse>;
2079
+ /** Scrape a website and rebuild this agent's managed knowledge corpus. */
2080
+ syncKnowledge(agentId: string, input?: LabsKnowledgeSyncRequest): Promise<LabsKnowledgeSyncResponse>;
2081
+ /** Remove website knowledge while preserving uploaded documents and notes. */
2082
+ detachWebsiteKnowledge(agentId: string): Promise<LabsKnowledgeSyncResponse>;
2083
+ /** Ask the managed server whether this agent is ready to activate. */
2084
+ readiness(agentKey: string, opts?: GetLabsAgentOptions): Promise<LabsAgentReadiness>;
2085
+ /** Activate a ready hosted agent. */
2086
+ activate(agentKey: string, opts?: GetLabsAgentOptions): Promise<LabsAgentLifecycleResponse>;
2087
+ /** Pause a hosted agent without deleting it. */
2088
+ pause(agentKey: string, opts?: GetLabsAgentOptions): Promise<LabsAgentLifecycleResponse>;
2089
+ /** Start the native provider-neutral browser voice session for this agent. */
2090
+ startWebRtcCall(agentId: string): Promise<WebRtcCallResult>;
2091
+ /** Rebuild retrieval data from the agent's already saved knowledge sources. */
2092
+ reindexKnowledge(agentId: string): Promise<Record<string, unknown>>;
2093
+ /** Upload and index a txt, md, csv, or PDF knowledge document. */
2094
+ uploadKnowledgeDocument(agentId: string, file: Uint8Array | ArrayBuffer | Blob, filename: string): Promise<{
2095
+ agent: LabsAgentResponse;
2096
+ }>;
2097
+ /** Delete one document and rebuild the agent's managed corpus. */
2098
+ deleteKnowledgeDocument(agentId: string, documentId: string): Promise<{
2099
+ agent: LabsAgentResponse;
2100
+ }>;
2101
+ /** Ask a grounded question against the same corpus used during calls. */
2102
+ chatKnowledge(agentId: string, message: string, history?: LabsKnowledgeChatTurn[]): Promise<LabsKnowledgeChatResponse>;
1915
2103
  /** Delete an agent. Optionally ask the backend to release assigned numbers. */
1916
2104
  delete(agentKey: string, opts?: DeleteLabsAgentOptions): Promise<DeleteLabsAgentResponse>;
1917
2105
  }