feat(FileClient): forward include_hidden to /api/file/home and /search_subdirs#217
Conversation
…h_subdirs Add an optional includeHidden flag to FileHomeOptions and FileSearchSubdirsOptions so callers can request hidden (dot-) entries from the agent-server's file-browser endpoints. When unset, the param is omitted entirely so requests stay byte-identical to before (backward compatible). Also types the existing favorites/locations fields on FileHomeResponse as FileBrowserEntry[] (label, path), matching the agent-server's HomeResponse model. Needed by agent-canvas to add a 'Show hidden folders' toggle to the folder browser without reaching for the low-level HttpClient. Co-authored-by: openhands <openhands@all-hands.dev>
|
✅ Review complete. This review was performed through OpenHands Cloud Automation. You can log in and view the conversation here. |
all-hands-bot
left a comment
There was a problem hiding this comment.
🟢 Taste Rating: Good taste — this is a small, additive API extension that uses the existing request parameter machinery without changing default behavior.
No blocking issues found. include_hidden is only emitted when includeHidden is true, the old getHome() and searchSubdirectories(path) URLs remain unchanged when unset, and the added tests cover both the opt-in and omitted-parameter paths. CI is green across build, unit, integration, smoke, and security checks.
[RISK ASSESSMENT]
- [Overall PR]
⚠️ Risk Assessment: 🟢 LOW
Small typed-client surface addition with optional fields only, no dependency changes, no new security-sensitive code, and backward-compatible default request serialization.
VERDICT:
✅ Worth merging: Core logic is sound and the behavior is covered by tests.
KEY INSIGHT:
The patch cleanly threads one optional boolean through the existing HttpClient parameter path, preserving byte-identical requests for existing callers.
This review was generated by an AI agent (OpenHands) on behalf of the user through OpenHands Automation. View conversation
Why
agent-canvas wants a "Show hidden folders" toggle in its folder browser, but the agent-server's
/api/file/homeand/api/file/search_subdirsendpoints filter out hidden (dot-) entries by default. The server is gaining aninclude_hiddenquery param (OpenHands/software-agent-sdk#3740), but the typedFileClienthere has no way to forward it — so the frontend would be forced to construct the low-levelHttpClientdirectly, which agent-canvas's API-access guard explicitly bans.Summary
includeHiddenflag toFileHomeOptionsandFileSearchSubdirsOptions.FileClient.getHome({ includeHidden })andFileClient.searchSubdirectories(path, { includeHidden })now forwardinclude_hidden=truewhen set.favorites/locationsfields onFileHomeResponseasFileBrowserEntry[]({ label, path }), matching the agent-server'sHomeResponsemodel.Type
Backward compatibility
Purely additive: optional params/options only. Older agent-servers ignore the unknown
include_hiddenquery param, so consumers on a newer client + older server keep working (the toggle is just a no-op).How to Test
npm run build && npm test -- --testPathPatterns=api-clients— adds two tests:FileClient forwards includeHidden to the home and search_subdirs endpoints— asserts?include_hidden=trueis appended to both URLs when set.FileClient omits include_hidden when includeHidden is not set— asserts the param is absent (URL unchanged) when not set.All 55 api-clients tests pass; build + lint clean.
Linked
include_hiddenon/api/file/home+/api/file/search_subdirs).This PR was created by an AI agent (OpenHands) on behalf of the user.