aov-agent 1.0.0 → 1.0.1

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 (30) hide show
  1. package/README.md +250 -1
  2. package/dist/agent-ui/components/Assistant/AgentButton/AgentButton.js +28 -0
  3. package/dist/agent-ui/components/Assistant/AgentButton/AgentButton.scss +40 -0
  4. package/dist/agent-ui/components/Assistant/Assistant.js +73 -0
  5. package/dist/agent-ui/components/Assistant/Assistant.scss +3 -0
  6. package/dist/agent-ui/components/Assistant/AssistantWidget/AssistantWidget.js +187 -0
  7. package/dist/agent-ui/components/Assistant/AssistantWidget/AssistantWidget.scss +211 -0
  8. package/dist/agent-ui/components/Assistant/AssistantWidget/components/CampaignRendered.js +30 -0
  9. package/dist/agent-ui/components/Assistant/AssistantWidget/components/ListChat.js +129 -0
  10. package/dist/agent-ui/components/Assistant/Markdown/MarkdownText.js +228 -0
  11. package/dist/agent-ui/components/Assistant/Markdown/MarkdownText.scss +222 -0
  12. package/dist/agent-ui/components/Assistant/Markdown/MathRenderer.js +46 -0
  13. package/dist/agent-ui/components/Assistant/Suggestions/Suggestions.js +62 -0
  14. package/dist/agent-ui/components/Assistant/Suggestions/Suggestions.scss +22 -0
  15. package/dist/agent-ui/components/Assistant/ThreadProvider.js +482 -0
  16. package/dist/agent-ui/components/Assistant/ToolResult/CardTool.js +41 -0
  17. package/dist/agent-ui/components/Assistant/ToolResult/ToolResult.js +20 -0
  18. package/dist/agent-ui/components/ResizableModal/ResizableModal.js +262 -0
  19. package/dist/agent-ui/components/ResizableModal/ResizableModal.scss +117 -0
  20. package/dist/agent-ui/contexts/AgentContext.js +39 -0
  21. package/dist/agent-ui/contexts/SuggestionsContext.js +64 -0
  22. package/dist/agent-ui/contexts/ThreadContext.js +60 -0
  23. package/dist/agent-ui/hooks/useFetchApi.js +238 -0
  24. package/dist/agent-ui/hooks/useStreamApi.js +127 -0
  25. package/dist/agent-ui/index.js +1 -0
  26. package/dist/agent-ui/services/errorService.js +39 -0
  27. package/dist/agent-ui/utils/api.js +164 -0
  28. package/package.json +26 -9
  29. package/dist/index.js +0 -7
  30. package/types/index.d.ts +0 -5
@@ -0,0 +1,222 @@
1
+ /* Custom markdown styles for AssistantWidget */
2
+ .assistant-markdown-text {
3
+ h1 {
4
+ font-size: 1.25rem;
5
+ font-weight: 600;
6
+ margin: 1.2em 0 0.6em 0;
7
+ line-height: 1.3;
8
+ }
9
+ h2 {
10
+ font-size: 1.1rem;
11
+ font-weight: 600;
12
+ margin: 1em 0 0.5em 0;
13
+ line-height: 1.3;
14
+ }
15
+ h3 {
16
+ font-size: 1rem;
17
+ font-weight: 600;
18
+ margin: 0.8em 0 0.4em 0;
19
+ line-height: 1.3;
20
+ }
21
+ h4,
22
+ h5,
23
+ h6 {
24
+ font-size: 0.95rem;
25
+ font-weight: 500;
26
+ margin: 0.7em 0 0.3em 0;
27
+ line-height: 1.3;
28
+ }
29
+ p {
30
+ margin: 0.5em 0;
31
+ }
32
+ ul,
33
+ ol {
34
+ margin: 0.5em 0 0.5em 1.2em;
35
+ padding-left: 0;
36
+ list-style-position: outside;
37
+ }
38
+ ul {
39
+ list-style-type: disc;
40
+ }
41
+ ol {
42
+ list-style-type: decimal;
43
+ }
44
+ li {
45
+ margin: 0.2em 0;
46
+ display: list-item;
47
+ }
48
+ li > ul,
49
+ li > ol {
50
+ margin: 0.2em 0 0.2em 1.2em;
51
+ }
52
+ li li {
53
+ list-style-type: circle;
54
+ }
55
+ li li li {
56
+ list-style-type: square;
57
+ }
58
+ }
59
+
60
+ /* Link styles */
61
+ .aui-md-a {
62
+ color: #0066cc;
63
+ text-decoration: underline;
64
+ text-decoration-color: rgba(0, 102, 204, 0.6);
65
+ }
66
+
67
+ .aui-md-a:hover {
68
+ color: #0052a3;
69
+ text-decoration-color: #0052a3;
70
+ }
71
+
72
+ /* Code block styles */
73
+ .aui-md-code-block-wrapper {
74
+ position: relative;
75
+ margin: 1em 0;
76
+ border-radius: 8px;
77
+ overflow: hidden;
78
+ background: #1e1e1e;
79
+ border: 1px solid #333;
80
+ }
81
+
82
+ .aui-md-code-block-header {
83
+ background: #2d2d2d;
84
+ padding: 6px 12px;
85
+ border-bottom: 1px solid #333;
86
+ display: flex;
87
+ justify-content: space-between;
88
+ align-items: center;
89
+ }
90
+
91
+ .aui-md-code-block-lang {
92
+ color: #888;
93
+ font-size: 12px;
94
+ text-transform: uppercase;
95
+ font-weight: 500;
96
+ }
97
+
98
+ .aui-md-pre {
99
+ margin: 0;
100
+ padding: 12px 16px;
101
+ overflow-x: auto;
102
+ background: #1e1e1e;
103
+ color: #d4d4d4;
104
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
105
+ font-size: 13px;
106
+ line-height: 1.5;
107
+ }
108
+
109
+ .aui-md-code {
110
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
111
+ font-size: 13px;
112
+ background: transparent;
113
+ color: #d4d4d4;
114
+ white-space: pre;
115
+ }
116
+
117
+ /* Inline code styles */
118
+ .aui-md-code-inline {
119
+ background: #f3f4f6;
120
+ color: #d73a49;
121
+ padding: 2px 6px;
122
+ border-radius: 3px;
123
+ font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', 'Courier New', monospace;
124
+ font-size: 0.875em;
125
+ border: 1px solid #e5e7eb;
126
+ }
127
+
128
+ /* Additional markdown element styles */
129
+ .aui-md-h1,
130
+ .aui-md-h2,
131
+ .aui-md-h3,
132
+ .aui-md-h4 {
133
+ color: #1a1a1a;
134
+ font-weight: 600;
135
+ margin-top: 1em;
136
+ margin-bottom: 0.5em;
137
+ }
138
+
139
+ .aui-md-h1 {
140
+ font-size: 1.5em;
141
+ border-bottom: 1px solid #e1e4e8;
142
+ padding-bottom: 0.3em;
143
+ }
144
+
145
+ .aui-md-h2 {
146
+ font-size: 1.3em;
147
+ }
148
+
149
+ .aui-md-h3 {
150
+ font-size: 1.1em;
151
+ }
152
+
153
+ .aui-md-ul,
154
+ .aui-md-ol {
155
+ padding-left: 1.5em;
156
+ margin: 0.5em 0;
157
+ list-style-position: outside;
158
+ }
159
+
160
+ .aui-md-ul {
161
+ list-style-type: disc;
162
+ }
163
+
164
+ .aui-md-ol {
165
+ list-style-type: decimal;
166
+ }
167
+
168
+ .aui-md-li {
169
+ margin: 0.25em 0;
170
+ line-height: 1.6;
171
+ display: list-item;
172
+ }
173
+
174
+ .aui-md-li > .aui-md-ul,
175
+ .aui-md-li > .aui-md-ol {
176
+ margin: 0.25em 0;
177
+ padding-left: 1.2em;
178
+ }
179
+
180
+ .aui-md-ul .aui-md-ul .aui-md-li {
181
+ list-style-type: circle;
182
+ }
183
+
184
+ .aui-md-ul .aui-md-ul .aui-md-ul .aui-md-li {
185
+ list-style-type: square;
186
+ }
187
+
188
+ .aui-md-blockquote {
189
+ border-left: 4px solid #dfe2e5;
190
+ padding-left: 1em;
191
+ margin: 0.5em 0;
192
+ color: #6a737d;
193
+ }
194
+
195
+ .aui-md-strong {
196
+ font-weight: 600;
197
+ }
198
+
199
+ .aui-md-em {
200
+ font-style: italic;
201
+ }
202
+
203
+ /* Scrollbar styling for code blocks */
204
+ .aui-md-pre::-webkit-scrollbar {
205
+ height: 8px;
206
+ width: 8px;
207
+ }
208
+
209
+ .aui-md-pre::-webkit-scrollbar-track {
210
+ background: rgba(0, 0, 0, 0.1);
211
+ border-radius: 4px;
212
+ }
213
+
214
+ .aui-md-pre::-webkit-scrollbar-thumb {
215
+ background: rgba(0, 0, 0, 0.3);
216
+ border-radius: 4px;
217
+ }
218
+
219
+ .aui-md-pre::-webkit-scrollbar-thumb:hover {
220
+ background: rgba(0, 0, 0, 0.5);
221
+ }
222
+
@@ -0,0 +1,46 @@
1
+ import React, { useEffect, useRef } from 'react';
2
+ import 'katex/dist/katex.min.css';
3
+ import renderMathInElement from 'katex/contrib/auto-render/auto-render';
4
+ var MathRenderer = function MathRenderer(_ref) {
5
+ var children = _ref.children;
6
+ var ref = useRef(null);
7
+ useEffect(function () {
8
+ if (!ref.current) return;
9
+ try {
10
+ var originalHtml = ref.current.innerHTML;
11
+ var transformedHtml = originalHtml.replace(/\[\s+([\s\S]*?\\[\s\S]*?)\s+\]/g, function (_m, inner) {
12
+ return "\\(".concat(inner, "\\)");
13
+ });
14
+ if (transformedHtml !== originalHtml) {
15
+ ref.current.innerHTML = transformedHtml;
16
+ }
17
+ renderMathInElement(ref.current, {
18
+ delimiters: [{
19
+ left: '$$',
20
+ right: '$$',
21
+ display: true
22
+ }, {
23
+ left: '\\[',
24
+ right: '\\]',
25
+ display: true
26
+ }, {
27
+ left: '$',
28
+ right: '$',
29
+ display: false
30
+ }, {
31
+ left: '\\(',
32
+ right: '\\)',
33
+ display: false
34
+ }],
35
+ throwOnError: false,
36
+ ignoredTags: ['script', 'noscript', 'style', 'textarea', 'pre', 'code']
37
+ });
38
+ } catch (e) {
39
+ console.error('katex render error', e);
40
+ }
41
+ }, [children]);
42
+ return /*#__PURE__*/React.createElement("div", {
43
+ ref: ref
44
+ }, children);
45
+ };
46
+ export default MathRenderer;
@@ -0,0 +1,62 @@
1
+ function _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }
2
+ function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
3
+ function _unsupportedIterableToArray(r, a) { if (r) { if ("string" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return "Object" === t && r.constructor && (t = r.constructor.name), "Map" === t || "Set" === t ? Array.from(r) : "Arguments" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }
4
+ function _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }
5
+ function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t["return"] && (u = t["return"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
6
+ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
7
+ import React, { useState, useEffect, useRef } from "react";
8
+ import { ThreadPrimitive } from "@assistant-ui/react";
9
+ import { useSuggestions } from "../../../contexts/SuggestionsContext.js";
10
+ import "./Suggestions.scss";
11
+ var Suggestions = function Suggestions() {
12
+ var _useSuggestions = useSuggestions(),
13
+ suggestions = _useSuggestions.suggestions,
14
+ isVisible = _useSuggestions.isVisible;
15
+ var _useState = useState([]),
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ displayedSuggestions = _useState2[0],
18
+ setDisplayedSuggestions = _useState2[1];
19
+ var containerRef = useRef(null);
20
+ useEffect(function () {
21
+ if (suggestions && suggestions.length > 0) {
22
+ setDisplayedSuggestions(suggestions);
23
+ } else {
24
+ setDisplayedSuggestions([]);
25
+ }
26
+ }, [suggestions]);
27
+
28
+ // scroll horizontal
29
+ useEffect(function () {
30
+ var el = containerRef.current;
31
+ if (!el) return;
32
+ var onWheel = function onWheel(e) {
33
+ if (e.shiftKey) return;
34
+ if (Math.abs(e.deltaY) > Math.abs(e.deltaX)) {
35
+ e.preventDefault();
36
+ el.scrollLeft += e.deltaY;
37
+ }
38
+ };
39
+ el.addEventListener("wheel", onWheel, {
40
+ passive: false
41
+ });
42
+ return function () {
43
+ return el.removeEventListener("wheel", onWheel);
44
+ };
45
+ }, [displayedSuggestions.length]);
46
+ if (!displayedSuggestions || displayedSuggestions.length === 0 || !isVisible) {
47
+ return null;
48
+ }
49
+ return /*#__PURE__*/React.createElement("div", {
50
+ className: "aui-suggestions-container",
51
+ ref: containerRef
52
+ }, displayedSuggestions.map(function (suggestion, index) {
53
+ return /*#__PURE__*/React.createElement(ThreadPrimitive.Suggestion, {
54
+ key: "suggestion-".concat(index),
55
+ prompt: suggestion.trim().replace("- ", ""),
56
+ method: "replace",
57
+ autoSend: true,
58
+ className: "aui-suggestion"
59
+ }, suggestion.trim().replace("- ", ""));
60
+ }));
61
+ };
62
+ export default Suggestions;
@@ -0,0 +1,22 @@
1
+ .aui-suggestions-container {
2
+ display: flex;
3
+ gap: 8px;
4
+ overflow-x: auto;
5
+ overflow-y: hidden;
6
+ white-space: nowrap;
7
+ width: 100%;
8
+ text-wrap: nowrap;
9
+ scrollbar-width: none;
10
+ z-index: 99;
11
+ padding-right: 20px;
12
+
13
+ button {
14
+ width: fit-content;
15
+ border-radius: 12px;
16
+ border: none;
17
+ padding: 3px 8px;
18
+ font-weight: normal;
19
+ font-size: 12px;
20
+ }
21
+ }
22
+