vanilla-agent 1.31.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.d.cts CHANGED
@@ -1090,6 +1090,37 @@ type AgentWidgetConfig = {
1090
1090
  * ```
1091
1091
  */
1092
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;
1093
1124
  /**
1094
1125
  * Static headers to include with each request.
1095
1126
  * For dynamic headers (e.g., auth tokens), use `getHeaders` instead.
@@ -1771,8 +1802,8 @@ type ActionManagerProcessContext = {
1771
1802
  type ActionManagerOptions = {
1772
1803
  parsers: AgentWidgetActionParser[];
1773
1804
  handlers: AgentWidgetActionHandler[];
1774
- getMetadata: () => Record<string, unknown>;
1775
- updateMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
1805
+ getSessionMetadata: () => Record<string, unknown>;
1806
+ updateSessionMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
1776
1807
  emit: <K extends keyof AgentWidgetControllerEventMap>(event: K, payload: AgentWidgetControllerEventMap[K]) => void;
1777
1808
  documentRef: Document | null;
1778
1809
  };
package/dist/index.d.ts CHANGED
@@ -1090,6 +1090,37 @@ type AgentWidgetConfig = {
1090
1090
  * ```
1091
1091
  */
1092
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;
1093
1124
  /**
1094
1125
  * Static headers to include with each request.
1095
1126
  * For dynamic headers (e.g., auth tokens), use `getHeaders` instead.
@@ -1771,8 +1802,8 @@ type ActionManagerProcessContext = {
1771
1802
  type ActionManagerOptions = {
1772
1803
  parsers: AgentWidgetActionParser[];
1773
1804
  handlers: AgentWidgetActionHandler[];
1774
- getMetadata: () => Record<string, unknown>;
1775
- updateMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
1805
+ getSessionMetadata: () => Record<string, unknown>;
1806
+ updateSessionMetadata: (updater: (prev: Record<string, unknown>) => Record<string, unknown>) => void;
1776
1807
  emit: <K extends keyof AgentWidgetControllerEventMap>(event: K, payload: AgentWidgetControllerEventMap[K]) => void;
1777
1808
  documentRef: Document | null;
1778
1809
  };