@lobehub/lobehub 2.0.0-next.190 → 2.0.0-next.191
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/CHANGELOG.md +25 -0
- package/changelog/v1.json +9 -0
- package/package.json +1 -1
- package/packages/const/src/utils/merge.test.ts +679 -0
- package/packages/context-engine/src/processors/__tests__/AgentCouncilFlatten.test.ts +0 -20
- package/packages/context-engine/src/processors/__tests__/MessageContent.test.ts +5 -23
- package/packages/context-engine/src/providers/SystemRoleInjector.ts +0 -1
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/agentCouncil/simple.json +4 -19
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/agentCouncil/with-supervisor-reply.json +4 -23
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/agentGroup/speak-different-agent.json +3 -13
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistant-chain-with-followup.json +3 -8
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistantGroup/assistant-with-tools.json +21 -17
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/assistantGroup/tools-with-branches.json +15 -15
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/active-index-1.json +3 -13
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-branch.json +2 -9
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-group-branches.json +0 -11
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/assistant-user-branch.json +5 -15
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/conversation.json +4 -14
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/multi-assistant-group.json +0 -13
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/branch/nested.json +2 -15
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/simple.json +4 -9
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/compare/with-tools.json +8 -17
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/linear-conversation.json +3 -7
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/simple.json +1 -7
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-summary.json +10 -11
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/agentCouncil/simple.json +2 -32
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/agentCouncil/with-supervisor-reply.json +8 -46
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/agentGroup/speak-different-agent.json +5 -24
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistant-chain-with-followup.json +5 -13
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/assistant-with-tools.json +6 -16
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/assistantGroup/tools-with-branches.json +6 -17
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/active-index-1.json +4 -18
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-branch.json +4 -16
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-group-branches.json +0 -19
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/assistant-user-branch.json +8 -24
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/conversation.json +7 -23
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/multi-assistant-group.json +0 -15
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/branch/nested.json +4 -25
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/simple.json +2 -13
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/compare/with-tools.json +4 -20
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/linear-conversation.json +4 -12
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/simple.json +2 -14
- package/packages/conversation-flow/src/__tests__/fixtures/outputs/tasks/with-summary.json +20 -22
- package/packages/conversation-flow/src/__tests__/indexing.test.ts +0 -35
- package/packages/conversation-flow/src/__tests__/structuring.test.ts +0 -41
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +0 -4
- package/packages/conversation-flow/src/transformation/__tests__/BranchResolver.test.ts +0 -10
- package/packages/conversation-flow/src/transformation/__tests__/ContextTreeBuilder.test.ts +0 -19
- package/packages/conversation-flow/src/transformation/__tests__/FlatListBuilder.test.ts +0 -37
- package/packages/conversation-flow/src/transformation/__tests__/MessageCollector.test.ts +0 -12
- package/packages/conversation-flow/src/transformation/__tests__/MessageTransformer.test.ts +0 -2
- package/packages/database/src/models/message.ts +0 -1
- package/packages/prompts/src/prompts/chatMessages/index.test.ts +0 -1
- package/packages/prompts/src/prompts/groupChat/__snapshots__/index.test.ts.snap +0 -21
- package/packages/prompts/src/prompts/groupChat/index.test.ts +0 -3
- package/packages/types/src/message/ui/chat.ts +0 -2
- package/src/features/Conversation/store/slices/data/action.test.ts +0 -14
- package/src/features/Conversation/store/slices/data/reducer.test.ts +0 -21
- package/src/features/Conversation/store/slices/data/reducer.ts +1 -1
- package/src/features/Conversation/store/slices/message/action/crud.test.ts +0 -10
- package/src/server/modules/Mecha/ContextEngineering/__tests__/serverMessagesEngine.test.ts +3 -5
- package/src/server/routers/lambda/__tests__/message.test.ts +1 -2
- package/src/server/services/agentRuntime/AgentRuntimeService.ts +109 -109
- package/src/server/services/agentRuntime/types.ts +8 -8
- package/src/server/services/doc/index.tsx +2 -2
- package/src/server/services/generation/index.ts +2 -2
- package/src/server/services/message/index.ts +3 -3
- package/src/server/services/usage/index.ts +4 -4
- package/src/services/chat/chat.test.ts +0 -6
- package/src/services/chat/mecha/contextEngineering.test.ts +3 -29
- package/src/services/chat/mecha/modelParamsResolver.test.ts +803 -0
- package/src/store/chat/agents/GroupOrchestration/createGroupOrchestrationExecutors.ts +0 -2
- package/src/store/chat/agents/__tests__/createAgentExecutors/call-tool.test.ts +0 -6
- package/src/store/chat/agents/__tests__/createAgentExecutors/fixtures/mockMessages.ts +0 -3
- package/src/store/chat/agents/createAgentExecutors.ts +4 -4
- package/src/store/chat/slices/aiAgent/actions/__tests__/agentGroup.test.ts +0 -2
- package/src/store/chat/slices/aiAgent/actions/__tests__/runAgent.test.ts +0 -3
- package/src/store/chat/slices/aiChat/actions/conversationLifecycle.ts +0 -1
- package/src/store/chat/slices/builtinTool/actions/__tests__/search.test.ts +0 -4
- package/src/store/chat/slices/message/reducer.test.ts +0 -5
- package/src/store/chat/slices/message/reducer.ts +1 -1
- package/src/store/chat/slices/message/selectors/displayMessage.test.ts +0 -13
- package/src/store/chat/slices/message/selectors/displayMessage.ts +3 -34
- package/src/store/chat/slices/portal/selectors.test.ts +0 -7
- package/src/store/chat/slices/thread/action.test.ts +0 -1
- package/src/store/chat/slices/translate/action.test.ts +0 -1
- package/src/store/tool/slices/oldStore/action.test.ts +0 -1
|
@@ -40,7 +40,6 @@ exports[`filterMessagesForAgent > should handle assistant direct messages 1`] =
|
|
|
40
40
|
"content": "DM to agent-1",
|
|
41
41
|
"createdAt": 1634567890000,
|
|
42
42
|
"id": "1",
|
|
43
|
-
"meta": {},
|
|
44
43
|
"role": "assistant",
|
|
45
44
|
"targetId": "agent-1",
|
|
46
45
|
"updatedAt": 1634567890000,
|
|
@@ -50,7 +49,6 @@ exports[`filterMessagesForAgent > should handle assistant direct messages 1`] =
|
|
|
50
49
|
"content": "***",
|
|
51
50
|
"createdAt": 1634567890000,
|
|
52
51
|
"id": "2",
|
|
53
|
-
"meta": {},
|
|
54
52
|
"role": "assistant",
|
|
55
53
|
"targetId": "agent-2",
|
|
56
54
|
"updatedAt": 1634567890000,
|
|
@@ -64,7 +62,6 @@ exports[`filterMessagesForAgent > should handle group messages without targetId
|
|
|
64
62
|
"content": "Hello everyone",
|
|
65
63
|
"createdAt": 1634567890000,
|
|
66
64
|
"id": "1",
|
|
67
|
-
"meta": {},
|
|
68
65
|
"role": "user",
|
|
69
66
|
"updatedAt": 1634567890000,
|
|
70
67
|
},
|
|
@@ -73,7 +70,6 @@ exports[`filterMessagesForAgent > should handle group messages without targetId
|
|
|
73
70
|
"content": "Hi there",
|
|
74
71
|
"createdAt": 1634567890000,
|
|
75
72
|
"id": "2",
|
|
76
|
-
"meta": {},
|
|
77
73
|
"role": "assistant",
|
|
78
74
|
"updatedAt": 1634567890000,
|
|
79
75
|
},
|
|
@@ -87,7 +83,6 @@ exports[`filterMessagesForAgent > should handle messages sent by this agent 1`]
|
|
|
87
83
|
"content": "My message to agent-2",
|
|
88
84
|
"createdAt": 1634567890000,
|
|
89
85
|
"id": "1",
|
|
90
|
-
"meta": {},
|
|
91
86
|
"role": "assistant",
|
|
92
87
|
"targetId": "agent-2",
|
|
93
88
|
"updatedAt": 1634567890000,
|
|
@@ -97,7 +92,6 @@ exports[`filterMessagesForAgent > should handle messages sent by this agent 1`]
|
|
|
97
92
|
"content": "My group message",
|
|
98
93
|
"createdAt": 1634567890000,
|
|
99
94
|
"id": "2",
|
|
100
|
-
"meta": {},
|
|
101
95
|
"role": "assistant",
|
|
102
96
|
"updatedAt": 1634567890000,
|
|
103
97
|
},
|
|
@@ -106,7 +100,6 @@ exports[`filterMessagesForAgent > should handle messages sent by this agent 1`]
|
|
|
106
100
|
"content": "***",
|
|
107
101
|
"createdAt": 1634567890000,
|
|
108
102
|
"id": "3",
|
|
109
|
-
"meta": {},
|
|
110
103
|
"role": "assistant",
|
|
111
104
|
"targetId": "agent-3",
|
|
112
105
|
"updatedAt": 1634567890000,
|
|
@@ -120,7 +113,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
120
113
|
"content": "System prompt",
|
|
121
114
|
"createdAt": 1634567890000,
|
|
122
115
|
"id": "1",
|
|
123
|
-
"meta": {},
|
|
124
116
|
"role": "system",
|
|
125
117
|
"updatedAt": 1634567890000,
|
|
126
118
|
},
|
|
@@ -128,7 +120,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
128
120
|
"content": "Hello everyone",
|
|
129
121
|
"createdAt": 1634567890000,
|
|
130
122
|
"id": "2",
|
|
131
|
-
"meta": {},
|
|
132
123
|
"role": "user",
|
|
133
124
|
"updatedAt": 1634567890000,
|
|
134
125
|
},
|
|
@@ -137,7 +128,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
137
128
|
"content": "Hi!",
|
|
138
129
|
"createdAt": 1634567890000,
|
|
139
130
|
"id": "3",
|
|
140
|
-
"meta": {},
|
|
141
131
|
"role": "assistant",
|
|
142
132
|
"updatedAt": 1634567890000,
|
|
143
133
|
},
|
|
@@ -145,7 +135,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
145
135
|
"content": "DM to agent-1",
|
|
146
136
|
"createdAt": 1634567890000,
|
|
147
137
|
"id": "4",
|
|
148
|
-
"meta": {},
|
|
149
138
|
"role": "user",
|
|
150
139
|
"targetId": "agent-1",
|
|
151
140
|
"updatedAt": 1634567890000,
|
|
@@ -155,7 +144,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
155
144
|
"content": "DM response",
|
|
156
145
|
"createdAt": 1634567890000,
|
|
157
146
|
"id": "5",
|
|
158
|
-
"meta": {},
|
|
159
147
|
"role": "assistant",
|
|
160
148
|
"targetId": "user",
|
|
161
149
|
"updatedAt": 1634567890000,
|
|
@@ -164,7 +152,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
164
152
|
"content": "***",
|
|
165
153
|
"createdAt": 1634567890000,
|
|
166
154
|
"id": "6",
|
|
167
|
-
"meta": {},
|
|
168
155
|
"role": "user",
|
|
169
156
|
"targetId": "agent-2",
|
|
170
157
|
"updatedAt": 1634567890000,
|
|
@@ -174,7 +161,6 @@ exports[`filterMessagesForAgent > should handle mixed message types 1`] = `
|
|
|
174
161
|
"content": "***",
|
|
175
162
|
"createdAt": 1634567890000,
|
|
176
163
|
"id": "7",
|
|
177
|
-
"meta": {},
|
|
178
164
|
"role": "assistant",
|
|
179
165
|
"targetId": "user",
|
|
180
166
|
"updatedAt": 1634567890000,
|
|
@@ -188,7 +174,6 @@ exports[`filterMessagesForAgent > should handle system messages 1`] = `
|
|
|
188
174
|
"content": "System message",
|
|
189
175
|
"createdAt": 1634567890000,
|
|
190
176
|
"id": "1",
|
|
191
|
-
"meta": {},
|
|
192
177
|
"role": "system",
|
|
193
178
|
"updatedAt": 1634567890000,
|
|
194
179
|
},
|
|
@@ -201,7 +186,6 @@ exports[`filterMessagesForAgent > should handle user direct messages 1`] = `
|
|
|
201
186
|
"content": "Private message to agent-1",
|
|
202
187
|
"createdAt": 1634567890000,
|
|
203
188
|
"id": "1",
|
|
204
|
-
"meta": {},
|
|
205
189
|
"role": "user",
|
|
206
190
|
"targetId": "agent-1",
|
|
207
191
|
"updatedAt": 1634567890000,
|
|
@@ -210,7 +194,6 @@ exports[`filterMessagesForAgent > should handle user direct messages 1`] = `
|
|
|
210
194
|
"content": "***",
|
|
211
195
|
"createdAt": 1634567890000,
|
|
212
196
|
"id": "2",
|
|
213
|
-
"meta": {},
|
|
214
197
|
"role": "user",
|
|
215
198
|
"targetId": "agent-2",
|
|
216
199
|
"updatedAt": 1634567890000,
|
|
@@ -227,7 +210,6 @@ exports[`filterMessagesForAgent > should preserve all message properties when re
|
|
|
227
210
|
"file1",
|
|
228
211
|
],
|
|
229
212
|
"id": "1",
|
|
230
|
-
"meta": {},
|
|
231
213
|
"observationId": "obs1",
|
|
232
214
|
"parentId": "parent1",
|
|
233
215
|
"role": "user",
|
|
@@ -244,7 +226,6 @@ exports[`filterMessagesForAgent > should replace content for DMs not involving t
|
|
|
244
226
|
"content": "***",
|
|
245
227
|
"createdAt": 1634567890000,
|
|
246
228
|
"id": "1",
|
|
247
|
-
"meta": {},
|
|
248
229
|
"role": "user",
|
|
249
230
|
"targetId": "agent-2",
|
|
250
231
|
"updatedAt": 1634567890000,
|
|
@@ -254,7 +235,6 @@ exports[`filterMessagesForAgent > should replace content for DMs not involving t
|
|
|
254
235
|
"content": "***",
|
|
255
236
|
"createdAt": 1634567890000,
|
|
256
237
|
"id": "2",
|
|
257
|
-
"meta": {},
|
|
258
238
|
"role": "assistant",
|
|
259
239
|
"targetId": "user",
|
|
260
240
|
"updatedAt": 1634567890000,
|
|
@@ -264,7 +244,6 @@ exports[`filterMessagesForAgent > should replace content for DMs not involving t
|
|
|
264
244
|
"content": "***",
|
|
265
245
|
"createdAt": 1634567890000,
|
|
266
246
|
"id": "3",
|
|
267
|
-
"meta": {},
|
|
268
247
|
"role": "assistant",
|
|
269
248
|
"targetId": "agent-3",
|
|
270
249
|
"updatedAt": 1634567890000,
|
|
@@ -19,7 +19,6 @@ describe('buildGroupChatSystemPrompt', () => {
|
|
|
19
19
|
content: 'Hello everyone',
|
|
20
20
|
createdAt: mockTimestamp,
|
|
21
21
|
updatedAt: mockTimestamp,
|
|
22
|
-
meta: {},
|
|
23
22
|
},
|
|
24
23
|
{
|
|
25
24
|
id: 'm2',
|
|
@@ -28,7 +27,6 @@ describe('buildGroupChatSystemPrompt', () => {
|
|
|
28
27
|
content: 'Hi! I can help with that.',
|
|
29
28
|
createdAt: mockTimestamp,
|
|
30
29
|
updatedAt: mockTimestamp,
|
|
31
|
-
meta: {},
|
|
32
30
|
},
|
|
33
31
|
];
|
|
34
32
|
|
|
@@ -114,7 +112,6 @@ describe('filterMessagesForAgent', () => {
|
|
|
114
112
|
content,
|
|
115
113
|
createdAt: mockTimestamp,
|
|
116
114
|
updatedAt: mockTimestamp,
|
|
117
|
-
meta: {},
|
|
118
115
|
...options,
|
|
119
116
|
});
|
|
120
117
|
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { MetaData } from '../../meta';
|
|
2
1
|
import { GroundingSearch } from '../../search';
|
|
3
2
|
import { ThreadStatus } from '../../topic/thread';
|
|
4
3
|
import {
|
|
@@ -121,7 +120,6 @@ export interface UIChatMessage {
|
|
|
121
120
|
id: string;
|
|
122
121
|
imageList?: ChatImageItem[];
|
|
123
122
|
members?: UIChatMessage[];
|
|
124
|
-
meta: MetaData;
|
|
125
123
|
metadata?: MessageMetadata | null;
|
|
126
124
|
model?: string | null;
|
|
127
125
|
/**
|
|
@@ -187,7 +187,6 @@ describe('DataSlice', () => {
|
|
|
187
187
|
role: 'user',
|
|
188
188
|
createdAt: 1000,
|
|
189
189
|
updatedAt: 1000,
|
|
190
|
-
meta: {},
|
|
191
190
|
},
|
|
192
191
|
{
|
|
193
192
|
id: 'new-msg-2',
|
|
@@ -195,7 +194,6 @@ describe('DataSlice', () => {
|
|
|
195
194
|
role: 'assistant',
|
|
196
195
|
createdAt: 2000,
|
|
197
196
|
updatedAt: 2000,
|
|
198
|
-
meta: {},
|
|
199
197
|
},
|
|
200
198
|
];
|
|
201
199
|
|
|
@@ -329,7 +327,6 @@ describe('DataSlice', () => {
|
|
|
329
327
|
role: 'assistantGroup' as const,
|
|
330
328
|
createdAt: Date.now(),
|
|
331
329
|
updatedAt: Date.now(),
|
|
332
|
-
meta: {},
|
|
333
330
|
children: [
|
|
334
331
|
{ id: 'child-1', content: 'First response', role: 'assistant' as const },
|
|
335
332
|
{ id: 'child-2', content: 'Second response', role: 'assistant' as const },
|
|
@@ -352,7 +349,6 @@ describe('DataSlice', () => {
|
|
|
352
349
|
role: 'assistantGroup' as const,
|
|
353
350
|
createdAt: Date.now(),
|
|
354
351
|
updatedAt: Date.now(),
|
|
355
|
-
meta: {},
|
|
356
352
|
children: [
|
|
357
353
|
{ id: 'child-1', content: 'First response', role: 'assistant' as const },
|
|
358
354
|
{
|
|
@@ -387,7 +383,6 @@ describe('DataSlice', () => {
|
|
|
387
383
|
role: 'assistantGroup' as const,
|
|
388
384
|
createdAt: Date.now(),
|
|
389
385
|
updatedAt: Date.now(),
|
|
390
|
-
meta: {},
|
|
391
386
|
children: [
|
|
392
387
|
{ id: 'child-1', content: 'First response', role: 'assistant' as const },
|
|
393
388
|
{ id: 'child-2', content: '', role: 'assistant' as const },
|
|
@@ -409,7 +404,6 @@ describe('DataSlice', () => {
|
|
|
409
404
|
role: 'assistantGroup' as const,
|
|
410
405
|
createdAt: Date.now(),
|
|
411
406
|
updatedAt: Date.now(),
|
|
412
|
-
meta: {},
|
|
413
407
|
children: [],
|
|
414
408
|
};
|
|
415
409
|
|
|
@@ -434,7 +428,6 @@ describe('DataSlice', () => {
|
|
|
434
428
|
role: 'user',
|
|
435
429
|
createdAt: 1000,
|
|
436
430
|
updatedAt: 1000,
|
|
437
|
-
meta: {},
|
|
438
431
|
},
|
|
439
432
|
];
|
|
440
433
|
|
|
@@ -468,7 +461,6 @@ describe('DataSlice', () => {
|
|
|
468
461
|
role: 'user',
|
|
469
462
|
createdAt: 1000,
|
|
470
463
|
updatedAt: 1000,
|
|
471
|
-
meta: {},
|
|
472
464
|
},
|
|
473
465
|
];
|
|
474
466
|
|
|
@@ -575,7 +567,6 @@ describe('DataSlice', () => {
|
|
|
575
567
|
role: 'assistant',
|
|
576
568
|
createdAt: 1000,
|
|
577
569
|
updatedAt: 1000,
|
|
578
|
-
meta: {},
|
|
579
570
|
groupId: 'group-123',
|
|
580
571
|
agentId: 'worker-agent-1',
|
|
581
572
|
},
|
|
@@ -585,7 +576,6 @@ describe('DataSlice', () => {
|
|
|
585
576
|
role: 'assistant',
|
|
586
577
|
createdAt: 2000,
|
|
587
578
|
updatedAt: 2000,
|
|
588
|
-
meta: {},
|
|
589
579
|
groupId: 'group-123',
|
|
590
580
|
agentId: 'worker-agent-2',
|
|
591
581
|
},
|
|
@@ -629,7 +619,6 @@ describe('DataSlice', () => {
|
|
|
629
619
|
role: 'user',
|
|
630
620
|
createdAt: 1000,
|
|
631
621
|
updatedAt: 1000,
|
|
632
|
-
meta: {},
|
|
633
622
|
},
|
|
634
623
|
];
|
|
635
624
|
|
|
@@ -670,7 +659,6 @@ describe('DataSlice', () => {
|
|
|
670
659
|
content: 'test',
|
|
671
660
|
createdAt: Date.now(),
|
|
672
661
|
updatedAt: Date.now(),
|
|
673
|
-
meta: {},
|
|
674
662
|
},
|
|
675
663
|
],
|
|
676
664
|
} as any);
|
|
@@ -700,7 +688,6 @@ describe('DataSlice', () => {
|
|
|
700
688
|
content: 'test',
|
|
701
689
|
createdAt: Date.now(),
|
|
702
690
|
updatedAt: Date.now(),
|
|
703
|
-
meta: {},
|
|
704
691
|
},
|
|
705
692
|
],
|
|
706
693
|
} as any);
|
|
@@ -730,7 +717,6 @@ describe('DataSlice', () => {
|
|
|
730
717
|
content: 'test',
|
|
731
718
|
createdAt: Date.now(),
|
|
732
719
|
updatedAt: Date.now(),
|
|
733
|
-
meta: {},
|
|
734
720
|
},
|
|
735
721
|
],
|
|
736
722
|
} as any);
|
|
@@ -14,7 +14,6 @@ describe('messagesReducer', () => {
|
|
|
14
14
|
createdAt: 1629264000000,
|
|
15
15
|
updatedAt: 1629264000000,
|
|
16
16
|
role: 'user',
|
|
17
|
-
meta: {},
|
|
18
17
|
},
|
|
19
18
|
{
|
|
20
19
|
id: 'message2',
|
|
@@ -22,7 +21,6 @@ describe('messagesReducer', () => {
|
|
|
22
21
|
createdAt: 1629264001000,
|
|
23
22
|
updatedAt: 1629264001000,
|
|
24
23
|
role: 'assistant',
|
|
25
|
-
meta: {},
|
|
26
24
|
tools: [
|
|
27
25
|
{ identifier: 'tool1', apiName: 'calculator', id: 'abc', type: 'default', arguments: '' },
|
|
28
26
|
],
|
|
@@ -93,7 +91,6 @@ describe('messagesReducer', () => {
|
|
|
93
91
|
createdAt: 1629264000000,
|
|
94
92
|
updatedAt: 1629264000000,
|
|
95
93
|
role: 'user',
|
|
96
|
-
meta: {},
|
|
97
94
|
extra: { abc: '1' },
|
|
98
95
|
} as UIChatMessage,
|
|
99
96
|
];
|
|
@@ -230,7 +227,6 @@ describe('messagesReducer', () => {
|
|
|
230
227
|
content: 'Tool content',
|
|
231
228
|
createdAt: 1629264000000,
|
|
232
229
|
updatedAt: 1629264000000,
|
|
233
|
-
meta: {},
|
|
234
230
|
plugin: {
|
|
235
231
|
identifier: 'tool1',
|
|
236
232
|
apiName: 'calculator',
|
|
@@ -327,7 +323,6 @@ describe('messagesReducer', () => {
|
|
|
327
323
|
content: '',
|
|
328
324
|
createdAt: 1629264000000,
|
|
329
325
|
updatedAt: 1629264000000,
|
|
330
|
-
meta: {},
|
|
331
326
|
} as UIChatMessage,
|
|
332
327
|
];
|
|
333
328
|
|
|
@@ -501,7 +496,6 @@ describe('messagesReducer', () => {
|
|
|
501
496
|
expect(newMsg?.role).toBe('user');
|
|
502
497
|
expect(newMsg?.createdAt).toBeDefined();
|
|
503
498
|
expect(newMsg?.updatedAt).toBeDefined();
|
|
504
|
-
expect(newMsg?.meta).toEqual({});
|
|
505
499
|
});
|
|
506
500
|
});
|
|
507
501
|
|
|
@@ -565,7 +559,6 @@ describe('messagesReducer', () => {
|
|
|
565
559
|
role: 'user',
|
|
566
560
|
createdAt: 1,
|
|
567
561
|
updatedAt: 1,
|
|
568
|
-
meta: {},
|
|
569
562
|
parentId: undefined,
|
|
570
563
|
},
|
|
571
564
|
{
|
|
@@ -574,7 +567,6 @@ describe('messagesReducer', () => {
|
|
|
574
567
|
role: 'assistant',
|
|
575
568
|
createdAt: 2,
|
|
576
569
|
updatedAt: 2,
|
|
577
|
-
meta: {},
|
|
578
570
|
parentId: 'A',
|
|
579
571
|
},
|
|
580
572
|
{
|
|
@@ -583,7 +575,6 @@ describe('messagesReducer', () => {
|
|
|
583
575
|
role: 'tool',
|
|
584
576
|
createdAt: 3,
|
|
585
577
|
updatedAt: 3,
|
|
586
|
-
meta: {},
|
|
587
578
|
parentId: 'B',
|
|
588
579
|
},
|
|
589
580
|
{
|
|
@@ -592,7 +583,6 @@ describe('messagesReducer', () => {
|
|
|
592
583
|
role: 'user',
|
|
593
584
|
createdAt: 4,
|
|
594
585
|
updatedAt: 4,
|
|
595
|
-
meta: {},
|
|
596
586
|
parentId: 'C',
|
|
597
587
|
},
|
|
598
588
|
];
|
|
@@ -624,7 +614,6 @@ describe('messagesReducer', () => {
|
|
|
624
614
|
role: 'user',
|
|
625
615
|
createdAt: 1,
|
|
626
616
|
updatedAt: 1,
|
|
627
|
-
meta: {},
|
|
628
617
|
parentId: undefined,
|
|
629
618
|
},
|
|
630
619
|
{
|
|
@@ -633,7 +622,6 @@ describe('messagesReducer', () => {
|
|
|
633
622
|
role: 'assistant',
|
|
634
623
|
createdAt: 2,
|
|
635
624
|
updatedAt: 2,
|
|
636
|
-
meta: {},
|
|
637
625
|
parentId: 'A',
|
|
638
626
|
},
|
|
639
627
|
{
|
|
@@ -642,7 +630,6 @@ describe('messagesReducer', () => {
|
|
|
642
630
|
role: 'tool',
|
|
643
631
|
createdAt: 3,
|
|
644
632
|
updatedAt: 3,
|
|
645
|
-
meta: {},
|
|
646
633
|
parentId: 'B',
|
|
647
634
|
},
|
|
648
635
|
{
|
|
@@ -651,7 +638,6 @@ describe('messagesReducer', () => {
|
|
|
651
638
|
role: 'user',
|
|
652
639
|
createdAt: 4,
|
|
653
640
|
updatedAt: 4,
|
|
654
|
-
meta: {},
|
|
655
641
|
parentId: 'C',
|
|
656
642
|
},
|
|
657
643
|
];
|
|
@@ -681,7 +667,6 @@ describe('messagesReducer', () => {
|
|
|
681
667
|
role: 'user',
|
|
682
668
|
createdAt: 1,
|
|
683
669
|
updatedAt: 1,
|
|
684
|
-
meta: {},
|
|
685
670
|
parentId: undefined,
|
|
686
671
|
},
|
|
687
672
|
{
|
|
@@ -690,7 +675,6 @@ describe('messagesReducer', () => {
|
|
|
690
675
|
role: 'assistant',
|
|
691
676
|
createdAt: 2,
|
|
692
677
|
updatedAt: 2,
|
|
693
|
-
meta: {},
|
|
694
678
|
parentId: 'A',
|
|
695
679
|
},
|
|
696
680
|
{
|
|
@@ -699,7 +683,6 @@ describe('messagesReducer', () => {
|
|
|
699
683
|
role: 'user',
|
|
700
684
|
createdAt: 3,
|
|
701
685
|
updatedAt: 3,
|
|
702
|
-
meta: {},
|
|
703
686
|
parentId: 'B',
|
|
704
687
|
},
|
|
705
688
|
{
|
|
@@ -708,7 +691,6 @@ describe('messagesReducer', () => {
|
|
|
708
691
|
role: 'user',
|
|
709
692
|
createdAt: 4,
|
|
710
693
|
updatedAt: 4,
|
|
711
|
-
meta: {},
|
|
712
694
|
parentId: undefined,
|
|
713
695
|
},
|
|
714
696
|
{
|
|
@@ -717,7 +699,6 @@ describe('messagesReducer', () => {
|
|
|
717
699
|
role: 'assistant',
|
|
718
700
|
createdAt: 5,
|
|
719
701
|
updatedAt: 5,
|
|
720
|
-
meta: {},
|
|
721
702
|
parentId: 'X',
|
|
722
703
|
},
|
|
723
704
|
{
|
|
@@ -726,7 +707,6 @@ describe('messagesReducer', () => {
|
|
|
726
707
|
role: 'user',
|
|
727
708
|
createdAt: 6,
|
|
728
709
|
updatedAt: 6,
|
|
729
|
-
meta: {},
|
|
730
710
|
parentId: 'Y',
|
|
731
711
|
},
|
|
732
712
|
];
|
|
@@ -761,7 +741,6 @@ describe('messagesReducer', () => {
|
|
|
761
741
|
createdAt: Date.now(),
|
|
762
742
|
updatedAt: Date.now(),
|
|
763
743
|
role: 'user',
|
|
764
|
-
meta: {},
|
|
765
744
|
},
|
|
766
745
|
];
|
|
767
746
|
|
|
@@ -238,7 +238,7 @@ export const messagesReducer = (
|
|
|
238
238
|
const now = Date.now();
|
|
239
239
|
|
|
240
240
|
return produce(state, (draft) => {
|
|
241
|
-
draft.push({ ...value, createdAt: now, id,
|
|
241
|
+
draft.push({ ...value, createdAt: now, id, updatedAt: now } as UIChatMessage);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
244
|
|
|
@@ -53,7 +53,6 @@ describe('Message CRUD Actions', () => {
|
|
|
53
53
|
role: 'user',
|
|
54
54
|
createdAt: Date.now(),
|
|
55
55
|
updatedAt: Date.now(),
|
|
56
|
-
meta: {},
|
|
57
56
|
},
|
|
58
57
|
],
|
|
59
58
|
});
|
|
@@ -138,7 +137,6 @@ describe('Message CRUD Actions', () => {
|
|
|
138
137
|
role: 'user' as const,
|
|
139
138
|
createdAt: Date.now(),
|
|
140
139
|
updatedAt: Date.now(),
|
|
141
|
-
meta: {},
|
|
142
140
|
};
|
|
143
141
|
|
|
144
142
|
act(() => {
|
|
@@ -173,7 +171,6 @@ describe('Message CRUD Actions', () => {
|
|
|
173
171
|
role: 'assistantGroup',
|
|
174
172
|
createdAt: Date.now(),
|
|
175
173
|
updatedAt: Date.now(),
|
|
176
|
-
meta: {},
|
|
177
174
|
children: [
|
|
178
175
|
{
|
|
179
176
|
id: 'child-1',
|
|
@@ -223,7 +220,6 @@ describe('Message CRUD Actions', () => {
|
|
|
223
220
|
role: 'user' as const,
|
|
224
221
|
createdAt: Date.now(),
|
|
225
222
|
updatedAt: Date.now(),
|
|
226
|
-
meta: {},
|
|
227
223
|
};
|
|
228
224
|
|
|
229
225
|
act(() => {
|
|
@@ -246,7 +242,6 @@ describe('Message CRUD Actions', () => {
|
|
|
246
242
|
role: 'assistantGroup',
|
|
247
243
|
createdAt: Date.now(),
|
|
248
244
|
updatedAt: Date.now(),
|
|
249
|
-
meta: {},
|
|
250
245
|
children: [{ id: 'child-1', content: 'Response' }],
|
|
251
246
|
};
|
|
252
247
|
|
|
@@ -290,7 +285,6 @@ describe('Message CRUD Actions', () => {
|
|
|
290
285
|
role: 'user' as const,
|
|
291
286
|
createdAt: Date.now(),
|
|
292
287
|
updatedAt: Date.now(),
|
|
293
|
-
meta: {},
|
|
294
288
|
};
|
|
295
289
|
|
|
296
290
|
act(() => {
|
|
@@ -340,7 +334,6 @@ describe('Message CRUD Actions', () => {
|
|
|
340
334
|
role: 'assistant' as const,
|
|
341
335
|
createdAt: Date.now(),
|
|
342
336
|
updatedAt: Date.now(),
|
|
343
|
-
meta: {},
|
|
344
337
|
},
|
|
345
338
|
{
|
|
346
339
|
id: 'assistant-2',
|
|
@@ -348,7 +341,6 @@ describe('Message CRUD Actions', () => {
|
|
|
348
341
|
role: 'assistant' as const,
|
|
349
342
|
createdAt: Date.now() + 1,
|
|
350
343
|
updatedAt: Date.now() + 1,
|
|
351
|
-
meta: {},
|
|
352
344
|
},
|
|
353
345
|
];
|
|
354
346
|
|
|
@@ -492,7 +484,6 @@ describe('Message CRUD Actions', () => {
|
|
|
492
484
|
role: 'user',
|
|
493
485
|
createdAt: Date.now(),
|
|
494
486
|
updatedAt: Date.now(),
|
|
495
|
-
meta: {},
|
|
496
487
|
},
|
|
497
488
|
],
|
|
498
489
|
});
|
|
@@ -638,7 +629,6 @@ describe('Message CRUD Actions', () => {
|
|
|
638
629
|
role: 'user',
|
|
639
630
|
createdAt: Date.now(),
|
|
640
631
|
updatedAt: Date.now(),
|
|
641
|
-
meta: {},
|
|
642
632
|
},
|
|
643
633
|
]);
|
|
644
634
|
});
|
|
@@ -9,7 +9,6 @@ describe('serverMessagesEngine', () => {
|
|
|
9
9
|
content: 'Hello',
|
|
10
10
|
createdAt: Date.now(),
|
|
11
11
|
id: 'msg-1',
|
|
12
|
-
meta: {},
|
|
13
12
|
role: 'user',
|
|
14
13
|
updatedAt: Date.now(),
|
|
15
14
|
} as UIChatMessage,
|
|
@@ -17,7 +16,6 @@ describe('serverMessagesEngine', () => {
|
|
|
17
16
|
content: 'Hi there!',
|
|
18
17
|
createdAt: Date.now(),
|
|
19
18
|
id: 'msg-2',
|
|
20
|
-
meta: {},
|
|
21
19
|
role: 'assistant',
|
|
22
20
|
updatedAt: Date.now(),
|
|
23
21
|
} as UIChatMessage,
|
|
@@ -78,7 +76,6 @@ describe('serverMessagesEngine', () => {
|
|
|
78
76
|
content: `Message ${i}`,
|
|
79
77
|
createdAt: Date.now(),
|
|
80
78
|
id: `msg-${i}`,
|
|
81
|
-
meta: {},
|
|
82
79
|
role: i % 2 === 0 ? 'user' : 'assistant',
|
|
83
80
|
updatedAt: Date.now(),
|
|
84
81
|
} as UIChatMessage);
|
|
@@ -260,7 +257,9 @@ describe('serverMessagesEngine', () => {
|
|
|
260
257
|
|
|
261
258
|
// User memories are injected as a consolidated user message before the first user message
|
|
262
259
|
// Note: meta/id fields are removed by the engine cleanup step, so assert via content.
|
|
263
|
-
const injection = result.find(
|
|
260
|
+
const injection = result.find(
|
|
261
|
+
(m: any) => m.role === 'user' && String(m.content).includes('<user_memory>'),
|
|
262
|
+
);
|
|
264
263
|
expect(injection).toBeDefined();
|
|
265
264
|
expect(injection!.role).toBe('user');
|
|
266
265
|
});
|
|
@@ -329,7 +328,6 @@ describe('serverMessagesEngine', () => {
|
|
|
329
328
|
content: 'user input',
|
|
330
329
|
createdAt: Date.now(),
|
|
331
330
|
id: 'msg-1',
|
|
332
|
-
meta: {},
|
|
333
331
|
role: 'user',
|
|
334
332
|
updatedAt: Date.now(),
|
|
335
333
|
} as UIChatMessage,
|
|
@@ -152,7 +152,6 @@ describe('messageRouter', () => {
|
|
|
152
152
|
const mockQueryAll = vi.fn().mockResolvedValue([
|
|
153
153
|
{
|
|
154
154
|
id: 'msg1',
|
|
155
|
-
meta: {},
|
|
156
155
|
} as UIChatMessage,
|
|
157
156
|
]);
|
|
158
157
|
vi.mocked(MessageModel).mockImplementation(
|
|
@@ -169,7 +168,7 @@ describe('messageRouter', () => {
|
|
|
169
168
|
const result = await ctx.messageModel.queryAll();
|
|
170
169
|
|
|
171
170
|
expect(mockQueryAll).toHaveBeenCalled();
|
|
172
|
-
expect(result).toEqual([{ id: 'msg1'
|
|
171
|
+
expect(result).toEqual([{ id: 'msg1' }]);
|
|
173
172
|
});
|
|
174
173
|
|
|
175
174
|
it('should handle removeMessage', async () => {
|