(firstArg string, agentTypeVar string)
| 63 | } |
| 64 | |
| 65 | func parseAgentType(firstArg string, agentTypeVar string) (AgentType, error) { |
| 66 | // if the agent type is provided, use it |
| 67 | if castedAgentType, ok := agentTypeAliases[agentTypeVar]; ok { |
| 68 | return castedAgentType, nil |
| 69 | } |
| 70 | if agentTypeVar != "" { |
| 71 | return AgentTypeCustom, fmt.Errorf("invalid agent type: %s", agentTypeVar) |
| 72 | } |
| 73 | // if the agent type is not provided, guess it from the first argument |
| 74 | if castedFirstArg, ok := agentTypeAliases[firstArg]; ok { |
| 75 | return castedFirstArg, nil |
| 76 | } |
| 77 | return AgentTypeCustom, nil |
| 78 | } |
| 79 | |
| 80 | func runServer(ctx context.Context, logger *slog.Logger, argsToPass []string) error { |
| 81 | agent := argsToPass[0] |
no outgoing calls