@nopaque/sdk 0.1.1 → 0.6.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/dist/index.d.ts CHANGED
@@ -119,16 +119,32 @@ declare class Paginator<T, Raw = unknown> implements AsyncIterable<T> {
119
119
  [Symbol.asyncIterator](): AsyncIterator<T>;
120
120
  }
121
121
 
122
+ /**
123
+ * Audio categories the API accepts. Required on upload — the category decides
124
+ * the S3 key prefix, so the API rejects a request without one.
125
+ */
126
+ type AudioCategory = 'test' | 'map' | 'voice' | 'transcript';
122
127
  interface AudioFile {
123
128
  id: string;
124
- fileName: string;
129
+ /** Wire name is `filename`, all lowercase. Not `fileName`. */
130
+ filename: string;
125
131
  contentType: string;
132
+ category?: AudioCategory;
133
+ associatedId?: string;
126
134
  sizeBytes?: number;
135
+ durationSecs?: number;
136
+ /** Extension the API derived from the filename, e.g. 'wav'. */
137
+ format?: string;
138
+ sampleRate?: number;
139
+ channels?: number;
127
140
  createdAt?: string;
141
+ createdBy?: string;
142
+ metadata?: Record<string, unknown>;
128
143
  }
129
144
  interface AudioUploadURL {
130
145
  uploadUrl: string;
131
146
  audioId: string;
147
+ s3Key: string;
132
148
  expiresIn: number;
133
149
  }
134
150
  interface AudioDownloadURL {
@@ -136,8 +152,13 @@ interface AudioDownloadURL {
136
152
  expiresIn: number;
137
153
  }
138
154
  interface CreateUploadUrlRequest {
139
- fileName: string;
155
+ filename: string;
140
156
  contentType: string;
157
+ category: AudioCategory;
158
+ /** Defaults server-side to the generated audioId when omitted. */
159
+ associatedId?: string;
160
+ durationSecs?: number;
161
+ sizeBytes?: number;
141
162
  }
142
163
  interface AudioListParams {
143
164
  limit?: number;
@@ -146,8 +167,10 @@ interface AudioListParams {
146
167
  interface UploadInput {
147
168
  /** Path string, Buffer/Uint8Array bytes, ReadableStream, File/Blob, or Node file stream. */
148
169
  file: string | Uint8Array | ReadableStream<Uint8Array> | Blob | NodeJS.ReadableStream;
170
+ category: AudioCategory;
149
171
  contentType?: string;
150
172
  name?: string;
173
+ associatedId?: string;
151
174
  }
152
175
  interface DownloadOptions {
153
176
  to?: string;
@@ -228,6 +251,134 @@ declare class BatchesResource extends Resource {
228
251
  waitForRun(runId: string, opts?: BatchesWaitForOptions): Promise<BatchRun>;
229
252
  }
230
253
 
254
+ interface ComplianceTest {
255
+ id: string;
256
+ title: string;
257
+ severity: 'critical' | 'major' | 'advisory';
258
+ regulationKeys: string[];
259
+ }
260
+ interface ComplianceRegulation {
261
+ key: string;
262
+ label: string;
263
+ testIds: string[];
264
+ }
265
+ interface ComplianceCatalogue {
266
+ version: string;
267
+ regulations: ComplianceRegulation[];
268
+ tests: ComplianceTest[];
269
+ }
270
+ interface ComplianceCatalogueResponse {
271
+ catalogue: ComplianceCatalogue;
272
+ pickerLimit: number;
273
+ s2stestSecondsAvailable: number;
274
+ tier: string;
275
+ }
276
+ interface CreateComplianceBatchRequest {
277
+ phoneNumber: string;
278
+ sector: string;
279
+ testIds: string[];
280
+ }
281
+ interface CreateComplianceBatchResponse {
282
+ runIds: string[];
283
+ reportUrl: string;
284
+ }
285
+ interface ComplianceTestEvidence {
286
+ turn: number;
287
+ quote: string;
288
+ }
289
+ interface ComplianceTestVerdict {
290
+ testId: string;
291
+ verdict: 'pass' | 'fail' | 'pending';
292
+ evidence?: ComplianceTestEvidence[];
293
+ judgeRationale?: string;
294
+ }
295
+ interface ComplianceRegulationSection {
296
+ regulationKey: string;
297
+ label: string;
298
+ passed: number;
299
+ failed: number;
300
+ pending: number;
301
+ verdicts: ComplianceTestVerdict[];
302
+ }
303
+ interface ComplianceReportSummary {
304
+ phoneNumber: string;
305
+ catalogueVersion: string;
306
+ passed: number;
307
+ failed: number;
308
+ pending: number;
309
+ generatedAt: string;
310
+ }
311
+ interface ComplianceReport {
312
+ summary: ComplianceReportSummary;
313
+ sections: ComplianceRegulationSection[];
314
+ }
315
+ interface ComplianceReportListItem {
316
+ phoneNumber: string;
317
+ passed: number;
318
+ failed: number;
319
+ total: number;
320
+ lastRunAt: string;
321
+ }
322
+ interface ComplianceReportListParams {
323
+ limit?: number;
324
+ nextToken?: string;
325
+ }
326
+ interface GeneratePdfRequest {
327
+ regulationKey?: string;
328
+ }
329
+ interface GeneratePdfResponse {
330
+ url: string;
331
+ }
332
+
333
+ type MissionTestKind = 'freeform' | 'compliance';
334
+ type MissionTestStatus = 'queued' | 'running' | 'completed' | 'failed' | 'cancelled';
335
+ interface MissionTestProfile {
336
+ phoneNumber: string;
337
+ name?: string;
338
+ }
339
+ interface CreateMissionTestRequest {
340
+ sector: string;
341
+ mission: string;
342
+ acceptance: string;
343
+ profile: MissionTestProfile;
344
+ }
345
+ interface MissionTestRun {
346
+ id: string;
347
+ workspaceId: string;
348
+ kind: MissionTestKind;
349
+ sector: string;
350
+ mission: string;
351
+ acceptance: string;
352
+ profile: MissionTestProfile;
353
+ status: MissionTestStatus;
354
+ verdict?: 'pass' | 'fail';
355
+ createdAt: string;
356
+ updatedAt: string;
357
+ }
358
+ interface MissionTestDefaults {
359
+ sector: string;
360
+ mission: string;
361
+ acceptance: string;
362
+ catalogueVersion: string;
363
+ }
364
+ interface MissionTestListParams {
365
+ limit?: number;
366
+ nextToken?: string;
367
+ }
368
+
369
+ declare class ComplianceResource extends Resource {
370
+ getCatalogue(params?: {
371
+ sector?: string;
372
+ }, requestOptions?: RequestOptions): Promise<ComplianceCatalogueResponse>;
373
+ run(body: CreateComplianceBatchRequest, requestOptions?: RequestOptions): Promise<CreateComplianceBatchResponse>;
374
+ listReports(params?: ComplianceReportListParams, requestOptions?: RequestOptions): Paginator<ComplianceReportListItem>;
375
+ listReportsPage(params?: ComplianceReportListParams, requestOptions?: RequestOptions): Promise<Page<ComplianceReportListItem>>;
376
+ getReport(phoneNumber: string, requestOptions?: RequestOptions): Promise<ComplianceReport>;
377
+ generatePdfUrl(phoneNumber: string, body?: GeneratePdfRequest, requestOptions?: RequestOptions): Promise<GeneratePdfResponse>;
378
+ downloadReportPdf(phoneNumber: string, body?: GeneratePdfRequest, requestOptions?: RequestOptions): Promise<Uint8Array>;
379
+ rerun(runId: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
380
+ }
381
+
231
382
  interface Dataset {
232
383
  id: string;
233
384
  name: string;
@@ -268,6 +419,417 @@ declare class DatasetsResource extends Resource {
268
419
  resolve(datasetId: string, requestOptions?: RequestOptions): Promise<ResolvedDataset>;
269
420
  }
270
421
 
422
+ /** Amazon Connect chat via StartChatContact plus the participant websocket. */
423
+ interface ConnectChatTarget {
424
+ transport: 'connect-chat';
425
+ instanceId: string;
426
+ contactFlowId: string;
427
+ region?: string;
428
+ attributes?: Record<string, string>;
429
+ assumeRoleArn?: string;
430
+ }
431
+ /** Generic REST chat endpoint, including OpenAI-compatible shapes. */
432
+ interface HttpJsonTarget {
433
+ transport: 'http-json';
434
+ endpoint: string;
435
+ openaiCompatible?: boolean;
436
+ authRef?: string;
437
+ }
438
+ /** Browser-automated embedded chat widget, for targets with no API at all. */
439
+ interface WebWidgetTarget {
440
+ transport: 'web-widget';
441
+ url: string;
442
+ selectorProfile?: string;
443
+ }
444
+ /**
445
+ * What `phoneNumber` becomes on a text channel. Discriminated on `transport`.
446
+ * `targetRef` (on the run, not here) is the stable human-readable identity a
447
+ * report aggregates on.
448
+ */
449
+ type DigitalTarget = ConnectChatTarget | HttpJsonTarget | WebWidgetTarget;
450
+ /** Fields every chat step carries. */
451
+ interface ChatStepBase {
452
+ id?: string;
453
+ name?: string;
454
+ }
455
+ /**
456
+ * Send a customer message. Supply EXACTLY ONE of `text` or `profileItemId` -
457
+ * both, or neither, is a 400.
458
+ *
459
+ * `profileItemId` is a key into `profile.dataItems`, mirroring how a voice DTMF
460
+ * step resolves one. There is no template syntax: an unresolvable reference
461
+ * fails loudly rather than sending the literal `{{accountNumber}}` to the bot.
462
+ */
463
+ type SendChatStep = ChatStepBase & {
464
+ type: 'send';
465
+ } & ({
466
+ text: string;
467
+ profileItemId?: never;
468
+ } | {
469
+ profileItemId: string;
470
+ text?: never;
471
+ });
472
+ /** How an `expect` step compares the bot's message. `exact` is the default. */
473
+ type ChatMatcher = 'exact' | 'contains' | 'regex' | 'similarity';
474
+ /**
475
+ * Assert the bot's next message.
476
+ *
477
+ * `exact` is the default because chat delivers the bytes the bot sent. Matching
478
+ * trims and collapses whitespace but is case-SENSITIVE.
479
+ */
480
+ interface ExpectChatStep extends ChatStepBase {
481
+ type: 'expect';
482
+ expected: string;
483
+ /** Defaults to `exact`. */
484
+ matcher?: ChatMatcher;
485
+ /**
486
+ * 0-100. Only consulted by `similarity`, but reported on every result row so
487
+ * a failure shows the bar it was judged against. Defaults to 100.
488
+ */
489
+ threshold?: number;
490
+ /** Greater than 0, at most 120. Defaults to 20. */
491
+ timeoutSecs?: number;
492
+ }
493
+ /** Pause. For targets that rate-limit, or to let an async handoff settle. */
494
+ interface WaitChatStep extends ChatStepBase {
495
+ type: 'wait';
496
+ /** Greater than 0, at most 60. Defaults to 1. */
497
+ seconds?: number;
498
+ }
499
+ /** Close the conversation explicitly. Optional - the runner closes the transport anyway. */
500
+ interface EndChatStep extends ChatStepBase {
501
+ type: 'end';
502
+ }
503
+ /** One step of a `kind: standard` test, discriminated on `type`. */
504
+ type ChatStep = SendChatStep | ExpectChatStep | WaitChatStep | EndChatStep;
505
+ /** One named piece of test data a `standard` run's steps draw on. */
506
+ interface DigitalProfileItem {
507
+ label?: string;
508
+ value?: string;
509
+ }
510
+ /** Test data a `standard` run's steps draw on. The voice profile shape minus `voiceItems`. */
511
+ interface DigitalProfile {
512
+ dataItems?: Record<string, DigitalProfileItem>;
513
+ }
514
+ /** Shaped like the voice `TestStepResult` so a client widens a union rather than learning a second shape. */
515
+ interface DigitalStepResult {
516
+ stepId?: string;
517
+ name?: string;
518
+ actionType?: string;
519
+ actionValue?: string;
520
+ expectedTranscript?: string;
521
+ actualTranscript?: string;
522
+ /** Reported whatever the matcher - on a failure it distinguishes a typo from a wrong turn. */
523
+ similarity?: number;
524
+ threshold?: number;
525
+ outcome?: string;
526
+ duration?: number;
527
+ }
528
+ /** One turn of the conversation, as the worker's transcript emits it. */
529
+ interface DigitalTranscriptTurn {
530
+ role?: string;
531
+ text?: string;
532
+ at?: string;
533
+ }
534
+ /**
535
+ * One condition the judge cited for its verdict. `condition` and `reason` are
536
+ * what the judge sends today; the rest are tolerated because the judge may add
537
+ * fields and an unknown one must never cost a caller their verdict.
538
+ */
539
+ interface DigitalEvidence {
540
+ condition?: string;
541
+ reason?: string;
542
+ quote?: string;
543
+ met?: boolean;
544
+ triggered?: boolean;
545
+ turn?: number;
546
+ }
547
+ /** One conversation, with its own verdict and evidence. */
548
+ interface DigitalSample {
549
+ outcome?: DigitalOutcome;
550
+ stepResults?: DigitalStepResult[];
551
+ stepsRun?: number;
552
+ stepsTotal?: number;
553
+ /** A list of turns, NOT a string - whatever the OpenAPI document says. */
554
+ transcript?: DigitalTranscriptTurn[];
555
+ reasoning?: string;
556
+ /** Judged kinds only. There is no combined `evidence` field. */
557
+ passEvidence?: DigitalEvidence[];
558
+ failEvidence?: DigitalEvidence[];
559
+ failureReason?: string;
560
+ }
561
+ type DigitalRunStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
562
+ type DigitalOutcome = 'pass' | 'fail' | 'inconclusive';
563
+ type DigitalTestKind = 'freeform' | 'compliance' | 'standard';
564
+ interface DigitalTestRun {
565
+ id: string;
566
+ workspaceId: string;
567
+ userId?: string;
568
+ targetRef: string;
569
+ channel: 'chat';
570
+ target?: DigitalTarget;
571
+ kind: DigitalTestKind;
572
+ sector?: string;
573
+ mission?: string;
574
+ acceptance?: string;
575
+ catalogueTestId?: string;
576
+ /** Set when the run was launched from a saved config. Undeclared in the OpenAPI document. */
577
+ configId?: string;
578
+ /**
579
+ * `failed` means the test could not be DELIVERED (an infrastructure failure,
580
+ * with `failureReason` set). A bot that behaved badly produces `completed`
581
+ * with `outcome: 'fail'` - the two are deliberately not the same thing.
582
+ */
583
+ status: DigitalRunStatus;
584
+ outcome?: DigitalOutcome;
585
+ samplesRequested?: number;
586
+ samplesJudged?: number;
587
+ passed?: number;
588
+ failed?: number;
589
+ /**
590
+ * Samples that never produced a verdict because the transport failed. Kept
591
+ * SEPARATE from `passRate`.
592
+ */
593
+ transportErrors?: number;
594
+ /** passed / samplesJudged. Null until the run reaches a verdict. */
595
+ passRate?: number | null;
596
+ sampleOutcomes?: string[];
597
+ samples?: DigitalSample[];
598
+ payloadS3Bucket?: string;
599
+ payloadS3Key?: string;
600
+ payloadBytes?: number;
601
+ failureReason?: string;
602
+ startedAt: string;
603
+ completedAt?: string;
604
+ /** Still `pending` past this means no worker ever picked the job up. */
605
+ launchDeadline?: string;
606
+ }
607
+ interface DigitalTestConfigBase {
608
+ name?: string;
609
+ description?: string;
610
+ targetRef?: string;
611
+ target?: DigitalTarget;
612
+ sector?: string;
613
+ mission?: string;
614
+ kind?: DigitalTestKind;
615
+ /** Required for `kind: 'freeform'`. */
616
+ acceptance?: string;
617
+ /** Required for `kind: 'compliance'`. Matches `^M-\d{3}$`. */
618
+ catalogueTestId?: string;
619
+ passConditions?: string[];
620
+ failConditions?: string[];
621
+ setup?: string;
622
+ additionalContext?: string;
623
+ profileId?: string;
624
+ /** Inline test data. `profileId` takes precedence over this. */
625
+ profile?: DigitalProfile;
626
+ /** Flat label to value dict for the judged kinds. */
627
+ profileSnapshot?: Record<string, unknown>;
628
+ /** Probe utterances for the judged kinds. `standard` uses `steps` instead. */
629
+ probes?: string[];
630
+ /** `standard` only. A judged kind carrying steps is rejected. */
631
+ steps?: ChatStep[];
632
+ /** 1-10. Defaults to 3 for the judged kinds and 1 for `standard`. */
633
+ samples?: number;
634
+ /** 1-60. Defaults to 12. */
635
+ maxTurns?: number;
636
+ }
637
+ interface DigitalTestConfig extends DigitalTestConfigBase {
638
+ id: string;
639
+ workspaceId: string;
640
+ name: string;
641
+ targetRef: string;
642
+ target: DigitalTarget;
643
+ sector: string;
644
+ mission: string;
645
+ kind: DigitalTestKind;
646
+ userId?: string;
647
+ createdAt: string;
648
+ updatedAt: string;
649
+ }
650
+ /** `required: [targetRef, target, sector, mission]`. */
651
+ type CreateDigitalTestRunRequest = DigitalTestConfigBase & {
652
+ targetRef: string;
653
+ target: DigitalTarget;
654
+ sector: string;
655
+ mission: string;
656
+ };
657
+ /** `required: [name, targetRef, target, sector, mission]`. */
658
+ type CreateDigitalTestConfigRequest = DigitalTestConfigBase & {
659
+ name: string;
660
+ targetRef: string;
661
+ target: DigitalTarget;
662
+ sector: string;
663
+ mission: string;
664
+ };
665
+ type UpdateDigitalTestConfigRequest = DigitalTestConfigBase;
666
+ /**
667
+ * Optional overrides. Everything not supplied comes from the saved config.
668
+ * `target` and `targetRef` must be overridden TOGETHER - a half-override is a 400.
669
+ */
670
+ interface LaunchDigitalTestConfigRequest {
671
+ targetRef?: string;
672
+ target?: DigitalTarget;
673
+ samples?: number;
674
+ }
675
+ interface DigitalTestRunListParams {
676
+ targetRef?: string;
677
+ limit?: number;
678
+ cursor?: string;
679
+ nextToken?: string | null;
680
+ }
681
+ interface DigitalTestConfigListParams {
682
+ limit?: number;
683
+ cursor?: string;
684
+ nextToken?: string | null;
685
+ }
686
+ interface DigitalComplianceAuditSummary {
687
+ targetRef: string;
688
+ lastRunAt: string;
689
+ runCount: number;
690
+ catalogueTestIds: string[];
691
+ }
692
+ /** Optional filters for `GET /digital-testing/compliance-audits/report`. */
693
+ interface DigitalComplianceReportParams {
694
+ /** Restrict the catalogue to tests applicable to this sector. */
695
+ sector?: string;
696
+ }
697
+ interface CreateDigitalTestRunResponse {
698
+ message: string;
699
+ run: DigitalTestRun;
700
+ }
701
+ /**
702
+ * One page of runs, newest first. `nextCursor` is present ONLY when another
703
+ * page exists, and is OMITTED (not null) on the last page.
704
+ */
705
+ interface ListDigitalTestRunsResponse {
706
+ runs: DigitalTestRun[];
707
+ nextCursor?: string;
708
+ }
709
+ /** One page of saved configs, most recently updated first. */
710
+ interface ListDigitalTestConfigsResponse {
711
+ configs: DigitalTestConfig[];
712
+ nextCursor?: string;
713
+ }
714
+ interface ListDigitalComplianceAuditsResponse {
715
+ audits: DigitalComplianceAuditSummary[];
716
+ }
717
+
718
+ /**
719
+ * Digital (chat channel) compliance audits.
720
+ *
721
+ * @beta Access is limited to beta workspaces during the beta period.
722
+ */
723
+ declare class DigitalComplianceResource extends Resource {
724
+ /**
725
+ * List digital compliance audits, one entry per target.
726
+ *
727
+ * @beta Access is limited to beta workspaces during the beta period.
728
+ */
729
+ listAudits(requestOptions?: RequestOptions): Promise<DigitalComplianceAuditSummary[]>;
730
+ /**
731
+ * Compliance report for one digital target.
732
+ *
733
+ * `targetRef` goes in the QUERY STRING, not the path: a targetRef contains
734
+ * slashes (`acme/billing-bot`) and a single path segment cannot hold one. The
735
+ * API made the same choice for the same reason.
736
+ *
737
+ * Pass `{ sector }` to restrict the catalogue to tests applicable to that sector.
738
+ *
739
+ * @beta Access is limited to beta workspaces during the beta period.
740
+ */
741
+ getReport(targetRef: string, params?: DigitalComplianceReportParams, requestOptions?: RequestOptions): Promise<unknown>;
742
+ }
743
+
744
+ /**
745
+ * Saved digital (chat channel) test configs.
746
+ *
747
+ * @beta Access is limited to beta workspaces during the beta period.
748
+ */
749
+ declare class DigitalTestConfigsResource extends Resource {
750
+ /** @beta Access is limited to beta workspaces during the beta period. */
751
+ list(params?: DigitalTestConfigListParams, requestOptions?: RequestOptions): Paginator<DigitalTestConfig>;
752
+ /** @beta Access is limited to beta workspaces during the beta period. */
753
+ listPage(params?: DigitalTestConfigListParams, requestOptions?: RequestOptions): Promise<Page<DigitalTestConfig>>;
754
+ /**
755
+ * Save a digital test config. Per-kind rules are enforced at SAVE time, so a
756
+ * config that could never run is rejected with 400 rather than stored.
757
+ *
758
+ * @beta Access is limited to beta workspaces during the beta period.
759
+ */
760
+ create(body: CreateDigitalTestConfigRequest, requestOptions?: RequestOptions): Promise<DigitalTestConfig>;
761
+ /** @beta Access is limited to beta workspaces during the beta period. */
762
+ get(configId: string, requestOptions?: RequestOptions): Promise<DigitalTestConfig>;
763
+ /** @beta Access is limited to beta workspaces during the beta period. */
764
+ update(configId: string, body: UpdateDigitalTestConfigRequest, requestOptions?: RequestOptions): Promise<DigitalTestConfig>;
765
+ /** @beta Access is limited to beta workspaces during the beta period. */
766
+ delete(configId: string, requestOptions?: RequestOptions): Promise<void>;
767
+ /**
768
+ * Launch a run from a saved config. `target` and `targetRef` must be
769
+ * overridden together — a half-override is a 400.
770
+ *
771
+ * @beta Access is limited to beta workspaces during the beta period.
772
+ */
773
+ launch(configId: string, body?: LaunchDigitalTestConfigRequest, requestOptions?: RequestOptions): Promise<DigitalTestRun>;
774
+ }
775
+
776
+ /** Mirrors `BatchesWaitForOptions` (`src/resources/batches.ts:15-21`). */
777
+ interface DigitalTestingWaitForOptions {
778
+ timeout?: number;
779
+ pollInterval?: number;
780
+ intervalCap?: number;
781
+ onUpdate?: (run: DigitalTestRun) => void;
782
+ requestOptions?: RequestOptions;
783
+ }
784
+ /**
785
+ * Digital (chat channel) test runs.
786
+ *
787
+ * @beta Access is limited to beta workspaces during the beta period.
788
+ */
789
+ declare class DigitalTestingResource extends Resource {
790
+ /**
791
+ * Queue a digital test run.
792
+ *
793
+ * @beta Access is limited to beta workspaces during the beta period.
794
+ */
795
+ create(body: CreateDigitalTestRunRequest, requestOptions?: RequestOptions): Promise<DigitalTestRun>;
796
+ /**
797
+ * Paginated list of digital test runs, newest first.
798
+ *
799
+ * @beta Access is limited to beta workspaces during the beta period.
800
+ */
801
+ list(params?: DigitalTestRunListParams, requestOptions?: RequestOptions): Paginator<DigitalTestRun>;
802
+ /**
803
+ * One page of digital test runs.
804
+ *
805
+ * @beta Access is limited to beta workspaces during the beta period.
806
+ */
807
+ listPage(params?: DigitalTestRunListParams, requestOptions?: RequestOptions): Promise<Page<DigitalTestRun>>;
808
+ /**
809
+ * Get one digital test run.
810
+ *
811
+ * @beta Access is limited to beta workspaces during the beta period.
812
+ */
813
+ get(runId: string, requestOptions?: RequestOptions): Promise<DigitalTestRun>;
814
+ /**
815
+ * Cancel a digital test run.
816
+ *
817
+ * @beta Access is limited to beta workspaces during the beta period.
818
+ */
819
+ cancel(runId: string, requestOptions?: RequestOptions): Promise<DigitalTestRun>;
820
+ /**
821
+ * Poll until the run reaches a terminal state.
822
+ *
823
+ * Resolves on `completed`, `failed` and `cancelled` alike and returns the run.
824
+ * A bot that behaved badly is `completed` with `outcome: 'fail'`, which is a
825
+ * RESULT, not an error — this never throws on it. `failed` means the test could
826
+ * not be delivered.
827
+ *
828
+ * @beta Access is limited to beta workspaces during the beta period.
829
+ */
830
+ waitForRun(runId: string, opts?: DigitalTestingWaitForOptions): Promise<DigitalTestRun>;
831
+ }
832
+
271
833
  type EnrichmentStatus = 'queued' | 'running' | 'completed' | 'failed';
272
834
  interface EnrichmentDimensions {
273
835
  accessibility?: number;
@@ -408,13 +970,172 @@ declare class LoadTestingResource extends Resource {
408
970
  waitForComplete(loadTestId: string, opts?: LoadTestingWaitForOptions): Promise<LoadTestStatusResponse>;
409
971
  }
410
972
 
973
+ /**
974
+ * Unified telemetry contract (schemaVersion 1) emitted by the mapping/testing
975
+ * containers. Every field except `schemaVersion` is optional and the objects
976
+ * tolerate unknown keys (passthrough during rollout), so these types are modelled
977
+ * permissively — treat any nested field as possibly-absent.
978
+ *
979
+ * See api/packages/schemas/entities/call-telemetry.ts for the authoritative shape.
980
+ */
981
+ interface TurnTelemetry {
982
+ schemaVersion: 1;
983
+ timing?: {
984
+ startedAt?: string;
985
+ endedAt?: string;
986
+ durationMs?: number;
987
+ responseLatencyMs?: number;
988
+ [key: string]: unknown;
989
+ };
990
+ transcript?: {
991
+ avgWordConfidence?: number;
992
+ minWordConfidence?: number;
993
+ detectedLanguage?: string;
994
+ wordCount?: number;
995
+ words?: Array<{
996
+ word: string;
997
+ startMs: number;
998
+ endMs: number;
999
+ confidence?: number;
1000
+ }>;
1001
+ [key: string]: unknown;
1002
+ };
1003
+ dtmf?: {
1004
+ digitsSent?: string;
1005
+ digitsReceived?: string;
1006
+ sentOnDelay?: boolean;
1007
+ sendDurationMs?: number;
1008
+ completedAt?: string;
1009
+ [key: string]: unknown;
1010
+ };
1011
+ llmExtraction?: {
1012
+ operation?: string;
1013
+ model?: string;
1014
+ inputTokens?: number;
1015
+ outputTokens?: number;
1016
+ latencyMs?: number;
1017
+ reasoning?: string;
1018
+ hallucinationDetected?: boolean;
1019
+ [key: string]: unknown;
1020
+ };
1021
+ conversationTurn?: {
1022
+ role?: 'user' | 'assistant' | 'system';
1023
+ timestamp?: string;
1024
+ turnIndex?: number;
1025
+ text?: string;
1026
+ [key: string]: unknown;
1027
+ };
1028
+ [key: string]: unknown;
1029
+ }
1030
+ interface CallTelemetry {
1031
+ schemaVersion: 1;
1032
+ telephony?: {
1033
+ callLegId?: string;
1034
+ callSessionId?: string;
1035
+ telnyxConnectionId?: string;
1036
+ hangupCause?: string;
1037
+ hangupSource?: string;
1038
+ sipHangupCause?: string;
1039
+ initiatedByUs?: boolean;
1040
+ terminalStatus?: 'completed' | 'failed' | 'aborted_by_duration' | 'aborted_by_cost' | 'aborted_by_inactivity' | 'aborted_mid_stream' | 'aborted_by_reaper' | 'no_answer';
1041
+ terminationReason?: string;
1042
+ [key: string]: unknown;
1043
+ };
1044
+ quality?: {
1045
+ inboundMos?: number;
1046
+ inboundJitterMaxVarianceMs?: number;
1047
+ inboundPacketCount?: number;
1048
+ inboundPacketsLost?: number;
1049
+ outboundMos?: number;
1050
+ outboundJitterMaxVarianceMs?: number;
1051
+ outboundPacketCount?: number;
1052
+ outboundPacketsLost?: number;
1053
+ codec?: string;
1054
+ sampleRateHz?: number;
1055
+ [key: string]: unknown;
1056
+ };
1057
+ audio?: {
1058
+ coverage?: number;
1059
+ noiseFloorEnergy?: number;
1060
+ maxSilenceSecs?: number;
1061
+ speechEndOffsetSecs?: number;
1062
+ totalChunks?: number;
1063
+ speechChunks?: number;
1064
+ audioId?: string;
1065
+ audioS3Key?: string;
1066
+ audioSizeBytes?: number;
1067
+ audioDurationSecs?: number;
1068
+ audioFormat?: 'wav' | 'mp3' | 'wav-mp3-payload';
1069
+ telnyxRecordingId?: string;
1070
+ [key: string]: unknown;
1071
+ };
1072
+ cost?: {
1073
+ telnyxTotalUsd?: number;
1074
+ telnyxCostParts?: Array<{
1075
+ part: string;
1076
+ billedSecs: number;
1077
+ costUsd: number;
1078
+ currency: string;
1079
+ rate?: number;
1080
+ }>;
1081
+ computedDurationSecs?: number;
1082
+ computedPerMinuteRateUsd?: number;
1083
+ computedCostUsd?: number;
1084
+ [key: string]: unknown;
1085
+ };
1086
+ timing?: {
1087
+ dialedAt?: string;
1088
+ answeredAt?: string;
1089
+ endedAt?: string;
1090
+ dialToAnswerMs?: number;
1091
+ answerToFirstUtteranceMs?: number;
1092
+ [key: string]: unknown;
1093
+ };
1094
+ mode?: {
1095
+ detected?: 'voice' | 'dtmf' | 'hybrid' | 'unknown';
1096
+ voiceTurnCount?: number;
1097
+ dtmfTurnCount?: number;
1098
+ dtmfInboundDetected?: boolean;
1099
+ [key: string]: unknown;
1100
+ };
1101
+ turns?: TurnTelemetry[];
1102
+ [key: string]: unknown;
1103
+ }
1104
+
411
1105
  type JobStatus = 'idle' | 'queued' | 'running' | 'completed' | 'failed' | 'limited' | 'cancelled' | 'created';
412
1106
  type StepStatus = 'pending' | 'running' | 'completed' | 'failed' | 'retrying' | 'skipped';
413
1107
  type MappingMode = 'dtmf' | 'dtmf-audio' | 'full-audio';
1108
+ /**
1109
+ * Latest-run status used by the list filter and the `MappingJobListItem.status`
1110
+ * field (post-merged from the run, not the job-level idle/running cycle).
1111
+ */
1112
+ type MappingRunStatus = 'idle' | 'running' | 'completed' | 'failed' | 'limited';
1113
+ /**
1114
+ * Industry vertical used for prompt-library lookup. Required by the API
1115
+ * whenever `mappingMode` is not `dtmf`.
1116
+ */
1117
+ type Vertical = 'FSI' | 'Healthcare' | 'EnergyUtilities' | 'Telecoms' | 'General';
1118
+ /** Behaviour when the orchestrator revisits an already-discovered menu. */
1119
+ type RepeatBehavior = 'skip' | 'explore_once' | 'explore_n';
414
1120
  interface RetryConfig {
415
1121
  enabled: boolean;
416
1122
  maxRetries: number;
417
1123
  }
1124
+ interface RepeatConfig {
1125
+ behavior: RepeatBehavior;
1126
+ /** Only meaningful when `behavior` is `explore_n`. Defaults to 2 server-side. */
1127
+ maxExplorations?: number;
1128
+ }
1129
+ interface EnrichmentConfig {
1130
+ enabled: boolean;
1131
+ /** Defaults to `["quality_scoring"]` server-side. */
1132
+ types?: string[];
1133
+ }
1134
+ /**
1135
+ * Per-job configuration. Every mode-related knob lives here rather than at the
1136
+ * top of the request body — the API reads `body.config.mappingMode`, and a
1137
+ * top-level `mappingMode` is ignored.
1138
+ */
418
1139
  interface MappingJobConfig {
419
1140
  maxDepth?: number;
420
1141
  maxCalls?: number;
@@ -424,6 +1145,13 @@ interface MappingJobConfig {
424
1145
  voiceProfileId?: string;
425
1146
  dataProfileId?: string;
426
1147
  retryConfig?: RetryConfig;
1148
+ repeatConfig?: RepeatConfig;
1149
+ enrichmentConfig?: EnrichmentConfig;
1150
+ mappingMode?: MappingMode;
1151
+ /** Required when `mappingMode` is `dtmf-audio` or `full-audio`. */
1152
+ vertical?: Vertical;
1153
+ /** Security-probe mode. The API rejects it combined with `mappingMode: 'dtmf'`. */
1154
+ probeMode?: boolean;
427
1155
  }
428
1156
  interface MappingJobStats {
429
1157
  totalCalls: number;
@@ -432,13 +1160,27 @@ interface MappingJobStats {
432
1160
  loopsDetected: number;
433
1161
  retriedCalls: number;
434
1162
  }
1163
+ /**
1164
+ * Nested run summary surfaced on the single-job response (`GET /mapping/{id}`).
1165
+ * Present when a run exists; omitted (never null) when the job has no runs yet.
1166
+ * Unlike the job-level status, `status` here CAN reach `completed`.
1167
+ */
1168
+ interface CurrentRun {
1169
+ id: string;
1170
+ status: 'queued' | 'running' | 'completed' | 'failed' | 'limited';
1171
+ runNumber: number;
1172
+ stats?: MappingJobStats;
1173
+ inFlightCount?: number;
1174
+ limitReason?: string;
1175
+ startedAt?: string;
1176
+ completedAt?: string;
1177
+ }
435
1178
  interface MappingJob {
436
1179
  id: string;
437
1180
  workspaceId?: string;
438
1181
  userId?: string;
439
1182
  name: string;
440
1183
  phoneNumber?: string;
441
- mappingMode?: MappingMode;
442
1184
  profileId?: string;
443
1185
  status: JobStatus;
444
1186
  config?: MappingJobConfig;
@@ -447,31 +1189,80 @@ interface MappingJob {
447
1189
  pendingPaths?: string[];
448
1190
  currentRunId?: string;
449
1191
  runId?: string;
1192
+ runNumber?: number;
1193
+ /** Nested run summary — present when a run exists; omitted (never null) otherwise. */
1194
+ currentRun?: CurrentRun;
450
1195
  limitReason?: string;
451
1196
  error?: string;
1197
+ /** User-defined labels (max 10, lowercase kebab-case). */
1198
+ tags?: string[];
452
1199
  createdAt?: string;
453
1200
  updatedAt?: string;
454
1201
  startedAt?: string;
455
1202
  completedAt?: string;
456
1203
  cancelledAt?: string;
457
1204
  }
1205
+ /**
1206
+ * Slim projection returned by `mapping.list()`. `status` is the latest-run
1207
+ * status (post-merged), not the job-level idle/running cycle.
1208
+ */
1209
+ interface MappingJobListItem {
1210
+ id: string;
1211
+ workspaceId?: string;
1212
+ userId?: string;
1213
+ name: string;
1214
+ phoneNumber?: string;
1215
+ status: MappingRunStatus | JobStatus;
1216
+ config?: MappingJobConfig;
1217
+ tags?: string[];
1218
+ error?: string;
1219
+ runNumber?: number;
1220
+ profileId?: string;
1221
+ createdAt?: string;
1222
+ updatedAt?: string;
1223
+ }
458
1224
  interface CreateMappingJobRequest {
459
1225
  name: string;
460
1226
  phoneNumber: string;
461
- mappingMode: MappingMode;
462
1227
  profileId?: string;
463
1228
  config?: MappingJobConfig;
1229
+ /** User-defined labels (max 10, lowercase kebab-case). */
1230
+ tags?: string[];
464
1231
  }
465
1232
  interface UpdateMappingJobRequest {
466
1233
  name?: string;
467
1234
  phoneNumber?: string;
468
- mappingMode?: MappingMode;
469
1235
  config?: MappingJobConfig;
1236
+ /** User-defined labels (max 10, lowercase kebab-case). */
1237
+ tags?: string[];
470
1238
  }
471
1239
  interface MappingListParams {
472
- workspaceId?: string;
1240
+ /** E.164 exact match. */
1241
+ phoneNumber?: string;
1242
+ /** Case-insensitive substring match on job name. */
1243
+ name?: string;
1244
+ /** Exact UUID match on the data profile. */
1245
+ profileId?: string;
1246
+ /** Single lowercase tag exact match. */
1247
+ tag?: string;
1248
+ /** Filter by latest-run status. */
1249
+ status?: MappingRunStatus;
1250
+ /** ISO8601 datetime — jobs created at or after this time. */
1251
+ createdAfter?: string;
1252
+ /** ISO8601 datetime — jobs created at or before this time. */
1253
+ createdBefore?: string;
1254
+ /** Sort field (only 'createdAt' supported). */
1255
+ sort?: 'createdAt';
1256
+ /** Sort direction (default 'desc'). */
1257
+ sortDir?: 'asc' | 'desc';
1258
+ /** Results per page (1..100, default 50). */
473
1259
  limit?: number;
1260
+ /** Opaque pagination cursor from a previous response's nextCursor. */
1261
+ cursor?: string;
1262
+ /** @deprecated Back-compat alias for `cursor`. */
474
1263
  nextToken?: string;
1264
+ /** @deprecated No longer read by the API; workspace is derived from the key. */
1265
+ workspaceId?: string;
475
1266
  }
476
1267
  interface DTMFOption {
477
1268
  digit: string;
@@ -484,6 +1275,8 @@ interface StepResult {
484
1275
  audioUrl?: string;
485
1276
  audioSizeBytes?: number;
486
1277
  duration?: number;
1278
+ /** Per-step telemetry (additive, all-optional). */
1279
+ turnTelemetry?: TurnTelemetry;
487
1280
  }
488
1281
  interface MappingStep {
489
1282
  id: string;
@@ -501,7 +1294,28 @@ interface MappingStep {
501
1294
  createdAt?: string;
502
1295
  completedAt?: string;
503
1296
  }
504
- interface TreeNode {
1297
+ /** Per-step UX hint for prompts that require user input (e.g. PIN/account number). */
1298
+ interface TreeInputRequired {
1299
+ type: string;
1300
+ description: string;
1301
+ formatHint?: string;
1302
+ terminator?: string;
1303
+ startTimeMs?: number;
1304
+ }
1305
+ /** Enrichment fields shared by TreeNode and FlatTreeNode (all optional/additive). */
1306
+ interface TreeNodeEnrichment {
1307
+ stepType?: 'dtmf' | 'voice';
1308
+ voicePrompt?: string;
1309
+ menuLabel?: string;
1310
+ spokenResponse?: string;
1311
+ probeCategory?: string;
1312
+ probeClassification?: string;
1313
+ probeRationale?: string;
1314
+ audioUrl?: string;
1315
+ duration?: number;
1316
+ inputRequired?: TreeInputRequired;
1317
+ }
1318
+ interface TreeNode extends TreeNodeEnrichment {
505
1319
  stepId: string;
506
1320
  digit?: string;
507
1321
  label?: string;
@@ -511,16 +1325,47 @@ interface TreeNode {
511
1325
  transcript?: string;
512
1326
  isTerminal: boolean;
513
1327
  children: TreeNode[];
514
- duration?: number;
515
- audioUrl?: string;
516
1328
  }
1329
+ interface FlatTreeNode extends TreeNodeEnrichment {
1330
+ stepId: string;
1331
+ digit?: string;
1332
+ label?: string;
1333
+ depth: number;
1334
+ path: string[];
1335
+ status: StepStatus;
1336
+ transcript?: string;
1337
+ isTerminal: boolean;
1338
+ }
1339
+ /**
1340
+ * Empty-state envelope (200 OK) returned by the tree endpoint when there is no
1341
+ * tree to render. Branch on `tree === null` to detect it.
1342
+ */
1343
+ interface MappingTreeEmptyState {
1344
+ jobId: string;
1345
+ runId?: string;
1346
+ runNumber?: number;
1347
+ status: string;
1348
+ stats?: MappingJobStats;
1349
+ tree: null;
1350
+ reason: 'no_runs' | 'no_steps' | 'in_progress';
1351
+ message: string;
1352
+ }
1353
+ /**
1354
+ * Tree response. In the happy path `tree` (or `steps` for flat format) is
1355
+ * populated; in the empty state `tree` is `null` and `reason`/`message` explain
1356
+ * why. `root` is retained for back-compat with older shapes.
1357
+ */
517
1358
  interface MappingTree {
518
1359
  jobId?: string;
519
1360
  runId?: string;
1361
+ runNumber?: number;
520
1362
  status?: string;
521
1363
  stats?: MappingJobStats;
522
1364
  tree?: TreeNode | null;
523
1365
  root?: TreeNode | null;
1366
+ /** Present when format='flat'. */
1367
+ steps?: FlatTreeNode[];
1368
+ reason?: 'no_runs' | 'no_steps' | 'in_progress';
524
1369
  message?: string;
525
1370
  }
526
1371
  interface MappingPath {
@@ -535,11 +1380,18 @@ interface MappingRun {
535
1380
  id: string;
536
1381
  jobId?: string;
537
1382
  status: string;
1383
+ runNumber?: number;
538
1384
  startedAt?: string;
539
1385
  completedAt?: string;
540
1386
  stats?: MappingJobStats;
1387
+ /** Call-level telemetry (additive, all-optional). */
1388
+ callTelemetry?: CallTelemetry;
541
1389
  }
542
1390
  type TreeFormat = 'tree' | 'flat';
1391
+ interface ProbeResult {
1392
+ message: string;
1393
+ probeCount: number;
1394
+ }
543
1395
 
544
1396
  interface WaitForCompleteOptions {
545
1397
  timeout?: number;
@@ -549,8 +1401,8 @@ interface WaitForCompleteOptions {
549
1401
  requestOptions?: RequestOptions;
550
1402
  }
551
1403
  declare class MappingResource extends Resource {
552
- list(params?: MappingListParams, requestOptions?: RequestOptions): Paginator<MappingJob>;
553
- listPage(params?: MappingListParams, requestOptions?: RequestOptions): Promise<Page<MappingJob>>;
1404
+ list(params?: MappingListParams, requestOptions?: RequestOptions): Paginator<MappingJobListItem>;
1405
+ listPage(params?: MappingListParams, requestOptions?: RequestOptions): Promise<Page<MappingJobListItem>>;
554
1406
  get(jobId: string, requestOptions?: RequestOptions): Promise<MappingJob>;
555
1407
  create(body: CreateMappingJobRequest, requestOptions?: RequestOptions): Promise<MappingJob>;
556
1408
  update(jobId: string, body: UpdateMappingJobRequest, requestOptions?: RequestOptions): Promise<MappingJob>;
@@ -560,6 +1412,7 @@ declare class MappingResource extends Resource {
560
1412
  attest(jobId: string, requestOptions?: RequestOptions): Promise<{
561
1413
  attested: boolean;
562
1414
  }>;
1415
+ probe(jobId: string, runId: string, requestOptions?: RequestOptions): Promise<ProbeResult>;
563
1416
  steps(jobId: string, params?: {
564
1417
  limit?: number;
565
1418
  nextToken?: string;
@@ -578,26 +1431,139 @@ declare class MappingResource extends Resource {
578
1431
  updatePath(jobId: string, path: string, body: Record<string, unknown>, requestOptions?: RequestOptions): Promise<MappingPath>;
579
1432
  deletePath(jobId: string, path: string, requestOptions?: RequestOptions): Promise<void>;
580
1433
  remap(jobId: string, path: string, requestOptions?: RequestOptions): Promise<MappingJob>;
581
- probe(jobId: string, runId: string, body?: Record<string, unknown>, requestOptions?: RequestOptions): Promise<unknown>;
582
1434
  waitForComplete(jobId: string, opts?: WaitForCompleteOptions): Promise<MappingJob>;
583
1435
  }
584
1436
 
585
- interface ProfileItem {
1437
+ interface CreateMissionTestConfigRequest {
1438
+ name: string;
1439
+ description?: string;
1440
+ sector: string;
1441
+ mission: string;
1442
+ acceptance: string;
1443
+ profileId: string;
1444
+ phoneNumber?: string;
1445
+ /** User-defined labels (max 10, lowercase kebab-case). */
1446
+ tags?: string[];
1447
+ }
1448
+ /**
1449
+ * Partial update for `PATCH /testing/mission-test-configs/{id}`. At least one
1450
+ * field must be provided. `description` and `tags` accept `null` to clear.
1451
+ */
1452
+ interface UpdateMissionTestConfigRequest {
1453
+ name?: string;
1454
+ description?: string | null;
1455
+ phoneNumber?: string;
1456
+ sector?: string;
1457
+ mission?: string;
1458
+ acceptance?: string;
1459
+ profileId?: string;
1460
+ tags?: string[] | null;
1461
+ }
1462
+ interface MissionTestConfig {
586
1463
  id: string;
1464
+ workspaceId: string;
1465
+ name: string;
1466
+ description?: string;
1467
+ phoneNumber?: string;
1468
+ sector: string;
1469
+ mission: string;
1470
+ acceptance: string;
1471
+ profileId: string;
1472
+ /** User-defined labels (max 10, lowercase kebab-case). */
1473
+ tags?: string[];
1474
+ createdAt: string;
1475
+ updatedAt: string;
1476
+ }
1477
+ /**
1478
+ * Slim projection returned by `missionTestConfigs.list()`. Drops the long-text
1479
+ * `mission` and `acceptance` fields — fetch the full row with `get()`.
1480
+ */
1481
+ interface MissionTestConfigListItem {
1482
+ id: string;
1483
+ workspaceId: string;
1484
+ name: string;
1485
+ description?: string;
1486
+ phoneNumber?: string;
1487
+ sector: string;
1488
+ profileId: string;
1489
+ tags?: string[];
1490
+ createdAt: string;
1491
+ updatedAt: string;
1492
+ }
1493
+ interface MissionTestConfigListParams {
1494
+ name?: string;
1495
+ phoneNumber?: string;
1496
+ sector?: string;
587
1497
  profileId?: string;
588
- label: string;
589
- value: string;
590
- createdAt?: string;
591
- updatedAt?: string;
1498
+ /** Single lowercase tag exact match. */
1499
+ tag?: string;
1500
+ /** ISO8601 datetime. */
1501
+ createdAfter?: string;
1502
+ /** ISO8601 datetime. */
1503
+ createdBefore?: string;
1504
+ sort?: 'createdAt' | 'name';
1505
+ sortDir?: 'asc' | 'desc';
1506
+ /** Results per page (1..100, default 50). */
1507
+ limit?: number;
1508
+ /** Opaque pagination cursor. */
1509
+ cursor?: string;
1510
+ /** @deprecated Back-compat alias for `cursor`. */
1511
+ nextToken?: string;
592
1512
  }
1513
+
1514
+ declare class MissionTestConfigsResource extends Resource {
1515
+ list(params?: MissionTestConfigListParams, requestOptions?: RequestOptions): Paginator<MissionTestConfigListItem>;
1516
+ listPage(params?: MissionTestConfigListParams, requestOptions?: RequestOptions): Promise<Page<MissionTestConfigListItem>>;
1517
+ create(body: CreateMissionTestConfigRequest, requestOptions?: RequestOptions): Promise<MissionTestConfig>;
1518
+ get(id: string, requestOptions?: RequestOptions): Promise<MissionTestConfig>;
1519
+ update(id: string, body: UpdateMissionTestConfigRequest, requestOptions?: RequestOptions): Promise<MissionTestConfig>;
1520
+ delete(id: string, requestOptions?: RequestOptions): Promise<void>;
1521
+ run(id: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1522
+ }
1523
+
1524
+ declare class MissionTestsResource extends Resource {
1525
+ list(params?: MissionTestListParams, requestOptions?: RequestOptions): Paginator<MissionTestRun>;
1526
+ listPage(params?: MissionTestListParams, requestOptions?: RequestOptions): Promise<Page<MissionTestRun>>;
1527
+ create(body: CreateMissionTestRequest, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1528
+ getDefaults(requestOptions?: RequestOptions): Promise<MissionTestDefaults>;
1529
+ get(id: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1530
+ cancel(id: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1531
+ }
1532
+
1533
+ /**
1534
+ * Profile items are a discriminated union on `type`. A voice item points at an
1535
+ * uploaded audio row; a data item points at an item inside a dataset. Branch on
1536
+ * `type` before reaching for `audioId` or `datasetId`.
1537
+ */
1538
+ interface ProfileVoiceItemBase {
1539
+ id: string;
1540
+ /**
1541
+ * Legacy display label. Deprecated server-side and no longer written — for
1542
+ * data items the label is derived from the dataset item's key at read time,
1543
+ * so it is frequently absent. Do not rely on it.
1544
+ */
1545
+ label?: string;
1546
+ description?: string;
1547
+ }
1548
+ interface ProfileVoiceItem extends ProfileVoiceItemBase {
1549
+ type: 'voice';
1550
+ audioId: string;
1551
+ }
1552
+ interface ProfileDataItem extends ProfileVoiceItemBase {
1553
+ type: 'data';
1554
+ datasetId: string;
1555
+ itemId: string;
1556
+ }
1557
+ type ProfileItem = ProfileVoiceItem | ProfileDataItem;
593
1558
  interface Profile {
594
1559
  id: string;
1560
+ workspaceId?: string;
595
1561
  name: string;
596
1562
  description?: string;
597
1563
  items?: ProfileItem[];
598
1564
  createdAt?: string;
599
1565
  updatedAt?: string;
600
- matchedLabels?: string[];
1566
+ createdBy?: string;
601
1567
  }
602
1568
  interface CreateProfileRequest {
603
1569
  name: string;
@@ -607,13 +1573,27 @@ interface UpdateProfileRequest {
607
1573
  name?: string;
608
1574
  description?: string;
609
1575
  }
610
- interface AddProfileItemRequest {
1576
+ /**
1577
+ * Body for `POST /profiles/{id}/items`. `type` selects which id field the API
1578
+ * requires, and `label` is required by this legacy route even though the field
1579
+ * is deprecated on the stored item.
1580
+ */
1581
+ type AddProfileItemRequest = {
1582
+ type: 'voice';
1583
+ audioId: string;
611
1584
  label: string;
612
- value: string;
613
- }
1585
+ description?: string;
1586
+ } | {
1587
+ type: 'data';
1588
+ datasetId: string;
1589
+ itemId: string;
1590
+ label: string;
1591
+ description?: string;
1592
+ };
1593
+ /** Body for `PUT /profiles/{id}/items/{itemId}`. Only these two are read. */
614
1594
  interface UpdateProfileItemRequest {
615
1595
  label?: string;
616
- value?: string;
1596
+ description?: string;
617
1597
  }
618
1598
  interface ProfilesListParams {
619
1599
  limit?: number;
@@ -638,41 +1618,77 @@ declare class ProfilesResource extends Resource {
638
1618
  get(profileId: string, requestOptions?: RequestOptions): Promise<Profile>;
639
1619
  update(profileId: string, body: UpdateProfileRequest, requestOptions?: RequestOptions): Promise<Profile>;
640
1620
  delete(profileId: string, requestOptions?: RequestOptions): Promise<void>;
641
- addItem(profileId: string, body: AddProfileItemRequest, requestOptions?: RequestOptions): Promise<ProfileItem>;
642
- updateItem(profileId: string, itemId: string, body: UpdateProfileItemRequest, requestOptions?: RequestOptions): Promise<ProfileItem>;
643
- deleteItem(profileId: string, itemId: string, requestOptions?: RequestOptions): Promise<void>;
1621
+ addItem(profileId: string, body: AddProfileItemRequest, requestOptions?: RequestOptions): Promise<Profile>;
1622
+ updateItem(profileId: string, itemId: string, body: UpdateProfileItemRequest, requestOptions?: RequestOptions): Promise<Profile>;
1623
+ /** Returns the updated profile, as all three item routes do. */
1624
+ deleteItem(profileId: string, itemId: string, requestOptions?: RequestOptions): Promise<Profile>;
644
1625
  listParameters(requestOptions?: RequestOptions): Promise<ProfileParametersResponse>;
645
1626
  findByParameters(params: ProfilesByParametersParams, requestOptions?: RequestOptions): Promise<ProfilesByParametersResponse>;
646
1627
  }
647
1628
 
648
- type ScheduleStatus = 'active' | 'paused' | 'disabled';
1629
+ /**
1630
+ * Which firing strategy a schedule uses. Required on create — the API rejects
1631
+ * a schedule without one, and each variant requires a different companion
1632
+ * field: `cron` needs `cronExpression`, `recurring` needs `intervalMinutes`,
1633
+ * `once` needs a future `runAt`.
1634
+ */
1635
+ type ScheduleType = 'once' | 'recurring' | 'cron';
1636
+ /** What the schedule fires against. Optional — a schedule with no target is a reusable template. */
1637
+ type ScheduleTargetType = 'test' | 'map' | 'batch';
649
1638
  interface Schedule {
650
1639
  id: string;
1640
+ workspaceId: string;
651
1641
  name: string;
652
- configId: string;
653
- cronExpression: string;
654
- timezone?: string;
655
- status: ScheduleStatus;
656
- nextRunAt?: string;
657
- createdAt?: string;
658
- updatedAt?: string;
659
- pausedAt?: string;
660
- resumedAt?: string;
1642
+ description?: string;
1643
+ targetId?: string;
1644
+ targetType?: ScheduleTargetType;
1645
+ scheduleType: ScheduleType;
1646
+ cronExpression?: string;
1647
+ intervalMinutes?: number;
1648
+ runAt?: string;
1649
+ timezone: string;
1650
+ /** Wire value is the string `'true'` / `'false'`, not a boolean — it backs a GSI key. */
1651
+ enabled: 'true' | 'false';
1652
+ lastRunAt?: string;
1653
+ nextRunAt: string;
1654
+ runCount: number;
1655
+ eventBridgeRuleArn?: string;
1656
+ eventBridgeRuleName?: string;
1657
+ createdAt: string;
1658
+ updatedAt: string;
1659
+ createdBy: string;
661
1660
  }
662
1661
  interface CreateScheduleRequest {
663
1662
  name: string;
664
- configId: string;
665
- cronExpression: string;
1663
+ scheduleType: ScheduleType;
1664
+ description?: string;
1665
+ targetId?: string;
1666
+ targetType?: ScheduleTargetType;
1667
+ /** Required when scheduleType is 'cron'. */
1668
+ cronExpression?: string;
1669
+ /** Required when scheduleType is 'recurring'. Minimum 1. */
1670
+ intervalMinutes?: number;
1671
+ /** Required when scheduleType is 'once'. ISO timestamp, must be in the future. */
1672
+ runAt?: string;
1673
+ /** IANA timezone. Defaults server-side to 'UTC'. */
666
1674
  timezone?: string;
667
1675
  }
668
1676
  interface UpdateScheduleRequest {
669
1677
  name?: string;
1678
+ description?: string;
1679
+ scheduleType?: ScheduleType;
670
1680
  cronExpression?: string;
1681
+ intervalMinutes?: number;
1682
+ runAt?: string;
671
1683
  timezone?: string;
1684
+ /** Sent as a boolean; the API coerces it to the `'true'`/`'false'` wire form. */
1685
+ enabled?: boolean;
672
1686
  }
673
1687
  interface ScheduleListParams {
674
1688
  limit?: number;
675
1689
  nextToken?: string;
1690
+ /** Filter to schedules attached to one target. */
1691
+ targetId?: string;
676
1692
  }
677
1693
 
678
1694
  declare class SchedulerResource extends Resource {
@@ -800,7 +1816,6 @@ interface CreateTestJobRequest {
800
1816
  name?: string;
801
1817
  }
802
1818
  type TestRunStatus = 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
803
- type TestRunResult = 'pass' | 'fail' | 'partial';
804
1819
  /**
805
1820
  * A single execution of a test. The primary identifier is `id`, matching the
806
1821
  * server's entity shape. Pass it to `waitForRun()` and `get()`.
@@ -814,7 +1829,11 @@ interface TestRun {
814
1829
  testConfigId?: string;
815
1830
  workspaceId?: string;
816
1831
  status?: TestRunStatus;
817
- result?: TestRunResult;
1832
+ /**
1833
+ * Terminal verdict. The API never sends a `result` field — an SDK type
1834
+ * declaring one read as undefined on every run, including passing ones.
1835
+ */
1836
+ outcome?: TestRunOutcome | null;
818
1837
  startedAt?: string;
819
1838
  completedAt?: string;
820
1839
  launchDeadline?: string;
@@ -836,6 +1855,134 @@ type CreateTestRunRequest = {
836
1855
  jobId?: never;
837
1856
  testConfigId: string;
838
1857
  };
1858
+ type TestRunType = 'mission' | 'compliance' | 'standard' | 'param';
1859
+ type TestRunOutcome = 'PASS' | 'FAIL' | 'ERROR' | 'INCONCLUSIVE' | 'pending';
1860
+ /**
1861
+ * Slim summary returned by `testing.runs.list()` / `testing.listRuns()`.
1862
+ * No transcript/evidence — keeps the list payload light.
1863
+ */
1864
+ interface TestRunListItem {
1865
+ id: string;
1866
+ workspaceId: string;
1867
+ runType: TestRunType;
1868
+ configId?: string;
1869
+ catalogueTestId?: string;
1870
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
1871
+ outcome?: TestRunOutcome | null;
1872
+ phoneNumber?: string;
1873
+ mission?: string;
1874
+ passedSteps?: number;
1875
+ failedSteps?: number;
1876
+ startedAt: string;
1877
+ completedAt?: string;
1878
+ /** Real call length in seconds (post-answer → last node), not orchestration wall-clock. */
1879
+ callDurationSecs?: number;
1880
+ }
1881
+ /** Query params for the filtered+paginated `GET /testing/runs`. */
1882
+ interface TestRunListParams {
1883
+ /** @deprecated Legacy back-compat filter. */
1884
+ jobId?: string;
1885
+ runType?: TestRunType;
1886
+ outcome?: TestRunOutcome;
1887
+ phoneNumber?: string;
1888
+ configId?: string;
1889
+ catalogueTestId?: string;
1890
+ /** ISO8601 datetime. */
1891
+ startedAfter?: string;
1892
+ /** ISO8601 datetime. */
1893
+ startedBefore?: string;
1894
+ sortBy?: 'startedAt' | 'completedAt';
1895
+ sortDir?: 'asc' | 'desc';
1896
+ /** Results per page (1..200, default 50). */
1897
+ limit?: number;
1898
+ /** Opaque pagination cursor. */
1899
+ cursor?: string;
1900
+ /** @deprecated Back-compat alias for `cursor`. */
1901
+ nextToken?: string;
1902
+ }
1903
+ type AggregateGroupBy = 'outcome' | 'runType' | 'configId' | 'catalogueTestId' | 'phoneNumber';
1904
+ type AggregateTimeBucket = 'day' | 'week' | 'month';
1905
+ /** Query params for `GET /testing/runs/aggregate`. `groupBy` is required. */
1906
+ interface TestRunAggregateParams {
1907
+ runType?: TestRunType;
1908
+ outcome?: TestRunOutcome;
1909
+ phoneNumber?: string;
1910
+ configId?: string;
1911
+ catalogueTestId?: string;
1912
+ startedAfter?: string;
1913
+ startedBefore?: string;
1914
+ groupBy: AggregateGroupBy;
1915
+ timeBucket?: AggregateTimeBucket;
1916
+ }
1917
+ interface AggregateGroup {
1918
+ key: string;
1919
+ count: number;
1920
+ }
1921
+ interface TestRunAggregateResponse {
1922
+ groups?: AggregateGroup[];
1923
+ buckets?: Array<{
1924
+ bucket: string;
1925
+ groups: AggregateGroup[];
1926
+ }>;
1927
+ truncated: boolean;
1928
+ totalGroups: number;
1929
+ }
1930
+ /**
1931
+ * Mission-strict response for `GET /testing/mission-test-runs/{id}`.
1932
+ * No stepResults — mission tests have no steps.
1933
+ */
1934
+ interface MissionTestRunResponse {
1935
+ id: string;
1936
+ workspaceId: string;
1937
+ configId?: string;
1938
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
1939
+ outcome?: TestRunOutcome | null;
1940
+ sector?: string;
1941
+ mission?: string;
1942
+ acceptance?: string;
1943
+ passed?: boolean;
1944
+ passReasoning?: string;
1945
+ passEvidence?: unknown;
1946
+ verdict?: 'pass' | 'fail';
1947
+ complianceFailEvidence?: unknown[];
1948
+ compliancePassEvidence?: unknown[];
1949
+ judgeReasoning?: string;
1950
+ transcript?: unknown;
1951
+ phoneNumber?: string;
1952
+ audioId?: string;
1953
+ callControlId?: string;
1954
+ startedAt: string;
1955
+ completedAt?: string;
1956
+ errorMessage?: string;
1957
+ }
1958
+ /**
1959
+ * An operator-enabled Telnyx text-to-speech voice. Customers choose from this
1960
+ * curated set rather than the full Telnyx catalogue.
1961
+ */
1962
+ interface Voice {
1963
+ voiceId: string;
1964
+ name: string;
1965
+ language?: string;
1966
+ accent?: string;
1967
+ gender?: 'male' | 'female' | 'neutral';
1968
+ provider?: string;
1969
+ /** Descriptive blurb from the Telnyx catalogue. */
1970
+ label?: string;
1971
+ /**
1972
+ * Exactly one enabled voice carries this. It is the voice used when a mission
1973
+ * test does not choose one.
1974
+ */
1975
+ isDefault?: boolean;
1976
+ }
1977
+ /** Response for `GET /testing/voices`. */
1978
+ interface ListVoicesResponse {
1979
+ voices: Voice[];
1980
+ /**
1981
+ * Which voice is used when a mission test does not choose one. Absent only
1982
+ * if no voice is flagged default.
1983
+ */
1984
+ defaultVoiceId?: string;
1985
+ }
839
1986
 
840
1987
  interface TestingWaitForOptions {
841
1988
  timeout?: number;
@@ -861,8 +2008,10 @@ declare class TestingJobsResource extends Resource {
861
2008
  }
862
2009
  declare class TestingRunsResource extends Resource {
863
2010
  create(body: CreateTestRunRequest, requestOptions?: RequestOptions): Promise<TestRun>;
864
- list(params?: TestingListParams, requestOptions?: RequestOptions): Paginator<TestRun>;
865
- listPage(params?: TestingListParams, requestOptions?: RequestOptions): Promise<Page<TestRun>>;
2011
+ list(params?: TestRunListParams, requestOptions?: RequestOptions): Paginator<TestRunListItem>;
2012
+ listPage(params?: TestRunListParams, requestOptions?: RequestOptions): Promise<Page<TestRunListItem>>;
2013
+ /** GET /testing/runs/aggregate — grouped counts over test runs. */
2014
+ aggregate(params: TestRunAggregateParams, requestOptions?: RequestOptions): Promise<TestRunAggregateResponse>;
866
2015
  get(runId: string, requestOptions?: RequestOptions): Promise<TestRun>;
867
2016
  waitForRun(runId: string, opts?: TestingWaitForOptions): Promise<TestRun>;
868
2017
  }
@@ -871,6 +2020,14 @@ declare class TestingResource extends Resource {
871
2020
  readonly jobs: TestingJobsResource;
872
2021
  readonly runs: TestingRunsResource;
873
2022
  constructor(transport: Transport);
2023
+ /** Paginated, filtered list of test runs (alias for `testing.runs.list()`). */
2024
+ listRuns(params?: TestRunListParams, requestOptions?: RequestOptions): Paginator<TestRunListItem>;
2025
+ /** GET /testing/voices — operator-enabled voices a mission test may use. */
2026
+ listVoices(requestOptions?: RequestOptions): Promise<ListVoicesResponse>;
2027
+ /** GET /testing/runs/aggregate — grouped counts over test runs. */
2028
+ aggregateRuns(params: TestRunAggregateParams, requestOptions?: RequestOptions): Promise<TestRunAggregateResponse>;
2029
+ /** GET /testing/mission-test-runs/{id} — mission-strict run detail (no steps). */
2030
+ getMissionTestRun(id: string, requestOptions?: RequestOptions): Promise<MissionTestRunResponse>;
874
2031
  }
875
2032
 
876
2033
  declare class Nopaque {
@@ -884,6 +2041,12 @@ declare class Nopaque {
884
2041
  readonly loadTesting: LoadTestingResource;
885
2042
  readonly scheduler: SchedulerResource;
886
2043
  readonly enrichment: EnrichmentResource;
2044
+ readonly missionTests: MissionTestsResource;
2045
+ readonly missionTestConfigs: MissionTestConfigsResource;
2046
+ readonly compliance: ComplianceResource;
2047
+ readonly digitalTesting: DigitalTestingResource;
2048
+ readonly digitalTestConfigs: DigitalTestConfigsResource;
2049
+ readonly digitalCompliance: DigitalComplianceResource;
887
2050
  private readonly transport;
888
2051
  constructor(options?: NopaqueOptions);
889
2052
  close(): void;
@@ -891,4 +2054,4 @@ declare class Nopaque {
891
2054
 
892
2055
  declare const VERSION: string;
893
2056
 
894
- export { APIConnectionError, APITimeoutError, type AddProfileItemRequest, type AudioDownloadURL, type AudioFile, type AudioListParams, type AudioUploadURL, AuthenticationError, type Batch, type BatchRun, type BatchRunStatus, type BatchStatus, type BatchesListParams, ConflictError, type CreateBatchRequest, type CreateDatasetRequest, type CreateLoadTestRequest, type CreateMappingJobRequest, type CreateProfileRequest, type CreateScheduleRequest, type CreateSweepRequest, type CreateTestConfigRequest, type CreateTestJobRequest, type CreateTestRunRequest, type CreateUploadUrlRequest, type DTMFOption, type Dataset, type DatasetsListParams, type DownloadOptions, type EnrichRequest, type EnrichResponse, type Enrichment, type EnrichmentDimensions, type EnrichmentStatus, type JobStatus, type LoadTest, type LoadTestEstimate, type LoadTestEstimateRequest, type LoadTestProgress, type LoadTestRun, type LoadTestStatus, type LoadTestStatusResponse, type LoadTestingListParams, type MappingJob, type MappingJobConfig, type MappingJobStats, type MappingListParams, type MappingMode, type MappingPath, type MappingRun, type MappingStep, type MappingTree, Nopaque, NopaqueAPIError, NopaqueConfigError, NopaqueError, type NopaqueOptions, NopaqueTimeoutError, NotFoundError, Page, Paginator, PermissionError, type Profile, type ProfileItem, type ProfileParametersResponse, type ProfilesByParametersParams, type ProfilesByParametersResponse, type ProfilesListParams, type QualityScoringResults, RateLimitError, type RequestOptions, type ResolvedDataset, type ResolvedDatasetEntry, type RetryConfig, type Schedule, type ScheduleListParams, type ScheduleStatus, ServerError, type StepResult, type StepStatus, type Sweep, type SweepRun, type SweepRunStatus, type SweepStatus, type SweepVariationResult, type SweepsListParams, type TestConfig, type TestJob, type TestJobStatus, type TestRun, type TestRunResult, type TestRunStatus, type TestStep, type TestingListParams, type TokenUsageDetails, type TokenUsageResponse, type TreeFormat, type TreeNode, type UpdateBatchRequest, type UpdateDatasetRequest, type UpdateLoadTestRequest, type UpdateMappingJobRequest, type UpdateProfileItemRequest, type UpdateProfileRequest, type UpdateScheduleRequest, type UpdateSweepRequest, type UpdateTestConfigRequest, type UploadInput, VERSION, ValidationError };
2057
+ export { APIConnectionError, APITimeoutError, type AddProfileItemRequest, type AggregateGroup, type AggregateGroupBy, type AggregateTimeBucket, type AudioCategory, type AudioDownloadURL, type AudioFile, type AudioListParams, type AudioUploadURL, AuthenticationError, type Batch, type BatchRun, type BatchRunStatus, type BatchStatus, type BatchesListParams, type CallTelemetry, type ChatMatcher, type ChatStep, type ChatStepBase, type ComplianceCatalogue, type ComplianceCatalogueResponse, type ComplianceRegulation, type ComplianceRegulationSection, type ComplianceReport, type ComplianceReportListItem, type ComplianceReportListParams, type ComplianceReportSummary, type ComplianceTest, type ComplianceTestEvidence, type ComplianceTestVerdict, ConflictError, type ConnectChatTarget, type CreateBatchRequest, type CreateComplianceBatchRequest, type CreateComplianceBatchResponse, type CreateDatasetRequest, type CreateDigitalTestConfigRequest, type CreateDigitalTestRunRequest, type CreateDigitalTestRunResponse, type CreateLoadTestRequest, type CreateMappingJobRequest, type CreateMissionTestConfigRequest, type CreateMissionTestRequest, type CreateProfileRequest, type CreateScheduleRequest, type CreateSweepRequest, type CreateTestConfigRequest, type CreateTestJobRequest, type CreateTestRunRequest, type CreateUploadUrlRequest, type CurrentRun, type DTMFOption, type Dataset, type DatasetsListParams, type DigitalComplianceAuditSummary, type DigitalComplianceReportParams, type DigitalEvidence, type DigitalOutcome, type DigitalProfile, type DigitalProfileItem, type DigitalRunStatus, type DigitalSample, type DigitalStepResult, type DigitalTarget, type DigitalTestConfig, type DigitalTestConfigBase, type DigitalTestConfigListParams, type DigitalTestKind, type DigitalTestRun, type DigitalTestRunListParams, type DigitalTranscriptTurn, type DownloadOptions, type EndChatStep, type EnrichRequest, type EnrichResponse, type Enrichment, type EnrichmentConfig, type EnrichmentDimensions, type EnrichmentStatus, type ExpectChatStep, type FlatTreeNode, type GeneratePdfRequest, type GeneratePdfResponse, type HttpJsonTarget, type JobStatus, type LaunchDigitalTestConfigRequest, type ListDigitalComplianceAuditsResponse, type ListDigitalTestConfigsResponse, type ListDigitalTestRunsResponse, type ListVoicesResponse, type LoadTest, type LoadTestEstimate, type LoadTestEstimateRequest, type LoadTestProgress, type LoadTestRun, type LoadTestStatus, type LoadTestStatusResponse, type LoadTestingListParams, type MappingJob, type MappingJobConfig, type MappingJobListItem, type MappingJobStats, type MappingListParams, type MappingMode, type MappingPath, type MappingRun, type MappingRunStatus, type MappingStep, type MappingTree, type MappingTreeEmptyState, type MissionTestConfig, type MissionTestConfigListItem, type MissionTestConfigListParams, type MissionTestDefaults, type MissionTestKind, type MissionTestListParams, type MissionTestProfile, type MissionTestRun, type MissionTestRunResponse, type MissionTestStatus, Nopaque, NopaqueAPIError, NopaqueConfigError, NopaqueError, type NopaqueOptions, NopaqueTimeoutError, NotFoundError, Page, Paginator, PermissionError, type ProbeResult, type Profile, type ProfileDataItem, type ProfileItem, type ProfileParametersResponse, type ProfileVoiceItem, type ProfileVoiceItemBase, type ProfilesByParametersParams, type ProfilesByParametersResponse, type ProfilesListParams, type QualityScoringResults, RateLimitError, type RepeatBehavior, type RepeatConfig, type RequestOptions, type ResolvedDataset, type ResolvedDatasetEntry, type RetryConfig, type Schedule, type ScheduleListParams, type ScheduleTargetType, type ScheduleType, type SendChatStep, ServerError, type StepResult, type StepStatus, type Sweep, type SweepRun, type SweepRunStatus, type SweepStatus, type SweepVariationResult, type SweepsListParams, type TestConfig, type TestJob, type TestJobStatus, type TestRun, type TestRunAggregateParams, type TestRunAggregateResponse, type TestRunListItem, type TestRunListParams, type TestRunOutcome, type TestRunStatus, type TestRunType, type TestStep, type TestingListParams, type TokenUsageDetails, type TokenUsageResponse, type TreeFormat, type TreeInputRequired, type TreeNode, type TreeNodeEnrichment, type TurnTelemetry, type UpdateBatchRequest, type UpdateDatasetRequest, type UpdateDigitalTestConfigRequest, type UpdateLoadTestRequest, type UpdateMappingJobRequest, type UpdateMissionTestConfigRequest, type UpdateProfileItemRequest, type UpdateProfileRequest, type UpdateScheduleRequest, type UpdateSweepRequest, type UpdateTestConfigRequest, type UploadInput, VERSION, ValidationError, type Vertical, type Voice, type WaitChatStep, type WebWidgetTarget };