@pinecall/skills 0.1.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.
Files changed (68) hide show
  1. package/README.md +65 -0
  2. package/build.mjs +204 -0
  3. package/package.json +29 -0
  4. package/skills/pinecall-concepts/SKILL.md +41 -0
  5. package/skills/pinecall-concepts/references/concepts/agents-and-channels.md +155 -0
  6. package/skills/pinecall-concepts/references/concepts/deployment-topologies.md +120 -0
  7. package/skills/pinecall-concepts/references/concepts/hot-reload.md +119 -0
  8. package/skills/pinecall-concepts/references/concepts/philosophy.md +100 -0
  9. package/skills/pinecall-concepts/references/concepts/server-vs-client-llm.md +119 -0
  10. package/skills/pinecall-examples/SKILL.md +59 -0
  11. package/skills/pinecall-examples/references/examples/browser-widget.md +206 -0
  12. package/skills/pinecall-examples/references/examples/chat-bot.md +184 -0
  13. package/skills/pinecall-examples/references/examples/headless-agent.md +121 -0
  14. package/skills/pinecall-examples/references/examples/index.md +183 -0
  15. package/skills/pinecall-examples/references/examples/multi-channel-bot.md +173 -0
  16. package/skills/pinecall-examples/references/examples/outbound-dispatch.md +109 -0
  17. package/skills/pinecall-examples/references/examples/turn-detection.md +150 -0
  18. package/skills/pinecall-guides/SKILL.md +68 -0
  19. package/skills/pinecall-guides/references/guides/call-ringing.md +149 -0
  20. package/skills/pinecall-guides/references/guides/conversation-history.md +377 -0
  21. package/skills/pinecall-guides/references/guides/dev-mode.md +130 -0
  22. package/skills/pinecall-guides/references/guides/events.md +677 -0
  23. package/skills/pinecall-guides/references/guides/human-takeover.md +184 -0
  24. package/skills/pinecall-guides/references/guides/inbound-voice.md +201 -0
  25. package/skills/pinecall-guides/references/guides/knowledge-bases.md +166 -0
  26. package/skills/pinecall-guides/references/guides/live-listening.md +199 -0
  27. package/skills/pinecall-guides/references/guides/multi-tenant.md +158 -0
  28. package/skills/pinecall-guides/references/guides/outbound-calls.md +279 -0
  29. package/skills/pinecall-guides/references/guides/sse-streaming.md +207 -0
  30. package/skills/pinecall-guides/references/guides/testing-agents.md +272 -0
  31. package/skills/pinecall-guides/references/guides/tools-and-functions.md +254 -0
  32. package/skills/pinecall-guides/references/guides/webrtc-browser.md +200 -0
  33. package/skills/pinecall-guides/references/guides/whatsapp.md +370 -0
  34. package/skills/pinecall-guides/references/guides/ws-streaming.md +235 -0
  35. package/skills/pinecall-quickstart/SKILL.md +54 -0
  36. package/skills/pinecall-quickstart/references/index.md +123 -0
  37. package/skills/pinecall-quickstart/references/quickstart.md +185 -0
  38. package/skills/pinecall-reference/SKILL.md +43 -0
  39. package/skills/pinecall-reference/references/reference/cli.md +578 -0
  40. package/skills/pinecall-reference/references/reference/events.md +366 -0
  41. package/skills/pinecall-reference/references/reference/llm-providers.md +263 -0
  42. package/skills/pinecall-reference/references/reference/rest-api.md +122 -0
  43. package/skills/pinecall-reference/references/reference/session-limits.md +119 -0
  44. package/skills/pinecall-reference/references/reference/stt-providers.md +174 -0
  45. package/skills/pinecall-reference/references/reference/tts-providers.md +149 -0
  46. package/skills/pinecall-sdk-api/SKILL.md +56 -0
  47. package/skills/pinecall-sdk-api/references/api/agent.md +328 -0
  48. package/skills/pinecall-sdk-api/references/api/call.md +324 -0
  49. package/skills/pinecall-sdk-api/references/api/pinecall.md +186 -0
  50. package/skills/pinecall-sdk-api/references/api/reply-stream.md +148 -0
  51. package/skills/pinecall-security/SKILL.md +37 -0
  52. package/skills/pinecall-security/references/security.md +138 -0
  53. package/skills/pinecall-web-chat/SKILL.md +38 -0
  54. package/skills/pinecall-web-chat/references/web/chat/chat-session.md +178 -0
  55. package/skills/pinecall-web-chat/references/web/chat/overview.md +98 -0
  56. package/skills/pinecall-web-components/SKILL.md +37 -0
  57. package/skills/pinecall-web-components/references/web/components/overview.md +128 -0
  58. package/skills/pinecall-web-voice/SKILL.md +40 -0
  59. package/skills/pinecall-web-voice/references/web/core/datachannel-protocol.md +149 -0
  60. package/skills/pinecall-web-voice/references/web/core/overview.md +70 -0
  61. package/skills/pinecall-web-voice/references/web/core/state-and-phases.md +153 -0
  62. package/skills/pinecall-web-voice/references/web/core/voice-session.md +279 -0
  63. package/skills/pinecall-web-widget/SKILL.md +41 -0
  64. package/skills/pinecall-web-widget/references/web/widget/overview.md +67 -0
  65. package/skills/pinecall-web-widget/references/web/widget/props.md +291 -0
  66. package/skills/pinecall-web-widget/references/web/widget/theming.md +131 -0
  67. package/skills/pinecall-web-widget/references/web/widget/tools-api.md +381 -0
  68. package/skills/pinecall-web-widget/references/web/widget/use-voice-session-hook.md +130 -0
@@ -0,0 +1,122 @@
1
+ ---
2
+ title: "REST API"
3
+ description: "Static helpers for the Pinecall management API. No WebSocket needed."
4
+ ---
5
+
6
+ # REST API
7
+
8
+ The SDK ships with static REST helpers for management tasks: list voices, list phone numbers, mint tokens, check Twilio balance. These don't require an active WebSocket — you can call them from any process with an API key.
9
+
10
+ ```typescript
11
+ import {
12
+ fetchVoices,
13
+ fetchPhones,
14
+ createToken,
15
+ fetchTwilioBalance,
16
+ } from "@pinecall/sdk";
17
+ ```
18
+
19
+ ## `fetchVoices(opts?)`
20
+
21
+ List available TTS voices. Filter by provider and language.
22
+
23
+ ```typescript
24
+ import { fetchVoices } from "@pinecall/sdk";
25
+
26
+ // All voices
27
+ const voices = await fetchVoices();
28
+
29
+ // Spanish Cartesia voices only
30
+ const es = await fetchVoices({ provider: "cartesia", language: "es" });
31
+
32
+ voices.forEach((v) => console.log(`${v.name} (${v.provider}/${v.alias ?? v.id})`));
33
+ // → "Sarah (elevenlabs/sarah)"
34
+ ```
35
+
36
+ **Returns:** `Voice[]` — each voice has `id`, `name`, `alias`, `provider`, `gender`, `style`, `languages[]`, `previewUrl`.
37
+
38
+ | Option | Type | Description |
39
+ |---|---|---|
40
+ | `provider` | `string` | Filter by provider name |
41
+ | `language` | `string` | Filter by language (BCP-47) |
42
+ | `apiUrl` | `string` | Custom server URL |
43
+
44
+ ## `fetchPhones(opts)`
45
+
46
+ List phone numbers on your Pinecall account.
47
+
48
+ ```typescript
49
+ const phones = await fetchPhones({ apiKey: "pk_..." });
50
+ phones.forEach((p) => console.log(`${p.name} → ${p.number}`));
51
+ // → "(318) 633-0963 → +13186330963"
52
+ ```
53
+
54
+ **Returns:** `Phone[]` — each phone has `number` (E.164), `name`, `sid`, `isSdk`.
55
+
56
+ | Option | Type | Required | Description |
57
+ |---|---|---|---|
58
+ | `apiKey` | `string` | ✅ | Your Pinecall API key |
59
+ | `apiUrl` | `string` | — | Custom server URL |
60
+
61
+ ## `createToken(opts)`
62
+
63
+ Generate a short-lived, single-use token for browser WebRTC or chat connections. **Requires API key** — call from your backend, never the browser.
64
+
65
+ ```typescript
66
+ import { createToken } from "@pinecall/sdk";
67
+
68
+ const token = await createToken({
69
+ channel: "webrtc",
70
+ agentId: "florencia",
71
+ apiKey: process.env.PINECALL_API_KEY!,
72
+ });
73
+ ```
74
+
75
+ Or via instance methods (preferred when you have a `Pinecall` or `Agent` instance):
76
+
77
+ ```typescript
78
+ const token = await pc.createToken("webrtc", "florencia");
79
+ const token = await agent.createToken("webrtc");
80
+ ```
81
+
82
+ **Returns:** `{ token: string, server: string, expiresIn: number }`.
83
+
84
+ | Option | Type | Required | Description |
85
+ |---|---|---|---|
86
+ | `channel` | `"webrtc" \| "chat" \| "stream"` | ✅ | Token type |
87
+ | `agentId` | `string` | ✅ | Agent slug |
88
+ | `apiKey` | `string` | ✅ | API key for authentication |
89
+ | `apiUrl` | `string` | — | Custom server URL |
90
+
91
+ See [Security](/security) for the full token security model.
92
+
93
+ ## `fetchTwilioBalance(opts?)`
94
+
95
+ Check your Twilio account balance.
96
+
97
+ ```typescript
98
+ const balance = await fetchTwilioBalance({ apiKey: "pk_..." });
99
+ if (balance) console.log(`$${balance.balance} ${balance.currency}`);
100
+ ```
101
+
102
+ **Returns:** `{ balance: string, currency: string } | null`.
103
+
104
+ | Option | Type | Required | Description |
105
+ |---|---|---|---|
106
+ | `apiKey` | `string` | ✅ | API key |
107
+ | `apiUrl` | `string` | — | Custom server URL |
108
+
109
+ ## Custom server URL
110
+
111
+ All helpers accept an `apiUrl` option for self-hosted or staging servers:
112
+
113
+ ```typescript
114
+ fetchVoices({ apiUrl: "http://localhost:1337" });
115
+ fetchPhones({ apiKey: "pk_...", apiUrl: "http://localhost:1337" });
116
+ ```
117
+
118
+ ## What's next
119
+
120
+ - [`Pinecall.createToken`](/api/pinecall) — instance method form
121
+ - [Security](/security) — token security model
122
+ - [TTS Providers](/reference/tts-providers) — discovering voices
@@ -0,0 +1,119 @@
1
+ ---
2
+ title: "Session Limits"
3
+ description: "Safety limits to prevent runaway sessions."
4
+ ---
5
+
6
+ # Session Limits
7
+
8
+ Calls have built-in safety limits to prevent runaway sessions: max call duration, idle timeout, warnings, and grace periods. Tune them per agent.
9
+
10
+ ## Defaults
11
+
12
+ | Setting | Default | Description |
13
+ |---|---|---|
14
+ | `max_duration_seconds` | `600` (10 min) | Hard cap on total call length |
15
+ | `idle_timeout_seconds` | `60` | Auto-hangup after this many seconds of no user speech |
16
+ | `idle_warning_seconds` | `15` | Emit `session.idleWarning` this many seconds **before** idle timeout |
17
+ | `idle_grace_seconds` | `10` | After idle timeout fires, agent gets this many seconds to prompt user before force-hangup |
18
+
19
+ ## Tuning per agent
20
+
21
+ ```typescript
22
+ const agent = pc.agent("receptionist", {
23
+ voice: "elevenlabs/sarah",
24
+ stt: "deepgram/flux-en",
25
+ llm: "openai/gpt-5-chat-latest",
26
+ prompt: "...",
27
+ sessionLimits: {
28
+ max_duration_seconds: 1800, // 30 minutes
29
+ idle_timeout_seconds: 120, // 2 minutes of silence
30
+ idle_warning_seconds: 30, // warn 30s before timeout
31
+ idle_grace_seconds: 15,
32
+ },
33
+ });
34
+ ```
35
+
36
+ ## Disabling limits
37
+
38
+ Set to `0` to disable. **Not recommended for production** — runaway sessions are a real cost risk.
39
+
40
+ ```typescript
41
+ sessionLimits: {
42
+ max_duration_seconds: 0, // 0 = unlimited
43
+ idle_timeout_seconds: 0, // 0 = disabled
44
+ }
45
+ ```
46
+
47
+ ## How it works
48
+
49
+ 1. The server starts two watchdog tasks when a call begins.
50
+ 2. The **max-duration watchdog** fires after `max_duration_seconds` — emits `session.timeout` then hangs up.
51
+ 3. The **idle watchdog** tracks user activity:
52
+ - When the user hasn't spoken for `idle_timeout_seconds - idle_warning_seconds`, emits `session.idleWarning`
53
+ - Then waits `idle_warning_seconds` for the user to speak
54
+ - If still silent at `idle_timeout_seconds`, fires `session.idleWarning` again, gives the agent `idle_grace_seconds` to prompt the user
55
+ - If still silent, emits `session.timeout` and hangs up
56
+ 4. Any user speech resets the idle timer.
57
+
58
+ ## Reacting to warnings
59
+
60
+ The `session.idleWarning` event lets you prompt the user before the timeout:
61
+
62
+ ```typescript
63
+ agent.on("session.idleWarning", (event, call) => {
64
+ // event.remainingSeconds: seconds until timeout
65
+ // event.idleTimeoutSeconds: the configured idle timeout
66
+ call.say("Are you still there?");
67
+ });
68
+
69
+ agent.on("session.timeout", (event, call) => {
70
+ // event.reason: "max_duration" | "idle_timeout"
71
+ call.say("Goodbye! The call is ending due to inactivity.");
72
+ });
73
+ ```
74
+
75
+ ## Timeline
76
+
77
+ ![Idle timeout timeline](/assets/diagrams/idle-timeline.png)
78
+
79
+ > **Important:** Bot speech (e.g. "Are you still there?") **pauses** the idle counter but does **not** reset it. Only real user speech resets the timer. This prevents infinite warning loops.
80
+
81
+ ## Widget integration
82
+
83
+ The `@pinecall/web` automatically responds to `session.idleWarning` by switching the orb to a blinking amber state (`.idle-warning` CSS class, configurable via `colorWarning` theme prop). On `session.timeout`, the widget auto-disconnects.
84
+
85
+ ## Common configs
86
+
87
+ ### Quick IVR-style flows
88
+
89
+ ```typescript
90
+ sessionLimits: {
91
+ max_duration_seconds: 180, // 3 min hard cap
92
+ idle_timeout_seconds: 20, // hang up fast on silence
93
+ idle_warning_seconds: 5,
94
+ }
95
+ ```
96
+
97
+ ### Long-form support calls
98
+
99
+ ```typescript
100
+ sessionLimits: {
101
+ max_duration_seconds: 3600, // 1 hour
102
+ idle_timeout_seconds: 180, // 3 min of silence
103
+ idle_warning_seconds: 60,
104
+ }
105
+ ```
106
+
107
+ ### Outbound campaigns
108
+
109
+ ```typescript
110
+ sessionLimits: {
111
+ max_duration_seconds: 600, // 10 min — most outbound calls end quickly
112
+ idle_timeout_seconds: 30, // hang up if callee stops engaging
113
+ }
114
+ ```
115
+
116
+ ## What's next
117
+
118
+ - [Events reference → `session.*`](/reference/events)
119
+ - [Outbound calls](/guides/outbound-calls)
@@ -0,0 +1,174 @@
1
+ ---
2
+ title: "STT Providers"
3
+ description: "Speech-to-text providers, models, and tuning parameters."
4
+ ---
5
+
6
+ # STT Providers
7
+
8
+ Pinecall supports multiple STT providers. Use the `provider/model` format or a full config object.
9
+
10
+ ## Quick reference
11
+
12
+ ```typescript
13
+ // Deepgram Flux (recommended for real-time voice)
14
+ { stt: "deepgram/flux" } // auto-selects en/multi based on language
15
+ { stt: "deepgram/flux-en" } // force English-only model
16
+ { stt: "deepgram/flux-multi" } // force multilingual model
17
+
18
+ // Deepgram Nova
19
+ { stt: "deepgram/nova-3" }
20
+ { stt: "deepgram/nova-2" }
21
+
22
+ // Gladia
23
+ { stt: "gladia/solaria" }
24
+
25
+ // AWS Transcribe
26
+ { stt: "transcribe" }
27
+ ```
28
+
29
+ ## Naming convention
30
+
31
+ Configuration objects that pass through to providers keep **snake_case** to mirror what the receiving side expects (`endpointing_ms`, `interim_results`, etc.). This avoids an unnecessary translation layer and lets you copy-paste from provider docs directly.
32
+
33
+ ## Deepgram Flux (recommended)
34
+
35
+ Best for real-time voice agents. Turn detection and VAD are **auto-derived** — no configuration needed.
36
+
37
+ ```typescript
38
+ stt: "deepgram/flux"
39
+ ```
40
+
41
+ Or with tuning:
42
+
43
+ ```typescript
44
+ stt: {
45
+ provider: "deepgram-flux",
46
+ keyterms: ["pinecall"], // boost recognition for specific terms
47
+ eot_threshold: 0.5, // end-of-turn sensitivity (0-1)
48
+ eager_eot_threshold: 0.7, // eager turn threshold
49
+ eot_timeout_ms: 2000,
50
+ }
51
+ ```
52
+
53
+ > **Auto-derived:** Flux → native turn detection + native VAD. No need to specify `turnDetection`.
54
+
55
+ > **Language auto-select:** `"deepgram/flux"` picks `flux-general-en` when `language: "en"` and `flux-general-multi` otherwise. Use `"deepgram/flux-en"` or `"deepgram/flux-multi"` to force a specific model.
56
+
57
+ ## Deepgram Nova
58
+
59
+ Classic STT. Turn detection and VAD auto-derived (smart_turn + silero).
60
+
61
+ ```typescript
62
+ stt: "deepgram/nova-3"
63
+ ```
64
+
65
+ Or with tuning:
66
+
67
+ ```typescript
68
+ stt: {
69
+ provider: "deepgram",
70
+ model: "nova-3",
71
+ language: "en",
72
+ interim_results: true,
73
+ smart_format: true,
74
+ punctuate: true,
75
+ profanity_filter: false,
76
+ endpointing_ms: 300,
77
+ utterance_end_ms: 1000,
78
+ keywords: ["pinecall"],
79
+ }
80
+ ```
81
+
82
+ ## Gladia
83
+
84
+ ```typescript
85
+ stt: "gladia/solaria"
86
+ ```
87
+
88
+ Or with tuning:
89
+
90
+ ```typescript
91
+ stt: {
92
+ provider: "gladia",
93
+ model: "solaria-1",
94
+ language: "en",
95
+ endpointing: 300,
96
+ speech_threshold: 0.8,
97
+ code_switching: false,
98
+ audio_enhancer: true,
99
+ }
100
+ ```
101
+
102
+ ## AWS Transcribe
103
+
104
+ ```typescript
105
+ stt: {
106
+ provider: "transcribe",
107
+ language: "en-US",
108
+ }
109
+ ```
110
+
111
+ ## Which to choose
112
+
113
+ | Provider | Best for | Trade-off |
114
+ |---|---|---|
115
+ | `deepgram/flux` | Real-time voice agents | Lowest latency; English, Spanish, French, German, Portuguese, and ~15 more |
116
+ | `deepgram/nova-3` | Arabic, Hindi, Thai, CJK, and 60+ languages | Slightly higher latency; smart_turn + silero VAD |
117
+ | `gladia/solaria` | Code-switching, multilingual | Higher latency than Deepgram |
118
+ | `transcribe` | AWS-native deployments | AWS pricing model |
119
+
120
+ For most agents, start with `deepgram/flux`. Use `deepgram/nova-3` for languages Flux doesn't cover (Arabic, Hindi, Thai, Chinese, Japanese, Korean, etc.).
121
+
122
+ ## Language coverage
123
+
124
+ **Deepgram Flux** supports ~20 languages including: English, Spanish, French, German, Portuguese, Italian, Dutch, Russian, Ukrainian, Turkish, Polish, Swedish, Norwegian, Danish, Finnish, Indonesian, Malay, Korean, Japanese, Chinese (Mandarin).
125
+
126
+ **Deepgram Nova-3** supports 60+ languages including everything Flux covers plus: Arabic, Hindi, Urdu, Bengali, Thai, Vietnamese, Hebrew, Farsi, Swahili, Tamil, Telugu, and many more.
127
+
128
+ > **Rule of thumb:** If your language works with Flux, use Flux — it's faster and has native turn detection. If not, use Nova-3.
129
+
130
+ ### Multi-language agents with `phoneNumbers`
131
+
132
+ When you have different phone numbers per language/region, set per-number STT overrides. The server auto-derives turn detection and VAD from the STT provider:
133
+
134
+ | STT Provider | Turn Detection | VAD |
135
+ |---|---|---|
136
+ | `deepgram/flux` | Native (built-in) | Native (built-in) |
137
+ | `deepgram/nova-3` | Smart turn | Silero |
138
+ | `gladia/solaria` | Smart turn | Silero |
139
+
140
+ ```typescript
141
+ const agent = pc.agent("global-support", {
142
+ prompt: "You are a multilingual support agent.",
143
+ llm: "openai/gpt-5-chat-latest",
144
+ phoneNumbers: [
145
+ // English — Flux (fastest, native turn detection)
146
+ { number: "+14155551234", language: "en", voice: "elevenlabs/sarah", stt: "deepgram/flux" },
147
+ // Spanish — Flux multilingual
148
+ { number: "+34612345678", language: "es", voice: "elevenlabs/valentina", stt: "deepgram/flux" },
149
+ // Arabic — Nova-3 (Flux doesn't support Arabic)
150
+ { number: "+972501234567", language: "ar", voice: "elevenlabs/ahmad", stt: "deepgram/nova-3" },
151
+ ],
152
+ });
153
+ ```
154
+
155
+ No need to configure turn detection or VAD manually — the server auto-derives them from the STT provider.
156
+
157
+ ## Hot-reloading STT
158
+
159
+ You can swap STT providers at runtime:
160
+
161
+ ```typescript
162
+ // Agent-wide (all future calls)
163
+ agent.update({ stt: "gladia/solaria" });
164
+
165
+ // One call only
166
+ call.update({ stt: "deepgram/nova-3" });
167
+ ```
168
+
169
+ ## What's next
170
+
171
+ - [Turn Detection](/concepts/turn-detection) — how Flux native vs SmartTurn + Silero work
172
+ - [TTS Providers](/reference/tts-providers)
173
+ - [LLM Providers](/reference/llm-providers)
174
+ - [`Agent.configure`](/api/agent)
@@ -0,0 +1,149 @@
1
+ ---
2
+ title: "TTS Providers"
3
+ description: "Text-to-speech providers, voices, and tuning parameters."
4
+ ---
5
+
6
+ # TTS Providers
7
+
8
+ Pinecall supports multiple TTS providers. Use the `provider/friendly-id` format (always lowercase) to specify a voice:
9
+
10
+ ## Voice format
11
+
12
+ ```typescript
13
+ // Recommended: friendly alias (always lowercase)
14
+ { voice: "elevenlabs/sarah" }
15
+ { voice: "cartesia/yumiko" }
16
+ { voice: "polly/lucia" }
17
+
18
+ // Full config object (for tuning parameters)
19
+ { voice: { provider: "elevenlabs", voice_id: "...", speed: 1.1 } }
20
+ ```
21
+
22
+ > The legacy `provider:rawId` format (e.g. `"elevenlabs:EXAVITQu4vr4xnSDxMaL"`) still works but is not recommended.
23
+
24
+ ## Discovering voices
25
+
26
+ Use the CLI to browse voices. Without flags, you get a catalog overview:
27
+
28
+ ```bash
29
+ # Overview — shows providers, voice counts, languages
30
+ pinecall voices
31
+
32
+ # List voices for a provider + language
33
+ pinecall voices --provider=elevenlabs --language=es
34
+
35
+ # Preview a voice (plays audio in your terminal)
36
+ pinecall voices play elevenlabs/sarah
37
+ ```
38
+
39
+ Every voice gets a friendly alias auto-generated from its name — use it directly in your config:
40
+
41
+ ```typescript
42
+ { voice: "elevenlabs/sarah" } // → Sarah - Mature, Reassuring
43
+ { voice: "elevenlabs/agustin" } // → Agustin - Conversational & Relaxed
44
+ ```
45
+
46
+ Or use the [`fetchVoices`](/reference/rest-api) REST helper:
47
+
48
+ ```typescript
49
+ import { fetchVoices } from "@pinecall/sdk";
50
+
51
+ const voices = await fetchVoices({ provider: "elevenlabs", language: "es" });
52
+ voices.forEach((v) => console.log(`${v.name} → ${v.provider}/${v.alias ?? v.id}`));
53
+ ```
54
+
55
+ ## ElevenLabs
56
+
57
+ ```typescript
58
+ voice: {
59
+ provider: "elevenlabs",
60
+ voice_id: "JBFqnCBsd6RMkjVDRZzb",
61
+ speed: 1.0,
62
+ stability: 0.5,
63
+ similarity_boost: 0.75,
64
+ style: 0,
65
+ use_speaker_boost: true,
66
+ }
67
+ ```
68
+
69
+ Shortcut: `"elevenlabs/sarah"`
70
+
71
+ The server defaults to `eleven_flash_v2_5` (the fastest model, optimized for real-time streaming). Override it with the optional `model` field (e.g. `model: "eleven_turbo_v2_5"`).
72
+
73
+ **Tuning notes:**
74
+
75
+ - `stability` higher = more consistent, less expressive
76
+ - `similarity_boost` higher = closer to the cloned voice
77
+ - `style` 0–1, adds expressiveness (slight latency cost)
78
+
79
+ ## Cartesia
80
+
81
+ ```typescript
82
+ voice: {
83
+ provider: "cartesia",
84
+ voice_id: "a0e99841-438c-4a64-b679-ae501e7d6091",
85
+ model: "sonic-3",
86
+ speed: 1.0,
87
+ volume: 1.0,
88
+ emotion: null,
89
+ language: "en",
90
+ }
91
+ ```
92
+
93
+ Shortcut: `"cartesia/yumiko"`
94
+
95
+ **Tuning notes:**
96
+
97
+ - `model: "sonic-3"` — fastest Cartesia model, designed for streaming
98
+ - `emotion` accepts named emotion presets (check Cartesia docs for the current list)
99
+
100
+ ## AWS Polly
101
+
102
+ ```typescript
103
+ voice: {
104
+ provider: "polly",
105
+ voice_id: "Joanna",
106
+ engine: "neural",
107
+ language: "en-US",
108
+ }
109
+ ```
110
+
111
+ Shortcut: `"polly/joanna"`
112
+
113
+ **Tuning notes:**
114
+
115
+ - `engine: "neural"` is required for natural-sounding output. The older `standard` engine is robotic.
116
+ - Polly is the cheapest option but the least natural — fine for IVR-style flows, not for engaging conversation.
117
+
118
+ ## Which to choose
119
+
120
+ | Provider | Best for | Trade-off |
121
+ |---|---|---|
122
+ | **ElevenLabs** | Most natural-sounding output | Higher cost per character |
123
+ | **Cartesia** | Real-time streaming, low latency | Smaller voice library |
124
+ | **Polly** | Cheap IVR, simple flows | Less natural |
125
+
126
+ For most agents, start with ElevenLabs (`eleven_flash_v2_5`) or Cartesia (`sonic-3`). Use Polly only for high-volume, low-engagement flows.
127
+
128
+ ## Hot-reloading voices
129
+
130
+ Voice can change at any time:
131
+
132
+ ```typescript
133
+ // Agent-wide
134
+ agent.update({ voice: "cartesia/blake" });
135
+
136
+ // One call only
137
+ call.update({ voice: "elevenlabs/daniel" });
138
+
139
+ // Per-channel override
140
+ agent.addPhoneNumber("+34911234567", {
141
+ voice: "elevenlabs/valentina",
142
+ });
143
+ ```
144
+
145
+ ## What's next
146
+
147
+ - [STT Providers](/reference/stt-providers)
148
+ - [REST API → fetchVoices](/reference/rest-api)
149
+ - [`Agent.configure`](/api/agent)
@@ -0,0 +1,56 @@
1
+ ---
2
+ name: pinecall-sdk-api
3
+ description: >-
4
+ @pinecall/sdk API reference — Pinecall, Agent, Call, ReplyStream. Use when the user is building, configuring, or debugging with @pinecall/sdk. Keywords: api, pc.agent, agent.dial, call object, reply stream, replyStream, server sdk surface.
5
+ license: MIT
6
+ ---
7
+
8
+ # @pinecall/sdk (Node.js)
9
+
10
+ @pinecall/sdk API reference — Pinecall, Agent, Call, ReplyStream.
11
+
12
+ This skill bundles the official Pinecall documentation for **@pinecall/sdk (Node.js)**. The
13
+ table below indexes every page; open the `references/…` file for the full text
14
+ (loaded on demand). Source of truth: <https://docs.pinecall.io>.
15
+
16
+ | Page | What it covers | Open |
17
+ |------|----------------|------|
18
+ | **Pinecall** | The WebSocket client. Manages auth, reconnection, and agent multiplexing. | [`references/api/pinecall.md`](references/api/pinecall.md) · [docs](https://docs.pinecall.io/api/pinecall) |
19
+ | **Agent** | Owns channels, routes call events, stores defaults, dials outbound calls. | [`references/api/agent.md`](references/api/agent.md) · [docs](https://docs.pinecall.io/api/agent) |
20
+ | **Call** | Per-session handle. Speak, control, update, read state. | [`references/api/call.md`](references/api/call.md) · [docs](https://docs.pinecall.io/api/call) |
21
+ | **ReplyStream** | Token-by-token streaming for client-side LLM responses. | [`references/api/reply-stream.md`](references/api/reply-stream.md) · [docs](https://docs.pinecall.io/api/reply-stream) |
22
+
23
+ ## Canonical agent
24
+
25
+ ```typescript
26
+ import { Pinecall } from "@pinecall/sdk";
27
+
28
+ const pc = new Pinecall(); // reads PINECALL_API_KEY, auto-connects
29
+
30
+ const agent = pc.agent("mara", {
31
+ prompt: "You are Mara, a friendly voice assistant. Be concise.",
32
+ llm: "openai/gpt-5-chat-latest",
33
+ voice: "elevenlabs/sarah",
34
+ stt: "deepgram/flux",
35
+ language: "en",
36
+ greeting: "Hello! How can I help?",
37
+ });
38
+ ```
39
+
40
+ ## House rules — always apply
41
+
42
+ - **Example defaults** (use these exact strings unless the user asks otherwise):
43
+ `stt: "deepgram/flux"`, `llm: "openai/gpt-5-chat-latest"`, `voice: "elevenlabs/sarah"`.
44
+ **NEVER use `deepgram/nova-2`** — it is not supported. Use `deepgram/nova-3`
45
+ only for languages Flux doesn't support (e.g. Arabic).
46
+ - **Turn detection & VAD are auto-derived from the STT provider — never set
47
+ `turnDetection` or `vad` manually.** Flux → native turns + native VAD;
48
+ every other STT → `smart_turn` + `silero`.
49
+ - **Greeting**: inbound → `greeting` field in `pc.agent()`; outbound → `greeting`
50
+ field in `agent.dial()`. It is sugar for `call.say()` in `call.started`.
51
+ - **Auth**: `new Pinecall()` reads `PINECALL_API_KEY` from env and auto-connects.
52
+ - Full documentation: <https://docs.pinecall.io>
53
+
54
+ ---
55
+ *Generated from `sdk/docs/` by `@pinecall/skills` — do not edit by hand; edit the
56
+ docs and re-run `node build.mjs`.*