Skip to content

Commit 16e294f

Browse files
committed
remove a few instances of unused WebSocket
1 parent 9de95ed commit 16e294f

File tree

4 files changed

+3
-23
lines changed

4 files changed

+3
-23
lines changed

backend/src/main-prompt.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,11 +19,9 @@ import type {
1919
AgentTemplateType,
2020
AgentOutput,
2121
} from '@codebuff/common/types/session-state'
22-
import type { WebSocket } from 'ws'
2322

2423
export const mainPrompt = async (
2524
params: {
26-
ws: WebSocket
2725
action: ClientAction<'prompt'>
2826

2927
onResponseChunk: (chunk: string | PrintModeEvent) => void
@@ -51,7 +49,7 @@ export const mainPrompt = async (
5149
sessionState: SessionState
5250
output: AgentOutput
5351
}> => {
54-
const { ws, action, localAgentTemplates, requestToolCall, logger } = params
52+
const { action, localAgentTemplates, requestToolCall, logger } = params
5553

5654
const {
5755
prompt,

backend/src/run-agent-step.ts

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,9 @@ import type {
4848
AgentOutput,
4949
} from '@codebuff/common/types/session-state'
5050
import type { ProjectFileContext } from '@codebuff/common/util/file'
51-
import type { WebSocket } from 'ws'
5251

5352
export const runAgentStep = async (
5453
params: {
55-
ws: WebSocket
5654
userId: string | undefined
5755
userInputId: string
5856
clientSessionId: string
@@ -102,7 +100,6 @@ export const runAgentStep = async (
102100
messageId: string | null
103101
}> => {
104102
const {
105-
ws,
106103
userId,
107104
userInputId,
108105
fingerprintId,
@@ -396,7 +393,6 @@ export const runAgentStep = async (
396393

397394
export const loopAgentSteps = async (
398395
params: {
399-
ws: WebSocket
400396
userInputId: string
401397
agentType: AgentTemplateType
402398
agentState: AgentState
@@ -444,7 +440,6 @@ export const loopAgentSteps = async (
444440
output: AgentOutput
445441
}> => {
446442
const {
447-
ws,
448443
userInputId,
449444
agentType,
450445
agentState,
@@ -604,7 +599,6 @@ export const loopAgentSteps = async (
604599
} = await runProgrammaticStep({
605600
...params,
606601
agentState: currentAgentState,
607-
ws,
608602
template: agentTemplate,
609603
localAgentTemplates,
610604
prompt: currentPrompt,
@@ -669,7 +663,6 @@ export const loopAgentSteps = async (
669663
messageId,
670664
} = await runAgentStep({
671665
...params,
672-
ws,
673666
userId,
674667
userInputId,
675668
clientSessionId,

backend/src/tools/batch-str-replace.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ import type {
2020
} from '@codebuff/common/types/function-params'
2121
import type { ToolResultPart } from '@codebuff/common/types/messages/content-part'
2222
import type { PrintModeEvent } from '@codebuff/common/types/print-mode'
23-
import type { WebSocket } from 'ws'
2423

2524
export type DeferredStrReplace = {
2625
toolCall: CodebuffToolCall<'str_replace'>
@@ -80,7 +79,6 @@ export function getBenchifyClient(params: { logger: Logger }): Benchify | null {
8079
}
8180

8281
type BatchContext = {
83-
ws: WebSocket
8482
userInputId: string
8583
onResponseChunk: (chunk: string | PrintModeEvent) => void
8684
state: Record<string, any>
@@ -380,11 +378,10 @@ async function executeSingleStrReplace(
380378
* Creates a typed requestClientToolCall function for batch mode
381379
*/
382380
function createRequestClientToolCall(params: {
383-
ws: WebSocket
384381
requestToolCall: RequestToolCallFn
385382
userInputId: string
386383
}) {
387-
const { ws, requestToolCall, userInputId } = params
384+
const { requestToolCall, userInputId } = params
388385
return async (
389386
clientToolCall: any,
390387
): Promise<CodebuffToolOutput<'str_replace'>> => {
@@ -776,7 +773,6 @@ async function applyBenchifyResultsGracefully(
776773
async function applyBenchifyResultSafely(params: {
777774
benchifyFile: { path: string; contents: string }
778775
benchifyDiff: string
779-
ws: WebSocket
780776
onResponseChunk: (chunk: string | PrintModeEvent) => void
781777
state: Record<string, any>
782778
toolResults: ToolResultPart[]

backend/src/tools/handlers/tool/find-files.ts

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,6 @@ export const handleFindFiles = ((
5858
> &
5959
ParamsExcluding<
6060
typeof uploadExpandedFileContextForTraining,
61-
| 'ws'
6261
| 'messages'
6362
| 'system'
6463
| 'assistantPrompt'
@@ -79,11 +78,8 @@ export const handleFindFiles = ((
7978
state,
8079
} = params
8180
const { prompt } = toolCall.input
82-
const { ws, fingerprintId, userId, repoId, messages } = state
81+
const { fingerprintId, userId, repoId, messages } = state
8382

84-
if (!ws) {
85-
throw new Error('Internal error for find_files: Missing WebSocket in state')
86-
}
8783
if (!messages) {
8884
throw new Error('Internal error for find_files: Missing messages in state')
8985
}
@@ -129,7 +125,6 @@ export const handleFindFiles = ((
129125
if (COLLECT_FULL_FILE_CONTEXT && addedFiles.length > 0) {
130126
uploadExpandedFileContextForTraining({
131127
...params,
132-
ws,
133128
messages,
134129
system,
135130
assistantPrompt: prompt,
@@ -186,7 +181,6 @@ export const handleFindFiles = ((
186181

187182
async function uploadExpandedFileContextForTraining(
188183
params: {
189-
ws: WebSocket
190184
agentStepId: string
191185
clientSessionId: string
192186
fingerprintId: string
@@ -197,7 +191,6 @@ async function uploadExpandedFileContextForTraining(
197191
} & ParamsOf<typeof requestRelevantFilesForTraining>,
198192
) {
199193
const {
200-
ws,
201194
agentStepId,
202195
clientSessionId,
203196
fingerprintId,

0 commit comments

Comments
 (0)