feat(library): asset-to-chat flow + open() preview tool#4117
Open
rafavalls wants to merge 1 commit into
Open
Conversation
- Remove `deck:` from `isPerThreadTab` so landing page tabs persist when creating a new thread (deck files live in the org home volume, not per-thread) - Add chat button to Library toolbar (Toolbar.Toggles slot) when a home-volume HTML file is previewed; navigates to the last thread with the file open in the deck tab alongside chat - Add `open(filepath)` built-in tool (cluster-only) that emits a transient `data-open-preview` stream part; the React client navigates the deck tab immediately with stat cache invalidation, matching data-deck-updated behavior - Hide `tool-open` card in chat (navigation already happened, card is noise) - Add `<open-preview>` system prompt block so agents know to call open() after writing an HTML page or deck Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
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.
What is this contribution about?
Three fixes for the Library → Chat asset workflow:
Deck tabs persist across thread switches — removed
deck:fromisPerThreadTab()since deck files live in the org home volume (persistent, org-scoped), not in a thread-specific path. Previously, creating a new thread while viewing a landing page would close the preview tab.Library "Open in chat" button — when previewing a home-volume HTML file in the Library, a chat icon appears in the top-left toolbar (same
Toolbar.Togglesslot used by the agent chat button). Clicking it navigates to the last thread with the file open in the deck tab alongside the chat panel, so the asset stays visible.open(filepath)built-in tool — agents can now callopen("pages/landing.html")after creating or editing an HTML file to immediately navigate the preview panel. The tool emits a transientdata-open-previewstream part (no persistence, no ghost nav on reload), invalidates the stat cache so the iframe renders fresh, and the tool card is hidden from chat since the navigation already happened. A system prompt block tells models when to call it.Screenshots/Demonstration
How to Test
bun run dev, open the Library (/$org/files), browse tohome → pages/, click an HTML fileMessageCircle01button appears in the top-left toolbar (after back/forward nav)?main=deck:<path>&chat=1(chat left, HTML right)open()after writing the file → preview panel navigates automaticallyMigration Notes
No database migrations or configuration changes required.
Review Checklist
Summary by cubic
Improves the Library → Chat workflow: HTML previews persist across thread switches, and you can open a preview directly in chat. Adds an
open(filepath)tool so agents can switch the preview automatically after creating or editing a page.New Features
open(filepath)emits a transientdata-open-previewevent that navigates the preview and refreshes it; the tool card is hidden to avoid noise. Added an<open-preview>system prompt so models know when to call it.Bug Fixes
Written for commit ff2e969. Summary will update on new commits.