@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.
- package/CHANGELOG.md +36 -0
- package/client.d.mts +7 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +7 -4
- package/client.d.ts.map +1 -1
- package/client.js +3 -0
- package/client.js.map +1 -1
- package/client.mjs +3 -0
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/agent-prompt.d.mts +129 -0
- package/resources/agent-prompt.d.mts.map +1 -0
- package/resources/agent-prompt.d.ts +129 -0
- package/resources/agent-prompt.d.ts.map +1 -0
- package/resources/agent-prompt.js +58 -0
- package/resources/agent-prompt.js.map +1 -0
- package/resources/agent-prompt.mjs +54 -0
- package/resources/agent-prompt.mjs.map +1 -0
- package/resources/call.d.mts +1 -1
- package/resources/call.d.mts.map +1 -1
- package/resources/call.d.ts +1 -1
- package/resources/call.d.ts.map +1 -1
- package/resources/config.d.mts +166 -18
- package/resources/config.d.mts.map +1 -1
- package/resources/config.d.ts +166 -18
- package/resources/config.d.ts.map +1 -1
- package/resources/customer-flow-edge-case.d.mts +72 -9
- package/resources/customer-flow-edge-case.d.mts.map +1 -1
- package/resources/customer-flow-edge-case.d.ts +72 -9
- package/resources/customer-flow-edge-case.d.ts.map +1 -1
- package/resources/customer-flow.d.mts +2005 -78
- package/resources/customer-flow.d.mts.map +1 -1
- package/resources/customer-flow.d.ts +2005 -78
- package/resources/customer-flow.d.ts.map +1 -1
- package/resources/customer-flow.js +18 -0
- package/resources/customer-flow.js.map +1 -1
- package/resources/customer-flow.mjs +18 -0
- package/resources/customer-flow.mjs.map +1 -1
- package/resources/index.d.mts +3 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +3 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +3 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +1 -0
- package/resources/index.mjs.map +1 -1
- package/resources/simulation-environment.d.mts +163 -1
- package/resources/simulation-environment.d.mts.map +1 -1
- package/resources/simulation-environment.d.ts +163 -1
- package/resources/simulation-environment.d.ts.map +1 -1
- package/resources/simulation-environment.js +51 -0
- package/resources/simulation-environment.js.map +1 -1
- package/resources/simulation-environment.mjs +51 -0
- package/resources/simulation-environment.mjs.map +1 -1
- package/resources/simulation-job.d.mts +62 -2
- package/resources/simulation-job.d.mts.map +1 -1
- package/resources/simulation-job.d.ts +62 -2
- package/resources/simulation-job.d.ts.map +1 -1
- package/resources/simulation-persona.d.mts +42 -6
- package/resources/simulation-persona.d.mts.map +1 -1
- package/resources/simulation-persona.d.ts +42 -6
- package/resources/simulation-persona.d.ts.map +1 -1
- package/resources/simulation-run-plan-job.d.mts +31 -1
- package/resources/simulation-run-plan-job.d.mts.map +1 -1
- package/resources/simulation-run-plan-job.d.ts +31 -1
- package/resources/simulation-run-plan-job.d.ts.map +1 -1
- package/resources/simulation-run-plan.d.mts +154 -12
- package/resources/simulation-run-plan.d.mts.map +1 -1
- package/resources/simulation-run-plan.d.ts +154 -12
- package/resources/simulation-run-plan.d.ts.map +1 -1
- package/resources/simulation-template.d.mts +10 -0
- package/resources/simulation-template.d.mts.map +1 -1
- package/resources/simulation-template.d.ts +10 -0
- package/resources/simulation-template.d.ts.map +1 -1
- package/resources/simulation.d.mts +221 -6
- package/resources/simulation.d.mts.map +1 -1
- package/resources/simulation.d.ts +221 -6
- package/resources/simulation.d.ts.map +1 -1
- package/resources/simulation.js +10 -3
- package/resources/simulation.js.map +1 -1
- package/resources/simulation.mjs +10 -3
- package/resources/simulation.mjs.map +1 -1
- package/src/client.ts +33 -0
- package/src/resources/agent-prompt.ts +183 -0
- package/src/resources/call.ts +1 -1
- package/src/resources/config.ts +310 -20
- package/src/resources/customer-flow-edge-case.ts +180 -9
- package/src/resources/customer-flow.ts +3091 -63
- package/src/resources/index.ts +15 -0
- package/src/resources/simulation-environment.ts +244 -0
- package/src/resources/simulation-job.ts +92 -2
- package/src/resources/simulation-persona.ts +108 -6
- package/src/resources/simulation-run-plan-job.ts +39 -1
- package/src/resources/simulation-run-plan.ts +176 -12
- package/src/resources/simulation-template.ts +11 -0
- package/src/resources/simulation.ts +247 -6
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- 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 `
|
|
12
|
-
*
|
|
13
|
-
*
|
|
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
|
|
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
|
|
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.
|
|
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.
|
|
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.
|
|
1
|
+
export declare const VERSION = "3.12.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '3.
|
|
1
|
+
export const VERSION = '3.12.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|