File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -14,6 +14,9 @@ export const getPearaiExtension = async () => {
1414 return pearAiExtension
1515}
1616
17+ // TODO: SHOULD HAVE TYPE SYNCED WITH THE PEARAI SUBMODULE!
18+ type CreatorModeState = "OVERLAY_CLOSED" | "OVERLAY_OPEN" | "OVERLAY_CLOSED_CREATOR_ACTIVE"
19+
1720export const registerPearListener = async ( ) => {
1821 // Getting the pear ai extension instance
1922 const pearAiExtension = await getPearaiExtension ( )
@@ -61,7 +64,20 @@ export const registerPearListener = async () => {
6164 } ) ;
6265 // If there's a creator event in the cache after the extensions were refreshed, we need to get it!
6366 pearAiExtension . exports . pearAPI . creatorMode . triggerCachedCreatorEvent ( true ) ;
64- console . log ( "triggerCachedCreatorEvent CALLED!" )
67+
68+ pearAiExtension . exports . pearAPI . creatorMode . onDidChangeCreatorModeState ( async ( state : CreatorModeState ) => {
69+ // Get the sidebar provider
70+ const sidebarProvider = ClineProvider . getVisibleInstance ( ) ;
71+
72+ if ( sidebarProvider ) {
73+ // Send a message to the webview that will trigger a window event
74+ sidebarProvider . postMessageToWebview ( {
75+ type : "creatorModeUpdate" ,
76+ text : state ,
77+ } ) ;
78+ }
79+ } ) ;
80+
6581 } else {
6682 console . error ( "⚠️⚠️ PearAI API not available in exports ⚠️⚠️" )
6783 }
Original file line number Diff line number Diff line change @@ -68,6 +68,7 @@ export interface ExtensionMessage {
6868 | "acceptInput"
6969 | "setHistoryPreviewCollapsed"
7070 | "commandExecutionStatus"
71+ | "creatorModeUpdate"
7172 text ?: string
7273 action ?:
7374 | "chatButtonClicked"
You can’t perform that action at this time.
0 commit comments