Skip to content

Clean up agent-service code structure and reconcile its types with the frontend #5563

@bobbai00

Description

@bobbai00

Task Summary

The agent-service/ (Bun/TS) codebase has accumulated structural inconsistencies that hurt readability and risk silent wire-contract bugs.

Code structure

Problem Detail
Definitions scattered ~25 interfaces/types live in client/tool/util/server files instead of types/
Duplicate definitions LogicalPlan / PortSchema / InputPortInfo defined twice; AgentSettingsApi is field-for-field identical to UpdateAgentSettingsRequest
Impure "clients" api/ mixes HTTP clients with types, endpoint config, and JWT helpers; the execution HTTP client lives in agent/tools/, while api/execution-api.ts holds only types
Misleading naming AgentDelegateConfig is a runtime binding (not config) and is re-declared inline 3× with conflicting shapes; *Config is used for non-config objects
Duplicate logic jsonToTableFormat and the input/output-shape formatter are duplicated across two files

Inconsistency with the frontend wire contract

The agent reads/writes the same workflow and compile payloads as the Angular frontend, but several types/ definitions have drifted from frontend/src/app/.../*.interface.ts:

Type agent-service (current) frontend (source of truth)
CommentBox {commentBoxID, comments: string, x, y, width, height} {commentBoxID, comments: Comment[], commentBoxPosition: Point}
WorkflowSettings missing executionMode {dataTransferBatchSize, executionMode}
WorkflowFatalError {type: string, message, operatorId?} {message, details, operatorId, workerId, type: {name}, timestamp}

These avoid runtime breakage today only because the code reads a subset of the fields and passes the rest through opaquely — they are latent bugs, not correct shapes.

Task Type

  • Refactor / Cleanup
  • DevOps / Deployment / CI
  • Testing / QA
  • Documentation
  • Performance
  • Other

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No fields configured for Task.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions