sam-coder-cli 1.0.38 ā 1.0.40
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/bin/ai-team.js +21 -2
- package/package.json +1 -1
package/bin/ai-team.js
CHANGED
|
@@ -1,9 +1,25 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
// Import dependencies at runtime to avoid circular dependencies
|
|
2
|
+
let callOpenRouter;
|
|
3
|
+
let MultiplayerClient;
|
|
3
4
|
const readline = require('readline');
|
|
4
5
|
const chalk = require('chalk');
|
|
5
6
|
const { v4: uuidv4 } = require('uuid');
|
|
6
7
|
|
|
8
|
+
// Lazy load dependencies to avoid circular dependencies
|
|
9
|
+
function getCallOpenRouter() {
|
|
10
|
+
if (!callOpenRouter) {
|
|
11
|
+
callOpenRouter = require('./agi-cli').callOpenRouter;
|
|
12
|
+
}
|
|
13
|
+
return callOpenRouter;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
function getMultiplayerClient() {
|
|
17
|
+
if (!MultiplayerClient) {
|
|
18
|
+
MultiplayerClient = require('./multiplayer-client').MultiplayerClient;
|
|
19
|
+
}
|
|
20
|
+
return MultiplayerClient;
|
|
21
|
+
}
|
|
22
|
+
|
|
7
23
|
// System prompt for AI team collaboration
|
|
8
24
|
const TEAM_COLLABORATION_PROMPT = `You are an AI team facilitator that helps coordinate multiple AI agents working together on a project.
|
|
9
25
|
|
|
@@ -23,6 +39,7 @@ Respond in markdown format with clear sections for each part of your response.`;
|
|
|
23
39
|
|
|
24
40
|
class AITeam {
|
|
25
41
|
constructor(options = {}) {
|
|
42
|
+
const MultiplayerClient = getMultiplayerClient();
|
|
26
43
|
this.client = new MultiplayerClient({
|
|
27
44
|
name: options.name || `Agent-${uuidv4().substr(0, 4)}`,
|
|
28
45
|
role: options.role || 'DEVELOPER',
|
|
@@ -125,6 +142,7 @@ class AITeam {
|
|
|
125
142
|
this.conversation.push({ role: 'user', content: input });
|
|
126
143
|
|
|
127
144
|
// Get AI response
|
|
145
|
+
const callOpenRouter = getCallOpenRouter();
|
|
128
146
|
const response = await callOpenRouter(this.conversation, this.client.model);
|
|
129
147
|
const aiMessage = response.choices[0].message;
|
|
130
148
|
|
|
@@ -171,6 +189,7 @@ class AITeam {
|
|
|
171
189
|
console.log(chalk.blue(`\nš Task received: ${task.description}`));
|
|
172
190
|
|
|
173
191
|
// Process the task using the AGI-CLI's tool calling system
|
|
192
|
+
const callOpenRouter = getCallOpenRouter();
|
|
174
193
|
const response = await callOpenRouter([
|
|
175
194
|
{ role: 'system', content: `You are an AI assistant working on a task: ${task.description}` },
|
|
176
195
|
{ role: 'user', content: 'Please complete this task step by step.' }
|