@@ -3,6 +3,7 @@ import type { McpServerElicitationRequestParams } from '../../app-server/v2';
33import { createCodexMockTestFixture , createTestSessionState , type CodexMockTestFixture } from '../acp-test-utils' ;
44import type { SessionState } from '../../CodexAcpServer' ;
55import { AgentMode } from "../../AgentMode" ;
6+ import { McpApprovalOptionId } from "../../McpApprovalOptionId" ;
67import type { ServerNotification } from "../../app-server" ;
78
89describe ( 'Elicitation Events' , ( ) => {
@@ -132,7 +133,7 @@ describe('Elicitation Events', () => {
132133 describe ( 'MCP tool call approval elicitation' , ( ) => {
133134 it ( 'should show Allow/session/always/Decline options when all persist values advertised' , async ( ) => {
134135 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
135- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_once' } } ) ;
136+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowOnce } } ) ;
136137
137138 const params : McpServerElicitationRequestParams = {
138139 threadId : sessionId , turnId : 'turn-1' , serverName : 'tool-server' ,
@@ -151,7 +152,7 @@ describe('Elicitation Events', () => {
151152
152153 it ( 'should map allow_once to accept with null meta' , async ( ) => {
153154 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
154- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_once' } } ) ;
155+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowOnce } } ) ;
155156
156157 const params : McpServerElicitationRequestParams = {
157158 threadId : sessionId , turnId : 'turn-1' , serverName : 'tool-server' ,
@@ -170,7 +171,7 @@ describe('Elicitation Events', () => {
170171
171172 it ( 'should map allow_session to accept with persist:session meta' , async ( ) => {
172173 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
173- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_session' } } ) ;
174+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowSession } } ) ;
174175
175176 const params : McpServerElicitationRequestParams = {
176177 threadId : sessionId , turnId : 'turn-1' , serverName : 'tool-server' ,
@@ -189,7 +190,7 @@ describe('Elicitation Events', () => {
189190
190191 it ( 'should map allow_always to accept with persist:always meta' , async ( ) => {
191192 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
192- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_always' } } ) ;
193+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowAlways } } ) ;
193194
194195 const params : McpServerElicitationRequestParams = {
195196 threadId : sessionId , turnId : 'turn-1' , serverName : 'tool-server' ,
@@ -208,7 +209,7 @@ describe('Elicitation Events', () => {
208209
209210 it ( 'should only show session option when persist is "session"' , async ( ) => {
210211 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
211- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_once' } } ) ;
212+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowOnce } } ) ;
212213
213214 const params : McpServerElicitationRequestParams = {
214215 threadId : sessionId , turnId : 'turn-1' , serverName : 'tool-server' ,
@@ -227,7 +228,7 @@ describe('Elicitation Events', () => {
227228
228229 it ( 'should show only Allow and Decline when no persist options' , async ( ) => {
229230 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
230- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_once' } } ) ;
231+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowOnce } } ) ;
231232
232233 const params : McpServerElicitationRequestParams = {
233234 threadId : sessionId , turnId : 'turn-1' , serverName : 'tool-server' ,
@@ -246,7 +247,7 @@ describe('Elicitation Events', () => {
246247
247248 it ( 'should not reuse a completed auto-approved call id for a later approval request' , async ( ) => {
248249 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
249- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_once' } } ) ;
250+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowOnce } } ) ;
250251
251252 const startedNotification : ServerNotification = {
252253 method : 'item/started' ,
@@ -309,7 +310,7 @@ describe('Elicitation Events', () => {
309310
310311 it ( 'should not reuse a stale call id after serverRequest/resolved clears interrupted approval state' , async ( ) => {
311312 const { promptPromise, completeTurn } = setupSessionWithPendingPrompt ( ) ;
312- fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : 'allow_once' } } ) ;
313+ fixture . setPermissionResponse ( { outcome : { outcome : 'selected' , optionId : McpApprovalOptionId . AllowOnce } } ) ;
313314
314315 const startedNotification : ServerNotification = {
315316 method : 'item/started' ,
0 commit comments