@amigo-ai/platform-sdk 0.25.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.
- package/README.md +62 -0
- package/api.md +166 -0
- package/dist/index.cjs +1063 -0
- package/dist/index.cjs.map +4 -4
- package/dist/index.js +68 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1063 -0
- package/dist/index.mjs.map +4 -4
- package/dist/resources/analytics.js +20 -0
- package/dist/resources/analytics.js.map +1 -1
- package/dist/resources/briefs.js +34 -0
- package/dist/resources/briefs.js.map +1 -0
- package/dist/resources/calls.js +22 -0
- package/dist/resources/calls.js.map +1 -1
- package/dist/resources/command-center.js +17 -0
- package/dist/resources/command-center.js.map +1 -0
- package/dist/resources/crm.js +52 -0
- package/dist/resources/crm.js.map +1 -0
- package/dist/resources/data-query.js +22 -0
- package/dist/resources/data-query.js.map +1 -0
- package/dist/resources/desktop-sessions.js +43 -0
- package/dist/resources/desktop-sessions.js.map +1 -0
- package/dist/resources/fhir.js +130 -0
- package/dist/resources/fhir.js.map +1 -0
- package/dist/resources/insights.js +53 -0
- package/dist/resources/insights.js.map +1 -0
- package/dist/resources/intake.js +42 -0
- package/dist/resources/intake.js.map +1 -0
- package/dist/resources/monitor-concepts.js +47 -0
- package/dist/resources/monitor-concepts.js.map +1 -0
- package/dist/resources/network.js +17 -0
- package/dist/resources/network.js.map +1 -0
- package/dist/resources/pipeline.js +69 -0
- package/dist/resources/pipeline.js.map +1 -0
- package/dist/resources/sensorium.js +25 -0
- package/dist/resources/sensorium.js.map +1 -0
- package/dist/resources/sessions.js +29 -0
- package/dist/resources/sessions.js.map +1 -0
- package/dist/resources/settings.js +17 -0
- package/dist/resources/settings.js.map +1 -1
- package/dist/resources/simulations.js +75 -0
- package/dist/resources/simulations.js.map +1 -1
- package/dist/resources/surfaces.js +85 -0
- package/dist/resources/surfaces.js.map +1 -0
- package/dist/resources/tasks.js +23 -0
- package/dist/resources/tasks.js.map +1 -0
- package/dist/resources/tools.js +24 -0
- package/dist/resources/tools.js.map +1 -0
- package/dist/resources/unification-rules.js +46 -0
- package/dist/resources/unification-rules.js.map +1 -0
- package/dist/resources/workspaces.js +25 -0
- package/dist/resources/workspaces.js.map +1 -1
- package/dist/types/generated/api.d.ts +59 -51
- package/dist/types/generated/api.d.ts.map +1 -1
- package/dist/types/index.d.cts +51 -0
- package/dist/types/index.d.cts.map +1 -1
- package/dist/types/index.d.ts +51 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/resources/analytics.d.ts +26 -0
- package/dist/types/resources/analytics.d.ts.map +1 -1
- package/dist/types/resources/briefs.d.ts +79 -0
- package/dist/types/resources/briefs.d.ts.map +1 -0
- package/dist/types/resources/calls.d.ts +77 -0
- package/dist/types/resources/calls.d.ts.map +1 -1
- package/dist/types/resources/command-center.d.ts +55 -0
- package/dist/types/resources/command-center.d.ts.map +1 -0
- package/dist/types/resources/crm.d.ts +207 -0
- package/dist/types/resources/crm.d.ts.map +1 -0
- package/dist/types/resources/data-query.d.ts +23 -0
- package/dist/types/resources/data-query.d.ts.map +1 -0
- package/dist/types/resources/desktop-sessions.d.ts +38 -0
- package/dist/types/resources/desktop-sessions.d.ts.map +1 -0
- package/dist/types/resources/fhir.d.ts +350 -0
- package/dist/types/resources/fhir.d.ts.map +1 -0
- package/dist/types/resources/functions.d.ts.map +1 -1
- package/dist/types/resources/insights.d.ts +56 -0
- package/dist/types/resources/insights.d.ts.map +1 -0
- package/dist/types/resources/intake.d.ts +59 -0
- package/dist/types/resources/intake.d.ts.map +1 -0
- package/dist/types/resources/metrics.d.ts.map +1 -1
- package/dist/types/resources/monitor-concepts.d.ts +115 -0
- package/dist/types/resources/monitor-concepts.d.ts.map +1 -0
- package/dist/types/resources/network.d.ts +17 -0
- package/dist/types/resources/network.d.ts.map +1 -0
- package/dist/types/resources/operators.d.ts.map +1 -1
- package/dist/types/resources/pipeline.d.ts +183 -0
- package/dist/types/resources/pipeline.d.ts.map +1 -0
- package/dist/types/resources/sensorium.d.ts +40 -0
- package/dist/types/resources/sensorium.d.ts.map +1 -0
- package/dist/types/resources/sessions.d.ts +33 -0
- package/dist/types/resources/sessions.d.ts.map +1 -0
- package/dist/types/resources/settings.d.ts +16 -0
- package/dist/types/resources/settings.d.ts.map +1 -1
- package/dist/types/resources/simulations.d.ts +186 -3
- package/dist/types/resources/simulations.d.ts.map +1 -1
- package/dist/types/resources/surfaces.d.ts +240 -0
- package/dist/types/resources/surfaces.d.ts.map +1 -0
- package/dist/types/resources/tasks.d.ts +55 -0
- package/dist/types/resources/tasks.d.ts.map +1 -0
- package/dist/types/resources/tools.d.ts +53 -0
- package/dist/types/resources/tools.d.ts.map +1 -0
- package/dist/types/resources/unification-rules.d.ts +129 -0
- package/dist/types/resources/unification-rules.d.ts.map +1 -0
- package/dist/types/resources/workspaces.d.ts +24 -0
- package/dist/types/resources/workspaces.d.ts.map +1 -1
- 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`
|