@lobehub/lobehub 2.0.0-next.335 → 2.0.0-next.337
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 +59 -0
- package/changelog/v1.json +21 -0
- package/package.json +1 -1
- package/packages/builtin-tool-agent-builder/src/manifest.ts +0 -2
- package/packages/builtin-tool-group-management/src/manifest.ts +54 -53
- package/packages/builtin-tool-group-management/src/systemRole.ts +43 -111
- package/packages/builtin-tool-memory/src/client/Render/AddPreferenceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Render/index.ts +2 -0
- package/packages/builtin-tool-memory/src/client/Streaming/AddPreferenceMemory/index.tsx +17 -0
- package/packages/builtin-tool-memory/src/client/Streaming/index.ts +4 -3
- package/packages/builtin-tool-memory/src/client/components/PreferenceMemoryCard.tsx +357 -0
- package/packages/builtin-tool-memory/src/client/components/index.ts +1 -0
- package/packages/builtin-tool-memory/src/executor/index.ts +3 -3
- package/packages/builtin-tool-memory/src/systemRole.ts +1 -0
- package/packages/context-engine/src/engine/tools/ToolArgumentsRepairer.ts +129 -0
- package/packages/context-engine/src/engine/tools/__tests__/ToolArgumentsRepairer.test.ts +186 -0
- package/packages/context-engine/src/engine/tools/index.ts +3 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/index.ts +2 -0
- package/packages/conversation-flow/src/__tests__/fixtures/inputs/tasks/with-assistant-group.json +156 -0
- package/packages/conversation-flow/src/__tests__/parse.test.ts +22 -0
- package/packages/conversation-flow/src/transformation/FlatListBuilder.ts +88 -11
- package/packages/database/src/models/userMemory/model.ts +1 -1
- package/packages/memory-user-memory/src/extractors/context.test.ts +0 -1
- package/packages/memory-user-memory/src/extractors/experience.test.ts +0 -1
- package/packages/memory-user-memory/src/extractors/identity.test.ts +0 -1
- package/packages/memory-user-memory/src/extractors/preference.test.ts +0 -1
- package/packages/memory-user-memory/src/schemas/context.ts +0 -2
- package/packages/memory-user-memory/src/schemas/experience.ts +0 -2
- package/packages/memory-user-memory/src/schemas/identity.ts +1 -2
- package/packages/memory-user-memory/src/schemas/preference.ts +0 -2
- package/packages/types/src/openai/chat.ts +0 -4
- package/src/app/[variants]/(main)/community/(detail)/user/features/DetailProvider.tsx +5 -1
- package/src/app/[variants]/(main)/community/(detail)/user/features/UserAgentCard.tsx +8 -8
- package/src/app/[variants]/(main)/community/(detail)/user/features/UserGroupCard.tsx +142 -15
- package/src/app/[variants]/(main)/community/(detail)/user/features/useUserDetail.ts +45 -20
- package/src/server/routers/lambda/market/agentGroup.ts +179 -1
- package/src/server/routers/lambda/userMemories/tools.ts +5 -4
- package/src/server/routers/lambda/userMemories.ts +4 -4
- package/src/server/services/discover/index.ts +4 -0
- package/src/server/services/memory/userMemory/extract.ts +3 -3
- package/src/services/chat/chat.test.ts +109 -104
- package/src/services/chat/index.ts +13 -32
- package/src/services/chat/mecha/agentConfigResolver.test.ts +113 -0
- package/src/services/chat/mecha/agentConfigResolver.ts +15 -5
- package/src/services/marketApi.ts +14 -0
- package/src/store/chat/agents/__tests__/createAgentExecutors/helpers/testExecutor.ts +13 -0
- package/src/store/chat/agents/createAgentExecutors.ts +13 -1
- package/src/store/chat/slices/aiChat/actions/__tests__/conversationControl.test.ts +5 -1
- package/src/store/chat/slices/aiChat/actions/__tests__/fixtures.ts +14 -0
- package/src/store/chat/slices/aiChat/actions/__tests__/streamingExecutor.test.ts +131 -7
- package/src/store/chat/slices/aiChat/actions/streamingExecutor.ts +61 -62
- package/src/store/chat/slices/plugin/action.test.ts +71 -0
- package/src/store/chat/slices/plugin/actions/internals.ts +14 -5
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,65 @@
|
|
|
2
2
|
|
|
3
3
|
# Changelog
|
|
4
4
|
|
|
5
|
+
## [Version 2.0.0-next.337](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.336...v2.0.0-next.337)
|
|
6
|
+
|
|
7
|
+
<sup>Released on **2026-01-22**</sup>
|
|
8
|
+
|
|
9
|
+
#### 🐛 Bug Fixes
|
|
10
|
+
|
|
11
|
+
- **misc**: Fix memory schema, update the agentbuilder tools not always use humanIntervention.
|
|
12
|
+
|
|
13
|
+
<br/>
|
|
14
|
+
|
|
15
|
+
<details>
|
|
16
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
17
|
+
|
|
18
|
+
#### What's fixed
|
|
19
|
+
|
|
20
|
+
- **misc**: Fix memory schema, closes [#11645](https://github.com/lobehub/lobe-chat/issues/11645) ([3baf780](https://github.com/lobehub/lobe-chat/commit/3baf780))
|
|
21
|
+
- **misc**: Update the agentbuilder tools not always use humanIntervention, closes [#11696](https://github.com/lobehub/lobe-chat/issues/11696) ([0d3017b](https://github.com/lobehub/lobe-chat/commit/0d3017b))
|
|
22
|
+
|
|
23
|
+
</details>
|
|
24
|
+
|
|
25
|
+
<div align="right">
|
|
26
|
+
|
|
27
|
+
[](#readme-top)
|
|
28
|
+
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
## [Version 2.0.0-next.336](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.335...v2.0.0-next.336)
|
|
32
|
+
|
|
33
|
+
<sup>Released on **2026-01-22**</sup>
|
|
34
|
+
|
|
35
|
+
#### ✨ Features
|
|
36
|
+
|
|
37
|
+
- **misc**: Support agent group unpublish agents.
|
|
38
|
+
|
|
39
|
+
#### 🐛 Bug Fixes
|
|
40
|
+
|
|
41
|
+
- **misc**: Fix tool argument scape and improve multi task run.
|
|
42
|
+
|
|
43
|
+
<br/>
|
|
44
|
+
|
|
45
|
+
<details>
|
|
46
|
+
<summary><kbd>Improvements and Fixes</kbd></summary>
|
|
47
|
+
|
|
48
|
+
#### What's improved
|
|
49
|
+
|
|
50
|
+
- **misc**: Support agent group unpublish agents, closes [#11687](https://github.com/lobehub/lobe-chat/issues/11687) ([4e060be](https://github.com/lobehub/lobe-chat/commit/4e060be))
|
|
51
|
+
|
|
52
|
+
#### What's fixed
|
|
53
|
+
|
|
54
|
+
- **misc**: Fix tool argument scape and improve multi task run, closes [#11691](https://github.com/lobehub/lobe-chat/issues/11691) ([b13bb8a](https://github.com/lobehub/lobe-chat/commit/b13bb8a))
|
|
55
|
+
|
|
56
|
+
</details>
|
|
57
|
+
|
|
58
|
+
<div align="right">
|
|
59
|
+
|
|
60
|
+
[](#readme-top)
|
|
61
|
+
|
|
62
|
+
</div>
|
|
63
|
+
|
|
5
64
|
## [Version 2.0.0-next.335](https://github.com/lobehub/lobe-chat/compare/v2.0.0-next.334...v2.0.0-next.335)
|
|
6
65
|
|
|
7
66
|
<sup>Released on **2026-01-22**</sup>
|
package/changelog/v1.json
CHANGED
|
@@ -1,4 +1,25 @@
|
|
|
1
1
|
[
|
|
2
|
+
{
|
|
3
|
+
"children": {
|
|
4
|
+
"fixes": [
|
|
5
|
+
"Fix memory schema, update the agentbuilder tools not always use humanIntervention."
|
|
6
|
+
]
|
|
7
|
+
},
|
|
8
|
+
"date": "2026-01-22",
|
|
9
|
+
"version": "2.0.0-next.337"
|
|
10
|
+
},
|
|
11
|
+
{
|
|
12
|
+
"children": {
|
|
13
|
+
"features": [
|
|
14
|
+
"Support agent group unpublish agents."
|
|
15
|
+
],
|
|
16
|
+
"fixes": [
|
|
17
|
+
"Fix tool argument scape and improve multi task run."
|
|
18
|
+
]
|
|
19
|
+
},
|
|
20
|
+
"date": "2026-01-22",
|
|
21
|
+
"version": "2.0.0-next.336"
|
|
22
|
+
},
|
|
2
23
|
{
|
|
3
24
|
"children": {},
|
|
4
25
|
"date": "2026-01-22",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lobehub/lobehub",
|
|
3
|
-
"version": "2.0.0-next.
|
|
3
|
+
"version": "2.0.0-next.337",
|
|
4
4
|
"description": "LobeHub - an open-source,comprehensive AI Agent framework that supports speech synthesis, multimodal, and extensible Function Call plugin system. Supports one-click free deployment of your private ChatGPT/LLM web application.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"framework",
|
|
@@ -27,7 +27,6 @@ export const AgentBuilderManifest: BuiltinToolManifest = {
|
|
|
27
27
|
{
|
|
28
28
|
description:
|
|
29
29
|
'Search for tools (MCP plugins) in the marketplace. Users can browse and install tools directly from the search results. Use this when users want to find new tools or capabilities.',
|
|
30
|
-
humanIntervention: 'always',
|
|
31
30
|
name: AgentBuilderApiName.searchMarketTools,
|
|
32
31
|
parameters: {
|
|
33
32
|
properties: {
|
|
@@ -57,7 +56,6 @@ export const AgentBuilderManifest: BuiltinToolManifest = {
|
|
|
57
56
|
{
|
|
58
57
|
description:
|
|
59
58
|
'Install a plugin for the agent. This tool ALWAYS REQUIRES user approval before installation, even in auto-run mode. For MCP marketplace plugins, it will install and enable the plugin. For Klavis tools and LobehubSkill providers that need OAuth, it will initiate the connection flow and wait for user to complete authorization.',
|
|
60
|
-
humanIntervention: 'always',
|
|
61
59
|
name: AgentBuilderApiName.installPlugin,
|
|
62
60
|
parameters: {
|
|
63
61
|
properties: {
|
|
@@ -84,43 +84,44 @@ export const GroupManagementManifest: BuiltinToolManifest = {
|
|
|
84
84
|
// },
|
|
85
85
|
|
|
86
86
|
// ==================== Task Execution ====================
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
},
|
|
87
|
+
// TODO: Enable executeAgentTask when ready
|
|
88
|
+
// {
|
|
89
|
+
// description:
|
|
90
|
+
// 'Assign an asynchronous task to an agent. The task runs in the background and results are returned to the conversation context upon completion. Ideal for longer operations.',
|
|
91
|
+
// name: GroupManagementApiName.executeAgentTask,
|
|
92
|
+
// humanIntervention: 'required',
|
|
93
|
+
// parameters: {
|
|
94
|
+
// properties: {
|
|
95
|
+
// agentId: {
|
|
96
|
+
// description: 'The ID of the agent to execute the task.',
|
|
97
|
+
// type: 'string',
|
|
98
|
+
// },
|
|
99
|
+
// title: {
|
|
100
|
+
// description: 'Brief title describing what this task does (shown in UI).',
|
|
101
|
+
// type: 'string',
|
|
102
|
+
// },
|
|
103
|
+
// task: {
|
|
104
|
+
// description:
|
|
105
|
+
// 'Clear description of the task to perform. Be specific about expected deliverables.',
|
|
106
|
+
// type: 'string',
|
|
107
|
+
// },
|
|
108
|
+
// timeout: {
|
|
109
|
+
// default: 1_800_000,
|
|
110
|
+
// description:
|
|
111
|
+
// 'Maximum time in milliseconds to wait for task completion (default: 1800000, 30 minutes).',
|
|
112
|
+
// type: 'number',
|
|
113
|
+
// },
|
|
114
|
+
// skipCallSupervisor: {
|
|
115
|
+
// default: false,
|
|
116
|
+
// description:
|
|
117
|
+
// 'If true, the orchestration will end after the task completes, without calling the supervisor again. Use this when the task is the final action needed.',
|
|
118
|
+
// type: 'boolean',
|
|
119
|
+
// },
|
|
120
|
+
// },
|
|
121
|
+
// required: ['agentId', 'title', 'task'],
|
|
122
|
+
// type: 'object',
|
|
123
|
+
// },
|
|
124
|
+
// },
|
|
124
125
|
// TODO: Enable executeAgentTasks when ready
|
|
125
126
|
// {
|
|
126
127
|
// description:
|
|
@@ -168,22 +169,22 @@ export const GroupManagementManifest: BuiltinToolManifest = {
|
|
|
168
169
|
// type: 'object',
|
|
169
170
|
// },
|
|
170
171
|
// },
|
|
171
|
-
{
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
},
|
|
172
|
+
// {
|
|
173
|
+
// description:
|
|
174
|
+
// 'Interrupt a running agent task. Use this to stop a task that is taking too long or is no longer needed.',
|
|
175
|
+
// humanIntervention: 'always',
|
|
176
|
+
// name: GroupManagementApiName.interrupt,
|
|
177
|
+
// parameters: {
|
|
178
|
+
// properties: {
|
|
179
|
+
// taskId: {
|
|
180
|
+
// description: 'The ID of the task to interrupt (returned by executeTask).',
|
|
181
|
+
// type: 'string',
|
|
182
|
+
// },
|
|
183
|
+
// },
|
|
184
|
+
// required: ['taskId'],
|
|
185
|
+
// type: 'object',
|
|
186
|
+
// },
|
|
187
|
+
// },
|
|
187
188
|
|
|
188
189
|
// ==================== Context Management ====================
|
|
189
190
|
// {
|
|
@@ -7,45 +7,38 @@
|
|
|
7
7
|
export const systemPrompt = `You are a Group Supervisor with tools to orchestrate multi-agent collaboration. Your primary responsibility is to coordinate agents effectively by choosing the right mode of interaction.
|
|
8
8
|
|
|
9
9
|
<core_decision_framework>
|
|
10
|
-
##
|
|
10
|
+
## Communication Mode Selection
|
|
11
11
|
|
|
12
|
-
Before involving any agent,
|
|
12
|
+
Before involving any agent, determine the best communication approach:
|
|
13
13
|
|
|
14
|
-
### 🗣️
|
|
15
|
-
**Use when
|
|
14
|
+
### 🗣️ Single Agent (speak)
|
|
15
|
+
**Use when one agent's expertise is sufficient** - the agent shares the group's conversation context.
|
|
16
16
|
|
|
17
17
|
Characteristics:
|
|
18
18
|
- Agent responds based on their expertise and knowledge
|
|
19
19
|
- Agent sees the group conversation history
|
|
20
20
|
- Response is immediate and synchronous
|
|
21
|
-
-
|
|
22
|
-
- Lightweight, quick interactions
|
|
21
|
+
- Focused, single-perspective response
|
|
23
22
|
|
|
24
23
|
Best for:
|
|
25
|
-
-
|
|
26
|
-
-
|
|
27
|
-
-
|
|
28
|
-
- Reviewing/critiquing content presented in conversation
|
|
29
|
-
- Quick consultations
|
|
30
|
-
- Discussion and debate
|
|
24
|
+
- Follow-up questions to a specific agent
|
|
25
|
+
- Tasks clearly matching one agent's expertise
|
|
26
|
+
- When user explicitly requests a specific agent
|
|
31
27
|
|
|
32
|
-
###
|
|
33
|
-
**Use when
|
|
28
|
+
### 📢 Multiple Agents (broadcast)
|
|
29
|
+
**Use when diverse perspectives are valuable** - all agents share the group's conversation context.
|
|
34
30
|
|
|
35
31
|
Characteristics:
|
|
36
|
-
-
|
|
37
|
-
-
|
|
38
|
-
-
|
|
39
|
-
- Each agent completes their task independently
|
|
40
|
-
- Results are returned to the group when done
|
|
32
|
+
- Multiple agents respond in parallel
|
|
33
|
+
- All agents see the same conversation history
|
|
34
|
+
- Quick gathering of multiple viewpoints
|
|
41
35
|
|
|
42
36
|
Best for:
|
|
43
|
-
-
|
|
44
|
-
-
|
|
45
|
-
-
|
|
46
|
-
-
|
|
47
|
-
-
|
|
48
|
-
- Any task where the agent needs to "do something" not just "say something"
|
|
37
|
+
- Sharing opinions, perspectives, or advice
|
|
38
|
+
- Answering questions from knowledge
|
|
39
|
+
- Brainstorming and ideation
|
|
40
|
+
- Reviewing/critiquing content presented in conversation
|
|
41
|
+
- Discussion and debate
|
|
49
42
|
|
|
50
43
|
## Decision Flowchart
|
|
51
44
|
|
|
@@ -53,36 +46,23 @@ Best for:
|
|
|
53
46
|
User Request
|
|
54
47
|
│
|
|
55
48
|
▼
|
|
56
|
-
Does the task
|
|
57
|
-
(search web, write code, call APIs, process files, etc.)
|
|
49
|
+
Does the task need multiple perspectives?
|
|
58
50
|
│
|
|
59
|
-
├─── YES ──→
|
|
51
|
+
├─── YES ──→ broadcast (parallel speaking)
|
|
60
52
|
│
|
|
61
|
-
└─── NO ───→
|
|
62
|
-
│
|
|
63
|
-
├─── YES ──→ broadcast (parallel speaking)
|
|
64
|
-
│
|
|
65
|
-
└─── NO ───→ speak (single agent)
|
|
53
|
+
└─── NO ───→ speak (single agent)
|
|
66
54
|
\`\`\`
|
|
67
55
|
</core_decision_framework>
|
|
68
56
|
|
|
69
57
|
<user_intent_analysis>
|
|
70
58
|
Before responding, analyze the user's intent:
|
|
71
59
|
|
|
72
|
-
**Signals for
|
|
73
|
-
- "Search for...", "Find information about...", "Research..."
|
|
74
|
-
- "Write code to...", "Create a script that...", "Implement..."
|
|
75
|
-
- "Analyze this file...", "Process this data..."
|
|
76
|
-
- "Generate a report...", "Create documentation..."
|
|
77
|
-
- Tasks that clearly require external tools or multi-step operations
|
|
78
|
-
- When multiple agents need to work on different parts independently
|
|
79
|
-
|
|
80
|
-
**Signals for Speaking (speak/broadcast):**
|
|
60
|
+
**Signals for Multiple Agents (broadcast):**
|
|
81
61
|
- "What do you think about...", "Any ideas for...", "How should we..."
|
|
82
62
|
- "Review this...", "Give me feedback on...", "Critique..."
|
|
83
63
|
- "Explain...", "Compare...", "Summarize..."
|
|
84
64
|
- Requests for opinions, perspectives, or expertise-based answers
|
|
85
|
-
- Questions that
|
|
65
|
+
- Questions that benefit from diverse viewpoints
|
|
86
66
|
|
|
87
67
|
**Signals for Single Agent (speak):**
|
|
88
68
|
- Explicit request: "Ask [Agent Name] to...", "Let [Agent Name] answer..."
|
|
@@ -90,7 +70,6 @@ Before responding, analyze the user's intent:
|
|
|
90
70
|
- Task clearly matches only one agent's expertise
|
|
91
71
|
|
|
92
72
|
**Default Behavior:**
|
|
93
|
-
- When in doubt about tool usage → Ask yourself: "Can this be answered with knowledge alone, or does it require the agent to DO something?"
|
|
94
73
|
- When in doubt about single vs multiple agents → Lean towards broadcast for diverse perspectives
|
|
95
74
|
</user_intent_analysis>
|
|
96
75
|
|
|
@@ -150,115 +129,68 @@ When a user's request is broad or unclear, ask 1-2 focused questions to understa
|
|
|
150
129
|
<core_capabilities>
|
|
151
130
|
## Tool Categories
|
|
152
131
|
|
|
153
|
-
**
|
|
132
|
+
**Communication:**
|
|
154
133
|
- **speak**: Single agent responds synchronously in group context
|
|
155
134
|
- **broadcast**: Multiple agents respond in parallel in group context
|
|
156
135
|
|
|
157
|
-
**Task Execution (Independent Context, With Tools):**
|
|
158
|
-
- **executeAgentTask**: Assign a task to one agent in isolated context
|
|
159
|
-
- **interrupt**: Stop a running task
|
|
160
|
-
|
|
161
136
|
**Flow Control:**
|
|
162
|
-
- **summarize**: Compress conversation context
|
|
163
137
|
- **vote**: Initiate voting among agents
|
|
164
138
|
</core_capabilities>
|
|
165
139
|
|
|
166
140
|
<workflow_patterns>
|
|
167
141
|
## Pattern Selection Guide
|
|
168
142
|
|
|
169
|
-
### Pattern 1: Discussion/Consultation (
|
|
170
|
-
When you need opinions, feedback, or knowledge-based responses.
|
|
143
|
+
### Pattern 1: Discussion/Consultation (Broadcast)
|
|
144
|
+
When you need opinions, feedback, or knowledge-based responses from multiple agents.
|
|
171
145
|
|
|
172
146
|
\`\`\`
|
|
173
147
|
User: "What do you think about using microservices for this project?"
|
|
174
|
-
Analysis: Opinion-based,
|
|
148
|
+
Analysis: Opinion-based, benefits from diverse perspectives
|
|
175
149
|
Action: broadcast to [Architect, DevOps, Backend] - share perspectives
|
|
176
150
|
\`\`\`
|
|
177
151
|
|
|
178
|
-
### Pattern 2:
|
|
179
|
-
When an agent needs to research/work independently using their tools.
|
|
180
|
-
|
|
181
|
-
\`\`\`
|
|
182
|
-
User: "Research the pros and cons of React"
|
|
183
|
-
Analysis: Requires web search, agent works independently
|
|
184
|
-
Action: executeAgentTask to frontend expert
|
|
185
|
-
executeAgentTask({
|
|
186
|
-
agentId: "frontend-expert",
|
|
187
|
-
title: "Research React",
|
|
188
|
-
task: "Research React ecosystem, performance benchmarks, community size, and typical use cases. Provide pros and cons."
|
|
189
|
-
})
|
|
190
|
-
\`\`\`
|
|
191
|
-
|
|
192
|
-
### Pattern 3: Sequential Discussion (Speaking Chain)
|
|
152
|
+
### Pattern 2: Sequential Discussion (Speaking Chain)
|
|
193
153
|
When each response should build on previous ones.
|
|
194
154
|
|
|
195
155
|
\`\`\`
|
|
196
156
|
User: "Design a notification system architecture"
|
|
197
|
-
Analysis: Build-upon discussion,
|
|
157
|
+
Analysis: Build-upon discussion, each agent adds to previous response
|
|
198
158
|
Action:
|
|
199
159
|
1. speak to Architect: "Propose high-level architecture"
|
|
200
160
|
2. speak to Backend: "Evaluate and add implementation details"
|
|
201
161
|
3. speak to DevOps: "Add deployment and scaling considerations"
|
|
202
162
|
\`\`\`
|
|
203
163
|
|
|
204
|
-
### Pattern
|
|
205
|
-
When
|
|
164
|
+
### Pattern 3: Focused Consultation (Speak)
|
|
165
|
+
When a specific agent's expertise is needed.
|
|
206
166
|
|
|
207
167
|
\`\`\`
|
|
208
|
-
User: "
|
|
209
|
-
Analysis:
|
|
210
|
-
Action:
|
|
211
|
-
1. executeAgentTask({
|
|
212
|
-
agentId: "devops",
|
|
213
|
-
title: "K8s Adoption Research",
|
|
214
|
-
task: "Research Kubernetes adoption best practices for our scale. Include migration complexity, resource requirements, operational overhead, and security considerations."
|
|
215
|
-
})
|
|
216
|
-
2. [Wait for results]
|
|
217
|
-
3. broadcast: "Based on the research, share your recommendations"
|
|
218
|
-
\`\`\`
|
|
219
|
-
|
|
220
|
-
### Pattern 5: Implementation Task
|
|
221
|
-
When an agent needs to create deliverables using their tools.
|
|
222
|
-
|
|
223
|
-
\`\`\`
|
|
224
|
-
User: "Write the landing page copy"
|
|
225
|
-
Analysis: Agent produces artifacts using their tools
|
|
226
|
-
Action: executeAgentTask({
|
|
227
|
-
agentId: "copywriter",
|
|
228
|
-
title: "Write Copy",
|
|
229
|
-
task: "Write compelling landing page copy for [product]. Include headline, subheadline, feature descriptions, and CTA text."
|
|
230
|
-
})
|
|
168
|
+
User: "Ask the frontend expert about React performance"
|
|
169
|
+
Analysis: User explicitly requested specific agent
|
|
170
|
+
Action: speak to frontend expert with the question
|
|
231
171
|
\`\`\`
|
|
232
172
|
</workflow_patterns>
|
|
233
173
|
|
|
234
174
|
<tool_usage_guidelines>
|
|
235
|
-
**
|
|
175
|
+
**Communication:**
|
|
236
176
|
- speak: \`agentId\`, \`instruction\` (optional guidance)
|
|
237
177
|
- broadcast: \`agentIds\` (array), \`instruction\` (optional shared guidance)
|
|
238
178
|
|
|
239
|
-
**Task Execution:**
|
|
240
|
-
- executeAgentTask: \`agentId\`, \`title\`, \`task\` (clear deliverable description), \`timeout\` (optional, default 30min)
|
|
241
|
-
- interrupt: \`taskId\`
|
|
242
|
-
|
|
243
179
|
**Flow Control:**
|
|
244
|
-
- summarize: \`focus\` (optional), \`preserveRecent\` (messages to keep, default 5)
|
|
245
180
|
- vote: \`question\`, \`options\` (array of {id, label, description}), \`voterAgentIds\` (optional), \`requireReasoning\` (default true)
|
|
246
181
|
</tool_usage_guidelines>
|
|
247
182
|
|
|
248
183
|
<best_practices>
|
|
249
|
-
1. **
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
7. **Summarize proactively**: Compress context before it grows too large
|
|
255
|
-
8. **Explain your choices**: Tell users why you chose speaking vs task execution
|
|
184
|
+
1. **Keep it simple**: Use speak for single agent, broadcast for multiple perspectives
|
|
185
|
+
2. **Parallel when possible**: Use broadcast to gather diverse viewpoints quickly
|
|
186
|
+
3. **Sequential when dependent**: Use speak chain when each response builds on previous
|
|
187
|
+
4. **Be clear with instructions**: Provide context to help agents give better responses
|
|
188
|
+
5. **Explain your choices**: Tell users why you chose speak vs broadcast
|
|
256
189
|
</best_practices>
|
|
257
190
|
|
|
258
191
|
<response_format>
|
|
259
192
|
When orchestrating:
|
|
260
|
-
1. Briefly explain your mode choice: "
|
|
261
|
-
2.
|
|
262
|
-
3.
|
|
263
|
-
4. Reference agents clearly: "Agent [Name] suggests..." or "Task [taskId] completed with..."
|
|
193
|
+
1. Briefly explain your mode choice: "I'll ask [agent] because..." or "I'll gather perspectives from multiple agents because..."
|
|
194
|
+
2. After agents respond, synthesize results and provide actionable conclusions
|
|
195
|
+
3. Reference agents clearly: "Agent [Name] suggests..."
|
|
264
196
|
</response_format>`;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinRenderProps } from '@lobechat/types';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { AddPreferenceMemoryParams, AddPreferenceMemoryState } from '../../../types';
|
|
7
|
+
import { PreferenceMemoryCard } from '../../components';
|
|
8
|
+
|
|
9
|
+
const AddPreferenceMemoryRender = memo<
|
|
10
|
+
BuiltinRenderProps<AddPreferenceMemoryParams, AddPreferenceMemoryState>
|
|
11
|
+
>(({ args }) => {
|
|
12
|
+
return <PreferenceMemoryCard data={args} />;
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
AddPreferenceMemoryRender.displayName = 'AddPreferenceMemoryRender';
|
|
16
|
+
|
|
17
|
+
export default AddPreferenceMemoryRender;
|
|
@@ -2,6 +2,7 @@ import type { BuiltinRender } from '@lobechat/types';
|
|
|
2
2
|
|
|
3
3
|
import { MemoryApiName } from '../../types';
|
|
4
4
|
import AddExperienceMemoryRender from './AddExperienceMemory';
|
|
5
|
+
import AddPreferenceMemoryRender from './AddPreferenceMemory';
|
|
5
6
|
import SearchUserMemoryRender from './SearchUserMemory';
|
|
6
7
|
|
|
7
8
|
/**
|
|
@@ -11,5 +12,6 @@ import SearchUserMemoryRender from './SearchUserMemory';
|
|
|
11
12
|
*/
|
|
12
13
|
export const MemoryRenders: Record<string, BuiltinRender> = {
|
|
13
14
|
[MemoryApiName.addExperienceMemory]: AddExperienceMemoryRender as BuiltinRender,
|
|
15
|
+
[MemoryApiName.addPreferenceMemory]: AddPreferenceMemoryRender as BuiltinRender,
|
|
14
16
|
[MemoryApiName.searchUserMemory]: SearchUserMemoryRender as BuiltinRender,
|
|
15
17
|
};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
|
|
3
|
+
import type { BuiltinStreamingProps } from '@lobechat/types';
|
|
4
|
+
import { memo } from 'react';
|
|
5
|
+
|
|
6
|
+
import type { AddPreferenceMemoryParams } from '../../../types';
|
|
7
|
+
import { PreferenceMemoryCard } from '../../components';
|
|
8
|
+
|
|
9
|
+
export const AddPreferenceMemoryStreaming = memo<BuiltinStreamingProps<AddPreferenceMemoryParams>>(
|
|
10
|
+
({ args }) => {
|
|
11
|
+
return <PreferenceMemoryCard data={args} loading />;
|
|
12
|
+
},
|
|
13
|
+
);
|
|
14
|
+
|
|
15
|
+
AddPreferenceMemoryStreaming.displayName = 'AddPreferenceMemoryStreaming';
|
|
16
|
+
|
|
17
|
+
export default AddPreferenceMemoryStreaming;
|
|
@@ -2,6 +2,7 @@ import { type BuiltinStreaming } from '@lobechat/types';
|
|
|
2
2
|
|
|
3
3
|
import { MemoryApiName } from '../../types';
|
|
4
4
|
import { AddExperienceMemoryStreaming } from './AddExperienceMemory';
|
|
5
|
+
import { AddPreferenceMemoryStreaming } from './AddPreferenceMemory';
|
|
5
6
|
|
|
6
7
|
/**
|
|
7
8
|
* Memory Streaming Components Registry
|
|
@@ -11,8 +12,8 @@ import { AddExperienceMemoryStreaming } from './AddExperienceMemory';
|
|
|
11
12
|
*/
|
|
12
13
|
export const MemoryStreamings: Record<string, BuiltinStreaming> = {
|
|
13
14
|
[MemoryApiName.addExperienceMemory]: AddExperienceMemoryStreaming as BuiltinStreaming,
|
|
15
|
+
[MemoryApiName.addPreferenceMemory]: AddPreferenceMemoryStreaming as BuiltinStreaming,
|
|
14
16
|
};
|
|
15
17
|
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
export {AddExperienceMemoryStreaming} from './AddExperienceMemory';
|
|
18
|
+
export { AddExperienceMemoryStreaming } from './AddExperienceMemory';
|
|
19
|
+
export { AddPreferenceMemoryStreaming } from './AddPreferenceMemory';
|