vanilla-agent 0.1.0 → 1.0.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.
@@ -572,6 +572,10 @@
572
572
  width: 360px;
573
573
  }
574
574
 
575
+ .tvw-w-\[400px\] {
576
+ width: 400px;
577
+ }
578
+
575
579
  .tvw-h-\[640px\] {
576
580
  height: 640px;
577
581
  }
@@ -687,6 +691,35 @@ form:focus-within textarea {
687
691
  opacity: 1;
688
692
  }
689
693
 
694
+ /* Clear chat button tooltip */
695
+ .tvw-clear-chat-button-wrapper {
696
+ position: relative;
697
+ display: inline-flex;
698
+ align-items: center;
699
+ justify-content: center;
700
+ }
701
+
702
+ .tvw-clear-chat-tooltip {
703
+ background-color: #111827;
704
+ color: #ffffff;
705
+ padding: 6px 12px;
706
+ border-radius: 0.5rem;
707
+ font-size: 12px;
708
+ white-space: nowrap;
709
+ pointer-events: none;
710
+ z-index: 10000;
711
+ }
712
+
713
+ .tvw-clear-chat-tooltip-arrow {
714
+ content: "";
715
+ position: absolute;
716
+ top: 100%;
717
+ left: 50%;
718
+ transform: translateX(-50%);
719
+ border: 4px solid transparent;
720
+ border-top-color: #111827;
721
+ }
722
+
690
723
  /* Typing indicator animation */
691
724
  @keyframes typing {
692
725
  0%, 100% {
package/src/types.ts CHANGED
@@ -1,11 +1,11 @@
1
- import type { ChatWidgetPlugin } from "./plugins/types";
1
+ import type { AgentWidgetPlugin } from "./plugins/types";
2
2
 
3
- export type ChatWidgetFeatureFlags = {
3
+ export type AgentWidgetFeatureFlags = {
4
4
  showReasoning?: boolean;
5
5
  showToolCalls?: boolean;
6
6
  };
7
7
 
8
- export type ChatWidgetTheme = {
8
+ export type AgentWidgetTheme = {
9
9
  primary?: string;
10
10
  secondary?: string;
11
11
  surface?: string;
@@ -24,6 +24,9 @@ export type ChatWidgetTheme = {
24
24
  closeButtonColor?: string;
25
25
  closeButtonBackgroundColor?: string;
26
26
  closeButtonBorderColor?: string;
27
+ clearChatIconColor?: string;
28
+ clearChatBackgroundColor?: string;
29
+ clearChatBorderColor?: string;
27
30
  micIconColor?: string;
28
31
  micBackgroundColor?: string;
29
32
  micBorderColor?: string;
@@ -39,7 +42,7 @@ export type ChatWidgetTheme = {
39
42
  buttonRadius?: string;
40
43
  };
41
44
 
42
- export type ChatWidgetLauncherConfig = {
45
+ export type AgentWidgetLauncherConfig = {
43
46
  enabled?: boolean;
44
47
  title?: string;
45
48
  subtitle?: string;
@@ -68,10 +71,17 @@ export type ChatWidgetLauncherConfig = {
68
71
  closeButtonBorderWidth?: string;
69
72
  closeButtonBorderColor?: string;
70
73
  closeButtonBorderRadius?: string;
74
+ closeButtonPaddingX?: string;
75
+ closeButtonPaddingY?: string;
71
76
  closeButtonPlacement?: "inline" | "top-right";
77
+ closeButtonIconName?: string;
78
+ closeButtonIconText?: string;
79
+ closeButtonTooltipText?: string;
80
+ closeButtonShowTooltip?: boolean;
81
+ clearChat?: AgentWidgetClearChatConfig;
72
82
  };
73
83
 
74
- export type ChatWidgetSendButtonConfig = {
84
+ export type AgentWidgetSendButtonConfig = {
75
85
  borderWidth?: string;
76
86
  borderColor?: string;
77
87
  paddingX?: string;
@@ -86,7 +96,22 @@ export type ChatWidgetSendButtonConfig = {
86
96
  size?: string;
87
97
  };
88
98
 
89
- export type ChatWidgetStatusIndicatorConfig = {
99
+ export type AgentWidgetClearChatConfig = {
100
+ enabled?: boolean;
101
+ iconName?: string;
102
+ iconColor?: string;
103
+ backgroundColor?: string;
104
+ borderWidth?: string;
105
+ borderColor?: string;
106
+ borderRadius?: string;
107
+ size?: string;
108
+ paddingX?: string;
109
+ paddingY?: string;
110
+ tooltipText?: string;
111
+ showTooltip?: boolean;
112
+ };
113
+
114
+ export type AgentWidgetStatusIndicatorConfig = {
90
115
  visible?: boolean;
91
116
  idleText?: string;
92
117
  connectingText?: string;
@@ -94,7 +119,7 @@ export type ChatWidgetStatusIndicatorConfig = {
94
119
  errorText?: string;
95
120
  };
96
121
 
97
- export type ChatWidgetVoiceRecognitionConfig = {
122
+ export type AgentWidgetVoiceRecognitionConfig = {
98
123
  enabled?: boolean;
99
124
  pauseDuration?: number;
100
125
  iconName?: string;
@@ -113,7 +138,7 @@ export type ChatWidgetVoiceRecognitionConfig = {
113
138
  showRecordingIndicator?: boolean;
114
139
  };
115
140
 
116
- export type ChatWidgetConfig = {
141
+ export type AgentWidgetConfig = {
117
142
  apiUrl?: string;
118
143
  flowId?: string;
119
144
  headers?: Record<string, string>;
@@ -123,28 +148,28 @@ export type ChatWidgetConfig = {
123
148
  inputPlaceholder?: string;
124
149
  sendButtonLabel?: string;
125
150
  };
126
- theme?: ChatWidgetTheme;
127
- features?: ChatWidgetFeatureFlags;
128
- launcher?: ChatWidgetLauncherConfig;
129
- initialMessages?: ChatWidgetMessage[];
151
+ theme?: AgentWidgetTheme;
152
+ features?: AgentWidgetFeatureFlags;
153
+ launcher?: AgentWidgetLauncherConfig;
154
+ initialMessages?: AgentWidgetMessage[];
130
155
  suggestionChips?: string[];
131
156
  debug?: boolean;
132
157
  formEndpoint?: string;
133
158
  launcherWidth?: string;
134
- sendButton?: ChatWidgetSendButtonConfig;
135
- statusIndicator?: ChatWidgetStatusIndicatorConfig;
136
- voiceRecognition?: ChatWidgetVoiceRecognitionConfig;
159
+ sendButton?: AgentWidgetSendButtonConfig;
160
+ statusIndicator?: AgentWidgetStatusIndicatorConfig;
161
+ voiceRecognition?: AgentWidgetVoiceRecognitionConfig;
137
162
  postprocessMessage?: (context: {
138
163
  text: string;
139
- message: ChatWidgetMessage;
164
+ message: AgentWidgetMessage;
140
165
  streaming: boolean;
141
166
  }) => string;
142
- plugins?: ChatWidgetPlugin[];
167
+ plugins?: AgentWidgetPlugin[];
143
168
  };
144
169
 
145
- export type ChatWidgetMessageRole = "user" | "assistant" | "system";
170
+ export type AgentWidgetMessageRole = "user" | "assistant" | "system";
146
171
 
147
- export type ChatWidgetReasoning = {
172
+ export type AgentWidgetReasoning = {
148
173
  id: string;
149
174
  status: "pending" | "streaming" | "complete";
150
175
  chunks: string[];
@@ -153,7 +178,7 @@ export type ChatWidgetReasoning = {
153
178
  durationMs?: number;
154
179
  };
155
180
 
156
- export type ChatWidgetToolCall = {
181
+ export type AgentWidgetToolCall = {
157
182
  id: string;
158
183
  name?: string;
159
184
  status: "pending" | "running" | "complete";
@@ -166,29 +191,29 @@ export type ChatWidgetToolCall = {
166
191
  durationMs?: number;
167
192
  };
168
193
 
169
- export type ChatWidgetMessageVariant = "assistant" | "reasoning" | "tool";
194
+ export type AgentWidgetMessageVariant = "assistant" | "reasoning" | "tool";
170
195
 
171
- export type ChatWidgetMessage = {
196
+ export type AgentWidgetMessage = {
172
197
  id: string;
173
- role: ChatWidgetMessageRole;
198
+ role: AgentWidgetMessageRole;
174
199
  content: string;
175
200
  createdAt: string;
176
201
  streaming?: boolean;
177
- variant?: ChatWidgetMessageVariant;
202
+ variant?: AgentWidgetMessageVariant;
178
203
  sequence?: number;
179
- reasoning?: ChatWidgetReasoning;
180
- toolCall?: ChatWidgetToolCall;
181
- tools?: ChatWidgetToolCall[];
204
+ reasoning?: AgentWidgetReasoning;
205
+ toolCall?: AgentWidgetToolCall;
206
+ tools?: AgentWidgetToolCall[];
182
207
  };
183
208
 
184
- export type ChatWidgetEvent =
185
- | { type: "message"; message: ChatWidgetMessage }
209
+ export type AgentWidgetEvent =
210
+ | { type: "message"; message: AgentWidgetMessage }
186
211
  | { type: "status"; status: "connecting" | "connected" | "error" | "idle" }
187
212
  | { type: "error"; error: Error };
188
213
 
189
- export type ChatWidgetInitOptions = {
214
+ export type AgentWidgetInitOptions = {
190
215
  target: string | HTMLElement;
191
- config?: ChatWidgetConfig;
216
+ config?: AgentWidgetConfig;
192
217
  useShadowDom?: boolean;
193
218
  onReady?: () => void;
194
219
  };