chrome-devtools-frontend 1.0.1555430 → 1.0.1558690

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 (232) hide show
  1. package/front_end/core/common/Object.ts +5 -1
  2. package/front_end/core/host/ResourceLoader.ts +1 -1
  3. package/front_end/core/host/UserMetrics.ts +3 -1
  4. package/front_end/core/sdk/DOMModel.ts +7 -0
  5. package/front_end/core/sdk/NetworkManager.ts +0 -7
  6. package/front_end/core/sdk/SourceMap.ts +16 -2
  7. package/front_end/core/sdk/SourceMapManager.ts +1 -1
  8. package/front_end/core/sdk/SourceMapScopesInfo.ts +11 -4
  9. package/front_end/entrypoints/formatter_worker/FormatterActions.ts +3 -0
  10. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +119 -8
  11. package/front_end/entrypoints/formatter_worker/Substitute.ts +1 -1
  12. package/front_end/entrypoints/main/GlobalAiButton.ts +5 -1
  13. package/front_end/generated/Deprecation.ts +0 -7
  14. package/front_end/generated/InspectorBackendCommands.ts +4 -4
  15. package/front_end/generated/protocol.ts +9 -1
  16. package/front_end/models/ai_assistance/AiConversation.ts +71 -10
  17. package/front_end/models/ai_assistance/ArtifactsManager.ts +67 -0
  18. package/front_end/models/ai_assistance/ConversationHandler.ts +3 -2
  19. package/front_end/models/ai_assistance/agents/AiAgent.ts +17 -27
  20. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +151 -3
  21. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
  22. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  23. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +0 -2
  24. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +3 -3
  25. package/front_end/models/annotations/AnnotationRepository.ts +2 -2
  26. package/front_end/models/bindings/CompilerScriptMapping.ts +7 -6
  27. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +4 -4
  28. package/front_end/models/greendev/Prototypes.ts +56 -0
  29. package/front_end/models/greendev/README.md +5 -0
  30. package/front_end/models/greendev/greendev.ts +5 -0
  31. package/front_end/models/javascript_metadata/NativeFunctions.js +2 -2
  32. package/front_end/models/stack_trace/StackTraceImpl.ts +5 -3
  33. package/front_end/models/stack_trace/StackTraceModel.ts +53 -40
  34. package/front_end/models/trace/EventsSerializer.ts +8 -2
  35. package/front_end/models/trace/extras/TraceTree.ts +4 -2
  36. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +2 -2
  37. package/front_end/models/trace/insights/LCPDiscovery.ts +0 -2
  38. package/front_end/models/trace/types/TraceEvents.ts +0 -1
  39. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +96 -91
  40. package/front_end/panels/ai_assistance/aiAssistancePanel.css +16 -0
  41. package/front_end/panels/ai_assistance/components/ArtifactsViewer.ts +109 -7
  42. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -2
  43. package/front_end/panels/ai_assistance/components/CollapsibleAssistanceContentWidget.ts +7 -8
  44. package/front_end/panels/ai_assistance/components/PerformanceAgentFlameChart.ts +15 -8
  45. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +9 -9
  46. package/front_end/panels/ai_assistance/components/artifactsViewer.css +6 -1
  47. package/front_end/panels/ai_assistance/components/collapsibleAssistanceContentWidget.css +5 -6
  48. package/front_end/panels/application/AppManifestView.ts +360 -391
  49. package/front_end/panels/application/ApplicationPanelSidebar.ts +24 -57
  50. package/front_end/panels/application/CookieItemsView.ts +1 -0
  51. package/front_end/panels/application/OpenedWindowDetailsView.ts +2 -0
  52. package/front_end/panels/application/ServiceWorkersView.ts +2 -0
  53. package/front_end/panels/application/SharedStorageTreeElement.ts +3 -0
  54. package/front_end/panels/application/StorageView.ts +1 -0
  55. package/front_end/panels/application/appManifestView.css +49 -1
  56. package/front_end/panels/application/components/ProtocolHandlersView.ts +2 -2
  57. package/front_end/panels/console/ConsoleViewMessage.ts +4 -3
  58. package/front_end/panels/elements/ElementsTreeElement.ts +30 -1
  59. package/front_end/panels/elements/ElementsTreeOutline.ts +1 -1
  60. package/front_end/panels/elements/ElementsTreeOutlineRenderer.ts +7 -1
  61. package/front_end/panels/elements/components/AdornerManager.ts +8 -0
  62. package/front_end/panels/emulation/DeviceModeToolbar.ts +3 -1
  63. package/front_end/panels/issues/AffectedResourcesView.ts +0 -1
  64. package/front_end/panels/lighthouse/LighthousePanel.ts +10 -0
  65. package/front_end/panels/lighthouse/lighthousePanel.css +46 -3
  66. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +4 -8
  67. package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +148 -97
  68. package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +1 -1
  69. package/front_end/panels/linear_memory_inspector/components/linearMemoryValueInterpreter.css +37 -35
  70. package/front_end/panels/network/NetworkLogViewColumns.ts +9 -9
  71. package/front_end/panels/network/RequestCookiesView.ts +125 -141
  72. package/front_end/panels/network/components/RequestHeadersView.ts +2 -2
  73. package/front_end/panels/network/requestCookiesView.css +22 -20
  74. package/front_end/panels/recorder/components/RecordingView.ts +3 -3
  75. package/front_end/panels/recorder/components/StepView.ts +2 -1
  76. package/front_end/panels/settings/SettingsScreen.ts +133 -1
  77. package/front_end/panels/settings/keybindsSettingsTab.css +4 -0
  78. package/front_end/panels/settings/settings-meta.ts +24 -0
  79. package/front_end/panels/settings/settingsScreen.css +4 -0
  80. package/front_end/panels/sources/CallStackSidebarPane.ts +7 -3
  81. package/front_end/panels/sources/DebuggerPausedMessage.ts +125 -90
  82. package/front_end/panels/sources/SourcesPanel.ts +10 -7
  83. package/front_end/panels/sources/UISourceCodeFrame.ts +3 -17
  84. package/front_end/panels/sources/debuggerPausedMessage.css +8 -0
  85. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +2 -1
  86. package/front_end/panels/timeline/components/sidebarInsightsTab.css +2 -0
  87. package/front_end/third_party/acorn/estree-legacy.d.ts +4 -0
  88. package/front_end/third_party/chromium/README.chromium +1 -1
  89. package/front_end/third_party/puppeteer/README.chromium +2 -2
  90. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts +12 -0
  91. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.d.ts.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Browser.js.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/CDPSession.d.ts.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/CDPSession.js.map +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/ElementHandle.js.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.d.ts.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Frame.js.map +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +14 -2
  100. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts +3 -1
  103. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.d.ts.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js +6 -0
  105. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Browser.js.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts +0 -1
  107. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js +0 -20
  109. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/HTTPRequest.js.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +3 -1
  111. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +10 -14
  113. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
  115. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  116. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js +14 -0
  117. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/core/Connection.d.ts.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +3 -1
  120. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +12 -0
  122. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts +1 -0
  124. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.js +22 -0
  126. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/EmulationManager.js.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +3 -1
  128. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +9 -2
  130. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  131. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js +21 -7
  132. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/BrowserConnector.js.map +1 -1
  133. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/common/EventEmitter.d.ts.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
  136. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
  137. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  139. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  140. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +26 -0
  142. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +86 -20
  143. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts +12 -0
  144. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.d.ts.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Browser.js.map +1 -1
  146. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/CDPSession.d.ts.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/CDPSession.js.map +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.d.ts.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/ElementHandle.js.map +1 -1
  150. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.d.ts.map +1 -1
  151. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Frame.js.map +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +14 -2
  153. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  155. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts +3 -1
  156. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.d.ts.map +1 -1
  157. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js +6 -0
  158. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Browser.js.map +1 -1
  159. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts +0 -1
  160. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.d.ts.map +1 -1
  161. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js +0 -20
  162. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/HTTPRequest.js.map +1 -1
  163. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +3 -1
  164. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  165. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +11 -15
  166. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  167. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts +1 -0
  168. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  169. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js +14 -0
  170. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  171. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/core/Connection.d.ts.map +1 -1
  172. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +3 -1
  173. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  174. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +12 -0
  175. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.d.ts +1 -0
  177. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.d.ts.map +1 -1
  178. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.js +22 -0
  179. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/EmulationManager.js.map +1 -1
  180. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +3 -1
  181. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  182. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +9 -2
  183. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  184. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js +21 -7
  185. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/BrowserConnector.js.map +1 -1
  186. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/common/EventEmitter.d.ts.map +1 -1
  187. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
  188. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
  189. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
  190. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  191. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  192. package/front_end/third_party/puppeteer/package/lib/types.d.ts +26 -0
  193. package/front_end/third_party/puppeteer/package/package.json +2 -2
  194. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +18 -0
  195. package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +1 -2
  196. package/front_end/third_party/puppeteer/package/src/api/ElementHandle.ts +2 -4
  197. package/front_end/third_party/puppeteer/package/src/api/Frame.ts +2 -4
  198. package/front_end/third_party/puppeteer/package/src/api/Page.ts +18 -6
  199. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +13 -0
  200. package/front_end/third_party/puppeteer/package/src/bidi/HTTPRequest.ts +0 -33
  201. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +14 -28
  202. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +19 -0
  203. package/front_end/third_party/puppeteer/package/src/bidi/core/Connection.ts +3 -2
  204. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +19 -0
  205. package/front_end/third_party/puppeteer/package/src/cdp/EmulationManager.ts +30 -0
  206. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +15 -6
  207. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +29 -10
  208. package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +3 -3
  209. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  210. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  211. package/front_end/ui/components/icon_button/iconButton.css +3 -1
  212. package/front_end/ui/components/report_view/ReportView.docs.ts +37 -0
  213. package/front_end/ui/components/report_view/ReportView.ts +12 -6
  214. package/front_end/ui/components/report_view/report.css +16 -0
  215. package/front_end/ui/components/settings/SettingCheckbox.ts +1 -1
  216. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +135 -7
  217. package/front_end/ui/components/text_editor/config.ts +6 -6
  218. package/front_end/ui/legacy/ContextMenu.ts +11 -2
  219. package/front_end/ui/legacy/Floaty.ts +5 -9
  220. package/front_end/ui/legacy/InspectorView.ts +2 -1
  221. package/front_end/ui/legacy/ReportView.ts +5 -4
  222. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  223. package/front_end/ui/legacy/Toolbar.ts +4 -0
  224. package/front_end/ui/legacy/UIUtils.ts +0 -2
  225. package/front_end/ui/legacy/Widget.ts +7 -0
  226. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +18 -3
  227. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +3 -3
  228. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +6 -0
  229. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -1
  230. package/front_end/ui/legacy/reportView.css +0 -24
  231. package/front_end/ui/visual_logging/KnownContextValues.ts +7 -0
  232. package/package.json +1 -1
@@ -58,7 +58,7 @@ export class AiConversation {
58
58
  }
59
59
 
60
60
  readonly id: string;
61
- type: ConversationType;
61
+ #type: ConversationType;
62
62
  #isReadOnly: boolean;
63
63
  readonly history: ResponseData[];
64
64
  #isExternal: boolean;
@@ -66,6 +66,9 @@ export class AiConversation {
66
66
  #aidaClient: Host.AidaClient.AidaClient;
67
67
  #changeManager: ChangeManager|undefined;
68
68
  #agent: AiAgent<unknown>;
69
+ #origin?: string;
70
+
71
+ #contexts: Array<ConversationContext<unknown>> = [];
69
72
 
70
73
  constructor(
71
74
  type: ConversationType,
@@ -78,13 +81,13 @@ export class AiConversation {
78
81
  ) {
79
82
  this.#changeManager = changeManager;
80
83
  this.#aidaClient = aidaClient;
81
- this.type = type;
82
- this.#agent = this.#createAgent();
84
+ this.#type = type;
83
85
 
84
86
  this.id = id;
85
87
  this.#isReadOnly = isReadOnly;
86
88
  this.#isExternal = isExternal;
87
89
  this.history = this.#reconstructHistory(data);
90
+ this.#agent = this.#createAgent();
88
91
  }
89
92
 
90
93
  get isReadOnly(): boolean {
@@ -109,6 +112,25 @@ export class AiConversation {
109
112
  return this.history.length === 0;
110
113
  }
111
114
 
115
+ #setOriginIfEmpty(newOrigin: string|undefined): void {
116
+ if (!this.#origin) {
117
+ this.#origin = newOrigin;
118
+ }
119
+ }
120
+
121
+ setContext(updateContext: ConversationContext<unknown>|null): void {
122
+ if (!updateContext) {
123
+ this.#contexts = [];
124
+ return;
125
+ }
126
+
127
+ this.#contexts = [updateContext];
128
+ }
129
+
130
+ get selectedContext(): ConversationContext<unknown>|undefined {
131
+ return this.#contexts.at(0);
132
+ }
133
+
112
134
  #reconstructHistory(historyWithoutImages: ResponseData[]): ResponseData[] {
113
135
  const imageHistory = AiHistoryStorage.instance().getImageHistory();
114
136
  if (imageHistory && imageHistory.length > 0) {
@@ -214,7 +236,7 @@ export class AiConversation {
214
236
  }
215
237
  return item;
216
238
  }),
217
- type: this.type,
239
+ type: this.#type,
218
240
  isExternal: this.#isExternal,
219
241
  };
220
242
  }
@@ -223,10 +245,11 @@ export class AiConversation {
223
245
  const options = {
224
246
  aidaClient: this.#aidaClient,
225
247
  serverSideLoggingEnabled: isAiAssistanceServerSideLoggingEnabled(),
248
+ sessionId: this.id,
226
249
  changeManager: this.#changeManager,
227
250
  };
228
251
  let agent: AiAgent<unknown>;
229
- switch (this.type) {
252
+ switch (this.#type) {
230
253
  case ConversationType.STYLING: {
231
254
  agent = new StylingAgent(options);
232
255
  break;
@@ -326,24 +349,62 @@ Time: ${micros(time)}`;
326
349
  async *
327
350
  run(
328
351
  initialQuery: string,
329
- options: {selected: ConversationContext<unknown>|null, signal?: AbortSignal, extraContext?: ExtraContext[]},
330
- multimodalInput?: MultimodalInput,
352
+ options: {
353
+
354
+ signal?: AbortSignal,
355
+ extraContext?: ExtraContext[],
356
+ multimodalInput?: MultimodalInput,
357
+ } = {},
331
358
  ): AsyncGenerator<ResponseData, void, void> {
332
359
  if (options.extraContext) {
333
360
  await this.#createFactsForExtraContext(options.extraContext);
334
361
  }
335
- for await (const data of this.#agent.run(initialQuery, options, multimodalInput)) {
362
+ this.#setOriginIfEmpty(this.selectedContext?.getOrigin());
363
+
364
+ if (this.isBlockedByOrigin) {
365
+ throw new Error('Cross-origin context data should not be included');
366
+ }
367
+
368
+ function shouldAddToHistory(data: ResponseData): boolean {
336
369
  // We don't want to save partial responses to the conversation history.
337
370
  // TODO(crbug.com/463325400): We should save interleaved answers to the history as well.
338
- if (data.type !== ResponseType.ANSWER || data.complete) {
371
+ if (data.type === ResponseType.ANSWER && !data.complete) {
372
+ return false;
373
+ }
374
+
375
+ return true;
376
+ }
377
+
378
+ for await (const data of this.#agent.run(
379
+ initialQuery,
380
+ {
381
+ signal: options.signal,
382
+ selected: this.selectedContext ?? null,
383
+ },
384
+ options.multimodalInput,
385
+ )) {
386
+ if (shouldAddToHistory(data)) {
339
387
  void this.addHistoryItem(data);
340
388
  }
341
389
  yield data;
342
390
  }
343
391
  }
344
392
 
393
+ /**
394
+ * Indicates whether the new conversation context is blocked due to cross-origin restrictions.
395
+ * This happens when the conversation's context has a different
396
+ * origin than the selected context.
397
+ */
398
+ get isBlockedByOrigin(): boolean {
399
+ return !this.#contexts.every(context => context.isOriginAllowed(this.#origin));
400
+ }
401
+
345
402
  get origin(): string|undefined {
346
- return this.#agent.origin;
403
+ return this.#origin;
404
+ }
405
+
406
+ get type(): ConversationType {
407
+ return this.#type;
347
408
  }
348
409
  }
349
410
 
@@ -0,0 +1,67 @@
1
+ // Copyright 2025 The Chromium Authors
2
+ // Use of this source code is governed by a BSD-style license that can be
3
+ // found in the LICENSE file.
4
+
5
+ import type * as SDK from '../../core/sdk/sdk.js';
6
+ import type * as Trace from '../../models/trace/trace.js';
7
+ import type {InsightKeys} from '../trace/insights/types.js';
8
+
9
+ export interface InsightArtifact {
10
+ type: 'insight';
11
+ insightType: InsightKeys;
12
+ }
13
+
14
+ export interface NetworkRequestArtifact {
15
+ type: 'network-request';
16
+ request: SDK.NetworkRequest.NetworkRequest|Trace.Types.Events.SyntheticNetworkRequest;
17
+ }
18
+
19
+ export interface FlameChartArtifact {
20
+ type: 'flamechart';
21
+ start: Trace.Types.Timing.Micro;
22
+ end: Trace.Types.Timing.Micro;
23
+ }
24
+
25
+ export type Artifact = InsightArtifact|NetworkRequestArtifact|FlameChartArtifact;
26
+
27
+ export class ArtifactAddedEvent extends Event {
28
+ static readonly eventName = 'artifactadded';
29
+
30
+ constructor(public artifact: Artifact) {
31
+ super(ArtifactAddedEvent.eventName);
32
+ }
33
+ }
34
+
35
+ let instance: ArtifactsManager|null = null;
36
+
37
+ export class ArtifactsManager extends EventTarget {
38
+ #artifacts: Artifact[] = [];
39
+
40
+ static instance(): ArtifactsManager {
41
+ if (!instance) {
42
+ instance = new ArtifactsManager();
43
+ }
44
+ return instance;
45
+ }
46
+
47
+ static removeInstance(): void {
48
+ instance = null;
49
+ }
50
+
51
+ private constructor() {
52
+ super();
53
+ }
54
+
55
+ get artifacts(): Artifact[] {
56
+ return this.#artifacts;
57
+ }
58
+
59
+ addArtifact(artifact: Artifact): void {
60
+ this.#artifacts.push(artifact);
61
+ this.dispatchEvent(new ArtifactAddedEvent(artifact));
62
+ }
63
+
64
+ clear(): void {
65
+ this.#artifacts = [];
66
+ }
67
+ }
@@ -213,7 +213,7 @@ export class ConversationHandler extends Common.ObjectWrapper.ObjectWrapper<Even
213
213
  const conversation = new AiConversation(
214
214
  conversationType,
215
215
  [],
216
- aiAgent.id,
216
+ aiAgent.sessionId,
217
217
  /* isReadOnly */ true,
218
218
  this.#aidaClient,
219
219
  undefined,
@@ -228,7 +228,8 @@ export class ConversationHandler extends Common.ObjectWrapper.ObjectWrapper<Even
228
228
  selected: NodeContext|PerformanceTraceContext|RequestContext|null,
229
229
  }): AsyncGenerator<ExternalRequestResponse, ExternalRequestResponse> {
230
230
  const {conversation, prompt, selected} = opts;
231
- const generator = conversation.run(prompt, {selected});
231
+ conversation.setContext(selected);
232
+ const generator = conversation.run(prompt);
232
233
  const devToolsLogs: object[] = [];
233
234
  for await (const data of generator) {
234
235
  if (data.type !== ResponseType.ANSWER || data.complete) {
@@ -125,6 +125,7 @@ export interface RequestOptions {
125
125
  export interface AgentOptions {
126
126
  aidaClient: Host.AidaClient.AidaClient;
127
127
  serverSideLoggingEnabled?: boolean;
128
+ sessionId?: string;
128
129
  confirmSideEffectForTest?: typeof Promise.withResolvers;
129
130
  }
130
131
 
@@ -270,7 +271,7 @@ export abstract class AiAgent<T> {
270
271
  abstract readonly userTier: string|undefined;
271
272
  abstract handleContextDetails(select: ConversationContext<T>|null): AsyncGenerator<ContextResponse, void, void>;
272
273
 
273
- readonly #sessionId: string = crypto.randomUUID();
274
+ readonly #sessionId: string;
274
275
  readonly #aidaClient: Host.AidaClient.AidaClient;
275
276
  readonly #serverSideLoggingEnabled: boolean;
276
277
  readonly confirmSideEffect: typeof Promise.withResolvers;
@@ -284,12 +285,6 @@ export abstract class AiAgent<T> {
284
285
  aidaResponse: Host.AidaClient.DoConversationResponse,
285
286
  }> = [];
286
287
 
287
- /**
288
- * Might need to be part of history in case we allow chatting in
289
- * historical conversations.
290
- */
291
- #origin?: string;
292
-
293
288
  /**
294
289
  * `context` does not change during `AiAgent.run()`, ensuring that calls to JS
295
290
  * have the correct `context`. We don't want element selection by the user to
@@ -297,7 +292,6 @@ export abstract class AiAgent<T> {
297
292
  */
298
293
  protected context?: ConversationContext<T>;
299
294
 
300
- #id: string = crypto.randomUUID();
301
295
  #history: Host.AidaClient.Content[] = [];
302
296
 
303
297
  #facts: Set<Host.AidaClient.RequestFact> = new Set<Host.AidaClient.RequestFact>();
@@ -305,6 +299,7 @@ export abstract class AiAgent<T> {
305
299
  constructor(opts: AgentOptions) {
306
300
  this.#aidaClient = opts.aidaClient;
307
301
  this.#serverSideLoggingEnabled = opts.serverSideLoggingEnabled ?? false;
302
+ this.#sessionId = opts.sessionId ?? crypto.randomUUID();
308
303
  this.confirmSideEffect = opts.confirmSideEffectForTest ?? (() => Promise.withResolvers());
309
304
  }
310
305
 
@@ -393,12 +388,8 @@ export abstract class AiAgent<T> {
393
388
  return request;
394
389
  }
395
390
 
396
- get id(): string {
397
- return this.#id;
398
- }
399
-
400
- get origin(): string|undefined {
401
- return this.#origin;
391
+ get sessionId(): string {
392
+ return this.#sessionId;
402
393
  }
403
394
 
404
395
  /**
@@ -496,15 +487,8 @@ export abstract class AiAgent<T> {
496
487
  multimodalInput?: MultimodalInput,
497
488
  ): AsyncGenerator<ResponseData, void, void> {
498
489
  await options.selected?.refresh();
499
-
500
490
  if (options.selected) {
501
- // First context set on the agent determines its origin from now on.
502
- if (this.#origin === undefined) {
503
- this.#origin = options.selected.getOrigin();
504
- }
505
- if (options.selected.isOriginAllowed(this.#origin)) {
506
- this.context = options.selected;
507
- }
491
+ this.context = options.selected;
508
492
  }
509
493
 
510
494
  const enhancedQuery = await this.enhanceQuery(initialQuery, options.selected, multimodalInput?.type);
@@ -596,10 +580,16 @@ export abstract class AiAgent<T> {
596
580
 
597
581
  if (functionCall) {
598
582
  try {
599
- const result = yield* this.#callFunction(functionCall.name, functionCall.args, {
600
- ...options,
601
- explanation: textResponse,
602
- });
583
+ const result = yield*
584
+ this.#callFunction(
585
+ functionCall.name,
586
+ functionCall.args,
587
+ {
588
+ ...options,
589
+ explanation: textResponse,
590
+ },
591
+ );
592
+
603
593
  if (options.signal?.aborted) {
604
594
  yield this.#createErrorResponse(ErrorType.ABORT);
605
595
  break;
@@ -720,7 +710,7 @@ export abstract class AiAgent<T> {
720
710
 
721
711
  result = await call.handler(args, {
722
712
  ...options,
723
- approved: approvedRun,
713
+ approved: true,
724
714
  });
725
715
  }
726
716
 
@@ -10,8 +10,10 @@ import * as Root from '../../../core/root/root.js';
10
10
  import * as SDK from '../../../core/sdk/sdk.js';
11
11
  import * as Tracing from '../../../services/tracing/tracing.js';
12
12
  import * as Annotations from '../../annotations/annotations.js';
13
+ import * as Logs from '../../logs/logs.js';
13
14
  import * as SourceMapScopes from '../../source_map_scopes/source_map_scopes.js';
14
15
  import * as Trace from '../../trace/trace.js';
16
+ import {ArtifactsManager} from '../ArtifactsManager.js';
15
17
  import {
16
18
  PerformanceInsightFormatter,
17
19
  } from '../data_formatters/PerformanceInsightFormatter.js';
@@ -67,7 +69,49 @@ const greenDevAdditionalAnnotationsGuidelines = `
67
69
  - The annotationMessage should be descriptive and relevant to why the element or network request is being highlighted.
68
70
  `;
69
71
 
70
- const greenDevAdditionalWidgetGuidelines = `
72
+ const getGreenDevAdditionalWidgetGuidelines = (): string => {
73
+ // GreenDev is experimenting with multiple ways to display widget:
74
+ // if widgetsFromFunctionCalls is true, then we use function calls to add widgets
75
+ // otherwise we use ai-insight tags
76
+ const widgetsFromFunctionCalls = true;
77
+
78
+ if (widgetsFromFunctionCalls) {
79
+ return `
80
+ - CRITICAL: You have access to three functions for adding rich, interactive widgets to your response:
81
+ \`addInsightWidget\`, \`addNetworkRequestWidget\`, and \`addFlameChartWidget\`.
82
+ You MUST use these functions whenever you refer to a corresponding entity.
83
+
84
+ - **\`addInsightWidget({insightType: '...'})\`**:
85
+ - **When to use**: Call this function every time you mention a specific performance insight (e.g., LCP, INP,
86
+ CLS culprits).
87
+ - **Purpose**: It embeds an interactive widget that provides a detailed breakdown and visualization of the
88
+ insight.
89
+ - **Example**: If you are explaining the causes of a poor LCP score, you MUST also call
90
+ \`addInsightWidget({insightType: 'LCPBreakdown'})\`. This provides the user with the data to explore
91
+ alongside your explanation.
92
+ - **\`addNetworkRequestWidget({eventKey: '...'})\`**:
93
+ - **When to use**: Call this function whenever you discuss a specific network request.
94
+ - **Purpose**: It adds a widget displaying the full details of the network request, such as its timing,
95
+ headers, and priority.
96
+ - **Critical**: The eventKey should be the trace event key (only the number, no letters prefix or -) of that
97
+ script's network request.
98
+ - **Example**: If you identify a render-blocking script, you MUST also call
99
+ \`addNetworkRequestWidget({eventKey: '...'})\` with the trace event key (only the number, no letters prefix
100
+ or -) of that script's network request.
101
+ - **\`addFlameChartWidget({start: ..., end: ...})\`**:
102
+ - **When to use**: Call this function to highlight a specific time range within the trace, especially when
103
+ discussing long tasks, specific events, or periods of high activity.
104
+ - **Purpose**: It embeds a focused flame chart visualization for the given time range (in microseconds).
105
+ - **Example**: If you find a long task that is blocking the main thread, you MUST also call
106
+ \`addFlameChartWidget({start: 123456, end: 789012})\`. This provides the user with the data to explore
107
+ alongside your explanation.
108
+ - **General Rules**:
109
+ - You MUST call these functions as soon as you identify the entity you are discussing.
110
+ - Do NOT add more than one widget for the same insight, network request, or time range to avoid redundancy.
111
+ `;
112
+ }
113
+
114
+ return `
71
115
  - **Visualizing Insights**: When discussing the breakdown of specific metrics or a performance problem,
72
116
  you must render the appropriate Insight Overview component. Use these tags on a new line within your response:
73
117
  - For LCP breakdown: <ai-insight value="LCPBreakdown">
@@ -102,6 +146,7 @@ you must render the appropriate Insight Overview component. Use these tags on a
102
146
  - For example, for LCP, the phases like Time to First Byte will be part of the insight widget, so you must not state them in the text. This applies to other insights and network request timings.
103
147
  - Do not display any of the same widgets more than once. For example, if you have already displayed a network request widget for a specific event, do not display it again in the same response.
104
148
  `;
149
+ };
105
150
 
106
151
  /**
107
152
  * Preamble clocks in at ~1341 tokens.
@@ -111,7 +156,7 @@ you must render the appropriate Insight Overview component. Use these tags on a
111
156
  * Check token length in https://aistudio.google.com/
112
157
  */
113
158
  const buildPreamble = (): string => {
114
- const greenDevEnabled = Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled;
159
+ const greenDevEnabled = Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled);
115
160
  const annotationsEnabled = Annotations.AnnotationRepository.annotationsEnabled();
116
161
  return `You are an assistant, expert in web performance and highly skilled with Chrome DevTools.
117
162
 
@@ -166,7 +211,7 @@ Note: if the user asks a specific question about the trace (such as "What is my
166
211
  - Be direct and to the point. Avoid unnecessary introductory phrases or filler content. Focus on delivering actionable advice efficiently.
167
212
 
168
213
  ${annotationsEnabled ? greenDevAdditionalAnnotationsGuidelines : ''}
169
- ${greenDevEnabled ? greenDevAdditionalWidgetGuidelines : ''}
214
+ ${greenDevEnabled ? getGreenDevAdditionalWidgetGuidelines() : ''}
170
215
 
171
216
  ## Strict Constraints
172
217
 
@@ -1200,6 +1245,109 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1200
1245
  },
1201
1246
  });
1202
1247
  }
1248
+
1249
+ if (Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled) {
1250
+ this.declareFunction<{insightType: Trace.Insights.Types.InsightKeys}>('addInsightWidget', {
1251
+ description:
1252
+ 'Adds an insight widget to the response. When mentioning an insight, call this function to also display an appropriate widget.',
1253
+ parameters: {
1254
+ type: Host.AidaClient.ParametersTypes.OBJECT,
1255
+ description: '',
1256
+ nullable: false,
1257
+ properties: {
1258
+ insightType: {
1259
+ type: Host.AidaClient.ParametersTypes.STRING,
1260
+ description:
1261
+ 'The name of the insight. Only use the insight names given in the "Available insights" list.',
1262
+ nullable: false,
1263
+ },
1264
+ },
1265
+ },
1266
+ handler: async _params => {
1267
+ ArtifactsManager.instance().addArtifact({type: 'insight', insightType: _params.insightType});
1268
+ return {result: {success: true}};
1269
+ },
1270
+ });
1271
+
1272
+ this.declareFunction<{eventKey: string}, object|{error: string}>('addNetworkRequestWidget', {
1273
+ description:
1274
+ 'Adds a network request widget to the response. When mentioning a network request, call this function with its trace event key.',
1275
+ parameters: {
1276
+ type: Host.AidaClient.ParametersTypes.OBJECT,
1277
+ description: '',
1278
+ nullable: false,
1279
+ properties: {
1280
+ eventKey: {
1281
+ type: Host.AidaClient.ParametersTypes.STRING,
1282
+ description: 'The trace event key for the network request.',
1283
+ nullable: false,
1284
+ },
1285
+ },
1286
+ },
1287
+ handler: async _params => {
1288
+ const rawTraceEvent =
1289
+ Trace.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().getRawTraceEvents().at(
1290
+ Number(_params.eventKey));
1291
+ // Get the trace event object if it is available.
1292
+ // If the trace is uploaded, we need to use the synthetic event.
1293
+ if (rawTraceEvent && Trace.Types.Events.isSyntheticNetworkRequest(rawTraceEvent)) {
1294
+ const rawTraceEventId = rawTraceEvent?.args?.data?.requestId;
1295
+ const rawTraceEventUrl = rawTraceEvent?.args?.data?.url;
1296
+ const networkRequest = rawTraceEvent ? Logs.NetworkLog.NetworkLog.instance()
1297
+ .requestsForId(rawTraceEventId)
1298
+ .find(r => r.url() === rawTraceEventUrl) :
1299
+ null;
1300
+ if (networkRequest) {
1301
+ ArtifactsManager.instance().addArtifact({type: 'network-request', request: networkRequest});
1302
+ return {result: {success: true}};
1303
+ }
1304
+ }
1305
+
1306
+ const syntheticRequest =
1307
+ Trace.Helpers.SyntheticEvents.SyntheticEventsManager.getActiveManager().syntheticEventForRawEventIndex(
1308
+ Number(_params.eventKey));
1309
+
1310
+ if (syntheticRequest && Trace.Types.Events.isSyntheticNetworkRequest(syntheticRequest)) {
1311
+ ArtifactsManager.instance().addArtifact({
1312
+ type: 'network-request',
1313
+ request: syntheticRequest,
1314
+ });
1315
+ return {result: {success: true}};
1316
+ }
1317
+
1318
+ return {result: {error: 'Could not find network request'}};
1319
+ },
1320
+ });
1321
+
1322
+ this.declareFunction<{start: number, end: number}, object|{error: string}>('addFlameChartWidget', {
1323
+ description: 'Adds a flame chart widget to the response.',
1324
+ parameters: {
1325
+ type: Host.AidaClient.ParametersTypes.OBJECT,
1326
+ description: '',
1327
+ nullable: false,
1328
+ properties: {
1329
+ start: {
1330
+ type: Host.AidaClient.ParametersTypes.INTEGER,
1331
+ description: 'The start time of the flame chart in microseconds.',
1332
+ nullable: false,
1333
+ },
1334
+ end: {
1335
+ type: Host.AidaClient.ParametersTypes.INTEGER,
1336
+ description: 'The end time of the flame chart in microseconds.',
1337
+ nullable: false,
1338
+ },
1339
+ },
1340
+ },
1341
+ handler: async _params => {
1342
+ ArtifactsManager.instance().addArtifact({
1343
+ type: 'flamechart',
1344
+ start: Trace.Types.Timing.Micro(_params.start),
1345
+ end: Trace.Types.Timing.Micro(_params.end),
1346
+ });
1347
+ return {result: {success: true}};
1348
+ },
1349
+ });
1350
+ }
1203
1351
  }
1204
1352
 
1205
1353
  async addElementAnnotation(elementId: string, annotationMessage: string):
@@ -275,7 +275,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
275
275
  this.#changes = opts.changeManager || new ChangeManager();
276
276
  this.#execJs = opts.execJs ?? executeJsCode;
277
277
  this.#createExtensionScope = opts.createExtensionScope ?? ((changes: ChangeManager) => {
278
- return new ExtensionScope(changes, this.id, this.context?.getItem() ?? null);
278
+ return new ExtensionScope(changes, this.sessionId, this.context?.getItem() ?? null);
279
279
  });
280
280
 
281
281
  this.declareFunction<{
@@ -13,6 +13,7 @@ import * as StylingAgent from './agents/StylingAgent.js';
13
13
  import * as AiConversation from './AiConversation.js';
14
14
  import * as AiHistoryStorage from './AiHistoryStorage.js';
15
15
  import * as AiUtils from './AiUtils.js';
16
+ import * as ArtifactsManager from './ArtifactsManager.js';
16
17
  import * as BuiltInAi from './BuiltInAi.js';
17
18
  import * as ChangeManager from './ChangeManager.js';
18
19
  import * as ConversationHandler from './ConversationHandler.js';
@@ -38,6 +39,7 @@ export {
38
39
  AiHistoryStorage,
39
40
  AIQueries,
40
41
  AiUtils,
42
+ ArtifactsManager,
41
43
  BuiltInAi,
42
44
  ChangeManager,
43
45
  ConversationHandler,
@@ -262,8 +262,6 @@ export class PerformanceInsightFormatter {
262
262
  });
263
263
 
264
264
  rootCauses.unsizedImages.forEach(img => {
265
- // TODO(b/413284569): if we store a nice human readable name for this
266
- // image in the trace metadata, we can do something much nicer here.
267
265
  const url = img.paintImageEvent.args.data.url;
268
266
  const nodeName = img.paintImageEvent.args.data.nodeName;
269
267
  const extraText = url ? `url: ${this.#formatUrl(url)}` : `id: ${img.backendNodeId}`;
@@ -534,7 +534,7 @@ Metrics (lab / observed):
534
534
  - Load delay: 90 ms, bounds: {min: 157423704371, max: 157423794709}
535
535
  - Load duration: 64 ms, bounds: {min: 157423794709, max: 157423858674}
536
536
  - Render delay: 94 ms, bounds: {min: 157423858674, max: 157423953162}
537
- - CLS: 0.04, event: (eventKey: s--1, ts: 157425604232)
537
+ - CLS: 0.04, event: (eventKey: s-166266, ts: 157425604232)
538
538
  Metrics (field / real users): n/a – no data for this page in CrUX
539
539
  Available insights:
540
540
  - insight name: LCPBreakdown
@@ -665,7 +665,7 @@ Metrics (lab / observed):
665
665
  - Load delay: 46 ms, bounds: {min: 59728656735, max: 59728702313}
666
666
  - Load duration: 506 ms, bounds: {min: 59728702313, max: 59729208600}
667
667
  - Render delay: 104 ms, bounds: {min: 59729208600, max: 59729312744}
668
- - CLS: 0.31, event: (eventKey: s--1, ts: 59729100192)
668
+ - CLS: 0.31, event: (eventKey: s-14787, ts: 59729100192)
669
669
  Metrics (field / real users): n/a – no data for this page in CrUX
670
670
  Available insights:
671
671
  - insight name: Cache
@@ -738,7 +738,7 @@ Metrics (lab / observed):
738
738
  - Load delay: 46 ms, bounds: {min: 59728656735, max: 59728702313}
739
739
  - Load duration: 506 ms, bounds: {min: 59728702313, max: 59729208600}
740
740
  - Render delay: 104 ms, bounds: {min: 59729208600, max: 59729312744}
741
- - CLS: 0.31, event: (eventKey: s--1, ts: 59729100192)
741
+ - CLS: 0.31, event: (eventKey: s-14787, ts: 59729100192)
742
742
  Metrics (field / real users):
743
743
  - LCP: 1740 ms (scope: url)
744
744
  - INP: 185 ms (scope: url)
@@ -3,8 +3,8 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
- import * as Root from '../../core/root/root.js';
7
6
  import type * as SDK from '../../core/sdk/sdk.js';
7
+ import * as GreenDev from '../greendev/greendev.js';
8
8
 
9
9
  import {AnnotationType} from './AnnotationType.js';
10
10
 
@@ -63,7 +63,7 @@ export class AnnotationRepository {
63
63
  }
64
64
 
65
65
  static annotationsEnabled(): boolean {
66
- const enabled = Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled);
66
+ const enabled = GreenDev.Prototypes.instance().isEnabled('aiAnnotations');
67
67
  // TODO(finnur): Fix race when Repository is created before feature flags have been set properly.
68
68
  if (!enabled) {
69
69
  this.#hasRepliedGreenDevDisabled = true;
@@ -281,6 +281,7 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
281
281
  if (!sourceMap) {
282
282
  return null;
283
283
  }
284
+ await sourceMap.waitForScopeInfo();
284
285
 
285
286
  const {lineNumber, columnNumber} = script.rawLocationToRelativeLocation(rawLocation);
286
287
  const {url, scope} = sourceMap.findOriginalFunctionScope({line: lineNumber, column: columnNumber}) ?? {};
@@ -313,17 +314,16 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
313
314
  return new Workspace.UISourceCode.UIFunctionBounds(uiSourceCode, range, name);
314
315
  }
315
316
 
316
- translateRawFramesStep(
317
+ async translateRawFramesStep(
317
318
  rawFrames: StackTraceImpl.Trie.RawFrame[],
318
- translatedFrames: Awaited<ReturnType<StackTraceImpl.StackTraceModel.TranslateRawFrames>>): boolean {
319
+ translatedFrames: Awaited<ReturnType<StackTraceImpl.StackTraceModel.TranslateRawFrames>>): Promise<boolean> {
319
320
  const frame = rawFrames[0];
320
321
  if (StackTraceImpl.Trie.isBuiltinFrame(frame)) {
321
322
  return false;
322
323
  }
323
324
 
324
- const sourceMapWithScopeInfoForFrame =
325
- (rawFrame: StackTraceImpl.Trie.RawFrame): {sourceMap: SDK.SourceMap.SourceMap, script: SDK.Script.Script}|
326
- null => {
325
+ const sourceMapWithScopeInfoForFrame = async(rawFrame: StackTraceImpl.Trie.RawFrame):
326
+ Promise<{sourceMap: SDK.SourceMap.SourceMap, script: SDK.Script.Script}|null> => {
327
327
  const script = this.#debuggerModel.scriptForId(rawFrame.scriptId ?? '');
328
328
  if (!script || this.#stubUISourceCodes.has(script)) {
329
329
  // Use fallback while source map is being loaded.
@@ -331,10 +331,11 @@ export class CompilerScriptMapping implements DebuggerSourceMapping {
331
331
  }
332
332
 
333
333
  const sourceMap = script.sourceMap();
334
+ await sourceMap?.waitForScopeInfo();
334
335
  return sourceMap?.hasScopeInfo() ? {sourceMap, script} : null;
335
336
  };
336
337
 
337
- const sourceMapAndScript = sourceMapWithScopeInfoForFrame(frame);
338
+ const sourceMapAndScript = await sourceMapWithScopeInfoForFrame(frame);
338
339
  if (!sourceMapAndScript) {
339
340
  return false;
340
341
  }