@athenaintel/react 0.9.1 → 0.9.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.
package/dist/index.js CHANGED
@@ -24296,7 +24296,7 @@ function useAthenaThreadListAdapter(config2) {
24296
24296
  );
24297
24297
  return useMemo(() => ({
24298
24298
  async list() {
24299
- if (!auth.token && !auth.apiKey) {
24299
+ if (!auth.token) {
24300
24300
  return { threads: [] };
24301
24301
  }
24302
24302
  try {
@@ -24338,8 +24338,7 @@ function useAthenaThreadListAdapter(config2) {
24338
24338
  };
24339
24339
  },
24340
24340
  unstable_Provider
24341
- // eslint-disable-next-line react-hooks/exhaustive-deps
24342
- }), [auth, unstable_Provider, config2.refreshKey]);
24341
+ }), [auth, unstable_Provider]);
24343
24342
  }
24344
24343
  const ThreadListRefreshContext = createContext(null);
24345
24344
  function useRefreshThreadList() {
@@ -24592,13 +24591,10 @@ function AthenaWithThreadList({
24592
24591
  knowledgeBase,
24593
24592
  systemPrompt
24594
24593
  }) {
24595
- const [refreshKey, setRefreshKey] = useState(0);
24596
- const handleRefresh = useCallback(() => setRefreshKey((k) => k + 1), []);
24597
24594
  const adapter = useAthenaThreadListAdapter({
24598
24595
  backendUrl,
24599
24596
  apiKey,
24600
- token,
24601
- refreshKey
24597
+ token
24602
24598
  });
24603
24599
  const runtimeConfigRef = useRef({
24604
24600
  apiUrl,
@@ -24634,6 +24630,14 @@ function AthenaWithThreadList({
24634
24630
  runtimeHook,
24635
24631
  adapter
24636
24632
  });
24633
+ const handleRefresh = useCallback(() => {
24634
+ var _a2;
24635
+ const core = (_a2 = runtime == null ? void 0 : runtime._core) == null ? void 0 : _a2.threads;
24636
+ if (core) {
24637
+ core._loadThreadsPromise = void 0;
24638
+ core.__internal_load();
24639
+ }
24640
+ }, [runtime]);
24637
24641
  const auiTools = useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
24638
24642
  const aui = useAui({ tools: auiTools });
24639
24643
  const athenaConfig = useMemo(
@@ -60804,40 +60808,40 @@ const createLucideIcon = (iconName, iconNode) => {
60804
60808
  * This source code is licensed under the ISC license.
60805
60809
  * See the LICENSE file in the root directory of this source tree.
60806
60810
  */
60807
- const __iconNode$L = [
60811
+ const __iconNode$M = [
60808
60812
  ["path", { d: "M12 5v14", key: "s699le" }],
60809
60813
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
60810
60814
  ];
60811
- const ArrowDown = createLucideIcon("arrow-down", __iconNode$L);
60815
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$M);
60812
60816
  /**
60813
60817
  * @license lucide-react v0.575.0 - ISC
60814
60818
  *
60815
60819
  * This source code is licensed under the ISC license.
60816
60820
  * See the LICENSE file in the root directory of this source tree.
60817
60821
  */
60818
- const __iconNode$K = [
60822
+ const __iconNode$L = [
60819
60823
  ["path", { d: "M5 12h14", key: "1ays0h" }],
60820
60824
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
60821
60825
  ];
60822
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$K);
60826
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$L);
60823
60827
  /**
60824
60828
  * @license lucide-react v0.575.0 - ISC
60825
60829
  *
60826
60830
  * This source code is licensed under the ISC license.
60827
60831
  * See the LICENSE file in the root directory of this source tree.
60828
60832
  */
60829
- const __iconNode$J = [
60833
+ const __iconNode$K = [
60830
60834
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
60831
60835
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
60832
60836
  ];
60833
- const ArrowUp = createLucideIcon("arrow-up", __iconNode$J);
60837
+ const ArrowUp = createLucideIcon("arrow-up", __iconNode$K);
60834
60838
  /**
60835
60839
  * @license lucide-react v0.575.0 - ISC
60836
60840
  *
60837
60841
  * This source code is licensed under the ISC license.
60838
60842
  * See the LICENSE file in the root directory of this source tree.
60839
60843
  */
60840
- const __iconNode$I = [
60844
+ const __iconNode$J = [
60841
60845
  ["path", { d: "M12 7v14", key: "1akyts" }],
60842
60846
  [
60843
60847
  "path",
@@ -60847,14 +60851,14 @@ const __iconNode$I = [
60847
60851
  }
60848
60852
  ]
60849
60853
  ];
60850
- const BookOpen = createLucideIcon("book-open", __iconNode$I);
60854
+ const BookOpen = createLucideIcon("book-open", __iconNode$J);
60851
60855
  /**
60852
60856
  * @license lucide-react v0.575.0 - ISC
60853
60857
  *
60854
60858
  * This source code is licensed under the ISC license.
60855
60859
  * See the LICENSE file in the root directory of this source tree.
60856
60860
  */
60857
- const __iconNode$H = [
60861
+ const __iconNode$I = [
60858
60862
  ["path", { d: "M12 18V5", key: "adv99a" }],
60859
60863
  ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
60860
60864
  ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
@@ -60864,71 +60868,85 @@ const __iconNode$H = [
60864
60868
  ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
60865
60869
  ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
60866
60870
  ];
60867
- const Brain = createLucideIcon("brain", __iconNode$H);
60871
+ const Brain = createLucideIcon("brain", __iconNode$I);
60868
60872
  /**
60869
60873
  * @license lucide-react v0.575.0 - ISC
60870
60874
  *
60871
60875
  * This source code is licensed under the ISC license.
60872
60876
  * See the LICENSE file in the root directory of this source tree.
60873
60877
  */
60874
- const __iconNode$G = [
60878
+ const __iconNode$H = [
60875
60879
  ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
60876
60880
  ["path", { d: "M18 17V9", key: "2bz60n" }],
60877
60881
  ["path", { d: "M13 17V5", key: "1frdt8" }],
60878
60882
  ["path", { d: "M8 17v-3", key: "17ska0" }]
60879
60883
  ];
60880
- const ChartColumn = createLucideIcon("chart-column", __iconNode$G);
60884
+ const ChartColumn = createLucideIcon("chart-column", __iconNode$H);
60881
60885
  /**
60882
60886
  * @license lucide-react v0.575.0 - ISC
60883
60887
  *
60884
60888
  * This source code is licensed under the ISC license.
60885
60889
  * See the LICENSE file in the root directory of this source tree.
60886
60890
  */
60887
- const __iconNode$F = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
60888
- const Check = createLucideIcon("check", __iconNode$F);
60891
+ const __iconNode$G = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
60892
+ const Check = createLucideIcon("check", __iconNode$G);
60889
60893
  /**
60890
60894
  * @license lucide-react v0.575.0 - ISC
60891
60895
  *
60892
60896
  * This source code is licensed under the ISC license.
60893
60897
  * See the LICENSE file in the root directory of this source tree.
60894
60898
  */
60895
- const __iconNode$E = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
60896
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$E);
60899
+ const __iconNode$F = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
60900
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$F);
60897
60901
  /**
60898
60902
  * @license lucide-react v0.575.0 - ISC
60899
60903
  *
60900
60904
  * This source code is licensed under the ISC license.
60901
60905
  * See the LICENSE file in the root directory of this source tree.
60902
60906
  */
60903
- const __iconNode$D = [
60907
+ const __iconNode$E = [
60904
60908
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60905
60909
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
60906
60910
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
60907
60911
  ];
60908
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$D);
60912
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$E);
60909
60913
  /**
60910
60914
  * @license lucide-react v0.575.0 - ISC
60911
60915
  *
60912
60916
  * This source code is licensed under the ISC license.
60913
60917
  * See the LICENSE file in the root directory of this source tree.
60914
60918
  */
60915
- const __iconNode$C = [
60919
+ const __iconNode$D = [
60916
60920
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60917
60921
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
60918
60922
  ];
60919
- const CircleCheck = createLucideIcon("circle-check", __iconNode$C);
60923
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$D);
60920
60924
  /**
60921
60925
  * @license lucide-react v0.575.0 - ISC
60922
60926
  *
60923
60927
  * This source code is licensed under the ISC license.
60924
60928
  * See the LICENSE file in the root directory of this source tree.
60925
60929
  */
60926
- const __iconNode$B = [
60930
+ const __iconNode$C = [
60927
60931
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60928
60932
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
60929
60933
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
60930
60934
  ];
60931
- const CircleX = createLucideIcon("circle-x", __iconNode$B);
60935
+ const CircleX = createLucideIcon("circle-x", __iconNode$C);
60936
+ /**
60937
+ * @license lucide-react v0.575.0 - ISC
60938
+ *
60939
+ * This source code is licensed under the ISC license.
60940
+ * See the LICENSE file in the root directory of this source tree.
60941
+ */
60942
+ const __iconNode$B = [
60943
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
60944
+ ["path", { d: "M8 4H6a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2v-2", key: "4jdomd" }],
60945
+ ["path", { d: "M16 4h2a2 2 0 0 1 2 2v4", key: "3hqy98" }],
60946
+ ["path", { d: "M21 14H11", key: "1bme5i" }],
60947
+ ["path", { d: "m15 10-4 4 4 4", key: "5dvupr" }]
60948
+ ];
60949
+ const ClipboardCopy = createLucideIcon("clipboard-copy", __iconNode$B);
60932
60950
  /**
60933
60951
  * @license lucide-react v0.575.0 - ISC
60934
60952
  *
@@ -61895,6 +61913,46 @@ function ToolFallbackError({
61895
61913
  /* @__PURE__ */ jsx("p", { className: "mt-0.5 text-xs text-destructive/80", children: errorText })
61896
61914
  ] });
61897
61915
  }
61916
+ function CopyToolSpec({
61917
+ toolName,
61918
+ argsText,
61919
+ result
61920
+ }) {
61921
+ const [copied, setCopied] = useState(false);
61922
+ const handleCopy = useCallback(() => {
61923
+ const spec = { tool_name: toolName };
61924
+ if (argsText) {
61925
+ const parsed = tryParseJson$2(argsText);
61926
+ spec.arguments = parsed ?? argsText;
61927
+ }
61928
+ if (result !== void 0) {
61929
+ if (typeof result === "string") {
61930
+ const parsed = tryParseJson$2(result);
61931
+ spec.result = parsed ?? result;
61932
+ } else {
61933
+ spec.result = result;
61934
+ }
61935
+ }
61936
+ const text2 = JSON.stringify(spec, null, 2);
61937
+ navigator.clipboard.writeText(text2).then(() => {
61938
+ setCopied(true);
61939
+ setTimeout(() => setCopied(false), 2e3);
61940
+ });
61941
+ }, [toolName, argsText, result]);
61942
+ return /* @__PURE__ */ jsxs(
61943
+ "button",
61944
+ {
61945
+ type: "button",
61946
+ onClick: handleCopy,
61947
+ className: "flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/50 transition-colors hover:bg-muted/50 hover:text-muted-foreground",
61948
+ title: "Copy tool name, arguments, and result as JSON",
61949
+ children: [
61950
+ /* @__PURE__ */ jsx(ClipboardCopy, { className: "size-2.5" }),
61951
+ copied ? "Copied" : toolName
61952
+ ]
61953
+ }
61954
+ );
61955
+ }
61898
61956
  function AssetToolCard({
61899
61957
  toolName,
61900
61958
  argsText,
@@ -61986,7 +62044,8 @@ function AssetToolCard({
61986
62044
  (status == null ? void 0 : status.type) === "incomplete" && /* @__PURE__ */ jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsx(ToolFallbackError, { status }) }),
61987
62045
  detailsOpen && !isCancelled && /* @__PURE__ */ jsxs("div", { className: "mt-2.5 flex flex-col gap-2 border-t border-border/50 px-3 pt-2", children: [
61988
62046
  /* @__PURE__ */ jsx(ToolFallbackArgs, { argsText }),
61989
- /* @__PURE__ */ jsx(ToolFallbackResult, { result })
62047
+ /* @__PURE__ */ jsx(ToolFallbackResult, { result }),
62048
+ /* @__PURE__ */ jsx("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsx(CopyToolSpec, { toolName, argsText, result }) })
61990
62049
  ] })
61991
62050
  ] });
61992
62051
  }
@@ -62047,7 +62106,8 @@ const ToolFallbackImpl = ({
62047
62106
  className: cn(isCancelled && "opacity-60")
62048
62107
  }
62049
62108
  ),
62050
- !isCancelled && /* @__PURE__ */ jsx(ToolFallbackResult, { result })
62109
+ !isCancelled && /* @__PURE__ */ jsx(ToolFallbackResult, { result }),
62110
+ !isCancelled && /* @__PURE__ */ jsx("div", { className: "flex justify-end px-3 pt-1", children: /* @__PURE__ */ jsx(CopyToolSpec, { toolName, argsText, result }) })
62051
62111
  ] })
62052
62112
  ]
62053
62113
  }