@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
package/dist/logo.png DELETED
Binary file
Binary file
@@ -1,134 +0,0 @@
1
- import { useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
2
- import { useState, useRef, useEffect, useCallback } from "react";
3
- import { l as ensureAutomationRun, j as createAutomationRun, e as cancelAutomationRun, d as automationStatuses, q as getAutomationRun } from "./automations-OzVpAuzv.js";
4
- function useAutomationRun(options) {
5
- const {
6
- agentId,
7
- inputs,
8
- externalId,
9
- autoStart = true,
10
- pollIntervalMs = 2e3,
11
- dedupeWithExternalId = true,
12
- onComplete,
13
- onCreated,
14
- onUpdate
15
- } = options;
16
- const queryClient = useQueryClient();
17
- const [currentRunId, setCurrentRunId] = useState(null);
18
- const [errorV, setErrorV] = useState(null);
19
- const startMutation = useMutation({
20
- mutationFn: async () => {
21
- setErrorV(null);
22
- if (!agentId) throw new Error("agentId is required");
23
- if (externalId && dedupeWithExternalId) {
24
- return ensureAutomationRun({ agentId, inputs, externalId });
25
- }
26
- return createAutomationRun({ agentId, inputs, externalId });
27
- },
28
- onSuccess: (data) => {
29
- setCurrentRunId(data.id);
30
- queryClient.setQueryData(["automation-run", data.id], data);
31
- onCreated?.(data);
32
- onUpdate?.(data);
33
- },
34
- onError: (err) => {
35
- setErrorV(err instanceof Error ? err.message : "Unable to start automation");
36
- }
37
- });
38
- const cancelMutation = useMutation({
39
- mutationFn: async (runId) => {
40
- return cancelAutomationRun(runId);
41
- },
42
- onSuccess: (data) => {
43
- queryClient.setQueryData(["automation-run", data.id], data);
44
- onUpdate?.(data);
45
- },
46
- onError: (err) => {
47
- setErrorV(err instanceof Error ? err.message : "Unable to cancel automation");
48
- }
49
- });
50
- const {
51
- data: run,
52
- isError: isQueryError,
53
- error: queryError,
54
- refetch
55
- } = useQuery({
56
- queryKey: ["automation-run", currentRunId],
57
- queryFn: async () => {
58
- if (!currentRunId) return null;
59
- return getAutomationRun(currentRunId);
60
- },
61
- enabled: !!currentRunId,
62
- // Poll while active, stop when terminal
63
- refetchInterval: (query) => {
64
- const status = query.state.data?.status;
65
- if (status && automationStatuses.TERMINAL_STATUSES.includes(status)) {
66
- return false;
67
- }
68
- return pollIntervalMs;
69
- },
70
- // Immediately show data from setQueryData
71
- initialData: void 0
72
- });
73
- const completedRunRef = useRef(null);
74
- useEffect(() => {
75
- if (run) {
76
- onUpdate?.(run);
77
- if (automationStatuses.TERMINAL_STATUSES.includes(run.status)) {
78
- if (completedRunRef.current !== run.id) {
79
- completedRunRef.current = run.id;
80
- onComplete?.(run);
81
- }
82
- } else {
83
- if (completedRunRef.current === run.id) {
84
- completedRunRef.current = null;
85
- }
86
- }
87
- }
88
- }, [run, onComplete, onUpdate]);
89
- useEffect(() => {
90
- if (isQueryError && queryError) {
91
- setErrorV(queryError instanceof Error ? queryError.message : "Failed to poll automation");
92
- }
93
- }, [isQueryError, queryError]);
94
- const start = useCallback(async () => {
95
- try {
96
- const result = await startMutation.mutateAsync();
97
- return result;
98
- } catch {
99
- return null;
100
- }
101
- }, [startMutation]);
102
- const cancel = useCallback(async () => {
103
- if (!currentRunId) return null;
104
- try {
105
- return await cancelMutation.mutateAsync(currentRunId);
106
- } catch {
107
- return null;
108
- }
109
- }, [cancelMutation, currentRunId]);
110
- const refresh = useCallback(async () => {
111
- if (!currentRunId) return start();
112
- const result = await refetch();
113
- return result.data ?? null;
114
- }, [currentRunId, refetch, start]);
115
- const autoStartedRef = useRef(false);
116
- useEffect(() => {
117
- if (autoStart && !autoStartedRef.current && !currentRunId) {
118
- autoStartedRef.current = true;
119
- void start();
120
- }
121
- }, [autoStart, currentRunId, start]);
122
- return {
123
- run: run ?? null,
124
- status: run?.status ?? "idle",
125
- isLoading: startMutation.isPending || cancelMutation.isPending,
126
- error: errorV,
127
- start,
128
- refresh,
129
- cancel
130
- };
131
- }
132
- export {
133
- useAutomationRun as u
134
- };