feat(tools): HTTP tool runtime (MVP, closes #20)#54
Merged
Conversation
- Add httptool package: map uses operation to method/path, JSON body for POST/PUT/PATCH, env: header resolution, retries for 5xx/transport (not 4xx) - Wire registry dispatch for type http with ToolHTTP + optional ToolRetry - Tests: httptest success, env headers, 404 single attempt, 503 recovery, registry integration Closes #20 Made-with: Cursor
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.
Summary
Implements the MVP HTTP tool transport for
spec.type: httpas described in issue #20 and the design doc (HTTP tools / operation mapping).What changed
internal/tools/http(package httptool):Executeruns a logical HTTP call from workflowuses(tool.<name>.<operation>→ operation string passed through).get|post|put|delete|patch(case-insensitive) selects the method; remaining dot segments become the path (/-joined). Otherwise GET with the full dotted path.baseUrl+ optional staticheaders; header values supportenv:VARvia existingmodels.ResolveAPIKeyFrom.withmap (empty object if nil).spec.retry(maxAttempts,backoff) for transport errors and 5xx; 4xx are client errors and are not retried.internal/toolsdispatchestype: httptohttptool.Execute(defaulthttp.Client).Tests
httptest.Serversuccess path and registry e2e.maxAttempts > 1: exactly one HTTP request (no retry).parseOperationsmoke for POST path shape.Verification
make fmtmake test(with-race)make vetCloses #20
Made with Cursor