@lumerahq/ui 0.7.7 → 0.8.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 (40) hide show
  1. package/dist/RecordSheet-DjPTM9r2.js +38195 -0
  2. package/dist/{api-DXN1wKkz.js → api-Da1IIWDG.js} +1 -1
  3. package/dist/{automations-OzVpAuzv.js → automations-BEBG7FqJ.js} +118 -24
  4. package/dist/components/agent-chat/AgentChat.d.ts +3 -0
  5. package/dist/components/agent-chat/AgentChat.d.ts.map +1 -0
  6. package/dist/components/agent-chat/index.d.ts +5 -0
  7. package/dist/components/agent-chat/index.d.ts.map +1 -0
  8. package/dist/components/agent-chat/lumera-agent-transport.d.ts +20 -0
  9. package/dist/components/agent-chat/lumera-agent-transport.d.ts.map +1 -0
  10. package/dist/components/agent-chat/types.d.ts +400 -0
  11. package/dist/components/agent-chat/types.d.ts.map +1 -0
  12. package/dist/components/index.d.ts +2 -0
  13. package/dist/components/index.d.ts.map +1 -1
  14. package/dist/components/index.js +8 -6
  15. package/dist/components/ui/button.d.ts +1 -1
  16. package/dist/{formatters-Baj7FkeG.js → formatters-D4T821Dv.js} +2 -1
  17. package/dist/highlighted-body-OFNGDK62-B8uWyiQv.js +19 -0
  18. package/dist/hooks/index.d.ts +2 -0
  19. package/dist/hooks/index.d.ts.map +1 -1
  20. package/dist/hooks/index.js +11 -9
  21. package/dist/hooks/use-agent-chat-sessions.d.ts +21 -0
  22. package/dist/hooks/use-agent-chat-sessions.d.ts.map +1 -0
  23. package/dist/hooks/use-agent-chat.d.ts +47 -0
  24. package/dist/hooks/use-agent-chat.d.ts.map +1 -0
  25. package/dist/index.js +54 -49
  26. package/dist/lib/bridge.d.ts +46 -0
  27. package/dist/lib/bridge.d.ts.map +1 -1
  28. package/dist/lib/index.d.ts +1 -1
  29. package/dist/lib/index.d.ts.map +1 -1
  30. package/dist/lib/index.js +27 -26
  31. package/dist/logo.svg +15 -0
  32. package/dist/mermaid-GHXKKRXX-Cm-NNxwL.js +4 -0
  33. package/dist/ui.css +254 -2
  34. package/dist/use-automation-run-rhYZZhj7.js +746 -0
  35. package/dist/{use-sql-table-DSt5nL70.js → use-sql-table-MilCekNQ.js} +104 -9
  36. package/package.json +2 -1
  37. package/dist/RecordSheet-M1ux7vW7.js +0 -12241
  38. package/dist/logo.png +0 -0
  39. package/dist/lumera-logo.png +0 -0
  40. package/dist/use-automation-run-hQ7DMZ8f.js +0 -134
@@ -1,7 +1,101 @@
1
- import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
2
1
  import { useState, useCallback, useEffect, useMemo } from "react";
3
- import { A as listRunsByAgent, d as automationStatuses, j as createAutomationRun, o as onInitMessage } from "./automations-OzVpAuzv.js";
4
- import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-DXN1wKkz.js";
2
+ import { useQueryClient, useQuery, useMutation } from "@tanstack/react-query";
3
+ import { C as listRunsByAgent, e as automationStatuses, k as createAutomationRun, o as onInitMessage } from "./automations-BEBG7FqJ.js";
4
+ import { u as uploadFile, i as pbSql, k as pbUpdateRecord } from "./api-Da1IIWDG.js";
5
+ function useAgentChatSessions({
6
+ agentId,
7
+ transport,
8
+ disabled = false,
9
+ autoLoad = true,
10
+ onError
11
+ }) {
12
+ const [sessions, setSessions] = useState([]);
13
+ const [activeSessionId, setActiveSessionId] = useState(void 0);
14
+ const [error, setError] = useState(null);
15
+ const [isLoading, setIsLoading] = useState(false);
16
+ const [isRenaming, setIsRenaming] = useState(false);
17
+ const handleError = useCallback(
18
+ (err) => {
19
+ setError(err);
20
+ onError?.(err);
21
+ },
22
+ [onError]
23
+ );
24
+ const loadSessions = useCallback(async () => {
25
+ if (disabled) return void 0;
26
+ if (!transport.listSessions) {
27
+ const err = new Error("Agent chat transport does not support listing sessions.");
28
+ handleError(err);
29
+ return void 0;
30
+ }
31
+ setIsLoading(true);
32
+ setError(null);
33
+ try {
34
+ const result = await transport.listSessions({ agentId });
35
+ setSessions(result.sessions);
36
+ setActiveSessionId(result.activeSessionId ?? result.sessions[0]?.id);
37
+ return result;
38
+ } catch (err) {
39
+ handleError(err);
40
+ return void 0;
41
+ } finally {
42
+ setIsLoading(false);
43
+ }
44
+ }, [agentId, disabled, handleError, transport]);
45
+ const renameSession = useCallback(
46
+ async (sessionId, name) => {
47
+ if (disabled) return void 0;
48
+ if (!transport.renameSession) {
49
+ const err = new Error("Agent chat transport does not support renaming sessions.");
50
+ handleError(err);
51
+ return void 0;
52
+ }
53
+ const trimmedName = name.trim();
54
+ if (!trimmedName) {
55
+ const err = new Error("Session name is required.");
56
+ handleError(err);
57
+ return void 0;
58
+ }
59
+ setIsRenaming(true);
60
+ setError(null);
61
+ try {
62
+ const session = await transport.renameSession({ agentId, sessionId, name: trimmedName });
63
+ setSessions((current) => replaceSession(current, session));
64
+ setActiveSessionId((current) => current ?? session.id);
65
+ return session;
66
+ } catch (err) {
67
+ handleError(err);
68
+ return void 0;
69
+ } finally {
70
+ setIsRenaming(false);
71
+ }
72
+ },
73
+ [agentId, disabled, handleError, transport]
74
+ );
75
+ useEffect(() => {
76
+ if (!autoLoad || disabled) return;
77
+ void loadSessions();
78
+ }, [autoLoad, disabled, loadSessions]);
79
+ return {
80
+ sessions,
81
+ activeSessionId,
82
+ error,
83
+ isLoading,
84
+ isRenaming,
85
+ setSessions,
86
+ loadSessions,
87
+ renameSession
88
+ };
89
+ }
90
+ function replaceSession(sessions, next) {
91
+ let found = false;
92
+ const updated = sessions.map((session) => {
93
+ if (session.id !== next.id) return session;
94
+ found = true;
95
+ return next;
96
+ });
97
+ return found ? updated : [next, ...updated];
98
+ }
5
99
  function useAutomationAgent({
6
100
  agentId,
7
101
  limit = 5,
@@ -334,10 +428,11 @@ function useSqlTable(options) {
334
428
  };
335
429
  }
336
430
  export {
337
- useFileUpload as a,
338
- useLumeraUser as b,
339
- usePbSql as c,
340
- usePbUpdate as d,
341
- useSqlTable as e,
342
- useAutomationAgent as u
431
+ useAutomationAgent as a,
432
+ useFileUpload as b,
433
+ useLumeraUser as c,
434
+ usePbSql as d,
435
+ usePbUpdate as e,
436
+ useSqlTable as f,
437
+ useAgentChatSessions as u
343
438
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/ui",
3
- "version": "0.7.7",
3
+ "version": "0.8.0-dev.1",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -43,6 +43,7 @@
43
43
  "class-variance-authority": "^0.7.1",
44
44
  "clsx": "^2.1.1",
45
45
  "lucide-react": "^0.561.0",
46
+ "streamdown": "^2.5.0",
46
47
  "tailwind-merge": "^3.4.0"
47
48
  },
48
49
  "devDependencies": {