@@ -200,6 +200,11 @@ export class CustomerFlow extends APIResource {
200200 * navigating a menu the simulation is playing, so its digits are an assertion the
201201 * run is graded against rather than an instruction, and it counts as an agent turn
202202 * for role alternation.
203+ *
204+ * In a STRICT flow an `AGENT_TURN` may carry its own `offScriptPolicy`, which
205+ * replaces the flow-level one at that step. Omit it (or send null) to follow the
206+ * flow's policy. Use it where one missed step makes the rest of the call
207+ * meaningless: an authentication menu, say, with `then: HANG_UP_INVALIDATE`.
203208 */
204209export type FlowStep =
205210 | FlowStep . UnionMember0
@@ -222,11 +227,27 @@ export namespace FlowStep {
222227
223228 nodeId ?: string ;
224229
230+ offScriptPolicy ?: UnionMember0 . OffScriptPolicy | null ;
231+
225232 ref ?: string ;
226233
227234 steps ?: Array < CustomerFlowAPI . FlowStep > ;
228235 }
229236
237+ export namespace UnionMember0 {
238+ export interface OffScriptPolicy {
239+ maxAttempts : number ;
240+
241+ reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
242+
243+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
244+
245+ sayLine ?: string | null ;
246+
247+ waitSeconds ?: number | null ;
248+ }
249+ }
250+
230251 export interface UnionMember1 {
231252 type : 'CUSTOMER_TURN' ;
232253
@@ -396,8 +417,11 @@ export namespace CustomerFlowCreateResponse {
396417 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
397418 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
398419 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
399- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
400- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
420+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
421+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
422+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
423+ * stay silent, 3 attempts, hang up. The default for every agent step; an
424+ * AGENT_TURN step can carry its own.
401425 */
402426 offScriptPolicy : ScriptedCustomerFlow . OffScriptPolicy | null ;
403427
@@ -1131,15 +1155,18 @@ export namespace CustomerFlowCreateResponse {
11311155 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
11321156 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
11331157 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
1134- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
1135- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
1158+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
1159+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
1160+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
1161+ * stay silent, 3 attempts, hang up. The default for every agent step; an
1162+ * AGENT_TURN step can carry its own.
11361163 */
11371164 export interface OffScriptPolicy {
11381165 maxAttempts : number ;
11391166
11401167 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
11411168
1142- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
1169+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
11431170
11441171 sayLine ?: string | null ;
11451172
@@ -2659,8 +2686,11 @@ export namespace CustomerFlowUpdateResponse {
26592686 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
26602687 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
26612688 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
2662- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
2663- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
2689+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
2690+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
2691+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
2692+ * stay silent, 3 attempts, hang up. The default for every agent step; an
2693+ * AGENT_TURN step can carry its own.
26642694 */
26652695 offScriptPolicy : ScriptedCustomerFlow . OffScriptPolicy | null ;
26662696
@@ -3394,15 +3424,18 @@ export namespace CustomerFlowUpdateResponse {
33943424 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
33953425 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
33963426 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
3397- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
3398- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
3427+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
3428+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
3429+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
3430+ * stay silent, 3 attempts, hang up. The default for every agent step; an
3431+ * AGENT_TURN step can carry its own.
33993432 */
34003433 export interface OffScriptPolicy {
34013434 maxAttempts : number ;
34023435
34033436 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
34043437
3405- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
3438+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
34063439
34073440 sayLine ?: string | null ;
34083441
@@ -4925,8 +4958,11 @@ export namespace CustomerFlowListResponse {
49254958 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
49264959 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
49274960 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
4928- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
4929- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
4961+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
4962+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
4963+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
4964+ * stay silent, 3 attempts, hang up. The default for every agent step; an
4965+ * AGENT_TURN step can carry its own.
49304966 */
49314967 offScriptPolicy : ScriptedCustomerFlow . OffScriptPolicy | null ;
49324968
@@ -5660,15 +5696,18 @@ export namespace CustomerFlowListResponse {
56605696 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
56615697 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
56625698 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
5663- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
5664- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
5699+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
5700+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
5701+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
5702+ * stay silent, 3 attempts, hang up. The default for every agent step; an
5703+ * AGENT_TURN step can carry its own.
56655704 */
56665705 export interface OffScriptPolicy {
56675706 maxAttempts : number ;
56685707
56695708 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
56705709
5671- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
5710+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
56725711
56735712 sayLine ?: string | null ;
56745713
@@ -7218,8 +7257,11 @@ export namespace CustomerFlowDuplicateResponse {
72187257 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
72197258 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
72207259 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
7221- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
7222- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
7260+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
7261+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
7262+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
7263+ * stay silent, 3 attempts, hang up. The default for every agent step; an
7264+ * AGENT_TURN step can carry its own.
72237265 */
72247266 offScriptPolicy : ScriptedCustomerFlow . OffScriptPolicy | null ;
72257267
@@ -7953,15 +7995,18 @@ export namespace CustomerFlowDuplicateResponse {
79537995 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
79547996 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
79557997 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
7956- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
7957- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
7998+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
7999+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
8000+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
8001+ * stay silent, 3 attempts, hang up. The default for every agent step; an
8002+ * AGENT_TURN step can carry its own.
79588003 */
79598004 export interface OffScriptPolicy {
79608005 maxAttempts : number ;
79618006
79628007 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
79638008
7964- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
8009+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
79658010
79668011 sayLine ?: string | null ;
79678012
@@ -9481,8 +9526,11 @@ export namespace CustomerFlowGetByIDResponse {
94819526 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
94829527 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
94839528 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
9484- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
9485- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
9529+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
9530+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
9531+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
9532+ * stay silent, 3 attempts, hang up. The default for every agent step; an
9533+ * AGENT_TURN step can carry its own.
94869534 */
94879535 offScriptPolicy : ScriptedCustomerFlow . OffScriptPolicy | null ;
94889536
@@ -10216,15 +10264,18 @@ export namespace CustomerFlowGetByIDResponse {
1021610264 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
1021710265 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
1021810266 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
10219- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
10220- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
10267+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
10268+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
10269+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
10270+ * stay silent, 3 attempts, hang up. The default for every agent step; an
10271+ * AGENT_TURN step can carry its own.
1022110272 */
1022210273 export interface OffScriptPolicy {
1022310274 maxAttempts : number ;
1022410275
1022510276 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
1022610277
10227- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
10278+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
1022810279
1022910280 sayLine ?: string | null ;
1023010281
@@ -13678,8 +13729,11 @@ export declare namespace CustomerFlowCreateParams {
1367813729 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
1367913730 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
1368013731 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
13681- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
13682- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
13732+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
13733+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
13734+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
13735+ * stay silent, 3 attempts, hang up. The default for every agent step; an
13736+ * AGENT_TURN step can carry its own.
1368313737 */
1368413738 offScriptPolicy ?: CreateScriptedCustomerFlowInput . OffScriptPolicy | null ;
1368513739
@@ -13709,15 +13763,18 @@ export declare namespace CustomerFlowCreateParams {
1370913763 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
1371013764 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
1371113765 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
13712- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
13713- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
13766+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
13767+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
13768+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
13769+ * stay silent, 3 attempts, hang up. The default for every agent step; an
13770+ * AGENT_TURN step can carry its own.
1371413771 */
1371513772 export interface OffScriptPolicy {
1371613773 maxAttempts : number ;
1371713774
1371813775 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
1371913776
13720- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
13777+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
1372113778
1372213779 sayLine ?: string | null ;
1372313780
@@ -13832,8 +13889,11 @@ export interface CustomerFlowUpdateParams {
1383213889 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
1383313890 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
1383413891 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
13835- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
13836- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
13892+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
13893+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
13894+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
13895+ * stay silent, 3 attempts, hang up. The default for every agent step; an
13896+ * AGENT_TURN step can carry its own.
1383713897 */
1383813898 offScriptPolicy ?: CustomerFlowUpdateParams . OffScriptPolicy | null ;
1383913899
@@ -13865,15 +13925,18 @@ export namespace CustomerFlowUpdateParams {
1386513925 * attempt (STAY_SILENT, REPEAT its last scripted line, RESPOND once in character
1386613926 * without moving on, or SAY `sayLine`), and `then` runs when attempts reach
1386713927 * `maxAttempts` or your agent stays silent for `waitSeconds` (HANG_UP ends the
13868- * call with ended reason SCRIPT_DIVERGED, MOVE_ON advances anyway, ADAPT hands the
13869- * rest of the call to loose behaviour). Null: stay silent, 3 attempts, hang up.
13928+ * call with ended reason SCRIPT_DIVERGED, HANG_UP_INVALIDATE ends it the same way
13929+ * and invalidates the run so it is scored by nothing and counted nowhere, MOVE_ON
13930+ * advances anyway, ADAPT hands the rest of the call to loose behaviour). Null:
13931+ * stay silent, 3 attempts, hang up. The default for every agent step; an
13932+ * AGENT_TURN step can carry its own.
1387013933 */
1387113934 export interface OffScriptPolicy {
1387213935 maxAttempts : number ;
1387313936
1387413937 reaction : 'STAY_SILENT' | 'REPEAT' | 'RESPOND' | 'SAY' ;
1387513938
13876- then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' ;
13939+ then : 'HANG_UP' | 'MOVE_ON' | 'ADAPT' | 'HANG_UP_INVALIDATE' ;
1387713940
1387813941 sayLine ?: string | null ;
1387913942
0 commit comments