@voice-ai-labs/web-sdk 0.9.1 → 1.0.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.
- package/README.md +170 -24
- package/dist/client/analytics.d.ts +18 -1
- package/dist/client/analytics.d.ts.map +1 -1
- package/dist/client/analytics.js +25 -0
- package/dist/client/analytics.js.map +1 -1
- package/dist/client/base.d.ts +8 -2
- package/dist/client/base.d.ts.map +1 -1
- package/dist/client/base.js +31 -13
- package/dist/client/base.js.map +1 -1
- package/dist/client/index.d.ts +1 -0
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +1 -0
- package/dist/client/index.js.map +1 -1
- package/dist/client/managed-tools.d.ts +17 -0
- package/dist/client/managed-tools.d.ts.map +1 -0
- package/dist/client/managed-tools.js +24 -0
- package/dist/client/managed-tools.js.map +1 -0
- package/dist/client/tts.d.ts +1 -1
- package/dist/client/tts.js +1 -1
- package/dist/index.d.ts +9 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +800 -46
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +817 -45
- package/dist/index.js.map +1 -1
- package/dist/managed-tools/google.d.ts +29 -0
- package/dist/managed-tools/google.d.ts.map +1 -0
- package/dist/managed-tools/google.js +178 -0
- package/dist/managed-tools/google.js.map +1 -0
- package/dist/managed-tools/iana-timezones.d.ts +10 -0
- package/dist/managed-tools/iana-timezones.d.ts.map +1 -0
- package/dist/managed-tools/iana-timezones.js +470 -0
- package/dist/managed-tools/iana-timezones.js.map +1 -0
- package/dist/types.d.ts +87 -10
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -35,9 +35,10 @@ The SDK provides a unified interface for:
|
|
|
35
35
|
- [**Real-time Voice**](#real-time-voice) — Connect to voice agents with live transcription
|
|
36
36
|
- [**Text-to-Speech**](#text-to-speech) — Generate speech and manage voices
|
|
37
37
|
- [**Agent Management**](#agent-management) — Create, update, deploy, and manage agents
|
|
38
|
+
- [**Managed Tools**](#managed-tools) — Connect first-party managed integrations such as Google Calendar, Sheets, and Gmail
|
|
38
39
|
- [**Knowledge Base**](#knowledge-base) — Manage RAG documents for your agents
|
|
39
40
|
- [**Phone Numbers**](#phone-numbers) — Search and manage phone numbers
|
|
40
|
-
- [**Analytics**](#analytics) — Access call history and
|
|
41
|
+
- [**Analytics**](#analytics) — Access call history, transcripts, and recordings
|
|
41
42
|
- [**Webhooks**](#webhooks) — Receive real-time notifications for call events
|
|
42
43
|
- [**Security**](#security) — Backend token exchange, endToken, CORS
|
|
43
44
|
- [**Error Handling**](#error-handling) — Connection and API error handling
|
|
@@ -167,7 +168,7 @@ const audio = await voiceai.tts.synthesize({
|
|
|
167
168
|
// List all available voices
|
|
168
169
|
const voices = await voiceai.tts.listVoices();
|
|
169
170
|
|
|
170
|
-
// Clone a voice from audio file (MP3/WAV/
|
|
171
|
+
// Clone a voice from audio file (MP3/WAV/M4A, max 7.5MB)
|
|
171
172
|
const voice = await voiceai.tts.cloneVoice({
|
|
172
173
|
file: audioFile,
|
|
173
174
|
name: 'My Voice',
|
|
@@ -246,6 +247,7 @@ const agent = await voiceai.agents.create({
|
|
|
246
247
|
config: {
|
|
247
248
|
prompt: 'You are a helpful customer support agent.',
|
|
248
249
|
greeting: 'Hello! How can I help you today?',
|
|
250
|
+
recording_enabled: true,
|
|
249
251
|
tts_params: {
|
|
250
252
|
voice_id: 'my-voice-id',
|
|
251
253
|
model: 'voiceai-tts-v1-latest',
|
|
@@ -278,9 +280,133 @@ await voiceai.agents.createOutboundCall({
|
|
|
278
280
|
});
|
|
279
281
|
```
|
|
280
282
|
|
|
283
|
+
## Managed Tools
|
|
284
|
+
|
|
285
|
+
The managed tools surface is generic. Today it covers Google Calendar, Google Sheets, and Gmail.
|
|
286
|
+
|
|
287
|
+
Managed tools are exposed under `voiceai.managedTools`.
|
|
288
|
+
|
|
289
|
+
Today the SDK includes one Google entry:
|
|
290
|
+
|
|
291
|
+
- `voiceai.managedTools.google`
|
|
292
|
+
- Use it to start OAuth, check status, and disconnect Google managed tools for an agent
|
|
293
|
+
- Pass the individual managed tool configs under `managedTools.google_calendar`, `managedTools.google_sheets`, and `managedTools.google_gmail`
|
|
294
|
+
|
|
295
|
+
Use the managed Google surface to connect an agent to Google Calendar, Sheets, or Gmail.
|
|
296
|
+
|
|
297
|
+
```typescript
|
|
298
|
+
import VoiceAI, {
|
|
299
|
+
GOOGLE_CALENDAR_OPERATION_OPTIONS,
|
|
300
|
+
IANA_TIMEZONE_OPTIONS,
|
|
301
|
+
getGoogleReconnectState,
|
|
302
|
+
hasEnabledGoogleManagedTools,
|
|
303
|
+
} from '@voice-ai-labs/web-sdk';
|
|
304
|
+
|
|
305
|
+
const voiceai = new VoiceAI({ apiKey: 'vk_your_api_key' });
|
|
306
|
+
|
|
307
|
+
const start = await voiceai.managedTools.google.startOAuth('agent-123', {
|
|
308
|
+
returnUrl: window.location.href,
|
|
309
|
+
managedTools: {
|
|
310
|
+
google_calendar: {
|
|
311
|
+
enabled: true,
|
|
312
|
+
timezone: 'America/Los_Angeles',
|
|
313
|
+
selected_operations: ['google_calendar_check_availability', 'google_calendar_create_event'],
|
|
314
|
+
},
|
|
315
|
+
},
|
|
316
|
+
});
|
|
317
|
+
|
|
318
|
+
window.open(start.auth_url, 'google-oauth', 'popup,width=540,height=720');
|
|
319
|
+
|
|
320
|
+
const status = await voiceai.managedTools.google.getStatus('agent-123');
|
|
321
|
+
const reconnect = getGoogleReconnectState(
|
|
322
|
+
{
|
|
323
|
+
google_calendar: {
|
|
324
|
+
enabled: true,
|
|
325
|
+
selected_operations: ['google_calendar_check_availability', 'google_calendar_create_event'],
|
|
326
|
+
},
|
|
327
|
+
},
|
|
328
|
+
status
|
|
329
|
+
);
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
Connection flow:
|
|
333
|
+
|
|
334
|
+
1. Call `startOAuth(...)` with the agent ID, `returnUrl`, and the individual Google managed tool configs you want enabled.
|
|
335
|
+
2. Open the returned `auth_url` in a popup or browser tab.
|
|
336
|
+
3. Google redirects to the VoiceAI backend callback.
|
|
337
|
+
4. The backend completes OAuth and then returns the user to your `returnUrl`.
|
|
338
|
+
5. Refresh or poll `voiceai.managedTools.google.getStatus(agentId)` to confirm the connection state.
|
|
339
|
+
|
|
340
|
+
Connection semantics:
|
|
341
|
+
|
|
342
|
+
- `startOAuth(...)` manages Google managed-tools access for the agent
|
|
343
|
+
- `managedTools.google_calendar`, `managedTools.google_sheets`, and `managedTools.google_gmail` decide which Google capabilities should be available
|
|
344
|
+
- enabling more Google operations later can require reconnecting to grant additional access
|
|
345
|
+
- `disconnect(...)` removes Google managed-tools access for that agent
|
|
346
|
+
|
|
347
|
+
Available helpers:
|
|
348
|
+
|
|
349
|
+
- `voiceai.managedTools.google.startOAuth(agentId, { returnUrl, managedTools })`
|
|
350
|
+
- `voiceai.managedTools.google.getStatus(agentId)`
|
|
351
|
+
- `voiceai.managedTools.google.disconnect(agentId)`
|
|
352
|
+
- `GOOGLE_CALENDAR_OPERATION_OPTIONS`, `GOOGLE_SHEETS_OPERATION_OPTIONS`, `GOOGLE_GMAIL_OPERATION_OPTIONS`
|
|
353
|
+
- `getManagedToolSelectedOperations(...)`, `toggleManagedToolOperation(...)`
|
|
354
|
+
- `getRequiredGoogleScopes(...)`, `getGoogleReconnectState(...)`, `hasEnabledGoogleManagedTools(...)`
|
|
355
|
+
- `IANA_TIMEZONE_OPTIONS` for timezone selectors. Each option includes `{ value, label, offsetMinutes }`, where `value` is the canonical IANA timezone like `America/Los_Angeles`
|
|
356
|
+
|
|
357
|
+
Managed tool config fields:
|
|
358
|
+
|
|
359
|
+
- `google_calendar`
|
|
360
|
+
- `enabled: boolean`
|
|
361
|
+
- `default_calendar_id?: string`
|
|
362
|
+
- `timezone?: string`
|
|
363
|
+
- `selected_operations?: GoogleCalendarOperation[]`
|
|
364
|
+
- `google_sheets`
|
|
365
|
+
- `enabled: boolean`
|
|
366
|
+
- `spreadsheet_id?: string`
|
|
367
|
+
- `sheet_name?: string`
|
|
368
|
+
- `selected_operations?: GoogleSheetsOperation[]`
|
|
369
|
+
- `google_gmail`
|
|
370
|
+
- `enabled: boolean`
|
|
371
|
+
- `selected_operations?: GoogleGmailOperation[]`
|
|
372
|
+
|
|
373
|
+
Supported Calendar operations:
|
|
374
|
+
|
|
375
|
+
- `google_calendar_check_availability` — Check whether a calendar is free during a time window
|
|
376
|
+
- `google_calendar_list_upcoming_events` — Read the next upcoming events from the calendar
|
|
377
|
+
- `google_calendar_create_event` — Create a new calendar event
|
|
378
|
+
- `google_calendar_update_event` — Modify an existing calendar event
|
|
379
|
+
- `google_calendar_cancel_event` — Cancel or delete an existing calendar event
|
|
380
|
+
|
|
381
|
+
Supported Sheets operations:
|
|
382
|
+
|
|
383
|
+
- `google_sheets_append_row` — Write a new row into a spreadsheet
|
|
384
|
+
- `google_sheets_list_sheets` — List worksheet tabs and spreadsheet metadata
|
|
385
|
+
- `google_sheets_read_rows` — Read rows from a worksheet range
|
|
386
|
+
|
|
387
|
+
Supported Gmail operations:
|
|
388
|
+
|
|
389
|
+
- `google_gmail_search_messages` — Search Gmail and return readable message summaries
|
|
390
|
+
- `google_gmail_get_message` — Fetch a specific Gmail message by ID
|
|
391
|
+
- `google_gmail_send_email` — Send an email from the connected Gmail account
|
|
392
|
+
|
|
393
|
+
Notes:
|
|
394
|
+
|
|
395
|
+
- Google Calendar, Sheets, and Gmail all use the `voiceai.managedTools.google` surface.
|
|
396
|
+
- If you enable additional Google operations later, `getStatus()` / `getGoogleReconnectState(...)` may report `reconnect_required` until you reconnect and grant the additional access.
|
|
397
|
+
- `voiceai.managedTools.google.disconnect(agentId)` removes Google managed-tools access for the agent.
|
|
398
|
+
- `returnUrl` is your app/frontend return target after the VoiceAI backend callback completes. It is not the Google-registered OAuth redirect URI.
|
|
399
|
+
- Calendar `timezone` should be an IANA timezone like `America/Los_Angeles`
|
|
400
|
+
- If `selected_operations` is omitted, the SDK helpers treat that managed tool config as “all supported operations selected”
|
|
401
|
+
- If `selected_operations` is an empty array, the managed tool config remains present but requests no additional provider scopes
|
|
402
|
+
|
|
281
403
|
> **Outbound access control:** `POST /api/v1/calls/outbound` is restricted to approved accounts.
|
|
282
404
|
> If you need outbound enabled for your account/workspace, please contact Voice.ai support.
|
|
283
405
|
|
|
406
|
+
> **Update behavior:** `voiceai.agents.update()` is a partial update. Omit a field to leave it unchanged. For nullable scalar fields like `prompt`, `greeting`, `phone_number`, or nested `tts_params` fields, pass `null` to clear the current value. See section-specific notes below for webhook clearing behavior.
|
|
407
|
+
|
|
408
|
+
> **Recording:** `config.recording_enabled` defaults to `true` for new agents. Set it to `false` to disable recording for future calls.
|
|
409
|
+
|
|
284
410
|
### Dynamic Variables
|
|
285
411
|
|
|
286
412
|
Pass optional `dynamic_variables` at call start and reference them in your prompt with `{{variable_name}}`:
|
|
@@ -360,12 +486,21 @@ await voiceai.phoneNumbers.release('+14155551234');
|
|
|
360
486
|
const history = await voiceai.analytics.getCallHistory({
|
|
361
487
|
page: 1,
|
|
362
488
|
limit: 20,
|
|
363
|
-
agent_ids: ['agent-123']
|
|
489
|
+
agent_ids: ['agent-123'],
|
|
490
|
+
agent_name: 'support',
|
|
491
|
+
sort_by: 'duration',
|
|
492
|
+
sort_dir: 'desc'
|
|
364
493
|
});
|
|
365
494
|
|
|
366
495
|
// Get transcript URL
|
|
367
496
|
const transcript = await voiceai.analytics.getTranscriptUrl(callId);
|
|
368
497
|
|
|
498
|
+
// Get recording status or URL
|
|
499
|
+
const recording = await voiceai.analytics.getRecordingUrl(callId);
|
|
500
|
+
if (recording.status === 'ready' && recording.url) {
|
|
501
|
+
window.open(recording.url, '_blank');
|
|
502
|
+
}
|
|
503
|
+
|
|
369
504
|
// Get stats summary
|
|
370
505
|
const stats = await voiceai.analytics.getStatsSummary();
|
|
371
506
|
```
|
|
@@ -374,9 +509,9 @@ const stats = await voiceai.analytics.getStatsSummary();
|
|
|
374
509
|
|
|
375
510
|
Configure webhooks when creating or updating an agent.
|
|
376
511
|
|
|
377
|
-
`webhooks.events`, `webhooks.inbound_call`, and `webhooks.tools` use different contracts:
|
|
512
|
+
`webhooks.events[]`, `webhooks.inbound_call`, and `webhooks.tools` use different contracts:
|
|
378
513
|
|
|
379
|
-
- `webhooks.events` supports `secret` (write-only on create/update) and `has_secret` (read-only on fetch).
|
|
514
|
+
- `webhooks.events[]` supports `secret` (write-only on create/update) and `has_secret` (read-only on fetch), with fan-out across enabled endpoints.
|
|
380
515
|
- `webhooks.inbound_call` supports `secret` (write-only on create/update) and `has_secret` (read-only on fetch).
|
|
381
516
|
- `webhooks.tools` define outbound API calls and do not use `secret`.
|
|
382
517
|
|
|
@@ -389,13 +524,15 @@ const agent = await voiceai.agents.create({
|
|
|
389
524
|
config: {
|
|
390
525
|
prompt: 'You are a helpful support agent.',
|
|
391
526
|
webhooks: {
|
|
392
|
-
events:
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
527
|
+
events: [
|
|
528
|
+
{
|
|
529
|
+
url: 'https://your-server.com/webhooks/voice-events',
|
|
530
|
+
secret: 'your-hmac-secret', // Event webhook signing secret
|
|
531
|
+
events: ['call.started', 'call.completed'], // Or omit for all events
|
|
532
|
+
timeout: 5,
|
|
533
|
+
enabled: true
|
|
534
|
+
}
|
|
535
|
+
],
|
|
399
536
|
inbound_call: {
|
|
400
537
|
url: 'https://your-server.com/webhooks/inbound-call',
|
|
401
538
|
secret: 'your-inbound-call-secret', // Inbound call webhook signing secret
|
|
@@ -435,11 +572,13 @@ const agent = await voiceai.agents.create({
|
|
|
435
572
|
await voiceai.agents.update(agentId, {
|
|
436
573
|
config: {
|
|
437
574
|
webhooks: {
|
|
438
|
-
events:
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
575
|
+
events: [
|
|
576
|
+
{
|
|
577
|
+
url: 'https://your-server.com/webhooks',
|
|
578
|
+
events: ['call.completed'], // Only receive call.completed
|
|
579
|
+
enabled: true
|
|
580
|
+
}
|
|
581
|
+
],
|
|
443
582
|
tools: [
|
|
444
583
|
{
|
|
445
584
|
name: 'search_knowledge_base',
|
|
@@ -465,15 +604,20 @@ await voiceai.agents.update(agentId, {
|
|
|
465
604
|
|
|
466
605
|
### Webhook configuration requiredness
|
|
467
606
|
|
|
468
|
-
- `webhooks.events`
|
|
469
|
-
- Required: `url`
|
|
470
|
-
- Optional: `secret`, `events`, `timeout` (default `5`), `enabled` (default `true`)
|
|
607
|
+
- `webhooks.events[]`
|
|
608
|
+
- Required per endpoint: `url`
|
|
609
|
+
- Optional per endpoint: `secret`, `events`, `timeout` (default `5`), `enabled` (default `true`)
|
|
610
|
+
- On update: omit `webhooks.events` to preserve the current list, set `webhooks.events: null` to remove it, or pass a full array to replace the list
|
|
611
|
+
- When replacing the array: omitted `secret` values are preserved only for entries whose `url` exactly matches an existing endpoint, `secret: null` clears the signing secret for that endpoint, and duplicate URLs are invalid
|
|
612
|
+
- Use `events: []` on an endpoint to receive all event types
|
|
471
613
|
- `webhooks.inbound_call`
|
|
472
614
|
- Required: `url`
|
|
473
615
|
- Optional: `secret`, `timeout` (default `5`), `enabled` (default `true`)
|
|
616
|
+
- On update: omit `inbound_call` to preserve it, set `inbound_call: null` to remove it, and set `secret: null` to clear only the signing secret
|
|
474
617
|
- `webhooks.tools`
|
|
475
618
|
- Required per tool: `name`, `description`, `parameters`, `url`, `method`, `execution_mode`, `auth_type`
|
|
476
619
|
- Optional per tool: `auth_token`, `headers`, `response`, `timeout` (default `10`)
|
|
620
|
+
- On update: omit `tools` to leave the current tool list unchanged, set `tools: null` to clear all tools, or pass a new array to replace the current list
|
|
477
621
|
|
|
478
622
|
If a field is optional and omitted, the service uses the documented default. Prefer omitting optional fields instead of sending `null` unless you explicitly intend to clear behavior in a supported way.
|
|
479
623
|
|
|
@@ -506,8 +650,10 @@ interface WebhookEvent {
|
|
|
506
650
|
|
|
507
651
|
For webhook tools, Voice.ai makes outbound HTTP requests directly to each tool `url`.
|
|
508
652
|
|
|
509
|
-
- `method: 'GET'`: tool arguments are sent as query parameters.
|
|
510
|
-
- `method: 'POST' | 'PUT' | 'PATCH'
|
|
653
|
+
- `method: 'GET' | 'DELETE'`: tool arguments are sent as query parameters.
|
|
654
|
+
- `method: 'POST' | 'PUT' | 'PATCH'`: tool arguments are sent as JSON body.
|
|
655
|
+
- For body methods, Voice.ai always sends `Content-Type: application/json`.
|
|
656
|
+
- If you configure a `Content-Type` header in `headers`, it is ignored for webhook tools.
|
|
511
657
|
- Metadata headers are always sent:
|
|
512
658
|
- `X-VoiceAI-Request-Id`
|
|
513
659
|
- `X-VoiceAI-Tool-Name`
|
|
@@ -538,7 +684,7 @@ X-VoiceAI-Call-Id: call_123
|
|
|
538
684
|
- `auth_type: 'none'`: no auth headers added.
|
|
539
685
|
- `auth_type: 'bearer_token'`: sends `Authorization: Bearer <auth_token>`.
|
|
540
686
|
- `auth_type: 'api_key'`: sends `X-API-Key: <auth_token>`.
|
|
541
|
-
- `auth_type: 'custom_headers'`: sends your configured `headers` map.
|
|
687
|
+
- `auth_type: 'custom_headers'`: sends your configured `headers` map, except `Content-Type`, which is agent-managed for body methods.
|
|
542
688
|
|
|
543
689
|
### Webhook Tool Response Behavior
|
|
544
690
|
|
|
@@ -547,7 +693,7 @@ X-VoiceAI-Call-Id: call_123
|
|
|
547
693
|
|
|
548
694
|
### Signature Verification (Event Webhooks)
|
|
549
695
|
|
|
550
|
-
If you configure `webhooks.events.secret`, verify the HMAC-SHA256 signature:
|
|
696
|
+
If you configure `webhooks.events[].secret`, verify the HMAC-SHA256 signature:
|
|
551
697
|
|
|
552
698
|
```typescript
|
|
553
699
|
import crypto from 'crypto';
|
|
@@ -4,10 +4,11 @@
|
|
|
4
4
|
* Provides methods for:
|
|
5
5
|
* - Getting call history with filters
|
|
6
6
|
* - Getting transcript URLs
|
|
7
|
+
* - Getting recording status and URLs
|
|
7
8
|
* - Getting agent stats summary
|
|
8
9
|
*/
|
|
9
10
|
import { BaseClient, BaseClientConfig } from './base';
|
|
10
|
-
import type { PaginatedCallHistoryResponse, GetCallHistoryOptions, TranscriptResponse, AgentStatsSummaryResponse } from '../types';
|
|
11
|
+
import type { PaginatedCallHistoryResponse, GetCallHistoryOptions, TranscriptResponse, RecordingResponse, AgentStatsSummaryResponse } from '../types';
|
|
11
12
|
/**
|
|
12
13
|
* Client for analytics and reporting operations
|
|
13
14
|
*/
|
|
@@ -58,6 +59,22 @@ export declare class AnalyticsClient extends BaseClient {
|
|
|
58
59
|
* ```
|
|
59
60
|
*/
|
|
60
61
|
getTranscriptUrl(callId: string): Promise<TranscriptResponse>;
|
|
62
|
+
/**
|
|
63
|
+
* Get recording status or download URL for a call
|
|
64
|
+
*
|
|
65
|
+
* @param callId - The call identifier
|
|
66
|
+
* @returns Object with recording status and optional URL
|
|
67
|
+
*
|
|
68
|
+
* @example
|
|
69
|
+
* ```typescript
|
|
70
|
+
* const recording = await client.analytics.getRecordingUrl("call_12345");
|
|
71
|
+
*
|
|
72
|
+
* if (recording.status === 'ready' && recording.url) {
|
|
73
|
+
* window.open(recording.url, '_blank');
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
getRecordingUrl(callId: string): Promise<RecordingResponse>;
|
|
61
78
|
/**
|
|
62
79
|
* Get agent stats summary
|
|
63
80
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"analytics.d.ts","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AACtD,OAAO,KAAK,EACV,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,EAClB,iBAAiB,EACjB,yBAAyB,EAC1B,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,qBAAa,eAAgB,SAAQ,UAAU;gBACjC,MAAM,EAAE,gBAAgB;IAIpC;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACG,cAAc,CAAC,OAAO,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAe5F;;;;;;;;;;;;;OAaG;IACG,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,kBAAkB,CAAC;IAInE;;;;;;;;;;;;;;OAcG;IACG,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,iBAAiB,CAAC;IAIjE;;;;;;;;;;;;;OAaG;IACG,eAAe,IAAI,OAAO,CAAC,yBAAyB,CAAC;CAG5D"}
|
package/dist/client/analytics.js
CHANGED
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
* Provides methods for:
|
|
5
5
|
* - Getting call history with filters
|
|
6
6
|
* - Getting transcript URLs
|
|
7
|
+
* - Getting recording status and URLs
|
|
7
8
|
* - Getting agent stats summary
|
|
8
9
|
*/
|
|
9
10
|
import { BaseClient } from './base';
|
|
@@ -55,6 +56,12 @@ export class AnalyticsClient extends BaseClient {
|
|
|
55
56
|
params.end_date = options.end_date;
|
|
56
57
|
if (options?.agent_ids)
|
|
57
58
|
params.agent_ids = options.agent_ids;
|
|
59
|
+
if (options?.agent_name)
|
|
60
|
+
params.agent_name = options.agent_name;
|
|
61
|
+
if (options?.sort_by)
|
|
62
|
+
params.sort_by = options.sort_by;
|
|
63
|
+
if (options?.sort_dir)
|
|
64
|
+
params.sort_dir = options.sort_dir;
|
|
58
65
|
return this.get('/agent/call-history', params);
|
|
59
66
|
}
|
|
60
67
|
/**
|
|
@@ -74,6 +81,24 @@ export class AnalyticsClient extends BaseClient {
|
|
|
74
81
|
async getTranscriptUrl(callId) {
|
|
75
82
|
return this.get(`/agent/call-history/${callId}/transcript`);
|
|
76
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* Get recording status or download URL for a call
|
|
86
|
+
*
|
|
87
|
+
* @param callId - The call identifier
|
|
88
|
+
* @returns Object with recording status and optional URL
|
|
89
|
+
*
|
|
90
|
+
* @example
|
|
91
|
+
* ```typescript
|
|
92
|
+
* const recording = await client.analytics.getRecordingUrl("call_12345");
|
|
93
|
+
*
|
|
94
|
+
* if (recording.status === 'ready' && recording.url) {
|
|
95
|
+
* window.open(recording.url, '_blank');
|
|
96
|
+
* }
|
|
97
|
+
* ```
|
|
98
|
+
*/
|
|
99
|
+
async getRecordingUrl(callId) {
|
|
100
|
+
return this.get(`/agent/call-history/${callId}/recording`);
|
|
101
|
+
}
|
|
77
102
|
/**
|
|
78
103
|
* Get agent stats summary
|
|
79
104
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"analytics.js","sourceRoot":"","sources":["../../src/client/analytics.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAoB,MAAM,QAAQ,CAAC;AAStD;;GAEG;AACH,MAAM,OAAO,eAAgB,SAAQ,UAAU;IAC7C,YAAY,MAAwB;QAClC,KAAK,CAAC,MAAM,CAAC,CAAC;IAChB,CAAC;IAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;OA4BG;IACH,KAAK,CAAC,cAAc,CAAC,OAA+B;QAClD,MAAM,MAAM,GAAwB,EAAE,CAAC;QAEvC,IAAI,OAAO,EAAE,IAAI,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;QAC5D,IAAI,OAAO,EAAE,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,KAAK,GAAG,OAAO,CAAC,KAAK,CAAC;QAC/D,IAAI,OAAO,EAAE,UAAU;YAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAChE,IAAI,OAAO,EAAE,QAAQ;YAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAC1D,IAAI,OAAO,EAAE,SAAS;YAAE,MAAM,CAAC,SAAS,GAAG,OAAO,CAAC,SAAS,CAAC;QAC7D,IAAI,OAAO,EAAE,UAAU;YAAE,MAAM,CAAC,UAAU,GAAG,OAAO,CAAC,UAAU,CAAC;QAChE,IAAI,OAAO,EAAE,OAAO;YAAE,MAAM,CAAC,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC;QACvD,IAAI,OAAO,EAAE,QAAQ;YAAE,MAAM,CAAC,QAAQ,GAAG,OAAO,CAAC,QAAQ,CAAC;QAE1D,OAAO,IAAI,CAAC,GAAG,CAA+B,qBAAqB,EAAE,MAAM,CAAC,CAAC;IAC/E,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,gBAAgB,CAAC,MAAc;QACnC,OAAO,IAAI,CAAC,GAAG,CAAqB,uBAAuB,MAAM,aAAa,CAAC,CAAC;IAClF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,KAAK,CAAC,eAAe,CAAC,MAAc;QAClC,OAAO,IAAI,CAAC,GAAG,CAAoB,uBAAuB,MAAM,YAAY,CAAC,CAAC;IAChF,CAAC;IAED;;;;;;;;;;;;;OAaG;IACH,KAAK,CAAC,eAAe;QACnB,OAAO,IAAI,CAAC,GAAG,CAA4B,sBAAsB,CAAC,CAAC;IACrE,CAAC;CACF"}
|
package/dist/client/base.d.ts
CHANGED
|
@@ -6,6 +6,7 @@
|
|
|
6
6
|
* - Error handling and response parsing
|
|
7
7
|
* - Common HTTP methods (GET, POST, PUT, PATCH, DELETE)
|
|
8
8
|
*/
|
|
9
|
+
import type { AuthTokenProvider } from '../types';
|
|
9
10
|
/** Error thrown by Voice.ai API client */
|
|
10
11
|
export declare class VoiceAIError extends Error {
|
|
11
12
|
readonly status?: number | undefined;
|
|
@@ -15,7 +16,9 @@ export declare class VoiceAIError extends Error {
|
|
|
15
16
|
}
|
|
16
17
|
/** Configuration for BaseClient */
|
|
17
18
|
export interface BaseClientConfig {
|
|
18
|
-
apiKey
|
|
19
|
+
apiKey?: string;
|
|
20
|
+
authToken?: string;
|
|
21
|
+
getAuthToken?: AuthTokenProvider;
|
|
19
22
|
apiUrl: string;
|
|
20
23
|
}
|
|
21
24
|
/**
|
|
@@ -23,12 +26,15 @@ export interface BaseClientConfig {
|
|
|
23
26
|
*/
|
|
24
27
|
export declare class BaseClient {
|
|
25
28
|
protected readonly apiKey: string;
|
|
29
|
+
protected readonly authToken?: string;
|
|
30
|
+
protected readonly getAuthToken?: AuthTokenProvider;
|
|
26
31
|
protected readonly apiUrl: string;
|
|
27
32
|
constructor(config: BaseClientConfig);
|
|
33
|
+
protected resolveBearerToken(): Promise<string>;
|
|
28
34
|
/**
|
|
29
35
|
* Build headers with authentication
|
|
30
36
|
*/
|
|
31
|
-
protected getHeaders(contentType?: string): Record<string, string
|
|
37
|
+
protected getHeaders(contentType?: string): Promise<Record<string, string>>;
|
|
32
38
|
/**
|
|
33
39
|
* Handle API response and parse errors
|
|
34
40
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/client/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/client/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,iBAAiB,EAAsC,MAAM,UAAU,CAAC;AAEtF,0CAA0C;AAC1C,qBAAa,YAAa,SAAQ,KAAK;aAGnB,MAAM,CAAC,EAAE,MAAM;aACf,IAAI,CAAC,EAAE,MAAM;aACb,MAAM,CAAC,EAAE,MAAM;gBAH/B,OAAO,EAAE,MAAM,EACC,MAAM,CAAC,EAAE,MAAM,YAAA,EACf,IAAI,CAAC,EAAE,MAAM,YAAA,EACb,MAA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EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,CAAC,CAAC;IAe7E;;OAEG;cACa,GAAG,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAU5D;;OAEG;cACa,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC;IAU9D;;OAEG;cACa,UAAU,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC;IASvD;;OAEG;cACa,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,IAAI,CAAC;IA0BpE;;OAEG;cACa,aAAa,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,GAAG,GAAG,OAAO,CAAC,QAAQ,CAAC;CAyB3E"}
|
package/dist/client/base.js
CHANGED
|
@@ -21,15 +21,33 @@ export class VoiceAIError extends Error {
|
|
|
21
21
|
*/
|
|
22
22
|
export class BaseClient {
|
|
23
23
|
constructor(config) {
|
|
24
|
-
this.apiKey = config.apiKey;
|
|
24
|
+
this.apiKey = config.apiKey || '';
|
|
25
|
+
this.authToken = config.authToken;
|
|
26
|
+
this.getAuthToken = config.getAuthToken;
|
|
25
27
|
this.apiUrl = config.apiUrl;
|
|
26
28
|
}
|
|
29
|
+
async resolveBearerToken() {
|
|
30
|
+
if (this.apiKey) {
|
|
31
|
+
return this.apiKey;
|
|
32
|
+
}
|
|
33
|
+
if (this.authToken) {
|
|
34
|
+
return this.authToken;
|
|
35
|
+
}
|
|
36
|
+
if (this.getAuthToken) {
|
|
37
|
+
const resolvedToken = await this.getAuthToken();
|
|
38
|
+
if (typeof resolvedToken === 'string' && resolvedToken.trim()) {
|
|
39
|
+
return resolvedToken;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
throw new VoiceAIError('Authentication required. Configure apiKey, authToken, or getAuthToken.', 401, 'UNAUTHORIZED');
|
|
43
|
+
}
|
|
27
44
|
/**
|
|
28
45
|
* Build headers with authentication
|
|
29
46
|
*/
|
|
30
|
-
getHeaders(contentType = 'application/json') {
|
|
47
|
+
async getHeaders(contentType = 'application/json') {
|
|
48
|
+
const bearerToken = await this.resolveBearerToken();
|
|
31
49
|
const headers = {
|
|
32
|
-
'Authorization': `Bearer ${
|
|
50
|
+
'Authorization': `Bearer ${bearerToken}`,
|
|
33
51
|
};
|
|
34
52
|
if (contentType) {
|
|
35
53
|
headers['Content-Type'] = contentType;
|
|
@@ -59,7 +77,7 @@ export class BaseClient {
|
|
|
59
77
|
}
|
|
60
78
|
// Handle specific error codes
|
|
61
79
|
if (response.status === 401) {
|
|
62
|
-
throw new VoiceAIError('Authentication failed. Please check your API key.', 401, 'UNAUTHORIZED');
|
|
80
|
+
throw new VoiceAIError('Authentication failed. Please check your API key or auth token.', 401, 'UNAUTHORIZED');
|
|
63
81
|
}
|
|
64
82
|
if (response.status === 403) {
|
|
65
83
|
const detail = errorData?.detail || errorData?.error;
|
|
@@ -100,7 +118,7 @@ export class BaseClient {
|
|
|
100
118
|
}
|
|
101
119
|
const response = await fetch(url.toString(), {
|
|
102
120
|
method: 'GET',
|
|
103
|
-
headers: this.getHeaders(),
|
|
121
|
+
headers: await this.getHeaders(),
|
|
104
122
|
});
|
|
105
123
|
return this.handleResponse(response);
|
|
106
124
|
}
|
|
@@ -123,7 +141,7 @@ export class BaseClient {
|
|
|
123
141
|
}
|
|
124
142
|
const response = await fetch(url.toString(), {
|
|
125
143
|
method: 'GET',
|
|
126
|
-
headers: this.getHeaders(),
|
|
144
|
+
headers: await this.getHeaders(),
|
|
127
145
|
});
|
|
128
146
|
if (!response.ok) {
|
|
129
147
|
let errorData = null;
|
|
@@ -143,7 +161,7 @@ export class BaseClient {
|
|
|
143
161
|
async post(path, body) {
|
|
144
162
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
145
163
|
method: 'POST',
|
|
146
|
-
headers: this.getHeaders(),
|
|
164
|
+
headers: await this.getHeaders(),
|
|
147
165
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
148
166
|
});
|
|
149
167
|
return this.handleResponse(response);
|
|
@@ -154,7 +172,7 @@ export class BaseClient {
|
|
|
154
172
|
async postFormData(path, formData) {
|
|
155
173
|
// Don't set Content-Type header - browser will set it with boundary
|
|
156
174
|
const headers = {
|
|
157
|
-
'Authorization': `Bearer ${this.
|
|
175
|
+
'Authorization': `Bearer ${await this.resolveBearerToken()}`,
|
|
158
176
|
};
|
|
159
177
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
160
178
|
method: 'POST',
|
|
@@ -169,7 +187,7 @@ export class BaseClient {
|
|
|
169
187
|
async put(path, body) {
|
|
170
188
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
171
189
|
method: 'PUT',
|
|
172
|
-
headers: this.getHeaders(),
|
|
190
|
+
headers: await this.getHeaders(),
|
|
173
191
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
174
192
|
});
|
|
175
193
|
return this.handleResponse(response);
|
|
@@ -180,7 +198,7 @@ export class BaseClient {
|
|
|
180
198
|
async patch(path, body) {
|
|
181
199
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
182
200
|
method: 'PATCH',
|
|
183
|
-
headers: this.getHeaders(),
|
|
201
|
+
headers: await this.getHeaders(),
|
|
184
202
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
185
203
|
});
|
|
186
204
|
return this.handleResponse(response);
|
|
@@ -191,7 +209,7 @@ export class BaseClient {
|
|
|
191
209
|
async httpDelete(path) {
|
|
192
210
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
193
211
|
method: 'DELETE',
|
|
194
|
-
headers: this.getHeaders(),
|
|
212
|
+
headers: await this.getHeaders(),
|
|
195
213
|
});
|
|
196
214
|
return this.handleResponse(response);
|
|
197
215
|
}
|
|
@@ -201,7 +219,7 @@ export class BaseClient {
|
|
|
201
219
|
async postForBlob(path, body) {
|
|
202
220
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
203
221
|
method: 'POST',
|
|
204
|
-
headers: this.getHeaders(),
|
|
222
|
+
headers: await this.getHeaders(),
|
|
205
223
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
206
224
|
});
|
|
207
225
|
if (!response.ok) {
|
|
@@ -223,7 +241,7 @@ export class BaseClient {
|
|
|
223
241
|
async postForStream(path, body) {
|
|
224
242
|
const response = await fetch(`${this.apiUrl}${path}`, {
|
|
225
243
|
method: 'POST',
|
|
226
|
-
headers: this.getHeaders(),
|
|
244
|
+
headers: await this.getHeaders(),
|
|
227
245
|
body: body !== undefined ? JSON.stringify(body) : undefined,
|
|
228
246
|
});
|
|
229
247
|
if (!response.ok) {
|
package/dist/client/base.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/client/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,0CAA0C;AAC1C,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YACE,OAAe,EACC,MAAe,EACf,IAAa,EACb,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAAM,CAAS;QACf,SAAI,GAAJ,IAAI,CAAS;QACb,WAAM,GAAN,MAAM,CAAS;QAG/B,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;IAC7B,CAAC;CACF;
|
|
1
|
+
{"version":3,"file":"base.js","sourceRoot":"","sources":["../../src/client/base.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,0CAA0C;AAC1C,MAAM,OAAO,YAAa,SAAQ,KAAK;IACrC,YACE,OAAe,EACC,MAAe,EACf,IAAa,EACb,MAAe;QAE/B,KAAK,CAAC,OAAO,CAAC,CAAC;QAJC,WAAM,GAAN,MAA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ACjB,+BAA+B;YAC/B,IAAI,SAAS,GAAyB,IAAI,CAAC;YAC3C,IAAI,CAAC;gBACH,SAAS,GAAG,MAAM,QAAQ,CAAC,IAAI,EAAE,CAAC;YACpC,CAAC;YAAC,MAAM,CAAC;gBACP,WAAW;YACb,CAAC;YAED,MAAM,IAAI,YAAY,CACpB,SAAS,EAAE,KAAK,IAAI,SAAS,EAAE,MAAM,IAAI,8BAA8B,QAAQ,CAAC,MAAM,EAAE,EACxF,QAAQ,CAAC,MAAM,EACf,SAAS,EAAE,IAAI,CAChB,CAAC;QACJ,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;CACF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -7,6 +7,7 @@ export { VoiceAIError } from './base';
|
|
|
7
7
|
export { AgentClient } from './agents';
|
|
8
8
|
export { AnalyticsClient } from './analytics';
|
|
9
9
|
export { KnowledgeBaseClient } from './knowledge-base';
|
|
10
|
+
export { ManagedToolsClient } from './managed-tools';
|
|
10
11
|
export { PhoneNumberClient } from './phone-numbers';
|
|
11
12
|
export { TTSClient } from './tts';
|
|
12
13
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
|
package/dist/client/index.js
CHANGED
|
@@ -7,6 +7,7 @@ export { VoiceAIError } from './base';
|
|
|
7
7
|
export { AgentClient } from './agents';
|
|
8
8
|
export { AnalyticsClient } from './analytics';
|
|
9
9
|
export { KnowledgeBaseClient } from './knowledge-base';
|
|
10
|
+
export { ManagedToolsClient } from './managed-tools';
|
|
10
11
|
export { PhoneNumberClient } from './phone-numbers';
|
|
11
12
|
export { TTSClient } from './tts';
|
|
12
13
|
//# sourceMappingURL=index.js.map
|
package/dist/client/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AACvC,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACpD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { BaseClient, type BaseClientConfig } from './base';
|
|
2
|
+
import type { GoogleConnectionStatus, GoogleOAuthStartOptions, GoogleOAuthStartResponse } from '../types';
|
|
3
|
+
declare class GoogleManagedToolsClient extends BaseClient {
|
|
4
|
+
constructor(config: BaseClientConfig);
|
|
5
|
+
startOAuth(agentId: string, options?: GoogleOAuthStartOptions): Promise<GoogleOAuthStartResponse>;
|
|
6
|
+
getStatus(agentId: string): Promise<GoogleConnectionStatus>;
|
|
7
|
+
disconnect(agentId: string): Promise<{
|
|
8
|
+
disconnected: boolean;
|
|
9
|
+
agent_id: string;
|
|
10
|
+
}>;
|
|
11
|
+
}
|
|
12
|
+
export declare class ManagedToolsClient {
|
|
13
|
+
readonly google: GoogleManagedToolsClient;
|
|
14
|
+
constructor(config: BaseClientConfig);
|
|
15
|
+
}
|
|
16
|
+
export {};
|
|
17
|
+
//# sourceMappingURL=managed-tools.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"managed-tools.d.ts","sourceRoot":"","sources":["../../src/client/managed-tools.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,KAAK,gBAAgB,EAAE,MAAM,QAAQ,CAAC;AAC3D,OAAO,KAAK,EACV,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACzB,MAAM,UAAU,CAAC;AAElB,cAAM,wBAAyB,SAAQ,UAAU;gBACnC,MAAM,EAAE,gBAAgB;IAI9B,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,GAAE,uBAA4B,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAUrG,SAAS,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,sBAAsB,CAAC;IAI3D,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC;QAAE,YAAY,EAAE,OAAO,CAAC;QAAC,QAAQ,EAAE,MAAM,CAAA;KAAE,CAAC;CAGxF;AAED,qBAAa,kBAAkB;IAC7B,SAAgB,MAAM,EAAE,wBAAwB,CAAC;gBAErC,MAAM,EAAE,gBAAgB;CAGrC"}
|