@@ -2,7 +2,7 @@ import type * as acp from "@agentclientprotocol/sdk";
22import type { AvailableCommand } from "@agentclientprotocol/sdk" ;
33import { ACPSessionConnection , type AcpClientConnection } from "./ACPSessionConnection" ;
44import type { CodexAcpClient } from "./CodexAcpClient" ;
5- import type { RateLimitSnapshot , ReviewTarget , SkillsListEntry , TurnCompletedNotification } from "./app-server/v2" ;
5+ import type { RateLimitSnapshot , ReviewTarget , SkillsListEntry , SkillsListParams , TurnCompletedNotification } from "./app-server/v2" ;
66import type { SessionState } from "./CodexAcpServer" ;
77import type { RateLimitsMap } from "./RateLimitsMap" ;
88import type { TokenCount } from "./TokenCount" ;
@@ -41,24 +41,30 @@ export class CodexCommands {
4141 this . onLogout = onLogout ;
4242 }
4343
44- async publish ( sessionId : string ) : Promise < void > {
44+ async publish ( sessionState : SessionState ) : Promise < void > {
4545 try {
46- const skillsResponse = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( ) ) ;
46+ const skillsResponse = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( this . createSkillsListParams ( sessionState ) ) ) ;
4747 const availableCommands = this . buildAvailableCommands ( skillsResponse ?. data ?? [ ] ) ;
4848 if ( availableCommands . length === 0 ) {
4949 return ;
5050 }
5151
52- const session = new ACPSessionConnection ( this . connection , sessionId ) ;
52+ const session = new ACPSessionConnection ( this . connection , sessionState . sessionId ) ;
5353 await session . update ( {
5454 sessionUpdate : "available_commands_update" ,
5555 availableCommands
5656 } ) ;
5757 } catch ( err ) {
58- logger . error ( `Failed to publish available commands for session ${ sessionId } ` , err ) ;
58+ logger . error ( `Failed to publish available commands for session ${ sessionState . sessionId } ` , err ) ;
5959 }
6060 }
6161
62+ private createSkillsListParams ( sessionState : SessionState ) : SkillsListParams {
63+ return {
64+ cwds : [ sessionState . cwd , ...sessionState . additionalDirectories ] ,
65+ } ;
66+ }
67+
6268 private buildAvailableCommands ( skillsEntries : SkillsListEntry [ ] ) : AvailableCommand [ ] {
6369 const commands = new Map < string , AvailableCommand > ( ) ;
6470
@@ -212,7 +218,7 @@ export class CodexCommands {
212218 return { handled : true } ;
213219 }
214220 case "skills" : {
215- const response = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( ) ) ;
221+ const response = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( this . createSkillsListParams ( sessionState ) ) ) ;
216222 const skills = ( response ?. data ?? [ ] ) . flatMap ( entry => entry . skills ) ;
217223 const lines = skills . map ( skill => {
218224 const description = skill . shortDescription ?? skill . description ?? "" ;
0 commit comments