@hsafa/ui-sdk 0.4.2 → 0.4.4

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
@@ -172,9 +172,12 @@ interface HsafaChatProps {
172
172
  defaultReasoningOpen?: boolean;
173
173
  hideReasoningContent?: boolean;
174
174
  HsafaTools?: Record<string, HsafaTool>;
175
- dynamicPageTypes?: any[];
176
175
  componentAboveInput?: React__default.ComponentType<any>;
177
176
  editProcessContent?: EditProcessContent;
177
+ onStart?: (message: any) => void;
178
+ onFinish?: (message: any) => void;
179
+ currentChat?: string;
180
+ onChatChanged?: (chatId: string) => void;
178
181
  }
179
182
  type EditProcessContent = {
180
183
  title?: string;
@@ -198,140 +201,6 @@ declare function useFileUpload(baseUrl?: string): {
198
201
  MAX_UPLOAD_SIZE: number;
199
202
  };
200
203
 
201
- /**
202
- * Dynamic Page Types
203
- * Defines all types for the Dynamic Page system
204
- */
205
- interface DynamicPageGrid {
206
- gridTemplateColumns: string;
207
- gridTemplateRows: string;
208
- gap?: string;
209
- gridTemplateAreas?: string;
210
- }
211
- interface DynamicPageObjectMeta {
212
- title?: string;
213
- description?: string;
214
- tags?: string[];
215
- }
216
- interface DynamicPageObject {
217
- object_name: string;
218
- area?: string;
219
- data: any;
220
- type?: string;
221
- meta?: DynamicPageObjectMeta;
222
- version: number;
223
- updatedAt: string;
224
- }
225
- interface ComponentError {
226
- object_name: string;
227
- area: string;
228
- error: string;
229
- errorStack?: string | null;
230
- timestamp: string;
231
- type?: string;
232
- }
233
- interface DynamicPageState {
234
- grid: DynamicPageGrid | null;
235
- objects: Record<string, DynamicPageObject>;
236
- componentErrors?: ComponentError[];
237
- }
238
- interface DynamicPageTypeConfig {
239
- type: string;
240
- component: React.ComponentType<any>;
241
- description: string;
242
- variants?: string[];
243
- /** Optional Zod schema or JSON schema describing the expected data structure */
244
- schema?: any;
245
- /** Optional examples showing valid data for this type */
246
- examples?: any[];
247
- }
248
- interface ToolResult {
249
- success: boolean;
250
- message?: string;
251
- [key: string]: any;
252
- }
253
-
254
- /**
255
- * Dynamic Page Operations
256
- * All tool logic for managing dynamic pages
257
- */
258
-
259
- declare class DynamicPageOperations {
260
- private chatId;
261
- private state;
262
- private availableTypes;
263
- private onStateChange;
264
- constructor(chatId: string, state: DynamicPageState, availableTypes: DynamicPageTypeConfig[], onStateChange: (state: DynamicPageState) => void);
265
- private updateState;
266
- setGrid(params: {
267
- gridTemplateColumns: string;
268
- gridTemplateRows: string;
269
- gap?: string;
270
- gridTemplateAreas?: string;
271
- }): ToolResult;
272
- readGrid(): ToolResult;
273
- readAvailableTypes(): ToolResult;
274
- setObject(params: {
275
- object_name: string;
276
- area?: string;
277
- data: any;
278
- type?: string;
279
- meta?: {
280
- title?: string;
281
- description?: string;
282
- tags?: string[];
283
- };
284
- }): ToolResult;
285
- editObject(params: {
286
- object_name: string;
287
- json_patch?: any[];
288
- merge_patch?: any;
289
- replace_entire_data?: boolean;
290
- new_data?: any;
291
- options?: any;
292
- }): ToolResult;
293
- deleteObject(params: {
294
- object_name: string;
295
- }): ToolResult;
296
- readAllObjects(): ToolResult;
297
- readObject(params: {
298
- object_name: string;
299
- }): ToolResult;
300
- readAtPointer(params: {
301
- object_name: string;
302
- pointer?: string;
303
- }): ToolResult;
304
- renameObject(params: {
305
- current_name: string;
306
- new_name: string;
307
- new_area?: string;
308
- }): ToolResult;
309
- moveObject(params: {
310
- object_name: string;
311
- target_area: string;
312
- }): ToolResult;
313
- validateGrid(): ToolResult;
314
- readComponentErrors(params?: {
315
- limit?: number;
316
- }): ToolResult;
317
- clearComponentErrors(): ToolResult;
318
- private getRecentErrorsSummary;
319
- }
320
-
321
- /**
322
- * useDynamicPage Hook
323
- * Manages dynamic page state and operations
324
- */
325
-
326
- declare function useDynamicPage(chatIdParam: string, availableTypes: DynamicPageTypeConfig[]): {
327
- state: DynamicPageState;
328
- isDynamicPageOpen: boolean;
329
- getOperations: () => DynamicPageOperations | null;
330
- closeDynamicPage: () => void;
331
- openDynamicPage: () => void;
332
- handleError: (error: ComponentError) => void;
333
- };
334
-
335
204
  /**
336
205
  * useHsafaAgent - The main headless hook for Hsafa Agent
337
206
  *
@@ -366,7 +235,6 @@ declare function useDynamicPage(chatIdParam: string, availableTypes: DynamicPage
366
235
  * }
367
236
  * ```
368
237
  */
369
-
370
238
  interface UseHsafaAgentConfig {
371
239
  /** The agent ID to connect to */
372
240
  agentId: string;
@@ -376,8 +244,8 @@ interface UseHsafaAgentConfig {
376
244
  tools?: Record<string, any>;
377
245
  /** Custom UI components for rendering tool results */
378
246
  uiComponents?: Record<string, React.ComponentType<any>>;
379
- /** Dynamic page type configurations */
380
- dynamicPageTypes?: any[];
247
+ /** Callback when a message starts */
248
+ onStart?: (message: any) => void;
381
249
  /** Callback when a message finishes */
382
250
  onFinish?: (message: any) => void;
383
251
  /** Callback when an error occurs */
@@ -385,7 +253,11 @@ interface UseHsafaAgentConfig {
385
253
  /** Initial messages to load */
386
254
  initialMessages?: any[];
387
255
  /** Callback when messages change */
388
- onMessagesChange?: (messages: any[]) => void;
256
+ onMessagesChange?: (messages: any[], chatId?: string) => void;
257
+ /** Optional controlled chat id */
258
+ controlledChatId?: string;
259
+ /** Optional callback when chat id changes */
260
+ onChatIdChange?: (chatId: string) => void;
389
261
  }
390
262
  interface HsafaAgentAPI {
391
263
  /** Current input text */
@@ -411,6 +283,8 @@ interface HsafaAgentAPI {
411
283
  newChat: () => void;
412
284
  /** Set messages directly (for loading history) */
413
285
  setMessages: (messages: any[]) => void;
286
+ /** Notify that messages have changed (for edit operations) */
287
+ notifyMessagesChange: () => void;
414
288
  /** Direct access to the underlying chat API */
415
289
  chatApi: any;
416
290
  /** Current chat ID */
@@ -421,8 +295,6 @@ interface HsafaAgentAPI {
421
295
  tools: Record<string, any>;
422
296
  /** All available UI components */
423
297
  uiComponents: Record<string, any>;
424
- /** Dynamic page operations (if enabled) */
425
- dynamicPage: ReturnType<typeof useDynamicPage> | null;
426
298
  /** Ref to form host elements (for requestInput tool) */
427
299
  formHostRef: React.MutableRefObject<Map<string, HTMLDivElement>>;
428
300
  /** Ref to form state (for requestInput tool) */
@@ -695,12 +567,6 @@ interface HsafaContextValue extends HsafaConfig {
695
567
  currentChatId?: string;
696
568
  /** Setter for current chat id */
697
569
  setCurrentChatId: (chatId: string) => void;
698
- /** Dynamic page types registered by active chat */
699
- dynamicPageTypes: any[];
700
- /** Register dynamic page types from a chat */
701
- registerDynamicPageTypes: (chatId: string, types: any[]) => void;
702
- /** Unregister dynamic page types when chat unmounts */
703
- unregisterDynamicPageTypes: (chatId: string) => void;
704
570
  }
705
571
  /**
706
572
  * Props for the HsafaProvider component
@@ -737,10 +603,10 @@ declare function HsafaProvider({ baseUrl, dir, theme, children }: HsafaProviderP
737
603
  */
738
604
  declare function useHsafa(): HsafaContextValue;
739
605
 
740
- declare function HsafaChat({ agentId, theme, primaryColor, primaryColorDark, primaryColorLight, backgroundColor, borderColor, textColor, accentColor, baseUrl, initialMessages, onMessagesChange, defaultOpen, floatingButtonPosition, HsafaTools, HsafaUI, dynamicPageTypes, componentAboveInput, editProcessContent, }: HsafaChatProps & {
606
+ declare function HsafaChat({ agentId, theme, primaryColor, primaryColorDark, primaryColorLight, backgroundColor, borderColor, textColor, accentColor, baseUrl, initialMessages, onMessagesChange, defaultOpen, floatingButtonPosition, HsafaTools, HsafaUI, componentAboveInput, editProcessContent, onStart, onFinish, currentChat, onChatChanged, }: HsafaChatProps & {
741
607
  baseUrl?: string;
742
608
  initialMessages?: any[];
743
- onMessagesChange?: (messages: any[]) => void;
609
+ onMessagesChange?: (messages: any[], chatId?: string) => void;
744
610
  HsafaUI?: Record<string, React__default.ComponentType<any>>;
745
611
  }): react_jsx_runtime.JSX.Element;
746
612
 
@@ -759,7 +625,6 @@ interface ContentContainerProps {
759
625
  enableMargin?: boolean;
760
626
  chatWidth?: number | string;
761
627
  dir?: "ltr" | "rtl";
762
- onDynamicPageError?: (error: ComponentError) => void;
763
628
  }
764
629
  /**
765
630
  * ContentContainer component that wraps your content and applies animations
@@ -777,7 +642,7 @@ interface ContentContainerProps {
777
642
  * <ContentContainer theme="dark" enableBorderAnimation>
778
643
  * <YourApp />
779
644
  * </ContentContainer>
780
- * <HsafaChat agentId="agent-1" width={450} dynamicPageTypes={types} />
645
+ * <HsafaChat agentId="agent-1" width={450} />
781
646
  * </HsafaProvider>
782
647
  *
783
648
  * // With custom chat width and RTL support
@@ -790,7 +655,7 @@ interface ContentContainerProps {
790
655
  * >
791
656
  * <YourApp />
792
657
  * </ContentContainer>
793
- * <HsafaChat agentId="agent-1" width={450} dir="rtl" dynamicPageTypes={types} />
658
+ * <HsafaChat agentId="agent-1" width={450} dir="rtl" />
794
659
  * </HsafaProvider>
795
660
  *
796
661
  * // Disable margin (content stays full width)
@@ -798,11 +663,11 @@ interface ContentContainerProps {
798
663
  * <ContentContainer enableMargin={false}>
799
664
  * <YourApp />
800
665
  * </ContentContainer>
801
- * <HsafaChat agentId="agent-1" dynamicPageTypes={types} />
666
+ * <HsafaChat agentId="agent-1" />
802
667
  * </HsafaProvider>
803
668
  * ```
804
669
  */
805
- declare function ContentContainer({ children, theme, primaryColor, backgroundColor, borderColor, textColor, mutedTextColor, enableBorderAnimation, borderRadius, enableContentBorder, className, enableMargin, chatWidth, dir, onDynamicPageError, }: ContentContainerProps): react_jsx_runtime.JSX.Element;
670
+ declare function ContentContainer({ children, theme, primaryColor, backgroundColor, borderColor, textColor, mutedTextColor, enableBorderAnimation, borderRadius, enableContentBorder, className, enableMargin, chatWidth, dir, }: ContentContainerProps): react_jsx_runtime.JSX.Element;
806
671
 
807
672
  /**
808
673
  * Component Registry for custom UI components
@@ -1064,49 +929,4 @@ type FillResult = {
1064
929
  };
1065
930
  declare function FillActiveInput(value: any, options?: FillInputOptions): Promise<FillResult>;
1066
931
 
1067
- interface DynamicPageProps {
1068
- state: DynamicPageState;
1069
- typeConfigs: DynamicPageTypeConfig[];
1070
- theme?: 'dark' | 'light';
1071
- primaryColor?: string;
1072
- backgroundColor?: string;
1073
- borderColor?: string;
1074
- textColor?: string;
1075
- onError?: (error: ComponentError) => void;
1076
- }
1077
- declare function DynamicPage({ state, typeConfigs, theme, primaryColor, backgroundColor, borderColor, textColor, onError, }: DynamicPageProps): react_jsx_runtime.JSX.Element;
1078
-
1079
- declare function createDynamicPageTools(getOperations: () => DynamicPageOperations | null, _addToolResult?: (payload: any) => void): {
1080
- setGrid: (toolCall: any) => Promise<ToolResult>;
1081
- readGrid: (toolCall: any) => Promise<ToolResult>;
1082
- readAvailableTypes: () => Promise<ToolResult>;
1083
- setObject: {
1084
- executeEachToken: boolean;
1085
- tool: (toolCall: any) => Promise<ToolResult>;
1086
- };
1087
- editObject: {
1088
- executeEachToken: boolean;
1089
- tool: (toolCall: any) => Promise<ToolResult>;
1090
- };
1091
- deleteObject: (toolCall: any) => Promise<ToolResult>;
1092
- readAllObjects: () => Promise<ToolResult>;
1093
- readObject: (toolCall: any) => Promise<ToolResult>;
1094
- readAtPointer: (toolCall: any) => Promise<ToolResult>;
1095
- renameObject: (toolCall: any) => Promise<ToolResult>;
1096
- moveObject: (toolCall: any) => Promise<ToolResult>;
1097
- validateGrid: () => Promise<ToolResult>;
1098
- readComponentErrors: (toolCall: any) => Promise<ToolResult>;
1099
- clearComponentErrors: () => Promise<ToolResult>;
1100
- };
1101
-
1102
- /**
1103
- * Dynamic Page Storage
1104
- * Manages localStorage persistence for dynamic page data linked to chat ID
1105
- */
1106
-
1107
- declare function saveDynamicPageState(chatId: string, state: DynamicPageState): void;
1108
- declare function loadDynamicPageState(chatId: string): DynamicPageState | null;
1109
- declare function deleteDynamicPageState(chatId: string): void;
1110
- declare function dynamicPageExists(chatId: string): boolean;
1111
-
1112
- export { type Anchor, type Attachment, Button, type ButtonProps, type ChatMessage, type ChatMetadata, type ChatStorageAPI, type ComponentError, ContentContainer, type ContentContainerProps, CursorController, type CustomToolUIRenderProps, type DomComponent, DynamicPage, type DynamicPageGrid, type DynamicPageObject, type DynamicPageObjectMeta, DynamicPageOperations, type DynamicPageState, type DynamicPageTypeConfig, type EditProcessContent, FillActiveInput, type FillInputOptions, type FillResult, FloatingChatButton, type GetDomComponentsOptions, type GetDomComponentsResult, type GuideAction, type GuideCursorOptions, type GuideOptions, type GuideRunResult, type GuideStep, type GuideStepResult, type GuideTarget, type HsafaAgentAPI, HsafaChat, type HsafaChatProps, HsafaProvider, type HsafaTool, type MessageEditorAPI, type SavedChat, type ToolResult, type UIComponentProps, type UseChatStorageConfig, type UseHsafaAgentConfig, type UseMessageEditorConfig, registry as componentRegistry, guideCursor as controlCursor, createDynamicPageTools, deleteDynamicPageState, dynamicPageExists, getDomComponents, guideCursor, loadDynamicPageState, saveDynamicPageState, useAutoScroll, useChatStorage, useDynamicPage, useFileUpload, useHsafa, useHsafaAgent, useMessageEditor };
932
+ export { type Anchor, type Attachment, Button, type ButtonProps, type ChatMessage, type ChatMetadata, type ChatStorageAPI, ContentContainer, type ContentContainerProps, CursorController, type CustomToolUIRenderProps, type DomComponent, type EditProcessContent, FillActiveInput, type FillInputOptions, type FillResult, FloatingChatButton, type GetDomComponentsOptions, type GetDomComponentsResult, type GuideAction, type GuideCursorOptions, type GuideOptions, type GuideRunResult, type GuideStep, type GuideStepResult, type GuideTarget, type HsafaAgentAPI, HsafaChat, type HsafaChatProps, HsafaProvider, type HsafaTool, type MessageEditorAPI, type SavedChat, type UIComponentProps, type UseChatStorageConfig, type UseHsafaAgentConfig, type UseMessageEditorConfig, registry as componentRegistry, guideCursor as controlCursor, getDomComponents, guideCursor, useAutoScroll, useChatStorage, useFileUpload, useHsafa, useHsafaAgent, useMessageEditor };
package/dist/index.d.ts CHANGED
@@ -172,9 +172,12 @@ interface HsafaChatProps {
172
172
  defaultReasoningOpen?: boolean;
173
173
  hideReasoningContent?: boolean;
174
174
  HsafaTools?: Record<string, HsafaTool>;
175
- dynamicPageTypes?: any[];
176
175
  componentAboveInput?: React__default.ComponentType<any>;
177
176
  editProcessContent?: EditProcessContent;
177
+ onStart?: (message: any) => void;
178
+ onFinish?: (message: any) => void;
179
+ currentChat?: string;
180
+ onChatChanged?: (chatId: string) => void;
178
181
  }
179
182
  type EditProcessContent = {
180
183
  title?: string;
@@ -198,140 +201,6 @@ declare function useFileUpload(baseUrl?: string): {
198
201
  MAX_UPLOAD_SIZE: number;
199
202
  };
200
203
 
201
- /**
202
- * Dynamic Page Types
203
- * Defines all types for the Dynamic Page system
204
- */
205
- interface DynamicPageGrid {
206
- gridTemplateColumns: string;
207
- gridTemplateRows: string;
208
- gap?: string;
209
- gridTemplateAreas?: string;
210
- }
211
- interface DynamicPageObjectMeta {
212
- title?: string;
213
- description?: string;
214
- tags?: string[];
215
- }
216
- interface DynamicPageObject {
217
- object_name: string;
218
- area?: string;
219
- data: any;
220
- type?: string;
221
- meta?: DynamicPageObjectMeta;
222
- version: number;
223
- updatedAt: string;
224
- }
225
- interface ComponentError {
226
- object_name: string;
227
- area: string;
228
- error: string;
229
- errorStack?: string | null;
230
- timestamp: string;
231
- type?: string;
232
- }
233
- interface DynamicPageState {
234
- grid: DynamicPageGrid | null;
235
- objects: Record<string, DynamicPageObject>;
236
- componentErrors?: ComponentError[];
237
- }
238
- interface DynamicPageTypeConfig {
239
- type: string;
240
- component: React.ComponentType<any>;
241
- description: string;
242
- variants?: string[];
243
- /** Optional Zod schema or JSON schema describing the expected data structure */
244
- schema?: any;
245
- /** Optional examples showing valid data for this type */
246
- examples?: any[];
247
- }
248
- interface ToolResult {
249
- success: boolean;
250
- message?: string;
251
- [key: string]: any;
252
- }
253
-
254
- /**
255
- * Dynamic Page Operations
256
- * All tool logic for managing dynamic pages
257
- */
258
-
259
- declare class DynamicPageOperations {
260
- private chatId;
261
- private state;
262
- private availableTypes;
263
- private onStateChange;
264
- constructor(chatId: string, state: DynamicPageState, availableTypes: DynamicPageTypeConfig[], onStateChange: (state: DynamicPageState) => void);
265
- private updateState;
266
- setGrid(params: {
267
- gridTemplateColumns: string;
268
- gridTemplateRows: string;
269
- gap?: string;
270
- gridTemplateAreas?: string;
271
- }): ToolResult;
272
- readGrid(): ToolResult;
273
- readAvailableTypes(): ToolResult;
274
- setObject(params: {
275
- object_name: string;
276
- area?: string;
277
- data: any;
278
- type?: string;
279
- meta?: {
280
- title?: string;
281
- description?: string;
282
- tags?: string[];
283
- };
284
- }): ToolResult;
285
- editObject(params: {
286
- object_name: string;
287
- json_patch?: any[];
288
- merge_patch?: any;
289
- replace_entire_data?: boolean;
290
- new_data?: any;
291
- options?: any;
292
- }): ToolResult;
293
- deleteObject(params: {
294
- object_name: string;
295
- }): ToolResult;
296
- readAllObjects(): ToolResult;
297
- readObject(params: {
298
- object_name: string;
299
- }): ToolResult;
300
- readAtPointer(params: {
301
- object_name: string;
302
- pointer?: string;
303
- }): ToolResult;
304
- renameObject(params: {
305
- current_name: string;
306
- new_name: string;
307
- new_area?: string;
308
- }): ToolResult;
309
- moveObject(params: {
310
- object_name: string;
311
- target_area: string;
312
- }): ToolResult;
313
- validateGrid(): ToolResult;
314
- readComponentErrors(params?: {
315
- limit?: number;
316
- }): ToolResult;
317
- clearComponentErrors(): ToolResult;
318
- private getRecentErrorsSummary;
319
- }
320
-
321
- /**
322
- * useDynamicPage Hook
323
- * Manages dynamic page state and operations
324
- */
325
-
326
- declare function useDynamicPage(chatIdParam: string, availableTypes: DynamicPageTypeConfig[]): {
327
- state: DynamicPageState;
328
- isDynamicPageOpen: boolean;
329
- getOperations: () => DynamicPageOperations | null;
330
- closeDynamicPage: () => void;
331
- openDynamicPage: () => void;
332
- handleError: (error: ComponentError) => void;
333
- };
334
-
335
204
  /**
336
205
  * useHsafaAgent - The main headless hook for Hsafa Agent
337
206
  *
@@ -366,7 +235,6 @@ declare function useDynamicPage(chatIdParam: string, availableTypes: DynamicPage
366
235
  * }
367
236
  * ```
368
237
  */
369
-
370
238
  interface UseHsafaAgentConfig {
371
239
  /** The agent ID to connect to */
372
240
  agentId: string;
@@ -376,8 +244,8 @@ interface UseHsafaAgentConfig {
376
244
  tools?: Record<string, any>;
377
245
  /** Custom UI components for rendering tool results */
378
246
  uiComponents?: Record<string, React.ComponentType<any>>;
379
- /** Dynamic page type configurations */
380
- dynamicPageTypes?: any[];
247
+ /** Callback when a message starts */
248
+ onStart?: (message: any) => void;
381
249
  /** Callback when a message finishes */
382
250
  onFinish?: (message: any) => void;
383
251
  /** Callback when an error occurs */
@@ -385,7 +253,11 @@ interface UseHsafaAgentConfig {
385
253
  /** Initial messages to load */
386
254
  initialMessages?: any[];
387
255
  /** Callback when messages change */
388
- onMessagesChange?: (messages: any[]) => void;
256
+ onMessagesChange?: (messages: any[], chatId?: string) => void;
257
+ /** Optional controlled chat id */
258
+ controlledChatId?: string;
259
+ /** Optional callback when chat id changes */
260
+ onChatIdChange?: (chatId: string) => void;
389
261
  }
390
262
  interface HsafaAgentAPI {
391
263
  /** Current input text */
@@ -411,6 +283,8 @@ interface HsafaAgentAPI {
411
283
  newChat: () => void;
412
284
  /** Set messages directly (for loading history) */
413
285
  setMessages: (messages: any[]) => void;
286
+ /** Notify that messages have changed (for edit operations) */
287
+ notifyMessagesChange: () => void;
414
288
  /** Direct access to the underlying chat API */
415
289
  chatApi: any;
416
290
  /** Current chat ID */
@@ -421,8 +295,6 @@ interface HsafaAgentAPI {
421
295
  tools: Record<string, any>;
422
296
  /** All available UI components */
423
297
  uiComponents: Record<string, any>;
424
- /** Dynamic page operations (if enabled) */
425
- dynamicPage: ReturnType<typeof useDynamicPage> | null;
426
298
  /** Ref to form host elements (for requestInput tool) */
427
299
  formHostRef: React.MutableRefObject<Map<string, HTMLDivElement>>;
428
300
  /** Ref to form state (for requestInput tool) */
@@ -695,12 +567,6 @@ interface HsafaContextValue extends HsafaConfig {
695
567
  currentChatId?: string;
696
568
  /** Setter for current chat id */
697
569
  setCurrentChatId: (chatId: string) => void;
698
- /** Dynamic page types registered by active chat */
699
- dynamicPageTypes: any[];
700
- /** Register dynamic page types from a chat */
701
- registerDynamicPageTypes: (chatId: string, types: any[]) => void;
702
- /** Unregister dynamic page types when chat unmounts */
703
- unregisterDynamicPageTypes: (chatId: string) => void;
704
570
  }
705
571
  /**
706
572
  * Props for the HsafaProvider component
@@ -737,10 +603,10 @@ declare function HsafaProvider({ baseUrl, dir, theme, children }: HsafaProviderP
737
603
  */
738
604
  declare function useHsafa(): HsafaContextValue;
739
605
 
740
- declare function HsafaChat({ agentId, theme, primaryColor, primaryColorDark, primaryColorLight, backgroundColor, borderColor, textColor, accentColor, baseUrl, initialMessages, onMessagesChange, defaultOpen, floatingButtonPosition, HsafaTools, HsafaUI, dynamicPageTypes, componentAboveInput, editProcessContent, }: HsafaChatProps & {
606
+ declare function HsafaChat({ agentId, theme, primaryColor, primaryColorDark, primaryColorLight, backgroundColor, borderColor, textColor, accentColor, baseUrl, initialMessages, onMessagesChange, defaultOpen, floatingButtonPosition, HsafaTools, HsafaUI, componentAboveInput, editProcessContent, onStart, onFinish, currentChat, onChatChanged, }: HsafaChatProps & {
741
607
  baseUrl?: string;
742
608
  initialMessages?: any[];
743
- onMessagesChange?: (messages: any[]) => void;
609
+ onMessagesChange?: (messages: any[], chatId?: string) => void;
744
610
  HsafaUI?: Record<string, React__default.ComponentType<any>>;
745
611
  }): react_jsx_runtime.JSX.Element;
746
612
 
@@ -759,7 +625,6 @@ interface ContentContainerProps {
759
625
  enableMargin?: boolean;
760
626
  chatWidth?: number | string;
761
627
  dir?: "ltr" | "rtl";
762
- onDynamicPageError?: (error: ComponentError) => void;
763
628
  }
764
629
  /**
765
630
  * ContentContainer component that wraps your content and applies animations
@@ -777,7 +642,7 @@ interface ContentContainerProps {
777
642
  * <ContentContainer theme="dark" enableBorderAnimation>
778
643
  * <YourApp />
779
644
  * </ContentContainer>
780
- * <HsafaChat agentId="agent-1" width={450} dynamicPageTypes={types} />
645
+ * <HsafaChat agentId="agent-1" width={450} />
781
646
  * </HsafaProvider>
782
647
  *
783
648
  * // With custom chat width and RTL support
@@ -790,7 +655,7 @@ interface ContentContainerProps {
790
655
  * >
791
656
  * <YourApp />
792
657
  * </ContentContainer>
793
- * <HsafaChat agentId="agent-1" width={450} dir="rtl" dynamicPageTypes={types} />
658
+ * <HsafaChat agentId="agent-1" width={450} dir="rtl" />
794
659
  * </HsafaProvider>
795
660
  *
796
661
  * // Disable margin (content stays full width)
@@ -798,11 +663,11 @@ interface ContentContainerProps {
798
663
  * <ContentContainer enableMargin={false}>
799
664
  * <YourApp />
800
665
  * </ContentContainer>
801
- * <HsafaChat agentId="agent-1" dynamicPageTypes={types} />
666
+ * <HsafaChat agentId="agent-1" />
802
667
  * </HsafaProvider>
803
668
  * ```
804
669
  */
805
- declare function ContentContainer({ children, theme, primaryColor, backgroundColor, borderColor, textColor, mutedTextColor, enableBorderAnimation, borderRadius, enableContentBorder, className, enableMargin, chatWidth, dir, onDynamicPageError, }: ContentContainerProps): react_jsx_runtime.JSX.Element;
670
+ declare function ContentContainer({ children, theme, primaryColor, backgroundColor, borderColor, textColor, mutedTextColor, enableBorderAnimation, borderRadius, enableContentBorder, className, enableMargin, chatWidth, dir, }: ContentContainerProps): react_jsx_runtime.JSX.Element;
806
671
 
807
672
  /**
808
673
  * Component Registry for custom UI components
@@ -1064,49 +929,4 @@ type FillResult = {
1064
929
  };
1065
930
  declare function FillActiveInput(value: any, options?: FillInputOptions): Promise<FillResult>;
1066
931
 
1067
- interface DynamicPageProps {
1068
- state: DynamicPageState;
1069
- typeConfigs: DynamicPageTypeConfig[];
1070
- theme?: 'dark' | 'light';
1071
- primaryColor?: string;
1072
- backgroundColor?: string;
1073
- borderColor?: string;
1074
- textColor?: string;
1075
- onError?: (error: ComponentError) => void;
1076
- }
1077
- declare function DynamicPage({ state, typeConfigs, theme, primaryColor, backgroundColor, borderColor, textColor, onError, }: DynamicPageProps): react_jsx_runtime.JSX.Element;
1078
-
1079
- declare function createDynamicPageTools(getOperations: () => DynamicPageOperations | null, _addToolResult?: (payload: any) => void): {
1080
- setGrid: (toolCall: any) => Promise<ToolResult>;
1081
- readGrid: (toolCall: any) => Promise<ToolResult>;
1082
- readAvailableTypes: () => Promise<ToolResult>;
1083
- setObject: {
1084
- executeEachToken: boolean;
1085
- tool: (toolCall: any) => Promise<ToolResult>;
1086
- };
1087
- editObject: {
1088
- executeEachToken: boolean;
1089
- tool: (toolCall: any) => Promise<ToolResult>;
1090
- };
1091
- deleteObject: (toolCall: any) => Promise<ToolResult>;
1092
- readAllObjects: () => Promise<ToolResult>;
1093
- readObject: (toolCall: any) => Promise<ToolResult>;
1094
- readAtPointer: (toolCall: any) => Promise<ToolResult>;
1095
- renameObject: (toolCall: any) => Promise<ToolResult>;
1096
- moveObject: (toolCall: any) => Promise<ToolResult>;
1097
- validateGrid: () => Promise<ToolResult>;
1098
- readComponentErrors: (toolCall: any) => Promise<ToolResult>;
1099
- clearComponentErrors: () => Promise<ToolResult>;
1100
- };
1101
-
1102
- /**
1103
- * Dynamic Page Storage
1104
- * Manages localStorage persistence for dynamic page data linked to chat ID
1105
- */
1106
-
1107
- declare function saveDynamicPageState(chatId: string, state: DynamicPageState): void;
1108
- declare function loadDynamicPageState(chatId: string): DynamicPageState | null;
1109
- declare function deleteDynamicPageState(chatId: string): void;
1110
- declare function dynamicPageExists(chatId: string): boolean;
1111
-
1112
- export { type Anchor, type Attachment, Button, type ButtonProps, type ChatMessage, type ChatMetadata, type ChatStorageAPI, type ComponentError, ContentContainer, type ContentContainerProps, CursorController, type CustomToolUIRenderProps, type DomComponent, DynamicPage, type DynamicPageGrid, type DynamicPageObject, type DynamicPageObjectMeta, DynamicPageOperations, type DynamicPageState, type DynamicPageTypeConfig, type EditProcessContent, FillActiveInput, type FillInputOptions, type FillResult, FloatingChatButton, type GetDomComponentsOptions, type GetDomComponentsResult, type GuideAction, type GuideCursorOptions, type GuideOptions, type GuideRunResult, type GuideStep, type GuideStepResult, type GuideTarget, type HsafaAgentAPI, HsafaChat, type HsafaChatProps, HsafaProvider, type HsafaTool, type MessageEditorAPI, type SavedChat, type ToolResult, type UIComponentProps, type UseChatStorageConfig, type UseHsafaAgentConfig, type UseMessageEditorConfig, registry as componentRegistry, guideCursor as controlCursor, createDynamicPageTools, deleteDynamicPageState, dynamicPageExists, getDomComponents, guideCursor, loadDynamicPageState, saveDynamicPageState, useAutoScroll, useChatStorage, useDynamicPage, useFileUpload, useHsafa, useHsafaAgent, useMessageEditor };
932
+ export { type Anchor, type Attachment, Button, type ButtonProps, type ChatMessage, type ChatMetadata, type ChatStorageAPI, ContentContainer, type ContentContainerProps, CursorController, type CustomToolUIRenderProps, type DomComponent, type EditProcessContent, FillActiveInput, type FillInputOptions, type FillResult, FloatingChatButton, type GetDomComponentsOptions, type GetDomComponentsResult, type GuideAction, type GuideCursorOptions, type GuideOptions, type GuideRunResult, type GuideStep, type GuideStepResult, type GuideTarget, type HsafaAgentAPI, HsafaChat, type HsafaChatProps, HsafaProvider, type HsafaTool, type MessageEditorAPI, type SavedChat, type UIComponentProps, type UseChatStorageConfig, type UseHsafaAgentConfig, type UseMessageEditorConfig, registry as componentRegistry, guideCursor as controlCursor, getDomComponents, guideCursor, useAutoScroll, useChatStorage, useFileUpload, useHsafa, useHsafaAgent, useMessageEditor };