fix(tools): add ok checks for type assertions in subagent and spawn tools
This commit is contained in:
1 parent
12c36572a5
commit
77017eb57d
2 files changed
+12
-3
No files matched your search
+8
-2
@@ -90,8 +90,14 @@ func (t *SpawnTool) execute(
|
||||
return ErrorResult("task is required and must be a non-empty string")
|
||||
}
|
||||
|
||||
label, _ := args["label"].(string)
|
||||
agentID, _ := args["agent_id"].(string)
|
||||
label, ok := args["label"].(string)
|
||||
if !ok {
|
||||
label = ""
|
||||
}
|
||||
agentID, ok := args["agent_id"].(string)
|
||||
if !ok {
|
||||
agentID = ""
|
||||
}
|
||||
targetAgentID := strings.TrimSpace(agentID)
|
||||
|
||||
// Check allowlist if targeting a specific agent
|
||||
|
||||
@@ -391,7 +391,10 @@ func (t *SubagentTool) Execute(ctx context.Context, args map[string]any) *ToolRe
|
||||
return ErrorResult("task is required").WithError(fmt.Errorf("task parameter is required"))
|
||||
}
|
||||
|
||||
label, _ := args["label"].(string)
|
||||
label, ok := args["label"].(string)
|
||||
if !ok {
|
||||
label = ""
|
||||
}
|
||||
|
||||
// Build system prompt for subagent
|
||||
systemPrompt := fmt.Sprintf(
|
||||
|
||||
Reference in new issue
Block a user