Skip to content

Studio: embeddable per-product agent (schema, train, chat, actions, embed) - #175

Merged
rahulsainlll merged 10 commits into
mainfrom
feat/widget-products-schema
Aug 3, 2026
Merged

Studio: embeddable per-product agent (schema, train, chat, actions, embed)#175
rahulsainlll merged 10 commits into
mainfrom
feat/widget-products-schema

Conversation

@rahulsainlll

Copy link
Copy Markdown
Collaborator

Adds Studio — an embeddable, per-product agent. A product trains an agent on its content, connects actions it can run, and drops one script tag onto its own site. The agent answers from that content and can run the product's actions, confirm-gated.

This is Stage 1 (current rails: server card + classic payments). The non-custodial Soroban policy wallet is a later track; everything here is built to extend into it.

What's included

  • Schema (packages/database): products, product_content, product_actions (+ enums, relations, migration 0016). One agent per account.
  • Studio (apps/dashboard): a single-agent section with Train / Test / Deploy / Inbox / Settings sidebar items.
    • Train: add content (doc / snippet / FAQ / website sync) and connect actions, in a two-column layout with a live preview panel. Lists stream in via Suspense so the shell + preview paint instantly.
    • Deploy: copy the embed snippet + channel toggles.
  • Public chat endpoint (/api/widget/[publicKey]/chat): grounded in the product's enabled content, CORS, per-key rate limit, ?preview=1 for drafts. Returns { reply, action }; chat only proposes actions.
  • Actions: capability (a Tael slug) or HTTP. Paid capability runs are gated to the authenticated owner; public visitors can only trigger SSRF-guarded HTTP actions. Confirm-gated run endpoint.
  • Embed: dependency-free public/embed.js (Shadow DOM, XSS-safe rendering, calls only the Tael base) + a public branding config endpoint (returns only name/greeting/brandColor/logoUrl).

Security

  • Ownership-checked on every action and query.
  • syncWebsite re-validates every redirect hop against the SSRF guard (no 302-to-internal-host).
  • Config endpoint never exposes owner data; embed script escapes all rendered text.

Notes

  • Migration 0016 is already applied to the shared database, so prod has the tables.
  • revalidateStudioPaths lives in a plain server module (a "use server" file may only export async actions).

Testing

  • pnpm typecheck green across the repo; changed files pass eslint + prettier.
  • Verified end to end locally on testnet: create agent, train (doc + website sync), preview chat replies, embed on a test page.

rahulsainlll and others added 10 commits July 31, 2026 15:02
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
syncWebsite used redirect: "follow", so the SSRF guard only checked the
initial URL. A public page could 302 to an internal host (cloud metadata,
localhost) and be followed, pulling secrets into stored content. Now every
redirect hop is re-validated against the guard via manual redirects.
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
A "use server" file may only export async server actions, so the sync
revalidateStudioPaths helper broke the build. Moved it to a plain
server-only module (revalidate.ts) and updated imports.
Co-authored-by: Cursor <cursoragent@cursor.com>
…s instantly

The Train page awaited getOrCreateProduct + listContent + listActions before
rendering anything, so the whole page (including the preview) blocked on three
DB round-trips. Now only the product is awaited up front; the content and
actions lists stream in via Suspense with skeletons, so the shell, add-content
cards, and the live preview appear right away. Inlined the old TrainContentPanel
into the page and removed it.
@cursor

cursor Bot commented Aug 3, 2026

Copy link
Copy Markdown

Bugbot is not enabled for your account, so this pull request was not reviewed.

Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs.

@vercel

vercel Bot commented Aug 3, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
tael-dashboard Building Building Preview Aug 3, 2026 1:33am
tael-protocol-dashboard Building Building Preview Aug 3, 2026 1:33am

@rahulsainlll
rahulsainlll merged commit 9c7e09b into main Aug 3, 2026
2 of 4 checks passed
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