FE-1658: Dock the Petrinaut AI assistant on the right - #9659
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview Layout and shortcuts: Canvas insets no longer stack the full assistant width on the properties panel—only the compact voice dock affects minimap/viewport offsets. The bottom toolbar centers on the full editor and shifts to clear docked panels. Cmd/Ctrl+Shift+K toggles the assistant (palette command + capture-phase listener); Cmd/Ctrl+K without Shift stays the command palette. Opening via toggle expands voice dock and focuses the composer. Polish: Assistant panel styling/header (dock/float controls), default width 420px, docs/changeset, and broad test coverage for shortcuts, docking lifecycle, and layout. Reviewed by Cursor Bugbot for commit a2ae04a. Bugbot is set up for automated code reviews on this repo. Configure here. |
There was a problem hiding this comment.
🟡 Changes recommended
The floating panel’s default position covers the canvas minimap.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds docked and movable floating layouts for Petrinaut’s AI assistant while preserving conversation state.
Changes:
- Adds dock/float controls, drag and keyboard positioning, resizing, and animations.
- Updates editor layout state and canvas insets.
- Adds tests, documentation, Storybook coverage, and a patch changeset.
File summaries
| File | Description |
|---|---|
.changeset/quiet-boats-dock.md |
Adds the package changeset. |
libs/@hashintel/petrinaut/docs/ai-assistant.md |
Documents docking and floating. |
libs/@hashintel/petrinaut/src/react/hooks/use-petrinaut-commands.test.tsx |
Updates context fixture. |
libs/@hashintel/petrinaut/src/react/hooks/use-petrinaut-mutations.test.tsx |
Updates context fixture. |
libs/@hashintel/petrinaut/src/react/state/editor-context.ts |
Adds assistant placement state. |
libs/@hashintel/petrinaut/src/react/state/editor-provider.tsx |
Implements placement updates and animation. |
libs/@hashintel/petrinaut/src/react/state/panel-defaults.ts |
Reduces the default assistant width. |
libs/@hashintel/petrinaut/src/ui/hooks/use-canvas-insets.test.ts |
Tests floating and docked insets. |
libs/@hashintel/petrinaut/src/ui/hooks/use-canvas-insets.ts |
Accounts for floating placement. |
libs/@hashintel/petrinaut/src/ui/views/Editor/editor-view.tsx |
Adds the dock column layout. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/SimulateView/experiments/experiments-story-fixtures.tsx |
Updates context fixture. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel.test.tsx |
Updates context fixture. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel.tsx |
Removes legacy offset handling. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/ai-assistant-contents.stories.tsx |
Adds floating-panel story coverage. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/ai-assistant-contents.test.tsx |
Tests state preservation across placement changes. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/ai-assistant-contents.tsx |
Implements the redesigned panel layouts. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/ai-assistant-contents/use-floating-position.ts |
Implements bounded pointer and keyboard movement. |
Review details
- Files reviewed: 17/17 changed files
- Comments generated: 1
- Review effort level: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
388839c to
4c26598
Compare
a137724 to
a2ae04a
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit a2ae04a. Configure here.
| state.isAiAssistantOpen && state.isAiAssistantCollapsed | ||
| ? state.aiAssistantWidth + 12 | ||
| : 0, | ||
| ), |
There was a problem hiding this comment.
Compact Voice inset ignores panel cap
Medium Severity
The compact Voice inset uses the raw aiAssistantWidth plus 12px, while the dock itself renders at min(aiAssistantWidth, 100cqw). On an editor narrower than that reserved width, minimap and viewport controls are placed past the canvas edge and can disappear or overlap the compact dock.
Reviewed by Cursor Bugbot for commit a2ae04a. Configure here.
| style={{ | ||
| width: | ||
| isOpen && !isFloating && !isVoiceDockCollapsed ? panelWidth : 0, | ||
| }} |
There was a problem hiding this comment.
Dock column can hide the canvas
Medium Severity
The dock spacer is flex-shrink: 0 and can be as wide as the full editor (min(assistantWidth, 100cqw)). The canvas now shrinks with minWidth: 0, so a docked assistant on a narrow embed—or after a wide resize—can consume the entire row and leave a 0-width canvas.
Additional Locations (2)
Reviewed by Cursor Bugbot for commit a2ae04a. Configure here.


Summary
The Petrinaut AI assistant opens in a sidebar at the far right of the editor. The sidebar sits flush against the viewport, with square corners and a thin divider. It reserves space beside the canvas and properties panel.
A header button detaches the assistant into a rounded, movable panel with a subtle shadow. Undocking returns the reserved width to the canvas. Opening the docked panel slides it into view at its full width while the canvas makes room. The draft, transcript, host controls, and active response survive these transitions.
Links
Blocked by
Changes
Test coverage
After the 14 September rebase, affected package builds, unit tests, types, lint and architecture checks passed on the integrated stack. Browser recordings and manual checks listed below predate this rebase.
Petrinaut: 951 tests passed across 111 test files
Demo website: 513 tests passed across 48 test files
Library and website builds, type checks, lint, formatting, and architecture checks passed
Regression coverage verifies draft and transcript preservation, host-control lifetime, close/reopen behavior, stopping responses, and canvas insets through voice collapse and expansion
Compact Voice setup is also exercised under React Strict Mode
Browser checks cover docking, floating, pointer and keyboard movement, resizing, and bounds at an 800 × 600 viewport
The deployed website also preserves a typed draft when detaching and docking
Browser measurements verify progressive canvas width allocation on opening, closing, docking, and undocking while the panel retains its full width
Browser checks verify canvas controls return to the edge when floating and stay clear of compact Voice setup
Command tests cover availability, current callbacks, both platform modifiers, input focus, shortcut isolation, and listener cleanup; the AI shortcut takes priority over text-field handlers
Browser checks verify palette execution, repeated toggling, floating draft preservation, dismissal of the palette by the AI shortcut, and toggling within Simulate and Notebook without leaving the view
Both shortcut modifiers were checked in Monaco: the assistant receives focus and the code stays unchanged
Brunch compatibility: 58 transport tests and 74 SDCPN plugin tests passed; their builds, types, and lint passed
Another 56 focused Brunch server tests passed for freshness, recorded changes, and explanations, resolving shared logging and telemetry imports to their source files because the full backend dependency build requires the Rust toolchain
The Workpiece tab, draft, and transcript survive docking, floating, and close/reopen; keyboard tab navigation was checked in Storybook
Toolbar regression coverage checks centering, combined properties/assistant clearance, floating, and tight layouts
Browser checks cover draft preservation across Experiments, Scenarios, Notebook, and Edit
Live Brunch inference was not exercised
How to test
Run
yarn workspace @hashintel/petrinaut devand open Petrinaut → With AI AssistantOpen AI from the bottom toolbar and select a node
Open the command palette with Cmd/Ctrl+K, then choose Toggle AI assistant
Focus another control and press Cmd/Ctrl+Shift+K
In Editor / AI Assistant → With Workpiece Tab, switch tabs, detach, and dock again
Type a draft, choose Float AI assistant, and drag its header
Focus Move AI assistant and press arrow keys; hold Shift to move farther
Resize from the left edge, then choose Dock AI assistant
Close and reopen the assistant
Open Petrinaut → With Voice Setup and choose Start voice mode
Choose Expand voice setup
With a draft in the assistant, switch between Edit, Simulate, and Notebook (enable Notebook in Settings)
Open and close the docked assistant in a wide editor, then open the properties panel too