@@ -319,14 +319,17 @@ export function buildCodexInitializeParams(): CodexSchema.V1InitializeParams {
319319 } ;
320320}
321321
322- const probeCodexAppServerProvider = Effect . fn ( "probeCodexAppServerProvider" ) ( function * ( input : {
322+ interface CodexAppServerProbeInput {
323323 readonly binaryPath : string ;
324324 readonly homePath ?: string ;
325325 readonly launchArgs ?: string ;
326326 readonly cwd : string ;
327- readonly customModels ?: ReadonlyArray < string > ;
328327 readonly environment ?: NodeJS . ProcessEnv ;
329- } ) {
328+ }
329+
330+ const openCodexAppServerProbe = Effect . fn ( "openCodexAppServerProbe" ) ( function * (
331+ input : CodexAppServerProbeInput ,
332+ ) {
330333 // `~` is not shell-expanded when env vars are set via `child_process.spawn`,
331334 // so `CODEX_HOME=~/.codex_work` would reach codex verbatim and trip
332335 // "CODEX_HOME points to '~/.codex_work', but that path does not exist".
@@ -369,22 +372,33 @@ const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(fun
369372 Effect . provide ( clientContext ) ,
370373 ) ;
371374
372- const initialize = yield * client . request ( "initialize" , {
373- clientInfo : {
374- name : "t3code_desktop" ,
375- title : "T3 Code Desktop" ,
376- version : "0.1.0" ,
377- } ,
378- capabilities : {
379- experimentalApi : true ,
380- } ,
381- } ) ;
375+ const initialize = yield * client . request ( "initialize" , buildCodexInitializeParams ( ) ) ;
382376 yield * client . notify ( "initialized" , undefined ) ;
383377
384378 // Extract the version string after the first '/' in userAgent, up to the next space or the end
385379 const versionMatch = initialize . userAgent . match ( / \/ ( [ ^ \s ] + ) / ) ;
386380 const version = versionMatch ? versionMatch [ 1 ] : undefined ;
387381
382+ return { client, version } ;
383+ } ) ;
384+
385+ export const listCodexProviderSkills = Effect . fn ( "listCodexProviderSkills" ) ( function * ( input : {
386+ readonly binaryPath : string ;
387+ readonly homePath ?: string ;
388+ readonly launchArgs ?: string ;
389+ readonly cwd : string ;
390+ readonly environment ?: NodeJS . ProcessEnv ;
391+ } ) {
392+ const { client } = yield * openCodexAppServerProbe ( input ) ;
393+ const response = yield * client . request ( "skills/list" , { cwds : [ input . cwd ] } ) ;
394+ return parseCodexSkillsListResponse ( response , input . cwd ) ;
395+ } ) ;
396+
397+ const probeCodexAppServerProvider = Effect . fn ( "probeCodexAppServerProvider" ) ( function * (
398+ input : CodexAppServerProbeInput & { readonly customModels ?: ReadonlyArray < string > } ,
399+ ) {
400+ const { client, version } = yield * openCodexAppServerProbe ( input ) ;
401+
388402 const accountResponse = yield * client . request ( "account/read" , { } ) ;
389403 if ( ! accountResponse . account && accountResponse . requiresOpenaiAuth ) {
390404 return {
@@ -411,7 +425,9 @@ const probeCodexAppServerProvider = Effect.fn("probeCodexAppServerProvider")(fun
411425 models : applyPreferredCodexDefaultModel (
412426 appendCustomCodexModels ( models , input . customModels ?? [ ] ) ,
413427 ) ,
414- skills : parseCodexSkillsListResponse ( skillsResponse , input . cwd ) ,
428+ skills : parseCodexSkillsListResponse ( skillsResponse , input . cwd ) . filter (
429+ ( skill ) => skill . scope !== "repo" ,
430+ ) ,
415431 } satisfies CodexAppServerProviderSnapshot ;
416432} ) ;
417433
0 commit comments