supafone-labs 0.3.0 → 0.3.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 +87 -15
- package/dist/cjs/index.d.ts +365 -7
- package/dist/cjs/index.js +457 -17
- package/dist/index.d.ts +365 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +456 -17
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/index.ts +819 -21
package/README.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
#
|
|
1
|
+
# supafone-labs
|
|
2
2
|
|
|
3
3
|
**The TypeScript client for the Supafone agent framework.**
|
|
4
4
|
|
|
5
5
|
Use this package to create hosted Supafone agents from code: inbound
|
|
6
6
|
receptionists, outbound sales agents, web agents, Supafone-managed phone
|
|
7
7
|
numbers, built-in stages, tools, recordings, transcripts, widgets, and Supafone
|
|
8
|
-
Pro watcher. It also includes the [Supafone Labs cloud](https
|
|
8
|
+
Pro watcher. It also includes the [Supafone Labs cloud](https://labs.supafone.ai)
|
|
9
9
|
sidecar oracle, hosted TTS/STT, live multilingual transcription, the builder,
|
|
10
10
|
and the adversarial QA suite.
|
|
11
11
|
|
|
12
12
|
Dependency-free. Works in Node 18+ and the browser (native `fetch` / `WebSocket`).
|
|
13
13
|
|
|
14
14
|
```bash
|
|
15
|
-
npm i
|
|
15
|
+
npm i supafone-labs
|
|
16
16
|
```
|
|
17
17
|
|
|
18
18
|
## Keys
|
|
@@ -22,7 +22,7 @@ The SDK talks to two related APIs:
|
|
|
22
22
|
| Environment variable | Key shape | Used for |
|
|
23
23
|
| --- | --- | --- |
|
|
24
24
|
| `SUPAFONE_LABS_API_KEY` | `sl_live_...` | Labs cloud oracle, hosted TTS/STT, logs, usage, QA, optimizer |
|
|
25
|
-
| `SUPAFONE_API_KEY` | `sf_live_...` | Hosted Supafone agents on `/api/
|
|
25
|
+
| `SUPAFONE_API_KEY` | `sf_live_...` | Hosted Supafone agents on `/api/v1/labs/*` |
|
|
26
26
|
|
|
27
27
|
If you only use hosted-agent methods, `SUPAFONE_API_KEY` is enough. If you use
|
|
28
28
|
both products from one SDK instance, pass `SUPAFONE_API_KEY` as
|
|
@@ -31,7 +31,7 @@ both products from one SDK instance, pass `SUPAFONE_API_KEY` as
|
|
|
31
31
|
## Quick start
|
|
32
32
|
|
|
33
33
|
```ts
|
|
34
|
-
import { Supafone } from "
|
|
34
|
+
import { Supafone } from "supafone-labs";
|
|
35
35
|
|
|
36
36
|
const supafone = new Supafone({ apiKey: process.env.SUPAFONE_LABS_API_KEY! });
|
|
37
37
|
|
|
@@ -51,7 +51,7 @@ the agent is doing fine — say nothing.
|
|
|
51
51
|
## Spawn a hosted Supafone agent
|
|
52
52
|
|
|
53
53
|
Use the same package to create finished Supafone agents from code. This hits the
|
|
54
|
-
Supafone API (`/api/
|
|
54
|
+
Supafone API (`/api/v1/labs/*`), not a raw Ultravox endpoint: Supafone keeps the
|
|
55
55
|
multistage state machine, managed voice accounts, tools, recordings,
|
|
56
56
|
transcripts, account sync, and Supafone Pro watcher attached.
|
|
57
57
|
|
|
@@ -59,8 +59,23 @@ The default path is fully Supafone-managed. Developers do **not** need a Twilio
|
|
|
59
59
|
account, Ultravox account, or voice-provider account to buy a number and launch
|
|
60
60
|
an agent.
|
|
61
61
|
|
|
62
|
+
Supafone Labs has two main features:
|
|
63
|
+
|
|
64
|
+
- **Agent Factory**: create the complete hosted agent with managed provider
|
|
65
|
+
defaults and one Supafone API key.
|
|
66
|
+
- **Self-healing watcher**: enable `labs.enabled` to attach the Supafone Labs
|
|
67
|
+
second mind to a hosted or BYOK agent.
|
|
68
|
+
|
|
69
|
+
BYOK is advanced and split into three independent lanes:
|
|
70
|
+
|
|
71
|
+
| Lane | Examples |
|
|
72
|
+
| --- | --- |
|
|
73
|
+
| Agent/provider stack | Ultravox, Retell, Vapi, Bland, LiveKit, Pipecat, GPT Realtime, Grok |
|
|
74
|
+
| Telephony | Twilio, Telnyx, Plivo, SignalWire, SIP/custom trunks |
|
|
75
|
+
| TTS | Cartesia, ElevenLabs, Inworld, Deepgram, custom TTS |
|
|
76
|
+
|
|
62
77
|
```ts
|
|
63
|
-
import { Supafone } from "
|
|
78
|
+
import { Supafone } from "supafone-labs";
|
|
64
79
|
|
|
65
80
|
const supafone = new Supafone({
|
|
66
81
|
apiKey: process.env.SUPAFONE_LABS_API_KEY || process.env.SUPAFONE_API_KEY!,
|
|
@@ -88,6 +103,21 @@ const inbound = await supafone.labs.agents.createInboundWithNumber({
|
|
|
88
103
|
enabled: true,
|
|
89
104
|
model: "gemma",
|
|
90
105
|
},
|
|
106
|
+
recording: {
|
|
107
|
+
enabled: true,
|
|
108
|
+
recordAudio: true,
|
|
109
|
+
consentRequired: true,
|
|
110
|
+
announcement: "This call may be recorded for quality and training.",
|
|
111
|
+
retentionDays: 30,
|
|
112
|
+
redactPii: true,
|
|
113
|
+
},
|
|
114
|
+
transcription: {
|
|
115
|
+
enabled: true,
|
|
116
|
+
provider: "supafone_managed",
|
|
117
|
+
language: "multi",
|
|
118
|
+
diarization: true,
|
|
119
|
+
timestamps: true,
|
|
120
|
+
},
|
|
91
121
|
tools: {
|
|
92
122
|
callRouting: true,
|
|
93
123
|
scheduling: true,
|
|
@@ -128,8 +158,16 @@ const outbound = await supafone.labs.agents.createOutboundWithNumber({
|
|
|
128
158
|
console.log(outbound.number?.assignment);
|
|
129
159
|
```
|
|
130
160
|
|
|
161
|
+
Call artifacts are available from the same hosted-agent namespace:
|
|
162
|
+
|
|
163
|
+
```ts
|
|
164
|
+
await supafone.labs.calls.list({ agentKey: "medivoice-intake" });
|
|
165
|
+
await supafone.labs.recordings.list({ agentKey: "medivoice-intake" });
|
|
166
|
+
await supafone.labs.transcripts.list({ agentKey: "medivoice-intake" });
|
|
167
|
+
```
|
|
168
|
+
|
|
131
169
|
If you already own telephony, keep Supafone's agent framework and configure
|
|
132
|
-
BYOK as the advanced path:
|
|
170
|
+
that BYOK lane as the advanced path:
|
|
133
171
|
|
|
134
172
|
```ts
|
|
135
173
|
await supafone.labs.telephony.configure({
|
|
@@ -143,6 +181,40 @@ await supafone.labs.telephony.configure({
|
|
|
143
181
|
});
|
|
144
182
|
```
|
|
145
183
|
|
|
184
|
+
Or configure all three BYOK lanes in one agent payload:
|
|
185
|
+
|
|
186
|
+
```ts
|
|
187
|
+
await supafone.labs.agents.createOutbound({
|
|
188
|
+
agentKey: "speed-to-lead-byok",
|
|
189
|
+
name: "Speed to lead BYOK",
|
|
190
|
+
byok: {
|
|
191
|
+
agentProvider: {
|
|
192
|
+
provider: "ultravox",
|
|
193
|
+
apiKey: process.env.ULTRAVOX_API_KEY!,
|
|
194
|
+
},
|
|
195
|
+
telephony: {
|
|
196
|
+
mode: "byok",
|
|
197
|
+
provider: "telnyx",
|
|
198
|
+
credentials: {
|
|
199
|
+
apiKey: process.env.TELNYX_API_KEY!,
|
|
200
|
+
connectionId: process.env.TELNYX_CONNECTION_ID!,
|
|
201
|
+
fromNumber: "+14155550123",
|
|
202
|
+
},
|
|
203
|
+
},
|
|
204
|
+
tts: {
|
|
205
|
+
provider: "cartesia",
|
|
206
|
+
apiKey: process.env.CARTESIA_API_KEY!,
|
|
207
|
+
},
|
|
208
|
+
},
|
|
209
|
+
labs: {
|
|
210
|
+
enabled: true,
|
|
211
|
+
mode: "byok",
|
|
212
|
+
managedInfrastructure: false,
|
|
213
|
+
tts: { provider: "cartesia" },
|
|
214
|
+
},
|
|
215
|
+
});
|
|
216
|
+
```
|
|
217
|
+
|
|
146
218
|
## Verify the hosted-agent path
|
|
147
219
|
|
|
148
220
|
Use the production smoke example before handing a key to a customer or testing a
|
|
@@ -227,18 +299,18 @@ inspect gateway responses.
|
|
|
227
299
|
|
|
228
300
|
## Module format
|
|
229
301
|
|
|
230
|
-
Ships **both ESM and CommonJS**. `import { Supafone } from "
|
|
231
|
-
and `const { Supafone } = require("
|
|
302
|
+
Ships **both ESM and CommonJS**. `import { Supafone } from "supafone-labs"`
|
|
303
|
+
and `const { Supafone } = require("supafone-labs")` both work, with full types.
|
|
232
304
|
|
|
233
305
|
## API
|
|
234
306
|
|
|
235
307
|
| Method | Endpoint |
|
|
236
308
|
| --- | --- |
|
|
237
|
-
| `labs.capabilities()` | `GET /api/
|
|
238
|
-
| `labs.agents.create/createInbound/createOutbound/list/get` | `/api/
|
|
309
|
+
| `labs.capabilities()` | `GET /api/v1/labs/capabilities` on the Supafone API |
|
|
310
|
+
| `labs.agents.create/createInbound/createOutbound/list/get` | `/api/v1/labs/agents*` on the Supafone API |
|
|
239
311
|
| `labs.agents.createInboundWithNumber/createOutboundWithNumber` | Agent creation plus Supafone-managed number buy/assign |
|
|
240
|
-
| `labs.phoneNumbers.search/buy/assign/list/buyAndAssign` | `/api/
|
|
241
|
-
| `labs.telephony.get/configure/useSupafoneManaged` | `/api/
|
|
312
|
+
| `labs.phoneNumbers.search/buy/assign/list/buyAndAssign` | `/api/v1/labs/phone-numbers*` |
|
|
313
|
+
| `labs.telephony.get/configure/useSupafoneManaged` | `/api/v1/labs/telephony` |
|
|
242
314
|
| `labs.presets.list()` · `labs.tools.list()` · `labs.voices.list()` | Supafone hosted-agent discovery |
|
|
243
315
|
| `whisper(transcript, opts?)` | convenience over the oracle |
|
|
244
316
|
| `oracle({ messages, model?, ... })` | `POST /v1/oracle/complete` |
|
|
@@ -250,7 +322,7 @@ and `const { Supafone } = require("@supafonesupafone-labs")` both work, with ful
|
|
|
250
322
|
| `qa.run/history` | `/v1/qa/*` |
|
|
251
323
|
| `optimizer.improve/standing` | `/v1/optimizer/*` |
|
|
252
324
|
|
|
253
|
-
Get a key (5 free minutes, no card): <https
|
|
325
|
+
Get a key (5 free minutes, no card): <https://labs.supafone.ai/get-key.html>
|
|
254
326
|
|
|
255
327
|
The runtime, all provider adapters, and the offline (bring-your-own-keys) mode
|
|
256
328
|
are open source and MIT-licensed — the Python package `pip install supafone-labs`
|