diff --git a/frontend/src/app/workspace/component/agent/agent-interaction/agent-interaction.component.spec.ts b/frontend/src/app/workspace/component/agent/agent-interaction/agent-interaction.component.spec.ts index a216269927d..8c8e2ac3504 100644 --- a/frontend/src/app/workspace/component/agent/agent-interaction/agent-interaction.component.spec.ts +++ b/frontend/src/app/workspace/component/agent/agent-interaction/agent-interaction.component.spec.ts @@ -30,7 +30,7 @@ import { NotificationService } from "../../../../common/service/notification/not import { commonTestProviders } from "../../../../common/testing/test-utils"; function makeAgent(id: string, name: string = id): AgentInfo { - return { id, name, modelType: "gpt-test", isBaselineMode: false, createdAt: new Date("2026-01-01T00:00:00Z") }; + return { id, name, modelType: "gpt-test" }; } describe("AgentInteractionComponent", () => { 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 4edc93d4a0b..f2f9c53d984 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 @@ -79,8 +79,6 @@ function makeAgentInfo(overrides: Partial = {}): AgentInfo { id: AGENT_ID, name: "Test Agent", modelType: "gpt-test", - isBaselineMode: false, - createdAt: new Date("2026-01-01T00:00:00Z"), ...overrides, }; } diff --git a/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.html b/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.html index d2cf613084e..e553b4b5d09 100644 --- a/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.html +++ b/frontend/src/app/workspace/component/agent/agent-panel/agent-panel.component.html @@ -98,12 +98,10 @@ - +
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 128ecba2745..77e6ddfe23c 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 @@ -88,8 +88,6 @@ function makeAgent(id: string, overrides: Partial = {}): AgentInfo { id, name: `Agent ${id}`, modelType: "gpt-test", - isBaselineMode: false, - createdAt: new Date("2026-01-01T00:00:00Z"), ...overrides, }; } 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 b4e8bda8671..c5c2b9e6108 100644 --- a/frontend/src/app/workspace/service/agent/agent.service.spec.ts +++ b/frontend/src/app/workspace/service/agent/agent.service.spec.ts @@ -19,9 +19,9 @@ import { TestBed } from "@angular/core/testing"; import { HttpClientTestingModule, HttpTestingController } from "@angular/common/http/testing"; -import { of, throwError } from "rxjs"; +import { Observable, of, take, throwError } from "rxjs"; import { AgentService, AgentInfo, AgentSettingsApi, ModelType, OperatorExecutionSummary } from "./agent.service"; -import { AgentState, ReActStep } from "./agent-types"; +import { AgentState, ReActStep, ToolOperatorAccess } from "./agent-types"; import { NotificationService } from "../../../common/service/notification/notification.service"; import { WorkflowPersistService } from "../../../common/service/workflow-persist/workflow-persist.service"; import { ComputingUnitStatusService } from "../../../common/service/computing-unit/computing-unit-status/computing-unit-status.service"; @@ -31,6 +31,12 @@ import { DashboardWorkflowComputingUnit } from "../../../common/type/workflow-co import { Workflow } from "../../../common/type/workflow"; import { commonTestProviders } from "../../../common/testing/test-utils"; +function readSnapshot(source: Observable): T | undefined { + let current: T | undefined; + source.pipe(take(1)).subscribe(value => (current = value)); + return current; +} + /** * Minimal WebSocket double. Installed with vi.stubGlobal so the service's * `new WebSocket(...)` and `WebSocket.OPEN` references resolve to it; tests @@ -282,63 +288,6 @@ describe("AgentService", () => { }); }); - describe("getAgent", () => { - it("serves cache hits without issuing a request", () => { - seedAgent("agent-1"); - let got: AgentInfo | undefined; - - service.getAgent("agent-1").subscribe(a => (got = a)); - - httpMock.expectNone(r => r.url === "/api/agents/agent-1"); - expect(got?.id).toBe("agent-1"); - expect(got?.name).toBe("Bob"); - }); - - it("fetches, maps and caches an unknown agent", () => { - let got: AgentInfo | undefined; - service.getAgent("agent-9").subscribe(a => (got = a)); - - httpMock - .expectOne(r => r.method === "GET" && r.url === "/api/agents/agent-9") - .flush({ - id: "agent-9", - name: "Eve", - modelType: "o3", - state: "GENERATING", - createdAt: "2026-06-11T00:00:00.000Z", - delegate: { - userToken: "secret", - userInfo: { uid: 1, name: "u", email: "u@example.com", role: "REGULAR" }, - workflowId: 42, - workflowName: "wf", - }, - }); - - expect(got?.createdAt).toBeInstanceOf(Date); - expect(got?.createdAt.getTime()).toBe(new Date("2026-06-11T00:00:00.000Z").getTime()); - expect(got?.state).toBe(AgentState.GENERATING); - expect(got?.delegate?.workflowId).toBe(42); - expect((got?.delegate as any).userToken).toBeUndefined(); - - // Second lookup is a cache hit. - let again: AgentInfo | undefined; - service.getAgent("agent-9").subscribe(a => (again = a)); - httpMock.expectNone(r => r.url === "/api/agents/agent-9"); - expect(again).toBe(got); - }); - - it("maps a 404 to a descriptive error", () => { - let message: string | undefined; - service.getAgent("ghost").subscribe({ error: (e: unknown) => (message = (e as Error).message) }); - - httpMock - .expectOne(r => r.method === "GET" && r.url === "/api/agents/ghost") - .flush("not found", { status: 404, statusText: "Not Found" }); - - expect(message).toBe("Agent with ID ghost not found"); - }); - }); - describe("getAllAgents", () => { it("maps backend agents and evicts stale local ones", () => { seedAgent("agent-1"); @@ -366,9 +315,10 @@ describe("AgentService", () => { }); expect(result?.map(a => a.id)).toEqual(["agent-2"]); + expect(result?.[0]).toMatchObject({ name: "Eve", modelType: "o3" }); expect(result?.[0].state).toBe(AgentState.GENERATING); - expect(result?.[0].createdAt).toBeInstanceOf(Date); expect(result?.[0].delegate?.workflowId).toBe(7); + expect((result?.[0].delegate as any).userToken).toBeUndefined(); // agent-1 was not on the backend: cache and tracking are gone. expect((service as any).agents.has("agent-1")).toBe(false); expect((service as any).agentStateTracking.has("agent-1")).toBe(false); @@ -787,7 +737,7 @@ describe("AgentService", () => { expect(step.operatorAccess).toBeInstanceOf(Map); expect(step.operatorAccess?.get(0)?.viewedOperatorIds).toEqual(["v1"]); - expect(service.getHeadId("agent-1")).toBe("h1"); + expect(readSnapshot(service.getHeadIdObservable("agent-1"))).toBe("h1"); expect(workflow!.content).toEqual({ operators: ["op"] }); expect((service as any).agentStateTracking.get("agent-1").wsWorkflowActive).toBe(true); @@ -812,7 +762,7 @@ describe("AgentService", () => { }); expect(steps.length).toBe(1); expect(steps[0].isEnd).toBe(false); - expect(service.getHeadId("agent-1")).toBe("s1"); + expect(readSnapshot(service.getHeadIdObservable("agent-1"))).toBe("s1"); // Same messageId + stepId: the existing step is replaced, not appended. emit(ws, { @@ -821,7 +771,7 @@ describe("AgentService", () => { }); expect(steps.length).toBe(1); expect(steps[0].isEnd).toBe(true); - expect(service.getVisibleSteps("agent-1").length).toBe(1); + expect(readSnapshot(service.getReActStepsObservable("agent-1"))?.length).toBe(1); // A new step with afterWorkflowContent also updates the workflow. emit(ws, { @@ -835,7 +785,7 @@ describe("AgentService", () => { }, }); expect(steps.length).toBe(2); - expect(service.getHeadId("agent-1")).toBe("s2"); + expect(readSnapshot(service.getHeadIdObservable("agent-1"))).toBe("s2"); expect(workflow!.content).toEqual({ operators: [1] }); expect((service as any).agentStateTracking.get("agent-1").wsWorkflowActive).toBe(true); }); @@ -910,7 +860,7 @@ describe("AgentService", () => { emit(FakeWebSocket.latest(), { type: "WsServerStepEvent" }); expect(steps).toEqual([]); - expect(service.getHeadId("agent-1")).toBeNull(); + expect(readSnapshot(service.getHeadIdObservable("agent-1"))).toBeNull(); }); it("advances HEAD to the synthesised id when the step carries none", () => { @@ -924,7 +874,7 @@ describe("AgentService", () => { // convertApiReActStep falls back to `${messageId}-${stepId || 0}`, which is // always a non-empty string, so a step never fails the HEAD guard. - expect(service.getHeadId("agent-1")).toBe("m9-0"); + expect(readSnapshot(service.getHeadIdObservable("agent-1"))).toBe("m9-0"); }); it("ignores a status event that carries no state", () => { @@ -1106,47 +1056,6 @@ describe("AgentService", () => { }); }); - describe("getReActStepsByOperatorAccess", () => { - it("collects viewing and modifying steps exactly once each", () => { - let result: { viewedBy: ReActStep[]; modifiedBy: ReActStep[] } | undefined; - service.getReActStepsByOperatorAccess("agent-1", "op-7").subscribe(r => (result = r)); - - httpMock - .expectOne(r => r.method === "GET" && r.url === "/api/agents/agent-1/react-steps") - .flush({ - state: "AVAILABLE", - steps: [ - { - messageId: "viewer", - timestamp: "2026-06-11T00:00:00.000Z", - // Two accesses mention op-7: the step must appear only once. - operatorAccess: { - "0": { viewedOperatorIds: ["op-7"], addedOperatorIds: [], modifiedOperatorIds: [] }, - "1": { viewedOperatorIds: ["op-7"], addedOperatorIds: [], modifiedOperatorIds: [] }, - }, - }, - { - messageId: "modifier", - timestamp: "2026-06-11T00:00:00.000Z", - operatorAccess: { - "0": { viewedOperatorIds: [], addedOperatorIds: [], modifiedOperatorIds: ["op-7"] }, - }, - }, - { - messageId: "bystander", - timestamp: "2026-06-11T00:00:00.000Z", - operatorAccess: { - "0": { viewedOperatorIds: ["other"], addedOperatorIds: [], modifiedOperatorIds: [] }, - }, - }, - ], - }); - - expect(result?.viewedBy.map(s => s.messageId)).toEqual(["viewer"]); - expect(result?.modifiedBy.map(s => s.messageId)).toEqual(["modifier"]); - }); - }); - describe("agent request routing and fallbacks", () => { it("attaches X-Agent-Workflow-Id when the agent's tracking has a workflowId", () => { service.ensureWorkflowPolling("agent-1", 42); @@ -1215,21 +1124,7 @@ describe("AgentService", () => { expect(notification.error).toHaveBeenCalledWith("nope"); }); - it("posts operator ids and converts the returned steps", () => { - service.ensureWorkflowPolling("agent-1", 42); - let result: { steps: ReActStep[] } | undefined; - service.getStepsByOperatorIds("agent-1", ["op-1"]).subscribe(r => (result = r)); - - const req = httpMock.expectOne(r => r.method === "POST" && r.url === "/api/agents/agent-1/steps-by-operators"); - expect(req.request.body).toEqual({ operatorIds: ["op-1"] }); - expect(req.request.headers.get("X-Agent-Workflow-Id")).toBe("42"); - req.flush({ steps: [{ messageId: "m1", timestamp: "2026-06-11T00:00:00.000Z" }] }); - - expect(result?.steps.length).toBe(1); - expect(result?.steps[0].id).toBe("m1-0"); - }); - - it("falls back for system-info, operator-types and steps-by-operators failures", () => { + it("falls back for system-info and operator-types failures", () => { let systemInfo: { systemPrompt: string; tools: unknown[] } | undefined; service.getSystemInfo("agent-1").subscribe(s => (systemInfo = s)); httpMock @@ -1243,25 +1138,6 @@ describe("AgentService", () => { .expectOne(r => r.url === "/api/agents/agent-1/operator-types") .flush("boom", { status: 500, statusText: "Server Error" }); expect(operatorTypes).toEqual([]); - - let steps: { steps: ReActStep[] } | undefined; - service.getStepsByOperatorIds("agent-1", ["op-1"]).subscribe(s => (steps = s)); - httpMock - .expectOne(r => r.url === "/api/agents/agent-1/steps-by-operators") - .flush("boom", { status: 500, statusText: "Server Error" }); - expect(steps).toEqual({ steps: [] }); - }); - }); - - describe("canvas annotation toggles", () => { - it("togglePortShapes drives showPortShapes$ and the synchronous getter", () => { - const seen: boolean[] = []; - service.showPortShapes$.subscribe(v => seen.push(v)); - - service.togglePortShapes(false); - - expect(seen).toEqual([true, false]); - expect(service.getShowPortShapes()).toBe(false); }); }); @@ -1292,35 +1168,25 @@ describe("AgentService", () => { expect((service as any).agentStateTracking.has("ghost")).toBe(false); }); - it("isAgentConnected is false for an unavailable/unknown agent and true otherwise", () => { - let unknown: boolean | undefined; - service.isAgentConnected("ghost").subscribe(v => (unknown = v)); - expect(unknown).toBe(false); - - service.getAgentStateObservable("agent-1").subscribe(); - (service as any).agentStateTracking.get("agent-1").stateSubject.next(AgentState.AVAILABLE); - let connected: boolean | undefined; - service.isAgentConnected("agent-1").subscribe(v => (connected = v)); - expect(connected).toBe(true); - }); - - it("getHeadId / getHeadIdObservable return the tracked HEAD, or null when untracked", () => { + it("getHeadIdObservable returns the tracked HEAD, or null after creating tracking for a new id", () => { const emitted: (string | null)[] = []; service.getHeadIdObservable("agent-1").subscribe(v => emitted.push(v)); (service as any).agentStateTracking.get("agent-1").headIdSubject.next("m1-2"); expect(emitted).toEqual([null, "m1-2"]); - expect(service.getHeadId("agent-1")).toBe("m1-2"); - expect(service.getHeadId("ghost")).toBeNull(); + expect(readSnapshot(service.getHeadIdObservable("agent-1"))).toBe("m1-2"); + expect(readSnapshot(service.getHeadIdObservable("ghost"))).toBeNull(); + expect((service as any).agentStateTracking.has("ghost")).toBe(true); }); - it("getVisibleSteps returns the tracked snapshot, or [] when untracked", () => { + it("getReActStepsObservable returns the tracked steps, or [] after creating tracking for a new id", () => { service.getReActStepsObservable("agent-1").subscribe(); const step = { messageId: "m1", stepId: 0 } as unknown as ReActStep; (service as any).agentStateTracking.get("agent-1").reActStepsSubject.next([step]); - expect(service.getVisibleSteps("agent-1")).toEqual([step]); - expect(service.getVisibleSteps("ghost")).toEqual([]); + expect(readSnapshot(service.getReActStepsObservable("agent-1"))).toEqual([step]); + expect(readSnapshot(service.getReActStepsObservable("ghost"))).toEqual([]); + expect((service as any).agentStateTracking.has("ghost")).toBe(true); }); it("getWorkflowObservable emits the tracked workflow, or null when untracked", () => { @@ -1334,28 +1200,6 @@ describe("AgentService", () => { service.getWorkflowObservable("ghost").subscribe(w => (untracked = w)); expect(untracked).toBeNull(); }); - - it("getAgentWorkflowId walks the delegate chain: missing agent, no delegate, full", () => { - expect(service.getAgentWorkflowId("ghost")).toBeUndefined(); - - (service as any).agents.set("no-delegate", { id: "no-delegate", name: "x" }); - expect(service.getAgentWorkflowId("no-delegate")).toBeUndefined(); - - seedAgent("with-wf", 42); - expect(service.getAgentWorkflowId("with-wf")).toBe(42); - }); - - it("getAgentCount reports the number of registered agents", () => { - let empty: number | undefined; - service.getAgentCount().subscribe(c => (empty = c)); - expect(empty).toBe(0); - - seedAgent("agent-1"); - seedAgent("agent-2"); - let count: number | undefined; - service.getAgentCount().subscribe(c => (count = c)); - expect(count).toBe(2); - }); }); describe("setHoveredMessage guards", () => { @@ -1378,22 +1222,6 @@ describe("AgentService", () => { }); }); - describe("getReActStepsByOperatorAccess without operator access", () => { - it("skips steps whose operatorAccess is absent", () => { - let result: { viewedBy: ReActStep[]; modifiedBy: ReActStep[] } | undefined; - service.getReActStepsByOperatorAccess("agent-1", "op-7").subscribe(r => (result = r)); - - httpMock - .expectOne(r => r.method === "GET" && r.url === "/api/agents/agent-1/react-steps") - .flush({ - state: "AVAILABLE", - steps: [{ messageId: "no-access", timestamp: "2026-06-11T00:00:00.000Z" }], - }); - - expect(result).toEqual({ viewedBy: [], modifiedBy: [] }); - }); - }); - describe("mapStateToAgentState", () => { it("maps STOPPING, UNAVAILABLE and unrecognised backend states", () => { let mapped: AgentInfo[] | undefined; @@ -1482,6 +1310,48 @@ describe("AgentService", () => { }); }); + describe("getReActSteps success", () => { + it("converts the fetched steps, turning each step's keyed operator access into a Map", () => { + let steps: ReActStep[] | undefined; + service.getReActSteps("agent-1").subscribe(s => (steps = s)); + + const viewed: ToolOperatorAccess = { + viewedOperatorIds: ["op-7"], + addedOperatorIds: [], + modifiedOperatorIds: [], + }; + const modified: ToolOperatorAccess = { + viewedOperatorIds: [], + addedOperatorIds: [], + modifiedOperatorIds: ["op-7"], + }; + httpMock + .expectOne(r => r.method === "GET" && r.url === "/api/agents/agent-1/react-steps") + .flush({ + state: "AVAILABLE", + steps: [ + { + messageId: "m1", + stepId: 2, + timestamp: "2026-06-11T00:00:00.000Z", + operatorAccess: { "0": viewed, "1": modified }, + }, + { messageId: "m2", timestamp: "2026-06-11T00:00:01.000Z" }, + ], + }); + + expect(steps?.map(s => s.id)).toEqual(["m1-2", "m2-0"]); + expect(steps?.[0].timestamp).toEqual(new Date("2026-06-11T00:00:00.000Z")); + expect(steps?.[0].operatorAccess).toEqual( + new Map([ + [0, viewed], + [1, modified], + ]) + ); + expect(steps?.[1].operatorAccess).toBeUndefined(); + }); + }); + describe("getReActSteps failure", () => { it("emits an empty array instead of propagating the error", () => { let steps: ReActStep[] | undefined; diff --git a/frontend/src/app/workspace/service/agent/agent.service.ts b/frontend/src/app/workspace/service/agent/agent.service.ts index 3bccc6475fb..96ee1a2d9d4 100644 --- a/frontend/src/app/workspace/service/agent/agent.service.ts +++ b/frontend/src/app/workspace/service/agent/agent.service.ts @@ -37,8 +37,8 @@ import { import { NotificationService } from "../../../common/service/notification/notification.service"; import { WorkflowPersistService } from "../../../common/service/workflow-persist/workflow-persist.service"; import { AppSettings } from "../../../common/app-setting"; -import { AgentState, ReActStep, ModelMessage } from "./agent-types"; -import { Workflow, WorkflowContent } from "../../../common/type/workflow"; +import { AgentState, ReActStep } from "./agent-types"; +import { Workflow } from "../../../common/type/workflow"; import { ComputingUnitStatusService } from "../../../common/service/computing-unit/computing-unit-status/computing-unit-status.service"; import { WarehouseService } from "../../../common/service/warehouse/warehouse.service"; import { AuthService } from "../../../common/service/user/auth.service"; @@ -74,8 +74,6 @@ export interface AgentInfo { id: string; name: string; modelType: string; - isBaselineMode: boolean; - createdAt: Date; /** State is fetched from API */ state?: AgentState; delegate?: { @@ -167,16 +165,6 @@ interface ApiReActStepsResponse { state: string; } -interface ApiMessageResponse { - response: string; - steps: any[]; - usage: { inputTokens: number; outputTokens: number; totalTokens: number }; - stats: any; - stopped: boolean; - error?: string; - workflow: any; -} - interface LiteLLMModel { id: string; object: string; @@ -216,7 +204,7 @@ interface AgentStateTracking { /** * Manages the workspace's agents via the agent-service HTTP/WebSocket * API. Owns the local agent list, per-agent state tracking (ReAct steps, HEAD - * pointer, workflow snapshot), and the canvas annotation toggles consumed by + * pointer, workflow snapshot), and the canvas annotation streams consumed by * workflow-editor. */ @Injectable({ @@ -239,14 +227,6 @@ export class AgentService { /** Cached model types */ private modelTypes$: Observable | null = null; - // ============================================================================ - // 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(); - constructor( private http: HttpClient, private notificationService: NotificationService, @@ -385,8 +365,6 @@ export class AgentService { id: api.id, name: api.name, modelType: api.modelType, - isBaselineMode: false, - createdAt: new Date(api.createdAt), state: this.mapStateToAgentState(api.state), delegate: api.delegate ? { @@ -692,14 +670,6 @@ export class AgentService { return connectedIds; } - /** - * Get the workflow ID associated with an agent. - */ - public getAgentWorkflowId(agentId: string): number | undefined { - const agent = this.agents.get(agentId); - return agent?.delegate?.workflowId; - } - /** * Create a new agent with the specified model type. * The user's JWT travels in the Authorization header (added by the JWT @@ -747,28 +717,6 @@ export class AgentService { }); } - /** - * Get an agent by ID. - */ - public getAgent(agentId: string): Observable { - return defer(() => { - const agent = this.agents.get(agentId); - if (agent) { - return of(agent); - } - - // Fetch from API if not in cache - return this.http.get(`${this.AGENT_API_BASE}/agents/${agentId}`, this.agentHeaders(agentId)).pipe( - map(response => { - const agentInfo = this.mapApiAgentInfo(response); - this.agents.set(response.id, agentInfo); - return agentInfo; - }), - catchError(() => throwError(() => new Error(`Agent with ID ${agentId} not found`))) - ); - }); - } - /** * Get all agents. * Also syncs local cache with backend - removes any stale agents that no longer exist on the backend. @@ -857,13 +805,6 @@ export class AgentService { .join(" "); } - /** - * Get the count of active agents. - */ - public getAgentCount(): Observable { - return of(this.agents.size); - } - /** * Send a message to an agent via WebSocket. * The message is sent through the WebSocket connection for real-time streaming. @@ -983,13 +924,6 @@ export class AgentService { return tracking.stateSubject.asObservable(); } - /** - * Check if an agent is connected. - */ - public isAgentConnected(agentId: string): Observable { - return this.getAgentState(agentId).pipe(map(state => state !== AgentState.UNAVAILABLE)); - } - /** * Get HEAD step ID observable for an agent. */ @@ -998,22 +932,6 @@ export class AgentService { return tracking.headIdSubject.asObservable(); } - /** - * Get current HEAD step ID for an agent. - */ - public getHeadId(agentId: string): string | null { - const tracking = this.agentStateTracking.get(agentId); - return tracking ? tracking.headIdSubject.getValue() : null; - } - - /** - * Get visible steps for an agent (current snapshot). - */ - public getVisibleSteps(agentId: string): ReActStep[] { - const tracking = this.agentStateTracking.get(agentId); - return tracking ? tracking.reActStepsSubject.getValue() : []; - } - /** * Get system information for an agent (system prompt and tools). * Fetches from agent-service API. @@ -1079,36 +997,6 @@ export class AgentService { return tracking.hoveredMessageSubject.asObservable(); } - /** - * Get ReActSteps that viewed or modified a specific operator. - */ - public getReActStepsByOperatorAccess( - agentId: string, - operatorId: string - ): Observable<{ viewedBy: ReActStep[]; modifiedBy: ReActStep[] }> { - return this.getReActSteps(agentId).pipe( - map(allSteps => { - const viewedBy: ReActStep[] = []; - const modifiedBy: ReActStep[] = []; - - for (const step of allSteps) { - if (step.operatorAccess) { - step.operatorAccess.forEach(access => { - if (access.viewedOperatorIds.includes(operatorId) && !viewedBy.includes(step)) { - viewedBy.push(step); - } - if (access.modifiedOperatorIds.includes(operatorId) && !modifiedBy.includes(step)) { - modifiedBy.push(step); - } - }); - } - } - - return { viewedBy, modifiedBy }; - }) - ); - } - /** * Get workflow observable for an agent. * This observable emits the full Workflow object from the backend database @@ -1191,50 +1079,6 @@ export class AgentService { .pipe(catchError(() => of([]))); } - // ============================================================================ - // Context Filtering Methods - // ============================================================================ - - /** - * Get ReActSteps relevant to the specified operator IDs. - * Fetches from the backend which filters steps based on which operators they affected. - * - * @param agentId - The agent ID - * @param operatorIds - The operator IDs to filter by - * @returns Observable with filtered ReActSteps - */ - public getStepsByOperatorIds(agentId: string, operatorIds: string[]): Observable<{ steps: ReActStep[] }> { - return this.http - .post<{ - steps: ReActStep[]; - }>(`${this.AGENT_API_BASE}/agents/${agentId}/steps-by-operators`, { operatorIds }, this.agentHeaders(agentId)) - .pipe( - map(response => ({ - steps: this.convertApiReActSteps(response.steps), - })), - catchError(() => - of({ - steps: [], - }) - ) - ); - } - - // ============================================================================ - // Canvas annotation toggles - // ============================================================================ - - /** - * Toggle whether output port shapes are shown on operators. - */ - public togglePortShapes(show: boolean): void { - this.showPortShapesSubject.next(show); - } - - public getShowPortShapes(): boolean { - return this.showPortShapesSubject.getValue(); - } - // ============================================================================ // Operator Result Annotation Methods // ============================================================================