@athenaintel/react 0.9.2 → 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
@@ -62467,7 +62467,9 @@ function ToolCard({
62467
62467
  toolName,
62468
62468
  badge,
62469
62469
  error: error2,
62470
- children
62470
+ children,
62471
+ args,
62472
+ result
62471
62473
  }) {
62472
62474
  const isRunning = status === "running";
62473
62475
  const isComplete = status === "complete";
@@ -62501,9 +62503,46 @@ function ToolCard({
62501
62503
  ] })
62502
62504
  ] }),
62503
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 }) }),
62504
- children
62506
+ children,
62507
+ toolName && isComplete && /* @__PURE__ */ jsx(CopyToolSpecButton, { toolName, args, result })
62505
62508
  ] });
62506
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
+ }
62507
62546
  function ExpandableSection({
62508
62547
  label,
62509
62548
  children,
@@ -62567,6 +62606,8 @@ const WebSearchToolUIImpl = ({
62567
62606
  title: isRunning ? "Searching the web..." : "Web search",
62568
62607
  subtitle: query ? truncate(query, 80) : void 0,
62569
62608
  toolName,
62609
+ args: typedArgs,
62610
+ result,
62570
62611
  badge: isComplete && results.length > 0 ? `${results.length} results` : void 0,
62571
62612
  error: errorMsg,
62572
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: [
@@ -62624,6 +62665,8 @@ const BrowseToolUIImpl = ({
62624
62665
  title: isRunning ? "Browsing page..." : pageTitle ? truncate(pageTitle, 50) : "Browsed page",
62625
62666
  subtitle: displayUrl,
62626
62667
  toolName,
62668
+ args: typedArgs,
62669
+ result,
62627
62670
  error: errorMsg,
62628
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) }) })
62629
62672
  }
@@ -62667,6 +62710,8 @@ const EmailSearchToolUIImpl = ({
62667
62710
  title: isRunning ? "Searching emails..." : "Email search",
62668
62711
  subtitle: query ? truncate(query, 80) : void 0,
62669
62712
  toolName,
62713
+ args: typedArgs,
62714
+ result,
62670
62715
  badge: isComplete && emails.length > 0 ? `${emails.length} emails` : void 0,
62671
62716
  error: errorMsg,
62672
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(
@@ -62749,6 +62794,8 @@ function CreateAssetToolUIImpl({
62749
62794
  title: isRunning ? runningLabel : doneLabel,
62750
62795
  subtitle: createdName || name || void 0,
62751
62796
  toolName,
62797
+ args: typedArgs,
62798
+ result,
62752
62799
  error: errorMsg,
62753
62800
  children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
62754
62801
  "button",
@@ -62826,6 +62873,8 @@ const CreateEmailDraftToolUIImpl = ({
62826
62873
  status: (status == null ? void 0 : status.type) ?? "complete",
62827
62874
  title: isRunning ? "Creating email draft..." : "Email draft created",
62828
62875
  toolName,
62876
+ args: typedArgs,
62877
+ result,
62829
62878
  subtitle: subject ? truncate(subject, 60) : to ? `To: ${truncate(to, 40)}` : void 0,
62830
62879
  error: errorMsg
62831
62880
  }
@@ -63194,6 +63243,8 @@ const RunPythonCodeToolUIImpl = ({
63194
63243
  status: (status == null ? void 0 : status.type) ?? "complete",
63195
63244
  title: isRunning ? "Running code..." : summary || `Executed ${lines} ${lines !== 1 ? "lines" : "line"}`,
63196
63245
  toolName,
63246
+ args: typedArgs,
63247
+ result,
63197
63248
  error: errorMsg,
63198
63249
  children: [
63199
63250
  code2 && /* @__PURE__ */ jsx(ExpandableSection, { label: "Show code", children: /* @__PURE__ */ jsx(SyntaxHighlightedCode, { code: code2 }) }),
@@ -63282,6 +63333,8 @@ const OpenAssetToolUIImpl = ({
63282
63333
  title: isRunning ? "Opening asset..." : "Asset opened",
63283
63334
  subtitle: assetId ? truncate(assetId, 30) : void 0,
63284
63335
  toolName,
63336
+ args: typedArgs,
63337
+ result,
63285
63338
  error: errorMsg,
63286
63339
  children: assetId && isComplete && !isCancelled && /* @__PURE__ */ jsx("div", { className: "border-t border-border/40 px-4 py-2", children: /* @__PURE__ */ jsxs(
63287
63340
  "button",