@@ -15,7 +15,7 @@ import { HELP_TEXT } from '../../constants';
1515import { useListNavigation , useMultiSelectNavigation } from '../../hooks' ;
1616import { generateUniqueName } from '../../utils' ;
1717import type { AddGatewayConfig } from './types' ;
18- import { AUTHORIZER_TYPE_OPTIONS , GATEWAY_STEP_LABELS } from './types' ;
18+ import { AUTHORIZER_TYPE_OPTIONS , GATEWAY_STEP_LABELS , SEMANTIC_SEARCH_ITEM_ID } from './types' ;
1919import { useAddGatewayWizard } from './useAddGatewayWizard' ;
2020import { Box , Text } from 'ink' ;
2121import React , { useMemo , useState } from 'react' ;
@@ -27,6 +27,8 @@ interface AddGatewayScreenProps {
2727 unassignedTargets : string [ ] ;
2828}
2929
30+ const INITIAL_ADVANCED_SELECTED = [ SEMANTIC_SEARCH_ITEM_ID ] ;
31+
3032export function AddGatewayScreen ( { onComplete, onExit, existingGateways, unassignedTargets } : AddGatewayScreenProps ) {
3133 const wizard = useAddGatewayWizard ( unassignedTargets . length ) ;
3234
@@ -48,10 +50,16 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
4850 [ ]
4951 ) ;
5052
53+ const advancedConfigItems : SelectableItem [ ] = useMemo (
54+ ( ) => [ { id : SEMANTIC_SEARCH_ITEM_ID , title : 'Semantic Search' } ] ,
55+ [ ]
56+ ) ;
57+
5158 const isNameStep = wizard . step === 'name' ;
5259 const isAuthorizerStep = wizard . step === 'authorizer' ;
5360 const isJwtConfigStep = wizard . step === 'jwt-config' ;
5461 const isIncludeTargetsStep = wizard . step === 'include-targets' ;
62+ const isAdvancedConfigStep = wizard . step === 'advanced-config' ;
5563 const isConfirmStep = wizard . step === 'confirm' ;
5664
5765 const authorizerNav = useListNavigation ( {
@@ -70,6 +78,17 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
7078 requireSelection : false ,
7179 } ) ;
7280
81+ const advancedNav = useMultiSelectNavigation ( {
82+ items : advancedConfigItems ,
83+ getId : item => item . id ,
84+ initialSelectedIds : INITIAL_ADVANCED_SELECTED ,
85+ onConfirm : selectedIds =>
86+ wizard . setAdvancedConfig ( { enableSemanticSearch : selectedIds . includes ( SEMANTIC_SEARCH_ITEM_ID ) } ) ,
87+ onExit : ( ) => wizard . goBack ( ) ,
88+ isActive : isAdvancedConfigStep ,
89+ requireSelection : false ,
90+ } ) ;
91+
7392 useListNavigation ( {
7493 items : [ { id : 'confirm' , title : 'Confirm' } ] ,
7594 onSelect : ( ) => onComplete ( wizard . config ) ,
@@ -136,13 +155,14 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
136155 }
137156 } ;
138157
139- const helpText = isIncludeTargetsStep
140- ? 'Space toggle · Enter confirm · Esc back'
141- : isConfirmStep
142- ? HELP_TEXT . CONFIRM_CANCEL
143- : isAuthorizerStep
144- ? HELP_TEXT . NAVIGATE_SELECT
145- : HELP_TEXT . TEXT_INPUT ;
158+ const helpText =
159+ isIncludeTargetsStep || isAdvancedConfigStep
160+ ? 'Space toggle · Enter confirm · Esc back'
161+ : isConfirmStep
162+ ? HELP_TEXT . CONFIRM_CANCEL
163+ : isAuthorizerStep
164+ ? HELP_TEXT . NAVIGATE_SELECT
165+ : HELP_TEXT . TEXT_INPUT ;
146166
147167 const headerContent = < StepIndicator steps = { wizard . steps } currentStep = { wizard . step } labels = { GATEWAY_STEP_LABELS } /> ;
148168
@@ -202,6 +222,30 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
202222 < Text dimColor > No unassigned targets available. Press Enter to continue.</ Text >
203223 ) ) }
204224
225+ { isAdvancedConfigStep && (
226+ < Box flexDirection = "column" >
227+ < Text bold > Advanced Configuration</ Text >
228+ < Text dimColor > Toggle options with Space, press Enter to continue</ Text >
229+ < Box marginTop = { 1 } flexDirection = "column" >
230+ { advancedConfigItems . map ( ( item , idx ) => {
231+ const isCursor = idx === advancedNav . cursorIndex ;
232+ const isChecked = advancedNav . selectedIds . has ( item . id ) ;
233+ const checkbox = isChecked ? '[✓]' : '[ ]' ;
234+ return (
235+ < Box key = { item . id } >
236+ < Text wrap = "truncate" >
237+ < Text color = { isCursor ? 'cyan' : undefined } > { isCursor ? '❯' : ' ' } </ Text >
238+ < Text color = { isChecked ? 'green' : undefined } > { checkbox } </ Text >
239+ < Text color = { isCursor ? 'cyan' : undefined } > { item . title } </ Text >
240+ </ Text >
241+ < Text dimColor > { isChecked ? 'Enabled' : 'Disabled' } </ Text >
242+ </ Box >
243+ ) ;
244+ } ) }
245+ </ Box >
246+ </ Box >
247+ ) }
248+
205249 { isConfirmStep && (
206250 < ConfirmReview
207251 fields = { [
@@ -228,6 +272,7 @@ export function AddGatewayScreen({ onComplete, onExit, existingGateways, unassig
228272 ? wizard . config . selectedTargets . join ( ', ' )
229273 : '(none)' ,
230274 } ,
275+ { label : 'Semantic Search' , value : wizard . config . enableSemanticSearch ? 'Enabled' : 'Disabled' } ,
231276 ] }
232277 />
233278 ) }
0 commit comments