@@ -12,9 +12,9 @@ import {
1212import { API_KEY_ENV_VAR } from '../../common/src/constants'
1313import { getInitialSessionState } from '../../common/src/types/session-state'
1414
15+ import type { AgentConfig } from './types/agent-config'
1516import type { PrintModeEvent } from '../../common/src/types/print-mode'
1617import type { SessionState } from '../../common/src/types/session-state'
17- import type { AgentConfig } from './types/agent-config'
1818
1919type ClientToolName = 'write_file' | 'run_terminal_command'
2020
@@ -27,7 +27,7 @@ export type CodebuffClientOptions = {
2727 Record <
2828 ClientToolName ,
2929 (
30- args : Extract < ServerAction , { type : 'tool-call-request' } > [ 'args' ] ,
30+ args : ServerAction < 'tool-call-request' > [ 'args' ] ,
3131 ) => Promise < { toolResultMessage : string } >
3232 > & {
3333 // Include read_files separately, since it has a different signature.
@@ -40,7 +40,7 @@ export type CodebuffClientOptions = {
4040
4141type RunState = {
4242 sessionState : SessionState
43- toolResults : Extract < ServerAction , { type : 'prompt-response' } > [ 'toolResults' ]
43+ toolResults : ServerAction < 'prompt-response' > [ 'toolResults' ]
4444}
4545
4646export class CodebuffClient {
@@ -176,9 +176,7 @@ export class CodebuffClient {
176176 } )
177177 }
178178
179- private async handlePromptResponse (
180- action : Extract < ServerAction , { type : 'prompt-response' } > ,
181- ) {
179+ private async handlePromptResponse ( action : ServerAction < 'prompt-response' > ) {
182180 const promiseActions =
183181 this . promptIdToResolveResponse [ action ?. promptId ?? '' ]
184182
@@ -217,9 +215,7 @@ export class CodebuffClient {
217215 return getFiles ( filePath , this . cwd )
218216 }
219217
220- private async handleToolCall (
221- action : Extract < ServerAction , { type : 'tool-call-request' } > ,
222- ) {
218+ private async handleToolCall ( action : ServerAction < 'tool-call-request' > ) {
223219 const toolName = action . toolName
224220 const args = action . args
225221 let result : string
0 commit comments