Skip to content

Commit cd656b7

Browse files
committed
refactor: convert checkTerminalCommand to use object parameter
1 parent 7000215 commit cd656b7

File tree

2 files changed

+13
-9
lines changed

2 files changed

+13
-9
lines changed

backend/src/check-terminal-command.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,16 @@ import { logger } from './util/logger'
88
* Checks if a prompt appears to be a terminal command that can be run directly.
99
* Returns the command if it is a terminal command, null otherwise.
1010
*/
11-
export async function checkTerminalCommand(
12-
prompt: string,
11+
export async function checkTerminalCommand(params: {
12+
prompt: string
1313
options: {
1414
clientSessionId: string
1515
fingerprintId: string
1616
userInputId: string
1717
userId: string | undefined
18-
},
19-
): Promise<string | null> {
18+
}
19+
}): Promise<string | null> {
20+
const { prompt, options } = params
2021
if (!prompt?.trim()) {
2122
return null
2223
}

backend/src/main-prompt.ts

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -133,11 +133,14 @@ export const mainPrompt = async (
133133
if (prompt && mainAgentTemplate.toolNames.includes('run_terminal_command')) {
134134
// Check if this is a direct terminal command
135135
const startTime = Date.now()
136-
const terminalCommand = await checkTerminalCommand(prompt, {
137-
clientSessionId,
138-
fingerprintId,
139-
userInputId: promptId,
140-
userId,
136+
const terminalCommand = await checkTerminalCommand({
137+
prompt,
138+
options: {
139+
clientSessionId,
140+
fingerprintId,
141+
userInputId: promptId,
142+
userId,
143+
},
141144
})
142145
const duration = Date.now() - startTime
143146

0 commit comments

Comments
 (0)