@townco/agent 0.1.116 → 0.1.117
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.
|
@@ -334,7 +334,9 @@ export class LangchainAgent {
|
|
|
334
334
|
const nonMcpToolMetadata = enabledTools.map(extractToolMetadata);
|
|
335
335
|
const nonMcpToolDefinitionsTokens = estimateAllToolsOverhead(nonMcpToolMetadata);
|
|
336
336
|
// Calculate TODO_WRITE_INSTRUCTIONS overhead if applicable
|
|
337
|
-
|
|
337
|
+
// Skip for subagents since the todo_write tool is filtered out for them
|
|
338
|
+
const isSubagentForTokens = req.sessionMeta?.[SUBAGENT_MODE_KEY] === true;
|
|
339
|
+
const hasTodoWriteTool = builtInNames.includes("todo_write") && !isSubagentForTokens;
|
|
338
340
|
const todoInstructionsTokens = hasTodoWriteTool
|
|
339
341
|
? countTokens(TODO_WRITE_INSTRUCTIONS)
|
|
340
342
|
: 0;
|
|
@@ -623,7 +625,9 @@ export class LangchainAgent {
|
|
|
623
625
|
agentConfig.systemPrompt = effectiveSystemPrompt;
|
|
624
626
|
}
|
|
625
627
|
// Inject system prompt with optional TodoWrite instructions
|
|
626
|
-
|
|
628
|
+
// Skip for subagents since the todo_write tool is filtered out for them
|
|
629
|
+
const isSubagentForPrompt = req.sessionMeta?.[SUBAGENT_MODE_KEY] === true;
|
|
630
|
+
const hasTodoWrite = builtInNames.includes("todo_write") && !isSubagentForPrompt;
|
|
627
631
|
if (hasTodoWrite) {
|
|
628
632
|
agentConfig.systemPrompt = `${agentConfig.systemPrompt ?? ""}\n\n${TODO_WRITE_INSTRUCTIONS}`;
|
|
629
633
|
}
|