@economic/agents-react 1.4.4 → 1.5.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.mts +4 -1
- package/dist/index.mjs +6 -1
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -13,6 +13,7 @@ type ChatSummary = {
|
|
|
13
13
|
name: string;
|
|
14
14
|
title?: string;
|
|
15
15
|
summary?: string;
|
|
16
|
+
title_set_by_user?: number;
|
|
16
17
|
created_at: number;
|
|
17
18
|
updated_at: number;
|
|
18
19
|
};
|
|
@@ -29,6 +30,7 @@ type GetChatsHandler = () => Promise<ChatSummary[]>;
|
|
|
29
30
|
type CreateChatHandler = () => Promise<string>;
|
|
30
31
|
type OpenChatHandler = (chatId: string) => void;
|
|
31
32
|
type DeleteChatHandler = (chatId: string) => Promise<void>;
|
|
33
|
+
type RenameChatHandler = (chatId: string, title: string) => Promise<void>;
|
|
32
34
|
//#endregion
|
|
33
35
|
//#region src/useAgent.d.ts
|
|
34
36
|
interface UseAgentReturn {
|
|
@@ -76,6 +78,7 @@ interface Assistant {
|
|
|
76
78
|
createChat: CreateChatHandler;
|
|
77
79
|
openChat: OpenChatHandler;
|
|
78
80
|
deleteChat: DeleteChatHandler;
|
|
81
|
+
renameChat: RenameChatHandler;
|
|
79
82
|
}
|
|
80
83
|
interface UseAssistantReturn {
|
|
81
84
|
currentChatName: string | undefined;
|
|
@@ -89,4 +92,4 @@ interface UseAssistantOptions<ToolContext extends Record<string, unknown> = Reco
|
|
|
89
92
|
}
|
|
90
93
|
declare function useAssistant<ToolContext extends Record<string, unknown>>(options: UseAssistantOptions<ToolContext>): UseAssistantReturn;
|
|
91
94
|
//#endregion
|
|
92
|
-
export { type Agent, type AgentConnectionStatus, type AgentConnectionType, type Assistant, type Chat, type ChatSummary, type CreateChatHandler, type DeleteChatHandler, type GetChatsHandler, type GetMessageFeedbackHandler, type MessageFeedback, type MessageFeedbackHandler, type OpenChatHandler, type UseAgentReturn, type UseAssistantReturn, type UseChatReturn, getToolApproval, getToolCallId, getToolPartState, useAgent, useAssistant, useChat };
|
|
95
|
+
export { type Agent, type AgentConnectionStatus, type AgentConnectionType, type Assistant, type Chat, type ChatSummary, type CreateChatHandler, type DeleteChatHandler, type GetChatsHandler, type GetMessageFeedbackHandler, type MessageFeedback, type MessageFeedbackHandler, type OpenChatHandler, type RenameChatHandler, type UseAgentReturn, type UseAssistantReturn, type UseChatReturn, getToolApproval, getToolCallId, getToolPartState, useAgent, useAssistant, useChat };
|
package/dist/index.mjs
CHANGED
|
@@ -170,6 +170,10 @@ function useAssistant(options) {
|
|
|
170
170
|
setChatId(void 0);
|
|
171
171
|
await refreshChats();
|
|
172
172
|
};
|
|
173
|
+
const renameChat = async (chatId, title) => {
|
|
174
|
+
await assistant.call("renameChat", [chatId, title]);
|
|
175
|
+
await refreshChats();
|
|
176
|
+
};
|
|
173
177
|
const isChatEnabled = !!chatId && !!subAgentName;
|
|
174
178
|
const isChatReady = isChatEnabled && assistantStatus === "connected";
|
|
175
179
|
const chat = useChat({
|
|
@@ -192,7 +196,8 @@ function useAssistant(options) {
|
|
|
192
196
|
getChats,
|
|
193
197
|
createChat,
|
|
194
198
|
openChat,
|
|
195
|
-
deleteChat
|
|
199
|
+
deleteChat,
|
|
200
|
+
renameChat
|
|
196
201
|
},
|
|
197
202
|
chat
|
|
198
203
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@economic/agents-react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"files": [
|
|
6
6
|
"dist"
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
"zod": "^4.4.3"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
|
-
"@cloudflare/workers-types": "^4.
|
|
30
|
+
"@cloudflare/workers-types": "^4.20260702.1",
|
|
31
31
|
"@types/node": "^25.6.0",
|
|
32
32
|
"@typescript/native-preview": "7.0.0-dev.20260412.1",
|
|
33
33
|
"tsdown": "^0.22.0",
|