@actioneer/ads 0.1.0

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.
Files changed (231) hide show
  1. package/LICENSE +21 -0
  2. package/bin/ads-init.mjs +314 -0
  3. package/components/accordion.d.ts +13 -0
  4. package/components/accordion.js +91 -0
  5. package/components/agents-ui/agent-audio-visualizer-aura.d.ts +11 -0
  6. package/components/agents-ui/agent-audio-visualizer-aura.js +277 -0
  7. package/components/agents-ui/agent-audio-visualizer-wave.d.ts +12 -0
  8. package/components/agents-ui/agent-audio-visualizer-wave.js +203 -0
  9. package/components/agents-ui/react-shader-toy.d.ts +87 -0
  10. package/components/agents-ui/react-shader-toy.js +531 -0
  11. package/components/ai-elements/chain-of-thought.d.ts +30 -0
  12. package/components/ai-elements/chain-of-thought.js +182 -0
  13. package/components/ai-elements/index.d.ts +11 -0
  14. package/components/ai-elements/inline-citation.d.ts +44 -0
  15. package/components/ai-elements/inline-citation.js +314 -0
  16. package/components/ai-elements/message.d.ts +96 -0
  17. package/components/ai-elements/message.js +308 -0
  18. package/components/ai-elements/queue.d.ts +60 -0
  19. package/components/ai-elements/queue.js +193 -0
  20. package/components/ai-elements/reasoning.d.ts +26 -0
  21. package/components/ai-elements/reasoning.js +131 -0
  22. package/components/ai-elements/shimmer.d.ts +25 -0
  23. package/components/ai-elements/shimmer.js +44 -0
  24. package/components/ai-elements/speech-input.d.ts +16 -0
  25. package/components/ai-elements/speech-input.js +151 -0
  26. package/components/ai-elements/task-progress.d.ts +41 -0
  27. package/components/ai-elements/task-progress.js +211 -0
  28. package/components/ai-elements/task.d.ts +35 -0
  29. package/components/ai-elements/task.js +73 -0
  30. package/components/ai-elements/tool.d.ts +53 -0
  31. package/components/ai-elements/tool.js +116 -0
  32. package/components/ai-elements/voice.d.ts +74 -0
  33. package/components/ai-elements/voice.js +875 -0
  34. package/components/alert.d.ts +21 -0
  35. package/components/alert.js +76 -0
  36. package/components/answer.d.ts +984 -0
  37. package/components/answer.js +543 -0
  38. package/components/assistant-ui/action-bar.d.ts +3 -0
  39. package/components/assistant-ui/action-bar.js +57 -0
  40. package/components/assistant-ui/answer-tool-ui.d.ts +5 -0
  41. package/components/assistant-ui/answer-tool-ui.js +42 -0
  42. package/components/assistant-ui/attachment.d.ts +50 -0
  43. package/components/assistant-ui/attachment.js +353 -0
  44. package/components/assistant-ui/badge.d.ts +11 -0
  45. package/components/assistant-ui/badge.js +54 -0
  46. package/components/assistant-ui/branch-picker.d.ts +3 -0
  47. package/components/assistant-ui/branch-picker.js +36 -0
  48. package/components/assistant-ui/chain-of-thought.d.ts +46 -0
  49. package/components/assistant-ui/composer-add-context.d.ts +50 -0
  50. package/components/assistant-ui/composer-add-context.js +209 -0
  51. package/components/assistant-ui/composer-deep-research.d.ts +16 -0
  52. package/components/assistant-ui/composer-deep-research.js +38 -0
  53. package/components/assistant-ui/composer-harness.d.ts +18 -0
  54. package/components/assistant-ui/composer-harness.js +186 -0
  55. package/components/assistant-ui/composer-trigger-popover.d.ts +47 -0
  56. package/components/assistant-ui/composer-trigger-popover.js +147 -0
  57. package/components/assistant-ui/composer.d.ts +8 -0
  58. package/components/assistant-ui/composer.js +276 -0
  59. package/components/assistant-ui/directive-text.d.ts +16 -0
  60. package/components/assistant-ui/directive-text.js +40 -0
  61. package/components/assistant-ui/error.d.ts +6 -0
  62. package/components/assistant-ui/error.js +39 -0
  63. package/components/assistant-ui/file.d.ts +37 -0
  64. package/components/assistant-ui/file.js +159 -0
  65. package/components/assistant-ui/follow-up-suggestions.d.ts +7 -0
  66. package/components/assistant-ui/follow-up-suggestions.js +44 -0
  67. package/components/assistant-ui/image.d.ts +46 -0
  68. package/components/assistant-ui/image.js +351 -0
  69. package/components/assistant-ui/index.d.ts +28 -0
  70. package/components/assistant-ui/markdown-text.d.ts +1 -0
  71. package/components/assistant-ui/markdown-text.js +242 -0
  72. package/components/assistant-ui/message-timing.d.ts +25 -0
  73. package/components/assistant-ui/message-timing.js +56 -0
  74. package/components/assistant-ui/message.d.ts +4 -0
  75. package/components/assistant-ui/message.js +159 -0
  76. package/components/assistant-ui/primitives.d.ts +2 -0
  77. package/components/assistant-ui/quote.d.ts +37 -0
  78. package/components/assistant-ui/quote.js +150 -0
  79. package/components/assistant-ui/reasoning.d.ts +44 -0
  80. package/components/assistant-ui/reasoning.js +261 -0
  81. package/components/assistant-ui/selection-toolbar.d.ts +29 -0
  82. package/components/assistant-ui/selection-toolbar.js +91 -0
  83. package/components/assistant-ui/smart-message-text.d.ts +15 -0
  84. package/components/assistant-ui/smart-message-text.js +29 -0
  85. package/components/assistant-ui/sources.d.ts +17 -0
  86. package/components/assistant-ui/sources.js +121 -0
  87. package/components/assistant-ui/suggestions.d.ts +7 -0
  88. package/components/assistant-ui/suggestions.js +19 -0
  89. package/components/assistant-ui/thread-context.d.ts +37 -0
  90. package/components/assistant-ui/thread-context.js +8 -0
  91. package/components/assistant-ui/thread.d.ts +5 -0
  92. package/components/assistant-ui/thread.js +77 -0
  93. package/components/assistant-ui/tool-fallback.d.ts +36 -0
  94. package/components/assistant-ui/tool-fallback.js +428 -0
  95. package/components/assistant-ui/tool-group.d.ts +33 -0
  96. package/components/assistant-ui/tool-group.js +173 -0
  97. package/components/assistant-ui/tooltip-icon-button.d.ts +7 -0
  98. package/components/assistant-ui/tooltip-icon-button.js +31 -0
  99. package/components/assistant-ui/voice.d.ts +18 -0
  100. package/components/autocomplete.d.ts +18 -0
  101. package/components/autocomplete.js +162 -0
  102. package/components/avatar.d.ts +26 -0
  103. package/components/avatar.js +92 -0
  104. package/components/badge.d.ts +10 -0
  105. package/components/badge.js +83 -0
  106. package/components/brand-loader.d.ts +16 -0
  107. package/components/brand-loader.js +64 -0
  108. package/components/breadcrumbs.d.ts +8 -0
  109. package/components/breadcrumbs.js +58 -0
  110. package/components/button.d.ts +13 -0
  111. package/components/button.js +100 -0
  112. package/components/card.d.ts +19 -0
  113. package/components/card.js +82 -0
  114. package/components/carousel.d.ts +31 -0
  115. package/components/carousel.js +351 -0
  116. package/components/chart.d.ts +165 -0
  117. package/components/chart.js +841 -0
  118. package/components/checkbox.d.ts +13 -0
  119. package/components/checkbox.js +84 -0
  120. package/components/chip.d.ts +13 -0
  121. package/components/chip.js +112 -0
  122. package/components/collapsible.d.ts +5 -0
  123. package/components/collapsible.js +31 -0
  124. package/components/connector-card.d.ts +62 -0
  125. package/components/connector-card.js +154 -0
  126. package/components/divider.d.ts +23 -0
  127. package/components/divider.js +69 -0
  128. package/components/drawer.d.ts +45 -0
  129. package/components/drawer.js +234 -0
  130. package/components/dropdown.d.ts +33 -0
  131. package/components/dropdown.js +198 -0
  132. package/components/empty-state.d.ts +8 -0
  133. package/components/empty-state.js +30 -0
  134. package/components/field.d.ts +20 -0
  135. package/components/field.js +74 -0
  136. package/components/index.d.ts +56 -0
  137. package/components/index.js +444 -0
  138. package/components/input-field.d.ts +22 -0
  139. package/components/input-field.js +91 -0
  140. package/components/input.d.ts +8 -0
  141. package/components/input.js +61 -0
  142. package/components/kbd.d.ts +6 -0
  143. package/components/kbd.js +26 -0
  144. package/components/link.d.ts +14 -0
  145. package/components/link.js +72 -0
  146. package/components/modal.d.ts +18 -0
  147. package/components/modal.js +156 -0
  148. package/components/navbar.d.ts +15 -0
  149. package/components/navbar.js +68 -0
  150. package/components/number-field.d.ts +11 -0
  151. package/components/number-field.js +89 -0
  152. package/components/pagination.d.ts +28 -0
  153. package/components/pagination.js +179 -0
  154. package/components/panel.d.ts +14 -0
  155. package/components/panel.js +71 -0
  156. package/components/pixel-blast-svg.d.ts +22 -0
  157. package/components/pixel-blast-svg.js +154 -0
  158. package/components/popover.d.ts +20 -0
  159. package/components/popover.js +101 -0
  160. package/components/progress-circle.d.ts +11 -0
  161. package/components/progress-circle.js +75 -0
  162. package/components/progress.d.ts +22 -0
  163. package/components/progress.js +66 -0
  164. package/components/radio.d.ts +16 -0
  165. package/components/radio.js +101 -0
  166. package/components/segmented.d.ts +16 -0
  167. package/components/segmented.js +103 -0
  168. package/components/select.d.ts +28 -0
  169. package/components/select.js +180 -0
  170. package/components/selection-action-bar.d.ts +11 -0
  171. package/components/selection-action-bar.js +59 -0
  172. package/components/sidebar.d.ts +118 -0
  173. package/components/sidebar.js +375 -0
  174. package/components/skeleton.d.ts +6 -0
  175. package/components/skeleton.js +26 -0
  176. package/components/slider.d.ts +11 -0
  177. package/components/slider.js +62 -0
  178. package/components/spinner.d.ts +11 -0
  179. package/components/spinner.js +62 -0
  180. package/components/switch.d.ts +7 -0
  181. package/components/switch.js +61 -0
  182. package/components/table.d.ts +59 -0
  183. package/components/table.js +254 -0
  184. package/components/tabs.d.ts +29 -0
  185. package/components/tabs.js +371 -0
  186. package/components/textarea.d.ts +5 -0
  187. package/components/textarea.js +24 -0
  188. package/components/timeline.d.ts +7 -0
  189. package/components/timeline.js +47 -0
  190. package/components/toast.d.ts +74 -0
  191. package/components/toast.js +211 -0
  192. package/components/tooltip.d.ts +11 -0
  193. package/components/tooltip.js +143 -0
  194. package/components/tree.d.ts +42 -0
  195. package/components/tree.js +86 -0
  196. package/components/typography.d.ts +33 -0
  197. package/components/typography.js +65 -0
  198. package/components/ui/avatar.d.ts +11 -0
  199. package/components/ui/avatar.js +56 -0
  200. package/components/ui/button.d.ts +10 -0
  201. package/components/ui/button.js +57 -0
  202. package/components/ui/collapsible.d.ts +5 -0
  203. package/components/ui/collapsible.js +35 -0
  204. package/components/ui/dialog.d.ts +17 -0
  205. package/components/ui/dialog.js +93 -0
  206. package/components/ui/tabs.d.ts +22 -0
  207. package/components/ui/tooltip.d.ts +7 -0
  208. package/components/ui/tooltip.js +56 -0
  209. package/fonts/aribau-grotesk-400.otf +0 -0
  210. package/fonts/aribau-grotesk-700.otf +0 -0
  211. package/fonts.css +21 -0
  212. package/hooks/agents-ui/use-agent-audio-visualizer-aura.d.ts +8 -0
  213. package/hooks/agents-ui/use-agent-audio-visualizer-aura.js +62 -0
  214. package/hooks/agents-ui/use-agent-audio-visualizer-wave.d.ts +7 -0
  215. package/hooks/agents-ui/use-agent-audio-visualizer-wave.js +60 -0
  216. package/hooks/agents-ui/voice-visualizer-types.d.ts +9 -0
  217. package/lib/cn.d.ts +3 -0
  218. package/lib/cn.js +9 -0
  219. package/lib/icons.d.ts +378 -0
  220. package/lib/icons.js +119 -0
  221. package/lib/interactive.d.ts +24 -0
  222. package/lib/interactive.js +36 -0
  223. package/lib/motion.d.ts +58 -0
  224. package/lib/motion.js +70 -0
  225. package/lib/router.d.ts +3 -0
  226. package/lib/utils.d.ts +6 -0
  227. package/llms.txt +537 -0
  228. package/manifest.json +5085 -0
  229. package/package.json +60 -0
  230. package/styles.css +653 -0
  231. package/theme.css +273 -0
@@ -0,0 +1,77 @@
1
+ "use client";
2
+ import { jsxs as l, jsx as o } from "react/jsx-runtime";
3
+ import { Composer as d } from "./composer.js";
4
+ import { ComposerPlaceholdersProvider as z } from "./composer.js";
5
+ import { RenderAnswerToolUI as s } from "./answer-tool-ui.js";
6
+ import { ThreadFollowupSuggestions as c } from "./follow-up-suggestions.js";
7
+ import { ThreadMessage as f } from "./message.js";
8
+ import { SelectionToolbar as u } from "./selection-toolbar.js";
9
+ import { ThreadSuggestions as h } from "./suggestions.js";
10
+ import { isNewChatView as a, ThreadComponentsContext as m, EMPTY_COMPONENTS as p } from "./thread-context.js";
11
+ import { TooltipIconButton as x } from "./tooltip-icon-button.js";
12
+ import { cn as b } from "../../lib/cn.js";
13
+ import { useAuiState as w, ThreadPrimitive as e, AuiIf as n } from "@assistant-ui/react";
14
+ import { ArrowDown as g } from "../../lib/icons.js";
15
+ import { useContext as v } from "react";
16
+ const F = ({
17
+ components: r = p,
18
+ isAnswerToolEnabled: i = !0
19
+ }) => {
20
+ const t = w(a);
21
+ return /* @__PURE__ */ l(m.Provider, { value: r, children: [
22
+ i && /* @__PURE__ */ o(s, {}),
23
+ /* @__PURE__ */ o(T, { isEmpty: t })
24
+ ] });
25
+ }, T = ({ isEmpty: r }) => {
26
+ const { Welcome: i = y } = v(m);
27
+ return /* @__PURE__ */ l(e.Root, { className: "aui-root aui-thread-root bg-background @container flex h-full flex-col", children: [
28
+ /* @__PURE__ */ o(
29
+ e.Viewport,
30
+ {
31
+ turnAnchor: "top",
32
+ "data-slot": "aui_thread-viewport",
33
+ className: "relative flex flex-1 flex-col overflow-x-auto overflow-y-scroll scroll-smooth",
34
+ children: /* @__PURE__ */ l("div", { className: "mx-auto flex w-full max-w-(--thread-max-width) flex-1 flex-col px-4 pt-4", children: [
35
+ /* @__PURE__ */ o(n, { condition: a, children: /* @__PURE__ */ o("div", { className: "flex flex-1 flex-col items-center justify-end", children: /* @__PURE__ */ o(i, {}) }) }),
36
+ /* @__PURE__ */ o(
37
+ "div",
38
+ {
39
+ "data-slot": "aui_message-group",
40
+ className: "mb-14 flex flex-col gap-y-6 empty:hidden",
41
+ children: /* @__PURE__ */ o(e.Messages, { children: () => /* @__PURE__ */ o(f, {}) })
42
+ }
43
+ ),
44
+ /* @__PURE__ */ l(
45
+ e.ViewportFooter,
46
+ {
47
+ className: b(
48
+ "aui-thread-viewport-footer bg-background flex flex-col gap-4 overflow-visible pb-4 md:pb-6",
49
+ r && "flex-1",
50
+ !r && "sticky bottom-0 mt-auto rounded-t-(--composer-radius)"
51
+ ),
52
+ children: [
53
+ /* @__PURE__ */ o(N, {}),
54
+ /* @__PURE__ */ o(c, {}),
55
+ /* @__PURE__ */ o(d, {}),
56
+ /* @__PURE__ */ o(n, { condition: (t) => a(t) && t.composer.isEmpty, children: /* @__PURE__ */ o(h, {}) })
57
+ ]
58
+ }
59
+ )
60
+ ] })
61
+ }
62
+ ),
63
+ /* @__PURE__ */ o(u, {})
64
+ ] });
65
+ }, N = () => /* @__PURE__ */ o(e.ScrollToBottom, { asChild: !0, children: /* @__PURE__ */ o(
66
+ x,
67
+ {
68
+ tooltip: "Scroll to bottom",
69
+ variant: "outline",
70
+ className: "aui-thread-scroll-to-bottom dark:border-border dark:bg-background dark:hover:bg-accent absolute -top-12 z-10 self-center rounded-full p-4 disabled:invisible",
71
+ children: /* @__PURE__ */ o(g, {})
72
+ }
73
+ ) }), y = () => /* @__PURE__ */ o("div", { className: "aui-thread-welcome-root mb-6 flex flex-col items-center px-4 text-center", children: /* @__PURE__ */ o("h1", { className: "aui-thread-welcome-message-inner fade-in slide-in-from-bottom-1 animate-in fill-mode-both text-xl font-semibold duration-(--duration-normal)", children: "How can I help you today?" }) });
74
+ export {
75
+ z as ComposerPlaceholdersProvider,
76
+ F as Thread
77
+ };
@@ -0,0 +1,36 @@
1
+ import { ToolCallMessagePart, ToolCallMessagePartProps, ToolCallMessagePartStatus, ToolCallMessagePartComponent } from '@assistant-ui/react';
2
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
3
+ export type ToolFallbackRootProps = Omit<React.ComponentProps<typeof Collapsible>, "open" | "onOpenChange"> & {
4
+ open?: boolean;
5
+ onOpenChange?: (open: boolean) => void;
6
+ defaultOpen?: boolean;
7
+ };
8
+ declare function ToolFallbackRoot({ className, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, children, ...props }: ToolFallbackRootProps): import("react").JSX.Element;
9
+ declare function ToolFallbackTrigger({ toolName, status, className, ...props }: React.ComponentProps<typeof CollapsibleTrigger> & {
10
+ toolName: string;
11
+ status?: ToolCallMessagePartStatus;
12
+ }): import("react").JSX.Element;
13
+ declare function ToolFallbackContent({ className, children, ...props }: React.ComponentProps<typeof CollapsibleContent>): import("react").JSX.Element;
14
+ declare function ToolFallbackArgs({ argsText, className, ...props }: React.ComponentProps<"div"> & {
15
+ argsText?: string;
16
+ }): import("react").JSX.Element | null;
17
+ declare function ToolFallbackResult({ result, className, ...props }: React.ComponentProps<"div"> & {
18
+ result?: unknown;
19
+ }): import("react").JSX.Element | null;
20
+ declare function ToolFallbackError({ status, className, ...props }: React.ComponentProps<"div"> & {
21
+ status?: ToolCallMessagePartStatus;
22
+ }): import("react").JSX.Element | null;
23
+ declare function ToolFallbackApproval({ className, addResult, resume, interrupt, approval, respondToApproval, ...props }: React.ComponentProps<"div"> & Partial<Pick<ToolCallMessagePartProps, "addResult" | "resume" | "respondToApproval">> & {
24
+ interrupt?: ToolCallMessagePart["interrupt"];
25
+ approval?: ToolCallMessagePart["approval"];
26
+ }): import("react").JSX.Element | null;
27
+ declare const ToolFallback: ToolCallMessagePartComponent & {
28
+ Root: typeof ToolFallbackRoot;
29
+ Trigger: typeof ToolFallbackTrigger;
30
+ Content: typeof ToolFallbackContent;
31
+ Args: typeof ToolFallbackArgs;
32
+ Result: typeof ToolFallbackResult;
33
+ Error: typeof ToolFallbackError;
34
+ Approval: typeof ToolFallbackApproval;
35
+ };
36
+ export { ToolFallback, ToolFallbackRoot, ToolFallbackTrigger, ToolFallbackContent, ToolFallbackArgs, ToolFallbackResult, ToolFallbackError, ToolFallbackApproval, };
@@ -0,0 +1,428 @@
1
+ "use client";
2
+ import { jsxs as m, jsx as o } from "react/jsx-runtime";
3
+ import { memo as U, useState as y, useRef as P, useCallback as _ } from "react";
4
+ import { WarningCircle as q, CloseCircle as $, Check as M, Loader as B, ChevronDown as J } from "../../lib/icons.js";
5
+ import { useScrollLock as V, useToolCallElapsed as W } from "@assistant-ui/react";
6
+ import { Collapsible as K, CollapsibleTrigger as G, CollapsibleContent as H } from "../ui/collapsible.js";
7
+ import { cn as i } from "../../lib/cn.js";
8
+ import { Button as v } from "../ui/button.js";
9
+ const Q = 200, C = "active:scale-[0.98]";
10
+ function D({
11
+ className: e,
12
+ open: l,
13
+ onOpenChange: t,
14
+ defaultOpen: n = !1,
15
+ children: r,
16
+ ...c
17
+ }) {
18
+ const s = P(null), [d, b] = y(n), h = V(s, Q), u = l !== void 0, g = u ? l : d, f = _(
19
+ (x) => {
20
+ h(), u || b(x), t == null || t(x);
21
+ },
22
+ [h, u, t]
23
+ );
24
+ return /* @__PURE__ */ o(
25
+ K,
26
+ {
27
+ ref: s,
28
+ "data-slot": "tool-fallback-root",
29
+ open: g,
30
+ onOpenChange: f,
31
+ className: i(
32
+ "aui-tool-fallback-root group/tool-fallback-root w-full",
33
+ e
34
+ ),
35
+ ...c,
36
+ children: r
37
+ }
38
+ );
39
+ }
40
+ const X = {
41
+ running: B,
42
+ complete: M,
43
+ incomplete: $,
44
+ "requires-action": q
45
+ }, Y = (e) => {
46
+ if (e < 1e3) return "<1s";
47
+ const l = e / 1e3;
48
+ return l < 10 ? `${(Math.floor(l * 10) / 10).toFixed(1)}s` : l < 60 ? `${Math.floor(l)}s` : `${Math.floor(l / 60)}m ${Math.floor(l % 60)}s`;
49
+ };
50
+ function Z({
51
+ className: e,
52
+ ...l
53
+ }) {
54
+ const t = W();
55
+ return t === void 0 ? null : /* @__PURE__ */ o(
56
+ "span",
57
+ {
58
+ "data-slot": "tool-fallback-duration",
59
+ className: i(
60
+ "aui-tool-fallback-duration text-muted-foreground text-xs tabular-nums",
61
+ e
62
+ ),
63
+ ...l,
64
+ children: Y(t)
65
+ }
66
+ );
67
+ }
68
+ function R({
69
+ toolName: e,
70
+ status: l,
71
+ className: t,
72
+ ...n
73
+ }) {
74
+ const r = (l == null ? void 0 : l.type) ?? "complete", c = r === "running", s = (l == null ? void 0 : l.type) === "incomplete" && l.reason === "cancelled", d = X[r], b = s ? "Cancelled tool" : "Used tool";
75
+ return /* @__PURE__ */ m(
76
+ G,
77
+ {
78
+ "data-slot": "tool-fallback-trigger",
79
+ className: i(
80
+ "aui-tool-fallback-trigger group/trigger text-muted-foreground hover:text-foreground flex w-fit origin-left items-center gap-2 py-1.5 text-xs transition-[color,scale] active:scale-[0.98]",
81
+ t
82
+ ),
83
+ ...n,
84
+ children: [
85
+ /* @__PURE__ */ o(
86
+ d,
87
+ {
88
+ "data-slot": "tool-fallback-trigger-icon",
89
+ className: i(
90
+ "aui-tool-fallback-trigger-icon size-4 shrink-0",
91
+ s && "text-muted-foreground",
92
+ c && "animate-spin [animation-duration:var(--duration-spin)] motion-reduce:animate-none"
93
+ )
94
+ }
95
+ ),
96
+ /* @__PURE__ */ m(
97
+ "span",
98
+ {
99
+ "data-slot": "tool-fallback-trigger-label",
100
+ className: i(
101
+ "aui-tool-fallback-trigger-label-wrapper relative inline-block text-start leading-none",
102
+ s && "text-muted-foreground line-through"
103
+ ),
104
+ children: [
105
+ /* @__PURE__ */ m("span", { children: [
106
+ b,
107
+ ": ",
108
+ /* @__PURE__ */ o("b", { children: e })
109
+ ] }),
110
+ c && /* @__PURE__ */ m(
111
+ "span",
112
+ {
113
+ "aria-hidden": !0,
114
+ "data-slot": "tool-fallback-trigger-shimmer",
115
+ className: "aui-tool-fallback-trigger-shimmer shimmer pointer-events-none absolute inset-0 motion-reduce:animate-none",
116
+ children: [
117
+ b,
118
+ ": ",
119
+ /* @__PURE__ */ o("b", { children: e })
120
+ ]
121
+ }
122
+ )
123
+ ]
124
+ }
125
+ ),
126
+ /* @__PURE__ */ o(Z, {}),
127
+ /* @__PURE__ */ o(
128
+ J,
129
+ {
130
+ "data-slot": "tool-fallback-trigger-chevron",
131
+ className: i(
132
+ "aui-tool-fallback-trigger-chevron size-4 shrink-0",
133
+ "transition-transform duration-(--duration-normal) ease-out motion-reduce:transition-none",
134
+ "group-data-[state=closed]/trigger:-rotate-90",
135
+ "group-data-[state=open]/trigger:rotate-0"
136
+ )
137
+ }
138
+ )
139
+ ]
140
+ }
141
+ );
142
+ }
143
+ function E({
144
+ className: e,
145
+ children: l,
146
+ ...t
147
+ }) {
148
+ return /* @__PURE__ */ o(
149
+ H,
150
+ {
151
+ "data-slot": "tool-fallback-content",
152
+ className: i(
153
+ "aui-tool-fallback-content relative overflow-hidden text-xs outline-none",
154
+ "group/collapsible-content",
155
+ "data-[state=closed]:pointer-events-none",
156
+ e
157
+ ),
158
+ ...t,
159
+ children: /* @__PURE__ */ o(
160
+ "div",
161
+ {
162
+ className: i(
163
+ "flex flex-col gap-2 ps-6 pt-1 pb-2 ease-out motion-reduce:animate-none",
164
+ "group-data-[state=open]/collapsible-content:animate-in group-data-[state=open]/collapsible-content:fade-in-0 group-data-[state=open]/collapsible-content:blur-in-[2px] group-data-[state=open]/collapsible-content:slide-in-from-top-1",
165
+ "group-data-[state=closed]/collapsible-content:animate-out group-data-[state=closed]/collapsible-content:fade-out-0 group-data-[state=closed]/collapsible-content:blur-out-[2px] group-data-[state=closed]/collapsible-content:slide-out-to-top-1",
166
+ "group-data-[state=closed]/collapsible-content:duration-(--duration-normal) group-data-[state=open]/collapsible-content:duration-(--duration-normal)"
167
+ ),
168
+ children: l
169
+ }
170
+ )
171
+ }
172
+ );
173
+ }
174
+ function I({
175
+ argsText: e,
176
+ className: l,
177
+ ...t
178
+ }) {
179
+ return e ? /* @__PURE__ */ o(
180
+ "div",
181
+ {
182
+ "data-slot": "tool-fallback-args",
183
+ className: i("aui-tool-fallback-args", l),
184
+ ...t,
185
+ children: /* @__PURE__ */ o("pre", { className: "aui-tool-fallback-args-value bg-muted/50 text-foreground/90 rounded-md p-2.5 text-xs whitespace-pre-wrap", children: e })
186
+ }
187
+ ) : null;
188
+ }
189
+ function L({
190
+ result: e,
191
+ className: l,
192
+ ...t
193
+ }) {
194
+ return e === void 0 ? null : /* @__PURE__ */ m(
195
+ "div",
196
+ {
197
+ "data-slot": "tool-fallback-result",
198
+ className: i("aui-tool-fallback-result", l),
199
+ ...t,
200
+ children: [
201
+ /* @__PURE__ */ o("p", { className: "aui-tool-fallback-result-header text-muted-foreground text-xs font-medium", children: "Result:" }),
202
+ /* @__PURE__ */ o("pre", { className: "aui-tool-fallback-result-content bg-muted/50 text-foreground/90 mt-1 rounded-md p-2.5 text-xs whitespace-pre-wrap", children: typeof e == "string" ? e : JSON.stringify(e, null, 2) })
203
+ ]
204
+ }
205
+ );
206
+ }
207
+ function S({
208
+ status: e,
209
+ className: l,
210
+ ...t
211
+ }) {
212
+ if ((e == null ? void 0 : e.type) !== "incomplete") return null;
213
+ const n = e.error, r = n ? typeof n == "string" ? n : JSON.stringify(n) : null;
214
+ if (!r) return null;
215
+ const s = e.reason === "cancelled" ? "Cancelled reason:" : "Error:";
216
+ return /* @__PURE__ */ m(
217
+ "div",
218
+ {
219
+ "data-slot": "tool-fallback-error",
220
+ className: i("aui-tool-fallback-error", l),
221
+ ...t,
222
+ children: [
223
+ /* @__PURE__ */ o("p", { className: "aui-tool-fallback-error-header text-muted-foreground font-semibold", children: s }),
224
+ /* @__PURE__ */ o("p", { className: "aui-tool-fallback-error-reason text-muted-foreground", children: r })
225
+ ]
226
+ }
227
+ );
228
+ }
229
+ const ee = "Approved by user", le = "User denied tool execution", A = {
230
+ "allow-once": "Allow",
231
+ "allow-always": "Always allow",
232
+ "reject-once": "Deny",
233
+ "reject-always": "Always deny"
234
+ }, F = (e) => e === "allow-once" || e === "allow-always", O = (e) => e.label ?? (Object.hasOwn(A, e.kind) ? A[e.kind] : void 0) ?? e.id;
235
+ function j({
236
+ className: e,
237
+ addResult: l,
238
+ resume: t,
239
+ interrupt: n,
240
+ approval: r,
241
+ respondToApproval: c,
242
+ ...s
243
+ }) {
244
+ const [d, b] = y(!1), [h, u] = y(null);
245
+ if (r != null && (r.approved !== void 0 || r.resolution !== void 0))
246
+ return null;
247
+ const g = c ? r == null ? void 0 : r.options : void 0, f = g == null ? void 0 : g.filter(
248
+ (a) => Object.hasOwn(A, a.kind)
249
+ ), x = (a) => {
250
+ d || (r != null && r.approved === void 0 && c ? c({ approved: a }) : n ? t == null || t({ approved: a }) : l == null || l(a ? ee : le), b(!0));
251
+ }, T = (a) => {
252
+ d || (c == null || c({ optionId: a.id }), b(!0), u(null));
253
+ }, z = (a) => {
254
+ a.confirm ? u(a.id) : T(a);
255
+ }, k = h != null ? f == null ? void 0 : f.find((a) => a.id === h) : void 0;
256
+ if (k) {
257
+ const a = typeof k.confirm == "object" ? k.confirm : void 0, w = (a == null ? void 0 : a.description) ?? k.description;
258
+ return /* @__PURE__ */ m(
259
+ "div",
260
+ {
261
+ "data-slot": "tool-fallback-approval-confirm",
262
+ className: i(
263
+ "aui-tool-fallback-approval-confirm flex flex-col gap-2 pt-1",
264
+ e
265
+ ),
266
+ ...s,
267
+ children: [
268
+ /* @__PURE__ */ o("p", { className: "aui-tool-fallback-approval-confirm-title font-semibold", children: (a == null ? void 0 : a.title) ?? `${O(k)}?` }),
269
+ w && /* @__PURE__ */ o("p", { className: "aui-tool-fallback-approval-confirm-description text-muted-foreground", children: w }),
270
+ k.grants && k.grants.length > 0 && /* @__PURE__ */ o("ul", { className: "aui-tool-fallback-approval-confirm-grants flex flex-col gap-1", children: k.grants.map((p) => /* @__PURE__ */ o("li", { children: /* @__PURE__ */ o("code", { className: "aui-tool-fallback-approval-confirm-grant bg-muted rounded px-1.5 py-0.5 text-xs", children: p }) }, p)) }),
271
+ /* @__PURE__ */ m("div", { className: "flex items-center gap-2", children: [
272
+ /* @__PURE__ */ o(
273
+ v,
274
+ {
275
+ size: "sm",
276
+ className: C,
277
+ onClick: () => T(k),
278
+ disabled: d,
279
+ children: "Confirm"
280
+ }
281
+ ),
282
+ /* @__PURE__ */ o(
283
+ v,
284
+ {
285
+ size: "sm",
286
+ variant: "outline",
287
+ className: C,
288
+ onClick: () => u(null),
289
+ disabled: d,
290
+ children: "Back"
291
+ }
292
+ )
293
+ ] })
294
+ ]
295
+ }
296
+ );
297
+ }
298
+ if (g && g.length > 0) {
299
+ const a = (f == null ? void 0 : f.filter((p) => F(p.kind))) ?? [], w = (f == null ? void 0 : f.filter((p) => !F(p.kind))) ?? [];
300
+ return /* @__PURE__ */ m(
301
+ "div",
302
+ {
303
+ "data-slot": "tool-fallback-approval",
304
+ className: i(
305
+ "aui-tool-fallback-approval flex flex-wrap items-center gap-2 pt-1",
306
+ e
307
+ ),
308
+ ...s,
309
+ children: [
310
+ [...a, ...w].map((p) => /* @__PURE__ */ o(
311
+ v,
312
+ {
313
+ size: "sm",
314
+ variant: p === a[0] ? "default" : "outline",
315
+ className: C,
316
+ onClick: () => z(p),
317
+ disabled: d,
318
+ children: O(p)
319
+ },
320
+ p.id
321
+ )),
322
+ w.length === 0 && /* @__PURE__ */ o(
323
+ v,
324
+ {
325
+ size: "sm",
326
+ variant: "outline",
327
+ className: C,
328
+ onClick: () => x(!1),
329
+ disabled: d,
330
+ children: "Deny"
331
+ }
332
+ )
333
+ ]
334
+ }
335
+ );
336
+ }
337
+ return /* @__PURE__ */ m(
338
+ "div",
339
+ {
340
+ "data-slot": "tool-fallback-approval",
341
+ className: i(
342
+ "aui-tool-fallback-approval flex items-center gap-2 pt-1",
343
+ e
344
+ ),
345
+ ...s,
346
+ children: [
347
+ /* @__PURE__ */ o(
348
+ v,
349
+ {
350
+ size: "sm",
351
+ className: C,
352
+ onClick: () => x(!0),
353
+ disabled: d,
354
+ children: "Allow"
355
+ }
356
+ ),
357
+ /* @__PURE__ */ o(
358
+ v,
359
+ {
360
+ size: "sm",
361
+ variant: "outline",
362
+ className: C,
363
+ onClick: () => x(!1),
364
+ disabled: d,
365
+ children: "Deny"
366
+ }
367
+ )
368
+ ]
369
+ }
370
+ );
371
+ }
372
+ const oe = ({
373
+ toolName: e,
374
+ argsText: l,
375
+ result: t,
376
+ status: n,
377
+ addResult: r,
378
+ resume: c,
379
+ interrupt: s,
380
+ approval: d,
381
+ respondToApproval: b
382
+ }) => {
383
+ const h = (n == null ? void 0 : n.type) === "incomplete" && n.reason === "cancelled", u = (n == null ? void 0 : n.type) === "requires-action", [g, f] = y(u), [x, T] = y(u);
384
+ return u !== x && (T(u), u && f(!0)), /* @__PURE__ */ m(D, { open: g, onOpenChange: f, children: [
385
+ /* @__PURE__ */ o(R, { toolName: e, status: n }),
386
+ /* @__PURE__ */ m(E, { children: [
387
+ /* @__PURE__ */ o(S, { status: n }),
388
+ /* @__PURE__ */ o(
389
+ I,
390
+ {
391
+ argsText: l,
392
+ className: i(h && "opacity-60")
393
+ }
394
+ ),
395
+ u && /* @__PURE__ */ o(
396
+ j,
397
+ {
398
+ addResult: r,
399
+ resume: c,
400
+ interrupt: s,
401
+ approval: d,
402
+ respondToApproval: b
403
+ }
404
+ ),
405
+ !h && /* @__PURE__ */ o(L, { result: t })
406
+ ] })
407
+ ] });
408
+ }, N = U(
409
+ oe
410
+ );
411
+ N.displayName = "ToolFallback";
412
+ N.Root = D;
413
+ N.Trigger = R;
414
+ N.Content = E;
415
+ N.Args = I;
416
+ N.Result = L;
417
+ N.Error = S;
418
+ N.Approval = j;
419
+ export {
420
+ N as ToolFallback,
421
+ j as ToolFallbackApproval,
422
+ I as ToolFallbackArgs,
423
+ E as ToolFallbackContent,
424
+ S as ToolFallbackError,
425
+ L as ToolFallbackResult,
426
+ D as ToolFallbackRoot,
427
+ R as ToolFallbackTrigger
428
+ };
@@ -0,0 +1,33 @@
1
+ import { FC, PropsWithChildren } from 'react';
2
+ import { VariantProps } from 'class-variance-authority';
3
+ import { Collapsible, CollapsibleContent, CollapsibleTrigger } from '../ui/collapsible';
4
+ declare const toolGroupVariants: (props?: ({
5
+ variant?: "muted" | "outline" | "ghost" | null | undefined;
6
+ } & import('class-variance-authority/types').ClassProp) | undefined) => string;
7
+ export type ToolGroupRootProps = Omit<React.ComponentProps<typeof Collapsible>, "open" | "onOpenChange"> & VariantProps<typeof toolGroupVariants> & {
8
+ open?: boolean;
9
+ onOpenChange?: (open: boolean) => void;
10
+ defaultOpen?: boolean;
11
+ };
12
+ declare function ToolGroupRoot({ className, variant, open: controlledOpen, onOpenChange: controlledOnOpenChange, defaultOpen, children, ...props }: ToolGroupRootProps): import("react").JSX.Element;
13
+ declare function ToolGroupTrigger({ count, active, className, ...props }: React.ComponentProps<typeof CollapsibleTrigger> & {
14
+ count: number;
15
+ active?: boolean;
16
+ }): import("react").JSX.Element;
17
+ declare function ToolGroupContent({ className, children, ...props }: React.ComponentProps<typeof CollapsibleContent>): import("react").JSX.Element;
18
+ type ToolGroupComponent = FC<PropsWithChildren<{
19
+ startIndex: number;
20
+ endIndex: number;
21
+ }>> & {
22
+ Root: typeof ToolGroupRoot;
23
+ Trigger: typeof ToolGroupTrigger;
24
+ Content: typeof ToolGroupContent;
25
+ };
26
+ /**
27
+ * @deprecated This wrapper targets the legacy `components.ToolGroup` prop
28
+ * on `<MessagePrimitive.Parts>`. Use `<MessagePrimitive.GroupedParts>` with
29
+ * a `groupBy` returning `"group-tool"` and compose `ToolGroupRoot` /
30
+ * `ToolGroupTrigger` / `ToolGroupContent` directly. See `thread.tsx`.
31
+ */
32
+ declare const ToolGroup: ToolGroupComponent;
33
+ export { ToolGroup, ToolGroupRoot, ToolGroupTrigger, ToolGroupContent, toolGroupVariants, };