refactor(agent-service): centralize backend DTOs, metadata, endpoint config, and auth#5928
Draft
bobbai00 wants to merge 2 commits into
Draft
refactor(agent-service): centralize backend DTOs, metadata, endpoint config, and auth#5928bobbai00 wants to merge 2 commits into
bobbai00 wants to merge 2 commits into
Conversation
Move the inline WS message definitions out of server.ts into a dedicated types/ws module, modeled as discriminated unions rather than one all-optional interface: - client.ts: WsClientRequest = WsClientRequestPrompt | WsClientRequestStopCommand - server.ts: WsServerMessage union (init/step/state/complete/error/headChange) + OperatorResultSummaryWs - index.ts: barrel, re-exported from the types barrel The client->server wire discriminator changes from "message"/"stop" to "prompt"/"command" (stop becomes commandType: "stop"); server->client `type` values are unchanged. server.ts parses WsClientRequest and switches on the new shapes, and the frontend WS sends are updated in lockstep. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
…config, and auth Consolidate the agent-service type/config layer. Stacked on the WS PR (apache#5751); types/execution.ts is left untouched (its redesign is a separate PR). - types/dto.ts: backend request/response DTOs (workflow persistence, compiling-service responses, WorkflowFatalError). - types/metadata.ts: operator-metadata types extracted from api/backend-api. - config/endpoints.ts: getServiceEndpoints() centralizing backend base URLs. - auth/jwt.ts: relocated from api/auth-api; update import paths. - Replace `any` with precise types across src/types/*; type ReActStep tool/message fields precisely. - Consume the centralized types at call sites (clients, server, agent utils). - Expand test coverage (jwt, workflow-system-metadata, compile/workflow clients); rename *.test.ts -> *.spec.ts. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_012qFkyrpTd5PrkNBPcBeo4Q
Contributor
Automated Reviewer SuggestionsBased on the
|
This was referenced Jun 24, 2026
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #5928 +/- ##
============================================
+ Coverage 54.60% 55.02% +0.42%
Complexity 2927 2927
============================================
Files 1109 1109
Lines 42828 42817 -11
Branches 4608 4608
============================================
+ Hits 23385 23561 +176
+ Misses 18081 17894 -187
Partials 1362 1362
*This pull request uses carry forward flags. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
This was referenced Jun 24, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this PR?
Centralizes the agent-service type/config layer (no runtime behavior change). Stacked on #5751 (the WS-types PR).
types/dto.ts— backend request/response DTOs (workflow persistence, compiling-service responses,WorkflowFatalError).types/metadata.ts— operator-metadata types extracted fromapi/backend-api.config/endpoints.ts—getServiceEndpoints()centralizing backend base URLs.auth/jwt.ts— relocated fromapi/auth-api; import paths updated.anywith precise types acrosssrc/types/*; typeReActSteptool/message fields.workflow-system-metadata, compile/workflow clients) and rename*.test.ts→*.spec.ts.types/execution.tsis intentionally untouched here — its redesign is #5927.Any related issues, documentation, discussions?
Closes #5748
Part of #5747.
How was this PR tested?
bunx tsc --noEmit,bun test(126 pass / 0 fail), andprettier --checkall pass inagent-service.Was this PR authored or co-authored using generative AI tooling?
Generated-by: Claude Opus 4.8 (1M context)