@codingame/monaco-vscode-chat-service-override 37.1.0 → 37.2.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.
Files changed (205) hide show
  1. package/index.js +15 -5
  2. package/package.json +5 -5
  3. package/vscode/src/vs/platform/agentHost/browser/agentHostEnablementService.js +1 -1
  4. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.d.ts +104 -0
  5. package/vscode/src/vs/workbench/api/browser/mainThreadChatAgents2.js +827 -0
  6. package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.d.ts +15 -0
  7. package/vscode/src/vs/workbench/api/browser/mainThreadChatCodeMapper.js +71 -0
  8. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.d.ts +16 -0
  9. package/vscode/src/vs/workbench/api/browser/mainThreadChatContext.js +95 -0
  10. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.d.ts +22 -0
  11. package/vscode/src/vs/workbench/api/browser/mainThreadChatDebug.js +286 -0
  12. package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.d.ts +10 -0
  13. package/vscode/src/vs/workbench/api/browser/mainThreadChatInputNotification.js +38 -0
  14. package/vscode/src/vs/workbench/api/browser/mainThreadChatQuota.d.ts +9 -0
  15. package/vscode/src/vs/workbench/api/browser/mainThreadChatQuota.js +22 -0
  16. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.d.ts +130 -0
  17. package/vscode/src/vs/workbench/api/browser/mainThreadChatSessions.js +907 -0
  18. package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.d.ts +10 -0
  19. package/vscode/src/vs/workbench/api/browser/mainThreadChatStatus.js +28 -0
  20. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.d.ts +27 -0
  21. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModelTools.js +167 -0
  22. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.d.ts +46 -0
  23. package/vscode/src/vs/workbench/api/browser/mainThreadLanguageModels.js +356 -0
  24. package/vscode/src/vs/workbench/contrib/agentsVoice/browser/agentsVoiceWidgetBinding.js +1 -1
  25. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +1 -1
  26. package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +2 -2
  27. package/vscode/src/vs/workbench/contrib/chat/browser/actions/exportAgentHostDebugLogsAction.js +1 -1
  28. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +1 -1
  29. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +2 -2
  30. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +1 -1
  31. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +2 -2
  32. package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +1 -1
  33. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationContentExpander.d.ts +1 -1
  34. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationItemProvider.d.ts +1 -1
  35. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentCustomizationSyncProvider.d.ts +1 -1
  36. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostActiveClientService.d.ts +1 -1
  37. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostExistingSessionHarnessPickerEnablement.js +1 -1
  38. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostLocalCustomizations.d.ts +1 -1
  39. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +1 -1
  40. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPromptCacheNotification.js +1 -1
  41. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionHandler.js +5 -3
  42. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSettings.contribution.js +1 -1
  43. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSignedOutModelsNotification.js +2 -2
  44. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentSessionSettings.contribution.js +2 -2
  45. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/openSessionLinkOpener.contribution.js +1 -1
  46. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.d.ts +1 -1
  47. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +1 -1
  48. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +1 -1
  49. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +1 -1
  50. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.d.ts +1 -1
  51. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsService.js +1 -1
  52. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.d.ts +1 -1
  53. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +1 -1
  54. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.d.ts +1 -1
  55. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
  56. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +1 -1
  57. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +1 -1
  58. package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +2 -2
  59. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +1 -1
  60. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +1 -1
  61. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +3 -3
  62. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +1 -1
  63. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationPresentation.d.ts +1 -1
  64. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +1 -1
  65. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +1 -1
  66. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigration.d.ts +1 -1
  67. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationMigrationCategories.js +1 -1
  68. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +1 -1
  69. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +1 -1
  70. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +1 -1
  71. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +1 -1
  72. package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +1 -1
  73. package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +1 -1
  74. package/vscode/src/vs/workbench/contrib/chat/browser/chat.shared.contribution.js +12 -12
  75. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.d.ts +1 -1
  76. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/agentHostChatDebugProvider.js +1 -1
  77. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.d.ts +1 -1
  78. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +1 -1
  79. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.d.ts +1 -1
  80. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.d.ts +1 -1
  81. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.d.ts +1 -1
  82. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +1 -1
  83. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.d.ts +1 -1
  84. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.d.ts +1 -1
  85. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +1 -1
  86. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.d.ts +1 -1
  87. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.d.ts +1 -1
  88. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.d.ts +1 -1
  89. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +1 -1
  90. package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.d.ts +1 -1
  91. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.d.ts +1 -1
  92. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingModifiedNotebookSnapshot.js +1 -1
  93. package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookCellEntry.d.ts +1 -1
  94. package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
  95. package/vscode/src/vs/workbench/contrib/chat/browser/chatPromoNotification.js +1 -1
  96. package/vscode/src/vs/workbench/contrib/chat/browser/chatQuotaNotification.js +2 -2
  97. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.d.ts +2 -0
  98. package/vscode/src/vs/workbench/contrib/chat/browser/chatSessions/chatSessionDescription.js +57 -0
  99. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +2 -2
  100. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.d.ts +1 -1
  101. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +1 -1
  102. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.d.ts +1 -1
  103. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +1 -1
  104. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +1 -1
  105. package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +1 -1
  106. package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +1 -1
  107. package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.d.ts +1 -1
  108. package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationConfig.js +1 -1
  109. package/vscode/src/vs/workbench/contrib/chat/browser/expNotification/chatExpNotificationContribution.js +1 -1
  110. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.d.ts +1 -1
  111. package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +2 -2
  112. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.d.ts +1 -1
  113. package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +1 -1
  114. package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +1 -1
  115. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +3 -3
  116. package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +1 -1
  117. package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +1 -1
  118. package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +1 -1
  119. package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +1 -1
  120. package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +1 -1
  121. package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +1 -1
  122. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +1 -1
  123. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCommandArgumentHint.js +1 -1
  124. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +2 -2
  125. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +1 -1
  126. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +10 -2
  127. package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputReferenceDecorations.js +1 -1
  128. package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.d.ts +1 -1
  129. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugEvents.d.ts +1 -1
  130. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.d.ts +253 -0
  131. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugService.js +20 -0
  132. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +1 -1
  133. package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +1 -1
  134. package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +2 -2
  135. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.d.ts +300 -0
  136. package/vscode/src/vs/workbench/contrib/chat/common/customizationHarnessService.js +272 -0
  137. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.d.ts +25 -0
  138. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginEnablement.js +178 -0
  139. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +78 -0
  140. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +51 -0
  141. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +2 -2
  142. package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +2 -2
  143. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.d.ts +67 -0
  144. package/vscode/src/vs/workbench/contrib/chat/common/plugins/fileBackedInstalledPluginsStore.js +195 -0
  145. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.d.ts +67 -0
  146. package/vscode/src/vs/workbench/contrib/chat/common/plugins/marketplaceReference.js +294 -0
  147. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +212 -0
  148. package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +955 -0
  149. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.d.ts +31 -0
  150. package/vscode/src/vs/workbench/contrib/chat/common/plugins/strictKnownMarketplaces.js +122 -0
  151. package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.d.ts +1 -1
  152. package/vscode/src/vs/workbench/contrib/chat/common/plugins/workspacePluginSettingsService.js +1 -1
  153. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.d.ts +65 -0
  154. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/computeAutomaticInstructions.js +698 -0
  155. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +50 -0
  156. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +78 -0
  157. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +77 -0
  158. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +120 -0
  159. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +10 -0
  160. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +23 -0
  161. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.d.ts +92 -0
  162. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/extensionPromptFileService.js +335 -0
  163. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +235 -0
  164. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +1673 -0
  165. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +202 -0
  166. package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +872 -0
  167. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.d.ts +36 -0
  168. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/confirmationTool.js +239 -0
  169. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.d.ts +21 -0
  170. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/editFileTool.js +143 -0
  171. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.d.ts +24 -0
  172. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/manageTodoListTool.js +298 -0
  173. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.d.ts +25 -0
  174. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/reviewPlanTool.js +177 -0
  175. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.d.ts +73 -0
  176. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/runSubagentTool.js +577 -0
  177. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.d.ts +11 -0
  178. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactRulesTool.js +90 -0
  179. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.d.ts +16 -0
  180. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/setArtifactsTool.js +130 -0
  181. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.d.ts +12 -0
  182. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/taskCompleteTool.js +53 -0
  183. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.d.ts +5 -0
  184. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/toolHelpers.js +12 -0
  185. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.d.ts +10 -0
  186. package/vscode/src/vs/workbench/contrib/chat/common/tools/builtinTools/tools.js +91 -0
  187. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.d.ts +38 -0
  188. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsContribution.js +518 -0
  189. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.d.ts +6 -0
  190. package/vscode/src/vs/workbench/contrib/chat/common/tools/languageModelToolsParametersSchema.js +231 -0
  191. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +1 -1
  192. package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +4 -4
  193. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +1 -1
  194. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +1 -1
  195. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +1 -1
  196. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +1 -1
  197. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +1 -1
  198. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalTool.js +1 -1
  199. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +1 -1
  200. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +1 -1
  201. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +1 -1
  202. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +1 -1
  203. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.d.ts +1 -1
  204. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCache.js +1 -1
  205. package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.js +1 -1
@@ -0,0 +1,698 @@
1
+
2
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
3
+ import { splitGlobAware, match } from '@codingame/monaco-vscode-api/vscode/vs/base/common/glob';
4
+ import { ResourceMap, ResourceSet } from '@codingame/monaco-vscode-api/vscode/vs/base/common/map';
5
+ import { Schemas } from '@codingame/monaco-vscode-api/vscode/vs/base/common/network';
6
+ import { OperatingSystem } from '@codingame/monaco-vscode-api/vscode/vs/base/common/platform';
7
+ import { basename, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
8
+ import { escape } from '@codingame/monaco-vscode-api/vscode/vs/base/common/strings';
9
+ import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
10
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
11
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
12
+ import { ILabelService } from '@codingame/monaco-vscode-api/vscode/vs/platform/label/common/label.service';
13
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
14
+ import { IRemoteAgentService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/remote/common/remoteAgentService.service';
15
+ import { ITelemetryService } from '@codingame/monaco-vscode-api/vscode/vs/platform/telemetry/common/telemetry.service';
16
+ import { IWorkspaceContextService } from '@codingame/monaco-vscode-api/vscode/vs/platform/workspace/common/workspace.service';
17
+ import { toPromptFileVariableEntry, PromptFileVariableKind, isPromptFileVariableEntry, IChatRequestVariableEntry, ChatRequestVariableSet, toToolVariableEntry, toPromptTextVariableEntry } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/attachments/chatVariableEntries';
18
+ import { VSCodeToolReference } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService';
19
+ import { ILanguageModelToolsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/tools/languageModelToolsService.service';
20
+ import { PromptsConfig } from '@codingame/monaco-vscode-katex-common/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/config';
21
+ import { isInClaudeRulesFolder, isInClaudeAgentsFolder, isPromptOrInstructionsFile } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/config/promptFileLocations';
22
+ import { isPromptFileTildePath } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptFileParser';
23
+ import { newInstructionsCollectionEvent, newInstructionsCollectionDebugInfo, matchesSessionType, AgentInstructionFileType } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
24
+ export { newInstructionsCollectionDebugInfo, newInstructionsCollectionEvent } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService';
25
+ import { IPromptsService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/service/promptsService.service';
26
+ import { AGENT_DEBUG_LOG_FILE_LOGGING_ENABLED_SETTING, TROUBLESHOOT_SKILL_PATH } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/promptSyntax/promptTypes';
27
+ import { OffsetRange } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/core/ranges/offsetRange';
28
+ import { ChatModeKind } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/constants';
29
+ import { hash } from '@codingame/monaco-vscode-api/vscode/vs/base/common/hash';
30
+ import { IAgentPluginService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService.service';
31
+ import { IPathService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/services/path/common/pathService.service';
32
+
33
+ let lastInstructionsCollectionResult;
34
+ let ComputeAutomaticInstructions = class ComputeAutomaticInstructions {
35
+ constructor(
36
+ _modeKind,
37
+ _enabledTools,
38
+ _enabledSubagents,
39
+ _currentSessionType,
40
+ _promptsService,
41
+ _logService,
42
+ _labelService,
43
+ _configurationService,
44
+ _workspaceService,
45
+ _fileService,
46
+ _remoteAgentService,
47
+ _telemetryService,
48
+ _languageModelToolsService,
49
+ _agentPluginService,
50
+ _pathService
51
+ ) {
52
+ this._modeKind = _modeKind;
53
+ this._enabledTools = _enabledTools;
54
+ this._enabledSubagents = _enabledSubagents;
55
+ this._currentSessionType = _currentSessionType;
56
+ this._promptsService = _promptsService;
57
+ this._logService = _logService;
58
+ this._labelService = _labelService;
59
+ this._configurationService = _configurationService;
60
+ this._workspaceService = _workspaceService;
61
+ this._fileService = _fileService;
62
+ this._remoteAgentService = _remoteAgentService;
63
+ this._telemetryService = _telemetryService;
64
+ this._languageModelToolsService = _languageModelToolsService;
65
+ this._agentPluginService = _agentPluginService;
66
+ this._pathService = _pathService;
67
+ this._parseResults = ( new ResourceMap());
68
+ }
69
+ async _parseInstructionsFile(uri, token) {
70
+ if (( this._parseResults.has(uri))) {
71
+ return this._parseResults.get(uri);
72
+ }
73
+ try {
74
+ const result = await this._promptsService.parseNew(uri, token);
75
+ this._parseResults.set(uri, result);
76
+ return result;
77
+ } catch (error) {
78
+ this._logService.error(
79
+ `[InstructionsContextComputer] Failed to parse instruction file: ${uri}`,
80
+ error
81
+ );
82
+ return undefined;
83
+ }
84
+ }
85
+ async collect(variables, token) {
86
+ const startTime = performance.now();
87
+ const instructionFiles = await this._promptsService.getInstructionFiles(token);
88
+ this._logService.trace(
89
+ `[InstructionsContextComputer] ${instructionFiles.length} instruction files available.`
90
+ );
91
+ const telemetryEvent = newInstructionsCollectionEvent();
92
+ const debugInfo = newInstructionsCollectionDebugInfo();
93
+ const context = this._getContext(variables);
94
+ await this.addApplyingInstructions(instructionFiles, context, variables, telemetryEvent, debugInfo, token);
95
+ await this._addReferencedInstructions(variables, telemetryEvent, debugInfo, token);
96
+ await this._addAgentInstructions(variables, telemetryEvent, debugInfo, token);
97
+ const customizationsIndexVariable = await this._getCustomizationsIndex(instructionFiles, variables, telemetryEvent, debugInfo, token);
98
+ if (customizationsIndexVariable) {
99
+ variables.add(customizationsIndexVariable);
100
+ telemetryEvent.listedInstructionsCount++;
101
+ }
102
+ debugInfo.durationInMillis = performance.now() - startTime;
103
+ this.sendTelemetry(telemetryEvent);
104
+ lastInstructionsCollectionResult = {
105
+ telemetryEvent,
106
+ debugInfo
107
+ };
108
+ }
109
+ sendTelemetry(telemetryEvent) {
110
+ telemetryEvent.totalInstructionsCount = telemetryEvent.agentInstructionsCount + telemetryEvent.referencedInstructionsCount + telemetryEvent.applyingInstructionsCount + telemetryEvent.listedInstructionsCount;
111
+ this._telemetryService.publicLog2("instructionsCollected", telemetryEvent);
112
+ }
113
+ async _logSkillLoadedTelemetry(skills) {
114
+ try {
115
+ const pluginByUri = ( new ResourceMap());
116
+ const allPlugins = this._agentPluginService.plugins.get();
117
+ for (const plugin of allPlugins) {
118
+ pluginByUri.set(plugin.uri, plugin);
119
+ }
120
+ const hashOrEmpty = value => {
121
+ return value !== undefined ? String(hash(value)) : "";
122
+ };
123
+ for (const skill of skills) {
124
+ const skillPlugin = skill.pluginUri ? pluginByUri.get(skill.pluginUri) : undefined;
125
+ this._telemetryService.publicLog2("skillLoadedIntoContext", {
126
+ skillNameHash: hashOrEmpty(skill.name),
127
+ skillStorage: skill.storage,
128
+ extensionIdHash: hashOrEmpty(skill.extension?.identifier.value),
129
+ extensionVersion: skill.extension?.version ?? "",
130
+ pluginNameHash: hashOrEmpty(skillPlugin?.label),
131
+ pluginVersion: skillPlugin?.fromMarketplace?.version ?? ""
132
+ });
133
+ }
134
+ } catch (err) {
135
+ this._logService.error("[InstructionsContextComputer] Failed to log skill telemetry", err);
136
+ }
137
+ }
138
+ async addApplyingInstructions(instructionFiles, context, variables, telemetryEvent, debugInfo, token) {
139
+ const includeApplyingInstructions = this._configurationService.getValue(PromptsConfig.INCLUDE_APPLYING_INSTRUCTIONS);
140
+ if (!includeApplyingInstructions && this._modeKind !== ChatModeKind.Edit) {
141
+ this._logService.trace(
142
+ `[InstructionsContextComputer] includeApplyingInstructions is disabled and agent kind is not Edit. No applying instructions will be added.`
143
+ );
144
+ return;
145
+ }
146
+ const currentSessionType = this._currentSessionType;
147
+ for (const instructionFile of instructionFiles) {
148
+ if (token.isCancellationRequested) {
149
+ return;
150
+ }
151
+ const {
152
+ uri,
153
+ pattern
154
+ } = instructionFile;
155
+ if (!matchesSessionType(instructionFile.sessionTypes, currentSessionType)) {
156
+ continue;
157
+ }
158
+ if (!pattern) {
159
+ this._logService.trace(`[InstructionsContextComputer] No pattern (applyTo / paths) found: ${uri}`);
160
+ debugInfo.debugDetails.push({
161
+ category: "skipped",
162
+ name: ( basename(uri).toString()),
163
+ uri,
164
+ reason: ( localize(10532, "no applyTo pattern"))
165
+ });
166
+ continue;
167
+ }
168
+ const isClaudeRules = isInClaudeRulesFolder(uri);
169
+ if (( context.instructions.has(uri))) {
170
+ this._logService.trace(
171
+ `[InstructionsContextComputer] Skipping already processed instruction file: ${uri}`
172
+ );
173
+ debugInfo.debugDetails.push({
174
+ category: "skipped",
175
+ name: ( basename(uri).toString()),
176
+ uri,
177
+ reason: ( localize(10533, "already processed"))
178
+ });
179
+ continue;
180
+ }
181
+ const match = this._matches(context.files, pattern);
182
+ if (match) {
183
+ this._logService.trace(
184
+ `[InstructionsContextComputer] Match for ${uri} with ${match.pattern}${match.file ? ` for file ${match.file}` : ""}`
185
+ );
186
+ const reason = !match.file ? ( localize(10534, "automatically attached as pattern is **")) : ( localize(
187
+ 10535,
188
+ "automatically attached as pattern {0} matches {1}",
189
+ pattern,
190
+ this._labelService.getUriLabel(match.file, {
191
+ relative: true
192
+ })
193
+ ));
194
+ variables.add(
195
+ toPromptFileVariableEntry(uri, PromptFileVariableKind.Instruction, reason, true)
196
+ );
197
+ telemetryEvent.applyingInstructionsCount++;
198
+ debugInfo.debugDetails.push({
199
+ category: "applying",
200
+ name: ( basename(uri).toString()),
201
+ uri,
202
+ reason
203
+ });
204
+ if (isClaudeRules) {
205
+ telemetryEvent.claudeRulesCount++;
206
+ }
207
+ } else {
208
+ this._logService.trace(`[InstructionsContextComputer] No match for ${uri} with ${pattern}`);
209
+ debugInfo.debugDetails.push({
210
+ category: "skipped",
211
+ name: ( basename(uri).toString()),
212
+ uri,
213
+ reason: ( localize(10536, "applyTo '{0}' did not match any attached files", pattern))
214
+ });
215
+ }
216
+ }
217
+ }
218
+ _getContext(attachedContext) {
219
+ const files = ( new ResourceSet());
220
+ const instructions = ( new ResourceSet());
221
+ for (const variable of attachedContext.asArray()) {
222
+ if (isPromptFileVariableEntry(variable)) {
223
+ instructions.add(variable.value);
224
+ } else {
225
+ const uri = IChatRequestVariableEntry.toUri(variable);
226
+ if (uri) {
227
+ files.add(uri);
228
+ }
229
+ }
230
+ }
231
+ return {
232
+ files,
233
+ instructions
234
+ };
235
+ }
236
+ async _addAgentInstructions(variables, telemetryEvent, debugInfo, token) {
237
+ const logger = {
238
+ logInfo: message => this._logService.trace(`[InstructionsContextComputer] ${message}`)
239
+ };
240
+ const allCandidates = await this._promptsService.listAgentInstructions(token, logger);
241
+ const entries = ( new ChatRequestVariableSet());
242
+ const copilotEntries = ( new ChatRequestVariableSet());
243
+ for (const {
244
+ uri,
245
+ type
246
+ } of allCandidates) {
247
+ const varEntry = toPromptFileVariableEntry(uri, PromptFileVariableKind.Instruction, undefined, true);
248
+ entries.add(varEntry);
249
+ if (type === AgentInstructionFileType.copilotInstructionsMd) {
250
+ copilotEntries.add(varEntry);
251
+ }
252
+ telemetryEvent.agentInstructionsCount++;
253
+ if (type === AgentInstructionFileType.claudeMd) {
254
+ telemetryEvent.claudeMdCount++;
255
+ }
256
+ debugInfo.debugDetails.push({
257
+ category: "applying",
258
+ name: ( basename(uri).toString()),
259
+ uri,
260
+ reason: ( localize(10537, "always added"))
261
+ });
262
+ logger.logInfo(`Agent instruction file added: ${( uri.toString())}`);
263
+ }
264
+ if (copilotEntries.length > 0) {
265
+ await this._addReferencedInstructions(copilotEntries, telemetryEvent, debugInfo, token);
266
+ for (const entry of copilotEntries.asArray()) {
267
+ variables.add(entry);
268
+ }
269
+ }
270
+ for (const entry of entries.asArray()) {
271
+ variables.add(entry);
272
+ }
273
+ }
274
+ _matches(files, applyToPattern) {
275
+ const patterns = splitGlobAware(applyToPattern, ",");
276
+ const patterMatches = pattern => {
277
+ pattern = pattern.trim();
278
+ if (pattern.length === 0) {
279
+ return undefined;
280
+ }
281
+ if (pattern === "**" || pattern === "**/*" || pattern === "*") {
282
+ return {
283
+ pattern
284
+ };
285
+ }
286
+ if (!pattern.startsWith("/") && !pattern.startsWith("**/")) {
287
+ pattern = "**/" + pattern;
288
+ }
289
+ for (const file of files) {
290
+ if (match(pattern, file.path, {
291
+ ignoreCase: true
292
+ })) {
293
+ return {
294
+ pattern,
295
+ file
296
+ };
297
+ }
298
+ }
299
+ return undefined;
300
+ };
301
+ for (const pattern of patterns) {
302
+ const matchResult = patterMatches(pattern);
303
+ if (matchResult) {
304
+ return matchResult;
305
+ }
306
+ }
307
+ return undefined;
308
+ }
309
+ _getTool(referenceName) {
310
+ if (!this._enabledTools) {
311
+ return undefined;
312
+ }
313
+ const tool = this._languageModelToolsService.getToolByName(referenceName);
314
+ if (tool && this._enabledTools[tool.id]) {
315
+ return {
316
+ tool,
317
+ variable: `#tool:${this._languageModelToolsService.getFullReferenceName(tool)}`
318
+ };
319
+ }
320
+ return undefined;
321
+ }
322
+ async _getCustomizationsIndex(instructionFiles, _existingVariables, telemetryEvent, debugInfo, token) {
323
+ const readTool = this._getTool("readFile");
324
+ const runInTerminalTool = this._getTool("runInTerminal");
325
+ const fileReadTool = readTool ?? runInTerminalTool;
326
+ const runSubagentTool = this._getTool(VSCodeToolReference.runSubagent);
327
+ const skillTool = this._getTool("skill");
328
+ const currentSessionType = this._currentSessionType;
329
+ const remoteEnv = await this._remoteAgentService.getEnvironment();
330
+ const remoteOS = remoteEnv?.os;
331
+ const isRemote = this._remoteAgentService.getConnection() !== null;
332
+ const filePath = uri => getFilePath(uri, remoteOS, isRemote);
333
+ const entries = [];
334
+ if (fileReadTool) {
335
+ const searchNestedAgentMd = this._configurationService.getValue(PromptsConfig.USE_NESTED_AGENT_MD);
336
+ const agentsMdPromise = searchNestedAgentMd ? this._promptsService.listNestedAgentMDs(token) : Promise.resolve([]);
337
+ entries.push("<instructions>");
338
+ entries.push(
339
+ "Here is a list of instruction files that contain rules for working with this codebase."
340
+ );
341
+ entries.push(
342
+ "These files are important for understanding the codebase structure, conventions, and best practices."
343
+ );
344
+ entries.push(
345
+ "When an instruction file applies to your task (based on its description or applyTo pattern), follow the rules specified in it."
346
+ );
347
+ entries.push(
348
+ `If the file content is not already included in the context, use the ${fileReadTool.variable} tool to read it before proceeding. Use the exact value from the <file> element as-is with the tool; do not add or remove prefixes or otherwise modify it.`
349
+ );
350
+ entries.push(
351
+ "Only load instruction files when they are relevant to the current task. Do not eagerly load all instructions upfront."
352
+ );
353
+ entries.push(
354
+ "When modifying or creating files, check for instructions whose applyTo pattern matches the file path and follow them."
355
+ );
356
+ let hasContent = false;
357
+ for (const instruction of instructionFiles) {
358
+ if (!matchesSessionType(instruction.sessionTypes, currentSessionType)) {
359
+ continue;
360
+ }
361
+ entries.push("<instruction>");
362
+ entries.push(`<file>${filePath(instruction.uri)}</file>`);
363
+ if (instruction.description) {
364
+ entries.push(`<description>${escape(instruction.description)}</description>`);
365
+ }
366
+ if (instruction.pattern) {
367
+ entries.push(`<applyTo>${escape(instruction.pattern)}</applyTo>`);
368
+ }
369
+ entries.push("</instruction>");
370
+ hasContent = true;
371
+ }
372
+ const agentsMdFiles = await agentsMdPromise;
373
+ for (const {
374
+ uri
375
+ } of agentsMdFiles) {
376
+ const folderName = this._labelService.getUriLabel(dirname(uri), {
377
+ relative: true
378
+ });
379
+ const description = folderName.trim().length === 0 ? ( localize(10538, "Instructions for the workspace")) : ( localize(10539, "Instructions for folder '{0}'", folderName));
380
+ entries.push("<instruction>");
381
+ entries.push(`<file>${filePath(uri)}</file>`);
382
+ entries.push(`<description>${escape(description)}</description>`);
383
+ entries.push("</instruction>");
384
+ hasContent = true;
385
+ }
386
+ if (!hasContent) {
387
+ entries.length = 0;
388
+ } else {
389
+ entries.push("</instructions>", "", "");
390
+ }
391
+ const agentSkills = await this._promptsService.findAgentSkills(token);
392
+ const isFileLoggingEnabled = this._configurationService.getValue(AGENT_DEBUG_LOG_FILE_LOGGING_ENABLED_SETTING);
393
+ const modelInvocableSkills = agentSkills?.filter(skill => {
394
+ if (!skill.description) {
395
+ debugInfo.debugDetails.push({
396
+ category: "skipped",
397
+ name: skill.name,
398
+ uri: skill.uri,
399
+ reason: ( localize(10540, "no description for model invocation"))
400
+ });
401
+ return false;
402
+ }
403
+ if (skill.disableModelInvocation) {
404
+ debugInfo.debugDetails.push({
405
+ category: "skipped",
406
+ name: skill.name,
407
+ uri: skill.uri,
408
+ reason: ( localize(10541, "model invocation disabled"))
409
+ });
410
+ return false;
411
+ }
412
+ if (!matchesSessionType(skill.sessionTypes, currentSessionType)) {
413
+ debugInfo.debugDetails.push({
414
+ category: "skipped",
415
+ name: skill.name,
416
+ uri: skill.uri,
417
+ reason: ( localize(10542, "session type not matched"))
418
+ });
419
+ return false;
420
+ }
421
+ if (!isFileLoggingEnabled && skill.uri.path.includes(TROUBLESHOOT_SKILL_PATH)) {
422
+ debugInfo.debugDetails.push({
423
+ category: "skipped",
424
+ name: skill.name,
425
+ uri: skill.uri,
426
+ reason: ( localize(10543, "debug logging disabled"))
427
+ });
428
+ return false;
429
+ }
430
+ return true;
431
+ });
432
+ if (modelInvocableSkills && modelInvocableSkills.length > 0) {
433
+ this._logSkillLoadedTelemetry(modelInvocableSkills);
434
+ for (const skill of modelInvocableSkills) {
435
+ debugInfo.debugDetails.push({
436
+ category: "skill",
437
+ name: skill.name,
438
+ uri: skill.uri,
439
+ reason: skill.storage
440
+ });
441
+ }
442
+ const useSkillAdherencePrompt = this._configurationService.getValue(PromptsConfig.USE_SKILL_ADHERENCE_PROMPT);
443
+ const skillLoadTool = skillTool ?? fileReadTool;
444
+ entries.push("<skills>");
445
+ if (useSkillAdherencePrompt) {
446
+ entries.push(
447
+ "Skills provide specialized capabilities, domain knowledge, and refined workflows for producing high-quality outputs. Each skill folder contains tested instructions for specific domains like testing strategies, API design, or performance optimization. Multiple skills can be combined when a task spans different domains."
448
+ );
449
+ if (skillTool) {
450
+ entries.push(
451
+ `BLOCKING REQUIREMENT: When a skill applies to the user's request, you MUST invoke it IMMEDIATELY as your first action, BEFORE generating any other response or taking action on the task. Use ${skillTool.variable} with the skill name to load the relevant skill(s).`
452
+ );
453
+ } else {
454
+ entries.push(
455
+ `BLOCKING REQUIREMENT: When a skill applies to the user's request, you MUST load and read the SKILL.md file IMMEDIATELY as your first action, BEFORE generating any other response or taking action on the task. Use ${fileReadTool.variable} to load the relevant skill(s).`
456
+ );
457
+ }
458
+ entries.push(
459
+ "NEVER just mention or reference a skill in your response without actually loading it first. If a skill is relevant, load it before proceeding."
460
+ );
461
+ entries.push("How to determine if a skill applies:");
462
+ entries.push(
463
+ "1. Review the available skills below and match their descriptions against the user's request"
464
+ );
465
+ entries.push(
466
+ "2. If any skill's domain overlaps with the task, load that skill immediately"
467
+ );
468
+ entries.push(
469
+ "3. When multiple skills apply (e.g., a flowchart in documentation), load all relevant skills"
470
+ );
471
+ entries.push("Examples:");
472
+ entries.push(
473
+ `- "Help me write unit tests for this module" -> Load the testing skill via ${skillLoadTool.variable} FIRST, then proceed`
474
+ );
475
+ entries.push(
476
+ `- "Optimize this slow function" -> Load the performance-profiling skill via ${skillLoadTool.variable} FIRST, then proceed`
477
+ );
478
+ entries.push(
479
+ `- "Add a discount code field to checkout" -> Load both the checkout-flow and form-validation skills FIRST`
480
+ );
481
+ entries.push("Available skills:");
482
+ } else {
483
+ if (skillTool) {
484
+ entries.push(
485
+ "Here is a list of skills that contain domain specific knowledge on a variety of topics."
486
+ );
487
+ entries.push(
488
+ `When a user asks you to perform a task that falls within the domain of a skill, use the ${skillTool.variable} tool with the skill name to load it.`
489
+ );
490
+ } else {
491
+ entries.push(
492
+ "Here is a list of skills that contain domain specific knowledge on a variety of topics."
493
+ );
494
+ entries.push(
495
+ "Each skill comes with a description of the topic and a file path that contains the detailed instructions."
496
+ );
497
+ entries.push(
498
+ `When a user asks you to perform a task that falls within the domain of a skill, use the ${fileReadTool.variable} tool to acquire the full instructions from the file URI.`
499
+ );
500
+ }
501
+ }
502
+ const SKILL_DESCRIPTION_CHAR_BUDGET = 15000;
503
+ const TRUNCATED_NAMES_CHAR_BUDGET = 5000;
504
+ let skillCharCount = 0;
505
+ let truncatedAtIndex = modelInvocableSkills.length;
506
+ for (let i = 0; i < modelInvocableSkills.length; i++) {
507
+ const skill = modelInvocableSkills[i];
508
+ const skillEntry = [`<skill>`, `<name>${escape(skill.name)}</name>`];
509
+ if (skill.description) {
510
+ skillEntry.push(`<description>${escape(skill.description)}</description>`);
511
+ }
512
+ skillEntry.push(`<file>${filePath(skill.uri)}</file>`);
513
+ skillEntry.push(`</skill>`);
514
+ const entryLength = skillEntry.join("\n").length + 1;
515
+ if (skillTool && skillCharCount + entryLength > SKILL_DESCRIPTION_CHAR_BUDGET) {
516
+ truncatedAtIndex = i;
517
+ break;
518
+ }
519
+ skillCharCount += entryLength;
520
+ entries.push(...skillEntry);
521
+ }
522
+ if (truncatedAtIndex < modelInvocableSkills.length) {
523
+ const truncatedSkills = modelInvocableSkills.slice(truncatedAtIndex);
524
+ const names = [];
525
+ let nameListLength = 0;
526
+ for (const skill of truncatedSkills) {
527
+ const escapedName = escape(skill.name);
528
+ const addition = (names.length > 0 ? 2 : 0) + escapedName.length;
529
+ if (nameListLength + addition > TRUNCATED_NAMES_CHAR_BUDGET) {
530
+ break;
531
+ }
532
+ nameListLength += addition;
533
+ names.push(escapedName);
534
+ }
535
+ const remaining = truncatedSkills.length - names.length;
536
+ const nameList = names.join(", ");
537
+ entries.push(
538
+ remaining > 0 ? `Additional skills available (invoke by name): ${nameList}... and ${remaining} more` : `Additional skills available (invoke by name): ${nameList}`
539
+ );
540
+ }
541
+ entries.push("</skills>", "", "");
542
+ }
543
+ }
544
+ if (runSubagentTool) {
545
+ const canUseAgent = (() => {
546
+ if (!this._enabledSubagents || this._enabledSubagents.includes("*")) {
547
+ return agent => agent.visibility.agentInvocable && matchesSessionType(agent.sessionTypes, currentSessionType);
548
+ } else {
549
+ const subagents = this._enabledSubagents;
550
+ return agent => subagents.includes(agent.name) && matchesSessionType(agent.sessionTypes, currentSessionType);
551
+ }
552
+ })();
553
+ const agents = (await this._promptsService.getCustomAgents(token)).filter(a => a.enabled);
554
+ if (agents.length > 0) {
555
+ entries.push("<agents>");
556
+ entries.push("Here is a list of agents that can be used when running a subagent.");
557
+ entries.push(
558
+ "Each agent has optionally a description with the agent's purpose and expertise. When asked to run a subagent, choose the most appropriate agent from this list."
559
+ );
560
+ entries.push(
561
+ `Use the ${runSubagentTool.variable} tool with the agent name to run the subagent.`
562
+ );
563
+ for (const agent of agents) {
564
+ if (canUseAgent(agent)) {
565
+ entries.push("<agent>");
566
+ entries.push(`<name>${escape(agent.name)}</name>`);
567
+ if (agent.description) {
568
+ entries.push(`<description>${escape(agent.description)}</description>`);
569
+ }
570
+ if (agent.argumentHint) {
571
+ entries.push(`<argumentHint>${escape(agent.argumentHint)}</argumentHint>`);
572
+ }
573
+ entries.push("</agent>");
574
+ debugInfo.debugDetails.push({
575
+ category: "custom-agent",
576
+ name: agent.name,
577
+ uri: agent.uri
578
+ });
579
+ if (isInClaudeAgentsFolder(agent.uri)) {
580
+ telemetryEvent.claudeAgentsCount++;
581
+ }
582
+ } else {
583
+ debugInfo.debugDetails.push({
584
+ category: "skipped",
585
+ name: agent.name,
586
+ uri: agent.uri,
587
+ reason: ( localize(10544, "not invocable by model"))
588
+ });
589
+ }
590
+ }
591
+ entries.push("</agents>", "", "");
592
+ }
593
+ }
594
+ if (entries.length === 0) {
595
+ return undefined;
596
+ }
597
+ const content = entries.join("\n");
598
+ const toolReferences = [];
599
+ const collectToolReference = tool => {
600
+ if (tool) {
601
+ let offset = content.indexOf(tool.variable);
602
+ while (offset >= 0) {
603
+ toolReferences.push(toToolVariableEntry(tool.tool, ( new OffsetRange(offset, offset + tool.variable.length))));
604
+ offset = content.indexOf(tool.variable, offset + 1);
605
+ }
606
+ }
607
+ };
608
+ collectToolReference(fileReadTool);
609
+ collectToolReference(runSubagentTool);
610
+ collectToolReference(skillTool);
611
+ return toPromptTextVariableEntry(content, true, toolReferences);
612
+ }
613
+ async _addReferencedInstructions(attachedContext, telemetryEvent, debugInfo, token) {
614
+ const includeReferencedInstructions = this._configurationService.getValue(PromptsConfig.INCLUDE_REFERENCED_INSTRUCTIONS);
615
+ if (!includeReferencedInstructions && this._modeKind !== ChatModeKind.Edit) {
616
+ this._logService.trace(
617
+ `[InstructionsContextComputer] includeReferencedInstructions is disabled and agent kind is not Edit. No referenced instructions will be added.`
618
+ );
619
+ return;
620
+ }
621
+ const seen = ( new ResourceSet());
622
+ const todo = [];
623
+ for (const variable of attachedContext.asArray()) {
624
+ if (isPromptFileVariableEntry(variable)) {
625
+ if (!( seen.has(variable.value))) {
626
+ todo.push(variable.value);
627
+ seen.add(variable.value);
628
+ }
629
+ }
630
+ }
631
+ let next = todo.pop();
632
+ while (next) {
633
+ const result = await this._parseInstructionsFile(next, token);
634
+ if (result && result.body) {
635
+ const refsToCheck = [];
636
+ let userHome;
637
+ for (const ref of result.body.fileReferences) {
638
+ if (isPromptFileTildePath(ref.content)) {
639
+ userHome ??= await this._pathService.userHome();
640
+ }
641
+ const url = result.body.resolveFilePath(ref.content, userHome);
642
+ if (url && !( seen.has(url)) && (isPromptOrInstructionsFile(url) || this._workspaceService.getWorkspaceFolder(url) !== undefined)) {
643
+ refsToCheck.push({
644
+ resource: url
645
+ });
646
+ seen.add(url);
647
+ }
648
+ }
649
+ if (refsToCheck.length > 0) {
650
+ const stats = await this._fileService.resolveAll(refsToCheck);
651
+ for (let i = 0; i < stats.length; i++) {
652
+ const stat = stats[i];
653
+ const uri = refsToCheck[i].resource;
654
+ if (stat.success && stat.stat?.isFile) {
655
+ if (isPromptOrInstructionsFile(uri)) {
656
+ todo.push(uri);
657
+ }
658
+ const reason = ( localize(10545, "Referenced by {0}", basename(next)));
659
+ attachedContext.add(
660
+ toPromptFileVariableEntry(uri, PromptFileVariableKind.InstructionReference, reason, true)
661
+ );
662
+ telemetryEvent.referencedInstructionsCount++;
663
+ debugInfo.debugDetails.push({
664
+ category: "referenced",
665
+ name: ( basename(uri).toString()),
666
+ uri,
667
+ reason
668
+ });
669
+ this._logService.trace(`[InstructionsContextComputer] ${( uri.toString())} added, referenced by ${( next.toString())}`);
670
+ }
671
+ }
672
+ }
673
+ }
674
+ next = todo.pop();
675
+ }
676
+ }
677
+ };
678
+ ComputeAutomaticInstructions = ( __decorate([( __param(4, IPromptsService)), ( __param(5, ILogService)), ( __param(6, ILabelService)), ( __param(7, IConfigurationService)), ( __param(8, IWorkspaceContextService)), ( __param(9, IFileService)), ( __param(10, IRemoteAgentService)), ( __param(11, ITelemetryService)), ( __param(12, ILanguageModelToolsService)), ( __param(13, IAgentPluginService)), ( __param(14, IPathService))], ComputeAutomaticInstructions));
679
+ function getFilePath(uri, remoteOS, isRemote = false) {
680
+ if (isRemote && uri.scheme === Schemas.file) {
681
+ return ( uri.with({
682
+ scheme: "vscode-local"
683
+ }).toString());
684
+ }
685
+ if (uri.scheme === Schemas.file || uri.scheme === Schemas.vscodeRemote) {
686
+ const fsPath = uri.fsPath;
687
+ if (remoteOS !== undefined) {
688
+ if (remoteOS === OperatingSystem.Windows) {
689
+ return fsPath.replace(/\//g, "\\");
690
+ }
691
+ return fsPath.replace(/\\/g, "/");
692
+ }
693
+ return fsPath;
694
+ }
695
+ return ( uri.toString());
696
+ }
697
+
698
+ export { ComputeAutomaticInstructions, getFilePath, lastInstructionsCollectionResult };