@voice-ai-labs/web-sdk 0.3.0 → 0.4.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 +39 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +298 -14
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +298 -14
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +3 -0
- package/dist/types.d.ts.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -50,6 +50,44 @@ await voiceai.connect({
|
|
|
50
50
|
});
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
+
### Error Handling
|
|
54
|
+
|
|
55
|
+
The `connect()` method throws an `Error` if connection fails. Common error cases:
|
|
56
|
+
|
|
57
|
+
```typescript
|
|
58
|
+
try {
|
|
59
|
+
await voiceai.connect({ agentId: 'agent-123' });
|
|
60
|
+
} catch (error) {
|
|
61
|
+
if (error.message.includes('insufficient_credits')) {
|
|
62
|
+
// User is out of credits
|
|
63
|
+
console.error('Out of credits. Please add more credits to continue.');
|
|
64
|
+
} else if (error.message.includes('Authentication failed')) {
|
|
65
|
+
// Invalid API key
|
|
66
|
+
console.error('Invalid API key');
|
|
67
|
+
} else if (error.message.includes('agent_not_deployed')) {
|
|
68
|
+
// Agent is paused or disabled
|
|
69
|
+
console.error('Agent is not deployed');
|
|
70
|
+
} else {
|
|
71
|
+
console.error('Connection failed:', error.message);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
Errors are also emitted via the `onError` handler and reflected in `onStatusChange`:
|
|
77
|
+
|
|
78
|
+
```typescript
|
|
79
|
+
voiceai.onError((error) => {
|
|
80
|
+
console.error('Error:', error.message);
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
voiceai.onStatusChange((status) => {
|
|
84
|
+
if (status.error) {
|
|
85
|
+
// status.error contains the error message string
|
|
86
|
+
console.error('Connection error:', status.error);
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
53
91
|
### Events
|
|
54
92
|
|
|
55
93
|
```typescript
|
|
@@ -285,8 +323,8 @@ function verifyWebhook(body: string, headers: Headers, secret: string): boolean
|
|
|
285
323
|
|
|
286
324
|
```typescript
|
|
287
325
|
import type {
|
|
326
|
+
WebhookEventType,
|
|
288
327
|
WebhookEventsConfig,
|
|
289
|
-
PublicWebhookEventsConfig,
|
|
290
328
|
WebhooksConfig,
|
|
291
329
|
WebhookEvent,
|
|
292
330
|
WebhookTestResponse,
|
package/dist/index.d.ts
CHANGED
|
@@ -86,10 +86,15 @@ export declare class VoiceAI {
|
|
|
86
86
|
* @param options - Connection options
|
|
87
87
|
* @param options.agentId - ID of the agent to connect to
|
|
88
88
|
* @param options.autoPublishMic - Auto-enable microphone (default: true)
|
|
89
|
+
* @param options.testMode - Test mode to preview paused/undeployed agents (default: false)
|
|
89
90
|
*
|
|
90
91
|
* @example
|
|
91
92
|
* ```typescript
|
|
93
|
+
* // Connect to a deployed agent
|
|
92
94
|
* await voiceai.connect({ agentId: 'agent-123' });
|
|
95
|
+
*
|
|
96
|
+
* // Test a paused agent before deploying
|
|
97
|
+
* await voiceai.connect({ agentId: 'agent-123', testMode: true });
|
|
93
98
|
* ```
|
|
94
99
|
*/
|
|
95
100
|
connect(options: ConnectionOptions): Promise<void>;
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;GAqBG;AAGH,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,mBAAmB,EAAE,MAAM,yBAAyB,CAAC;AAC9D,OAAO,EAAE,iBAAiB,EAAE,MAAM,wB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AAM7C,YAAY,EAEV,aAAa,EAGb,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAGhB,oBAAoB,EACpB,oBAAoB,EAGpB,uBAAuB,EACvB,YAAY,EACZ,iBAAiB,EACjB,iBAAiB,EACjB,sBAAsB,EAGtB,UAAU,EACV,cAAc,EACd,cAAc,EACd,eAAe,EACf,mBAAmB,EAGnB,SAAS,EACT,eAAe,EACf,WAAW,EACX,KAAK,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,kBAAkB,EAClB,mBAAmB,EACnB,6BAA6B,EAC7B,gBAAgB,EAChB,iBAAiB,EACjB,sBAAsB,EACtB,iBAAiB,EAGjB,gBAAgB,EAChB,mBAAmB,EACnB,cAAc,EACd,YAAY,EACZ,mBAAmB,EAGnB,eAAe,EACf,4BAA4B,EAC5B,qBAAqB,EACrB,kBAAkB,EAGlB,qBAAqB,EACrB,0BAA0B,EAC1B,0BAA0B,EAC1B,qBAAqB,EACrB,0BAA0B,EAC1B,8BAA8B,EAG9B,eAAe,EACf,oBAAoB,EACpB,yBAAyB,EACzB,0BAA0B,EAC1B,0BAA0B,EAC1B,2BAA2B,EAC3B,uBAAuB,EAGvB,cAAc,EACd,iBAAiB,EACjB,aAAa,GACd,MAAM,SAAS,CAAC;AAMjB;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,CAAC,EAAE,OAAO,CAAC,mBAAmB,CAAC,GAAG,mBAAmB,CAmBvG;AAMD,OAAO,EAAE,gBAAgB,EAAE,MAAM,+BAA+B,CAAC;AACjE,YAAY,EAAE,uBAAuB,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC"}
|
package/dist/index.esm.js
CHANGED
|
@@ -4130,6 +4130,12 @@ const ParticipantInfo = /* @__PURE__ */proto3.makeMessageType("livekit.Participa
|
|
|
4130
4130
|
kind: "enum",
|
|
4131
4131
|
T: proto3.getEnumType(ParticipantInfo_KindDetail),
|
|
4132
4132
|
repeated: true
|
|
4133
|
+
}, {
|
|
4134
|
+
no: 19,
|
|
4135
|
+
name: "data_tracks",
|
|
4136
|
+
kind: "message",
|
|
4137
|
+
T: DataTrackInfo,
|
|
4138
|
+
repeated: true
|
|
4133
4139
|
}]);
|
|
4134
4140
|
const ParticipantInfo_State = /* @__PURE__ */proto3.makeEnum("livekit.ParticipantInfo.State", [{
|
|
4135
4141
|
no: 0,
|
|
@@ -4162,6 +4168,9 @@ const ParticipantInfo_Kind = /* @__PURE__ */proto3.makeEnum("livekit.Participant
|
|
|
4162
4168
|
}, {
|
|
4163
4169
|
no: 7,
|
|
4164
4170
|
name: "CONNECTOR"
|
|
4171
|
+
}, {
|
|
4172
|
+
no: 8,
|
|
4173
|
+
name: "BRIDGE"
|
|
4165
4174
|
}]);
|
|
4166
4175
|
const ParticipantInfo_KindDetail = /* @__PURE__ */proto3.makeEnum("livekit.ParticipantInfo.KindDetail", [{
|
|
4167
4176
|
no: 0,
|
|
@@ -4169,6 +4178,15 @@ const ParticipantInfo_KindDetail = /* @__PURE__ */proto3.makeEnum("livekit.Parti
|
|
|
4169
4178
|
}, {
|
|
4170
4179
|
no: 1,
|
|
4171
4180
|
name: "FORWARDED"
|
|
4181
|
+
}, {
|
|
4182
|
+
no: 2,
|
|
4183
|
+
name: "CONNECTOR_WHATSAPP"
|
|
4184
|
+
}, {
|
|
4185
|
+
no: 3,
|
|
4186
|
+
name: "CONNECTOR_TWILIO"
|
|
4187
|
+
}, {
|
|
4188
|
+
no: 4,
|
|
4189
|
+
name: "BRIDGE_RTSP"
|
|
4172
4190
|
}]);
|
|
4173
4191
|
const Encryption_Type = /* @__PURE__ */proto3.makeEnum("livekit.Encryption.Type", [{
|
|
4174
4192
|
no: 0,
|
|
@@ -4332,6 +4350,37 @@ const TrackInfo = /* @__PURE__ */proto3.makeMessageType("livekit.TrackInfo", ()
|
|
|
4332
4350
|
kind: "enum",
|
|
4333
4351
|
T: proto3.getEnumType(BackupCodecPolicy$1)
|
|
4334
4352
|
}]);
|
|
4353
|
+
const DataTrackInfo = /* @__PURE__ */proto3.makeMessageType("livekit.DataTrackInfo", () => [{
|
|
4354
|
+
no: 1,
|
|
4355
|
+
name: "pub_handle",
|
|
4356
|
+
kind: "scalar",
|
|
4357
|
+
T: 13
|
|
4358
|
+
/* ScalarType.UINT32 */
|
|
4359
|
+
}, {
|
|
4360
|
+
no: 2,
|
|
4361
|
+
name: "sid",
|
|
4362
|
+
kind: "scalar",
|
|
4363
|
+
T: 9
|
|
4364
|
+
/* ScalarType.STRING */
|
|
4365
|
+
}, {
|
|
4366
|
+
no: 3,
|
|
4367
|
+
name: "name",
|
|
4368
|
+
kind: "scalar",
|
|
4369
|
+
T: 9
|
|
4370
|
+
/* ScalarType.STRING */
|
|
4371
|
+
}, {
|
|
4372
|
+
no: 4,
|
|
4373
|
+
name: "encryption",
|
|
4374
|
+
kind: "enum",
|
|
4375
|
+
T: proto3.getEnumType(Encryption_Type)
|
|
4376
|
+
}]);
|
|
4377
|
+
const DataTrackSubscriptionOptions = /* @__PURE__ */proto3.makeMessageType("livekit.DataTrackSubscriptionOptions", () => [{
|
|
4378
|
+
no: 1,
|
|
4379
|
+
name: "target_fps",
|
|
4380
|
+
kind: "scalar",
|
|
4381
|
+
T: 13,
|
|
4382
|
+
opt: true
|
|
4383
|
+
}]);
|
|
4335
4384
|
const VideoLayer = /* @__PURE__ */proto3.makeMessageType("livekit.VideoLayer", () => [{
|
|
4336
4385
|
no: 1,
|
|
4337
4386
|
name: "quality",
|
|
@@ -4373,6 +4422,12 @@ const VideoLayer = /* @__PURE__ */proto3.makeMessageType("livekit.VideoLayer", (
|
|
|
4373
4422
|
kind: "scalar",
|
|
4374
4423
|
T: 9
|
|
4375
4424
|
/* ScalarType.STRING */
|
|
4425
|
+
}, {
|
|
4426
|
+
no: 8,
|
|
4427
|
+
name: "repair_ssrc",
|
|
4428
|
+
kind: "scalar",
|
|
4429
|
+
T: 13
|
|
4430
|
+
/* ScalarType.UINT32 */
|
|
4376
4431
|
}]);
|
|
4377
4432
|
const VideoLayer_Mode = /* @__PURE__ */proto3.makeEnum("livekit.VideoLayer.Mode", [{
|
|
4378
4433
|
no: 0,
|
|
@@ -5387,6 +5442,24 @@ const SignalRequest = /* @__PURE__ */proto3.makeMessageType("livekit.SignalReque
|
|
|
5387
5442
|
kind: "message",
|
|
5388
5443
|
T: UpdateLocalVideoTrack,
|
|
5389
5444
|
oneof: "message"
|
|
5445
|
+
}, {
|
|
5446
|
+
no: 19,
|
|
5447
|
+
name: "publish_data_track_request",
|
|
5448
|
+
kind: "message",
|
|
5449
|
+
T: PublishDataTrackRequest,
|
|
5450
|
+
oneof: "message"
|
|
5451
|
+
}, {
|
|
5452
|
+
no: 20,
|
|
5453
|
+
name: "unpublish_data_track_request",
|
|
5454
|
+
kind: "message",
|
|
5455
|
+
T: UnpublishDataTrackRequest,
|
|
5456
|
+
oneof: "message"
|
|
5457
|
+
}, {
|
|
5458
|
+
no: 21,
|
|
5459
|
+
name: "update_data_subscription",
|
|
5460
|
+
kind: "message",
|
|
5461
|
+
T: UpdateDataSubscription,
|
|
5462
|
+
oneof: "message"
|
|
5390
5463
|
}]);
|
|
5391
5464
|
const SignalResponse = /* @__PURE__ */proto3.makeMessageType("livekit.SignalResponse", () => [{
|
|
5392
5465
|
no: 1,
|
|
@@ -5538,6 +5611,24 @@ const SignalResponse = /* @__PURE__ */proto3.makeMessageType("livekit.SignalResp
|
|
|
5538
5611
|
kind: "message",
|
|
5539
5612
|
T: SubscribedAudioCodecUpdate,
|
|
5540
5613
|
oneof: "message"
|
|
5614
|
+
}, {
|
|
5615
|
+
no: 27,
|
|
5616
|
+
name: "publish_data_track_response",
|
|
5617
|
+
kind: "message",
|
|
5618
|
+
T: PublishDataTrackResponse,
|
|
5619
|
+
oneof: "message"
|
|
5620
|
+
}, {
|
|
5621
|
+
no: 28,
|
|
5622
|
+
name: "unpublish_data_track_response",
|
|
5623
|
+
kind: "message",
|
|
5624
|
+
T: UnpublishDataTrackResponse,
|
|
5625
|
+
oneof: "message"
|
|
5626
|
+
}, {
|
|
5627
|
+
no: 29,
|
|
5628
|
+
name: "data_track_subscriber_handles",
|
|
5629
|
+
kind: "message",
|
|
5630
|
+
T: DataTrackSubscriberHandles,
|
|
5631
|
+
oneof: "message"
|
|
5541
5632
|
}]);
|
|
5542
5633
|
const SimulcastCodec = /* @__PURE__ */proto3.makeMessageType("livekit.SimulcastCodec", () => [{
|
|
5543
5634
|
no: 1,
|
|
@@ -5662,6 +5753,74 @@ const AddTrackRequest = /* @__PURE__ */proto3.makeMessageType("livekit.AddTrackR
|
|
|
5662
5753
|
T: proto3.getEnumType(AudioTrackFeature),
|
|
5663
5754
|
repeated: true
|
|
5664
5755
|
}]);
|
|
5756
|
+
const PublishDataTrackRequest = /* @__PURE__ */proto3.makeMessageType("livekit.PublishDataTrackRequest", () => [{
|
|
5757
|
+
no: 1,
|
|
5758
|
+
name: "pub_handle",
|
|
5759
|
+
kind: "scalar",
|
|
5760
|
+
T: 13
|
|
5761
|
+
/* ScalarType.UINT32 */
|
|
5762
|
+
}, {
|
|
5763
|
+
no: 2,
|
|
5764
|
+
name: "name",
|
|
5765
|
+
kind: "scalar",
|
|
5766
|
+
T: 9
|
|
5767
|
+
/* ScalarType.STRING */
|
|
5768
|
+
}, {
|
|
5769
|
+
no: 3,
|
|
5770
|
+
name: "encryption",
|
|
5771
|
+
kind: "enum",
|
|
5772
|
+
T: proto3.getEnumType(Encryption_Type)
|
|
5773
|
+
}]);
|
|
5774
|
+
const PublishDataTrackResponse = /* @__PURE__ */proto3.makeMessageType("livekit.PublishDataTrackResponse", () => [{
|
|
5775
|
+
no: 1,
|
|
5776
|
+
name: "info",
|
|
5777
|
+
kind: "message",
|
|
5778
|
+
T: DataTrackInfo
|
|
5779
|
+
}]);
|
|
5780
|
+
const UnpublishDataTrackRequest = /* @__PURE__ */proto3.makeMessageType("livekit.UnpublishDataTrackRequest", () => [{
|
|
5781
|
+
no: 1,
|
|
5782
|
+
name: "pub_handle",
|
|
5783
|
+
kind: "scalar",
|
|
5784
|
+
T: 13
|
|
5785
|
+
/* ScalarType.UINT32 */
|
|
5786
|
+
}]);
|
|
5787
|
+
const UnpublishDataTrackResponse = /* @__PURE__ */proto3.makeMessageType("livekit.UnpublishDataTrackResponse", () => [{
|
|
5788
|
+
no: 1,
|
|
5789
|
+
name: "info",
|
|
5790
|
+
kind: "message",
|
|
5791
|
+
T: DataTrackInfo
|
|
5792
|
+
}]);
|
|
5793
|
+
const DataTrackSubscriberHandles = /* @__PURE__ */proto3.makeMessageType("livekit.DataTrackSubscriberHandles", () => [{
|
|
5794
|
+
no: 1,
|
|
5795
|
+
name: "sub_handles",
|
|
5796
|
+
kind: "map",
|
|
5797
|
+
K: 13,
|
|
5798
|
+
V: {
|
|
5799
|
+
kind: "message",
|
|
5800
|
+
T: DataTrackSubscriberHandles_PublishedDataTrack
|
|
5801
|
+
}
|
|
5802
|
+
}]);
|
|
5803
|
+
const DataTrackSubscriberHandles_PublishedDataTrack = /* @__PURE__ */proto3.makeMessageType("livekit.DataTrackSubscriberHandles.PublishedDataTrack", () => [{
|
|
5804
|
+
no: 1,
|
|
5805
|
+
name: "publisher_identity",
|
|
5806
|
+
kind: "scalar",
|
|
5807
|
+
T: 9
|
|
5808
|
+
/* ScalarType.STRING */
|
|
5809
|
+
}, {
|
|
5810
|
+
no: 2,
|
|
5811
|
+
name: "publisher_sid",
|
|
5812
|
+
kind: "scalar",
|
|
5813
|
+
T: 9
|
|
5814
|
+
/* ScalarType.STRING */
|
|
5815
|
+
}, {
|
|
5816
|
+
no: 3,
|
|
5817
|
+
name: "track_sid",
|
|
5818
|
+
kind: "scalar",
|
|
5819
|
+
T: 9
|
|
5820
|
+
/* ScalarType.STRING */
|
|
5821
|
+
}], {
|
|
5822
|
+
localName: "DataTrackSubscriberHandles_PublishedDataTrack"
|
|
5823
|
+
});
|
|
5665
5824
|
const TrickleRequest = /* @__PURE__ */proto3.makeMessageType("livekit.TrickleRequest", () => [{
|
|
5666
5825
|
no: 1,
|
|
5667
5826
|
name: "candidateInit",
|
|
@@ -5877,6 +6036,33 @@ const UpdateSubscription = /* @__PURE__ */proto3.makeMessageType("livekit.Update
|
|
|
5877
6036
|
T: ParticipantTracks,
|
|
5878
6037
|
repeated: true
|
|
5879
6038
|
}]);
|
|
6039
|
+
const UpdateDataSubscription = /* @__PURE__ */proto3.makeMessageType("livekit.UpdateDataSubscription", () => [{
|
|
6040
|
+
no: 1,
|
|
6041
|
+
name: "updates",
|
|
6042
|
+
kind: "message",
|
|
6043
|
+
T: UpdateDataSubscription_Update,
|
|
6044
|
+
repeated: true
|
|
6045
|
+
}]);
|
|
6046
|
+
const UpdateDataSubscription_Update = /* @__PURE__ */proto3.makeMessageType("livekit.UpdateDataSubscription.Update", () => [{
|
|
6047
|
+
no: 1,
|
|
6048
|
+
name: "track_sid",
|
|
6049
|
+
kind: "scalar",
|
|
6050
|
+
T: 9
|
|
6051
|
+
/* ScalarType.STRING */
|
|
6052
|
+
}, {
|
|
6053
|
+
no: 2,
|
|
6054
|
+
name: "subscribe",
|
|
6055
|
+
kind: "scalar",
|
|
6056
|
+
T: 8
|
|
6057
|
+
/* ScalarType.BOOL */
|
|
6058
|
+
}, {
|
|
6059
|
+
no: 3,
|
|
6060
|
+
name: "options",
|
|
6061
|
+
kind: "message",
|
|
6062
|
+
T: DataTrackSubscriptionOptions
|
|
6063
|
+
}], {
|
|
6064
|
+
localName: "UpdateDataSubscription_Update"
|
|
6065
|
+
});
|
|
5880
6066
|
const UpdateTrackSettings = /* @__PURE__ */proto3.makeMessageType("livekit.UpdateTrackSettings", () => [{
|
|
5881
6067
|
no: 1,
|
|
5882
6068
|
name: "track_sids",
|
|
@@ -6283,6 +6469,12 @@ const SyncState = /* @__PURE__ */proto3.makeMessageType("livekit.SyncState", ()
|
|
|
6283
6469
|
kind: "message",
|
|
6284
6470
|
T: DataChannelReceiveState,
|
|
6285
6471
|
repeated: true
|
|
6472
|
+
}, {
|
|
6473
|
+
no: 8,
|
|
6474
|
+
name: "publish_data_tracks",
|
|
6475
|
+
kind: "message",
|
|
6476
|
+
T: PublishDataTrackResponse,
|
|
6477
|
+
repeated: true
|
|
6286
6478
|
}]);
|
|
6287
6479
|
const DataChannelReceiveState = /* @__PURE__ */proto3.makeMessageType("livekit.DataChannelReceiveState", () => [{
|
|
6288
6480
|
no: 1,
|
|
@@ -6487,6 +6679,18 @@ const RequestResponse = /* @__PURE__ */proto3.makeMessageType("livekit.RequestRe
|
|
|
6487
6679
|
kind: "message",
|
|
6488
6680
|
T: UpdateLocalVideoTrack,
|
|
6489
6681
|
oneof: "request"
|
|
6682
|
+
}, {
|
|
6683
|
+
no: 10,
|
|
6684
|
+
name: "publish_data_track",
|
|
6685
|
+
kind: "message",
|
|
6686
|
+
T: PublishDataTrackRequest,
|
|
6687
|
+
oneof: "request"
|
|
6688
|
+
}, {
|
|
6689
|
+
no: 11,
|
|
6690
|
+
name: "unpublish_data_track",
|
|
6691
|
+
kind: "message",
|
|
6692
|
+
T: UnpublishDataTrackRequest,
|
|
6693
|
+
oneof: "request"
|
|
6490
6694
|
}]);
|
|
6491
6695
|
const RequestResponse_Reason = /* @__PURE__ */proto3.makeEnum("livekit.RequestResponse.Reason", [{
|
|
6492
6696
|
no: 0,
|
|
@@ -6509,6 +6713,18 @@ const RequestResponse_Reason = /* @__PURE__ */proto3.makeEnum("livekit.RequestRe
|
|
|
6509
6713
|
}, {
|
|
6510
6714
|
no: 6,
|
|
6511
6715
|
name: "UNCLASSIFIED_ERROR"
|
|
6716
|
+
}, {
|
|
6717
|
+
no: 7,
|
|
6718
|
+
name: "INVALID_HANDLE"
|
|
6719
|
+
}, {
|
|
6720
|
+
no: 8,
|
|
6721
|
+
name: "INVALID_NAME"
|
|
6722
|
+
}, {
|
|
6723
|
+
no: 9,
|
|
6724
|
+
name: "DUPLICATE_HANDLE"
|
|
6725
|
+
}, {
|
|
6726
|
+
no: 10,
|
|
6727
|
+
name: "DUPLICATE_NAME"
|
|
6512
6728
|
}]);
|
|
6513
6729
|
const TrackSubscribed = /* @__PURE__ */proto3.makeMessageType("livekit.TrackSubscribed", () => [{
|
|
6514
6730
|
no: 1,
|
|
@@ -6541,6 +6757,12 @@ const ConnectionSettings = /* @__PURE__ */proto3.makeMessageType("livekit.Connec
|
|
|
6541
6757
|
kind: "scalar",
|
|
6542
6758
|
T: 8
|
|
6543
6759
|
/* ScalarType.BOOL */
|
|
6760
|
+
}, {
|
|
6761
|
+
no: 5,
|
|
6762
|
+
name: "auto_subscribe_data_track",
|
|
6763
|
+
kind: "scalar",
|
|
6764
|
+
T: 8,
|
|
6765
|
+
opt: true
|
|
6544
6766
|
}]);
|
|
6545
6767
|
const JoinRequest = /* @__PURE__ */proto3.makeMessageType("livekit.JoinRequest", () => [{
|
|
6546
6768
|
no: 1,
|
|
@@ -10391,7 +10613,8 @@ function adapterFactory() {
|
|
|
10391
10613
|
|
|
10392
10614
|
adapterFactory({
|
|
10393
10615
|
window: typeof window === 'undefined' ? undefined : window
|
|
10394
|
-
});
|
|
10616
|
+
});var _a, _b;
|
|
10617
|
+
class TypedPromise extends (_b = Promise) {
|
|
10395
10618
|
// eslint-disable-next-line @typescript-eslint/no-useless-constructor
|
|
10396
10619
|
constructor(executor) {
|
|
10397
10620
|
super(executor);
|
|
@@ -10408,7 +10631,11 @@ adapterFactory({
|
|
|
10408
10631
|
static race(values) {
|
|
10409
10632
|
return super.race(values);
|
|
10410
10633
|
}
|
|
10411
|
-
}
|
|
10634
|
+
}
|
|
10635
|
+
_a = TypedPromise;
|
|
10636
|
+
TypedPromise.resolve = value => {
|
|
10637
|
+
return Reflect.get(_b, "resolve", _a).call(_a, value);
|
|
10638
|
+
};// tiny, simplified version of https://github.com/lancedikson/bowser/blob/master/src/parser-browsers.js
|
|
10412
10639
|
// reduced to only differentiate Chrome(ium) based browsers / Firefox / Safari
|
|
10413
10640
|
const commonVersionIdentifier = /version\/(\d+(\.?_?\d+)+)/i;
|
|
10414
10641
|
let browserDetails;
|
|
@@ -10474,14 +10701,23 @@ function getMatch(exp, ua) {
|
|
|
10474
10701
|
}
|
|
10475
10702
|
function getOSVersion(ua) {
|
|
10476
10703
|
return ua.includes('mac os') ? getMatch(/\(.+?(\d+_\d+(:?_\d+)?)/, ua, 1).replace(/_/g, '.') : undefined;
|
|
10477
|
-
}var version$1 = "2.17.
|
|
10478
|
-
const protocolVersion = 16
|
|
10479
|
-
|
|
10480
|
-
|
|
10704
|
+
}var version$1 = "2.17.1";const version = version$1;
|
|
10705
|
+
const protocolVersion = 16;/** Base error that all LiveKit specific custom errors inherit from. */
|
|
10706
|
+
class LivekitError extends Error {
|
|
10707
|
+
constructor(code, message, options) {
|
|
10708
|
+
super(message || 'an error has occurred');
|
|
10481
10709
|
this.name = 'LiveKitError';
|
|
10482
10710
|
this.code = code;
|
|
10711
|
+
if (typeof (options === null || options === void 0 ? void 0 : options.cause) !== 'undefined') {
|
|
10712
|
+
this.cause = options === null || options === void 0 ? void 0 : options.cause;
|
|
10713
|
+
}
|
|
10483
10714
|
}
|
|
10484
10715
|
}
|
|
10716
|
+
/**
|
|
10717
|
+
* LiveKit specific error type representing an error with an associated set of reasons.
|
|
10718
|
+
* Use this to represent an error with multiple different but contextually related variants.
|
|
10719
|
+
* */
|
|
10720
|
+
class LivekitReasonedError extends LivekitError {}
|
|
10485
10721
|
var ConnectionErrorReason;
|
|
10486
10722
|
(function (ConnectionErrorReason) {
|
|
10487
10723
|
ConnectionErrorReason[ConnectionErrorReason["NotAllowed"] = 0] = "NotAllowed";
|
|
@@ -10493,7 +10729,7 @@ var ConnectionErrorReason;
|
|
|
10493
10729
|
ConnectionErrorReason[ConnectionErrorReason["WebSocket"] = 6] = "WebSocket";
|
|
10494
10730
|
ConnectionErrorReason[ConnectionErrorReason["ServiceNotFound"] = 7] = "ServiceNotFound";
|
|
10495
10731
|
})(ConnectionErrorReason || (ConnectionErrorReason = {}));
|
|
10496
|
-
class ConnectionError extends
|
|
10732
|
+
class ConnectionError extends LivekitReasonedError {
|
|
10497
10733
|
constructor(message, reason, status, context) {
|
|
10498
10734
|
super(1, message);
|
|
10499
10735
|
this.name = 'ConnectionError';
|
|
@@ -10564,7 +10800,7 @@ class PublishTrackError extends LivekitError {
|
|
|
10564
10800
|
this.status = status;
|
|
10565
10801
|
}
|
|
10566
10802
|
}
|
|
10567
|
-
class SignalRequestError extends
|
|
10803
|
+
class SignalRequestError extends LivekitReasonedError {
|
|
10568
10804
|
constructor(message, reason) {
|
|
10569
10805
|
super(15, message);
|
|
10570
10806
|
this.name = 'SignalRequestError';
|
|
@@ -10590,7 +10826,7 @@ var DataStreamErrorReason;
|
|
|
10590
10826
|
// Encryption type mismatch.
|
|
10591
10827
|
DataStreamErrorReason[DataStreamErrorReason["EncryptionTypeMismatch"] = 8] = "EncryptionTypeMismatch";
|
|
10592
10828
|
})(DataStreamErrorReason || (DataStreamErrorReason = {}));
|
|
10593
|
-
class DataStreamError extends
|
|
10829
|
+
class DataStreamError extends LivekitReasonedError {
|
|
10594
10830
|
constructor(message, reason) {
|
|
10595
10831
|
super(16, message);
|
|
10596
10832
|
this.name = 'DataStreamError';
|
|
@@ -20117,7 +20353,8 @@ class TextStreamReader extends BaseStreamReader {
|
|
|
20117
20353
|
topic: streamHeader.topic,
|
|
20118
20354
|
timestamp: Number(streamHeader.timestamp),
|
|
20119
20355
|
attributes: streamHeader.attributes,
|
|
20120
|
-
encryptionType
|
|
20356
|
+
encryptionType,
|
|
20357
|
+
attachedStreamIds: streamHeader.contentHeader.value.attachedStreamIds
|
|
20121
20358
|
};
|
|
20122
20359
|
const stream = new ReadableStream({
|
|
20123
20360
|
start: controller => {
|
|
@@ -20270,7 +20507,8 @@ class OutgoingDataStreamManager {
|
|
|
20270
20507
|
topic: (_b = options === null || options === void 0 ? void 0 : options.topic) !== null && _b !== void 0 ? _b : '',
|
|
20271
20508
|
size: options === null || options === void 0 ? void 0 : options.totalSize,
|
|
20272
20509
|
attributes: options === null || options === void 0 ? void 0 : options.attributes,
|
|
20273
|
-
encryptionType: ((_c = this.engine.e2eeManager) === null || _c === void 0 ? void 0 : _c.isDataChannelEncryptionEnabled) ? Encryption_Type.GCM : Encryption_Type.NONE
|
|
20510
|
+
encryptionType: ((_c = this.engine.e2eeManager) === null || _c === void 0 ? void 0 : _c.isDataChannelEncryptionEnabled) ? Encryption_Type.GCM : Encryption_Type.NONE,
|
|
20511
|
+
attachedStreamIds: options === null || options === void 0 ? void 0 : options.attachedStreamIds
|
|
20274
20512
|
};
|
|
20275
20513
|
const header = new DataStream_Header({
|
|
20276
20514
|
streamId,
|
|
@@ -20283,7 +20521,7 @@ class OutgoingDataStreamManager {
|
|
|
20283
20521
|
case: 'textHeader',
|
|
20284
20522
|
value: new DataStream_TextHeader({
|
|
20285
20523
|
version: options === null || options === void 0 ? void 0 : options.version,
|
|
20286
|
-
attachedStreamIds:
|
|
20524
|
+
attachedStreamIds: info.attachedStreamIds,
|
|
20287
20525
|
replyToStreamId: options === null || options === void 0 ? void 0 : options.replyToStreamId,
|
|
20288
20526
|
operationType: (options === null || options === void 0 ? void 0 : options.type) === 'update' ? DataStream_OperationType.UPDATE : DataStream_OperationType.CREATE
|
|
20289
20527
|
})
|
|
@@ -26893,7 +27131,44 @@ class JWSSignatureVerificationFailed extends JOSEError {
|
|
|
26893
27131
|
_defineProperty(this, "code", 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED');
|
|
26894
27132
|
}
|
|
26895
27133
|
}
|
|
26896
|
-
_defineProperty(JWSSignatureVerificationFailed, "code", 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED');
|
|
27134
|
+
_defineProperty(JWSSignatureVerificationFailed, "code", 'ERR_JWS_SIGNATURE_VERIFICATION_FAILED');var DataTrackHandleErrorReason;
|
|
27135
|
+
(function (DataTrackHandleErrorReason) {
|
|
27136
|
+
DataTrackHandleErrorReason[DataTrackHandleErrorReason["Reserved"] = 0] = "Reserved";
|
|
27137
|
+
DataTrackHandleErrorReason[DataTrackHandleErrorReason["TooLarge"] = 1] = "TooLarge";
|
|
27138
|
+
})(DataTrackHandleErrorReason || (DataTrackHandleErrorReason = {}));
|
|
27139
|
+
var DataTrackDeserializeErrorReason;
|
|
27140
|
+
(function (DataTrackDeserializeErrorReason) {
|
|
27141
|
+
DataTrackDeserializeErrorReason[DataTrackDeserializeErrorReason["TooShort"] = 0] = "TooShort";
|
|
27142
|
+
DataTrackDeserializeErrorReason[DataTrackDeserializeErrorReason["HeaderOverrun"] = 1] = "HeaderOverrun";
|
|
27143
|
+
DataTrackDeserializeErrorReason[DataTrackDeserializeErrorReason["MissingExtWords"] = 2] = "MissingExtWords";
|
|
27144
|
+
DataTrackDeserializeErrorReason[DataTrackDeserializeErrorReason["UnsupportedVersion"] = 3] = "UnsupportedVersion";
|
|
27145
|
+
DataTrackDeserializeErrorReason[DataTrackDeserializeErrorReason["InvalidHandle"] = 4] = "InvalidHandle";
|
|
27146
|
+
DataTrackDeserializeErrorReason[DataTrackDeserializeErrorReason["MalformedExt"] = 5] = "MalformedExt";
|
|
27147
|
+
})(DataTrackDeserializeErrorReason || (DataTrackDeserializeErrorReason = {}));
|
|
27148
|
+
var DataTrackSerializeErrorReason;
|
|
27149
|
+
(function (DataTrackSerializeErrorReason) {
|
|
27150
|
+
DataTrackSerializeErrorReason[DataTrackSerializeErrorReason["TooSmallForHeader"] = 0] = "TooSmallForHeader";
|
|
27151
|
+
DataTrackSerializeErrorReason[DataTrackSerializeErrorReason["TooSmallForPayload"] = 1] = "TooSmallForPayload";
|
|
27152
|
+
})(DataTrackSerializeErrorReason || (DataTrackSerializeErrorReason = {}));
|
|
27153
|
+
var DataTrackExtensionTag;
|
|
27154
|
+
(function (DataTrackExtensionTag) {
|
|
27155
|
+
DataTrackExtensionTag[DataTrackExtensionTag["UserTimestamp"] = 2] = "UserTimestamp";
|
|
27156
|
+
DataTrackExtensionTag[DataTrackExtensionTag["E2ee"] = 1] = "E2ee";
|
|
27157
|
+
})(DataTrackExtensionTag || (DataTrackExtensionTag = {}));
|
|
27158
|
+
DataTrackExtensionTag.UserTimestamp;
|
|
27159
|
+
DataTrackExtensionTag.E2ee;
|
|
27160
|
+
/** Marker indicating a packet's position in relation to a frame. */
|
|
27161
|
+
var FrameMarker;
|
|
27162
|
+
(function (FrameMarker) {
|
|
27163
|
+
/** Packet is the first in a frame. */
|
|
27164
|
+
FrameMarker[FrameMarker["Start"] = 0] = "Start";
|
|
27165
|
+
/** Packet is within a frame. */
|
|
27166
|
+
FrameMarker[FrameMarker["Inter"] = 1] = "Inter";
|
|
27167
|
+
/** Packet is the last in a frame. */
|
|
27168
|
+
FrameMarker[FrameMarker["Final"] = 2] = "Final";
|
|
27169
|
+
/** Packet is the only one in a frame. */
|
|
27170
|
+
FrameMarker[FrameMarker["Single"] = 3] = "Single";
|
|
27171
|
+
})(FrameMarker || (FrameMarker = {}));
|
|
26897
27172
|
|
|
26898
27173
|
/**
|
|
26899
27174
|
* Base HTTP Client for Voice.ai API
|
|
@@ -28198,10 +28473,15 @@ class VoiceAI {
|
|
|
28198
28473
|
* @param options - Connection options
|
|
28199
28474
|
* @param options.agentId - ID of the agent to connect to
|
|
28200
28475
|
* @param options.autoPublishMic - Auto-enable microphone (default: true)
|
|
28476
|
+
* @param options.testMode - Test mode to preview paused/undeployed agents (default: false)
|
|
28201
28477
|
*
|
|
28202
28478
|
* @example
|
|
28203
28479
|
* ```typescript
|
|
28480
|
+
* // Connect to a deployed agent
|
|
28204
28481
|
* await voiceai.connect({ agentId: 'agent-123' });
|
|
28482
|
+
*
|
|
28483
|
+
* // Test a paused agent before deploying
|
|
28484
|
+
* await voiceai.connect({ agentId: 'agent-123', testMode: true });
|
|
28205
28485
|
* ```
|
|
28206
28486
|
*/
|
|
28207
28487
|
async connect(options) {
|
|
@@ -28427,7 +28707,11 @@ class VoiceAI {
|
|
|
28427
28707
|
}
|
|
28428
28708
|
async getConnectionDetails(options) {
|
|
28429
28709
|
const url = options.apiUrl || this.apiUrl;
|
|
28430
|
-
|
|
28710
|
+
// Use test-connection-details for testMode (allows testing paused/undeployed agents)
|
|
28711
|
+
const endpointPath = options.testMode
|
|
28712
|
+
? '/connection/test-connection-details'
|
|
28713
|
+
: '/connection/connection-details';
|
|
28714
|
+
const endpoint = `${url}${endpointPath}`;
|
|
28431
28715
|
const requestData = {};
|
|
28432
28716
|
if (options.agentId)
|
|
28433
28717
|
requestData.agent_id = options.agentId;
|