Files
AFFiNE-Mirror/packages/backend/server/src/plugins/copilot/index.ts
T
DarkSky ee899a267b 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 -->
2026-08-10 09:27:58 +08:00

85 lines
2.4 KiB
TypeScript

import './config';
import { Module } from '@nestjs/common';
import { ServerConfigModule } from '../../core';
import { DocStorageModule } from '../../core/doc';
import { FeatureModule } from '../../core/features';
import { PermissionModule } from '../../core/permission';
import { QuotaModule } from '../../core/quota';
import { StorageModule } from '../../core/storage';
import { WorkspaceModule } from '../../core/workspaces';
import { IndexerModule } from '../indexer';
import { CopilotController } from './controller';
import { CopilotFeatureGuard, CopilotFeatureService } from './feature';
import { WorkspaceMcpController } from './mcp/controller';
import { McpCredentialService } from './mcp/credential';
import { McpCredentialResolver } from './mcp/resolver';
import {
COPILOT_API_PROVIDERS,
COPILOT_FEATURE_PROVIDERS,
COPILOT_KERNEL_PROVIDERS,
COPILOT_TRANSCRIPT_REALTIME_PROVIDERS,
} from './module-providers';
const COPILOT_SHARED_IMPORTS = [
DocStorageModule,
FeatureModule,
QuotaModule,
PermissionModule,
ServerConfigModule,
StorageModule,
WorkspaceModule,
IndexerModule,
];
@Module({
imports: [ServerConfigModule],
providers: [CopilotFeatureService, CopilotFeatureGuard],
exports: [CopilotFeatureService, CopilotFeatureGuard],
})
export class CopilotAvailabilityModule {}
@Module({
imports: [...COPILOT_SHARED_IMPORTS, CopilotAvailabilityModule],
providers: [...COPILOT_KERNEL_PROVIDERS],
exports: [CopilotAvailabilityModule, ...COPILOT_KERNEL_PROVIDERS],
})
export class CopilotKernelModule {}
@Module({
imports: [PermissionModule, CopilotAvailabilityModule, CopilotKernelModule],
providers: [...COPILOT_TRANSCRIPT_REALTIME_PROVIDERS],
})
export class CopilotRealtimeModule {}
@Module({
imports: [...COPILOT_SHARED_IMPORTS, CopilotKernelModule],
providers: [...COPILOT_FEATURE_PROVIDERS],
exports: [...COPILOT_FEATURE_PROVIDERS],
})
export class CopilotFeatureModule {}
@Module({
imports: [
...COPILOT_SHARED_IMPORTS,
CopilotKernelModule,
CopilotFeatureModule,
],
providers: [...COPILOT_API_PROVIDERS],
exports: [...COPILOT_API_PROVIDERS],
})
export class CopilotApiModule {}
@Module({
imports: [
PermissionModule,
CopilotKernelModule,
CopilotFeatureModule,
CopilotApiModule,
],
providers: [McpCredentialService, McpCredentialResolver],
controllers: [CopilotController, WorkspaceMcpController],
})
export class CopilotModule {}