Skip to content

feat(agent): AI Data Studio — multi-provider agent backend + Data Studio view#431

Merged
Blankll merged 17 commits into
masterfrom
feat/ai-data-studio-agent
May 19, 2026
Merged

feat(agent): AI Data Studio — multi-provider agent backend + Data Studio view#431
Blankll merged 17 commits into
masterfrom
feat/ai-data-studio-agent

Conversation

@Blankll
Copy link
Copy Markdown
Member

@Blankll Blankll commented May 19, 2026

Summary

Syncs AI/agent improvements from the private ultimate branch into the public repo.

What's included

Rust agent backend (src-tauri/src/agent/)

  • Multi-provider LLM agent with loop runner, tool executor, session store (SQLite via rusqlite)
  • Supports OpenAI, DeepSeek, OpenRouter, Ollama, LM Studio
  • Replaces the old openai_client module (removed)
  • New Tauri commands: start_agent_session, send_agent_message, validate_llm_config, list_llm_models, etc.

Data Studio view (src/views/data-studio/)

  • Full chat-driven data exploration interface
  • Session history, tool confirmation cards, source management modals

Agent composables & stores

  • useAgentContext, useChatAgent, useSidebarChatAgent, useDataStudioAgent, useDataStudioChatAgent
  • dataStudioStore, codeActionStore
  • appStore: ProviderConfig, ModelRef, getResolvedFeatureModel for multi-provider support; migrates legacy aiConfigs secret to new LlmSettings on first load

Shared agent UI components

  • agent-message-bubble, chat-panel (with missing-AI-config CTA), model-picker

AI settings (src/views/setting/components/aigc.vue)

  • Replaced per-provider tabs (OpenAI / DeepSeek) with unified multi-provider settings
  • Supports all five providers: OpenAI, DeepSeek, OpenRouter, Ollama, LM Studio
  • System prompt is now dynamically built from live database schema context (richer than the static user-editable prompt in origin)

Accessibility & UX improvements

  • SearchableSelect: full keyboard navigation (arrow keys, Enter, Escape, ARIA)
  • path-breadcrumb, tool-bar-right: keyboard + ARIA accessibility
  • DialogContent: pointer-events fix for closed overlay
  • Monaco completionProvider: InsertAsSnippet for query language commands (ESQL/SQL/EQL/PPL) — aligns with fix(completion): use InsertAsSnippet for query language commands #416
  • Sidebar chat chatbot-box: resizable panel, session history, upgraded to agent-based architecture

i18n: agent/data-studio keys added to enUS and zhCN

MongoDB: always visible

  • Removed VITE_FEATURE_MONGODB feature flag and __MONGODB_ENABLED__ Vite define
  • MongoDB is now shown in all environments (dev and production)
  • featureFlags.ts retained for compatibility but no longer gates MongoDB

What's excluded

  • All login/auth/Geekfun account features
  • authService.ts, login views, orContinueWith/loginWithGeekfun i18n keys

What's preserved from origin

  • Full MongoDB support (mongo_client.rs, mongoApi.ts, mongo editor)
  • All DynamoDB extended features (delete/truncate/update-table-config/pitr/streams/ttl modules)
  • Origin's connectionStore.ts (has OpenSearch, EasySearch, MongoDB types — ahead of ultimate)
  • Origin's fetch_client.rs (OnceLock-based, safer than ultimate's static mut version)
  • featureFlags.ts + its tests (no longer gates MongoDB, but preserved)
  • All keyboard accessibility and OpenSearch/EasySearch guards in import/export views

Verification

  • tsc --noEmit
  • eslint ✅ (0 errors)
  • jest ✅ 31 suites / 1280 tests

Blankll and others added 8 commits May 19, 2026 10:58
…and tool executor

Remove openai_client module; replace with multi-provider agent architecture.
Add rusqlite-backed session persistence, confirm/cancel maps, and
tauri-plugin-system-info + tauri-plugin-single-instance plugins.

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
- Add agentApi.ts with invoke bindings for agent Tauri commands
- Replace openai-based chatBotApi with validate_llm_config/list_llm_models
- Add chat.ts types (ChatConfig, ChatContextConfig, SendMessageOptions)
- Add appStore ProviderConfig/ModelRef/getResolvedFeatureModel for multi-provider support
- Replace chatStore with useAgentContext-based session management
- Add dataStudioStore and codeActionStore for Data Studio feature
- Add 5 agent composables: useAgentContext, useChatAgent, useSidebarChatAgent,
  useDataStudioAgent, useDataStudioChatAgent
- Remove featureFlags.ts (MongoDB always enabled now)
- Widen DatabaseType union in chat types to include OPENSEARCH/EASYSEARCH/MONGODB
- Add data-studio views: layout, chat panel, editor, toolbar, dataset panel
- Add shared agent components: agent-message-bubble, chat-panel, model-picker
- Update markdown-render with agent-aware rendering
- Update chatbot-box and the-aside for agent-based sidebar chat
- Add data-studio route to router
- Update aigc settings page for multi-provider LLM configuration
- Restore index-manage.vue from ultimate (ESLint/style fixes)
- Add agent/data-studio i18n keys to enUS and zhCN (no login/auth keys)
- Update components.d.ts with new agent component type registrations
- Update vite.config.ts and jest.config.cjs from ultimate
- Add .sisyphus/ to .gitignore
- Add product docs: data-studio PRD, market analyses, architecture overview
…m ultimate

- tabStore: add MONGO_EDITOR type, queryResult tracking, isSearchConnection guard,
  .mongo file extension for MongoDB tabs
- dynamoManageStore: apply fixes and improvements from ultimate
- importExportStore: apply fixes from ultimate
…ient, file_api

- fetch_client: replace unsafe static mut with OnceLock (safe, idiomatic); proxy
  bypasses the cache and creates a fresh client per request
- dynamo_client: restore effective_region fallback so Sso/AssumeRole variant
  region fields are actually read (also restores correct region resolution when
  top-level region is empty)
- file_api: remove unused StreamFileInput struct (stream_file_lines uses flat params)
@codecov
Copy link
Copy Markdown

codecov Bot commented May 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 77.06%. Comparing base (1f914c9) to head (ac150de).

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #431   +/-   ##
=======================================
  Coverage   77.06%   77.06%           
=======================================
  Files          55       55           
  Lines        2695     2695           
  Branches      657      657           
=======================================
  Hits         2077     2077           
  Misses        417      417           
  Partials      201      201           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Blankll added 7 commits May 19, 2026 11:14
- Restore origin's dynamoManageStore (has CreateTableConfig, TruncateResult,
  createTable, deleteTable, truncateTable, updateStreams, updateTimeToLive,
  updateContinuousBackups, updateTableConfig — all missing from ultimate's older version)
- Restore origin's tabStore (has saveQueryResult, queryResult on Panel)
- Restore origin's importExportStore
- es-editor: replace isOpenSearch boolean with DatabaseType discrimination
  (OpenSearch/EasySearch → EngineType.OPENSEARCH, else ELASTICSEARCH)
- mongo-editor: replace chatStore.insertBoard with codeActionStore.insertBuffer
  (new agent architecture moved editor-insert signal to codeActionStore)
…Option, widen SearchConnection cast

- tabStore getter was renamed to activeSearchIndexOption (covers ES/OpenSearch/EasySearch)
- tool-bar.vue and es-editor: update all references to match
- es-editor: cast activeConnection as SearchConnection instead of ElasticsearchConnection
  so OPENSEARCH/EASYSEARCH type comparisons compile without overlap errors
- Restore src/common/featureFlags.ts (deleted by mistake)
- Restore tests/featureFlags.test.ts (deleted by mistake)
- Re-export featureFlags from src/common/index.ts
- floating-menu.vue: keep ultimate's animated FAB; restore all 5 DB types
  (OpenSearch, EasySearch, MongoDB), remove isFeatureEnabled computed filter
- connect-list.vue: remove isFeatureEnabled guard; MongoDB connections
  always visible (no feature flag needed)
- Add missing opensearchIcon, easysearchIcon SVG imports
- Restore full getDbIcon ternary (DYNAMODB→ES→OS→EasySearch fallback)
- Restore OPENSEARCH || EASYSEARCH branches in handleAddToEditor
  (ultimate's version only handled ELASTICSEARCH, dropping OS/EasySearch)
- shortcuts-help-dialog.vue: restore MongoDB Editor shortcuts section
- tool-bar.vue: restore MongoDB collection select, sample queries,
  run button, create-dynamo-table button; restore isSearchConnection
  (covers ES/OpenSearch/EasySearch) instead of ES-only narrowing;
  restore COLLECTION handling in handleOpen/handleUpdate
- connect/index.vue: restore MongoDB editor template, mongoEditorRefs,
  setMongoEditorRef, handleInsertMongoSampleQuery, handleExecuteMongoQuery
- context-menu.vue: restore full keyboard accessibility (role, tabindex,
  handleMenuKeyDown, ArrowUp/Down/Enter/Space/Escape, highlight index, focus)
- file-list.vue: restore keyboard accessibility (keydown handlers,
  openContextMenuForKeyboard, @close, closeContextMenu, previousFocus,
  getGridColumns, focusFileNode)
- tool-bar-right.vue: restore role/tabindex/keydown on nav items
- the-aside.vue: restore role/tabindex/keydown on nav items; keep new
  data-studio nav entry added by branch
- dynamo sql-editor.vue: restore keyboard-accessible context menu
  (role=menu, role=menuitem, ArrowUp/Down/Enter highlight, focus management)
- es-connect-dialog.vue: restore OpenSearch/EasySearch auth fields template
  (username/password/apiKey fields conditionally shown for search types)
- lang/enUS.ts + zhCN.ts: merge origin keys back (manage.columns.*,
  manage.actions.filterIndices/filterTemplates, manage.index.newAliasForm.*,
  manage.dynamo.createTableTitle/deleteTable*/truncateTable*, etc.)
  while keeping all new AI/agent/data-studio keys from ultimate
- SearchableSelect: restore ArrowUp/Down/Enter keyboard nav, aria-expanded/
  aria-haspopup/aria-controls/aria-activedescendant, focus ring, useId
  listbox, role=option, mouseenter highlight, slot ordering
- es-editor: restore menuItems computed, handleMenuKeydown, focusMenuItem,
  contextMenuRef, highlightedIndex, Shift+F10 Monaco keyboard action;
  fix historyStore.addEntry to use activeConnection.value.type instead of
  hardcoded DatabaseType.ELASTICSEARCH
- dynamo-connect-dialog: restore ArrowUp/Down/Enter suggestion navigation,
  highlightedSuggestionIndex, aria-label on Close/Dismiss buttons
- dynamo ui-editor: restore role/tabindex/keydown on add-filter button
- delete-confirm-modal: restore aria-label Close/Dismiss, keydown.enter
  on Retry/Delete buttons
- path-breadcrumb: restore role=link, tabindex=0, keydown.enter/.space
- export-target-output: restore accessible folder-selector-btn with
  focus-visible ring, hover styles, keydown.enter/.space
- import/export files: restore isSearchConnection() checks (was narrowed
  to DatabaseType.ELASTICSEARCH only, breaking OpenSearch/EasySearch)
- new-file-dialog: restore Form @submit.prevent + Button type=submit pattern
- mongo-editor: restore codeActionStore.clearInsertBuffer() after insert
…onfig CTA in chat panel

- completionProvider.ts: restore InsertAsSnippet for query language command
  completions (ESQL/SQL/EQL/PPL) — matches origin 1f914c9 and aligns with
  PR #416 fix; ultimate had re-introduced the None regression
- chat-panel.vue: restore 'Configure GPT' settings CTA button in error
  banner when AI is not configured, matching origin chatbot-box behavior;
  add useRouter import and error-settings-btn CSS
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR syncs the new multi-provider LLM/agent architecture into the public repo, adding a Data Studio chat-driven workflow and migrating the existing sidebar assistant to the shared agent/model-routing infrastructure.

Changes:

  • Introduces a new Rust/Tauri agent backend (multi-provider LLM harness, tool registry/executor, loop runner, SQLite session store).
  • Adds the Data Studio view + supporting UI (chat panel, tool confirmation cards, session history, source connect/permission modals).
  • Refactors existing chat/code-insertion plumbing (new codeActionStore, editor insert buffer flow, updated chatbot UI, new chat types/composables).

Reviewed changes

Copilot reviewed 65 out of 68 changed files in this pull request and generated 15 comments.

Show a summary per file
File Description
vite.config.ts Simplifies Vite config; removes MongoDB feature define.
src/views/manage/components/index-manage.vue Adds index/template management UI with filters and actions.
src/views/import-export/components/import-source-scope.vue Updates schema configuration comment wording.
src/views/editor/mongo-editor/index.vue Switches code insertion source to codeActionStore.
src/views/editor/es-editor/index.vue Switches code insertion source; treats EasySearch as OpenSearch engine for docs.
src/views/data-studio/components/tool-confirmation-card.vue New tool execution confirmation UI card.
src/views/data-studio/components/session-history-panel.vue New Data Studio session history list UI.
src/views/data-studio/components/modify-source-modal.vue New modal to edit source permission mode.
src/views/data-studio/components/detach-source-modal.vue New modal to detach a connected source.
src/views/data-studio/components/add-source-modal.vue New modal to connect a source to Data Studio.
src/views/connect/components/floating-menu.vue Removes MongoDB feature gating; always shows DB types.
src/views/connect/components/dynamodb-connect-dialog.vue Refactors suggestion “enter” handler into helper.
src/views/connect/components/connect-list.vue Removes MongoDB feature gating from connection filtering.
src/types/index.ts Exports new chat types.
src/types/chat.ts Adds unified chat/session/message types for agents.
src/store/index.ts Exposes new codeActionStore.
src/store/dataStudioStore.ts Adds Data Studio store: sessions, tool calls, confirmations, source config.
src/store/codeActionStore.ts New store for editor insert buffer actions.
src/store/chatStore.ts Refactors sidebar assistant to use multi-provider model routing + agent streaming.
src/router/index.ts Adds /data-studio route.
src/layout/components/the-aside.vue Adds Data Studio entry to the main sidebar nav.
src/layout/components/chatbot-box.vue Replaces legacy chatbot UI with shared ChatPanel + session history overlay + resizable UI.
src/lang/zhCN.ts Adds Data Studio + provider/model routing i18n keys (and some login keys).
src/lang/enUS.ts Adds Data Studio + provider/model routing i18n keys (and some login keys).
src/datasources/index.ts Exports new agentApi.
src/datasources/chatBotApi.ts Expands provider enum; replaces old streaming with model listing/validation commands.
src/datasources/agentApi.ts New Tauri IPC surface for agent steps/loop, tools, sessions, and streaming events.
src/composables/useSidebarChatAgent.ts Adapts Data Studio sessions into sidebar assistant chat sessions.
src/composables/useDataStudioChatAgent.ts Adapts Data Studio sessions into Data Studio chat sessions.
src/composables/useAgentContext.ts Builds prompt context from active panel/connection/editor content.
src/composables/index.ts Exports new agent/chat composables.
src/components/ui/dialog/DialogContent.vue Adjusts dialog overlay classes.
src/components/ui/combobox/SearchableSelect.vue Minor formatting change in option filtering.
src/components/model-picker.vue New model picker UI for multi-provider model routing.
src/components/markdown-render.vue Updates code-actions encoding + insertion target store; adds cleanup for global listener.
src/components/chat-panel.vue New shared chat UI wrapper (messages, tool confirmation cards, model picker).
src-tauri/src/openai_client.rs Removes legacy OpenAI client module.
src-tauri/src/main.rs Wires in new agent modules/commands, SQLite store init, single-instance handling.
src-tauri/src/file_api.rs Removes unused StreamFileInput struct.
src-tauri/src/fetch_client.rs Replaces static mut clients with OnceLock caching.
src-tauri/src/dynamo_client.rs Improves DynamoDB region selection logic for empty region inputs.
src-tauri/src/db/mod.rs New SQLite wrapper + migrations for agent storage.
src-tauri/src/agent/tools.rs New static tool registry + permission filtering.
src-tauri/src/agent/tool_executor.rs Defines async tool executor trait.
src-tauri/src/agent/session_store.rs New SQLite-backed session/message CRUD + import/export.
src-tauri/src/agent/schema.rs Adds schema introspection for Elasticsearch + DynamoDB.
src-tauri/src/agent/mod.rs Agent module wiring + public exports.
src-tauri/src/agent/harness.rs Multi-provider OpenAI-compatible streaming harness + config validation + model listing.
src-tauri/src/agent/executor.rs Implements ES/Dynamo tool execution + output truncation + validation.
src-tauri/src/agent/config.rs Base URL + auth header helpers for agent loop runner.
src-tauri/Cargo.toml Adds SQLite/tooling deps and new Tauri plugins (system-info, single-instance).
jest.config.cjs Removes import.meta.env globals shim.
docs/opencode-vs-dockit-architecture.md Adds architecture comparison doc (currently out of sync with the implementation).
components.d.ts Registers new global Vue components.
.gitignore Ignores additional local scratch directories/files.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src-tauri/src/agent/executor.rs Outdated
Comment thread src-tauri/src/agent/executor.rs Outdated
Comment thread src-tauri/src/agent/tools.rs Outdated
Comment thread src-tauri/src/agent/schema.rs Outdated
Comment thread src/views/data-studio/components/add-source-modal.vue
Comment thread src/lang/zhCN.ts Outdated
Comment thread src-tauri/Cargo.toml Outdated
serde_json = "1"

tauri-plugin-deep-link = "2"
tauri-plugin-system-info = { git = "https://github.com/HuakunShen/tauri-plugin-system-info", branch = "v2" }
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4e61651. Pinned to commit rev afb2b7fe50f337500937eb946c1204a728353b63 instead of branch=v2.

Comment on lines +133 to +136
<DropdownMenuItem
v-if="row.status === 'open'"
@click="handleAction('closIndex', row.index)"
>
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4e61651. Renamed closIndex to closeIndex in both the template click handler and the if-branch in handleAction.

Comment thread docs/opencode-vs-dockit-architecture.md Outdated

> **Scope**: Agent loop & execution model · Tool system · Session & state · Provider abstraction · Robustness features
> **Sources**: opencode (`anomalyco/opencode` mirror of sst/opencode) and DocKit (this repo, post-robustness-refactor)
> **TL;DR**: OpenCode is a **general-purpose, server-grade agent framework** (TypeScript/Bun, SQLite-backed, multi-provider, plugin-based tools). DocKit is a **domain-specific embedded agent** (Vue + Rust/Tauri, in-memory + Pinia-persisted, OpenAI-only, static tool registry for ES/DynamoDB). The two systems converge on the same robustness primitives but diverge sharply on architecture, extensibility, and runtime model.
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4e61651. Updated the TL;DR, Architecture at a Glance table, session storage section, provider list, and Recommended Next Steps to reflect the SQLite backend and 5-provider support.

Comment thread docs/opencode-vs-dockit-architecture.md Outdated
Comment on lines +14 to +18
| **Where the loop lives** | Backend (`session/prompt.ts`) — server-driven | Frontend (`composables/useDataStudioAgent.ts`) — Vue-driven |
| **Where LLM calls happen** | Backend (`session/llm.ts`, AI SDK) | Backend (`src-tauri/src/agent/harness.rs`, async-openai crate) |
| **Where tools execute** | Backend (`tool/registry.ts`, in-process) | Backend (`src-tauri/src/agent/executor.rs`, Tauri command) |
| **Persistence** | SQLite via Drizzle (`session.sql.ts`) | Pinia + `persistedstate` → localStorage |
| **Provider model** | Multi-provider via `BundledSDK` registry | OpenAI protocol only (4 endpoints: OpenAI, DeepSeek, OpenRouter, Ollama) |
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed in 4e61651. Same as above - persistence row updated to SQLite via rusqlite, provider row updated to list all 5 supported providers.

- executor.rs: UTF-8 safe truncation via is_char_boundary; url_encode_segment encodes all bytes
- tools.rs: normalize OPENSEARCH/EASYSEARCH to ELASTICSEARCH for tool filtering
- schema.rs: introspect_schema supports OPENSEARCH and EASYSEARCH
- chatStore.ts: avoid in-place reverse() mutation when finding last matching chat
- enUS.ts / zhCN.ts: remove orContinueWith and loginWithGeekfun i18n keys
- add-source-modal.vue: filter connections to agent-supported types only; proper icons per type
- session-history-panel.vue: replace hardcoded English strings with i18n keys
- index-manage.vue: fix closIndex typo → closeIndex
- Cargo.toml: pin tauri-plugin-system-info to a specific commit rev
- docs: update architecture doc to reflect SQLite backend and multi-provider support
@Blankll
Copy link
Copy Markdown
Member Author

Blankll commented May 19, 2026

All 15 review items addressed in commit 4e61651: (1) UTF-8 safe truncation via is_char_boundary; (2) url_encode_segment uses .bytes(); (3+4) tools.rs+schema.rs normalize OPENSEARCH/EASYSEARCH to ELASTICSEARCH; (5) chatStore non-mutating reverse; (6) removed login i18n keys; (7+8) add-source-modal filters unsupported types + correct icons; (9) session-history-panel uses i18n for New Session/Yesterday/Session; (10) closIndex typo fixed; (11) tauri-plugin-system-info pinned to commit rev; (12) architecture doc updated for SQLite and multi-provider.

@Blankll Blankll merged commit a76b685 into master May 19, 2026
6 checks passed
@Blankll Blankll deleted the feat/ai-data-studio-agent branch May 19, 2026 08:41
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.

2 participants