feat(ai): bind each conversation to its own connection

This commit is contained in:
Abeautifulsnow authored and GitHub committed 2026-09-23 17:56:05 +08:00
1 parent 47e7f56b14
commit c373f322d2
35 files changed
+1584 -272

No files matched your search

+11
View File
@@ -1185,6 +1185,8 @@ export interface AiChatMessage {
kind?: "contextSummary" | "writeSqlConfirmation" | "productionWriteBlocked";
/** Set on the assistant message whose generation failed; persisted (mirrors dbx-core `AiChatMessage.failed`). */
failed?: boolean;
/** Target frozen when this assistant turn started, retained for confirmation. */
sourceBinding?: import("@/lib/ai/aiConversationBinding").AiConversationBinding;
}
export interface AiConversation {
@@ -1192,7 +1194,16 @@ export interface AiConversation {
id: string;
title: string;
connectionName: string;
/** Connection this conversation is bound to (#9902). The binding belongs to
* the conversation, not to whichever editor tab is active.
* Empty means "unbound": either persisted before session-scoped binding
* existed and its `connectionName` matched zero or several saved connections
* (names are not unique), or the bound connection was deleted. Consumers must
* ask the user rather than fall back to the active tab. */
connectionId: string;
database: string;
/** Schema for schema-scoped engines (Postgres, Dameng); absent otherwise. */
schema?: string;
messages: AiChatMessage[];
/** One editable "send later" input saved while an active run occupies the
* conversation (parent PRD §5). Persisted with the conversation. */