Browse Source

fix: allow question permission for orchestrator only (#25)

Ivan Marshall Widjaja 2 months ago
parent
commit
510b096e91
1 changed files with 8 additions and 0 deletions
  1. 8 0
      src/agents/index.ts

+ 8 - 0
src/agents/index.ts

@@ -22,6 +22,13 @@ function applyOverrides(agent: AgentDefinition, override: AgentOverrideConfig):
   }
 }
 
+type PermissionValue = "ask" | "allow" | "deny";
+
+function applyDefaultPermissions(agent: AgentDefinition): void {
+  const existing = (agent.config.permission ?? {}) as Record<string, PermissionValue>;
+  agent.config.permission = { ...existing, question: "allow" } as SDKAgentConfig["permission"];
+}
+
 type SubagentName = Exclude<AgentName, "orchestrator">;
 
 /** Agent factories indexed by name */
@@ -64,6 +71,7 @@ export function createAgents(config?: PluginConfig): AgentDefinition[] {
   const orchestratorModel =
     agentOverrides["orchestrator"]?.model ?? DEFAULT_MODELS["orchestrator"];
   const orchestrator = createOrchestratorAgent(orchestratorModel);
+  applyDefaultPermissions(orchestrator);
   const oOverride = agentOverrides["orchestrator"];
   if (oOverride) {
     applyOverrides(orchestrator, oOverride);