@syncagent/react 0.1.7 → 0.1.9

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.mts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, CSSProperties } from 'react';
3
- import { SyncAgentConfig, SyncAgentClient, Message } from '@syncagent/js';
3
+ import { SyncAgentConfig, SyncAgentClient, ToolData, Message } from '@syncagent/js';
4
4
  export { ChatOptions, Message, SyncAgentClient, SyncAgentConfig, ToolDefinition, ToolParameter } from '@syncagent/js';
5
5
 
6
6
  declare function SyncAgentProvider({ config, children, }: {
@@ -11,6 +11,10 @@ declare function useSyncAgentClient(): SyncAgentClient;
11
11
 
12
12
  interface UseSyncAgentOptions {
13
13
  client?: SyncAgentClient;
14
+ /** Extra context injected into every message */
15
+ context?: Record<string, any>;
16
+ /** Called when a DB tool returns structured data */
17
+ onData?: (data: ToolData) => void;
14
18
  }
15
19
  declare function useSyncAgent(options?: UseSyncAgentOptions): {
16
20
  messages: Message[];
@@ -20,6 +24,7 @@ declare function useSyncAgent(options?: UseSyncAgentOptions): {
20
24
  step: string;
21
25
  label: string;
22
26
  } | null;
27
+ lastData: ToolData | null;
23
28
  sendMessage: (content: string) => Promise<void>;
24
29
  stop: () => void;
25
30
  reset: () => void;
@@ -38,6 +43,14 @@ interface SyncAgentChatProps {
38
43
  className?: string;
39
44
  style?: CSSProperties;
40
45
  suggestions?: string[];
46
+ /** Unique key for localStorage persistence */
47
+ persistKey?: string;
48
+ /** Extra context injected into every message */
49
+ context?: Record<string, any>;
50
+ /** Called when user reacts to a message */
51
+ onReaction?: (messageIndex: number, reaction: "up" | "down", content: string) => void;
52
+ /** Called when a DB tool returns structured data */
53
+ onData?: (data: ToolData) => void;
41
54
  }
42
55
  declare function SyncAgentChat({ config, ...props }: SyncAgentChatProps): react_jsx_runtime.JSX.Element;
43
56
 
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react_jsx_runtime from 'react/jsx-runtime';
2
2
  import { ReactNode, CSSProperties } from 'react';
3
- import { SyncAgentConfig, SyncAgentClient, Message } from '@syncagent/js';
3
+ import { SyncAgentConfig, SyncAgentClient, ToolData, Message } from '@syncagent/js';
4
4
  export { ChatOptions, Message, SyncAgentClient, SyncAgentConfig, ToolDefinition, ToolParameter } from '@syncagent/js';
5
5
 
6
6
  declare function SyncAgentProvider({ config, children, }: {
@@ -11,6 +11,10 @@ declare function useSyncAgentClient(): SyncAgentClient;
11
11
 
12
12
  interface UseSyncAgentOptions {
13
13
  client?: SyncAgentClient;
14
+ /** Extra context injected into every message */
15
+ context?: Record<string, any>;
16
+ /** Called when a DB tool returns structured data */
17
+ onData?: (data: ToolData) => void;
14
18
  }
15
19
  declare function useSyncAgent(options?: UseSyncAgentOptions): {
16
20
  messages: Message[];
@@ -20,6 +24,7 @@ declare function useSyncAgent(options?: UseSyncAgentOptions): {
20
24
  step: string;
21
25
  label: string;
22
26
  } | null;
27
+ lastData: ToolData | null;
23
28
  sendMessage: (content: string) => Promise<void>;
24
29
  stop: () => void;
25
30
  reset: () => void;
@@ -38,6 +43,14 @@ interface SyncAgentChatProps {
38
43
  className?: string;
39
44
  style?: CSSProperties;
40
45
  suggestions?: string[];
46
+ /** Unique key for localStorage persistence */
47
+ persistKey?: string;
48
+ /** Extra context injected into every message */
49
+ context?: Record<string, any>;
50
+ /** Called when user reacts to a message */
51
+ onReaction?: (messageIndex: number, reaction: "up" | "down", content: string) => void;
52
+ /** Called when a DB tool returns structured data */
53
+ onData?: (data: ToolData) => void;
41
54
  }
42
55
  declare function SyncAgentChat({ config, ...props }: SyncAgentChatProps): react_jsx_runtime.JSX.Element;
43
56