@@ -23,6 +23,7 @@ import {
2323 initializeTools ,
2424} from "./tools/index.js" ;
2525import { loadCommandsFromDirectory } from "./commands/loader.js" ;
26+ import { RoutingHintController } from "./routing-hints.js" ;
2627import { hasProjectMarker } from "./utils/files.js" ;
2728
2829function getCommandsDir ( ) : string {
@@ -44,6 +45,9 @@ const plugin: Plugin = async ({ directory }) => {
4445 initializeTools ( projectRoot , config ) ;
4546
4647 const indexer = new Indexer ( projectRoot , config ) ;
48+ const routingHints = config . search . routingHints
49+ ? new RoutingHintController ( ( ) => indexer . getStatus ( ) )
50+ : null ;
4751
4852 const isValidProject = ! config . indexing . requireProjectMarker || hasProjectMarker ( projectRoot ) ;
4953
@@ -81,6 +85,19 @@ const plugin: Plugin = async ({ directory }) => {
8185 remove_knowledge_base,
8286 } ,
8387
88+ async "chat.message" ( input , output ) {
89+ routingHints ?. observeUserMessage ( input . sessionID , output . parts ) ;
90+ } ,
91+
92+ async "experimental.chat.system.transform" ( input , output ) {
93+ const hints = await routingHints ?. getSystemHints ( input . sessionID ) ?? [ ] ;
94+ output . system . push ( ...hints ) ;
95+ } ,
96+
97+ async "tool.execute.after" ( input ) {
98+ routingHints ?. markToolUsed ( input . sessionID , input . tool ) ;
99+ } ,
100+
84101 async config ( cfg ) {
85102 cfg . command = cfg . command ?? { } ;
86103
0 commit comments