@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
@@ -1,9 +1,9 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
2
  import * as React from "react";
3
3
  import React__default, { useContext, createContext, forwardRef, createElement, memo, useId as useId$1, useTransition, useMemo, useRef, useEffect, useState, cloneElement, isValidElement, useCallback, Suspense, lazy, Fragment as Fragment$1, useLayoutEffect } from "react";
4
- import { u as useAgentChat, a as useAgentChatSessions, b as useAutomationRun } from "./use-automation-run-_7rjd8L4.js";
4
+ import { u as useAgentChat, b as useAgentChatSessions, a as areAgentChatMutationsBlocked, c as useAutomationRun } from "./use-automation-run-CuJ-xpUg.js";
5
5
  import { t as twMerge, p as clsx, o as cn$2, a as formatCellValue$2 } from "./formatters-D4T821Dv.js";
6
- import { v as pbSql, f as getDownloadUrl, p as parentApiRequest, d as parentApiStream, B as BridgeError, g as getAppProjectExternalId, _ as resolveProjectResourceId, C as automationStatuses, N as getAutomationRunFileDownloadUrl, T as listAutomationRunFiles } from "./automations-C6SMookl.js";
6
+ import { A as pbSql, n as getDownloadUrl, p as parentApiRequest, k as parentApiStream, B as BridgeError, g as getAppProjectExternalId, a3 as resolveProjectResourceId, I as automationStatuses, S as getAutomationRunFileDownloadUrl, Y as listAutomationRunFiles } from "./automations-TTSbZaKC.js";
7
7
  import * as ReactDOM from "react-dom";
8
8
  import { createPortal } from "react-dom";
9
9
  const mergeClasses = (...classes) => classes.filter((className, index2, array) => {
@@ -24010,7 +24010,7 @@ var lr = (e) => {
24010
24010
  for (; t > 0 && e[t - 1] === `
24011
24011
  `; ) t--;
24012
24012
  return e.slice(0, t);
24013
- }, cr = lazy(() => import("./highlighted-body-OFNGDK62-DReGUNtu.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
24013
+ }, cr = lazy(() => import("./highlighted-body-OFNGDK62-BZWB5CNY.js").then((e) => ({ default: e.HighlightedCodeBlockBody }))), st = ({ code: e, language: t, className: o, children: n, isIncomplete: r = false, startLine: s2, lineNumbers: a, ...l }) => {
24014
24014
  let i = y2(), d2 = useMemo(() => lr(e), [e]), c2 = useMemo(() => ({ bg: "transparent", fg: "inherit", tokens: d2.split(`
24015
24015
  `).map((p2) => [{ content: p2, color: "inherit", bgColor: "transparent", htmlStyle: {}, offset: 0 }]) }), [d2]);
24016
24016
  return jsx(nt.Provider, { value: { code: e }, children: jsxs(ot, { isIncomplete: r, language: t, children: [jsx(rt, { language: t }), n ? jsx("div", { className: i("pointer-events-none sticky top-2 z-10 -mt-10 flex h-8 items-center justify-end"), children: jsx("div", { className: i("pointer-events-auto flex shrink-0 items-center gap-2 rounded-md border border-sidebar bg-sidebar/80 px-1.5 py-1 supports-[backdrop-filter]:bg-sidebar/70 supports-[backdrop-filter]:backdrop-blur"), "data-streamdown": "code-block-actions", children: n }) }) : null, jsx(Suspense, { fallback: jsx(At, { className: o, language: t, lineNumbers: a, result: c2, startLine: s2, ...l }), children: jsx(cr, { className: o, code: d2, language: t, lineNumbers: a, raw: c2, startLine: s2, ...l }) })] }) });
@@ -24372,7 +24372,7 @@ var vo = ({ children: e, className: t, showControls: o, showCopy: n = true, show
24372
24372
  let l = y2(), i = o && n, d2 = o && r, c2 = o && s2, p2 = i || d2 || c2;
24373
24373
  return jsxs("div", { className: l("my-4 flex flex-col gap-2 rounded-lg border border-border bg-sidebar p-2"), "data-streamdown": "table-wrapper", children: [p2 ? jsxs("div", { className: l("flex items-center justify-end gap-1"), children: [i ? jsx(Te, {}) : null, d2 ? jsx(Pe, {}) : null, c2 ? jsx(Co, { showCopy: i, showDownload: d2, children: e }) : null] }) : null, jsx("div", { className: l("border-collapse overflow-x-auto overflow-y-auto rounded-md border border-border bg-background"), children: jsx("table", { className: l("w-full divide-y divide-border", t), "data-streamdown": "table", ...a, children: e }) })] });
24374
24374
  };
24375
- var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-BT6HRm2v.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24375
+ var es = /startLine=(\d+)/, ts = /\bnoLineNumbers\b/, os = lazy(() => import("./mermaid-GHXKKRXX-DGRhAYJL.js").then((e) => ({ default: e.Mermaid }))), ns = /language-([^\s]+)/;
24376
24376
  function qe(e, t) {
24377
24377
  if (!(e != null && e.position || t != null && t.position)) return true;
24378
24378
  if (!(e != null && e.position && (t != null && t.position))) return false;
@@ -27541,6 +27541,7 @@ function AgentChat({
27541
27541
  maxBufferedMessages,
27542
27542
  maxQueuedMessages,
27543
27543
  disabled,
27544
+ readOnly,
27544
27545
  watchdog,
27545
27546
  watchdogTimeoutMs,
27546
27547
  watchdogPollMs,
@@ -27564,6 +27565,7 @@ function AgentChat({
27564
27565
  maxBufferedMessages,
27565
27566
  maxQueuedMessages,
27566
27567
  disabled,
27568
+ readOnly,
27567
27569
  watchdog,
27568
27570
  watchdogTimeoutMs,
27569
27571
  watchdogPollMs,
@@ -27606,7 +27608,7 @@ function AgentChat({
27606
27608
  });
27607
27609
  const displayName = name2 ?? agent?.name ?? loadedAgent?.name ?? "Agent chat";
27608
27610
  const displayDescription = description ?? agent?.description ?? loadedAgent?.description;
27609
- const statusText = chat.phase === "streaming" ? "Streaming response…" : chat.phase === "submitting" ? "Submitting…" : chat.canAbort ? "Working…" : "Ready";
27611
+ const statusText = chat.phase === "streaming" ? "Streaming response…" : chat.phase === "submitting" ? "Submitting…" : chat.isWorking ? "Working…" : "Ready";
27610
27612
  const appearance = features?.appearance ?? "card";
27611
27613
  const resizeOptions = useMemo(() => normalizeResizableWidth(features?.resizableWidth), [features?.resizableWidth]);
27612
27614
  const attachmentsEnabled = Boolean(features?.attachments && transport.uploadFile);
@@ -27665,6 +27667,7 @@ function AgentChat({
27665
27667
  description: displayDescription,
27666
27668
  statusText,
27667
27669
  phase: chat.phase,
27670
+ isWorking: chat.isWorking,
27668
27671
  canAbort: chat.canAbort,
27669
27672
  tokenUsage: features?.tokenUsage ? chat.tokenUsage ?? void 0 : void 0
27670
27673
  }
@@ -27739,13 +27742,13 @@ function AgentChat({
27739
27742
  ]
27740
27743
  }
27741
27744
  ),
27742
- /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
27745
+ !chat.hideComposer ? /* @__PURE__ */ jsx("div", { className: "shrink-0", children: /* @__PURE__ */ jsx(
27743
27746
  Composer2,
27744
27747
  {
27745
27748
  state: {
27746
27749
  value: chat.input,
27747
27750
  pendingFiles: chat.pendingFiles,
27748
- disabled: Boolean(disabled),
27751
+ disabled: chat.mutationsBlocked,
27749
27752
  phase: chat.phase,
27750
27753
  queueLength: chat.queueLength,
27751
27754
  canSubmit: chat.canSubmit,
@@ -27762,7 +27765,7 @@ function AgentChat({
27762
27765
  removePendingFile: chat.removePendingFile
27763
27766
  }
27764
27767
  }
27765
- ) })
27768
+ ) }) : null
27766
27769
  ]
27767
27770
  }
27768
27771
  ) });
@@ -27836,8 +27839,8 @@ function AgentChatMessage({
27836
27839
  }
27837
27840
  );
27838
27841
  }
27839
- function DefaultHeader({ name: name2, description, statusText, phase, canAbort, tokenUsage }) {
27840
- const busy = phase === "streaming" || phase === "submitting" || canAbort;
27842
+ function DefaultHeader({ name: name2, description, statusText, isWorking, tokenUsage }) {
27843
+ const busy = isWorking;
27841
27844
  return /* @__PURE__ */ jsxs("div", { className: "flex shrink-0 items-center justify-between gap-3 border-b border-border bg-card px-4 py-3", children: [
27842
27845
  /* @__PURE__ */ jsxs("div", { className: "min-w-0", children: [
27843
27846
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2 text-sm font-semibold", children: [
@@ -29202,7 +29205,7 @@ function EmptyState({
29202
29205
  /* @__PURE__ */ jsx("div", { className: "flex size-12 items-center justify-center rounded-2xl bg-primary text-primary-foreground shadow-sm", children: /* @__PURE__ */ jsx(Sparkles, { className: "size-6" }) }),
29203
29206
  /* @__PURE__ */ jsx("p", { className: "mt-3 text-base font-semibold", children: title }),
29204
29207
  description ? /* @__PURE__ */ jsx("p", { className: "mt-1 max-w-sm text-sm leading-relaxed text-muted-foreground", children: description }) : null,
29205
- suggestions && suggestions.length > 0 ? /* @__PURE__ */ jsx("div", { className: "mt-5 grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2", children: suggestions.map((s2) => /* @__PURE__ */ jsx(
29208
+ suggestions && suggestions.length > 0 && onPick ? /* @__PURE__ */ jsx("div", { className: "mt-5 grid w-full max-w-md grid-cols-1 gap-2 sm:grid-cols-2", children: suggestions.map((s2) => /* @__PURE__ */ jsx(
29206
29209
  "button",
29207
29210
  {
29208
29211
  type: "button",
@@ -29406,6 +29409,7 @@ function AssistantChat({
29406
29409
  watchdog = true,
29407
29410
  discoveryPoll,
29408
29411
  disabled,
29412
+ readOnly,
29409
29413
  className
29410
29414
  }) {
29411
29415
  const syncedTransport = useDataSyncTransport(transport, onDataChange);
@@ -29418,6 +29422,7 @@ function AssistantChat({
29418
29422
  watchdog,
29419
29423
  discoveryPoll,
29420
29424
  disabled,
29425
+ readOnly,
29421
29426
  onTurnComplete: () => {
29422
29427
  onTurnComplete?.();
29423
29428
  onDataChange?.();
@@ -29436,7 +29441,8 @@ function AssistantChat({
29436
29441
  });
29437
29442
  const hasMessages = chat.messages.length > 0;
29438
29443
  const lastTurnId = chat.turns[chat.turns.length - 1]?.id;
29439
- const inFlight = chat.phase === "submitting" || chat.phase === "streaming" || chat.phase === "aborting" || chat.canAbort;
29444
+ const inFlight = chat.isWorking;
29445
+ const emptySuggestions = chat.mutationsBlocked ? void 0 : suggestions;
29440
29446
  return /* @__PURE__ */ jsx(ToolRenderersProvider, { renderers: toolRenderers, children: /* @__PURE__ */ jsxs("div", { className: cn$2("flex min-h-0 flex-col", className), children: [
29441
29447
  showHeader ? /* @__PURE__ */ jsxs("header", { className: "flex shrink-0 items-center gap-2 border-b px-3 py-2.5", children: [
29442
29448
  headerLeft,
@@ -29472,8 +29478,8 @@ function AssistantChat({
29472
29478
  {
29473
29479
  title: emptyTitle,
29474
29480
  description: emptyDescription,
29475
- suggestions,
29476
- onPick: (prompt) => void chat.sendMessage(prompt)
29481
+ suggestions: emptySuggestions,
29482
+ onPick: emptySuggestions ? (prompt) => void chat.sendMessage(prompt) : void 0
29477
29483
  }
29478
29484
  ) : /* @__PURE__ */ jsx("div", { className: "mx-auto w-full max-w-2xl space-y-5", role: "log", "aria-live": "polite", children: chat.turns.map((turn) => {
29479
29485
  const isLastTurn = turn.id === lastTurnId;
@@ -29483,7 +29489,7 @@ function AssistantChat({
29483
29489
  turn.assistants.map((message, index2) => {
29484
29490
  const isLastAssistant = index2 === lastAssistantIndex;
29485
29491
  const streaming = chat.isStreaming && isLastTurn && isLastAssistant;
29486
- const canRegenerate = !chat.isStreaming && isLastTurn && isLastAssistant && Boolean(turn.user?.content);
29492
+ const canRegenerate = !chat.mutationsBlocked && !chat.isStreaming && isLastTurn && isLastAssistant && Boolean(turn.user?.content);
29487
29493
  return /* @__PURE__ */ jsx(
29488
29494
  AssistantMessageView,
29489
29495
  {
@@ -29494,7 +29500,7 @@ function AssistantChat({
29494
29500
  message.id
29495
29501
  );
29496
29502
  }),
29497
- isLastTurn && turn.assistants.length === 0 && inFlight ? /* @__PURE__ */ jsx(PendingAssistantMessage, {}) : null
29503
+ isLastTurn && inFlight && (chat.hideComposer || turn.assistants.length === 0) ? /* @__PURE__ */ jsx(PendingAssistantMessage, {}) : null
29498
29504
  ] }, turn.id);
29499
29505
  }) }),
29500
29506
  chat.error ? /* @__PURE__ */ jsxs("div", { className: "mx-auto mt-4 flex w-full max-w-2xl items-center justify-between gap-3 rounded-lg border border-destructive/30 bg-destructive/10 px-3 py-2 text-sm text-destructive", children: [
@@ -29512,14 +29518,14 @@ function AssistantChat({
29512
29518
  ]
29513
29519
  }
29514
29520
  ),
29515
- /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
29521
+ !chat.hideComposer ? /* @__PURE__ */ jsxs("div", { className: "relative shrink-0", children: [
29516
29522
  /* @__PURE__ */ jsx("div", { className: "pointer-events-none absolute inset-x-0 -top-6 h-6 bg-gradient-to-t from-background to-transparent" }),
29517
29523
  /* @__PURE__ */ jsx(
29518
29524
  Composer,
29519
29525
  {
29520
29526
  value: chat.input,
29521
29527
  placeholder,
29522
- disabled,
29528
+ disabled: chat.mutationsBlocked,
29523
29529
  inFlight,
29524
29530
  canSubmit: chat.canSubmit,
29525
29531
  canAbort: chat.canAbort,
@@ -29536,7 +29542,7 @@ function AssistantChat({
29536
29542
  onRemoveFile: chat.removePendingFile
29537
29543
  }
29538
29544
  )
29539
- ] })
29545
+ ] }) : null
29540
29546
  ] }) });
29541
29547
  }
29542
29548
  function newSessionId(prefix) {
@@ -29557,18 +29563,28 @@ function AssistantPage({
29557
29563
  enableAttachments,
29558
29564
  historyLimit,
29559
29565
  discoveryPoll,
29566
+ disabled,
29567
+ readOnly,
29560
29568
  sessionFilter,
29561
29569
  newChatPrefix = "app-chat",
29562
29570
  className
29563
29571
  }) {
29564
- const sessions = useAgentChatSessions({ agentId, transport, sessionFilter, autoLoad: true });
29572
+ const mutationsBlocked = areAgentChatMutationsBlocked(disabled, readOnly);
29573
+ const sessions = useAgentChatSessions({ agentId, transport, sessionFilter, autoLoad: true, disabled, readOnly });
29565
29574
  const [activeSessionId, setActiveSessionId] = useState(void 0);
29566
29575
  const [railOpen, setRailOpen] = useState(true);
29567
29576
  useEffect(() => {
29568
29577
  if (activeSessionId || sessions.isLoading) return;
29569
- setActiveSessionId(sessions.activeSessionId ?? newSessionId(newChatPrefix));
29570
- }, [activeSessionId, sessions.isLoading, sessions.activeSessionId, newChatPrefix]);
29571
- const handleNew = () => setActiveSessionId(newSessionId(newChatPrefix));
29578
+ if (sessions.activeSessionId) {
29579
+ setActiveSessionId(sessions.activeSessionId);
29580
+ } else if (!mutationsBlocked) {
29581
+ setActiveSessionId(newSessionId(newChatPrefix));
29582
+ }
29583
+ }, [activeSessionId, mutationsBlocked, sessions.isLoading, sessions.activeSessionId, newChatPrefix]);
29584
+ const noSessionAvailable = mutationsBlocked && !sessions.isLoading && !activeSessionId && sessions.sessions.length === 0;
29585
+ const chatDisabled = Boolean(disabled || !activeSessionId);
29586
+ const handleNew = mutationsBlocked ? void 0 : () => setActiveSessionId(newSessionId(newChatPrefix));
29587
+ const handleRename = mutationsBlocked ? void 0 : (id, name2) => void sessions.renameSession(id, name2);
29572
29588
  return /* @__PURE__ */ jsxs("div", { className: cn$2("flex min-h-0 overflow-hidden bg-card", className), children: [
29573
29589
  railOpen ? /* @__PURE__ */ jsx(
29574
29590
  SessionRail,
@@ -29578,7 +29594,7 @@ function AssistantPage({
29578
29594
  isLoading: sessions.isLoading,
29579
29595
  onSelect: setActiveSessionId,
29580
29596
  onNew: handleNew,
29581
- onRename: (id, name2) => sessions.renameSession(id, name2)
29597
+ onRename: handleRename
29582
29598
  }
29583
29599
  ) : null,
29584
29600
  /* @__PURE__ */ jsx(
@@ -29593,13 +29609,15 @@ function AssistantPage({
29593
29609
  scopes,
29594
29610
  suggestions,
29595
29611
  placeholder,
29596
- emptyTitle,
29597
- emptyDescription,
29612
+ emptyTitle: noSessionAvailable ? "No conversations yet" : emptyTitle,
29613
+ emptyDescription: noSessionAvailable ? "There are no existing conversations to review." : emptyDescription,
29598
29614
  toolRenderers,
29599
29615
  onDataChange,
29600
29616
  enableAttachments,
29601
29617
  historyLimit,
29602
29618
  discoveryPoll,
29619
+ disabled: chatDisabled,
29620
+ readOnly,
29603
29621
  onTurnComplete: () => void sessions.loadSessions(),
29604
29622
  headerLeft: /* @__PURE__ */ jsx(
29605
29623
  "button",
@@ -29633,7 +29651,7 @@ function SessionRail({
29633
29651
  const commitRename = (id) => {
29634
29652
  const name2 = renameValue.trim();
29635
29653
  setRenamingId(null);
29636
- if (name2) void onRename(id, name2);
29654
+ if (name2) void onRename?.(id, name2);
29637
29655
  };
29638
29656
  return /* @__PURE__ */ jsxs("aside", { className: "flex w-60 shrink-0 flex-col border-r bg-card", children: [
29639
29657
  /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between gap-2 px-3 py-2.5", children: [
@@ -29641,7 +29659,7 @@ function SessionRail({
29641
29659
  /* @__PURE__ */ jsx(MessagesSquare, { className: "size-3.5" }),
29642
29660
  " Chats"
29643
29661
  ] }),
29644
- /* @__PURE__ */ jsxs(
29662
+ onNew ? /* @__PURE__ */ jsxs(
29645
29663
  "button",
29646
29664
  {
29647
29665
  type: "button",
@@ -29652,7 +29670,7 @@ function SessionRail({
29652
29670
  " New"
29653
29671
  ]
29654
29672
  }
29655
- )
29673
+ ) : null
29656
29674
  ] }),
29657
29675
  /* @__PURE__ */ jsx("div", { className: "min-h-0 flex-1 overflow-y-auto px-2 pb-2", children: isLoading && sessions.length === 0 ? /* @__PURE__ */ jsxs("div", { className: "space-y-1.5 p-1", children: [
29658
29676
  /* @__PURE__ */ jsx("div", { className: "h-12 animate-pulse rounded-lg bg-muted" }),
@@ -29685,7 +29703,7 @@ function SessionRail({
29685
29703
  {
29686
29704
  type: "button",
29687
29705
  onClick: () => onSelect(session.id),
29688
- onDoubleClick: () => startRename(session.id, title),
29706
+ onDoubleClick: onRename ? () => startRename(session.id, title) : void 0,
29689
29707
  className: cn$2(
29690
29708
  "group flex w-full flex-col items-start gap-0.5 rounded-lg px-2.5 py-2 text-left transition",
29691
29709
  isActive ? "bg-primary/10 text-primary" : "hover:bg-accent"
@@ -29693,7 +29711,7 @@ function SessionRail({
29693
29711
  children: [
29694
29712
  /* @__PURE__ */ jsxs("span", { className: "flex w-full items-center gap-1", children: [
29695
29713
  /* @__PURE__ */ jsx("span", { className: "line-clamp-1 flex-1 text-sm font-medium", children: title }),
29696
- /* @__PURE__ */ jsx(
29714
+ onRename ? /* @__PURE__ */ jsx(
29697
29715
  Pencil,
29698
29716
  {
29699
29717
  className: "size-3 shrink-0 text-muted-foreground opacity-0 transition group-hover:opacity-100",
@@ -29702,7 +29720,7 @@ function SessionRail({
29702
29720
  startRename(session.id, title);
29703
29721
  }
29704
29722
  }
29705
- )
29723
+ ) : null
29706
29724
  ] }),
29707
29725
  /* @__PURE__ */ jsx("span", { className: "text-[11px] text-muted-foreground", children: formatRelative(session.lastUsedAt ?? session.createdAt) })
29708
29726
  ]
@@ -29771,6 +29789,8 @@ function AssistantWidget({
29771
29789
  toolRenderers,
29772
29790
  onDataChange,
29773
29791
  historyLimit,
29792
+ disabled,
29793
+ readOnly,
29774
29794
  loading,
29775
29795
  error: error2,
29776
29796
  defaultOpen = false
@@ -29823,7 +29843,9 @@ function AssistantWidget({
29823
29843
  emptyDescription,
29824
29844
  toolRenderers,
29825
29845
  onDataChange,
29826
- historyLimit
29846
+ historyLimit,
29847
+ disabled,
29848
+ readOnly
29827
29849
  }
29828
29850
  ) })
29829
29851
  ] }) : null
@@ -1,4 +1,4 @@
1
- import { Z as requestApi } from "./automations-C6SMookl.js";
1
+ import { a2 as requestApi } from "./automations-TTSbZaKC.js";
2
2
  const RECORD_AUDIT_EXPORT_LIMIT = 1e4;
3
3
  const RECORD_AUDIT_MAX_COLLECTIONS = 20;
4
4
  const normalizeRecordAuditPageSize = (value = 50) => Math.min(200, Math.max(1, Math.trunc(value) || 50));
@@ -81,6 +81,17 @@ let hasStoredHostPayload = false;
81
81
  function getAppProjectExternalId() {
82
82
  return storedHostPayload?.app?.projectExternalId;
83
83
  }
84
+ function getViewerContext() {
85
+ return storedHostPayload?.viewer;
86
+ }
87
+ const isOrganizationMember = (viewer) => viewer?.belongsToOrganization === true && viewer.organizationMembership != null;
88
+ const isCompanyAdmin = (viewer) => isOrganizationMember(viewer) && viewer.organizationMembership.isCompanyAdmin;
89
+ const isDepartment = (viewer, departmentKey) => isOrganizationMember(viewer) && viewer.organizationMembership.department?.key.trim().toLowerCase() === departmentKey.trim().toLowerCase();
90
+ const hasMemberTag = (viewer, tagKey) => {
91
+ if (!isOrganizationMember(viewer)) return false;
92
+ const normalized = tagKey.trim().toLowerCase();
93
+ return viewer.organizationMembership.tags.some((tag) => tag.key.trim().toLowerCase() === normalized);
94
+ };
84
95
  const normalizeHash = (hash) => {
85
96
  if (!hash) return "";
86
97
  return hash.startsWith("#") ? hash : `#${hash}`;
@@ -521,6 +532,76 @@ const directHostApiStream = (request2, handlers) => {
521
532
  };
522
533
  };
523
534
  let directModeInitFired = false;
535
+ const normalizeViewerSubject = (value) => {
536
+ if (value === "org_member") return "org_member";
537
+ if (value === "app_user" || value === "public_app_user") return "public_app_user";
538
+ return "anonymous";
539
+ };
540
+ const viewerContextFromMe = (me) => {
541
+ const response = me.viewer;
542
+ const subjectType = normalizeViewerSubject(response?.subject_type ?? me.subject_type);
543
+ const user = me.user ?? null;
544
+ if (response) {
545
+ const membership = response.organization_membership;
546
+ const appUser = response.app_user;
547
+ return {
548
+ version: 1,
549
+ isSignedIn: response.is_signed_in === true,
550
+ subjectType,
551
+ belongsToOrganization: response.belongs_to_organization === true,
552
+ identity: response.identity ? {
553
+ id: response.identity.id ?? "",
554
+ name: response.identity.name ?? "",
555
+ email: response.identity.email ?? ""
556
+ } : null,
557
+ organizationMembership: membership ? {
558
+ id: membership.id ?? "",
559
+ role: membership.role ?? "",
560
+ isCompanyAdmin: membership.is_company_admin === true,
561
+ department: membership.department ?? null,
562
+ tags: membership.tags ?? []
563
+ } : null,
564
+ appUser: appUser ? { id: appUser.id ?? "", role: appUser.role ?? "" } : null
565
+ };
566
+ }
567
+ if (subjectType === "org_member" && user) {
568
+ return {
569
+ version: 1,
570
+ isSignedIn: true,
571
+ subjectType,
572
+ belongsToOrganization: true,
573
+ identity: { id: user.id, name: user.name, email: user.email },
574
+ organizationMembership: {
575
+ id: user.id,
576
+ role: user.role ?? "",
577
+ isCompanyAdmin: user.role?.toLowerCase() === "admin",
578
+ department: null,
579
+ tags: []
580
+ },
581
+ appUser: null
582
+ };
583
+ }
584
+ if (subjectType === "public_app_user" && user) {
585
+ return {
586
+ version: 1,
587
+ isSignedIn: true,
588
+ subjectType,
589
+ belongsToOrganization: false,
590
+ identity: { id: user.id, name: user.name, email: user.email },
591
+ organizationMembership: null,
592
+ appUser: { id: user.id, role: user.role ?? "" }
593
+ };
594
+ }
595
+ return {
596
+ version: 1,
597
+ isSignedIn: false,
598
+ subjectType: "anonymous",
599
+ belongsToOrganization: false,
600
+ identity: null,
601
+ organizationMembership: null,
602
+ appUser: null
603
+ };
604
+ };
524
605
  const fireDirectModeInit = () => {
525
606
  if (directModeInitFired || !isDirectMode()) return;
526
607
  directModeInitFired = true;
@@ -528,7 +609,7 @@ const fireDirectModeInit = () => {
528
609
  let payload;
529
610
  try {
530
611
  const response = await fetch("/api/me", { credentials: "same-origin" });
531
- if (response.ok || response.status === 401) {
612
+ if (response.ok) {
532
613
  let me;
533
614
  try {
534
615
  me = await response.json();
@@ -543,7 +624,8 @@ const fireDirectModeInit = () => {
543
624
  projectExternalId: me.project_external_id,
544
625
  accessLevel: me.access_level
545
626
  },
546
- subjectType: me.subject_type
627
+ subjectType: me.subject_type,
628
+ viewer: viewerContextFromMe(me)
547
629
  };
548
630
  }
549
631
  }
@@ -568,15 +650,48 @@ const logout = async () => {
568
650
  const fireDevModeInit = () => {
569
651
  if (devModeInitFired || !isStandaloneDevMode()) return;
570
652
  devModeInitFired = true;
653
+ const role = viteEnv.VITE_DEV_USER_ROLE ?? "admin";
654
+ const departmentKey = viteEnv.VITE_DEV_USER_DEPARTMENT ?? "finance";
655
+ const tagKeys = parseParentOrigins(viteEnv.VITE_DEV_USER_TAGS ?? "approver");
656
+ const identity = {
657
+ id: viteEnv.VITE_DEV_USER_ID ?? "__dev_user__",
658
+ name: viteEnv.VITE_DEV_USER_NAME ?? "Dev User",
659
+ email: viteEnv.VITE_DEV_USER_EMAIL ?? "dev@localhost"
660
+ };
571
661
  const mockPayload = {
572
662
  company: {
573
663
  id: viteEnv.VITE_DEV_COMPANY_ID ?? "__dev_company__",
574
664
  name: viteEnv.VITE_DEV_COMPANY_NAME ?? "Dev Company"
575
665
  },
576
666
  user: {
577
- id: viteEnv.VITE_DEV_USER_ID ?? "__dev_user__",
578
- name: viteEnv.VITE_DEV_USER_NAME ?? "Dev User",
579
- email: viteEnv.VITE_DEV_USER_EMAIL ?? "dev@localhost"
667
+ ...identity,
668
+ role
669
+ },
670
+ subjectType: "org_member",
671
+ viewer: {
672
+ version: 1,
673
+ isSignedIn: true,
674
+ subjectType: "org_member",
675
+ belongsToOrganization: true,
676
+ identity,
677
+ organizationMembership: {
678
+ id: identity.id,
679
+ role,
680
+ isCompanyAdmin: role.toLowerCase() === "admin",
681
+ department: departmentKey ? {
682
+ id: `__dev_department_${departmentKey}__`,
683
+ key: departmentKey,
684
+ label: departmentKey,
685
+ color: "#10b981"
686
+ } : null,
687
+ tags: tagKeys.map((key) => ({
688
+ id: `__dev_tag_${key}__`,
689
+ key,
690
+ label: key,
691
+ color: "#3b82f6"
692
+ }))
693
+ },
694
+ appUser: null
580
695
  },
581
696
  session: {
582
697
  token: viteEnv.VITE_DEV_AUTH_TOKEN
@@ -1454,57 +1569,62 @@ async function listRunsByExternalId(params) {
1454
1569
  });
1455
1570
  }
1456
1571
  export {
1457
- uploadFile as A,
1572
+ listRunsByExternalId as $,
1573
+ pbSql as A,
1458
1574
  BridgeError as B,
1459
- automationStatuses as C,
1460
- cancelAutomationRun as D,
1575
+ pbUpdate as C,
1576
+ pbUpdateRecord as D,
1461
1577
  EXPECTED_PARENT_ORIGIN as E,
1462
- cancelRun as F,
1463
- clearAutomationCache as G,
1464
- createAutomationRun as H,
1465
- createRun as I,
1466
- ensureAutomationRun as J,
1467
- ensureRun as K,
1468
- getAutomationByExternalId as L,
1469
- getAutomationRun as M,
1470
- getAutomationRunFileDownloadUrl as N,
1471
- getRun as O,
1472
- getRunFiles as P,
1473
- getRunFileUrl as Q,
1474
- isActiveStatus as R,
1475
- isTerminalStatus as S,
1476
- listAutomationRunFiles as T,
1477
- listRuns as U,
1478
- listRunsByAgent as V,
1479
- listRunsByExternalId as W,
1480
- pollAutomationRun as X,
1481
- pollRun as Y,
1482
- requestApi as Z,
1483
- resolveProjectResourceId as _,
1578
+ pbUpsert as F,
1579
+ sendEmail as G,
1580
+ uploadFile as H,
1581
+ automationStatuses as I,
1582
+ cancelAutomationRun as J,
1583
+ cancelRun as K,
1584
+ clearAutomationCache as L,
1585
+ createAutomationRun as M,
1586
+ createRun as N,
1587
+ ensureAutomationRun as O,
1588
+ ensureRun as P,
1589
+ getAutomationByExternalId as Q,
1590
+ getAutomationRun as R,
1591
+ getAutomationRunFileDownloadUrl as S,
1592
+ getRun as T,
1593
+ getRunFiles as U,
1594
+ getRunFileUrl as V,
1595
+ isActiveStatus as W,
1596
+ isTerminalStatus as X,
1597
+ listAutomationRunFiles as Y,
1598
+ listRuns as Z,
1599
+ listRunsByAgent as _,
1484
1600
  getShareableAppUrl as a,
1601
+ pollAutomationRun as a0,
1602
+ pollRun as a1,
1603
+ requestApi as a2,
1604
+ resolveProjectResourceId as a3,
1485
1605
  buildShareableAppUrl as b,
1486
1606
  configureBridge as c,
1487
- parentApiStream as d,
1488
- postReadyMessage as e,
1489
- getDownloadUrl as f,
1607
+ getViewerContext as d,
1608
+ isDepartment as e,
1609
+ isEmbedded as f,
1490
1610
  getAppProjectExternalId as g,
1491
- getUploadUrl as h,
1492
- isEmbedded as i,
1493
- pbBulkDelete as j,
1494
- pbBulkUpdate as k,
1611
+ hasMemberTag as h,
1612
+ isCompanyAdmin as i,
1613
+ isOrganizationMember as j,
1614
+ parentApiStream as k,
1495
1615
  logout as l,
1496
- pbCreate as m,
1497
- pbDelete as n,
1616
+ postReadyMessage as m,
1617
+ getDownloadUrl as n,
1498
1618
  onInitMessage as o,
1499
1619
  parentApiRequest as p,
1500
- pbGet as q,
1620
+ getUploadUrl as q,
1501
1621
  redirectToLogin as r,
1502
1622
  serializeBridgeRuntimeConfig as s,
1503
- pbList as t,
1504
- pbSearch as u,
1505
- pbSql as v,
1506
- pbUpdate as w,
1507
- pbUpdateRecord as x,
1508
- pbUpsert as y,
1509
- sendEmail as z
1623
+ pbBulkDelete as t,
1624
+ pbBulkUpdate as u,
1625
+ pbCreate as v,
1626
+ pbDelete as w,
1627
+ pbGet as x,
1628
+ pbList as y,
1629
+ pbSearch as z
1510
1630
  };
@@ -1,3 +1,3 @@
1
1
  import { AgentChatMetadata, AgentChatProps } from './types';
2
- export declare function AgentChat<TMeta extends AgentChatMetadata = AgentChatMetadata, TToolInput = unknown, TActionData = unknown>({ agentId, sessionId, agent, name, description, transport, initialMessages, initialPage, historyLimit, maxBufferedMessages, maxQueuedMessages, disabled, watchdog, watchdogTimeoutMs, watchdogPollMs, discoveryPoll, className, labels: labelOverrides, features, renderers, onMessagesChange, onTurnComplete, onError, children, }: AgentChatProps<TMeta, TToolInput, TActionData>): import("react/jsx-runtime").JSX.Element;
2
+ export declare function AgentChat<TMeta extends AgentChatMetadata = AgentChatMetadata, TToolInput = unknown, TActionData = unknown>({ agentId, sessionId, agent, name, description, transport, initialMessages, initialPage, historyLimit, maxBufferedMessages, maxQueuedMessages, disabled, readOnly, watchdog, watchdogTimeoutMs, watchdogPollMs, discoveryPoll, className, labels: labelOverrides, features, renderers, onMessagesChange, onTurnComplete, onError, children, }: AgentChatProps<TMeta, TToolInput, TActionData>): import("react/jsx-runtime").JSX.Element;
3
3
  //# sourceMappingURL=AgentChat.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"AgentChat.d.ts","sourceRoot":"","sources":["../../../src/components/agent-chat/AgentChat.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EASV,iBAAiB,EAEjB,cAAc,EAGf,MAAM,SAAS,CAAC;AAajB,wBAAgB,SAAS,CACvB,KAAK,SAAS,iBAAiB,GAAG,iBAAiB,EACnD,UAAU,GAAG,OAAO,EACpB,WAAW,GAAG,OAAO,EACrB,EACA,OAAO,EACP,SAAS,EACT,KAAK,EACL,IAAI,EACJ,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC,2CAqQhD"}
1
+ {"version":3,"file":"AgentChat.d.ts","sourceRoot":"","sources":["../../../src/components/agent-chat/AgentChat.tsx"],"names":[],"mappings":"AA+BA,OAAO,KAAK,EASV,iBAAiB,EAEjB,cAAc,EAGf,MAAM,SAAS,CAAC;AAajB,wBAAgB,SAAS,CACvB,KAAK,SAAS,iBAAiB,GAAG,iBAAiB,EACnD,UAAU,GAAG,OAAO,EACpB,WAAW,GAAG,OAAO,EACrB,EACA,OAAO,EACP,SAAS,EACT,KAAK,EACL,IAAI,EACJ,WAAW,EACX,SAAS,EACT,eAAe,EACf,WAAW,EACX,YAAY,EACZ,mBAAmB,EACnB,iBAAiB,EACjB,QAAQ,EACR,QAAQ,EACR,QAAQ,EACR,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,SAAS,EACT,MAAM,EAAE,cAAc,EACtB,QAAQ,EACR,SAAS,EACT,gBAAgB,EAChB,cAAc,EACd,OAAO,EACP,QAAQ,GACT,EAAE,cAAc,CAAC,KAAK,EAAE,UAAU,EAAE,WAAW,CAAC,2CAsQhD"}
@@ -362,12 +362,9 @@ export interface AgentChatHeaderRendererProps {
362
362
  /** Human status line derived from the live run ("Ready", "Working…", "Streaming response…"). */
363
363
  statusText: string;
364
364
  phase: AgentChatPhase;
365
- /**
366
- * A run is active and abortable. This is the working signal during the long
367
- * stretches of an agent turn where `phase` alone reads idle (tool
368
- * executions, watchdog-recovered streams) — derive busy state from
369
- * `phase !== 'idle' || canAbort`, never from `phase` alone.
370
- */
365
+ /** A composite activity signal independent of mutation permissions. */
366
+ isWorking: boolean;
367
+ /** Whether the current caller may abort the active run. */
371
368
  canAbort: boolean;
372
369
  tokenUsage?: AgentChatTokenUsage;
373
370
  }
@@ -467,7 +464,10 @@ export interface AgentChatProps<TMeta extends AgentChatMetadata = AgentChatMetad
467
464
  historyLimit?: number;
468
465
  maxBufferedMessages?: number;
469
466
  maxQueuedMessages?: number;
467
+ /** Disable the entire chat runtime, including history network activity. */
470
468
  disabled?: boolean;
469
+ /** Load and refresh the transcript, but hide the composer and reject mutations. */
470
+ readOnly?: boolean;
471
471
  /**
472
472
  * Re-poll `/history` to recover when a live stream drops without a terminal
473
473
  * event. Opt-in; default `false`. See {@link UseAgentChatOptions.watchdog}.