feat(tauri): support workspace file links#2476
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (5)
✅ Files skipped from review due to trivial changes (1)
📝 WalkthroughWalkthroughThis PR implements a unified workspace-file interaction layer for the Tauri desktop app. It adds frontend link-parsing utilities, backend Tauri commands for opening/revealing/previewing workspace files with path containment validation, TypeScript command wrappers, and upgrades chat markdown rendering to handle workspace links alongside external URLs. ChangesWorkspace File Links and Path Operations
Estimated code review effort🎯 4 (Complex) | ⏱️ ~45 minutes Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (1 warning, 1 inconclusive)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
ESLint skipped: no ESLint configuration detected in root package.json. To enable, add Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
gitbooks/developing/architecture/tauri-shell.md (1)
151-160: 💤 Low valueWell-documented workspace file link commands.
The documentation clearly explains the three new commands and their path safety constraints. All security considerations from the PR are covered: workspace-relative paths only, canonicalization, and rejection of traversal/absolute/URI/symlink escapes.
Optional: Consider adding issue reference for traceability
For consistency with the screen share section (line 143, which references
#713and#812), you could optionally mention that this closes issue#1402:### Workspace file links -From **`workspace_paths.rs`**. These commands accept workspace-relative paths only. The shell resolves each path against the active OpenHuman workspace, canonicalizes the target, and rejects traversal, absolute paths, URI-like prefixes, and symlink escapes before opening or reading anything. +From **`workspace_paths.rs`**. These commands accept workspace-relative paths only. The shell resolves each path against the active OpenHuman workspace, canonicalizes the target, and rejects traversal, absolute paths, URI-like prefixes, and symlink escapes before opening or reading anything. See issue `#1402` (workspace file interactions).This adds traceability similar to other command sections, but is not essential.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@gitbooks/developing/architecture/tauri-shell.md` around lines 151 - 160, Add an optional issue reference for traceability by appending a short note in this section (near the Workspace file links header or the screen-share style reference) that indicates this documentation closes issue `#1402`; update the prose around the list or add a parenthetical “(closes `#1402`)” so readers can trace the implementation to the issue, referencing the workspace_paths.rs commands open_workspace_path, reveal_workspace_path, and preview_workspace_text when placing the note.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@app/src-tauri/permissions/allow-core-process.toml`:
- Around line 114-123: The allow-core-process TOML currently includes
workspace-file commands ("open_workspace_path", "reveal_workspace_path",
"preview_workspace_text"), widening a high-privilege bundle; create a new
permission TOML (e.g., allow-workspace-files) containing only those three
command identifiers, remove them from allow-core-process, and then update
capability grant files under app/src-tauri/capabilities/ to replace any grant of
allow-core-process with a grant for allow-workspace-files where only
workspace-file access is required so UI surfaces request the narrower
permission.
In `@app/src/utils/workspaceLinks.ts`:
- Around line 16-24: After calling decodeURIComponent on rawPath (the decoded
variable), immediately reject any decoded NUL bytes by checking for '\0' (or
char code 0) and returning null if found; update the logic in workspaceLinks.ts
right after the try/catch that sets decoded and before creating normalized so
that a decoded string containing NUL is treated as invalid (preserving the
existing WINDOWS_DRIVE_RE and normalized checks).
---
Nitpick comments:
In `@gitbooks/developing/architecture/tauri-shell.md`:
- Around line 151-160: Add an optional issue reference for traceability by
appending a short note in this section (near the Workspace file links header or
the screen-share style reference) that indicates this documentation closes issue
`#1402`; update the prose around the list or add a parenthetical “(closes `#1402`)”
so readers can trace the implementation to the issue, referencing the
workspace_paths.rs commands open_workspace_path, reveal_workspace_path, and
preview_workspace_text when placing the note.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 56615497-6482-4b9e-ab1a-b5945727268d
📒 Files selected for processing (11)
app/src-tauri/permissions/allow-core-process.tomlapp/src-tauri/src/lib.rsapp/src-tauri/src/workspace_paths.rsapp/src/pages/conversations/components/AgentMessageBubble.test.tsxapp/src/pages/conversations/components/AgentMessageBubble.tsxapp/src/utils/tauriCommands/index.tsapp/src/utils/tauriCommands/workspacePaths.test.tsapp/src/utils/tauriCommands/workspacePaths.tsapp/src/utils/workspaceLinks.test.tsapp/src/utils/workspaceLinks.tsgitbooks/developing/architecture/tauri-shell.md
There was a problem hiding this comment.
🧹 Nitpick comments (1)
app/src/lib/i18n/chunks/de-5.ts (1)
504-526: 🏗️ Heavy liftSplit this locale chunk before it grows further.
Line 526 keeps this source above the preferred ~500-line limit; please split
de-5.tsinto smaller namespace-focused chunks to preserve readability and single responsibility.As per coding guidelines "
**/*.{js,ts,tsx,jsx}: Prefer files ≤ ~500 lines per source file; split modules when growing to maintain readability and single responsibility."🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@app/src/lib/i18n/chunks/de-5.ts` around lines 504 - 526, The de-5.ts locale file has grown past the ~500-line guideline; extract the MCP-server keys (all entries with the 'settings.mcpServer.*' and related 'settings.developerMenu.mcpServer.*' keys shown) into a new, smaller locale chunk (e.g., a namespace-focused de-xxx file), export that chunk the same shape as the existing locale object, and remove those keys from de-5.ts; then update the locale aggregator where chunks are combined to import and merge the new MCP chunk so runtime behavior and key names (settings.mcpServer.* and settings.developerMenu.mcpServer.*) remain unchanged.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Nitpick comments:
In `@app/src/lib/i18n/chunks/de-5.ts`:
- Around line 504-526: The de-5.ts locale file has grown past the ~500-line
guideline; extract the MCP-server keys (all entries with the
'settings.mcpServer.*' and related 'settings.developerMenu.mcpServer.*' keys
shown) into a new, smaller locale chunk (e.g., a namespace-focused de-xxx file),
export that chunk the same shape as the existing locale object, and remove those
keys from de-5.ts; then update the locale aggregator where chunks are combined
to import and merge the new MCP chunk so runtime behavior and key names
(settings.mcpServer.* and settings.developerMenu.mcpServer.*) remain unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 8121d2c8-fdcd-4191-b8f8-7604c706ed60
📒 Files selected for processing (2)
app/src/lib/i18n/chunks/de-3.tsapp/src/lib/i18n/chunks/de-5.ts
|
Clarification for the CodeRabbit pre-merge note: the German i18n additions are intentional CI-gate cleanup, not a separate feature. |
|
CI is green and the CodeRabbit threads are resolved. Ready for reviewer pass / merge when convenient. |
|
@graycyrus Could you take a reviewer pass on this when convenient? CI is green, CodeRabbit is approved, and there are no unresolved review threads on the PR. The German i18n additions are only to satisfy the current i18n gate. |
Summary
workspace:/openhuman-workspace:link parsing and routes chat markdown workspace links through the new Tauri command.file://markdown links blocked and preserves existing externalhttp(s)/mailto:handling.Problem
Agents and UI surfaces can reference files produced under the OpenHuman workspace, but the desktop app did not have a safe first-party path for handling those workspace file links. Using raw filesystem URLs would either be blocked by the existing link policy or risk bypassing workspace boundaries.
Solution
open_workspace_path,reveal_workspace_path, andpreview_workspace_textTauri commands.react-markdownURL filtering and are dispatched through the guarded Tauri command.Submission Checklist
## Related— N/A: no matrix feature ID applies.docs/RELEASE-MANUAL-SMOKE.md) — N/A: no release smoke flow changes.Closes #NNNin the## RelatedsectionImpact
file://links remain blocked; Rust canonicalization guards against path traversal and symlink escapes.Related
preview_workspace_textonce the file-view surface is designed.AI Authored PR Metadata (required for Codex/Linear PRs)
Linear Issue
Commit & Branch
feat/1402-workspace-file-linksc8745d8cValidation Run
pnpm --filter openhuman-app format:check(via pre-push hook)pnpm typecheck(pnpm --filter openhuman-app compile)pnpm --filter openhuman-app test:unit src/utils/workspaceLinks.test.ts src/utils/tauriCommands/workspacePaths.test.ts src/pages/conversations/components/AgentMessageBubble.test.tsx(11 passed)cargo fmt --manifest-path app/src-tauri/Cargo.toml -- --check;GGML_NATIVE=OFF cargo check --manifest-path app/src-tauri/Cargo.toml; pre-pushpnpm --filter openhuman-app rust:checkGGML_NATIVE=OFF cargo test --manifest-path app/src-tauri/Cargo.toml workspace_paths::tests(6 passed)pnpm --filter openhuman-app exec eslint src/utils/workspaceLinks.ts src/utils/workspaceLinks.test.ts src/utils/tauriCommands/workspacePaths.ts src/utils/tauriCommands/workspacePaths.test.ts src/pages/conversations/components/AgentMessageBubble.tsx src/pages/conversations/components/AgentMessageBubble.test.tsxgit diff --checkValidation Blocked
command:N/Aerror:N/Aimpact:N/ABehavior Changes
workspace:oropenhuman-workspace:links to open workspace-contained files through guarded Tauri commands.Parity Contract
http:,https:, andmailto:links still route throughopenUrl; rawfile://links remain blocked.Duplicate / Superseded PR Handling
Summary by CodeRabbit
New Features
workspace:protocol links to open, reveal, or preview files within their workspace.Documentation