@roarkanalytics/sdk 3.9.0 → 3.11.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 (62) hide show
  1. package/CHANGELOG.md +24 -0
  2. package/client.d.mts +3 -0
  3. package/client.d.mts.map +1 -1
  4. package/client.d.ts +3 -0
  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/customer-flow-edge-case.d.mts +9 -0
  12. package/resources/customer-flow-edge-case.d.mts.map +1 -1
  13. package/resources/customer-flow-edge-case.d.ts +9 -0
  14. package/resources/customer-flow-edge-case.d.ts.map +1 -1
  15. package/resources/customer-flow.d.mts +30 -0
  16. package/resources/customer-flow.d.mts.map +1 -1
  17. package/resources/customer-flow.d.ts +30 -0
  18. package/resources/customer-flow.d.ts.map +1 -1
  19. package/resources/index.d.mts +1 -0
  20. package/resources/index.d.mts.map +1 -1
  21. package/resources/index.d.ts +1 -0
  22. package/resources/index.d.ts.map +1 -1
  23. package/resources/index.js +3 -1
  24. package/resources/index.js.map +1 -1
  25. package/resources/index.mjs +1 -0
  26. package/resources/index.mjs.map +1 -1
  27. package/resources/simulation-run-plan.d.mts +128 -12
  28. package/resources/simulation-run-plan.d.mts.map +1 -1
  29. package/resources/simulation-run-plan.d.ts +128 -12
  30. package/resources/simulation-run-plan.d.ts.map +1 -1
  31. package/resources/simulation-template.d.mts +162 -0
  32. package/resources/simulation-template.d.mts.map +1 -0
  33. package/resources/simulation-template.d.ts +162 -0
  34. package/resources/simulation-template.d.ts.map +1 -0
  35. package/resources/simulation-template.js +31 -0
  36. package/resources/simulation-template.js.map +1 -0
  37. package/resources/simulation-template.mjs +27 -0
  38. package/resources/simulation-template.mjs.map +1 -0
  39. package/resources/simulation.d.mts +218 -6
  40. package/resources/simulation.d.mts.map +1 -1
  41. package/resources/simulation.d.ts +218 -6
  42. package/resources/simulation.d.ts.map +1 -1
  43. package/resources/simulation.js +10 -3
  44. package/resources/simulation.js.map +1 -1
  45. package/resources/simulation.mjs +10 -3
  46. package/resources/simulation.mjs.map +1 -1
  47. package/src/client.ts +8 -0
  48. package/src/resources/customer-flow-edge-case.ts +18 -0
  49. package/src/resources/customer-flow.ts +60 -0
  50. package/src/resources/index.ts +1 -0
  51. package/src/resources/simulation-run-plan.ts +146 -12
  52. package/src/resources/simulation-template.ts +190 -0
  53. package/src/resources/simulation.ts +244 -6
  54. package/src/version.ts +1 -1
  55. package/version.d.mts +1 -1
  56. package/version.d.mts.map +1 -1
  57. package/version.d.ts +1 -1
  58. package/version.d.ts.map +1 -1
  59. package/version.js +1 -1
  60. package/version.js.map +1 -1
  61. package/version.mjs +1 -1
  62. package/version.mjs.map +1 -1
@@ -0,0 +1,190 @@
1
+ // File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ import { APIResource } from '../core/resource';
4
+ import { APIPromise } from '../core/api-promise';
5
+ import { RequestOptions } from '../internal/request-options';
6
+
7
+ export class SimulationTemplate extends APIResource {
8
+ /**
9
+ * Returns the built-in simulation templates, each resolved against this project:
10
+ * the metric and check definitions it collects, and the flows it runs with the
11
+ * variants it covers.
12
+ *
13
+ * A template is a preset rather than a stored object, so building a run from one
14
+ * produces an ordinary run plan you own and can edit afterwards. Pass a `slug` as
15
+ * `template` to POST /v1/simulation/run.
16
+ *
17
+ * Every entry is complete, so there is no per-template endpoint to follow up with,
18
+ * and the list is a fixed catalogue rather than a paginated one. Only templates a
19
+ * request can actually run are listed.
20
+ *
21
+ * @example
22
+ * ```ts
23
+ * const simulationTemplates =
24
+ * await client.simulationTemplate.list();
25
+ * ```
26
+ */
27
+ list(options?: RequestOptions): APIPromise<SimulationTemplateListResponse> {
28
+ return this._client.get('/v1/simulation/template', options);
29
+ }
30
+ }
31
+
32
+ /**
33
+ * The built-in simulation templates.
34
+ */
35
+ export interface SimulationTemplateListResponse {
36
+ data: Array<SimulationTemplateListResponse.Data>;
37
+ }
38
+
39
+ export namespace SimulationTemplateListResponse {
40
+ /**
41
+ * A built-in simulation template, resolved against this project: what it measures
42
+ * and what it runs.
43
+ */
44
+ export interface Data {
45
+ /**
46
+ * Grouping used in the dashboard library
47
+ */
48
+ category: string;
49
+
50
+ /**
51
+ * The per-simulation cap a run from this template uses unless the request sets its
52
+ * own.
53
+ */
54
+ defaultMaxSimulationDurationSeconds: number;
55
+
56
+ /**
57
+ * What this template tests
58
+ */
59
+ description: string;
60
+
61
+ /**
62
+ * The flows this template runs, and which of their ways of running it covers.
63
+ *
64
+ * Empty means the template presets only what to measure, and a run has to say what
65
+ * to measure it on: pass `flows` to POST /v1/simulation/run. When it is not empty
66
+ * you can still pass `flows` to narrow it, naming a subset of the ids listed here.
67
+ */
68
+ flows: Array<Data.Flow>;
69
+
70
+ /**
71
+ * Whether runs from this template also collect each attached flow's own metrics,
72
+ * on top of the template's set.
73
+ */
74
+ includeFlowMetrics: boolean;
75
+
76
+ /**
77
+ * The metrics this template collects, resolved to this project's definitions.
78
+ */
79
+ metrics: Array<Data.Metric>;
80
+
81
+ /**
82
+ * Stable identifier. Name this in a run request.
83
+ */
84
+ slug: string;
85
+
86
+ /**
87
+ * The Pass/Fail checks this template attaches alongside its metrics.
88
+ */
89
+ thresholds: Array<Data.Threshold>;
90
+
91
+ /**
92
+ * Display name
93
+ */
94
+ title: string;
95
+ }
96
+
97
+ export namespace Data {
98
+ export interface Flow {
99
+ /**
100
+ * Customer flow ID
101
+ */
102
+ id: string;
103
+
104
+ /**
105
+ * The other ways of running this flow that this template covers.
106
+ */
107
+ edgeCases: Array<Flow.EdgeCase>;
108
+
109
+ /**
110
+ * The flow's default way of running, when this template covers it. Null when it
111
+ * does not, or the flow has none.
112
+ */
113
+ happyPath: Flow.HappyPath | null;
114
+
115
+ /**
116
+ * The stable slug of a Roark-curated flow, null for one of your own.
117
+ *
118
+ * Prefer this over `id` when you are storing a run in version control: a curated
119
+ * flow is a global row, so its id is the same for every project but differs
120
+ * between deployments, while the slug is stable wherever the flow exists. Both are
121
+ * accepted by a run request.
122
+ */
123
+ slug: string | null;
124
+
125
+ /**
126
+ * Flow title
127
+ */
128
+ title: string;
129
+ }
130
+
131
+ export namespace Flow {
132
+ export interface EdgeCase {
133
+ /**
134
+ * Customer flow variant ID
135
+ */
136
+ id: string;
137
+
138
+ /**
139
+ * The stable slug of a Roark-curated edge case, null for one of your own.
140
+ *
141
+ * Prefer this over `id` in a run you keep in version control. A curated edge case
142
+ * is a global row, so its id differs between deployments, and renaming one
143
+ * replaces the row and its id outright. The slug survives both.
144
+ */
145
+ slug: string | null;
146
+
147
+ /**
148
+ * What this way of running the flow is called
149
+ */
150
+ title: string;
151
+ }
152
+
153
+ /**
154
+ * The flow's default way of running, when this template covers it. Null when it
155
+ * does not, or the flow has none.
156
+ */
157
+ export interface HappyPath {
158
+ title: string;
159
+ }
160
+ }
161
+
162
+ export interface Metric {
163
+ /**
164
+ * Metric definition ID
165
+ */
166
+ id: string;
167
+
168
+ /**
169
+ * Stable metric slug, e.g. "response_time"
170
+ */
171
+ slug: string;
172
+ }
173
+
174
+ export interface Threshold {
175
+ /**
176
+ * Metric definition ID
177
+ */
178
+ id: string;
179
+
180
+ /**
181
+ * Stable metric slug, e.g. "response_time"
182
+ */
183
+ slug: string;
184
+ }
185
+ }
186
+ }
187
+
188
+ export declare namespace SimulationTemplate {
189
+ export { type SimulationTemplateListResponse as SimulationTemplateListResponse };
190
+ }
@@ -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,20 @@ export declare namespace SimulationRunParams {
211
219
  */
212
220
  flows?: Array<Plan.Flow>;
213
221
 
222
+ /**
223
+ * Also collect each attached flow's own metrics, on top of the `metrics` named
224
+ * here.
225
+ *
226
+ * Default true, which is what you want when you brought your own flows and their
227
+ * graders. Set false for a run whose metric list is meant to be exhaustive: a
228
+ * template like Load Testing or Voicemail deliberately grades a narrow set, and
229
+ * inheriting every flow metric on top multiplies analysis cost across the volume
230
+ * without adding signal.
231
+ *
232
+ * GET /v1/simulation/template returns the value each template expects.
233
+ */
234
+ includeFlowMetrics?: boolean;
235
+
214
236
  /**
215
237
  * Number of iterations to run for each test case (1-10000)
216
238
  */
@@ -292,7 +314,7 @@ export declare namespace SimulationRunParams {
292
314
  /**
293
315
  * The customer flow to run.
294
316
  */
295
- id: string;
317
+ id?: string;
296
318
 
297
319
  /**
298
320
  * `"ALL"` runs every edge case the flow has when the run starts, so one added
@@ -311,6 +333,13 @@ export declare namespace SimulationRunParams {
311
333
  */
312
334
  personaOverrideId?: string | null;
313
335
 
336
+ /**
337
+ * The Roark-curated flow to run, by its stable slug. Use instead of `id` for a run
338
+ * you keep in version control: a curated flow’s id differs between deployments,
339
+ * its slug does not. Your own flows have no slug and are named by `id`.
340
+ */
341
+ slug?: string;
342
+
314
343
  /**
315
344
  * Values for everything it resolves.
316
345
  */
@@ -322,13 +351,21 @@ export declare namespace SimulationRunParams {
322
351
  /**
323
352
  * The edge case to run.
324
353
  */
325
- id: string;
354
+ id?: string;
326
355
 
327
356
  /**
328
357
  * Run this one as that persona instead of its own.
329
358
  */
330
359
  personaOverrideId?: string | null;
331
360
 
361
+ /**
362
+ * The edge case to run, by its stable slug, matched within this flow. Use instead
363
+ * of `id` for a run you keep in version control: a curated edge case’s id differs
364
+ * between deployments and changes outright if it is renamed. Your own edge cases
365
+ * have no slug and are named by `id`.
366
+ */
367
+ slug?: string;
368
+
332
369
  /**
333
370
  * Values for this one only.
334
371
  */
@@ -462,6 +499,207 @@ export declare namespace SimulationRunParams {
462
499
  variables: { [key: string]: string };
463
500
  }
464
501
  }
502
+
503
+ export interface RunSimulationFromTemplate {
504
+ /**
505
+ * The agent endpoints to call. No template can know these.
506
+ */
507
+ agentEndpoints: Array<RunSimulationFromTemplate.AgentEndpoint>;
508
+
509
+ /**
510
+ * Direction of the simulation (INBOUND or OUTBOUND)
511
+ */
512
+ direction: 'INBOUND' | 'OUTBOUND';
513
+
514
+ /**
515
+ * The template to run, as listed by GET /v1/simulation/template.
516
+ */
517
+ template: string;
518
+
519
+ /**
520
+ * Phrases that trigger end of call. Empty array disables the feature.
521
+ */
522
+ endCallPhrases?: Array<string>;
523
+
524
+ /**
525
+ * Semantic conditions that trigger end of call. The LLM evaluates the conversation
526
+ * against these conditions. Empty array disables the feature.
527
+ */
528
+ endCallReasons?: Array<string>;
529
+
530
+ /**
531
+ * Merge the customer's own recording of the real call into each simulation, so
532
+ * metrics can be scored against the live leg as well as the simulated one. This is
533
+ * the API equivalent of the dashboard's live-enrichment toggle.
534
+ *
535
+ * With this on, the run provisions a phone number and holds each call open for up
536
+ * to 15 minutes waiting for a matching call to be posted to POST /v1/call. A call
537
+ * matches on the provisioned number (`roarkPhoneNumber` on the job) with a start
538
+ * time inside the simulation window. If nothing arrives, the simulation still
539
+ * completes and any `LIVE`-sourced metric produces no value.
540
+ *
541
+ * Required by any metric whose `requiresLiveConversation` is true: without it that
542
+ * metric is silently skipped.
543
+ */
544
+ enrichWithLiveConversation?: boolean;
545
+
546
+ /**
547
+ * Execution mode (PARALLEL or SEQUENTIAL)
548
+ */
549
+ executionMode?: 'PARALLEL' | 'SEQUENTIAL_SAME_RUN_PLAN' | 'SEQUENTIAL_PROJECT';
550
+
551
+ /**
552
+ * The flows to run, in the same shape a run plan takes them.
553
+ *
554
+ * Required when the template lists no flows of its own: it presets what to
555
+ * measure, and this says what to measure it on. Optional when it does, where these
556
+ * REPLACE the ones it would have run, so you can narrow a suite to the cases you
557
+ * care about. Either way, GET /v1/simulation/template lists the flows and variant
558
+ * ids each template covers.
559
+ */
560
+ flows?: Array<RunSimulationFromTemplate.Flow>;
561
+
562
+ /**
563
+ * Number of iterations to run for each test case (1-10000)
564
+ */
565
+ iterationCount?: number;
566
+
567
+ /**
568
+ * Maximum number of concurrent simulation jobs
569
+ */
570
+ maxConcurrentJobs?: number;
571
+
572
+ /**
573
+ * Defaults to the template's `defaultMaxSimulationDurationSeconds`, as returned by
574
+ * GET /v1/simulation/template.
575
+ */
576
+ maxSimulationDurationSeconds?: number;
577
+
578
+ /**
579
+ * What to call this. Defaults to the template's name and the date, and required
580
+ * with `saveAsPlan`.
581
+ */
582
+ name?: string;
583
+
584
+ /**
585
+ * Keeps the resolved configuration as a run plan, listed by GET
586
+ * /v1/simulation/plan and re-runnable with `planId`. Requires `name`.
587
+ */
588
+ saveAsPlan?: boolean;
589
+
590
+ /**
591
+ * Timeout in seconds for silence detection
592
+ */
593
+ silenceTimeoutSeconds?: number;
594
+
595
+ /**
596
+ * Values for the {{variables}} the run resolves. An object applies them
597
+ * everywhere; an array targets a flow, its happy path, or one of its edge cases
598
+ * with `flowId`.
599
+ *
600
+ * The scenario-scoped form the other variants accept is not valid here: a template
601
+ * run is always flow-based, so there would be no scenario for it to reach.
602
+ */
603
+ variables?: { [key: string]: string } | Array<RunSimulationFromTemplate.UnionMember1>;
604
+ }
605
+
606
+ export namespace RunSimulationFromTemplate {
607
+ export interface AgentEndpoint {
608
+ id: string;
609
+ }
610
+
611
+ /**
612
+ * One customer flow attached to a run plan, and which of its ways of running you
613
+ * cover.
614
+ *
615
+ * Attaching the same flow more than once with different overrides is how you fan
616
+ * it out across personas or values.
617
+ */
618
+ export interface Flow {
619
+ /**
620
+ * The customer flow to run.
621
+ */
622
+ id?: string;
623
+
624
+ /**
625
+ * `"ALL"` runs every edge case the flow has when the run starts, so one added
626
+ * later is covered. An array runs only the ones you name, each able to carry its
627
+ * own persona override and values.
628
+ */
629
+ edgeCases?: 'ALL' | Array<Flow.UnionMember1>;
630
+
631
+ /**
632
+ * Run the flow's happy path. Resolved when the run starts, so it follows the flow.
633
+ */
634
+ happyPath?: boolean;
635
+
636
+ /**
637
+ * Runs everything this attachment resolves as that persona instead of its own.
638
+ */
639
+ personaOverrideId?: string | null;
640
+
641
+ /**
642
+ * The Roark-curated flow to run, by its stable slug. Use instead of `id` for a run
643
+ * you keep in version control: a curated flow’s id differs between deployments,
644
+ * its slug does not. Your own flows have no slug and are named by `id`.
645
+ */
646
+ slug?: string;
647
+
648
+ /**
649
+ * Values for everything it resolves.
650
+ */
651
+ variables?: { [key: string]: string };
652
+ }
653
+
654
+ export namespace Flow {
655
+ export interface UnionMember1 {
656
+ /**
657
+ * The edge case to run.
658
+ */
659
+ id?: string;
660
+
661
+ /**
662
+ * Run this one as that persona instead of its own.
663
+ */
664
+ personaOverrideId?: string | null;
665
+
666
+ /**
667
+ * The edge case to run, by its stable slug, matched within this flow. Use instead
668
+ * of `id` for a run you keep in version control: a curated edge case’s id differs
669
+ * between deployments and changes outright if it is renamed. Your own edge cases
670
+ * have no slug and are named by `id`.
671
+ */
672
+ slug?: string;
673
+
674
+ /**
675
+ * Values for this one only.
676
+ */
677
+ variables?: { [key: string]: string };
678
+ }
679
+ }
680
+
681
+ export interface UnionMember1 {
682
+ /**
683
+ * A customer flow this plan runs.
684
+ */
685
+ flowId: string;
686
+
687
+ /**
688
+ * The values to apply.
689
+ */
690
+ variables: { [key: string]: string };
691
+
692
+ /**
693
+ * Narrow to one edge case of that flow.
694
+ */
695
+ edgeCaseId?: string;
696
+
697
+ /**
698
+ * Narrow to the flow's happy path.
699
+ */
700
+ happyPath?: true;
701
+ }
702
+ }
465
703
  }
466
704
 
467
705
  export declare namespace Simulation {
package/src/version.ts CHANGED
@@ -1 +1 @@
1
- export const VERSION = '3.9.0'; // x-release-please-version
1
+ export const VERSION = '3.11.0'; // x-release-please-version
package/version.d.mts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.9.0";
1
+ export declare const VERSION = "3.11.0";
2
2
  //# sourceMappingURL=version.d.mts.map
package/version.d.mts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.mts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
package/version.d.ts CHANGED
@@ -1,2 +1,2 @@
1
- export declare const VERSION = "3.9.0";
1
+ export declare const VERSION = "3.11.0";
2
2
  //# sourceMappingURL=version.d.ts.map
package/version.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,UAAU,CAAC"}
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,OAAO,WAAW,CAAC"}
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.9.0'; // x-release-please-version
4
+ exports.VERSION = '3.11.0'; // x-release-please-version
5
5
  //# sourceMappingURL=version.js.map
package/version.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":";;;AAAa,QAAA,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}
package/version.mjs CHANGED
@@ -1,2 +1,2 @@
1
- export const VERSION = '3.9.0'; // x-release-please-version
1
+ export const VERSION = '3.11.0'; // x-release-please-version
2
2
  //# sourceMappingURL=version.mjs.map
package/version.mjs.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC,CAAC,2BAA2B"}
1
+ {"version":3,"file":"version.mjs","sourceRoot":"","sources":["src/version.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,QAAQ,CAAC,CAAC,2BAA2B"}