feat(server): improve context management (#15448)

#### PR Dependency Tree


* **PR #15448** 👈

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**
* Added workspace artifact upload, browsing, removal, deduplication, and
library ownership support.
* Copilot now supports scoped document and artifact search, canvas
reading, live editor context, and frontend tools.
* Added scope and focus selectors with source-resolution receipts in
chat.
* Added embedding health, progress, synchronization, and retrieval
capabilities.
* Added BYOK policy visibility, provider restrictions, endpoint dialect
selection, and validation.
* Added delegated editor interactions and userdata document
authorization.

* **Bug Fixes**
* Improved attachment handling, cancellation, access control, retrieval
fallbacks, workspace synchronization, and configuration validation.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
DarkSky
2026-08-10 09:27:58 +08:00
committed by GitHub
parent 42322d13fe
commit ee899a267b
311 changed files with 20468 additions and 14806 deletions

View File

@@ -6,7 +6,7 @@ test.describe.configure({ mode: 'serial' });
test.describe('AIChatWith/Attachments', () => {
test.beforeEach(async ({ loggedInPage: page, utils }) => {
await utils.testUtils.setupTestEnvironment(page, 'claude-sonnet-4-6');
await utils.testUtils.setupTestEnvironment(page);
await utils.chatPanel.openChatPanel(page);
});
@@ -26,13 +26,13 @@ test.describe('AIChatWith/Attachments', () => {
buffer: buffer,
},
],
'What is AttachmentEEee?'
'What is AttachmentEEee? Answer with a citation.'
);
await utils.chatPanel.waitForHistory(page, [
{
role: 'user',
content: 'What is AttachmentEEee?',
content: 'What is AttachmentEEee? Answer with a citation.',
},
{
role: 'assistant',
@@ -41,8 +41,29 @@ test.describe('AIChatWith/Attachments', () => {
]);
await expect(async () => {
const { content } = await utils.chatPanel.getLatestAssistantMessage(page);
const { content, message } =
await utils.chatPanel.getLatestAssistantMessage(page);
expect(content).toMatch(/EEee/);
const references = await message
.locator('affine-footnote-node')
.evaluateAll(nodes =>
nodes.map(
node =>
(
node as HTMLElement & {
footnote?: { reference?: Record<string, unknown> };
}
).footnote?.reference
)
);
expect(references).toEqual(
expect.arrayContaining([
expect.objectContaining({
type: 'attachment',
artifactId: expect.any(String),
}),
])
);
}).toPass({ timeout: 10000 });
});