@lumerahq/ui 0.19.6 → 0.20.0-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.
Files changed (57) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +29 -15
  3. package/dist/{RecordSheet-YYdAQo89.js → RecordSheet-CzJyCMVB.js} +1335 -751
  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/tool-renderers/ToolCallCard.d.ts +4 -1
  44. package/dist/components/agent-chat/tool-renderers/ToolCallCard.d.ts.map +1 -1
  45. package/dist/components/agent-chat/types.d.ts +87 -19
  46. package/dist/components/agent-chat/types.d.ts.map +1 -1
  47. package/dist/components/index.d.ts +2 -2
  48. package/dist/components/index.d.ts.map +1 -1
  49. package/dist/components/index.js +22 -21
  50. package/dist/{highlighted-body-OFNGDK62-CC4-u9BC.js → highlighted-body-OFNGDK62-DuBXfvG-.js} +1 -1
  51. package/dist/hooks/index.js +1 -1
  52. package/dist/index.js +25 -24
  53. package/dist/mermaid-GHXKKRXX-ByaXZtzi.js +4 -0
  54. package/dist/ui.css +517 -63
  55. package/dist/{use-automation-run-BcXShLYo.js → use-automation-run-1Fd0EFiJ.js} +1 -1
  56. package/package.json +3 -2
  57. package/dist/mermaid-GHXKKRXX-BYF0ZrAE.js +0 -4
package/CHANGELOG.md ADDED
@@ -0,0 +1,38 @@
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`.
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
+ - 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.
21
+ - Tool step summaries of the form `Label · detail` render as a row with the detail in a mono column; a leading emoji is dropped.
22
+ - The chat markdown variant uses the body text scale.
23
+ - The stylesheet adds `.agent-chat` accent tokens and animations. The `.assistant-md` rules and `pulse-dot` keyframe remain for the assistant surfaces.
24
+
25
+ ### Deprecated
26
+
27
+ Still exported so existing apps keep compiling; removed in a later major.
28
+
29
+ - `ActivityStrip`, `ActivityStripItem`, `ActivityStripProps`: `AgentChat` renders reasoning and tool steps itself with its own reasoning line and tool-step card.
30
+ - `encodeActivityLabels`, `summarizeActivityLabels`: only the deprecated `ActivityStrip` uses them.
31
+ - `AgentChatAppearance` and the `appearance` feature flag and renderer prop: the transcript has one appearance and the value is ignored.
32
+ - `labels.emptyTitle`: the empty state is titled with the agent name.
33
+ - `statusText` on header renderer props: still provided; derive custom copy from `phase`, `isWorking`, and `isCompacting`.
34
+
35
+ ### Notes
36
+
37
+ - `AssistantPage`, `AssistantWidget`, and `AssistantChat` still render the previous look and will be rebuilt as thin wrappers over `AgentChat` in an upcoming release.
38
+ - 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,17 +121,23 @@ 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}
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 }}
133
141
  className="h-full"
134
142
  />
135
143
  </div>
@@ -137,9 +145,15 @@ export function AppAssistant({ agentId }: { agentId: string }) {
137
145
  }
138
146
  ```
139
147
 
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.
148
+ The component fills its host's height, so give the parent a height. Colors, radii, and type come from the shared theme tokens (`--primary`, `--radius`, `--font-sans`, …); rebrand by overriding those on `:root`, `.dark`, or a wrapper class.
149
+
150
+ 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 is sent per turn as `web_search_enabled`. 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.
151
+
152
+ **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.
153
+
154
+ `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
155
 
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 }}`.
156
+ 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
157
 
144
158
  ### API Utilities
145
159