@spekoai/sdk 0.4.1 → 0.4.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.
Files changed (35) hide show
  1. package/CHANGELOG.md +28 -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 +1 -1
package/CHANGELOG.md CHANGED
@@ -33,6 +33,34 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
33
33
 
34
34
  ## [Unreleased]
35
35
 
36
+ ### Added
37
+
38
+ - `speko.agents.tools.listChatTools(agentId)` — fetches an agent's registered
39
+ tools and converts them into the `ChatTool[]` shape `complete()` accepts.
40
+ Covers all four source kinds (`inline`, `webhook`, `builtin`, `integration`),
41
+ so the result can be passed straight to `speko.complete({ tools })`.
42
+ - `baseURL` is now accepted as an alias for `baseUrl` on the client constructor.
43
+ If both are set, `baseUrl` wins.
44
+ - Agent tool methods (`speko.agents.tools.*`) accept an optional trailing
45
+ `AbortSignal` to cancel the in-flight request.
46
+ - `integration` tool source support: new `AgentToolSourceIntegration` type, added
47
+ to `AgentToolSourceCreate` and `AgentToolSourceSerialized`. Binds a tool to an
48
+ org-installed Speko app action (e.g. Google Calendar, Slack).
49
+ - `AgentToolSourceWebhookUpdate` / `AgentToolSourceUpdate` types: webhook updates
50
+ may now omit `secret` to keep the existing encrypted secret (only supply it to
51
+ rotate). `AgentToolUpdateParams.source` uses the new update union.
52
+ - Telephony SDK parity: `phoneNumbers.getKyb/saveKybDraft/submitKyb`,
53
+ `calls.recording`, and `agents.listCalls`, plus public types for KYB,
54
+ call recordings, report finalization, SMS assignment fields, and agent call
55
+ pages.
56
+
57
+ ### Changed
58
+
59
+ - `PhoneNumberRow.source` now reflects the public API values
60
+ (`managed | sip_trunk`), `PhoneNumberUpdateParams` accepts `null` for clearable
61
+ fields, and `PhoneNumberImportSipTrunkParams` supports both productized SIP
62
+ connection imports and the legacy `sipTrunkId` path.
63
+
36
64
  ## [0.2.1] - 2026-04-26
37
65
 
38
66
  ### Added
package/README.md CHANGED
@@ -45,6 +45,37 @@ const { text: reply } = await speko.complete({
45
45
  // speko.transcribeStream(...), speko.synthesizeStream(...), speko.completeStream(...)
46
46
  ```
47
47
 
48
+ > The client accepts `baseURL` as an alias for `baseUrl` — e.g.
49
+ > `new Speko({ apiKey, baseURL: process.env.SPEKO_BASE_URL })`. If both are set,
50
+ > `baseUrl` wins.
51
+
52
+ ## Registered tools
53
+
54
+ Tools registered against an agent (via `speko.agents.tools.create(...)` or the
55
+ dashboard) can be loaded and handed straight to `complete()`.
56
+ `listChatTools(agentId)` fetches the agent's tools and converts every source
57
+ kind — `inline`, `webhook`, `builtin`, and `integration` — into the
58
+ `ChatTool[]` shape `complete()` expects:
59
+
60
+ ```ts
61
+ const speko = new Speko({
62
+ apiKey: process.env.SPEKO_API_KEY,
63
+ baseURL: process.env.SPEKO_BASE_URL,
64
+ });
65
+
66
+ // Fetch once, then pass straight to complete()
67
+ const tools = await speko.agents.tools.listChatTools(agentId);
68
+
69
+ const { text, toolCalls } = await speko.complete({
70
+ messages: [{ role: 'user', content: 'Book me a slot tomorrow at 3pm' }],
71
+ intent: { language: 'en' },
72
+ tools,
73
+ });
74
+ ```
75
+
76
+ Webhook, builtin, and integration tools run server-side and are folded back into
77
+ the response; inline tools come back to you as `toolCalls` to execute yourself.
78
+
48
79
  ## Documentation
49
80
 
50
81
  Full API reference and guides: <https://docs.speko.dev>
package/dist/index.d.ts CHANGED
@@ -1,4 +1,4 @@
1
1
  export { Speko } from './lib/client.js';
2
2
  export { SpekoApiError, SpekoAuthError, SpekoRateLimitError } from './lib/errors.js';
3
- export type { AgentCreateParams, AgentIntent, AgentLlmOptions, AgentRow, AgentStackPreferences, AgentSttOptions, AgentToolCreateParams, AgentToolRow, AgentToolSourceBuiltin, AgentToolSourceCreate, AgentToolSourceInline, AgentToolSourceSerialized, AgentToolSourceWebhookCreate, AgentToolSourceWebhookSerialized, AgentToolUpdateParams, AgentUpdateParams, AvailablePhoneNumber, ChatMessage, ChatTool, ChatToolCall, ChatToolChoice, ChatToolExecutionMode, ChatToolSource, CompleteParams, CompleteResult, CompleteStreamEvent, CreditLedgerEntry, CreditLedgerKind, CreditLedgerPage, CreditLedgerQueryParams, KeySource, KnowledgeBaseCreateParams, KnowledgeBaseDocumentCreateParams, KnowledgeBaseDocumentCreateResult, KnowledgeBaseDocumentPollOptions, KnowledgeBaseDocumentRow, KnowledgeBaseDocumentStatus, KnowledgeBaseDocumentUploadParams, KnowledgeBaseDocumentUploadSpec, KnowledgeBaseListParams, KnowledgeBaseRow, OptimizeFor, OrganizationBalance, PhoneNumberCreateParams, PhoneNumberDirection, PhoneNumberRow, PhoneNumberSearchParams, PhoneNumberUpdateParams, PipelineConstraints, RealtimeConnectParams, RealtimeEventHandler, RealtimeFrame, RealtimeProvider, RealtimeSessionHandle, RealtimeToolSpec, RoutingIntent, SpekoClientOptions, SynthesizeOptions, SynthesizeResult, SynthesizeStreamResult, TranscribeOptions, TranscribeResult, TranscribeStreamEvent, UsageByProvider, UsageQueryParams, UsageSummary, VoiceDialParams, VoiceDialResult, } from './lib/types/index.js';
3
+ export type { AgentAmbientClip, AgentBackgroundAudio, AgentCallListEntry, AgentCallListPage, AgentCallListParams, AgentCreateParams, AgentIntent, AgentLifecycleWebhookCreate, AgentLifecycleWebhookSerialized, AgentLifecycleWebhookUpdate, AgentLlmOptions, AgentRow, AgentStackPreferences, AgentSttOptions, AgentToolCreateParams, AgentToolRow, AgentToolSourceBuiltin, AgentToolSourceCreate, AgentToolSourceInline, AgentToolSourceIntegration, AgentToolSourceSerialized, AgentToolSourceUpdate, AgentToolSourceWebhookCreate, AgentToolSourceWebhookSerialized, AgentToolSourceWebhookUpdate, AgentToolUpdateParams, AgentUpdateParams, AgentWebhooksCreate, AgentWebhooksSerialized, AgentWebhooksUpdate, AvailablePhoneNumber, BlindTransferParams, CallCostLine, CallDetail, CallEvent, CallRecording, CallReport, CallTranscriptEntry, CallTransfer, CallTransferResponse, CancelScheduledCallbackParams, CancelWarmTransferParams, ChatMessage, ChatTool, ChatToolCall, ChatToolChoice, ChatToolExecutionMode, ChatToolSource, CompleteParams, CompleteResult, CompleteStreamEvent, CompleteWarmTransferParams, CreditLedgerEntry, CreditLedgerKind, CreditLedgerPage, CreditLedgerQueryParams, FinalizeCallReportParams, FinalizeCallReportResult, KeySource, KnowledgeBaseCreateParams, KnowledgeBaseDocumentCreateParams, KnowledgeBaseDocumentCreateResult, KnowledgeBaseDocumentPollOptions, KnowledgeBaseDocumentRow, KnowledgeBaseDocumentStatus, KnowledgeBaseDocumentUploadParams, KnowledgeBaseDocumentUploadSpec, KnowledgeBaseListParams, KnowledgeBaseRow, OptimizeFor, OrganizationBalance, PhoneNumberCreateParams, PhoneNumberDirection, PhoneNumberImportSipTrunkParams, PhoneNumberKybAuthorizedRepresentative, PhoneNumberKybBusinessProfile, PhoneNumberKybDraftParams, PhoneNumberKybOverview, PhoneNumberKybSlackNotificationStatus, PhoneNumberKybStatus, PhoneNumberKybSubmission, PhoneNumberKybSubmissionStatus, PhoneNumberKybSubmitParams, PhoneNumberRow, PhoneNumberSearchParams, PhoneNumberSetupStatus, PhoneNumberSmsAssignmentStatus, PhoneNumberSource, PhoneNumberUpdateParams, PipelineConstraints, RealtimeConnectParams, RealtimeEventHandler, RealtimeFrame, RealtimeProvider, RealtimeSessionHandle, RealtimeToolSpec, RoutingIntent, ScheduledCallback, ScheduledCallbackStatus, ScheduledCallbacksListParams, SpekoClientOptions, SynthesizeOptions, SynthesizeResult, SynthesizeStreamResult, TranscribeOptions, TranscribeResult, TranscribeStreamEvent, UsageByProvider, UsageQueryParams, UsageSummary, VoiceCatalogEntry, VoiceDialParams, VoiceDialResult, VoicesListParams, VoicesListResult, VoicesProviderEntry, WarmTransferDestination, WarmTransferFallback, WarmTransferFallbackResult, WarmTransferParams, WarmTransferVoicemailDetection, } from './lib/types/index.js';
4
4
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrF,YAAY,EACV,iBAAiB,EACjB,WAAW,EACX,eAAe,EACf,QAAQ,EACR,qBAAqB,EACrB,eAAe,EACf,qBAAqB,EACrB,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,yBAAyB,EACzB,4BAA4B,EAC5B,gCAAgC,EAChC,qBAAqB,EACrB,iBAAiB,EACjB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,YAAY,EACZ,cAAc,EACd,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,SAAS,EACT,yBAAyB,EACzB,iCAAiC,EACjC,iCAAiC,EACjC,gCAAgC,EAChC,wBAAwB,EACxB,2BAA2B,EAC3B,iCAAiC,EACjC,+BAA+B,EAC/B,uBAAuB,EACvB,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACvB,mBAAmB,EACnB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,gBAAgB,EAChB,qBAAqB,EACrB,gBAAgB,EAChB,aAAa,EACb,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,eAAe,GAChB,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,iBAAiB,CAAC;AACrF,YAAY,EACV,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,EAClB,iBAAiB,EACjB,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,2BAA2B,EAC3B,+BAA+B,E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B,uBAAuB,EACvB,4BAA4B,EAC5B,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,sBAAsB,EACtB,iBAAiB,EACjB,gBAAgB,EAChB,qBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,iBAAiB,EACjB,eAAe,EACf,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,mBAAmB,EACnB,uBAAuB,EACvB,oBAAoB,EACpB,0BAA0B,EAC1B,kBAAkB,EAClB,8BAA8B,GAC/B,MAAM,sBAAsB,CAAC"}
@@ -1,10 +1,13 @@
1
1
  import { Agents } from './resources/agents.js';
2
+ import { Callbacks } from './resources/callbacks.js';
3
+ import { Calls } from './resources/calls.js';
2
4
  import { Credits } from './resources/credits.js';
3
5
  import { KnowledgeBases } from './resources/knowledge-bases.js';
4
6
  import { PhoneNumbers } from './resources/phone-numbers.js';
5
7
  import { Realtime } from './resources/realtime.js';
6
8
  import { Usage } from './resources/usage.js';
7
9
  import { Voice } from './resources/voice.js';
10
+ import { Voices } from './resources/voices.js';
8
11
  import type { CompleteParams, CompleteResult, CompleteStreamEvent, SpekoClientOptions, SynthesizeOptions, SynthesizeResult, SynthesizeStreamResult, TranscribeOptions, TranscribeResult, TranscribeStreamEvent } from './types/index.js';
9
12
  /**
10
13
  * Speko client — one API, every voice provider.
@@ -25,9 +28,12 @@ export declare class Speko {
25
28
  readonly credits: Credits;
26
29
  readonly realtime: Realtime;
27
30
  readonly voice: Voice;
31
+ readonly voices: Voices;
28
32
  readonly phoneNumbers: PhoneNumbers;
29
33
  readonly agents: Agents;
30
34
  readonly knowledgeBases: KnowledgeBases;
35
+ readonly calls: Calls;
36
+ readonly callbacks: Callbacks;
31
37
  private readonly transcribeResource;
32
38
  private readonly synthesizeResource;
33
39
  private readonly completeResource;
@@ -1 +1 @@
1
- {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/lib/client.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,M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AC1B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,sBAAsB,CAAC;IAIlC;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAIpF,cAAc,CACZ,MAAM,EAAE,cAAc,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,qBAAqB,CAAC,mBAAmB,CAAC;CAG9C"}
@@ -1,5 +1,7 @@
1
1
  import { HttpClient } from './http.js';
2
2
  import { Agents } from './resources/agents.js';
3
+ import { Callbacks } from './resources/callbacks.js';
4
+ import { Calls } from './resources/calls.js';
3
5
  import { Complete } from './resources/complete.js';
4
6
  import { Credits } from './resources/credits.js';
5
7
  import { KnowledgeBases } from './resources/knowledge-bases.js';
@@ -9,6 +11,7 @@ import { Synthesize } from './resources/synthesize.js';
9
11
  import { Transcribe } from './resources/transcribe.js';
10
12
  import { Usage } from './resources/usage.js';
11
13
  import { Voice } from './resources/voice.js';
14
+ import { Voices } from './resources/voices.js';
12
15
  const DEFAULT_BASE_URL = 'https://api.speko.dev';
13
16
  const DEFAULT_TIMEOUT = 30_000;
14
17
  /**
@@ -30,9 +33,12 @@ export class Speko {
30
33
  credits;
31
34
  realtime;
32
35
  voice;
36
+ voices;
33
37
  phoneNumbers;
34
38
  agents;
35
39
  knowledgeBases;
40
+ calls;
41
+ callbacks;
36
42
  transcribeResource;
37
43
  synthesizeResource;
38
44
  completeResource;
@@ -41,7 +47,7 @@ export class Speko {
41
47
  throw new Error('Speko: apiKey is required. Get one at https://platform.speko.dev/api-keys');
42
48
  }
43
49
  const http = new HttpClient({
44
- baseUrl: options.baseUrl ?? DEFAULT_BASE_URL,
50
+ baseUrl: options.baseUrl ?? options.baseURL ?? DEFAULT_BASE_URL,
45
51
  apiKey: options.apiKey,
46
52
  timeout: options.timeout ?? DEFAULT_TIMEOUT,
47
53
  });
@@ -49,9 +55,12 @@ export class Speko {
49
55
  this.credits = new Credits(http);
50
56
  this.realtime = new Realtime(http);
51
57
  this.voice = new Voice(http);
58
+ this.voices = new Voices(http);
52
59
  this.phoneNumbers = new PhoneNumbers(http);
53
60
  this.agents = new Agents(http);
54
61
  this.knowledgeBases = new KnowledgeBases(http);
62
+ this.calls = new Calls(http);
63
+ this.callbacks = new Callbacks(http);
55
64
  this.transcribeResource = new Transcribe(http);
56
65
  this.synthesizeResource = new Synthesize(http);
57
66
  this.completeResource = new Complete(http);
@@ -12,6 +12,7 @@ export declare class HttpClient {
12
12
  request<T>(method: string, path: string, body?: unknown, externalSignal?: AbortSignal): Promise<T>;
13
13
  get<T>(path: string, externalSignal?: AbortSignal): Promise<T>;
14
14
  post<T>(path: string, body: unknown, externalSignal?: AbortSignal): Promise<T>;
15
+ put<T>(path: string, body: unknown, externalSignal?: AbortSignal): Promise<T>;
15
16
  delete<T>(path: string, externalSignal?: AbortSignal): Promise<T>;
16
17
  patch<T>(path: string, body: unknown, externalSignal?: AbortSignal): Promise<T>;
17
18
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/lib/http.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,iBAAiB;IAChC,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;CACjB;AAID,qBAAa,UAAU;IACrB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;IACjC,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAS;IACpC,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAyB;IACrD,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAS;gBAErB,OAAO,EAAE,iBAAiB;IAWhC,OAAO,CAAC,CAAC,EACb,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,CAAC,EAAE,OAAO,EACd,cAAc,CAAC,EAAE,WAAW,GAC3B,OAAO,CAAC,CAAC,CAAC;IAsBP,GAAG,C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BAAqB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC;IA+CpD,aAAa,CACjB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,UAAU,EACrB,YAAY,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EACpC,cAAc,CAAC,EAAE,WAAW,GAC3B,OAAO,CAAC,qBAAqB,CAAC;QAAE,KAAK,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IA4B7D,mBAAmB,CACvB,MAAM,EAAE,MAAM,EACd,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,OAAO,EACb,cAAc,CAAC,EAAE,WAAW,GAC3B,OAAO,CAAC;QAAE,MAAM,EAAE,qBAAqB,CAAC,UAAU,CAAC,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,CAAC;YAgC3E,WAAW;YA+BX,cAAc;IAiB7B;;;;OAIG;IACH,OAAO,CAAC,WAAW;YA6BL,WAAW;CAyB1B"}
package/dist/lib/http.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { SpekoApiError, SpekoAuthError, SpekoRateLimitError } from './errors.js';
2
- const USER_AGENT = '@spekoai/sdk/0.4.0';
2
+ const USER_AGENT = '@spekoai/sdk/0.4.1';
3
3
  export class HttpClient {
4
4
  baseUrl;
5
5
  authHeader;
@@ -40,6 +40,9 @@ export class HttpClient {
40
40
  async post(path, body, externalSignal) {
41
41
  return this.request('POST', path, body, externalSignal);
42
42
  }
43
+ async put(path, body, externalSignal) {
44
+ return this.request('PUT', path, body, externalSignal);
45
+ }
43
46
  async delete(path, externalSignal) {
44
47
  return this.request('DELETE', path, undefined, externalSignal);
45
48
  }
@@ -1,5 +1,5 @@
1
1
  import type { HttpClient } from '../http.js';
2
- import type { AgentCreateParams, AgentRow, AgentToolCreateParams, AgentToolRow, AgentToolUpdateParams, AgentUpdateParams, PhoneNumberRow } from '../types/index.js';
2
+ import type { AgentCallListPage, AgentCallListParams, AgentCreateParams, AgentRow, AgentToolCreateParams, AgentToolRow, AgentToolUpdateParams, AgentUpdateParams, ChatTool, PhoneNumberRow } from '../types/index.js';
3
3
  /**
4
4
  * Per-org agent definitions — the system prompt, voice, intent, and
5
5
  * routing constraints used when this agent answers (or places) a call.
@@ -44,25 +44,42 @@ export declare class Agents {
44
44
  * `{ agentId: null }`.
45
45
  */
46
46
  detachPhoneNumber(phoneNumberId: string): Promise<PhoneNumberRow>;
47
+ /**
48
+ * List recent calls for an agent. Use `next_cursor` from the returned page
49
+ * as `cursor` to page backward in time.
50
+ */
51
+ listCalls(agentId: string, params?: AgentCallListParams): Promise<AgentCallListPage>;
47
52
  }
48
53
  /**
49
- * Per-agent tool definitions exposed to the LLM mid-call. Three
50
- * execution modes: `inline` (caller runs the tool), `webhook`
51
- * (Speko POSTs to your URL with a Standard-Webhooks signature), and
52
- * `builtin` (Speko-managed tools like `search_knowledge_base`).
54
+ * Per-agent tool definitions exposed to the LLM mid-call. Four execution
55
+ * modes: `inline` (caller runs the tool), `webhook` (Speko POSTs to your URL
56
+ * with a Standard-Webhooks signature), `builtin` (Speko-managed tools like
57
+ * `search_knowledge_base`, `transfer_call`, `end_call`), and `integration`
58
+ * (an org-installed Speko app action such as Google Calendar or Slack).
53
59
  *
54
60
  * Webhook secrets are encrypted server-side at creation; the returned
55
61
  * row carries a `secretRef` pointer instead of the plaintext.
62
+ *
63
+ * Every method accepts an optional trailing `AbortSignal` to cancel the
64
+ * in-flight request — useful when a calling framework tears down a session
65
+ * mid-call.
56
66
  */
57
67
  export declare class AgentTools {
58
68
  private readonly http;
59
69
  constructor(http: HttpClient);
60
- list(agentId: string): Promise<AgentToolRow[]>;
61
- create(agentId: string, params: AgentToolCreateParams): Promise<AgentToolRow>;
62
- get(agentId: string, toolId: string): Promise<AgentToolRow>;
63
- update(agentId: string, toolId: string, params: AgentToolUpdateParams): Promise<AgentToolRow>;
64
- delete(agentId: string, toolId: string): Promise<{
70
+ list(agentId: string, abortSignal?: AbortSignal): Promise<AgentToolRow[]>;
71
+ create(agentId: string, params: AgentToolCreateParams, abortSignal?: AbortSignal): Promise<AgentToolRow>;
72
+ get(agentId: string, toolId: string, abortSignal?: AbortSignal): Promise<AgentToolRow>;
73
+ update(agentId: string, toolId: string, params: AgentToolUpdateParams, abortSignal?: AbortSignal): Promise<AgentToolRow>;
74
+ delete(agentId: string, toolId: string, abortSignal?: AbortSignal): Promise<{
65
75
  deleted: boolean;
66
76
  }>;
77
+ /**
78
+ * Fetch this agent's registered tools and convert them into the
79
+ * {@link ChatTool}[] shape that {@link Speko.complete} accepts. Handles all
80
+ * four source kinds (`inline`, `webhook`, `builtin`, `integration`) — load
81
+ * once and pass the result straight to `speko.complete({ tools })`.
82
+ */
83
+ listChatTools(agentId: string, abortSignal?: AbortSignal): Promise<ChatTool[]>;
67
84
  }
68
85
  //# sourceMappingURL=agents.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"agents.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/agents.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,iBAAiB,EACjB,QAAQ,EACR,qBAAqB,EACrB,YAAY,EACZ,qBAAqB,EACrB,iBAAiB,EACjB,cAAc,EACf,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;GAmBG;AACH,qBAAa,MAAM;IAGL,OAAO,CAAC,QAAQ,CAAC,IAAI;IAFjC,QAAQ,CAAC,KAAK,EAAE,UAAU,CAAC;gBAEE,IAAI,EAAE,UAAU;IAI7C,IAAI,IAAI,OAAO,CAAC,QAAQ,EAAE,CAAC;IAI3B,MAAM,CAAC,MAAM,EAAE,iBAAiB,GAAG,OAAO,CAAC,QAAQ,CAAC;IAIpD,GAAG,CAAC,OAAO,EA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E,qBAAqB,EAC7B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,YAAY,CAAC;IAQxB,GAAG,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,YAAY,CAAC;IAOtF,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,qBAAqB,EAC7B,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC,YAAY,CAAC;IAQxB,MAAM,CACJ,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,WAAW,CAAC,EAAE,WAAW,GACxB,OAAO,CAAC;QAAE,OAAO,EAAE,OAAO,CAAA;KAAE,CAAC;IAOhC;;;;;OAKG;IACG,aAAa,CAAC,OAAO,EAAE,MAAM,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;CAIrF"}
@@ -57,34 +57,78 @@ export class Agents {
57
57
  detachPhoneNumber(phoneNumberId) {
58
58
  return this.http.patch(`/v1/phone-numbers/${encodeURIComponent(phoneNumberId)}`, { agentId: null });
59
59
  }
60
+ /**
61
+ * List recent calls for an agent. Use `next_cursor` from the returned page
62
+ * as `cursor` to page backward in time.
63
+ */
64
+ listCalls(agentId, params = {}) {
65
+ const query = new URLSearchParams();
66
+ if (params.limit !== undefined)
67
+ query.set('limit', String(params.limit));
68
+ if (params.cursor)
69
+ query.set('cursor', params.cursor);
70
+ if (params.since)
71
+ query.set('since', params.since);
72
+ const suffix = query.toString() ? `?${query}` : '';
73
+ return this.http.get(`/v1/agents/${encodeURIComponent(agentId)}/calls${suffix}`);
74
+ }
60
75
  }
61
76
  /**
62
- * Per-agent tool definitions exposed to the LLM mid-call. Three
63
- * execution modes: `inline` (caller runs the tool), `webhook`
64
- * (Speko POSTs to your URL with a Standard-Webhooks signature), and
65
- * `builtin` (Speko-managed tools like `search_knowledge_base`).
77
+ * Per-agent tool definitions exposed to the LLM mid-call. Four execution
78
+ * modes: `inline` (caller runs the tool), `webhook` (Speko POSTs to your URL
79
+ * with a Standard-Webhooks signature), `builtin` (Speko-managed tools like
80
+ * `search_knowledge_base`, `transfer_call`, `end_call`), and `integration`
81
+ * (an org-installed Speko app action such as Google Calendar or Slack).
66
82
  *
67
83
  * Webhook secrets are encrypted server-side at creation; the returned
68
84
  * row carries a `secretRef` pointer instead of the plaintext.
85
+ *
86
+ * Every method accepts an optional trailing `AbortSignal` to cancel the
87
+ * in-flight request — useful when a calling framework tears down a session
88
+ * mid-call.
69
89
  */
70
90
  export class AgentTools {
71
91
  http;
72
92
  constructor(http) {
73
93
  this.http = http;
74
94
  }
75
- list(agentId) {
76
- return this.http.get(`/v1/agents/${encodeURIComponent(agentId)}/tools`);
95
+ list(agentId, abortSignal) {
96
+ return this.http.get(`/v1/agents/${encodeURIComponent(agentId)}/tools`, abortSignal);
97
+ }
98
+ create(agentId, params, abortSignal) {
99
+ return this.http.post(`/v1/agents/${encodeURIComponent(agentId)}/tools`, params, abortSignal);
77
100
  }
78
- create(agentId, params) {
79
- return this.http.post(`/v1/agents/${encodeURIComponent(agentId)}/tools`, params);
101
+ get(agentId, toolId, abortSignal) {
102
+ return this.http.get(`/v1/agents/${encodeURIComponent(agentId)}/tools/${encodeURIComponent(toolId)}`, abortSignal);
80
103
  }
81
- get(agentId, toolId) {
82
- return this.http.get(`/v1/agents/${encodeURIComponent(agentId)}/tools/${encodeURIComponent(toolId)}`);
104
+ update(agentId, toolId, params, abortSignal) {
105
+ return this.http.patch(`/v1/agents/${encodeURIComponent(agentId)}/tools/${encodeURIComponent(toolId)}`, params, abortSignal);
83
106
  }
84
- update(agentId, toolId, params) {
85
- return this.http.patch(`/v1/agents/${encodeURIComponent(agentId)}/tools/${encodeURIComponent(toolId)}`, params);
107
+ delete(agentId, toolId, abortSignal) {
108
+ return this.http.delete(`/v1/agents/${encodeURIComponent(agentId)}/tools/${encodeURIComponent(toolId)}`, abortSignal);
86
109
  }
87
- delete(agentId, toolId) {
88
- return this.http.delete(`/v1/agents/${encodeURIComponent(agentId)}/tools/${encodeURIComponent(toolId)}`);
110
+ /**
111
+ * Fetch this agent's registered tools and convert them into the
112
+ * {@link ChatTool}[] shape that {@link Speko.complete} accepts. Handles all
113
+ * four source kinds (`inline`, `webhook`, `builtin`, `integration`) — load
114
+ * once and pass the result straight to `speko.complete({ tools })`.
115
+ */
116
+ async listChatTools(agentId, abortSignal) {
117
+ const rows = await this.list(agentId, abortSignal);
118
+ return rows.map(toChatTool);
89
119
  }
90
120
  }
121
+ /**
122
+ * Convert a serialized {@link AgentToolRow} into a {@link ChatTool}. The row's
123
+ * `source` is structurally identical to `ChatToolSource` for every kind, so the
124
+ * mapping is a direct passthrough; `executionMode` is derived from `source.kind`.
125
+ */
126
+ function toChatTool(row) {
127
+ return {
128
+ name: row.name,
129
+ description: row.description,
130
+ parameters: row.parameters,
131
+ executionMode: row.source.kind,
132
+ source: row.source,
133
+ };
134
+ }
@@ -0,0 +1,13 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { CancelScheduledCallbackParams, ScheduledCallback, ScheduledCallbacksListParams } from '../types/index.js';
3
+ export declare class Callbacks {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ list(params?: ScheduledCallbacksListParams): Promise<{
7
+ callbacks: ScheduledCallback[];
8
+ }>;
9
+ get(callbackId: string): Promise<ScheduledCallback>;
10
+ cancel(callbackId: string, params?: CancelScheduledCallbackParams): Promise<ScheduledCallback>;
11
+ dispatch(callbackId: string): Promise<ScheduledCallback>;
12
+ }
13
+ //# sourceMappingURL=callbacks.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"callbacks.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/callbacks.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,6BAA6B,EAC7B,iBAAiB,EACjB,4BAA4B,EAC7B,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,SAAS;IACR,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,CAAC,MAAM,GAAE,4BAAiC,GAAG,OAAO,CAAC;QAAE,SAAS,EAAE,iBAAiB,EAAE,CAAA;KAAE,CAAC;IAS5F,GAAG,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAInD,MAAM,CACJ,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,6BAAkC,GACzC,OAAO,CAAC,iBAAiB,CAAC;IAO7B,QAAQ,CAAC,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAMzD"}
@@ -0,0 +1,26 @@
1
+ export class Callbacks {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ list(params = {}) {
7
+ const query = new URLSearchParams();
8
+ if (params.status)
9
+ query.set('status', params.status);
10
+ if (params.sourceSessionId)
11
+ query.set('source_session_id', params.sourceSessionId);
12
+ if (params.limit !== undefined)
13
+ query.set('limit', String(params.limit));
14
+ const suffix = query.toString() ? `?${query}` : '';
15
+ return this.http.get(`/v1/callbacks${suffix}`);
16
+ }
17
+ get(callbackId) {
18
+ return this.http.get(`/v1/callbacks/${encodeURIComponent(callbackId)}`);
19
+ }
20
+ cancel(callbackId, params = {}) {
21
+ return this.http.post(`/v1/callbacks/${encodeURIComponent(callbackId)}/cancel`, params);
22
+ }
23
+ dispatch(callbackId) {
24
+ return this.http.post(`/v1/callbacks/${encodeURIComponent(callbackId)}/dispatch`, {});
25
+ }
26
+ }
@@ -0,0 +1,18 @@
1
+ import type { HttpClient } from '../http.js';
2
+ import type { BlindTransferParams, CallDetail, CallEvent, CallRecording, CallReport, CallTransfer, CallTransferResponse, CancelWarmTransferParams, CompleteWarmTransferParams, FinalizeCallReportParams, FinalizeCallReportResult, WarmTransferParams } from '../types/index.js';
3
+ export declare class Calls {
4
+ private readonly http;
5
+ constructor(http: HttpClient);
6
+ get(callId: string): Promise<CallDetail>;
7
+ events(callId: string): Promise<{
8
+ events: CallEvent[];
9
+ }>;
10
+ report(callId: string): Promise<CallReport>;
11
+ finalizeReport(callId: string, params?: FinalizeCallReportParams): Promise<FinalizeCallReportResult>;
12
+ recording(callId: string): Promise<CallRecording>;
13
+ blindTransfer(callId: string, params: BlindTransferParams): Promise<CallTransfer>;
14
+ warmTransfer(callId: string, params: WarmTransferParams): Promise<CallTransferResponse>;
15
+ completeWarmTransfer(callId: string, transferId: string, params?: CompleteWarmTransferParams): Promise<CallTransfer>;
16
+ cancelWarmTransfer(callId: string, transferId: string, params?: CancelWarmTransferParams): Promise<CallTransferResponse>;
17
+ }
18
+ //# sourceMappingURL=calls.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"calls.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/calls.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,mBAAmB,EACnB,UAAU,EACV,SAAS,EACT,aAAa,EACb,UAAU,EACV,YAAY,EACZ,oBAAoB,EACpB,wBAAwB,EACxB,0BAA0B,EAC1B,wBAAwB,EACxB,wBAAwB,EACxB,kBAAkB,EACnB,MAAM,mBAAmB,CAAC;AAE3B,qBAAa,KAAK;IACJ,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,GAAG,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAIxC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,MAAM,EAAE,SAAS,EAAE,CAAA;KAAE,CAAC;IAIxD,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;IAI3C,cAAc,CACZ,MAAM,EAAE,MAAM,EACd,MAAM,GAAE,wBAA6B,GACpC,OAAO,CAAC,wBAAwB,CAAC;IAOpC,SAAS,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;IAIjD,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,mBAAmB,GAAG,OAAO,CAAC,YAAY,CAAC;IAOjF,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,kBAAkB,GAAG,OAAO,CAAC,oBAAoB,CAAC;IAOvF,oBAAoB,CAClB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,0BAA+B,GACtC,OAAO,CAAC,YAAY,CAAC;IASxB,kBAAkB,CAChB,MAAM,EAAE,MAAM,EACd,UAAU,EAAE,MAAM,EAClB,MAAM,GAAE,wBAA6B,GACpC,OAAO,CAAC,oBAAoB,CAAC;CAMjC"}
@@ -0,0 +1,33 @@
1
+ export class Calls {
2
+ http;
3
+ constructor(http) {
4
+ this.http = http;
5
+ }
6
+ get(callId) {
7
+ return this.http.get(`/v1/calls/${encodeURIComponent(callId)}`);
8
+ }
9
+ events(callId) {
10
+ return this.http.get(`/v1/calls/${encodeURIComponent(callId)}/events`);
11
+ }
12
+ report(callId) {
13
+ return this.http.get(`/v1/calls/${encodeURIComponent(callId)}/report`);
14
+ }
15
+ finalizeReport(callId, params = {}) {
16
+ return this.http.post(`/v1/calls/${encodeURIComponent(callId)}/report/finalize`, params);
17
+ }
18
+ recording(callId) {
19
+ return this.http.get(`/v1/calls/${encodeURIComponent(callId)}/recording`);
20
+ }
21
+ blindTransfer(callId, params) {
22
+ return this.http.post(`/v1/calls/${encodeURIComponent(callId)}/transfers/blind`, params);
23
+ }
24
+ warmTransfer(callId, params) {
25
+ return this.http.post(`/v1/calls/${encodeURIComponent(callId)}/transfers/warm`, params);
26
+ }
27
+ completeWarmTransfer(callId, transferId, params = {}) {
28
+ return this.http.post(`/v1/calls/${encodeURIComponent(callId)}/transfers/${encodeURIComponent(transferId)}/complete`, params);
29
+ }
30
+ cancelWarmTransfer(callId, transferId, params = {}) {
31
+ return this.http.post(`/v1/calls/${encodeURIComponent(callId)}/transfers/${encodeURIComponent(transferId)}/cancel`, params);
32
+ }
33
+ }
@@ -1 +1 @@
1
- {"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/complete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7F,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;OAWG;IACG,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAuB/E,MAAM,CACX,MAAM,EAAE,cAAc,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,qBAAqB,CAAC,mBAAmB,CAAC;CAQ9C"}
1
+ {"version":3,"file":"complete.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/complete.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAE7F,qBAAa,QAAQ;IACP,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C;;;;;;;;;;;OAWG;IACG,IAAI,CAAC,MAAM,EAAE,cAAc,EAAE,WAAW,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,cAAc,CAAC;IAuB/E,MAAM,CACX,MAAM,EAAE,cAAc,EACtB,WAAW,CAAC,EAAE,WAAW,GACxB,qBAAqB,CAAC,mBAAmB,CAAC;CAiB9C"}
@@ -40,7 +40,10 @@ export class Complete {
40
40
  return done;
41
41
  }
42
42
  async *stream(params, abortSignal) {
43
- for await (const event of this.http.requestSse('POST', '/v1/complete', params, abortSignal)) {
43
+ const { sessionId, ...body } = params;
44
+ const trimmedSessionId = sessionId?.trim();
45
+ const headers = trimmedSessionId ? { 'x-session-id': trimmedSessionId } : undefined;
46
+ for await (const event of this.http.requestSse('POST', '/v1/complete', body, abortSignal, headers)) {
44
47
  yield {
45
48
  ...event.data,
46
49
  type: event.event,
@@ -1,10 +1,10 @@
1
1
  import type { HttpClient } from '../http.js';
2
- import type { AvailablePhoneNumber, PhoneNumberCreateParams, PhoneNumberRow, PhoneNumberSearchParams, PhoneNumberUpdateParams } from '../types/index.js';
2
+ import type { AvailablePhoneNumber, PhoneNumberCreateParams, PhoneNumberImportSipTrunkParams, PhoneNumberKybDraftParams, PhoneNumberKybOverview, PhoneNumberKybSubmission, PhoneNumberKybSubmitParams, PhoneNumberRow, PhoneNumberSearchParams, PhoneNumberUpdateParams } from '../types/index.js';
3
3
  /**
4
- * Phone numbers Speko has provisioned (or imported) on Telnyx for your
5
- * organization. Each number can be used for outbound dialing and/or
6
- * inbound, and carries an optional metadata template that's merged into
7
- * the worker dispatch payload when the number is used.
4
+ * Phone numbers Speko has provisioned as managed numbers or registered
5
+ * from your own SIP trunk. Each number can be used for outbound dialing
6
+ * and/or inbound, and carries an optional metadata template that's
7
+ * merged into the worker dispatch payload when the number is used.
8
8
  *
9
9
  * @example
10
10
  * ```ts
@@ -28,7 +28,7 @@ export declare class PhoneNumbers {
28
28
  constructor(http: HttpClient);
29
29
  list(): Promise<PhoneNumberRow[]>;
30
30
  /**
31
- * Search Telnyx's pool for orderable US numbers. Filter by area code
31
+ * Search the platform-managed pool for orderable US numbers. Filter by area code
32
32
  * and/or locality. Results include cost so you can preview "$1 upfront +
33
33
  * $1/month" before committing to {@link create}.
34
34
  *
@@ -41,9 +41,23 @@ export declare class PhoneNumbers {
41
41
  searchAvailable(params?: PhoneNumberSearchParams): Promise<AvailablePhoneNumber[]>;
42
42
  get(id: string): Promise<PhoneNumberRow>;
43
43
  create(params: PhoneNumberCreateParams): Promise<PhoneNumberRow>;
44
+ importSipTrunk(params: PhoneNumberImportSipTrunkParams): Promise<PhoneNumberRow>;
44
45
  update(id: string, params: PhoneNumberUpdateParams): Promise<PhoneNumberRow>;
45
46
  delete(id: string): Promise<{
46
47
  released: boolean;
47
48
  }>;
49
+ /**
50
+ * Read business verification state used to gate managed phone-number purchases.
51
+ * Includes the latest submission plus any SMS 10DLC-derived prefill.
52
+ */
53
+ getKyb(): Promise<PhoneNumberKybOverview>;
54
+ /**
55
+ * Save a draft business verification submission without sending it for review.
56
+ */
57
+ saveKybDraft(params: PhoneNumberKybDraftParams): Promise<PhoneNumberKybSubmission>;
58
+ /**
59
+ * Submit business verification for review. `attestationAccepted` must be `true`.
60
+ */
61
+ submitKyb(params: PhoneNumberKybSubmitParams): Promise<PhoneNumberKybSubmission>;
48
62
  }
49
63
  //# sourceMappingURL=phone-numbers.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"phone-numbers.d.ts","sourceRoot":"","sources":["../../../src/lib/resources/phone-numbers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACvB,cAAc,EACd,uBAAuB,EACvB,uBAAuB,EACxB,MAAM,mBAAmB,CAAC;AAE3B;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,qBAAa,YAAY;IACX,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,UAAU;IAE7C,IAAI,IAAI,OAAO,CAAC,cAAc,EAAE,CAAC;IAIjC;;;;;;;;;;OAUG;IACH,eAAe,CAAC,MAAM,GAAE,uBAA4B,GAAG,OAAO,CAAC,oBAAoB,EAAE,CAAC;IAWtF,GAAG,CAAC,EAAE,EAAE,MAAM,GAAG,OAA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G,OAAO,CAAC;QAAE,QAAQ,EAAE,OAAO,CAAA;KAAE,CAAC;IAIlD;;;OAGG;IACH,MAAM,IAAI,OAAO,CAAC,sBAAsB,CAAC;IAIzC;;OAEG;IACH,YAAY,CAAC,MAAM,EAAE,yBAAyB,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAIlF;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,0BAA0B,GAAG,OAAO,CAAC,wBAAwB,CAAC;CAGjF"}
@@ -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
  }