Repository navigation
feat(tools): web_search method, auth headers and field mapping - #451
Merged
Merged
Conversation
TOLE_WEB_SEARCH_METHOD (GET default, POST with {"query","limit"}),
TOLE_WEB_SEARCH_HEADERS (Name=Value pairs, ${VAR} expanded from the
environment, sent only to the backend; transport headers and line
breaks refused; errors never echo a value) and TOLE_WEB_SEARCH_FIELDS
(wire=backend, e.g. snippet=description,results=items) let backends
such as nginjen plug in without an adapter. A malformed value fails
startup. WebSearchTool::from_env now returns Result<Option<Self>, String>.
🔍 Cora AI Code Review
Review powered by cora-code · BYOK · MIT |
Contributor
Author
|
Merged on the Cora agent-as-reviewer verdict ( |
Merged
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
web_searchcan talk to backends beyond the fleet contract:TOLE_WEB_SEARCH_METHOD,TOLE_WEB_SEARCH_HEADERSandTOLE_WEB_SEARCH_FIELDS.Closes #436.
Why
nginjen (the fleet's own search backend) answers only
POST /searchwith{"query","limit"}, needsAuthorization: Bearer <key>, and returnsdescriptioninstead ofsnippet; it could not be plugged in without a shim.Changes
tole-core/src/web.rs:SearchMethod(GET ?q=default;POSTwith JSON{"query", "limit": 8}, the nginjen request shape).TOLE_WEB_SEARCH_HEADERS:Name=Valuepairs separated by commas;${VAR}expanded from the environment (unset/blank is an error naming the variable); names must be RFC 9110 tokens;Host,Content-Length,Transfer-Encoding,Connection,Content-Typerefused; CR/LF/NUL in a value refused; no error or description ever contains a value. Headers go only to the backend (the search agent follows no redirects).TOLE_WEB_SEARCH_FIELDS:wire=backendforresults,title,url,snippet; unknown wire fields are errors. The default contract is unchanged.WebSearchTool::from_env()returnsResult<Option<Self>, String>; newWebSearchTool::new(url)andfrom_lookup(env).tole-cli/src/tool_roster.rs: a malformed search config fails startup instead of silently dropping the tool.docs/epics.md,docs/threat-model.md(credential scope).Testing
${VAR}expansion, every rejection path asserts the secret is not echoed (incl. a line break smuggled through a variable), method and field parsing.{"query","limit"},Authorization: Bearerreceived,descriptionmapped tosnippet,results=items.${VAR}and a reserved header failtole runnaming the variable/header, never the value.cargo fmt, clippy (workspace all-targets, bare, shell-tools, mcp, tole-core bare),cargo test --workspace: green. Cora agent review (prepare + finalize): 0 findings,should_block: false.