@@ -9,7 +9,6 @@ import * as Host from '../../core/host/host.js';
99import * as i18n from '../../core/i18n/i18n.js' ;
1010import type * as Platform from '../../core/platform/platform.js' ;
1111import * as SDK from '../../core/sdk/sdk.js' ;
12- import * as Persistence from '../../models/persistence/persistence.js' ;
1312import * as Workspace from '../../models/workspace/workspace.js' ;
1413import * as UI from '../../ui/legacy/legacy.js' ;
1514import * as Lit from '../../ui/lit/lit.js' ;
@@ -38,7 +37,6 @@ import {
3837 NetworkAgent ,
3938 RequestContext ,
4039} from './agents/NetworkAgent.js' ;
41- import { PatchAgent , ProjectContext } from './agents/PatchAgent.js' ;
4240import { CallTreeContext , PerformanceAgent } from './agents/PerformanceAgent.js' ;
4341import { NodeContext , StylingAgent , StylingAgentWithFunctionCalling } from './agents/StylingAgent.js' ;
4442import aiAssistancePanelStyles from './aiAssistancePanel.css.js' ;
@@ -163,13 +161,6 @@ function createFileContext(file: Workspace.UISourceCode.UISourceCode|null): File
163161 return new FileContext ( file ) ;
164162}
165163
166- function createProjectContext ( project : Persistence . FileSystemWorkspaceBinding . FileSystem | null ) : ProjectContext | null {
167- if ( ! project ) {
168- return null ;
169- }
170- return new ProjectContext ( project ) ;
171- }
172-
173164function createRequestContext ( request : SDK . NetworkRequest . NetworkRequest | null ) : RequestContext | null {
174165 if ( ! request ) {
175166 return null ;
@@ -209,7 +200,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
209200 #currentAgent?: AiAgent < unknown > ;
210201
211202 #previousSameOriginContext?: ConversationContext < unknown > ;
212- #project: ProjectContext | null = null ;
213203 #selectedFile: FileContext | null = null ;
214204 #selectedElement: NodeContext | null = null ;
215205 #selectedCallTree: CallTreeContext | null = null ;
@@ -356,8 +346,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
356346 break ;
357347 }
358348 case AgentType . PATCH : {
359- agent = new PatchAgent ( options ) ;
360- break ;
349+ throw new Error ( 'AI Assistance does not support direct usage of the patch agent' ) ;
361350 }
362351 }
363352
@@ -451,8 +440,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
451440 this . #selectedCallTree =
452441 createCallTreeContext ( UI . Context . Context . instance ( ) . flavor ( TimelineUtils . AICallTree . AICallTree ) ) ,
453442 this . #selectedFile = createFileContext ( UI . Context . Context . instance ( ) . flavor ( Workspace . UISourceCode . UISourceCode ) ) ,
454- this . #project =
455- createProjectContext ( UI . Context . Context . instance ( ) . flavor ( Persistence . FileSystemWorkspaceBinding . FileSystem ) ) ,
456443 this . #viewProps = {
457444 ...this . #viewProps,
458445 agentType : this . #currentAgent?. type ,
@@ -473,8 +460,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
473460 TimelineUtils . AICallTree . AICallTree , this . #handleTraceEntryNodeFlavorChange) ;
474461 UI . Context . Context . instance ( ) . addFlavorChangeListener (
475462 Workspace . UISourceCode . UISourceCode , this . #handleUISourceCodeFlavorChange) ;
476- UI . Context . Context . instance ( ) . addFlavorChangeListener (
477- Persistence . FileSystemWorkspaceBinding . FileSystem , this . #handlePersistenceFileSystemChange) ;
478463 UI . Context . Context . instance ( ) . addFlavorChangeListener (
479464 ElementsPanel . ElementsPanel . ElementsPanel , this . #selectDefaultAgentIfNeeded, this ) ;
480465 UI . Context . Context . instance ( ) . addFlavorChangeListener (
@@ -600,19 +585,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
600585 this . #updateAgentState( this . #currentAgent) ;
601586 } ;
602587
603- #handlePersistenceFileSystemChange =
604- ( ev : Common . EventTarget . EventTargetEvent < Persistence . FileSystemWorkspaceBinding . FileSystem > ) : void => {
605- const newProject = ev . data ;
606- if ( ! newProject ) {
607- return ;
608- }
609- if ( this . #project?. getItem ( ) === newProject ) {
610- return ;
611- }
612- this . #project = new ProjectContext ( ev . data as Workspace . Workspace . Project ) ;
613- this . #updateAgentState( this . #currentAgent) ;
614- } ;
615-
616588 #handleAiAssistanceEnabledSettingChanged = ( ) : void => {
617589 const nextChatUiState = this . #getChatUiState( ) ;
618590 if ( this . #viewProps. state === nextChatUiState ) {
@@ -674,11 +646,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
674646
675647 let targetAgentType : AgentType | undefined ;
676648 switch ( actionId ) {
677- case 'ai-assistance.filesystem' : {
678- // TODO: metrics if needed.
679- targetAgentType = AgentType . PATCH ;
680- break ;
681- }
682649 case 'freestyler.elements-floating-button' : {
683650 Host . userMetrics . actionTaken ( Host . UserMetrics . Action . AiAssistanceOpenedFromElementsPanelFloatingButton ) ;
684651 targetAgentType = AgentType . STYLING ;
@@ -856,8 +823,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
856823 context = this . #selectedCallTree;
857824 break ;
858825 case AgentType . PATCH :
859- context = this . #project;
860- break ;
826+ throw new Error ( 'AI Assistance does not support direct usage of the patch agent' ) ;
861827 }
862828 return context ;
863829 }
@@ -1035,8 +1001,7 @@ export class ActionDelegate implements UI.ActionRegistration.ActionDelegate {
10351001 case 'drjones.network-panel-context' :
10361002 case 'drjones.performance-panel-context' :
10371003 case 'drjones.sources-floating-button' :
1038- case 'drjones.sources-panel-context' :
1039- case 'ai-assistance.filesystem' : {
1004+ case 'drjones.sources-panel-context' : {
10401005 void ( async ( ) => {
10411006 const view = UI . ViewManager . ViewManager . instance ( ) . view (
10421007 AiAssistancePanel . panelName ,
0 commit comments