@grec0/memory-bank-mcp 0.2.8 → 0.2.9
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/tools/routeTask.js +10 -5
- package/package.json +1 -1
package/dist/tools/routeTask.js
CHANGED
|
@@ -242,9 +242,9 @@ export async function routeTaskTool(params, indexManager) {
|
|
|
242
242
|
content: prompt,
|
|
243
243
|
},
|
|
244
244
|
];
|
|
245
|
-
// Tool calling loop (max
|
|
245
|
+
// Tool calling loop (max 20 iterations to prevent infinite loops)
|
|
246
246
|
let iterations = 0;
|
|
247
|
-
const maxIterations =
|
|
247
|
+
const maxIterations = 20;
|
|
248
248
|
let finalResponse = null;
|
|
249
249
|
while (iterations < maxIterations) {
|
|
250
250
|
iterations++;
|
|
@@ -255,7 +255,7 @@ export async function routeTaskTool(params, indexManager) {
|
|
|
255
255
|
reasoning: {
|
|
256
256
|
effort: reasoningEffort,
|
|
257
257
|
},
|
|
258
|
-
instructions: "You are a Task Routing Orchestrator. Analyze tasks and route them to appropriate projects. You can use semantic_search to verify where code exists before making decisions. Always respond with JSON after your analysis.",
|
|
258
|
+
instructions: "You are a Task Routing Orchestrator. Analyze tasks and route them to appropriate projects. You can use semantic_search to verify where code exists before making decisions. Always respond with JSON after your analysis. ti",
|
|
259
259
|
input,
|
|
260
260
|
tools: ORCHESTRATOR_TOOLS,
|
|
261
261
|
tool_choice: "auto",
|
|
@@ -264,6 +264,7 @@ export async function routeTaskTool(params, indexManager) {
|
|
|
264
264
|
// Process output items from Responses API
|
|
265
265
|
let hasToolCalls = false;
|
|
266
266
|
const toolCalls = [];
|
|
267
|
+
let messageContent = null;
|
|
267
268
|
for (const item of response.output || []) {
|
|
268
269
|
if (item.type === "function_call") {
|
|
269
270
|
hasToolCalls = true;
|
|
@@ -277,11 +278,12 @@ export async function routeTaskTool(params, indexManager) {
|
|
|
277
278
|
// Extract text content from message
|
|
278
279
|
for (const contentItem of item.content) {
|
|
279
280
|
if (contentItem.type === "output_text") {
|
|
280
|
-
|
|
281
|
+
messageContent = contentItem.text;
|
|
281
282
|
}
|
|
282
283
|
}
|
|
283
284
|
}
|
|
284
285
|
}
|
|
286
|
+
console.error(` Output: ${hasToolCalls ? toolCalls.length + ' tool call(s)' : 'no tools'}, message: ${messageContent ? 'yes' : 'no'}`);
|
|
285
287
|
if (hasToolCalls) {
|
|
286
288
|
console.error(` Model requested ${toolCalls.length} tool call(s)`);
|
|
287
289
|
// Execute each tool call and add results to input
|
|
@@ -301,8 +303,11 @@ export async function routeTaskTool(params, indexManager) {
|
|
|
301
303
|
output: toolResult,
|
|
302
304
|
});
|
|
303
305
|
}
|
|
306
|
+
// Continue to next iteration to get the final response
|
|
304
307
|
}
|
|
305
|
-
else if (
|
|
308
|
+
else if (messageContent) {
|
|
309
|
+
// No tool calls, just a message - this is the final response
|
|
310
|
+
finalResponse = messageContent;
|
|
306
311
|
console.error(` Final response received`);
|
|
307
312
|
break;
|
|
308
313
|
}
|