From 53b65a5ae76708c8d610982c75b3fbdff40257dd Mon Sep 17 00:00:00 2001 From: Xinyuan Lin Date: Sat, 19 Sep 2026 16:42:30 -0700 Subject: [PATCH] chore(frontend): remove the unused scroll-to-step request stream --- .../agent-chat/agent-chat.component.spec.ts | 29 ------------------- .../agent-chat/agent-chat.component.ts | 21 -------------- .../agent-panel/agent-panel.component.spec.ts | 3 -- .../service/agent/agent.service.spec.ts | 9 ------ .../workspace/service/agent/agent.service.ts | 13 +-------- 5 files changed, 1 insertion(+), 74 deletions(-) diff --git a/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.spec.ts b/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.spec.ts index 8ae1f2ddaa5..f7f5ecf734d 100644 --- a/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.spec.ts +++ b/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.spec.ts @@ -48,8 +48,6 @@ class MockAgentService { public stepsSubject = new BehaviorSubject([]); public headIdSubject = new BehaviorSubject(null); public workflowSubject = new BehaviorSubject(null); - public scrollToStepSubject = new Subject<{ agentId: string; messageId: string; stepId: number }>(); - public scrollToStep$ = this.scrollToStepSubject.asObservable(); public ensureWorkflowPolling = vi.fn(); public getAgentState = vi.fn((): Observable => of(this.stateSubject.getValue())); @@ -722,33 +720,6 @@ describe("AgentChatComponent", () => { }); }); - describe("scroll-to-step requests", () => { - it("scrolls to and highlights the requested step of this agent", () => { - createComponent(); - const s0 = makeStep({ messageId: "m1", stepId: 0 }); - const s1 = makeStep({ messageId: "m1", stepId: 1 }); - agentService.stepsSubject.next([s0, s1]); - fixture.detectChanges(); - agentService.setHoveredMessage.mockClear(); - - agentService.scrollToStepSubject.next({ agentId: AGENT_ID, messageId: "m1", stepId: 0 }); - - expect(scrollIntoViewMock).toHaveBeenCalledWith({ behavior: "smooth", block: "center" }); - expect(component.hoveredMessageIndex).toBe(0); - expect(agentService.setHoveredMessage).toHaveBeenCalledWith(AGENT_ID, s0); - }); - - it("ignores scroll requests addressed to other agents", () => { - createComponent(); - agentService.stepsSubject.next([makeStep()]); - fixture.detectChanges(); - - agentService.scrollToStepSubject.next({ agentId: "someone-else", messageId: "m1", stepId: 0 }); - - expect(scrollIntoViewMock).not.toHaveBeenCalled(); - }); - }); - describe("template rendering", () => { it("renders user and agent message bubbles with roles, content and tool summary", async () => { createComponent(); diff --git a/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.ts b/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.ts index 55b6c6a3f66..a6520647d27 100644 --- a/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.ts +++ b/frontend/src/app/workspace/component/agent/agent-panel/agent-chat/agent-chat.component.ts @@ -237,13 +237,6 @@ export class AgentChatComponent implements OnInit, AfterViewChecked, OnDestroy, if (this.isActive) { this.startWorkflowSubscription(); } - - // Subscribe to scroll-to-step requests - this.agentService.scrollToStep$.pipe(untilDestroyed(this)).subscribe(({ agentId, messageId, stepId }) => { - if (agentId === this.agentInfo.id) { - this.scrollToStep(messageId, stepId); - } - }); } ngOnChanges(changes: SimpleChanges): void { @@ -741,18 +734,4 @@ export class AgentChatComponent implements OnInit, AfterViewChecked, OnDestroy, error: () => {}, }); } - - /** - * Scroll to a specific step in the chat by messageId and stepId. - */ - private scrollToStep(messageId: string, stepId: number): void { - // Find the step index in visibleSteps - const stepIndex = this.visibleSteps.findIndex(step => step.messageId === messageId && step.stepId === stepId); - - if (stepIndex >= 0) { - this.scrollToMessage(stepIndex); - // Highlight the message briefly - this.setHoveredMessage(stepIndex); - } - } } diff --git a/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.spec.ts b/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.spec.ts index b067665d354..5d4550a0daa 100644 --- a/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.spec.ts +++ b/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.spec.ts @@ -702,9 +702,6 @@ describe("AgentPanelComponent", () => { * children resolve the same AgentService token. */ class FullMockAgentService extends MockAgentService { - public scrollToStepSubject = new Subject<{ agentId: string; messageId: string; stepId: number }>(); - public scrollToStep$ = this.scrollToStepSubject.asObservable(); - // agent-chat public ensureWorkflowPolling = vi.fn(); public getAgentState = vi.fn((): Observable => of(AgentState.AVAILABLE)); diff --git a/frontend/src/app/workspace/service/agent/agent.service.spec.ts b/frontend/src/app/workspace/service/agent/agent.service.spec.ts index d5e38a97429..071329703cc 100644 --- a/frontend/src/app/workspace/service/agent/agent.service.spec.ts +++ b/frontend/src/app/workspace/service/agent/agent.service.spec.ts @@ -1223,15 +1223,6 @@ describe("AgentService", () => { expect(seen).toEqual([true, false]); expect(service.getShowPortShapes()).toBe(false); }); - - it("requestScrollToStep broadcasts the scroll target", () => { - let target: { agentId: string; messageId: string; stepId: number } | undefined; - service.scrollToStep$.subscribe(t => (target = t)); - - service.requestScrollToStep("agent-1", "m1", 4); - - expect(target).toEqual({ agentId: "agent-1", messageId: "m1", stepId: 4 }); - }); }); // --------------------------------------------------------------------------- diff --git a/frontend/src/app/workspace/service/agent/agent.service.ts b/frontend/src/app/workspace/service/agent/agent.service.ts index 0464ec8ba8f..a2db75ff23c 100644 --- a/frontend/src/app/workspace/service/agent/agent.service.ts +++ b/frontend/src/app/workspace/service/agent/agent.service.ts @@ -211,17 +211,13 @@ export class AgentService { private modelTypes$: Observable | null = null; // ============================================================================ - // Canvas annotation state (port shapes, step badges, scroll-to-step) + // Canvas annotation state (port shapes, step badges) // ============================================================================ /** Whether to show output port shapes (rows, columns) on operators */ private showPortShapesSubject = new BehaviorSubject(true); public showPortShapes$ = this.showPortShapesSubject.asObservable(); - /** Subject emitting scroll-to-step requests */ - private scrollToStepSubject = new Subject<{ agentId: string; messageId: string; stepId: number }>(); - public scrollToStep$ = this.scrollToStepSubject.asObservable(); - constructor( private http: HttpClient, private notificationService: NotificationService, @@ -1224,13 +1220,6 @@ export class AgentService { return this.showPortShapesSubject.getValue(); } - /** - * Request scrolling to a specific step in the agent chat. - */ - public requestScrollToStep(agentId: string, messageId: string, stepId: number): void { - this.scrollToStepSubject.next({ agentId, messageId, stepId }); - } - // ============================================================================ // Operator Result Annotation Methods // ============================================================================