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
Task Summary
The
agent-service/(Bun/TS) codebase has accumulated structural inconsistencies that hurt readability and risk silent wire-contract bugs.Code structure
types/LogicalPlan/PortSchema/InputPortInfodefined twice;AgentSettingsApiis field-for-field identical toUpdateAgentSettingsRequestapi/mixes HTTP clients with types, endpoint config, and JWT helpers; the execution HTTP client lives inagent/tools/, whileapi/execution-api.tsholds only typesAgentDelegateConfigis a runtime binding (not config) and is re-declared inline 3× with conflicting shapes;*Configis used for non-config objectsjsonToTableFormatand the input/output-shape formatter are duplicated across two filesInconsistency 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 fromfrontend/src/app/.../*.interface.ts:CommentBox{commentBoxID, comments: string, x, y, width, height}{commentBoxID, comments: Comment[], commentBoxPosition: Point}WorkflowSettingsexecutionMode{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