@@ -2469,6 +2469,93 @@ describe("tui command handlers", () => {
24692469 expect ( addSystem ) . toHaveBeenNthCalledWith ( 2 , "usage: /think <off|max|default>" ) ;
24702470 } ) ;
24712471
2472+ it . each ( [
2473+ {
2474+ name : "provider-specific binary on" ,
2475+ local : false ,
2476+ levels : [
2477+ { id : "off" , label : "off" } ,
2478+ { id : "high" , label : "on" } ,
2479+ ] ,
2480+ input : "on" ,
2481+ expected : "high" ,
2482+ } ,
2483+ {
2484+ name : "case-insensitive binary on in embedded mode" ,
2485+ local : true ,
2486+ levels : [ { id : "high" , label : "on" } ] ,
2487+ input : "ON" ,
2488+ expected : "high" ,
2489+ } ,
2490+ {
2491+ name : "always-on high profile" ,
2492+ local : false ,
2493+ levels : [ { id : "high" , label : "always on" } ] ,
2494+ input : "always on" ,
2495+ expected : "high" ,
2496+ } ,
2497+ {
2498+ name : "always-on off profile" ,
2499+ local : false ,
2500+ levels : [ { id : "off" , label : "always on" } ] ,
2501+ input : "always on" ,
2502+ expected : "off" ,
2503+ } ,
2504+ {
2505+ name : "Moonshot binary on" ,
2506+ local : false ,
2507+ levels : [ { id : "low" , label : "on" } ] ,
2508+ input : "on" ,
2509+ expected : "low" ,
2510+ } ,
2511+ {
2512+ name : "canonical id ahead of another option's label" ,
2513+ local : false ,
2514+ levels : [
2515+ { id : "low" , label : "high" } ,
2516+ { id : "high" , label : "turbo" } ,
2517+ ] ,
2518+ input : "high" ,
2519+ expected : "high" ,
2520+ } ,
2521+ ] ) (
2522+ "resolves $name to its canonical thinking level" ,
2523+ async ( { local, levels, input, expected } ) => {
2524+ const { handleCommand, patchSession, addSystem } = createHarness ( {
2525+ opts : { local } ,
2526+ sessionInfo : { thinkingLevels : levels } ,
2527+ } ) ;
2528+
2529+ await handleCommand ( `/think ${ input } ` ) ;
2530+
2531+ expect ( patchSession ) . toHaveBeenCalledWith ( {
2532+ key : "agent:main:main" ,
2533+ thinkingLevel : expected ,
2534+ } ) ;
2535+ expect ( addSystem ) . toHaveBeenCalledWith ( `thinking set to ${ input } ` ) ;
2536+ } ,
2537+ ) ;
2538+
2539+ it . each ( [ undefined , [ ] ] ) (
2540+ "resolves thinking labels from the provider policy when session levels are %j" ,
2541+ async ( thinkingLevels ) => {
2542+ const { handleCommand, patchSession } = createHarness ( {
2543+ sessionInfo : {
2544+ modelProvider : "opencode-go" ,
2545+ model : "minimax-m3" ,
2546+ thinkingLevels,
2547+ } ,
2548+ } ) ;
2549+
2550+ await handleCommand ( "/think on" ) ;
2551+
2552+ expect ( patchSession ) . toHaveBeenCalledWith ( {
2553+ key : "agent:main:main" ,
2554+ thinkingLevel : "high" ,
2555+ } ) ;
2556+ } ,
2557+ ) ;
2558+
24722559 it . each ( [
24732560 { command : "verbose" , usage : "usage: /verbose <on|off|full>" } ,
24742561 { command : "reasoning" , usage : "usage: /reasoning <on|off|stream>" } ,
0 commit comments