FE-1500: add the embedded Petrinaut preview - #9360
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
1 Skipped Deployment
|
PR SummaryMedium Risk Overview The preview builds an in-memory read-only document and reuses Also adds the Reviewed by Cursor Bugbot for commit afae06f. Bugbot is set up for automated code reviews on this repo. Configure here. |
bdd7d29 to
19b712e
Compare
aa20c9f to
f5225e5
Compare
|
Semgrep found 4
Detected a call to |
733d6ac to
f90fdcd
Compare
897d5ef to
999f04c
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
There are 2 total unresolved issues (including 1 from previous review).
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit bdd70a2. Configure here.
There was a problem hiding this comment.
🟡 Changes recommended
The public navigation contract exposes scenario state that the preview provider tree never applies.
Once you've addressed the issues Copilot identified, you can request another Copilot review.
Pull request overview
Adds a compact, read-only Petrinaut embed surface with shared canvas and inspection infrastructure.
Changes:
- Introduces
PetrinautPreviewand its package entry point. - Splits document and canvas providers for lightweight composition.
- Adds preview presentation settings, navigation tests, and documentation.
File summaries
| File | Description |
|---|---|
.changeset/petrinaut-embedded-preview.md |
Records package patches. |
libs/@hashintel/petrinaut/package.json |
Exports the preview bundle. |
libs/@hashintel/petrinaut/vite.config.ts |
Builds the preview entry. |
libs/@hashintel/petrinaut/src/preview.ts |
Defines the public source entry. |
libs/@hashintel/petrinaut/src/react/index.ts |
Exports layered providers. |
libs/@hashintel/petrinaut/src/react/petrinaut-provider.tsx |
Uses the new provider layers. |
libs/@hashintel/petrinaut/src/react/petrinaut-provider-layers.tsx |
Implements reusable provider layers. |
libs/@hashintel/petrinaut/src/ui/petrinaut.tsx |
Reserves the preview profile. |
libs/@hashintel/petrinaut/src/ui/preview/index.ts |
Aggregates preview exports. |
libs/@hashintel/petrinaut/src/ui/preview/navigation-adapter.ts |
Adapts preview navigation state. |
libs/@hashintel/petrinaut/src/ui/preview/navigation-adapter.test.ts |
Tests navigation projection. |
libs/@hashintel/petrinaut/src/ui/preview/petrinaut-preview.tsx |
Composes the preview surface. |
libs/@hashintel/petrinaut/src/ui/preview/preview-net-navigation.tsx |
Adds compact net selection. |
libs/@hashintel/petrinaut/src/ui/preview/properties-panel.tsx |
Adds the responsive inspector. |
libs/@hashintel/petrinaut/src/ui/views/shared/presentation-context.tsx |
Defines preview capabilities. |
libs/@hashintel/petrinaut/src/ui/views/SDCPN/components/mini-map.tsx |
Adjusts preview minimap placement. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/LeftSideBar/subviews/nets-list.tsx |
Supports selection callbacks. |
libs/@hashintel/petrinaut/src/ui/views/Editor/panels/ai-assistant-panel/petrinaut-docs-content.ts |
Registers preview documentation. |
libs/@hashintel/petrinaut/docs/README.md |
Links the preview guide. |
libs/@hashintel/petrinaut/docs/preview.md |
Documents preview behavior. |
libs/@hashintel/petrinaut-core/src/ai.ts |
Registers preview AI documentation metadata. |
Review details
- Files reviewed: 21/21 changed files
- Comments generated: 2
- Review effort level: Balanced
💡 Configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
| export type PetrinautPreviewNavigationState = Pick< | ||
| PetrinautNavigationState, | ||
| "scenarioId" | "subnetId" | "selection" | ||
| >; |
| export type { PetrinautPreviewNavigationState } from "./navigation-adapter"; | ||
| export { PetrinautPreview } from "./petrinaut-preview"; | ||
| export type { PetrinautPreviewProps } from "./petrinaut-preview"; | ||
| export type { PetrinautNavigationController } from "../../react/navigation"; | ||
| export type { ViewportAction } from "../types/viewport-action"; |

Summary
Before this PR, embedding a net meant mounting the full
Petrinautcomponent in read-only mode. That loads Monaco, the language server, experiments, optimizations, and the AI assistant for a page that only shows a model, and its chrome is sized for authoring.PetrinautPreview, exported from@hashintel/petrinaut/preview, is a compact read-only surface for showing a net inside another application. It reuses the editor's canvas, navigation, and property inspection and mounts none of the authoring tooling. Its chrome follows the editor's: a flat outlined header, a square badge, and an inspector docked beside the canvas.Links
Changes
Provider layers
PetrinautProvidersplits intoPetrinautDocumentProviderandPetrinautCanvasProviderPreview surface
PetrinautPreviewinsrc/ui/preview/previewpresentation profiledocs/preview.mdregistered in the docs index and the AI assistant's doc listTest coverage
navigation-adapter.test.ts:ai.test.ts,petrinaut-docs-content.test.ts:build:lib:How to test
yarn workspace @hashintel/petrinaut build:lib<PetrinautPreview definition={...} title="..." />from@hashintel/petrinaut/previewin a host page