chrome-devtools-frontend 1.0.1376716 → 1.0.1380117

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 (434) hide show
  1. package/config/gni/devtools_grd_files.gni +15 -7
  2. package/config/gni/devtools_image_files.gni +2 -0
  3. package/front_end/Images/src/animation.svg +3 -0
  4. package/front_end/Images/src/brush-2.svg +3 -0
  5. package/front_end/core/common/SettingRegistration.ts +1 -1
  6. package/front_end/core/host/AidaClient.ts +1 -0
  7. package/front_end/core/host/InspectorFrontendHost.ts +4 -0
  8. package/front_end/core/i18n/ByteUtilities.test.ts +34 -0
  9. package/front_end/core/i18n/ByteUtilities.ts +65 -0
  10. package/front_end/core/i18n/NumberFormatter.ts +75 -0
  11. package/front_end/core/i18n/i18n.ts +4 -0
  12. package/front_end/core/i18n/time-utilities.test.ts +20 -2
  13. package/front_end/core/i18n/time-utilities.ts +125 -86
  14. package/front_end/core/platform/NumberUtilities.test.ts +3 -26
  15. package/front_end/core/platform/NumberUtilities.ts +0 -20
  16. package/front_end/core/root/Runtime.ts +6 -3
  17. package/front_end/core/sdk/CPUThrottlingManager.ts +4 -0
  18. package/front_end/core/sdk/CSSContainerQuery.test.ts +10 -16
  19. package/front_end/core/sdk/CSSContainerQuery.ts +3 -15
  20. package/front_end/core/sdk/CSSMatchedStyles.test.ts +4 -0
  21. package/front_end/core/sdk/CSSMatchedStyles.ts +5 -5
  22. package/front_end/core/sdk/CSSModel.ts +18 -0
  23. package/front_end/core/sdk/CSSPropertyParser.test.ts +16 -1
  24. package/front_end/core/sdk/CSSPropertyParser.ts +2 -2
  25. package/front_end/core/sdk/sdk-meta.ts +8 -0
  26. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +3 -3
  27. package/front_end/generated/ARIAProperties.js +4 -0
  28. package/front_end/generated/InspectorBackendCommands.js +8 -6
  29. package/front_end/generated/SupportedCSSProperties.js +17 -4
  30. package/front_end/generated/protocol-mapping.d.ts +15 -1
  31. package/front_end/generated/protocol-proxy-api.d.ts +14 -1
  32. package/front_end/generated/protocol.ts +26 -2
  33. package/front_end/models/extensions/ExtensionAPI.ts +9 -1
  34. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +2 -0
  35. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -21
  36. package/front_end/models/live-metrics/web-vitals-injected/{rollup.config.js → rollup.config.mjs} +1 -1
  37. package/front_end/models/persistence/EditFileSystemView.ts +19 -9
  38. package/front_end/models/persistence/WorkspaceSettingsTab.ts +50 -54
  39. package/front_end/models/persistence/editFileSystemView.css +35 -15
  40. package/front_end/models/persistence/workspaceSettingsTab.css +21 -87
  41. package/front_end/models/timeline_model/timeline_model.ts +0 -6
  42. package/front_end/models/trace/Processor.test.ts +18 -17
  43. package/front_end/models/trace/Processor.ts +10 -14
  44. package/front_end/models/trace/README.md +0 -1
  45. package/front_end/models/{timeline_model → trace/extras}/TimelineJSProfile.ts +19 -29
  46. package/front_end/models/{timeline_model/TimelineModelFilter.test.ts → trace/extras/TraceFilter.test.ts} +15 -17
  47. package/front_end/models/trace/extras/TraceFilter.ts +62 -0
  48. package/front_end/models/{timeline_model/TimelineProfileTree.test.ts → trace/extras/TraceTree.test.ts} +44 -43
  49. package/front_end/models/{timeline_model/TimelineProfileTree.ts → trace/extras/TraceTree.ts} +65 -59
  50. package/front_end/models/trace/extras/extras.ts +3 -0
  51. package/front_end/models/trace/handlers/AnimationHandler.ts +0 -8
  52. package/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +1 -11
  53. package/front_end/models/trace/handlers/FramesHandler.test.ts +1 -6
  54. package/front_end/models/trace/handlers/FramesHandler.ts +1 -14
  55. package/front_end/models/trace/handlers/GPUHandler.test.ts +0 -2
  56. package/front_end/models/trace/handlers/GPUHandler.ts +1 -25
  57. package/front_end/models/trace/handlers/ImagePaintingHandler.ts +3 -0
  58. package/front_end/models/trace/handlers/InitiatorsHandler.test.ts +0 -1
  59. package/front_end/models/trace/handlers/InitiatorsHandler.ts +0 -20
  60. package/front_end/models/trace/handlers/InvalidationsHandler.test.ts +0 -1
  61. package/front_end/models/trace/handlers/InvalidationsHandler.ts +0 -18
  62. package/front_end/models/trace/handlers/LargestImagePaintHandler.test.ts +2 -2
  63. package/front_end/models/trace/handlers/LargestImagePaintHandler.ts +63 -3
  64. package/front_end/models/trace/handlers/LargestTextPaintHandler.ts +3 -0
  65. package/front_end/models/trace/handlers/LayerTreeHandler.test.ts +0 -2
  66. package/front_end/models/trace/handlers/LayerTreeHandler.ts +1 -18
  67. package/front_end/models/trace/handlers/LayoutShiftsHandler.test.ts +0 -3
  68. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -20
  69. package/front_end/models/trace/handlers/MemoryHandler.test.ts +0 -1
  70. package/front_end/models/trace/handlers/MemoryHandler.ts +3 -0
  71. package/front_end/models/trace/handlers/MetaHandler.test.ts +1 -32
  72. package/front_end/models/trace/handlers/MetaHandler.ts +2 -30
  73. package/front_end/models/trace/handlers/NetworkRequestsHandler.test.ts +0 -26
  74. package/front_end/models/trace/handlers/NetworkRequestsHandler.ts +4 -23
  75. package/front_end/models/trace/handlers/PageFramesHandler.ts +3 -0
  76. package/front_end/models/trace/handlers/RendererHandler.test.ts +0 -4
  77. package/front_end/models/trace/handlers/RendererHandler.ts +1 -24
  78. package/front_end/models/trace/handlers/SamplesHandler.test.ts +0 -5
  79. package/front_end/models/trace/handlers/SamplesHandler.ts +0 -26
  80. package/front_end/models/trace/handlers/ScreenshotsHandler.test.ts +0 -1
  81. package/front_end/models/trace/handlers/SelectorStatsHandler.ts +3 -0
  82. package/front_end/models/trace/handlers/ServerTimingsHandler.ts +1 -16
  83. package/front_end/models/trace/handlers/Threads.test.ts +1 -2
  84. package/front_end/models/trace/handlers/UserInteractionsHandler.test.ts +4 -27
  85. package/front_end/models/trace/handlers/UserInteractionsHandler.ts +16 -25
  86. package/front_end/models/trace/handlers/UserTimingsHandler.ts +0 -17
  87. package/front_end/models/trace/handlers/WorkersHandler.test.ts +0 -1
  88. package/front_end/models/trace/handlers/WorkersHandler.ts +0 -23
  89. package/front_end/models/trace/handlers/types.ts +1 -8
  90. package/front_end/models/trace/insights/{CumulativeLayoutShift.test.ts → CLSCulprits.test.ts} +21 -21
  91. package/front_end/models/trace/insights/{CumulativeLayoutShift.ts → CLSCulprits.ts} +24 -5
  92. package/front_end/models/trace/insights/Common.ts +5 -55
  93. package/front_end/models/trace/insights/DocumentLatency.test.ts +2 -2
  94. package/front_end/models/trace/insights/DocumentLatency.ts +26 -6
  95. package/front_end/models/trace/insights/FontDisplay.ts +24 -5
  96. package/front_end/models/trace/insights/InteractionToNextPaint.test.ts +1 -1
  97. package/front_end/models/trace/insights/InteractionToNextPaint.ts +26 -6
  98. package/front_end/models/trace/insights/LCPDiscovery.test.ts +58 -0
  99. package/front_end/models/trace/insights/LCPDiscovery.ts +101 -0
  100. package/front_end/models/trace/insights/{LargestContentfulPaint.test.ts → LCPPhases.test.ts} +6 -28
  101. package/front_end/models/trace/insights/{LargestContentfulPaint.ts → LCPPhases.ts} +37 -38
  102. package/front_end/models/trace/insights/{InsightRunners.ts → Models.ts} +4 -3
  103. package/front_end/models/trace/insights/RenderBlocking.test.ts +1 -1
  104. package/front_end/models/trace/insights/RenderBlocking.ts +33 -28
  105. package/front_end/models/trace/insights/SlowCSSSelector.ts +26 -5
  106. package/front_end/models/trace/insights/{ThirdPartyWeb.test.ts → ThirdParties.test.ts} +3 -3
  107. package/front_end/models/trace/insights/{ThirdPartyWeb.ts → ThirdParties.ts} +24 -5
  108. package/front_end/models/trace/insights/Viewport.test.ts +1 -1
  109. package/front_end/models/trace/insights/Viewport.ts +27 -9
  110. package/front_end/models/trace/insights/insights.ts +1 -1
  111. package/front_end/models/trace/insights/types.ts +11 -9
  112. package/front_end/models/trace/types/TraceEvents.ts +51 -22
  113. package/front_end/panels/application/SharedStorageItemsView.test.ts +3 -3
  114. package/front_end/panels/application/SharedStorageItemsView.ts +5 -3
  115. package/front_end/panels/application/StorageView.ts +3 -3
  116. package/front_end/panels/application/components/StorageMetadataView.ts +1 -2
  117. package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +34 -31
  118. package/front_end/panels/coverage/CoverageView.ts +3 -3
  119. package/front_end/panels/elements/ComputedStyleModel.ts +9 -2
  120. package/front_end/panels/elements/ComputedStyleWidget.test.ts +72 -0
  121. package/front_end/panels/elements/ComputedStyleWidget.ts +12 -0
  122. package/front_end/panels/elements/ElementStatePaneWidget.test.ts +84 -30
  123. package/front_end/panels/elements/ElementStatePaneWidget.ts +42 -24
  124. package/front_end/panels/elements/ElementsTreeElement.ts +24 -11
  125. package/front_end/panels/elements/MetricsSidebarPane.ts +12 -7
  126. package/front_end/panels/elements/PropertyMatchers.ts +3 -0
  127. package/front_end/panels/elements/StylePropertiesSection.ts +15 -6
  128. package/front_end/panels/elements/StylePropertyTreeElement.test.ts +3 -1
  129. package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
  130. package/front_end/panels/elements/stylePropertiesTreeOutline.css +2 -2
  131. package/front_end/panels/explain/components/ConsoleInsight.ts +8 -18
  132. package/front_end/panels/freestyler/AiAgent.test.ts +58 -1
  133. package/front_end/panels/freestyler/AiAgent.ts +58 -3
  134. package/front_end/panels/freestyler/DrJonesFileAgent.test.ts +99 -23
  135. package/front_end/panels/freestyler/DrJonesFileAgent.ts +53 -20
  136. package/front_end/panels/freestyler/DrJonesNetworkAgent.test.ts +15 -7
  137. package/front_end/panels/freestyler/DrJonesNetworkAgent.ts +36 -15
  138. package/front_end/panels/freestyler/DrJonesPerformanceAgent.test.ts +6 -6
  139. package/front_end/panels/freestyler/DrJonesPerformanceAgent.ts +48 -8
  140. package/front_end/panels/freestyler/FreestylerAgent.test.ts +15 -14
  141. package/front_end/panels/freestyler/FreestylerAgent.ts +52 -8
  142. package/front_end/panels/freestyler/FreestylerPanel.test.ts +539 -39
  143. package/front_end/panels/freestyler/FreestylerPanel.ts +349 -215
  144. package/front_end/panels/freestyler/components/FreestylerChatUi.test.ts +126 -34
  145. package/front_end/panels/freestyler/components/FreestylerChatUi.ts +320 -268
  146. package/front_end/panels/freestyler/components/UserActionRow.ts +156 -47
  147. package/front_end/panels/freestyler/components/freestylerChatUi.css +69 -34
  148. package/front_end/panels/freestyler/components/userActionRow.css +40 -67
  149. package/front_end/panels/freestyler/freestyler-meta.ts +3 -11
  150. package/front_end/panels/issues/components/HideIssuesMenu.ts +2 -11
  151. package/front_end/panels/layer_viewer/LayerDetailsView.ts +1 -2
  152. package/front_end/panels/layer_viewer/PaintProfilerView.ts +5 -5
  153. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +46 -0
  154. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +26 -17
  155. package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +25 -19
  156. package/front_end/panels/network/BinaryResourceView.ts +6 -7
  157. package/front_end/panels/network/EventSourceMessagesView.ts +1 -1
  158. package/front_end/panels/network/NetworkDataGridNode.ts +3 -3
  159. package/front_end/panels/network/NetworkLogView.ts +7 -8
  160. package/front_end/panels/network/RequestTimingView.test.ts +35 -1
  161. package/front_end/panels/network/RequestTimingView.ts +96 -0
  162. package/front_end/panels/network/ResourceWebSocketFrameView.ts +2 -2
  163. package/front_end/panels/network/networkTimingTable.css +2 -1
  164. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
  165. package/front_end/panels/profiler/HeapProfileView.ts +3 -3
  166. package/front_end/panels/profiler/HeapSnapshotView.ts +2 -2
  167. package/front_end/panels/profiler/HeapTimelineOverview.ts +12 -12
  168. package/front_end/panels/profiler/IsolateSelector.ts +3 -4
  169. package/front_end/panels/profiler/ProfileFlameChartDataProvider.ts +1 -1
  170. package/front_end/panels/profiler/ProfileSidebarTreeElement.ts +7 -6
  171. package/front_end/panels/profiler/ProfileView.ts +1 -1
  172. package/front_end/panels/recorder/components/RecordingView.ts +2 -2
  173. package/front_end/panels/recorder/injected/{rollup.config.js → rollup.config.mjs} +1 -1
  174. package/front_end/panels/recorder/recorderController.css +0 -4
  175. package/front_end/panels/security/CookieReportTreeElement.ts +1 -9
  176. package/front_end/panels/security/CookieReportView.ts +120 -0
  177. package/front_end/panels/security/SecurityPanel.ts +8 -2
  178. package/front_end/panels/security/cookieReportView.css +46 -0
  179. package/front_end/panels/security/sidebar.css +1 -2
  180. package/front_end/panels/sensors/LocationsSettingsTab.ts +26 -11
  181. package/front_end/panels/sensors/locationsSettingsTab.css +18 -18
  182. package/front_end/panels/settings/AISettingsTab.ts +6 -15
  183. package/front_end/panels/settings/KeybindsSettingsTab.ts +1 -1
  184. package/front_end/panels/settings/SettingsScreen.ts +61 -56
  185. package/front_end/panels/settings/aiSettingsTab.css +3 -14
  186. package/front_end/panels/settings/components/SyncSection.ts +1 -2
  187. package/front_end/panels/settings/components/syncSection.css +0 -10
  188. package/front_end/panels/settings/frameworkIgnoreListSettingsTab.css +3 -1
  189. package/front_end/panels/settings/keybindsSettingsTab.css +7 -10
  190. package/front_end/panels/settings/settingsScreen.css +27 -125
  191. package/front_end/panels/sources/DebuggerPlugin.ts +9 -4
  192. package/front_end/panels/sources/NavigatorView.ts +11 -13
  193. package/front_end/panels/timeline/ActiveFilters.ts +3 -4
  194. package/front_end/panels/timeline/AnimationsTrackAppender.ts +1 -2
  195. package/front_end/panels/timeline/CountersGraph.ts +2 -4
  196. package/front_end/panels/timeline/EventsTimelineTreeView.ts +7 -8
  197. package/front_end/panels/timeline/README.md +2 -1
  198. package/front_end/panels/timeline/TimelineController.ts +14 -4
  199. package/front_end/panels/timeline/TimelineEventOverview.ts +3 -4
  200. package/front_end/panels/timeline/TimelineFilters.ts +3 -4
  201. package/front_end/panels/timeline/TimelineFlameChartDataProvider.test.ts +1 -1
  202. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +3 -10
  203. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +1 -2
  204. package/front_end/panels/timeline/TimelineFlameChartView.ts +21 -12
  205. package/front_end/panels/timeline/TimelineLoader.test.ts +1 -2
  206. package/front_end/panels/timeline/TimelineLoader.ts +3 -4
  207. package/front_end/panels/timeline/TimelineMiniMap.ts +10 -0
  208. package/front_end/panels/timeline/TimelinePanel.ts +20 -8
  209. package/front_end/panels/timeline/TimelineTreeView.test.ts +12 -13
  210. package/front_end/panels/timeline/TimelineTreeView.ts +35 -40
  211. package/front_end/panels/timeline/TimelineUIUtils.test.ts +2 -2
  212. package/front_end/panels/timeline/TimelineUIUtils.ts +12 -14
  213. package/front_end/panels/timeline/components/LayoutShiftDetails.ts +6 -7
  214. package/front_end/panels/timeline/components/LiveMetricsView.test.ts +3 -3
  215. package/front_end/panels/timeline/components/LiveMetricsView.ts +14 -26
  216. package/front_end/panels/timeline/components/MetricCard.test.ts +1 -1
  217. package/front_end/panels/timeline/components/MetricCard.ts +46 -0
  218. package/front_end/panels/timeline/components/NetworkRequestDetails.ts +3 -4
  219. package/front_end/panels/timeline/components/SidebarSingleInsightSet.test.ts +2 -0
  220. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +41 -36
  221. package/front_end/panels/timeline/components/insights/CLSCulprits.ts +19 -33
  222. package/front_end/panels/timeline/components/insights/DocumentLatency.ts +29 -40
  223. package/front_end/panels/timeline/components/insights/FontDisplay.ts +17 -23
  224. package/front_end/panels/timeline/components/insights/Helpers.ts +12 -16
  225. package/front_end/panels/timeline/components/insights/InteractionToNextPaint.ts +14 -26
  226. package/front_end/panels/timeline/components/insights/LCPDiscovery.ts +25 -37
  227. package/front_end/panels/timeline/components/insights/LCPPhases.ts +20 -47
  228. package/front_end/panels/timeline/components/insights/RenderBlocking.ts +19 -28
  229. package/front_end/panels/timeline/components/insights/SidebarInsight.ts +1 -2
  230. package/front_end/panels/timeline/components/insights/SlowCSSSelector.ts +18 -31
  231. package/front_end/panels/timeline/components/insights/Table.ts +5 -3
  232. package/front_end/panels/timeline/components/insights/ThirdParties.ts +18 -25
  233. package/front_end/panels/timeline/components/insights/Viewport.ts +14 -25
  234. package/front_end/panels/timeline/components/liveMetricsView.css +5 -13
  235. package/front_end/panels/timeline/components/metricCard.css +11 -0
  236. package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -1
  237. package/front_end/panels/timeline/overlays/OverlaysImpl.test.ts +5 -5
  238. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +13 -12
  239. package/front_end/panels/timeline/timelineFlameChartView.css +1 -1
  240. package/front_end/panels/timeline/utils/AICallTree.test.ts +105 -0
  241. package/front_end/panels/timeline/utils/AICallTree.ts +25 -24
  242. package/front_end/testing/EnvironmentHelpers.ts +5 -18
  243. package/front_end/testing/InsightHelpers.ts +4 -4
  244. package/front_end/testing/TraceHelpers.ts +1 -1
  245. package/front_end/third_party/puppeteer/README.chromium +2 -2
  246. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +2 -3
  247. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  248. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  249. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts +14 -3
  250. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  251. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js +16 -2
  252. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  253. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts +34 -5
  254. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.d.ts.map +1 -1
  255. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js +51 -2
  256. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Input.js.map +1 -1
  257. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  258. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js +10 -8
  259. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/ElementHandle.js.map +1 -1
  260. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.d.ts.map +1 -1
  261. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js +1 -1
  262. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Frame.js.map +1 -1
  263. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts +14 -4
  264. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.d.ts.map +1 -1
  265. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js +57 -23
  266. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Input.js.map +1 -1
  267. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts +1 -1
  268. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  269. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js +13 -10
  270. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/ElementHandle.js.map +1 -1
  271. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts +15 -4
  272. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.d.ts.map +1 -1
  273. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js +55 -26
  274. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Input.js.map +1 -1
  275. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts +0 -8
  276. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  277. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js +2 -11
  278. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/CallbackRegistry.js.map +1 -1
  279. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts +2 -1
  280. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  281. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js +5 -2
  282. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/ConsoleMessage.js.map +1 -1
  283. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts +7 -0
  284. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.d.ts.map +1 -1
  285. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js +9 -1
  286. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/Errors.js.map +1 -1
  287. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.d.ts.map +1 -1
  288. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js +5 -3
  289. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/WaitTask.js.map +1 -1
  290. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts +1 -1
  291. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.d.ts.map +1 -1
  292. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js +0 -3
  293. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/environment.js.map +1 -1
  294. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.d.ts +1 -1
  295. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/injected.js +1 -1
  296. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.d.ts +1 -1
  297. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/generated/version.js +1 -1
  298. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  299. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  300. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  301. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  302. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  303. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts +14 -0
  304. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
  305. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js +18 -0
  306. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/incremental-id-generator.js.map +1 -0
  307. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +51 -10
  308. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +215 -97
  309. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +2 -3
  310. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  311. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  312. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts +14 -3
  313. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  314. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js +16 -2
  315. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  316. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts +34 -5
  317. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.d.ts.map +1 -1
  318. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js +51 -2
  319. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Input.js.map +1 -1
  320. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.d.ts.map +1 -1
  321. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js +10 -8
  322. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/ElementHandle.js.map +1 -1
  323. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.d.ts.map +1 -1
  324. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js +1 -1
  325. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Frame.js.map +1 -1
  326. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts +14 -4
  327. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.d.ts.map +1 -1
  328. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js +57 -23
  329. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Input.js.map +1 -1
  330. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts +1 -1
  331. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.d.ts.map +1 -1
  332. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js +13 -10
  333. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/ElementHandle.js.map +1 -1
  334. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts +15 -4
  335. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.d.ts.map +1 -1
  336. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js +55 -26
  337. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Input.js.map +1 -1
  338. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts +0 -8
  339. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.d.ts.map +1 -1
  340. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js +1 -9
  341. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/CallbackRegistry.js.map +1 -1
  342. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts +2 -1
  343. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.d.ts.map +1 -1
  344. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js +5 -2
  345. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/ConsoleMessage.js.map +1 -1
  346. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts +7 -0
  347. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.d.ts.map +1 -1
  348. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js +7 -0
  349. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/Errors.js.map +1 -1
  350. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.d.ts.map +1 -1
  351. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js +5 -3
  352. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/WaitTask.js.map +1 -1
  353. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts +1 -1
  354. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.d.ts.map +1 -1
  355. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js +0 -3
  356. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/environment.js.map +1 -1
  357. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.d.ts +1 -1
  358. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/injected.js +1 -1
  359. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.d.ts +1 -1
  360. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/generated/version.js +1 -1
  361. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  362. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  363. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  364. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts +14 -0
  365. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.d.ts.map +1 -0
  366. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js +15 -0
  367. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/incremental-id-generator.js.map +1 -0
  368. package/front_end/third_party/puppeteer/package/lib/types.d.ts +51 -10
  369. package/front_end/third_party/puppeteer/package/package.json +4 -4
  370. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +2 -3
  371. package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +21 -3
  372. package/front_end/third_party/puppeteer/package/src/api/Input.ts +57 -8
  373. package/front_end/third_party/puppeteer/package/src/bidi/ElementHandle.ts +9 -7
  374. package/front_end/third_party/puppeteer/package/src/bidi/Frame.ts +1 -0
  375. package/front_end/third_party/puppeteer/package/src/bidi/Input.ts +72 -31
  376. package/front_end/third_party/puppeteer/package/src/cdp/ElementHandle.ts +14 -9
  377. package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +71 -26
  378. package/front_end/third_party/puppeteer/package/src/common/CallbackRegistry.ts +1 -15
  379. package/front_end/third_party/puppeteer/package/src/common/ConsoleMessage.ts +8 -1
  380. package/front_end/third_party/puppeteer/package/src/common/Errors.ts +7 -0
  381. package/front_end/third_party/puppeteer/package/src/common/WaitTask.ts +9 -9
  382. package/front_end/third_party/puppeteer/package/src/environment.ts +1 -4
  383. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  384. package/front_end/third_party/puppeteer/package/src/generated/version.ts +1 -1
  385. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  386. package/front_end/third_party/puppeteer/package/src/util/incremental-id-generator.ts +20 -0
  387. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +1 -0
  388. package/front_end/ui/components/buttons/Button.test.ts +14 -0
  389. package/front_end/ui/components/buttons/Button.ts +27 -4
  390. package/front_end/ui/components/cards/card.css +7 -4
  391. package/front_end/ui/components/dialogs/Dialog.ts +2 -4
  392. package/front_end/ui/components/dialogs/ShortcutDialog.ts +15 -13
  393. package/front_end/ui/components/dialogs/dialog.css +2 -6
  394. package/front_end/ui/components/dialogs/shortcutDialog.css +33 -41
  395. package/front_end/ui/components/docs/freestyler/basic.ts +6 -8
  396. package/front_end/ui/components/docs/freestyler/empty_state.ts +6 -8
  397. package/front_end/ui/components/docs/performance_panel/track_example.html +1 -1
  398. package/front_end/ui/components/markdown_view/MarkdownView.test.ts +39 -17
  399. package/front_end/ui/components/markdown_view/MarkdownView.ts +77 -14
  400. package/front_end/ui/components/markdown_view/markdownView.css +15 -0
  401. package/front_end/ui/components/settings/SettingCheckbox.ts +3 -2
  402. package/front_end/ui/legacy/ContextMenu.ts +2 -2
  403. package/front_end/ui/legacy/InplaceEditor.ts +18 -14
  404. package/front_end/ui/legacy/TabbedPane.ts +0 -14
  405. package/front_end/ui/legacy/UIUtils.ts +0 -7
  406. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +7 -2
  407. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +8 -4
  408. package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +20 -11
  409. package/front_end/ui/legacy/components/inline_editor/LinkSwatch.test.ts +19 -0
  410. package/front_end/ui/legacy/components/inline_editor/LinkSwatch.ts +1 -1
  411. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -1
  412. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +5 -22
  413. package/front_end/ui/legacy/components/perf_ui/OverviewGrid.ts +129 -100
  414. package/front_end/ui/legacy/components/perf_ui/TimelineGrid.ts +4 -2
  415. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.test.ts +9 -4
  416. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewCalculator.ts +6 -6
  417. package/front_end/ui/legacy/components/perf_ui/TimelineOverviewPane.ts +22 -4
  418. package/front_end/ui/legacy/components/perf_ui/flameChart.css +0 -2
  419. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.test.ts +49 -0
  420. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +23 -46
  421. package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
  422. package/front_end/ui/legacy/components/utils/ImagePreview.ts +1 -1
  423. package/front_end/ui/legacy/textPrompt.css +1 -1
  424. package/front_end/ui/legacy/toolbar.css +4 -5
  425. package/front_end/ui/visual_logging/KnownContextValues.ts +174 -0
  426. package/front_end/ui/visual_logging/LoggingConfig.ts +6 -2
  427. package/package.json +7 -6
  428. package/scripts/build/ninja/bundle.gni +3 -3
  429. package/scripts/build/{rollup.config.js → rollup.config.mjs} +4 -4
  430. package/scripts/devtools_paths.py +8 -4
  431. package/scripts/eslint_rules/tests/check_test_definitions_test.js +8 -3
  432. package/scripts/tools/update_goldens_v2.py +1 -1
  433. package/front_end/models/timeline_model/TimelineModelFilter.ts +0 -61
  434. /package/front_end/Images/{rollup.config.js → rollup.config.mjs} +0 -0
@@ -4,14 +4,20 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
+ import type * as Platform from '../../core/platform/platform.js';
7
8
  import * as SDK from '../../core/sdk/sdk.js';
8
9
  import * as Workspace from '../../models/workspace/workspace.js';
9
10
  import {findMenuItemWithLabel, getMenu} from '../../testing/ContextMenuHelpers.js';
10
11
  import {dispatchClickEvent} from '../../testing/DOMHelpers.js';
11
12
  import {describeWithEnvironment, getGetHostConfigStub, registerNoopActions} from '../../testing/EnvironmentHelpers.js';
12
13
  import * as UI from '../../ui/legacy/legacy.js';
14
+ import * as ElementsPanel from '../elements/elements.js';
15
+ import * as NetworkPanel from '../network/network.js';
16
+ import * as SourcesPanel from '../sources/sources.js';
17
+ import * as TimelinePanel from '../timeline/timeline.js';
13
18
  import * as TimelineUtils from '../timeline/utils/utils.js';
14
19
 
20
+ import * as AiAgent from './AiAgent.js';
15
21
  import * as Freestyler from './freestyler.js';
16
22
 
17
23
  function getTestAidaClient() {
@@ -33,12 +39,16 @@ async function drainMicroTasks() {
33
39
  }
34
40
 
35
41
  describeWithEnvironment('FreestylerPanel', () => {
36
- let mockView: sinon.SinonStub;
42
+ let mockView: sinon.SinonStub<[Freestyler.Props, unknown, HTMLElement]>;
37
43
  let panel: Freestyler.FreestylerPanel;
38
44
 
39
45
  beforeEach(() => {
40
46
  mockView = sinon.stub();
41
47
  registerNoopActions(['elements.toggle-element-search']);
48
+ UI.Context.Context.instance().setFlavor(ElementsPanel.ElementsPanel.ElementsPanel, null);
49
+ UI.Context.Context.instance().setFlavor(NetworkPanel.NetworkPanel.NetworkPanel, null);
50
+ UI.Context.Context.instance().setFlavor(SourcesPanel.SourcesPanel.SourcesPanel, null);
51
+ UI.Context.Context.instance().setFlavor(TimelinePanel.TimelinePanel.TimelinePanel, null);
42
52
  });
43
53
 
44
54
  afterEach(() => {
@@ -309,9 +319,10 @@ describeWithEnvironment('FreestylerPanel', () => {
309
319
  UI.Context.Context.instance().setFlavor(SDK.DOMModel.DOMNode, node);
310
320
  panel.markAsRoot();
311
321
  panel.show(document.body);
322
+ panel.handleAction('freestyler.elements-floating-button');
312
323
 
313
324
  sinon.assert.calledWith(mockView, sinon.match({
314
- selectedElement: node,
325
+ selectedContext: new Freestyler.NodeContext(node),
315
326
  }));
316
327
  });
317
328
 
@@ -324,8 +335,9 @@ describeWithEnvironment('FreestylerPanel', () => {
324
335
  });
325
336
  panel.markAsRoot();
326
337
  panel.show(document.body);
338
+ panel.handleAction('freestyler.elements-floating-button');
327
339
  sinon.assert.calledWith(mockView, sinon.match({
328
- selectedElement: null,
340
+ selectedContext: null,
329
341
  }));
330
342
 
331
343
  const node = sinon.createStubInstance(SDK.DOMModel.DOMNode, {
@@ -334,7 +346,7 @@ describeWithEnvironment('FreestylerPanel', () => {
334
346
  UI.Context.Context.instance().setFlavor(SDK.DOMModel.DOMNode, node);
335
347
 
336
348
  sinon.assert.calledWith(mockView, sinon.match({
337
- selectedElement: node,
349
+ selectedContext: new Freestyler.NodeContext(node),
338
350
  }));
339
351
  });
340
352
 
@@ -347,8 +359,9 @@ describeWithEnvironment('FreestylerPanel', () => {
347
359
  });
348
360
  panel.markAsRoot();
349
361
  panel.show(document.body);
362
+ panel.handleAction('freestyler.elements-floating-button');
350
363
  sinon.assert.calledWith(mockView, sinon.match({
351
- selectedElement: null,
364
+ selectedContext: null,
352
365
  }));
353
366
 
354
367
  const node = sinon.createStubInstance(SDK.DOMModel.DOMNode, {
@@ -357,7 +370,7 @@ describeWithEnvironment('FreestylerPanel', () => {
357
370
  UI.Context.Context.instance().setFlavor(SDK.DOMModel.DOMNode, node);
358
371
 
359
372
  sinon.assert.calledWith(mockView, sinon.match({
360
- selectedElement: null,
373
+ selectedContext: null,
361
374
  }));
362
375
  });
363
376
 
@@ -391,9 +404,10 @@ describeWithEnvironment('FreestylerPanel', () => {
391
404
  UI.Context.Context.instance().setFlavor(SDK.NetworkRequest.NetworkRequest, networkRequest);
392
405
  panel.markAsRoot();
393
406
  panel.show(document.body);
407
+ panel.handleAction('drjones.network-floating-button');
394
408
 
395
409
  sinon.assert.calledWith(mockView, sinon.match({
396
- selectedNetworkRequest: networkRequest,
410
+ selectedContext: new Freestyler.RequestContext(networkRequest),
397
411
  }));
398
412
  });
399
413
 
@@ -406,15 +420,16 @@ describeWithEnvironment('FreestylerPanel', () => {
406
420
  });
407
421
  panel.markAsRoot();
408
422
  panel.show(document.body);
423
+ panel.handleAction('drjones.network-floating-button');
409
424
  sinon.assert.calledWith(mockView, sinon.match({
410
- selectedNetworkRequest: null,
425
+ selectedContext: null,
411
426
  }));
412
427
 
413
428
  const networkRequest = sinon.createStubInstance(SDK.NetworkRequest.NetworkRequest);
414
429
  UI.Context.Context.instance().setFlavor(SDK.NetworkRequest.NetworkRequest, networkRequest);
415
430
 
416
431
  sinon.assert.calledWith(mockView, sinon.match({
417
- selectedNetworkRequest: networkRequest,
432
+ selectedContext: new Freestyler.RequestContext(networkRequest),
418
433
  }));
419
434
  });
420
435
 
@@ -446,9 +461,10 @@ describeWithEnvironment('FreestylerPanel', () => {
446
461
  UI.Context.Context.instance().setFlavor(TimelineUtils.AICallTree.AICallTree, selectedAiCallTree);
447
462
  panel.markAsRoot();
448
463
  panel.show(document.body);
464
+ panel.handleAction('drjones.performance-panel-context');
449
465
 
450
466
  sinon.assert.calledWith(mockView, sinon.match({
451
- selectedAiCallTree,
467
+ selectedContext: new Freestyler.CallTreeContext(selectedAiCallTree as TimelineUtils.AICallTree.AICallTree),
452
468
  }));
453
469
  });
454
470
 
@@ -461,15 +477,16 @@ describeWithEnvironment('FreestylerPanel', () => {
461
477
  });
462
478
  panel.markAsRoot();
463
479
  panel.show(document.body);
480
+ panel.handleAction('drjones.performance-panel-context');
464
481
  sinon.assert.calledWith(mockView, sinon.match({
465
- selectedAiCallTree: null,
482
+ selectedContext: null,
466
483
  }));
467
484
 
468
485
  const selectedAiCallTree = {};
469
486
  UI.Context.Context.instance().setFlavor(TimelineUtils.AICallTree.AICallTree, selectedAiCallTree);
470
487
 
471
488
  sinon.assert.calledWith(mockView, sinon.match({
472
- selectedAiCallTree,
489
+ selectedContext: new Freestyler.CallTreeContext(selectedAiCallTree as TimelineUtils.AICallTree.AICallTree),
473
490
  }));
474
491
  });
475
492
 
@@ -501,9 +518,10 @@ describeWithEnvironment('FreestylerPanel', () => {
501
518
  UI.Context.Context.instance().setFlavor(Workspace.UISourceCode.UISourceCode, uiSourceCode);
502
519
  panel.markAsRoot();
503
520
  panel.show(document.body);
521
+ panel.handleAction('drjones.sources-panel-context');
504
522
 
505
523
  sinon.assert.calledWith(mockView, sinon.match({
506
- selectedFile: uiSourceCode,
524
+ selectedContext: new Freestyler.FileContext(uiSourceCode),
507
525
  }));
508
526
  });
509
527
 
@@ -516,15 +534,16 @@ describeWithEnvironment('FreestylerPanel', () => {
516
534
  });
517
535
  panel.markAsRoot();
518
536
  panel.show(document.body);
537
+ panel.handleAction('drjones.sources-panel-context');
519
538
  sinon.assert.calledWith(mockView, sinon.match({
520
- selectedFile: null,
539
+ selectedContext: null,
521
540
  }));
522
541
 
523
542
  const uiSourceCode = sinon.createStubInstance(Workspace.UISourceCode.UISourceCode);
524
543
  UI.Context.Context.instance().setFlavor(Workspace.UISourceCode.UISourceCode, uiSourceCode);
525
544
 
526
545
  sinon.assert.calledWith(mockView, sinon.match({
527
- selectedFile: uiSourceCode,
546
+ selectedContext: new Freestyler.FileContext(uiSourceCode),
528
547
  }));
529
548
  });
530
549
 
@@ -611,17 +630,17 @@ describeWithEnvironment('FreestylerPanel', () => {
611
630
  syncInfo: getTestSyncInfo(),
612
631
  });
613
632
  panel.handleAction('freestyler.elements-floating-button');
614
- (mockView.lastCall.args.at(0) as Freestyler.Props).onTextSubmit('test');
633
+ mockView.lastCall.args[0].onTextSubmit('test');
615
634
  await drainMicroTasks();
616
635
 
617
- assert.deepEqual(mockView.lastCall.args.at(0).messages, [
636
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
618
637
  {
619
- entity: 'user',
638
+ entity: Freestyler.ChatMessageEntity.USER,
620
639
  text: 'test',
621
640
  },
622
641
  {
623
642
  answer: 'test',
624
- entity: 'model',
643
+ entity: Freestyler.ChatMessageEntity.MODEL,
625
644
  rpcId: undefined,
626
645
  suggestions: undefined,
627
646
  steps: [],
@@ -631,27 +650,66 @@ describeWithEnvironment('FreestylerPanel', () => {
631
650
  const button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'New chat\']');
632
651
  assert.instanceOf(button, HTMLElement);
633
652
  dispatchClickEvent(button);
634
- assert.deepEqual(mockView.lastCall.args.at(0).messages, []);
653
+ assert.deepEqual(mockView.lastCall.args[0].messages, []);
635
654
  });
636
655
 
637
- it('should switch agents and restore history', async () => {
656
+ it('should select default agent after new chat', async () => {
657
+ const stub = getGetHostConfigStub({
658
+ devToolsFreestyler: {
659
+ enabled: true,
660
+ },
661
+ });
638
662
  panel = new Freestyler.FreestylerPanel(mockView, {
639
663
  aidaClient: getTestAidaClient(),
640
664
  aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
641
665
  syncInfo: getTestSyncInfo(),
642
666
  });
643
667
  panel.handleAction('freestyler.elements-floating-button');
644
- (mockView.lastCall.args.at(0) as Freestyler.Props).onTextSubmit('User question to Freestyler?');
668
+ mockView.lastCall.args[0].onTextSubmit('test');
645
669
  await drainMicroTasks();
670
+ UI.Context.Context.instance().setFlavor(
671
+ ElementsPanel.ElementsPanel.ElementsPanel,
672
+ sinon.createStubInstance(ElementsPanel.ElementsPanel.ElementsPanel));
646
673
 
647
- assert.deepEqual(mockView.lastCall.args.at(0).messages, [
674
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
675
+ {
676
+ entity: Freestyler.ChatMessageEntity.USER,
677
+ text: 'test',
678
+ },
648
679
  {
649
- entity: 'user',
680
+ answer: 'test',
681
+ entity: Freestyler.ChatMessageEntity.MODEL,
682
+ rpcId: undefined,
683
+ suggestions: undefined,
684
+ steps: [],
685
+ },
686
+ ]);
687
+ const toolbar = panel.contentElement.querySelector('.freestyler-left-toolbar');
688
+ const button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'New chat\']');
689
+ assert.instanceOf(button, HTMLElement);
690
+ dispatchClickEvent(button);
691
+ assert.deepEqual(mockView.lastCall.args[0].messages, []);
692
+ assert.deepEqual(mockView.lastCall.args[0].agentType, AiAgent.AgentType.FREESTYLER);
693
+ stub.restore();
694
+ });
695
+
696
+ it('should switch agents and restore history', async () => {
697
+ panel = new Freestyler.FreestylerPanel(mockView, {
698
+ aidaClient: getTestAidaClient(),
699
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
700
+ syncInfo: getTestSyncInfo(),
701
+ });
702
+ panel.handleAction('freestyler.elements-floating-button');
703
+ mockView.lastCall.args[0].onTextSubmit('User question to Freestyler?');
704
+ await drainMicroTasks();
705
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
706
+ {
707
+ entity: Freestyler.ChatMessageEntity.USER,
650
708
  text: 'User question to Freestyler?',
651
709
  },
652
710
  {
653
711
  answer: 'test',
654
- entity: 'model',
712
+ entity: Freestyler.ChatMessageEntity.MODEL,
655
713
  rpcId: undefined,
656
714
  suggestions: undefined,
657
715
  steps: [],
@@ -659,16 +717,16 @@ describeWithEnvironment('FreestylerPanel', () => {
659
717
  ]);
660
718
 
661
719
  panel.handleAction('drjones.network-floating-button');
662
- (mockView.lastCall.args.at(0) as Freestyler.Props).onTextSubmit('User question to DrJones?');
720
+ mockView.lastCall.args[0].onTextSubmit('User question to DrJones?');
663
721
  await drainMicroTasks();
664
- assert.deepEqual(mockView.lastCall.args.at(0).messages, [
722
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
665
723
  {
666
- entity: 'user',
724
+ entity: Freestyler.ChatMessageEntity.USER,
667
725
  text: 'User question to DrJones?',
668
726
  },
669
727
  {
670
728
  answer: 'test',
671
- entity: 'model',
729
+ entity: Freestyler.ChatMessageEntity.MODEL,
672
730
  rpcId: undefined,
673
731
  suggestions: undefined,
674
732
  steps: [],
@@ -686,14 +744,14 @@ describeWithEnvironment('FreestylerPanel', () => {
686
744
  contextMenu.invokeHandler(freestylerEntry.id());
687
745
 
688
746
  await drainMicroTasks();
689
- assert.deepEqual(mockView.lastCall.args.at(0).messages, [
747
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
690
748
  {
691
- entity: 'user',
749
+ entity: Freestyler.ChatMessageEntity.USER,
692
750
  text: 'User question to Freestyler?',
693
751
  },
694
752
  {
695
753
  answer: 'test',
696
- entity: 'model',
754
+ entity: Freestyler.ChatMessageEntity.MODEL,
697
755
  rpcId: undefined,
698
756
  suggestions: undefined,
699
757
  steps: [],
@@ -709,27 +767,469 @@ describeWithEnvironment('FreestylerPanel', () => {
709
767
  syncInfo: getTestSyncInfo(),
710
768
  });
711
769
  panel.handleAction('freestyler.elements-floating-button');
712
- (mockView.lastCall.args.at(0) as Freestyler.Props).onTextSubmit('test');
770
+ mockView.lastCall.args[0].onTextSubmit('test');
771
+ await drainMicroTasks();
772
+
773
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
774
+ {
775
+ entity: Freestyler.ChatMessageEntity.USER,
776
+ text: 'test',
777
+ },
778
+ {
779
+ answer: 'test',
780
+ entity: Freestyler.ChatMessageEntity.MODEL,
781
+ rpcId: undefined,
782
+ suggestions: undefined,
783
+ steps: [],
784
+ },
785
+ ]);
786
+ const toolbar = panel.contentElement.querySelector('.freestyler-left-toolbar');
787
+ const button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'Delete chat\']');
788
+ assert.instanceOf(button, HTMLElement);
789
+ dispatchClickEvent(button);
790
+ assert.deepEqual(mockView.lastCall.args[0].messages, []);
791
+ assert.deepEqual(mockView.lastCall.args[0].agentType, undefined);
792
+ });
793
+
794
+ it('should select default agent based on open panel after clearing the chat', async () => {
795
+ const stub = getGetHostConfigStub({
796
+ devToolsFreestyler: {
797
+ enabled: true,
798
+ },
799
+ });
800
+ panel = new Freestyler.FreestylerPanel(mockView, {
801
+ aidaClient: getTestAidaClient(),
802
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
803
+ syncInfo: getTestSyncInfo(),
804
+ });
805
+ panel.handleAction('freestyler.elements-floating-button');
806
+ mockView.lastCall.args[0].onTextSubmit('test');
713
807
  await drainMicroTasks();
714
808
 
715
- assert.deepEqual(mockView.lastCall.args.at(0).messages, [
809
+ UI.Context.Context.instance().setFlavor(
810
+ ElementsPanel.ElementsPanel.ElementsPanel, sinon.createStubInstance(ElementsPanel.ElementsPanel.ElementsPanel));
811
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
716
812
  {
717
- entity: 'user',
813
+ entity: Freestyler.ChatMessageEntity.USER,
718
814
  text: 'test',
719
815
  },
720
816
  {
721
817
  answer: 'test',
722
- entity: 'model',
818
+ entity: Freestyler.ChatMessageEntity.MODEL,
723
819
  rpcId: undefined,
724
820
  suggestions: undefined,
725
821
  steps: [],
726
822
  },
727
823
  ]);
728
824
  const toolbar = panel.contentElement.querySelector('.freestyler-left-toolbar');
729
- const button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'Clear chat\']');
825
+ const button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'Delete chat\']');
730
826
  assert.instanceOf(button, HTMLElement);
731
827
  dispatchClickEvent(button);
732
- assert.deepEqual(mockView.lastCall.args.at(0).messages, []);
733
- assert.deepEqual(mockView.lastCall.args.at(0).agentType, undefined);
828
+ assert.deepEqual(mockView.lastCall.args[0].messages, []);
829
+ assert.deepEqual(mockView.lastCall.args[0].agentType, AiAgent.AgentType.FREESTYLER);
830
+ stub.restore();
831
+ });
832
+
833
+ it('should have empty state after clear chat history', async () => {
834
+ panel = new Freestyler.FreestylerPanel(mockView, {
835
+ aidaClient: getTestAidaClient(),
836
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
837
+ syncInfo: getTestSyncInfo(),
838
+ });
839
+ panel.handleAction('freestyler.elements-floating-button');
840
+ mockView.lastCall.args[0].onTextSubmit('User question to Freestyler?');
841
+ await drainMicroTasks();
842
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
843
+ {
844
+ entity: Freestyler.ChatMessageEntity.USER,
845
+ text: 'User question to Freestyler?',
846
+ },
847
+ {
848
+ answer: 'test',
849
+ entity: Freestyler.ChatMessageEntity.MODEL,
850
+ rpcId: undefined,
851
+ suggestions: undefined,
852
+ steps: [],
853
+ },
854
+ ]);
855
+
856
+ panel.handleAction('drjones.network-floating-button');
857
+ mockView.lastCall.args[0].onTextSubmit('User question to DrJones?');
858
+ await drainMicroTasks();
859
+ assert.deepEqual(mockView.lastCall.args[0].messages, [
860
+ {
861
+ entity: Freestyler.ChatMessageEntity.USER,
862
+ text: 'User question to DrJones?',
863
+ },
864
+ {
865
+ answer: 'test',
866
+ entity: Freestyler.ChatMessageEntity.MODEL,
867
+ rpcId: undefined,
868
+ suggestions: undefined,
869
+ steps: [],
870
+ },
871
+ ]);
872
+
873
+ let toolbar = panel.contentElement.querySelector('.freestyler-left-toolbar');
874
+ let button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'History\']');
875
+ assert.instanceOf(button, HTMLElement);
876
+ let contextMenu = getMenu(() => {
877
+ dispatchClickEvent(button!);
878
+ });
879
+ const clearAll = findMenuItemWithLabel(contextMenu.footerSection(), 'Clear chat history')!;
880
+ assert.isDefined(clearAll);
881
+ contextMenu.invokeHandler(clearAll.id());
882
+ await drainMicroTasks();
883
+ assert.deepEqual(mockView.lastCall.args[0].messages, []);
884
+ assert.deepEqual(mockView.lastCall.args[0].agentType, undefined);
885
+
886
+ await drainMicroTasks();
887
+ contextMenu.discard();
888
+ await drainMicroTasks();
889
+
890
+ toolbar = panel.contentElement.querySelector('.freestyler-left-toolbar');
891
+ button = toolbar!.shadowRoot!.querySelector('devtools-button[aria-label=\'History\']');
892
+ assert.instanceOf(button, HTMLElement);
893
+ contextMenu = getMenu(() => {
894
+ dispatchClickEvent(button);
895
+ });
896
+ const menuItem = findMenuItemWithLabel(contextMenu.defaultSection(), 'No past conversations');
897
+ assert(menuItem);
898
+ });
899
+ describe('cross-origin', () => {
900
+ it('blocks input on cross origin requests', async () => {
901
+ const networkRequest = sinon.createStubInstance(SDK.NetworkRequest.NetworkRequest, {
902
+ url: 'https://a.test' as Platform.DevToolsPath.UrlString,
903
+ });
904
+ UI.Context.Context.instance().setFlavor(SDK.NetworkRequest.NetworkRequest, networkRequest);
905
+ panel = new Freestyler.FreestylerPanel(mockView, {
906
+ aidaClient: getTestAidaClient(),
907
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
908
+ syncInfo: getTestSyncInfo(),
909
+ });
910
+ panel.markAsRoot();
911
+ panel.show(document.body);
912
+ panel.handleAction('drjones.network-floating-button');
913
+
914
+ sinon.assert.calledWith(mockView, sinon.match({
915
+ selectedContext: new Freestyler.RequestContext(networkRequest),
916
+ blockedByCrossOrigin: false,
917
+ }));
918
+
919
+ // Send a query for https://a.test.
920
+ panel.handleAction('drjones.network-floating-button');
921
+ mockView.lastCall.args[0].onTextSubmit('test');
922
+ await drainMicroTasks();
923
+
924
+ // Change context to https://b.test.
925
+ const networkRequest2 = sinon.createStubInstance(SDK.NetworkRequest.NetworkRequest, {
926
+ url: 'https://b.test' as Platform.DevToolsPath.UrlString,
927
+ });
928
+ UI.Context.Context.instance().setFlavor(SDK.NetworkRequest.NetworkRequest, networkRequest2);
929
+ panel.handleAction('drjones.network-floating-button');
930
+ await drainMicroTasks();
931
+
932
+ sinon.assert.calledWith(mockView, sinon.match({
933
+ selectedContext: new Freestyler.RequestContext(networkRequest2),
934
+ blockedByCrossOrigin: true,
935
+ }));
936
+ });
937
+ });
938
+
939
+ describe('auto agent selection for panels', () => {
940
+ describe('Elements panel', () => {
941
+ it('should select FREESTYLER agent when the Elements panel is open in initial render', () => {
942
+ const stub = getGetHostConfigStub({
943
+ devToolsFreestyler: {
944
+ enabled: true,
945
+ },
946
+ });
947
+ UI.Context.Context.instance().setFlavor(
948
+ ElementsPanel.ElementsPanel.ElementsPanel,
949
+ sinon.createStubInstance(ElementsPanel.ElementsPanel.ElementsPanel));
950
+ panel = new Freestyler.FreestylerPanel(mockView, {
951
+ aidaClient: getTestAidaClient(),
952
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
953
+ syncInfo: getTestSyncInfo(),
954
+ });
955
+
956
+ panel.markAsRoot();
957
+ panel.show(document.body);
958
+
959
+ sinon.assert.calledWith(mockView, sinon.match({
960
+ agentType: AiAgent.AgentType.FREESTYLER,
961
+ }));
962
+ stub.restore();
963
+ });
964
+
965
+ it('should update to no agent state when the Elements panel is closed and no other panels are open', () => {
966
+ const stub = getGetHostConfigStub({
967
+ devToolsFreestyler: {
968
+ enabled: true,
969
+ },
970
+ });
971
+ UI.Context.Context.instance().setFlavor(
972
+ ElementsPanel.ElementsPanel.ElementsPanel,
973
+ sinon.createStubInstance(ElementsPanel.ElementsPanel.ElementsPanel));
974
+ panel = new Freestyler.FreestylerPanel(mockView, {
975
+ aidaClient: getTestAidaClient(),
976
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
977
+ syncInfo: getTestSyncInfo(),
978
+ });
979
+
980
+ panel.markAsRoot();
981
+ panel.show(document.body);
982
+ sinon.assert.calledWith(mockView, sinon.match({
983
+ agentType: AiAgent.AgentType.FREESTYLER,
984
+ }));
985
+
986
+ UI.Context.Context.instance().setFlavor(ElementsPanel.ElementsPanel.ElementsPanel, null);
987
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
988
+ stub.restore();
989
+ });
990
+
991
+ it('should render no agent state when Elements panel is open but Freestyler is not enabled', () => {
992
+ const stub = getGetHostConfigStub({
993
+ devToolsFreestyler: {
994
+ enabled: false,
995
+ },
996
+ });
997
+ UI.Context.Context.instance().setFlavor(
998
+ ElementsPanel.ElementsPanel.ElementsPanel,
999
+ sinon.createStubInstance(ElementsPanel.ElementsPanel.ElementsPanel));
1000
+ panel = new Freestyler.FreestylerPanel(mockView, {
1001
+ aidaClient: getTestAidaClient(),
1002
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1003
+ syncInfo: getTestSyncInfo(),
1004
+ });
1005
+
1006
+ panel.markAsRoot();
1007
+ panel.show(document.body);
1008
+
1009
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1010
+ stub.restore();
1011
+ });
1012
+ });
1013
+
1014
+ describe('Network panel', () => {
1015
+ it('should select DRJONES_NETWORK agent when the Network panel is open in initial render', () => {
1016
+ const stub = getGetHostConfigStub({
1017
+ devToolsAiAssistanceNetworkAgent: {
1018
+ enabled: true,
1019
+ },
1020
+ });
1021
+ UI.Context.Context.instance().setFlavor(
1022
+ NetworkPanel.NetworkPanel.NetworkPanel, sinon.createStubInstance(NetworkPanel.NetworkPanel.NetworkPanel));
1023
+ panel = new Freestyler.FreestylerPanel(mockView, {
1024
+ aidaClient: getTestAidaClient(),
1025
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1026
+ syncInfo: getTestSyncInfo(),
1027
+ });
1028
+
1029
+ panel.markAsRoot();
1030
+ panel.show(document.body);
1031
+
1032
+ sinon.assert.calledWith(mockView, sinon.match({
1033
+ agentType: AiAgent.AgentType.DRJONES_NETWORK_REQUEST,
1034
+ }));
1035
+ stub.restore();
1036
+ });
1037
+
1038
+ it('should update to no agent state when the Network panel is closed and no other panels are open', () => {
1039
+ const stub = getGetHostConfigStub({
1040
+ devToolsAiAssistanceNetworkAgent: {
1041
+ enabled: true,
1042
+ },
1043
+ });
1044
+ UI.Context.Context.instance().setFlavor(
1045
+ NetworkPanel.NetworkPanel.NetworkPanel, sinon.createStubInstance(NetworkPanel.NetworkPanel.NetworkPanel));
1046
+ panel = new Freestyler.FreestylerPanel(mockView, {
1047
+ aidaClient: getTestAidaClient(),
1048
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1049
+ syncInfo: getTestSyncInfo(),
1050
+ });
1051
+
1052
+ panel.markAsRoot();
1053
+ panel.show(document.body);
1054
+ sinon.assert.calledWith(mockView, sinon.match({
1055
+ agentType: AiAgent.AgentType.DRJONES_NETWORK_REQUEST,
1056
+ }));
1057
+
1058
+ UI.Context.Context.instance().setFlavor(NetworkPanel.NetworkPanel.NetworkPanel, null);
1059
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1060
+ stub.restore();
1061
+ });
1062
+
1063
+ it('should render no agent state when Network panel is open but devToolsAiAssistanceNetworkAgent is not enabled',
1064
+ () => {
1065
+ const stub = getGetHostConfigStub({
1066
+ devToolsAiAssistanceNetworkAgent: {
1067
+ enabled: false,
1068
+ },
1069
+ });
1070
+ UI.Context.Context.instance().setFlavor(
1071
+ NetworkPanel.NetworkPanel.NetworkPanel,
1072
+ sinon.createStubInstance(NetworkPanel.NetworkPanel.NetworkPanel));
1073
+ panel = new Freestyler.FreestylerPanel(mockView, {
1074
+ aidaClient: getTestAidaClient(),
1075
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1076
+ syncInfo: getTestSyncInfo(),
1077
+ });
1078
+
1079
+ panel.markAsRoot();
1080
+ panel.show(document.body);
1081
+
1082
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1083
+ stub.restore();
1084
+ });
1085
+ });
1086
+
1087
+ describe('Sources panel', () => {
1088
+ it('should select DRJONES_FILE agent when the Sources panel is open in initial render', () => {
1089
+ const stub = getGetHostConfigStub({
1090
+ devToolsAiAssistanceFileAgent: {
1091
+ enabled: true,
1092
+ },
1093
+ });
1094
+ UI.Context.Context.instance().setFlavor(
1095
+ SourcesPanel.SourcesPanel.SourcesPanel, sinon.createStubInstance(SourcesPanel.SourcesPanel.SourcesPanel));
1096
+ panel = new Freestyler.FreestylerPanel(mockView, {
1097
+ aidaClient: getTestAidaClient(),
1098
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1099
+ syncInfo: getTestSyncInfo(),
1100
+ });
1101
+
1102
+ panel.markAsRoot();
1103
+ panel.show(document.body);
1104
+
1105
+ sinon.assert.calledWith(mockView, sinon.match({
1106
+ agentType: AiAgent.AgentType.DRJONES_FILE,
1107
+ }));
1108
+ stub.restore();
1109
+ });
1110
+
1111
+ it('should update to no agent state when the Sources panel is closed and no other panels are open', () => {
1112
+ const stub = getGetHostConfigStub({
1113
+ devToolsAiAssistanceFileAgent: {
1114
+ enabled: true,
1115
+ },
1116
+ });
1117
+ UI.Context.Context.instance().setFlavor(
1118
+ SourcesPanel.SourcesPanel.SourcesPanel, sinon.createStubInstance(SourcesPanel.SourcesPanel.SourcesPanel));
1119
+ panel = new Freestyler.FreestylerPanel(mockView, {
1120
+ aidaClient: getTestAidaClient(),
1121
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1122
+ syncInfo: getTestSyncInfo(),
1123
+ });
1124
+
1125
+ panel.markAsRoot();
1126
+ panel.show(document.body);
1127
+ sinon.assert.calledWith(mockView, sinon.match({
1128
+ agentType: AiAgent.AgentType.DRJONES_FILE,
1129
+ }));
1130
+
1131
+ UI.Context.Context.instance().setFlavor(SourcesPanel.SourcesPanel.SourcesPanel, null);
1132
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1133
+ stub.restore();
1134
+ });
1135
+
1136
+ it('should render no agent state when Sources panel is open but devToolsAiAssistanceFileAgent is not enabled',
1137
+ () => {
1138
+ const stub = getGetHostConfigStub({
1139
+ devToolsAiAssistanceFileAgent: {
1140
+ enabled: false,
1141
+ },
1142
+ });
1143
+ UI.Context.Context.instance().setFlavor(
1144
+ SourcesPanel.SourcesPanel.SourcesPanel,
1145
+ sinon.createStubInstance(SourcesPanel.SourcesPanel.SourcesPanel));
1146
+ panel = new Freestyler.FreestylerPanel(mockView, {
1147
+ aidaClient: getTestAidaClient(),
1148
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1149
+ syncInfo: getTestSyncInfo(),
1150
+ });
1151
+
1152
+ panel.markAsRoot();
1153
+ panel.show(document.body);
1154
+
1155
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1156
+ stub.restore();
1157
+ });
1158
+ });
1159
+
1160
+ describe('Performance panel', () => {
1161
+ it('should select DRJONES_PERFORMANCE agent when the Performance panel is open in initial render', () => {
1162
+ const stub = getGetHostConfigStub({
1163
+ devToolsAiAssistancePerformanceAgent: {
1164
+ enabled: true,
1165
+ },
1166
+ });
1167
+ UI.Context.Context.instance().setFlavor(
1168
+ TimelinePanel.TimelinePanel.TimelinePanel,
1169
+ sinon.createStubInstance(TimelinePanel.TimelinePanel.TimelinePanel));
1170
+ panel = new Freestyler.FreestylerPanel(mockView, {
1171
+ aidaClient: getTestAidaClient(),
1172
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1173
+ syncInfo: getTestSyncInfo(),
1174
+ });
1175
+
1176
+ panel.markAsRoot();
1177
+ panel.show(document.body);
1178
+
1179
+ sinon.assert.calledWith(mockView, sinon.match({
1180
+ agentType: AiAgent.AgentType.DRJONES_PERFORMANCE,
1181
+ }));
1182
+ stub.restore();
1183
+ });
1184
+
1185
+ it('should update to no agent state when the Performance panel is closed and no other panels are open', () => {
1186
+ const stub = getGetHostConfigStub({
1187
+ devToolsAiAssistancePerformanceAgent: {
1188
+ enabled: true,
1189
+ },
1190
+ });
1191
+ UI.Context.Context.instance().setFlavor(
1192
+ TimelinePanel.TimelinePanel.TimelinePanel,
1193
+ sinon.createStubInstance(TimelinePanel.TimelinePanel.TimelinePanel));
1194
+ panel = new Freestyler.FreestylerPanel(mockView, {
1195
+ aidaClient: getTestAidaClient(),
1196
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1197
+ syncInfo: getTestSyncInfo(),
1198
+ });
1199
+
1200
+ panel.markAsRoot();
1201
+ panel.show(document.body);
1202
+ sinon.assert.calledWith(mockView, sinon.match({
1203
+ agentType: AiAgent.AgentType.DRJONES_PERFORMANCE,
1204
+ }));
1205
+
1206
+ UI.Context.Context.instance().setFlavor(TimelinePanel.TimelinePanel.TimelinePanel, null);
1207
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1208
+ stub.restore();
1209
+ });
1210
+
1211
+ it('should render no agent state when Performance panel is open but devToolsAiAssistancePerformanceAgent is not enabled',
1212
+ () => {
1213
+ const stub = getGetHostConfigStub({
1214
+ devToolsAiAssistancePerformanceAgent: {
1215
+ enabled: false,
1216
+ },
1217
+ });
1218
+ UI.Context.Context.instance().setFlavor(
1219
+ TimelinePanel.TimelinePanel.TimelinePanel,
1220
+ sinon.createStubInstance(TimelinePanel.TimelinePanel.TimelinePanel));
1221
+ panel = new Freestyler.FreestylerPanel(mockView, {
1222
+ aidaClient: getTestAidaClient(),
1223
+ aidaAvailability: Host.AidaClient.AidaAccessPreconditions.AVAILABLE,
1224
+ syncInfo: getTestSyncInfo(),
1225
+ });
1226
+
1227
+ panel.markAsRoot();
1228
+ panel.show(document.body);
1229
+
1230
+ assert.deepStrictEqual(mockView.lastCall.args[0].agentType, undefined);
1231
+ stub.restore();
1232
+ });
1233
+ });
734
1234
  });
735
1235
  });