@athenaintel/react 0.9.1 → 0.9.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.
package/dist/index.d.ts CHANGED
@@ -632,7 +632,7 @@ export declare const TOOL_UI_REGISTRY: Record<string, ToolCallMessagePartCompone
632
632
 
633
633
  export { ToolCallMessagePartComponent }
634
634
 
635
- export declare function ToolCard({ icon: Icon, status, title, subtitle, toolName, badge, error, children, }: {
635
+ export declare function ToolCard({ icon: Icon, status, title, subtitle, toolName, badge, error, children, args, result, }: {
636
636
  icon: React.ElementType;
637
637
  status: ToolStatus;
638
638
  title: string;
@@ -641,6 +641,8 @@ export declare function ToolCard({ icon: Icon, status, title, subtitle, toolName
641
641
  badge?: string;
642
642
  error?: string | null;
643
643
  children?: React.ReactNode;
644
+ args?: Record<string, unknown>;
645
+ result?: unknown;
644
646
  }): JSX.Element;
645
647
 
646
648
  export declare const ToolFallback: ToolCallMessagePartComponent & {
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
  }
@@ -62407,7 +62467,9 @@ function ToolCard({
62407
62467
  toolName,
62408
62468
  badge,
62409
62469
  error: error2,
62410
- children
62470
+ children,
62471
+ args,
62472
+ result
62411
62473
  }) {
62412
62474
  const isRunning = status === "running";
62413
62475
  const isComplete = status === "complete";
@@ -62441,9 +62503,46 @@ function ToolCard({
62441
62503
  ] })
62442
62504
  ] }),
62443
62505
  error2 && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 bg-destructive/10 px-4 py-2.5", children: /* @__PURE__ */ jsx("p", { className: "text-[12px] leading-relaxed text-destructive", children: error2 }) }),
62444
- children
62506
+ children,
62507
+ toolName && isComplete && /* @__PURE__ */ jsx(CopyToolSpecButton, { toolName, args, result })
62445
62508
  ] });
62446
62509
  }
62510
+ function CopyToolSpecButton({
62511
+ toolName,
62512
+ args,
62513
+ result
62514
+ }) {
62515
+ const [copied, setCopied] = useState(false);
62516
+ const handleCopy = useCallback(() => {
62517
+ const spec = { tool_name: toolName };
62518
+ if (args) spec.arguments = args;
62519
+ if (result !== void 0) {
62520
+ if (typeof result === "string") {
62521
+ const parsed = tryParseJson(result);
62522
+ spec.result = parsed ?? result;
62523
+ } else {
62524
+ spec.result = result;
62525
+ }
62526
+ }
62527
+ navigator.clipboard.writeText(JSON.stringify(spec, null, 2)).then(() => {
62528
+ setCopied(true);
62529
+ setTimeout(() => setCopied(false), 2e3);
62530
+ });
62531
+ }, [toolName, args, result]);
62532
+ return /* @__PURE__ */ jsx("div", { className: "flex justify-end px-3 pb-1.5", children: /* @__PURE__ */ jsxs(
62533
+ "button",
62534
+ {
62535
+ type: "button",
62536
+ onClick: handleCopy,
62537
+ className: "flex items-center gap-1 rounded px-1.5 py-0.5 text-[10px] text-muted-foreground/40 transition-colors hover:bg-muted/50 hover:text-muted-foreground",
62538
+ title: "Copy tool name, arguments, and result as JSON",
62539
+ children: [
62540
+ /* @__PURE__ */ jsx(ClipboardCopy, { className: "size-2.5" }),
62541
+ copied ? "Copied!" : toolName
62542
+ ]
62543
+ }
62544
+ ) });
62545
+ }
62447
62546
  function ExpandableSection({
62448
62547
  label,
62449
62548
  children,
@@ -62507,6 +62606,8 @@ const WebSearchToolUIImpl = ({
62507
62606
  title: isRunning ? "Searching the web..." : "Web search",
62508
62607
  subtitle: query ? truncate(query, 80) : void 0,
62509
62608
  toolName,
62609
+ args: typedArgs,
62610
+ result,
62510
62611
  badge: isComplete && results.length > 0 ? `${results.length} results` : void 0,
62511
62612
  error: errorMsg,
62512
62613
  children: isComplete && results.length > 0 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show search results", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col gap-2.5", children: results.map((r2, i) => /* @__PURE__ */ jsxs("div", { className: "flex flex-col gap-0.5", children: [
@@ -62564,6 +62665,8 @@ const BrowseToolUIImpl = ({
62564
62665
  title: isRunning ? "Browsing page..." : pageTitle ? truncate(pageTitle, 50) : "Browsed page",
62565
62666
  subtitle: displayUrl,
62566
62667
  toolName,
62668
+ args: typedArgs,
62669
+ result,
62567
62670
  error: errorMsg,
62568
62671
  children: isComplete && pageContent && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show page content", children: /* @__PURE__ */ jsx("pre", { className: "whitespace-pre-wrap break-words text-[11px] leading-relaxed text-muted-foreground", children: truncate(pageContent, 3e3) }) })
62569
62672
  }
@@ -62607,6 +62710,8 @@ const EmailSearchToolUIImpl = ({
62607
62710
  title: isRunning ? "Searching emails..." : "Email search",
62608
62711
  subtitle: query ? truncate(query, 80) : void 0,
62609
62712
  toolName,
62713
+ args: typedArgs,
62714
+ result,
62610
62715
  badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
62611
62716
  error: errorMsg,
62612
62717
  children: isComplete && emails.length > 0 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show email results", children: /* @__PURE__ */ jsx("div", { className: "flex flex-col divide-y divide-border/30", children: emails.map((email, i) => /* @__PURE__ */ jsxs(
@@ -62689,6 +62794,8 @@ function CreateAssetToolUIImpl({
62689
62794
  title: isRunning ? runningLabel : doneLabel,
62690
62795
  subtitle: createdName || name || void 0,
62691
62796
  toolName,
62797
+ args: typedArgs,
62798
+ result,
62692
62799
  error: errorMsg,
62693
62800
  children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
62694
62801
  "button",
@@ -62766,6 +62873,8 @@ const CreateEmailDraftToolUIImpl = ({
62766
62873
  status: (status == null ? void 0 : status.type) ?? "complete",
62767
62874
  title: isRunning ? "Creating email draft..." : "Email draft created",
62768
62875
  toolName,
62876
+ args: typedArgs,
62877
+ result,
62769
62878
  subtitle: subject ? truncate(subject, 60) : to ? `To: ${truncate(to, 40)}` : void 0,
62770
62879
  error: errorMsg
62771
62880
  }
@@ -63134,6 +63243,8 @@ const RunPythonCodeToolUIImpl = ({
63134
63243
  status: (status == null ? void 0 : status.type) ?? "complete",
63135
63244
  title: isRunning ? "Running code..." : summary || `Executed ${lines} ${lines !== 1 ? "lines" : "line"}`,
63136
63245
  toolName,
63246
+ args: typedArgs,
63247
+ result,
63137
63248
  error: errorMsg,
63138
63249
  children: [
63139
63250
  code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(SyntaxHighlightedCode, { code: code2 }) }),
@@ -63222,6 +63333,8 @@ const OpenAssetToolUIImpl = ({
63222
63333
  title: isRunning ? "Opening asset..." : "Asset opened",
63223
63334
  subtitle: assetId ? truncate(assetId, 30) : void 0,
63224
63335
  toolName,
63336
+ args: typedArgs,
63337
+ result,
63225
63338
  error: errorMsg,
63226
63339
  children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
63227
63340
  "button",