@roarkanalytics/sdk 3.10.0 → 3.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/client.d.mts +7 -4
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +7 -4
  5. package/client.d.ts.map +1 -1
  6. package/client.js +3 -0
  7. package/client.js.map +1 -1
  8. package/client.mjs +3 -0
  9. package/client.mjs.map +1 -1
  10. package/package.json +1 -1
  11. package/resources/agent-prompt.d.mts +129 -0
  12. package/resources/agent-prompt.d.mts.map +1 -0
  13. package/resources/agent-prompt.d.ts +129 -0
  14. package/resources/agent-prompt.d.ts.map +1 -0
  15. package/resources/agent-prompt.js +58 -0
  16. package/resources/agent-prompt.js.map +1 -0
  17. package/resources/agent-prompt.mjs +54 -0
  18. package/resources/agent-prompt.mjs.map +1 -0
  19. package/resources/call.d.mts +1 -1
  20. package/resources/call.d.mts.map +1 -1
  21. package/resources/call.d.ts +1 -1
  22. package/resources/call.d.ts.map +1 -1
  23. package/resources/config.d.mts +166 -18
  24. package/resources/config.d.mts.map +1 -1
  25. package/resources/config.d.ts +166 -18
  26. package/resources/config.d.ts.map +1 -1
  27. package/resources/customer-flow-edge-case.d.mts +72 -9
  28. package/resources/customer-flow-edge-case.d.mts.map +1 -1
  29. package/resources/customer-flow-edge-case.d.ts +72 -9
  30. package/resources/customer-flow-edge-case.d.ts.map +1 -1
  31. package/resources/customer-flow.d.mts +2005 -78
  32. package/resources/customer-flow.d.mts.map +1 -1
  33. package/resources/customer-flow.d.ts +2005 -78
  34. package/resources/customer-flow.d.ts.map +1 -1
  35. package/resources/customer-flow.js +18 -0
  36. package/resources/customer-flow.js.map +1 -1
  37. package/resources/customer-flow.mjs +18 -0
  38. package/resources/customer-flow.mjs.map +1 -1
  39. package/resources/index.d.mts +3 -2
  40. package/resources/index.d.mts.map +1 -1
  41. package/resources/index.d.ts +3 -2
  42. package/resources/index.d.ts.map +1 -1
  43. package/resources/index.js +3 -1
  44. package/resources/index.js.map +1 -1
  45. package/resources/index.mjs +1 -0
  46. package/resources/index.mjs.map +1 -1
  47. package/resources/simulation-environment.d.mts +163 -1
  48. package/resources/simulation-environment.d.mts.map +1 -1
  49. package/resources/simulation-environment.d.ts +163 -1
  50. package/resources/simulation-environment.d.ts.map +1 -1
  51. package/resources/simulation-environment.js +51 -0
  52. package/resources/simulation-environment.js.map +1 -1
  53. package/resources/simulation-environment.mjs +51 -0
  54. package/resources/simulation-environment.mjs.map +1 -1
  55. package/resources/simulation-job.d.mts +62 -2
  56. package/resources/simulation-job.d.mts.map +1 -1
  57. package/resources/simulation-job.d.ts +62 -2
  58. package/resources/simulation-job.d.ts.map +1 -1
  59. package/resources/simulation-persona.d.mts +42 -6
  60. package/resources/simulation-persona.d.mts.map +1 -1
  61. package/resources/simulation-persona.d.ts +42 -6
  62. package/resources/simulation-persona.d.ts.map +1 -1
  63. package/resources/simulation-run-plan-job.d.mts +31 -1
  64. package/resources/simulation-run-plan-job.d.mts.map +1 -1
  65. package/resources/simulation-run-plan-job.d.ts +31 -1
  66. package/resources/simulation-run-plan-job.d.ts.map +1 -1
  67. package/resources/simulation-run-plan.d.mts +154 -12
  68. package/resources/simulation-run-plan.d.mts.map +1 -1
  69. package/resources/simulation-run-plan.d.ts +154 -12
  70. package/resources/simulation-run-plan.d.ts.map +1 -1
  71. package/resources/simulation-template.d.mts +10 -0
  72. package/resources/simulation-template.d.mts.map +1 -1
  73. package/resources/simulation-template.d.ts +10 -0
  74. package/resources/simulation-template.d.ts.map +1 -1
  75. package/resources/simulation.d.mts +221 -6
  76. package/resources/simulation.d.mts.map +1 -1
  77. package/resources/simulation.d.ts +221 -6
  78. package/resources/simulation.d.ts.map +1 -1
  79. package/resources/simulation.js +10 -3
  80. package/resources/simulation.js.map +1 -1
  81. package/resources/simulation.mjs +10 -3
  82. package/resources/simulation.mjs.map +1 -1
  83. package/src/client.ts +33 -0
  84. package/src/resources/agent-prompt.ts +183 -0
  85. package/src/resources/call.ts +1 -1
  86. package/src/resources/config.ts +310 -20
  87. package/src/resources/customer-flow-edge-case.ts +180 -9
  88. package/src/resources/customer-flow.ts +3091 -63
  89. package/src/resources/index.ts +15 -0
  90. package/src/resources/simulation-environment.ts +244 -0
  91. package/src/resources/simulation-job.ts +92 -2
  92. package/src/resources/simulation-persona.ts +108 -6
  93. package/src/resources/simulation-run-plan-job.ts +39 -1
  94. package/src/resources/simulation-run-plan.ts +176 -12
  95. package/src/resources/simulation-template.ts +11 -0
  96. package/src/resources/simulation.ts +247 -6
  97. package/src/version.ts +1 -1
  98. package/version.d.mts +1 -1
  99. package/version.d.ts +1 -1
  100. package/version.js +1 -1
  101. package/version.mjs +1 -1
@@ -8,9 +8,16 @@ export class Simulation extends APIResource {
8
8
  /**
9
9
  * Starts a simulation and returns the run.
10
10
  *
11
- * Send `plan` to describe a simulation and run it once. Add `saveAsPlan` to keep
12
- * that configuration as a reusable run plan. Send `planId` instead to run a plan
13
- * you already have.
11
+ * Send `template` to run one of the built-in templates: it supplies the metrics
12
+ * and checks, and for some templates the flows too, so the request only names the
13
+ * agent and the direction. Send `plan` to describe a simulation yourself and run
14
+ * it once. Send `planId` to run a plan you already have.
15
+ *
16
+ * `template` and `plan` both resolve to a run plan, returned as
17
+ * `simulationRunPlanId`. Add `saveAsPlan` to keep it, or read it back to see
18
+ * exactly what ran. A plan built from a template is a snapshot: retuning the
19
+ * template later never changes what that plan runs, which is what makes a saved
20
+ * one safe to pin in CI.
14
21
  *
15
22
  * @example
16
23
  * ```ts
@@ -92,7 +99,8 @@ export namespace SimulationRunResponse {
92
99
 
93
100
  export type SimulationRunParams =
94
101
  | SimulationRunParams.RunSimulationFromConfig
95
- | SimulationRunParams.RunSimulationFromPlanID;
102
+ | SimulationRunParams.RunSimulationFromPlanID
103
+ | SimulationRunParams.RunSimulationFromTemplate;
96
104
 
97
105
  export declare namespace SimulationRunParams {
98
106
  export interface RunSimulationFromConfig {
@@ -211,6 +219,22 @@ export declare namespace SimulationRunParams {
211
219
  */
212
220
  flows?: Array<Plan.Flow>;
213
221
 
222
+ /**
223
+ * Let the run add metrics by itself off the attached flows, on top of the
224
+ * `metrics` named here.
225
+ *
226
+ * Two attach this way today: Agent Expectations wherever an attached flow has
227
+ * agent expectations written on it, and Keypad Entry wherever one has steps where
228
+ * the agent is expected to press keys. Both grade something authored on the flow
229
+ * that nothing else measures, which is why it is on by default.
230
+ *
231
+ * Set false when the `metrics` list is meant to be exhaustive: a plan testing only
232
+ * whether the caller can complete the flow may not want the agent graded on its
233
+ * expectations as well. False also pins the plan against any automatic metric
234
+ * Roark adds later.
235
+ */
236
+ includeAutomaticMetrics?: boolean;
237
+
214
238
  /**
215
239
  * Also collect each attached flow's own metrics, on top of the `metrics` named
216
240
  * here.
@@ -306,7 +330,7 @@ export declare namespace SimulationRunParams {
306
330
  /**
307
331
  * The customer flow to run.
308
332
  */
309
- id: string;
333
+ id?: string;
310
334
 
311
335
  /**
312
336
  * `"ALL"` runs every edge case the flow has when the run starts, so one added
@@ -325,6 +349,13 @@ export declare namespace SimulationRunParams {
325
349
  */
326
350
  personaOverrideId?: string | null;
327
351
 
352
+ /**
353
+ * The Roark-curated flow to run, by its stable slug. Use instead of `id` for a run
354
+ * you keep in version control: a curated flow’s id differs between deployments,
355
+ * its slug does not. Your own flows have no slug and are named by `id`.
356
+ */
357
+ slug?: string;
358
+
328
359
  /**
329
360
  * Values for everything it resolves.
330
361
  */
@@ -336,13 +367,21 @@ export declare namespace SimulationRunParams {
336
367
  /**
337
368
  * The edge case to run.
338
369
  */
339
- id: string;
370
+ id?: string;
340
371
 
341
372
  /**
342
373
  * Run this one as that persona instead of its own.
343
374
  */
344
375
  personaOverrideId?: string | null;
345
376
 
377
+ /**
378
+ * The edge case to run, by its stable slug, matched within this flow. Use instead
379
+ * of `id` for a run you keep in version control: a curated edge case’s id differs
380
+ * between deployments and changes outright if it is renamed. Your own edge cases
381
+ * have no slug and are named by `id`.
382
+ */
383
+ slug?: string;
384
+
346
385
  /**
347
386
  * Values for this one only.
348
387
  */
@@ -476,6 +515,208 @@ export declare namespace SimulationRunParams {
476
515
  variables: { [key: string]: string };
477
516
  }
478
517
  }
518
+
519
+ export interface RunSimulationFromTemplate {
520
+ /**
521
+ * The agent endpoints to call. No template can know these.
522
+ */
523
+ agentEndpoints: Array<RunSimulationFromTemplate.AgentEndpoint>;
524
+
525
+ /**
526
+ * Direction of the simulation (INBOUND or OUTBOUND)
527
+ */
528
+ direction: 'INBOUND' | 'OUTBOUND';
529
+
530
+ /**
531
+ * The template to run, as listed by GET /v1/simulation/template.
532
+ */
533
+ template: string;
534
+
535
+ /**
536
+ * Phrases that trigger end of call. Empty array disables the feature.
537
+ */
538
+ endCallPhrases?: Array<string>;
539
+
540
+ /**
541
+ * Semantic conditions that trigger end of call. The LLM evaluates the conversation
542
+ * against these conditions. Defaults to the template's `defaultEndCallReasons`, as
543
+ * returned by GET /v1/simulation/template. Pass an empty array to run with none.
544
+ */
545
+ endCallReasons?: Array<string>;
546
+
547
+ /**
548
+ * Merge the customer's own recording of the real call into each simulation, so
549
+ * metrics can be scored against the live leg as well as the simulated one. This is
550
+ * the API equivalent of the dashboard's live-enrichment toggle.
551
+ *
552
+ * With this on, the run provisions a phone number and holds each call open for up
553
+ * to 15 minutes waiting for a matching call to be posted to POST /v1/call. A call
554
+ * matches on the provisioned number (`roarkPhoneNumber` on the job) with a start
555
+ * time inside the simulation window. If nothing arrives, the simulation still
556
+ * completes and any `LIVE`-sourced metric produces no value.
557
+ *
558
+ * Required by any metric whose `requiresLiveConversation` is true: without it that
559
+ * metric is silently skipped.
560
+ */
561
+ enrichWithLiveConversation?: boolean;
562
+
563
+ /**
564
+ * Execution mode (PARALLEL or SEQUENTIAL)
565
+ */
566
+ executionMode?: 'PARALLEL' | 'SEQUENTIAL_SAME_RUN_PLAN' | 'SEQUENTIAL_PROJECT';
567
+
568
+ /**
569
+ * The flows to run, in the same shape a run plan takes them.
570
+ *
571
+ * Required when the template lists no flows of its own: it presets what to
572
+ * measure, and this says what to measure it on. Optional when it does, where these
573
+ * REPLACE the ones it would have run, so you can narrow a suite to the cases you
574
+ * care about. Either way, GET /v1/simulation/template lists the flows and variant
575
+ * ids each template covers.
576
+ */
577
+ flows?: Array<RunSimulationFromTemplate.Flow>;
578
+
579
+ /**
580
+ * Number of iterations to run for each test case (1-10000)
581
+ */
582
+ iterationCount?: number;
583
+
584
+ /**
585
+ * Maximum number of concurrent simulation jobs
586
+ */
587
+ maxConcurrentJobs?: number;
588
+
589
+ /**
590
+ * Defaults to the template's `defaultMaxSimulationDurationSeconds`, as returned by
591
+ * GET /v1/simulation/template.
592
+ */
593
+ maxSimulationDurationSeconds?: number;
594
+
595
+ /**
596
+ * What to call this. Defaults to the template's name and the date, and required
597
+ * with `saveAsPlan`.
598
+ */
599
+ name?: string;
600
+
601
+ /**
602
+ * Keeps the resolved configuration as a run plan, listed by GET
603
+ * /v1/simulation/plan and re-runnable with `planId`. Requires `name`.
604
+ */
605
+ saveAsPlan?: boolean;
606
+
607
+ /**
608
+ * Timeout in seconds for silence detection
609
+ */
610
+ silenceTimeoutSeconds?: number;
611
+
612
+ /**
613
+ * Values for the {{variables}} the run resolves. An object applies them
614
+ * everywhere; an array targets a flow, its happy path, or one of its edge cases
615
+ * with `flowId`.
616
+ *
617
+ * The scenario-scoped form the other variants accept is not valid here: a template
618
+ * run is always flow-based, so there would be no scenario for it to reach.
619
+ */
620
+ variables?: { [key: string]: string } | Array<RunSimulationFromTemplate.UnionMember1>;
621
+ }
622
+
623
+ export namespace RunSimulationFromTemplate {
624
+ export interface AgentEndpoint {
625
+ id: string;
626
+ }
627
+
628
+ /**
629
+ * One customer flow attached to a run plan, and which of its ways of running you
630
+ * cover.
631
+ *
632
+ * Attaching the same flow more than once with different overrides is how you fan
633
+ * it out across personas or values.
634
+ */
635
+ export interface Flow {
636
+ /**
637
+ * The customer flow to run.
638
+ */
639
+ id?: string;
640
+
641
+ /**
642
+ * `"ALL"` runs every edge case the flow has when the run starts, so one added
643
+ * later is covered. An array runs only the ones you name, each able to carry its
644
+ * own persona override and values.
645
+ */
646
+ edgeCases?: 'ALL' | Array<Flow.UnionMember1>;
647
+
648
+ /**
649
+ * Run the flow's happy path. Resolved when the run starts, so it follows the flow.
650
+ */
651
+ happyPath?: boolean;
652
+
653
+ /**
654
+ * Runs everything this attachment resolves as that persona instead of its own.
655
+ */
656
+ personaOverrideId?: string | null;
657
+
658
+ /**
659
+ * The Roark-curated flow to run, by its stable slug. Use instead of `id` for a run
660
+ * you keep in version control: a curated flow’s id differs between deployments,
661
+ * its slug does not. Your own flows have no slug and are named by `id`.
662
+ */
663
+ slug?: string;
664
+
665
+ /**
666
+ * Values for everything it resolves.
667
+ */
668
+ variables?: { [key: string]: string };
669
+ }
670
+
671
+ export namespace Flow {
672
+ export interface UnionMember1 {
673
+ /**
674
+ * The edge case to run.
675
+ */
676
+ id?: string;
677
+
678
+ /**
679
+ * Run this one as that persona instead of its own.
680
+ */
681
+ personaOverrideId?: string | null;
682
+
683
+ /**
684
+ * The edge case to run, by its stable slug, matched within this flow. Use instead
685
+ * of `id` for a run you keep in version control: a curated edge case’s id differs
686
+ * between deployments and changes outright if it is renamed. Your own edge cases
687
+ * have no slug and are named by `id`.
688
+ */
689
+ slug?: string;
690
+
691
+ /**
692
+ * Values for this one only.
693
+ */
694
+ variables?: { [key: string]: string };
695
+ }
696
+ }
697
+
698
+ export interface UnionMember1 {
699
+ /**
700
+ * A customer flow this plan runs.
701
+ */
702
+ flowId: string;
703
+
704
+ /**
705
+ * The values to apply.
706
+ */
707
+ variables: { [key: string]: string };
708
+
709
+ /**
710
+ * Narrow to one edge case of that flow.
711
+ */
712
+ edgeCaseId?: string;
713
+
714
+ /**
715
+ * Narrow to the flow's happy path.
716
+ */
717
+ happyPath?: true;
718
+ }
719
+ }
479
720
  }
480
721
 
481
722
  export declare namespace Simulation {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.10.0'; // x-release-please-version
1
+ export const VERSION = '3.12.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.10.0";
1
+ export declare const VERSION = "3.12.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.10.0";
1
+ export declare const VERSION = "3.12.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.js CHANGED
@@ -1,5 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.VERSION = void 0;
4
- exports.VERSION = '3.10.0'; // x-release-please-version
4
+ exports.VERSION = '3.12.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.10.0'; // x-release-please-version
1
+ export const VERSION = '3.12.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map