Repository navigation
fix(webui): native Windows folder picker and rail project refresh - #77
Merged
Merged
Conversation
Replace the PowerShell/C# picker with a short-lived koffi worker that owns the modal IFileOpenDialog. The worker presses Alt immediately before Show so a dialog spawned by a background server still activates in front, and reports the selected path over IPC. Eligibility no longer depends on a TTY or WEBUI_OPEN_BROWSER: a local desktop loopback launch can create the picker. Add koffi to the package, update the installed-app acceptance driver, tests and install docs, and remove the PowerShell picker.
The rail reads the visible project list once when it mounts. Creating a session in a new directory refreshed the session catalogue but not the project records, so the new project appeared only after a page reload. Refresh the project list on the creation completion path. A project read failure stays retryable and does not undo the created session.
The native-directory grant still authorizes only the page that loads its one-time URL. A local desktop host that embeds the page cannot rely on the system browser opening that URL, so the launcher can now write the URL to an owner-only file when WEBUI_DESKTOP_HOST=1 and WEBUI_LAUNCH_URL_FILE is set. The file is written atomically after the listener starts, is never logged, and contains only the URL. A write failure is reported and the host falls back to the printed bare URL. Eligibility keeps the ordinary TTY requirement; WEBUI_DESKTOP_HOST opts a local embedded launch out of it. WEBUI_OPEN_BROWSER only gates the system browser, never the picker. SSH, full access, and non-loopback binds remain excluded, and the HTTP route's grant/cookie/browserKey checks are unchanged.
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.
Change
Three WebUI fixes from the Windows desktop flow:
IFileOpenDialog, sets per-monitor DPI awareness, and presses Alt immediately beforeShowso the dialog activates in front. The worker reports over IPC and is killed/awaited on abort. The PowerShell picker is removed.WEBUI_DESKTOP_HOST=1marks a locally hosted page that embeds the WebUI;WEBUI_LAUNCH_URL_FILE=<absolute path>names a private file. Once the listener is up, the launcher writes the page URL with its#nativeDirectoryGrantfragment to that file atomically, with 0600 access on POSIX (Windows keeps the file under the user-profile ACL), and never logs it. The host opens that URL in its own page, so the existingcaptureNativeDirectoryLaunchGrantpairing completes. Ordinary launches still require an interactive TTY;WEBUI_DESKTOP_HOST=1is the explicit opt-in for a local embedded launch.WEBUI_OPEN_BROWSER=0only suppresses the system browser and never disqualifies the picker. SSH, full access and non-loopback binds remain excluded.The native-directory route is deliberately unchanged: loopback, Host, Origin,
Sec-Fetch-Site, cookie, grant and browserKey checks all stay in force. The grant remains one-time and is only useful to the page that opens it; this change does not relax the boundary to token-only. A handoff write failure is logged without the URL, and the host falls back to the printed bare URL. The package declareskoffi3.1.1 (MIT), and the install/acceptance paths include it.Validation
node --test test/source-sync.test.mjs— 75 tests, 72 passed, 3 skipped, 0 failed.pnpm exec vitest run --config vitest.oss.config.mjs packages/webui/test/unit/task-session-workflows.test.ts— 24/24 passed.pnpm --filter @mavis/webui typecheck:client— passed.pnpm build:webui— passed.node scripts/source-inventory.mjs— passed.WEBUI_DESKTOP_HOST=1,WEBUI_LAUNCH_URL_FILE=<absolute path>,WEBUI_OPEN_BROWSER=0and no TTY. The file was created with no trailing newline and only the URL (token plus#nativeDirectoryGrant); the grant did not appear in stdout or logs, and the URL opened from the file.pnpm verifywas not run.Publication and contribution checks
release/public-source.json; new tests are declared intest/vitest-suites.jsonwhere applicable.Maintainer handoff
Publication scope or license changes:
koffi3.1.1 (MIT) is added to the WebUI npm package for the Windows dialog.Shared-source port: not needed.