bobbai00 commented on code in PR #5751:
URL: https://github.com/apache/texera/pull/5751#discussion_r3487548026


##########
agent-service/src/types/ws/client.ts:
##########
@@ -0,0 +1,49 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Client -> server WebSocket frames for this service's protocol
+// (`/agents/:id/react`). Modeled as a discriminated union on `type`, so each
+// request kind carries only its own fields.
+
+/** Shared discriminator base; every client request sets a unique `type`. */
+interface WsClientRequestBase {
+  type: "prompt" | "command";
+}
+
+/**
+ * A user prompt for the agent to run. `messageSource` notes where it
+ * originated (interactive chat vs. an operator feedback action).
+ */
+export interface WsClientRequestPrompt extends WsClientRequestBase {

Review Comment:
   changed to `XXXCommand`



##########
agent-service/src/types/ws/server.ts:
##########
@@ -0,0 +1,110 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *   http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+// Server -> client WebSocket frames for this service's protocol
+// (`/agents/:id/react`). Modeled as a discriminated union on `type`, so each
+// message kind declares exactly the fields it sends.
+
+import type { AgentState, ReActStep } from "../agent";
+import type { WorkflowContent } from "../workflow";
+
+/**
+ * Wire projection of one operator's execution result, summarized for the
+ * client: counts and a small record sample instead of full payloads.
+ */
+export interface OperatorResultSummaryWs {
+  state: string;
+  inputTuples: number;
+  outputTuples: number;
+  inputPortShapes?: { portIndex: number; rows: number; columns: number }[];
+  outputColumns?: number;
+  error?: string;
+  warnings?: string[];
+  consoleLogCount?: number;
+  totalRowCount?: number;
+  sampleRecords?: Record<string, unknown>[];
+  resultStatistics?: Record<string, string>;
+}
+
+/** Per-operator result summaries, keyed by operator id. */
+type OperatorResults = Record<string, OperatorResultSummaryWs>;
+
+/** Shared discriminator base; every server frame sets a unique `type`. */
+interface WsServerMessageBase {
+  type: "snapshot" | "step" | "status" | "error" | "headChange";
+}
+
+/**
+ * Full state pushed once when a client connects: the agent's current lifecycle
+ * state, the complete step list, and the HEAD pointer. Operator results are 
not
+ * included — they are pulled on demand via `GET /operator-results`.
+ */
+export interface WsServerSnapshotMessage extends WsServerMessageBase {
+  type: "snapshot";
+  state: AgentState;
+  steps: ReActStep[];
+  headId: string;
+}
+
+/**
+ * A single ReAct step, streamed live as the agent runs.
+ */
+export interface WsServerStepMessage extends WsServerMessageBase {
+  type: "step";
+  step: ReActStep;
+}
+
+/**
+ * An agent lifecycle transition (e.g. GENERATING when a run starts, the 
resting
+ * state when it ends, STOPPING on stop).
+ */
+export interface WsServerStatusMessage extends WsServerMessageBase {
+  type: "status";
+  state: AgentState;
+}
+
+/** An error surfaced to the client (agent not found, bad request, failed 
run). */
+export interface WsServerErrorMessage extends WsServerMessageBase {
+  type: "error";
+  error: string;
+}
+
+/**
+ * Emitted after a checkout: HEAD moved, carrying the full step list and the
+ * workflow snapshot at the new head.
+ *
+ * @deprecated Redundant and unused — the checkout flow that produces this 
frame
+ * is unreachable in the product (nothing invokes the client's 
`checkoutStep()`).
+ * Scheduled for removal (see #5930); do not build new code on it.
+ */
+export interface WsServerHeadChangeMessage extends WsServerMessageBase {
+  type: "headChange";

Review Comment:
   Fixed



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to