vanilla-agent 1.7.2 → 1.8.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.
package/dist/index.d.cts CHANGED
@@ -108,6 +108,7 @@ type AgentWidgetActionParser = (input: AgentWidgetActionParserInput) => AgentWid
108
108
  type AgentWidgetActionHandlerResult = {
109
109
  handled?: boolean;
110
110
  displayText?: string;
111
+ persistMessage?: boolean;
111
112
  };
112
113
  type AgentWidgetActionContext = {
113
114
  message: AgentWidgetMessage;
@@ -134,11 +135,25 @@ type AgentWidgetActionEventPayload = {
134
135
  action: AgentWidgetParsedAction;
135
136
  message: AgentWidgetMessage;
136
137
  };
138
+ type AgentWidgetStateEvent = {
139
+ open: boolean;
140
+ source: "user" | "auto" | "api" | "system";
141
+ timestamp: number;
142
+ };
143
+ type AgentWidgetStateSnapshot = {
144
+ open: boolean;
145
+ launcherEnabled: boolean;
146
+ voiceActive: boolean;
147
+ streaming: boolean;
148
+ };
137
149
  type AgentWidgetControllerEventMap = {
138
150
  "assistant:message": AgentWidgetMessage;
139
151
  "assistant:complete": AgentWidgetMessage;
140
152
  "voice:state": AgentWidgetVoiceStateEvent;
141
153
  "action:detected": AgentWidgetActionEventPayload;
154
+ "widget:opened": AgentWidgetStateEvent;
155
+ "widget:closed": AgentWidgetStateEvent;
156
+ "widget:state": AgentWidgetStateSnapshot;
142
157
  };
143
158
  type AgentWidgetFeatureFlags = {
144
159
  showReasoning?: boolean;
@@ -291,6 +306,12 @@ type AgentWidgetToolCallConfig = {
291
306
  toggleTextColor?: string;
292
307
  labelTextColor?: string;
293
308
  };
309
+ type AgentWidgetSuggestionChipsConfig = {
310
+ fontFamily?: "sans-serif" | "serif" | "mono";
311
+ fontWeight?: string;
312
+ paddingX?: string;
313
+ paddingY?: string;
314
+ };
294
315
  /**
295
316
  * Interface for pluggable stream parsers that extract text from streaming responses.
296
317
  * Parsers handle incremental parsing to extract text values from structured formats (JSON, XML, etc.).
@@ -357,6 +378,7 @@ type AgentWidgetConfig = {
357
378
  launcher?: AgentWidgetLauncherConfig;
358
379
  initialMessages?: AgentWidgetMessage[];
359
380
  suggestionChips?: string[];
381
+ suggestionChipsConfig?: AgentWidgetSuggestionChipsConfig;
360
382
  debug?: boolean;
361
383
  formEndpoint?: string;
362
384
  launcherWidth?: string;
@@ -564,6 +586,9 @@ type Controller = {
564
586
  updatePersistentMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
565
587
  on: <K extends keyof AgentWidgetControllerEventMap>(event: K, handler: (payload: AgentWidgetControllerEventMap[K]) => void) => () => void;
566
588
  off: <K extends keyof AgentWidgetControllerEventMap>(event: K, handler: (payload: AgentWidgetControllerEventMap[K]) => void) => void;
589
+ isOpen: () => boolean;
590
+ isVoiceActive: () => boolean;
591
+ getState: () => AgentWidgetStateSnapshot;
567
592
  };
568
593
  declare const createAgentExperience: (mount: HTMLElement, initialConfig?: AgentWidgetConfig, runtimeOptions?: {
569
594
  debugTools?: boolean;
@@ -613,7 +638,10 @@ type ActionManagerOptions = {
613
638
  declare const defaultJsonActionParser: AgentWidgetActionParser;
614
639
  declare const defaultActionHandlers: Record<string, AgentWidgetActionHandler>;
615
640
  declare const createActionManager: (options: ActionManagerOptions) => {
616
- process: (context: ActionManagerProcessContext) => string | null;
641
+ process: (context: ActionManagerProcessContext) => {
642
+ text: string;
643
+ persist: boolean;
644
+ } | null;
617
645
  syncFromMetadata: () => void;
618
646
  };
619
647
 
package/dist/index.d.ts CHANGED
@@ -108,6 +108,7 @@ type AgentWidgetActionParser = (input: AgentWidgetActionParserInput) => AgentWid
108
108
  type AgentWidgetActionHandlerResult = {
109
109
  handled?: boolean;
110
110
  displayText?: string;
111
+ persistMessage?: boolean;
111
112
  };
112
113
  type AgentWidgetActionContext = {
113
114
  message: AgentWidgetMessage;
@@ -134,11 +135,25 @@ type AgentWidgetActionEventPayload = {
134
135
  action: AgentWidgetParsedAction;
135
136
  message: AgentWidgetMessage;
136
137
  };
138
+ type AgentWidgetStateEvent = {
139
+ open: boolean;
140
+ source: "user" | "auto" | "api" | "system";
141
+ timestamp: number;
142
+ };
143
+ type AgentWidgetStateSnapshot = {
144
+ open: boolean;
145
+ launcherEnabled: boolean;
146
+ voiceActive: boolean;
147
+ streaming: boolean;
148
+ };
137
149
  type AgentWidgetControllerEventMap = {
138
150
  "assistant:message": AgentWidgetMessage;
139
151
  "assistant:complete": AgentWidgetMessage;
140
152
  "voice:state": AgentWidgetVoiceStateEvent;
141
153
  "action:detected": AgentWidgetActionEventPayload;
154
+ "widget:opened": AgentWidgetStateEvent;
155
+ "widget:closed": AgentWidgetStateEvent;
156
+ "widget:state": AgentWidgetStateSnapshot;
142
157
  };
143
158
  type AgentWidgetFeatureFlags = {
144
159
  showReasoning?: boolean;
@@ -291,6 +306,12 @@ type AgentWidgetToolCallConfig = {
291
306
  toggleTextColor?: string;
292
307
  labelTextColor?: string;
293
308
  };
309
+ type AgentWidgetSuggestionChipsConfig = {
310
+ fontFamily?: "sans-serif" | "serif" | "mono";
311
+ fontWeight?: string;
312
+ paddingX?: string;
313
+ paddingY?: string;
314
+ };
294
315
  /**
295
316
  * Interface for pluggable stream parsers that extract text from streaming responses.
296
317
  * Parsers handle incremental parsing to extract text values from structured formats (JSON, XML, etc.).
@@ -357,6 +378,7 @@ type AgentWidgetConfig = {
357
378
  launcher?: AgentWidgetLauncherConfig;
358
379
  initialMessages?: AgentWidgetMessage[];
359
380
  suggestionChips?: string[];
381
+ suggestionChipsConfig?: AgentWidgetSuggestionChipsConfig;
360
382
  debug?: boolean;
361
383
  formEndpoint?: string;
362
384
  launcherWidth?: string;
@@ -564,6 +586,9 @@ type Controller = {
564
586
  updatePersistentMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
565
587
  on: <K extends keyof AgentWidgetControllerEventMap>(event: K, handler: (payload: AgentWidgetControllerEventMap[K]) => void) => () => void;
566
588
  off: <K extends keyof AgentWidgetControllerEventMap>(event: K, handler: (payload: AgentWidgetControllerEventMap[K]) => void) => void;
589
+ isOpen: () => boolean;
590
+ isVoiceActive: () => boolean;
591
+ getState: () => AgentWidgetStateSnapshot;
567
592
  };
568
593
  declare const createAgentExperience: (mount: HTMLElement, initialConfig?: AgentWidgetConfig, runtimeOptions?: {
569
594
  debugTools?: boolean;
@@ -613,7 +638,10 @@ type ActionManagerOptions = {
613
638
  declare const defaultJsonActionParser: AgentWidgetActionParser;
614
639
  declare const defaultActionHandlers: Record<string, AgentWidgetActionHandler>;
615
640
  declare const createActionManager: (options: ActionManagerOptions) => {
616
- process: (context: ActionManagerProcessContext) => string | null;
641
+ process: (context: ActionManagerProcessContext) => {
642
+ text: string;
643
+ persist: boolean;
644
+ } | null;
617
645
  syncFromMetadata: () => void;
618
646
  };
619
647