@codingame/monaco-vscode-workbench-service-override 37.2.0 → 37.3.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 (325) hide show
  1. package/common.d.ts +3 -0
  2. package/common.js +29 -0
  3. package/index.d.ts +1 -1
  4. package/index.js +25 -32
  5. package/package.json +18 -8
  6. package/session.d.ts +4 -0
  7. package/session.js +260 -0
  8. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostLocationPreferenceService.d.ts +24 -0
  9. package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostLocationPreferenceService.js +71 -0
  10. package/vscode/src/vs/platform/agentHost/common/remoteAgentHostLocationPreference.d.ts +7 -0
  11. package/vscode/src/vs/platform/agentHost/common/remoteAgentHostLocationPreference.js +7 -0
  12. package/vscode/src/vs/sessions/browser/dockedAuxiliaryBarController.d.ts +50 -0
  13. package/vscode/src/vs/sessions/browser/dockedAuxiliaryBarController.js +120 -0
  14. package/vscode/src/vs/sessions/browser/media/sessions-logo-dark.svg +6 -0
  15. package/vscode/src/vs/sessions/browser/media/sessions-logo-light.svg +6 -0
  16. package/vscode/src/vs/sessions/browser/media/sessionsSetUp.css +72 -0
  17. package/vscode/src/vs/sessions/browser/parts/chatCompositeBar.d.ts +116 -0
  18. package/vscode/src/vs/sessions/browser/parts/chatCompositeBar.js +566 -0
  19. package/vscode/src/vs/sessions/browser/parts/chatGroupDropTarget.d.ts +43 -0
  20. package/vscode/src/vs/sessions/browser/parts/chatGroupDropTarget.js +308 -0
  21. package/vscode/src/vs/sessions/browser/parts/chatGroupView.d.ts +108 -0
  22. package/vscode/src/vs/sessions/browser/parts/chatGroupView.js +324 -0
  23. package/vscode/src/vs/sessions/browser/parts/chatGroupsView.d.ts +136 -0
  24. package/vscode/src/vs/sessions/browser/parts/chatGroupsView.js +771 -0
  25. package/vscode/src/vs/sessions/browser/parts/customViewGridPart.d.ts +43 -0
  26. package/vscode/src/vs/sessions/browser/parts/customViewGridPart.js +113 -0
  27. package/vscode/src/vs/sessions/browser/parts/customViewGridParts.d.ts +17 -0
  28. package/vscode/src/vs/sessions/browser/parts/customViewGridParts.js +31 -0
  29. package/vscode/src/vs/sessions/browser/parts/customViewNode.d.ts +24 -0
  30. package/vscode/src/vs/sessions/browser/parts/customViewNode.js +131 -0
  31. package/vscode/src/vs/sessions/browser/parts/editorPart.d.ts +11 -0
  32. package/vscode/src/vs/sessions/browser/parts/editorPart.js +36 -0
  33. package/vscode/src/vs/sessions/browser/parts/editorParts.d.ts +12 -0
  34. package/vscode/src/vs/sessions/browser/parts/editorParts.js +45 -0
  35. package/vscode/src/vs/sessions/browser/parts/media/chatCompositeBar.css +559 -0
  36. package/vscode/src/vs/sessions/browser/parts/media/chatGroupDropTarget.css +27 -0
  37. package/vscode/src/vs/sessions/browser/parts/media/chatGroupsView.css +60 -0
  38. package/vscode/src/vs/sessions/browser/parts/media/customViewGridPart.css +108 -0
  39. package/vscode/src/vs/sessions/browser/parts/media/editorPart.css +210 -0
  40. package/vscode/src/vs/sessions/browser/parts/media/remoteHostUnavailableEmptyState.css +81 -0
  41. package/vscode/src/vs/sessions/browser/parts/media/sessionDropTarget.css +31 -0
  42. package/vscode/src/vs/sessions/browser/parts/media/sessionReadOnlyBanner.css +87 -0
  43. package/vscode/src/vs/sessions/browser/parts/media/sessionView.css +107 -0
  44. package/vscode/src/vs/sessions/browser/parts/media/sessionsPart.css +134 -0
  45. package/vscode/src/vs/sessions/browser/parts/menubar.contribution.d.ts +1 -0
  46. package/vscode/src/vs/sessions/browser/parts/menubar.contribution.js +79 -0
  47. package/vscode/src/vs/sessions/browser/parts/mobile/mobileCustomViewGridPart.d.ts +13 -0
  48. package/vscode/src/vs/sessions/browser/parts/mobile/mobileCustomViewGridPart.js +33 -0
  49. package/vscode/src/vs/sessions/browser/parts/mobile/mobileSessionsPart.d.ts +14 -0
  50. package/vscode/src/vs/sessions/browser/parts/mobile/mobileSessionsPart.js +34 -0
  51. package/vscode/src/vs/sessions/browser/parts/remoteHostUnavailableEmptyState.d.ts +39 -0
  52. package/vscode/src/vs/sessions/browser/parts/remoteHostUnavailableEmptyState.js +136 -0
  53. package/vscode/src/vs/sessions/browser/parts/sessionBarStyles.d.ts +9 -0
  54. package/vscode/src/vs/sessions/browser/parts/sessionBarStyles.js +62 -0
  55. package/vscode/src/vs/sessions/browser/parts/sessionDropTarget.d.ts +39 -0
  56. package/vscode/src/vs/sessions/browser/parts/sessionDropTarget.js +261 -0
  57. package/vscode/src/vs/sessions/browser/parts/sessionHeader.d.ts +97 -0
  58. package/vscode/src/vs/sessions/browser/parts/sessionHeader.js +345 -0
  59. package/vscode/src/vs/sessions/browser/parts/sessionReadOnlyBanner.d.ts +43 -0
  60. package/vscode/src/vs/sessions/browser/parts/sessionReadOnlyBanner.js +69 -0
  61. package/vscode/src/vs/sessions/browser/parts/sessionRemoteConnection.d.ts +79 -0
  62. package/vscode/src/vs/sessions/browser/parts/sessionRemoteConnection.js +363 -0
  63. package/vscode/src/vs/sessions/browser/parts/sessionView.d.ts +125 -0
  64. package/vscode/src/vs/sessions/browser/parts/sessionView.js +300 -0
  65. package/vscode/src/vs/sessions/browser/parts/sessionsPart.d.ts +124 -0
  66. package/vscode/src/vs/sessions/browser/parts/sessionsPart.js +336 -0
  67. package/vscode/src/vs/sessions/browser/parts/sessionsParts.d.ts +33 -0
  68. package/vscode/src/vs/sessions/browser/parts/sessionsParts.js +62 -0
  69. package/vscode/src/vs/sessions/browser/parts/singlePaneAuxiliaryBarPart.d.ts +13 -0
  70. package/vscode/src/vs/sessions/browser/parts/singlePaneAuxiliaryBarPart.js +36 -0
  71. package/vscode/src/vs/sessions/browser/parts/singlePaneEditorPart.d.ts +65 -0
  72. package/vscode/src/vs/sessions/browser/parts/singlePaneEditorPart.js +178 -0
  73. package/vscode/src/vs/sessions/browser/sessionWorkspace.d.ts +12 -0
  74. package/vscode/src/vs/sessions/browser/sessionWorkspace.js +19 -0
  75. package/vscode/src/vs/sessions/browser/sessionsSetUpService.d.ts +24 -0
  76. package/vscode/src/vs/sessions/browser/sessionsSetUpService.js +598 -0
  77. package/vscode/src/vs/sessions/browser/sessionsSignInDialog.d.ts +25 -0
  78. package/vscode/src/vs/sessions/browser/sessionsSignInDialog.js +91 -0
  79. package/vscode/src/vs/sessions/common/welcome.d.ts +1 -0
  80. package/vscode/src/vs/sessions/common/welcome.js +5 -0
  81. package/vscode/src/vs/sessions/contrib/accountMenu/browser/account.contribution.d.ts +11 -0
  82. package/vscode/src/vs/sessions/contrib/accountMenu/browser/account.contribution.js +1052 -0
  83. package/vscode/src/vs/sessions/contrib/accountMenu/browser/chatPetAchievementBadges.d.ts +23 -0
  84. package/vscode/src/vs/sessions/contrib/accountMenu/browser/chatPetAchievementBadges.js +168 -0
  85. package/vscode/src/vs/sessions/contrib/accountMenu/browser/media/accountTitleBarWidget.css +646 -0
  86. package/vscode/src/vs/sessions/contrib/accountMenu/browser/media/accountWidget.css +231 -0
  87. package/vscode/src/vs/sessions/contrib/accountMenu/browser/media/chatPetAchievementBadges.css +120 -0
  88. package/vscode/src/vs/sessions/contrib/agentFeedback/browser/nullAgentFeedbackService.contribution.d.ts +53 -0
  89. package/vscode/src/vs/sessions/contrib/agentFeedback/browser/nullAgentFeedbackService.contribution.js +99 -0
  90. package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeView.contribution.d.ts +1 -0
  91. package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeView.contribution.js +270 -0
  92. package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeViewViews.d.ts +62 -0
  93. package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/aiCustomizationTreeViewViews.js +606 -0
  94. package/vscode/src/vs/sessions/contrib/aiCustomizationTreeView/browser/media/aiCustomizationTreeView.css +116 -0
  95. package/vscode/src/vs/sessions/contrib/aquarium/browser/aquarium.contribution.d.ts +1 -0
  96. package/vscode/src/vs/sessions/contrib/aquarium/browser/aquarium.contribution.js +97 -0
  97. package/vscode/src/vs/sessions/contrib/aquarium/browser/aquariumOverlay.d.ts +72 -0
  98. package/vscode/src/vs/sessions/contrib/aquarium/browser/aquariumOverlay.js +776 -0
  99. package/vscode/src/vs/sessions/contrib/aquarium/browser/fish.d.ts +68 -0
  100. package/vscode/src/vs/sessions/contrib/aquarium/browser/fish.js +153 -0
  101. package/vscode/src/vs/sessions/contrib/aquarium/browser/fishFeedingStreak.d.ts +58 -0
  102. package/vscode/src/vs/sessions/contrib/aquarium/browser/fishFeedingStreak.js +172 -0
  103. package/vscode/src/vs/sessions/contrib/aquarium/browser/media/aquarium.css +316 -0
  104. package/vscode/src/vs/sessions/contrib/aquarium/browser/vscodeLogoPath.d.ts +1 -0
  105. package/vscode/src/vs/sessions/contrib/aquarium/browser/vscodeLogoPath.js +5 -0
  106. package/vscode/src/vs/sessions/contrib/automations/browser/automationDialog.d.ts +173 -0
  107. package/vscode/src/vs/sessions/contrib/automations/browser/automationDialog.js +1589 -0
  108. package/vscode/src/vs/sessions/contrib/automations/browser/automationDialogService.d.ts +32 -0
  109. package/vscode/src/vs/sessions/contrib/automations/browser/automationDialogService.js +396 -0
  110. package/vscode/src/vs/sessions/contrib/automations/browser/automationInputCompletions.d.ts +33 -0
  111. package/vscode/src/vs/sessions/contrib/automations/browser/automationInputCompletions.js +216 -0
  112. package/vscode/src/vs/sessions/contrib/automations/browser/automationLeaderElection.d.ts +37 -0
  113. package/vscode/src/vs/sessions/contrib/automations/browser/automationLeaderElection.js +126 -0
  114. package/vscode/src/vs/sessions/contrib/automations/browser/automationRunner.d.ts +21 -0
  115. package/vscode/src/vs/sessions/contrib/automations/browser/automationRunner.js +294 -0
  116. package/vscode/src/vs/sessions/contrib/automations/browser/automationScheduler.d.ts +59 -0
  117. package/vscode/src/vs/sessions/contrib/automations/browser/automationScheduler.js +232 -0
  118. package/vscode/src/vs/sessions/contrib/automations/browser/automationStorageService.d.ts +13 -0
  119. package/vscode/src/vs/sessions/contrib/automations/browser/automationStorageService.js +22 -0
  120. package/vscode/src/vs/sessions/contrib/automations/browser/automationTools.d.ts +60 -0
  121. package/vscode/src/vs/sessions/contrib/automations/browser/automationTools.js +1256 -0
  122. package/vscode/src/vs/sessions/contrib/automations/browser/automations.contribution.d.ts +1 -0
  123. package/vscode/src/vs/sessions/contrib/automations/browser/automations.contribution.js +88 -0
  124. package/vscode/src/vs/sessions/contrib/automations/browser/media/automationDialog.css +746 -0
  125. package/vscode/src/vs/sessions/contrib/automations/browser/providerAutomationService.d.ts +62 -0
  126. package/vscode/src/vs/sessions/contrib/automations/browser/providerAutomationService.js +493 -0
  127. package/vscode/src/vs/sessions/contrib/automations/common/isolationGroupModel.d.ts +38 -0
  128. package/vscode/src/vs/sessions/contrib/automations/common/isolationGroupModel.js +123 -0
  129. package/vscode/src/vs/sessions/contrib/blockedSessions/browser/blockedSessions.d.ts +45 -0
  130. package/vscode/src/vs/sessions/contrib/blockedSessions/browser/blockedSessions.js +110 -0
  131. package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.contribution.d.ts +1 -0
  132. package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.contribution.js +5 -0
  133. package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.d.ts +31 -0
  134. package/vscode/src/vs/sessions/contrib/browserView/browser/sessionBrowserView.js +137 -0
  135. package/vscode/src/vs/sessions/contrib/changes/browser/changes.contribution.d.ts +1 -0
  136. package/vscode/src/vs/sessions/contrib/changes/browser/changes.contribution.js +130 -0
  137. package/vscode/src/vs/sessions/contrib/changes/browser/changesActions.d.ts +8 -0
  138. package/vscode/src/vs/sessions/contrib/changes/browser/changesActions.js +385 -0
  139. package/vscode/src/vs/sessions/contrib/changes/browser/changesMultiDiffSourceResolver.d.ts +28 -0
  140. package/vscode/src/vs/sessions/contrib/changes/browser/changesMultiDiffSourceResolver.js +76 -0
  141. package/vscode/src/vs/sessions/contrib/changes/browser/changesViewActions.d.ts +1 -0
  142. package/vscode/src/vs/sessions/contrib/changes/browser/changesViewActions.js +509 -0
  143. package/vscode/src/vs/sessions/contrib/changes/browser/changesetReviewActions.d.ts +6 -0
  144. package/vscode/src/vs/sessions/contrib/changes/browser/changesetReviewActions.js +58 -0
  145. package/vscode/src/vs/sessions/contrib/changes/browser/media/changesActions.css +11 -0
  146. package/vscode/src/vs/sessions/contrib/changes/browser/sessionSyncChanges.d.ts +24 -0
  147. package/vscode/src/vs/sessions/contrib/changes/browser/sessionSyncChanges.js +188 -0
  148. package/vscode/src/vs/sessions/contrib/changes/browser/sessionsChangesAccessibilityHelp.d.ts +15 -0
  149. package/vscode/src/vs/sessions/contrib/changes/browser/sessionsChangesAccessibilityHelp.js +100 -0
  150. package/vscode/src/vs/sessions/contrib/chat/browser/chatViewStateService.d.ts +9 -0
  151. package/vscode/src/vs/sessions/contrib/chat/browser/chatViewStateService.js +18 -0
  152. package/vscode/src/vs/sessions/contrib/chat/browser/media/sessionChatInputToolbarDebug.css +59 -0
  153. package/vscode/src/vs/sessions/contrib/chat/browser/sessionChatInputToolbarDebug.d.ts +47 -0
  154. package/vscode/src/vs/sessions/contrib/chat/browser/sessionChatInputToolbarDebug.js +306 -0
  155. package/vscode/src/vs/sessions/contrib/chat/browser/sessionTaskRunner.d.ts +41 -0
  156. package/vscode/src/vs/sessions/contrib/chat/browser/sessionTaskRunner.js +31 -0
  157. package/vscode/src/vs/sessions/contrib/chatDebug/browser/chatDebug.contribution.d.ts +1 -0
  158. package/vscode/src/vs/sessions/contrib/chatDebug/browser/chatDebug.contribution.js +84 -0
  159. package/vscode/src/vs/sessions/contrib/customViewTest/browser/customViewTest.contribution.d.ts +1 -0
  160. package/vscode/src/vs/sessions/contrib/customViewTest/browser/customViewTest.contribution.js +111 -0
  161. package/vscode/src/vs/sessions/contrib/customViewTest/browser/media/customViewTest.css +9 -0
  162. package/vscode/src/vs/sessions/contrib/editor/browser/addTabActions.d.ts +21 -0
  163. package/vscode/src/vs/sessions/contrib/editor/browser/addTabActions.js +170 -0
  164. package/vscode/src/vs/sessions/contrib/editor/browser/editor.contribution.d.ts +14 -0
  165. package/vscode/src/vs/sessions/contrib/editor/browser/editor.contribution.js +425 -0
  166. package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.contribution.d.ts +1 -0
  167. package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.contribution.js +35 -0
  168. package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.d.ts +18 -0
  169. package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditor.js +85 -0
  170. package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditorInput.d.ts +31 -0
  171. package/vscode/src/vs/sessions/contrib/editor/browser/emptyFileEditorInput.js +125 -0
  172. package/vscode/src/vs/sessions/contrib/editor/browser/media/editorBreadcrumbs.css +66 -0
  173. package/vscode/src/vs/sessions/contrib/editor/browser/media/editorHeader.css +113 -0
  174. package/vscode/src/vs/sessions/contrib/editor/browser/media/emptyFileEditor.css +30 -0
  175. package/vscode/src/vs/sessions/contrib/fileTreeView/browser/fileTreeView.contribution.d.ts +1 -0
  176. package/vscode/src/vs/sessions/contrib/fileTreeView/browser/fileTreeView.contribution.js +25 -0
  177. package/vscode/src/vs/sessions/contrib/fileTreeView/browser/githubFileSystemProvider.d.ts +66 -0
  178. package/vscode/src/vs/sessions/contrib/fileTreeView/browser/githubFileSystemProvider.js +274 -0
  179. package/vscode/src/vs/sessions/contrib/files/browser/files.contribution.d.ts +6 -0
  180. package/vscode/src/vs/sessions/contrib/files/browser/files.contribution.js +100 -0
  181. package/vscode/src/vs/sessions/contrib/files/browser/filesView.d.ts +21 -0
  182. package/vscode/src/vs/sessions/contrib/files/browser/filesView.js +76 -0
  183. package/vscode/src/vs/sessions/contrib/files/browser/media/filesView.css +29 -0
  184. package/vscode/src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.d.ts +211 -0
  185. package/vscode/src/vs/sessions/contrib/layout/browser/baseSessionLayoutController.js +587 -0
  186. package/vscode/src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.d.ts +112 -0
  187. package/vscode/src/vs/sessions/contrib/layout/browser/desktopSessionLayoutController.js +444 -0
  188. package/vscode/src/vs/sessions/contrib/layout/browser/mobileSessionLayoutController.d.ts +13 -0
  189. package/vscode/src/vs/sessions/contrib/layout/browser/mobileSessionLayoutController.js +8 -0
  190. package/vscode/src/vs/sessions/contrib/layout/browser/sessions.layout.contribution.d.ts +1 -0
  191. package/vscode/src/vs/sessions/contrib/layout/browser/sessions.layout.contribution.js +68 -0
  192. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDetailPanelCoordinator.d.ts +32 -0
  193. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDetailPanelCoordinator.js +81 -0
  194. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDockedTabsCoordinator.d.ts +111 -0
  195. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDockedTabsCoordinator.js +513 -0
  196. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDraftSessionStrategy.d.ts +44 -0
  197. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneDraftSessionStrategy.js +423 -0
  198. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneExistingSessionStrategy.d.ts +62 -0
  199. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneExistingSessionStrategy.js +435 -0
  200. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneLayoutStrategy.d.ts +46 -0
  201. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneLayoutStrategy.js +11 -0
  202. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneSharedHelpers.d.ts +11 -0
  203. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneSharedHelpers.js +43 -0
  204. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneVisibilityProfileStore.d.ts +21 -0
  205. package/vscode/src/vs/sessions/contrib/layout/browser/singlePane/singlePaneVisibilityProfileStore.js +77 -0
  206. package/vscode/src/vs/sessions/contrib/layout/browser/singlePaneLayoutController.d.ts +55 -0
  207. package/vscode/src/vs/sessions/contrib/layout/browser/singlePaneLayoutController.js +91 -0
  208. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/agentHostReadinessContext.d.ts +11 -0
  209. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/agentHostReadinessContext.js +39 -0
  210. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionTourContribution.d.ts +1 -0
  211. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionTourContribution.js +109 -0
  212. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourContribution.d.ts +1 -0
  213. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourContribution.js +123 -0
  214. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourTrigger.d.ts +24 -0
  215. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewTourTrigger.js +67 -0
  216. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV2TourContribution.d.ts +1 -0
  217. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV2TourContribution.js +47 -0
  218. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3Prompt.d.ts +79 -0
  219. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3Prompt.js +1277 -0
  220. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3TourContribution.d.ts +1 -0
  221. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/newSessionViewV3TourContribution.js +75 -0
  222. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionTour.d.ts +34 -0
  223. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionTour.js +53 -0
  224. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTour.d.ts +40 -0
  225. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTour.js +69 -0
  226. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTourShared.d.ts +4 -0
  227. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewTourShared.js +38 -0
  228. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV2Tour.d.ts +6 -0
  229. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV2Tour.js +63 -0
  230. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV3Tour.d.ts +15 -0
  231. package/vscode/src/vs/sessions/contrib/onboardingTours/browser/tours/newSessionViewV3Tour.js +49 -0
  232. package/vscode/src/vs/sessions/contrib/policyBlocked/browser/media/sessionsPolicyBlocked.css +125 -0
  233. package/vscode/src/vs/sessions/contrib/policyBlocked/browser/policyBlocked.contribution.d.ts +20 -0
  234. package/vscode/src/vs/sessions/contrib/policyBlocked/browser/policyBlocked.contribution.js +98 -0
  235. package/vscode/src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.d.ts +39 -0
  236. package/vscode/src/vs/sessions/contrib/policyBlocked/browser/sessionsPolicyBlocked.js +218 -0
  237. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/devContainerAgentHostService.d.ts +53 -0
  238. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/devContainerAgentHostService.js +496 -0
  239. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostConnectionCustomization.d.ts +27 -0
  240. package/vscode/src/vs/sessions/contrib/providers/remoteAgentHost/browser/remoteAgentHostConnectionCustomization.js +26 -0
  241. package/vscode/src/vs/sessions/contrib/search/browser/media/searchEditorEmptyState.css +15 -0
  242. package/vscode/src/vs/sessions/contrib/search/browser/search.contribution.d.ts +1 -0
  243. package/vscode/src/vs/sessions/contrib/search/browser/search.contribution.js +79 -0
  244. package/vscode/src/vs/sessions/contrib/search/browser/searchEditorEmptyState.contribution.d.ts +7 -0
  245. package/vscode/src/vs/sessions/contrib/search/browser/searchEditorEmptyState.contribution.js +57 -0
  246. package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsCIFixModel.d.ts +39 -0
  247. package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsCIFixModel.js +155 -0
  248. package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsIndicatorModel.d.ts +117 -0
  249. package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsIndicatorModel.js +320 -0
  250. package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsList.d.ts +65 -0
  251. package/vscode/src/vs/sessions/contrib/sessions/browser/blockedSessionsList.js +129 -0
  252. package/vscode/src/vs/sessions/contrib/sessions/browser/media/automationsCards.css +624 -0
  253. package/vscode/src/vs/sessions/contrib/sessions/browser/media/blockedSessionsList.css +111 -0
  254. package/vscode/src/vs/sessions/contrib/sessions/browser/media/newSessionActionViewItem.css +112 -0
  255. package/vscode/src/vs/sessions/contrib/sessions/browser/media/sessionsTitleBarWidget.css +159 -0
  256. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionActionFeedback.d.ts +26 -0
  257. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionActionFeedback.js +26 -0
  258. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionDetailsAction.d.ts +2 -0
  259. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionDetailsAction.js +77 -0
  260. package/vscode/src/vs/sessions/contrib/sessions/browser/sessions.contribution.d.ts +1 -0
  261. package/vscode/src/vs/sessions/contrib/sessions/browser/sessions.contribution.js +162 -0
  262. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsActions.d.ts +111 -0
  263. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsActions.js +1550 -0
  264. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsMouseNavigation.d.ts +13 -0
  265. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsMouseNavigation.js +69 -0
  266. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsPicker.d.ts +10 -0
  267. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsPicker.js +33 -0
  268. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTelemetry.contribution.d.ts +126 -0
  269. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTelemetry.contribution.js +724 -0
  270. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.d.ts +150 -0
  271. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTitleBarWidget.js +526 -0
  272. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTypedCharactersTracker.d.ts +64 -0
  273. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsTypedCharactersTracker.js +99 -0
  274. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsWindowNotifier.d.ts +37 -0
  275. package/vscode/src/vs/sessions/contrib/sessions/browser/sessionsWindowNotifier.js +160 -0
  276. package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationTemplates.d.ts +19 -0
  277. package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationTemplates.js +74 -0
  278. package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsAccessibility.d.ts +4 -0
  279. package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsAccessibility.js +228 -0
  280. package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsView.d.ts +53 -0
  281. package/vscode/src/vs/sessions/contrib/sessions/browser/views/automationsView.js +2143 -0
  282. package/vscode/src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.d.ts +12 -0
  283. package/vscode/src/vs/sessions/contrib/sessions/browser/views/sessionsViewActions.js +1270 -0
  284. package/vscode/src/vs/sessions/contrib/workspace/browser/workspace.contribution.d.ts +1 -0
  285. package/vscode/src/vs/sessions/contrib/workspace/browser/workspace.contribution.js +5 -0
  286. package/vscode/src/vs/sessions/contrib/workspace/browser/workspaceFolderManagement.d.ts +28 -0
  287. package/vscode/src/vs/sessions/contrib/workspace/browser/workspaceFolderManagement.js +95 -0
  288. package/vscode/src/vs/sessions/services/agentHostFilter/browser/agentHostFilterService.d.ts +79 -0
  289. package/vscode/src/vs/sessions/services/agentHostFilter/browser/agentHostFilterService.js +259 -0
  290. package/vscode/src/vs/sessions/services/customView/browser/customView.d.ts +42 -0
  291. package/vscode/src/vs/sessions/services/customView/browser/customView.js +15 -0
  292. package/vscode/src/vs/sessions/services/customView/browser/customViewService.d.ts +21 -0
  293. package/vscode/src/vs/sessions/services/customView/browser/customViewService.js +68 -0
  294. package/vscode/src/vs/sessions/services/sessions/browser/closedItemHistory.d.ts +72 -0
  295. package/vscode/src/vs/sessions/services/sessions/browser/closedItemHistory.js +115 -0
  296. package/vscode/src/vs/sessions/services/sessions/browser/sessionGroupsService.d.ts +77 -0
  297. package/vscode/src/vs/sessions/services/sessions/browser/sessionGroupsService.js +330 -0
  298. package/vscode/src/vs/sessions/services/sessions/browser/sessionNavigation.d.ts +67 -0
  299. package/vscode/src/vs/sessions/services/sessions/browser/sessionNavigation.js +157 -0
  300. package/vscode/src/vs/sessions/services/sessions/browser/sessionOpenTelemetryService.d.ts +32 -0
  301. package/vscode/src/vs/sessions/services/sessions/browser/sessionOpenTelemetryService.js +162 -0
  302. package/vscode/src/vs/sessions/services/sessions/browser/sessionSectionOrderService.d.ts +40 -0
  303. package/vscode/src/vs/sessions/services/sessions/browser/sessionSectionOrderService.js +170 -0
  304. package/vscode/src/vs/sessions/services/sessions/browser/sessionsListModelService.d.ts +63 -0
  305. package/vscode/src/vs/sessions/services/sessions/browser/sessionsListModelService.js +419 -0
  306. package/vscode/src/vs/sessions/services/sessions/browser/sessionsManagementService.d.ts +229 -0
  307. package/vscode/src/vs/sessions/services/sessions/browser/sessionsManagementService.js +1212 -0
  308. package/vscode/src/vs/sessions/services/sessions/browser/sessionsProvidersService.d.ts +22 -0
  309. package/vscode/src/vs/sessions/services/sessions/browser/sessionsProvidersService.js +42 -0
  310. package/vscode/src/vs/sessions/services/sessions/browser/sessionsRecencyHistory.d.ts +43 -0
  311. package/vscode/src/vs/sessions/services/sessions/browser/sessionsRecencyHistory.js +103 -0
  312. package/vscode/src/vs/sessions/services/sessions/browser/sessionsService.d.ts +243 -0
  313. package/vscode/src/vs/sessions/services/sessions/browser/sessionsService.js +1121 -0
  314. package/vscode/src/vs/sessions/services/sessions/browser/sessionsWindowUsageService.d.ts +8 -0
  315. package/vscode/src/vs/sessions/services/sessions/browser/sessionsWindowUsageService.js +24 -0
  316. package/vscode/src/vs/sessions/services/sessions/browser/visibleSessions.d.ts +321 -0
  317. package/vscode/src/vs/sessions/services/sessions/browser/visibleSessions.js +729 -0
  318. package/vscode/src/vs/sessions/services/sessions/browser/worktreeTrust.d.ts +23 -0
  319. package/vscode/src/vs/sessions/services/sessions/browser/worktreeTrust.js +23 -0
  320. package/vscode/src/vs/sessions/services/sessions/common/sessionContextKeys.d.ts +32 -0
  321. package/vscode/src/vs/sessions/services/sessions/common/sessionContextKeys.js +103 -0
  322. package/vscode/src/vs/sessions/services/workspaceFolderLabel/browser/workspaceFolderLabelService.d.ts +16 -0
  323. package/vscode/src/vs/sessions/services/workspaceFolderLabel/browser/workspaceFolderLabelService.js +41 -0
  324. package/vscode/src/vs/workbench/browser/layout.js +7 -7
  325. package/vscode/src/vs/workbench/browser/workbench.js +3 -3
@@ -0,0 +1,2143 @@
1
+
2
+ import { registerCss } from '@codingame/monaco-vscode-api/css';
3
+ import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
4
+ import * as automationsCards from '../media/automationsCards.css';
5
+ import './automationsAccessibility.js';
6
+ import { $ as $$1, trackFocus, append, DragAndDropObserver, addDisposableListener, EventType, isHTMLElement, getWindow, EventHelper, getActiveElement, isActiveElement, isAncestor, clearNode, isAncestorOfActiveElement, reset } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
7
+ import { VSBuffer } from '@codingame/monaco-vscode-api/vscode/vs/base/common/buffer';
8
+ import { ButtonBar, Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
9
+ import { getDefaultHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
10
+ import { defaultButtonStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
11
+ import { disposableTimeout } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
12
+ import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
13
+ import { Disposable, toDisposable, DisposableStore, MutableDisposable, DisposableMap, combinedDisposable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
14
+ import '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/index';
15
+ import { ThemeIcon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/themables';
16
+ import { generateUuid } from '@codingame/monaco-vscode-api/vscode/vs/base/common/uuid';
17
+ import { localize, localize2 } from '@codingame/monaco-vscode-api/vscode/vs/nls';
18
+ import { IInstantiationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/instantiation';
19
+ import { IHoverService } from '@codingame/monaco-vscode-api/vscode/vs/platform/hover/browser/hover.service';
20
+ import { IUriIdentityService } from '@codingame/monaco-vscode-api/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
21
+ import { IAutomationService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/automationService.service';
22
+ import { CHAT_AUTOMATIONS_ENABLED_SETTING, ChatAutomationsEnabledContext } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/automationsEnabled';
23
+ import { IAutomationRunner } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/automationRunner.service';
24
+ import { IAutomationDialogService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/automationDialogService.service';
25
+ import { AutomationBlueprintParseError, AUTOMATION_BLUEPRINT_FILE_SUFFIX, parseAutomationBlueprint, createAutomationBlueprintFileName, serializeAutomationBlueprint, automationToBlueprint } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/automationBlueprint';
26
+ import { DAYS_OF_WEEK } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/automations/schedule';
27
+ import { IAgentPluginService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/plugins/agentPluginService.service';
28
+ import { AgentSessionApprovalModel } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/browser/agentSessions/agentSessionApprovalModel';
29
+ import { isEqual, basename, joinPath, dirname } from '@codingame/monaco-vscode-api/vscode/vs/base/common/resources';
30
+ import { CancellationToken } from '@codingame/monaco-vscode-api/vscode/vs/base/common/cancellation';
31
+ import { ILogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/log/common/log.service';
32
+ import { IDialogService, IFileDialogService } from '@codingame/monaco-vscode-api/vscode/vs/platform/dialogs/common/dialogs.service';
33
+ import { IFileService } from '@codingame/monaco-vscode-api/vscode/vs/platform/files/common/files.service';
34
+ import { StorageScope, StorageTarget } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage';
35
+ import { IStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/storage/common/storage.service';
36
+ import { IConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/platform/configuration/common/configuration.service';
37
+ import { RawContextKey, ContextKeyExpr } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey';
38
+ import { IContextKeyService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextkey/common/contextkey.service';
39
+ import { IContextMenuService } from '@codingame/monaco-vscode-api/vscode/vs/platform/contextview/browser/contextView.service';
40
+ import { status } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/aria/aria';
41
+ import { Gesture, EventType as EventType$1 } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/touch';
42
+ import { extractEditorsDropData } from '@codingame/monaco-vscode-api/vscode/vs/platform/dnd/browser/dnd';
43
+ import { ISessionsService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/browser/sessionsService.service';
44
+ import { ISessionsManagementService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/common/sessionsManagement.service';
45
+ import { SessionStatus } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/sessions/common/session';
46
+ import { SessionStatusIcon } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/sessionStatusIcon';
47
+ import { AbstractCustomView } from '../../../../services/customView/browser/customView.js';
48
+ import { ICustomViewService } from '@codingame/monaco-vscode-api/vscode/vs/sessions/services/customView/browser/customViewService.service';
49
+ import { SyncDescriptor } from '@codingame/monaco-vscode-api/vscode/vs/platform/instantiation/common/descriptors';
50
+ import { Menus } from '@codingame/monaco-vscode-api/vscode/vs/sessions/browser/menus';
51
+ import { MenuItemAction, MenuRegistry, registerAction2, Action2 } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/common/actions';
52
+ import { IActionViewItemService } from '@codingame/monaco-vscode-api/vscode/vs/platform/actions/browser/actionViewItemService.service';
53
+ import { getChatSessionArchiveActionWording, ChatSessionArchiveActionWordingSettingId, getChatSessionArchiveActionPresentation } from '@codingame/monaco-vscode-api/vscode/vs/platform/chat/common/sessionArchiveActions';
54
+ import { BaseActionViewItem } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/actionbar/actionViewItems';
55
+ import { AutomationsCustomViewFocusContext, AutomationsHasItemsContext, SessionIsReadContext, SessionIsArchivedContext, SessionSupportsRenameContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/common/contextkeys';
56
+ import { SessionsFlatList, SessionItemStatusContext } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/sessions/browser/views/sessionsList';
57
+ import { AUTOMATIONS_CUSTOM_VIEW_ID } from '@codingame/monaco-vscode-api/vscode/vs/sessions/contrib/sessions/browser/automationsConstants';
58
+ import { ARCHIVE_SESSION_COMMAND_ID, MARK_SESSION_READ_COMMAND_ID, MARK_SESSION_UNREAD_COMMAND_ID, RENAME_SESSION_COMMAND_ID, UNARCHIVE_SESSION_COMMAND_ID } from '@codingame/monaco-vscode-api/vscode/vs/sessions/common/sessionCommands';
59
+ import { readAutomationTemplates } from './automationTemplates.js';
60
+ import { autorun } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/reactions/autorun';
61
+ import { constObservable } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/constObservable';
62
+ import { observableValue } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableValue';
63
+ import { observableSignalFromEvent } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/observables/observableSignalFromEvent';
64
+ import { transaction } from '@codingame/monaco-vscode-api/vscode/vs/base/common/observableInternal/transaction';
65
+
66
+ registerCss(automationsCards, 1);
67
+ const $ = $$1;
68
+ const STOP_AUTOMATION_RUN_SESSION_COMMAND_ID = "sessions.automations.stopRunSession";
69
+ const SEEN_PLUGIN_AUTOMATION_TEMPLATES_STORAGE_KEY = "sessions.automations.seenPluginTemplateIds";
70
+ const AutomationCardCanDeleteContext = new RawContextKey("sessionsAutomationCardCanDelete", false);
71
+ const AutomationCardCanUpdateContext = new RawContextKey("sessionsAutomationCardCanUpdate", false);
72
+ const AutomationCardEnabledContext = new RawContextKey("sessionsAutomationCardEnabled", false);
73
+ function areAutomationTemplatesEqual(first, second) {
74
+ return first.length === second.length && first.every((template, index) => {
75
+ const other = second[index];
76
+ return template.id === other.id && template.name === other.name && template.description === other.description && template.prompt === other.prompt && template.enabled === other.enabled && template.schedule.interval === other.schedule.interval && template.schedule.scheduleHour === other.schedule.scheduleHour && template.schedule.scheduleMinute === other.schedule.scheduleMinute && template.schedule.scheduleDay === other.schedule.scheduleDay && template.source?.label === other.source?.label && ((!template.source && !other.source) || (!!template.source && !!other.source && isEqual(template.source.uri, other.source.uri)));
77
+ });
78
+ }
79
+ function setsEqual(first, second) {
80
+ return first.size === second.size && [...first].every(value => ( second.has(value)));
81
+ }
82
+ let AutomationsCardsWidget = class AutomationsCardsWidget extends Disposable {
83
+ constructor(
84
+ automationService,
85
+ agentPluginService,
86
+ sessionsManagementService,
87
+ instantiationService,
88
+ contextKeyService,
89
+ uriIdentityService
90
+ ) {
91
+ super();
92
+ this.automationService = automationService;
93
+ this.agentPluginService = agentPluginService;
94
+ this.sessionsManagementService = sessionsManagementService;
95
+ this.uriIdentityService = uriIdentityService;
96
+ this.isMarkingAllRead = observableValue(this, false);
97
+ this.element = $(".automations-cards-widget");
98
+ this.element.tabIndex = -1;
99
+ const focusContext = AutomationsCustomViewFocusContext.bindTo(contextKeyService);
100
+ const focusTracker = this._register(trackFocus(this.element));
101
+ this._register(focusTracker.onDidFocus(() => focusContext.set(true)));
102
+ this._register(focusTracker.onDidBlur(() => focusContext.set(false)));
103
+ this._register(toDisposable(() => focusContext.reset()));
104
+ const scrollContent = append(this.element, $(".automations-cards-scroll-content"));
105
+ this.cardsSection = this._register(
106
+ instantiationService.createInstance(AutomationCardsSection, scrollContent, this.element)
107
+ );
108
+ this.historySection = this._register(instantiationService.createInstance(
109
+ AutomationHistorySection,
110
+ scrollContent,
111
+ this.element,
112
+ this.isMarkingAllRead
113
+ ));
114
+ this._register(autorun(reader => {
115
+ const catalogueState = this.automationService.catalogueState.read(reader);
116
+ const items = this.automationService.automations.read(reader);
117
+ const templates = readAutomationTemplates(this.agentPluginService.plugins.read(reader), reader);
118
+ this.cardsSection.render(items, catalogueState, templates);
119
+ }));
120
+ const sessionDeleted = observableSignalFromEvent(this, this.sessionsManagementService.onDidDeleteSession);
121
+ const sessionsChanged = observableSignalFromEvent(this, this.sessionsManagementService.onDidChangeSessions);
122
+ this._register(autorun(reader => {
123
+ if (this.isMarkingAllRead.read(reader)) {
124
+ return;
125
+ }
126
+ sessionDeleted.read(reader);
127
+ sessionsChanged.read(reader);
128
+ this.automationService.automations.read(reader);
129
+ const allRuns = this.automationService.runs.read(reader);
130
+ const sessionsByResource = ( new Map(this.sessionsManagementService.getSessions().map(
131
+ session => [this.uriIdentityService.extUri.getComparisonKey(session.resource), session]
132
+ )));
133
+ const sessions = ( new Map());
134
+ for (const run of allRuns) {
135
+ if (!run.sessionResource) {
136
+ continue;
137
+ }
138
+ const session = sessionsByResource.get(this.uriIdentityService.extUri.getComparisonKey(run.sessionResource));
139
+ if (session) {
140
+ sessions.set(run.id, session);
141
+ }
142
+ }
143
+ this.historySection.render(allRuns, sessions);
144
+ }));
145
+ }
146
+ layout(width, height) {
147
+ this.element.style.width = `${width}px`;
148
+ this.historySection.layout();
149
+ }
150
+ focus() {
151
+ this.element.focus();
152
+ }
153
+ };
154
+ AutomationsCardsWidget = ( __decorate([( __param(0, IAutomationService)), ( __param(1, IAgentPluginService)), ( __param(2, ISessionsManagementService)), ( __param(3, IInstantiationService)), ( __param(4, IContextKeyService)), ( __param(5, IUriIdentityService))], AutomationsCardsWidget));
155
+ let AutomationCardsSection = class AutomationCardsSection extends Disposable {
156
+ constructor(
157
+ parent,
158
+ focusRoot,
159
+ automationService,
160
+ automationRunner,
161
+ automationDialogService,
162
+ hoverService,
163
+ logService,
164
+ dialogService,
165
+ fileService,
166
+ storageService,
167
+ configurationService,
168
+ contextKeyService,
169
+ contextMenuService
170
+ ) {
171
+ super();
172
+ this.focusRoot = focusRoot;
173
+ this.automationService = automationService;
174
+ this.automationRunner = automationRunner;
175
+ this.automationDialogService = automationDialogService;
176
+ this.hoverService = hoverService;
177
+ this.logService = logService;
178
+ this.dialogService = dialogService;
179
+ this.fileService = fileService;
180
+ this.storageService = storageService;
181
+ this.configurationService = configurationService;
182
+ this.contextKeyService = contextKeyService;
183
+ this.contextMenuService = contextMenuService;
184
+ this.persistentCards = ( new Map());
185
+ this.latestAutomations = ( new Map());
186
+ this.emptyStateDisposables = this._register(( new DisposableStore()));
187
+ this.templateDisposables = this._register(( new DisposableStore()));
188
+ this.stateDisposables = this._register(( new DisposableStore()));
189
+ this.templateAriaId = generateUuid();
190
+ this.emptyStateRendered = false;
191
+ this.renderedTemplates = [];
192
+ this.builtInTemplatesUserToggled = false;
193
+ this.pluginTemplatesUserToggled = false;
194
+ this.currentPluginTemplateIds = ( new Set());
195
+ this.partialState = "ready";
196
+ this.focusRequestGeneration = 0;
197
+ this.seenPluginTemplateIds = this.readSeenPluginTemplateIds();
198
+ this._register(this.storageService.onDidChangeValue(
199
+ StorageScope.PROFILE,
200
+ SEEN_PLUGIN_AUTOMATION_TEMPLATES_STORAGE_KEY,
201
+ this._store
202
+ )(() => {
203
+ this.seenPluginTemplateIds = this.readSeenPluginTemplateIds();
204
+ this.updatePluginTemplateUnreadState(false);
205
+ }));
206
+ this.partialStateContainer = append(parent, $(".automations-cards-partial-state"));
207
+ this.partialStateContainer.setAttribute("role", "status");
208
+ this.partialStateContainer.setAttribute("aria-live", "polite");
209
+ this.partialStateContainer.style.display = "none";
210
+ this.partialLoadingIcon = append(this.partialStateContainer, $("span.automations-cards-partial-state-icon"));
211
+ this.partialLoadingIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), "codicon-modifier-spin");
212
+ this.partialLoadingIcon.setAttribute("aria-hidden", "true");
213
+ this.partialErrorIcon = append(this.partialStateContainer, $("span.automations-cards-partial-state-icon"));
214
+ this.partialErrorIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.warning));
215
+ this.partialErrorIcon.setAttribute("aria-hidden", "true");
216
+ this.partialStateMessage = append(
217
+ this.partialStateContainer,
218
+ $("span.automations-cards-partial-state-message")
219
+ );
220
+ this.container = append(parent, $(".automations-cards-grid"));
221
+ this.container.style.display = "none";
222
+ this.emptyContainer = append(parent, $(".automations-cards-empty"));
223
+ this.emptyContainer.style.display = "none";
224
+ this.loadingContainer = append(parent, $(".automations-cards-state.automations-cards-loading"));
225
+ this.loadingContainer.style.display = "none";
226
+ this.loadingCreateButton = this.renderLoadingState();
227
+ this.unavailableContainer = append(parent, $(".automations-cards-state.automations-cards-unavailable"));
228
+ this.unavailableContainer.style.display = "none";
229
+ this.unavailableCreateButton = this.renderUnavailableState();
230
+ this.errorContainer = append(parent, $(".automations-cards-state.automations-cards-error"));
231
+ this.errorContainer.style.display = "none";
232
+ this.errorCreateButton = this.renderErrorState();
233
+ this.templatesContainer = append(parent, $(".automations-templates"));
234
+ this.templatesContainer.style.display = "none";
235
+ this.dropOverlay = append(this.focusRoot, $(".automations-drop-overlay"));
236
+ this.dropOverlay.setAttribute("role", "status");
237
+ this.dropOverlay.setAttribute("aria-live", "polite");
238
+ const dropIcon = append(this.dropOverlay, $("span.automations-drop-overlay-icon"));
239
+ dropIcon.classList.add(...ThemeIcon.asClassNameArray(Codicon.cloudUpload));
240
+ dropIcon.setAttribute("aria-hidden", "true");
241
+ const dropTitle = append(this.dropOverlay, $("span.automations-drop-overlay-title"));
242
+ dropTitle.textContent = ( localize(4660, "Drop to import automation"));
243
+ const dropDescription = append(this.dropOverlay, $("span.automations-drop-overlay-description"));
244
+ dropDescription.textContent = ( localize(4661, "You can review the Automation before creating it."));
245
+ this._register(new DragAndDropObserver(this.focusRoot, {
246
+ onDragEnter: event => this.updateDropOverlay(event),
247
+ onDragOver: event => this.updateDropOverlay(event),
248
+ onDragLeave: () => this.hideDropOverlay(),
249
+ onDragEnd: () => this.hideDropOverlay(),
250
+ onDrop: event => this.handleDrop(event)
251
+ }));
252
+ const focusTracker = this._register(trackFocus(this.focusRoot));
253
+ this._register(focusTracker.onDidBlur(() => this.clearPendingFocus()));
254
+ this._register(
255
+ addDisposableListener(this.focusRoot, EventType.FOCUS_OUT, event => {
256
+ if (event.relatedTarget && (!isHTMLElement(event.relatedTarget) || !this.focusRoot.contains(event.relatedTarget))) {
257
+ this.clearPendingFocus();
258
+ }
259
+ })
260
+ );
261
+ this._register(addDisposableListener(
262
+ getWindow(this.focusRoot),
263
+ EventType.BLUR,
264
+ () => this.clearPendingFocus()
265
+ ));
266
+ this._register(
267
+ addDisposableListener(this.focusRoot, EventType.MOUSE_DOWN, () => this.clearPendingFocus())
268
+ );
269
+ this._register(
270
+ addDisposableListener(this.focusRoot, EventType.KEY_DOWN, () => this.clearPendingFocus())
271
+ );
272
+ this._register(toDisposable(() => {
273
+ this.clearPendingFocus();
274
+ for (const card of ( this.persistentCards.values())) {
275
+ card.disposables.dispose();
276
+ card.element.remove();
277
+ }
278
+ this.persistentCards.clear();
279
+ this.latestAutomations.clear();
280
+ }));
281
+ }
282
+ updateDropOverlay(event) {
283
+ const dropData = getAutomationDropData(event);
284
+ const canImport = dropData.kind === "resource" || dropData.kind === "file";
285
+ this.dropOverlay.classList.toggle("visible", canImport);
286
+ if (canImport && event.dataTransfer) {
287
+ event.dataTransfer.dropEffect = "copy";
288
+ }
289
+ }
290
+ hideDropOverlay() {
291
+ this.dropOverlay.classList.remove("visible");
292
+ }
293
+ handleDrop(event) {
294
+ const dropData = getAutomationDropData(event);
295
+ this.hideDropOverlay();
296
+ if (dropData.kind === "none") {
297
+ return;
298
+ }
299
+ EventHelper.stop(event, true);
300
+ if (dropData.kind === "invalid") {
301
+ const detail = dropData.reason === "multiple" ? ( localize(4662, "Drop one Automation blueprint file at a time.")) : ( localize(4663, "Only .automation.md files can be imported."));
302
+ void this.dialogService.error(( localize(4664, "Unable to import automation.")), detail);
303
+ return;
304
+ }
305
+ const readContent = dropData.kind === "resource" ? async () => ( (await this.fileService.readFile(dropData.resource)).value.toString()) : async () => ( VSBuffer.wrap(( new Uint8Array(await dropData.file.arrayBuffer()))).toString());
306
+ void importAutomationBlueprint(
307
+ readContent,
308
+ this.automationDialogService,
309
+ this.automationService,
310
+ this.configurationService,
311
+ this.dialogService,
312
+ this.logService
313
+ );
314
+ }
315
+ render(automations, catalogueState, templates) {
316
+ const activeElement = getActiveElement();
317
+ const contentOwnedFocus = isHTMLElement(activeElement) && (this.visibleContainer?.contains(activeElement) || this.templatesContainer.contains(activeElement));
318
+ const activeAutomationIds = ( new Set(automations.map(automation => automation.id)));
319
+ for (const [automationId, card] of this.persistentCards) {
320
+ if (( activeAutomationIds.has(automationId))) {
321
+ continue;
322
+ }
323
+ card.disposables.dispose();
324
+ card.element.remove();
325
+ this.persistentCards.delete(automationId);
326
+ this.latestAutomations.delete(automationId);
327
+ }
328
+ let index = 0;
329
+ for (const automation of automations) {
330
+ const prev = this.latestAutomations.get(automation.id);
331
+ this.latestAutomations.set(automation.id, automation);
332
+ let card = this.persistentCards.get(automation.id);
333
+ if (!card) {
334
+ card = this.renderCard(automation);
335
+ this.persistentCards.set(automation.id, card);
336
+ } else if (prev !== automation) {
337
+ this.updateCard(card, automation, prev);
338
+ }
339
+ const currentElement = this.container.children.item(index);
340
+ if (currentElement !== card.element) {
341
+ this.container.insertBefore(card.element, currentElement);
342
+ }
343
+ index++;
344
+ }
345
+ if (!this.builtInTemplatesUserToggled) {
346
+ const defaultExpanded = automations.length === 0;
347
+ if (this.builtInTemplatesExpanded !== defaultExpanded) {
348
+ this.builtInTemplatesExpanded = defaultExpanded;
349
+ if (this.builtInTemplatesSection) {
350
+ this.builtInTemplatesSection.open = defaultExpanded;
351
+ }
352
+ }
353
+ }
354
+ if (!this.pluginTemplatesUserToggled) {
355
+ const defaultExpanded = automations.length === 0;
356
+ if (this.pluginTemplatesExpanded !== defaultExpanded) {
357
+ this.pluginTemplatesExpanded = defaultExpanded;
358
+ if (this.pluginTemplatesSection) {
359
+ this.pluginTemplatesSection.open = defaultExpanded;
360
+ }
361
+ }
362
+ }
363
+ if (!areAutomationTemplatesEqual(this.renderedTemplates, templates)) {
364
+ this.renderTemplates(templates);
365
+ this.renderedTemplates = templates;
366
+ }
367
+ this.updatePluginTemplateUnreadState(
368
+ this.pluginTemplatesUserToggled || (catalogueState === "ready" && automations.length === 0)
369
+ );
370
+ const showTemplateSections = templates.length > 0;
371
+ this.templatesContainer.style.display = showTemplateSections ? "" : "none";
372
+ const nextContainer = automations.length === 0 ? this.getEmptyStateContainer(catalogueState) : this.container;
373
+ const previousContainer = this.visibleContainer;
374
+ if (previousContainer !== nextContainer) {
375
+ nextContainer.style.display = "";
376
+ this.visibleContainer = nextContainer;
377
+ }
378
+ this.renderPartialState(automations.length > 0 ? catalogueState : "ready");
379
+ if (!this.focusPendingAutomation() && contentOwnedFocus && isHTMLElement(activeElement)) {
380
+ if (!nextContainer.contains(activeElement) && !(showTemplateSections && this.isVisibleTemplateElement(activeElement))) {
381
+ this.focusVisibleState(automations, catalogueState);
382
+ } else if (!isActiveElement(activeElement)) {
383
+ activeElement.focus();
384
+ }
385
+ }
386
+ if (previousContainer && previousContainer !== nextContainer) {
387
+ previousContainer.style.display = "none";
388
+ }
389
+ }
390
+ isVisibleTemplateElement(element) {
391
+ if (!this.templatesContainer.contains(element)) {
392
+ return false;
393
+ }
394
+ const section = element.closest("details.automations-template-section");
395
+ const summary = element.closest("summary");
396
+ return !section || section.open || summary?.parentElement === section;
397
+ }
398
+ getEmptyStateContainer(catalogueState) {
399
+ switch (catalogueState) {
400
+ case "loading":
401
+ return this.loadingContainer;
402
+ case "unavailable":
403
+ return this.unavailableContainer;
404
+ case "error":
405
+ return this.errorContainer;
406
+ case "ready":
407
+ if (!this.emptyStateRendered) {
408
+ this.renderEmptyState();
409
+ this.emptyStateRendered = true;
410
+ }
411
+ return this.emptyContainer;
412
+ }
413
+ }
414
+ renderCard(automation) {
415
+ const disposables = ( new DisposableStore());
416
+ const wrapper = $(".automations-card-wrapper");
417
+ const card = append(wrapper, $(".automations-card"));
418
+ card.setAttribute("role", "group");
419
+ const cardContextKeyService = disposables.add(this.contextKeyService.createScoped(card));
420
+ const canDeleteContext = AutomationCardCanDeleteContext.bindTo(cardContextKeyService);
421
+ const canUpdateContext = AutomationCardCanUpdateContext.bindTo(cardContextKeyService);
422
+ const enabledContext = AutomationCardEnabledContext.bindTo(cardContextKeyService);
423
+ disposables.add(Gesture.addTarget(card));
424
+ const main = append(card, $("button.automations-card-main", {
425
+ type: "button"
426
+ }));
427
+ const nameRow = append(main, $(".automations-card-name"));
428
+ const nameTextEl = append(nameRow, $("span.automations-card-name-text"));
429
+ const disabledBadge = append(nameRow, $("span.automations-card-disabled-badge"));
430
+ disabledBadge.textContent = ( localize(4665, "Disabled"));
431
+ const metaEl = append(main, $(".automations-card-meta"));
432
+ const scheduleEl = append(metaEl, $("span.automations-card-meta-item.automations-card-schedule"));
433
+ const folderEl = append(metaEl, $("span.automations-card-meta-item.automations-card-folder"));
434
+ const folderHover = disposables.add(( new MutableDisposable()));
435
+ const promptEl = append(main, $(".automations-card-prompt"));
436
+ const actions = append(card, $(".automations-card-actions"));
437
+ actions.setAttribute("role", "group");
438
+ const buttonBar = disposables.add(( new ButtonBar(actions)));
439
+ const runNowLabel = ( localize(4666, "Run now"));
440
+ const runningLabel = ( localize(4667, "Running"));
441
+ const runBtn = this.createIconButton(
442
+ buttonBar,
443
+ Codicon.play,
444
+ runNowLabel,
445
+ this.automationService.canRunAutomation?.(automation.id) === false
446
+ );
447
+ runBtn.element.classList.add("automations-card-run-button");
448
+ disposables.add(runBtn.onDidClick(e => {
449
+ e?.stopPropagation();
450
+ const currentAutomation = this.latestAutomations.get(automation.id);
451
+ if (!currentAutomation || this.automationService.canRunAutomation?.(automation.id) === false) {
452
+ return;
453
+ }
454
+ runBtn.enabled = false;
455
+ runBtn.setAriaLabel(runningLabel);
456
+ runBtn.setTitle(runningLabel);
457
+ disposableTimeout(() => {
458
+ runBtn.enabled = this.automationService.canRunAutomation?.(automation.id) !== false;
459
+ runBtn.setAriaLabel(runNowLabel);
460
+ runBtn.setTitle(runNowLabel);
461
+ }, 10_000, disposables);
462
+ void this.runNow(currentAutomation);
463
+ }));
464
+ const moreActionsButton = this.createIconButton(buttonBar, Codicon.kebabVertical, ( localize(4668, "More Actions for {0}", automation.name)), false);
465
+ moreActionsButton.element.classList.add("automations-card-more-actions-button");
466
+ moreActionsButton.element.setAttribute("aria-haspopup", "menu");
467
+ moreActionsButton.element.setAttribute("aria-expanded", "false");
468
+ disposables.add(moreActionsButton.onDidClick(event => {
469
+ event?.stopPropagation();
470
+ const currentAutomation = this.latestAutomations.get(automation.id);
471
+ if (!currentAutomation) {
472
+ return;
473
+ }
474
+ actions.classList.add("menu-open");
475
+ moreActionsButton.element.setAttribute("aria-expanded", "true");
476
+ this.contextMenuService.showContextMenu({
477
+ menuId: Menus.AutomationCardContext,
478
+ menuActionOptions: {
479
+ shouldForwardArgs: true,
480
+ arg: currentAutomation
481
+ },
482
+ getAnchor: () => moreActionsButton.element,
483
+ contextKeyService: cardContextKeyService,
484
+ onHide: () => {
485
+ actions.classList.remove("menu-open");
486
+ moreActionsButton.element.setAttribute("aria-expanded", "false");
487
+ }
488
+ });
489
+ }));
490
+ for (const eventType of [EventType.CLICK, EventType$1.Tap]) {
491
+ disposables.add(addDisposableListener(card, eventType, event => {
492
+ const target = event.initialTarget ?? event.target;
493
+ if (target instanceof Node && isAncestor(target, actions)) {
494
+ return;
495
+ }
496
+ const currentAutomation = this.latestAutomations.get(automation.id);
497
+ if (!currentAutomation || this.automationService.canUpdateAutomation?.(automation.id) === false) {
498
+ return;
499
+ }
500
+ void this.openEditDialog(currentAutomation);
501
+ }));
502
+ }
503
+ const entry = {
504
+ element: wrapper,
505
+ card,
506
+ main,
507
+ actions,
508
+ runButton: runBtn,
509
+ moreActionsButton,
510
+ canDeleteContext,
511
+ canUpdateContext,
512
+ enabledContext,
513
+ nameText: nameTextEl,
514
+ scheduleEl,
515
+ folderEl,
516
+ folderHover,
517
+ promptEl,
518
+ disabledBadge,
519
+ disposables
520
+ };
521
+ this.updateCard(entry, automation);
522
+ return entry;
523
+ }
524
+ updateCard(card, automation, previous) {
525
+ card.main.disabled = this.automationService.canUpdateAutomation?.(automation.id) === false;
526
+ card.runButton.enabled = this.automationService.canRunAutomation?.(automation.id) !== false;
527
+ card.canDeleteContext.set(this.automationService.canDeleteAutomation?.(automation.id) !== false);
528
+ card.canUpdateContext.set(this.automationService.canUpdateAutomation?.(automation.id) !== false);
529
+ card.enabledContext.set(automation.enabled);
530
+ const schedule = formatSchedule(automation.schedule);
531
+ const scheduleChanged = !previous || formatSchedule(previous.schedule) !== schedule;
532
+ const nameChanged = !previous || previous.name !== automation.name;
533
+ if (nameChanged || scheduleChanged) {
534
+ card.card.setAttribute("aria-label", ( localize(4669, "{0} — {1}", automation.name, schedule)));
535
+ }
536
+ if (nameChanged) {
537
+ card.main.setAttribute("aria-label", ( localize(4670, "Edit automation {0}", automation.name)));
538
+ card.actions.setAttribute("aria-label", ( localize(4671, "Actions for {0}", automation.name)));
539
+ const moreActionsLabel = ( localize(4668, "More Actions for {0}", automation.name));
540
+ card.moreActionsButton.setAriaLabel(moreActionsLabel);
541
+ card.moreActionsButton.setTitle(moreActionsLabel);
542
+ card.nameText.textContent = automation.name;
543
+ }
544
+ if (!previous || previous.enabled !== automation.enabled) {
545
+ card.disabledBadge.style.display = automation.enabled ? "none" : "";
546
+ }
547
+ if (scheduleChanged) {
548
+ card.scheduleEl.textContent = schedule;
549
+ }
550
+ const folderLabel = getAutomationTargetLabel(automation.target);
551
+ if (!previous || getAutomationTargetLabel(previous.target) !== folderLabel) {
552
+ card.folderEl.textContent = folderLabel;
553
+ card.folderHover.value = this.hoverService.setupManagedHover(getDefaultHoverDelegate("element"), card.folderEl, folderLabel);
554
+ }
555
+ if (!previous || previous.prompt !== automation.prompt) {
556
+ const maxLength = 120;
557
+ card.promptEl.textContent = automation.prompt.length > maxLength ? automation.prompt.slice(0, maxLength) + "…" : automation.prompt;
558
+ }
559
+ }
560
+ createIconButton(buttonBar, icon, tooltip, disabled) {
561
+ const button = buttonBar.addButton({
562
+ ariaLabel: tooltip,
563
+ disabled,
564
+ supportIcons: true,
565
+ title: tooltip
566
+ });
567
+ button.label = `$(${icon.id})`;
568
+ button.element.classList.add("automations-card-action-button");
569
+ return button;
570
+ }
571
+ async runNow(automation) {
572
+ if (!(await this.ensureEnabled())) {
573
+ return;
574
+ }
575
+ try {
576
+ const operation = this.automationRunner.runOnce(automation, "manual", 0, CancellationToken.None);
577
+ const dispatch = await operation.whenDispatched;
578
+ switch (dispatch.kind) {
579
+ case "started":
580
+ status(( localize(4672, "Started automation {0}", automation.name)));
581
+ break;
582
+ case "alreadyRunning":
583
+ status(( localize(4673, "Automation {0} is already running", automation.name)));
584
+ break;
585
+ case "notStarted":
586
+ status(( localize(4674, "Automation {0} did not start", automation.name)));
587
+ break;
588
+ }
589
+ await operation.whenCompleted;
590
+ } catch (error) {
591
+ this.logService.error("[AutomationsCards] Failed to run automation", error);
592
+ await this.dialogService.error(( localize(4675, "Failed to run automation.")), getErrorMessage(error));
593
+ }
594
+ }
595
+ renderEmptyState() {
596
+ const title = append(this.emptyContainer, $("h3.automations-cards-empty-title"));
597
+ title.textContent = ( localize(4676, "No automations yet"));
598
+ const desc = append(this.emptyContainer, $("p.automations-cards-empty-description"));
599
+ desc.textContent = ( localize(
600
+ 4677,
601
+ "Create an automation to schedule an agent session to run on a cadence you choose."
602
+ ));
603
+ const createButton = this.emptyStateDisposables.add(( new Button(this.emptyContainer, {
604
+ ...defaultButtonStyles,
605
+ title: ( localize(4678, "Create Automation"))
606
+ })));
607
+ this.emptyCreateButton = createButton;
608
+ createButton.label = ( localize(4678, "Create Automation"));
609
+ createButton.element.classList.add("automations-cards-create-button");
610
+ this.emptyStateDisposables.add(createButton.onDidClick(() => this.openCreateDialog()));
611
+ }
612
+ renderTemplates(templates) {
613
+ this.templateDisposables.clear();
614
+ clearNode(this.templatesContainer);
615
+ const builtInTemplates = templates.filter(template => !template.source);
616
+ const pluginTemplates = templates.filter(template => !!template.source);
617
+ this.currentPluginTemplateIds = ( new Set(pluginTemplates.map(template => template.id)));
618
+ this.pluginTemplatesSection = undefined;
619
+ this.pluginTemplatesSummary = undefined;
620
+ this.pluginTemplatesUnreadIndicator = undefined;
621
+ this.builtInTemplatesSection = this.renderTemplateSection({
622
+ className: "automations-built-in-templates",
623
+ title: ( localize(4679, "Built-in Templates")),
624
+ description: ( localize(
625
+ 4680,
626
+ "Choose a starting point, then review and customize it before creating."
627
+ )),
628
+ templates: builtInTemplates,
629
+ expanded: this.builtInTemplatesExpanded ?? false,
630
+ onDidToggle: expanded => {
631
+ if (expanded !== this.builtInTemplatesExpanded) {
632
+ this.builtInTemplatesExpanded = expanded;
633
+ this.builtInTemplatesUserToggled = true;
634
+ }
635
+ }
636
+ }).section;
637
+ if (pluginTemplates.length > 0) {
638
+ const rendered = this.renderTemplateSection({
639
+ className: "automations-plugin-templates",
640
+ title: ( localize(4681, "Templates from Plugins")),
641
+ description: ( localize(4682, "Templates provided by enabled plugins start disabled.")),
642
+ templates: pluginTemplates,
643
+ expanded: this.pluginTemplatesExpanded ?? false,
644
+ showUnreadIndicator: true,
645
+ onDidToggle: expanded => {
646
+ this.pluginTemplatesExpanded = expanded;
647
+ this.pluginTemplatesUserToggled = true;
648
+ this.updatePluginTemplateUnreadState(expanded);
649
+ }
650
+ });
651
+ this.pluginTemplatesSection = rendered.section;
652
+ this.pluginTemplatesSummary = rendered.summary;
653
+ this.pluginTemplatesUnreadIndicator = rendered.unreadIndicator;
654
+ }
655
+ }
656
+ renderTemplateSection(options) {
657
+ const section = append(
658
+ this.templatesContainer,
659
+ $(`details.automations-template-section.${options.className}`)
660
+ );
661
+ section.open = options.expanded;
662
+ const summary = append(section, $("summary.automations-template-section-summary"));
663
+ const chevron = append(summary, $("span.automations-template-section-chevron"));
664
+ chevron.classList.add(...ThemeIcon.asClassNameArray(Codicon.chevronRight));
665
+ chevron.setAttribute("aria-hidden", "true");
666
+ const title = append(summary, $("span.automations-template-section-title"));
667
+ title.id = `${options.className}-${this.templateAriaId}`;
668
+ title.setAttribute("role", "heading");
669
+ title.setAttribute("aria-level", "3");
670
+ title.textContent = options.title;
671
+ const unreadIndicator = options.showUnreadIndicator ? append(summary, $("span.automations-template-section-unread")) : undefined;
672
+ unreadIndicator?.setAttribute("aria-hidden", "true");
673
+ const count = append(summary, $("span.automations-template-section-count"));
674
+ count.textContent = String(options.templates.length);
675
+ this.templateDisposables.add(
676
+ addDisposableListener(section, "toggle", () => options.onDidToggle(section.open))
677
+ );
678
+ const description = append(section, $("p.automations-templates-description"));
679
+ description.textContent = options.description;
680
+ const grid = append(section, $(".automations-templates-grid"));
681
+ grid.setAttribute("role", "group");
682
+ grid.setAttribute("aria-labelledby", title.id);
683
+ for (const template of options.templates) {
684
+ this.renderTemplateCard(grid, template);
685
+ }
686
+ return {
687
+ section,
688
+ summary,
689
+ unreadIndicator
690
+ };
691
+ }
692
+ updatePluginTemplateUnreadState(markExpandedAsSeen) {
693
+ if (!this.pluginTemplatesSection || !this.pluginTemplatesSummary || !this.pluginTemplatesUnreadIndicator) {
694
+ return;
695
+ }
696
+ if (this.pluginTemplatesSection.open && markExpandedAsSeen) {
697
+ this.markCurrentPluginTemplatesSeen();
698
+ }
699
+ const unreadCount = this.pluginTemplatesSection.open ? 0 : [...this.currentPluginTemplateIds].filter(id => !( this.seenPluginTemplateIds.has(id))).length;
700
+ this.pluginTemplatesUnreadIndicator.classList.toggle("visible", unreadCount > 0);
701
+ if (unreadCount === 0) {
702
+ this.pluginTemplatesSummary.removeAttribute("aria-label");
703
+ } else {
704
+ this.pluginTemplatesSummary.setAttribute("aria-label", unreadCount === 1 ? ( localize(4683, "Templates from Plugins, 1 new template")) : ( localize(4684, "Templates from Plugins, {0} new templates", unreadCount)));
705
+ }
706
+ }
707
+ markCurrentPluginTemplatesSeen() {
708
+ if (setsEqual(this.currentPluginTemplateIds, this.seenPluginTemplateIds)) {
709
+ return;
710
+ }
711
+ this.seenPluginTemplateIds = ( new Set(this.currentPluginTemplateIds));
712
+ this.storageService.store(
713
+ SEEN_PLUGIN_AUTOMATION_TEMPLATES_STORAGE_KEY,
714
+ JSON.stringify([...this.seenPluginTemplateIds].sort()),
715
+ StorageScope.PROFILE,
716
+ StorageTarget.MACHINE
717
+ );
718
+ }
719
+ readSeenPluginTemplateIds() {
720
+ const raw = this.storageService.get(SEEN_PLUGIN_AUTOMATION_TEMPLATES_STORAGE_KEY, StorageScope.PROFILE);
721
+ if (!raw) {
722
+ return ( new Set());
723
+ }
724
+ try {
725
+ const parsed = JSON.parse(raw);
726
+ if (Array.isArray(parsed) && parsed.every(id => typeof id === "string")) {
727
+ return ( new Set(parsed));
728
+ }
729
+ } catch (error) {
730
+ this.logService.warn("[Automations] Failed to read seen plugin Automation templates.", error);
731
+ return ( new Set());
732
+ }
733
+ this.logService.warn("[Automations] Ignoring invalid seen plugin Automation templates storage.");
734
+ return ( new Set());
735
+ }
736
+ renderLoadingState() {
737
+ this.loadingContainer.setAttribute("role", "status");
738
+ const icon = append(this.loadingContainer, $("span.automations-cards-state-icon"));
739
+ icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.loading), "codicon-modifier-spin");
740
+ icon.setAttribute("aria-hidden", "true");
741
+ const title = append(this.loadingContainer, $("h3.automations-cards-state-title"));
742
+ title.textContent = ( localize(4685, "Loading automations..."));
743
+ const description = append(this.loadingContainer, $("p.automations-cards-state-description"));
744
+ description.textContent = ( localize(4686, "You can create a new automation while existing automations load."));
745
+ return this.renderStateCreateButton(this.loadingContainer);
746
+ }
747
+ renderUnavailableState() {
748
+ const icon = append(this.unavailableContainer, $("span.automations-cards-state-icon"));
749
+ icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.debugDisconnect));
750
+ icon.setAttribute("aria-hidden", "true");
751
+ const title = append(this.unavailableContainer, $("h3.automations-cards-state-title"));
752
+ title.textContent = ( localize(4687, "Some automations are unavailable"));
753
+ const description = append(this.unavailableContainer, $("p.automations-cards-state-description"));
754
+ description.textContent = ( localize(
755
+ 4688,
756
+ "One or more providers are disconnected, disabled, or do not support automations."
757
+ ));
758
+ return this.renderStateCreateButton(this.unavailableContainer);
759
+ }
760
+ renderErrorState() {
761
+ this.errorContainer.setAttribute("role", "alert");
762
+ const icon = append(this.errorContainer, $("span.automations-cards-state-icon"));
763
+ icon.classList.add(...ThemeIcon.asClassNameArray(Codicon.error));
764
+ icon.setAttribute("aria-hidden", "true");
765
+ const title = append(this.errorContainer, $("h3.automations-cards-state-title"));
766
+ title.textContent = ( localize(4689, "Unable to load automations"));
767
+ const description = append(this.errorContainer, $("p.automations-cards-state-description"));
768
+ description.textContent = ( localize(4690, "The complete automation catalogue could not be read."));
769
+ return this.renderStateCreateButton(this.errorContainer);
770
+ }
771
+ renderStateCreateButton(container) {
772
+ const createButton = this.stateDisposables.add(( new Button(container, {
773
+ ...defaultButtonStyles,
774
+ title: ( localize(4678, "Create Automation"))
775
+ })));
776
+ createButton.label = ( localize(4678, "Create Automation"));
777
+ createButton.element.classList.add("automations-cards-state-create-button");
778
+ this.stateDisposables.add(createButton.onDidClick(() => this.openCreateDialog()));
779
+ return createButton;
780
+ }
781
+ renderPartialState(catalogueState) {
782
+ if (this.partialState === catalogueState) {
783
+ return;
784
+ }
785
+ this.partialState = catalogueState;
786
+ if (catalogueState === "ready") {
787
+ this.partialStateContainer.style.display = "none";
788
+ return;
789
+ }
790
+ const isError = catalogueState === "error";
791
+ const isLoading = catalogueState === "loading";
792
+ this.partialStateContainer.style.display = "";
793
+ this.partialStateContainer.classList.toggle("automations-cards-partial-state-error", isError);
794
+ this.partialLoadingIcon.style.display = isLoading ? "" : "none";
795
+ this.partialErrorIcon.style.display = isLoading ? "none" : "";
796
+ this.partialStateMessage.textContent = isError ? ( localize(4691, "Some automations could not be loaded.")) : catalogueState === "unavailable" ? ( localize(4692, "Some automations are unavailable.")) : ( localize(4693, "Loading additional automations..."));
797
+ }
798
+ renderTemplateCard(container, template) {
799
+ const card = append(container, $("button.automations-template-card", {
800
+ type: "button"
801
+ }));
802
+ const schedule = formatSchedule(template.schedule);
803
+ card.setAttribute("aria-label", template.source ? ( localize(
804
+ 4694,
805
+ "Use template: {0}, {1}, from {2}",
806
+ template.name,
807
+ schedule,
808
+ template.source.label
809
+ )) : ( localize(4695, "Use template: {0}, {1}", template.name, schedule)));
810
+ const nameRow = append(card, $(".automations-template-card-name"));
811
+ const name = append(nameRow, $("span.automations-template-card-name-text"));
812
+ name.textContent = template.name;
813
+ this.templateDisposables.add(this.hoverService.setupDelayedHover(name, {
814
+ content: template.name
815
+ }));
816
+ const badge = append(nameRow, $("span.automations-template-card-badge"));
817
+ badge.textContent = template.source ? ( localize(4696, "Plugin")) : ( localize(4697, "Template"));
818
+ badge.setAttribute("aria-hidden", "true");
819
+ if (template.source) {
820
+ const source = append(card, $("span.automations-template-card-source"));
821
+ source.textContent = ( localize(4698, "From {0}", template.source.label));
822
+ this.templateDisposables.add(this.hoverService.setupDelayedHover(source, {
823
+ content: template.source.label
824
+ }));
825
+ }
826
+ const scheduleElement = append(card, $("span.automations-template-card-schedule"));
827
+ scheduleElement.textContent = schedule;
828
+ const description = append(card, $("span.automations-template-card-prompt"));
829
+ description.id = `automations-template-${this.templateAriaId}-${template.id}-description`;
830
+ description.textContent = template.description;
831
+ this.templateDisposables.add(this.hoverService.setupDelayedHover(description, {
832
+ content: template.prompt
833
+ }));
834
+ card.setAttribute("aria-describedby", description.id);
835
+ this.templateDisposables.add(addDisposableListener(card, EventType.CLICK, () => {
836
+ void this.openCreateDialog({
837
+ name: template.name,
838
+ prompt: template.prompt,
839
+ schedule: template.schedule,
840
+ ...(template.enabled !== undefined ? {
841
+ enabled: template.enabled
842
+ } : {})
843
+ });
844
+ }));
845
+ }
846
+ async openCreateDialog(initialValues) {
847
+ this.clearPendingFocus();
848
+ if (!(await this.ensureEnabled())) {
849
+ return;
850
+ }
851
+ try {
852
+ const result = await this.automationDialogService.showAutomationDialog(initialValues ? {
853
+ initialValues
854
+ } : {});
855
+ if (!result || result.kind !== "create" || this._store.isDisposed) {
856
+ return;
857
+ }
858
+ const restoreFocus = isAncestorOfActiveElement(this.focusRoot);
859
+ const focusRequestGeneration = this.focusRequestGeneration;
860
+ if (!(await this.ensureEnabled())) {
861
+ return;
862
+ }
863
+ const created = await this.automationService.createAutomation(result.value, () => this.throwIfDisabled());
864
+ if (restoreFocus && focusRequestGeneration === this.focusRequestGeneration && !this._store.isDisposed && isAncestorOfActiveElement(this.focusRoot)) {
865
+ this.pendingFocusAutomationId = created.id;
866
+ this.focusPendingAutomation();
867
+ }
868
+ status(( localize(4699, "Created automation {0}", created.name)));
869
+ } catch (err) {
870
+ this.logService.error("[AutomationsCards] Failed to create automation", err);
871
+ await this.dialogService.error(( localize(4700, "Failed to create automation.")), getErrorMessage(err));
872
+ }
873
+ }
874
+ clearPendingFocus() {
875
+ this.pendingFocusAutomationId = undefined;
876
+ this.focusRequestGeneration++;
877
+ }
878
+ focusPendingAutomation() {
879
+ if (!this.pendingFocusAutomationId) {
880
+ return false;
881
+ }
882
+ if (this._store.isDisposed || !isAncestorOfActiveElement(this.focusRoot)) {
883
+ this.clearPendingFocus();
884
+ return false;
885
+ }
886
+ const card = this.persistentCards.get(this.pendingFocusAutomationId);
887
+ if (!card) {
888
+ return false;
889
+ }
890
+ this.pendingFocusAutomationId = undefined;
891
+ card.main.focus();
892
+ return true;
893
+ }
894
+ focusVisibleState(automations, catalogueState) {
895
+ if (automations.length > 0) {
896
+ (this.persistentCards.get(automations[0].id)?.main ?? this.focusRoot).focus();
897
+ return;
898
+ }
899
+ switch (catalogueState) {
900
+ case "loading":
901
+ this.loadingCreateButton.focus();
902
+ return;
903
+ case "unavailable":
904
+ this.unavailableCreateButton.focus();
905
+ return;
906
+ case "error":
907
+ this.errorCreateButton.focus();
908
+ return;
909
+ case "ready":
910
+ (this.emptyCreateButton?.element ?? this.focusRoot).focus();
911
+ }
912
+ }
913
+ async openEditDialog(automation) {
914
+ if (!(await this.ensureEnabled())) {
915
+ return;
916
+ }
917
+ try {
918
+ const result = await this.automationDialogService.showAutomationDialog({
919
+ existing: automation
920
+ });
921
+ if (!result || result.kind !== "update") {
922
+ return;
923
+ }
924
+ if (!(await this.ensureEnabled())) {
925
+ return;
926
+ }
927
+ const updateResult = await this.automationService.updateAutomationIfUnchanged(result.id, result.value, automation, () => this.throwIfDisabled());
928
+ if (updateResult.kind === "conflict") {
929
+ throw ( new Error(updateResult.current ? ( localize(
930
+ 4701,
931
+ "This automation changed while the dialog was open. Reopen it to review the latest values."
932
+ )) : ( localize(4702, "This automation was deleted while the dialog was open."))));
933
+ }
934
+ status(( localize(4703, "Updated automation {0}", automation.name)));
935
+ } catch (err) {
936
+ this.logService.error("[AutomationsCards] Failed to update automation", err);
937
+ await this.dialogService.error(( localize(4704, "Failed to update automation.")), getErrorMessage(err));
938
+ }
939
+ }
940
+ isEnabled() {
941
+ return this.configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
942
+ }
943
+ async ensureEnabled() {
944
+ if (this.isEnabled()) {
945
+ return true;
946
+ }
947
+ await showAutomationsDisabled(this.dialogService);
948
+ return false;
949
+ }
950
+ throwIfDisabled() {
951
+ if (!this.isEnabled()) {
952
+ throw ( new Error(( localize(4705, "Automations were disabled before the change could be saved."))));
953
+ }
954
+ }
955
+ };
956
+ AutomationCardsSection = ( __decorate([( __param(2, IAutomationService)), ( __param(3, IAutomationRunner)), ( __param(4, IAutomationDialogService)), ( __param(5, IHoverService)), ( __param(6, ILogService)), ( __param(7, IDialogService)), ( __param(8, IFileService)), ( __param(9, IStorageService)), ( __param(10, IConfigurationService)), ( __param(11, IContextKeyService)), ( __param(12, IContextMenuService))], AutomationCardsSection));
957
+ let AutomationHistorySection = class AutomationHistorySection extends Disposable {
958
+ dispose() {
959
+ this.disposeAllGroups();
960
+ super.dispose();
961
+ }
962
+ constructor(
963
+ parent,
964
+ focusFallback,
965
+ isMarkingAllRead,
966
+ automationService,
967
+ sessionsService,
968
+ sessionsManagementService,
969
+ logService,
970
+ dialogService,
971
+ instantiationService
972
+ ) {
973
+ super();
974
+ this.focusFallback = focusFallback;
975
+ this.isMarkingAllRead = isMarkingAllRead;
976
+ this.automationService = automationService;
977
+ this.sessionsService = sessionsService;
978
+ this.sessionsManagementService = sessionsManagementService;
979
+ this.logService = logService;
980
+ this.dialogService = dialogService;
981
+ this.instantiationService = instantiationService;
982
+ this.headerDisposables = this._register(( new DisposableStore()));
983
+ this.persistentGroups = ( new Map());
984
+ this.runFocusTargets = ( new Map());
985
+ this.renderedFocusableRunIds = [];
986
+ this.shouldRestoreFocus = false;
987
+ this.currentRuns = observableValue(this, []);
988
+ this.currentSessions = observableValue(this, ( new Map()));
989
+ this.container = append(parent, $(".automations-history"));
990
+ this.groupsContainer = append(this.container, $(".automations-history-groups"));
991
+ this.approvalModel = this._register(this.instantiationService.createInstance(AgentSessionApprovalModel));
992
+ }
993
+ render(runs, sessions) {
994
+ const sessionRuns = runs.filter(run => ( sessions.has(run.id)));
995
+ const visibleRuns = runs.filter(run => ( sessions.has(run.id)) || isTemporaryAutomationRun(run) || (!!run.sessionResource && !!this.sessionsManagementService.getSession(run.sessionResource)));
996
+ transaction(tx => {
997
+ this.currentRuns.set(sessionRuns, tx);
998
+ this.currentSessions.set(sessions, tx);
999
+ });
1000
+ this.runFocusTargets.clear();
1001
+ this.renderedFocusableRunIds = [];
1002
+ if (visibleRuns.length === 0) {
1003
+ this.container.style.display = "none";
1004
+ this.disposeAllGroups();
1005
+ this.restoreFocusAfterRender();
1006
+ return;
1007
+ }
1008
+ this.container.style.display = "";
1009
+ this.ensureHeader();
1010
+ const groups = groupRunsByDate(visibleRuns);
1011
+ const activeKeys = ( new Set(groups.map(group => group.key)));
1012
+ for (const [key, entry] of this.persistentGroups) {
1013
+ if (!( activeKeys.has(key))) {
1014
+ entry.disposables.dispose();
1015
+ entry.element.remove();
1016
+ this.persistentGroups.delete(key);
1017
+ }
1018
+ }
1019
+ let index = 0;
1020
+ for (const group of groups) {
1021
+ const sessionItems = this.resolveSessionItems(group.runs, sessions);
1022
+ const temporaryRuns = group.runs.filter(run => !( sessions.has(run.id)));
1023
+ let entry = this.persistentGroups.get(group.key);
1024
+ if (entry) {
1025
+ if (entry.header.textContent !== group.label) {
1026
+ entry.header.textContent = group.label;
1027
+ }
1028
+ this.updateTemporaryRuns(entry, temporaryRuns);
1029
+ this.updateGroupSessions(entry, sessionItems);
1030
+ } else {
1031
+ entry = this.createGroup(group.key, group.label, temporaryRuns, sessionItems);
1032
+ }
1033
+ const currentElement = this.groupsContainer.children.item(index);
1034
+ if (currentElement !== entry.element) {
1035
+ this.groupsContainer.insertBefore(entry.element, currentElement);
1036
+ if (entry.list) {
1037
+ this.layoutSessionList(entry.listContainer, entry.list);
1038
+ }
1039
+ }
1040
+ index++;
1041
+ for (const item of sessionItems) {
1042
+ if (!entry.list) {
1043
+ continue;
1044
+ }
1045
+ this.renderedFocusableRunIds.push(item.run.id);
1046
+ this.runFocusTargets.set(item.run.id, {
1047
+ list: entry.list,
1048
+ session: item.session
1049
+ });
1050
+ }
1051
+ }
1052
+ this.restoreFocusAfterRender();
1053
+ }
1054
+ layout() {
1055
+ for (const entry of ( this.persistentGroups.values())) {
1056
+ if (entry.list) {
1057
+ this.layoutSessionList(entry.listContainer, entry.list);
1058
+ }
1059
+ }
1060
+ }
1061
+ ensureHeader() {
1062
+ if (this.headerRow) {
1063
+ return;
1064
+ }
1065
+ this.headerDisposables.clear();
1066
+ this.headerRow = $$1(".automations-history-header");
1067
+ this.container.insertBefore(this.headerRow, this.groupsContainer);
1068
+ const headerLabel = append(this.headerRow, $("span"));
1069
+ headerLabel.textContent = ( localize(4706, "History"));
1070
+ this.markAllButton = this.headerDisposables.add(( new Button(this.headerRow, {
1071
+ ...defaultButtonStyles,
1072
+ secondary: true,
1073
+ title: ( localize(4707, "Mark all as read"))
1074
+ })));
1075
+ this.markAllButton.label = ( localize(4707, "Mark all as read"));
1076
+ this.markAllButton.element.classList.add("automations-mark-all-read");
1077
+ this.headerDisposables.add(this.markAllButton.onDidClick(() => {
1078
+ void this.markAllRunsRead(this.currentRuns.get());
1079
+ }));
1080
+ this.headerDisposables.add(autorun(reader => {
1081
+ const runs = this.currentRuns.read(reader);
1082
+ const sessions = this.currentSessions.read(reader);
1083
+ const isMarkingAllRead = this.isMarkingAllRead.read(reader);
1084
+ const hasUnread = ( runs.some(run => isUnreadAutomationRun(run, sessions.get(run.id), reader)));
1085
+ this.markAllButton.element.style.display = hasUnread ? "" : "none";
1086
+ this.markAllButton.enabled = hasUnread && !isMarkingAllRead;
1087
+ }));
1088
+ }
1089
+ resolveSessionItems(runs, sessions) {
1090
+ const items = [];
1091
+ for (const run of runs) {
1092
+ const session = sessions.get(run.id);
1093
+ if (session) {
1094
+ items.push({
1095
+ run,
1096
+ session
1097
+ });
1098
+ }
1099
+ }
1100
+ return items;
1101
+ }
1102
+ createGroup(key, label, temporaryRuns, items) {
1103
+ const disposables = ( new DisposableStore());
1104
+ const element = $(".automations-history-group");
1105
+ const header = append(element, $(".automations-history-group-header"));
1106
+ header.textContent = label;
1107
+ const runsContainer = append(element, $(".automations-history-group-runs"));
1108
+ const temporaryRowsContainer = append(runsContainer, $(".automations-temporary-runs"));
1109
+ const listContainer = append(runsContainer, $(".automations-run-session-list"));
1110
+ const runsBySession = ( new Map());
1111
+ const entry = {
1112
+ element,
1113
+ header,
1114
+ temporaryRowsContainer,
1115
+ temporaryRows: disposables.add(( new DisposableMap())),
1116
+ listContainer,
1117
+ listDisposables: disposables.add(( new MutableDisposable())),
1118
+ list: undefined,
1119
+ runsBySession,
1120
+ sessions: [],
1121
+ disposables
1122
+ };
1123
+ this.persistentGroups.set(key, entry);
1124
+ this.updateTemporaryRuns(entry, temporaryRuns);
1125
+ this.updateGroupSessions(entry, items);
1126
+ return entry;
1127
+ }
1128
+ ensureGroupList(entry) {
1129
+ if (entry.list) {
1130
+ return entry.list;
1131
+ }
1132
+ const disposables = ( new DisposableStore());
1133
+ const list = disposables.add(
1134
+ this.instantiationService.createInstance(SessionsFlatList, entry.listContainer, {
1135
+ showSessionHover: false,
1136
+ alwaysConsumeMouseWheel: false,
1137
+ useCompactQuickChatRows: false,
1138
+ toolbarMenuId: Menus.AutomationsHistoryItem,
1139
+ contextMenuId: Menus.AutomationsHistoryItemContext,
1140
+ markSessionReadOnOpen: false,
1141
+ approvalModel: this.approvalModel,
1142
+ onSessionOpen: resource => void this.openRunSession(resource),
1143
+ onToolbarAction: (action, session) => this.handleSessionAction(action, session, entry.runsBySession),
1144
+ onContextMenuAction: (action, session) => this.handleSessionAction(action, session, entry.runsBySession)
1145
+ })
1146
+ );
1147
+ disposables.add(
1148
+ list.onDidChangeContentHeight(() => this.layoutSessionList(entry.listContainer, list))
1149
+ );
1150
+ entry.list = list;
1151
+ entry.listDisposables.value = disposables;
1152
+ return list;
1153
+ }
1154
+ updateTemporaryRuns(entry, runs) {
1155
+ const activeRunIds = ( new Set(runs.map(run => run.id)));
1156
+ for (const runId of ( entry.temporaryRows.keys())) {
1157
+ if (!( activeRunIds.has(runId))) {
1158
+ entry.temporaryRows.deleteAndDispose(runId);
1159
+ }
1160
+ }
1161
+ let index = 0;
1162
+ for (const run of runs) {
1163
+ const title = this.getAutomationName(run);
1164
+ let row = entry.temporaryRows.get(run.id);
1165
+ if (!row) {
1166
+ row = this.createTemporaryRunRow(title);
1167
+ entry.temporaryRows.set(run.id, row);
1168
+ } else if (row.title.textContent !== title) {
1169
+ row.title.textContent = title;
1170
+ row.element.setAttribute("aria-label", ( localize(4708, "{0}, Working...", title)));
1171
+ }
1172
+ const currentElement = entry.temporaryRowsContainer.children.item(index);
1173
+ if (currentElement !== row.element) {
1174
+ entry.temporaryRowsContainer.insertBefore(row.element, currentElement);
1175
+ }
1176
+ index++;
1177
+ }
1178
+ }
1179
+ createTemporaryRunRow(title) {
1180
+ const disposables = ( new DisposableStore());
1181
+ const element = $(".automations-temporary-run.session-item");
1182
+ element.setAttribute("role", "group");
1183
+ element.setAttribute("aria-label", ( localize(4708, "{0}, Working...", title)));
1184
+ const icon = append(element, $(".session-icon"));
1185
+ const statusIcon = disposables.add(this.instantiationService.createInstance(SessionStatusIcon, icon));
1186
+ statusIcon.setStatus(SessionStatus.InProgress, true, false);
1187
+ const main = append(element, $(".session-main"));
1188
+ const titleRow = append(main, $(".session-title-row"));
1189
+ const titleElement = append(titleRow, $("span.session-title"));
1190
+ titleElement.textContent = title;
1191
+ const detailsRow = append(main, $(".session-details-row"));
1192
+ append(detailsRow, $("span.session-description")).textContent = ( localize(4709, "Working..."));
1193
+ return {
1194
+ element,
1195
+ title: titleElement,
1196
+ dispose: () => {
1197
+ disposables.dispose();
1198
+ element.remove();
1199
+ }
1200
+ };
1201
+ }
1202
+ updateGroupSessions(entry, items) {
1203
+ entry.runsBySession.clear();
1204
+ for (const item of items) {
1205
+ entry.runsBySession.set(( item.session.resource.toString()), item.run);
1206
+ }
1207
+ const sessions = items.map(item => item.session);
1208
+ if (entry.sessions.length === sessions.length && entry.sessions.every((session, index) => session === sessions[index])) {
1209
+ return;
1210
+ }
1211
+ entry.sessions = sessions;
1212
+ if (sessions.length === 0) {
1213
+ entry.list = undefined;
1214
+ entry.listDisposables.clear();
1215
+ clearNode(entry.listContainer);
1216
+ entry.listContainer.style.height = "";
1217
+ return;
1218
+ }
1219
+ const list = this.ensureGroupList(entry);
1220
+ list.setSessions(sessions);
1221
+ this.layoutSessionList(entry.listContainer, list);
1222
+ }
1223
+ disposeAllGroups() {
1224
+ for (const [key, entry] of this.persistentGroups) {
1225
+ entry.disposables.dispose();
1226
+ entry.element.remove();
1227
+ this.persistentGroups.delete(key);
1228
+ }
1229
+ if (this.headerRow) {
1230
+ this.headerRow.remove();
1231
+ this.headerRow = undefined;
1232
+ this.markAllButton = undefined;
1233
+ this.headerDisposables.clear();
1234
+ }
1235
+ }
1236
+ layoutSessionList(container, list) {
1237
+ const height = list.getContentHeight();
1238
+ const width = container.clientWidth;
1239
+ container.style.height = `${height}px`;
1240
+ list.layout(height, width);
1241
+ }
1242
+ async handleSessionAction(action, session, runsBySession) {
1243
+ const run = runsBySession.get(( session.resource.toString()));
1244
+ if (!run) {
1245
+ return false;
1246
+ }
1247
+ switch (action.id) {
1248
+ case STOP_AUTOMATION_RUN_SESSION_COMMAND_ID:
1249
+ action.enabled = false;
1250
+ await this.stopRunSession(session, this.getAutomationName(run), action);
1251
+ return true;
1252
+ case ARCHIVE_SESSION_COMMAND_ID:
1253
+ await this.sessionsManagementService.archiveSession(session);
1254
+ return true;
1255
+ default:
1256
+ return false;
1257
+ }
1258
+ }
1259
+ getAutomationName(run) {
1260
+ return this.automationService.automations.get().find(automation => automation.id === run.automationId)?.name ?? ( localize(4710, "Unknown"));
1261
+ }
1262
+ async openRunSession(resource) {
1263
+ if (!this.sessionsManagementService.getSession(resource)) {
1264
+ return;
1265
+ }
1266
+ try {
1267
+ await this.sessionsService.openSession(resource, {
1268
+ preserveFocus: false,
1269
+ source: "automation"
1270
+ });
1271
+ } catch (error) {
1272
+ this.logService.error("[AutomationsCards] Failed to open automation run", error);
1273
+ await this.dialogService.error(( localize(4711, "Failed to open automation run.")), getErrorMessage(error));
1274
+ }
1275
+ }
1276
+ async stopRunSession(session, automationName, action) {
1277
+ try {
1278
+ await this.sessionsManagementService.cancelCurrentRequest(session);
1279
+ status(( localize(4712, "Stopped the session for {0}", automationName)));
1280
+ } catch (error) {
1281
+ action.enabled = true;
1282
+ this.logService.error("[AutomationsCards] Failed to stop automation run session", error);
1283
+ await this.dialogService.error(( localize(4713, "Failed to stop the automation run session.")), getErrorMessage(error));
1284
+ }
1285
+ }
1286
+ restoreFocusAfterRender() {
1287
+ if (!this.shouldRestoreFocus) {
1288
+ return;
1289
+ }
1290
+ const target = this.pendingFocusRunId ? this.runFocusTargets.get(this.pendingFocusRunId) : undefined;
1291
+ this.clearPendingFocus();
1292
+ if (target) {
1293
+ target.list.focusSession(target.session);
1294
+ } else {
1295
+ this.focusFallback.focus();
1296
+ }
1297
+ }
1298
+ clearPendingFocus() {
1299
+ this.pendingFocusRunId = undefined;
1300
+ this.shouldRestoreFocus = false;
1301
+ }
1302
+ async markAllRunsRead(runs) {
1303
+ this.isMarkingAllRead.set(true, undefined);
1304
+ const sessions = ( new Map());
1305
+ try {
1306
+ for (const run of runs) {
1307
+ if ((run.status === "completed" || run.status === "failed") && run.sessionResource) {
1308
+ const session = this.sessionsManagementService.getSession(run.sessionResource);
1309
+ if (session && !session.isRead.get()) {
1310
+ sessions.set(( session.resource.toString()), session);
1311
+ }
1312
+ }
1313
+ }
1314
+ await this.sessionsManagementService.markAllRead([...( sessions.values())]);
1315
+ } catch (error) {
1316
+ this.logService.error("[AutomationsCards] Failed to mark automation runs read", error);
1317
+ await this.dialogService.error(( localize(4714, "Failed to mark automation runs as read.")), getErrorMessage(error));
1318
+ } finally {
1319
+ this.isMarkingAllRead.set(false, undefined);
1320
+ }
1321
+ }
1322
+ };
1323
+ AutomationHistorySection = ( __decorate([( __param(3, IAutomationService)), ( __param(4, ISessionsService)), ( __param(5, ISessionsManagementService)), ( __param(6, ILogService)), ( __param(7, IDialogService)), ( __param(8, IInstantiationService))], AutomationHistorySection));
1324
+ function isUnreadAutomationRun(run, session, reader) {
1325
+ return (run.status === "completed" || run.status === "failed") && !!session && !session.isRead.read(reader);
1326
+ }
1327
+ function isTemporaryAutomationRun(run) {
1328
+ return run.status === "pending" || run.status === "running";
1329
+ }
1330
+ function formatSchedule(schedule) {
1331
+ const {
1332
+ interval,
1333
+ scheduleHour,
1334
+ scheduleMinute
1335
+ } = schedule;
1336
+ const time = formatHourMinute(scheduleHour, scheduleMinute);
1337
+ switch (interval) {
1338
+ case "hourly":
1339
+ return localize(4715, "Hourly");
1340
+ case "daily":
1341
+ return localize(4716, "Daily at {0}", time);
1342
+ case "weekly":
1343
+ {
1344
+ const day = DAYS_OF_WEEK[((schedule.scheduleDay % 7) + 7) % 7];
1345
+ return localize(4717, "{0} at {1}", day, time);
1346
+ }
1347
+ case "manual":
1348
+ return localize(4718, "Manual");
1349
+ default:
1350
+ return localize(4718, "Manual");
1351
+ }
1352
+ }
1353
+ function formatHourMinute(hour, minute) {
1354
+ const date = ( new Date(Date.UTC(
1355
+ 2000,
1356
+ 0,
1357
+ 1,
1358
+ Math.max(0, Math.min(23, hour | 0)),
1359
+ Math.max(0, Math.min(59, minute | 0))
1360
+ )));
1361
+ return date.toLocaleTimeString(undefined, {
1362
+ hour: "numeric",
1363
+ minute: "2-digit",
1364
+ timeZone: "UTC"
1365
+ });
1366
+ }
1367
+ function getAutomationTargetLabel(target) {
1368
+ return target.kind === "workspace" ? basename(target.folderUri) : ( localize(4719, "No workspace"));
1369
+ }
1370
+ function groupRunsByDate(runs) {
1371
+ const now = ( new Date());
1372
+ const today = ( new Date(now.getFullYear(), now.getMonth(), now.getDate()));
1373
+ const yesterday = ( new Date(today));
1374
+ yesterday.setDate(yesterday.getDate() - 1);
1375
+ const lastWeekStart = ( new Date(today));
1376
+ lastWeekStart.setDate(lastWeekStart.getDate() - 7);
1377
+ const groups = ( new Map());
1378
+ for (const run of runs) {
1379
+ const t = Date.parse(run.startedAt);
1380
+ if (Number.isNaN(t)) {
1381
+ continue;
1382
+ }
1383
+ const date = ( new Date(t));
1384
+ const {
1385
+ key,
1386
+ label,
1387
+ order
1388
+ } = getDateBucket(date, today, yesterday, lastWeekStart);
1389
+ let group = groups.get(key);
1390
+ if (!group) {
1391
+ group = {
1392
+ key,
1393
+ label,
1394
+ order,
1395
+ runs: []
1396
+ };
1397
+ groups.set(key, group);
1398
+ }
1399
+ group.runs.push(run);
1400
+ }
1401
+ return [...( groups.values())].sort((a, b) => a.order - b.order);
1402
+ }
1403
+ function getDateBucket(date, today, yesterday, lastWeekStart) {
1404
+ if (date >= today) {
1405
+ return {
1406
+ key: "today",
1407
+ label: ( localize(4720, "Today")),
1408
+ order: 0
1409
+ };
1410
+ }
1411
+ if (date >= yesterday) {
1412
+ return {
1413
+ key: "yesterday",
1414
+ label: ( localize(4721, "Yesterday")),
1415
+ order: 1
1416
+ };
1417
+ }
1418
+ if (date >= lastWeekStart) {
1419
+ return {
1420
+ key: "week",
1421
+ label: ( localize(4722, "Last week")),
1422
+ order: 2
1423
+ };
1424
+ }
1425
+ const monthLabel = date.toLocaleDateString(undefined, {
1426
+ month: "long",
1427
+ year: "numeric"
1428
+ });
1429
+ const monthIndex = date.getFullYear() * 12 + date.getMonth();
1430
+ const order = 30000 - monthIndex;
1431
+ return {
1432
+ key: `month-${date.getFullYear()}-${date.getMonth()}`,
1433
+ label: monthLabel,
1434
+ order
1435
+ };
1436
+ }
1437
+ function getErrorMessage(error) {
1438
+ return error instanceof Error ? error.message : String(error);
1439
+ }
1440
+ function getAutomationBlueprintErrorMessage(error) {
1441
+ if (!(error instanceof AutomationBlueprintParseError)) {
1442
+ return getErrorMessage(error);
1443
+ }
1444
+ switch (error.code) {
1445
+ case "invalidFrontmatter":
1446
+ return localize(4723, "The file must start with valid YAML frontmatter.");
1447
+ case "unknownProperty":
1448
+ return localize(4724, "The property '{0}' is not supported.", error.property ?? "");
1449
+ case "invalidField":
1450
+ return localize(4725, "The property '{0}' is missing or invalid.", error.property ?? "");
1451
+ case "unsupportedVersion":
1452
+ return localize(
1453
+ 4726,
1454
+ "Automation blueprint version {0} is not supported.",
1455
+ error.property ?? ""
1456
+ );
1457
+ case "invalidId":
1458
+ return localize(4727, "The blueprint id '{0}' is invalid.", error.property ?? "");
1459
+ case "unsupportedSchedule":
1460
+ return localize(
1461
+ 4728,
1462
+ "The cron expression '{0}' cannot be represented by the current Automation editor.",
1463
+ error.property ?? ""
1464
+ );
1465
+ case "unsupportedTimeZone":
1466
+ return localize(
1467
+ 4729,
1468
+ "The time zone '{0}' is not supported. Use 'local' so the schedule follows the importing user's time zone.",
1469
+ error.property ?? ""
1470
+ );
1471
+ case "missingPrompt":
1472
+ return localize(4730, "The Automation prompt must follow the frontmatter.");
1473
+ }
1474
+ }
1475
+ function normalizeAutomationBlueprintResource(resource) {
1476
+ let name = basename(resource);
1477
+ while (name.toLowerCase().endsWith(AUTOMATION_BLUEPRINT_FILE_SUFFIX)) {
1478
+ name = name.slice(0, -AUTOMATION_BLUEPRINT_FILE_SUFFIX.length);
1479
+ }
1480
+ if (name.toLowerCase().endsWith(".md")) {
1481
+ name = name.slice(0, -".md".length);
1482
+ }
1483
+ return joinPath(
1484
+ dirname(resource),
1485
+ `${name || "automation"}${AUTOMATION_BLUEPRINT_FILE_SUFFIX}`
1486
+ );
1487
+ }
1488
+ function isAutomationBlueprintResource(resource) {
1489
+ return resource.path.toLowerCase().endsWith(AUTOMATION_BLUEPRINT_FILE_SUFFIX);
1490
+ }
1491
+ function getAutomationDropData(event) {
1492
+ const editors = extractEditorsDropData(event);
1493
+ if (editors.length > 0) {
1494
+ if (editors.length !== 1 || !editors[0].resource) {
1495
+ return {
1496
+ kind: "invalid",
1497
+ reason: "multiple"
1498
+ };
1499
+ }
1500
+ return isAutomationBlueprintResource(editors[0].resource) ? {
1501
+ kind: "resource",
1502
+ resource: editors[0].resource
1503
+ } : {
1504
+ kind: "invalid",
1505
+ reason: "unsupported"
1506
+ };
1507
+ }
1508
+ const files = [];
1509
+ if (event.dataTransfer?.files) {
1510
+ for (let index = 0; index < event.dataTransfer.files.length; index++) {
1511
+ const file = event.dataTransfer.files.item(index);
1512
+ if (file) {
1513
+ files.push(file);
1514
+ }
1515
+ }
1516
+ }
1517
+ if (files.length === 0) {
1518
+ return {
1519
+ kind: "none"
1520
+ };
1521
+ }
1522
+ if (files.length !== 1) {
1523
+ return {
1524
+ kind: "invalid",
1525
+ reason: "multiple"
1526
+ };
1527
+ }
1528
+ return files[0].name.toLowerCase().endsWith(AUTOMATION_BLUEPRINT_FILE_SUFFIX) ? {
1529
+ kind: "file",
1530
+ file: files[0]
1531
+ } : {
1532
+ kind: "invalid",
1533
+ reason: "unsupported"
1534
+ };
1535
+ }
1536
+ async function importAutomationBlueprint(
1537
+ readContent,
1538
+ automationDialogService,
1539
+ automationService,
1540
+ configurationService,
1541
+ dialogService,
1542
+ logService
1543
+ ) {
1544
+ const isEnabled = () => configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
1545
+ if (!isEnabled()) {
1546
+ await showAutomationsDisabled(dialogService);
1547
+ return;
1548
+ }
1549
+ let blueprint;
1550
+ try {
1551
+ blueprint = parseAutomationBlueprint(await readContent());
1552
+ } catch (error) {
1553
+ logService.error("[Automations] Failed to read Automation blueprint", error);
1554
+ await dialogService.error(( localize(4731, "Failed to import automation.")), getAutomationBlueprintErrorMessage(error));
1555
+ return;
1556
+ }
1557
+ const result = await automationDialogService.showAutomationDialog({
1558
+ initialValues: {
1559
+ name: blueprint.name,
1560
+ prompt: blueprint.prompt,
1561
+ schedule: blueprint.schedule,
1562
+ enabled: false
1563
+ }
1564
+ });
1565
+ if (!result || result.kind !== "create") {
1566
+ return;
1567
+ }
1568
+ if (!isEnabled()) {
1569
+ await showAutomationsDisabled(dialogService);
1570
+ return;
1571
+ }
1572
+ try {
1573
+ const automation = await automationService.createAutomation(result.value, () => {
1574
+ if (!isEnabled()) {
1575
+ throw ( new Error(( localize(
1576
+ 4732,
1577
+ "Automations were disabled before the imported automation could be saved."
1578
+ ))));
1579
+ }
1580
+ });
1581
+ status(( localize(4733, "Imported automation {0}", automation.name)));
1582
+ } catch (error) {
1583
+ logService.error("[Automations] Failed to import Automation blueprint", error);
1584
+ await dialogService.error(( localize(4734, "Failed to import automation.")), getErrorMessage(error));
1585
+ }
1586
+ }
1587
+ async function showAutomationsDisabled(dialogService) {
1588
+ await dialogService.info(( localize(4735, "Automations are disabled.")), ( localize(4736, "Enable “{0}” to make changes.", CHAT_AUTOMATIONS_ENABLED_SETTING)));
1589
+ }
1590
+ async function confirmAndDeleteAutomation(
1591
+ automation,
1592
+ automationService,
1593
+ configurationService,
1594
+ dialogService,
1595
+ logService
1596
+ ) {
1597
+ if (automationService.canDeleteAutomation?.(automation.id) === false) {
1598
+ return;
1599
+ }
1600
+ const isEnabled = () => configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
1601
+ if (!isEnabled()) {
1602
+ await showAutomationsDisabled(dialogService);
1603
+ return;
1604
+ }
1605
+ const confirmed = await dialogService.confirm({
1606
+ message: ( localize(4737, "Delete automation \"{0}\"?", automation.name)),
1607
+ detail: ( localize(4738, "This will permanently delete the automation and its run history.")),
1608
+ primaryButton: ( localize(4739, "Delete"))
1609
+ });
1610
+ if (!confirmed.confirmed) {
1611
+ return;
1612
+ }
1613
+ if (!isEnabled()) {
1614
+ await showAutomationsDisabled(dialogService);
1615
+ return;
1616
+ }
1617
+ try {
1618
+ await automationService.deleteAutomation(automation.id, () => {
1619
+ if (!isEnabled()) {
1620
+ throw ( new Error(( localize(4740, "Automations were disabled before the automation could be deleted."))));
1621
+ }
1622
+ });
1623
+ status(( localize(4741, "Deleted automation {0}", automation.name)));
1624
+ } catch (error) {
1625
+ logService.error("[AutomationsCards] Failed to delete automation", error);
1626
+ await dialogService.error(( localize(4742, "Failed to delete automation.")), getErrorMessage(error));
1627
+ }
1628
+ }
1629
+ let AutomationsCustomView = class AutomationsCustomView extends AbstractCustomView {
1630
+ constructor(instantiationService) {
1631
+ super();
1632
+ this.instantiationService = instantiationService;
1633
+ this.title = constObservable(( localize(4743, "Automations")));
1634
+ this.description = constObservable(( localize(
1635
+ 4744,
1636
+ "Schedule agent sessions to run automatically on a cadence you choose."
1637
+ )));
1638
+ }
1639
+ render(container) {
1640
+ container.classList.add("automations-cards-content");
1641
+ this._widget = this._register(this.instantiationService.createInstance(AutomationsCardsWidget));
1642
+ container.appendChild(this._widget.element);
1643
+ }
1644
+ layout(width, height) {
1645
+ this._widget?.layout(width, height);
1646
+ }
1647
+ focus() {
1648
+ this._widget?.focus();
1649
+ }
1650
+ };
1651
+ AutomationsCustomView = ( __decorate([( __param(0, IInstantiationService))], AutomationsCustomView));
1652
+ let AutomationsCustomViewContribution = class AutomationsCustomViewContribution extends Disposable {
1653
+ static {
1654
+ this.ID = "sessions.contrib.automationsCustomView";
1655
+ }
1656
+ constructor(
1657
+ customViewService,
1658
+ actionViewItemService,
1659
+ contextKeyService,
1660
+ automationService,
1661
+ configurationService
1662
+ ) {
1663
+ super();
1664
+ this.historyItemActions = this._register(( new MutableDisposable()));
1665
+ const registerHistoryItemActions = () => {
1666
+ this.historyItemActions.value = registerAutomationHistoryItemActions(getChatSessionArchiveActionWording(configurationService));
1667
+ };
1668
+ registerHistoryItemActions();
1669
+ this._register(configurationService.onDidChangeConfiguration(event => {
1670
+ if (event.affectsConfiguration(ChatSessionArchiveActionWordingSettingId)) {
1671
+ registerHistoryItemActions();
1672
+ }
1673
+ }));
1674
+ const hasItemsContext = AutomationsHasItemsContext.bindTo(contextKeyService);
1675
+ this._register(autorun(reader => {
1676
+ hasItemsContext.set(automationService.automations.read(reader).length > 0);
1677
+ }));
1678
+ this._register(customViewService.registerCustomView({
1679
+ id: AUTOMATIONS_CUSTOM_VIEW_ID,
1680
+ ctor: ( new SyncDescriptor(AutomationsCustomView)),
1681
+ actions: {
1682
+ style: "buttonBar",
1683
+ menuId: Menus.CustomViewAutomations
1684
+ }
1685
+ }, {
1686
+ restore: contextKeyService.getContextKeyValue(ChatAutomationsEnabledContext.key) === true
1687
+ }));
1688
+ const automationContextKeys = ( new Set([ChatAutomationsEnabledContext.key]));
1689
+ this._register(contextKeyService.onDidChangeContext(event => {
1690
+ if (event.affectsSome(automationContextKeys) && !contextKeyService.getContextKeyValue(ChatAutomationsEnabledContext.key) && customViewService.activeCustomView.get()?.id === AUTOMATIONS_CUSTOM_VIEW_ID) {
1691
+ customViewService.hideCustomView();
1692
+ }
1693
+ }));
1694
+ this._register(actionViewItemService.register(
1695
+ Menus.CustomViewAutomations,
1696
+ "sessionsView.newAutomation",
1697
+ (action, options, instantiationService) => {
1698
+ if (!(action instanceof MenuItemAction)) {
1699
+ return undefined;
1700
+ }
1701
+ return instantiationService.createInstance(AutomationHeaderButtonActionViewItem, undefined, action, options, false);
1702
+ }
1703
+ ));
1704
+ this._register(actionViewItemService.register(
1705
+ Menus.CustomViewAutomations,
1706
+ "sessions.automations.import",
1707
+ (action, options, instantiationService) => {
1708
+ if (!(action instanceof MenuItemAction)) {
1709
+ return undefined;
1710
+ }
1711
+ return instantiationService.createInstance(AutomationHeaderButtonActionViewItem, undefined, action, options, true);
1712
+ }
1713
+ ));
1714
+ }
1715
+ };
1716
+ AutomationsCustomViewContribution = ( __decorate([( __param(0, ICustomViewService)), ( __param(1, IActionViewItemService)), ( __param(2, IContextKeyService)), ( __param(3, IAutomationService)), ( __param(4, IConfigurationService))], AutomationsCustomViewContribution));
1717
+ function registerAutomationHistoryItemActions(archiveWording) {
1718
+ const archivePresentation = getChatSessionArchiveActionPresentation(archiveWording);
1719
+ return combinedDisposable(MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItem, {
1720
+ command: {
1721
+ id: STOP_AUTOMATION_RUN_SESSION_COMMAND_ID,
1722
+ title: ( localize(4745, "Stop")),
1723
+ icon: Codicon.stopCircle
1724
+ },
1725
+ group: "navigation",
1726
+ order: 1,
1727
+ when: ( ContextKeyExpr.or(( SessionItemStatusContext.isEqualTo(SessionStatus.InProgress)), ( SessionItemStatusContext.isEqualTo(SessionStatus.NeedsInput))))
1728
+ }), MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItemContext, {
1729
+ command: {
1730
+ id: MARK_SESSION_READ_COMMAND_ID,
1731
+ title: ( localize(4746, "Mark as Read"))
1732
+ },
1733
+ group: "0_read",
1734
+ order: 1,
1735
+ when: ( ContextKeyExpr.and(( SessionIsReadContext.negate()), ( SessionIsArchivedContext.negate())))
1736
+ }), MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItemContext, {
1737
+ command: {
1738
+ id: MARK_SESSION_UNREAD_COMMAND_ID,
1739
+ title: ( localize(4747, "Mark as Unread"))
1740
+ },
1741
+ group: "0_read",
1742
+ order: 1,
1743
+ when: ( ContextKeyExpr.and(SessionIsReadContext, ( SessionIsArchivedContext.negate())))
1744
+ }), MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItemContext, {
1745
+ command: {
1746
+ id: RENAME_SESSION_COMMAND_ID,
1747
+ title: ( localize(4748, "Rename..."))
1748
+ },
1749
+ group: "1_edit",
1750
+ order: 1,
1751
+ when: SessionSupportsRenameContext
1752
+ }), MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItemContext, {
1753
+ command: {
1754
+ id: ARCHIVE_SESSION_COMMAND_ID,
1755
+ title: archivePresentation.archive.title
1756
+ },
1757
+ group: "1_edit",
1758
+ order: 2,
1759
+ when: ( SessionIsArchivedContext.negate())
1760
+ }), MenuRegistry.appendMenuItem(Menus.AutomationsHistoryItemContext, {
1761
+ command: {
1762
+ id: UNARCHIVE_SESSION_COMMAND_ID,
1763
+ title: archivePresentation.unarchive.title
1764
+ },
1765
+ group: "1_edit",
1766
+ order: 2,
1767
+ when: SessionIsArchivedContext
1768
+ }));
1769
+ }
1770
+ class AutomationHeaderButtonActionViewItem extends BaseActionViewItem {
1771
+ constructor(context, action, options, secondary) {
1772
+ super(context, action, options);
1773
+ this.secondary = secondary;
1774
+ }
1775
+ render(container) {
1776
+ this.element = container;
1777
+ container.classList.add("chat-pill-item");
1778
+ const button = this.button = this._register(( new Button(container, {
1779
+ secondary: this.secondary,
1780
+ ...defaultButtonStyles
1781
+ })));
1782
+ button.element.classList.add("monaco-text-button", "chat-pill-button");
1783
+ this._register(button.onDidClick(() => {
1784
+ if (this._action.enabled) {
1785
+ this.actionRunner.run(this._action, this._context);
1786
+ }
1787
+ }));
1788
+ this.updateLabel();
1789
+ this.updateEnabled();
1790
+ }
1791
+ focus() {
1792
+ if (this.button) {
1793
+ this.button.element.tabIndex = 0;
1794
+ this.button.focus();
1795
+ }
1796
+ }
1797
+ blur() {
1798
+ if (this.button) {
1799
+ this.button.element.tabIndex = -1;
1800
+ this.button.element.blur();
1801
+ }
1802
+ }
1803
+ setFocusable(focusable) {
1804
+ if (this.button) {
1805
+ this.button.element.tabIndex = focusable ? 0 : -1;
1806
+ }
1807
+ }
1808
+ updateEnabled() {
1809
+ if (this.button) {
1810
+ this.button.enabled = this._action.enabled;
1811
+ }
1812
+ }
1813
+ updateLabel() {
1814
+ if (!this.button) {
1815
+ return;
1816
+ }
1817
+ reset(this.button.element, this._action.label);
1818
+ }
1819
+ }
1820
+ registerAction2(class NewAutomationAction extends Action2 {
1821
+ constructor() {
1822
+ super({
1823
+ id: "sessionsView.newAutomation",
1824
+ title: ( localize2(4749, "New Automation")),
1825
+ precondition: ChatAutomationsEnabledContext,
1826
+ menu: [{
1827
+ id: Menus.CustomViewAutomations,
1828
+ group: "navigation",
1829
+ order: 1,
1830
+ when: ( ContextKeyExpr.and(ChatAutomationsEnabledContext, AutomationsHasItemsContext))
1831
+ }]
1832
+ });
1833
+ }
1834
+ async run(accessor) {
1835
+ const automationDialogService = accessor.get(IAutomationDialogService);
1836
+ const automationService = accessor.get(IAutomationService);
1837
+ const configurationService = accessor.get(IConfigurationService);
1838
+ const dialogService = accessor.get(IDialogService);
1839
+ const logService = accessor.get(ILogService);
1840
+ const isEnabled = () => configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
1841
+ if (!isEnabled()) {
1842
+ await showAutomationsDisabled(dialogService);
1843
+ return;
1844
+ }
1845
+ const result = await automationDialogService.showAutomationDialog({});
1846
+ if (!result || result.kind !== "create") {
1847
+ return;
1848
+ }
1849
+ if (!isEnabled()) {
1850
+ await showAutomationsDisabled(dialogService);
1851
+ return;
1852
+ }
1853
+ try {
1854
+ await automationService.createAutomation(result.value, () => {
1855
+ if (!isEnabled()) {
1856
+ throw ( new Error(( localize(4705, "Automations were disabled before the change could be saved."))));
1857
+ }
1858
+ });
1859
+ } catch (err) {
1860
+ logService.error("[Automations] Failed to create automation", err);
1861
+ await dialogService.error(( localize(4700, "Failed to create automation.")), getErrorMessage(err));
1862
+ }
1863
+ }
1864
+ });
1865
+ registerAction2(class ImportAutomationAction extends Action2 {
1866
+ constructor() {
1867
+ super({
1868
+ id: "sessions.automations.import",
1869
+ title: ( localize2(4750, "Import Automation")),
1870
+ precondition: ChatAutomationsEnabledContext,
1871
+ menu: [{
1872
+ id: Menus.CustomViewAutomations,
1873
+ group: "navigation",
1874
+ order: 2,
1875
+ when: ChatAutomationsEnabledContext
1876
+ }]
1877
+ });
1878
+ }
1879
+ async run(accessor) {
1880
+ const configurationService = accessor.get(IConfigurationService);
1881
+ const dialogService = accessor.get(IDialogService);
1882
+ const fileDialogService = accessor.get(IFileDialogService);
1883
+ const fileService = accessor.get(IFileService);
1884
+ const logService = accessor.get(ILogService);
1885
+ const automationDialogService = accessor.get(IAutomationDialogService);
1886
+ const automationService = accessor.get(IAutomationService);
1887
+ const isEnabled = () => configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
1888
+ if (!isEnabled()) {
1889
+ await showAutomationsDisabled(dialogService);
1890
+ return;
1891
+ }
1892
+ const resources = await fileDialogService.showOpenDialog({
1893
+ title: ( localize(4751, "Import Automation")),
1894
+ openLabel: ( localize(4752, "Import")),
1895
+ canSelectFiles: true,
1896
+ canSelectFolders: false,
1897
+ canSelectMany: false,
1898
+ filters: [{
1899
+ name: ( localize(4753, "Automation Blueprint")),
1900
+ extensions: ["automation.md"]
1901
+ }]
1902
+ });
1903
+ const resource = resources?.[0];
1904
+ if (!resource) {
1905
+ return;
1906
+ }
1907
+ if (!isAutomationBlueprintResource(resource)) {
1908
+ await dialogService.error(( localize(4664, "Unable to import automation.")), ( localize(4663, "Only .automation.md files can be imported.")));
1909
+ return;
1910
+ }
1911
+ await importAutomationBlueprint(async () => ( (await fileService.readFile(resource)).value.toString()), automationDialogService, automationService, configurationService, dialogService, logService);
1912
+ }
1913
+ });
1914
+ registerAction2(class DuplicateAutomationAction extends Action2 {
1915
+ constructor() {
1916
+ super({
1917
+ id: "sessions.automations.duplicate",
1918
+ title: ( localize2(4754, "Duplicate")),
1919
+ precondition: ChatAutomationsEnabledContext,
1920
+ menu: [{
1921
+ id: Menus.AutomationCardContext,
1922
+ group: "navigation",
1923
+ order: 2,
1924
+ when: ChatAutomationsEnabledContext
1925
+ }]
1926
+ });
1927
+ }
1928
+ async run(accessor, automation) {
1929
+ const automationDialogService = accessor.get(IAutomationDialogService);
1930
+ const automationService = accessor.get(IAutomationService);
1931
+ const configurationService = accessor.get(IConfigurationService);
1932
+ const dialogService = accessor.get(IDialogService);
1933
+ const logService = accessor.get(ILogService);
1934
+ const isEnabled = () => configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
1935
+ if (!isEnabled()) {
1936
+ await showAutomationsDisabled(dialogService);
1937
+ return;
1938
+ }
1939
+ try {
1940
+ const name = getDuplicateAutomationName(automation.name, automationService.automations.get());
1941
+ const result = await automationDialogService.showAutomationDialog({
1942
+ initialValues: {
1943
+ name,
1944
+ prompt: automation.prompt,
1945
+ schedule: automation.schedule,
1946
+ target: automation.target,
1947
+ ...(automation.sessionTemplate ? {
1948
+ sessionTemplate: automation.sessionTemplate
1949
+ } : {
1950
+ modelId: automation.modelId,
1951
+ mode: automation.mode,
1952
+ permissionLevel: automation.permissionLevel
1953
+ }),
1954
+ enabled: automation.enabled
1955
+ }
1956
+ });
1957
+ if (!result || result.kind !== "create") {
1958
+ return;
1959
+ }
1960
+ if (!isEnabled()) {
1961
+ await showAutomationsDisabled(dialogService);
1962
+ return;
1963
+ }
1964
+ const duplicate = await automationService.createAutomation(result.value, () => {
1965
+ if (!isEnabled()) {
1966
+ throw ( new Error(( localize(4755, "Automations were disabled before the duplicate could be saved."))));
1967
+ }
1968
+ });
1969
+ status(( localize(4756, "Created duplicate automation {0}", duplicate.name)));
1970
+ } catch (error) {
1971
+ logService.error("[Automations] Failed to duplicate automation", error);
1972
+ await dialogService.error(( localize(4757, "Failed to duplicate automation.")), getErrorMessage(error));
1973
+ }
1974
+ }
1975
+ });
1976
+ registerAction2(class ExportAutomationAction extends Action2 {
1977
+ constructor() {
1978
+ super({
1979
+ id: "sessions.automations.export",
1980
+ title: ( localize2(4758, "Export")),
1981
+ precondition: ChatAutomationsEnabledContext,
1982
+ menu: [{
1983
+ id: Menus.AutomationCardContext,
1984
+ group: "navigation",
1985
+ order: 3,
1986
+ when: ChatAutomationsEnabledContext
1987
+ }]
1988
+ });
1989
+ }
1990
+ async run(accessor, automation) {
1991
+ const configurationService = accessor.get(IConfigurationService);
1992
+ const dialogService = accessor.get(IDialogService);
1993
+ const fileDialogService = accessor.get(IFileDialogService);
1994
+ const fileService = accessor.get(IFileService);
1995
+ const logService = accessor.get(ILogService);
1996
+ if (configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) !== true) {
1997
+ await showAutomationsDisabled(dialogService);
1998
+ return;
1999
+ }
2000
+ let defaultUri = joinPath(
2001
+ await fileDialogService.defaultFilePath(),
2002
+ createAutomationBlueprintFileName(automation.name)
2003
+ );
2004
+ let resource;
2005
+ while (true) {
2006
+ const selectedResource = await fileDialogService.showSaveDialog({
2007
+ title: ( localize(4759, "Export Automation")),
2008
+ saveLabel: ( localize(4760, "Export")),
2009
+ defaultUri,
2010
+ filters: [{
2011
+ name: ( localize(4753, "Automation Blueprint")),
2012
+ extensions: ["md"]
2013
+ }]
2014
+ });
2015
+ if (!selectedResource) {
2016
+ return;
2017
+ }
2018
+ const normalizedResource = normalizeAutomationBlueprintResource(selectedResource);
2019
+ if (isEqual(selectedResource, normalizedResource)) {
2020
+ resource = selectedResource;
2021
+ break;
2022
+ }
2023
+ await dialogService.error(( localize(4761, "Unable to export automation.")), ( localize(4762, "Use a file name ending in exactly one .automation.md suffix.")));
2024
+ defaultUri = normalizedResource;
2025
+ }
2026
+ try {
2027
+ const content = serializeAutomationBlueprint(automationToBlueprint(automation));
2028
+ await fileService.writeFile(resource, VSBuffer.fromString(content));
2029
+ status(( localize(4763, "Exported automation {0}", automation.name)));
2030
+ } catch (error) {
2031
+ logService.error("[Automations] Failed to export Automation blueprint", error);
2032
+ await dialogService.error(( localize(4764, "Failed to export automation.")), getErrorMessage(error));
2033
+ }
2034
+ }
2035
+ });
2036
+ registerAction2(class DeleteAutomationAction extends Action2 {
2037
+ constructor() {
2038
+ super({
2039
+ id: "sessions.automations.delete",
2040
+ title: ( localize2(4765, "Delete")),
2041
+ precondition: ( ContextKeyExpr.and(ChatAutomationsEnabledContext, AutomationCardCanDeleteContext)),
2042
+ menu: [{
2043
+ id: Menus.AutomationCardContext,
2044
+ group: "navigation",
2045
+ order: 4,
2046
+ when: ChatAutomationsEnabledContext
2047
+ }]
2048
+ });
2049
+ }
2050
+ async run(accessor, automation) {
2051
+ await confirmAndDeleteAutomation(
2052
+ automation,
2053
+ accessor.get(IAutomationService),
2054
+ accessor.get(IConfigurationService),
2055
+ accessor.get(IDialogService),
2056
+ accessor.get(ILogService)
2057
+ );
2058
+ }
2059
+ });
2060
+ registerAction2(class DisableAutomationAction extends Action2 {
2061
+ constructor() {
2062
+ super({
2063
+ id: "sessions.automations.disable",
2064
+ title: ( localize2(4766, "Disable")),
2065
+ precondition: ( ContextKeyExpr.and(ChatAutomationsEnabledContext, AutomationCardCanUpdateContext)),
2066
+ menu: [{
2067
+ id: Menus.AutomationCardContext,
2068
+ group: "navigation",
2069
+ order: 1,
2070
+ when: ( ContextKeyExpr.and(ChatAutomationsEnabledContext, AutomationCardEnabledContext))
2071
+ }]
2072
+ });
2073
+ }
2074
+ async run(accessor, automation) {
2075
+ await setAutomationEnabled(accessor, automation, false);
2076
+ }
2077
+ });
2078
+ registerAction2(class EnableAutomationAction extends Action2 {
2079
+ constructor() {
2080
+ super({
2081
+ id: "sessions.automations.enable",
2082
+ title: ( localize2(4767, "Enable")),
2083
+ precondition: ( ContextKeyExpr.and(ChatAutomationsEnabledContext, AutomationCardCanUpdateContext)),
2084
+ menu: [{
2085
+ id: Menus.AutomationCardContext,
2086
+ group: "navigation",
2087
+ order: 1,
2088
+ when: ( ContextKeyExpr.and(ChatAutomationsEnabledContext, ( AutomationCardEnabledContext.negate())))
2089
+ }]
2090
+ });
2091
+ }
2092
+ async run(accessor, automation) {
2093
+ await setAutomationEnabled(accessor, automation, true);
2094
+ }
2095
+ });
2096
+ async function setAutomationEnabled(accessor, automation, enabled) {
2097
+ const automationService = accessor.get(IAutomationService);
2098
+ if (automation.enabled === enabled || automationService.canUpdateAutomation?.(automation.id) === false) {
2099
+ return;
2100
+ }
2101
+ const configurationService = accessor.get(IConfigurationService);
2102
+ const dialogService = accessor.get(IDialogService);
2103
+ const logService = accessor.get(ILogService);
2104
+ const automationsEnabled = () => configurationService.getValue(CHAT_AUTOMATIONS_ENABLED_SETTING) === true;
2105
+ if (!automationsEnabled()) {
2106
+ await showAutomationsDisabled(dialogService);
2107
+ return;
2108
+ }
2109
+ try {
2110
+ const result = await automationService.updateAutomationIfUnchanged(automation.id, {
2111
+ enabled
2112
+ }, automation, () => {
2113
+ if (!automationsEnabled()) {
2114
+ throw ( new Error(enabled ? ( localize(4768, "Automations were disabled before the automation could be enabled.")) : ( localize(4769, "Automations were disabled before the automation could be updated."))));
2115
+ }
2116
+ });
2117
+ if (result.kind === "conflict") {
2118
+ throw ( new Error(result.current ? (enabled ? ( localize(4770, "This automation changed before it could be enabled. Try again.")) : ( localize(4771, "This automation changed before it could be disabled. Try again."))) : (enabled ? ( localize(4772, "This automation was deleted before it could be enabled.")) : ( localize(4773, "This automation was deleted before it could be disabled.")))));
2119
+ }
2120
+ status(enabled ? ( localize(4774, "Enabled automation {0}", automation.name)) : ( localize(4775, "Disabled automation {0}", automation.name)));
2121
+ } catch (error) {
2122
+ logService.error(
2123
+ enabled ? "[Automations] Failed to enable automation" : "[Automations] Failed to disable automation",
2124
+ error
2125
+ );
2126
+ await dialogService.error(enabled ? ( localize(4776, "Failed to enable automation.")) : ( localize(4777, "Failed to disable automation.")), getErrorMessage(error));
2127
+ }
2128
+ }
2129
+ function getDuplicateAutomationName(name, automations) {
2130
+ const existingNames = ( new Set(automations.map(automation => automation.name)));
2131
+ const copyName = ( localize(4778, "{0} Copy", name));
2132
+ if (!( existingNames.has(copyName))) {
2133
+ return copyName;
2134
+ }
2135
+ for (let index = 2; ; index++) {
2136
+ const indexedCopyName = ( localize(4779, "{0} Copy {1}", name, index));
2137
+ if (!( existingNames.has(indexedCopyName))) {
2138
+ return indexedCopyName;
2139
+ }
2140
+ }
2141
+ }
2142
+
2143
+ export { AutomationsCardsWidget, AutomationsCustomView, AutomationsCustomViewContribution, SEEN_PLUGIN_AUTOMATION_TEMPLATES_STORAGE_KEY };