diff --git a/agent-service/src/agent/texera-agent.ts b/agent-service/src/agent/texera-agent.ts index 37eb12d8688..3ea59a369f6 100644 --- a/agent-service/src/agent/texera-agent.ts +++ b/agent-service/src/agent/texera-agent.ts @@ -75,7 +75,7 @@ type ReActStepCallback = (step: ReActStep) => void; /** * A single Texera agent instance. * - * Owns the conversation (ReAct step tree with HEAD/checkout semantics), the + * Owns the conversation (ReAct step tree with HEAD tracking), the * workflow being edited (`WorkflowState`), cached operator execution results * (`WorkflowResultState`), and the tool surface exposed to the LLM. Each call * to `sendMessage` drives one multi-step generation via the Vercel AI SDK, @@ -298,16 +298,6 @@ export class TexeraAgent { return Array.from(this.stepsById.values()).filter(s => s.id !== INITIAL_STEP_ID); } - checkout(stepId: string): boolean { - const step = this.stepsById.get(stepId); - if (!step && stepId !== INITIAL_STEP_ID) return false; - this.head = stepId; - if (step?.afterWorkflowContent) { - this.workflowState.setWorkflowContent(step.afterWorkflowContent); - } - return true; - } - setStepCallback(callback: ReActStepCallback | null): void { this.stepCallback = callback; } diff --git a/agent-service/src/server.ts b/agent-service/src/server.ts index 0da3f693797..0f358909b1e 100644 --- a/agent-service/src/server.ts +++ b/agent-service/src/server.ts @@ -308,31 +308,6 @@ const agentsRouter = new Elysia({ prefix: "/agents" }) return { status: "cleared" }; }) - .post("/:id/checkout", ({ params: { id }, body }) => { - const agent = getAgent(id); - const { stepId } = body as { stepId: string }; - if (!stepId) throw new Error("stepId is required"); - - const success = agent.checkout(stepId); - if (!success) throw new Error(`Step ${stepId} not found or checkout failed`); - - const allSteps = agent.getAllSteps(); - const workflowContent = agent.getWorkflowState().getWorkflowContent(); - - broadcastToAgent(id, { - type: "headChange", - headId: stepId, - steps: allSteps, - workflowContent, - operatorResults: getOperatorResultSummaries(agent), - }); - - return { - status: "checked out", - headId: stepId, - }; - }) - .get("/:id/operator-types", ({ params: { id } }) => { const agent = getAgent(id); const metadataStore = agent.getMetadataStore(); @@ -431,14 +406,13 @@ interface OperatorResultSummaryWs { } interface WsOutgoingMessage { - type: "step" | "state" | "error" | "complete" | "init" | "headChange"; + type: "step" | "state" | "error" | "complete" | "init"; step?: ReActStep; state?: string; error?: string; steps?: ReActStep[]; headId?: string; operatorResults?: Record; - workflowContent?: any; } function getOperatorResultSummaries(agent: TexeraAgent): Record { diff --git a/frontend/src/app/workspace/service/agent/agent.service.ts b/frontend/src/app/workspace/service/agent/agent.service.ts index 462e7679ce5..9c4d650d2ea 100644 --- a/frontend/src/app/workspace/service/agent/agent.service.ts +++ b/frontend/src/app/workspace/service/agent/agent.service.ts @@ -534,30 +534,6 @@ export class AgentService { } break; - case "headChange": - // HEAD moved (checkout) — update HEAD, visible steps, and workflow - if (message.headId !== undefined) { - tracking.headIdSubject.next(message.headId); - } - if (message.steps && Array.isArray(message.steps)) { - const steps = message.steps.map((s: any) => this.convertApiReActStep(s)); - tracking.reActStepsSubject.next(steps); - } - // Update workflow content from agent service (ground truth) - if (message.workflowContent) { - tracking.wsWorkflowActive = true; - const workflow: Workflow = { - ...(message.workflowMetadata || tracking.workflowSubject.getValue() || {}), - content: message.workflowContent, - }; - tracking.workflowSubject.next(workflow as Workflow); - } - // Update operator results on HEAD change - if (message.operatorResults) { - this.updateOperatorResultSummaries(message.operatorResults); - } - break; - case "error": // Error occurred console.error(`Agent ${agentId} error:`, message.error); @@ -1025,14 +1001,6 @@ export class AgentService { return tracking ? tracking.headIdSubject.getValue() : null; } - /** - * Checkout to a specific step (move HEAD, restore workflow). - * The backend broadcasts headChange + visible steps via WebSocket to all clients. - */ - public checkoutStep(agentId: string, stepId: string): Observable { - return this.http.post(`${this.AGENT_API_BASE}/agents/${agentId}/checkout`, { stepId }); - } - /** * Get visible steps for an agent (current snapshot). */