@lumerahq/ui 0.19.3 → 0.19.5

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 (36) hide show
  1. package/dist/{RecordSheet-CZ1jrBhN.js → RecordSheet-DYD2utw-.js} +55 -33
  2. package/dist/{audit-log-CBcctM1l.js → audit-log-BFPtNHQh.js} +1 -1
  3. package/dist/{automations-C6SMookl.js → automations-TTSbZaKC.js} +167 -47
  4. package/dist/components/agent-chat/AgentChat.d.ts +1 -1
  5. package/dist/components/agent-chat/AgentChat.d.ts.map +1 -1
  6. package/dist/components/agent-chat/types.d.ts +6 -6
  7. package/dist/components/agent-chat/types.d.ts.map +1 -1
  8. package/dist/components/assistant/AssistantChat.d.ts +4 -1
  9. package/dist/components/assistant/AssistantChat.d.ts.map +1 -1
  10. package/dist/components/assistant/AssistantPage.d.ts +5 -1
  11. package/dist/components/assistant/AssistantPage.d.ts.map +1 -1
  12. package/dist/components/assistant/AssistantWidget.d.ts +5 -1
  13. package/dist/components/assistant/AssistantWidget.d.ts.map +1 -1
  14. package/dist/components/assistant/chat-ui.d.ts +1 -1
  15. package/dist/components/assistant/chat-ui.d.ts.map +1 -1
  16. package/dist/components/index.js +1 -1
  17. package/dist/{highlighted-body-OFNGDK62-DReGUNtu.js → highlighted-body-OFNGDK62-BZWB5CNY.js} +1 -1
  18. package/dist/hooks/index.d.ts +1 -1
  19. package/dist/hooks/index.d.ts.map +1 -1
  20. package/dist/hooks/index.js +6 -5
  21. package/dist/hooks/use-agent-chat-sessions.d.ts +4 -1
  22. package/dist/hooks/use-agent-chat-sessions.d.ts.map +1 -1
  23. package/dist/hooks/use-agent-chat.d.ts +13 -1
  24. package/dist/hooks/use-agent-chat.d.ts.map +1 -1
  25. package/dist/index.js +58 -52
  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 +47 -42
  31. package/dist/mermaid-GHXKKRXX-DGRhAYJL.js +4 -0
  32. package/dist/ui.css +34 -0
  33. package/dist/{use-automation-run-_7rjd8L4.js → use-automation-run-CuJ-xpUg.js} +34 -14
  34. package/dist/{use-sql-table-DCe9zwOx.js → use-sql-table-DpHd0VWk.js} +2 -2
  35. package/package.json +3 -2
  36. package/dist/mermaid-GHXKKRXX-BT6HRm2v.js +0 -4
package/dist/lib/index.js CHANGED
@@ -1,25 +1,25 @@
1
- import { B, E, C, b, D, F, G, c, H, I, J, K, g, L, M, N, f, O, Q, P, a, h, R, i, S, T, U, V, W, l, o, p, d, j, k, m, n, q, t, u, v, w, x, y, X, Y, e, r, z, s, A } from "../automations-C6SMookl.js";
1
+ import { B, E, I, b, J, K, L, c, M, N, O, P, g, Q, R, S, n, T, V, U, a, q, d, h, W, i, e, f, j, X, Y, Z, _, $, l, o, p, k, t, u, v, w, x, y, z, A, C, D, F, a0, a1, m, r, G, s, H } from "../automations-TTSbZaKC.js";
2
2
  import { o as o2, f as f2, a as a2, b as b2, c as c2, d as d2, e as e2, g as g2, h as h2, i as i2, j as j2, k as k2, l as l2, m as m2, n as n2, s as s2 } from "../formatters-D4T821Dv.js";
3
3
  import { q as q2 } from "../query-client-DdOWay4_.js";
4
- import { R as R2, e as e3, b as b3, a as a3, f as f3, g as g3, l as l3, n as n3, c as c3, d as d3, r as r2 } from "../audit-log-CBcctM1l.js";
4
+ import { R as R2, e as e3, b as b3, a as a3, f as f3, g as g3, l as l3, n as n3, c as c3, d as d3, r as r2 } from "../audit-log-BFPtNHQh.js";
5
5
  export {
6
6
  B as BridgeError,
7
7
  E as EXPECTED_PARENT_ORIGIN,
8
8
  R2 as RECORD_AUDIT_EXPORT_LIMIT,
9
9
  e3 as RECORD_AUDIT_MAX_COLLECTIONS,
10
- C as automationStatuses,
10
+ I as automationStatuses,
11
11
  b3 as buildRecordAuditCsv,
12
12
  a3 as buildRecordAuditLogPath,
13
13
  b as buildShareableAppUrl,
14
- D as cancelAutomationRun,
15
- F as cancelRun,
16
- G as clearAutomationCache,
14
+ J as cancelAutomationRun,
15
+ K as cancelRun,
16
+ L as clearAutomationCache,
17
17
  o2 as cn,
18
18
  c as configureBridge,
19
- H as createAutomationRun,
20
- I as createRun,
21
- J as ensureAutomationRun,
22
- K as ensureRun,
19
+ M as createAutomationRun,
20
+ N as createRun,
21
+ O as ensureAutomationRun,
22
+ P as ensureRun,
23
23
  f3 as fetchRecordAuditLogCsv,
24
24
  f2 as formatBoolean,
25
25
  a2 as formatCellValue,
@@ -36,50 +36,55 @@ export {
36
36
  m2 as formatSelect,
37
37
  n2 as formatText,
38
38
  g as getAppProjectExternalId,
39
- L as getAutomationByExternalId,
40
- M as getAutomationRun,
41
- N as getAutomationRunFileDownloadUrl,
42
- f as getDownloadUrl,
39
+ Q as getAutomationByExternalId,
40
+ R as getAutomationRun,
41
+ S as getAutomationRunFileDownloadUrl,
42
+ n as getDownloadUrl,
43
43
  g3 as getRecordAuditLogSnapshot,
44
- O as getRun,
45
- Q as getRunFileUrl,
46
- P as getRunFiles,
44
+ T as getRun,
45
+ V as getRunFileUrl,
46
+ U as getRunFiles,
47
47
  a as getShareableAppUrl,
48
- h as getUploadUrl,
49
- R as isActiveStatus,
50
- i as isEmbedded,
51
- S as isTerminalStatus,
52
- T as listAutomationRunFiles,
48
+ q as getUploadUrl,
49
+ d as getViewerContext,
50
+ h as hasMemberTag,
51
+ W as isActiveStatus,
52
+ i as isCompanyAdmin,
53
+ e as isDepartment,
54
+ f as isEmbedded,
55
+ j as isOrganizationMember,
56
+ X as isTerminalStatus,
57
+ Y as listAutomationRunFiles,
53
58
  l3 as listRecordAuditLog,
54
- U as listRuns,
55
- V as listRunsByAgent,
56
- W as listRunsByExternalId,
59
+ Z as listRuns,
60
+ _ as listRunsByAgent,
61
+ $ as listRunsByExternalId,
57
62
  l as logout,
58
63
  n3 as normalizeRecordAuditCollections,
59
64
  c3 as normalizeRecordAuditExportLimit,
60
65
  d3 as normalizeRecordAuditPageSize,
61
66
  o as onInitMessage,
62
67
  p as parentApiRequest,
63
- d as parentApiStream,
64
- j as pbBulkDelete,
65
- k as pbBulkUpdate,
66
- m as pbCreate,
67
- n as pbDelete,
68
- q as pbGet,
69
- t as pbList,
70
- u as pbSearch,
71
- v as pbSql,
72
- w as pbUpdate,
73
- x as pbUpdateRecord,
74
- y as pbUpsert,
75
- X as pollAutomationRun,
76
- Y as pollRun,
77
- e as postReadyMessage,
68
+ k as parentApiStream,
69
+ t as pbBulkDelete,
70
+ u as pbBulkUpdate,
71
+ v as pbCreate,
72
+ w as pbDelete,
73
+ x as pbGet,
74
+ y as pbList,
75
+ z as pbSearch,
76
+ A as pbSql,
77
+ C as pbUpdate,
78
+ D as pbUpdateRecord,
79
+ F as pbUpsert,
80
+ a0 as pollAutomationRun,
81
+ a1 as pollRun,
82
+ m as postReadyMessage,
78
83
  q2 as queryClient,
79
84
  r2 as recordAuditActorLabel,
80
85
  r as redirectToLogin,
81
- z as sendEmail,
86
+ G as sendEmail,
82
87
  s as serializeBridgeRuntimeConfig,
83
88
  s2 as stripHtml,
84
- A as uploadFile
89
+ H as uploadFile
85
90
  };
@@ -0,0 +1,4 @@
1
+ import { G } from "./RecordSheet-DYD2utw-.js";
2
+ export {
3
+ G as Mermaid
4
+ };
package/dist/ui.css CHANGED
@@ -602,6 +602,40 @@
602
602
  grid-row-start: 1;
603
603
  }
604
604
 
605
+ .container {
606
+ width: 100%;
607
+ }
608
+
609
+ @media (min-width: 40rem) {
610
+ .container {
611
+ max-width: 40rem;
612
+ }
613
+ }
614
+
615
+ @media (min-width: 48rem) {
616
+ .container {
617
+ max-width: 48rem;
618
+ }
619
+ }
620
+
621
+ @media (min-width: 64rem) {
622
+ .container {
623
+ max-width: 64rem;
624
+ }
625
+ }
626
+
627
+ @media (min-width: 80rem) {
628
+ .container {
629
+ max-width: 80rem;
630
+ }
631
+ }
632
+
633
+ @media (min-width: 96rem) {
634
+ .container {
635
+ max-width: 96rem;
636
+ }
637
+ }
638
+
605
639
  .-mx-1\.5 {
606
640
  margin-inline: calc(var(--spacing) * -1.5);
607
641
  }
@@ -1,6 +1,6 @@
1
1
  import { useEffect, useState, useRef, useCallback, useMemo } from "react";
2
2
  import { useQueryClient, useMutation, useQuery } from "@tanstack/react-query";
3
- import { J as ensureAutomationRun, H as createAutomationRun, D as cancelAutomationRun, C as automationStatuses, M as getAutomationRun } from "./automations-C6SMookl.js";
3
+ import { O as ensureAutomationRun, M as createAutomationRun, J as cancelAutomationRun, I as automationStatuses, R as getAutomationRun } from "./automations-TTSbZaKC.js";
4
4
  const QUEUED_DISCOVERY_POLL_MS = 2e3;
5
5
  const IDLE_DISCOVERY_POLL_MS = 1e4;
6
6
  const HIDDEN_DISCOVERY_POLL_MS = 3e4;
@@ -89,6 +89,9 @@ const DEFAULT_SESSION_ID = "default";
89
89
  const DEFAULT_HISTORY_LIMIT = 10;
90
90
  const DEFAULT_MAX_BUFFERED_MESSAGES = 100;
91
91
  const DEFAULT_MAX_QUEUED_MESSAGES = 1;
92
+ function areAgentChatMutationsBlocked(disabled, readOnly) {
93
+ return Boolean(disabled || readOnly);
94
+ }
92
95
  function useAgentChat({
93
96
  agentId,
94
97
  sessionId = DEFAULT_SESSION_ID,
@@ -99,6 +102,7 @@ function useAgentChat({
99
102
  maxBufferedMessages = DEFAULT_MAX_BUFFERED_MESSAGES,
100
103
  maxQueuedMessages = DEFAULT_MAX_QUEUED_MESSAGES,
101
104
  disabled = false,
105
+ readOnly = false,
102
106
  autoLoadHistory = true,
103
107
  autoSubscribe = true,
104
108
  watchdog = false,
@@ -110,6 +114,9 @@ function useAgentChat({
110
114
  onTurnComplete,
111
115
  onError
112
116
  }) {
117
+ const mutationsBlocked = areAgentChatMutationsBlocked(disabled, readOnly);
118
+ const hideComposer = readOnly;
119
+ const mutationBlockedError = readOnly ? "Chat is read-only" : "Nothing to send";
113
120
  const [messages, setMessagesState] = useState(
114
121
  () => trimMessages(initialMessages, maxBufferedMessages)
115
122
  );
@@ -415,7 +422,10 @@ function useAgentChat({
415
422
  const sendMessage = useCallback(
416
423
  async (message) => {
417
424
  const content = (message ?? input).trim();
418
- if (disabled || isSubmitting || !content && pendingFiles.length === 0) {
425
+ if (mutationsBlocked) {
426
+ return { accepted: false, error: mutationBlockedError };
427
+ }
428
+ if (isSubmitting || !content && pendingFiles.length === 0) {
419
429
  return { accepted: false, error: "Nothing to send" };
420
430
  }
421
431
  const active = activeUserMessages(messagesRef.current);
@@ -453,13 +463,14 @@ function useAgentChat({
453
463
  }
454
464
  },
455
465
  [
456
- disabled,
457
466
  handleError,
458
467
  idFactory,
459
468
  input,
460
469
  isSubmitting,
461
470
  loadHistory,
462
471
  maxQueuedMessages,
472
+ mutationBlockedError,
473
+ mutationsBlocked,
463
474
  pendingFiles,
464
475
  sessionId,
465
476
  setMessages,
@@ -468,7 +479,7 @@ function useAgentChat({
468
479
  ]
469
480
  );
470
481
  const abort = useCallback(async () => {
471
- if (disabled || isAborting) return;
482
+ if (mutationsBlocked || isAborting) return;
472
483
  const requestId = latestActiveRequestId(messagesRef.current);
473
484
  setIsAborting(true);
474
485
  try {
@@ -487,10 +498,10 @@ function useAgentChat({
487
498
  } finally {
488
499
  if (mountedRef.current) setIsAborting(false);
489
500
  }
490
- }, [agentId, clearWatchdog, disabled, handleError, isAborting, sessionId, setMessages, transport]);
501
+ }, [agentId, clearWatchdog, handleError, isAborting, mutationsBlocked, sessionId, setMessages, transport]);
491
502
  const attachFiles = useCallback(
492
503
  async (files) => {
493
- if (files.length === 0) return;
504
+ if (mutationsBlocked || files.length === 0) return;
494
505
  const pending = files.map((file) => ({
495
506
  id: idFactory(),
496
507
  file,
@@ -523,7 +534,7 @@ function useAgentChat({
523
534
  })
524
535
  );
525
536
  },
526
- [agentId, handleError, idFactory, sessionId, transport]
537
+ [agentId, handleError, idFactory, mutationsBlocked, sessionId, transport]
527
538
  );
528
539
  const removePendingFile = useCallback((id) => {
529
540
  setPendingFiles((current) => current.filter((file) => file.id !== id));
@@ -563,9 +574,10 @@ function useAgentChat({
563
574
  const hasActive = useMemo(() => activeUserMessages(messages).length > 0, [messages]);
564
575
  const hasFailedUploads = pendingFiles.some((file) => file.status === "failed");
565
576
  const hasUploadingFiles = pendingFiles.some((file) => file.status === "uploading");
566
- const canSubmit = !disabled && !isSubmitting && !hasUploadingFiles && !hasFailedUploads && (input.trim().length > 0 || pendingFiles.length > 0) && (!hasActive || queueLength < maxQueuedMessages);
567
- const canAbort = !disabled && !isAborting && hasActive;
577
+ const canSubmit = !mutationsBlocked && !isSubmitting && !hasUploadingFiles && !hasFailedUploads && (input.trim().length > 0 || pendingFiles.length > 0) && (!hasActive || queueLength < maxQueuedMessages);
578
+ const canAbort = !mutationsBlocked && !isAborting && hasActive;
568
579
  const phase = derivePhase({ isLoadingHistory, isLoadingEarlier, isSubmitting, isStreaming, isAborting, error });
580
+ const isWorking = isSubmitting || isStreaming || isAborting || hasActive;
569
581
  const isTransportActiveCb = useCallback(
570
582
  () => isStreamingRef.current || isSubmittingRef.current || isAbortingRef.current,
571
583
  []
@@ -602,6 +614,10 @@ function useAgentChat({
602
614
  isAborting,
603
615
  canLoadEarlier: Boolean(page?.hasMoreBefore && page.beforeCursor),
604
616
  queueLength,
617
+ mutationsBlocked,
618
+ hideComposer,
619
+ hasActive,
620
+ isWorking,
605
621
  canSubmit,
606
622
  canAbort,
607
623
  loadHistory,
@@ -871,14 +887,16 @@ function useAgentChatSessions({
871
887
  transport,
872
888
  sessionFilter,
873
889
  disabled = false,
890
+ readOnly = false,
874
891
  autoLoad = true,
875
892
  activityPollMs,
876
893
  onError
877
894
  }) {
895
+ const mutationsBlocked = areAgentChatMutationsBlocked(disabled, readOnly);
878
896
  const [sessions, setSessions] = useState([]);
879
897
  const [activeSessionId, setActiveSessionId] = useState(void 0);
880
898
  const [error, setError] = useState(null);
881
- const [isLoading, setIsLoading] = useState(false);
899
+ const [isLoading, setIsLoading] = useState(autoLoad && !disabled);
882
900
  const [isRenaming, setIsRenaming] = useState(false);
883
901
  const sessionFilterRef = useRef(sessionFilter);
884
902
  sessionFilterRef.current = sessionFilter;
@@ -898,6 +916,7 @@ function useAgentChatSessions({
898
916
  if (!transport.listSessions) {
899
917
  const err = new Error("Agent chat transport does not support listing sessions.");
900
918
  handleError(err);
919
+ setIsLoading(false);
901
920
  return void 0;
902
921
  }
903
922
  setIsLoading(true);
@@ -916,7 +935,7 @@ function useAgentChatSessions({
916
935
  }, [agentId, disabled, handleError, transport]);
917
936
  const renameSession = useCallback(
918
937
  async (sessionId, name) => {
919
- if (disabled) return void 0;
938
+ if (mutationsBlocked) return void 0;
920
939
  if (!transport.renameSession) {
921
940
  const err = new Error("Agent chat transport does not support renaming sessions.");
922
941
  handleError(err);
@@ -942,7 +961,7 @@ function useAgentChatSessions({
942
961
  setIsRenaming(false);
943
962
  }
944
963
  },
945
- [agentId, disabled, handleError, transport]
964
+ [agentId, handleError, mutationsBlocked, transport]
946
965
  );
947
966
  useEffect(() => {
948
967
  if (!autoLoad || disabled) return;
@@ -1114,7 +1133,8 @@ function useAutomationRun(options) {
1114
1133
  };
1115
1134
  }
1116
1135
  export {
1117
- useAgentChatSessions as a,
1118
- useAutomationRun as b,
1136
+ areAgentChatMutationsBlocked as a,
1137
+ useAgentChatSessions as b,
1138
+ useAutomationRun as c,
1119
1139
  useAgentChat as u
1120
1140
  };
@@ -1,7 +1,7 @@
1
1
  import { useQueryClient, useQuery, useMutation, useInfiniteQuery } from "@tanstack/react-query";
2
2
  import { useState, useCallback, useEffect, useMemo } from "react";
3
- import { V as listRunsByAgent, C as automationStatuses, H as createAutomationRun, A as uploadFile, o as onInitMessage, v as pbSql, x as pbUpdateRecord } from "./automations-C6SMookl.js";
4
- import { n as normalizeRecordAuditCollections, d as normalizeRecordAuditPageSize, l as listRecordAuditLog, g as getRecordAuditLogSnapshot } from "./audit-log-CBcctM1l.js";
3
+ import { _ as listRunsByAgent, I as automationStatuses, M as createAutomationRun, H as uploadFile, o as onInitMessage, A as pbSql, D as pbUpdateRecord } from "./automations-TTSbZaKC.js";
4
+ import { n as normalizeRecordAuditCollections, d as normalizeRecordAuditPageSize, l as listRecordAuditLog, g as getRecordAuditLogSnapshot } from "./audit-log-BFPtNHQh.js";
5
5
  function useAutomationAgent({
6
6
  agentId,
7
7
  limit = 5,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@lumerahq/ui",
3
- "version": "0.19.3",
3
+ "version": "0.19.5",
4
4
  "type": "module",
5
5
  "sideEffects": [
6
6
  "*.css"
@@ -13,7 +13,7 @@
13
13
  "lint": "biome lint --write .",
14
14
  "check": "biome check --write .",
15
15
  "check:ci": "biome check .",
16
- "test": "rm -rf dist-test && tsc -p tsconfig.test.json && node --test 'dist-test/**/*.test.js'",
16
+ "test": "rm -rf dist-test && tsc -p tsconfig.test.json && node --test 'dist-test/**/*.test.js' && pnpm build:lib && node --test 'test/**/*.test.js'",
17
17
  "preview": "vite preview"
18
18
  },
19
19
  "main": "./dist/index.js",
@@ -65,6 +65,7 @@
65
65
  "@types/react": "^19.2.5",
66
66
  "@types/react-dom": "^19.2.3",
67
67
  "@vitejs/plugin-react": "^5.1.1",
68
+ "jsdom": "^26.1.0",
68
69
  "react": "^19.2.0",
69
70
  "react-dom": "^19.2.0",
70
71
  "shadcn": "^3.6.2",
@@ -1,4 +0,0 @@
1
- import { G } from "./RecordSheet-CZ1jrBhN.js";
2
- export {
3
- G as Mermaid
4
- };