@codingame/monaco-vscode-chat-service-override 30.0.0 → 31.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/index.js +21 -3
- package/package.json +5 -5
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.d.ts +125 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +393 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +65 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +453 -0
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +28 -0
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +81 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +75 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +180 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +202 -51
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +182 -0
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +282 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.d.ts +303 -32
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.js +14 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.d.ts +1 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.js +9 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.d.ts +30 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.js +662 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +12 -5
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.js +9 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.d.ts +17 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.js +5 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.d.ts +5 -5
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.js +14 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.d.ts +42 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.js +7 -0
- package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.d.ts +118 -0
- package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.js +551 -0
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.d.ts +22 -0
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +83 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +59 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +17 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +113 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +81 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +47 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +15 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +13 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +15 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.d.ts +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +58 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +24 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +29 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.js +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +65 -55
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +28 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +10 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +80 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +20 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +30 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +131 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +363 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +31 -76
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +374 -764
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.d.ts +8 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.js +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +222 -44
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +20 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +269 -123
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePage.js +40 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +26 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +249 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.d.ts +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWorkspaceService.js +3 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +5 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +14 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +113 -58
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +202 -68
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +246 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +162 -50
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +24 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +306 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +581 -257
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +15 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +245 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +25 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +3 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +19 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +103 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowLayout.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.d.ts +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +80 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +20 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +128 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +28 -28
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +11 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +10 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.d.ts +4 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditor.js +4 -310
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +3 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +61 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatManagementEditor.css +0 -110
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +31 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +46 -34
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +17 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +96 -82
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +21 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatus.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +15 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +315 -263
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +14 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +196 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +56 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipEligibilityTracker.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +31 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +26 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +48 -57
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +26 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.d.ts +11 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +226 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatModelCountTelemetry.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/telemetry/chatModelCountTelemetry.js +82 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +108 -56
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +24 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +9 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.d.ts +3 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.js +9 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +21 -80
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +26 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +4 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +46 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.d.ts +40 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +32 -5
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +152 -26
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +5 -9
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +265 -261
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.d.ts +28 -2
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatModelStore.js +75 -7
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +9 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +6 -5
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/common/model/objectMutationLog.js +32 -4
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +10 -25
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +7 -52
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +58 -466
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +36 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +0 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +168 -182
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +49 -29
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +491 -462
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +16 -6
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +18 -12
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.d.ts +24 -4
- package/vscode/src/vs/workbench/contrib/chat/common/tools/chatArtifactsService.js +145 -68
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +25 -25
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.d.ts +2 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.js +19 -17
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +3 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +5 -17
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +77 -157
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +10 -10
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +17 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibleView.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +21 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatEnabler.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.d.ts +4 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatService.js +29 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +12 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.d.ts +5 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +49 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +9 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +13 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +319 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +8 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +15 -15
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +2 -2
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.d.ts +21 -0
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostFileSystemService.js +35 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.service.d.ts +0 -94
- package/vscode/src/vs/platform/agentHost/common/state/protocol/action-origin.generated.d.ts +0 -16
- package/vscode/src/vs/platform/agentHost/common/state/protocol/actions.d.ts +0 -578
- package/vscode/src/vs/platform/agentHost/common/state/protocol/messages.d.ts +0 -206
- package/vscode/src/vs/platform/agentHost/common/state/protocol/notifications.d.ts +0 -114
- package/vscode/src/vs/platform/agentHost/common/state/protocol/state.d.ts +0 -860
- package/vscode/src/vs/platform/agentHost/common/state/sessionState.d.ts +0 -27
- package/vscode/src/vs/platform/browserElements/common/browserElements.d.ts +0 -58
- package/vscode/src/vs/platform/browserElements/common/browserElements.js +0 -16
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.d.ts +0 -18
- package/vscode/src/vs/platform/sandbox/common/sandboxHelperIpc.js +0 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/media/simpleBrowserOverlay.css +0 -85
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/simpleBrowserEditorOverlay.js +0 -443
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatUsageWidget.js +0 -132
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatUsageWidget.css +0 -69
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.d.ts +0 -65
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetup.js +0 -66
- package/vscode/src/vs/workbench/contrib/chat/common/chatArtifactExtraction.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/chat/common/chatArtifactExtraction.js +0 -158
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.d.ts +0 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/alternativeRecommendation.js +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/commandFileWriteParser.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.d.ts +0 -26
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/commandParsers/sedFileWriteParser.js +0 -142
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/basicExecuteStrategy.js +0 -164
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/executeStrategy.js +0 -163
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.d.ts +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/noneExecuteStrategy.js +0 -142
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.d.ts +0 -29
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/richExecuteStrategy.js +0 -137
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/executeStrategy/strategyHelpers.js +0 -174
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/outputHelpers.js +0 -39
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.d.ts +0 -32
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalHelpers.js +0 -249
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/runInTerminalToolTelemetry.js +0 -92
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.d.ts +0 -40
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/toolTerminalCreator.js +0 -209
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/awaitTerminalTool.js +0 -106
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.d.ts +0 -31
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/commandLineAutoApprover.js +0 -392
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.d.ts +0 -45
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/autoApprove/npmScriptAutoApprover.js +0 -243
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.d.ts +0 -52
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAnalyzer.js +0 -10
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineAutoApproveAnalyzer.js +0 -310
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineFileWriteAnalyzer.js +0 -168
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineAnalyzer/commandLineSandboxAnalyzer.js +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/commandLinePresenter.d.ts +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/nodeCommandLinePresenter.js +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/pythonCommandLinePresenter.js +0 -37
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.d.ts +0 -19
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/rubyCommandLinePresenter.js +0 -44
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.d.ts +0 -13
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLinePresenter/sandboxedCommandLinePresenter.js +0 -21
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.d.ts +0 -5
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineCdPrefixRewriter.js +0 -27
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePreventHistoryRewriter.js +0 -29
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLinePwshChainOperatorRewriter.js +0 -33
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineRewriter.d.ts +0 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.d.ts +0 -8
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/commandLineRewriter/commandLineSandboxRewriter.js +0 -28
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.d.ts +0 -118
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/outputMonitor.js +0 -1019
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.d.ts +0 -49
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/monitoring/types.js +0 -23
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/outputAnalyzer.d.ts +0 -9
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.d.ts +0 -150
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +0 -1619
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.d.ts +0 -22
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sandboxOutputAnalyzer.js +0 -41
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.d.ts +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalCommandArtifactCollector.js +0 -118
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.d.ts +0 -12
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/toolIds.js +0 -17
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.d.ts +0 -25
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/treeSitterCommandParser.js +0 -130
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.d.ts +0 -122
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/common/terminalSandboxService.js +0 -482
package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js
CHANGED
|
@@ -5,6 +5,7 @@ import { CancellationError } from '@codingame/monaco-vscode-api/vscode/vs/base/c
|
|
|
5
5
|
import { Emitter, Event } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
6
6
|
import { parse } from '@codingame/monaco-vscode-api/vscode/vs/base/common/json';
|
|
7
7
|
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
8
|
+
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
8
9
|
import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
|
|
9
10
|
import { ResourceMap, ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
|
|
10
11
|
import { isEqual, dirname, basename } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
|
|
@@ -25,20 +26,19 @@ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform
|
|
|
25
26
|
import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
|
|
26
27
|
import { IUserDataProfileService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
27
28
|
import { PromptsConfig } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/config';
|
|
28
|
-
import { getCleanPromptName, AGENT_MD_FILENAME, CLAUDE_MD_FILENAME, CLAUDE_LOCAL_MD_FILENAME, CLAUDE_CONFIG_FOLDER, COPILOT_CUSTOM_INSTRUCTIONS_FILENAME, GITHUB_CONFIG_FOLDER, getSkillFolderName } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
29
|
+
import { getCleanPromptName, AGENT_MD_FILENAME, CLAUDE_MD_FILENAME, CLAUDE_LOCAL_MD_FILENAME, CLAUDE_CONFIG_FOLDER, COPILOT_CUSTOM_INSTRUCTIONS_FILENAME, GITHUB_CONFIG_FOLDER, getSkillFolderName, isInClaudeRulesFolder } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
|
|
29
30
|
import { PromptsType, PromptFileSource, PROMPT_LANGUAGE_ID, Target, getPromptsTypeForLanguageId } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
|
|
30
31
|
import { PromptFilesLocator } from '../utils/promptFilesLocator.js';
|
|
31
|
-
import { PromptFileParser, PromptHeaderAttributes } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
|
|
32
|
-
import { PromptsStorage, SKILL_PROVIDER_ACTIVATION_EVENT, PROMPT_FILE_PROVIDER_ACTIVATION_EVENT, INSTRUCTIONS_PROVIDER_ACTIVATION_EVENT, CUSTOM_AGENT_PROVIDER_ACTIVATION_EVENT,
|
|
32
|
+
import { PromptFileParser, PromptHeaderAttributes, evaluateApplyToPattern } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
|
|
33
|
+
import { PromptsStorage, SKILL_PROVIDER_ACTIVATION_EVENT, PROMPT_FILE_PROVIDER_ACTIVATION_EVENT, INSTRUCTIONS_PROVIDER_ACTIVATION_EVENT, CUSTOM_AGENT_PROVIDER_ACTIVATION_EVENT, isExtensionPromptPath, AgentInstructionFileType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
|
|
33
34
|
import { Delayer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
34
35
|
import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
|
|
35
36
|
import { parseSubagentHooksFromYaml } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/hookSchema';
|
|
36
|
-
import { parseHooksFromFile, HookSourceFormat
|
|
37
|
+
import { parseHooksFromFile, HookSourceFormat } from '../hookCompatibility.js';
|
|
37
38
|
import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
|
|
38
39
|
import { IWorkspaceTrustManagementService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspaceTrust.service';
|
|
39
40
|
import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
|
|
40
41
|
import { getTarget, mapClaudeModels, mapClaudeTools } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptFileAttributes';
|
|
41
|
-
import { StopWatch } from '@codingame/monaco-vscode-api/vscode/vs/base/common/stopwatch';
|
|
42
42
|
import { ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
|
|
43
43
|
import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
|
|
44
44
|
import { getCanonicalPluginCommandId } from '../../plugins/agentPluginService.js';
|
|
@@ -106,8 +106,6 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
106
106
|
this.agentPluginService = agentPluginService;
|
|
107
107
|
this.workspaceTrustService = workspaceTrustService;
|
|
108
108
|
this.cachedParsedPromptFromModels = ( new ResourceMap());
|
|
109
|
-
this._onDidLogDiscovery = this._register(( new Emitter()));
|
|
110
|
-
this.onDidLogDiscovery = this._onDidLogDiscovery.event;
|
|
111
109
|
this.cachedFileLocations = {};
|
|
112
110
|
this.fileLocatorEvents = {};
|
|
113
111
|
this.contributedFiles = {
|
|
@@ -119,11 +117,14 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
119
117
|
};
|
|
120
118
|
this._contributedWhenKeys = ( new Set());
|
|
121
119
|
this._contributedWhenClauses = ( new Map());
|
|
120
|
+
this._providerWhenClauses = ( new Map());
|
|
122
121
|
this._onDidContributedWhenChange = this._register(( new Emitter()));
|
|
123
122
|
this._onDidChangeInstructions = this._register(( new Emitter()));
|
|
124
123
|
this._onDidPluginPromptFilesChange = this._register(( new Emitter()));
|
|
125
124
|
this._onDidPluginHooksChange = this._register(( new Emitter()));
|
|
126
125
|
this._pluginPromptFilesByType = ( new Map());
|
|
126
|
+
this._pendingReadonlyUris = [];
|
|
127
|
+
this._pendingReadonlyFlush = false;
|
|
127
128
|
this.promptFileProviders = [];
|
|
128
129
|
this.disabledPromptsStorageKeyPrefix = "chat.disabledPromptFiles.";
|
|
129
130
|
this.fileLocator = this.createPromptFilesLocator();
|
|
@@ -139,7 +140,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
139
140
|
}
|
|
140
141
|
}));
|
|
141
142
|
const modelChangeEvent = this._register(( new ModelChangeTracker(this.modelService))).onDidPromptChange;
|
|
142
|
-
this.cachedCustomAgents = this._register(( new CachedPromise(token => this.
|
|
143
|
+
this.cachedCustomAgents = this._register(( new CachedPromise(token => this.computeAgentDiscoveryInfo(token), () => Event.any(
|
|
143
144
|
this.getFileLocatorEvent(PromptsType.agent),
|
|
144
145
|
Event.filter(modelChangeEvent, e => e.promptType === PromptsType.agent),
|
|
145
146
|
this._onDidContributedWhenChange.event,
|
|
@@ -149,7 +150,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
149
150
|
),
|
|
150
151
|
this._onDidPluginPromptFilesChange.event
|
|
151
152
|
))));
|
|
152
|
-
this.cachedSlashCommands = this._register(( new CachedPromise(token => this.
|
|
153
|
+
this.cachedSlashCommands = this._register(( new CachedPromise(token => this.computeSlashCommandDiscoveryInfo(token), () => Event.any(
|
|
153
154
|
this.getFileLocatorEvent(PromptsType.prompt),
|
|
154
155
|
this.getFileLocatorEvent(PromptsType.skill),
|
|
155
156
|
Event.filter(modelChangeEvent, e => e.promptType === PromptsType.prompt),
|
|
@@ -157,7 +158,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
157
158
|
this._onDidContributedWhenChange.event,
|
|
158
159
|
this._onDidPluginPromptFilesChange.event
|
|
159
160
|
))));
|
|
160
|
-
this.cachedSkills = this._register(( new CachedPromise(token => this.
|
|
161
|
+
this.cachedSkills = this._register(( new CachedPromise(token => this.computeSkillDiscovery(token), () => Event.any(
|
|
161
162
|
this.getFileLocatorEvent(PromptsType.skill),
|
|
162
163
|
Event.filter(modelChangeEvent, e => e.promptType === PromptsType.skill),
|
|
163
164
|
this._onDidContributedWhenChange.event,
|
|
@@ -315,6 +316,8 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
315
316
|
const index = this.promptFileProviders.findIndex(p => p === providerEntry);
|
|
316
317
|
if (index >= 0) {
|
|
317
318
|
this.promptFileProviders.splice(index, 1);
|
|
319
|
+
this._providerWhenClauses.delete(providerEntry);
|
|
320
|
+
this._updateContributedWhenKeys();
|
|
318
321
|
this.invalidatePromptFileCache(type);
|
|
319
322
|
}
|
|
320
323
|
}
|
|
@@ -339,6 +342,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
339
342
|
}
|
|
340
343
|
async listFromProviders(type, activationEvent, token) {
|
|
341
344
|
const result = [];
|
|
345
|
+
const readonlyUris = [];
|
|
342
346
|
await this.extensionService.activateByEvent(activationEvent);
|
|
343
347
|
const providers = this.promptFileProviders.filter(p => p.type === type);
|
|
344
348
|
if (providers.length === 0) {
|
|
@@ -347,16 +351,13 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
347
351
|
for (const providerEntry of providers) {
|
|
348
352
|
try {
|
|
349
353
|
const files = await providerEntry.providePromptFiles({}, token);
|
|
354
|
+
this._providerWhenClauses.set(providerEntry, files?.flatMap(file => file.when ? [file.when] : []) ?? []);
|
|
355
|
+
this._updateContributedWhenKeys();
|
|
350
356
|
if (!files || token.isCancellationRequested) {
|
|
351
357
|
continue;
|
|
352
358
|
}
|
|
353
359
|
for (const file of files) {
|
|
354
|
-
|
|
355
|
-
await this.filesConfigService.updateReadonly(file.uri, true);
|
|
356
|
-
} catch (e) {
|
|
357
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
358
|
-
this.logger.error(`[listFromProviders] Failed to make file readonly: ${file.uri}`, msg);
|
|
359
|
-
}
|
|
360
|
+
readonlyUris.push(file.uri);
|
|
360
361
|
result.push({
|
|
361
362
|
uri: file.uri,
|
|
362
363
|
storage: PromptsStorage.extension,
|
|
@@ -364,7 +365,9 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
364
365
|
extension: providerEntry.extension,
|
|
365
366
|
source: PromptFileSource.ExtensionAPI,
|
|
366
367
|
name: file.name,
|
|
367
|
-
description: file.description
|
|
368
|
+
description: file.description,
|
|
369
|
+
when: file.when,
|
|
370
|
+
sessionTypes: file.sessionTypes
|
|
368
371
|
});
|
|
369
372
|
}
|
|
370
373
|
} catch (e) {
|
|
@@ -374,52 +377,56 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
374
377
|
);
|
|
375
378
|
}
|
|
376
379
|
}
|
|
380
|
+
void this.filesConfigService.updateReadonly(readonlyUris, true);
|
|
377
381
|
return result;
|
|
378
382
|
}
|
|
379
383
|
async listPromptFilesForStorage(type, storage, token) {
|
|
384
|
+
let promptPaths;
|
|
380
385
|
switch (storage) {
|
|
381
386
|
case PromptsStorage.extension:
|
|
382
|
-
|
|
387
|
+
promptPaths = await this.getExtensionPromptFiles(type, token);
|
|
388
|
+
break;
|
|
383
389
|
case PromptsStorage.local:
|
|
384
|
-
|
|
390
|
+
promptPaths = await this.fileLocator.listFiles(type, PromptsStorage.local, token).then(uris => ( uris.map(uri => ({
|
|
385
391
|
uri,
|
|
386
392
|
storage: PromptsStorage.local,
|
|
387
393
|
type
|
|
388
394
|
}))));
|
|
395
|
+
break;
|
|
389
396
|
case PromptsStorage.user:
|
|
390
|
-
|
|
397
|
+
promptPaths = await this.fileLocator.listFiles(type, PromptsStorage.user, token).then(uris => ( uris.map(uri => ({
|
|
391
398
|
uri,
|
|
392
399
|
storage: PromptsStorage.user,
|
|
393
400
|
type
|
|
394
401
|
}))));
|
|
402
|
+
break;
|
|
395
403
|
case PromptsStorage.plugin:
|
|
396
|
-
|
|
404
|
+
promptPaths = this._pluginPromptFilesByType.get(type) ?? [];
|
|
405
|
+
break;
|
|
397
406
|
default:
|
|
398
407
|
throw ( new Error(`[listPromptFilesForStorage] Unsupported prompt storage type: ${storage}`));
|
|
399
408
|
}
|
|
409
|
+
return promptPaths;
|
|
400
410
|
}
|
|
401
411
|
async getExtensionPromptFiles(type, token) {
|
|
402
412
|
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
403
413
|
const settledResults = await Promise.allSettled(( this.contributedFiles[type].values()));
|
|
404
|
-
const contributedFiles = ( settledResults.filter(result => result.status === "fulfilled").map(result => result.value))
|
|
414
|
+
const contributedFiles = ( settledResults.filter(result => result.status === "fulfilled").map(result => result.value));
|
|
415
|
+
const activationEvent = this.getProviderActivationEvent(type);
|
|
416
|
+
const providerFiles = activationEvent ? await this.listFromProviders(type, activationEvent, token) : [];
|
|
417
|
+
return [...contributedFiles, ...providerFiles].filter(file => {
|
|
405
418
|
if (!file.when) {
|
|
406
419
|
return true;
|
|
407
420
|
}
|
|
408
|
-
const
|
|
409
|
-
if (!
|
|
421
|
+
const when = ContextKeyExpr.deserialize(file.when);
|
|
422
|
+
if (!when) {
|
|
410
423
|
this.logger.warn(
|
|
411
424
|
`[getExtensionPromptFiles] Ignoring contributed prompt file with invalid when clause: ${file.when}`
|
|
412
425
|
);
|
|
413
426
|
return false;
|
|
414
427
|
}
|
|
415
|
-
return this.contextKeyService.contextMatchesRules(
|
|
428
|
+
return this.contextKeyService.contextMatchesRules(when);
|
|
416
429
|
});
|
|
417
|
-
const activationEvent = this.getProviderActivationEvent(type);
|
|
418
|
-
if (!activationEvent) {
|
|
419
|
-
return contributedFiles;
|
|
420
|
-
}
|
|
421
|
-
const providerFiles = await this.listFromProviders(type, activationEvent, token);
|
|
422
|
-
return [...contributedFiles, ...providerFiles];
|
|
423
430
|
}
|
|
424
431
|
getProviderActivationEvent(type) {
|
|
425
432
|
switch (type) {
|
|
@@ -471,68 +478,88 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
471
478
|
get onDidChangeSlashCommands() {
|
|
472
479
|
return this.cachedSlashCommands.onDidChangePromise;
|
|
473
480
|
}
|
|
474
|
-
async getPromptSlashCommands(token
|
|
475
|
-
const
|
|
476
|
-
const result =
|
|
477
|
-
if (sessionResource) {
|
|
478
|
-
const elapsed = sw.elapsed();
|
|
479
|
-
void this.getPromptSlashCommandDiscoveryInfo(token).catch(() => undefined).then(discoveryInfo => {
|
|
480
|
-
const details = result.length === 1 ? ( localize(
|
|
481
|
-
7621,
|
|
482
|
-
"Resolved {0} slash command in {1}ms",
|
|
483
|
-
result.length,
|
|
484
|
-
elapsed.toFixed(1)
|
|
485
|
-
)) : ( localize(
|
|
486
|
-
7622,
|
|
487
|
-
"Resolved {0} slash commands in {1}ms",
|
|
488
|
-
result.length,
|
|
489
|
-
elapsed.toFixed(1)
|
|
490
|
-
));
|
|
491
|
-
this._onDidLogDiscovery.fire({
|
|
492
|
-
sessionResource,
|
|
493
|
-
name: ( localize(7623, "Load Slash Commands")),
|
|
494
|
-
details,
|
|
495
|
-
discoveryInfo,
|
|
496
|
-
category: "discovery"
|
|
497
|
-
});
|
|
498
|
-
});
|
|
499
|
-
}
|
|
481
|
+
async getPromptSlashCommands(token) {
|
|
482
|
+
const discoveryInfo = await this.cachedSlashCommands.get(token);
|
|
483
|
+
const result = this.slashCommandsFromDiscoveryInfo(discoveryInfo);
|
|
500
484
|
return result;
|
|
501
485
|
}
|
|
502
|
-
async
|
|
486
|
+
async computeSlashCommandDiscoveryInfo(token) {
|
|
487
|
+
const stopWatch = StopWatch.create(true);
|
|
503
488
|
const promptFiles = await this.listPromptFiles(PromptsType.prompt, token);
|
|
504
489
|
const useAgentSkills = this.configurationService.getValue(PromptsConfig.USE_AGENT_SKILLS);
|
|
505
490
|
const skills = useAgentSkills ? await this.listPromptFiles(PromptsType.skill, token) : [];
|
|
506
491
|
const disabledSkills = this.getDisabledPromptFiles(PromptsType.skill);
|
|
507
492
|
const slashCommandFiles = [...promptFiles, ...skills.filter(s => !( disabledSkills.has(s.uri)))];
|
|
508
|
-
const
|
|
493
|
+
const parseResults = await Promise.all(( slashCommandFiles.map(async promptPath => {
|
|
509
494
|
try {
|
|
510
495
|
const parsedPromptFile = await this.parseNew(promptPath.uri, token);
|
|
511
|
-
|
|
496
|
+
const rawName = parsedPromptFile?.header?.name ?? promptPath.name ?? getCleanPromptName(promptPath.uri);
|
|
497
|
+
const name = promptPath.source === PromptFileSource.Plugin && promptPath.pluginUri ? getCanonicalPluginCommandId({
|
|
498
|
+
uri: promptPath.pluginUri
|
|
499
|
+
}, rawName) : rawName;
|
|
500
|
+
const description = parsedPromptFile?.header?.description ?? promptPath.description;
|
|
501
|
+
const argumentHint = parsedPromptFile?.header?.argumentHint;
|
|
502
|
+
const userInvocable = parsedPromptFile?.header?.userInvocable;
|
|
503
|
+
return {
|
|
504
|
+
status: "loaded",
|
|
505
|
+
promptPath: this.withPromptPathMetadata(promptPath, name, description),
|
|
506
|
+
argumentHint,
|
|
507
|
+
userInvocable
|
|
508
|
+
};
|
|
512
509
|
} catch (e) {
|
|
513
510
|
this.logger.error(
|
|
514
|
-
`[
|
|
511
|
+
`[computeSlashCommandDiscoveryInfo] Failed to parse prompt file for slash command: ${promptPath.uri}`,
|
|
515
512
|
e instanceof Error ? e.message : String(e)
|
|
516
513
|
);
|
|
517
|
-
return
|
|
514
|
+
return {
|
|
515
|
+
status: "skipped",
|
|
516
|
+
skipReason: "parse-error",
|
|
517
|
+
errorMessage: e instanceof Error ? e.message : String(e),
|
|
518
|
+
promptPath
|
|
519
|
+
};
|
|
518
520
|
}
|
|
519
521
|
})));
|
|
522
|
+
const files = parseResults;
|
|
523
|
+
const promptSourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.prompt);
|
|
524
|
+
const sourceFolders = [...promptSourceFolders];
|
|
525
|
+
if (useAgentSkills) {
|
|
526
|
+
const skillSourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.skill);
|
|
527
|
+
sourceFolders.push(...skillSourceFolders);
|
|
528
|
+
}
|
|
529
|
+
return {
|
|
530
|
+
type: PromptsType.prompt,
|
|
531
|
+
files,
|
|
532
|
+
sourceFolders,
|
|
533
|
+
durationInMillis: stopWatch.elapsed()
|
|
534
|
+
};
|
|
535
|
+
}
|
|
536
|
+
slashCommandsFromDiscoveryInfo(discoveryInfo) {
|
|
520
537
|
const result = [];
|
|
521
538
|
const seen = ( new ResourceSet());
|
|
522
|
-
for (const
|
|
523
|
-
if (
|
|
524
|
-
result.push(
|
|
525
|
-
|
|
539
|
+
for (const file of discoveryInfo.files) {
|
|
540
|
+
if (file.status === "loaded") {
|
|
541
|
+
result.push(
|
|
542
|
+
this.asChatPromptSlashCommand(file.argumentHint, file.userInvocable, file.promptPath)
|
|
543
|
+
);
|
|
544
|
+
seen.add(file.promptPath.uri);
|
|
526
545
|
}
|
|
527
546
|
}
|
|
528
547
|
for (const model of this.modelService.getModels()) {
|
|
529
548
|
if (model.getLanguageId() === PROMPT_LANGUAGE_ID && model.uri.scheme === Schemas.untitled && !( seen.has(model.uri))) {
|
|
530
549
|
const parsedPromptFile = this.getParsedPromptFile(model);
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
550
|
+
const name = parsedPromptFile?.header?.name ?? getCleanPromptName(model.uri);
|
|
551
|
+
const description = parsedPromptFile?.header?.description;
|
|
552
|
+
result.push(this.asChatPromptSlashCommand(
|
|
553
|
+
parsedPromptFile?.header?.argumentHint,
|
|
554
|
+
parsedPromptFile?.header?.userInvocable,
|
|
555
|
+
{
|
|
556
|
+
uri: model.uri,
|
|
557
|
+
storage: PromptsStorage.local,
|
|
558
|
+
type: PromptsType.prompt,
|
|
559
|
+
name,
|
|
560
|
+
description
|
|
561
|
+
}
|
|
562
|
+
));
|
|
536
563
|
}
|
|
537
564
|
}
|
|
538
565
|
return result;
|
|
@@ -542,23 +569,37 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
542
569
|
}
|
|
543
570
|
async resolvePromptSlashCommand(name, token) {
|
|
544
571
|
const commands = await this.getPromptSlashCommands(token);
|
|
545
|
-
|
|
572
|
+
const command = commands.find(cmd => cmd.name === name);
|
|
573
|
+
if (command) {
|
|
574
|
+
return {
|
|
575
|
+
...command,
|
|
576
|
+
parsedPromptFile: await this.parseNew(command.uri, token)
|
|
577
|
+
};
|
|
578
|
+
}
|
|
579
|
+
return undefined;
|
|
546
580
|
}
|
|
547
|
-
asChatPromptSlashCommand(
|
|
548
|
-
let name =
|
|
581
|
+
asChatPromptSlashCommand(argumentHint, userInvocable, promptPath) {
|
|
582
|
+
let name = promptPath.name ?? getCleanPromptName(promptPath.uri);
|
|
549
583
|
name = name.replace(/[^\p{L}\d_\-\.:]+/gu, "-");
|
|
584
|
+
const when = isExtensionPromptPath(promptPath) && promptPath.when ? ContextKeyExpr.deserialize(promptPath.when) ?? undefined : undefined;
|
|
550
585
|
return {
|
|
586
|
+
uri: promptPath.uri,
|
|
551
587
|
name: name,
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
promptPath,
|
|
556
|
-
|
|
588
|
+
source: promptPath.source,
|
|
589
|
+
storage: promptPath.storage,
|
|
590
|
+
type: promptPath.type,
|
|
591
|
+
extension: promptPath.extension,
|
|
592
|
+
pluginUri: promptPath.pluginUri,
|
|
593
|
+
description: promptPath.description,
|
|
594
|
+
argumentHint: argumentHint,
|
|
595
|
+
userInvocable: userInvocable ?? true,
|
|
596
|
+
when,
|
|
597
|
+
sessionTypes: promptPath.sessionTypes
|
|
557
598
|
};
|
|
558
599
|
}
|
|
559
600
|
async getPromptSlashCommandName(uri, token) {
|
|
560
601
|
const slashCommands = await this.getPromptSlashCommands(token);
|
|
561
|
-
const slashCommand = slashCommands.find(c => isEqual(c.
|
|
602
|
+
const slashCommand = slashCommands.find(c => isEqual(c.uri, uri));
|
|
562
603
|
if (!slashCommand) {
|
|
563
604
|
return getCleanPromptName(uri);
|
|
564
605
|
}
|
|
@@ -570,144 +611,173 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
570
611
|
get onDidChangeInstructions() {
|
|
571
612
|
return this.cachedInstructions.onDidChangePromise;
|
|
572
613
|
}
|
|
573
|
-
async getCustomAgents(token
|
|
574
|
-
const
|
|
575
|
-
const result =
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
discoveryInfo,
|
|
585
|
-
category: "discovery"
|
|
586
|
-
});
|
|
587
|
-
});
|
|
614
|
+
async getCustomAgents(token) {
|
|
615
|
+
const discoveryInfo = await this.cachedCustomAgents.get(token);
|
|
616
|
+
const result = this.agentsFromDiscoveryInfo(discoveryInfo);
|
|
617
|
+
return result;
|
|
618
|
+
}
|
|
619
|
+
agentsFromDiscoveryInfo(discoveryInfo) {
|
|
620
|
+
const result = [];
|
|
621
|
+
for (const file of discoveryInfo.files) {
|
|
622
|
+
if (file.status === "loaded" && file.agent) {
|
|
623
|
+
result.push(file.agent);
|
|
624
|
+
}
|
|
588
625
|
}
|
|
589
626
|
return result;
|
|
590
627
|
}
|
|
591
|
-
async
|
|
592
|
-
|
|
628
|
+
async computeAgentDiscoveryInfo(token) {
|
|
629
|
+
const stopWatch = StopWatch.create(true);
|
|
630
|
+
const allAgentFiles = await this.listPromptFiles(PromptsType.agent, token);
|
|
593
631
|
const disabledAgents = this.getDisabledPromptFiles(PromptsType.agent);
|
|
594
|
-
agentFiles = agentFiles.filter(promptPath => !( disabledAgents.has(promptPath.uri)));
|
|
595
632
|
const userHomeUri = await this.pathService.userHome();
|
|
596
633
|
const userHome = userHomeUri.scheme === Schemas.file ? userHomeUri.fsPath : userHomeUri.path;
|
|
597
634
|
const defaultFolder = this.workspaceService.getWorkspace().folders[0];
|
|
598
|
-
const
|
|
635
|
+
const files = await Promise.all(( allAgentFiles.map(async promptPath => {
|
|
599
636
|
const uri = promptPath.uri;
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
637
|
+
if (( disabledAgents.has(uri))) {
|
|
638
|
+
return {
|
|
639
|
+
status: "skipped",
|
|
640
|
+
skipReason: "disabled",
|
|
641
|
+
promptPath
|
|
642
|
+
};
|
|
643
|
+
}
|
|
644
|
+
try {
|
|
645
|
+
const ast = await this.parseNew(uri, token);
|
|
646
|
+
let metadata;
|
|
647
|
+
if (ast.header) {
|
|
648
|
+
const advanced = ast.header.getAttribute(PromptHeaderAttributes.advancedOptions);
|
|
649
|
+
if (advanced && advanced.value.type === "map") {
|
|
650
|
+
metadata = {};
|
|
651
|
+
for (const [key, value] of Object.entries(advanced.value)) {
|
|
652
|
+
if (value.type === "scalar") {
|
|
653
|
+
metadata[key] = value;
|
|
654
|
+
}
|
|
609
655
|
}
|
|
610
656
|
}
|
|
611
657
|
}
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
658
|
+
const toolReferences = [];
|
|
659
|
+
if (ast.body) {
|
|
660
|
+
const bodyOffset = ast.body.offset;
|
|
661
|
+
const bodyVarRefs = ast.body.variableReferences;
|
|
662
|
+
for (let i = bodyVarRefs.length - 1; i >= 0; i--) {
|
|
663
|
+
const {
|
|
664
|
+
name,
|
|
665
|
+
offset,
|
|
666
|
+
fullLength
|
|
667
|
+
} = bodyVarRefs[i];
|
|
668
|
+
const range = ( new OffsetRange(offset - bodyOffset, offset - bodyOffset + fullLength));
|
|
669
|
+
toolReferences.push({
|
|
670
|
+
name,
|
|
671
|
+
range
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
}
|
|
675
|
+
const agentInstructions = {
|
|
676
|
+
content: ast.body?.getContent() ?? "",
|
|
677
|
+
toolReferences,
|
|
678
|
+
metadata
|
|
679
|
+
};
|
|
680
|
+
const name = ast.header?.name ?? promptPath.name ?? getCleanPromptName(uri);
|
|
681
|
+
const description = ast.header?.description ?? promptPath.description;
|
|
682
|
+
const target = getTarget(PromptsType.agent, ast.header ?? uri);
|
|
683
|
+
const source = IAgentSource.fromPromptPath(promptPath);
|
|
684
|
+
const when = isExtensionPromptPath(promptPath) && promptPath.when ? ContextKeyExpr.deserialize(promptPath.when) ?? undefined : undefined;
|
|
685
|
+
if (!ast.header) {
|
|
686
|
+
const agent = {
|
|
687
|
+
uri,
|
|
624
688
|
name,
|
|
625
|
-
|
|
626
|
-
|
|
689
|
+
agentInstructions,
|
|
690
|
+
source,
|
|
691
|
+
target,
|
|
692
|
+
visibility: {
|
|
693
|
+
userInvocable: true,
|
|
694
|
+
agentInvocable: true
|
|
695
|
+
},
|
|
696
|
+
sessionTypes: promptPath.sessionTypes,
|
|
697
|
+
...(when !== undefined ? {
|
|
698
|
+
when
|
|
699
|
+
} : undefined)
|
|
700
|
+
};
|
|
701
|
+
return {
|
|
702
|
+
status: "loaded",
|
|
703
|
+
promptPath: this.withPromptPathMetadata(promptPath, name, description),
|
|
704
|
+
agent
|
|
705
|
+
};
|
|
627
706
|
}
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
707
|
+
const visibility = {
|
|
708
|
+
userInvocable: ast.header.userInvocable !== false,
|
|
709
|
+
agentInvocable: ast.header.infer !== undefined ? ast.header.infer === true : ast.header.disableModelInvocation !== true
|
|
710
|
+
};
|
|
711
|
+
let model = ast.header.model;
|
|
712
|
+
if (target === Target.Claude && model) {
|
|
713
|
+
model = mapClaudeModels(model);
|
|
714
|
+
}
|
|
715
|
+
let {
|
|
716
|
+
tools,
|
|
717
|
+
handOffs,
|
|
718
|
+
argumentHint,
|
|
719
|
+
agents
|
|
720
|
+
} = ast.header;
|
|
721
|
+
if (target === Target.Claude && tools) {
|
|
722
|
+
tools = mapClaudeTools(tools);
|
|
723
|
+
}
|
|
724
|
+
let hooks;
|
|
725
|
+
const useCustomAgentHooks = this.configurationService.getValue(PromptsConfig.USE_CUSTOM_AGENT_HOOKS);
|
|
726
|
+
const hooksRaw = ast.header.hooksRaw;
|
|
727
|
+
if (useCustomAgentHooks && hooksRaw) {
|
|
728
|
+
const hookWorkspaceFolder = this.workspaceService.getWorkspaceFolder(uri) ?? defaultFolder;
|
|
729
|
+
const workspaceRootUri = hookWorkspaceFolder?.uri;
|
|
730
|
+
hooks = parseSubagentHooksFromYaml(hooksRaw, workspaceRootUri, userHome, target);
|
|
731
|
+
}
|
|
732
|
+
const agent = {
|
|
639
733
|
uri,
|
|
640
734
|
name,
|
|
735
|
+
description,
|
|
736
|
+
model,
|
|
737
|
+
tools,
|
|
738
|
+
handOffs,
|
|
739
|
+
argumentHint,
|
|
740
|
+
target,
|
|
741
|
+
visibility,
|
|
742
|
+
agents,
|
|
743
|
+
hooks,
|
|
641
744
|
agentInstructions,
|
|
642
745
|
source,
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
}
|
|
746
|
+
sessionTypes: promptPath.sessionTypes,
|
|
747
|
+
...(when !== undefined ? {
|
|
748
|
+
when
|
|
749
|
+
} : undefined)
|
|
648
750
|
};
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
model = mapClaudeModels(model);
|
|
657
|
-
}
|
|
658
|
-
let {
|
|
659
|
-
description,
|
|
660
|
-
tools,
|
|
661
|
-
handOffs,
|
|
662
|
-
argumentHint,
|
|
663
|
-
agents
|
|
664
|
-
} = ast.header;
|
|
665
|
-
if (target === Target.Claude && tools) {
|
|
666
|
-
tools = mapClaudeTools(tools);
|
|
667
|
-
}
|
|
668
|
-
let hooks;
|
|
669
|
-
const useCustomAgentHooks = this.configurationService.getValue(PromptsConfig.USE_CUSTOM_AGENT_HOOKS);
|
|
670
|
-
const hooksRaw = ast.header.hooksRaw;
|
|
671
|
-
if (useCustomAgentHooks && hooksRaw) {
|
|
672
|
-
const hookWorkspaceFolder = this.workspaceService.getWorkspaceFolder(uri) ?? defaultFolder;
|
|
673
|
-
const workspaceRootUri = hookWorkspaceFolder?.uri;
|
|
674
|
-
hooks = parseSubagentHooksFromYaml(hooksRaw, workspaceRootUri, userHome, target);
|
|
675
|
-
}
|
|
676
|
-
return {
|
|
677
|
-
uri,
|
|
678
|
-
name,
|
|
679
|
-
description,
|
|
680
|
-
model,
|
|
681
|
-
tools,
|
|
682
|
-
handOffs,
|
|
683
|
-
argumentHint,
|
|
684
|
-
target,
|
|
685
|
-
visibility,
|
|
686
|
-
agents,
|
|
687
|
-
hooks,
|
|
688
|
-
agentInstructions,
|
|
689
|
-
source
|
|
690
|
-
};
|
|
691
|
-
})));
|
|
692
|
-
const customAgents = [];
|
|
693
|
-
for (let i = 0; i < customAgentsResults.length; i++) {
|
|
694
|
-
const result = customAgentsResults[i];
|
|
695
|
-
if (result.status === "fulfilled") {
|
|
696
|
-
customAgents.push(result.value);
|
|
697
|
-
} else {
|
|
698
|
-
const uri = agentFiles[i].uri;
|
|
699
|
-
const error = result.reason;
|
|
751
|
+
return {
|
|
752
|
+
status: "loaded",
|
|
753
|
+
promptPath: this.withPromptPathMetadata(promptPath, name, description),
|
|
754
|
+
agent
|
|
755
|
+
};
|
|
756
|
+
} catch (e) {
|
|
757
|
+
const error = e instanceof Error ? e : ( new Error(String(e)));
|
|
700
758
|
if (error instanceof FileOperationError && error.fileOperationResult === FileOperationResult.FILE_NOT_FOUND) {
|
|
701
759
|
this.logger.warn(
|
|
702
|
-
`[
|
|
760
|
+
`[computeAgentDiscoveryInfo] Skipping agent file that does not exist: ${uri}`,
|
|
703
761
|
error.message
|
|
704
762
|
);
|
|
705
763
|
} else {
|
|
706
|
-
this.logger.error(`[
|
|
764
|
+
this.logger.error(`[computeAgentDiscoveryInfo] Failed to parse agent file: ${uri}`, error);
|
|
707
765
|
}
|
|
766
|
+
return {
|
|
767
|
+
status: "skipped",
|
|
768
|
+
skipReason: "parse-error",
|
|
769
|
+
errorMessage: error.message,
|
|
770
|
+
promptPath
|
|
771
|
+
};
|
|
708
772
|
}
|
|
709
|
-
}
|
|
710
|
-
|
|
773
|
+
})));
|
|
774
|
+
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.agent);
|
|
775
|
+
return {
|
|
776
|
+
type: PromptsType.agent,
|
|
777
|
+
files,
|
|
778
|
+
sourceFolders,
|
|
779
|
+
durationInMillis: stopWatch.elapsed()
|
|
780
|
+
};
|
|
711
781
|
}
|
|
712
782
|
async parseNew(uri, token) {
|
|
713
783
|
const model = this.modelService.getModel(uri);
|
|
@@ -720,7 +790,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
720
790
|
}
|
|
721
791
|
return ( new PromptFileParser()).parse(uri, ( fileContent.value.toString()));
|
|
722
792
|
}
|
|
723
|
-
registerContributedFile(type, uri, extension, name, description, when) {
|
|
793
|
+
registerContributedFile(type, uri, extension, name, description, when, sessionTypes) {
|
|
724
794
|
const bucket = this.contributedFiles[type];
|
|
725
795
|
if (( bucket.has(uri))) {
|
|
726
796
|
return Disposable.None;
|
|
@@ -740,20 +810,12 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
740
810
|
throw e;
|
|
741
811
|
}
|
|
742
812
|
}
|
|
743
|
-
try {
|
|
744
|
-
await this.filesConfigService.updateReadonly(uri, true);
|
|
745
|
-
} catch (e) {
|
|
746
|
-
const msg = e instanceof Error ? e.message : String(e);
|
|
747
|
-
this.logger.error(
|
|
748
|
-
`[registerContributedFile] Failed to make prompt file readonly: ${uri}`,
|
|
749
|
-
msg
|
|
750
|
-
);
|
|
751
|
-
}
|
|
752
813
|
return {
|
|
753
814
|
uri,
|
|
754
815
|
name,
|
|
755
816
|
description,
|
|
756
817
|
when,
|
|
818
|
+
sessionTypes,
|
|
757
819
|
storage: PromptsStorage.extension,
|
|
758
820
|
type,
|
|
759
821
|
extension,
|
|
@@ -761,6 +823,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
761
823
|
};
|
|
762
824
|
})();
|
|
763
825
|
bucket.set(uri, entryPromise);
|
|
826
|
+
this._enqueueReadonlyUpdate(uri);
|
|
764
827
|
if (when) {
|
|
765
828
|
this._contributedWhenClauses.set(`${type}/${( uri.toString())}`, when);
|
|
766
829
|
}
|
|
@@ -789,6 +852,18 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
789
852
|
}
|
|
790
853
|
};
|
|
791
854
|
}
|
|
855
|
+
_enqueueReadonlyUpdate(uri) {
|
|
856
|
+
this._pendingReadonlyUris.push(uri);
|
|
857
|
+
if (!this._pendingReadonlyFlush) {
|
|
858
|
+
this._pendingReadonlyFlush = true;
|
|
859
|
+
queueMicrotask(() => {
|
|
860
|
+
const uris = this._pendingReadonlyUris;
|
|
861
|
+
this._pendingReadonlyUris = [];
|
|
862
|
+
this._pendingReadonlyFlush = false;
|
|
863
|
+
void this.filesConfigService.updateReadonly(uris, true);
|
|
864
|
+
});
|
|
865
|
+
}
|
|
866
|
+
}
|
|
792
867
|
_updateContributedWhenKeys() {
|
|
793
868
|
this._contributedWhenKeys.clear();
|
|
794
869
|
for (const whenClause of ( this._contributedWhenClauses.values())) {
|
|
@@ -797,6 +872,14 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
797
872
|
this._contributedWhenKeys.add(key);
|
|
798
873
|
}
|
|
799
874
|
}
|
|
875
|
+
for (const whenClauses of ( this._providerWhenClauses.values())) {
|
|
876
|
+
for (const whenClause of whenClauses) {
|
|
877
|
+
const expr = ContextKeyExpr.deserialize(whenClause);
|
|
878
|
+
for (const key of expr?.keys() ?? []) {
|
|
879
|
+
this._contributedWhenKeys.add(key);
|
|
880
|
+
}
|
|
881
|
+
}
|
|
882
|
+
}
|
|
800
883
|
}
|
|
801
884
|
getPromptLocationLabel(promptPath) {
|
|
802
885
|
switch (promptPath.storage) {
|
|
@@ -805,17 +888,17 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
805
888
|
relative: true
|
|
806
889
|
});
|
|
807
890
|
case PromptsStorage.user:
|
|
808
|
-
return localize(
|
|
891
|
+
return localize(7746, "User Data");
|
|
809
892
|
case PromptsStorage.extension:
|
|
810
893
|
{
|
|
811
894
|
return localize(
|
|
812
|
-
|
|
895
|
+
7747,
|
|
813
896
|
"Extension: {0}",
|
|
814
897
|
promptPath.extension.displayName ?? promptPath.extension.id
|
|
815
898
|
);
|
|
816
899
|
}
|
|
817
900
|
case PromptsStorage.plugin:
|
|
818
|
-
return localize(
|
|
901
|
+
return localize(7748, "Plugin");
|
|
819
902
|
default:
|
|
820
903
|
assertNever(promptPath, "Unknown prompt storage type");
|
|
821
904
|
}
|
|
@@ -843,7 +926,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
843
926
|
} else {
|
|
844
927
|
rootFiles.push({
|
|
845
928
|
fileName: AGENT_MD_FILENAME,
|
|
846
|
-
type:
|
|
929
|
+
type: AgentInstructionFileType.agentsMd
|
|
847
930
|
});
|
|
848
931
|
}
|
|
849
932
|
const useClaudeMD = this.configurationService.getValue(PromptsConfig.USE_CLAUDE_MD);
|
|
@@ -852,12 +935,12 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
852
935
|
} else {
|
|
853
936
|
const claudeMdFile = {
|
|
854
937
|
fileName: CLAUDE_MD_FILENAME,
|
|
855
|
-
type:
|
|
938
|
+
type: AgentInstructionFileType.claudeMd
|
|
856
939
|
};
|
|
857
940
|
rootFiles.push(claudeMdFile);
|
|
858
941
|
rootFiles.push({
|
|
859
942
|
fileName: CLAUDE_LOCAL_MD_FILENAME,
|
|
860
|
-
type:
|
|
943
|
+
type: AgentInstructionFileType.claudeMd
|
|
861
944
|
});
|
|
862
945
|
promises.push(this.fileLocator.findFilesInRoots(
|
|
863
946
|
rootFolders,
|
|
@@ -880,7 +963,7 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
880
963
|
} else {
|
|
881
964
|
const githubConfigFiles = [{
|
|
882
965
|
fileName: COPILOT_CUSTOM_INSTRUCTIONS_FILENAME,
|
|
883
|
-
type:
|
|
966
|
+
type: AgentInstructionFileType.copilotInstructionsMd
|
|
884
967
|
}];
|
|
885
968
|
promises.push(this.fileLocator.findFilesInRoots(
|
|
886
969
|
rootFolders,
|
|
@@ -1025,35 +1108,24 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1025
1108
|
get onDidChangeSkills() {
|
|
1026
1109
|
return this.cachedSkills.onDidChangePromise;
|
|
1027
1110
|
}
|
|
1028
|
-
|
|
1111
|
+
get onDidChangeHooks() {
|
|
1112
|
+
return this.cachedHooks.onDidChangePromise;
|
|
1113
|
+
}
|
|
1114
|
+
async findAgentSkills(token) {
|
|
1029
1115
|
const useAgentSkills = this.configurationService.getValue(PromptsConfig.USE_AGENT_SKILLS);
|
|
1030
1116
|
if (!useAgentSkills) {
|
|
1031
1117
|
return undefined;
|
|
1032
1118
|
}
|
|
1033
|
-
const
|
|
1034
|
-
const result =
|
|
1035
|
-
if (sessionResource) {
|
|
1036
|
-
const elapsed = sw.elapsed();
|
|
1037
|
-
void this.getSkillDiscoveryInfo(token).catch(() => undefined).then(discoveryInfo => {
|
|
1038
|
-
const details = result.length === 1 ? ( localize(7630, "Resolved {0} skill in {1}ms", result.length, elapsed.toFixed(1))) : ( localize(7631, "Resolved {0} skills in {1}ms", result.length, elapsed.toFixed(1)));
|
|
1039
|
-
this._onDidLogDiscovery.fire({
|
|
1040
|
-
sessionResource,
|
|
1041
|
-
name: ( localize(7632, "Load Skills")),
|
|
1042
|
-
details,
|
|
1043
|
-
discoveryInfo,
|
|
1044
|
-
category: "discovery"
|
|
1045
|
-
});
|
|
1046
|
-
});
|
|
1047
|
-
}
|
|
1119
|
+
const discoveryInfo = await this.cachedSkills.get(token);
|
|
1120
|
+
const result = this.skillsFromDiscoveryInfo(discoveryInfo);
|
|
1048
1121
|
return result;
|
|
1049
1122
|
}
|
|
1050
|
-
|
|
1051
|
-
const files = await this.computeSkillDiscoveryInfo(token);
|
|
1123
|
+
skillsFromDiscoveryInfo(discoveryInfo) {
|
|
1052
1124
|
const result = [];
|
|
1053
|
-
const
|
|
1054
|
-
for (const file of files) {
|
|
1125
|
+
for (const file of discoveryInfo.files) {
|
|
1055
1126
|
if (file.status === "loaded" && file.promptPath.name) {
|
|
1056
1127
|
const sanitizedDescription = this.truncateAgentSkillDescription(file.promptPath.description, file.promptPath.uri);
|
|
1128
|
+
const when = isExtensionPromptPath(file.promptPath) && file.promptPath.when ? ContextKeyExpr.deserialize(file.promptPath.when) ?? undefined : undefined;
|
|
1057
1129
|
result.push({
|
|
1058
1130
|
uri: file.promptPath.uri,
|
|
1059
1131
|
storage: file.promptPath.storage,
|
|
@@ -1061,10 +1133,22 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1061
1133
|
description: sanitizedDescription,
|
|
1062
1134
|
disableModelInvocation: file.disableModelInvocation ?? false,
|
|
1063
1135
|
userInvocable: file.userInvocable ?? true,
|
|
1064
|
-
when
|
|
1136
|
+
when,
|
|
1065
1137
|
pluginUri: file.promptPath.pluginUri,
|
|
1066
|
-
extension: file.promptPath.extension
|
|
1138
|
+
extension: file.promptPath.extension,
|
|
1139
|
+
sessionTypes: file.promptPath.sessionTypes
|
|
1067
1140
|
});
|
|
1141
|
+
}
|
|
1142
|
+
}
|
|
1143
|
+
return result;
|
|
1144
|
+
}
|
|
1145
|
+
async computeSkillDiscovery(token) {
|
|
1146
|
+
const stopWatch = StopWatch.create(true);
|
|
1147
|
+
const files = await this.computeSkillDiscoveryInfo(token);
|
|
1148
|
+
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.skill);
|
|
1149
|
+
const skillsBySource = ( new Map());
|
|
1150
|
+
for (const file of files) {
|
|
1151
|
+
if (file.status === "loaded" && file.promptPath.name) {
|
|
1068
1152
|
const source = file.promptPath.source;
|
|
1069
1153
|
if (source) {
|
|
1070
1154
|
skillsBySource.set(source, (skillsBySource.get(source) || 0) + 1);
|
|
@@ -1097,8 +1181,9 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1097
1181
|
}
|
|
1098
1182
|
}
|
|
1099
1183
|
}
|
|
1184
|
+
const totalSkillsFound = files.filter(f => f.status === "loaded" && f.promptPath.name).length;
|
|
1100
1185
|
this.telemetryService.publicLog2("agentSkillsFound", {
|
|
1101
|
-
totalSkillsFound
|
|
1186
|
+
totalSkillsFound,
|
|
1102
1187
|
claudePersonal: skillsBySource.get(PromptFileSource.ClaudePersonal) ?? 0,
|
|
1103
1188
|
claudeWorkspace: skillsBySource.get(PromptFileSource.ClaudeWorkspace) ?? 0,
|
|
1104
1189
|
copilotPersonal: skillsBySource.get(PromptFileSource.CopilotPersonal) ?? 0,
|
|
@@ -1116,51 +1201,55 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1116
1201
|
skippedNameMismatch,
|
|
1117
1202
|
skippedParseFailed
|
|
1118
1203
|
});
|
|
1204
|
+
return {
|
|
1205
|
+
type: PromptsType.skill,
|
|
1206
|
+
files,
|
|
1207
|
+
sourceFolders,
|
|
1208
|
+
durationInMillis: stopWatch.elapsed()
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
async getHooks(token) {
|
|
1212
|
+
const discoveryInfo = await this.cachedHooks.get(token);
|
|
1213
|
+
const result = discoveryInfo.hooksInfo;
|
|
1119
1214
|
return result;
|
|
1120
1215
|
}
|
|
1121
|
-
async
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
discoveryInfo,
|
|
1134
|
-
category: "discovery"
|
|
1135
|
-
});
|
|
1136
|
-
});
|
|
1216
|
+
async getDiscoveryInfo(type, token) {
|
|
1217
|
+
switch (type) {
|
|
1218
|
+
case PromptsType.instructions:
|
|
1219
|
+
return this.cachedInstructions.get(token);
|
|
1220
|
+
case PromptsType.prompt:
|
|
1221
|
+
return this.cachedSlashCommands.get(token);
|
|
1222
|
+
case PromptsType.agent:
|
|
1223
|
+
return this.cachedCustomAgents.get(token);
|
|
1224
|
+
case PromptsType.skill:
|
|
1225
|
+
return this.cachedSkills.get(token);
|
|
1226
|
+
case PromptsType.hook:
|
|
1227
|
+
return this.cachedHooks.get(token);
|
|
1137
1228
|
}
|
|
1138
|
-
return result;
|
|
1139
1229
|
}
|
|
1140
|
-
async getInstructionFiles(token
|
|
1141
|
-
const sw = StopWatch.create();
|
|
1230
|
+
async getInstructionFiles(token) {
|
|
1142
1231
|
const discoveryInfo = await this.cachedInstructions.get(token);
|
|
1143
|
-
const result = (
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1152
|
-
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
}
|
|
1232
|
+
const result = this.instructionsFromDiscoveryInfo(discoveryInfo);
|
|
1233
|
+
return result;
|
|
1234
|
+
}
|
|
1235
|
+
instructionsFromDiscoveryInfo(discoveryInfo) {
|
|
1236
|
+
const result = [];
|
|
1237
|
+
for (const file of discoveryInfo.files) {
|
|
1238
|
+
if (file.status === "loaded" && file.promptPath.name) {
|
|
1239
|
+
const when = isExtensionPromptPath(file.promptPath) && file.promptPath.when ? ContextKeyExpr.deserialize(file.promptPath.when) ?? undefined : undefined;
|
|
1240
|
+
result.push({
|
|
1241
|
+
uri: file.promptPath.uri,
|
|
1242
|
+
storage: file.promptPath.storage,
|
|
1243
|
+
extension: file.promptPath.extension,
|
|
1244
|
+
pluginUri: file.promptPath.pluginUri,
|
|
1245
|
+
source: file.promptPath.source,
|
|
1246
|
+
name: file.promptPath.name,
|
|
1247
|
+
description: file.promptPath.description,
|
|
1248
|
+
pattern: file.pattern,
|
|
1249
|
+
when,
|
|
1250
|
+
sessionTypes: file.promptPath.sessionTypes
|
|
1251
|
+
});
|
|
1252
|
+
}
|
|
1164
1253
|
}
|
|
1165
1254
|
return result;
|
|
1166
1255
|
}
|
|
@@ -1175,63 +1264,100 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1175
1264
|
return await this.getInstructionsDiscoveryInfo(token);
|
|
1176
1265
|
}
|
|
1177
1266
|
async computeHooks(token) {
|
|
1267
|
+
const stopWatch = StopWatch.create(true);
|
|
1178
1268
|
const useChatHooks = this.configurationService.getValue(PromptsConfig.USE_CHAT_HOOKS);
|
|
1179
|
-
if (!useChatHooks) {
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1269
|
+
if (!useChatHooks || !this.workspaceTrustService.isWorkspaceTrusted()) {
|
|
1270
|
+
const hookFiles = await this.listPromptFiles(PromptsType.hook, token);
|
|
1271
|
+
const skipReason = !useChatHooks ? "disabled" : "workspace-untrusted";
|
|
1272
|
+
const files = ( hookFiles.map(promptPath => ({
|
|
1273
|
+
status: "skipped",
|
|
1274
|
+
skipReason,
|
|
1275
|
+
promptPath: this.withPromptPathMetadata(promptPath, basename(promptPath.uri), promptPath.description)
|
|
1276
|
+
})));
|
|
1277
|
+
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.hook);
|
|
1278
|
+
return {
|
|
1279
|
+
type: PromptsType.hook,
|
|
1280
|
+
files,
|
|
1281
|
+
sourceFolders,
|
|
1282
|
+
hooksInfo: undefined,
|
|
1283
|
+
durationInMillis: stopWatch.elapsed()
|
|
1284
|
+
};
|
|
1184
1285
|
}
|
|
1185
1286
|
const useClaudeHooks = this.configurationService.getValue(PromptsConfig.USE_CLAUDE_HOOKS);
|
|
1186
1287
|
const hookFiles = await this.listPromptFiles(PromptsType.hook, token);
|
|
1187
1288
|
this.logger.trace(`[PromptsService] Found ${hookFiles.length} hook file(s).`);
|
|
1188
1289
|
const userHomeUri = await this.pathService.userHome();
|
|
1189
1290
|
const userHome = userHomeUri.scheme === Schemas.file ? userHomeUri.fsPath : userHomeUri.path;
|
|
1190
|
-
let hasDisabledClaudeHooks = false;
|
|
1191
|
-
const collectedHooks = ( new Map());
|
|
1192
1291
|
const defaultFolder = this.workspaceService.getWorkspace().folders[0];
|
|
1193
|
-
|
|
1292
|
+
const fileResults = await Promise.all(( hookFiles.map(async hookFile => {
|
|
1293
|
+
const name = basename(hookFile.uri);
|
|
1194
1294
|
if (hookFile.storage === PromptsStorage.plugin) {
|
|
1195
|
-
|
|
1295
|
+
return {
|
|
1296
|
+
file: {
|
|
1297
|
+
status: "loaded",
|
|
1298
|
+
promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description)
|
|
1299
|
+
}
|
|
1300
|
+
};
|
|
1196
1301
|
}
|
|
1197
1302
|
try {
|
|
1198
1303
|
const content = await this.fileService.readFile(hookFile.uri);
|
|
1199
1304
|
const json = parse(( content.value.toString()));
|
|
1305
|
+
if (!json || typeof json !== "object") {
|
|
1306
|
+
return {
|
|
1307
|
+
file: {
|
|
1308
|
+
status: "skipped",
|
|
1309
|
+
skipReason: "parse-error",
|
|
1310
|
+
errorMessage: "Invalid hooks file: must be a JSON object",
|
|
1311
|
+
promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description)
|
|
1312
|
+
}
|
|
1313
|
+
};
|
|
1314
|
+
}
|
|
1200
1315
|
const hookWorkspaceFolder = this.workspaceService.getWorkspaceFolder(hookFile.uri) ?? defaultFolder;
|
|
1201
1316
|
const workspaceRootUri = hookWorkspaceFolder?.uri;
|
|
1202
1317
|
const {
|
|
1203
1318
|
format,
|
|
1204
|
-
hooks,
|
|
1319
|
+
hooks: parsedHooks,
|
|
1205
1320
|
disabledAllHooks
|
|
1206
1321
|
} = parseHooksFromFile(hookFile.uri, json, workspaceRootUri, userHome);
|
|
1207
1322
|
if (disabledAllHooks) {
|
|
1208
1323
|
this.logger.trace(
|
|
1209
1324
|
`[PromptsService] Skipping hook file with disableAllHooks: ${hookFile.uri}`
|
|
1210
1325
|
);
|
|
1211
|
-
|
|
1326
|
+
return {
|
|
1327
|
+
file: {
|
|
1328
|
+
status: "skipped",
|
|
1329
|
+
skipReason: "all-hooks-disabled",
|
|
1330
|
+
promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description)
|
|
1331
|
+
}
|
|
1332
|
+
};
|
|
1212
1333
|
}
|
|
1213
1334
|
if (format === HookSourceFormat.Claude && useClaudeHooks === false) {
|
|
1214
|
-
const hasAnyCommands = ( [...(
|
|
1335
|
+
const hasAnyCommands = ( [...( parsedHooks.values())].some((
|
|
1215
1336
|
{
|
|
1216
1337
|
hooks: cmds
|
|
1217
1338
|
}
|
|
1218
1339
|
) => cmds.length > 0));
|
|
1219
|
-
if (hasAnyCommands) {
|
|
1220
|
-
hasDisabledClaudeHooks = true;
|
|
1221
|
-
}
|
|
1222
1340
|
this.logger.trace(
|
|
1223
1341
|
`[PromptsService] Skipping Claude hook file (disabled via setting): ${hookFile.uri}`
|
|
1224
1342
|
);
|
|
1225
|
-
|
|
1343
|
+
return {
|
|
1344
|
+
file: {
|
|
1345
|
+
status: "skipped",
|
|
1346
|
+
skipReason: "claude-hooks-disabled",
|
|
1347
|
+
promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description)
|
|
1348
|
+
},
|
|
1349
|
+
hasDisabledClaudeHooks: hasAnyCommands
|
|
1350
|
+
};
|
|
1226
1351
|
}
|
|
1352
|
+
const hooks = ( new Map());
|
|
1227
1353
|
for (const [hookType, {
|
|
1228
1354
|
hooks: commands
|
|
1229
|
-
}] of
|
|
1355
|
+
}] of parsedHooks) {
|
|
1230
1356
|
for (const command of commands) {
|
|
1231
|
-
let bucket =
|
|
1357
|
+
let bucket = hooks.get(hookType);
|
|
1232
1358
|
if (!bucket) {
|
|
1233
1359
|
bucket = [];
|
|
1234
|
-
|
|
1360
|
+
hooks.set(hookType, bucket);
|
|
1235
1361
|
}
|
|
1236
1362
|
bucket.push(command);
|
|
1237
1363
|
this.logger.trace(
|
|
@@ -1239,8 +1365,56 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1239
1365
|
);
|
|
1240
1366
|
}
|
|
1241
1367
|
}
|
|
1368
|
+
return {
|
|
1369
|
+
file: {
|
|
1370
|
+
status: "loaded",
|
|
1371
|
+
promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description)
|
|
1372
|
+
},
|
|
1373
|
+
hooks,
|
|
1374
|
+
sourceUri: hookFile.uri
|
|
1375
|
+
};
|
|
1242
1376
|
} catch (error) {
|
|
1377
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
1243
1378
|
this.logger.warn(`[PromptsService] Failed to parse hook file: ${hookFile.uri}`, error);
|
|
1379
|
+
return {
|
|
1380
|
+
file: {
|
|
1381
|
+
status: "skipped",
|
|
1382
|
+
skipReason: "parse-error",
|
|
1383
|
+
errorMessage: msg,
|
|
1384
|
+
promptPath: this.withPromptPathMetadata(hookFile, name, hookFile.description)
|
|
1385
|
+
}
|
|
1386
|
+
};
|
|
1387
|
+
}
|
|
1388
|
+
})));
|
|
1389
|
+
const files = [];
|
|
1390
|
+
let hasDisabledClaudeHooks = false;
|
|
1391
|
+
const collectedHooks = ( new Map());
|
|
1392
|
+
for (const {
|
|
1393
|
+
file,
|
|
1394
|
+
hooks,
|
|
1395
|
+
sourceUri,
|
|
1396
|
+
hasDisabledClaudeHooks: disabled
|
|
1397
|
+
} of fileResults) {
|
|
1398
|
+
if (file) {
|
|
1399
|
+
files.push(file);
|
|
1400
|
+
}
|
|
1401
|
+
if (disabled) {
|
|
1402
|
+
hasDisabledClaudeHooks = true;
|
|
1403
|
+
}
|
|
1404
|
+
if (hooks && sourceUri) {
|
|
1405
|
+
for (const [hookType, commands] of hooks) {
|
|
1406
|
+
let bucket = collectedHooks.get(hookType);
|
|
1407
|
+
if (!bucket) {
|
|
1408
|
+
bucket = [];
|
|
1409
|
+
collectedHooks.set(hookType, bucket);
|
|
1410
|
+
}
|
|
1411
|
+
for (const command of commands) {
|
|
1412
|
+
bucket.push({
|
|
1413
|
+
...command,
|
|
1414
|
+
sourceUri
|
|
1415
|
+
});
|
|
1416
|
+
}
|
|
1417
|
+
}
|
|
1244
1418
|
}
|
|
1245
1419
|
}
|
|
1246
1420
|
const plugins = this.agentPluginService.plugins.get();
|
|
@@ -1254,42 +1428,36 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1254
1428
|
bucket = [];
|
|
1255
1429
|
collectedHooks.set(hook.type, bucket);
|
|
1256
1430
|
}
|
|
1257
|
-
|
|
1431
|
+
for (const command of hook.hooks) {
|
|
1432
|
+
bucket.push({
|
|
1433
|
+
...command,
|
|
1434
|
+
sourceUri: hook.uri
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1258
1437
|
}
|
|
1259
1438
|
}
|
|
1439
|
+
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.hook);
|
|
1260
1440
|
if (collectedHooks.size === 0) {
|
|
1261
1441
|
this.logger.trace("[PromptsService] No valid hooks collected.");
|
|
1262
|
-
return undefined;
|
|
1263
|
-
}
|
|
1264
|
-
const result = Object.fromEntries(collectedHooks);
|
|
1265
|
-
this.logger.trace(`[PromptsService] Collected hooks: ${JSON.stringify(( Object.keys(result)))}`);
|
|
1266
|
-
return {
|
|
1267
|
-
hooks: result,
|
|
1268
|
-
hasDisabledClaudeHooks
|
|
1269
|
-
};
|
|
1270
|
-
}
|
|
1271
|
-
async getSkillDiscoveryInfo(token) {
|
|
1272
|
-
const useAgentSkills = this.configurationService.getValue(PromptsConfig.USE_AGENT_SKILLS);
|
|
1273
|
-
if (!useAgentSkills) {
|
|
1274
|
-
const allFiles = await this.listPromptFiles(PromptsType.skill, token);
|
|
1275
|
-
const files = ( allFiles.map(promptPath => ({
|
|
1276
|
-
status: "skipped",
|
|
1277
|
-
skipReason: "disabled",
|
|
1278
|
-
promptPath
|
|
1279
|
-
})));
|
|
1280
|
-
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.skill);
|
|
1281
1442
|
return {
|
|
1282
|
-
type: PromptsType.
|
|
1443
|
+
type: PromptsType.hook,
|
|
1283
1444
|
files,
|
|
1284
|
-
sourceFolders
|
|
1445
|
+
sourceFolders,
|
|
1446
|
+
hooksInfo: undefined,
|
|
1447
|
+
durationInMillis: stopWatch.elapsed()
|
|
1285
1448
|
};
|
|
1286
1449
|
}
|
|
1287
|
-
const
|
|
1288
|
-
|
|
1450
|
+
const result = Object.fromEntries(collectedHooks);
|
|
1451
|
+
this.logger.trace(`[PromptsService] Collected hooks: ${JSON.stringify(( Object.keys(result)))}`);
|
|
1289
1452
|
return {
|
|
1290
|
-
type: PromptsType.
|
|
1453
|
+
type: PromptsType.hook,
|
|
1291
1454
|
files,
|
|
1292
|
-
sourceFolders
|
|
1455
|
+
sourceFolders,
|
|
1456
|
+
hooksInfo: {
|
|
1457
|
+
hooks: result,
|
|
1458
|
+
hasDisabledClaudeHooks
|
|
1459
|
+
},
|
|
1460
|
+
durationInMillis: stopWatch.elapsed()
|
|
1293
1461
|
};
|
|
1294
1462
|
}
|
|
1295
1463
|
async computeSkillDiscoveryInfo(token) {
|
|
@@ -1379,78 +1547,8 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1379
1547
|
}
|
|
1380
1548
|
return files;
|
|
1381
1549
|
}
|
|
1382
|
-
async getAgentDiscoveryInfo(token) {
|
|
1383
|
-
const files = [];
|
|
1384
|
-
const disabledAgents = this.getDisabledPromptFiles(PromptsType.agent);
|
|
1385
|
-
const agentFiles = await this.listPromptFiles(PromptsType.agent, token);
|
|
1386
|
-
for (const promptPath of agentFiles) {
|
|
1387
|
-
const {
|
|
1388
|
-
uri
|
|
1389
|
-
} = promptPath;
|
|
1390
|
-
if (( disabledAgents.has(uri))) {
|
|
1391
|
-
files.push({
|
|
1392
|
-
status: "skipped",
|
|
1393
|
-
skipReason: "disabled",
|
|
1394
|
-
promptPath
|
|
1395
|
-
});
|
|
1396
|
-
continue;
|
|
1397
|
-
}
|
|
1398
|
-
try {
|
|
1399
|
-
const ast = await this.parseNew(uri, token);
|
|
1400
|
-
const name = ast.header?.name ?? promptPath.name ?? getCleanPromptName(uri);
|
|
1401
|
-
const description = ast.header?.description ?? promptPath.description;
|
|
1402
|
-
files.push({
|
|
1403
|
-
status: "loaded",
|
|
1404
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, description)
|
|
1405
|
-
});
|
|
1406
|
-
} catch (e) {
|
|
1407
|
-
files.push({
|
|
1408
|
-
status: "skipped",
|
|
1409
|
-
skipReason: "parse-error",
|
|
1410
|
-
errorMessage: e instanceof Error ? e.message : String(e),
|
|
1411
|
-
promptPath
|
|
1412
|
-
});
|
|
1413
|
-
}
|
|
1414
|
-
}
|
|
1415
|
-
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.agent);
|
|
1416
|
-
return {
|
|
1417
|
-
type: PromptsType.agent,
|
|
1418
|
-
files,
|
|
1419
|
-
sourceFolders
|
|
1420
|
-
};
|
|
1421
|
-
}
|
|
1422
|
-
async getPromptSlashCommandDiscoveryInfo(token) {
|
|
1423
|
-
const files = [];
|
|
1424
|
-
const promptFiles = await this.listPromptFiles(PromptsType.prompt, token);
|
|
1425
|
-
for (const promptPath of promptFiles) {
|
|
1426
|
-
const {
|
|
1427
|
-
uri
|
|
1428
|
-
} = promptPath;
|
|
1429
|
-
try {
|
|
1430
|
-
const parsedPromptFile = await this.parseNew(uri, token);
|
|
1431
|
-
const name = parsedPromptFile?.header?.name ?? promptPath.name ?? getCleanPromptName(uri);
|
|
1432
|
-
const description = parsedPromptFile?.header?.description ?? promptPath.description;
|
|
1433
|
-
files.push({
|
|
1434
|
-
status: "loaded",
|
|
1435
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, description)
|
|
1436
|
-
});
|
|
1437
|
-
} catch (e) {
|
|
1438
|
-
files.push({
|
|
1439
|
-
status: "skipped",
|
|
1440
|
-
skipReason: "parse-error",
|
|
1441
|
-
errorMessage: e instanceof Error ? e.message : String(e),
|
|
1442
|
-
promptPath
|
|
1443
|
-
});
|
|
1444
|
-
}
|
|
1445
|
-
}
|
|
1446
|
-
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.prompt);
|
|
1447
|
-
return {
|
|
1448
|
-
type: PromptsType.prompt,
|
|
1449
|
-
files,
|
|
1450
|
-
sourceFolders
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
1550
|
async getInstructionsDiscoveryInfo(token) {
|
|
1551
|
+
const stopWatch = StopWatch.create(true);
|
|
1454
1552
|
const files = [];
|
|
1455
1553
|
const instructionsFiles = await this.listPromptFiles(PromptsType.instructions, token);
|
|
1456
1554
|
for (const promptPath of instructionsFiles) {
|
|
@@ -1459,8 +1557,10 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1459
1557
|
const parsedPromptFile = await this.parseNew(uri, token);
|
|
1460
1558
|
const name = parsedPromptFile?.header?.name ?? promptPath.name ?? getCleanPromptName(uri);
|
|
1461
1559
|
const description = parsedPromptFile?.header?.description ?? promptPath.description;
|
|
1560
|
+
const pattern = evaluateApplyToPattern(parsedPromptFile.header, isInClaudeRulesFolder(uri));
|
|
1462
1561
|
files.push({
|
|
1463
1562
|
status: "loaded",
|
|
1563
|
+
pattern,
|
|
1464
1564
|
promptPath: this.withPromptPathMetadata(promptPath, name, description)
|
|
1465
1565
|
});
|
|
1466
1566
|
} catch (e) {
|
|
@@ -1476,79 +1576,8 @@ let PromptsService = class PromptsService extends Disposable {
|
|
|
1476
1576
|
return {
|
|
1477
1577
|
type: PromptsType.instructions,
|
|
1478
1578
|
files,
|
|
1479
|
-
sourceFolders
|
|
1480
|
-
|
|
1481
|
-
}
|
|
1482
|
-
async getHookDiscoveryInfo(token) {
|
|
1483
|
-
const files = [];
|
|
1484
|
-
const userHomeUri = await this.pathService.userHome();
|
|
1485
|
-
const userHome = userHomeUri.scheme === Schemas.file ? userHomeUri.fsPath : userHomeUri.path;
|
|
1486
|
-
const useClaudeHooks = this.configurationService.getValue(PromptsConfig.USE_CLAUDE_HOOKS);
|
|
1487
|
-
const hookFiles = await this.listPromptFiles(PromptsType.hook, token);
|
|
1488
|
-
for (const promptPath of hookFiles) {
|
|
1489
|
-
const {
|
|
1490
|
-
uri
|
|
1491
|
-
} = promptPath;
|
|
1492
|
-
const name = basename(uri);
|
|
1493
|
-
if (!this.workspaceTrustService.isWorkspaceTrusted()) {
|
|
1494
|
-
files.push({
|
|
1495
|
-
status: "skipped",
|
|
1496
|
-
skipReason: "workspace-untrusted",
|
|
1497
|
-
promptPath: this.withPromptPathMetadata(promptPath, basename(promptPath.uri), promptPath.description)
|
|
1498
|
-
});
|
|
1499
|
-
continue;
|
|
1500
|
-
}
|
|
1501
|
-
if (getHookSourceFormat(uri) === HookSourceFormat.Claude && useClaudeHooks === false) {
|
|
1502
|
-
files.push({
|
|
1503
|
-
status: "skipped",
|
|
1504
|
-
skipReason: "claude-hooks-disabled",
|
|
1505
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, promptPath.description)
|
|
1506
|
-
});
|
|
1507
|
-
continue;
|
|
1508
|
-
}
|
|
1509
|
-
try {
|
|
1510
|
-
const content = await this.fileService.readFile(uri);
|
|
1511
|
-
const json = parse(( content.value.toString()));
|
|
1512
|
-
if (!json || typeof json !== "object") {
|
|
1513
|
-
files.push({
|
|
1514
|
-
status: "skipped",
|
|
1515
|
-
skipReason: "parse-error",
|
|
1516
|
-
errorMessage: "Invalid hooks file: must be a JSON object",
|
|
1517
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, promptPath.description)
|
|
1518
|
-
});
|
|
1519
|
-
continue;
|
|
1520
|
-
}
|
|
1521
|
-
const hookWorkspaceFolder = this.workspaceService.getWorkspaceFolder(uri) ?? this.workspaceService.getWorkspace().folders[0];
|
|
1522
|
-
const workspaceRootUri = hookWorkspaceFolder?.uri;
|
|
1523
|
-
const {
|
|
1524
|
-
disabledAllHooks
|
|
1525
|
-
} = parseHooksFromFile(uri, json, workspaceRootUri, userHome);
|
|
1526
|
-
if (disabledAllHooks) {
|
|
1527
|
-
files.push({
|
|
1528
|
-
status: "skipped",
|
|
1529
|
-
skipReason: "all-hooks-disabled",
|
|
1530
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, promptPath.description)
|
|
1531
|
-
});
|
|
1532
|
-
continue;
|
|
1533
|
-
}
|
|
1534
|
-
files.push({
|
|
1535
|
-
status: "loaded",
|
|
1536
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, promptPath.description)
|
|
1537
|
-
});
|
|
1538
|
-
} catch (e) {
|
|
1539
|
-
files.push({
|
|
1540
|
-
status: "skipped",
|
|
1541
|
-
skipReason: "parse-error",
|
|
1542
|
-
errorMessage: e instanceof Error ? e.message : String(e),
|
|
1543
|
-
promptPath: this.withPromptPathMetadata(promptPath, name, promptPath.description)
|
|
1544
|
-
});
|
|
1545
|
-
}
|
|
1546
|
-
}
|
|
1547
|
-
const sourceFolders = await this._collectSourceFolderDiagnostics(PromptsType.hook);
|
|
1548
|
-
return {
|
|
1549
|
-
type: PromptsType.hook,
|
|
1550
|
-
files,
|
|
1551
|
-
sourceFolders
|
|
1579
|
+
sourceFolders,
|
|
1580
|
+
durationInMillis: stopWatch.elapsed()
|
|
1552
1581
|
};
|
|
1553
1582
|
}
|
|
1554
1583
|
};
|