Skip to content

Commit 0a5405f

Browse files
feat(managed-auth): add TS CUA worker contract (KERNEL-1456)
1 parent bd1c0ca commit 0a5405f

2 files changed

Lines changed: 194 additions & 4 deletions

File tree

.stats.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 127
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-0c99f133dc7e81a8e74e829299f4a7bfdd9f4fadc40e69a9a10c81ab28318f7a.yml
3-
openapi_spec_hash: 6e7e04300dc9554b2d1cf4284ee46504
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/kernel/kernel-5b9eb5cdadbc7a5f404f5c2cec40f726e5fece54bf8e2dd29ab5c7700eb44f0e.yml
3+
openapi_spec_hash: 63dd0798a4c0ed6477af50fff397f5dc
44
config_hash: 77ee715aa17061166f9a02b264a21b8d

src/resources/auth/connections.ts

Lines changed: 192 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,12 @@ export interface ManagedAuth {
352352
| 'requires_sms_code'
353353
| 'requires_email_code';
354354

355+
/**
356+
* Canonical choices awaiting selection. Prefer this over pending_sso_buttons,
357+
* mfa_options, and sign_in_options when present.
358+
*/
359+
choices?: Array<ManagedAuth.Choice> | null;
360+
355361
/**
356362
* Reference to credentials for the auth connection. Use one of:
357363
*
@@ -383,6 +389,12 @@ export interface ManagedAuth {
383389
*/
384390
external_action_message?: string | null;
385391

392+
/**
393+
* Canonical fields awaiting input. Prefer this over discovered_fields when
394+
* present.
395+
*/
396+
fields?: Array<ManagedAuth.Field> | null;
397+
386398
/**
387399
* When the current flow expires (null when no flow in progress). A flow past this
388400
* timestamp is no longer valid and its `flow_status` will be `EXPIRED`. Clients
@@ -503,6 +515,43 @@ export interface ManagedAuth {
503515
}
504516

505517
export namespace ManagedAuth {
518+
/**
519+
* Canonical auth-flow choice awaiting user selection.
520+
*/
521+
export interface Choice {
522+
/**
523+
* Stable choice identifier for canonical submit.
524+
*/
525+
id: string;
526+
527+
/**
528+
* Human-readable choice label.
529+
*/
530+
label: string;
531+
532+
/**
533+
* Choice type.
534+
*/
535+
type:
536+
| 'mfa_method'
537+
| 'sso_provider'
538+
| 'sign_in_method'
539+
| 'auth_method'
540+
| 'identifier_method'
541+
| 'account'
542+
| 'other';
543+
544+
/**
545+
* Additional context for the choice.
546+
*/
547+
description?: string | null;
548+
549+
/**
550+
* Selector for the visible choice, when available.
551+
*/
552+
observed_selector?: string | null;
553+
}
554+
506555
/**
507556
* Reference to credentials for the auth connection. Use one of:
508557
*
@@ -579,6 +628,41 @@ export namespace ManagedAuth {
579628
required?: boolean;
580629
}
581630

631+
/**
632+
* Canonical field awaiting user input.
633+
*/
634+
export interface Field {
635+
/**
636+
* Stable field identifier for canonical submit.
637+
*/
638+
id: string;
639+
640+
/**
641+
* Credential reference name to store the submitted value under.
642+
*/
643+
ref: string;
644+
645+
/**
646+
* Managed-auth field type.
647+
*/
648+
type: 'identifier' | 'password' | 'code' | 'totp_code' | 'totp_secret' | 'text';
649+
650+
/**
651+
* Human-readable label shown to the user.
652+
*/
653+
label?: string;
654+
655+
/**
656+
* Selector for the visible field, when available.
657+
*/
658+
observed_selector?: string | null;
659+
660+
/**
661+
* Whether this field is required.
662+
*/
663+
required?: boolean;
664+
}
665+
582666
/**
583667
* An MFA method option for verification
584668
*/
@@ -989,10 +1073,17 @@ export namespace ManagedAuthUpdateRequest {
9891073

9901074
/**
9911075
* Request to submit field values, click an SSO button, select an MFA method, or
992-
* select a sign-in option. Provide exactly one of fields, sso_button_selector,
993-
* sso_provider, mfa_option_id, or sign_in_option_id.
1076+
* select a sign-in option. Prefer canonical selected_choice_id/field_values when
1077+
* the API returns fields/choices; legacy
1078+
* fields/sso_button_selector/sso_provider/mfa_option_id/sign_in_option_id remain
1079+
* supported during deprecation.
9941080
*/
9951081
export interface SubmitFieldsRequest {
1082+
/**
1083+
* Canonical map of field ID to submitted value.
1084+
*/
1085+
field_values?: { [key: string]: string };
1086+
9961087
/**
9971088
* Map of field name to value
9981089
*/
@@ -1003,6 +1094,11 @@ export interface SubmitFieldsRequest {
10031094
*/
10041095
mfa_option_id?: string;
10051096

1097+
/**
1098+
* Canonical choice ID selected by the user.
1099+
*/
1100+
selected_choice_id?: string;
1101+
10061102
/**
10071103
* The sign-in option ID to select (when sign_in_options were returned)
10081104
*/
@@ -1064,6 +1160,12 @@ export namespace ConnectionFollowResponse {
10641160
*/
10651161
timestamp: string;
10661162

1163+
/**
1164+
* Canonical choices awaiting selection. Prefer this over pending_sso_buttons,
1165+
* mfa_options, and sign_in_options when present.
1166+
*/
1167+
choices?: Array<ManagedAuthStateEvent.Choice>;
1168+
10671169
/**
10681170
* Fields awaiting input (present when flow_step=AWAITING_INPUT; may also be
10691171
* present with AWAITING_EXTERNAL_ACTION as fallback actions).
@@ -1086,6 +1188,12 @@ export namespace ConnectionFollowResponse {
10861188
*/
10871189
external_action_message?: string;
10881190

1191+
/**
1192+
* Canonical fields awaiting input. Prefer this over discovered_fields when
1193+
* present.
1194+
*/
1195+
fields?: Array<ManagedAuthStateEvent.Field>;
1196+
10891197
/**
10901198
* Type of the current flow.
10911199
*/
@@ -1133,6 +1241,43 @@ export namespace ConnectionFollowResponse {
11331241
}
11341242

11351243
export namespace ManagedAuthStateEvent {
1244+
/**
1245+
* Canonical auth-flow choice awaiting user selection.
1246+
*/
1247+
export interface Choice {
1248+
/**
1249+
* Stable choice identifier for canonical submit.
1250+
*/
1251+
id: string;
1252+
1253+
/**
1254+
* Human-readable choice label.
1255+
*/
1256+
label: string;
1257+
1258+
/**
1259+
* Choice type.
1260+
*/
1261+
type:
1262+
| 'mfa_method'
1263+
| 'sso_provider'
1264+
| 'sign_in_method'
1265+
| 'auth_method'
1266+
| 'identifier_method'
1267+
| 'account'
1268+
| 'other';
1269+
1270+
/**
1271+
* Additional context for the choice.
1272+
*/
1273+
description?: string | null;
1274+
1275+
/**
1276+
* Selector for the visible choice, when available.
1277+
*/
1278+
observed_selector?: string | null;
1279+
}
1280+
11361281
/**
11371282
* A discovered form field
11381283
*/
@@ -1180,6 +1325,41 @@ export namespace ConnectionFollowResponse {
11801325
required?: boolean;
11811326
}
11821327

1328+
/**
1329+
* Canonical field awaiting user input.
1330+
*/
1331+
export interface Field {
1332+
/**
1333+
* Stable field identifier for canonical submit.
1334+
*/
1335+
id: string;
1336+
1337+
/**
1338+
* Credential reference name to store the submitted value under.
1339+
*/
1340+
ref: string;
1341+
1342+
/**
1343+
* Managed-auth field type.
1344+
*/
1345+
type: 'identifier' | 'password' | 'code' | 'totp_code' | 'totp_secret' | 'text';
1346+
1347+
/**
1348+
* Human-readable label shown to the user.
1349+
*/
1350+
label?: string;
1351+
1352+
/**
1353+
* Selector for the visible field, when available.
1354+
*/
1355+
observed_selector?: string | null;
1356+
1357+
/**
1358+
* Whether this field is required.
1359+
*/
1360+
required?: boolean;
1361+
}
1362+
11831363
/**
11841364
* An MFA method option for verification
11851365
*/
@@ -1562,6 +1742,11 @@ export namespace ConnectionLoginParams {
15621742
}
15631743

15641744
export interface ConnectionSubmitParams {
1745+
/**
1746+
* Canonical map of field ID to submitted value.
1747+
*/
1748+
field_values?: { [key: string]: string };
1749+
15651750
/**
15661751
* Map of field name to value
15671752
*/
@@ -1572,6 +1757,11 @@ export interface ConnectionSubmitParams {
15721757
*/
15731758
mfa_option_id?: string;
15741759

1760+
/**
1761+
* Canonical choice ID selected by the user.
1762+
*/
1763+
selected_choice_id?: string;
1764+
15751765
/**
15761766
* The sign-in option ID to select (when sign_in_options were returned)
15771767
*/

0 commit comments

Comments
 (0)