Skip to content

Canvas agent integration + Additional component framework support#49

Merged
HumbleBee14 merged 8 commits into
developfrom
Canvas-Agent-integration
Dec 30, 2025
Merged

Canvas agent integration + Additional component framework support#49
HumbleBee14 merged 8 commits into
developfrom
Canvas-Agent-integration

Conversation

@HumbleBee14

@HumbleBee14 HumbleBee14 commented Dec 30, 2025

Copy link
Copy Markdown
Member

This pull request introduces significant enhancements to the Roopik extension, focusing on improved AI context integration for the canvas, state persistence for user workflows, and better dependency management for component builds. The most important changes are grouped below.

AI Context Integration & Command Handling:

  • Added a new externalContext command to the Roopik extension. This enables external context (such as canvas state, selected components, and user input) to be sent directly to the AI chat interface, supporting both auto-send and draft modes. The command is registered, mapped, and invoked from both the canvas and chat panel. [1] [2] [3] [4]
  • Implemented canvasAiChat message handling and the handleCanvasAiChat method in CanvasPanel, which collects detailed canvas and component context, formats it, and forwards it to the AI chat via the new command. [1] [2]

Component Context & Data Flow:

  • Extended component data structures (ComponentLoadInfo and related usages) to include folderPath and entryFile, ensuring more complete context is available for AI and UI features. [1] [2] [3]

State Persistence & User Experience:

  • Added state persistence for the last active canvas. The extension now saves and restores the last active canvas across sessions, improving user workflow continuity. This includes new methods and logic in RoopikExtensionManager and is called during extension activation. [1] [2] [3] [4] [5] [6] [7]

Component Build & Dependency Management:

  • Updated build instructions for Roopik canvas components to clarify that bare specifier imports are automatically resolved by the internal ESM resolver, and CDN URLs must not be used. This ensures smoother dependency handling and version management.
  • Added build tool dependencies for Roopik component transformation to ESLint config, supporting Svelte, Vue, and Solid components.

Introduces a new 'Add External Context to Dio' command and supporting infrastructure for sending canvas context and user input to the AI chat. Updates the canvas panel to handle 'canvasAiChat' messages, formats context details, and triggers the new command. The webview and toolbar UI are updated with an 'Add to context' button and improved input handling, while types and context-building logic are added to support this feature.
Adds logic to persist and restore the last active canvas when the Roopik extension is activated. Implements state persistence in RoopikExtensionManager and introduces a new internal command 'roopik.core.getCanvas' for retrieving canvas information during restoration.
Introduces screenshot capture functionality when selecting elements in inspect mode and allows attaching screenshots to AI chat messages. Updates the webview, sandbox, and extension logic to support capturing, transmitting, and handling screenshots, including device metadata. Adds html2canvas as a dependency for image capture.
Introduces logic to append framework core dependencies (e.g., react, react-dom) as CDN URL parameters for non-core packages, preventing multiple instances of core libraries like React. Adds framework-aware dependency resolution and configures esbuild to use the correct JSX import source per framework, addressing issues with context and singleton runtime behavior.
Refactors framework detection to use a single source of truth in ComponentParser, including a new detectFrameworkFromFile helper. Updates detectors.ts to delegate detection to this helper, adds better handling for JSX/TSX files without explicit imports, and ensures 'unknown' frameworks are re-detected in esbuildTransformer. Adds debug logging for framework detection in componentService.
Enhanced regex patterns in componentParser.ts to detect framework imports with subpaths (e.g., 'preact/hooks', 'solid-js/web'). Updated esbuildTransformer.ts to treat 'preact/hooks' as a subpath, not a separate package, and adjusted the Preact runtime code to use 'h' for rendering components.
Added 'esbuild-plugin-solid' to the ESLint config and project dependencies to enable Solid.js support in the esbuild pipeline. Updated related Babel and esbuild dependencies to their latest versions for compatibility.
@HumbleBee14 HumbleBee14 merged commit 4bf440e into develop Dec 30, 2025
0 of 3 checks passed
@HumbleBee14 HumbleBee14 deleted the Canvas-Agent-integration branch December 30, 2025 12:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant