@@ -21,7 +21,7 @@ extension MirroirMCP {
2121 (1) action= " start " \u{2014} launch app + OCR. \
2222 (2) Navigate with tap/swipe/type_text, then action= " capture " per screen. \
2323 (3) action= " finish " \u{2014} emit SKILL.md. \
24- Use action= " explore " for autonomous BFS exploration . \
24+ Use action= " explore " for autonomous exploration ( BFS default, or DFS) . \
2525 Set fresh=true to discard persisted graph and explore from scratch. \
2626 WARNING: Exploration steals Mac keyboard focus (global HID events). \
2727 SECURITY: May navigate into sensitive screens. Do not run unattended.
@@ -35,7 +35,7 @@ extension MirroirMCP {
3535 " Session action: \" start \" to launch app and begin, " +
3636 " \" capture \" to OCR current screen and append, " +
3737 " \" finish \" to generate SKILL.md from all captures, " +
38- " \" explore \" for autonomous BFS exploration . " ) ,
38+ " \" explore \" for autonomous exploration ( BFS or DFS) . " ) ,
3939 " enum " : . array( [
4040 . string( " start " ) ,
4141 . string( " capture " ) ,
@@ -121,6 +121,16 @@ extension MirroirMCP {
121121 " Full-page scrolling still runs to discover below-fold elements. " +
122122 " Useful with vision describers that produce clean semantic elements. Default: false. " ) ,
123123 ] ) ,
124+ " explorer " : . object( [
125+ " type " : . string( " string " ) ,
126+ " description " : . string(
127+ " Exploration algorithm: \" bfs \" (breadth-first, default) " +
128+ " or \" dfs \" (depth-first). " ) ,
129+ " enum " : . array( [
130+ . string( " bfs " ) ,
131+ . string( " dfs " ) ,
132+ ] ) ,
133+ ] ) ,
124134 ] ) ,
125135 " required " : . array( [ . string( " action " ) ] ) ,
126136 ] ,
@@ -402,6 +412,7 @@ extension MirroirMCP {
402412 let fresh = args [ " fresh " ] ? . asBool ( ) ?? false
403413 let seed = args [ " seed " ] ? . asInt ( ) . map { UInt64 ( $0) }
404414 let skipCalibration = args [ " skip_calibration " ] ? . asBool ( ) ?? false
415+ let explorerChoice = args [ " explorer " ] ? . asString ( ) ?? " bfs "
405416 let explicitStrategy = args [ " strategy " ] ? . asString ( )
406417 let strategyChoice = StrategyDetector . detect (
407418 targetType: ctx. targetType,
@@ -427,30 +438,37 @@ extension MirroirMCP {
427438 screenshotBase64: firstResult. screenshotBase64
428439 )
429440
430- // Create BFS explorer and run exploration loop
441+ // Create explorer ( BFS or DFS) and run exploration loop
431442 let windowSize = ctx. bridge. getWindowInfo ( ) ? . size ?? CGSize ( width: 410 , height: 890 )
432- let componentDefinitions = ComponentLoader . loadAll ( )
433- let detectionMode = ComponentDetectionMode ( rawValue: EnvConfig . componentDetection) ?? . llmFirstScreen
434- let classifier = detectionMode. buildClassifier ( server: server)
435- let advisor : any ExplorationAdvising = EmbacleFFI . isAvailable
436- ? VisionExplorationAdvisor ( ) : HeuristicExplorationAdvisor ( )
437- let explorer = BFSExplorer (
438- session: session, budget: budget, windowSize: windowSize,
439- componentDefinitions: componentDefinitions,
440- classifier: classifier,
441- bridge: ctx. bridge,
442- seed: seed,
443- skipCalibration: skipCalibration,
444- advisor: advisor
445- )
443+ let explorer : any Exploring
444+ if explorerChoice == " dfs " {
445+ explorer = DFSExplorer (
446+ session: session, budget: budget, windowSize: windowSize
447+ )
448+ } else {
449+ let componentDefinitions = ComponentLoader . loadAll ( )
450+ let detectionMode = ComponentDetectionMode ( rawValue: EnvConfig . componentDetection) ?? . llmFirstScreen
451+ let classifier = detectionMode. buildClassifier ( server: server)
452+ let advisor : any ExplorationAdvising = EmbacleFFI . isAvailable
453+ ? VisionExplorationAdvisor ( ) : HeuristicExplorationAdvisor ( )
454+ explorer = BFSExplorer (
455+ session: session, budget: budget, windowSize: windowSize,
456+ componentDefinitions: componentDefinitions,
457+ classifier: classifier,
458+ bridge: ctx. bridge,
459+ seed: seed,
460+ skipCalibration: skipCalibration,
461+ advisor: advisor
462+ )
463+ }
446464 explorer. markStarted ( )
447465
448466 var stepResults : [ String ] = [
449- " Autonomous exploration started for ' \( appName) '. " ,
467+ " Autonomous \( explorerChoice . uppercased ( ) ) exploration started for '\( appName) '. " ,
450468 " Budget: depth= \( maxDepth) , screens= \( maxScreens) , time= \( maxTime) s " ,
451469 ]
452470
453- // Run BFS loop using detected strategy
471+ // Run exploration loop using detected strategy
454472 while !explorer. completed {
455473 let result : ExploreStepResult
456474 switch strategyChoice {
0 commit comments