refactor(agent-service): extract tool utilities and simplify server wiring#5754
Draft
bobbai00 wants to merge 3 commits into
Draft
refactor(agent-service): extract tool utilities and simplify server wiring#5754bobbai00 wants to merge 3 commits into
bobbai00 wants to merge 3 commits into
Conversation
…module Foundation slice of the agent-service reorganization (no runtime behavior change): - Add src/types/api.ts (wire DTOs) and src/types/metadata.ts (operator metadata types extracted out of api/backend-api.ts); export both from the types barrel. - Add src/config/endpoints.ts exposing getServiceEndpoints(). - Move src/api/auth-api.ts -> src/auth/jwt.ts (content unchanged) and add src/auth/jwt.test.ts; update auth import paths. - Keep api/backend-api.ts transitional: it now imports/re-exports the metadata types from ../types/metadata and retains getBackendConfig/fetchOperatorMetadata, which the follow-up clients PR relocates. The types/agent.ts and types/workflow.ts reshaping is deferred to the PR that also updates server.ts/workflow-state.ts, since those renames are coupled.
Second slice of the agent-service reorganization (no runtime behavior change): - Rename the per-service HTTP clients to *-client.ts: compile-api -> compile-client, workflow-api -> workflow-client, and split operator-metadata fetching into operator-metadata-client.ts; add a dedicated execution-client.ts for workflow execution calls. All clients now read base URLs via getServiceEndpoints(). - Rewire api/index.ts to the new client modules. - Add unit tests for all four clients. - Add the additive ExecutionRequestParams type (types/agent.ts) and ExecutionMode enum + optional WorkflowSettings.executionMode (types/workflow.ts) needed by the new client and its test; the follow-up server/state PR completes the workflow.ts reshaping and makes executionMode required. - Trim api/backend-api.ts to just getBackendConfig (transitional); the remaining server/tools consumers switch to getServiceEndpoints in the follow-up PR. Consumer changes are import-path-only; no logic was modified.
…iring Final slice of the agent-service reorganization (no runtime behavior change): - Extract shared tool helpers into agent/tools/tools-utility.ts and slim result-formatting.ts and workflow-execution-tools.ts accordingly. - Tidy texera-agent.ts and agent/util/* (workflow-system-metadata, workflow-utils). - Simplify server.ts / index.ts wiring and startup-banner logging; switch the remaining getBackendConfig consumers to getServiceEndpoints() and remove the now-unused api/backend-api.ts. - Complete the types reshaping deferred from the earlier slices: agent.ts delegation/settings DTO renames (AgentDelegateConfig -> AgentDelegation, AgentSettingsApi -> AgentSettingsDto) and workflow.ts Comment/CommentBox plus the now-required WorkflowSettings.executionMode, updating workflow-state.ts. - Add tests: texera-agent.test.ts, tools/workflow-execution-tools.test.ts, expanded server.test.ts and result-formatting.test.ts.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #5754 +/- ##
============================================
+ Coverage 53.04% 56.14% +3.10%
Complexity 2654 2654
============================================
Files 1094 1097 +3
Lines 42295 41991 -304
Branches 4545 4545
============================================
+ Hits 22434 23577 +1143
+ Misses 18545 17098 -1447
Partials 1316 1316
*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 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?
Final slice of the agent-service reorganization (no runtime behavior change):
agent/tools/tools-utility.ts; slimresult-formatting.tsandworkflow-execution-tools.ts.texera-agent.tsandagent/util/*(workflow-system-metadata,workflow-utils).server.ts/index.tswiring and startup-banner logging; switch the remaininggetBackendConfigconsumers togetServiceEndpoints()and remove the now-unusedapi/backend-api.ts.agent.tsDTO renames (AgentDelegateConfig→AgentDelegation,AgentSettingsApi→AgentSettingsDto) andworkflow.tsComment/CommentBoxplus the now-requiredWorkflowSettings.executionMode(updatingworkflow-state.ts).texera-agent.test.ts,tools/workflow-execution-tools.test.ts, and expandedserver.test.ts/result-formatting.test.ts.Any related issues, documentation, discussions?
Closes #5750
Part of #5747
How was this PR tested?
bunx tsc --noEmit,bun test(134 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)