@athenaintel/react 0.16.2 → 0.16.3

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.
@@ -38,6 +38,13 @@ export interface AssetPanelState {
38
38
  slideNumber?: number;
39
39
  /** Citation target (anchor + excerpt) the open should navigate to. */
40
40
  reference?: AthenaAssetCitationReference;
41
+ /**
42
+ * Swap the active tab for this asset instead of appending another tab.
43
+ * Citation clicks use this: reading references shouldn't accumulate a
44
+ * tab per cited document — the panel behaves as one preview surface.
45
+ * A tab that already exists for the asset is re-targeted either way.
46
+ */
47
+ replaceActiveTab?: boolean;
41
48
  }) => void;
42
49
  closeTab: (assetId: string) => void;
43
50
  setActiveTab: (assetId: string) => void;
@@ -29,6 +29,10 @@ export declare function resolveAssetEmbedUrl({ embedUrl, appUrl, backendUrl, cur
29
29
  backendUrl?: string | null;
30
30
  currentOrigin?: string | null;
31
31
  }): string;
32
+ export declare function appendCitationReferenceParams({ params, reference, }: {
33
+ params: URLSearchParams;
34
+ reference?: AthenaAssetCitationReference;
35
+ }): void;
32
36
  export declare function buildSdkAssetEmbedUrl(embedUrl: string, reference?: AthenaAssetCitationReference): string;
33
37
  export declare function getAssetEmbedAuthContext({ token, apiKey }: {
34
38
  token?: string | null;
@@ -15,6 +15,14 @@ export interface AthenaChatProps {
15
15
  welcomeSubtext?: string;
16
16
  /** Maximum width for the thread content. Defaults to "44rem". */
17
17
  maxWidth?: string;
18
+ /**
19
+ * Scroll anchoring for new turns. "bottom" (default) keeps the viewport
20
+ * pinned to the end while the assistant streams — classic chat follow.
21
+ * "top" pins the just-sent user message to the top of the viewport and
22
+ * intentionally does NOT follow the streaming response (assistant-ui
23
+ * disables autoScroll in that mode), so readers scroll at their own pace.
24
+ */
25
+ turnAnchor?: "top" | "bottom";
18
26
  /** Additional tool UIs to register by name. */
19
27
  toolUIs?: Record<string, ToolCallMessagePartComponent>;
20
28
  /** Mention tools available in the composer. */
package/dist/chat-ui.cjs CHANGED
@@ -3,7 +3,7 @@ var __defProp = Object.defineProperty;
3
3
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
4
4
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
5
5
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
6
- const useRestConversationHistory = require("./use-rest-conversation-history-CbMCaMzR.cjs");
6
+ const useRestConversationHistory = require("./use-rest-conversation-history-CMuTZmsp.cjs");
7
7
  const jsxRuntime = require("react/jsx-runtime");
8
8
  const React = require("react");
9
9
  const react = require("@assistant-ui/react");
package/dist/chat-ui.js CHANGED
@@ -1,8 +1,8 @@
1
1
  var __defProp = Object.defineProperty;
2
2
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
3
3
  var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
4
- import { au as createLucideIcon, O as cn, bJ as THREAD_HEADER_ACTIONS_CLASS, bK as THREAD_HEADER_PILL_CLASS, bL as THREAD_HEADER_CLASS, b4 as RefreshCw, bm as Plus, b9 as Search, be as LoaderCircle, bx as conversationDisplayTitle, b7 as Archive, bM as assetTypeToThumb, aA as MessageSquare, ak as Node, a2 as mergeAttributes, aq as Extension, aW as Suggestion, aU as useFloating, aV as FloatingPortal, N as autoUpdate, F as offset, I as flip, G as shift, aS as getFilteredItems, bN as getFetchState, bO as getEntry, bP as updateFetchState, a_ as addItems, aZ as registerSource, bQ as bindScopes, aR as useStore, aH as FileText, aw as Workflow, aK as BookOpen, bc as Sheet, ba as Table, aI as Database, aJ as Calendar, aB as Mail, bb as Image, az as Monitor, b8 as Code, bd as Camera, aC as LayoutGrid, aD as HardDrive, ay as Package, av as Wrench, ax as Users, aE as Globe, aF as FolderKanban, aG as Folder, bl as File$1, aY as Store, bR as getSearchScope, bS as fetchGraphQL, bT as PAGINATED_ASSETS_QUERY, bU as WORKSPACE_MEMBERS_QUERY, bV as SIMPLE_SEARCH_QUERY, bW as assetTypeToIcon, bX as useMentionAuth, b0 as createScopeRegistry, a$ as createItemCache, aO as useEditor, aQ as StarterKit, b3 as Placeholder, aP as EditorContent } from "./use-rest-conversation-history-FoEmnZcH.js";
5
- import { bY, bZ, b_, b$, c0, bh, bg, c1, bi, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn as cn2, co } from "./use-rest-conversation-history-FoEmnZcH.js";
4
+ import { au as createLucideIcon, O as cn, bJ as THREAD_HEADER_ACTIONS_CLASS, bK as THREAD_HEADER_PILL_CLASS, bL as THREAD_HEADER_CLASS, b4 as RefreshCw, bm as Plus, b9 as Search, be as LoaderCircle, bx as conversationDisplayTitle, b7 as Archive, bM as assetTypeToThumb, aA as MessageSquare, ak as Node, a2 as mergeAttributes, aq as Extension, aW as Suggestion, aU as useFloating, aV as FloatingPortal, N as autoUpdate, F as offset, I as flip, G as shift, aS as getFilteredItems, bN as getFetchState, bO as getEntry, bP as updateFetchState, a_ as addItems, aZ as registerSource, bQ as bindScopes, aR as useStore, aH as FileText, aw as Workflow, aK as BookOpen, bc as Sheet, ba as Table, aI as Database, aJ as Calendar, aB as Mail, bb as Image, az as Monitor, b8 as Code, bd as Camera, aC as LayoutGrid, aD as HardDrive, ay as Package, av as Wrench, ax as Users, aE as Globe, aF as FolderKanban, aG as Folder, bl as File$1, aY as Store, bR as getSearchScope, bS as fetchGraphQL, bT as PAGINATED_ASSETS_QUERY, bU as WORKSPACE_MEMBERS_QUERY, bV as SIMPLE_SEARCH_QUERY, bW as assetTypeToIcon, bX as useMentionAuth, b0 as createScopeRegistry, a$ as createItemCache, aO as useEditor, aQ as StarterKit, b3 as Placeholder, aP as EditorContent } from "./use-rest-conversation-history-BgG4VyZQ.js";
5
+ import { bY, bZ, b_, b$, c0, bh, bg, c1, bi, c2, c3, c4, c5, c6, c7, c8, c9, ca, cb, cc, cd, ce, cf, cg, ch, ci, cj, ck, cl, cm, cn as cn2, co } from "./use-rest-conversation-history-BgG4VyZQ.js";
6
6
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
7
7
  import { useMemo, useEffect, useState, useRef, Fragment, useImperativeHandle, forwardRef, useCallback, useId } from "react";
8
8
  import { useAui, unstable_useComposerInput } from "@assistant-ui/react";
package/dist/index.cjs CHANGED
@@ -19,7 +19,7 @@ var __privateWrapper = (obj, member, setter, getter) => ({
19
19
  });
20
20
  var _mutations, _scopes, _mutationId, _a2, _queries, _b, _queryCache, _mutationCache, _defaultOptions, _queryDefaults, _mutationDefaults, _mountCount, _unsubscribeFocus, _unsubscribeOnline, _c;
21
21
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
22
- const useRestConversationHistory = require("./use-rest-conversation-history-CbMCaMzR.cjs");
22
+ const useRestConversationHistory = require("./use-rest-conversation-history-CMuTZmsp.cjs");
23
23
  const React = require("react");
24
24
  const jsxRuntime = require("react/jsx-runtime");
25
25
  const react = require("@assistant-ui/react");
@@ -6214,7 +6214,7 @@ const convertLangChainToThreadMessages = (messages, isRunning = false, metadata
6214
6214
  return convertExternalMessages(filteredMessages, convertLangChainMessage, isRunning, metadata);
6215
6215
  };
6216
6216
  const __vite_import_meta_env__ = { "DEV": false };
6217
- const DEFAULT_MODEL = "claude-opus-4-6-thinking-max-fast";
6217
+ const DEFAULT_MODEL = "claude-opus-4-8-thinking-max-fast";
6218
6218
  const DEFAULT_AGENT = "athena_assist_agent";
6219
6219
  const getIsDev = () => {
6220
6220
  const importMetaEnv = __vite_import_meta_env__;
@@ -11052,6 +11052,14 @@ const useAssetPanelStore = create()(
11052
11052
  slideNumber: meta == null ? void 0 : meta.slideNumber,
11053
11053
  reference: meta == null ? void 0 : meta.reference
11054
11054
  };
11055
+ if ((meta == null ? void 0 : meta.replaceActiveTab) && s.activeTabId) {
11056
+ const activeIndex = s.tabs.findIndex((t) => t.id === s.activeTabId);
11057
+ if (activeIndex >= 0) {
11058
+ const tabs = s.tabs.slice();
11059
+ tabs[activeIndex] = newTab;
11060
+ return { isOpen: true, tabs, activeTabId: assetId };
11061
+ }
11062
+ }
11055
11063
  return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
11056
11064
  }),
11057
11065
  closeTab: (assetId) => set2((s) => {
@@ -24674,7 +24682,11 @@ const useAthenaLinkClickHandler = () => {
24674
24682
  type: citationLink.assetType ?? void 0,
24675
24683
  // Carry the citation target so the panel's iframe navigates to
24676
24684
  // the cited range/page instead of opening at the top.
24677
- reference: citationLink.reference
24685
+ reference: citationLink.reference,
24686
+ // Reading references is one preview surface: a citation to a
24687
+ // different asset swaps the active tab rather than stacking a
24688
+ // tab per cited document.
24689
+ replaceActiveTab: true
24678
24690
  });
24679
24691
  } : void 0;
24680
24692
  const context = {
@@ -31966,6 +31978,7 @@ const AthenaChat = ({
31966
31978
  welcomeMessage = "Hello there!",
31967
31979
  welcomeSubtext = "What can I help you with?",
31968
31980
  maxWidth = "44rem",
31981
+ turnAnchor = "bottom",
31969
31982
  toolUIs,
31970
31983
  mentionTools,
31971
31984
  welcomeSuggestions = DEFAULT_SUGGESTIONS,
@@ -32031,7 +32044,7 @@ const AthenaChat = ({
32031
32044
  className
32032
32045
  ),
32033
32046
  maxWidth,
32034
- turnAnchor: "top",
32047
+ turnAnchor,
32035
32048
  viewportClassName: "aui-thread-viewport relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth px-4 pt-4",
32036
32049
  contentClassName: "flex w-full flex-1 flex-col",
32037
32050
  viewportOverlay: /* @__PURE__ */ jsxRuntime.jsx(ThreadScrollToTop, {}),
@@ -33049,17 +33062,21 @@ const AssetIframe = React.memo(
33049
33062
  };
33050
33063
  }
33051
33064
  const initialSlideNumber = initialSlideRef.current.slideNumber;
33052
- const iframeSrc = React.useMemo(
33053
- () => embedUrl ? buildSdkAssetEmbedUrl(
33054
- buildAssetIframeSrc({
33055
- embedUrl,
33056
- assetType: tab.type,
33057
- slideNumber: initialSlideNumber
33058
- }),
33059
- tab.reference
33060
- ) : null,
33061
- [embedUrl, initialSlideNumber, tab.type, tab.reference]
33062
- );
33065
+ const iframeSrc = React.useMemo(() => {
33066
+ if (!embedUrl) return null;
33067
+ const base2 = buildAssetIframeSrc({
33068
+ embedUrl,
33069
+ assetType: tab.type,
33070
+ slideNumber: initialSlideNumber
33071
+ });
33072
+ try {
33073
+ const url = new URL(base2, window.location.href);
33074
+ appendCitationReferenceParams({ params: url.searchParams, reference: tab.reference });
33075
+ return url.toString();
33076
+ } catch {
33077
+ return base2;
33078
+ }
33079
+ }, [embedUrl, initialSlideNumber, tab.type, tab.reference]);
33063
33080
  const navigationMessage = React.useMemo(
33064
33081
  () => buildPresentationNavigationMessage({
33065
33082
  assetId: tab.id,