@docyrus/ui-pro-ai-assistant 0.7.3 → 0.7.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.
package/README.md CHANGED
@@ -219,8 +219,9 @@ The main chat interface component.
219
219
  | Prop | Type | Default | Description |
220
220
  |------|------|---------|-------------|
221
221
  | `enableSidebar` | `boolean` | `true` | Show the session list sidebar |
222
- | `enableWelcomePage` | `boolean` | `true` | Show a welcome landing page on first open with agent greeting, inline prompt input, and recent sessions. Sidebar and header are hidden in this view. Dismissed on interaction (new chat, session click, or message send) |
223
- | `defaultFullscreen` | `boolean` | `false` | Start in fullscreen |
222
+ | `enableWelcomePage` | `boolean` | `true` | Show a welcome landing page on first open with agent greeting, inline prompt input, and recent sessions. The header (with agent tabs) stays visible so users can switch agents from the welcome screen; the sidebar is hidden. Dismissed on interaction (new chat, session click, or message send) |
223
+ | `defaultFullscreen` | `boolean` | `false` | Initial uncontrolled fullscreen state |
224
+ | `isFullscreen` | `boolean` | — | Controlled fullscreen state. When provided, the package no longer manages its own fullscreen state — pair with `onFullscreenChange` to fully drive the expand button from the host |
224
225
  | `hideExpand` | `boolean` | `false` | Hide the fullscreen toggle |
225
226
  | `hideCloseButton` | `boolean` | `false` | Hide the close (X) button in the header |
226
227
  | `hideBorder` | `boolean` | `false` | Hide the outer border and shadow of the assistant container |
@@ -249,6 +250,8 @@ The main chat interface component.
249
250
 
250
251
  The header renders a tab strip. The first tab is pinned to `tenantAiAgentId` and cannot be closed. The `+` button next to it opens a dropdown listing the available base agents (from `agentSelectorUrl`); selecting one opens a new closable tab with its own isolated thread and message history. Open tabs are persisted to `localStorage`.
251
252
 
253
+ Switching agents (either selecting an existing tab or adding a new one) resets navigation to the chat home — the previous agent's projects/works pane is dismissed and any selected project / project context is cleared, so the user lands in the new agent's chat view rather than a stale pane.
254
+
252
255
  | Prop | Type | Default | Description |
253
256
  |------|------|---------|-------------|
254
257
  | `agentSelectorUrl` | `string` | `"/ai/agent-deployments/base"` | Endpoint listing base agents shown in the "+" dropdown |
@@ -271,7 +274,7 @@ The header renders a tab strip. The first tab is pinned to `tenantAiAgentId` and
271
274
  | `onMessageSend` | `(message: string) => void` | Fires when a message is sent |
272
275
  | `onVoiceStart` | `() => void` | Fires when voice recording starts |
273
276
  | `onVoiceEnd` | `() => void` | Fires when voice recording ends |
274
- | `onFullscreenChange` | `(isFullscreen: boolean) => void` | Intercepts the expand button. When provided, replaces the package's built-in fullscreen toggle — the host receives the intended next state and decides what to do (toggle, redirect, etc.). When omitted, the package self-toggles its fullscreen state. |
277
+ | `onFullscreenChange` | `(isFullscreen: boolean) => void` | Intercepts the expand button. When provided, replaces the package's built-in fullscreen toggle — the host receives the intended next state and decides what to do (toggle, redirect, etc.). When omitted, the package self-toggles its fullscreen state. Pair with `isFullscreen` for a fully controlled expand/collapse. |
275
278
  | `onShare` | `(info: { dataSourceId: string; recordId: string }) => void` | Custom share handler. When provided, the thread header share button calls this instead of the built-in sharing editor |
276
279
 
277
280
  #### Initial prompt
@@ -1,5 +1,5 @@
1
1
  import { type RefObject } from 'react';
2
2
  import { type DocyAssistantProps } from './types';
3
- export declare const DocyAssistant: ({ ref, isOpen, onClose, supportWebSearch, supportThinking, supportFiles, supportDocumentSearch, supportDeepResearch, supportMultiModels, supportWorkCanvas, apiEndpoint, title: titleProp, description: descriptionProp, placeholder: placeholderProp, logo, footerText: footerTextProp, variant, renderMode, enableSidebar, enableVoice, enableMicrophone, enableWelcomePage, tenantAiAgentId, onMessageSend, onVoiceStart, onVoiceEnd, className, defaultFullscreen, isFullscreen: isFullscreenProp, hideExpand, hideCloseButton, hideBorder, showHeader, hideHeaderOnWelcome, agentSelectorUrl, onAgentChange, onFullscreenChange, enableSharing, onShare: onShareProp, initialPrompt, initialModelId, initialFeatures, initialFiles, hostEnvironment, appId, appName, appIcon, clientTools, ...props }: DocyAssistantProps & {
3
+ export declare const DocyAssistant: ({ ref, isOpen, onClose, supportWebSearch, supportThinking, supportFiles, supportDocumentSearch, supportDeepResearch, supportMultiModels, supportWorkCanvas, apiEndpoint, title: titleProp, description: descriptionProp, placeholder: placeholderProp, logo, footerText: footerTextProp, variant, renderMode, enableSidebar, enableVoice, enableMicrophone, enableWelcomePage, tenantAiAgentId, onMessageSend, onVoiceStart, onVoiceEnd, className, defaultFullscreen, isFullscreen: isFullscreenProp, hideExpand, hideCloseButton, hideBorder, showHeader, agentSelectorUrl, onAgentChange, onFullscreenChange, enableSharing, onShare: onShareProp, initialPrompt, initialModelId, initialFeatures, initialFiles, hostEnvironment, appId, appName, appIcon, clientTools, ...props }: DocyAssistantProps & {
4
4
  ref?: RefObject<HTMLDivElement | null>;
5
5
  }) => import("react/jsx-runtime").JSX.Element;
package/dist/index.js CHANGED
@@ -19651,7 +19651,7 @@ function ChatPanel({
19651
19651
  /* @__PURE__ */ jsx(
19652
19652
  "div",
19653
19653
  {
19654
- className: "flex flex-1 flex-col items-center overflow-y-auto p-6 transition-all duration-250 ease-out",
19654
+ className: "flex flex-1 flex-col items-center overflow-y-auto py-6 px-3 transition-all duration-250 ease-out",
19655
19655
  style: { opacity: fadingOut ? 0 : 1, transform: fadingOut ? "translateY(-8px)" : "translateY(0)" },
19656
19656
  children: /* @__PURE__ */ jsxs("div", { className: "flex w-full max-w-[720px] flex-col", children: [
19657
19657
  /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-3 pb-6", children: isLoadingAgent ? /* @__PURE__ */ jsx("div", { className: "flex flex-1 items-center justify-center", children: /* @__PURE__ */ jsx("div", { className: "p-2 bg-muted rounded-md", children: /* @__PURE__ */ jsx(Spinner, { className: "size-10 text-muted-foreground" }) }) }) : /* @__PURE__ */ jsxs(Fragment, { children: [
@@ -34593,7 +34593,6 @@ var AssistantView = ({ ref, ...props }) => {
34593
34593
  hideCloseButton,
34594
34594
  hideBorder,
34595
34595
  showHeader = true,
34596
- hideHeaderOnWelcome = true,
34597
34596
  t,
34598
34597
  ...commonProps
34599
34598
  } = props;
@@ -34610,7 +34609,7 @@ var AssistantView = ({ ref, ...props }) => {
34610
34609
  "data-render-mode": "inline",
34611
34610
  ref,
34612
34611
  children: [
34613
- showHeader && (!hideHeaderOnWelcome || !(commonProps.showWelcome && commonProps.messages.length === 0)) && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between h-12 px-3 border-b shrink-0 bg-background gap-2", children: [
34612
+ showHeader && /* @__PURE__ */ jsxs("div", { className: "flex items-center justify-between h-12 px-3 border-b shrink-0 bg-background gap-2", children: [
34614
34613
  /* @__PURE__ */ jsx("div", { className: "flex items-center gap-1 min-w-0 flex-1", children: renderHeaderTabs ? renderHeaderTabs({ isFullscreen }) : null }),
34615
34614
  /* @__PURE__ */ jsxs("div", { className: "flex items-center gap-1 shrink-0", children: [
34616
34615
  onExpand && /* @__PURE__ */ jsx(
@@ -36164,7 +36163,6 @@ var DocyAssistant = ({
36164
36163
  hideCloseButton = false,
36165
36164
  hideBorder = false,
36166
36165
  showHeader = true,
36167
- hideHeaderOnWelcome = true,
36168
36166
  agentSelectorUrl = "/ai/agent-deployments/base",
36169
36167
  onAgentChange,
36170
36168
  onFullscreenChange,
@@ -36590,6 +36588,12 @@ var DocyAssistant = ({
36590
36588
  };
36591
36589
  const tabSnapshotsRef = useRef(/* @__PURE__ */ new Map());
36592
36590
  const previousTabIdRef = useRef(activeTabId);
36591
+ const resetNavigationForAgentSwitch = useCallback(() => {
36592
+ uiActions.setActiveTab(0);
36593
+ projectActions.setView("list");
36594
+ projectActions.selectProject(null);
36595
+ projectActions.setContext(null);
36596
+ }, [uiActions, projectActions]);
36593
36597
  const handleTabSelect = useCallback((nextTabId) => {
36594
36598
  if (nextTabId === activeTabId) return;
36595
36599
  tabSnapshotsRef.current.set(activeTabId, {
@@ -36597,7 +36601,8 @@ var DocyAssistant = ({
36597
36601
  messages
36598
36602
  });
36599
36603
  setActiveTabId(nextTabId);
36600
- }, [activeTabId, messages]);
36604
+ resetNavigationForAgentSwitch();
36605
+ }, [activeTabId, messages, resetNavigationForAgentSwitch]);
36601
36606
  const handleAddTab = useCallback((agent) => {
36602
36607
  const existing = tabs.find((t2) => t2.agentId === agent.id && t2.agentType === agent.type);
36603
36608
  if (existing) {
@@ -36618,13 +36623,15 @@ var DocyAssistant = ({
36618
36623
  });
36619
36624
  setTabs((prev) => [...prev, newTab]);
36620
36625
  setActiveTabId(newTab.id);
36626
+ resetNavigationForAgentSwitch();
36621
36627
  onAgentChange?.(agent.id, agent.type);
36622
36628
  }, [
36623
36629
  tabs,
36624
36630
  activeTabId,
36625
36631
  messages,
36626
36632
  handleTabSelect,
36627
- onAgentChange
36633
+ onAgentChange,
36634
+ resetNavigationForAgentSwitch
36628
36635
  ]);
36629
36636
  const pendingForwardRef = useRef(null);
36630
36637
  const handleForwardToAgent = useCallback(({ agentId: targetAgentId, prompt }) => {
@@ -37366,7 +37373,6 @@ var DocyAssistant = ({
37366
37373
  hideCloseButton,
37367
37374
  hideBorder,
37368
37375
  showHeader,
37369
- hideHeaderOnWelcome,
37370
37376
  renderHeaderTabs: ({ isFullscreen: fs }) => /* @__PURE__ */ jsx(
37371
37377
  AgentTabs,
37372
37378
  {