Skip to content

feat(selector): inline native path picker for ambiguous paths#212

Open
hazemahmedx0 wants to merge 4 commits into
stagingfrom
feat/inline-path-selector
Open

feat(selector): inline native path picker for ambiguous paths#212
hazemahmedx0 wants to merge 4 commits into
stagingfrom
feat/inline-path-selector

Conversation

@hazemahmedx0

@hazemahmedx0 hazemahmedx0 commented Jun 21, 2026

Copy link
Copy Markdown
Member

This is the client half of the inline path picker. When the agent isn't sure which file or folder you meant, a small card appears inline in the chat, you pick, and the turn keeps going. No new message from you, no interruption.

Before

image

After

Screenshot 2026-06-22 at 2 16 27 AM

https://www.loom.com/share/5495d1aff1a7488db532fbdbd0f55926

What's in here:

  • A PathSelector card that renders inline when the stream carries a pending selection. Pick mode lists the concrete candidates the agent found. Browse mode shows a button that opens the native OS picker.
  • Native picker through Electron. A dialog:pick-path IPC channel and main-process handler call dialog.showOpenDialog, so browse mode uses Finder or Explorer, the same way Claude Cowork's "Choose folder" does. No in-app file tree.
  • The pick is posted back to the server, and the card flips to a resolved state once that POST lands.

A few things this revision tightens:

  • Browse mode is native only now. The in-app directory browser and its listDirectory call are gone, so there's no second filesystem-listing path to maintain or secure.
  • Submitting awaits the POST and shows an error if it fails, instead of firing and forgetting. Only a real 404 is treated as not-pending. Anything else surfaces.
  • The Thinking indicator stays hidden while a selection card is showing, so the UI doesn't look stuck.
  • When kind is "any", the card offers both Choose file and Choose folder. On the web (no native picker) it falls back to a clear "Desktop app required" note.

Depends on the cowork-server selection endpoint and SSE selection events, which in turn depend on the anton select_path tool. Merge bottom up: anton, then cowork-server, then this.

Tested end to end against the local stack.


Part of the inline path picker stack. Merge bottom up:

  1. anton: feat(select_path): inline file/folder picker for ambiguous paths anton#197 (the select_path tool and elicitor protocol)
  2. cowork-server: feat(selection): stream select_path requests and resolve picks mid-turn cowork-server#77 (streams the request, resolves the pick)
  3. cowork: feat(selector): inline native path picker for ambiguous paths #212 (this PR, the native OS picker UI)

Related but independent: mindshub_inference #302 (https://github.com/mindsdb/mindshub_inference/pull/302) is the image side of the same multimodal and file effort. It translates image_url blocks for every provider and transcodes unsupported image types to PNG. It does not depend on this stack and this stack does not depend on it.

Renders an inline picker inside the streaming assistant turn when the agent's
select_path tool asks to disambiguate a path — never a separate chat bubble.

- responseStreamAdapter: pure pendingSelection field; set on
  response.selection.requested, cleared on terminal events.
- App: thread pendingSelection into the _streaming message (all stream paths).
- api: submitPathSelection() POSTs the pick (or null cancel) to
  /responses/selection.
- PathSelector: keyed-by-requestId card; on pick/dismiss it POSTs and collapses
  to a one-line confirmation while the agent continues. The choice returns as
  the tool result, so there is no synthetic user message.
PathSelector now navigates the filesystem (listDirectory) and selects a file or
folder when the agent asks in browse mode; pick-mode candidate list unchanged.
Reducer carries mode/root through pendingSelection.
Browse mode now opens the native Finder/Explorer via dialog.showOpenDialog
(IPC dialog:pick-path → preload pickPath → host.pickPath), shown as a single
"Choose folder"/"Choose file" button — like Claude Cowork — instead of an
in-app file tree. The custom /fs/list browser is kept only as the web fallback
(no native dialog in the browser shell).
Removes the in-app file browser and the listDirectory call so browse mode
always goes through the native OS picker, matching how Claude Cowork does it.
The submit now awaits the POST and shows an error if it fails instead of
firing and forgetting, only swallows a real 404 as not-pending, and keeps the
Thinking indicator hidden while a selection card is pending.
@hazemahmedx0 hazemahmedx0 requested a review from a team as a code owner June 21, 2026 21:45
@entelligence-ai-pr-reviews

Copy link
Copy Markdown

Automatic Review Skipped

Too many files for automatic review.

If you would still like a review, you can trigger one manually by commenting:

@entelligence review

Comment thread scripts/strip-xattrs.js Dismissed
@hazemahmedx0 hazemahmedx0 changed the base branch from main to staging June 21, 2026 21:49
@hazemahmedx0

Copy link
Copy Markdown
Member Author

@Entelligence review

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants