@@ -27,7 +27,7 @@ import { z } from 'zod/v4'
2727import { withAppContext } from '../context/app-context'
2828import { loopAgentSteps } from '../run-agent-step'
2929import { clearAgentGeneratorCache } from '../run-programmatic-step'
30- import { mockFileContext , MockWebSocket } from './test-utils'
30+ import { mockFileContext } from './test-utils'
3131
3232import type { getAgentTemplate } from '../templates/agent-registry'
3333import type { AgentTemplate } from '../templates/types'
@@ -38,7 +38,6 @@ import type {
3838} from '@codebuff/common/types/contracts/agent-runtime'
3939import type { ParamsOf } from '@codebuff/common/types/function-params'
4040import type { AgentState } from '@codebuff/common/types/session-state'
41- import type { WebSocket } from 'ws'
4241
4342describe ( 'loopAgentSteps - runAgentStep vs runProgrammaticStep behavior' , ( ) => {
4443 let mockTemplate : AgentTemplate
@@ -103,7 +102,10 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
103102
104103 beforeEach ( ( ) => {
105104 agentRuntimeImpl = { ...TEST_AGENT_RUNTIME_IMPL }
106- agentRuntimeScopedImpl = { ...TEST_AGENT_RUNTIME_SCOPED_IMPL }
105+ agentRuntimeScopedImpl = {
106+ ...TEST_AGENT_RUNTIME_SCOPED_IMPL ,
107+ sendAction : ( ) => { } ,
108+ }
107109
108110 llmCallCount = 0
109111
@@ -210,7 +212,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
210212 const result = await runLoopAgentStepsWithContext ( {
211213 ...agentRuntimeImpl ,
212214 ...agentRuntimeScopedImpl ,
213- ws : new MockWebSocket ( ) as unknown as WebSocket ,
214215 userInputId : 'test-user-input' ,
215216 agentType : 'test-agent' ,
216217 agentState : mockAgentState ,
@@ -257,7 +258,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
257258 const result = await runLoopAgentStepsWithContext ( {
258259 ...agentRuntimeImpl ,
259260 ...agentRuntimeScopedImpl ,
260- ws : new MockWebSocket ( ) as unknown as WebSocket ,
261261 userInputId : 'test-user-input' ,
262262 agentType : 'test-agent' ,
263263 agentState : mockAgentState ,
@@ -306,7 +306,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
306306 const result = await runLoopAgentStepsWithContext ( {
307307 ...agentRuntimeImpl ,
308308 ...agentRuntimeScopedImpl ,
309- ws : new MockWebSocket ( ) as unknown as WebSocket ,
310309 userInputId : 'test-user-input' ,
311310 agentType : 'test-agent' ,
312311 agentState : mockAgentState ,
@@ -354,7 +353,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
354353 const result = await runLoopAgentStepsWithContext ( {
355354 ...agentRuntimeImpl ,
356355 ...agentRuntimeScopedImpl ,
357- ws : new MockWebSocket ( ) as unknown as WebSocket ,
358356 userInputId : 'test-user-input' ,
359357 agentType : 'test-agent' ,
360358 agentState : mockAgentState ,
@@ -395,7 +393,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
395393 const result = await runLoopAgentStepsWithContext ( {
396394 ...agentRuntimeImpl ,
397395 ...agentRuntimeScopedImpl ,
398- ws : new MockWebSocket ( ) as unknown as WebSocket ,
399396 userInputId : 'test-user-input' ,
400397 agentType : 'test-agent' ,
401398 agentState : mockAgentState ,
@@ -428,7 +425,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
428425 const result = await runLoopAgentStepsWithContext ( {
429426 ...agentRuntimeImpl ,
430427 ...agentRuntimeScopedImpl ,
431- ws : new MockWebSocket ( ) as unknown as WebSocket ,
432428 userInputId : 'test-user-input' ,
433429 agentType : 'test-agent' ,
434430 agentState : mockAgentState ,
@@ -463,7 +459,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
463459 const result = await runLoopAgentStepsWithContext ( {
464460 ...agentRuntimeImpl ,
465461 ...agentRuntimeScopedImpl ,
466- ws : new MockWebSocket ( ) as unknown as WebSocket ,
467462 userInputId : 'test-user-input' ,
468463 agentType : 'test-agent' ,
469464 agentState : mockAgentState ,
@@ -515,7 +510,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
515510 const result = await runLoopAgentStepsWithContext ( {
516511 ...agentRuntimeImpl ,
517512 ...agentRuntimeScopedImpl ,
518- ws : new MockWebSocket ( ) as unknown as WebSocket ,
519513 userInputId : 'test-user-input' ,
520514 agentType : 'test-agent' ,
521515 agentState : mockAgentState ,
@@ -565,7 +559,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
565559 await runLoopAgentStepsWithContext ( {
566560 ...agentRuntimeImpl ,
567561 ...agentRuntimeScopedImpl ,
568- ws : new MockWebSocket ( ) as unknown as WebSocket ,
569562 userInputId : 'test-user-input' ,
570563 agentType : 'test-agent' ,
571564 agentState : mockAgentState ,
@@ -653,7 +646,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
653646 const result = await runLoopAgentStepsWithContext ( {
654647 ...agentRuntimeImpl ,
655648 ...agentRuntimeScopedImpl ,
656- ws : new MockWebSocket ( ) as unknown as WebSocket ,
657649 userInputId : 'test-user-input' ,
658650 agentType : 'test-agent' ,
659651 agentState : mockAgentState ,
@@ -727,7 +719,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
727719 const result = await runLoopAgentStepsWithContext ( {
728720 ...agentRuntimeImpl ,
729721 ...agentRuntimeScopedImpl ,
730- ws : new MockWebSocket ( ) as unknown as WebSocket ,
731722 userInputId : 'test-user-input' ,
732723 agentType : 'test-agent' ,
733724 agentState : mockAgentState ,
@@ -774,7 +765,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
774765 const result = await runLoopAgentStepsWithContext ( {
775766 ...agentRuntimeImpl ,
776767 ...agentRuntimeScopedImpl ,
777- ws : new MockWebSocket ( ) as unknown as WebSocket ,
778768 userInputId : 'test-user-input' ,
779769 agentType : 'test-agent' ,
780770 agentState : mockAgentState ,
@@ -843,7 +833,6 @@ describe('loopAgentSteps - runAgentStep vs runProgrammaticStep behavior', () =>
843833 const result = await runLoopAgentStepsWithContext ( {
844834 ...agentRuntimeImpl ,
845835 ...agentRuntimeScopedImpl ,
846- ws : new MockWebSocket ( ) as unknown as WebSocket ,
847836 userInputId : 'test-user-input' ,
848837 agentType : 'test-agent' ,
849838 agentState : mockAgentState ,
0 commit comments