Skip to content

Preview thread-storage and Markdown artifacts inline - #3439

Merged
SawyerHood merged 2 commits into
mainfrom
bb/inline-vis-thread-storage-and-markdown
Sep 10, 2026
Merged

SawyerHood merged 2 commits into
mainfrom
bb/inline-vis-thread-storage-and-markdown

Conversation

@SawyerHood

Copy link
Copy Markdown
Collaborator

Human comments

Integration of #3163 and #3165 by @IlyaM, which conflicted in every file of the inline-vis plugin. Both are credited as co-author on the commits.

What was wrong

The inline-vis plugin assumed every artifact was an HTML file in the thread workspace. Its RPC always resolved the thread environment, its frontend always used the worktree file route, and its extension check only accepted .html/.htm. Read-only artifacts written to $BB_THREAD_STORAGE could not be rendered inline (#3158), and Markdown reports had to be converted to HTML or pasted into the message (#3159).

What changed

  • Added source="workspace" | "thread-storage" to the directive; omitted source defaults to workspace. Thread-storage previews resolve their root through bb.sdk.threads.storageLocation(), confine the file under that root, and use the existing thread-storage file route. They omit the open-in-workspace action.
  • Accepted .md and .markdown files alongside HTML. The plugin-private RPC was renamed from prepareHtmlPreview to preparePreview and returns a discriminated html or markdown result with the normalized source. Markdown results include the validated UTF-8 content, which the frontend renders with the host Markdown component (raw HTML disabled) inside the same bounded, scrollable preview card. HTML keeps the sandboxed iframe.
  • Updated the README, plugin overview, package metadata, and bundled skill for both features.

Only the plugin-local RPC contract changed. No server/daemon wire fields changed, so HOST_DAEMON_PROTOCOL_VERSION is unchanged. No new public plugin API surface.

How you verified

Combined the tests from both PRs and added cross-feature coverage: Markdown from thread storage on the backend, and thread-storage Markdown suppressing the workspace action on the frontend.

pnpm exec turbo run test typecheck --filter=bb-plugin-inline-vis
  • 27 tests passed across 2 files; typecheck passed; 6 Turbo tasks succeeded
  • bb plugin build plugins/inline-vis succeeded
  • git diff --check passed

Fixes #3158
Fixes #3159

Supersedes #3163 and #3165.

AGENT GENERATED

@SawyerHood
SawyerHood merged commit 7ba69eb into main Sep 10, 2026
16 checks passed
@SawyerHood
SawyerHood deleted the bb/inline-vis-thread-storage-and-markdown branch September 10, 2026 22:01
ymichael added a commit that referenced this pull request Sep 11, 2026
## Human comments

## What was wrong

The inline Markdown preview added in #3439 passed only text to the
message renderer, discarding the report’s directory and storage source.
A nested `reports/report.md` linking to `sibling.md` or `chart.svg`
therefore resolved from the workspace root, even when the report lived
in thread storage.

## What changed

Pass server-resolved document context through the private inline-vis
response into `Markdown.experimental_document`. Reuse existing
file-image routing and explicit file navigation so links and images
resolve beside the document within the selected source. Preserve line
ranges, message rendering without document context, and existing HTML
sandbox behavior.

Document the experimental SDK prop in the Plugin Guide and API audit,
add an inline-vis example, and bump the Plugin SDK from `0.4.54` to
`0.4.55` so consumers can require a host that supports the new surface.
No daemon wire changes or new CLI commands; existing SDK/CLI message
directives retain their delivery path.

## How you verified

- Added real-renderer regressions for nested workspace/thread-storage
links and images, conflicting ambient workspace context, line ranges,
parent-directory references, missing destinations, and
escape/absolute-path controls. Both destination cases and both RPC
context assertions failed before the change and passed afterward.
- Turbo test/typecheck passed for `bb-plugin-inline-vis`,
`@get-bb/plugin-sdk`, and `@bb/plugin-api-map`; app build/typecheck and
the Plugin Guide build passed.
- Focused app tests passed, including 13 renderer/image checks after
rebasing. The broad app suite was interrupted under load; all five
observed failures passed focused reruns with two workers. No full-suite
pass claimed.
- Verified the actual source app with a connected daemon and synthetic
reports: correct sibling documents and charts from both storage roots,
desktop pointer activation, reload and keyboard activation at 390×844
with coarse pointer/no hover, and no horizontal overflow.
- Source browser/filesystem fixtures covered loading, stale/error
states, HTML sandbox preservation, and
missing/binary/oversized/traversal/symlink controls. Safari, Electron,
and remote authentication were not verified.
- `node .github/workflows/check-plugin-sdk-version.mjs` passed after the
`0.4.55` lockstep bump.

## Before and after

Matching 1280×900 source-component fixtures for a thread-storage report.
Before uses parent `1d20e5f9ccd9f85cf5e9f56461d8f5e4fc25c5f3`; After
captures the UI behavior now present at final pushed head
`5dd24812ac6a208688b6ed4d9a0f93af0c4d5c21`. The subsequent rebase and
SDK-version correction did not change the rendered UI. Navigation/RPC
are fixture adapters; the actual inline component and renderer are built
from the compared revisions. After requests the chart beside the report
and opens `reports/sibling.md` in thread storage.

| Before — wrong workspace destination, broken chart | After —
document-relative destination, chart loaded |
| --- | --- |
| ![Before: broken
chart](https://raw.githubusercontent.com/get-bb/bb/acbb8b2ca20cd3573966584973c05a905de011c6/pr-before.png)
| ![After: chart
loaded](https://raw.githubusercontent.com/get-bb/bb/acbb8b2ca20cd3573966584973c05a905de011c6/pr-after.png)
|

> AGENT GENERATED
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.

Support rendering Markdown files in inline-vis blocks inline-vis cannot render HTML files from $BB_THREAD_STORAGE

1 participant