@@ -46,6 +46,7 @@ export interface AppStore {
4646 threadMessagesLoading : Record < string , boolean > ;
4747 projectGitStatus : Record < string , "none" | "git" | "github" > ;
4848 projectPrMap : Record < string , Record < string , number > > ;
49+ activeModel : string | null ;
4950}
5051
5152function createAppStore ( ) {
@@ -85,6 +86,7 @@ function createAppStore() {
8586 threadMessagesLoading : { } ,
8687 projectGitStatus : { } ,
8788 projectPrMap : { } ,
89+ activeModel : null ,
8890 } ) ;
8991
9092 async function loadData ( ) {
@@ -228,11 +230,36 @@ function createAppStore() {
228230 } ) ;
229231 }
230232
233+ /** Map slash commands to natural language prompts the agent can act on. */
234+ function resolveSlashCommand ( input : string ) : string {
235+ if ( ! input . startsWith ( "/" ) ) return input ;
236+ const cmdName = input . split ( " " ) [ 0 ] ;
237+ const cmdArgs = input . slice ( cmdName . length ) . trim ( ) ;
238+ const mappings : Record < string , string > = {
239+ "/commit" : "Create a git commit with a descriptive message for the current changes" ,
240+ "/review-pr" : "Review the current pull request" ,
241+ "/compact" : "Summarize the conversation so far" ,
242+ "/help" : "Show what you can help with" ,
243+ "/fix" : "Fix the issues in the current code" ,
244+ "/test" : "Run the tests and fix any failures" ,
245+ "/lint" : "Run the linter and fix any issues" ,
246+ "/refactor" : "Refactor the current code for better readability and maintainability" ,
247+ } ;
248+ const mapped = mappings [ cmdName ] ;
249+ if ( mapped ) {
250+ return cmdArgs ? `${ mapped } : ${ cmdArgs } ` : mapped ;
251+ }
252+ return input ;
253+ }
254+
231255 async function sendUserMessage ( ) {
232- const text = store . composerText . trim ( ) ;
256+ let text = store . composerText . trim ( ) ;
233257 const atts = [ ...store . attachments ] ;
234258 if ( ( ! text && atts . length === 0 ) || ! store . activeTab ) return ;
235259
260+ // Resolve slash commands to natural language prompts
261+ text = resolveSlashCommand ( text ) ;
262+
236263 const threadId = store . activeTab ;
237264 setStore ( "composerText" , "" ) ;
238265 setStore ( "attachments" , [ ] ) ;
@@ -564,6 +591,10 @@ function createAppStore() {
564591 if ( store . sessionStatuses [ thread_id ] !== "generating" ) {
565592 setStore ( "sessionStatuses" , thread_id , "ready" ) ;
566593 }
594+ // Capture the confirmed model from the SDK
595+ if ( payload . model ) {
596+ setStore ( "activeModel" , payload . model ) ;
597+ }
567598 break ;
568599 case "session_error" : {
569600 setStore ( "sessionStatuses" , thread_id , "error" ) ;
0 commit comments