@athenaintel/react 0.16.0 → 0.16.2

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.
@@ -1,3 +1,4 @@
1
+ import type { AthenaAssetCitationReference } from './asset-embed-messages';
1
2
  export type AssetType = 'presentation' | 'spreadsheet' | 'document' | 'notebook' | 'unknown';
2
3
  export type ViewMode = 'tabs' | 'tiled';
3
4
  export interface AssetTab {
@@ -5,6 +6,8 @@ export interface AssetTab {
5
6
  name: string | null;
6
7
  type: AssetType;
7
8
  slideNumber?: number;
9
+ /** The citation target (anchor + excerpt) the tab was last opened at. */
10
+ reference?: AthenaAssetCitationReference;
8
11
  }
9
12
  interface ThreadAssetState {
10
13
  tabs: AssetTab[];
@@ -33,6 +36,8 @@ export interface AssetPanelState {
33
36
  name?: string;
34
37
  type?: AssetType;
35
38
  slideNumber?: number;
39
+ /** Citation target (anchor + excerpt) the open should navigate to. */
40
+ reference?: AthenaAssetCitationReference;
36
41
  }) => void;
37
42
  closeTab: (assetId: string) => void;
38
43
  setActiveTab: (assetId: string) => void;
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-DqpE-QGK.cjs");
6
+ const useRestConversationHistory = require("./use-rest-conversation-history-CbMCaMzR.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-BZ9Pl9kF.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-BZ9Pl9kF.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-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";
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";
@@ -27,7 +27,7 @@ export type AthenaDiagnosticLevel = (typeof ATHENA_DIAGNOSTIC_LEVELS)[number];
27
27
  * are part of the public contract: renaming one is a breaking change for
28
28
  * dashboards, so add new ones instead of repurposing.
29
29
  */
30
- export type AthenaDiagnosticEventName = 'sdk.init' | 'sdk.transport' | 'sdk.config.warning' | 'auth.bridge.start' | 'auth.bridge.ready' | 'auth.bridge.timeout' | 'auth.bridge.absent' | 'auth.bridge.error' | 'auth.token.acquired' | 'auth.token.refreshed' | 'auth.token.refresh_failed' | 'auth.token.stale' | 'auth.sso.userinfo.start' | 'auth.sso.userinfo.done' | 'auth.sso.userinfo.error' | 'threads.list.start' | 'threads.list.done' | 'threads.list.error' | 'threads.history.start' | 'threads.history.done' | 'threads.history.error' | 'statewire.attach.start' | 'statewire.snapshot' | 'statewire.connection' | 'statewire.parked' | 'statewire.error' | 'statewire.read_only' | 'run.send' | 'run.first_token' | 'run.done' | 'run.error' | 'stream.connected' | 'stream.error' | 'sdk.error';
30
+ export type AthenaDiagnosticEventName = 'sdk.init' | 'sdk.transport' | 'sdk.config.warning' | 'auth.bridge.start' | 'auth.bridge.ready' | 'auth.bridge.timeout' | 'auth.bridge.absent' | 'auth.bridge.error' | 'auth.token.acquired' | 'auth.token.refreshed' | 'auth.token.refresh_failed' | 'auth.token.stale' | 'auth.sso.userinfo.start' | 'auth.sso.userinfo.done' | 'auth.sso.userinfo.error' | 'threads.list.start' | 'threads.list.done' | 'threads.list.error' | 'threads.list.aborted' | 'threads.history.start' | 'threads.history.done' | 'threads.history.error' | 'threads.history.aborted' | 'statewire.attach.start' | 'statewire.snapshot' | 'statewire.connection' | 'statewire.parked' | 'statewire.error' | 'statewire.read_only' | 'run.send' | 'run.first_token' | 'run.done' | 'run.error' | 'stream.connected' | 'stream.error' | 'sdk.error';
31
31
  export interface AthenaDiagnosticEvent {
32
32
  /** Monotonic sequence number within this page. */
33
33
  seq: number;
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-DqpE-QGK.cjs");
22
+ const useRestConversationHistory = require("./use-rest-conversation-history-CbMCaMzR.cjs");
23
23
  const React = require("react");
24
24
  const jsxRuntime = require("react/jsx-runtime");
25
25
  const react = require("@assistant-ui/react");
@@ -7992,6 +7992,7 @@ function useDeepAgentThread({
7992
7992
  const lastLegacyRunActiveRef = React.useRef(null);
7993
7993
  const lastProtocolRef = React.useRef(null);
7994
7994
  const appliedStateRunConfigThreadRef = React.useRef(null);
7995
+ const absentStateRunConfigAttachRef = React.useRef(null);
7995
7996
  const notifiedLegacyReadOnlyThreadRef = React.useRef(null);
7996
7997
  const lastLegacyObservedThreadRef = React.useRef(null);
7997
7998
  const threadIdRef = React.useRef(threadId);
@@ -8017,6 +8018,12 @@ function useDeepAgentThread({
8017
8018
  if (notifyRunConfig) {
8018
8019
  queueMicrotask(() => notifyRunConfig(stateRunConfig));
8019
8020
  }
8021
+ } else if (!stateRunConfig && appliedStateRunConfigThreadRef.current !== attachIdRef.current && absentStateRunConfigAttachRef.current !== attachIdRef.current && projectDeepAgentProtocol(state) !== null) {
8022
+ absentStateRunConfigAttachRef.current = attachIdRef.current;
8023
+ const notifyRunConfig = onServerRunConfigRef.current;
8024
+ if (notifyRunConfig) {
8025
+ queueMicrotask(() => notifyRunConfig(null));
8026
+ }
8020
8027
  }
8021
8028
  const stateLegacyReadOnly = state == null ? void 0 : state.legacyReadOnly;
8022
8029
  if (lastLegacyObservedThreadRef.current !== attachIdRef.current) {
@@ -11030,7 +11037,10 @@ const useAssetPanelStore = create()(
11030
11037
  ...t,
11031
11038
  name: meta.name ?? t.name,
11032
11039
  type: meta.type ?? t.type,
11033
- slideNumber: "slideNumber" in meta ? meta.slideNumber : t.slideNumber
11040
+ slideNumber: "slideNumber" in meta ? meta.slideNumber : t.slideNumber,
11041
+ // A repeat citation click re-targets the open tab: the new
11042
+ // reference reaches the iframe (src change -> navigation).
11043
+ reference: "reference" in meta ? meta.reference : t.reference
11034
11044
  } : t
11035
11045
  ) : s.tabs;
11036
11046
  return { isOpen: true, tabs, activeTabId: assetId };
@@ -11039,7 +11049,8 @@ const useAssetPanelStore = create()(
11039
11049
  id: assetId,
11040
11050
  name: (meta == null ? void 0 : meta.name) ?? null,
11041
11051
  type: (meta == null ? void 0 : meta.type) ?? "unknown",
11042
- slideNumber: meta == null ? void 0 : meta.slideNumber
11052
+ slideNumber: meta == null ? void 0 : meta.slideNumber,
11053
+ reference: meta == null ? void 0 : meta.reference
11043
11054
  };
11044
11055
  return { isOpen: true, tabs: [...s.tabs, newTab], activeTabId: assetId };
11045
11056
  }),
@@ -24660,7 +24671,10 @@ const useAthenaLinkClickHandler = () => {
24660
24671
  const openInAssetPanel = citationLink ? () => {
24661
24672
  openAsset(citationLink.assetId, {
24662
24673
  name: trimmedLinkText ?? void 0,
24663
- type: citationLink.assetType ?? void 0
24674
+ type: citationLink.assetType ?? void 0,
24675
+ // Carry the citation target so the panel's iframe navigates to
24676
+ // the cited range/page instead of opening at the top.
24677
+ reference: citationLink.reference
24664
24678
  });
24665
24679
  } : void 0;
24666
24680
  const context = {
@@ -33036,12 +33050,15 @@ const AssetIframe = React.memo(
33036
33050
  }
33037
33051
  const initialSlideNumber = initialSlideRef.current.slideNumber;
33038
33052
  const iframeSrc = React.useMemo(
33039
- () => embedUrl ? buildAssetIframeSrc({
33040
- embedUrl,
33041
- assetType: tab.type,
33042
- slideNumber: initialSlideNumber
33043
- }) : null,
33044
- [embedUrl, initialSlideNumber, tab.type]
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]
33045
33062
  );
33046
33063
  const navigationMessage = React.useMemo(
33047
33064
  () => buildPresentationNavigationMessage({