@@ -386,30 +386,23 @@ const approval = (turnId: string) => ({
386386vi . mock ( "node:fs/promises" , { spy : true } ) ;
387387
388388describe ( "MuseAdapterV2" , ( ) => {
389- const afterFirstTurn = Effect . fnUntraced ( function * (
390- fake : Effect . Success < ReturnType < typeof makeFakeMuse > > ,
391- text : string ,
392- ) {
393- const harness = yield * makeHarness ( fake ) ;
394- const first = yield * startConversation ( harness , fake ) ;
395- yield * fake . emit ( "turn/completed" , { turnId : first . nativeId , terminal : "completed" } ) ;
396- yield * harness . takeEvent ( "turn.terminal" ) ;
397- const base = yield * turnInput ( harness . providerThread , 2 ) ;
398- const input = { ...base , message : { ...base . message , text } } ;
399- yield * harness . runtime . startTurn ( input ) ;
400- return { input, call : yield * fake . takeCall ( "turn/start" ) } ;
401- } ) ;
402-
403389 it . effect ( "invokes only the first live skill with the unchanged request as arguments" , ( ) =>
404390 Effect . gen ( function * ( ) {
405391 const fake = yield * makeFakeMuse ( ) ;
406392 fake . queueResponse ( "skill/list" , {
407393 skills : [ { selector : "architect" } , { selector : "ai-ugc:ugc-mode" } ] ,
408394 } ) ;
409- const { input, call } = yield * afterFirstTurn (
410- fake ,
411- "Please $nope then $ai-ugc:ugc-mode tidy $architect $ai-ugc:ugc-mode" ,
412- ) ;
395+ const harness = yield * makeHarness ( fake ) ;
396+ const base = yield * turnInput ( harness . providerThread ) ;
397+ const input = {
398+ ...base ,
399+ message : {
400+ ...base . message ,
401+ text : "Please $nope then $ai-ugc:ugc-mode tidy $architect $ai-ugc:ugc-mode" ,
402+ } ,
403+ } ;
404+ yield * harness . runtime . startTurn ( input ) ;
405+ const call = yield * fake . takeCall ( "turn/start" ) ;
413406 const parts = call . params . input as Array < {
414407 type : string ;
415408 selector ?: string ;
@@ -427,29 +420,26 @@ describe("MuseAdapterV2", () => {
427420 } ) . pipe ( Effect . scoped , Effect . provide ( testLayer ) ) ,
428421 ) ;
429422
430- it . effect ( "keeps first-turn, plain and unavailable skill requests as text" , ( ) =>
423+ it . effect ( "keeps plain and unavailable skill requests as text" , ( ) =>
431424 Effect . gen ( function * ( ) {
432- for ( const [ text , response , firstTurn ] of [
433- [ "$git tidy" , { skills : [ { selector : "git" } ] } , true ] ,
434- [ "Tidy the changes" , { skills : [ { selector : "git" } ] } , false ] ,
435- [ "$git tidy $nope" , { skills : [ { selector : "architect" } ] } , false ] ,
436- [ "$git tidy $nope" , new Error ( "listing failed" ) , false ] ,
425+ for ( const [ text , response ] of [
426+ [ "Tidy the changes" , { skills : [ { selector : "git" } ] } ] ,
427+ [ "$git tidy $nope" , { skills : [ { selector : "architect" } ] } ] ,
428+ [ "$git tidy $nope" , new Error ( "listing failed" ) ] ,
437429 ] as const ) {
438430 const fake = yield * makeFakeMuse ( ) ;
439431 fake . queueResponse ( "skill/list" , response ) ;
440- let call ;
441- if ( firstTurn ) {
442- const harness = yield * makeHarness ( fake ) ;
443- const base = yield * turnInput ( harness . providerThread ) ;
444- yield * harness . runtime . startTurn ( { ...base , message : { ...base . message , text } } ) ;
445- call = yield * fake . takeCall ( "turn/start" ) ;
446- } else call = ( yield * afterFirstTurn ( fake , text ) ) . call ;
432+ const harness = yield * makeHarness ( fake ) ;
433+ const base = yield * turnInput ( harness . providerThread ) ;
434+ const input = { ...base , message : { ...base . message , text } } ;
435+ yield * harness . runtime . startTurn ( input ) ;
436+ const call = yield * fake . takeCall ( "turn/start" ) ;
447437 const parts = call . params . input as Array < { type : string ; text ?: string } > ;
448438 assert . isTrue ( parts . every ( ( part ) => part . type === "text" ) ) ;
449- assert . strictEqual ( parts . at ( - 1 ) ?. text , text ) ;
439+ assert . strictEqual ( parts . at ( - 1 ) ?. text , input . message . text ) ;
450440 assert . strictEqual (
451441 fake . calls . filter ( ( call ) => call . method === "skill/list" ) . length ,
452- text . startsWith ( "$" ) && ! firstTurn ? 1 : 0 ,
442+ text . startsWith ( "$" ) ? 1 : 0 ,
453443 ) ;
454444 }
455445 } ) . pipe ( Effect . scoped , Effect . provide ( testLayer ) ) ,
0 commit comments