feat: add tools property to agent definitions for enhanced functionality. Otherwise opencode consders the subagents as readonly

This commit is contained in:
Javier Gomez 2025-09-10 12:34:24 +02:00
parent c4c4331801
commit b381290863
1 changed files with 4 additions and 0 deletions

View File

@ -269,6 +269,7 @@ class IdeSetup extends BaseIdeSetup {
const agentDef = { const agentDef = {
prompt: fileRef, prompt: fileRef,
mode: isOrchestratorAgent(agentId) ? 'primary' : 'subagent', mode: isOrchestratorAgent(agentId) ? 'primary' : 'subagent',
tools: { write: true, edit: true, bash: true },
}; };
if (!existing) { if (!existing) {
configObj.agent[key] = agentDef; configObj.agent[key] = agentDef;
@ -281,6 +282,7 @@ class IdeSetup extends BaseIdeSetup {
) { ) {
existing.prompt = agentDef.prompt; existing.prompt = agentDef.prompt;
existing.mode = agentDef.mode; existing.mode = agentDef.mode;
existing.tools = { write: true, edit: true, bash: true };
configObj.agent[key] = existing; configObj.agent[key] = existing;
summary.agentsUpdated++; summary.agentsUpdated++;
} else { } else {
@ -300,6 +302,7 @@ class IdeSetup extends BaseIdeSetup {
const agentDef = { const agentDef = {
prompt: fileRef, prompt: fileRef,
mode: isOrchestratorAgent(agentId) ? 'primary' : 'subagent', mode: isOrchestratorAgent(agentId) ? 'primary' : 'subagent',
tools: { write: true, edit: true, bash: true },
}; };
if (!existing) { if (!existing) {
configObj.agent[prefixedKey] = agentDef; configObj.agent[prefixedKey] = agentDef;
@ -312,6 +315,7 @@ class IdeSetup extends BaseIdeSetup {
) { ) {
existing.prompt = agentDef.prompt; existing.prompt = agentDef.prompt;
existing.mode = agentDef.mode; existing.mode = agentDef.mode;
existing.tools = { write: true, edit: true, bash: true };
configObj.agent[prefixedKey] = existing; configObj.agent[prefixedKey] = existing;
summary.agentsUpdated++; summary.agentsUpdated++;
} else { } else {