vanilla-agent 1.30.0 → 1.32.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.cjs +21 -21
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +46 -2
- package/dist/index.d.ts +46 -2
- package/dist/index.global.js +44 -44
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +21 -21
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +25 -6
- package/src/components/panel.ts +19 -2
- package/src/components/reasoning-bubble.ts +30 -23
- package/src/components/tool-bubble.ts +31 -23
- package/src/types.ts +44 -0
- package/src/ui.ts +94 -10
- package/src/utils/actions.ts +7 -7
package/dist/index.d.cts
CHANGED
|
@@ -767,6 +767,19 @@ type AgentWidgetLayoutConfig = {
|
|
|
767
767
|
messages?: AgentWidgetMessageLayoutConfig;
|
|
768
768
|
/** Slot renderers for custom content injection */
|
|
769
769
|
slots?: Partial<Record<WidgetLayoutSlot, SlotRenderer>>;
|
|
770
|
+
/**
|
|
771
|
+
* Show/hide the header section entirely.
|
|
772
|
+
* When false, the header (including icon, title, buttons) is completely hidden.
|
|
773
|
+
* @default true
|
|
774
|
+
*/
|
|
775
|
+
showHeader?: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Show/hide the footer/composer section entirely.
|
|
778
|
+
* When false, the footer (including input field, send button, suggestions) is completely hidden.
|
|
779
|
+
* Useful for read-only conversation previews.
|
|
780
|
+
* @default true
|
|
781
|
+
*/
|
|
782
|
+
showFooter?: boolean;
|
|
770
783
|
};
|
|
771
784
|
/**
|
|
772
785
|
* Token types for marked renderer methods
|
|
@@ -1077,6 +1090,37 @@ type AgentWidgetConfig = {
|
|
|
1077
1090
|
* ```
|
|
1078
1091
|
*/
|
|
1079
1092
|
onSessionExpired?: () => void;
|
|
1093
|
+
/**
|
|
1094
|
+
* Get stored session ID for session resumption (client token mode only).
|
|
1095
|
+
* Called when initializing a new session to check if there's a previous session_id
|
|
1096
|
+
* that should be passed to /client/init to resume the same conversation record.
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* config: {
|
|
1101
|
+
* getStoredSessionId: () => {
|
|
1102
|
+
* const stored = localStorage.getItem('session_id');
|
|
1103
|
+
* return stored || null;
|
|
1104
|
+
* }
|
|
1105
|
+
* }
|
|
1106
|
+
* ```
|
|
1107
|
+
*/
|
|
1108
|
+
getStoredSessionId?: () => string | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* Store session ID for session resumption (client token mode only).
|
|
1111
|
+
* Called when a new session is initialized to persist the session_id
|
|
1112
|
+
* so it can be used to resume the conversation later.
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* ```typescript
|
|
1116
|
+
* config: {
|
|
1117
|
+
* setStoredSessionId: (sessionId) => {
|
|
1118
|
+
* localStorage.setItem('session_id', sessionId);
|
|
1119
|
+
* }
|
|
1120
|
+
* }
|
|
1121
|
+
* ```
|
|
1122
|
+
*/
|
|
1123
|
+
setStoredSessionId?: (sessionId: string) => void;
|
|
1080
1124
|
/**
|
|
1081
1125
|
* Static headers to include with each request.
|
|
1082
1126
|
* For dynamic headers (e.g., auth tokens), use `getHeaders` instead.
|
|
@@ -1758,8 +1802,8 @@ type ActionManagerProcessContext = {
|
|
|
1758
1802
|
type ActionManagerOptions = {
|
|
1759
1803
|
parsers: AgentWidgetActionParser[];
|
|
1760
1804
|
handlers: AgentWidgetActionHandler[];
|
|
1761
|
-
|
|
1762
|
-
|
|
1805
|
+
getSessionMetadata: () => Record<string, unknown>;
|
|
1806
|
+
updateSessionMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
1763
1807
|
emit: <K extends keyof AgentWidgetControllerEventMap>(event: K, payload: AgentWidgetControllerEventMap[K]) => void;
|
|
1764
1808
|
documentRef: Document | null;
|
|
1765
1809
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -767,6 +767,19 @@ type AgentWidgetLayoutConfig = {
|
|
|
767
767
|
messages?: AgentWidgetMessageLayoutConfig;
|
|
768
768
|
/** Slot renderers for custom content injection */
|
|
769
769
|
slots?: Partial<Record<WidgetLayoutSlot, SlotRenderer>>;
|
|
770
|
+
/**
|
|
771
|
+
* Show/hide the header section entirely.
|
|
772
|
+
* When false, the header (including icon, title, buttons) is completely hidden.
|
|
773
|
+
* @default true
|
|
774
|
+
*/
|
|
775
|
+
showHeader?: boolean;
|
|
776
|
+
/**
|
|
777
|
+
* Show/hide the footer/composer section entirely.
|
|
778
|
+
* When false, the footer (including input field, send button, suggestions) is completely hidden.
|
|
779
|
+
* Useful for read-only conversation previews.
|
|
780
|
+
* @default true
|
|
781
|
+
*/
|
|
782
|
+
showFooter?: boolean;
|
|
770
783
|
};
|
|
771
784
|
/**
|
|
772
785
|
* Token types for marked renderer methods
|
|
@@ -1077,6 +1090,37 @@ type AgentWidgetConfig = {
|
|
|
1077
1090
|
* ```
|
|
1078
1091
|
*/
|
|
1079
1092
|
onSessionExpired?: () => void;
|
|
1093
|
+
/**
|
|
1094
|
+
* Get stored session ID for session resumption (client token mode only).
|
|
1095
|
+
* Called when initializing a new session to check if there's a previous session_id
|
|
1096
|
+
* that should be passed to /client/init to resume the same conversation record.
|
|
1097
|
+
*
|
|
1098
|
+
* @example
|
|
1099
|
+
* ```typescript
|
|
1100
|
+
* config: {
|
|
1101
|
+
* getStoredSessionId: () => {
|
|
1102
|
+
* const stored = localStorage.getItem('session_id');
|
|
1103
|
+
* return stored || null;
|
|
1104
|
+
* }
|
|
1105
|
+
* }
|
|
1106
|
+
* ```
|
|
1107
|
+
*/
|
|
1108
|
+
getStoredSessionId?: () => string | null;
|
|
1109
|
+
/**
|
|
1110
|
+
* Store session ID for session resumption (client token mode only).
|
|
1111
|
+
* Called when a new session is initialized to persist the session_id
|
|
1112
|
+
* so it can be used to resume the conversation later.
|
|
1113
|
+
*
|
|
1114
|
+
* @example
|
|
1115
|
+
* ```typescript
|
|
1116
|
+
* config: {
|
|
1117
|
+
* setStoredSessionId: (sessionId) => {
|
|
1118
|
+
* localStorage.setItem('session_id', sessionId);
|
|
1119
|
+
* }
|
|
1120
|
+
* }
|
|
1121
|
+
* ```
|
|
1122
|
+
*/
|
|
1123
|
+
setStoredSessionId?: (sessionId: string) => void;
|
|
1080
1124
|
/**
|
|
1081
1125
|
* Static headers to include with each request.
|
|
1082
1126
|
* For dynamic headers (e.g., auth tokens), use `getHeaders` instead.
|
|
@@ -1758,8 +1802,8 @@ type ActionManagerProcessContext = {
|
|
|
1758
1802
|
type ActionManagerOptions = {
|
|
1759
1803
|
parsers: AgentWidgetActionParser[];
|
|
1760
1804
|
handlers: AgentWidgetActionHandler[];
|
|
1761
|
-
|
|
1762
|
-
|
|
1805
|
+
getSessionMetadata: () => Record<string, unknown>;
|
|
1806
|
+
updateSessionMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
|
|
1763
1807
|
emit: <K extends keyof AgentWidgetControllerEventMap>(event: K, payload: AgentWidgetControllerEventMap[K]) => void;
|
|
1764
1808
|
documentRef: Document | null;
|
|
1765
1809
|
};
|