Yicong-Huang commented on code in PR #5751:
URL: https://github.com/apache/texera/pull/5751#discussion_r3448994813


##########
agent-service/src/types/ws.ts:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+// WebSocket frames for this service's own protocol (/agents/:id/react):
+// inbound client messages and the outbound streaming updates it pushes back.
+
+import type { ReActStep } from "./agent";
+import type { WorkflowContent } from "./workflow";
+
+export interface WsMessage {
+  type: "message" | "stop";

Review Comment:
   rename to `prompt` and `kill-command`



##########
agent-service/src/types/ws.ts:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+// WebSocket frames for this service's own protocol (/agents/:id/react):
+// inbound client messages and the outbound streaming updates it pushes back.
+
+import type { ReActStep } from "./agent";
+import type { WorkflowContent } from "./workflow";
+
+export interface WsMessage {
+  type: "message" | "stop";
+  content?: string;
+  messageSource?: "chat" | "feedback";
+}
+
+export interface OperatorResultSummaryWs {
+  state: string;
+  inputTuples: number;
+  outputTuples: number;
+  inputPortShapes?: { portIndex: number; rows: number; columns: number }[];

Review Comment:
   inputPortsDataShape?



##########
agent-service/src/types/ws.ts:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+// WebSocket frames for this service's own protocol (/agents/:id/react):
+// inbound client messages and the outbound streaming updates it pushes back.
+
+import type { ReActStep } from "./agent";
+import type { WorkflowContent } from "./workflow";
+
+export interface WsMessage {
+  type: "message" | "stop";
+  content?: string;
+  messageSource?: "chat" | "feedback";
+}
+
+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>;
+}
+
+export interface WsOutgoingMessage {
+  type: "step" | "state" | "error" | "complete" | "init" | "headChange";
+  step?: ReActStep;
+  state?: string;
+  error?: string;
+  steps?: ReActStep[];
+  headId?: string;
+  operatorResults?: Record<string, OperatorResultSummaryWs>;
+  workflowContent?: WorkflowContent;
+}

Review Comment:
   you need to seperate them into their own definition. don't mix them together.



##########
agent-service/src/types/api.ts:
##########
@@ -0,0 +1,95 @@
+/**
+ * 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.
+ */
+
+// Wire DTOs: request/response bodies exchanged with backend services and the
+// WebSocket frames this service sends to its own clients. Distinct from domain
+// types (workflow.ts, execution.ts, agent.ts) which model in-memory state.
+
+import type { WorkflowContent, OperatorPortSchemaMap } from "./workflow";
+import type { ReActStep } from "./agent";
+
+// --- Dashboard Service: workflow persistence ---
+
+export interface Workflow {
+  wid: number;
+  name: string;
+  description?: string;
+  content: WorkflowContent;
+  creationTime?: number;
+  lastModifiedTime?: number;
+  isPublished?: boolean;
+}
+
+export interface WorkflowPersistRequest {
+  wid?: number;
+  name: string;
+  description?: string;
+  content: string;
+  isPublic?: boolean;
+}
+
+// --- Workflow Compiling Service ---
+
+export interface WorkflowFatalError {
+  message: string;
+  details: string;
+  operatorId: string;
+  workerId: string;
+  type: { name: string };
+  timestamp: { nanos: number; seconds: number };
+}
+
+export interface WorkflowCompilationResponse {
+  physicalPlan?: any;
+  operatorOutputSchemas: Record<string, OperatorPortSchemaMap>;
+  operatorErrors: Record<string, WorkflowFatalError>;
+}

Review Comment:
   let's make sure this is aligned with our gui naming



##########
agent-service/src/types/ws.ts:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+// WebSocket frames for this service's own protocol (/agents/:id/react):
+// inbound client messages and the outbound streaming updates it pushes back.
+
+import type { ReActStep } from "./agent";
+import type { WorkflowContent } from "./workflow";
+
+export interface WsMessage {
+  type: "message" | "stop";

Review Comment:
   inherit on interface, define `kill-command` seperately



##########
agent-service/src/types/ws.ts:
##########
@@ -0,0 +1,55 @@
+/**
+ * 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.
+ */
+
+// WebSocket frames for this service's own protocol (/agents/:id/react):
+// inbound client messages and the outbound streaming updates it pushes back.
+
+import type { ReActStep } from "./agent";
+import type { WorkflowContent } from "./workflow";
+
+export interface WsMessage {
+  type: "message" | "stop";
+  content?: string;
+  messageSource?: "chat" | "feedback";
+}
+
+export interface OperatorResultSummaryWs {
+  state: string;
+  inputTuples: number;
+  outputTuples: number;
+  inputPortShapes?: { portIndex: number; rows: number; columns: number }[];

Review Comment:
   should this be output?



##########
agent-service/src/auth/jwt.test.ts:
##########
@@ -0,0 +1,68 @@
+/**
+ * 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.
+ */
+
+import { describe, expect, test } from "bun:test";
+import { extractUserFromToken, validateToken, createAuthHeaders } from "./jwt";
+
+function makeToken(payload: Record<string, unknown>): string {
+  const encode = (o: Record<string, unknown>) => 
Buffer.from(JSON.stringify(o)).toString("base64");
+  return `${encode({ alg: "none", typ: "JWT" })}.${encode(payload)}.signature`;

Review Comment:
   check the encoding on the sign side (Auth service)



-- 
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