@spekoai/sdk 0.4.1 → 0.4.3

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 (35) hide show
  1. package/CHANGELOG.md +54 -0
  2. package/README.md +31 -0
  3. package/dist/index.d.ts +1 -1
  4. package/dist/index.d.ts.map +1 -1
  5. package/dist/lib/client.d.ts +6 -0
  6. package/dist/lib/client.d.ts.map +1 -1
  7. package/dist/lib/client.js +10 -1
  8. package/dist/lib/http.d.ts +1 -0
  9. package/dist/lib/http.d.ts.map +1 -1
  10. package/dist/lib/http.js +4 -1
  11. package/dist/lib/resources/agents.d.ts +27 -10
  12. package/dist/lib/resources/agents.d.ts.map +1 -1
  13. package/dist/lib/resources/agents.js +58 -14
  14. package/dist/lib/resources/callbacks.d.ts +13 -0
  15. package/dist/lib/resources/callbacks.d.ts.map +1 -0
  16. package/dist/lib/resources/callbacks.js +26 -0
  17. package/dist/lib/resources/calls.d.ts +18 -0
  18. package/dist/lib/resources/calls.d.ts.map +1 -0
  19. package/dist/lib/resources/calls.js +33 -0
  20. package/dist/lib/resources/complete.d.ts.map +1 -1
  21. package/dist/lib/resources/complete.js +4 -1
  22. package/dist/lib/resources/phone-numbers.d.ts +20 -6
  23. package/dist/lib/resources/phone-numbers.d.ts.map +1 -1
  24. package/dist/lib/resources/phone-numbers.js +27 -5
  25. package/dist/lib/resources/synthesize.d.ts.map +1 -1
  26. package/dist/lib/resources/synthesize.js +2 -0
  27. package/dist/lib/resources/voice.d.ts +3 -4
  28. package/dist/lib/resources/voice.d.ts.map +1 -1
  29. package/dist/lib/resources/voice.js +3 -4
  30. package/dist/lib/resources/voices.d.ts +27 -0
  31. package/dist/lib/resources/voices.d.ts.map +1 -0
  32. package/dist/lib/resources/voices.js +32 -0
  33. package/dist/lib/types/index.d.ts +542 -17
  34. package/dist/lib/types/index.d.ts.map +1 -1
  35. package/package.json +17 -3
@@ -1,8 +1,8 @@
1
1
  /**
2
- * Phone numbers Speko has provisioned (or imported) on Telnyx for your
3
- * organization. Each number can be used for outbound dialing and/or
4
- * inbound, and carries an optional metadata template that's merged into
5
- * the worker dispatch payload when the number is used.
2
+ * Phone numbers Speko has provisioned as managed numbers or registered
3
+ * from your own SIP trunk. Each number can be used for outbound dialing
4
+ * and/or inbound, and carries an optional metadata template that's
5
+ * merged into the worker dispatch payload when the number is used.
6
6
  *
7
7
  * @example
8
8
  * ```ts
@@ -30,7 +30,7 @@ export class PhoneNumbers {
30
30
  return this.http.get('/v1/phone-numbers');
31
31
  }
32
32
  /**
33
- * Search Telnyx's pool for orderable US numbers. Filter by area code
33
+ * Search the platform-managed pool for orderable US numbers. Filter by area code
34
34
  * and/or locality. Results include cost so you can preview "$1 upfront +
35
35
  * $1/month" before committing to {@link create}.
36
36
  *
@@ -57,10 +57,32 @@ export class PhoneNumbers {
57
57
  create(params) {
58
58
  return this.http.post('/v1/phone-numbers', params);
59
59
  }
60
+ importSipTrunk(params) {
61
+ return this.http.post('/v1/phone-numbers/import', params);
62
+ }
60
63
  update(id, params) {
61
64
  return this.http.patch(`/v1/phone-numbers/${encodeURIComponent(id)}`, params);
62
65
  }
63
66
  delete(id) {
64
67
  return this.http.delete(`/v1/phone-numbers/${encodeURIComponent(id)}`);
65
68
  }
69
+ /**
70
+ * Read business verification state used to gate managed phone-number purchases.
71
+ * Includes the latest submission plus any SMS 10DLC-derived prefill.
72
+ */
73
+ getKyb() {
74
+ return this.http.get('/v1/phone-numbers/kyb');
75
+ }
76
+ /**
77
+ * Save a draft business verification submission without sending it for review.
78
+ */
79
+ saveKybDraft(params) {
80
+ return this.http.put('/v1/phone-numbers/kyb/draft', params);
81
+ }
82
+ /**
83
+ * Submit business verification for review. `attestationAccepted` must be `true`.
84
+ */
85
+ submitKyb(params) {
86
+ return this.http.post('/v1/phone-numbers/kyb/submit', params);
87
+ }
66
88
  }
@@ -1 +1 @@
1
- {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/synthesize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;OAeG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,CAAC;IAiBtB,MAAM,CACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,sBAAsB,CAAC;CAgCnC"}
1
+ {"version":3,"file":"synthesize.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/synthesize.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,UAAU;IACT,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;;;;;OAeG;IACG,IAAI,CACR,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,gBAAgB,CAAC;IAiBtB,MAAM,CACV,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,iBAAiB,EAC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,sBAAsB,CAAC;CAiCnC"}
@@ -43,6 +43,8 @@ export class Synthesize {
43
43
  const body = { text, intent };
44
44
  if (options.voice !== undefined)
45
45
  body['voice'] = options.voice;
46
+ if (options.model !== undefined)
47
+ body['model'] = options.model;
46
48
  if (options.speed !== undefined)
47
49
  body['speed'] = options.speed;
48
50
  if (options.constraints !== undefined)
@@ -1,7 +1,7 @@
1
1
  import type { HttpClient } from '../http.js';
2
2
  import type { VoiceDialParams, VoiceDialResult } from '../types/index.js';
3
3
  /**
4
- * Outbound phone calls via Speko's Telnyx-backed gateway.
4
+ * Outbound phone calls via Speko's managed telephony gateway.
5
5
  *
6
6
  * @example
7
7
  * ```ts
@@ -19,10 +19,9 @@ export declare class Voice {
19
19
  /**
20
20
  * Place an outbound call. The destination's phone rings; once they pick
21
21
  * up, audio bridges to a Speko worker running the configured pipeline
22
- * (STT→LLM→TTS) on a LiveKit room.
22
+ * (STT→LLM→TTS) on the media transport.
23
23
  *
24
- * Lifecycle is observable via Telnyx webhooks (which Speko handles
25
- * server-side) and reflected in the `voice_session` row's `status`.
24
+ * Lifecycle is reflected in the `voice_session` row's `status`.
26
25
  */
27
26
  dial(params: VoiceDialParams): Promise<VoiceDialResult>;
28
27
  }
@@ -1 +1 @@
1
- {"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/voice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;OAOG;IACG,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAG9D"}
1
+ {"version":3,"file":"voice.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/voice.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAE1E;;;;;;;;;;;;GAYG;AACH,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;OAMG;IACG,IAAI,CAAC,MAAM,EAAE,eAAe,GAAG,OAAO,CAAC,eAAe,CAAC;CAG9D"}
@@ -1,5 +1,5 @@
1
1
  /**
2
- * Outbound phone calls via Speko's Telnyx-backed gateway.
2
+ * Outbound phone calls via Speko's managed telephony gateway.
3
3
  *
4
4
  * @example
5
5
  * ```ts
@@ -19,10 +19,9 @@ export class Voice {
19
19
  /**
20
20
  * Place an outbound call. The destination's phone rings; once they pick
21
21
  * up, audio bridges to a Speko worker running the configured pipeline
22
- * (STT→LLM→TTS) on a LiveKit room.
22
+ * (STT→LLM→TTS) on the media transport.
23
23
  *
24
- * Lifecycle is observable via Telnyx webhooks (which Speko handles
25
- * server-side) and reflected in the `voice_session` row's `status`.
24
+ * Lifecycle is reflected in the `voice_session` row's `status`.
26
25
  */
27
26
  async dial(params) {
28
27
  return this.http.post('/v1/sessions/phone', params);
@@ -0,0 +1,27 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { VoicesListParams, VoicesListResult } from '../types/index.js';
3
+ /**
4
+ * Read-only TTS voice catalog. Use this to browse the curated list of
5
+ * voices per provider before calling `speko.synthesize` — handy for
6
+ * picking a voice id without reading each provider's API docs.
7
+ *
8
+ * ElevenLabs voices are account-scoped and are NOT returned by this
9
+ * endpoint; the response's `providers` array sets
10
+ * `voicesFetchedLive: true` on the elevenlabs entry as a signal to
11
+ * fetch them directly from ElevenLabs at runtime.
12
+ *
13
+ * @example
14
+ * ```ts
15
+ * // All voices, every provider:
16
+ * const { voices, providers } = await speko.voices.list();
17
+ *
18
+ * // Just Cartesia:
19
+ * const cartesia = await speko.voices.list({ provider: 'cartesia' });
20
+ * ```
21
+ */
22
+ export declare class Voices {
23
+ private readonly http;
24
+ constructor(http: HttpClient);
25
+ list(params?: VoicesListParams): Promise<VoicesListResult>;
26
+ }
27
+ //# sourceMappingURL=voices.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voices.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/voices.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AAE5E;;;;;;;;;;;;;;;;;;GAkBG;AACH,qBAAa,MAAM;IACL,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAEvC,IAAI,CAAC,MAAM,CAAC,EAAE,gBAAgB,GAAG,OAAO,CAAC,gBAAgB,CAAC;CAMjE"}
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Read-only TTS voice catalog. Use this to browse the curated list of
3
+ * voices per provider before calling `speko.synthesize` — handy for
4
+ * picking a voice id without reading each provider's API docs.
5
+ *
6
+ * ElevenLabs voices are account-scoped and are NOT returned by this
7
+ * endpoint; the response's `providers` array sets
8
+ * `voicesFetchedLive: true` on the elevenlabs entry as a signal to
9
+ * fetch them directly from ElevenLabs at runtime.
10
+ *
11
+ * @example
12
+ * ```ts
13
+ * // All voices, every provider:
14
+ * const { voices, providers } = await speko.voices.list();
15
+ *
16
+ * // Just Cartesia:
17
+ * const cartesia = await speko.voices.list({ provider: 'cartesia' });
18
+ * ```
19
+ */
20
+ export class Voices {
21
+ http;
22
+ constructor(http) {
23
+ this.http = http;
24
+ }
25
+ async list(params) {
26
+ const query = new URLSearchParams();
27
+ if (params?.provider)
28
+ query.set('provider', params.provider);
29
+ const qs = query.toString();
30
+ return this.http.get(`/v1/voices${qs ? `?${qs}` : ''}`);
31
+ }
32
+ }