@amigo-ai/platform-sdk 0.91.0 → 0.93.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (38) hide show
  1. package/README.md +26 -8
  2. package/api.md +2 -24
  3. package/dist/index.cjs +17 -139
  4. package/dist/index.cjs.map +3 -3
  5. package/dist/index.js +0 -3
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +17 -139
  8. package/dist/index.mjs.map +3 -3
  9. package/dist/resources/conversations.js +15 -0
  10. package/dist/resources/conversations.js.map +1 -1
  11. package/dist/types/generated/api.d.ts +99 -1334
  12. package/dist/types/generated/api.d.ts.map +1 -1
  13. package/dist/types/index.d.cts +1 -3
  14. package/dist/types/index.d.cts.map +1 -1
  15. package/dist/types/index.d.ts +1 -3
  16. package/dist/types/index.d.ts.map +1 -1
  17. package/dist/types/resources/context-graphs.d.ts +12 -36
  18. package/dist/types/resources/context-graphs.d.ts.map +1 -1
  19. package/dist/types/resources/conversations.d.ts +10 -0
  20. package/dist/types/resources/conversations.d.ts.map +1 -1
  21. package/dist/types/resources/external-integrations.d.ts.map +1 -1
  22. package/dist/types/resources/intake.d.ts.map +1 -1
  23. package/dist/types/resources/integrations.d.ts.map +1 -1
  24. package/dist/types/resources/metrics.d.ts.map +1 -1
  25. package/dist/types/resources/operators.d.ts.map +1 -1
  26. package/dist/types/resources/services.d.ts +0 -120
  27. package/dist/types/resources/services.d.ts.map +1 -1
  28. package/dist/types/resources/settings.d.ts +0 -2
  29. package/dist/types/resources/settings.d.ts.map +1 -1
  30. package/dist/types/resources/simulations.d.ts +20 -0
  31. package/dist/types/resources/simulations.d.ts.map +1 -1
  32. package/dist/types/resources/surfaces.d.ts.map +1 -1
  33. package/dist/types/resources/world.d.ts.map +1 -1
  34. package/package.json +1 -1
  35. package/dist/resources/review-queue.js +0 -103
  36. package/dist/resources/review-queue.js.map +0 -1
  37. package/dist/types/resources/review-queue.d.ts +0 -545
  38. package/dist/types/resources/review-queue.d.ts.map +0 -1
package/README.md CHANGED
@@ -578,23 +578,41 @@ const benchmarks = await client.calls.getBenchmarks({ days: 30 })
578
578
 
579
579
  ### Text conversations
580
580
 
581
- Use `client.conversations.sendMessage()` for user-first synchronous text turns. Omit
582
- `conversation_id` to start a new durable conversation; pass the returned ID to resume it.
581
+ Use `client.conversations.create()` to start a new durable conversation, then
582
+ `client.conversations.createTurn()` for user-first synchronous text turns (or
583
+ `streamTurn()` for a typed SSE event stream).
583
584
 
584
585
  ```typescript
585
- const firstTurn = await client.conversations.sendMessage({
586
+ const conversation = await client.conversations.create({
586
587
  service_id: 'service-id',
587
- message: 'Hello, I need help scheduling',
588
588
  entity_id: 'entity-id',
589
589
  })
590
590
 
591
- const nextTurn = await client.conversations.sendMessage({
592
- service_id: 'service-id',
593
- conversation_id: firstTurn.conversation_id,
591
+ const firstTurn = await client.conversations.createTurn(conversation.id, {
592
+ message: 'Hello, I need help scheduling',
593
+ })
594
+
595
+ const nextTurn = await client.conversations.createTurn(conversation.id, {
594
596
  message: 'Tuesday morning works',
595
597
  })
596
598
 
597
- console.log(nextTurn.messages.map((message) => message.text))
599
+ console.log(nextTurn.output.map((message) => message.text))
600
+ ```
601
+
602
+ Move an active conversation to a different channel (e.g. hand off web chat to
603
+ iMessage/SMS) with `switchChannel()`; close it with `close()` so the customer
604
+ can start fresh on the next inbound message:
605
+
606
+ ```typescript
607
+ await client.conversations.switchChannel(conversation.id, {
608
+ channel: 'imessage',
609
+ reason: 'customer_request',
610
+ recipient: '+15555550123', // required for sms/imessage
611
+ use_case_id: 'use-case-id', // required for sms/imessage
612
+ dispatch_opener: true,
613
+ })
614
+
615
+ await client.conversations.close(conversation.id)
598
616
  ```
599
617
 
600
618
  For real-time browser clients, build the text-stream URL and use WebSocket
package/api.md CHANGED
@@ -52,7 +52,7 @@ Notes:
52
52
  - Webhooks: `verifyWebhookSignature`, `parseWebhookEvent`, `WebhookVerificationError`
53
53
  - Pagination and response helpers: `paginate`, `buildLastResponse`, `extractRequestId`
54
54
  - Conversation helpers: `sessionConnectAuthProtocols`, `textStreamAuthProtocols`
55
- - Conversation types: `ConversationDetail`, `ConversationListResponse`, `ConversationSummary`, `ConversationTurn`, `ConversationTurnAvailableAction`, `ConversationTurnStateTransition`, `CreateConversationRequest`, `ListConversationsParams`, `SessionConnectUrlParams`, `TextStreamAuthProtocols` (WebSocket constructor subprotocol tuple), `TextStreamUrlParams`, `TurnDoneEvent`, `TurnErrorEvent`, `TurnMessageEvent`, `TurnRequest`, `TurnResponse`, `TurnConversationSnapshot`, `TurnStreamEvent`, `TurnThinkingEvent`, `TurnTokenEvent`, `TurnToolCallCompletedEvent`, `TurnToolCallStartedEvent`
55
+ - Conversation types: `ChannelKind`, `ConversationDetail`, `ConversationListResponse`, `ConversationSummary`, `ConversationTurn`, `ConversationTurnAvailableAction`, `ConversationTurnStateTransition`, `CreateConversationRequest`, `ListConversationsParams`, `SessionConnectUrlParams`, `SwitchChannelRequest`, `TextStreamAuthProtocols` (WebSocket constructor subprotocol tuple), `TextStreamUrlParams`, `TurnDoneEvent`, `TurnErrorEvent`, `TurnMessageEvent`, `TurnRequest`, `TurnResponse`, `TurnConversationSnapshot`, `TurnStreamEvent`, `TurnThinkingEvent`, `TurnTokenEvent`, `TurnToolCallCompletedEvent`, `TurnToolCallStartedEvent`
56
56
  - Voice provider constants: `STT_PROVIDERS`, `TTS_PROVIDERS`, `VOICE_SESSION_PROVIDERS`
57
57
  - Voice provider types: `AgentVoiceConfig`, `ServiceVoiceConfigInput`, `ServiceVoiceConfigOutput`, `SttProvider`, `TtsProvider`, `VoiceSessionProvider`, `VoiceSettingsRequest`, `VoiceSettingsResponse`
58
58
  - Response and hook types: `PaginatedList`, `ListParams`, `LastResponseInfo`, `ResponseMetadata`, `WithResponseMetadata`, `AmigoResponse`, `RetryOptions`, `RateLimitInfo`, `ClientHooks`, `RequestHookContext`, `ResponseHookContext`, `ErrorHookContext`
@@ -270,6 +270,7 @@ All workspace-scoped resources also expose `withOptions(options)`.
270
270
  - `create`
271
271
  - `get`
272
272
  - `close`
273
+ - `switchChannel`
273
274
  - `createTurn`
274
275
  - `pollTurn`
275
276
  - `createTurnStream`
@@ -383,29 +384,6 @@ All workspace-scoped resources also expose `withOptions(options)`.
383
384
  - `getInvoice`
384
385
  - `getInvoicePdf`
385
386
 
386
- ### `reviewQueue`
387
-
388
- - `list`
389
- - `listAutoPaging`
390
- - `get`
391
- - `getStats`
392
- - `getDashboard`
393
- - `getMyQueue`
394
- - `getMyQueueAutoPaging`
395
- - `approve`
396
- - `reject`
397
- - `claim`
398
- - `unclaim`
399
- - `correct`
400
- - `batchApprove`
401
- - `batchReject`
402
- - `getHistory`
403
- - `getHistoryAutoPaging`
404
- - `getTrends`
405
- - `getPerformance`
406
- - `getCorrectionSchema`
407
- - `getDiff`
408
-
409
387
  ### `recordings`
410
388
 
411
389
  - `getUrls`
package/dist/index.cjs CHANGED
@@ -2412,6 +2412,23 @@ var ConversationsResource = class extends WorkspaceScopedResource {
2412
2412
  }
2413
2413
  });
2414
2414
  }
2415
+ /**
2416
+ * Move a conversation to a different channel (e.g. web → sms/imessage).
2417
+ *
2418
+ * `recipient` (E.164) is required when switching to sms/imessage. Pass
2419
+ * `dispatch_opener: true` to have the agent immediately send one turn on
2420
+ * the new channel, optionally steered by `instruction`.
2421
+ */
2422
+ async switchChannel(conversationId, request) {
2423
+ return extractData(
2424
+ await this.client.POST("/v1/{workspace_id}/conversations/{conversation_id}/channel", {
2425
+ params: {
2426
+ path: { workspace_id: this.workspaceId, conversation_id: conversationId }
2427
+ },
2428
+ body: request
2429
+ })
2430
+ );
2431
+ }
2415
2432
  /**
2416
2433
  * Send a user message and receive the agent's synchronous JSON response.
2417
2434
  *
@@ -3554,143 +3571,6 @@ var BillingResource = class extends WorkspaceScopedResource {
3554
3571
  }
3555
3572
  };
3556
3573
 
3557
- // src/resources/review-queue.ts
3558
- var ReviewQueueResource = class extends WorkspaceScopedResource {
3559
- async list(params) {
3560
- return extractData(
3561
- await this.client.GET("/v1/{workspace_id}/review-queue", {
3562
- params: { path: { workspace_id: this.workspaceId }, query: params }
3563
- })
3564
- );
3565
- }
3566
- listAutoPaging(params) {
3567
- return this.iteratePaginatedList((pageParams) => this.list(pageParams), params);
3568
- }
3569
- async get(itemId) {
3570
- return extractData(
3571
- await this.client.GET("/v1/{workspace_id}/review-queue/{item_id}", {
3572
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } }
3573
- })
3574
- );
3575
- }
3576
- async getStats() {
3577
- return extractData(
3578
- await this.client.GET("/v1/{workspace_id}/review-queue/stats", {
3579
- params: { path: { workspace_id: this.workspaceId } }
3580
- })
3581
- );
3582
- }
3583
- async getDashboard() {
3584
- return extractData(
3585
- await this.client.GET("/v1/{workspace_id}/review-queue/dashboard", {
3586
- params: { path: { workspace_id: this.workspaceId } }
3587
- })
3588
- );
3589
- }
3590
- async getMyQueue(params) {
3591
- return extractData(
3592
- await this.client.GET("/v1/{workspace_id}/review-queue/my-queue", {
3593
- params: { path: { workspace_id: this.workspaceId }, query: params }
3594
- })
3595
- );
3596
- }
3597
- getMyQueueAutoPaging(params) {
3598
- return this.iteratePaginatedList((pageParams) => this.getMyQueue(pageParams), params);
3599
- }
3600
- async approve(itemId, body) {
3601
- return extractData(
3602
- await this.client.POST("/v1/{workspace_id}/review-queue/{item_id}/approve", {
3603
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } },
3604
- body
3605
- })
3606
- );
3607
- }
3608
- async reject(itemId, body) {
3609
- return extractData(
3610
- await this.client.POST("/v1/{workspace_id}/review-queue/{item_id}/reject", {
3611
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } },
3612
- body
3613
- })
3614
- );
3615
- }
3616
- async claim(itemId) {
3617
- return extractData(
3618
- await this.client.POST("/v1/{workspace_id}/review-queue/{item_id}/claim", {
3619
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } }
3620
- })
3621
- );
3622
- }
3623
- async unclaim(itemId) {
3624
- return extractData(
3625
- await this.client.POST("/v1/{workspace_id}/review-queue/{item_id}/unclaim", {
3626
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } }
3627
- })
3628
- );
3629
- }
3630
- async correct(itemId, body) {
3631
- return extractData(
3632
- await this.client.POST("/v1/{workspace_id}/review-queue/{item_id}/correct", {
3633
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } },
3634
- body
3635
- })
3636
- );
3637
- }
3638
- async batchApprove(body) {
3639
- return extractData(
3640
- await this.client.POST("/v1/{workspace_id}/review-queue/batch-approve", {
3641
- params: { path: { workspace_id: this.workspaceId } },
3642
- body
3643
- })
3644
- );
3645
- }
3646
- async batchReject(body) {
3647
- return extractData(
3648
- await this.client.POST("/v1/{workspace_id}/review-queue/batch-reject", {
3649
- params: { path: { workspace_id: this.workspaceId } },
3650
- body
3651
- })
3652
- );
3653
- }
3654
- async getHistory(params) {
3655
- return extractData(
3656
- await this.client.GET("/v1/{workspace_id}/review-queue/history", {
3657
- params: { path: { workspace_id: this.workspaceId }, query: params }
3658
- })
3659
- );
3660
- }
3661
- getHistoryAutoPaging(params) {
3662
- return this.iteratePaginatedList((pageParams) => this.getHistory(pageParams), params);
3663
- }
3664
- async getTrends(params) {
3665
- return extractData(
3666
- await this.client.GET("/v1/{workspace_id}/review-queue/trends", {
3667
- params: { path: { workspace_id: this.workspaceId }, query: params }
3668
- })
3669
- );
3670
- }
3671
- async getPerformance(params) {
3672
- return extractData(
3673
- await this.client.GET("/v1/{workspace_id}/review-queue/performance", {
3674
- params: { path: { workspace_id: this.workspaceId }, query: params }
3675
- })
3676
- );
3677
- }
3678
- async getCorrectionSchema(itemId) {
3679
- return extractData(
3680
- await this.client.GET("/v1/{workspace_id}/review-queue/{item_id}/correction-schema", {
3681
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } }
3682
- })
3683
- );
3684
- }
3685
- async getDiff(itemId) {
3686
- return extractData(
3687
- await this.client.GET("/v1/{workspace_id}/review-queue/{item_id}/diff", {
3688
- params: { path: { workspace_id: this.workspaceId, item_id: itemId } }
3689
- })
3690
- );
3691
- }
3692
- };
3693
-
3694
3574
  // src/resources/recordings.ts
3695
3575
  var RecordingsResource = class extends WorkspaceScopedResource {
3696
3576
  async getUrls(callSid) {
@@ -6307,7 +6187,6 @@ var AmigoClient = class _AmigoClient {
6307
6187
  metrics;
6308
6188
  settings;
6309
6189
  billing;
6310
- reviewQueue;
6311
6190
  recordings;
6312
6191
  audit;
6313
6192
  compliance;
@@ -6448,7 +6327,6 @@ var AmigoClient = class _AmigoClient {
6448
6327
  mutable.metrics = new MetricsResource(client, workspaceId2);
6449
6328
  mutable.settings = new SettingsResource(client, workspaceId2);
6450
6329
  mutable.billing = new BillingResource(client, workspaceId2);
6451
- mutable.reviewQueue = new ReviewQueueResource(client, workspaceId2);
6452
6330
  mutable.recordings = new RecordingsResource(client, workspaceId2);
6453
6331
  mutable.audit = new AuditResource(client, workspaceId2);
6454
6332
  mutable.compliance = new ComplianceResource(client, workspaceId2);