Use the provider configuration element for Automators
>>> [!note] Migrated issue
<!-- Drupal.org comment -->
<!-- Migrated from issue #3577173. -->
Reported by: [marcus_johansson](https://www.drupal.org/user/385947)
Related to !1449 !1320
>>>
<p>[Tracker]<br>
<strong>Update Summary: </strong>[One-line status update for stakeholders]<br>
<strong>Short Description: </strong>Use the AI provider configuration form element instead of AiProviderFormHelper in AI Automators and migrate stored configuration<br>
<strong>Check-in Date: </strong>MM/DD/YYYY<br>
[/Tracker]</p>
<h3 id="summary-problem-motivation">Problem/Motivation</h3>
<p>In AI 2.0 a standardized provider selection and configuration form element was introduced for configuring AI providers. This element is documented here: <a href="https://project.pages.drupalcode.org/ai/2.0.x/developers/ai_provider_configuration_element/">AI Provider Configuration Element</a>.</p>
<p>The AI Automators module currently uses <code>AiProviderFormHelper</code> to build provider selection and configuration fields. This creates inconsistency with the rest of the AI ecosystem in 2.x where the standardized form element is expected to be used. It also means Automators do not benefit from the unified provider configuration handling introduced in AI 2.0.</p>
<p>Additionally, the configuration structure used by Automators should follow the standardized provider configuration schema used in the AI module (<code>config/schema/ai.provider_config.schema.yml</code>). Existing Automators created in 1.3.x store their configuration differently and therefore require a migration step.</p>
<h3 id="summary-proposed-resolution">Proposed resolution</h3>
<ul>
<li>Replace the usage of <code>AiProviderFormHelper</code> inside <code>src/PluginBaseClasses/RuleBase.php</code>, most likely within <code>extraAdvancedFormFields()</code>, with the new AI provider configuration form element.</li>
<li>Ensure the Automator configuration stores provider settings in the same structure defined in <code>config/schema/ai.provider_config.schema.yml</code>.</li>
<li>Update the Automator plugin configuration handling so it reads and writes provider configuration using this standardized schema.</li>
<li>Create an update hook that migrates existing Automator configurations created in the 1.3.x branch to the new provider configuration structure.</li>
<li>The update hook should detect existing Automator configurations using the old helper structure and convert them to the new schema-compatible format.</li>
<li>Verify that existing Automators continue to function after the migration and that new Automators use the provider configuration element.</li>
</ul>
<h3 id="summary-ai-usage">AI usage (if applicable)</h3>
<p>[x] AI Assisted Issue<br>
This issue was generated with AI assistance, but was reviewed and refined by the creator.</p>
<p>[ ] AI Assisted Code<br>
This code was mainly generated by a human, with AI autocompleting or parts AI generated, but under full human supervision.</p>
<p>[ ] AI Generated Code<br>
This code was mainly generated by an AI with human guidance, and reviewed, tested, and refined by a human.</p>
<p>[ ] Vibe Coded<br>
This code was generated by an AI and has only been functionally tested.</p>
issue