Skip to content

The Open Standard for Generative UI

Add Handsontable + OpenUI Chat example (#454)

Visharad Kashyap4925e044620f
diff --git a/.gitattributes b/.gitattributes
new file mode 100644
index 000000000..3dafe8fd5
--- /dev/null
+++ b/.gitattributes
@@ -0,0 +1,4 @@
+# Auto-generated lockfiles: avoid merge conflicts by always regenerating from the
+# merge result of package.json files. After merging, run `pnpm install` to
+# reconcile the lockfile.
+pnpm-lock.yaml merge=binary
diff --git a/examples/hands-on-table-chat/.gitignore b/examples/hands-on-table-chat/.gitignore
new file mode 100644
index 000000000..5ef6a5207
--- /dev/null
+++ b/examples/hands-on-table-chat/.gitignore
@@ -0,0 +1,41 @@
+# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
+
+# dependencies
+/node_modules
+/.pnp
+.pnp.*
+.yarn/*
+!.yarn/patches
+!.yarn/plugins
+!.yarn/releases
+!.yarn/versions
+
+# testing
+/coverage
+
+# next.js
+/.next/
+/out/
+
+# production
+/build
+
+# misc
+.DS_Store
+*.pem
+
+# debug
+npm-debug.log*
+yarn-debug.log*
+yarn-error.log*
+.pnpm-debug.log*
+
+# env files (can opt-in for committing if needed)
+.env*
+
+# vercel
+.vercel
+
+# typescript
+*.tsbuildinfo
+next-env.d.ts
diff --git a/examples/hands-on-table-chat/README.md b/examples/hands-on-table-chat/README.md
new file mode 100644
index 000000000..e95cbb39e
--- /dev/null
+++ b/examples/hands-on-table-chat/README.md
@@ -0,0 +1,149 @@
+# Handsontable + OpenUI Chat
+
+An AI-powered spreadsheet app that pairs a full-featured [Handsontable](https://handsontable.com/) grid with an [OpenUI](https://openui.com) chat panel. Ask the AI to analyze, visualize, or modify your data — changes sync to the live spreadsheet in real time.
+
+![Next.js](https://img.shields.io/badge/Next.js-16-black?logo=next.js)
+![Handsontable](https://img.shields.io/badge/Handsontable-17-blue)
+![OpenUI](https://img.shields.io/badge/OpenUI-0.11-purple)
+
+## Features
+
+- **Live spreadsheet** — Handsontable grid with Excel-like editing, 386+ formula functions (via HyperFormula), context menus, column resizing, and CSV export
+- **AI chat panel** — OpenUI Copilot sidebar that understands the spreadsheet context and responds with rich UI (charts, tables, markdown)
+- **Bidirectional sync** — AI tool calls mutate the server-side table store, then push updates back to the grid via a `SpreadsheetTable` component
+- **Formula-aware row operations** — Adding or deleting rows automatically shifts cell references in formulas (mirrors Excel/Sheets behavior)
+- **Aggregate recalculation** — Total/Average/Sum/Count/Max/Min rows auto-update their formula ranges after structural changes
+- **Dark theme** — Fully dark UI for both the spreadsheet and chat panel
+
+## Architecture
+
+```
+┌─────────────────────────────────┐ ┌──────────────────────────┐
+│ Spreadsheet Panel │ │ Chat Panel │
+│ PersistentSpreadsheet.tsx │ │ OpenUI <Copilot /> │
+│ (Handsontable + HyperFormula) │ │ spreadsheet-library.tsx │
+└──────────────┬──────────────────┘ └────────────┬─────────────┘
+ │ │
+ │ POST /api/table │ POST /api/chat (SSE)
+ │ (user edits → server store) │ (messages → OpenAI → tool calls → SSE)
+ ▼ ▼
+ ┌─────────────────────────────────────────────┐
+ │ Server (Next.js API Routes) │
+ │ tableStore.ts — in-memory table state │
+ │ tools.ts — 8 spreadsheet tools for the LLM │
+ │ messageStore.ts — conversation history │
+ └─────────────────────────────────────────────┘
+```
+
+**Data flow:**
+
+1. User types a message in the chat panel
+2. The message hits `POST /api/chat`, which streams an OpenAI completion with tool calls
+3. Tools (`get_table_data`, `update_cells`, `add_rows`, `delete_rows`, `set_formula`, `query_table`, `add_column`, `recalculate_aggregates`) read/write the in-memory `tableStore`
+4. After write operations, the LLM emits a `SpreadsheetTable` component in its OpenUI Lang response
+5. The `useSpreadsheetSync` hook picks up the new data and pushes it into Handsontable via React context
+6. User edits in the grid sync back to the server via `POST /api/table`
+
+## Available AI Tools
+
+| Tool | Description |
+|------|-------------|
+| `get_table_data` | Read current table data, headers, and dimensions |
+| `update_cells` | Update one or more cells (values or formulas) |
+| `add_rows` | Insert rows at a position (formulas auto-shift) |
+| `delete_rows` | Remove rows by index (formulas auto-shrink) |
+| `set_formula` | Set an Excel-like formula in a cell |
+| `query_table` | Filter rows by column value with comparison operators |
+| `add_column` | Add a new column with a header name |
+| `recalculate_aggregates` | Rewrite Total/Average/Sum rows to cover current data range |
+
+## Getting Started
+
+### Prerequisites
+
+- Node.js 18+
+- An [OpenAI API key](https://platform.openai.com/api-keys) (GPT-4o recommended)
+
+### Setup
+
+```bash
+cd examples/hands-on-table-chat
+
+# Copy the environment template and add your API key
+cp env.example .env
+# Edit .env and set OPENAI_API_KEY=sk-...
+
+# Install dependencies
+pnpm install
+
+# Start the dev server
+pnpm dev
+```
+
+Open [http://localhost:3000](http://localhost:3000) to see the spreadsheet with the AI chat panel.
+
+### Environment Variables
+
+| Variable | Required | Default | Description |
+|----------|----------|---------|-------------|
+| `OPENAI_API_KEY` | Yes | — | Your OpenAI API key |
+| `OPENAI_MODEL` | No | `gpt-4o` | Model to use for chat completions |
+
+## Project Structure
+
+```
+hands-on-table-chat/
+├── src/
+│ ├── app/
+│ │ ├── page.tsx # Main layout: spreadsheet + chat panels
+│ │ ├── layout.tsx # Root layout with metadata
+│ │ ├── globals.css # Dark theme styles for grid + chat
+│ │ ├── PersistentSpreadsheet.tsx # Handsontable wrapper with HyperFormula
+│ │ ├── TableContext.tsx # React context for shared table state
+│ │ ├── useSpreadsheetSync.ts # Hook to push AI data into the grid
+│ │ └── api/
+│ │ ├── chat/
+│ │ │ ├── route.ts # POST endpoint — OpenAI streaming + tool loop
+│ │ │ ├── tools.ts # 8 spreadsheet tools for the LLM
+│ │ │ ├── tableStore.ts # In-memory table state + formula shifting
+│ │ │ └── messageStore.ts # Conversation history store
+│ │ └── table/
+│ │ └── route.ts # GET/POST for client ↔ server table sync
+│ ├── generated/
+│ │ └── system-prompt.txt # Auto-generated OpenUI Lang prompt
+│ └── lib/
+│ └── spreadsheet-library.tsx # OpenUI component library with SpreadsheetTable
+├── env.example # Environment variable template
+├── package.json
+├── tsconfig.json
+├── next.config.ts
+├── postcss.config.mjs
+└── eslint.config.mjs
+```
+
+## Key Dependencies
+
+| Package | Purpose |
+|---------|---------|
+| [`handsontable`](https://handsontable.com/) | Excel-like data grid |
+| [`@handsontable/react-wrapper`](https://www.npmjs.com/package/@handsontable/react-wrapper) | React bindings for Handsontable |
+| [`hyperformula`](https://hyperformula.handsontable.com/) | Formula engine (386+ Excel-compatible functions) |
+| [`@openuidev/react-ui`](https://openui.com/docs) | OpenUI chat Copilot component |
+| [`@openuidev/react-headless`](https://openui.com/docs) | OpenUI adapter and message formatting |
+| [`@openuidev/react-lang`](https://openui.com/docs) | OpenUI Lang component library DSL |
+| [`openai`](https://www.npmjs.com/package/openai) | OpenAI SDK for chat completions with tool calling |
+| [`next`](https://nextjs.org/) | React framework with API routes and SSE streaming |
+
+## Try These Prompts
+
+- **"Chart revenue by quarter"** — generates a bar chart from the spreadsheet data
+- **"Add Vision Pro to the lineup"** — inserts a new product row with formulas
+- **"Add a profit margin column"** — adds a calculated column
+- **"Revenue breakdown by category"** — pie chart of annual revenue by category
+- **"Compare Q1 vs Q4 growth"** — table with percentage growth calculations
+
+## Learn More
+
+- [OpenUI Documentation](https://openui.com/docs)
+- [Handsontable Documentation](https://handsontable.com/docs)
+- [OpenUI GitHub](https://github.com/thesysdev/openui)
diff --git a/examples/hands-on-table-chat/env.example b/examples/hands-on-table-chat/env.example
new file mode 100644
index 000000000..792647b13
--- /dev/null
+++ b/examples/hands-on-table-chat/env.example
@@ -0,0 +1,5 @@
+# OpenAI API Key
+OPENAI_API_KEY=your_openai_api_key_here
+
+# Optional: Override the model (default: gpt-4o)
+# OPENAI_MODEL=gpt-4o
diff --git a/examples/hands-on-table-chat/eslint.config.mjs b/examples/hands-on-table-chat/eslint.config.mjs
new file mode 100644
index 000000000..05e726d1b
--- /dev/null
+++ b/examples/hands-on-table-chat/eslint.config.mjs
@@ -0,0 +1,18 @@
+import { defineConfig, globalIgnores } from "eslint/config";
+import nextVitals from "eslint-config-next/core-web-vitals";
+import nextTs from "eslint-config-next/typescript";
+
+const eslintConfig = defineConfig([
+ ...nextVitals,
+ ...nextTs,
+ // Override default ignores of eslint-config-next.
+ globalIgnores([
+ // Default ignores of eslint-config-next:
+ ".next/**",
+ "out/**",
+ "build/**",
+ "next-env.d.ts",
+ ]),
+]);
+
+export default eslintConfig;
diff --git a/examples/hands-on-table-chat/next.config.ts b/examples/hands-on-table-chat/next.config.ts
new file mode 100644
index 000000000..e9ffa3083
--- /dev/null
+++ b/examples/hands-on-table-chat/next.config.ts
@@ -0,0 +1,7 @@
+import type { NextConfig } from "next";
+
+const nextConfig: NextConfig = {
+ /* config options here */
+};
+
+export default nextConfig;
diff --git a/examples/hands-on-table-chat/package.json b/examples/hands-on-table-chat/package.json
new file mode 100644
index 000000000..130786705
--- /dev/null
+++ b/examples/hands-on-table-chat/package.json
@@ -0,0 +1,36 @@
+{
+ "name": "hands-on-openui",
+ "version": "0.1.0",
+ "private": true,
+ "scripts": {
+ "dev": "next dev",
+ "build": "next build",
+ "start": "next start",
+ "lint": "eslint"
+ },
+ "dependencies": {
+ "@handsontable/react-wrapper": "^17.0.1",
+ "@openuidev/cli": "^0.0.6",
+ "@openuidev/react-headless": "^0.8.0",
+ "@openuidev/react-lang": "^0.2.0",
+ "@openuidev/react-ui": "^0.11.0",
+ "handsontable": "^17.0.1",
+ "hyperformula": "^3.2.0",
+ "lucide-react": "^1.8.0",
+ "next": "16.2.3",
+ "openai": "^6.34.0",
+ "react": "19.2.4",
+ "react-dom": "19.2.4",
+ "zod": "^4.3.6"
+ },
+ "devDependencies": {
+ "@tailwindcss/postcss": "^4",
+ "@types/node": "^20",
+ "@types/react": "^19",
+ "@types/react-dom": "^19",
+ "eslint": "^9",
+ "eslint-config-next": "16.2.3",
+ "tailwindcss": "^4",
+ "typescript": "^5"
+ }
+}
diff --git a/examples/hands-on-table-chat/postcss.config.mjs b/examples/hands-on-table-chat/postcss.config.mjs
new file mode 100644
index 000000000..61e36849c
--- /dev/null
+++ b/examples/hands-on-table-chat/postcss.config.mjs
@@ -0,0 +1,7 @@
+const config = {
+ plugins: {
+ "@tailwindcss/postcss": {},
+ },
+};
+
+export default config;
diff --git a/examples/hands-on-table-chat/public/file.svg b/examples/hands-on-table-chat/public/file.svg
new file mode 100644
index 000000000..004145cdd
--- /dev/null
+++ b/examples/hands-on-table-chat/public/file.svg
@@ -0,0 +1 @@
+<svg fill="none" viewBox="0 0 16 16" xmlns="http://www.w3.org/2000/svg"><path d="M14.5 13.5V5.41a1 1 0 0 0-.3-.7L9.8.29A1 1 0 0 0 9.08 0H1.5v13.5A2.5 2.5 0 0 0 4 16h8a2.5 2.5 0 0 0 2.5-2.5m-1.5 0v-7H8v-5H3v12a1 1 0 0 0 1 1h8a1 1 0 0 0 1-1M9.5 5V2.12L12.38 5zM5.13 5h-.62v1.25h2.12V5zm-.62 3h7.12v1.25H4.5zm.62 3h-.62v1.25h7.12V11z" clip-rule="evenodd" fill="#666" fill-rule="evenodd"/></svg>
\ No newline at end of file
diff --git a/examples/hands-on-table-chat/public/globe.svg b/examples/hands-on-table-chat/public/globe.svg
new file mode 100644
index 000000000..567f17b0d
--- /dev/null
+++ b/examples/hands-on-table-chat/public/globe.svg
@@ -0,0 +1 @@
+<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><g clip-path="url(#a)"><path fill-rule="evenodd" clip-rule="evenodd" d="M10.27 14.1a6.5 6.5 0 0 0 3.67-3.45q-1.24.21-2.7.34-.31 1.83-.97 3.1M8 16A8 8 0 1 0 8 0a8 8 0 0 0 0 16m.48-1.52a7 7 0 0 1-.96 0H7.5a4 4 0 0 1-.84-1.32q-.38-.89-.63-2.08a40 40 0 0 0 3.92 0q-.25 1.2-.63 2.08a4 4 0 0 1-.84 1.31zm2.94-4.76q1.66-.15 2.95-.43a7 7 0 0 0 0-2.58q-1.3-.27-2.95-.43a18 18 0 0 1 0 3.44m-1.27-3.54a17 17 0 0 1 0 3.64 39 39 0 0 1-4.3 0 17 17 0 0 1 0-3.64 39 39 0 0 1 4.3 0m1.1-1.17q1.45.13 2.69.34a6.5 6.5 0 0 0-3.67-3.44q.65 1.26.98 3.1M8.48 1.5l.01.02q.41.37.84 1.31.38.89.63 2.08a40 40 0 0 0-3.92 0q.25-1.2.63-2.08a4 4 0 0 1 .85-1.32 7 7 0 0 1 .96 0m-2.75.4a6.5 6.5 0 0 0-3.67 3.44 29 29 0 0 1 2.7-.34q.31-1.83.97-3.1M4.58 6.28q-1.66.16-2.95.43a7 7 0 0 0 0 2.58q1.3.27 2.95.43a18 18 0 0 1 0-3.44m.17 4.71q-1.45-.12-2.69-.34a6.5 6.5 0 0 0 3.67 3.44q-.65-1.27-.98-3.1" fill="#666"/></g><defs><clipPath id="a"><path fill="#fff" d="M0 0h16v16H0z"/></clipPath></defs></svg>
\ No newline at end of file
diff --git a/examples/hands-on-table-chat/public/next.svg b/examples/hands-on-table-chat/public/next.svg
new file mode 100644
index 000000000..5174b28c5
--- /dev/null
+++ b/examples/hands-on-table-chat/public/next.svg
@@ -0,0 +1 @@
+<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 394 80"><path fill="#000" d="M262 0h68.5v12.7h-27.2v66.6h-13.6V12.7H262V0ZM149 0v12.7H94v20.4h44.3v12.6H94v21h55v12.6H80.5V0h68.7zm34.3 0h-17.8l63.8 79.4h17.9l-32-39.7 32-39.6h-17.9l-23 28.6-23-28.6zm18.3 56.7-9-11-27.1 33.7h17.8l18.3-22.7z"/><path fill="#000" d="M81 79.3 17 0H0v79.3h13.6V17l50.2 62.3H81Zm252.6-.4c-1 0-1.8-.4-2.5-1s-1.1-1.6-1.1-2.6.3-1.8 1-2.5 1.6-1 2.6-1 1.8.3 2.5 1a3.4 3.4 0 0 1 .6 4.3 3.7 3.7 0 0 1-3 1.8zm23.2-33.5h6v23.3c0 2.1-.4 4-1.3 5.5a9.1 9.1 0 0 1-3.8 3.5c-1.6.8-3.5 1.3-5.7 1.3-2 0-3.7-.4-5.3-1s-2.8-1.8-3.7-3.2c-.9-1.3-1.4-3-1.4-5h6c.1.8.3 1.6.7 2.2s1 1.2 1.6 1.5c.7.4 1.5.5 2.4.5 1 0 1.8-.2 2.4-.6a4 4 0 0 0 1.6-1.8c.3-.8.5-1.8.5-3V45.5zm30.9 9.1a4.4 4.4 0 0 0-2-3.3 7.5 7.5 0 0 0-4.3-1.1c-1.3 0-2.4.2-3.3.5-.9.4-1.6 1-2 1.6a3.5 3.5 0 0 0-.3 4c.3.5.7.9 1.3 1.2l1.8 1 2 .5 3.2.8c1.3.3 2.5.7 3.7 1.2a13 13 0 0 1 3.2 1.8 8.1 8.1 0 0 1 3 6.5c0 2-.5 3.7-1.5 5.1a10 10 0 0 1-4.4 3.5c-1.8.8-4.1 1.2-6.8 1.2-2.6 0-4.9-.4-6.8-1.2-2-.8-3.4-2-4.5-3.5a10 10 0 0 1-1.7-5.6h6a5 5 0 0 0 3.5 4.6c1 .4 2.2.6 3.4.6 1.3 0 2.5-.2 3.5-.6 1-.4 1.8-1 2.4-1.7a4 4 0 0 0 .8-2.4c0-.9-.2-1.6-.7-2.2a11 11 0 0 0-2.1-1.4l-3.2-1-3.8-1c-2.8-.7-5-1.7-6.6-3.2a7.2 7.2 0 0 1-2.4-5.7 8 8 0 0 1 1.7-5 10 10 0 0 1 4.3-3.5c2-.8 4-1.2 6.4-1.2 2.3 0 4.4.4 6.2 1.2 1.8.8 3.2 2 4.3 3.4 1 1.4 1.5 3 1.5 5h-5.8z"/></svg>
\ No newline at end of file
diff --git a/examples/hands-on-table-chat/public/vercel.svg b/examples/hands-on-table-chat/public/vercel.svg
new file mode 100644
index 000000000..770539603
--- /dev/null
+++ b/examples/hands-on-table-chat/public/vercel.svg
@@ -0,0 +1 @@
+<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 1155 1000"><path d="m577.3 0 577.4 1000H0z" fill="#fff"/></svg>
\ No newline at end of file
diff --git a/examples/hands-on-table-chat/public/window.svg b/examples/hands-on-table-chat/public/window.svg
new file mode 100644
index 000000000..b2b2a44f6
--- /dev/null
+++ b/examples/hands-on-table-chat/public/window.svg
@@ -0,0 +1 @@
+<svg fill="none" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16"><path fill-rule="evenodd" clip-rule="evenodd" d="M1.5 2.5h13v10a1 1 0 0 1-1 1h-11a1 1 0 0 1-1-1zM0 1h16v11.5a2.5 2.5 0 0 1-2.5 2.5h-11A2.5 2.5 0 0 1 0 12.5zm3.75 4.5a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5M7 4.75a.75.75 0 1 1-1.5 0 .75.75 0 0 1 1.5 0m1.75.75a.75.75 0 1 0 0-1.5.75.75 0 0 0 0 1.5" fill="#666"/></svg>
\ No newline at end of file
diff --git a/examples/hands-on-table-chat/src/app/PersistentSpreadsheet.tsx b/examples/hands-on-table-chat/src/app/PersistentSpreadsheet.tsx
new file mode 100644
index 000000000..2cea537be
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/PersistentSpreadsheet.tsx
@@ -0,0 +1,228 @@
+"use client";
+
+import "handsontable/styles/handsontable.css";
+import "handsontable/styles/ht-theme-main.css";
+import { useEffect, useRef, useCallback, useState } from "react";
+import type { CellChange, ChangeSource } from "handsontable/common";
+import { useTableContext } from "./TableContext";
+
+type CellValue = string | number | null;
+
+function deepClone<T>(obj: T): T {
+ return JSON.parse(JSON.stringify(obj));
+}
+
+const DEFAULT_DATA: CellValue[][] = Array.from({ length: 10 }, () =>
+ Array(6).fill(null)
+);
+
+/* eslint-disable @typescript-eslint/no-explicit-any */
+let HotTable: any = null;
+let HyperFormula: any = null;
+let modulesLoaded = false;
+
+export default function PersistentSpreadsheet() {
+ const { tableData, syncTableData } = useTableContext();
+ const hotRef = useRef<any>(null);
+ const containerRef = useRef<HTMLDivElement>(null);
+ const [isClient, setIsClient] = useState(false);
+ const [isInitialized, setIsInitialized] = useState(false);
+ const [containerHeight, setContainerHeight] = useState(400);
+
+ const lastContextDataRef = useRef<string>("");
+ const isSyncingRef = useRef(false);
+ const colHeadersRef = useRef<string[] | undefined>(tableData?.colHeaders);
+
+ useEffect(() => {
+ const updateSize = () => {
+ if (containerRef.current) {
+ const rect = containerRef.current.getBoundingClientRect();
+ setContainerHeight(rect.height > 0 ? rect.height : 400);
+ }
+ // Tell Handsontable to re-render with new dimensions
+ const hot = hotRef.current?.hotInstance;
+ if (hot) {
+ hot.refreshDimensions();
+ hot.render();
+ }
+ };
+ updateSize();
+ window.addEventListener("resize", updateSize);
+ const t = setTimeout(updateSize, 100);
+ return () => {
+ window.removeEventListener("resize", updateSize);
+ clearTimeout(t);
+ };
+ }, [isClient]);
+
+ useEffect(() => {
+ const load = async () => {
+ if (typeof window !== "undefined" && !modulesLoaded) {
+ const [hotModule, hfModule, registryModule] = await Promise.all([
+ import("@handsontable/react-wrapper"),
+ import("hyperformula"),
+ import("handsontable/registry"),
+ ]);
+ HotTable = hotModule.HotTable;
+ HyperFormula = hfModule.HyperFormula;
+ registryModule.registerAllModules();
+ modulesLoaded = true;
+ setIsClient(true);
+ } else if (modulesLoaded) {
+ setIsClient(true);
+ }
+ };
+ load();
+ }, []);
+
+ const saveData = useCallback(
+ async (data: CellValue[][], colHeaders?: string[]) => {
+ if (isSyncingRef.current) return;
+ try {
+ isSyncingRef.current = true;
+ await syncTableData(data, colHeaders || colHeadersRef.current);
+ } catch (e) {
+ console.error("Failed to save table data:", e);
+ } finally {
+ isSyncingRef.current = false;
+ }
+ },
+ [syncTableData]
+ );
+
+ useEffect(() => {
+ const hot = hotRef.current?.hotInstance;
+ if (!hot || isInitialized) return;
+
+ const data = tableData?.data || DEFAULT_DATA;
+ const colHeaders = tableData?.colHeaders;
+
+ hot.loadData(deepClone(data));
+ if (colHeaders) {
+ hot.updateSettings({ colHeaders });
+ colHeadersRef.current = colHeaders;
+ }
+
+ lastContextDataRef.current = JSON.stringify(tableData);
+ setIsInitialized(true);
+ }, [isClient, tableData, isInitialized]);
+
+ useEffect(() => {
+ const hot = hotRef.current?.hotInstance;
+ if (!hot || !isInitialized || isSyncingRef.current) return;
+
+ const str = JSON.stringify(tableData);
+ if (str !== lastContextDataRef.current && tableData?.data) {
+ lastContextDataRef.current = str;
+ hot.loadData(deepClone(tableData.data));
+ if (tableData.colHeaders) {
+ hot.updateSettings({ colHeaders: tableData.colHeaders });
+ colHeadersRef.current = tableData.colHeaders;
+ }
+ }
+ }, [tableData, isInitialized]);
+
+ const handleAfterChange = useCallback(
+ (changes: CellChange[] | null, source: ChangeSource) => {
+ if (source === "loadData" || !changes) return;
+ const hot = hotRef.current?.hotInstance;
+ if (hot) saveData(hot.getData() as CellValue[][]);
+ },
+ [saveData]
+ );
+
+ const handleStructuralChange = useCallback(() => {
+ const hot = hotRef.current?.hotInstance;
+ if (hot) saveData(hot.getData() as CellValue[][]);
+ }, [saveData]);
+
+ const handleExportCSV = useCallback(() => {
+ const hot = hotRef.current?.hotInstance;
+ if (!hot) return;
+ const exportPlugin = hot.getPlugin("exportFile");
+ exportPlugin?.downloadFile("csv", {
+ bom: false,
+ columnDelimiter: ",",
+ columnHeaders: true,
+ exportHiddenColumns: true,
+ exportHiddenRows: true,
+ fileExtension: "csv",
+ filename: "Spreadsheet_[YYYY]-[MM]-[DD]",
+ mimeType: "text/csv",
+ rowDelimiter: "\r\n",
+ rowHeaders: false,
+ });
+ }, []);
+
+ if (!isClient || !HotTable || !HyperFormula) {
+ return (
+ <div className="persistent-spreadsheet">
+ <div className="flex items-center justify-center h-full">
+ <div className="text-gray-400 text-sm">Loading spreadsheet...</div>
+ </div>
+ </div>
+ );
+ }
+
+ const HotTableComponent = HotTable;
+ const HyperFormulaEngine = HyperFormula;
+ const currentData = tableData?.data || DEFAULT_DATA;
+ const currentHeaders = tableData?.colHeaders;
+
+ return (
+ <div className="persistent-spreadsheet">
+ <div className="flex items-center justify-between px-4 py-2 border-b border-white/10">
+ <div>
+ <h2 className="text-sm font-semibold text-white">Spreadsheet</h2>
+ <p className="text-xs text-gray-500">
+ {currentData.length} rows ×{" "}
+ {currentHeaders?.length || currentData[0]?.length || 0} columns
+ </p>
+ </div>
+ <button
+ onClick={handleExportCSV}
+ className="px-3 py-1.5 text-xs bg-white/10 hover:bg-white/20 text-gray-300 rounded-md transition-colors"
+ >
+ Export CSV
+ </button>
+ </div>
+
+ <div ref={containerRef} className="flex-1 min-h-0 relative">
+ <HotTableComponent
+ ref={hotRef}
+ data={deepClone(currentData)}
+ colHeaders={currentHeaders || true}
+ rowHeaders={true}
+ height={containerHeight}
+ width="auto"
+ licenseKey="non-commercial-and-evaluation"
+ contextMenu={true}
+ manualColumnResize={true}
+ manualRowResize={true}
+ autoWrapRow={true}
+ autoWrapCol={true}
+ minSpareRows={50}
+ cells={(_row: number, col: number) => {
+ if (col >= 2) return { numericFormat: { pattern: "0,0.##" } };
+ return {};
+ }}
+ formulas={{ engine: HyperFormulaEngine }}
+ afterChange={handleAfterChange}
+ afterCreateRow={handleStructuralChange}
+ afterRemoveRow={handleStructuralChange}
+ afterCreateCol={handleStructuralChange}
+ afterRemoveCol={handleStructuralChange}
+ className="htDark"
+ stretchH="all"
+ />
+ </div>
+
+ <div className="px-4 py-1.5 border-t border-white/10">
+ <p className="text-xs text-gray-600">
+ Right-click for options • Formulas supported (=SUM, =AVERAGE, etc.)
+ </p>
+ </div>
+ </div>
+ );
+}
+/* eslint-enable @typescript-eslint/no-explicit-any */
diff --git a/examples/hands-on-table-chat/src/app/TableContext.tsx b/examples/hands-on-table-chat/src/app/TableContext.tsx
new file mode 100644
index 000000000..3b302ff47
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/TableContext.tsx
@@ -0,0 +1,79 @@
+"use client";
+
+import {
+ createContext,
+ useContext,
+ useState,
+ useCallback,
+ type ReactNode,
+} from "react";
+
+type CellValue = string | number | null;
+
+interface TableData {
+ data: CellValue[][];
+ colHeaders?: string[];
+}
+
+interface TableContextType {
+ threadId: string;
+ setThreadId: (id: string) => void;
+ tableData: TableData | null;
+ syncTableData: (data: CellValue[][], colHeaders?: string[]) => Promise<void>;
+}
+
+const INITIAL_TABLE: TableData = {
+ colHeaders: ["Product", "Category", "Q1 Revenue", "Q2 Revenue", "Q3 Revenue", "Q4 Revenue", "Annual Revenue", "Units Sold", "Unit Price"],
+ data: [
+ ["MacBook Pro 16\"", "Laptops", 48500, 52300, 61200, 74800, "=SUM(C1:F1)", 320, 2499],
+ ["iPhone 15 Pro", "Phones", 125000, 98700, 112400, 185600, "=SUM(C2:F2)", 4200, 999],
+ ["AirPods Pro", "Audio", 32400, 28900, 35100, 52800, "=SUM(C3:F3)", 8800, 249],
+ ["iPad Air", "Tablets", 21800, 24500, 19600, 38200, "=SUM(C4:F4)", 1560, 599],
+ ["Apple Watch Ultra", "Wearables", 18200, 21400, 25800, 31600, "=SUM(C5:F5)", 980, 799],
+ ["Mac Mini", "Desktops", 15600, 17200, 14800, 22400, "=SUM(C6:F6)", 620, 599],
+ ["HomePod Mini", "Audio", 8400, 7200, 9600, 18500, "=SUM(C7:F7)", 3700, 99],
+ ["AirTag 4-Pack", "Accessories", 6200, 5800, 7400, 14200, "=SUM(C8:F8)", 5100, 99],
+ ["Total", "", "=SUM(C1:C8)", "=SUM(D1:D8)", "=SUM(E1:E8)", "=SUM(F1:F8)", "=SUM(G1:G8)", "=SUM(H1:H8)", ""],
+ ["Average", "", "=AVERAGE(C1:C8)", "=AVERAGE(D1:D8)", "=AVERAGE(E1:E8)", "=AVERAGE(F1:F8)", "=AVERAGE(G1:G8)", "=AVERAGE(H1:H8)", ""],
+ ],
+};
+
+const TableContext = createContext<TableContextType | null>(null);
+
+export function TableProvider({ children }: { children: ReactNode }) {
+ const [threadId, setThreadIdState] = useState("default");
+ const [tableData, setTableDataState] = useState<TableData | null>(INITIAL_TABLE);
+
+ const setThreadId = useCallback((id: string) => setThreadIdState(id), []);
+
+ const syncTableData = useCallback(
+ async (data: CellValue[][], colHeaders?: string[]) => {
+ setTableDataState({ data, colHeaders });
+
+ try {
+ await fetch("/api/table", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({ threadId, data, colHeaders }),
+ });
+ } catch (error) {
+ console.error("Failed to sync table data:", error);
+ }
+ },
+ [threadId]
+ );
+
+ return (
+ <TableContext.Provider
+ value={{ threadId, setThreadId, tableData, syncTableData }}
+ >
+ {children}
+ </TableContext.Provider>
+ );
+}
+
+export function useTableContext() {
+ const ctx = useContext(TableContext);
+ if (!ctx) throw new Error("useTableContext must be used within TableProvider");
+ return ctx;
+}
diff --git a/examples/hands-on-table-chat/src/app/api/chat/messageStore.ts b/examples/hands-on-table-chat/src/app/api/chat/messageStore.ts
new file mode 100644
index 000000000..35aed78e4
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/api/chat/messageStore.ts
@@ -0,0 +1,25 @@
+import OpenAI from "openai";
+
+export type DBMessage = OpenAI.Chat.ChatCompletionMessageParam & {
+ id?: string;
+};
+
+const messagesStore: Record<string, DBMessage[]> = {};
+
+export const getMessageStore = (id: string) => {
+ if (!messagesStore[id]) messagesStore[id] = [];
+ const messageList = messagesStore[id];
+
+ return {
+ addMessage: (message: DBMessage) => {
+ messageList.push(message);
+ },
+ messageList,
+ getOpenAICompatibleMessageList: () =>
+ messageList.map((m) => {
+ const copy = { ...m };
+ delete copy.id;
+ return copy;
+ }),
+ };
+};
diff --git a/examples/hands-on-table-chat/src/app/api/chat/route.ts b/examples/hands-on-table-chat/src/app/api/chat/route.ts
new file mode 100644
index 000000000..c4e3758c7
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/api/chat/route.ts
@@ -0,0 +1,273 @@
+import { readFileSync } from "fs";
+import { join } from "path";
+import { NextRequest } from "next/server";
+import OpenAI from "openai";
+import type { ChatCompletionMessageParam } from "openai/resources/chat/completions.mjs";
+import { tools, setCurrentThreadId } from "./tools";
+
+const generatedPrompt = readFileSync(
+ join(process.cwd(), "src/generated/system-prompt.txt"),
+ "utf-8"
+);
+
+const SPREADSHEET_INSTRUCTIONS = `
+You are a helpful spreadsheet assistant. The user has a live Excel-like spreadsheet visible on the left panel at all times.
+
+CAPABILITIES:
+- View and analyze the current table data via the get_table_data tool
+- Update individual cells or ranges
+- Add formulas (386+ Excel-compatible functions: SUM, AVERAGE, IF, VLOOKUP, etc.)
+- Add or delete rows and columns
+- Query/filter data
+
+CRITICAL RULES:
+
+1. DO NOT modify the spreadsheet unless the user explicitly asks you to. Requests like "visualize", "show me", "analyze", "summarize" are READ-ONLY. For these, NEVER call update_cells, add_rows, delete_rows, set_formula, or add_column.
+
+2. For READ-ONLY requests: use TextContent, MarkDownRenderer, Table, BarChart, LineChart, PieChart to display information. Do NOT use SpreadsheetTable for read-only requests.
+
+3. For WRITE requests (user explicitly asks to change/add/delete data):
+ a. Use the modification tools (update_cells, add_rows, delete_rows, set_formula, add_column).
+ b. IMMEDIATELY after add_rows or delete_rows, ALWAYS call recalculate_aggregates to update Total/Average/Sum formulas.
+ c. Then call get_table_data to get the updated data.
+ d. Then you MUST emit a SpreadsheetTable component with the full updated data and colHeaders. This is how the live spreadsheet gets refreshed. Include it at the END of your response.
+ e. Also include a TextContent message explaining what you changed.
+
+4. Only call get_table_data when you need to read data (to answer a question or before/after a modification).
+
+5. For tool calls, use zero-based indices (row 0, col 0 = cell A1). Cell references in formulas use Excel notation (A1, B2, etc.).
+
+6. Common formulas: =SUM(range), =AVERAGE(range), =COUNT(range), =MAX(range), =MIN(range), =IF(condition, true_val, false_val)
+
+IMPORTANT — OUTPUT FORMAT:
+You MUST ALWAYS respond using OpenUI Lang syntax as described below. NEVER output plain text or markdown. Every response must define root = Stack([...]). Use TextContent for text paragraphs, MarkDownRenderer for formatted text, Table for tabular summaries, chart components for visualizations, and SpreadsheetTable ONLY after write operations to sync changes to the live spreadsheet.
+
+FOLLOW-UP BUTTONS:
+At the END of every response, ALWAYS include 2-3 follow-up suggestion buttons using Buttons([...]) with Button components. These help the user continue the conversation. Buttons without an Action prop automatically send their label as a message to you.
+
+Examples of good follow-ups:
+- After showing a summary: "Visualize this data", "Add a new product", "Show growth trends"
+- After a modification: "Undo this change", "Show me the updated data", "Add another row"
+- After a chart: "Break down by product", "Show as a table instead", "Compare Q1 vs Q4"
+
+The follow-up buttons should be contextually relevant to what you just did.
+`;
+
+const systemPrompt = SPREADSHEET_INSTRUCTIONS + "\n\n" + generatedPrompt;
+
+/* eslint-disable @typescript-eslint/no-explicit-any */
+function extractText(msg: any): string {
+ const content = msg?.content;
+ if (typeof content === "string") {
+ try {
+ const parsed = JSON.parse(content);
+ if (parsed?.parts)
+ return parsed.parts
+ .filter((p: any) => p.type === "text")
+ .map((p: any) => p.text)
+ .join("");
+ } catch {
+ /* plain string */
+ }
+ return content;
+ }
+ if (Array.isArray(content))
+ return content
+ .filter((p: any) => p.type === "text")
+ .map((p: any) => p.text)
+ .join("");
+ return JSON.stringify(msg);
+}
+/* eslint-enable @typescript-eslint/no-explicit-any */
+
+function sseToolCallStart(
+ encoder: TextEncoder,
+ tc: { id: string; function: { name: string } },
+ index: number
+) {
+ return encoder.encode(
+ `data: ${JSON.stringify({
+ id: `chatcmpl-tc-${tc.id}`,
+ object: "chat.completion.chunk",
+ choices: [
+ {
+ index: 0,
+ delta: {
+ tool_calls: [
+ {
+ index,
+ id: tc.id,
+ type: "function",
+ function: { name: tc.function.name, arguments: "" },
+ },
+ ],
+ },
+ finish_reason: null,
+ },
+ ],
+ })}\n\n`
+ );
+}
+
+function sseToolCallArgs(
+ encoder: TextEncoder,
+ tc: { id: string; function: { arguments: string } },
+ result: string,
+ index: number
+) {
+ let enrichedArgs: string;
+ try {
+ enrichedArgs = JSON.stringify({
+ _request: JSON.parse(tc.function.arguments),
+ _response: JSON.parse(result),
+ });
+ } catch {
+ enrichedArgs = tc.function.arguments;
+ }
+ return encoder.encode(
+ `data: ${JSON.stringify({
+ id: `chatcmpl-tc-${tc.id}-args`,
+ object: "chat.completion.chunk",
+ choices: [
+ {
+ index: 0,
+ delta: {
+ tool_calls: [{ index, function: { arguments: enrichedArgs } }],
+ },
+ finish_reason: null,
+ },
+ ],
+ })}\n\n`
+ );
+}
+
+export async function POST(req: NextRequest) {
+ const { messages, threadId } = await req.json();
+
+ setCurrentThreadId(threadId ?? "default");
+
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ const lastUserMsg = (messages as any[])
+ .filter((m: any) => m.role === "user")
+ .pop();
+ if (lastUserMsg) extractText(lastUserMsg);
+
+ const cleanMessages = (messages as any[])
+ .filter((m) => m.role !== "tool")
+ .map((m) => {
+ if (m.role === "assistant" && m.tool_calls?.length) {
+ const { tool_calls: _tc, ...rest } = m;
+ return rest;
+ }
+ return m;
+ });
+ /* eslint-enable @typescript-eslint/no-explicit-any */
+
+ const chatMessages: ChatCompletionMessageParam[] = [
+ { role: "system", content: systemPrompt },
+ ...cleanMessages,
+ ];
+
+ const client = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
+ const encoder = new TextEncoder();
+ let controllerClosed = false;
+
+ const readable = new ReadableStream({
+ start(controller) {
+ const enqueue = (data: Uint8Array) => {
+ if (controllerClosed) return;
+ try {
+ controller.enqueue(data);
+ } catch {
+ /* closed */
+ }
+ };
+ const close = () => {
+ if (controllerClosed) return;
+ controllerClosed = true;
+ try {
+ controller.close();
+ } catch {
+ /* closed */
+ }
+ };
+
+ let fullResponse = "";
+ const pendingCalls: Array<{
+ id: string;
+ name: string;
+ arguments: string;
+ }> = [];
+ let callIdx = 0;
+ let resultIdx = 0;
+
+ /* eslint-disable @typescript-eslint/no-explicit-any */
+ const runner = (client.chat.completions as any).runTools({
+ model: process.env.OPENAI_MODEL || "gpt-4o",
+ messages: chatMessages,
+ tools,
+ stream: true,
+ });
+
+ runner.on("functionToolCall", (fc: any) => {
+ const id = `tc-${callIdx}`;
+ pendingCalls.push({ id, name: fc.name, arguments: fc.arguments });
+ enqueue(
+ sseToolCallStart(encoder, { id, function: { name: fc.name } }, callIdx)
+ );
+ callIdx++;
+ });
+
+ runner.on("functionToolCallResult", (result: string) => {
+ const tc = pendingCalls[resultIdx];
+ if (tc) {
+ enqueue(
+ sseToolCallArgs(
+ encoder,
+ { id: tc.id, function: { arguments: tc.arguments } },
+ result,
+ resultIdx
+ )
+ );
+ }
+ resultIdx++;
+ });
+
+ runner.on("chunk", (chunk: any) => {
+ const choice = chunk.choices?.[0];
+ const delta = choice?.delta;
+ if (!delta) return;
+ if (delta.content) {
+ fullResponse += delta.content;
+ enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
+ }
+ if (choice?.finish_reason === "stop") {
+ enqueue(encoder.encode(`data: ${JSON.stringify(chunk)}\n\n`));
+ }
+ });
+
+ runner.on("end", () => {
+ enqueue(encoder.encode("data: [DONE]\n\n"));
+ close();
+ });
+
+ runner.on("error", (err: any) => {
+ const msg = err instanceof Error ? err.message : "Stream error";
+ console.error("Chat route error:", msg);
+ enqueue(
+ encoder.encode(`data: ${JSON.stringify({ error: msg })}\n\n`)
+ );
+ close();
+ });
+ /* eslint-enable @typescript-eslint/no-explicit-any */
+ },
+ });
+
+ return new Response(readable, {
+ headers: {
+ "Content-Type": "text/event-stream",
+ "Cache-Control": "no-cache, no-transform",
+ Connection: "keep-alive",
+ },
+ });
+}
diff --git a/examples/hands-on-table-chat/src/app/api/chat/tableStore.ts b/examples/hands-on-table-chat/src/app/api/chat/tableStore.ts
new file mode 100644
index 000000000..57a5c9ca8
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/api/chat/tableStore.ts
@@ -0,0 +1,421 @@
+export type CellValue = string | number | null;
+export type TableData = CellValue[][];
+
+export interface TableState {
+ data: TableData;
+ colHeaders: string[];
+}
+
+const DEFAULT_TABLE_STATE: TableState = {
+ colHeaders: [
+ "Product",
+ "Category",
+ "Q1 Revenue",
+ "Q2 Revenue",
+ "Q3 Revenue",
+ "Q4 Revenue",
+ "Annual Revenue",
+ "Units Sold",
+ "Unit Price",
+ ],
+ data: [
+ ["MacBook Pro 16\"", "Laptops", 48500, 52300, 61200, 74800, "=SUM(C1:F1)", 320, 2499],
+ ["iPhone 15 Pro", "Phones", 125000, 98700, 112400, 185600, "=SUM(C2:F2)", 4200, 999],
+ ["AirPods Pro", "Audio", 32400, 28900, 35100, 52800, "=SUM(C3:F3)", 8800, 249],
+ ["iPad Air", "Tablets", 21800, 24500, 19600, 38200, "=SUM(C4:F4)", 1560, 599],
+ ["Apple Watch Ultra", "Wearables", 18200, 21400, 25800, 31600, "=SUM(C5:F5)", 980, 799],
+ ["Mac Mini", "Desktops", 15600, 17200, 14800, 22400, "=SUM(C6:F6)", 620, 599],
+ ["HomePod Mini", "Audio", 8400, 7200, 9600, 18500, "=SUM(C7:F7)", 3700, 99],
+ ["AirTag 4-Pack", "Accessories", 6200, 5800, 7400, 14200, "=SUM(C8:F8)", 5100, 99],
+ [
+ "Total",
+ "",
+ "=SUM(C1:C8)",
+ "=SUM(D1:D8)",
+ "=SUM(E1:E8)",
+ "=SUM(F1:F8)",
+ "=SUM(G1:G8)",
+ "=SUM(H1:H8)",
+ "",
+ ],
+ [
+ "Average",
+ "",
+ "=AVERAGE(C1:C8)",
+ "=AVERAGE(D1:D8)",
+ "=AVERAGE(E1:E8)",
+ "=AVERAGE(F1:F8)",
+ "=AVERAGE(G1:G8)",
+ "=AVERAGE(H1:H8)",
+ "",
+ ],
+ ],
+};
+
+/**
+ * Adjusts cell references in formulas when rows are inserted.
+ * insertPosition is 0-based data index. count is number of rows inserted.
+ *
+ * Two behaviors (mirroring Excel/Sheets):
+ * 1. Range refs like B1:B5 — if inserting at or just after the range end,
+ * expand the end ref. E.g. insert at index 5 → =SUM(B1:B5) becomes =SUM(B1:B6).
+ * 2. Single refs and refs past the insert point shift down.
+ */
+function shiftFormulaRows(
+ formula: string,
+ insertPosition: number,
+ count: number
+): string {
+ if (!formula.startsWith("=")) return formula;
+
+ // Step 1: Expand range end-refs (e.g. B1:B5 → B1:B6 when inserting at position 5)
+ // A range like X<start>:X<end> where end (1-based) == insertPosition should expand.
+ formula = formula.replace(
+ /([A-Z]+)(\d+):([A-Z]+)(\d+)/gi,
+ (match, col1, startStr, col2, endStr) => {
+ const startRow = parseInt(startStr, 10);
+ const endRow = parseInt(endStr, 10);
+ let newEnd = endRow;
+ // endRow is 1-based; insertPosition is 0-based.
+ // If inserting at index 5, that's between 1-based rows 5 and 6.
+ // A range ending at row 5 (index 4) should expand to row 6 (include new row).
+ // Condition: endRow == insertPosition (1-based row 5 == 0-based index 5)
+ // or endRow > insertPosition (refs past insert point shift down).
+ if (endRow >= insertPosition) {
+ newEnd = endRow + count;
+ }
+ let newStart = startRow;
+ if (startRow > insertPosition) {
+ newStart = startRow + count;
+ }
+ return `${col1}${newStart}:${col2}${newEnd}`;
+ }
+ );
+
+ // Step 2: Shift standalone (non-range) refs past the insert point.
+ // We need to avoid double-shifting refs already handled in ranges.
+ // Process refs that are NOT part of a range (not preceded by : or followed by :).
+ formula = formula.replace(
+ /(?<!:)([A-Z]+)(\d+)(?![\d]*:)/gi,
+ (match, col, rowStr) => {
+ const row = parseInt(rowStr, 10);
+ if (row > insertPosition) {
+ return `${col}${row + count}`;
+ }
+ return match;
+ }
+ );
+
+ return formula;
+}
+
+function shrinkFormulaRows(
+ formula: string,
+ deletedPositions: number[]
+): string {
+ if (!formula.startsWith("=")) return formula;
+
+ // Handle ranges first
+ formula = formula.replace(
+ /([A-Z]+)(\d+):([A-Z]+)(\d+)/gi,
+ (match, col1, startStr, col2, endStr) => {
+ const startRow = parseInt(startStr, 10);
+ const endRow = parseInt(endStr, 10);
+ const startShift = deletedPositions.filter((d) => d < startRow - 1).length;
+ const endShift = deletedPositions.filter((d) => d < endRow - 1).length;
+ // Also shrink end if the deleted row was the last in the range
+ const endOnDeleted = deletedPositions.includes(endRow - 1) ? 1 : 0;
+ return `${col1}${startRow - startShift}:${col2}${endRow - endShift - endOnDeleted}`;
+ }
+ );
+
+ // Handle standalone refs
+ formula = formula.replace(
+ /(?<!:)([A-Z]+)(\d+)(?![\d]*:)/gi,
+ (match, col, rowStr) => {
+ const row = parseInt(rowStr, 10);
+ const dataIdx = row - 1;
+ if (deletedPositions.includes(dataIdx)) return match;
+ const shiftBy = deletedPositions.filter((d) => d < dataIdx).length;
+ return shiftBy > 0 ? `${col}${row - shiftBy}` : match;
+ }
+ );
+
+ return formula;
+}
+
+const tableStores: Map<string, TableState> = new Map();
+
+export function getTableStore(threadId: string): TableState {
+ if (!tableStores.has(threadId)) {
+ tableStores.set(threadId, {
+ colHeaders: [...DEFAULT_TABLE_STATE.colHeaders],
+ data: DEFAULT_TABLE_STATE.data.map((row) => [...row]),
+ });
+ }
+ return tableStores.get(threadId)!;
+}
+
+export function getTableData(threadId: string): {
+ data: TableData;
+ colHeaders: string[];
+} {
+ const store = getTableStore(threadId);
+ return { data: store.data, colHeaders: store.colHeaders };
+}
+
+export function updateCells(
+ threadId: string,
+ updates: { row: number; col: number; value: CellValue }[]
+): { success: boolean; message: string } {
+ const store = getTableStore(threadId);
+
+ for (const { row, col, value } of updates) {
+ if (row < 0 || col < 0)
+ return {
+ success: false,
+ message: `Invalid cell position: row ${row}, col ${col}`,
+ };
+
+ while (store.data.length <= row)
+ store.data.push(new Array(store.colHeaders.length).fill(null));
+ while (store.data[row].length <= col) store.data[row].push(null);
+
+ store.data[row][col] = value;
+ }
+
+ return { success: true, message: `Updated ${updates.length} cell(s)` };
+}
+
+export function addRows(
+ threadId: string,
+ rows: CellValue[][],
+ position?: number
+): { success: boolean; message: string; newRowIndices: number[] } {
+ const store = getTableStore(threadId);
+ const insertPosition = position ?? store.data.length;
+ const newRowIndices: number[] = [];
+ const count = rows.length;
+
+ // Shift formula references in existing rows before inserting
+ for (let r = 0; r < store.data.length; r++) {
+ for (let c = 0; c < store.data[r].length; c++) {
+ const val = store.data[r][c];
+ if (typeof val === "string" && val.startsWith("=")) {
+ store.data[r][c] = shiftFormulaRows(val, insertPosition, count);
+ }
+ }
+ }
+
+ for (let i = 0; i < rows.length; i++) {
+ const row = rows[i];
+ while (row.length < store.colHeaders.length) row.push(null);
+ store.data.splice(insertPosition + i, 0, row);
+ newRowIndices.push(insertPosition + i);
+ }
+
+ return {
+ success: true,
+ message: `Added ${rows.length} row(s) at position ${insertPosition}`,
+ newRowIndices,
+ };
+}
+
+export function deleteRows(
+ threadId: string,
+ rowIndices: number[]
+): { success: boolean; message: string } {
+ const store = getTableStore(threadId);
+ const validIndices = rowIndices.filter((i) => i >= 0 && i < store.data.length);
+ const sorted = [...validIndices].sort((a, b) => b - a);
+
+ // Remove rows (from end first so indices stay valid)
+ for (const idx of sorted) {
+ store.data.splice(idx, 1);
+ }
+
+ // Shrink formula references in remaining rows
+ for (let r = 0; r < store.data.length; r++) {
+ for (let c = 0; c < store.data[r].length; c++) {
+ const val = store.data[r][c];
+ if (typeof val === "string" && val.startsWith("=")) {
+ store.data[r][c] = shrinkFormulaRows(val, validIndices);
+ }
+ }
+ }
+
+ return { success: true, message: `Deleted ${validIndices.length} row(s)` };
+}
+
+export function setFormula(
+ threadId: string,
+ row: number,
+ col: number,
+ formula: string
+): { success: boolean; message: string } {
+ const store = getTableStore(threadId);
+ const f = formula.startsWith("=") ? formula : `=${formula}`;
+
+ if (row < 0 || row >= store.data.length)
+ return { success: false, message: `Invalid row index: ${row}` };
+ if (col < 0 || col >= store.colHeaders.length)
+ return { success: false, message: `Invalid column index: ${col}` };
+
+ store.data[row][col] = f;
+ return {
+ success: true,
+ message: `Set formula "${f}" at row ${row}, col ${col}`,
+ };
+}
+
+export function queryTable(
+ threadId: string,
+ columnIndex: number,
+ operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "contains",
+ value: string | number
+): {
+ success: boolean;
+ matchingRows: { rowIndex: number; data: CellValue[] }[];
+ message: string;
+} {
+ const store = getTableStore(threadId);
+ const matchingRows: { rowIndex: number; data: CellValue[] }[] = [];
+
+ for (let i = 0; i < store.data.length; i++) {
+ const cellValue = store.data[i][columnIndex];
+ if (typeof cellValue === "string" && cellValue.startsWith("=")) continue;
+
+ let matches = false;
+ switch (operator) {
+ case "=":
+ matches = cellValue === value;
+ break;
+ case "!=":
+ matches = cellValue !== value;
+ break;
+ case ">":
+ matches =
+ typeof cellValue === "number" &&
+ typeof value === "number" &&
+ cellValue > value;
+ break;
+ case "<":
+ matches =
+ typeof cellValue === "number" &&
+ typeof value === "number" &&
+ cellValue < value;
+ break;
+ case ">=":
+ matches =
+ typeof cellValue === "number" &&
+ typeof value === "number" &&
+ cellValue >= value;
+ break;
+ case "<=":
+ matches =
+ typeof cellValue === "number" &&
+ typeof value === "number" &&
+ cellValue <= value;
+ break;
+ case "contains":
+ matches =
+ typeof cellValue === "string" &&
+ typeof value === "string" &&
+ cellValue.toLowerCase().includes(value.toLowerCase());
+ break;
+ }
+
+ if (matches) matchingRows.push({ rowIndex: i, data: [...store.data[i]] });
+ }
+
+ return {
+ success: true,
+ matchingRows,
+ message: `Found ${matchingRows.length} matching row(s)`,
+ };
+}
+
+const COL_LETTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+function colLetter(idx: number): string {
+ if (idx < 26) return COL_LETTERS[idx];
+ return COL_LETTERS[Math.floor(idx / 26) - 1] + COL_LETTERS[idx % 26];
+}
+
+/**
+ * Finds aggregate rows (Total, Average, Sum, Count, etc.) and rewrites their
+ * formulas so the ranges cover all data rows above them.
+ */
+export function recalculateAggregates(
+ threadId: string
+): { success: boolean; message: string; updatedRows: number[] } {
+ const store = getTableStore(threadId);
+ const aggregateLabels: Record<string, string> = {
+ total: "SUM",
+ sum: "SUM",
+ average: "AVERAGE",
+ avg: "AVERAGE",
+ mean: "AVERAGE",
+ count: "COUNT",
+ max: "MAX",
+ min: "MIN",
+ };
+
+ const updatedRows: number[] = [];
+
+ for (let r = 0; r < store.data.length; r++) {
+ const firstCell = store.data[r][0];
+ if (typeof firstCell !== "string") continue;
+ const label = firstCell.trim().toLowerCase();
+ const func = aggregateLabels[label];
+ if (!func) continue;
+
+ // This is an aggregate row. Find the contiguous data rows above it.
+ // Data rows start at row 0 and go up to (r - 1), skipping any other aggregate rows above.
+ let dataStart = -1;
+ let dataEnd = -1;
+ for (let dr = 0; dr < r; dr++) {
+ const drFirst = store.data[dr][0];
+ const drLabel = typeof drFirst === "string" ? drFirst.trim().toLowerCase() : "";
+ if (aggregateLabels[drLabel]) continue; // skip other aggregate rows
+ if (dataStart === -1) dataStart = dr;
+ dataEnd = dr;
+ }
+
+ if (dataStart === -1) continue; // no data rows found
+
+ const startRow1 = dataStart + 1; // 1-based
+ const endRow1 = dataEnd + 1;
+
+ // Rewrite formulas for columns 1+ (skip column 0 which is the label)
+ for (let c = 1; c < store.data[r].length; c++) {
+ const cl = colLetter(c);
+ store.data[r][c] = `=${func}(${cl}${startRow1}:${cl}${endRow1})`;
+ }
+ updatedRows.push(r);
+ }
+
+ return {
+ success: true,
+ message: updatedRows.length > 0
+ ? `Recalculated ${updatedRows.length} aggregate row(s)`
+ : "No aggregate rows found to recalculate",
+ updatedRows,
+ };
+}
+
+export function addColumn(
+ threadId: string,
+ headerName: string,
+ position?: number
+): { success: boolean; message: string } {
+ const store = getTableStore(threadId);
+ const insertPosition = position ?? store.colHeaders.length;
+
+ store.colHeaders.splice(insertPosition, 0, headerName);
+ for (const row of store.data) row.splice(insertPosition, 0, null);
+
+ return {
+ success: true,
+ message: `Added column "${headerName}" at position ${insertPosition}`,
+ };
+}
diff --git a/examples/hands-on-table-chat/src/app/api/chat/tools.ts b/examples/hands-on-table-chat/src/app/api/chat/tools.ts
new file mode 100644
index 000000000..df412b59c
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/api/chat/tools.ts
@@ -0,0 +1,224 @@
+import {
+ getTableData,
+ updateCells,
+ addRows,
+ deleteRows,
+ setFormula,
+ queryTable,
+ addColumn,
+ recalculateAggregates,
+ CellValue,
+} from "./tableStore";
+
+let currentThreadId = "";
+
+export function setCurrentThreadId(threadId: string) {
+ currentThreadId = threadId;
+}
+
+/* eslint-disable @typescript-eslint/no-explicit-any */
+export const tools: any[] = [
+ {
+ type: "function",
+ function: {
+ name: "get_table_data",
+ description:
+ "Get the current table data including all cell values, formulas, and column headers. Call this first to see the current state of the spreadsheet.",
+ parameters: { type: "object", properties: {}, required: [] },
+ parse: JSON.parse,
+ function: async () => {
+ const result = getTableData(currentThreadId);
+ return JSON.stringify({
+ success: true,
+ colHeaders: result.colHeaders,
+ data: result.data,
+ rowCount: result.data.length,
+ colCount: result.colHeaders.length,
+ message: `Table has ${result.data.length} rows and ${result.colHeaders.length} columns`,
+ });
+ },
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "update_cells",
+ description:
+ "Update one or more cells in the table. Supports values (numbers, strings) or formulas (starting with =).",
+ parameters: {
+ type: "object",
+ properties: {
+ updates: {
+ type: "array",
+ items: {
+ type: "object",
+ properties: {
+ row: { type: "number", description: "Zero-based row index" },
+ col: { type: "number", description: "Zero-based column index" },
+ value: {
+ description: "Cell value: number, string, or formula starting with =",
+ },
+ },
+ required: ["row", "col", "value"],
+ },
+ description: "Array of cell updates to apply",
+ },
+ },
+ required: ["updates"],
+ },
+ parse: JSON.parse,
+ function: async (args: {
+ updates: { row: number; col: number; value: CellValue }[];
+ }) => JSON.stringify(updateCells(currentThreadId, args.updates)),
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "add_rows",
+ description:
+ "Add one or more new rows to the table. Each row is an array of cell values matching the column count. Use the 'position' parameter to insert before summary/formula rows (e.g., Total, Average). Formula references in existing rows auto-adjust when rows are inserted.",
+ parameters: {
+ type: "object",
+ properties: {
+ rows: {
+ type: "array",
+ items: { type: "array", items: {} },
+ description: "Array of rows to add",
+ },
+ position: {
+ type: "number",
+ description: "Zero-based row index to insert at. Omit to append.",
+ },
+ },
+ required: ["rows"],
+ },
+ parse: JSON.parse,
+ function: async (args: { rows: CellValue[][]; position?: number }) =>
+ JSON.stringify(addRows(currentThreadId, args.rows, args.position)),
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "delete_rows",
+ description: "Delete one or more rows from the table by their indices.",
+ parameters: {
+ type: "object",
+ properties: {
+ rowIndices: {
+ type: "array",
+ items: { type: "number" },
+ description: "Zero-based row indices to delete",
+ },
+ },
+ required: ["rowIndices"],
+ },
+ parse: JSON.parse,
+ function: async (args: { rowIndices: number[] }) =>
+ JSON.stringify(deleteRows(currentThreadId, args.rowIndices)),
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "set_formula",
+ description:
+ "Set an Excel-like formula in a specific cell. Supports 386+ functions including SUM, AVERAGE, IF, VLOOKUP, etc.",
+ parameters: {
+ type: "object",
+ properties: {
+ row: { type: "number", description: "Zero-based row index" },
+ col: { type: "number", description: "Zero-based column index" },
+ formula: {
+ type: "string",
+ description: "Excel-like formula, e.g. =SUM(A1:A5)",
+ },
+ },
+ required: ["row", "col", "formula"],
+ },
+ parse: JSON.parse,
+ function: async (args: { row: number; col: number; formula: string }) =>
+ JSON.stringify(
+ setFormula(currentThreadId, args.row, args.col, args.formula)
+ ),
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "query_table",
+ description:
+ "Query the table to find rows matching a condition. Useful for filtering data.",
+ parameters: {
+ type: "object",
+ properties: {
+ columnIndex: {
+ type: "number",
+ description: "Zero-based column index to query",
+ },
+ operator: {
+ type: "string",
+ enum: ["=", "!=", ">", "<", ">=", "<=", "contains"],
+ description: "Comparison operator",
+ },
+ value: { description: "Value to compare against" },
+ },
+ required: ["columnIndex", "operator", "value"],
+ },
+ parse: JSON.parse,
+ function: async (args: {
+ columnIndex: number;
+ operator: "=" | "!=" | ">" | "<" | ">=" | "<=" | "contains";
+ value: string | number;
+ }) =>
+ JSON.stringify(
+ queryTable(
+ currentThreadId,
+ args.columnIndex,
+ args.operator,
+ args.value
+ )
+ ),
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "add_column",
+ description:
+ "Add a new column to the table with the specified header name.",
+ parameters: {
+ type: "object",
+ properties: {
+ headerName: {
+ type: "string",
+ description: "Name for the new column header",
+ },
+ position: {
+ type: "number",
+ description: "Zero-based column index to insert at. Omit to append.",
+ },
+ },
+ required: ["headerName"],
+ },
+ parse: JSON.parse,
+ function: async (args: { headerName: string; position?: number }) =>
+ JSON.stringify(
+ addColumn(currentThreadId, args.headerName, args.position)
+ ),
+ },
+ },
+ {
+ type: "function",
+ function: {
+ name: "recalculate_aggregates",
+ description:
+ "Recalculate all aggregate rows (Total, Average, Sum, Count, Max, Min) so their formulas cover the correct data range. ALWAYS call this after add_rows or delete_rows to keep totals and averages up to date.",
+ parameters: { type: "object", properties: {}, required: [] },
+ parse: JSON.parse,
+ function: async () =>
+ JSON.stringify(recalculateAggregates(currentThreadId)),
+ },
+ },
+];
diff --git a/examples/hands-on-table-chat/src/app/api/table/route.ts b/examples/hands-on-table-chat/src/app/api/table/route.ts
new file mode 100644
index 000000000..7dec5bc32
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/api/table/route.ts
@@ -0,0 +1,34 @@
+import { NextRequest, NextResponse } from "next/server";
+import { getTableData, getTableStore, TableData } from "../chat/tableStore";
+
+export async function GET(req: NextRequest) {
+ const threadId = req.nextUrl.searchParams.get("threadId");
+ if (!threadId)
+ return NextResponse.json({ error: "threadId is required" }, { status: 400 });
+
+ return NextResponse.json(getTableData(threadId));
+}
+
+export async function POST(req: NextRequest) {
+ try {
+ const { threadId, data, colHeaders } = (await req.json()) as {
+ threadId: string;
+ data: TableData;
+ colHeaders?: string[];
+ };
+
+ if (!threadId)
+ return NextResponse.json({ error: "threadId is required" }, { status: 400 });
+ if (!data)
+ return NextResponse.json({ error: "data is required" }, { status: 400 });
+
+ const store = getTableStore(threadId);
+ store.data = data;
+ if (colHeaders) store.colHeaders = colHeaders;
+
+ return NextResponse.json({ success: true, message: "Table data synced" });
+ } catch (error) {
+ console.error("Error syncing table data:", error);
+ return NextResponse.json({ error: "Failed to sync table data" }, { status: 500 });
+ }
+}
diff --git a/examples/hands-on-table-chat/src/app/favicon.ico b/examples/hands-on-table-chat/src/app/favicon.ico
new file mode 100644
index 000000000..718d6fea4
Binary files /dev/null and b/examples/hands-on-table-chat/src/app/favicon.ico differ
diff --git a/examples/hands-on-table-chat/src/app/globals.css b/examples/hands-on-table-chat/src/app/globals.css
new file mode 100644
index 000000000..cec7e6528
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/globals.css
@@ -0,0 +1,234 @@
+@import "tailwindcss";
+
+:root {
+ --background: #0a0a0a;
+ --foreground: #ededed;
+}
+
+@theme inline {
+ --color-background: var(--background);
+ --color-foreground: var(--foreground);
+}
+
+html,
+body {
+ margin: 0;
+ padding: 0;
+ height: 100%;
+ overflow: hidden;
+}
+
+body {
+ color: var(--foreground);
+ background: var(--background);
+ font-family: Arial, Helvetica, sans-serif;
+}
+
+/* Handsontable dark mode */
+.handsontable {
+ font-size: 13px;
+}
+
+.handsontable th {
+ background-color: #252525 !important;
+ color: #ededed !important;
+ border-color: #404040 !important;
+}
+
+.handsontable td {
+ background-color: #1a1a1a !important;
+ color: #ededed !important;
+ border-color: #333 !important;
+}
+
+.handsontable td.area {
+ background-color: rgba(59, 130, 246, 0.2) !important;
+}
+
+.handsontable .wtBorder {
+ background-color: #3b82f6 !important;
+}
+
+.htContextMenu {
+ background-color: #1a1a1a !important;
+ border-color: #404040 !important;
+}
+
+.htContextMenu td {
+ background-color: #1a1a1a !important;
+ color: #ededed !important;
+}
+
+.htContextMenu td:hover {
+ background-color: #333 !important;
+}
+
+.htContextMenu td.htDisabled {
+ color: #666 !important;
+}
+
+/* Scrollbar styling */
+::-webkit-scrollbar {
+ width: 8px;
+ height: 8px;
+}
+
+::-webkit-scrollbar-track {
+ background: #1a1a1a;
+}
+
+::-webkit-scrollbar-thumb {
+ background: #404040;
+ border-radius: 4px;
+}
+
+::-webkit-scrollbar-thumb:hover {
+ background: #555;
+}
+
+/* Layout: spreadsheet + optional chat side-by-side */
+.app-layout {
+ display: flex;
+ width: 100vw;
+ height: 100vh;
+ overflow: hidden;
+}
+
+.spreadsheet-panel {
+ flex: 1 1 0%;
+ min-width: 0;
+ height: 100%;
+ background-color: #0f0f0f;
+ overflow: hidden;
+}
+
+/* Chat panel — flex child, no max-width constraint */
+.chat-panel {
+ flex: 0 0 auto;
+ width: 480px;
+ height: 100%;
+ display: flex;
+ flex-direction: column;
+ background-color: #0a0a0a;
+ border-left: 1px solid rgba(255, 255, 255, 0.1);
+ position: relative;
+ overflow: hidden;
+}
+
+.chat-panel__close-row {
+ display: flex;
+ justify-content: flex-end;
+ padding: 8px 8px 0;
+ flex-shrink: 0;
+ position: absolute;
+ top: 0;
+ right: 0;
+ z-index: 10;
+}
+
+.chat-panel__body {
+ flex: 1;
+ min-height: 0;
+ overflow: hidden;
+}
+
+/* Let tables/charts inside chat scroll horizontally instead of clipping */
+.chat-panel table,
+.chat-panel [class*="recharts-wrapper"] {
+ max-width: 100%;
+ overflow-x: auto;
+}
+
+.chat-panel [data-openui-component] {
+ max-width: 100%;
+ overflow-x: auto;
+}
+
+.chat-close-btn {
+ display: flex;
+ align-items: center;
+ justify-content: center;
+ width: 32px;
+ height: 32px;
+ border-radius: 8px;
+ border: 1px solid rgba(255, 255, 255, 0.1);
+ background: rgba(10, 10, 10, 0.8);
+ color: #999;
+ cursor: pointer;
+ transition: background 0.15s, color 0.15s;
+}
+
+.chat-close-btn:hover {
+ background: rgba(255, 255, 255, 0.1);
+ color: #fff;
+}
+
+/* Floating action button to open chat */
+.chat-fab {
+ position: fixed;
+ bottom: 24px;
+ right: 24px;
+ z-index: 90;
+ display: flex;
+ align-items: center;
+ gap: 8px;
+ padding: 12px 20px;
+ border-radius: 50px;
+ border: 1px solid rgba(255, 255, 255, 0.12);
+ background: linear-gradient(135deg, #1a1a2e 0%, #16213e 100%);
+ color: #ededed;
+ font-size: 14px;
+ font-weight: 500;
+ cursor: pointer;
+ box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(59, 130, 246, 0.15);
+ transition: transform 0.15s, box-shadow 0.15s;
+}
+
+.chat-fab:hover {
+ transform: translateY(-2px);
+ box-shadow: 0 6px 28px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(59, 130, 246, 0.3);
+}
+
+.chat-fab__label {
+ white-space: nowrap;
+}
+
+@media (max-width: 768px) {
+ .chat-panel {
+ width: 100vw;
+ }
+ .chat-fab__label {
+ display: none;
+ }
+ .chat-fab {
+ padding: 14px;
+ border-radius: 50%;
+ }
+}
+
+/* Persistent spreadsheet */
+.persistent-spreadsheet {
+ background-color: #0f0f0f;
+ display: flex;
+ flex-direction: column;
+ height: 100%;
+}
+
+.persistent-spreadsheet > div:first-child {
+ flex-shrink: 0;
+}
+
+.persistent-spreadsheet > div:nth-child(2) {
+ flex: 1;
+ min-height: 0;
+ position: relative;
+}
+
+.persistent-spreadsheet > div:last-child {
+ flex-shrink: 0;
+}
+
+.persistent-spreadsheet .handsontable {
+ position: relative;
+ z-index: 1;
+}
diff --git a/examples/hands-on-table-chat/src/app/layout.tsx b/examples/hands-on-table-chat/src/app/layout.tsx
new file mode 100644
index 000000000..df6db07fd
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/layout.tsx
@@ -0,0 +1,18 @@
+import type { Metadata } from "next";
+import "./globals.css";
+
+export const metadata: Metadata = {
+ title: "OpenUI + Handsontable — AI-Powered Spreadsheet",
+ description:
+ "An Excel-like spreadsheet with AI capabilities using OpenUI and Handsontable",
+};
+
+export default function RootLayout({
+ children,
+}: Readonly<{ children: React.ReactNode }>) {
+ return (
+ <html lang="en">
+ <body>{children}</body>
+ </html>
+ );
+}
diff --git a/examples/hands-on-table-chat/src/app/page.tsx b/examples/hands-on-table-chat/src/app/page.tsx
new file mode 100644
index 000000000..c07c8cdb1
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/page.tsx
@@ -0,0 +1,117 @@
+"use client";
+
+import "@openuidev/react-ui/components.css";
+import { openAIMessageFormat, openAIAdapter } from "@openuidev/react-headless";
+import { Copilot } from "@openuidev/react-ui";
+import { spreadsheetLibrary } from "@/lib/spreadsheet-library";
+import { TableProvider, useTableContext } from "./TableContext";
+import { useState, useEffect, useCallback } from "react";
+import { MessageSquare, PanelRightClose } from "lucide-react";
+import dynamic from "next/dynamic";
+
+const PersistentSpreadsheet = dynamic(
+ () => import("./PersistentSpreadsheet"),
+ { ssr: false }
+);
+
+function ChatPanel({ onClose }: { onClose: () => void }) {
+ const { threadId } = useTableContext();
+
+ return (
+ <div className="chat-panel">
+ <div className="chat-panel__close-row">
+ <button onClick={onClose} className="chat-close-btn" aria-label="Close chat">
+ <PanelRightClose size={18} />
+ </button>
+ </div>
+ <div className="chat-panel__body">
+ <Copilot
+ processMessage={async ({ messages, abortController }) => {
+ return fetch("/api/chat", {
+ method: "POST",
+ headers: { "Content-Type": "application/json" },
+ body: JSON.stringify({
+ messages: openAIMessageFormat.toApi(messages),
+ threadId,
+ }),
+ signal: abortController.signal,
+ });
+ }}
+ streamProtocol={openAIAdapter()}
+ componentLibrary={spreadsheetLibrary}
+ agentName="Spreadsheet AI"
+ welcomeMessage={{
+ title: "Spreadsheet AI",
+ description:
+ "I can help you analyze, visualize, and modify your product revenue data.",
+ }}
+ conversationStarters={{
+ variant: "long",
+ options: [
+ {
+ displayText: "Chart revenue by quarter",
+ prompt:
+ "Show me a bar chart comparing Q1 through Q4 revenue for all products.",
+ },
+ {
+ displayText: "Add Vision Pro to the lineup",
+ prompt:
+ "Add a new product 'Vision Pro' in category 'Headsets' with Q1=8200, Q2=11500, Q3=14800, Q4=22000, Units Sold=450, Unit Price=3499, and a SUM formula for Annual Revenue.",
+ },
+ {
+ displayText: "Add a profit margin column",
+ prompt:
+ "Add a new column called 'Profit Margin' that calculates 35% of the Annual Revenue for each product.",
+ },
+ {
+ displayText: "Revenue breakdown by category",
+ prompt:
+ "Show me a pie chart of total annual revenue broken down by category (Laptops, Phones, Audio, etc.).",
+ },
+ {
+ displayText: "Compare Q1 vs Q4 growth",
+ prompt:
+ "Show me a table comparing Q1 and Q4 revenue for each product with the percentage growth.",
+ },
+ ],
+ }}
+ />
+ </div>
+ </div>
+ );
+}
+
+export default function Home() {
+ const [chatOpen, setChatOpen] = useState(true);
+
+ const closeChat = useCallback(() => setChatOpen(false), []);
+
+ useEffect(() => {
+ window.dispatchEvent(new Event("resize"));
+ const t = setTimeout(() => window.dispatchEvent(new Event("resize")), 50);
+ return () => clearTimeout(t);
+ }, [chatOpen]);
+
+ return (
+ <TableProvider>
+ <div className="app-layout">
+ <div className="spreadsheet-panel">
+ <PersistentSpreadsheet />
+ </div>
+
+ {chatOpen && <ChatPanel onClose={closeChat} />}
+
+ {!chatOpen && (
+ <button
+ onClick={() => setChatOpen(true)}
+ className="chat-fab"
+ aria-label="Open chat"
+ >
+ <MessageSquare size={22} />
+ <span className="chat-fab__label">AI Chat</span>
+ </button>
+ )}
+ </div>
+ </TableProvider>
+ );
+}
diff --git a/examples/hands-on-table-chat/src/app/useSpreadsheetSync.ts b/examples/hands-on-table-chat/src/app/useSpreadsheetSync.ts
new file mode 100644
index 000000000..18b167049
--- /dev/null
+++ b/examples/hands-on-table-chat/src/app/useSpreadsheetSync.ts
@@ -0,0 +1,23 @@
+"use client";
+
+import { useEffect, useRef } from "react";
+import { useTableContext } from "./TableContext";
+
+type CellValue = string | number | null;
+
+export function useSpreadsheetSync(
+ data: CellValue[][] | undefined,
+ colHeaders: string[] | undefined
+) {
+ const { syncTableData } = useTableContext();
+ const lastDataRef = useRef<string>("");
+
+ useEffect(() => {
+ if (!data) return;
+ const dataStr = JSON.stringify({ data, colHeaders });
+ if (dataStr !== lastDataRef.current) {
+ lastDataRef.current = dataStr;
+ syncTableData(data, colHeaders);
+ }
+ }, [data, colHeaders, syncTableData]);
+}
diff --git a/examples/hands-on-table-chat/src/generated/system-prompt.txt b/examples/hands-on-table-chat/src/generated/system-prompt.txt
new file mode 100644
index 000000000..d7bffe358
--- /dev/null
+++ b/examples/hands-on-table-chat/src/generated/system-prompt.txt
@@ -0,0 +1,199 @@
+You are a spreadsheet assistant. The user sees a live spreadsheet on the left panel. Always respond in OpenUI Lang (root = Stack([...])). For read-only requests use TextContent, Table, charts. For write requests, after using tools emit SpreadsheetTable to sync changes to the live spreadsheet.
+
+## Syntax Rules
+
+1. Each statement is on its own line: `identifier = Expression`
+2. `root` is the entry point — every program must define `root = Stack(...)`
+3. Expressions are: strings ("..."), numbers, booleans (true/false), null, arrays ([...]), objects ({...}), or component calls TypeName(arg1, arg2, ...)
+4. Use references for readability: define `name = ...` on one line, then use `name` later
+5. EVERY variable (except root) MUST be referenced by at least one other variable. Unreferenced variables are silently dropped and will NOT render. Always include defined variables in their parent's children/items array.
+6. Arguments are POSITIONAL (order matters, not names). Write `Stack([children], "row", "l")` NOT `Stack([children], direction: "row", gap: "l")` — colon syntax is NOT supported and silently breaks
+7. Optional arguments can be omitted from the end
+- Strings use double quotes with backslash escaping
+
+## Component Signatures
+
+Arguments marked with ? are optional. Sub-components can be inline or referenced; prefer references for better streaming.
+Props typed `ActionExpression` accept an Action([@steps...]) expression. See the Action section for available steps (@ToAssistant, @OpenUrl).
+Props marked `$binding<type>` accept a `$variable` reference for two-way binding.
+
+### Layout
+Stack(children: any[], direction?: "row" | "column", gap?: "none" | "xs" | "s" | "m" | "l" | "xl" | "2xl", align?: "start" | "center" | "end" | "stretch" | "baseline", justify?: "start" | "center" | "end" | "between" | "around" | "evenly", wrap?: boolean) — Flex container. direction: "row"|"column" (default "column"). gap: "none"|"xs"|"s"|"m"|"l"|"xl"|"2xl" (default "m"). align: "start"|"center"|"end"|"stretch"|"baseline". justify: "start"|"center"|"end"|"between"|"around"|"evenly".
+Tabs(items: TabItem[]) — Tabbed container
+TabItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[]) — value is unique id, trigger is tab label, content is array of components
+Accordion(items: AccordionItem[]) — Collapsible sections
+AccordionItem(value: string, trigger: string, content: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[]) — value is unique id, trigger is section title
+Steps(items: StepsItem[]) — Step-by-step guide
+StepsItem(title: string, details: string) — title and details text for one step
+Carousel(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[][], variant?: "card" | "sunk") — Horizontal scrollable carousel
+Separator(orientation?: "horizontal" | "vertical", decorative?: boolean) — Visual divider between content sections
+Modal(title: string, open?: $binding<boolean>, children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps)[], size?: "sm" | "md" | "lg") — Modal dialog. open is a reactive $boolean binding — set to true to open, X/Escape/backdrop auto-closes. Put Form with buttons inside children.
+- For grid-like layouts, use Stack with direction "row" and wrap set to true.
+- Prefer justify "start" (or omit justify) with wrap=true for stable columns instead of uneven gutters.
+- Use nested Stacks when you need explicit rows/sections.
+- Show/hide sections: $editId != "" ? Card([editForm]) : null
+- Modal: Modal("Title", $showModal, [content]) — $showModal is boolean, X/Escape auto-closes. Put Form with its own buttons inside children.
+- Use Tabs for alternative views (chart types, data sections) — no $variable needed
+- Shared filter across Tabs: same $days binding in Query args works across all TabItems
+
+### Content
+Card(children: (TextContent | MarkDownRenderer | CardHeader | Callout | TextCallout | CodeBlock | Image | ImageBlock | ImageGallery | Separator | HorizontalBarChart | RadarChart | PieChart | RadialChart | SingleStackedBarChart | ScatterChart | AreaChart | BarChart | LineChart | Table | TagBlock | Form | Buttons | Steps | Tabs | Carousel | Stack)[], variant?: "card" | "sunk" | "clear", direction?: "row" | "column", gap?: "none" | "xs" | "s" | "m" | "l" | "xl" | "2xl", align?: "start" | "center" | "end" | "stretch" | "baseline", justify?: "start" | "center" | "end" | "between" | "around" | "evenly", wrap?: boolean) — Styled container. variant: "card" (default, elevated) | "sunk" (recessed) | "clear" (transparent). Always full width. Accepts all Stack flex params (default: direction "column"). Cards flex to share space in row/wrap layouts.
+CardHeader(title?: string, subtitle?: string) — Header with optional title and subtitle
+TextContent(text: string, size?: "small" | "default" | "large" | "small-heavy" | "large-heavy") — Text block. Supports markdown. Optional size: "small" | "default" | "large" | "small-heavy" | "large-heavy".
+MarkDownRenderer(textMarkdown: string, variant?: "clear" | "card" | "sunk") — Renders markdown text with optional container variant
+Callout(variant: "info" | "warning" | "error" | "success" | "neutral", title: string, description: string, visible?: $binding<boolean>) — Callout banner. Optional visible is a reactive $boolean — auto-dismisses after 3s by setting $visible to false.
+TextCallout(variant?: "neutral" | "info" | "warning" | "success" | "danger", title?: string, description?: string) — Text callout with variant, title, and description
+Image(alt: string, src?: string) — Image with alt text and optional URL
+ImageBlock(src: string, alt?: string) — Image block with loading state
+ImageGallery(images: {src: string, alt?: string, details?: string}[]) — Gallery grid of images with modal preview
+CodeBlock(language: string, codeString: string) — Syntax-highlighted code block
+- Use Cards to group related KPIs or sections. Stack with direction "row" for side-by-side layouts.
+- Success toast: Callout("success", "Saved", "Done.", $showSuccess) — use @Set($showSuccess, true) in save action, auto-dismisses after 3s. For errors: result.status == "error" ? Callout("error", "Failed", result.error) : null
+- KPI card: Card([TextContent("Label", "small"), TextContent("" + @Count(@Filter(data.rows, "field", "==", "value")), "large-heavy")])
+
+### Tables
+Table(columns: Col[]) — Data table — column-oriented. Each Col holds its own data array.
+Col(label: string, data: any, type?: "string" | "number" | "action") — Column definition — holds label + data array
+- Table is COLUMN-oriented: Table([Col("Label", dataArray), Col("Count", countArray, "number")]). Use array pluck for data: data.rows.fieldName
+- Col data can be component arrays for styled cells: Col("Status", @Each(data.rows, "item", Tag(item.status, null, "sm", item.status == "open" ? "success" : "danger")))
+- Row actions: Col("Actions", @Each(data.rows, "t", Button("Edit", Action([@Set($showEdit, true), @Set($editId, t.id)]))))
+- Sortable: sorted = @Sort(data.rows, $sortField, "desc"). Bind $sortField to Select. Use sorted.fieldName for Col data
+- Searchable: filtered = @Filter(data.rows, "title", "contains", $search). Bind $search to Input
+- Chain sort + filter: filtered = @Filter(...) then sorted = @Sort(filtered, ...) — use sorted for both Table and Charts
+- Empty state: @Count(data.rows) > 0 ? Table([...]) : TextContent("No data yet")
+
+### Charts (2D)
+BarChart(labels: string[], series: Series[], variant?: "grouped" | "stacked", xLabel?: string, yLabel?: string) — Vertical bars; use for comparing values across categories with one or more series
+LineChart(labels: string[], series: Series[], variant?: "linear" | "natural" | "step", xLabel?: string, yLabel?: string) — Lines over categories; use for trends and continuous data over time
+AreaChart(labels: string[], series: Series[], variant?: "linear" | "natural" | "step", xLabel?: string, yLabel?: string) — Filled area under lines; use for cumulative totals or volume trends over time
+RadarChart(labels: string[], series: Series[]) — Spider/web chart; use for comparing multiple variables across one or more entities
+HorizontalBarChart(labels: string[], series: Series[], variant?: "grouped" | "stacked", xLabel?: string, yLabel?: string) — Horizontal bars; prefer when category labels are long or for ranked lists
+Series(category: string, values: number[]) — One data series
+- Charts accept column arrays: LineChart(labels, [Series("Name", values)]). Use array pluck: LineChart(data.rows.day, [Series("Views", data.rows.views)])
+- Use Cards to wrap charts with CardHeader for titled sections
+- Chart + Table from same source: use @Sort or @Filter result for both LineChart and Table Col data
+- Multiple chart views: use Tabs — Tabs([TabItem("line", "Line", [LineChart(...)]), TabItem("bar", "Bar", [BarChart(...)])])
+
+### Charts (1D)
+PieChart(labels: string[], values: number[], variant?: "pie" | "donut") — Circular slices; use plucked arrays: PieChart(data.categories, data.values)
+RadialChart(labels: string[], values: number[]) — Radial bars; use plucked arrays: RadialChart(data.categories, data.values)
+SingleStackedBarChart(labels: string[], values: number[]) — Single horizontal stacked bar; use plucked arrays: SingleStackedBarChart(data.categories, data.values)
+Slice(category: string, value: number) — One slice with label and numeric value
+- PieChart and BarChart need NUMBERS, not objects. For list data, use @Count(@Filter(...)) to aggregate:
+- PieChart from list: `PieChart(["Low", "Med", "High"], [@Count(@Filter(data.rows, "priority", "==", "low")), @Count(@Filter(data.rows, "priority", "==", "medium")), @Count(@Filter(data.rows, "priority", "==", "high"))], "donut")`
+- KPI from count: `TextContent("" + @Count(@Filter(data.rows, "status", "==", "open")), "large-heavy")`
+
+### Charts (Scatter)
+ScatterChart(datasets: ScatterSeries[], xLabel?: string, yLabel?: string) — X/Y scatter plot; use for correlations, distributions, and clustering
+ScatterSeries(name: string, points: Point[]) — Named dataset
+Point(x: number, y: number, z?: number) — Data point with numeric coordinates
+
+### Forms
+Form(name: string, buttons: Buttons, fields?: FormControl[]) — Form container with fields and explicit action buttons
+FormControl(label: string, input: Input | TextArea | Select | DatePicker | Slider | CheckBoxGroup | RadioGroup, hint?: string) — Field with label, input component, and optional hint text
+Label(text: string) — Text label
+Input(name: string, placeholder?: string, type?: "text" | "email" | "password" | "number" | "url", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)
+TextArea(name: string, placeholder?: string, rows?: number, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)
+Select(name: string, items: SelectItem[], placeholder?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)
+SelectItem(value: string, label: string) — Option for Select
+DatePicker(name: string, mode?: "single" | "range", rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<any>)
+Slider(name: string, variant: "continuous" | "discrete", min: number, max: number, step?: number, defaultValue?: number[], label?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<number[]>) — Numeric slider input; supports continuous and discrete (stepped) variants
+CheckBoxGroup(name: string, items: CheckBoxItem[], rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<Record<string, boolean>>)
+CheckBoxItem(label: string, description: string, name: string, defaultChecked?: boolean)
+RadioGroup(name: string, items: RadioItem[], defaultValue?: string, rules?: {required?: boolean, email?: boolean, url?: boolean, numeric?: boolean, min?: number, max?: number, minLength?: number, maxLength?: number, pattern?: string}, value?: $binding<string>)
+RadioItem(label: string, description: string, value: string)
+SwitchGroup(name: string, items: SwitchItem[], variant?: "clear" | "card" | "sunk", value?: $binding<Record<string, boolean>>) — Group of switch toggles
+SwitchItem(label?: string, description?: string, name: string, defaultChecked?: boolean) — Individual switch toggle
+- For Form fields, define EACH FormControl as its own reference — do NOT inline all controls in one array. This allows progressive field-by-field streaming.
+- NEVER nest Form inside Form — each Form should be a standalone container.
+- Form requires explicit buttons. Always pass a Buttons(...) reference as the third Form argument.
+- rules is an optional object: {required: true, email: true, minLength: 8, maxLength: 100}
+- Available rules: required, email, min, max, minLength, maxLength, pattern, url, numeric
+- The renderer shows error messages automatically — do NOT generate error text in the UI
+- Conditional fields: $country == "US" ? stateField : $country == "UK" ? postcodeField : addressField
+- Edit form in Modal: Modal("Edit", $showEdit, [Form("edit", Buttons([saveBtn, cancelBtn]), [fields...])]). Save button should include @Set($showEdit, false) to close modal.
+
+### Buttons
+Button(label: string, action?: ActionExpression, variant?: "primary" | "secondary" | "tertiary", type?: "normal" | "destructive", size?: "extra-small" | "small" | "medium" | "large") — Clickable button
+Buttons(buttons: Button[], direction?: "row" | "column") — Group of Button components. direction: "row" (default) | "column".
+- Toggle in @Each: @Each(rows, "t", Button(t.status == "open" ? "Close" : "Reopen", Action([...])))
+
+### Data Display
+TagBlock(tags: string[]) — tags is an array of strings
+Tag(text: string, icon?: string, size?: "sm" | "md" | "lg", variant?: "neutral" | "info" | "success" | "warning" | "danger") — Styled tag/badge with optional icon and variant
+- Color-mapped Tag: Tag(value, null, "sm", value == "high" ? "danger" : value == "medium" ? "warning" : "neutral")
+
+### Other
+SpreadsheetTable(data: (string | number | any)[][], colHeaders?: string[]) — Syncs data to the live spreadsheet panel. ONLY use this AFTER modification tools (update_cells, add_rows, delete_rows, set_formula, add_column) to push updated data to the user's spreadsheet. NEVER use for read-only display. Always include colHeaders.
+
+## Action — Button Behavior
+
+Action([@steps...]) wires button clicks to operations. Steps are @-prefixed built-in actions. Steps execute in order.
+Buttons without an explicit Action prop automatically send their label to the assistant (equivalent to Action([@ToAssistant(label)])).
+
+Available steps:
+- @ToAssistant("message") — Send a message to the assistant (for conversational buttons like "Tell me more", "Explain this")
+- @OpenUrl("https://...") — Navigate to a URL
+
+Example — simple nav:
+```
+viewBtn = Button("View", Action([@OpenUrl("https://example.com")]))
+```
+
+- Action can be assigned to a variable or inlined: Button("Go", onSubmit) and Button("Go", Action([...])) both work
+
+## Hoisting & Streaming (CRITICAL)
+
+openui-lang supports hoisting: a reference can be used BEFORE it is defined. The parser resolves all references after the full input is parsed.
+
+During streaming, the output is re-parsed on every chunk. Undefined references are temporarily unresolved and appear once their definitions stream in. This creates a progressive top-down reveal — structure first, then data fills in.
+
+**Recommended statement order for optimal streaming:**
+1. `root = Stack(...)` — UI shell appears immediately
+2. Component definitions — fill in as they stream
+3. Data values — leaf content last
+
+Always write the root = Stack(...) statement first so the UI shell appears immediately, even before child data has streamed in.
+
+## Examples
+
+root = Stack([title, info, followups])
+title = TextContent("Sales Summary", "large-heavy")
+info = TextContent("Your spreadsheet has 5 products with quarterly sales data. Total revenue across all products is $45,350.")
+followups = Buttons([Button("Visualize sales trends", null, "secondary"), Button("Add a new product", null, "secondary"), Button("Show top performers", null, "secondary")])
+
+root = Stack([title, chart, followups])
+title = TextContent("Q1-Q4 Sales Comparison", "large-heavy")
+chart = BarChart("Quarterly Sales", [q1, q2, q3, q4], "Quarter", "Sales ($)")
+q1 = BarChartData("Q1", [w1a, w1b])
+w1a = BarChartBar("Widget A", 1500)
+w1b = BarChartBar("Widget B", 1200)
+q2 = BarChartData("Q2", [w2a, w2b])
+w2a = BarChartBar("Widget A", 1800)
+w2b = BarChartBar("Widget B", 1400)
+q3 = BarChartData("Q3", [w3a, w3b])
+w3a = BarChartBar("Widget A", 2100)
+w3b = BarChartBar("Widget B", 1600)
+q4 = BarChartData("Q4", [w4a, w4b])
+w4a = BarChartBar("Widget A", 2400)
+w4b = BarChartBar("Widget B", 1900)
+followups = Buttons([Button("Show as a table", null, "secondary"), Button("Compare Q1 vs Q4", null, "secondary")])
+
+root = Stack([msg, sheet, followups])
+msg = TextContent("Done! I added Widget C with Q1=500, Q2=600, Q3=700, Q4=800 and a SUM formula for Total.")
+sheet = SpreadsheetTable([["Widget A", 1500, 1800, 2100, 2400, "=SUM(B1:E1)"], ["Widget B", 1200, 1400, 1600, 1900, "=SUM(B2:E2)"], ["Widget C", 500, 600, 700, 800, "=SUM(B3:E3)"]], ["Product", "Q1 Sales", "Q2 Sales", "Q3 Sales", "Q4 Sales", "Total"])
+followups = Buttons([Button("Add another product", null, "secondary"), Button("Show updated totals", null, "secondary"), Button("Visualize the data", null, "secondary")])
+
+## Important Rules
+- When asked about data, generate realistic/plausible data
+- Choose components that best represent the content (tables for comparisons, charts for trends, forms for input, etc.)
+
+## Final Verification
+Before finishing, walk your output and verify:
+1. root = Stack(...) is the FIRST line (for optimal streaming).
+2. Every referenced name is defined. Every defined name (other than root) is reachable from root.
+
+- ALWAYS output valid OpenUI Lang with root = Stack([...]). Never output plain text or markdown outside of OpenUI Lang.
+- For READ-ONLY requests: use TextContent, MarkDownRenderer, Table, BarChart, LineChart, PieChart. Do NOT use SpreadsheetTable.
+- For WRITE requests: after calling modification tools and get_table_data, emit SpreadsheetTable with the full updated data and colHeaders to sync changes to the live spreadsheet. Also include a TextContent explaining what changed.
+- Only call modification tools when the user explicitly requests changes.
diff --git a/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsx b/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsx
new file mode 100644
index 000000000..a0b1c9cb5
--- /dev/null
+++ b/examples/hands-on-table-chat/src/lib/spreadsheet-library.tsx
@@ -0,0 +1,53 @@
+"use client";
+
+import { createLibrary, defineComponent } from "@openuidev/react-lang";
+import { openuiLibrary } from "@openuidev/react-ui/genui-lib";
+import { z } from "zod";
+import type { PromptOptions } from "@openuidev/react-lang";
+
+export const SpreadsheetTable = defineComponent({
+ name: "SpreadsheetTable",
+ description:
+ "Syncs data to the live spreadsheet panel. ONLY use this AFTER modification tools " +
+ "(update_cells, add_rows, delete_rows, set_formula, add_column) to push updated data " +
+ "to the user's spreadsheet. NEVER use for read-only display. Always include colHeaders.",
+ props: z.object({
+ data: z
+ .array(z.array(z.union([z.string(), z.number(), z.null()])))
+ .describe(
+ "2D array of cell values. Each inner array is a row. Values can be numbers, strings, or Excel-like formulas starting with ="
+ ),
+ colHeaders: z
+ .array(z.string())
+ .optional()
+ .describe("Array of column header names"),
+ }),
+ component: ({ props }) => {
+ // eslint-disable-next-line @typescript-eslint/no-require-imports
+ const { useSpreadsheetSync } = require("@/app/useSpreadsheetSync");
+ useSpreadsheetSync(props.data, props.colHeaders);
+ return null;
+ },
+});
+
+export const spreadsheetLibrary = createLibrary({
+ root: openuiLibrary.root ?? "Stack",
+ componentGroups: openuiLibrary.componentGroups,
+ components: [...Object.values(openuiLibrary.components), SpreadsheetTable],
+});
+
+export const promptOptions: PromptOptions = {
+ preamble:
+ "You are a spreadsheet assistant. The user sees a live spreadsheet on the left panel. Always respond in OpenUI Lang (root = Stack([...])). For read-only requests use TextContent, Table, charts. For write requests, after using tools emit SpreadsheetTable to sync changes to the live spreadsheet.",
+ additionalRules: [
+ "ALWAYS output valid OpenUI Lang with root = Stack([...]). Never output plain text or markdown outside of OpenUI Lang.",
+ "For READ-ONLY requests: use TextContent, MarkDownRenderer, Table, BarChart, LineChart, PieChart. Do NOT use SpreadsheetTable.",
+ "For WRITE requests: after calling modification tools and get_table_data, emit SpreadsheetTable with the full updated data and colHeaders to sync changes to the live spreadsheet. Also include a TextContent explaining what changed.",
+ "Only call modification tools when the user explicitly requests changes.",
+ ],
+ examples: [
+ `root = Stack([title, info, followups])\ntitle = TextContent("Sales Summary", "large-heavy")\ninfo = TextContent("Your spreadsheet has 5 products with quarterly sales data. Total revenue across all products is $45,350.")\nfollowups = Buttons([Button("Visualize sales trends", null, "secondary"), Button("Add a new product", null, "secondary"), Button("Show top performers", null, "secondary")])`,
+ `root = Stack([title, chart, followups])\ntitle = TextContent("Q1-Q4 Sales Comparison", "large-heavy")\nchart = BarChart("Quarterly Sales", [q1, q2, q3, q4], "Quarter", "Sales ($)")\nq1 = BarChartData("Q1", [w1a, w1b])\nw1a = BarChartBar("Widget A", 1500)\nw1b = BarChartBar("Widget B", 1200)\nq2 = BarChartData("Q2", [w2a, w2b])\nw2a = BarChartBar("Widget A", 1800)\nw2b = BarChartBar("Widget B", 1400)\nq3 = BarChartData("Q3", [w3a, w3b])\nw3a = BarChartBar("Widget A", 2100)\nw3b = BarChartBar("Widget B", 1600)\nq4 = BarChartData("Q4", [w4a, w4b])\nw4a = BarChartBar("Widget A", 2400)\nw4b = BarChartBar("Widget B", 1900)\nfollowups = Buttons([Button("Show as a table", null, "secondary"), Button("Compare Q1 vs Q4", null, "secondary")])`,
+ `root = Stack([msg, sheet, followups])\nmsg = TextContent("Done! I added Widget C with Q1=500, Q2=600, Q3=700, Q4=800 and a SUM formula for Total.")\nsheet = SpreadsheetTable([["Widget A", 1500, 1800, 2100, 2400, "=SUM(B1:E1)"], ["Widget B", 1200, 1400, 1600, 1900, "=SUM(B2:E2)"], ["Widget C", 500, 600, 700, 800, "=SUM(B3:E3)"]], ["Product", "Q1 Sales", "Q2 Sales", "Q3 Sales", "Q4 Sales", "Total"])\nfollowups = Buttons([Button("Add another product", null, "secondary"), Button("Show updated totals", null, "secondary"), Button("Visualize the data", null, "secondary")])`,
+ ],
+};
diff --git a/examples/hands-on-table-chat/tsconfig.json b/examples/hands-on-table-chat/tsconfig.json
new file mode 100644
index 000000000..cf9c65d3e
--- /dev/null
+++ b/examples/hands-on-table-chat/tsconfig.json
@@ -0,0 +1,34 @@
+{
+ "compilerOptions": {
+ "target": "ES2017",
+ "lib": ["dom", "dom.iterable", "esnext"],
+ "allowJs": true,
+ "skipLibCheck": true,
+ "strict": true,
+ "noEmit": true,
+ "esModuleInterop": true,
+ "module": "esnext",
+ "moduleResolution": "bundler",
+ "resolveJsonModule": true,
+ "isolatedModules": true,
+ "jsx": "react-jsx",
+ "incremental": true,
+ "plugins": [
+ {
+ "name": "next"
+ }
+ ],
+ "paths": {
+ "@/*": ["./src/*"]
+ }
+ },
+ "include": [
+ "next-env.d.ts",
+ "**/*.ts",
+ "**/*.tsx",
+ ".next/types/**/*.ts",
+ ".next/dev/types/**/*.ts",
+ "**/*.mts"
+ ],
+ "exclude": ["node_modules"]
+}
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 0ffd1a6c1..3d320aaf1 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -206,6 +206,73 @@ importers:
specifier: ^5
version: 5.9.3
+ examples/hands-on-table-chat:
+ dependencies:
+ '@handsontable/react-wrapper':
+ specifier: ^17.0.1
+ version: 17.0.1([email protected])
+ '@openuidev/cli':
+ specifier: ^0.0.6
+ version: 0.0.6(@types/[email protected])
+ '@openuidev/react-headless':
+ specifier: ^0.8.0
+ '@openuidev/react-lang':
+ specifier: ^0.2.0
+ '@openuidev/react-ui':
+ specifier: ^0.11.0
+ handsontable:
+ specifier: ^17.0.1
+ version: 17.0.1
+ hyperformula:
+ specifier: ^3.2.0
+ version: 3.2.0
+ lucide-react:
+ specifier: ^1.8.0
+ version: 1.8.0([email protected])
+ next:
+ specifier: 16.2.3
+ openai:
+ specifier: ^6.34.0
+ react:
+ specifier: 19.2.4
+ version: 19.2.4
+ react-dom:
+ specifier: 19.2.4
+ version: 19.2.4([email protected])
+ zod:
+ specifier: ^4.3.6
+ version: 4.3.6
+ devDependencies:
+ '@tailwindcss/postcss':
+ specifier: ^4
+ version: 4.2.1
+ '@types/node':
+ specifier: ^20
+ version: 20.19.35
+ '@types/react':
+ specifier: ^19
+ version: 19.2.14
+ '@types/react-dom':
+ specifier: ^19
+ version: 19.2.3(@types/[email protected])
+ eslint:
+ specifier: ^9
+ version: 9.29.0([email protected])
+ eslint-config-next:
+ specifier: 16.2.3
+ tailwindcss:
+ specifier: ^4
+ version: 4.2.2
+ typescript:
+ specifier: ^5
+ version: 5.9.3
+
examples/mastra-chat:
dependencies:
'@ag-ui/core':
@@ -3260,6 +3327,14 @@ packages:
resolution: {integrity: sha512-ZpJxMqB+Qfe3rp6uszCQoag4nSw42icURnBRfFYSOmTgEeOe4rD0vYlbA8spvCu2TlCesNTlEN9BLWtQqLxabA==}
engines: {node: '>=18.0.0'}
+ '@handsontable/[email protected]':
+ resolution: {integrity: sha512-1VN6N38t5/DcjJ7y7XUYrDx1LuzvvzlrFdBdMG90Qo1xc8+LXHqbWbsTEm5Ec5gXTEbDEO53vUT35R+2COmOyg==}
+
+ '@handsontable/[email protected]':
+ resolution: {integrity: sha512-fzzFIc0tZ8GQzZSQCkdaiAtPr6pLN8Sb/xtcVoEIOGDqJmox90FQadXYL59LuH/sXLzm+eEEWxNI5+HRXvk7hg==}
+ peerDependencies:
+ handsontable: ^17.0.0
+
'@heroui/[email protected]':
resolution: {integrity: sha512-Dx5oku2LPgK1+Uy1KIyVcfqgYTkVCXEII9OuwoKIJe7GW9Lf1xdHpSTwsdDZoNrUl8IvkDjav1ud92OGY/maRA==}
peerDependencies:
@@ -3795,9 +3870,15 @@ packages:
resolution: {integrity: sha512-N1ySLuZjnAtN3kFnwhAwPvZah8RJxKasD7x1f8shFqhncnWZn4JMfg37diLNuoHsLAlrDfM3g4mawVdtAG8XLQ==}
+ resolution: {integrity: sha512-ZWXyj4uNu4GCWQw9cjRxWlbD+33mcDszIo9iQxFnBX3Wmgq9ulaSJcl6VhuWx5pCWqqD+9W6Wfz7N0lM5lYPMA==}
+
resolution: {integrity: sha512-/Qq3PTagA6+nYVfryAtQ7/9FEr/6YVyvOtl6rZnGsbReGLf0jZU6gkpr1FuChAQpvV46a78p4cmHOVP8mbfSMQ==}
+ resolution: {integrity: sha512-nE/b9mht28XJxjTwKs/yk7w4XTaU3t40UHVAky6cjiijdP/SEy3hGsnQMPxmXPTpC7W4/97okm6fngKnvCqVaA==}
+
resolution: {integrity: sha512-RnRjBtH8S8eXCpUNkQ+543DUc7ys8y15VxmFU9HRqlo9BG3CcBUiwNtF8SNoi2xvGCVJq1vl2yYq+3oISBS0Zg==}
engines: {node: '>= 10'}
@@ -3810,6 +3891,12 @@ packages:
cpu: [arm64]
os: [darwin]
+ resolution: {integrity: sha512-u37KDKTKQ+OQLvY+z7SNXixwo4Q2/IAJFDzU1fYe66IbCE51aDSAzkNDkWmLN0yjTUh4BKBd+hb69jYn6qqqSg==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [darwin]
+
resolution: {integrity: sha512-nqa9/7iQlboF1EFtNhWxQA0rQstmYRSBGxSM6g3GxvxHxcoeqVXfGNr9stJOme674m2V7r4E3+jEhhGvSQhJRA==}
engines: {node: '>= 10'}
@@ -3822,6 +3909,12 @@ packages:
cpu: [x64]
os: [darwin]
+ resolution: {integrity: sha512-gHjL/qy6Q6CG3176FWbAKyKh9IfntKZTB3RY/YOJdDFpHGsUDXVH38U4mMNpHVGXmeYW4wj22dMp1lTfmu/bTQ==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [darwin]
+
resolution: {integrity: sha512-dCzAjqhDHwmoB2M4eYfVKqXs99QdQxNQVpftvP1eGVppamXh/OkDAwV737Zr0KPXEqRUMN4uCjh6mjO+XtF3Mw==}
engines: {node: '>= 10'}
@@ -3836,6 +3929,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-U6vtblPtU/P14Y/b/n9ZY0GOxbbIhTFuaFR7F4/uMBidCi2nSdaOFhA0Go81L61Zd6527+yvuX44T4ksnf8T+Q==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-+fpGWvQiITgf7PUtbWY1H7qUSnBZsPPLyyq03QuAKpVoTy/QUx1JptEDTQMVvQhvizCEuNLEeghrQUyXQOekuw==}
engines: {node: '>= 10'}
@@ -3850,6 +3950,13 @@ packages:
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-/YV0LgjHUmfhQpn9bVoGc4x4nan64pkhWR5wyEV8yCOfwwrH630KpvRg86olQHTwHIn1z59uh6JwKvHq1h4QEw==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-jSLvgdRRL/hrFAPqEjJf1fFguC719kmcptjNVDJl26BnJIpjL3KH5h6mzR4mAweociLQaqvt4UyzfbFjgAdDcw==}
engines: {node: '>= 10'}
@@ -3864,6 +3971,13 @@ packages:
os: [linux]
libc: [glibc]
+ resolution: {integrity: sha512-/HiWEcp+WMZ7VajuiMEFGZ6cg0+aYZPqCJD3YJEfpVWQsKYSjXQG06vJP6F1rdA03COD9Fef4aODs3YxKx+RDQ==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+ libc: [glibc]
+
resolution: {integrity: sha512-/uaF0WfmYqQgLfPmN6BvULwxY0dufI2mlN2JbOKqqceZh1G4hjREyi7pg03zjfyS6eqNemHAZPSoP84x17vo6w==}
engines: {node: '>= 10'}
@@ -3878,6 +3992,13 @@ packages:
os: [linux]
libc: [musl]
+ resolution: {integrity: sha512-Kt44hGJfZSefebhk/7nIdivoDr3Ugp5+oNz9VvF3GUtfxutucUIHfIO0ZYO8QlOPDQloUVQn4NVC/9JvHRk9hw==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [linux]
+ libc: [musl]
+
resolution: {integrity: sha512-xhsL1OvQSfGmlL5RbOmU+FV120urrgFpYLq+6U8C6KIym32gZT6XF/SDE92jKzzlPWskkbjOKCpqk5m4i8PEfg==}
engines: {node: '>= 10'}
@@ -3890,6 +4011,12 @@ packages:
cpu: [arm64]
os: [win32]
+ resolution: {integrity: sha512-O2NZ9ie3Tq6xj5Z5CSwBT3+aWAMW2PIZ4egUi9MaWLkwaehgtB7YZjPm+UpcNpKOme0IQuqDcor7BsW6QBiQBw==}
+ engines: {node: '>= 10'}
+ cpu: [arm64]
+ os: [win32]
+
resolution: {integrity: sha512-Z1Dh6lhFkxvBDH1FoW6OU/L6prYwPSlwjLiZkExIAh8fbP6iI/M7iGTQAJPYJ9YFlWobCZ1PHbchFhFYb2ADkw==}
engines: {node: '>= 10'}
@@ -3902,6 +4029,12 @@ packages:
cpu: [x64]
os: [win32]
+ resolution: {integrity: sha512-Ibm29/GgB/ab5n7XKqlStkm54qqZE8v2FnijUPBgrd67FWrac45o/RsNlaOWjme/B5UqeWt/8KM4aWBwA1D2Kw==}
+ engines: {node: '>= 10'}
+ cpu: [x64]
+ os: [win32]
+
'@nodelib/[email protected]':
resolution: {integrity: sha512-vq24Bq3ym5HEQm2NKCr3yXDwjc7vTsEThRDnkp2DK9p1uqLR+DHurm/NOTo0KG7HYHU7eppKZj3MyqYuMBf62g==}
engines: {node: '>= 8'}
@@ -4171,11 +4304,50 @@ packages:
resolution: {integrity: sha512-cifvXDhcqMwwTlTK04GBNeIe7yyo28Mfby85QXFe1Yk8nmi36Ab/5UQwptOx84SsoGNRg+EVSjwzfSZMy6pmlw==}
engines: {node: '>=14'}
+ '@openuidev/[email protected]':
+ resolution: {integrity: sha512-EfzxQBUwAfQyzVahtjvOY9bdKkIw/pYCFHxLRlkzGTexJ7/8DnAbkmbByoC/DtBDLrHriixxynfCu7jcflEsiA==}
+ hasBin: true
+
+ '@openuidev/[email protected]':
+ resolution: {integrity: sha512-Z2ZzlakKgZogtic4jQ9S+wNLi1rJ71EYQYR0rhXmXXiAV8sYlDeDT7nJB5aiRZ1w5BJ95aJ8WFABDA2syRQXVA==}
+ peerDependencies:
+ '@modelcontextprotocol/sdk': '>=1.0.0'
+ zod: ^4.0.0
+ peerDependenciesMeta:
+ '@modelcontextprotocol/sdk':
+ optional: true
+
+ '@openuidev/[email protected]':
+ resolution: {integrity: sha512-BSNna+r+PZXA0/ccnCr6e00lLLHgm2t6ot0qP+YAKJRyJrxV//qq5qEvU/5W5Nfyh0c16a33Cgc90xPF6tTU7w==}
+ peerDependencies:
+ react: '>=19.0.0'
+ zustand: ^4.5.5
+
'@openuidev/[email protected]':
resolution: {integrity: sha512-+/sVNVOFFzmnAsR8y+5W/la5U485OGXPFNtgY7wu0XdBdKSkbljNUGBA1XiHkzcxSVoATWOSy9eQ/J4UeHSPuQ==}
peerDependencies:
react: '>=19.0.0'
+ '@openuidev/[email protected]':
+ resolution: {integrity: sha512-qucVNoB7+DnsVE6ZZzKOIJLPx2xzXKbCbO1haebk6IZO4OOvlxm7SYxifE9zmZF4FlJpiuQ+vmEPVYW9FHHPOA==}
+ peerDependencies:
+ '@modelcontextprotocol/sdk': '>=1.0.0'
+ react: '>=19.0.0'
+ zod: ^4.0.0
+ peerDependenciesMeta:
+ '@modelcontextprotocol/sdk':
+ optional: true
+
+ '@openuidev/[email protected]':
+ resolution: {integrity: sha512-DwnK0i6d71nygrEJP84fAj0LxM2ndFC/xHlAt/rWIJsgUYlJz5eM3F5EHQjnveBIXsWnXapVNpKEHQEOxdGLAA==}
+ peerDependencies:
+ '@openuidev/react-headless': ^0.8.0
+ '@openuidev/react-lang': ^0.2.0
+ react: '>=19.0.0'
+ react-dom: '>=19.0.0'
+ zod: ^4.3.6
+ zustand: ^4.5.5
+
resolution: {integrity: sha512-a61ljmRVVyG5MC/698C8/FfFDw5a8LOIvyOLW5fztgUXqUpc1jOfQzOitSCbge657OgXXThmY3Tk8fpiDb4UcA==}
engines: {node: '>= 20.0.0'}
@@ -8807,6 +8979,9 @@ packages:
resolution: {integrity: sha512-QxD8cf2eVqJOOz63z6JIN9BzvVs/dlySa5HGSBH5xtR8dPteIRQnBxxKqkNTiT6jbDTF6jAfrd4oMcND9RGbQg==}
engines: {node: '>=0.6'}
+ resolution: {integrity: sha512-Ko0uX15oIUS7wJ3Rb30Fs6SkVbLmPBAKdlm7q9+ak9bbIeFf0MwuBsQV6z7+X768/cHsfg+WlysDWJcmthjsjQ==}
+
resolution: {integrity: sha512-Ceh+7ox5qe7LJuLHoY0feh3pHuUDHAcRUeyL2VYghZwfpkNIy/+8Ocg0a3UuSoYzavmylwuLWQOf3hl0jjMMIw==}
engines: {node: '>=8'}
@@ -9020,6 +9195,9 @@ packages:
resolution: {integrity: sha512-opLQzEVriiH1uUQ4Kctsd49bRoFDXGGSC4GUqj7pGyxM3RehRhvTlZJc1FL/Flew2p5uwxa1tUDWKzI4wNM8pg==}
+ resolution: {integrity: sha512-BwqQ/AgmKJ8jcMEjaSnfMybnKMgGTrtDKowfTP3pX4jwVy0kNjRsT/AP6h+wC3+3NC+X8X15VWBnTCQlX+wQFg==}
+
resolution: {integrity: sha512-7VT13fmjotKpGipCW9JEQAusEPE+Ei8nl6/g4FBAmIm0GOOLMua9NDDo/DWp0ZAxCr3cPq5ZpBqmPAQgDda2Pw==}
engines: {node: '>= 8.10.0'}
@@ -10025,6 +10203,15 @@ packages:
typescript:
optional: true
+ resolution: {integrity: sha512-Dnkrylzjof/Az7iNoIQJqD18zTxQZcngir19KJaiRsMnnjpQSVoa6aEg/1Q4hQC+cW90uTlgQYadwL1CYNwFWA==}
+ peerDependencies:
+ eslint: '>=9.0.0'
+ typescript: '>=3.3.1'
+ peerDependenciesMeta:
+ typescript:
+ optional: true
+
resolution: {integrity: sha512-82GZUjRS0p/jganf6q1rEO25VSoHH0hKPCTrgillPjdI/3bgBhAE1QzHrHTizjpRvy6pGAvKjDJtk2pF9NDq8w==}
hasBin: true
@@ -10846,6 +11033,9 @@ packages:
resolution: {integrity: sha512-3GKBOn+m2LX9iq+JC1064cSFprJY4jL1jCXTcpnfER5HYE2l/4EfWSGzkPa/ZDBmYI0ZOEj5VHV/eKnPGkHuOg==}
+ resolution: {integrity: sha512-N7d/Vv341sGsKq/afsR+Y1EcSD1YCAwpLN245VnmprTGaFtDSBsiu12EsjNPD/1VCvZvN5PLH8Ojsq/TzqhLZQ==}
+
resolution: {integrity: sha512-R3pbpkcIqv2Pm3dUwgjclDRVmWpTJW2DcMzcIhEXEx1oh/CEMObMm3KLmRJOdvhM7o4uQBnwr8pzRK2sJWIqfg==}
engines: {node: '>= 0.4'}
@@ -11051,6 +11241,9 @@ packages:
resolution: {integrity: sha512-Fl70vYtsAFb/C06PTS9dZBo7ihau+Tu/DNCk/OyHhea07S+aeMWpFFkUaXRa8fI+ScZbEI8dfSxwY7gxZ9SAVQ==}
+ resolution: {integrity: sha512-2vzQKKVMDPLsubZJb0JJWT/DhrkgIjsWj40Z9BIUVT6Jkl/YM5VtkLOP3agCieqW9HuqnXlWc+Vi+7XzQuC1Nw==}
+
resolution: {integrity: sha512-WDC/ui2VVRrz3jOVi+XtjqkDjiVjTtFaAGiW37k6b+ohyQ5wYDOGkvCZa8+H0nx3gyvv0+BST9xuOgIyGQ00gw==}
@@ -11938,6 +12131,11 @@ packages:
peerDependencies:
react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
+ resolution: {integrity: sha512-WuvlsjngSk7TnTBJ1hsCy3ql9V9VOdcPkd3PKcSmM34vJD8KG6molxz7m7zbYFgICwsanQWmJ13JlYs4Zp7Arw==}
+ peerDependencies:
+ react: ^16.5.1 || ^17.0.0 || ^18.0.0 || ^19.0.0
+
resolution: {integrity: sha512-h5bgJWpxJNswbU7qCrV0tIKQCaS3blPDrqKWx+QxzuzL1zGUzij9XCWLrSLsJPu5t+eWA/ycetzYAO5IOMcWAQ==}
hasBin: true
@@ -12421,6 +12619,9 @@ packages:
resolution: {integrity: sha512-aF7yRQr/Q0O2/4pIXm6PZ5G+jAd7QS4Yu8m+WEeEHGnbo+7mE36CbLSDQiXYV8bVL3NfmdeqPJct0tUlnjVSnA==}
+ resolution: {integrity: sha512-uEmtNhbDOrWPFS+hdjFCBfy9f2YoyzRpwcl+DqpC6taX21FzsTLQVbMV/W7PzNSX6x/bhC1zA3c2UQ5NzH6how==}
+
resolution: {integrity: sha512-sYgFe+pR9aIM7o4fhs2aXtOI+oqlUd33N9Yoxcgo1Fv7M20sRkHtCmzE/VRNIcq7uNJ+qio+Xubt1FXH3pQ+eQ==}
@@ -12551,6 +12752,27 @@ packages:
sass:
optional: true
+ resolution: {integrity: sha512-9V3zV4oZFza3PVev5/poB9g0dEafVcgNyQ8eTRop8GvxZjV2G15FC5ARuG1eFD42QgeYkzJBJzHghNP8Ad9xtA==}
+ engines: {node: '>=20.9.0'}
+ hasBin: true
+ peerDependencies:
+ '@opentelemetry/api': ^1.1.0
+ '@playwright/test': ^1.51.1
+ babel-plugin-react-compiler: '*'
+ react: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
+ react-dom: ^18.2.0 || 19.0.0-rc-de68d2f4-20241204 || ^19.0.0
+ sass: ^1.3.0
+ peerDependenciesMeta:
+ '@opentelemetry/api':
+ optional: true
+ '@playwright/test':
+ optional: true
+ babel-plugin-react-compiler:
+ optional: true
+ sass:
+ optional: true
+
resolution: {integrity: sha512-R5TMzSBoTDG4gi6Y+pvvyCNnooShHePHsHxMLP9EXDGdrlR5RvNdSd4e5k8z0/EzP9Ske7ABRMDWg6O7Dm2OYw==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -12645,6 +12867,9 @@ packages:
resolution: {integrity: sha512-2vPPEi+Z7WqML2jZYddDIfy5Dqb0r2fze2zTxNNknZaFpVHU3mFB3R+DWeJWGVx0ecvttSGlJTI+WG+8Z4cDWw==}
+ resolution: {integrity: sha512-xDcctDimhzko/e+y+Q2/8i3qNC9Svw1QgOkSkQoO0kIPI473tR9QRbo2KP88Ty9p8WbPy+3OpTaAIzehtuHq+A==}
+
resolution: {integrity: sha512-XzZFj2KMK16zE0TfrGpjvgc378wZWvDzIpunHOHOT0Jj8zbV5qT1uQKaJb+fAHv6lf1A4nOMMWHrTmjAK4u0Zg==}
engines: {node: ^20.19.0 || >=22.12.0}
@@ -12803,6 +13028,18 @@ packages:
zod:
optional: true
+ resolution: {integrity: sha512-yEr2jdGf4tVFYG6ohmr3pF6VJuveP0EA/sS8TBx+4Eq5NT10alu5zg2dmxMXMgqpihRDQlFGpRt2XwsGj+Fyxw==}
+ hasBin: true
+ peerDependencies:
+ ws: ^8.18.0
+ zod: ^3.25 || ^4.0
+ peerDependenciesMeta:
+ ws:
+ optional: true
+ zod:
+ optional: true
+
resolution: {integrity: sha512-N4YtSYJqghVu4iek2ZUvcN/0aqH1kRDuNqzcycDxhOUpg7GdvLa2F3DgS6yBNhInhv2r/6I0Flkn7CqL8+nIcw==}
@@ -13771,6 +14008,9 @@ packages:
resolution: {integrity: sha512-6VwtthbV4o/7+OaAF9I5L5V3llLEsoPyq9P1JVXkedTP33c7MfCG0/5NOPcSJn0TzXcG9YUrR0gQSWioew3LDg==}
+ resolution: {integrity: sha512-4qf/7IsIKfSNHQXSwial1IFmfM1Cc/whNBQqRwe0V2stPe7KmN1U0tWQiIx6JiirgSrisjE0eECdNf7Tav1Ntw==}
+
resolution: {integrity: sha512-iETxpjK6YoRWJG5o6hXLwvjYAoW+FEZn9os0PD/b6AP6xQwsa/Y7lCVgIixBbUPMfhu+i2LtdeAqVTgGlQarfA==}
hasBin: true
@@ -14600,6 +14840,9 @@ packages:
resolution: {integrity: sha512-nt6AMGKW1p/70DF/hGBdJB57B8Tspmbp5gfJ8ilhLnt7kkr2ye7hzD6NVG8GGErk2HWF34igrL2CXmNIkzKqKw==}
engines: {node: '>=18'}
+ resolution: {integrity: sha512-NB6Dk1A9xgQPMoGqC5CVXn123gWyte215ONT5Pp5a0yt4nlEoO1ZWeCwpncaekPHXO60i47ihFnZPiRPjRMq4Q==}
+
resolution: {integrity: sha512-+FbBPE1o9QAYvviau/qC5SE3caw21q3xkvWKBtja5vgqOWIHHJ3ioaq1VPfn/Szqctz2bU/oYeKd9/z5BL+PVg==}
@@ -17928,6 +18171,12 @@ snapshots:
'@repeaterjs/repeater': 3.0.6
tslib: 2.8.1
+ '@handsontable/[email protected]': {}
+
+ dependencies:
+ handsontable: 17.0.1
+
dependencies:
'@heroui/styles': 3.0.1([email protected])([email protected])
@@ -18081,6 +18330,15 @@ snapshots:
'@inquirer/[email protected]': {}
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/ansi': 2.0.3
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/figures': 2.0.3
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/ansi': 2.0.3
@@ -18090,6 +18348,13 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18097,6 +18362,18 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/ansi': 2.0.3
+ '@inquirer/figures': 2.0.3
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ cli-width: 4.1.0
+ fast-wrap-ansi: 0.2.0
+ mute-stream: 3.0.0
+ signal-exit: 4.1.0
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/ansi': 2.0.3
@@ -18109,6 +18386,14 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/external-editor': 2.0.3(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18117,6 +18402,13 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18124,6 +18416,13 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ chardet: 2.1.1
+ iconv-lite: 0.7.2
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
chardet: 2.1.1
@@ -18133,6 +18432,13 @@ snapshots:
'@inquirer/[email protected]': {}
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18140,6 +18446,13 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18147,6 +18460,14 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/ansi': 2.0.3
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/ansi': 2.0.3
@@ -18155,6 +18476,21 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/checkbox': 5.1.0(@types/[email protected])
+ '@inquirer/confirm': 6.0.8(@types/[email protected])
+ '@inquirer/editor': 5.0.8(@types/[email protected])
+ '@inquirer/expand': 5.0.8(@types/[email protected])
+ '@inquirer/input': 5.0.8(@types/[email protected])
+ '@inquirer/number': 4.0.8(@types/[email protected])
+ '@inquirer/password': 5.0.8(@types/[email protected])
+ '@inquirer/rawlist': 5.2.4(@types/[email protected])
+ '@inquirer/search': 4.1.4(@types/[email protected])
+ '@inquirer/select': 5.1.0(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/checkbox': 5.1.0(@types/[email protected])
@@ -18170,6 +18506,13 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18177,6 +18520,14 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/figures': 2.0.3
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/core': 11.1.5(@types/[email protected])
@@ -18185,6 +18536,15 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/ansi': 2.0.3
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/figures': 2.0.3
+ '@inquirer/type': 4.0.3(@types/[email protected])
+ optionalDependencies:
+ '@types/node': 20.19.35
+
dependencies:
'@inquirer/ansi': 2.0.3
@@ -18194,6 +18554,10 @@ snapshots:
optionalDependencies:
'@types/node': 22.15.32
+ '@inquirer/[email protected](@types/[email protected])':
+ optionalDependencies:
+ '@types/node': 20.19.35
+
optionalDependencies:
'@types/node': 22.15.32
@@ -18622,58 +18986,88 @@ snapshots:
'@next/[email protected]': {}
+ '@next/[email protected]': {}
+
dependencies:
fast-glob: 3.3.1
+ dependencies:
+ fast-glob: 3.3.1
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
optional: true
optional: true
+ optional: true
+
'@nodelib/[email protected]':
dependencies:
'@nodelib/fs.stat': 2.0.5
@@ -19211,6 +19605,27 @@ snapshots:
'@opentelemetry/[email protected]': {}
+ '@openuidev/[email protected](@types/[email protected])':
+ dependencies:
+ '@inquirer/core': 11.1.5(@types/[email protected])
+ '@inquirer/prompts': 8.3.0(@types/[email protected])
+ commander: 14.0.3
+ esbuild: 0.25.12
+ transitivePeerDependencies:
+ - '@types/node'
+
+ dependencies:
+ zod: 4.3.6
+ optionalDependencies:
+ '@modelcontextprotocol/sdk': 1.29.0(@cfworker/[email protected])([email protected])
+
+ dependencies:
+ '@ag-ui/core': 0.0.45
+ react: 19.2.4
+ zustand: 4.5.7(@types/[email protected])([email protected])
+
dependencies:
react: 19.2.0
@@ -19221,6 +19636,56 @@ snapshots:
react: 19.2.4
zod: 4.3.6
+ dependencies:
+ '@openuidev/lang-core': 0.2.1(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])
+ react: 19.2.4
+ zod: 4.3.6
+ optionalDependencies:
+ '@modelcontextprotocol/sdk': 1.29.0(@cfworker/[email protected])([email protected])
+
+ dependencies:
+ '@floating-ui/react-dom': 2.1.3([email protected]([email protected]))([email protected])
+ '@openuidev/react-headless': 0.8.0([email protected])([email protected](@types/[email protected])([email protected]))
+ '@openuidev/react-lang': 0.2.0(@modelcontextprotocol/[email protected](@cfworker/[email protected])([email protected]))([email protected])([email protected])
+ '@radix-ui/react-aspect-ratio': 1.1.7(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-dropdown-menu': 2.1.16(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-toggle-group': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ clsx: 2.1.1
+ date-fns: 4.1.0
+ lodash-es: 4.18.1
+ lucide-react: 0.562.0([email protected])
+ react: 19.2.4
+ react-day-picker: 9.14.0([email protected])
+ react-dom: 19.2.4([email protected])
+ react-markdown: 10.1.0(@types/[email protected])([email protected])
+ react-syntax-highlighter: 15.6.1([email protected])
+ rehype-katex: 7.0.1
+ remark-breaks: 4.0.0
+ remark-emoji: 5.0.1
+ remark-gfm: 4.0.1
+ remark-math: 6.0.0
+ tiny-invariant: 1.3.3
+ zod: 4.3.6
+ zustand: 4.5.7(@types/[email protected])([email protected])
+ transitivePeerDependencies:
+ - '@types/react'
+ - '@types/react-dom'
+ - supports-color
+
'@orama/[email protected]': {}
'@oxc-minify/[email protected]':
@@ -19735,6 +20200,22 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.1(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.2
@@ -19989,6 +20470,21 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
react: 19.2.3
@@ -20150,6 +20646,32 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-focus-guards': 1.1.3(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/[email protected])([email protected])
+ aria-hidden: 1.2.6
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ react-remove-scroll: 2.7.2(@types/[email protected])([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -20527,6 +21049,24 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.1(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.2
@@ -20716,6 +21256,35 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/number': 1.1.1
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-focus-guards': 1.1.3(@types/[email protected])([email protected])
+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-callback-ref': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ aria-hidden: 1.2.6
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ react-remove-scroll: 2.7.2(@types/[email protected])([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
@@ -20791,6 +21360,25 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/number': 1.1.1
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-layout-effect': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.1(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
@@ -20864,6 +21452,21 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-use-previous': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-use-size': 1.1.1(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.2
@@ -20977,6 +21580,21 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-direction': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-roving-focus': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.3
@@ -20988,6 +21606,17 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
'@radix-ui/primitive': 1.1.2
@@ -21065,6 +21694,26 @@ snapshots:
'@types/react': 19.2.14
'@types/react-dom': 19.2.3(@types/[email protected])
+ dependencies:
+ '@radix-ui/primitive': 1.1.3
+ '@radix-ui/react-compose-refs': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-context': 1.1.2(@types/[email protected])([email protected])
+ '@radix-ui/react-dismissable-layer': 1.1.11(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ '@radix-ui/react-id': 1.1.1(@types/[email protected])([email protected])
+ '@radix-ui/react-slot': 1.2.3(@types/[email protected])([email protected])
+ '@radix-ui/react-use-controllable-state': 1.2.2(@types/[email protected])([email protected])
+ '@radix-ui/react-visually-hidden': 1.2.3(@types/[email protected](@types/[email protected]))(@types/[email protected])([email protected]([email protected]))([email protected])
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ optionalDependencies:
+ '@types/react': 19.2.14
+ '@types/react-dom': 19.2.3(@types/[email protected])
+
dependencies:
react: 19.2.3
@@ -24993,6 +25642,8 @@ snapshots:
+
@@ -25233,6 +25884,10 @@ snapshots:
'@chevrotain/utils': 11.1.2
lodash-es: 4.17.23
+ dependencies:
+ regexp-to-ast: 0.4.0
+
dependencies:
anymatch: 3.1.3
@@ -26370,6 +27025,26 @@ snapshots:
- eslint-plugin-import-x
- supports-color
+ dependencies:
+ '@next/eslint-plugin-next': 16.2.3
+ eslint: 9.29.0([email protected])
+ eslint-import-resolver-node: 0.3.9
+ eslint-import-resolver-typescript: 3.10.1([email protected])([email protected]([email protected]))
+ eslint-plugin-jsx-a11y: 6.10.2([email protected]([email protected]))
+ eslint-plugin-react: 7.37.5([email protected]([email protected]))
+ eslint-plugin-react-hooks: 7.0.1([email protected]([email protected]))
+ globals: 16.4.0
+ optionalDependencies:
+ typescript: 5.9.3
+ transitivePeerDependencies:
+ - '@typescript-eslint/parser'
+ - eslint-import-resolver-webpack
+ - eslint-plugin-import-x
+ - supports-color
+
dependencies:
eslint: 9.29.0([email protected])
@@ -27393,6 +28068,15 @@ snapshots:
+ dependencies:
+ '@handsontable/pikaday': 1.0.0
+ dompurify: 3.3.1
+ moment: 2.30.1
+ numbro: 2.5.0
+ optionalDependencies:
+ hyperformula: 3.2.0
+
@@ -27695,6 +28379,11 @@ snapshots:
dependencies:
ms: 2.1.3
+ dependencies:
+ chevrotain: 6.5.0
+ tiny-emitter: 2.1.0
+
@@ -28552,6 +29241,10 @@ snapshots:
dependencies:
react: 19.2.3
+ dependencies:
+ react: 19.2.4
+
@@ -29548,6 +30241,8 @@ snapshots:
+
dependencies:
motion-utils: 12.29.2
@@ -29685,6 +30380,33 @@ snapshots:
- '@babel/core'
- babel-plugin-macros
+ dependencies:
+ '@next/env': 16.2.3
+ '@swc/helpers': 0.5.15
+ baseline-browser-mapping: 2.10.0
+ caniuse-lite: 1.0.30001778
+ postcss: 8.4.31
+ react: 19.2.4
+ react-dom: 19.2.4([email protected])
+ styled-jsx: 5.1.6(@babel/[email protected])([email protected])
+ optionalDependencies:
+ '@next/swc-darwin-arm64': 16.2.3
+ '@next/swc-darwin-x64': 16.2.3
+ '@next/swc-linux-arm64-gnu': 16.2.3
+ '@next/swc-linux-arm64-musl': 16.2.3
+ '@next/swc-linux-x64-gnu': 16.2.3
+ '@next/swc-linux-x64-musl': 16.2.3
+ '@next/swc-win32-arm64-msvc': 16.2.3
+ '@next/swc-win32-x64-msvc': 16.2.3
+ '@opentelemetry/api': 1.9.0
+ babel-plugin-react-compiler: 1.0.0
+ sass: 1.89.2
+ sharp: 0.34.5
+ transitivePeerDependencies:
+ - '@babel/core'
+ - babel-plugin-macros
+
dependencies:
'@cloudflare/kv-asset-handler': 0.4.2
@@ -29858,6 +30580,10 @@ snapshots:
+ dependencies:
+ bignumber.js: 9.3.1
+
dependencies:
'@dxup/nuxt': 0.4.0([email protected])([email protected])
@@ -30168,6 +30894,11 @@ snapshots:
ws: 8.20.0
zod: 4.3.6
+ optionalDependencies:
+ ws: 8.20.0
+ zod: 4.3.6
+
@@ -31071,6 +31802,14 @@ snapshots:
date-fns-jalali: 4.1.0-0
react: 19.2.3
+ dependencies:
+ '@date-fns/tz': 1.4.1
+ '@tabby_ai/hijri-converter': 1.0.5
+ date-fns: 4.1.0
+ date-fns-jalali: 4.1.0-0
+ react: 19.2.4
+
dependencies:
'@date-fns/tz': 1.2.0
@@ -31571,6 +32310,8 @@ snapshots:
dependencies:
regex-utilities: 2.3.0
+
@@ -32693,6 +33434,8 @@ snapshots:
+
@@ -33446,7 +34189,7 @@ snapshots:
dependencies:
- esbuild: 0.27.3
+ esbuild: 0.27.4
fdir: 6.5.0([email protected])
picomatch: 4.0.3
postcss: 8.5.8