11import path from 'path' ;
22import type { AgentType } from '../adapters/AgentAdapter.js' ;
33
4- export type StartableAgentType = Extract < AgentType , 'claude' | 'codex' | 'gemini_cli' | 'opencode' > ;
4+ export type StartableAgentType = Extract < AgentType , 'claude' | 'codex' | 'gemini_cli' | 'opencode' | 'pi' > ;
55
66export interface AgentConfig {
77 /** Shell command to launch the agent (sent to tmux via `send-keys`). */
@@ -18,8 +18,9 @@ export interface AgentConfig {
1818export const AGENTS : Record < StartableAgentType , AgentConfig > = {
1919 claude : { command : 'claude' , matches : matchArgv0 ( 'claude' ) } ,
2020 codex : { command : 'codex' , matches : matchArgv0 ( 'codex' ) } ,
21- opencode : { command : 'opencode' , matches : matchArgv0 ( 'opencode' ) } ,
2221 gemini_cli : { command : 'gemini' , matches : matchAnyToken ( 'gemini' ) } ,
22+ opencode : { command : 'opencode' , matches : matchArgv0 ( 'opencode' ) } ,
23+ pi : { command : 'pi' , matches : matchAnyBasename ( [ 'pi' , 'pi.exe' , 'pi.js' ] ) } ,
2324} ;
2425
2526function matchArgv0 ( name : string ) : ( psCommand : string ) => boolean {
@@ -39,3 +40,13 @@ function matchAnyToken(name: string): (psCommand: string) => boolean {
3940 return false ;
4041 } ;
4142}
43+
44+ function matchAnyBasename ( names : string [ ] ) : ( psCommand : string ) => boolean {
45+ const lowers = new Set ( names . map ( ( name ) => name . toLowerCase ( ) ) ) ;
46+ return ( psCommand ) => {
47+ for ( const token of psCommand . trim ( ) . split ( / \s + / ) ) {
48+ if ( lowers . has ( path . basename ( token ) . toLowerCase ( ) ) ) return true ;
49+ }
50+ return false ;
51+ } ;
52+ }
0 commit comments