Skip to content

Add the artifact list, viewer, and publish dialog - #1402

Open
innoavator wants to merge 4 commits into
feat/artifactsfrom
feat/artifacts-ui
Open

innoavator wants to merge 4 commits into
feat/artifactsfrom
feat/artifacts-ui

Conversation

@innoavator

@innoavator innoavator commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add a Publish button on HTML and Markdown file previews, plus an artifacts list and a viewer at /artifacts/<slug>.
  • The viewer pins a version with ?version=, copies the link, opens the source session, and downloads one file or a zip.
  • Depends on the backend pull request. This branch is stacked on feat/artifacts.

Test plan

  • Publish an HTML preview that references a stylesheet and confirm the viewer loads both files
  • Publish the same page again and confirm the version does not change
  • Open an older version with ?version= and copy that pinned link
  • Download a multi-file version and confirm it is a zip
  • Confirm the Artifacts entry is hidden when the artifacts port is omitted
  • pnpm --filter @truefoundry/trueforge-ui exec vitest run test/routing/paths.test.ts test/routing/derivePlace.test.ts test/server/serverChrome.test.ts

Made with Cursor


Note

Medium Risk
New user-facing publishing and sandboxed HTML viewing touch session file bundles and authenticated content URLs; behavior depends on a stacked backend PR.

Reviewed by Cursor Bugbot for commit 412d3f5. Bugbot is set up for automated code reviews on this repo. Configure here.

Part of #1403

Signed-in users can publish a previewed page and open the shared link from the sidebar.

Co-authored-by: Cursor <cursoragent@cursor.com>
@changeset-bot

changeset-bot Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 412d3f5

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@truefoundry/trueforge-assistant-ui-runtime Patch
@truefoundry/trueforge-ui Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@veria-ai

veria-ai Bot commented Nov 16, 2026 •

Copy link
Copy Markdown

PR overview

The PR adds an artifact list, an artifact viewer, and a dialog for publishing artifact files to everyone in a tenant.

Two issues remain open, with none addressed so far. The publish dialog hides file paths by default, making it harder for users to notice when page references include other sandbox files before sharing them tenant-wide. With analytics enabled, viewer events also send user-authored filenames and artifact slugs to PostHog, potentially exposing customer or project details.

Open issues (2)

Fixed/addressed: 0 · PR risk: 4/10

Reviews

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

closeLibraryAgent,
schedulesOpen,
setSchedulesOpen,
artifactsOpen,

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifacts overlay blocks returning to chat

High Severity

openHistorySession and the layout Back to chat handlers close other overlays but never clear artifactsOpen or artifactView. Layouts render the artifacts list and viewer instead of the thread while those flags stay set, so Open session and Back to chat leave the user stuck on the artifact surface. The same gap is in selectLibraryAgent and the thread-list row handler.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9341f1. Configure here.

<div className="px-4 py-3">
<Markdown content={text ?? ''} />
</div>
);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Markdown viewer ignores content URL

Medium Severity

Published Markdown is rendered from fetched text only, and contentUrl is unused for that kind. Relative images and other bundle files then resolve against the app route instead of the content-token base URL, so they do not load in the artifact viewer.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9341f1. Configure here.

return () => {
cancelled = true;
};
}, [artifacts, query]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact list keeps stale error

Low Severity

A successful listArtifacts response never clears error. After a failed first load, a later successful search still shows the previous error above the results.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit c9341f1. Configure here.

const [title, setTitle] = useState(suggestedTitle);
const [slug, setSlug] = useState('');
const [note, setNote] = useState('');
const [showFiles, setShowFiles] = useState(false);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: Files published tenant-wide are hidden by default

This dialog is where the user agrees to make files readable by everyone in the tenant, but by default it only shows "N files · X KB". The paths stay hidden behind "Show files" (closed here and reset to closed on line 49). The server builds the bundle from references in the page, and resolveToAbsolute in collectBundle.ts accepts relative ../ references to any absolute sandbox path. So an LLM-written page, possibly shaped by prompt injection, can pull in uploaded data or credential files from elsewhere in the sandbox without the user noticing. Show the file list by default. Also add a visible warning when the bundle reaches outside the page's folder. preview.entryPath containing a / is a direct signal, because it means preview.root sits above the entry file's directory.

files={selected.files.map(file => ({ path: file.path, detail: formatBytes(file.sizeBytes) }))}
{...(selectedPath != null ? { selectedPath } : {})}
onSelect={path => {
track(AnalyticsEvents.Artifact.FILE_SELECTED, { path });

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Low: User-authored artifact metadata sent to analytics

The frontend forwards these properties unchanged to PostHog (packages/frontend/src/App.tsx:202–205), so filenames containing customer or project details are exported whenever a file is selected with analytics enabled. Omit path here and the user-authored slug from VIEWER_OPENED on line 34; use an opaque artifact ID if correlation is needed.

Suggested change
track(AnalyticsEvents.Artifact.FILE_SELECTED, { path });
track(AnalyticsEvents.Artifact.FILE_SELECTED);

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Stale Bugbot comment from a previous run.

setError(null);
} catch (caught) {
if (!cancelled) setError(caught instanceof Error ? caught.message : 'Could not open artifact');
}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Viewer keeps stale artifact on failure

Medium Severity

Changing slug or version does not clear artifact, selected, or token before the next fetch. A missing artifact or failed version load leaves the previous page on screen behind the error. The version <select> is bound to selected.version, so it also snaps back to the old version until the new one finishes loading.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2a154d9. Configure here.

};

const showBackToChat = showDesktopOnlyNotice || libraryOpen || schedulesOpen || environmentsOpen;
const showBackToChat = showDesktopOnlyNotice || libraryOpen || schedulesOpen || artifactsOpen || environmentsOpen;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Back to chat skips artifacts close

Medium Severity

Back to chat is shown for the artifacts list and viewer, but the handlers never call setArtifactsOpen(false) or closeArtifactViewer. They only close library, schedules, sessions, and environments. Closing currently works only because setSchedulesOpen dismisses artifacts even when it is already closed, unlike the other overlay setters.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 2a154d9. Configure here.

Abhishek Choudhary and others added 2 commits November 16, 2026 23:34
A second publish compared a bundle-relative path with the sandbox path, so it always created a new artifact. The UI now joins the stored source root, keeps an edited title, and reads created_by_subject plus a files-free latest version.

Co-authored-by: Cursor <cursoragent@cursor.com>

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.

There are 7 total unresolved issues (including 5 from previous reviews).

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 412d3f5. Configure here.

}
setEnvironmentsOpenState(environmentsEnabled && open);
},
[environmentsEnabled, setSessionsOpen],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Artifact overlays close through schedules

Medium Severity

setSchedulesOpen always calls dismissArtifacts, including when closing. Back to chat, New Chat, and openHistorySession never call setArtifactsOpen(false) or closeArtifactViewer, so leaving an artifact depends on that side effect and will strand the user if the setter is aligned with the other overlays.

Additional Locations (2)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 412d3f5. Configure here.

>
Delete
</button>
) : null}

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Delete shown without failure handling

Medium Severity

Delete is always shown and both deleteArtifact and downloadVersion ignore rejection. A 403 from a non-owner, or any download failure, becomes an unhandled promise rejection with no error in the viewer.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 412d3f5. Configure here.

This branch has not been deployed

No deployments
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