v3/goal_ui/docs/WIDGET_SETUP.md
The GOAP widget is a fully-featured, embeddable research planning interface with 100% fidelity to the main application. It can be embedded on any website using a simple script tag.
✅ Complete GOAP planning workflow
✅ AI-powered research with Gemini integration
✅ State assessment and configuration display
✅ Full research report modal
✅ Customizable appearance via configuration
✅ Self-contained bundle with all dependencies
To generate the embeddable widget.js file:
# Using the build script
chmod +x build-widget.sh
./build-widget.sh
# Or manually
BUILD_WIDGET=true npm run build
This creates:
dist/widget.js - Standalone IIFE bundle with all dependenciesdist/widget.css - Compiled stylesThe widget.js is a self-contained bundle that includes:
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>My Site with RuFlo Research Widget</title>
</head>
<body>
<!-- Widget Container -->
<div id="ruflo-research-widget-container"></div>
<!-- Load Widget Script -->
<script src="https://your-domain.com/widget.js"></script>
</body>
</html>
<div id="ruflo-research-widget-container"></div>
<script>
// Configure widget appearance (optional)
window.RufloResearchWidgetConfig = {
primaryColor: "#8b5cf6",
accentColor: "#22c55e",
backgroundColor: "#1a1a1a",
cardBackgroundColor: "#262626",
textColor: "#ffffff",
fontFamily: "system-ui",
defaultGoal: "Research the latest advancements in quantum computing"
};
</script>
<script src="https://your-domain.com/widget.js"></script>
<div id="my-custom-container"></div>
<script>
window.RufloResearchWidgetConfig = { /* ... */ };
</script>
<script src="https://your-domain.com/widget.js"></script>
<script>
// Manually initialize with custom container
window.RufloResearchWidget.init('my-custom-container');
</script>
| Option | Type | Default | Description |
|---|---|---|---|
primaryColor | string | #8b5cf6 | Primary brand color |
accentColor | string | #22c55e | Accent/success color |
backgroundColor | string | #1a1a1a | Background color |
cardBackgroundColor | string | #262626 | Card background |
textColor | string | #ffffff | Primary text color |
fontFamily | string | system-ui | Font family |
defaultGoal | string | - | Pre-populated research goal |
The widget exposes a global RufloResearchWidget object:
window.RufloResearchWidget = {
init: (containerId?: string) => void,
version: string
}
init(containerId): Manually initialize the widget in a specific containerversion: Current widget versionBuild the widget:
npm run build
Serve the dist folder:
npx serve dist
Open the example embed page:
http://localhost:3000/widget-embed.html
Visit /demo in your application to see:
The widget includes full Supabase integration for:
Ensure your Supabase project is configured with the required edge functions:
generate-research-goalresearch-stepoptimize-research-configgenerate-action-itemsRufloResearchWidgetConfigFor issues or questions:
/demo[RuFlo Research] prefix