Connect SQL Expressions to the AI SDK completion endpoint
Replace the throwaway localhost transport with the supported authenticated endpoint and make SQL Expressions the first production consumer.
Start here: public/app/features/expressions/components/SqlExpressions/useSqlInlineCompletion.ts, useSqlInlineCompletion.test.ts, SqlEditor/SqlEditor.tsx, SqlExpr.tsx, and reusable prompt context in AssistantSQLButtons.tsx.
Constraints: No browser vendor key; use Grafana session authentication; send only bounded SQL/cursor and available-table/schema context; use the endpoint's model alias rather than a concrete vendor model; map CM6 abort to the HTTP request; keep the shared editor free of endpoint and SQL knowledge; do not use deprecated @grafana/llm or the Assistant multi-step agent.
Done when: Eligible users can request and progressively render an inline SQL suffix through the managed endpoint behind a feature gate; unavailable, unauthorized, aborted, empty, malformed, and error responses leave the editor usable; telemetry records timing and outcomes without SQL text.
Verify: Focused hook and SQL editor Jest tests cover prompt construction, feature/availability gating, streamed updates, cancellation, stale responses, and errors; manual local and deployed checks verify automatic/explicit request, ghost text, Tab, Escape, and no network call when disabled.
Implementing team: DataPro.
Consulted team: AI/ML and Frontend Platform.
Dependencies: Track AI SDK completion endpoint availability and progressive shared CM6 support.
Roadmap: Monaco to CodeMirror 6 migration roadmap and grafana/grafana#129192.
Source: grafana/grafana