diff --git a/packages/app/public/features/agent-bridge.html b/packages/app/public/features/agent-bridge.html new file mode 100644 index 0000000..37ff325 --- /dev/null +++ b/packages/app/public/features/agent-bridge.html @@ -0,0 +1,869 @@ + + +
+ + +Agent Bridge exposes your entire Origin Graph through the Model Context Protocol — so Cursor, Claude Code, and any MCP-compatible agent can read your component tree, run diffs, and propose changes without leaving the editor.
+ +A JSON-RPC 2.0 MCP server sits between your AI agent and the Origin Graph. The agent calls tools. The bridge executes them. Proposed changes come back to you for review.
+Add the Agent Bridge MCP endpoint to your Cursor or Claude Code settings. The MCP handshake authenticates via AGENT_BRIDGE_SECRET and announces available tool definitions.
Your agent issues a JSON-RPC call — e.g. diff_components({ before, after }). The bridge validates the input schema with Zod before any execution begins.
Agent Bridge queries the live Origin Graph, runs the diff engine against your real component tree, and streams structured results back to the agent.
+The agent receives a structured JSON response. Any proposed change is simultaneously queued as an Intent Diff in your canvas — ready for human review before anything applies.
+Every agent tool is backed by a live query against your Origin Graph. The agent gets your actual component tree, real prop values, and real token relationships — not documentation that may have drifted from your codebase.
+query_graph runs structured traversals — find components by name, trace token usage, map dependency chains.answer_question gives agents plain-language answers grounded in the real graph, not training data.Every change an agent proposes flows through the exact same Intent Diff review pipeline as a human edit. Nothing is applied silently. Every agent action is stamped, attributable, and reversible.
+Agent Bridge speaks standard JSON-RPC 2.0. Drop the endpoint into any MCP-compatible client and tool definitions auto-discover on connect.
+Agent Bridge is a first-class MCP server. No proprietary SDKs, no vendor lock-in. If your agent speaks MCP, it works.
+Every tool call and response follows the JSON-RPC 2.0 specification exactly — standard request/response envelopes, structured error codes, and batch request support out of the box.
+ Protocol +Agent Bridge registers as a full MCP server — tool discovery, capability negotiation, and streaming all follow the Model Context Protocol spec. Works with Cursor, Claude Code, and any future MCP client.
+ Standard +Every inbound tool call is validated against a Zod schema before any execution. Malformed inputs are rejected with structured JSON-RPC error responses — the graph is never reached by bad data.
+ Zod +Authentication is token-based via a pre-shared AGENT_BRIDGE_SECRET. Set it once in your MCP client config — all subsequent calls are bearer-authenticated automatically.
Large graph queries and diff results stream back incrementally as NDJSON. Your agent receives the first nodes immediately — no waiting for the full response payload to accumulate server-side.
+ Performance +Every agent action is persisted to an append-only audit log — agent identity, tool called, inputs, outputs, and timestamp. Queryable from the canvas and exportable to JSON at any time.
+ Compliance +Agents read from the Origin Graph and write back through Intent Diff. The whole system is the pipeline.
+Connect Cursor or Claude Code to your live Origin Graph in under five minutes. No hallucinated docs — just your actual codebase, queryable from any MCP agent.
+ +Describe a component in plain language. Completion Zone generates it using only tokens, variants, and patterns that already exist in your design system — no hallucinated styles, no drift.
+ +Completion Zone is not a generic AI. Every generation pass is anchored to the full context of your Origin Graph — so the output is always on-system.
+"Add a stats row below the chart" — your plain-language intent is parsed and the target artboard region is identified.
+ Natural language +Relevant components, design tokens, spacing scales, and color palettes are fetched from your Origin Graph and assembled into the model context.
+ Origin Graph +Claude constrains its output strictly to the graph context — only existing variants, only tokens in your scale. No new styles are ever invented.
+ Constrained output +The generated component is written into the artboard, the live canvas updates, and the result is emitted as an Intent Diff ready to ship.
+ Live Artboard +Generic AI tools invent. Completion Zone finishes. The difference is the constraint layer: every output token is validated against your existing design system before anything touches the canvas.
+Before Claude generates a single character, it receives the complete context of your Origin Graph — every token, every component name, every spacing value. The constraint is baked into the prompt, not tacked on afterward.
+Completion Zone is not a thin wrapper around an LLM. It's a constraint engine built from the ground up for the specific demands of systematic design at scale.
+Claude powers generation, but the constraint work happens before and after the API call. The system prompt is fully assembled from your Origin Graph on every request — no stale cached context, no drift over time.
+ Claude API +A validation layer sits between the LLM output and the canvas. Every proposed token value is checked against your design token registry. Invalid tokens are flagged or substituted with the nearest valid match from your scale.
+ Constraint layer +The Origin Graph is queried with a relevance function to fetch the most pertinent subset of your component library for each prompt — keeping the context window focused and the generation latency low.
+ Origin Graph +Before placing a completion on the canvas, Originmain diffs it against the current artboard state. Only the minimal set of changes is applied, producing a clean Intent Diff entry with zero noise or redundancy.
+ Intent Diff +The system prompt template communicates your design system's grammar to the model — token naming conventions, component composition patterns, spatial reasoning cues, and variant inheritance rules.
+ Prompt design +Accepted completions are written back into the Origin Graph as accepted pattern examples. Over time, these examples shift the model's priors toward your team's specific conventions without any fine-tuning or retraining.
+ Adaptive +Every piece of Originmain contributes to making completions possible — and every completion makes the rest of the platform smarter.
+Early access is free. Connect your Origin Graph and run your first completion in under two minutes.
+ +Originmain integrates with GitHub, Figma, Linear, Slack, VS Code, Cursor, TypeScript, and React — so every part of your design-to-code pipeline is connected, without changing how you work.
+ +Every integration follows the same secure pipeline — events flow in, diffs are computed, and your team is alerted in the tools they already use.
+Authorize via OAuth or register a webhook. Originmain handles token refresh and credential storage with zero manual config.
+Events flow into Originmain in real time. Each payload is verified with HMAC signatures before any processing begins.
+Changes are automatically fed into the Intent Diff engine. Component-level diffs are computed and attributed to the triggering event.
+Your team is alerted where they work — a Slack message, a PR comment, a Linear issue update, or an inline editor annotation.
+When a PR is opened, Originmain receives the push event and immediately kicks off a component-level diff across the entire affected subtree. The result is posted back to the PR as a structured comment — no manual review step.
+Connect your Figma file and Originmain subscribes to every change. Design tokens, component definitions, and layout compositions are extracted and mapped directly into the Origin Graph — no manual export, no hand-off step.
+Every integration uses platform-native authentication and cryptographic verification. No credentials stored in plaintext, no polling — only push-based, event-driven architecture.
+Every incoming webhook is verified with HMAC-SHA256 before processing. The shared secret is stored encrypted in Originmain's key vault — never in environment variables or config files.
+ Security +Each platform has its own signature header — x-hub-signature-256 for GitHub, x-figma-signature for Figma. Originmain verifies each using the platform's prescribed algorithm.
Subscribe only to the events you need. Originmain exposes a per-integration event filter — receive pull_request.opened and push from GitHub, or FILE_UPDATE from Figma.
GitHub, Figma, Linear, and Slack all use standard OAuth 2.0 with PKCE. Tokens are refreshed automatically — you authorize once and Originmain handles the rest without user intervention.
+ Authentication +Originmain's integration layer respects every platform's rate limit with adaptive back-off and request queuing. High-volume repos with hundreds of daily PRs process without dropped events.
+ Reliability +Every event received, every diff triggered, every notification sent is recorded with a timestamp and payload hash. Full audit trail available to workspace admins via the Originmain dashboard.
+ Compliance +Every integration ships fully operational on day one. Connect GitHub and Figma in under two minutes, then add Linear, Slack, and your editor tools from the dashboard.
+PR diffs & branch sync
+ Operational +Token & component sync
+ Operational +Issue & milestone sync
+ Operational +Alerts & diff summaries
+ Operational +Inline diff annotations
+ Operational +Agent Bridge suggestions
+ Operational +Type-safe prop contracts
+ Operational +Full Fiber tree mapping
+ Operational +The integration layer is the connective tissue of the whole platform — every feature benefits from a connected workflow.
+Connect GitHub and Figma in under two minutes. Every other integration is one click from the dashboard.
+ +Every design change is expressed as a structured diff of props, styles, and tree — not a screenshot comparison. Reviewers see exactly what changed and why.
+ +Intent Diff runs a Myers/LCS algorithm on serialized component trees — not on pixels. Every merge triggers a full, machine-readable patch automatically.
+The component tree is serialized to a structured document of props and styles, validated against a Zod schema before being stored as the diff baseline.
+The LCS-based Myers diff algorithm compares the serialized lines of the before and after snapshots, finding the minimum edit script between them.
+A standard unified patch string is emitted — --- before / +++ after with hunk headers and context lines on each side.
The patch is passed to @pierre/diffs and displayed in Split or Unified view for reviewers to inspect, accept, or reject individual prop changes.
Screenshot comparison tools tell you something looks different. Intent Diff tells you exactly which prop changed, from what value to what value. Every diff is a first-class data structure — queryable, storable, and consumable by CI/CD pipelines without any manual interpretation.
+Reviewers are not forced to approve or reject an entire diff. Each prop change is an independent item — cherry-pick what ships and what goes back, with a full audit trail recorded per decision. No more all-or-nothing PR approvals on design work.
+Intent Diff applies battle-tested diff theory — the same algorithm that powers Git — to component trees, not text files. Structured input means structured, machine-readable output.
+The O(ND) Myers diff algorithm finds the shortest edit script between two sequences. The same algorithm used in git diff — applied here to serialized component prop lines, not source code.
After the edit graph is constructed, longest-common-subsequence backtracking produces the minimum set of additions and removals — minimizing diff noise and keeping context stable across rebases.
+ Edit script +Output is a standard unified patch string with --- and +++ headers, @@ hunk ranges, and three lines of context. Parseable by any standard tooling out of the box.
The patch is rendered by @pierre/diffs in two modes: Split (side-by-side panels) for detailed prop comparison, and Unified (stacked) for a linear review flow.
Every component snapshot is validated at write time against a shared Zod schema. Type-safe serialization means the diff algorithm always operates on well-formed input — no silent failures or undefined prop shapes.
+ Type safety +The unified patch is available as a JSON payload on every merge event. Pipe it into GitHub Actions, Linear, or your own webhook to block PRs on token violations or notify designers of overridden changes.
+ Automation +Every artboard edit creates a diff. Every diff is queryable by the graph. Every diff is shippable through the bridge.
+Every design change expressed as a structured, machine-readable, component-level diff. Early access is free.
+ +Not a mockup. Not a screenshot. Every artboard is a real iframe render of your actual component tree — running your real code, connected to your real data.
+ +A lightweight runtime bridge connects your running app to the Originmain canvas with no build step required.
+Paste any URL from your running app. Originmain opens it as an iframe-backed artboard in the canvas.
+A lightweight script injects into the iframe and hooks into React's fiber tree — reading every component's props, state, and DOM rect.
+The fiber tree streams to the host via postMessage. The canvas renders selection overlays and prop inspectors in real time.
+Click any component. Change a prop in the inspector. The iframe re-renders instantly — no round-trips, no rebuild.
+Every artboard runs your actual React components in a sandboxed iframe. Your real styles, your real tokens, your real data — all visible and editable from the canvas.
+Click any component in the canvas — the inspector populates with its live props. Change a value and the iframe re-renders in under 16ms. All edits accumulate into an Intent Diff automatically.
+No proprietary runtime. No custom compiler. Live Artboard works with any React app — any version, any bundler, any framework.
+Each artboard runs in a sandboxed iframe with allow-scripts allow-same-origin. Your app runs in full isolation — Originmain never modifies your code.
A lightweight script hooks into React's internal fiber tree via __REACT_DEVTOOLS_GLOBAL_HOOK__ — the same API used by React DevTools. Works with React 16.8+.
Fiber tree updates stream from the iframe to the host canvas via a typed postMessage protocol. Messages are validated with a shared artboard ID so multiple artboards never cross-contaminate.
+ Protocol +Every component's bounding rect is captured on mount and update. This drives the selection overlay, hover highlights, and resize handles — all pixel-accurate to the live render.
+ Precision +No Babel plugin, no webpack loader, no custom babel config. Paste any URL — dev server, staging, or production — and the artboard renders immediately.
+ Zero friction +When the iframe is cross-origin, the renderer can include the hook script directly via a small npm package. Same protocol, same canvas experience — no compromise on security.
+ Flexibility +The real-time component tree is the foundation for every other Originmain feature.
+Early access is free. Connect your first artboard in under two minutes.
+ +The Origin Graph is a living knowledge graph of your entire component ecosystem — relationships, history, usage, and design tokens — all queryable in real time.
+ +A two-pass pipeline — static analysis plus runtime capture — builds a continuously updated graph with zero manual annotation required.
+An AST walker scans every component file, extracting imports, prop signatures, and design-token references without running your code.
+A React Fiber hook captures live props and state at render time, adding real-world usage data that static analysis alone can't see.
+Nodes and typed edges — usage, inheritance, token links — are written to Supabase, forming a queryable graph that updates incrementally.
+A REST API and MCP tool set expose the graph to AI agents, the diff engine, and the Inspector — answering natural-language queries in real time.
+Because every design-token link is a first-class edge in the graph, changing --color-primary immediately highlights every component downstream. No Storybook trawl. No grep. Just the answer.
Every node in the graph is a structured JSON object accessible via REST or MCP tools. AI agents, CI pipelines, and custom tooling can query your entire component ecosystem programmatically — no scraping, no docs to keep in sync.
+Origin Graph is designed to stay accurate as your codebase moves — incremental, typed, and accessible to any tooling that speaks REST or MCP.
+A Babel-based AST walker traverses every component file on save, extracting imports, JSX usage, and design-token references — without executing any code.
+ Static analysis +A Fiber hook captures live props and state during rendering, adding real-world usage data — actual prop values in production — that static analysis cannot infer.
+ Runtime +Nodes and edges are persisted in Supabase Postgres with a graph-friendly schema. Postgres views and RPC functions serve subgraph queries with sub-10ms latency.
+ Persistence +Three edge types — usage, inheritance, token — are stored with directionality and metadata, making impact analysis a simple graph traversal rather than a heuristic search.
Agent Bridge exposes the graph as an MCP tool. Ask "What will break if I rename Card?" in plain English from Cursor, Claude Code, or any MCP-compatible editor.
+ Agent Bridge +Only the files touched since the last commit are re-indexed. No full rebuild. A project with 1,000 components updates in under two seconds on a file save.
+ Performance +The graph is infrastructure. Every Originmain feature that needs to understand your codebase queries it first.
+Early access is free. Connect your repo and the first full graph index runs in under a minute.
+ +