@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.cjs CHANGED
@@ -24314,7 +24314,7 @@ function useAthenaThreadListAdapter(config2) {
24314
24314
  );
24315
24315
  return React.useMemo(() => ({
24316
24316
  async list() {
24317
- if (!auth.token && !auth.apiKey) {
24317
+ if (!auth.token) {
24318
24318
  return { threads: [] };
24319
24319
  }
24320
24320
  try {
@@ -24356,8 +24356,7 @@ function useAthenaThreadListAdapter(config2) {
24356
24356
  };
24357
24357
  },
24358
24358
  unstable_Provider
24359
- // eslint-disable-next-line react-hooks/exhaustive-deps
24360
- }), [auth, unstable_Provider, config2.refreshKey]);
24359
+ }), [auth, unstable_Provider]);
24361
24360
  }
24362
24361
  const ThreadListRefreshContext = React.createContext(null);
24363
24362
  function useRefreshThreadList() {
@@ -24610,13 +24609,10 @@ function AthenaWithThreadList({
24610
24609
  knowledgeBase,
24611
24610
  systemPrompt
24612
24611
  }) {
24613
- const [refreshKey, setRefreshKey] = React.useState(0);
24614
- const handleRefresh = React.useCallback(() => setRefreshKey((k) => k + 1), []);
24615
24612
  const adapter = useAthenaThreadListAdapter({
24616
24613
  backendUrl,
24617
24614
  apiKey,
24618
- token,
24619
- refreshKey
24615
+ token
24620
24616
  });
24621
24617
  const runtimeConfigRef = React.useRef({
24622
24618
  apiUrl,
@@ -24652,6 +24648,14 @@ function AthenaWithThreadList({
24652
24648
  runtimeHook,
24653
24649
  adapter
24654
24650
  });
24651
+ const handleRefresh = React.useCallback(() => {
24652
+ var _a2;
24653
+ const core = (_a2 = runtime == null ? void 0 : runtime._core) == null ? void 0 : _a2.threads;
24654
+ if (core) {
24655
+ core._loadThreadsPromise = void 0;
24656
+ core.__internal_load();
24657
+ }
24658
+ }, [runtime]);
24655
24659
  const auiTools = React.useMemo(() => Tools({ toolkit: frontendTools }), [frontendTools]);
24656
24660
  const aui = useAui({ tools: auiTools });
24657
24661
  const athenaConfig = React.useMemo(
@@ -60822,40 +60826,40 @@ const createLucideIcon = (iconName, iconNode) => {
60822
60826
  * This source code is licensed under the ISC license.
60823
60827
  * See the LICENSE file in the root directory of this source tree.
60824
60828
  */
60825
- const __iconNode$L = [
60829
+ const __iconNode$M = [
60826
60830
  ["path", { d: "M12 5v14", key: "s699le" }],
60827
60831
  ["path", { d: "m19 12-7 7-7-7", key: "1idqje" }]
60828
60832
  ];
60829
- const ArrowDown = createLucideIcon("arrow-down", __iconNode$L);
60833
+ const ArrowDown = createLucideIcon("arrow-down", __iconNode$M);
60830
60834
  /**
60831
60835
  * @license lucide-react v0.575.0 - ISC
60832
60836
  *
60833
60837
  * This source code is licensed under the ISC license.
60834
60838
  * See the LICENSE file in the root directory of this source tree.
60835
60839
  */
60836
- const __iconNode$K = [
60840
+ const __iconNode$L = [
60837
60841
  ["path", { d: "M5 12h14", key: "1ays0h" }],
60838
60842
  ["path", { d: "m12 5 7 7-7 7", key: "xquz4c" }]
60839
60843
  ];
60840
- const ArrowRight = createLucideIcon("arrow-right", __iconNode$K);
60844
+ const ArrowRight = createLucideIcon("arrow-right", __iconNode$L);
60841
60845
  /**
60842
60846
  * @license lucide-react v0.575.0 - ISC
60843
60847
  *
60844
60848
  * This source code is licensed under the ISC license.
60845
60849
  * See the LICENSE file in the root directory of this source tree.
60846
60850
  */
60847
- const __iconNode$J = [
60851
+ const __iconNode$K = [
60848
60852
  ["path", { d: "m5 12 7-7 7 7", key: "hav0vg" }],
60849
60853
  ["path", { d: "M12 19V5", key: "x0mq9r" }]
60850
60854
  ];
60851
- const ArrowUp = createLucideIcon("arrow-up", __iconNode$J);
60855
+ const ArrowUp = createLucideIcon("arrow-up", __iconNode$K);
60852
60856
  /**
60853
60857
  * @license lucide-react v0.575.0 - ISC
60854
60858
  *
60855
60859
  * This source code is licensed under the ISC license.
60856
60860
  * See the LICENSE file in the root directory of this source tree.
60857
60861
  */
60858
- const __iconNode$I = [
60862
+ const __iconNode$J = [
60859
60863
  ["path", { d: "M12 7v14", key: "1akyts" }],
60860
60864
  [
60861
60865
  "path",
@@ -60865,14 +60869,14 @@ const __iconNode$I = [
60865
60869
  }
60866
60870
  ]
60867
60871
  ];
60868
- const BookOpen = createLucideIcon("book-open", __iconNode$I);
60872
+ const BookOpen = createLucideIcon("book-open", __iconNode$J);
60869
60873
  /**
60870
60874
  * @license lucide-react v0.575.0 - ISC
60871
60875
  *
60872
60876
  * This source code is licensed under the ISC license.
60873
60877
  * See the LICENSE file in the root directory of this source tree.
60874
60878
  */
60875
- const __iconNode$H = [
60879
+ const __iconNode$I = [
60876
60880
  ["path", { d: "M12 18V5", key: "adv99a" }],
60877
60881
  ["path", { d: "M15 13a4.17 4.17 0 0 1-3-4 4.17 4.17 0 0 1-3 4", key: "1e3is1" }],
60878
60882
  ["path", { d: "M17.598 6.5A3 3 0 1 0 12 5a3 3 0 1 0-5.598 1.5", key: "1gqd8o" }],
@@ -60882,71 +60886,85 @@ const __iconNode$H = [
60882
60886
  ["path", { d: "M6 18a4 4 0 0 1-2-7.464", key: "k1g0md" }],
60883
60887
  ["path", { d: "M6.003 5.125a4 4 0 0 0-2.526 5.77", key: "q97ue3" }]
60884
60888
  ];
60885
- const Brain = createLucideIcon("brain", __iconNode$H);
60889
+ const Brain = createLucideIcon("brain", __iconNode$I);
60886
60890
  /**
60887
60891
  * @license lucide-react v0.575.0 - ISC
60888
60892
  *
60889
60893
  * This source code is licensed under the ISC license.
60890
60894
  * See the LICENSE file in the root directory of this source tree.
60891
60895
  */
60892
- const __iconNode$G = [
60896
+ const __iconNode$H = [
60893
60897
  ["path", { d: "M3 3v16a2 2 0 0 0 2 2h16", key: "c24i48" }],
60894
60898
  ["path", { d: "M18 17V9", key: "2bz60n" }],
60895
60899
  ["path", { d: "M13 17V5", key: "1frdt8" }],
60896
60900
  ["path", { d: "M8 17v-3", key: "17ska0" }]
60897
60901
  ];
60898
- const ChartColumn = createLucideIcon("chart-column", __iconNode$G);
60902
+ const ChartColumn = createLucideIcon("chart-column", __iconNode$H);
60899
60903
  /**
60900
60904
  * @license lucide-react v0.575.0 - ISC
60901
60905
  *
60902
60906
  * This source code is licensed under the ISC license.
60903
60907
  * See the LICENSE file in the root directory of this source tree.
60904
60908
  */
60905
- const __iconNode$F = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
60906
- const Check = createLucideIcon("check", __iconNode$F);
60909
+ const __iconNode$G = [["path", { d: "M20 6 9 17l-5-5", key: "1gmf2c" }]];
60910
+ const Check = createLucideIcon("check", __iconNode$G);
60907
60911
  /**
60908
60912
  * @license lucide-react v0.575.0 - ISC
60909
60913
  *
60910
60914
  * This source code is licensed under the ISC license.
60911
60915
  * See the LICENSE file in the root directory of this source tree.
60912
60916
  */
60913
- const __iconNode$E = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
60914
- const ChevronDown = createLucideIcon("chevron-down", __iconNode$E);
60917
+ const __iconNode$F = [["path", { d: "m6 9 6 6 6-6", key: "qrunsl" }]];
60918
+ const ChevronDown = createLucideIcon("chevron-down", __iconNode$F);
60915
60919
  /**
60916
60920
  * @license lucide-react v0.575.0 - ISC
60917
60921
  *
60918
60922
  * This source code is licensed under the ISC license.
60919
60923
  * See the LICENSE file in the root directory of this source tree.
60920
60924
  */
60921
- const __iconNode$D = [
60925
+ const __iconNode$E = [
60922
60926
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60923
60927
  ["line", { x1: "12", x2: "12", y1: "8", y2: "12", key: "1pkeuh" }],
60924
60928
  ["line", { x1: "12", x2: "12.01", y1: "16", y2: "16", key: "4dfq90" }]
60925
60929
  ];
60926
- const CircleAlert = createLucideIcon("circle-alert", __iconNode$D);
60930
+ const CircleAlert = createLucideIcon("circle-alert", __iconNode$E);
60927
60931
  /**
60928
60932
  * @license lucide-react v0.575.0 - ISC
60929
60933
  *
60930
60934
  * This source code is licensed under the ISC license.
60931
60935
  * See the LICENSE file in the root directory of this source tree.
60932
60936
  */
60933
- const __iconNode$C = [
60937
+ const __iconNode$D = [
60934
60938
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60935
60939
  ["path", { d: "m9 12 2 2 4-4", key: "dzmm74" }]
60936
60940
  ];
60937
- const CircleCheck = createLucideIcon("circle-check", __iconNode$C);
60941
+ const CircleCheck = createLucideIcon("circle-check", __iconNode$D);
60938
60942
  /**
60939
60943
  * @license lucide-react v0.575.0 - ISC
60940
60944
  *
60941
60945
  * This source code is licensed under the ISC license.
60942
60946
  * See the LICENSE file in the root directory of this source tree.
60943
60947
  */
60944
- const __iconNode$B = [
60948
+ const __iconNode$C = [
60945
60949
  ["circle", { cx: "12", cy: "12", r: "10", key: "1mglay" }],
60946
60950
  ["path", { d: "m15 9-6 6", key: "1uzhvr" }],
60947
60951
  ["path", { d: "m9 9 6 6", key: "z0biqf" }]
60948
60952
  ];
60949
- const CircleX = createLucideIcon("circle-x", __iconNode$B);
60953
+ const CircleX = createLucideIcon("circle-x", __iconNode$C);
60954
+ /**
60955
+ * @license lucide-react v0.575.0 - ISC
60956
+ *
60957
+ * This source code is licensed under the ISC license.
60958
+ * See the LICENSE file in the root directory of this source tree.
60959
+ */
60960
+ const __iconNode$B = [
60961
+ ["rect", { width: "8", height: "4", x: "8", y: "2", rx: "1", ry: "1", key: "tgr4d6" }],
60962
+ ["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" }],
60963
+ ["path", { d: "M16 4h2a2 2 0 0 1 2 2v4", key: "3hqy98" }],
60964
+ ["path", { d: "M21 14H11", key: "1bme5i" }],
60965
+ ["path", { d: "m15 10-4 4 4 4", key: "5dvupr" }]
60966
+ ];
60967
+ const ClipboardCopy = createLucideIcon("clipboard-copy", __iconNode$B);
60950
60968
  /**
60951
60969
  * @license lucide-react v0.575.0 - ISC
60952
60970
  *
@@ -61913,6 +61931,46 @@ function ToolFallbackError({
61913
61931
  /* @__PURE__ */ jsxRuntime.jsx("p", { className: "mt-0.5 text-xs text-destructive/80", children: errorText })
61914
61932
  ] });
61915
61933
  }
61934
+ function CopyToolSpec({
61935
+ toolName,
61936
+ argsText,
61937
+ result
61938
+ }) {
61939
+ const [copied, setCopied] = React.useState(false);
61940
+ const handleCopy = React.useCallback(() => {
61941
+ const spec = { tool_name: toolName };
61942
+ if (argsText) {
61943
+ const parsed = tryParseJson$2(argsText);
61944
+ spec.arguments = parsed ?? argsText;
61945
+ }
61946
+ if (result !== void 0) {
61947
+ if (typeof result === "string") {
61948
+ const parsed = tryParseJson$2(result);
61949
+ spec.result = parsed ?? result;
61950
+ } else {
61951
+ spec.result = result;
61952
+ }
61953
+ }
61954
+ const text2 = JSON.stringify(spec, null, 2);
61955
+ navigator.clipboard.writeText(text2).then(() => {
61956
+ setCopied(true);
61957
+ setTimeout(() => setCopied(false), 2e3);
61958
+ });
61959
+ }, [toolName, argsText, result]);
61960
+ return /* @__PURE__ */ jsxRuntime.jsxs(
61961
+ "button",
61962
+ {
61963
+ type: "button",
61964
+ onClick: handleCopy,
61965
+ 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",
61966
+ title: "Copy tool name, arguments, and result as JSON",
61967
+ children: [
61968
+ /* @__PURE__ */ jsxRuntime.jsx(ClipboardCopy, { className: "size-2.5" }),
61969
+ copied ? "Copied" : toolName
61970
+ ]
61971
+ }
61972
+ );
61973
+ }
61916
61974
  function AssetToolCard({
61917
61975
  toolName,
61918
61976
  argsText,
@@ -62004,7 +62062,8 @@ function AssetToolCard({
62004
62062
  (status == null ? void 0 : status.type) === "incomplete" && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "px-3 pt-2", children: /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackError, { status }) }),
62005
62063
  detailsOpen && !isCancelled && /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "mt-2.5 flex flex-col gap-2 border-t border-border/50 px-3 pt-2", children: [
62006
62064
  /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackArgs, { argsText }),
62007
- /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result })
62065
+ /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result }),
62066
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(CopyToolSpec, { toolName, argsText, result }) })
62008
62067
  ] })
62009
62068
  ] });
62010
62069
  }
@@ -62065,7 +62124,8 @@ const ToolFallbackImpl = ({
62065
62124
  className: cn(isCancelled && "opacity-60")
62066
62125
  }
62067
62126
  ),
62068
- !isCancelled && /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result })
62127
+ !isCancelled && /* @__PURE__ */ jsxRuntime.jsx(ToolFallbackResult, { result }),
62128
+ !isCancelled && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-end px-3 pt-1", children: /* @__PURE__ */ jsxRuntime.jsx(CopyToolSpec, { toolName, argsText, result }) })
62069
62129
  ] })
62070
62130
  ]
62071
62131
  }