Files
omnigent-ai--omnigent/openapi.json
T
antoniopinheirofilho d97426ec02 feat(workspace-picker): add "New folder" action to the new-session picker (#364)
* feat(workspace-picker): add "New folder" action to the new-session picker

The workspace picker could only select existing directories — creating a
new folder meant leaving the UI for Finder or a terminal. This adds an
inline "New folder" action across the full stack:

- host frame protocol: new `host.create_dir` / `host.create_dir_result`
  frames (frames.py) + host-side `_handle_create_dir` using os.makedirs,
  reporting "already exists"/"permission denied" as expected errors
  rather than failures (connect.py).
- server: `pending_create_dirs` correlation map (host_registry.py),
  result routing (host_tunnel.py), and a `POST /v1/hosts/{id}/directories`
  endpoint that proxies the frame (hosts.py). Owner-scoped exactly like
  the existing filesystem-browse endpoints; the workspace-boundary check
  still runs at session-create time.
- web UI: `createHostDirectory` + `useCreateHostDirectory` hook and a
  "New folder" button + inline name input in WorkspacePicker, which on
  success navigates into the freshly created directory.

Tests: frame round-trips, host handler (create/parents/exists/tilde),
the new REST route end-to-end against a mock host tunnel, the path-join
helper, the hook's request/error handling, and the picker's create flow.

Co-authored-by: Isaac
Signed-off-by: Antonio <antonio.pinheirofilho@databricks.com>

* style(workspace-picker): align new-folder form and simplify Create to an icon button

Match the new-folder form's padding/gap to the directory rows (px-3,
gap-2) so the folder icon and input line up with the entries below.
Replace the filled "Create" button with a borderless check-icon button
mirroring the cancel "X", so the two inline actions read as a matched
icon-button pair.

Co-authored-by: Isaac

* fix(host): distinguish a file from a directory in create_dir conflict

os.makedirs raises FileExistsError whether the leaf path is an existing
directory or a regular file; the handler reported "directory already
exists" for both. Check os.path.isdir so a file in the way is labelled
accurately. Adds a test for the leaf-is-a-file case.

Co-authored-by: Isaac

* test(e2e-ui): cover create-folder → new session workspace

Drives the new-session picker: navigate into a folder, click "New
folder", name it, Create. Asserts the picker POSTs the joined path to
/v1/hosts/{id}/directories, drops into the new folder, and that the
created path reaches POST /v1/sessions as `workspace` — i.e. the agent's
working directory is the folder the user just made. Mirrors the existing
select-folder test (stubbed host filesystem + captured create).

Co-authored-by: Isaac

* style(ap-web): wrap useHostFilesystem.test import per Prettier

The rebase conflict resolution left a single-line import that exceeds
Prettier's print width, failing the pre-commit lint gate. Wrap it.

Co-authored-by: Isaac

* fix(workspace-picker): allow creating the first folder in an empty home

The home view derives its absolute path from the first listing entry, so
an empty home (no entries) never resolves and left the "New folder"
button permanently disabled — even though the host expands ~. Fall back
to "~" as the create base once the listing has loaded, so the first
folder in an empty home can be created. Still disabled while loading.

Co-authored-by: Isaac

* chore(openapi): regenerate spec for POST /v1/hosts/{id}/directories

The new create-directory route and CreateDirectoryRequest schema were
missing from the checked-in openapi.json, failing the drift guard
(tests/server/test_openapi_drift.py). Regenerated via
scripts/dump_openapi.py.

Co-authored-by: Isaac

* test(ap-web): add useCreateHostDirectory to NewChatDialog hook mocks

NewChatDialog renders the real WorkspacePicker, which now calls
useCreateHostDirectory on mount. The test files mock
@/hooks/useHostFilesystem without that export, so the picker threw
"No useCreateHostDirectory export is defined on the mock". Add an idle
mutation to both mocks.

Co-authored-by: Isaac

---------

Signed-off-by: Antonio <antonio.pinheirofilho@databricks.com>
Co-authored-by: Serena Ruan <serena.rxy@gmail.com>
2026-06-17 09:02:39 +00:00

313 KiB