No public API for building scope subscription forms; consumers must depend on the internal scope manager
## Problem/Motivation There is no supported way for a contrib module to render a scope-subscription UI (the "subscribe to these scope values" widget) outside of an AI agent. The only mechanism is `plugin.manager.ai_context_scope`, which `docs/developers/api-stability.md` explicitly lists as **internal**. As a result, any non-agent consumer that wants per-entity scope subscriptions must reimplement the logic already living in `AiContextAgentForm`: - iterate `getScopePlugins()`, skip disabled / `!supportsSubscriptions()` plugins, - call `buildValueForm(..., for_subscription: TRUE)` per plugin, - call `extractFormValues()` per plugin on submit. `ai_empathy`'s `ai_empathy_ccc` submodule does exactly this — ~115 lines in `_ai_empathy_ccc_scenario_scope_form()` plus its entity builder — duplicating `AiContextAgentForm` and coupling to an internal service. This duplication exists independently of the alter-hook bug (see [Issue 1]); even with that fixed, the boilerplate and the internal dependency remain. ## Proposed resolution - Provide a public façade for subscription form building, e.g. an `ai_context.scope_form_builder` service (or documented public methods) exposing: - `build(array $defaults, bool $for_subscription = TRUE): array` — the per-plugin subscription widgets. - `extractValues(array $submitted): array` — normalized `scope_id => [values]` for storage. - Reuse it from `AiContextAgentForm` so there is a single implementation. - Document it as the supported way for non-agent modules to collect scope subscriptions, and update `api-stability.md`. ## Remaining tasks - [x] Add the public form-builder service/methods. - [x] Refactor `AiContextAgentForm` to consume it (no behavior change). - [x] Document the public surface; mark it stable in `api-stability.md`. - [x] Add a test, and (optionally) note `ai_empathy_ccc` as the reference consumer that can drop its duplicated form code. ## API/data model changes New public service/methods for subscription form building. No stored-data changes.
issue