@lumerahq/ui 0.11.0-dev.2 → 0.11.1-dev.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @lumerahq/ui
10
10
 
11
11
  ## Features
12
12
 
13
- - **UI Components** - Buttons, cards, tables, modals, sidebar, and more (built on shadcn/ui)
13
+ - **Application Components** - Assistant chat surfaces, data tables, record sheets, and automation runner
14
14
  - **Data Table** - Full-featured table with filtering, sorting, and pagination
15
15
  - **Bridge Module** - Parent-iframe communication for embedded apps
16
16
  - **API Utilities** - Lumera client with SQL, CRUD, file, and email operations
@@ -19,12 +19,81 @@ npm install @lumerahq/ui
19
19
 
20
20
  ## Usage
21
21
 
22
+ ### Styles
23
+
24
+ Import the package stylesheet once in the app entrypoint before rendering any `@lumerahq/ui` component:
25
+
26
+ ```tsx
27
+ import '@lumerahq/ui/styles.css';
28
+ ```
29
+
30
+ This stylesheet is required for the shared Tailwind/shadcn theme variables, Inter font, assistant markdown styles, and assistant animations. It is not included automatically when importing from `@lumerahq/ui/components`, `@lumerahq/ui/hooks`, or `@lumerahq/ui/lib`.
31
+
32
+ The stylesheet defines theme tokens as CSS custom properties. Override them on `:root`, `.dark`, or a wrapper class to retheme the assistant without changing component code:
33
+
34
+ ```css
35
+ .my-assistant-theme {
36
+ --brand: #2563eb;
37
+ --primary: var(--brand);
38
+ --ring: var(--brand);
39
+ --primary-foreground: #ffffff;
40
+ --background: #ffffff;
41
+ --foreground: #111827;
42
+ --card: #ffffff;
43
+ --border: #d1d5db;
44
+ }
45
+ ```
46
+
22
47
  ### Components
23
48
 
24
49
  ```tsx
25
- import { Button, Card, DataTable } from '@lumerahq/ui';
50
+ import { AutomationRunner, DataTable, RecordSheet } from '@lumerahq/ui';
26
51
  ```
27
52
 
53
+ ### Assistant Chat
54
+
55
+ Use `AssistantPage` for a full-page chat, `AssistantWidget` for a floating widget, or `AssistantChat` when embedding the chat surface inside custom chrome.
56
+
57
+ ```tsx
58
+ import { useMemo } from 'react';
59
+ import {
60
+ AssistantPage,
61
+ createLumeraAgentChatTransport,
62
+ type AgentChatToolRenderer,
63
+ } from '@lumerahq/ui';
64
+ import '@lumerahq/ui/styles.css';
65
+
66
+ const toolRenderers: AgentChatToolRenderer[] = [
67
+ {
68
+ match: (tc) => tc.name === 'send_invoice',
69
+ summary: (tc) => {
70
+ const input = tc.input as { invoiceId?: string };
71
+ return `Sent invoice ${input.invoiceId ?? ''}`.trim();
72
+ },
73
+ expandedView: (tc) => <pre>{tc.output ?? ''}</pre>,
74
+ },
75
+ ];
76
+
77
+ export function AppAssistant({ agentId }: { agentId: string }) {
78
+ const transport = useMemo(() => createLumeraAgentChatTransport({ agentId }), [agentId]);
79
+
80
+ return (
81
+ <div style={{ height: '100vh' }}>
82
+ <AssistantPage
83
+ agentId={agentId}
84
+ transport={transport}
85
+ title="Finance assistant"
86
+ suggestions={['Review open invoices', 'Draft collection notes']}
87
+ toolRenderers={toolRenderers}
88
+ className="h-full"
89
+ />
90
+ </div>
91
+ );
92
+ }
93
+ ```
94
+
95
+ Custom tool renderers are checked before the built-in renderer registry, so they can add support for custom tools or override how a built-in tool appears. Pass the same renderer array to `AssistantPage`, `AssistantChat`, or `AssistantWidget` through the `toolRenderers` prop. For the lower-level `AgentChat` component, pass it as `renderers={{ toolRenderers }}`.
96
+
28
97
  ### API Utilities
29
98
 
30
99
  ```tsx
@@ -24010,7 +24010,7 @@ var lr = (e) => {
24010
24010
  for (; t > 0 && e[t - 1] === `
24011
24011
  `; ) t--;
24012
24012
  return e.slice(0, t);
24013
- }, cr = lazy(() => import("./highlighted-body-OFNGDK62-RNfbxkZK.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
24013
+ }, cr = lazy(() => import("./highlighted-body-OFNGDK62-CwDFJOT8.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
24014
24014
  let i = y2(), d2 = useMemo(() => lr(e), [e]), c2 = useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: d2.split(`
24015
24015
  `).map((p2) => [{ content: p2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [d2]);
24016
24016
  return jsx(nt.Provider, { value: { code: e }, children: jsxs(ot, { isIncomplete: r, language: t, children: [jsx(rt, { language: t }), n ? jsx("div", { className: i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"), children: jsx("div", { className: i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"), "data-streamdown": "code-block-actions", children: n }) }) : null, jsx(Suspense, { fallback: jsx(At, { className: o, language: t, lineNumbers: a, result: c2, startLine: s2, ...l }), children: jsx(cr, { className: o, code: d2, language: t, lineNumbers: a, raw: c2, startLine: s2, ...l }) })] }) });
@@ -24372,7 +24372,7 @@ var vo = ({ children: e, className: t, showControls: o, showCopy: n = true, show
24372
24372
  let l = y2(), i = o && n, d2 = o && r, c2 = o && s2, p2 = i || d2 || c2;
24373
24373
  return jsxs("div", { className: l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"), "data-streamdown": "table-wrapper", children: [p2 ? jsxs("div", { className: l("flex items-center justify-end gap-1"), children: [i ? jsx(Te, {}) : null, d2 ? jsx(Pe, {}) : null, c2 ? jsx(Co, { showCopy: i, showDownload: d2, children: e }) : null] }) : null, jsx("div", { className: l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"), children: jsx("table", { className: l("w-full divide-y divide-border", t), "data-streamdown": "table", ...a, children: e }) })] });
24374
24374
  };
24375
- var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-D-jyZ9k_.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24375
+ var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-CB_DxMC9.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24376
24376
  function qe(e, t) {
24377
24377
  if (!(e != null && e.position || t != null && t.position)) return true;
24378
24378
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -26098,7 +26098,7 @@ const artifactRenderer = {
26098
26098
  return tc.name === "create_artifact";
26099
26099
  },
26100
26100
  summary(tc) {
26101
- const input = tc.input;
26101
+ const input = tc.input ?? {};
26102
26102
  const title = String(input.title ?? input.path ?? "file");
26103
26103
  return tc.status === "running" ? `📎 Creating ${title}…` : `📎 Created ${title}`;
26104
26104
  }
@@ -26128,7 +26128,7 @@ const bashRenderer = {
26128
26128
  return tc.name === "bash";
26129
26129
  },
26130
26130
  summary(tc) {
26131
- const command = tc.input.command ?? "";
26131
+ const command = (tc.input ?? {}).command ?? "";
26132
26132
  const parts = command.trim().split(/\s+/);
26133
26133
  const base = parts[0] ?? "";
26134
26134
  const rest = parts.slice(1).join(" ");
@@ -26240,7 +26240,7 @@ const editRenderer = {
26240
26240
  return tc.name === "edit";
26241
26241
  },
26242
26242
  summary(tc) {
26243
- const path2 = tc.input.path ?? "";
26243
+ const path2 = (tc.input ?? {}).path ?? "";
26244
26244
  const file = basename$2(path2);
26245
26245
  return tc.status === "running" ? `✏️ Editing ${file}` : tc.status === "error" ? isExploratoryToolCallError(tc) ? `✏️ Tried editing ${file}` : `✏️ Failed to edit ${file}` : `✏️ Edited ${file}`;
26246
26246
  }
@@ -26250,7 +26250,7 @@ const findToolRenderer = {
26250
26250
  return tc.name === "find";
26251
26251
  },
26252
26252
  summary(tc) {
26253
- const input = tc.input;
26253
+ const input = tc.input ?? {};
26254
26254
  const pattern = input.pattern ?? "";
26255
26255
  const short = pattern.length > 30 ? `${pattern.slice(0, 30)}…` : pattern;
26256
26256
  if (tc.status === "running") return `🔎 Finding "${short}"`;
@@ -26264,7 +26264,7 @@ const grepRenderer = {
26264
26264
  return tc.name === "grep";
26265
26265
  },
26266
26266
  summary(tc) {
26267
- const input = tc.input;
26267
+ const input = tc.input ?? {};
26268
26268
  const pattern = input.pattern ?? "";
26269
26269
  const short = pattern.length > 30 ? `${pattern.slice(0, 30)}…` : pattern;
26270
26270
  if (tc.status === "running") return `🔍 Searching for "${short}"`;
@@ -26899,7 +26899,7 @@ const lsRenderer = {
26899
26899
  return tc.name === "ls";
26900
26900
  },
26901
26901
  summary(tc) {
26902
- const path2 = tc.input.path ?? ".";
26902
+ const path2 = (tc.input ?? {}).path ?? ".";
26903
26903
  if (tc.status === "running") return `📁 Listing ${path2}`;
26904
26904
  const out = extractOutputText(tc.output);
26905
26905
  const lines = out.split("\n").filter((l) => l.trim());
@@ -27073,7 +27073,7 @@ const readRenderer = {
27073
27073
  return tc.name === "read";
27074
27074
  },
27075
27075
  summary(tc) {
27076
- const path2 = tc.input.path ?? "";
27076
+ const path2 = (tc.input ?? {}).path ?? "";
27077
27077
  const file = basename$1(path2);
27078
27078
  return tc.status === "running" ? `📖 Reading ${file}` : `📖 Read ${file}`;
27079
27079
  }
@@ -27171,7 +27171,7 @@ const webSearchRenderer = {
27171
27171
  return tc.name === "web_search";
27172
27172
  },
27173
27173
  summary(tc) {
27174
- const query = tc.input.query;
27174
+ const query = (tc.input ?? {}).query;
27175
27175
  const short = query?.length > 50 ? `${query.slice(0, 50)}…` : query ?? "";
27176
27176
  return tc.status === "running" ? `🌐 Searching: "${short}"` : `🌐 Searched: "${short}"`;
27177
27177
  }
@@ -27184,7 +27184,7 @@ const writeRenderer = {
27184
27184
  return tc.name === "write";
27185
27185
  },
27186
27186
  summary(tc) {
27187
- const path2 = tc.input.path ?? "";
27187
+ const path2 = (tc.input ?? {}).path ?? "";
27188
27188
  const file = basename(path2);
27189
27189
  if (tc.status === "running") return `📝 Writing ${file}`;
27190
27190
  if (tc.status === "error") {
@@ -27241,15 +27241,31 @@ function ToolCallCard({ toolCall, renderers, className, ...props }) {
27241
27241
  const overrides = renderers ?? contextRenderers;
27242
27242
  const renderer = useMemo(() => findRenderer(toolCall, overrides), [toolCall, overrides]);
27243
27243
  useEffect(() => subscribeCollectionMap(setCollections), []);
27244
- const summary = useMemo(() => renderer.summary(toolCall, collections), [renderer, toolCall, collections]);
27245
- const inlinePreview = useMemo(
27246
- () => renderer.inlinePreview?.(toolCall, collections) ?? null,
27247
- [renderer, toolCall, collections]
27248
- );
27249
- const expandedView = useMemo(
27250
- () => renderer.expandedView?.(toolCall, collections) ?? null,
27251
- [renderer, toolCall, collections]
27244
+ const safeToolCall = useMemo(
27245
+ () => toolCall.input == null ? { ...toolCall, input: {} } : toolCall,
27246
+ [toolCall]
27252
27247
  );
27248
+ const summary = useMemo(() => {
27249
+ try {
27250
+ return renderer.summary(safeToolCall, collections);
27251
+ } catch {
27252
+ return safeToolCall.name;
27253
+ }
27254
+ }, [renderer, safeToolCall, collections]);
27255
+ const inlinePreview = useMemo(() => {
27256
+ try {
27257
+ return renderer.inlinePreview?.(safeToolCall, collections) ?? null;
27258
+ } catch {
27259
+ return null;
27260
+ }
27261
+ }, [renderer, safeToolCall, collections]);
27262
+ const expandedView = useMemo(() => {
27263
+ try {
27264
+ return renderer.expandedView?.(safeToolCall, collections) ?? null;
27265
+ } catch {
27266
+ return null;
27267
+ }
27268
+ }, [renderer, safeToolCall, collections]);
27253
27269
  const rawOutput = useMemo(() => extractOutputText(toolCall.output), [toolCall.output]);
27254
27270
  const hasExpandable = !!expandedView || !!rawOutput;
27255
27271
  const isRunning = toolCall.status === "running";
@@ -1 +1 @@
1
- {"version":3,"file":"ToolCallCard.d.ts","sourceRoot":"","sources":["../../../../src/components/agent-chat/tool-renderers/ToolCallCard.tsx"],"names":[],"mappings":"AAYA,OAAO,EAAiB,KAAK,cAAc,EAAE,KAAK,SAAS,EAA4C,MA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AE,SAAS,EAAE,GAAG,KAAK,EAAE,EAAE,iBAAiB,2CAuG3F"}
@@ -1,4 +1,4 @@
1
- import { A, a, e, j, k, n, o, D, p, q, R, T, b, c, d, f, g, h, i, l, u, w, m } from "../RecordSheet-CWZIr6LL.js";
1
+ import { A, a, e, j, k, n, o, D, p, q, R, T, b, c, d, f, g, h, i, l, u, w, m } from "../RecordSheet-Bq03LrqX.js";
2
2
  export {
3
3
  A as AgentChat,
4
4
  a as ArtifactCard,
@@ -1,4 +1,4 @@
1
- import { s as R$1, L as Li, t as At } from "./RecordSheet-CWZIr6LL.js";
1
+ import { s as R$1, L as Li, t as At } from "./RecordSheet-Bq03LrqX.js";
2
2
  import { useContext, useState, useEffect } from "react";
3
3
  import { jsx } from "react/jsx-runtime";
4
4
  var R = ({ code: s, language: e, raw: t, className: h, startLine: d, lineNumbers: m, ...p }) => {
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A, a, e, j, k, n, o, D, p, q, R, T, b, c, d, f, g, h, i, l, u, w, m } from "./RecordSheet-CWZIr6LL.js";
1
+ import { A, a, e, j, k, n, o, D, p, q, R, T, b, c, d, f, g, h, i, l, u, w, m } from "./RecordSheet-Bq03LrqX.js";
2
2
  import { u as u2, a as a2, b as b2 } from "./use-automation-run-DRIBPYHk.js";
3
3
  import { u as u3, a as a3, b as b3, c as c2, d as d2, e as e2 } from "./use-sql-table-BgXH7Xzu.js";
4
4
  import { B, E, z, b as b4, A as A2, C, D as D2, c as c3, F, G, H, I, g as g2, J, K, L, f as f2, M, O, N, a as a4, h as h2, P, i as i2, Q, R as R2, S, T as T2, U, o as o2, p as p2, d as d3, j as j2, k as k2, l as l2, m as m2, n as n2, q as q2, r, t, u as u4, v, w as w2, V, W, e as e3, x, s, y } from "./automations-Bb9nlU05.js";
@@ -0,0 +1,4 @@
1
+ import { r } from "./RecordSheet-Bq03LrqX.js";
2
+ export {
3
+ r as Mermaid
4
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/ui",
3
- "version": "0.11.0-dev.2",
3
+ "version": "0.11.1-dev.0",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -1,4 +0,0 @@
1
- import { r } from "./RecordSheet-CWZIr6LL.js";
2
- export {
3
- r as Mermaid
4
- };