@amigo-ai/platform-sdk 0.26.0 → 0.27.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 (101) hide show
  1. package/README.md +62 -0
  2. package/api.md +166 -0
  3. package/dist/index.cjs +1063 -0
  4. package/dist/index.cjs.map +4 -4
  5. package/dist/index.js +68 -0
  6. package/dist/index.js.map +1 -1
  7. package/dist/index.mjs +1063 -0
  8. package/dist/index.mjs.map +4 -4
  9. package/dist/resources/analytics.js +20 -0
  10. package/dist/resources/analytics.js.map +1 -1
  11. package/dist/resources/briefs.js +34 -0
  12. package/dist/resources/briefs.js.map +1 -0
  13. package/dist/resources/calls.js +22 -0
  14. package/dist/resources/calls.js.map +1 -1
  15. package/dist/resources/command-center.js +17 -0
  16. package/dist/resources/command-center.js.map +1 -0
  17. package/dist/resources/crm.js +52 -0
  18. package/dist/resources/crm.js.map +1 -0
  19. package/dist/resources/data-query.js +22 -0
  20. package/dist/resources/data-query.js.map +1 -0
  21. package/dist/resources/desktop-sessions.js +43 -0
  22. package/dist/resources/desktop-sessions.js.map +1 -0
  23. package/dist/resources/fhir.js +130 -0
  24. package/dist/resources/fhir.js.map +1 -0
  25. package/dist/resources/insights.js +53 -0
  26. package/dist/resources/insights.js.map +1 -0
  27. package/dist/resources/intake.js +42 -0
  28. package/dist/resources/intake.js.map +1 -0
  29. package/dist/resources/monitor-concepts.js +47 -0
  30. package/dist/resources/monitor-concepts.js.map +1 -0
  31. package/dist/resources/network.js +17 -0
  32. package/dist/resources/network.js.map +1 -0
  33. package/dist/resources/pipeline.js +69 -0
  34. package/dist/resources/pipeline.js.map +1 -0
  35. package/dist/resources/sensorium.js +25 -0
  36. package/dist/resources/sensorium.js.map +1 -0
  37. package/dist/resources/sessions.js +29 -0
  38. package/dist/resources/sessions.js.map +1 -0
  39. package/dist/resources/settings.js +17 -0
  40. package/dist/resources/settings.js.map +1 -1
  41. package/dist/resources/simulations.js +75 -0
  42. package/dist/resources/simulations.js.map +1 -1
  43. package/dist/resources/surfaces.js +85 -0
  44. package/dist/resources/surfaces.js.map +1 -0
  45. package/dist/resources/tasks.js +23 -0
  46. package/dist/resources/tasks.js.map +1 -0
  47. package/dist/resources/tools.js +24 -0
  48. package/dist/resources/tools.js.map +1 -0
  49. package/dist/resources/unification-rules.js +46 -0
  50. package/dist/resources/unification-rules.js.map +1 -0
  51. package/dist/resources/workspaces.js +25 -0
  52. package/dist/resources/workspaces.js.map +1 -1
  53. package/dist/types/index.d.cts +51 -0
  54. package/dist/types/index.d.cts.map +1 -1
  55. package/dist/types/index.d.ts +51 -0
  56. package/dist/types/index.d.ts.map +1 -1
  57. package/dist/types/resources/analytics.d.ts +26 -0
  58. package/dist/types/resources/analytics.d.ts.map +1 -1
  59. package/dist/types/resources/briefs.d.ts +79 -0
  60. package/dist/types/resources/briefs.d.ts.map +1 -0
  61. package/dist/types/resources/calls.d.ts +77 -0
  62. package/dist/types/resources/calls.d.ts.map +1 -1
  63. package/dist/types/resources/command-center.d.ts +55 -0
  64. package/dist/types/resources/command-center.d.ts.map +1 -0
  65. package/dist/types/resources/crm.d.ts +207 -0
  66. package/dist/types/resources/crm.d.ts.map +1 -0
  67. package/dist/types/resources/data-query.d.ts +23 -0
  68. package/dist/types/resources/data-query.d.ts.map +1 -0
  69. package/dist/types/resources/desktop-sessions.d.ts +38 -0
  70. package/dist/types/resources/desktop-sessions.d.ts.map +1 -0
  71. package/dist/types/resources/fhir.d.ts +350 -0
  72. package/dist/types/resources/fhir.d.ts.map +1 -0
  73. package/dist/types/resources/insights.d.ts +56 -0
  74. package/dist/types/resources/insights.d.ts.map +1 -0
  75. package/dist/types/resources/intake.d.ts +59 -0
  76. package/dist/types/resources/intake.d.ts.map +1 -0
  77. package/dist/types/resources/monitor-concepts.d.ts +115 -0
  78. package/dist/types/resources/monitor-concepts.d.ts.map +1 -0
  79. package/dist/types/resources/network.d.ts +17 -0
  80. package/dist/types/resources/network.d.ts.map +1 -0
  81. package/dist/types/resources/pipeline.d.ts +183 -0
  82. package/dist/types/resources/pipeline.d.ts.map +1 -0
  83. package/dist/types/resources/sensorium.d.ts +40 -0
  84. package/dist/types/resources/sensorium.d.ts.map +1 -0
  85. package/dist/types/resources/sessions.d.ts +33 -0
  86. package/dist/types/resources/sessions.d.ts.map +1 -0
  87. package/dist/types/resources/settings.d.ts +16 -0
  88. package/dist/types/resources/settings.d.ts.map +1 -1
  89. package/dist/types/resources/simulations.d.ts +186 -3
  90. package/dist/types/resources/simulations.d.ts.map +1 -1
  91. package/dist/types/resources/surfaces.d.ts +240 -0
  92. package/dist/types/resources/surfaces.d.ts.map +1 -0
  93. package/dist/types/resources/tasks.d.ts +55 -0
  94. package/dist/types/resources/tasks.d.ts.map +1 -0
  95. package/dist/types/resources/tools.d.ts +53 -0
  96. package/dist/types/resources/tools.d.ts.map +1 -0
  97. package/dist/types/resources/unification-rules.d.ts +129 -0
  98. package/dist/types/resources/unification-rules.d.ts.map +1 -0
  99. package/dist/types/resources/workspaces.d.ts +24 -0
  100. package/dist/types/resources/workspaces.d.ts.map +1 -1
  101. package/package.json +1 -1
package/README.md CHANGED
@@ -446,6 +446,68 @@ const url = client.conversations.textStreamUrl({ serviceId: 'service-id', token:
446
446
  const socket = new WebSocket(url)
447
447
  ```
448
448
 
449
+ ### Real-time event streams
450
+
451
+ For workspace-wide events (calls, surfaces, pipeline, operators, channels), use the typed SSE consumer:
452
+
453
+ ```typescript
454
+ const handle = client.events.subscribeToWorkspace({
455
+ onEvent: (event) => {
456
+ switch (event.event_type) {
457
+ case 'call.started': console.log('call started:', event.call_sid); break
458
+ case 'pipeline.error': console.error('pipeline error:', event); break
459
+ }
460
+ },
461
+ onError: (err) => console.error('terminal:', err),
462
+ onReconnect: (attempt) => console.warn(`reconnect #${attempt}`),
463
+ })
464
+
465
+ // Later: handle.unsubscribe(); await handle.done
466
+ ```
467
+
468
+ The helper handles automatic reconnect (exp backoff with jitter, server-sent
469
+ `retry:` honored), gapless replay via `Last-Event-ID`, and discriminated-union
470
+ dispatch. Server emits a structured `error` frame with a stable `code` on
471
+ terminal failures — narrow with the typed error guard:
472
+
473
+ ```typescript
474
+ import { isWorkspaceEventStreamError } from '@amigo-ai/platform-sdk'
475
+
476
+ onError: (err) => {
477
+ if (isWorkspaceEventStreamError(err)) {
478
+ if (err.code === 'too_many_streams') {
479
+ // workspace has too many open streams; close another tab
480
+ } else if (err.retryable) {
481
+ // SDK already retried up to maxReconnects; safe to try again later
482
+ }
483
+ }
484
+ }
485
+ ```
486
+
487
+ For per-call voice observation (`agent_transcript_delta`, `latency`, `session_*`,
488
+ `participant_*`, etc.), use the WebSocket-based observer helper:
489
+
490
+ ```typescript
491
+ const observerHandle = client.observers.subscribe({
492
+ callSid: 'CAxxx',
493
+ token: bearerToken,
494
+ onEvent: (event) => {
495
+ switch (event.type) {
496
+ case 'agent_transcript_delta': renderAgentDelta(event.delta); break
497
+ case 'session_end': showSummary(event); break
498
+ }
499
+ },
500
+ onError: (err) => console.error('observer terminal:', err.reason, err.closeCode),
501
+ })
502
+ ```
503
+
504
+ Both helpers are built on the shared `ReconnectingWebSocket` primitive, which
505
+ maps platform-specific WebSocket close codes (4001 client error, 4029 rate
506
+ limit, 4403 auth, 4100 token expired) to a typed reason taxonomy and applies an
507
+ idle watchdog (default 45s) so a half-dead socket forces a reconnect rather
508
+ than hanging indefinitely. Compose it directly via `createReconnectingWebSocket`
509
+ when you need a managed WebSocket outside these resources.
510
+
449
511
  ### Analytics
450
512
 
451
513
  ```typescript
package/api.md CHANGED
@@ -75,6 +75,8 @@ All workspace-scoped resources also expose `withOptions(options)`.
75
75
  - `provision`
76
76
  - `checkEnvironment`
77
77
  - `convertEnvironment`
78
+ - `testCallerNumbers.get`
79
+ - `testCallerNumbers.update`
78
80
 
79
81
  ### `apiKeys`
80
82
 
@@ -230,6 +232,9 @@ All workspace-scoped resources also expose `withOptions(options)`.
230
232
  - `getBenchmarks`
231
233
  - `getPhoneVolume`
232
234
  - `getTraceAnalysis`
235
+ - `listTraces`
236
+ - `getMetrics`
237
+ - `createOutbound`
233
238
 
234
239
  ### `conversations`
235
240
 
@@ -282,6 +287,10 @@ All workspace-scoped resources also expose `withOptions(options)`.
282
287
  - `getOperatorPerformance`
283
288
  - `getAdvancedCallStats`
284
289
  - `compareCallPeriods`
290
+ - `surfaces.getCompletionRates`
291
+ - `surfaces.getChannelEffectiveness`
292
+ - `surfaces.getFieldAbandonment`
293
+ - `surfaces.getForEntity`
285
294
 
286
295
  ### `simulations`
287
296
 
@@ -291,6 +300,18 @@ All workspace-scoped resources also expose `withOptions(options)`.
291
300
  - `step`
292
301
  - `recommend`
293
302
  - `getIntelligence`
303
+ - `runs.list`
304
+ - `runs.create`
305
+ - `runs.get`
306
+ - `runs.complete`
307
+ - `runs.createSession`
308
+ - `bridge.plan`
309
+ - `bridge.run`
310
+ - `services.getGraph`
311
+ - `services.deleteGraph`
312
+ - `services.getGraphPaths`
313
+ - `services.listSessions`
314
+ - `services.listTurns`
294
315
 
295
316
  ### `metrics`
296
317
 
@@ -317,6 +338,8 @@ All workspace-scoped resources also expose `withOptions(options)`.
317
338
  - `behaviors.update`
318
339
  - `gapScanner.get`
319
340
  - `gapScanner.update`
341
+ - `gapScanner.preview`
342
+ - `gapScanner.scan`
320
343
  - `scribe.get`
321
344
  - `scribe.update`
322
345
  - `metrics.get`
@@ -434,4 +457,147 @@ All workspace-scoped resources also expose `withOptions(options)`.
434
457
 
435
458
  - `subscribe`
436
459
 
460
+ ### `fhir`
461
+
462
+ - `getStatus`
463
+ - `getSyncFailures`
464
+ - `import`
465
+ - `searchPatients`
466
+ - `getPatientSummary`
467
+ - `getPatientTimeline`
468
+ - `resources.search`
469
+ - `resources.create`
470
+ - `resources.get`
471
+ - `resources.update`
472
+ - `resources.getHistory`
473
+ - `views.patients`
474
+ - `views.appointments`
475
+ - `views.practitioners`
476
+ - `views.organizations`
477
+ - `views.locations`
478
+ - `views.slots`
479
+
480
+ ### `insights`
481
+
482
+ - `getDigest`
483
+ - `getSchema`
484
+ - `getSuggestions`
485
+ - `runSql`
486
+ - `sessions.create`
487
+ - `sessions.get`
488
+ - `sessions.chat`
489
+
490
+ ### `monitorConcepts`
491
+
492
+ - `create`
493
+ - `list`
494
+ - `listAutoPaging`
495
+ - `get`
496
+ - `update`
497
+ - `delete`
498
+
499
+ ### `unificationRules`
500
+
501
+ - `create`
502
+ - `list`
503
+ - `listAutoPaging`
504
+ - `get`
505
+ - `update`
506
+ - `delete`
507
+
508
+ ### `crm`
509
+
510
+ - `getStatus`
511
+ - `contacts.list`
512
+ - `contacts.get`
513
+ - `contacts.getTimeline`
514
+ - `companies.list`
515
+ - `companies.get`
516
+ - `deals.list`
517
+ - `deals.get`
518
+ - `deals.getPipeline`
519
+
520
+ ### `commandCenter`
521
+
522
+ - `get`
523
+
524
+ ### `sensorium`
525
+
526
+ - `getConnectorHealth`
527
+ - `getLoopLatency`
528
+
529
+ ### `dataQuery`
530
+
531
+ - `run`
532
+
533
+ ### `briefs`
534
+
535
+ - `get`
536
+ - `regenerate`
537
+ - `getForEntity`
538
+ - `regenerateForEntity`
539
+
540
+ ### `desktopSessions`
541
+
542
+ - `create`
543
+ - `disconnect`
544
+ - `sendAction`
545
+ - `getScreenshot`
546
+ - `getStatus`
547
+
548
+ ### `intake`
549
+
550
+ - `links.list`
551
+ - `links.create`
552
+ - `links.delete`
553
+ - `links.listUploads`
554
+ - `links.downloadUpload`
555
+
556
+ ### `network`
557
+
558
+ - `getEgressIps`
559
+
560
+ ### `pipeline`
561
+
562
+ - `getStatus`
563
+ - `getThroughput`
564
+ - `getReview`
565
+ - `getEntityResolution`
566
+ - `outbound.list`
567
+ - `outbound.getLog`
568
+ - `sources.list`
569
+ - `sources.getOverview`
570
+ - `sources.listEvents`
571
+ - `sources.getHistory`
572
+
573
+ ### `tasks`
574
+
575
+ - `get`
576
+ - `listByCall`
577
+
578
+ ### `tools`
579
+
580
+ - `execute`
581
+ - `resolveForService`
582
+
583
+ ### `surfaces`
584
+
585
+ - `list`
586
+ - `listAutoPaging`
587
+ - `listForReview`
588
+ - `create`
589
+ - `get`
590
+ - `update`
591
+ - `archive`
592
+ - `deliver`
593
+ - `getProgress`
594
+ - `approve`
595
+ - `reject`
596
+ - `reshape`
597
+
598
+ ### `sessions`
599
+
600
+ - `listActive`
601
+ - `inject`
602
+
437
603
  ### `api`