@@ -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" ;
@@ -42,24 +42,30 @@ export class CodexCommands {
4242 this . onLogout = onLogout ;
4343 }
4444
45- async publish ( sessionId : string ) : Promise < void > {
45+ async publish ( sessionState : SessionState ) : Promise < void > {
4646 try {
47- const skillsResponse = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( ) ) ;
47+ const skillsResponse = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( this . createSkillsListParams ( sessionState ) ) ) ;
4848 const availableCommands = this . buildAvailableCommands ( skillsResponse ?. data ?? [ ] ) ;
4949 if ( availableCommands . length === 0 ) {
5050 return ;
5151 }
5252
53- const session = new ACPSessionConnection ( this . connection , sessionId ) ;
53+ const session = new ACPSessionConnection ( this . connection , sessionState . sessionId ) ;
5454 await session . update ( {
5555 sessionUpdate : "available_commands_update" ,
5656 availableCommands
5757 } ) ;
5858 } catch ( err ) {
59- logger . error ( `Failed to publish available commands for session ${ sessionId } ` , err ) ;
59+ logger . error ( `Failed to publish available commands for session ${ sessionState . sessionId } ` , err ) ;
6060 }
6161 }
6262
63+ private createSkillsListParams ( sessionState : SessionState ) : SkillsListParams {
64+ return {
65+ cwds : [ sessionState . cwd , ...sessionState . additionalDirectories ] ,
66+ } ;
67+ }
68+
6369 private buildAvailableCommands ( skillsEntries : SkillsListEntry [ ] ) : AvailableCommand [ ] {
6470 const commands = new Map < string , AvailableCommand > ( ) ;
6571
@@ -221,7 +227,7 @@ export class CodexCommands {
221227 return { handled : true } ;
222228 }
223229 case "skills" : {
224- const response = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( ) ) ;
230+ const response = await this . runWithProcessCheck ( ( ) => this . codexAcpClient . listSkills ( this . createSkillsListParams ( sessionState ) ) ) ;
225231 const skills = ( response ?. data ?? [ ] ) . flatMap ( entry => entry . skills ) ;
226232 const lines = skills . map ( skill => {
227233 const description = skill . shortDescription ?? skill . description ?? "" ;
0 commit comments