feat(editor): extract chat runtime (#14937)

#### PR Dependency Tree


* **PR #14937** 👈

This tree was auto-generated by
[Charcoal](https://github.com/danerwilliams/charcoal)

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **New Features**
* Centralized AI event system and a runtime powering chat sessions and
actions.

* **Improvements**
* Chat UI (composer, messages, toolbar, tabs, panels) now syncs with
runtime snapshots for more consistent state.
* Improved session/tab lifecycle (create, fork, delete), context
embedding status, and history handling.
* More reliable send/stop/retry flows, better telemetry scoping, and
clearer upgrade/login/insert-template prompts.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-05-13 21:57:50 +08:00
committed by GitHub
parent 322f2ba986
commit e222f06e94
64 changed files with 5348 additions and 4510 deletions
@@ -1,6 +1,6 @@
import { Scrollable } from '@affine/component';
import { PageDetailLoading } from '@affine/component/page-detail-skeleton';
import { type AIChatParams, AIProvider } from '@affine/core/blocksuite/ai';
import { AIAppEvents, type AIChatParams } from '@affine/core/blocksuite/ai';
import type { AffineEditorContainer } from '@affine/core/blocksuite/block-suite-editor';
import { EditorOutlineViewer } from '@affine/core/blocksuite/outline-viewer';
import { AffineErrorBoundary } from '@affine/core/components/affine/affine-error-boundary';
@@ -137,12 +137,8 @@ function DocPeekPreviewEditor({
// chat panel open is already handled in <DetailPageImpl />
}
};
disposables.push(
AIProvider.slots.requestOpenWithChat.subscribe(openHandler)
);
disposables.push(
AIProvider.slots.requestSendWithChat.subscribe(openHandler)
);
disposables.push(AIAppEvents.requestOpenWithChat.subscribe(openHandler));
disposables.push(AIAppEvents.requestSendWithChat.subscribe(openHandler));
return () => disposables.forEach(d => d.unsubscribe());
}, [doc, peekView, workbench, workspace.id]);