feat(web): add embeddable thread route /embed/thread/:environmentId/:threadId#2
feat(web): add embeddable thread route /embed/thread/:environmentId/:threadId#2rororowyourboat merged 26 commits intomainfrom
Conversation
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com>
…#1303) Co-authored-by: codex <codex@users.noreply.github.com> Co-authored-by: Julius Marminge <julius0216@outlook.com>
Co-authored-by: justsomelegs <145564979+justsomelegs@users.noreply.github.com> Co-authored-by: codex <codex@users.noreply.github.com> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com> Co-authored-by: Julius Marminge <julius@macmini.local> Co-authored-by: Cursor Agent <cursoragent@cursor.com> Co-authored-by: cursor[bot] <206951365+cursor[bot]@users.noreply.github.com>
Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius0216@outlook.com> Co-authored-by: codex <codex@users.noreply.github.com>
Co-authored-by: Julius Marminge <julius@macmini.local>
Adds /embed/thread/:environmentId/:threadId — a standalone route that renders the existing ChatView without the app sidebar chrome. This is the iframe target for t3-canvas agent shapes (see rororowyourboat/t3-canvas#3). - New file-based route embed.thread.\$environmentId.\$threadId.tsx - __root.tsx bypasses AppSidebarLayout for any /embed/* pathname so the environment connection + websocket surface + toasts still initialize but the sidebar/diff/plan chrome does not render - minimal=1 search param is parsed and wired to a data attribute on the container for future targeted CSS; chrome hiding (BranchToolbar, PlanSidebar, ThreadTerminalDrawer) stays as a follow-up pass - routeTree.gen.ts regenerated by the @tanstack/router-plugin
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 892e8de502
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (!bootstrapComplete) { | ||
| return <EmbedMessage label="Loading thread…" />; |
There was a problem hiding this comment.
Handle unknown embed environments instead of perpetual loading
This gate returns the loading state whenever bootstrapComplete is false, but unknown environmentId values never bootstrap (the store falls back to an initial environment state with bootstrapComplete: false). As a result, /embed/thread/<bogus>/<bogus> never reaches the not-found branch and spins forever, which breaks the route’s intended graceful error behavior for invalid thread references.
Useful? React with 👍 / 👎.
| const nextEnvironmentState = updateThreadState( | ||
| getStoredEnvironmentState(state, state.activeEnvironmentId), | ||
| threadId, |
There was a problem hiding this comment.
Scope thread error writes to the thread environment
setError updates only state.activeEnvironmentId, but ChatView calls it with just a threadId for the currently viewed route thread. In multi-environment usage, when the viewed thread belongs to a non-active environment, this write targets the wrong environment slice (or no-ops), so transport/send errors are not persisted on the actual thread the user is looking at.
Useful? React with 👍 / 👎.
Summary
Adds a standalone route that renders the existing `ChatView` without the app sidebar chrome, for use inside iframes. The primary consumer is t3-canvas (a canvas-first agent workbench) which embeds T3 Code threads as tiles on an infinite canvas.
Closes #1
Changes
Follow-ups not in this PR
The `minimal=1` query param is parsed and exposed via `data-t3-embed-minimal="true"` on the container, but the actual chrome hiding (BranchToolbar, PlanSidebar, ThreadTerminalDrawer) inside `ChatView` is not yet implemented. These components render by default. Two reasonable paths, pick later:
For the MVP of t3-canvas agent tiles, showing the full ChatView inside an iframe is acceptable — the iframe is a large tile so the chrome is visible but not blocking.
Test plan
Out of scope