@fractal-solutions/qflow 1.0.35 → 1.0.37
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/agent/agent.js +20 -5
- package/dist/agent/tools.js +1 -1
- package/package.json +1 -1
package/dist/agent/agent.js
CHANGED
|
@@ -26,7 +26,7 @@ export class AgentNode extends AsyncNode {
|
|
|
26
26
|
this.conversationHistory = [
|
|
27
27
|
{ role: "system", content: this.getSystemPrompt() },
|
|
28
28
|
{ role: "user", content: `Goal: ${goal}` },
|
|
29
|
-
{ role: "system", content: "
|
|
29
|
+
{ role: "system", content: "You are now at the 'Understand & Explore' phase. Analyze the user's request and the directory/codebase, then formulate a plan." }
|
|
30
30
|
];
|
|
31
31
|
let step = 0;
|
|
32
32
|
let finalOutput = null;
|
|
@@ -66,7 +66,7 @@ export class AgentNode extends AsyncNode {
|
|
|
66
66
|
this.conversationHistory.push({ role: "assistant", content: JSON.stringify({ thought, tool_calls: toolCalls, parallel }) });
|
|
67
67
|
// If no tool calls, continue the loop to allow the LLM to re-evaluate
|
|
68
68
|
if (toolCalls.length === 0) {
|
|
69
|
-
this.conversationHistory.push({ role: "system", content: "
|
|
69
|
+
this.conversationHistory.push({ role: "system", content: "Your last step resulted in no action. Re-evaluate your plan. If you are stuck, consider using a different tool or asking the user for clarification with the 'interactive_input'tool." });
|
|
70
70
|
continue;
|
|
71
71
|
}
|
|
72
72
|
// Handle finish tool
|
|
@@ -83,7 +83,7 @@ export class AgentNode extends AsyncNode {
|
|
|
83
83
|
if (confirmation.toLowerCase() !== 'yes') {
|
|
84
84
|
logger.info("Agent finish denied by user. User input will be the next prompt.");
|
|
85
85
|
// Treat the user's new input as a new instruction/goal
|
|
86
|
-
this.conversationHistory.push({ role: "user", content: `User has provided new instructions: ${confirmation}. Please adjust your plan and continue working.` });
|
|
86
|
+
this.conversationHistory.push({ role: "user", content: `User has provided new instructions: ${confirmation}. Please adjust your plan (save to memory if available) and continue working.` });
|
|
87
87
|
// Optionally, you might want to clear some of the previous conversation history
|
|
88
88
|
// to give more weight to the new instruction, but be careful not to lose context.
|
|
89
89
|
// For now, we'll just add the new instruction.
|
|
@@ -159,7 +159,7 @@ export class AgentNode extends AsyncNode {
|
|
|
159
159
|
logger.error(`Error during tool execution: ${e.message}`);
|
|
160
160
|
this.conversationHistory.push({ role: "user", content: `Error: Tool execution failed with message: ${e.message}. You should try a different approach.` });
|
|
161
161
|
}
|
|
162
|
-
this.conversationHistory.push({ role: "system", content: "
|
|
162
|
+
this.conversationHistory.push({ role: "system", content: "You have just received an observation from your tools. Analyze the result and proceed to the next step in your plan. If the observation was an error, you must adjust your plan to fix the error." });
|
|
163
163
|
}
|
|
164
164
|
if (step >= this.maxSteps && finalOutput === null) {
|
|
165
165
|
const message = "Agent reached max steps without finishing. Last observation: " + JSON.stringify(this.conversationHistory[this.conversationHistory.length - 1]);
|
|
@@ -206,7 +206,22 @@ export class AgentNode extends AsyncNode {
|
|
|
206
206
|
Parameters: ${params}`;
|
|
207
207
|
}).join('\n');
|
|
208
208
|
const flowRegistryDescription = Object.keys(this.flowRegistry).length > 0 ? `\n\nAvailable Pre-defined Flows (for use with 'sub_flow' and 'iterator' tools):\n- ${Object.keys(this.flowRegistry).join('\n- ')}` : "";
|
|
209
|
-
return `You are
|
|
209
|
+
return `You are a senior Expert Computer User and AI software engineer. Your primary directive is to solve tasks by
|
|
210
|
+
effectively and impactfully using the tools available to you. You must operate with a professional software
|
|
211
|
+
engineering mindset by following a structured, non-negotiable workflow for every task:
|
|
212
|
+
|
|
213
|
+
|
|
214
|
+
Understand & Explore: Use commands (like glob, read, write, append, grep etc) to analyze the existing
|
|
215
|
+
directory/codebase/task. You must understand the context before you act.
|
|
216
|
+
Plan: Create a detailed, step-by-step plan. Present this plan in your 'thought'.
|
|
217
|
+
Execute: Execute the plan using the available tools.
|
|
218
|
+
Verify: After making changes, you MUST run tests to verify correctness of tool use.
|
|
219
|
+
|
|
220
|
+
|
|
221
|
+
Your response MUST be a single JSON object with 'thought' and 'tool_calls'. The 'thought'
|
|
222
|
+
field must contain your reasoning and current step in the plan. Do not add notes outside
|
|
223
|
+
the JSON structure. If you have a plan, you MUST include at least one tool call. An empty
|
|
224
|
+
'tool_calls' array means you are thinking or waiting for user input.`;
|
|
210
225
|
}
|
|
211
226
|
async getLLMAction() {
|
|
212
227
|
await this.manageConversationHistory();
|
package/dist/agent/tools.js
CHANGED
|
@@ -714,7 +714,7 @@ export function getToolDefinitions() {
|
|
|
714
714
|
},
|
|
715
715
|
{
|
|
716
716
|
name: "shell_command",
|
|
717
|
-
description: "Executes shell commands.",
|
|
717
|
+
description: "Executes shell commands. When running long running processes like npm run dev or bun run dev, add an ampersand (&) to the end to run in the background eg. 'npm run dev &'",
|
|
718
718
|
parameters: {
|
|
719
719
|
type: "object",
|
|
720
720
|
properties: {
|
package/package.json
CHANGED