@lumerahq/ui 0.19.6 → 0.20.0-dev.1

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.
Files changed (60) hide show
  1. package/CHANGELOG.md +44 -0
  2. package/README.md +31 -16
  3. package/dist/{RecordSheet-YYdAQo89.js → RecordSheet-Cq027sFr.js} +1358 -750
  4. package/dist/components/agent-chat/ActivityStrip.d.ts +6 -1
  5. package/dist/components/agent-chat/ActivityStrip.d.ts.map +1 -1
  6. package/dist/components/agent-chat/AgentChat.d.ts +1 -1
  7. package/dist/components/agent-chat/AgentChat.d.ts.map +1 -1
  8. package/dist/components/agent-chat/AgentChatComposer.d.ts +8 -0
  9. package/dist/components/agent-chat/AgentChatComposer.d.ts.map +1 -0
  10. package/dist/components/agent-chat/AgentChatEmptyState.d.ts +9 -0
  11. package/dist/components/agent-chat/AgentChatEmptyState.d.ts.map +1 -0
  12. package/dist/components/agent-chat/AgentChatHeader.d.ts +4 -0
  13. package/dist/components/agent-chat/AgentChatHeader.d.ts.map +1 -0
  14. package/dist/components/agent-chat/AgentChatToast.d.ts +5 -0
  15. package/dist/components/agent-chat/AgentChatToast.d.ts.map +1 -0
  16. package/dist/components/agent-chat/AgentChatTranscript.d.ts +24 -0
  17. package/dist/components/agent-chat/AgentChatTranscript.d.ts.map +1 -0
  18. package/dist/components/agent-chat/AssistantTurn.d.ts +40 -0
  19. package/dist/components/agent-chat/AssistantTurn.d.ts.map +1 -0
  20. package/dist/components/agent-chat/DefaultContentBlock.d.ts +4 -0
  21. package/dist/components/agent-chat/DefaultContentBlock.d.ts.map +1 -0
  22. package/dist/components/agent-chat/Markdown.d.ts +2 -2
  23. package/dist/components/agent-chat/ReasoningLine.d.ts +10 -0
  24. package/dist/components/agent-chat/ReasoningLine.d.ts.map +1 -0
  25. package/dist/components/agent-chat/SystemMarker.d.ts +7 -0
  26. package/dist/components/agent-chat/SystemMarker.d.ts.map +1 -0
  27. package/dist/components/agent-chat/ToolStepsCard.d.ts +17 -0
  28. package/dist/components/agent-chat/ToolStepsCard.d.ts.map +1 -0
  29. package/dist/components/agent-chat/TurnStatus.d.ts +11 -0
  30. package/dist/components/agent-chat/TurnStatus.d.ts.map +1 -0
  31. package/dist/components/agent-chat/UserMessage.d.ts +4 -0
  32. package/dist/components/agent-chat/UserMessage.d.ts.map +1 -0
  33. package/dist/components/agent-chat/activity-utils.d.ts +35 -8
  34. package/dist/components/agent-chat/activity-utils.d.ts.map +1 -1
  35. package/dist/components/agent-chat/hooks/use-autosize-textarea.d.ts +4 -0
  36. package/dist/components/agent-chat/hooks/use-autosize-textarea.d.ts.map +1 -0
  37. package/dist/components/agent-chat/hooks/use-stick-to-bottom.d.ts +7 -0
  38. package/dist/components/agent-chat/hooks/use-stick-to-bottom.d.ts.map +1 -0
  39. package/dist/components/agent-chat/hooks/use-transient-toast.d.ts +7 -0
  40. package/dist/components/agent-chat/hooks/use-transient-toast.d.ts.map +1 -0
  41. package/dist/components/agent-chat/index.d.ts +2 -1
  42. package/dist/components/agent-chat/index.d.ts.map +1 -1
  43. package/dist/components/agent-chat/lumera-agent-transport.d.ts.map +1 -1
  44. package/dist/components/agent-chat/tool-renderers/ToolCallCard.d.ts +4 -1
  45. package/dist/components/agent-chat/tool-renderers/ToolCallCard.d.ts.map +1 -1
  46. package/dist/components/agent-chat/types.d.ts +98 -19
  47. package/dist/components/agent-chat/types.d.ts.map +1 -1
  48. package/dist/components/index.d.ts +2 -2
  49. package/dist/components/index.d.ts.map +1 -1
  50. package/dist/components/index.js +22 -21
  51. package/dist/{highlighted-body-OFNGDK62-CC4-u9BC.js → highlighted-body-OFNGDK62-ByL2oaVl.js} +1 -1
  52. package/dist/hooks/index.js +1 -1
  53. package/dist/hooks/use-agent-chat.d.ts +6 -3
  54. package/dist/hooks/use-agent-chat.d.ts.map +1 -1
  55. package/dist/index.js +25 -24
  56. package/dist/mermaid-GHXKKRXX-BkfFnaMM.js +4 -0
  57. package/dist/ui.css +517 -59
  58. package/dist/{use-automation-run-BcXShLYo.js → use-automation-run-BaW82zqJ.js} +9 -4
  59. package/package.json +3 -2
  60. package/dist/mermaid-GHXKKRXX-BYF0ZrAE.js +0 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,44 @@
1
+ # Changelog
2
+
3
+ Notable changes to `@lumerahq/ui`. Earlier releases are not documented here.
4
+
5
+ ## 0.20.0
6
+
7
+ `AgentChat` is now the primary chat component. Use it for new chat UIs and move existing ones to it when you can. Nothing exported in 0.19 is removed; see Deprecated below.
8
+
9
+ ### Added
10
+
11
+ - Redesigned `AgentChat`: a header with the agent's identity, an activity dot, and a New button; an empty state with suggested prompts; a transcript with a reasoning line, a grouped tool-step card, streamed markdown with a caret, an error block with in-place Retry, and compaction markers with a collapsible recap; a composer with attachments, a per-turn Web search chip, quick-action chips, Stop, and a border trace while a turn runs.
12
+ - `AgentChat` props: `suggestions`, `composerChips`, `onNewChat`, `headerLeft`, `headerRight`, `webSearchDefault`, and `accent` / `accentForeground` to recolour one chat without touching the app theme.
13
+ - Labels: `newChat`, `active`, `idle`, `compacting`, `hint`, `working`, `stopped`, `interrupted`, `error`.
14
+ - `DefaultContentBlock` is exported so a custom `ContentBlock` renderer can handle its own block types and delegate the rest. Other default renderers and transcript internals stay unexported.
15
+ - Renderer props: message renderers receive `labels`; header renderers receive `labels`, `isCompacting`, and `onNewChat`; the composer state carries `inFlight`, `hint`, `sendLabel`, `stopLabel`, `chips`, and `webSearchEnabled`; `EmptyState` receives the agent name, description, suggestions, and a pick handler; `LoadEarlierButton` receives its `label`.
16
+ - An Agent Chat page in the package dev app (`pnpm dev`), driven by a scripted transport that covers streaming, tool steps, a failing turn with Retry, Stop, uploads, and auto-compaction.
17
+
18
+ ### Changed
19
+
20
+ - `AgentChat` fills its parent's height instead of defaulting to 720px. The viewport cap (`100vh - 2rem`) and the 360px minimum stay, so in an unsized parent it grows with the transcript up to the viewport height and then scrolls. The cap does not account for content above the chat; set a height on the parent to fit it to its space. `className="h-full"` is no longer needed.
21
+ - A user Stop settles the turn as `aborted`, shown as "Stopped" under the prompt with no Retry. An `interrupted` turn (a cut-off run) renders like a failure, with Retry.
22
+ - Tool step summaries of the form `Label · detail` render as a row with the detail in a mono column; a leading emoji is dropped.
23
+ - The chat markdown variant uses the body text scale.
24
+ - The stylesheet adds `.agent-chat` accent tokens and animations. The `.assistant-md` rules and `pulse-dot` keyframe remain for the assistant surfaces.
25
+
26
+ ### Fixed
27
+
28
+ - With `features.webSearch`, the Web chip starts from the agent's configured `web_search_enabled` (or the `webSearchDefault` prop), and a send omits the flag until one is known. It started off and sent `false` on every turn, which switched web search off for agents that have it on.
29
+ - A submit the runtime refuses (an HTTP error from `/live/start`) now shows its message in the transcript's error banner; the draft stays in the composer. It was dropped silently.
30
+
31
+ ### Deprecated
32
+
33
+ Still exported so existing apps keep compiling; removed in a later major.
34
+
35
+ - `ActivityStrip`, `ActivityStripItem`, `ActivityStripProps`: `AgentChat` renders reasoning and tool steps itself with its own reasoning line and tool-step card.
36
+ - `encodeActivityLabels`, `summarizeActivityLabels`: only the deprecated `ActivityStrip` uses them.
37
+ - `AgentChatAppearance` and the `appearance` feature flag and renderer prop: the transcript has one appearance and the value is ignored.
38
+ - `labels.emptyTitle`: the empty state is titled with the agent name.
39
+ - `statusText` on header renderer props: still provided; derive custom copy from `phase`, `isWorking`, and `isCompacting`.
40
+
41
+ ### Notes
42
+
43
+ - `AssistantPage`, `AssistantWidget`, and `AssistantChat` still render the previous look and will be rebuilt as thin wrappers over `AgentChat` in an upcoming release.
44
+ - Code that builds message or composer renderer prop objects by hand, to render the default `UserMessage` or composer outside `AgentChat`, must supply the new required fields.
package/README.md CHANGED
@@ -10,7 +10,7 @@ npm install @lumerahq/ui
10
10
 
11
11
  ## Features
12
12
 
13
- - **Application Components** - Assistant chat surfaces, data tables, record sheets, and automation runner
13
+ - **Application Components** - Agent 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
@@ -27,7 +27,7 @@ Import the package stylesheet once in the app entrypoint before rendering any `@
27
27
  import '@lumerahq/ui/styles.css';
28
28
  ```
29
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`.
30
+ This stylesheet is required for the shared Tailwind/shadcn theme variables, Inter font, and the agent chat's derived tokens and animations. It is not included automatically when importing from `@lumerahq/ui/components`, `@lumerahq/ui/hooks`, or `@lumerahq/ui/lib`.
31
31
 
32
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
33
 
@@ -93,15 +93,16 @@ present, and `run_id` retains an upstream automation or function run. Agent and
93
93
  session filters include these hook events. Webhook and anonymous app writes keep
94
94
  their distinct execution types instead of being reported as system work.
95
95
 
96
- ### Assistant Chat
96
+ ### Agent Chat
97
97
 
98
- Use `AssistantPage` for a full-page chat, `AssistantWidget` for a floating widget, or `AssistantChat` when embedding the chat surface inside custom chrome.
98
+ `AgentChat` is the primary chat component as of 0.20. It renders a header with the agent's identity and activity, an empty state with suggested prompts, the transcript (reasoning line, grouped tool-step card, streamed markdown, error block with in-place Retry, compaction markers), and a composer with attachments, a per-turn Web search chip, and Stop. Use it for new chat UIs and move existing ones to it at the first opportunity. `AssistantPage` (session rail), `AssistantWidget` (floating launcher), and `AssistantChat` (data-sync) still render the previous look and will be rebuilt as thin wrappers over `AgentChat` in an upcoming release.
99
99
 
100
100
  ```tsx
101
- import { useMemo } from 'react';
101
+ import { useEffect, useMemo, useState } from 'react';
102
102
  import {
103
- AssistantPage,
103
+ AgentChat,
104
104
  createLumeraAgentChatTransport,
105
+ postReadyMessage,
105
106
  type AgentChatToolRenderer,
106
107
  } from '@lumerahq/ui';
107
108
  import '@lumerahq/ui/styles.css';
@@ -109,9 +110,10 @@ import '@lumerahq/ui/styles.css';
109
110
  const toolRenderers: AgentChatToolRenderer[] = [
110
111
  {
111
112
  match: (tc) => tc.name === 'send_invoice',
113
+ // "label · detail": the detail lands in the right-aligned mono column.
112
114
  summary: (tc) => {
113
115
  const input = tc.input as { invoiceId?: string };
114
- return `Sent invoice ${input.invoiceId ?? ''}`.trim();
116
+ return `Sent invoice · ${input.invoiceId ?? ''}`.trim();
115
117
  },
116
118
  expandedView: (tc) => <pre>{tc.output ?? ''}</pre>,
117
119
  },
@@ -119,27 +121,40 @@ const toolRenderers: AgentChatToolRenderer[] = [
119
121
 
120
122
  export function AppAssistant({ agentId }: { agentId: string }) {
121
123
  const transport = useMemo(() => createLumeraAgentChatTransport({ agentId }), [agentId]);
124
+ // The host owns the session; New switches to a fresh one.
125
+ const [sessionId, setSessionId] = useState(() => `session-${Date.now()}`);
126
+
127
+ useEffect(() => {
128
+ postReadyMessage();
129
+ }, []);
122
130
 
123
131
  return (
124
132
  <div style={{ height: '100vh' }}>
125
- <AssistantPage
133
+ <AgentChat
126
134
  agentId={agentId}
135
+ sessionId={sessionId}
127
136
  transport={transport}
128
- title="Finance assistant"
129
- sessionFilter={(session) => session.id.startsWith('finance-')}
130
- newChatPrefix="finance"
131
- suggestions={['Review open invoices', 'Draft collection notes']}
132
- toolRenderers={toolRenderers}
133
- className="h-full"
137
+ suggestions={['Summarize recent activity', 'Find records that need attention']}
138
+ onNewChat={() => setSessionId(`session-${Date.now()}`)}
139
+ features={{ attachments: true, webSearch: true }}
140
+ renderers={{ toolRenderers }}
134
141
  />
135
142
  </div>
136
143
  );
137
144
  }
138
145
  ```
139
146
 
140
- `sessionFilter` scopes the visible session list and ignores a backend-selected active session that does not pass the predicate. It is a client-side presentation filter, not an authorization boundary.
147
+ The component fills its parent's height (min 360px). In an unsized parent it grows with the transcript, capped at the viewport height as a guard against unbounded growth. The cap does not account for content above the chat, so give the parent a height to fit it to the space it has. Colors, radii, and type come from the shared theme tokens (`--primary`, `--radius`, `--font-sans`, …). Pass `accent` (and `accentForeground` for text on a light accent) to recolour one chat, or override the tokens on `:root`, `.dark`, or a wrapper class to rebrand the whole app.
148
+
149
+ Keep the built-in header. It shows the agent's name and description, the Active/Idle dot, and New, and it tracks the runtime's state. Add controls with `headerLeft` and `headerRight`; set `features.header: false` only when the host chrome already provides all of that.
150
+
151
+ Session actions map to the runtime: **New** calls `onNewChat` (the host owns `sessionId`) and **Retry** on a failed turn uses `transport.retry` (`POST /live/retry`) to re-run it in place. The Web chip appears with `features.webSearch` and starts from the agent's configured web search setting, or `webSearchDefault`; the choice is sent per turn as `web_search_enabled`, and until one is known the field is omitted so the runtime keeps the agent's setting. When the runtime compacts context on its own mid-turn, the chat shows "Compacting context…" until it finishes and the transcript then carries a "Compacted" marker with the recap.
152
+
153
+ **Deprecated in 0.20** (still exported, removed in a later major): `ActivityStrip` with `ActivityStripItem` / `ActivityStripProps`, `encodeActivityLabels`, `summarizeActivityLabels`, the `appearance` feature flag and `AgentChatAppearance` type, `labels.emptyTitle`, and `statusText` on custom `Header` renderers. `AgentChat` renders reasoning and tool steps itself, with its own reasoning line and tool-step card, and has one transcript appearance.
154
+
155
+ `AgentChat` does not list sessions itself; pair it with `useAgentChatSessions()` and pass the chosen `sessionId`. On `AssistantPage`, `sessionFilter` scopes the visible session list and ignores a backend-selected active session that does not pass the predicate. It is a client-side presentation filter, not an authorization boundary.
141
156
 
142
- 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 }}`.
157
+ 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. A summary of the form `Label · detail` renders as a step row with the detail in the mono column; a leading emoji, if any, is dropped. Pass it to `AgentChat` as `renderers={{ toolRenderers }}`; the assistant surfaces take the same array through their `toolRenderers` prop.
143
158
 
144
159
  ### API Utilities
145
160