@@ -19,6 +19,8 @@ import type {
1919 // The aggregate union; must still resolve via the package root.
2020 SessionEvent ,
2121 PermissionRequest ,
22+ PermissionRequestedData ,
23+ PermissionRequestedEvent ,
2224
2325 // *Data payload types from the v0.3.0 generated session-event schema.
2426 AssistantMessageData ,
@@ -81,6 +83,11 @@ type _AssistantMessageEventStaysAlignedWithSessionEventUnion = _AssertEqual<
8183 Extract < SessionEvent , { type : "assistant.message" } >
8284> ;
8385const _assistantMessageEventAlignmentCheck : _AssistantMessageEventStaysAlignedWithSessionEventUnion = true ;
86+ type _PermissionRequestedEventStaysAlignedWithSessionEventUnion = _AssertEqual <
87+ PermissionRequestedEvent ,
88+ Extract < SessionEvent , { type : "permission.requested" } >
89+ > ;
90+ const _permissionRequestedEventAlignmentCheck : _PermissionRequestedEventStaysAlignedWithSessionEventUnion = true ;
8491
8592describe ( "Session event type exports (#1156)" , ( ) => {
8693 it ( "exposes the headline ToolExecutionStartData type with a usable shape" , ( ) => {
@@ -115,6 +122,32 @@ describe("Session event type exports (#1156)", () => {
115122 expect ( request . managedApprovalRequired ) . toBe ( true ) ;
116123 } ) ;
117124
125+ it ( "exposes managed approval metadata through permission event types" , ( ) => {
126+ const data : PermissionRequestedData = {
127+ permissionRequest : {
128+ kind : "url" ,
129+ url : "https://api.example.com/data" ,
130+ intention : "Fetch domain data" ,
131+ managedApprovalRequired : true ,
132+ } ,
133+ requestId : "permission-1" ,
134+ } ;
135+ const event : SessionEvent = {
136+ id : "evt-permission-1" ,
137+ parentId : null ,
138+ timestamp : "2026-01-01T00:00:00.000Z" ,
139+ type : "permission.requested" ,
140+ data,
141+ } ;
142+
143+ if ( event . type !== "permission.requested" ) {
144+ throw new Error ( "expected permission.requested narrowing" ) ;
145+ }
146+
147+ const permissionEvent : PermissionRequestedEvent = event ;
148+ expect ( permissionEvent . data . permissionRequest . managedApprovalRequired ) . toBe ( true ) ;
149+ } ) ;
150+
118151 it ( "wraps ToolExecutionStartData inside the exported ToolExecutionStartEvent" , ( ) => {
119152 const event : ToolExecutionStartEvent = {
120153 id : "evt-1" ,
@@ -172,6 +205,7 @@ describe("Session event type exports (#1156)", () => {
172205 assertImportable < ToolExecutionProgressData > ( ) ;
173206 assertImportable < ToolExecutionStartData > ( ) ;
174207 assertImportable < UserMessageData > ( ) ;
208+ assertImportable < PermissionRequestedData > ( ) ;
175209
176210 assertImportable < AssistantMessageEvent > ( ) ;
177211 assertImportable < ErrorEvent > ( ) ;
@@ -181,6 +215,7 @@ describe("Session event type exports (#1156)", () => {
181215 assertImportable < ToolExecutionCompleteEvent > ( ) ;
182216 assertImportable < ToolExecutionStartEvent > ( ) ;
183217 assertImportable < UserMessageEvent > ( ) ;
218+ assertImportable < PermissionRequestedEvent > ( ) ;
184219
185220 // Supporting auxiliary types referenced by the *Data shapes — these
186221 // must round-trip through the package root too, otherwise consumers
0 commit comments