Skip to content

feat(windows): AI assistant with schema context, editor actions and a policy per connection - #4319

Open
datlechin wants to merge 13 commits into
mainfrom
feat/windows-ai-assistant
Open

datlechin wants to merge 13 commits into
mainfrom
feat/windows-ai-assistant

Conversation

@datlechin

@datlechin datlechin commented Nov 18, 2026 •

Copy link
Copy Markdown
Member

Summary

  • Core FFI (C-17): Core::ai_assistant() gives an AiAssistant over the ai crate: keys kept in the core's secret store and never handed back, models listed, a conversation's system prompt read from the session's catalog (never a row), and a streamed AiReply drained like a query run.
  • The core refuses a saved connection whose AI policy is Never (ai.blocked). A hosted provider always goes to its own address. A reply stops with its session. AiError crosses with its host, status and provider in ErrorInfo.ai.
  • tablepro-ai takes the key it sent out of any error text a server or the transport wrote, so a server that echoes the key cannot show it. Linux gets this too; it has no fragment while linux/ is frozen for 0.1.0.
  • ConnectionRecord.ai_policy reads the saved policy back. On a save, None keeps the stored one.
  • Windows (W-57): Settings has an AI assistant section: provider (Off by default), compatible server address, API key saved to Credential Manager, and a model list read from the provider.
  • The connection form's Options has AI assistant: Ask each time, Always allow, Never.
  • View > Show AI assistant opens a pane beside the tabs. It streams a chat with the connection's table structure, shows code blocks with Copy and Insert in editor, and has Stop, Retry and New conversation.
  • Review, Explain and Optimize with AI are on the editor menu and the Query menu. Fix with AI is on a refused run's error bar.
  • Under Ask each time, the first request asks and names the connection and where its data goes. The answer lasts until the connection disconnects. The policy and settings are read again before each request.
  • ADRs: core 0032 and windows 0014. The Windows guide and core architecture are updated.
  • Not in this PR: describing tables named in SQL outside the editor's schema waits on C-08, since that parser lives in linux/crates/app. Inline suggestions are not part of W-57.

Test plan

  • cargo test -p tablepro-ffi -p tablepro-ai: all pass, including tests/ai.rs against a local server. Covered: a key from the store, usage, a refused key with host and provider words, an echoed key redacted, a missing key, cancel, a reply stopped by its session's close, model list, the structure of the tables a question names (quoted names too) with no row in it, and Never refusing before any request.
  • dotnet test --solution TablePro.slnx: 1052 passed after merging main. New: AiAssistantTests (Interop, real core and SQLite) and AssistantTests (App.Model). The App.Model tests cover consent rules per destination, conversation requests, reply Markdown, settings and the form's policy. QueryTabHistoryTests covers Fix and the statement at the caret.
  • Bindings regenerated and checked.
  • UI tests (AssistantTests, Windows CI) run against a fake Ollama server on 127.0.0.1. They cover the Settings section, the consent question and a streamed reply with its structure and Insert in editor, Explain then Review asking once, and Never showing the blocked pane with the commands disabled.

@datlechin
datlechin enabled auto-merge (squash) November 18, 2026 08:56

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant