@@ -46,7 +46,7 @@ import { Contents } from '@jupyterlab/services';
46
46
import { ISettingRegistry } from '@jupyterlab/settingregistry' ;
47
47
import { ITranslator , nullTranslator } from '@jupyterlab/translation' ;
48
48
import { launchIcon } from '@jupyterlab/ui-components' ;
49
- import { PromiseDelegate , Token } from '@lumino/coreutils' ;
49
+ import { PromiseDelegate } from '@lumino/coreutils' ;
50
50
import {
51
51
ChatPanel ,
52
52
ChatWidgetFactory ,
@@ -67,19 +67,9 @@ import {
67
67
import { chatCommandRegistryPlugin } from './chat-commands/plugins' ;
68
68
import { emojiCommandsPlugin } from './chat-commands/providers/emoji' ;
69
69
import { mentionCommandsPlugin } from './chat-commands/providers/user-mention' ;
70
- import { DocumentChange , YDocument } from '@jupyter/ydoc' ;
71
70
72
71
const FACTORY = 'Chat' ;
73
72
74
- // Cast ICollaborativeContentProvider token so TypeScript accepts it in plugin optional/requires arrays.
75
- // The arrays expect Token<any> from JupyterLab's @lumino/coreutils, but our token is from
76
- // @jupyter /collaborative-drive's @lumino/coreutils. These have separate Token class declarations
77
- // with their own private '_tokenStructuralPropertyT' properties, making TypeScript treat them as
78
- // distinct incompatible types even though they work identically. This is safe because tokens are just
79
- // dependency injection identifiers - the actual ICollaborativeContentProvider instance works correctly.
80
- const ICollaborativeContentProviderToken =
81
- ICollaborativeContentProvider as unknown as Token < any > ;
82
-
83
73
const pluginIds = {
84
74
activeCellManager : 'jupyterlab-chat-extension:activeCellManager' ,
85
75
attachmentOpenerRegistry : 'jupyterlab-chat-extension:attachmentOpener' ,
@@ -121,7 +111,7 @@ const docFactories: JupyterFrontEndPlugin<IChatFactory> = {
121
111
IActiveCellManagerToken ,
122
112
IAttachmentOpenerRegistry ,
123
113
IChatCommandRegistry ,
124
- ICollaborativeContentProviderToken ,
114
+ ICollaborativeContentProvider ,
125
115
IDefaultFileBrowser ,
126
116
IInputToolbarRegistryFactory ,
127
117
ILayoutRestorer ,
@@ -277,14 +267,7 @@ const docFactories: JupyterFrontEndPlugin<IChatFactory> = {
277
267
app . docRegistry . addFileType ( chatFileType ) ;
278
268
279
269
if ( drive ) {
280
- // Cast YChat return type to match SharedDocumentFactory's expected return type.
281
- // SharedDocumentFactory expects YDocument<DocumentChange>, but YChat.create() returns
282
- // YDocument<IChatChanges>. Since IChatChanges extends DocumentChange, the cast is valid.
283
- // TypeScript's generic invariance requires the cast as YDocument<Subtype> isn't assignable
284
- // to YDocument<Supertype> even when Subtype extends Supertype.
285
- const chatFactory = ( ) => {
286
- return YChat . create ( ) as unknown as YDocument < DocumentChange > ;
287
- } ;
270
+ const chatFactory = ( ) => YChat . create ( ) ;
288
271
drive . sharedModelFactory . registerDocumentFactory ( 'chat' , chatFactory ) ;
289
272
}
290
273
@@ -376,7 +359,7 @@ const chatCommands: JupyterFrontEndPlugin<void> = {
376
359
id : pluginIds . chatCommands ,
377
360
description : 'The commands to create or open a chat.' ,
378
361
autoStart : true ,
379
- requires : [ ICollaborativeContentProviderToken , IChatFactory ] ,
362
+ requires : [ ICollaborativeContentProvider , IChatFactory ] ,
380
363
optional : [
381
364
IActiveCellManagerToken ,
382
365
IChatPanel ,
@@ -690,11 +673,7 @@ const chatPanel: JupyterFrontEndPlugin<ChatPanel> = {
690
673
description : 'The chat panel widget.' ,
691
674
autoStart : true ,
692
675
provides : IChatPanel ,
693
- requires : [
694
- IChatFactory ,
695
- ICollaborativeContentProviderToken ,
696
- IRenderMimeRegistry
697
- ] ,
676
+ requires : [ IChatFactory , ICollaborativeContentProvider , IRenderMimeRegistry ] ,
698
677
optional : [
699
678
IAttachmentOpenerRegistry ,
700
679
IChatCommandRegistry ,
0 commit comments