@nopaque/sdk 0.1.1 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.cts 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,9 +970,146 @@ 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';
414
1113
  interface RetryConfig {
415
1114
  enabled: boolean;
416
1115
  maxRetries: number;
@@ -424,6 +1123,7 @@ interface MappingJobConfig {
424
1123
  voiceProfileId?: string;
425
1124
  dataProfileId?: string;
426
1125
  retryConfig?: RetryConfig;
1126
+ mappingMode?: MappingMode;
427
1127
  }
428
1128
  interface MappingJobStats {
429
1129
  totalCalls: number;
@@ -432,13 +1132,27 @@ interface MappingJobStats {
432
1132
  loopsDetected: number;
433
1133
  retriedCalls: number;
434
1134
  }
1135
+ /**
1136
+ * Nested run summary surfaced on the single-job response (`GET /mapping/{id}`).
1137
+ * Present when a run exists; omitted (never null) when the job has no runs yet.
1138
+ * Unlike the job-level status, `status` here CAN reach `completed`.
1139
+ */
1140
+ interface CurrentRun {
1141
+ id: string;
1142
+ status: 'queued' | 'running' | 'completed' | 'failed' | 'limited';
1143
+ runNumber: number;
1144
+ stats?: MappingJobStats;
1145
+ inFlightCount?: number;
1146
+ limitReason?: string;
1147
+ startedAt?: string;
1148
+ completedAt?: string;
1149
+ }
435
1150
  interface MappingJob {
436
1151
  id: string;
437
1152
  workspaceId?: string;
438
1153
  userId?: string;
439
1154
  name: string;
440
1155
  phoneNumber?: string;
441
- mappingMode?: MappingMode;
442
1156
  profileId?: string;
443
1157
  status: JobStatus;
444
1158
  config?: MappingJobConfig;
@@ -447,31 +1161,80 @@ interface MappingJob {
447
1161
  pendingPaths?: string[];
448
1162
  currentRunId?: string;
449
1163
  runId?: string;
1164
+ runNumber?: number;
1165
+ /** Nested run summary — present when a run exists; omitted (never null) otherwise. */
1166
+ currentRun?: CurrentRun;
450
1167
  limitReason?: string;
451
1168
  error?: string;
1169
+ /** User-defined labels (max 10, lowercase kebab-case). */
1170
+ tags?: string[];
452
1171
  createdAt?: string;
453
1172
  updatedAt?: string;
454
1173
  startedAt?: string;
455
1174
  completedAt?: string;
456
1175
  cancelledAt?: string;
457
1176
  }
1177
+ /**
1178
+ * Slim projection returned by `mapping.list()`. `status` is the latest-run
1179
+ * status (post-merged), not the job-level idle/running cycle.
1180
+ */
1181
+ interface MappingJobListItem {
1182
+ id: string;
1183
+ workspaceId?: string;
1184
+ userId?: string;
1185
+ name: string;
1186
+ phoneNumber?: string;
1187
+ status: MappingRunStatus | JobStatus;
1188
+ config?: MappingJobConfig;
1189
+ tags?: string[];
1190
+ error?: string;
1191
+ runNumber?: number;
1192
+ profileId?: string;
1193
+ createdAt?: string;
1194
+ updatedAt?: string;
1195
+ }
458
1196
  interface CreateMappingJobRequest {
459
1197
  name: string;
460
1198
  phoneNumber: string;
461
- mappingMode: MappingMode;
462
1199
  profileId?: string;
463
1200
  config?: MappingJobConfig;
1201
+ /** User-defined labels (max 10, lowercase kebab-case). */
1202
+ tags?: string[];
464
1203
  }
465
1204
  interface UpdateMappingJobRequest {
466
1205
  name?: string;
467
1206
  phoneNumber?: string;
468
- mappingMode?: MappingMode;
469
1207
  config?: MappingJobConfig;
1208
+ /** User-defined labels (max 10, lowercase kebab-case). */
1209
+ tags?: string[];
470
1210
  }
471
1211
  interface MappingListParams {
472
- workspaceId?: string;
1212
+ /** E.164 exact match. */
1213
+ phoneNumber?: string;
1214
+ /** Case-insensitive substring match on job name. */
1215
+ name?: string;
1216
+ /** Exact UUID match on the data profile. */
1217
+ profileId?: string;
1218
+ /** Single lowercase tag exact match. */
1219
+ tag?: string;
1220
+ /** Filter by latest-run status. */
1221
+ status?: MappingRunStatus;
1222
+ /** ISO8601 datetime — jobs created at or after this time. */
1223
+ createdAfter?: string;
1224
+ /** ISO8601 datetime — jobs created at or before this time. */
1225
+ createdBefore?: string;
1226
+ /** Sort field (only 'createdAt' supported). */
1227
+ sort?: 'createdAt';
1228
+ /** Sort direction (default 'desc'). */
1229
+ sortDir?: 'asc' | 'desc';
1230
+ /** Results per page (1..100, default 50). */
473
1231
  limit?: number;
1232
+ /** Opaque pagination cursor from a previous response's nextCursor. */
1233
+ cursor?: string;
1234
+ /** @deprecated Back-compat alias for `cursor`. */
474
1235
  nextToken?: string;
1236
+ /** @deprecated No longer read by the API; workspace is derived from the key. */
1237
+ workspaceId?: string;
475
1238
  }
476
1239
  interface DTMFOption {
477
1240
  digit: string;
@@ -484,6 +1247,8 @@ interface StepResult {
484
1247
  audioUrl?: string;
485
1248
  audioSizeBytes?: number;
486
1249
  duration?: number;
1250
+ /** Per-step telemetry (additive, all-optional). */
1251
+ turnTelemetry?: TurnTelemetry;
487
1252
  }
488
1253
  interface MappingStep {
489
1254
  id: string;
@@ -501,7 +1266,28 @@ interface MappingStep {
501
1266
  createdAt?: string;
502
1267
  completedAt?: string;
503
1268
  }
504
- interface TreeNode {
1269
+ /** Per-step UX hint for prompts that require user input (e.g. PIN/account number). */
1270
+ interface TreeInputRequired {
1271
+ type: string;
1272
+ description: string;
1273
+ formatHint?: string;
1274
+ terminator?: string;
1275
+ startTimeMs?: number;
1276
+ }
1277
+ /** Enrichment fields shared by TreeNode and FlatTreeNode (all optional/additive). */
1278
+ interface TreeNodeEnrichment {
1279
+ stepType?: 'dtmf' | 'voice';
1280
+ voicePrompt?: string;
1281
+ menuLabel?: string;
1282
+ spokenResponse?: string;
1283
+ probeCategory?: string;
1284
+ probeClassification?: string;
1285
+ probeRationale?: string;
1286
+ audioUrl?: string;
1287
+ duration?: number;
1288
+ inputRequired?: TreeInputRequired;
1289
+ }
1290
+ interface TreeNode extends TreeNodeEnrichment {
505
1291
  stepId: string;
506
1292
  digit?: string;
507
1293
  label?: string;
@@ -511,16 +1297,47 @@ interface TreeNode {
511
1297
  transcript?: string;
512
1298
  isTerminal: boolean;
513
1299
  children: TreeNode[];
514
- duration?: number;
515
- audioUrl?: string;
516
1300
  }
1301
+ interface FlatTreeNode extends TreeNodeEnrichment {
1302
+ stepId: string;
1303
+ digit?: string;
1304
+ label?: string;
1305
+ depth: number;
1306
+ path: string[];
1307
+ status: StepStatus;
1308
+ transcript?: string;
1309
+ isTerminal: boolean;
1310
+ }
1311
+ /**
1312
+ * Empty-state envelope (200 OK) returned by the tree endpoint when there is no
1313
+ * tree to render. Branch on `tree === null` to detect it.
1314
+ */
1315
+ interface MappingTreeEmptyState {
1316
+ jobId: string;
1317
+ runId?: string;
1318
+ runNumber?: number;
1319
+ status: string;
1320
+ stats?: MappingJobStats;
1321
+ tree: null;
1322
+ reason: 'no_runs' | 'no_steps' | 'in_progress';
1323
+ message: string;
1324
+ }
1325
+ /**
1326
+ * Tree response. In the happy path `tree` (or `steps` for flat format) is
1327
+ * populated; in the empty state `tree` is `null` and `reason`/`message` explain
1328
+ * why. `root` is retained for back-compat with older shapes.
1329
+ */
517
1330
  interface MappingTree {
518
1331
  jobId?: string;
519
1332
  runId?: string;
1333
+ runNumber?: number;
520
1334
  status?: string;
521
1335
  stats?: MappingJobStats;
522
1336
  tree?: TreeNode | null;
523
1337
  root?: TreeNode | null;
1338
+ /** Present when format='flat'. */
1339
+ steps?: FlatTreeNode[];
1340
+ reason?: 'no_runs' | 'no_steps' | 'in_progress';
524
1341
  message?: string;
525
1342
  }
526
1343
  interface MappingPath {
@@ -535,11 +1352,18 @@ interface MappingRun {
535
1352
  id: string;
536
1353
  jobId?: string;
537
1354
  status: string;
1355
+ runNumber?: number;
538
1356
  startedAt?: string;
539
1357
  completedAt?: string;
540
1358
  stats?: MappingJobStats;
1359
+ /** Call-level telemetry (additive, all-optional). */
1360
+ callTelemetry?: CallTelemetry;
541
1361
  }
542
1362
  type TreeFormat = 'tree' | 'flat';
1363
+ interface ProbeResult {
1364
+ message: string;
1365
+ probeCount: number;
1366
+ }
543
1367
 
544
1368
  interface WaitForCompleteOptions {
545
1369
  timeout?: number;
@@ -549,8 +1373,8 @@ interface WaitForCompleteOptions {
549
1373
  requestOptions?: RequestOptions;
550
1374
  }
551
1375
  declare class MappingResource extends Resource {
552
- list(params?: MappingListParams, requestOptions?: RequestOptions): Paginator<MappingJob>;
553
- listPage(params?: MappingListParams, requestOptions?: RequestOptions): Promise<Page<MappingJob>>;
1376
+ list(params?: MappingListParams, requestOptions?: RequestOptions): Paginator<MappingJobListItem>;
1377
+ listPage(params?: MappingListParams, requestOptions?: RequestOptions): Promise<Page<MappingJobListItem>>;
554
1378
  get(jobId: string, requestOptions?: RequestOptions): Promise<MappingJob>;
555
1379
  create(body: CreateMappingJobRequest, requestOptions?: RequestOptions): Promise<MappingJob>;
556
1380
  update(jobId: string, body: UpdateMappingJobRequest, requestOptions?: RequestOptions): Promise<MappingJob>;
@@ -560,6 +1384,7 @@ declare class MappingResource extends Resource {
560
1384
  attest(jobId: string, requestOptions?: RequestOptions): Promise<{
561
1385
  attested: boolean;
562
1386
  }>;
1387
+ probe(jobId: string, runId: string, requestOptions?: RequestOptions): Promise<ProbeResult>;
563
1388
  steps(jobId: string, params?: {
564
1389
  limit?: number;
565
1390
  nextToken?: string;
@@ -578,10 +1403,105 @@ declare class MappingResource extends Resource {
578
1403
  updatePath(jobId: string, path: string, body: Record<string, unknown>, requestOptions?: RequestOptions): Promise<MappingPath>;
579
1404
  deletePath(jobId: string, path: string, requestOptions?: RequestOptions): Promise<void>;
580
1405
  remap(jobId: string, path: string, requestOptions?: RequestOptions): Promise<MappingJob>;
581
- probe(jobId: string, runId: string, body?: Record<string, unknown>, requestOptions?: RequestOptions): Promise<unknown>;
582
1406
  waitForComplete(jobId: string, opts?: WaitForCompleteOptions): Promise<MappingJob>;
583
1407
  }
584
1408
 
1409
+ interface CreateMissionTestConfigRequest {
1410
+ name: string;
1411
+ description?: string;
1412
+ sector: string;
1413
+ mission: string;
1414
+ acceptance: string;
1415
+ profileId: string;
1416
+ phoneNumber?: string;
1417
+ /** User-defined labels (max 10, lowercase kebab-case). */
1418
+ tags?: string[];
1419
+ }
1420
+ /**
1421
+ * Partial update for `PATCH /testing/mission-test-configs/{id}`. At least one
1422
+ * field must be provided. `description` and `tags` accept `null` to clear.
1423
+ */
1424
+ interface UpdateMissionTestConfigRequest {
1425
+ name?: string;
1426
+ description?: string | null;
1427
+ phoneNumber?: string;
1428
+ sector?: string;
1429
+ mission?: string;
1430
+ acceptance?: string;
1431
+ profileId?: string;
1432
+ tags?: string[] | null;
1433
+ }
1434
+ interface MissionTestConfig {
1435
+ id: string;
1436
+ workspaceId: string;
1437
+ name: string;
1438
+ description?: string;
1439
+ phoneNumber?: string;
1440
+ sector: string;
1441
+ mission: string;
1442
+ acceptance: string;
1443
+ profileId: string;
1444
+ /** User-defined labels (max 10, lowercase kebab-case). */
1445
+ tags?: string[];
1446
+ createdAt: string;
1447
+ updatedAt: string;
1448
+ }
1449
+ /**
1450
+ * Slim projection returned by `missionTestConfigs.list()`. Drops the long-text
1451
+ * `mission` and `acceptance` fields — fetch the full row with `get()`.
1452
+ */
1453
+ interface MissionTestConfigListItem {
1454
+ id: string;
1455
+ workspaceId: string;
1456
+ name: string;
1457
+ description?: string;
1458
+ phoneNumber?: string;
1459
+ sector: string;
1460
+ profileId: string;
1461
+ tags?: string[];
1462
+ createdAt: string;
1463
+ updatedAt: string;
1464
+ }
1465
+ interface MissionTestConfigListParams {
1466
+ name?: string;
1467
+ phoneNumber?: string;
1468
+ sector?: string;
1469
+ profileId?: string;
1470
+ /** Single lowercase tag exact match. */
1471
+ tag?: string;
1472
+ /** ISO8601 datetime. */
1473
+ createdAfter?: string;
1474
+ /** ISO8601 datetime. */
1475
+ createdBefore?: string;
1476
+ sort?: 'createdAt' | 'name';
1477
+ sortDir?: 'asc' | 'desc';
1478
+ /** Results per page (1..100, default 50). */
1479
+ limit?: number;
1480
+ /** Opaque pagination cursor. */
1481
+ cursor?: string;
1482
+ /** @deprecated Back-compat alias for `cursor`. */
1483
+ nextToken?: string;
1484
+ }
1485
+
1486
+ declare class MissionTestConfigsResource extends Resource {
1487
+ list(params?: MissionTestConfigListParams, requestOptions?: RequestOptions): Paginator<MissionTestConfigListItem>;
1488
+ listPage(params?: MissionTestConfigListParams, requestOptions?: RequestOptions): Promise<Page<MissionTestConfigListItem>>;
1489
+ create(body: CreateMissionTestConfigRequest, requestOptions?: RequestOptions): Promise<MissionTestConfig>;
1490
+ get(id: string, requestOptions?: RequestOptions): Promise<MissionTestConfig>;
1491
+ update(id: string, body: UpdateMissionTestConfigRequest, requestOptions?: RequestOptions): Promise<MissionTestConfig>;
1492
+ delete(id: string, requestOptions?: RequestOptions): Promise<void>;
1493
+ run(id: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1494
+ }
1495
+
1496
+ declare class MissionTestsResource extends Resource {
1497
+ list(params?: MissionTestListParams, requestOptions?: RequestOptions): Paginator<MissionTestRun>;
1498
+ listPage(params?: MissionTestListParams, requestOptions?: RequestOptions): Promise<Page<MissionTestRun>>;
1499
+ create(body: CreateMissionTestRequest, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1500
+ getDefaults(requestOptions?: RequestOptions): Promise<MissionTestDefaults>;
1501
+ get(id: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1502
+ cancel(id: string, requestOptions?: RequestOptions): Promise<MissionTestRun>;
1503
+ }
1504
+
585
1505
  interface ProfileItem {
586
1506
  id: string;
587
1507
  profileId?: string;
@@ -645,34 +1565,69 @@ declare class ProfilesResource extends Resource {
645
1565
  findByParameters(params: ProfilesByParametersParams, requestOptions?: RequestOptions): Promise<ProfilesByParametersResponse>;
646
1566
  }
647
1567
 
648
- type ScheduleStatus = 'active' | 'paused' | 'disabled';
1568
+ /**
1569
+ * Which firing strategy a schedule uses. Required on create — the API rejects
1570
+ * a schedule without one, and each variant requires a different companion
1571
+ * field: `cron` needs `cronExpression`, `recurring` needs `intervalMinutes`,
1572
+ * `once` needs a future `runAt`.
1573
+ */
1574
+ type ScheduleType = 'once' | 'recurring' | 'cron';
1575
+ /** What the schedule fires against. Optional — a schedule with no target is a reusable template. */
1576
+ type ScheduleTargetType = 'test' | 'map' | 'batch';
649
1577
  interface Schedule {
650
1578
  id: string;
1579
+ workspaceId: string;
651
1580
  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;
1581
+ description?: string;
1582
+ targetId?: string;
1583
+ targetType?: ScheduleTargetType;
1584
+ scheduleType: ScheduleType;
1585
+ cronExpression?: string;
1586
+ intervalMinutes?: number;
1587
+ runAt?: string;
1588
+ timezone: string;
1589
+ /** Wire value is the string `'true'` / `'false'`, not a boolean — it backs a GSI key. */
1590
+ enabled: 'true' | 'false';
1591
+ lastRunAt?: string;
1592
+ nextRunAt: string;
1593
+ runCount: number;
1594
+ eventBridgeRuleArn?: string;
1595
+ eventBridgeRuleName?: string;
1596
+ createdAt: string;
1597
+ updatedAt: string;
1598
+ createdBy: string;
661
1599
  }
662
1600
  interface CreateScheduleRequest {
663
1601
  name: string;
664
- configId: string;
665
- cronExpression: string;
1602
+ scheduleType: ScheduleType;
1603
+ description?: string;
1604
+ targetId?: string;
1605
+ targetType?: ScheduleTargetType;
1606
+ /** Required when scheduleType is 'cron'. */
1607
+ cronExpression?: string;
1608
+ /** Required when scheduleType is 'recurring'. Minimum 1. */
1609
+ intervalMinutes?: number;
1610
+ /** Required when scheduleType is 'once'. ISO timestamp, must be in the future. */
1611
+ runAt?: string;
1612
+ /** IANA timezone. Defaults server-side to 'UTC'. */
666
1613
  timezone?: string;
667
1614
  }
668
1615
  interface UpdateScheduleRequest {
669
1616
  name?: string;
1617
+ description?: string;
1618
+ scheduleType?: ScheduleType;
670
1619
  cronExpression?: string;
1620
+ intervalMinutes?: number;
1621
+ runAt?: string;
671
1622
  timezone?: string;
1623
+ /** Sent as a boolean; the API coerces it to the `'true'`/`'false'` wire form. */
1624
+ enabled?: boolean;
672
1625
  }
673
1626
  interface ScheduleListParams {
674
1627
  limit?: number;
675
1628
  nextToken?: string;
1629
+ /** Filter to schedules attached to one target. */
1630
+ targetId?: string;
676
1631
  }
677
1632
 
678
1633
  declare class SchedulerResource extends Resource {
@@ -836,6 +1791,134 @@ type CreateTestRunRequest = {
836
1791
  jobId?: never;
837
1792
  testConfigId: string;
838
1793
  };
1794
+ type TestRunType = 'mission' | 'compliance' | 'standard' | 'param';
1795
+ type TestRunOutcome = 'PASS' | 'FAIL' | 'ERROR' | 'INCONCLUSIVE' | 'pending';
1796
+ /**
1797
+ * Slim summary returned by `testing.runs.list()` / `testing.listRuns()`.
1798
+ * No transcript/evidence — keeps the list payload light.
1799
+ */
1800
+ interface TestRunListItem {
1801
+ id: string;
1802
+ workspaceId: string;
1803
+ runType: TestRunType;
1804
+ configId?: string;
1805
+ catalogueTestId?: string;
1806
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
1807
+ outcome?: TestRunOutcome | null;
1808
+ phoneNumber?: string;
1809
+ mission?: string;
1810
+ passedSteps?: number;
1811
+ failedSteps?: number;
1812
+ startedAt: string;
1813
+ completedAt?: string;
1814
+ /** Real call length in seconds (post-answer → last node), not orchestration wall-clock. */
1815
+ callDurationSecs?: number;
1816
+ }
1817
+ /** Query params for the filtered+paginated `GET /testing/runs`. */
1818
+ interface TestRunListParams {
1819
+ /** @deprecated Legacy back-compat filter. */
1820
+ jobId?: string;
1821
+ runType?: TestRunType;
1822
+ outcome?: TestRunOutcome;
1823
+ phoneNumber?: string;
1824
+ configId?: string;
1825
+ catalogueTestId?: string;
1826
+ /** ISO8601 datetime. */
1827
+ startedAfter?: string;
1828
+ /** ISO8601 datetime. */
1829
+ startedBefore?: string;
1830
+ sortBy?: 'startedAt' | 'completedAt';
1831
+ sortDir?: 'asc' | 'desc';
1832
+ /** Results per page (1..200, default 50). */
1833
+ limit?: number;
1834
+ /** Opaque pagination cursor. */
1835
+ cursor?: string;
1836
+ /** @deprecated Back-compat alias for `cursor`. */
1837
+ nextToken?: string;
1838
+ }
1839
+ type AggregateGroupBy = 'outcome' | 'runType' | 'configId' | 'catalogueTestId' | 'phoneNumber';
1840
+ type AggregateTimeBucket = 'day' | 'week' | 'month';
1841
+ /** Query params for `GET /testing/runs/aggregate`. `groupBy` is required. */
1842
+ interface TestRunAggregateParams {
1843
+ runType?: TestRunType;
1844
+ outcome?: TestRunOutcome;
1845
+ phoneNumber?: string;
1846
+ configId?: string;
1847
+ catalogueTestId?: string;
1848
+ startedAfter?: string;
1849
+ startedBefore?: string;
1850
+ groupBy: AggregateGroupBy;
1851
+ timeBucket?: AggregateTimeBucket;
1852
+ }
1853
+ interface AggregateGroup {
1854
+ key: string;
1855
+ count: number;
1856
+ }
1857
+ interface TestRunAggregateResponse {
1858
+ groups?: AggregateGroup[];
1859
+ buckets?: Array<{
1860
+ bucket: string;
1861
+ groups: AggregateGroup[];
1862
+ }>;
1863
+ truncated: boolean;
1864
+ totalGroups: number;
1865
+ }
1866
+ /**
1867
+ * Mission-strict response for `GET /testing/mission-test-runs/{id}`.
1868
+ * No stepResults — mission tests have no steps.
1869
+ */
1870
+ interface MissionTestRunResponse {
1871
+ id: string;
1872
+ workspaceId: string;
1873
+ configId?: string;
1874
+ status: 'pending' | 'running' | 'completed' | 'failed' | 'cancelled';
1875
+ outcome?: TestRunOutcome | null;
1876
+ sector?: string;
1877
+ mission?: string;
1878
+ acceptance?: string;
1879
+ passed?: boolean;
1880
+ passReasoning?: string;
1881
+ passEvidence?: unknown;
1882
+ verdict?: 'pass' | 'fail';
1883
+ complianceFailEvidence?: unknown[];
1884
+ compliancePassEvidence?: unknown[];
1885
+ judgeReasoning?: string;
1886
+ transcript?: unknown;
1887
+ phoneNumber?: string;
1888
+ audioId?: string;
1889
+ callControlId?: string;
1890
+ startedAt: string;
1891
+ completedAt?: string;
1892
+ errorMessage?: string;
1893
+ }
1894
+ /**
1895
+ * An operator-enabled Telnyx text-to-speech voice. Customers choose from this
1896
+ * curated set rather than the full Telnyx catalogue.
1897
+ */
1898
+ interface Voice {
1899
+ voiceId: string;
1900
+ name: string;
1901
+ language?: string;
1902
+ accent?: string;
1903
+ gender?: 'male' | 'female' | 'neutral';
1904
+ provider?: string;
1905
+ /** Descriptive blurb from the Telnyx catalogue. */
1906
+ label?: string;
1907
+ /**
1908
+ * Exactly one enabled voice carries this. It is the voice used when a mission
1909
+ * test does not choose one.
1910
+ */
1911
+ isDefault?: boolean;
1912
+ }
1913
+ /** Response for `GET /testing/voices`. */
1914
+ interface ListVoicesResponse {
1915
+ voices: Voice[];
1916
+ /**
1917
+ * Which voice is used when a mission test does not choose one. Absent only
1918
+ * if no voice is flagged default.
1919
+ */
1920
+ defaultVoiceId?: string;
1921
+ }
839
1922
 
840
1923
  interface TestingWaitForOptions {
841
1924
  timeout?: number;
@@ -861,8 +1944,10 @@ declare class TestingJobsResource extends Resource {
861
1944
  }
862
1945
  declare class TestingRunsResource extends Resource {
863
1946
  create(body: CreateTestRunRequest, requestOptions?: RequestOptions): Promise<TestRun>;
864
- list(params?: TestingListParams, requestOptions?: RequestOptions): Paginator<TestRun>;
865
- listPage(params?: TestingListParams, requestOptions?: RequestOptions): Promise<Page<TestRun>>;
1947
+ list(params?: TestRunListParams, requestOptions?: RequestOptions): Paginator<TestRunListItem>;
1948
+ listPage(params?: TestRunListParams, requestOptions?: RequestOptions): Promise<Page<TestRunListItem>>;
1949
+ /** GET /testing/runs/aggregate — grouped counts over test runs. */
1950
+ aggregate(params: TestRunAggregateParams, requestOptions?: RequestOptions): Promise<TestRunAggregateResponse>;
866
1951
  get(runId: string, requestOptions?: RequestOptions): Promise<TestRun>;
867
1952
  waitForRun(runId: string, opts?: TestingWaitForOptions): Promise<TestRun>;
868
1953
  }
@@ -871,6 +1956,14 @@ declare class TestingResource extends Resource {
871
1956
  readonly jobs: TestingJobsResource;
872
1957
  readonly runs: TestingRunsResource;
873
1958
  constructor(transport: Transport);
1959
+ /** Paginated, filtered list of test runs (alias for `testing.runs.list()`). */
1960
+ listRuns(params?: TestRunListParams, requestOptions?: RequestOptions): Paginator<TestRunListItem>;
1961
+ /** GET /testing/voices — operator-enabled voices a mission test may use. */
1962
+ listVoices(requestOptions?: RequestOptions): Promise<ListVoicesResponse>;
1963
+ /** GET /testing/runs/aggregate — grouped counts over test runs. */
1964
+ aggregateRuns(params: TestRunAggregateParams, requestOptions?: RequestOptions): Promise<TestRunAggregateResponse>;
1965
+ /** GET /testing/mission-test-runs/{id} — mission-strict run detail (no steps). */
1966
+ getMissionTestRun(id: string, requestOptions?: RequestOptions): Promise<MissionTestRunResponse>;
874
1967
  }
875
1968
 
876
1969
  declare class Nopaque {
@@ -884,6 +1977,12 @@ declare class Nopaque {
884
1977
  readonly loadTesting: LoadTestingResource;
885
1978
  readonly scheduler: SchedulerResource;
886
1979
  readonly enrichment: EnrichmentResource;
1980
+ readonly missionTests: MissionTestsResource;
1981
+ readonly missionTestConfigs: MissionTestConfigsResource;
1982
+ readonly compliance: ComplianceResource;
1983
+ readonly digitalTesting: DigitalTestingResource;
1984
+ readonly digitalTestConfigs: DigitalTestConfigsResource;
1985
+ readonly digitalCompliance: DigitalComplianceResource;
887
1986
  private readonly transport;
888
1987
  constructor(options?: NopaqueOptions);
889
1988
  close(): void;
@@ -891,4 +1990,4 @@ declare class Nopaque {
891
1990
 
892
1991
  declare const VERSION: string;
893
1992
 
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 };
1993
+ 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 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 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 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 TestRunResult, 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 Voice, type WaitChatStep, type WebWidgetTarget };