99
1010import { Client } from '../client/index.js' ;
1111import { InMemoryTransport } from '../inMemory.js' ;
12- import { ElicitRequestParams , ElicitRequestSchema } from '../types.js' ;
12+ import { ElicitRequestFormParams , ElicitRequestSchema } from '../types.js' ;
1313import { AjvJsonSchemaValidator } from '../validation/ajv-provider.js' ;
1414import { CfWorkerJsonSchemaValidator } from '../validation/cfworker-provider.js' ;
1515import { Server } from './index.js' ;
@@ -69,7 +69,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
6969 content : { name : 'John Doe' }
7070 } ) ) ;
7171
72- const result = await server . elicitInput ( {
72+ const result = await server . elicitFormInput ( {
7373 message : 'What is your name?' ,
7474 requestedSchema : {
7575 type : 'object' ,
@@ -92,7 +92,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
9292 content : { age : 42 }
9393 } ) ) ;
9494
95- const result = await server . elicitInput ( {
95+ const result = await server . elicitFormInput ( {
9696 message : 'What is your age?' ,
9797 requestedSchema : {
9898 type : 'object' ,
@@ -115,7 +115,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
115115 content : { agree : true }
116116 } ) ) ;
117117
118- const result = await server . elicitInput ( {
118+ const result = await server . elicitFormInput ( {
119119 message : 'Do you agree?' ,
120120 requestedSchema : {
121121 type : 'object' ,
@@ -149,7 +149,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
149149 content : userData
150150 } ) ) ;
151151
152- const result = await server . elicitInput ( {
152+ const result = await server . elicitFormInput ( {
153153 message : 'Please provide your information' ,
154154 requestedSchema : {
155155 type : 'object' ,
@@ -184,7 +184,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
184184 } ) ) ;
185185
186186 await expect (
187- server . elicitInput ( {
187+ server . elicitFormInput ( {
188188 message : 'Please provide your information' ,
189189 requestedSchema : {
190190 type : 'object' ,
@@ -208,7 +208,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
208208 } ) ) ;
209209
210210 await expect (
211- server . elicitInput ( {
211+ server . elicitFormInput ( {
212212 message : 'Please provide your information' ,
213213 requestedSchema : {
214214 type : 'object' ,
@@ -229,7 +229,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
229229 } ) ) ;
230230
231231 await expect (
232- server . elicitInput ( {
232+ server . elicitFormInput ( {
233233 message : 'What is your name?' ,
234234 requestedSchema : {
235235 type : 'object' ,
@@ -249,7 +249,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
249249 } ) ) ;
250250
251251 await expect (
252- server . elicitInput ( {
252+ server . elicitFormInput ( {
253253 message : 'What is your age?' ,
254254 requestedSchema : {
255255 type : 'object' ,
@@ -269,7 +269,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
269269 } ) ) ;
270270
271271 await expect (
272- server . elicitInput ( {
272+ server . elicitFormInput ( {
273273 message : 'Enter a 5-digit zip code' ,
274274 requestedSchema : {
275275 type : 'object' ,
@@ -288,7 +288,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
288288 action : 'decline'
289289 } ) ) ;
290290
291- const result = await server . elicitInput ( {
291+ const result = await server . elicitFormInput ( {
292292 message : 'Please provide your information' ,
293293 requestedSchema : {
294294 type : 'object' ,
@@ -309,7 +309,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
309309 action : 'cancel'
310310 } ) ) ;
311311
312- const result = await server . elicitInput ( {
312+ const result = await server . elicitFormInput ( {
313313 message : 'Please provide your information' ,
314314 requestedSchema : {
315315 type : 'object' ,
@@ -339,7 +339,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
339339 return { action : 'decline' } ;
340340 } ) ;
341341
342- const nameResult = await server . elicitInput ( {
342+ const nameResult = await server . elicitFormInput ( {
343343 message : 'What is your name?' ,
344344 requestedSchema : {
345345 type : 'object' ,
@@ -348,7 +348,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
348348 }
349349 } ) ;
350350
351- const ageResult = await server . elicitInput ( {
351+ const ageResult = await server . elicitFormInput ( {
352352 message : 'What is your age?' ,
353353 requestedSchema : {
354354 type : 'object' ,
@@ -357,7 +357,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
357357 }
358358 } ) ;
359359
360- const cityResult = await server . elicitInput ( {
360+ const cityResult = await server . elicitFormInput ( {
361361 message : 'What is your city?' ,
362362 requestedSchema : {
363363 type : 'object' ,
@@ -384,7 +384,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
384384 content : { name : 'John' , nickname : 'Johnny' }
385385 } ) ) ;
386386
387- const result = await server . elicitInput ( {
387+ const result = await server . elicitFormInput ( {
388388 message : 'Enter your name' ,
389389 requestedSchema : {
390390 type : 'object' ,
@@ -408,7 +408,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
408408 content : { name : 'John' }
409409 } ) ) ;
410410
411- const result = await server . elicitInput ( {
411+ const result = await server . elicitFormInput ( {
412412 message : 'Enter your name' ,
413413 requestedSchema : {
414414 type : 'object' ,
@@ -432,7 +432,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
432432 content :
{ email :
'[email protected] ' } 433433 } ) ) ;
434434
435- const result = await server . elicitInput ( {
435+ const result = await server . elicitFormInput ( {
436436 message : 'Enter your email' ,
437437 requestedSchema : {
438438 type : 'object' ,
@@ -469,7 +469,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
469469 }
470470 ) ;
471471
472- const testSchemaProperties : ElicitRequestParams [ 'requestedSchema' ] = {
472+ const testSchemaProperties : ElicitRequestFormParams [ 'requestedSchema' ] = {
473473 type : 'object' ,
474474 properties : {
475475 subscribe : { type : 'boolean' , default : true } ,
@@ -542,7 +542,8 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
542542
543543 // Client returns no values; SDK should apply defaults automatically (and validate)
544544 client . setRequestHandler ( ElicitRequestSchema , request => {
545- expect ( request . params . requestedSchema ) . toEqual ( testSchemaProperties ) ;
545+ expect ( request . params . mode ) . toEqual ( 'form' ) ;
546+ expect ( ( request . params as ElicitRequestFormParams ) . requestedSchema ) . toEqual ( testSchemaProperties ) ;
546547 return {
547548 action : 'accept' ,
548549 content : { }
@@ -552,7 +553,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
552553 const [ clientTransport , serverTransport ] = InMemoryTransport . createLinkedPair ( ) ;
553554 await Promise . all ( [ client . connect ( clientTransport ) , server . connect ( serverTransport ) ] ) ;
554555
555- const result = await server . elicitInput ( {
556+ const result = await server . elicitFormInput ( {
556557 message : 'Provide your preferences' ,
557558 requestedSchema : testSchemaProperties
558559 } ) ;
@@ -581,7 +582,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
581582 } ) ) ;
582583
583584 await expect (
584- server . elicitInput ( {
585+ server . elicitFormInput ( {
585586 message : 'Enter your email' ,
586587 requestedSchema : {
587588 type : 'object' ,
@@ -607,7 +608,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
607608
608609 // Test with valid response
609610 await expect (
610- server . elicitInput ( {
611+ server . elicitFormInput ( {
611612 message : 'Please provide your information' ,
612613 requestedSchema : {
613614 type : 'object' ,
@@ -642,7 +643,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
642643
643644 // Test with valid response
644645 await expect (
645- server . elicitInput ( {
646+ server . elicitFormInput ( {
646647 message : 'Please provide your information' ,
647648 requestedSchema : {
648649 type : 'object' ,
@@ -681,7 +682,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
681682
682683 // Test with valid response
683684 await expect (
684- server . elicitInput ( {
685+ server . elicitFormInput ( {
685686 message : 'Please provide your information' ,
686687 requestedSchema : {
687688 type : 'object' ,
@@ -719,7 +720,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
719720
720721 // Test with valid response
721722 await expect (
722- server . elicitInput ( {
723+ server . elicitFormInput ( {
723724 message : 'Please provide your information' ,
724725 requestedSchema : {
725726 type : 'object' ,
@@ -758,7 +759,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
758759
759760 // Test with valid response
760761 await expect (
761- server . elicitInput ( {
762+ server . elicitFormInput ( {
762763 message : 'Please provide your information' ,
763764 requestedSchema : {
764765 type : 'object' ,
@@ -802,7 +803,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
802803
803804 // Test with valid response
804805 await expect (
805- server . elicitInput ( {
806+ server . elicitFormInput ( {
806807 message : 'Please provide your information' ,
807808 requestedSchema : {
808809 type : 'object' ,
@@ -832,7 +833,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
832833
833834 // Test with valid response
834835 await expect (
835- server . elicitInput ( {
836+ server . elicitFormInput ( {
836837 message : 'Please provide your information' ,
837838 requestedSchema : {
838839 type : 'object' ,
@@ -866,7 +867,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
866867
867868 // Test with valid response
868869 await expect (
869- server . elicitInput ( {
870+ server . elicitFormInput ( {
870871 message : 'Please provide your information' ,
871872 requestedSchema : {
872873 type : 'object' ,
@@ -899,7 +900,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
899900
900901 // Test with valid response
901902 await expect (
902- server . elicitInput ( {
903+ server . elicitFormInput ( {
903904 message : 'Please provide your information' ,
904905 requestedSchema : {
905906 type : 'object' ,
@@ -933,7 +934,7 @@ function testElicitationFlow(validatorProvider: typeof ajvProvider | typeof cfWo
933934
934935 // Test with valid response
935936 await expect (
936- server . elicitInput ( {
937+ server . elicitFormInput ( {
937938 message : 'Please provide your information' ,
938939 requestedSchema : {
939940 type : 'object' ,
0 commit comments