@automattic/agenttic-client 0.1.25 → 0.1.27
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/client/index.d.ts.map +1 -1
- package/dist/client/types/index.d.ts +10 -8
- package/dist/client/types/index.d.ts.map +1 -1
- package/dist/client/utils/internal/requests.d.ts.map +1 -1
- package/dist/client/utils/internal/streaming.d.ts.map +1 -1
- package/dist/index.d.ts +5 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1191 -817
- package/dist/react/agentManager.d.ts +4 -0
- package/dist/react/agentManager.d.ts.map +1 -1
- package/dist/react/conversationStorage.d.ts +35 -2
- package/dist/react/conversationStorage.d.ts.map +1 -1
- package/dist/react/odieConfig.d.ts +51 -0
- package/dist/react/odieConfig.d.ts.map +1 -0
- package/dist/react/odieService.d.ts +36 -0
- package/dist/react/odieService.d.ts.map +1 -0
- package/dist/react/serverTypes.d.ts +91 -0
- package/dist/react/serverTypes.d.ts.map +1 -0
- package/dist/react/useAgentChat.d.ts +5 -1
- package/dist/react/useAgentChat.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -5,6 +5,8 @@ import type { Client, ClientConfig, Message, SendMessageParams, Task, TaskUpdate
|
|
|
5
5
|
export interface AgentManagerConfig extends ClientConfig {
|
|
6
6
|
key?: string;
|
|
7
7
|
sessionId?: string;
|
|
8
|
+
/** localStorage key where sessionId is persisted (for cache) */
|
|
9
|
+
sessionIdStorageKey?: string;
|
|
8
10
|
}
|
|
9
11
|
/**
|
|
10
12
|
* Agent manager interface
|
|
@@ -17,7 +19,9 @@ export interface AgentManager {
|
|
|
17
19
|
sendMessage: (key: string, message: string, options?: Partial<SendMessageParams>) => Promise<Task>;
|
|
18
20
|
sendMessageStream: (key: string, message: string, options?: Partial<SendMessageParams>) => AsyncIterable<TaskUpdate>;
|
|
19
21
|
resetConversation: (key: string) => Promise<void>;
|
|
22
|
+
replaceMessages: (key: string, messages: Message[]) => Promise<void>;
|
|
20
23
|
getConversationHistory: (key: string) => Message[];
|
|
24
|
+
updateSessionId: (key: string, sessionId: string) => void;
|
|
21
25
|
abortCurrentRequest: (key: string) => void;
|
|
22
26
|
clear: () => void;
|
|
23
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"agentManager.d.ts","sourceRoot":"","sources":["../../src/react/agentManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"agentManager.d.ts","sourceRoot":"","sources":["../../src/react/agentManager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,MAAM,EACN,YAAY,EACZ,OAAO,EACP,iBAAiB,EACjB,IAAI,EACJ,UAAU,EACV,MAAM,uBAAuB,CAAC;AAuH/B;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,YAAY;IACvD,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gEAAgE;IAChE,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC7B;AAeD;;GAEG;AACH,MAAM,WAAW,YAAY;IAC5B,WAAW,EAAE,CACZ,GAAG,EAAE,MAAM,EACX,MAAM,EAAE,kBAAkB,KACtB,OAAO,CAAE,MAAM,CAAE,CAAC;IACvB,QAAQ,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,MAAM,GAAG,IAAI,CAAC;IAC3C,QAAQ,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,OAAO,CAAC;IACrC,WAAW,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,OAAO,CAAC;IACxC,WAAW,EAAE,CACZ,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,CAAE,iBAAiB,CAAE,KAClC,OAAO,CAAE,IAAI,CAAE,CAAC;IACrB,iBAAiB,EAAE,CAClB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,OAAO,CAAE,iBAAiB,CAAE,KAClC,aAAa,CAAE,UAAU,CAAE,CAAC;IACjC,iBAAiB,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,OAAO,CAAE,IAAI,CAAE,CAAC;IACtD,eAAe,EAAE,CAAE,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,EAAE,KAAM,OAAO,CAAE,IAAI,CAAE,CAAC;IACzE,sBAAsB,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,OAAO,EAAE,CAAC;IACrD,eAAe,EAAE,CAAE,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAM,IAAI,CAAC;IAC5D,mBAAmB,EAAE,CAAE,GAAG,EAAE,MAAM,KAAM,IAAI,CAAC;IAC7C,KAAK,EAAE,MAAM,IAAI,CAAC;CAClB;AAsjBD;;GAEG;AACH,wBAAgB,eAAe,IAAI,YAAY,CAE9C"}
|
|
@@ -1,4 +1,19 @@
|
|
|
1
|
-
import type { Message } from '../client/types/index';
|
|
1
|
+
import type { AuthProvider, Message } from '../client/types/index';
|
|
2
|
+
import type { PaginationMeta } from './serverTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for conversation storage
|
|
5
|
+
*/
|
|
6
|
+
export interface ConversationStorageConfig {
|
|
7
|
+
odieBotId?: string;
|
|
8
|
+
authProvider?: AuthProvider;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Result from loading conversation with pagination info
|
|
12
|
+
*/
|
|
13
|
+
export interface ConversationLoadResult {
|
|
14
|
+
messages: Message[];
|
|
15
|
+
pagination?: PaginationMeta;
|
|
16
|
+
}
|
|
2
17
|
/**
|
|
3
18
|
* Store conversation messages for a session
|
|
4
19
|
* @param sessionId - The session ID to store messages for
|
|
@@ -10,8 +25,26 @@ export declare function storeConversation(sessionId: string, messages: Message[]
|
|
|
10
25
|
* Load conversation messages for a session
|
|
11
26
|
* @param sessionId - The session ID to load messages for
|
|
12
27
|
* @param conversationStorageKey - Optional custom storage key, defaults to sessionId
|
|
28
|
+
* @param config - Optional storage configuration for server-based loading
|
|
29
|
+
*/
|
|
30
|
+
export declare function loadConversation(sessionId: string, conversationStorageKey?: string, config?: ConversationStorageConfig): Promise<ConversationLoadResult>;
|
|
31
|
+
/**
|
|
32
|
+
* Load more messages from server (pagination support)
|
|
33
|
+
* Only works with server storage mode
|
|
34
|
+
*
|
|
35
|
+
* Note: The caller should check pagination.hasMore from the previous load
|
|
36
|
+
* before calling this function to avoid unnecessary API calls.
|
|
37
|
+
*
|
|
38
|
+
* @param sessionId - The session/chat ID to load
|
|
39
|
+
* @param page - Page number to load (should be validated by caller against pagination data)
|
|
40
|
+
* @param config - Server storage configuration
|
|
41
|
+
* @example
|
|
42
|
+
* const { messages, pagination } = await loadConversation(sessionId, undefined, config);
|
|
43
|
+
* if (pagination?.hasMore) {
|
|
44
|
+
* const moreMessages = await loadMoreMessages(sessionId, pagination.currentPage + 1, config);
|
|
45
|
+
* }
|
|
13
46
|
*/
|
|
14
|
-
export declare function
|
|
47
|
+
export declare function loadMoreMessages(sessionId: string, page: number, config: ConversationStorageConfig): Promise<ConversationLoadResult>;
|
|
15
48
|
/**
|
|
16
49
|
* Clear conversation for a session
|
|
17
50
|
* @param sessionId - The session ID to clear
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conversationStorage.d.ts","sourceRoot":"","sources":["../../src/react/conversationStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"conversationStorage.d.ts","sourceRoot":"","sources":["../../src/react/conversationStorage.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,YAAY,EAGZ,OAAO,EAEP,MAAM,uBAAuB,CAAC;AAQ/B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAIpD;;GAEG;AACH,MAAM,WAAW,yBAAyB;IACzC,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACtC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,CAAC,EAAE,cAAc,CAAC;CAC5B;AAwKD;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,QAAQ,EAAE,OAAO,EAAE,EACnB,sBAAsB,CAAC,EAAE,MAAM,GAC7B,OAAO,CAAE,IAAI,CAAE,CA2CjB;AAED;;;;;GAKG;AACH,wBAAsB,gBAAgB,CACrC,SAAS,EAAE,MAAM,EACjB,sBAAsB,CAAC,EAAE,MAAM,EAC/B,MAAM,CAAC,EAAE,yBAAyB,GAChC,OAAO,CAAE,sBAAsB,CAAE,CAWnC;AAwGD;;;;;;;;;;;;;;;GAeG;AACH,wBAAsB,gBAAgB,CACrC,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,yBAAyB,GAC/B,OAAO,CAAE,sBAAsB,CAAE,CA0CnC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACtC,SAAS,EAAE,MAAM,EACjB,sBAAsB,CAAC,EAAE,MAAM,GAC7B,OAAO,CAAE,IAAI,CAAE,CAsBjB;AAED;;GAEG;AACH,wBAAsB,qBAAqB,IAAI,OAAO,CAAE,IAAI,CAAE,CA+B7D;AAED;;GAEG;AACH,wBAAsB,mBAAmB,IAAI,OAAO,CAAE,MAAM,EAAE,CAAE,CA8B/D"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Utilities for working with Odie bot IDs and configuration
|
|
3
|
+
*/
|
|
4
|
+
export interface OdieBotConfig {
|
|
5
|
+
product: string;
|
|
6
|
+
type: 'agent' | 'workflow' | 'chain';
|
|
7
|
+
slug: string;
|
|
8
|
+
agentId: string;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Create an Odie bot ID from an agent ID.
|
|
12
|
+
* Converts agent ID format (with hyphens) to bot ID format.
|
|
13
|
+
*
|
|
14
|
+
* @param agentId - The agent ID (e.g., 'wp-orchestrator')
|
|
15
|
+
* @param type - Bot type (default: 'agent')
|
|
16
|
+
* @param product - Product name (default: 'wpcom')
|
|
17
|
+
* @return Full Odie bot ID (e.g., 'wpcom-agent-wp_orchestrator')
|
|
18
|
+
* @example
|
|
19
|
+
* createOdieBotId('wp-orchestrator')
|
|
20
|
+
* // Returns: 'wpcom-agent-wp_orchestrator'
|
|
21
|
+
*
|
|
22
|
+
* createOdieBotId('my-bot', 'workflow', 'myproduct')
|
|
23
|
+
* // Returns: 'myproduct-workflow-my_bot'
|
|
24
|
+
*/
|
|
25
|
+
export declare function createOdieBotId(agentId: string, type?: 'agent' | 'workflow' | 'chain', product?: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Parse an Odie bot ID back into its components.
|
|
28
|
+
*
|
|
29
|
+
* @param odieBotId - The full Odie bot ID (e.g., 'wpcom-agent-wp_orchestrator')
|
|
30
|
+
* @return Parsed bot configuration with all components
|
|
31
|
+
* @example
|
|
32
|
+
* parseOdieBotId('wpcom-agent-wp_orchestrator')
|
|
33
|
+
* // Returns: {
|
|
34
|
+
* // product: 'wpcom',
|
|
35
|
+
* // type: 'agent',
|
|
36
|
+
* // slug: 'wp_orchestrator',
|
|
37
|
+
* // agentId: 'wp-orchestrator'
|
|
38
|
+
* // }
|
|
39
|
+
*/
|
|
40
|
+
export declare function parseOdieBotId(odieBotId: string): OdieBotConfig;
|
|
41
|
+
/**
|
|
42
|
+
* Check if a string is a valid Odie bot ID format.
|
|
43
|
+
*
|
|
44
|
+
* @param value - String to check
|
|
45
|
+
* @return True if valid Odie bot ID format
|
|
46
|
+
* @example
|
|
47
|
+
* isOdieBotId('wpcom-agent-wp_orchestrator') // true
|
|
48
|
+
* isOdieBotId('just-a-string') // false
|
|
49
|
+
*/
|
|
50
|
+
export declare function isOdieBotId(value: string): boolean;
|
|
51
|
+
//# sourceMappingURL=odieConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odieConfig.d.ts","sourceRoot":"","sources":["../../src/react/odieConfig.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,aAAa;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,OAAO,GAAG,UAAU,GAAG,OAAO,CAAC;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,eAAe,CAC9B,OAAO,EAAE,MAAM,EACf,IAAI,GAAE,OAAO,GAAG,UAAU,GAAG,OAAiB,EAC9C,OAAO,GAAE,MAAgB,GACvB,MAAM,CAMR;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,cAAc,CAAE,SAAS,EAAE,MAAM,GAAI,aAAa,CAgCjE;AAED;;;;;;;;GAQG;AACH,wBAAgB,WAAW,CAAE,KAAK,EAAE,MAAM,GAAI,OAAO,CAWpD"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service for loading conversations from WordPress.com odie-assistant API
|
|
3
|
+
*/
|
|
4
|
+
import type { AuthProvider } from '../client/types/index';
|
|
5
|
+
import type { ServerConversationListItem, ServerLoadResult } from './serverTypes';
|
|
6
|
+
export interface OdieServiceConfig {
|
|
7
|
+
botId: string;
|
|
8
|
+
apiBaseUrl?: string;
|
|
9
|
+
authProvider?: AuthProvider;
|
|
10
|
+
}
|
|
11
|
+
export declare const DEFAULT_API_BASE_URL = "https://public-api.wordpress.com";
|
|
12
|
+
/**
|
|
13
|
+
* Load conversation messages from the server
|
|
14
|
+
* @param chatId - The chat/session ID to load
|
|
15
|
+
* @param config - Service configuration
|
|
16
|
+
* @param pageNumber - Page number to load (default: 1)
|
|
17
|
+
* @param itemsPerPage - Items per page (default: 50, max: 100)
|
|
18
|
+
*/
|
|
19
|
+
export declare function loadChatFromServer(chatId: string, config: OdieServiceConfig, pageNumber?: number, itemsPerPage?: number): Promise<ServerLoadResult>;
|
|
20
|
+
/**
|
|
21
|
+
* List available conversations from server
|
|
22
|
+
* Useful for testing and debugging - lists recent conversations for a bot
|
|
23
|
+
* @param botId - The bot ID to get conversations for
|
|
24
|
+
* @param config - Service configuration (omit botId, will use parameter)
|
|
25
|
+
* @return Array of conversation list items
|
|
26
|
+
*/
|
|
27
|
+
export declare function listConversationsFromServer(botId: string, config: Omit<OdieServiceConfig, 'botId'>): Promise<ServerConversationListItem[]>;
|
|
28
|
+
/**
|
|
29
|
+
* Load multiple pages of messages and combine them
|
|
30
|
+
* Useful for loading entire conversation history
|
|
31
|
+
* @param chatId - The chat/session ID to load
|
|
32
|
+
* @param config - Service configuration
|
|
33
|
+
* @param maxPages - Maximum number of pages to load (default: 10)
|
|
34
|
+
*/
|
|
35
|
+
export declare function loadAllMessagesFromServer(chatId: string, config: OdieServiceConfig, maxPages?: number): Promise<ServerLoadResult>;
|
|
36
|
+
//# sourceMappingURL=odieService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"odieService.d.ts","sourceRoot":"","sources":["../../src/react/odieService.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAC1D,OAAO,KAAK,EAEX,0BAA0B,EAC1B,gBAAgB,EAChB,MAAM,eAAe,CAAC;AAIvB,MAAM,WAAW,iBAAiB;IACjC,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,YAAY,CAAC,EAAE,YAAY,CAAC;CAC5B;AAED,eAAO,MAAM,oBAAoB,qCAAqC,CAAC;AAEvE;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACvC,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,iBAAiB,EACzB,UAAU,GAAE,MAAU,EACtB,YAAY,GAAE,MAAW,GACvB,OAAO,CAAE,gBAAgB,CAAE,CAsG7B;AAED;;;;;;GAMG;AACH,wBAAsB,2BAA2B,CAChD,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,IAAI,CAAE,iBAAiB,EAAE,OAAO,CAAE,GACxC,OAAO,CAAE,0BAA0B,EAAE,CAAE,CA+DzC;AAED;;;;;;GAMG;AACH,wBAAsB,yBAAyB,CAC9C,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,iBAAiB,EACzB,QAAQ,GAAE,MAAW,GACnB,OAAO,CAAE,gBAAgB,CAAE,CA+C7B"}
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Server-side conversation storage types
|
|
3
|
+
* Maps to odie-assistant.php endpoints on WordPress.com
|
|
4
|
+
*/
|
|
5
|
+
import type { Message } from '../client/types/index';
|
|
6
|
+
/**
|
|
7
|
+
* Server message format from odie-assistant API
|
|
8
|
+
* Matches the structure returned by get_chat_with_messages()
|
|
9
|
+
*/
|
|
10
|
+
export interface ServerMessage {
|
|
11
|
+
message_id: number;
|
|
12
|
+
chat_id?: number;
|
|
13
|
+
role: 'user' | 'bot' | 'system' | 'tool_call' | 'tool_result';
|
|
14
|
+
content: string;
|
|
15
|
+
context?: Record<string, unknown> | any[];
|
|
16
|
+
created_at: string;
|
|
17
|
+
ts?: number;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Server chat/conversation format
|
|
21
|
+
* Matches the structure returned by get_chat_with_messages()
|
|
22
|
+
*/
|
|
23
|
+
export interface ServerChat {
|
|
24
|
+
chat_id: number;
|
|
25
|
+
bot_id: string;
|
|
26
|
+
wpcom_user_id?: number;
|
|
27
|
+
session_id?: string;
|
|
28
|
+
messages: ServerMessage[];
|
|
29
|
+
metadata?: {
|
|
30
|
+
total_messages: number;
|
|
31
|
+
current_page: number;
|
|
32
|
+
items_per_page: number;
|
|
33
|
+
total_pages: number;
|
|
34
|
+
};
|
|
35
|
+
created_at: string;
|
|
36
|
+
updated_at: string;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Pagination metadata for server responses
|
|
40
|
+
*/
|
|
41
|
+
export interface PaginationMeta {
|
|
42
|
+
currentPage: number;
|
|
43
|
+
itemsPerPage: number;
|
|
44
|
+
totalPages: number;
|
|
45
|
+
totalMessages: number;
|
|
46
|
+
hasMore: boolean;
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Result of loading messages from server
|
|
50
|
+
*/
|
|
51
|
+
export interface ServerLoadResult {
|
|
52
|
+
messages: Message[];
|
|
53
|
+
pagination: PaginationMeta;
|
|
54
|
+
chatId: number;
|
|
55
|
+
sessionId?: string;
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Conversation list item from server
|
|
59
|
+
* Represents a chat with metadata and latest message preview
|
|
60
|
+
*/
|
|
61
|
+
export interface ServerConversationListItem {
|
|
62
|
+
chat_id: number;
|
|
63
|
+
bot_id?: string;
|
|
64
|
+
wpcom_user_id?: number;
|
|
65
|
+
session_id?: string;
|
|
66
|
+
created_at: string;
|
|
67
|
+
last_message?: {
|
|
68
|
+
content: string;
|
|
69
|
+
role: 'user' | 'bot' | 'system';
|
|
70
|
+
created_at: string;
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Transform server message to client Message format
|
|
75
|
+
* @param serverMessage - Server message from odie-assistant API
|
|
76
|
+
*/
|
|
77
|
+
export declare function serverMessageToMessage(serverMessage: ServerMessage): Message;
|
|
78
|
+
/**
|
|
79
|
+
* Transform server chat response to client format
|
|
80
|
+
* @param serverChat - Server chat from odie-assistant API
|
|
81
|
+
*/
|
|
82
|
+
export declare function serverChatToLoadResult(serverChat: ServerChat): ServerLoadResult;
|
|
83
|
+
/**
|
|
84
|
+
* Error thrown when server conversation loading fails
|
|
85
|
+
*/
|
|
86
|
+
export declare class ServerConversationError extends Error {
|
|
87
|
+
readonly statusCode?: number | undefined;
|
|
88
|
+
readonly details?: unknown | undefined;
|
|
89
|
+
constructor(message: string, statusCode?: number | undefined, details?: unknown | undefined);
|
|
90
|
+
}
|
|
91
|
+
//# sourceMappingURL=serverTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"serverTypes.d.ts","sourceRoot":"","sources":["../../src/react/serverTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,OAAO,EAAkB,MAAM,uBAAuB,CAAC;AAGrE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,WAAW,GAAG,aAAa,CAAC;IAC9D,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAE,MAAM,EAAE,OAAO,CAAE,GAAG,GAAG,EAAE,CAAC;IAC5C,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,MAAM,CAAC;CACZ;AAED;;;GAGG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,aAAa,EAAE,CAAC;IAC1B,QAAQ,CAAC,EAAE;QACV,cAAc,EAAE,MAAM,CAAC;QACvB,YAAY,EAAE,MAAM,CAAC;QACrB,cAAc,EAAE,MAAM,CAAC;QACvB,WAAW,EAAE,MAAM,CAAC;KACpB,CAAC;IACF,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,OAAO,EAAE,OAAO,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAChC,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,UAAU,EAAE,cAAc,CAAC;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,0BAA0B;IAC1C,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,YAAY,CAAC,EAAE;QACd,OAAO,EAAE,MAAM,CAAC;QAChB,IAAI,EAAE,MAAM,GAAG,KAAK,GAAG,QAAQ,CAAC;QAChC,UAAU,EAAE,MAAM,CAAC;KACnB,CAAC;CACF;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,aAAa,EAAE,aAAa,GAC1B,OAAO,CAsCT;AAED;;;GAGG;AACH,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,UAAU,GACpB,gBAAgB,CAwBlB;AAED;;GAEG;AACH,qBAAa,uBAAwB,SAAQ,KAAK;aAGhC,UAAU,CAAC,EAAE,MAAM;aACnB,OAAO,CAAC,EAAE,OAAO;gBAFjC,OAAO,EAAE,MAAM,EACC,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,OAAO,CAAC,EAAE,OAAO,YAAA;CAKlC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type React from 'react';
|
|
2
2
|
import type { ReactNode } from 'react';
|
|
3
|
-
import type { AuthProvider, ContentType, ContextProvider, ToolProvider } from '../client/types/index';
|
|
3
|
+
import type { AuthProvider, Message as ClientMessage, ContentType, ContextProvider, ToolProvider } from '../client/types/index';
|
|
4
4
|
export interface Suggestion {
|
|
5
5
|
id: string;
|
|
6
6
|
label: string;
|
|
@@ -10,6 +10,7 @@ export interface Suggestion {
|
|
|
10
10
|
export interface SubmitOptions {
|
|
11
11
|
type?: ContentType;
|
|
12
12
|
archived?: boolean;
|
|
13
|
+
sessionId?: string;
|
|
13
14
|
}
|
|
14
15
|
export interface UIMessage {
|
|
15
16
|
id: string;
|
|
@@ -61,10 +62,12 @@ export interface UseAgentChatConfig {
|
|
|
61
62
|
agentId: string;
|
|
62
63
|
agentUrl: string;
|
|
63
64
|
sessionId: string;
|
|
65
|
+
sessionIdStorageKey?: string;
|
|
64
66
|
contextProvider?: ContextProvider;
|
|
65
67
|
toolProvider?: ToolProvider;
|
|
66
68
|
authProvider?: AuthProvider;
|
|
67
69
|
enableStreaming?: boolean;
|
|
70
|
+
odieBotId?: string;
|
|
68
71
|
}
|
|
69
72
|
export interface UseAgentChatReturn {
|
|
70
73
|
messages: UIMessage[];
|
|
@@ -79,6 +82,7 @@ export interface UseAgentChatReturn {
|
|
|
79
82
|
clearAllMessageActions: () => void;
|
|
80
83
|
addMessage: (message: UIMessage) => void;
|
|
81
84
|
abortCurrentRequest: () => void;
|
|
85
|
+
loadMessages: (messages: ClientMessage[]) => Promise<void>;
|
|
82
86
|
}
|
|
83
87
|
/**
|
|
84
88
|
* React hook for agent chat functionality
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useAgentChat.d.ts","sourceRoot":"","sources":["../../src/react/useAgentChat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAGvC,OAAO,KAAK,EACX,YAAY,
|
|
1
|
+
{"version":3,"file":"useAgentChat.d.ts","sourceRoot":"","sources":["../../src/react/useAgentChat.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,O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