chrome-devtools-frontend 1.0.1675430 → 1.0.1678416

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 (308) hide show
  1. package/AUTHORS +1 -0
  2. package/WATCHLISTS +0 -4
  3. package/front_end/core/common/EventTarget.ts +0 -5
  4. package/front_end/core/common/Settings.ts +0 -66
  5. package/front_end/core/host/InspectorFrontendHostAPI.ts +1 -0
  6. package/front_end/core/host/UserMetrics.ts +5 -0
  7. package/front_end/core/root/Runtime.ts +5 -5
  8. package/front_end/core/sdk/CSSMetadata.ts +5 -9
  9. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +16 -34
  10. package/front_end/core/sdk/DebuggerModel.ts +92 -57
  11. package/front_end/core/sdk/EmulationModel.ts +2 -1
  12. package/front_end/core/sdk/NetworkManager.ts +16 -2
  13. package/front_end/core/sdk/OverlayModel.ts +19 -9
  14. package/front_end/core/sdk/OverlayPersistentHighlighter.ts +10 -4
  15. package/front_end/core/sdk/ResourceTreeModel.ts +20 -1
  16. package/front_end/core/sdk/SDKSettings.ts +117 -0
  17. package/front_end/core/sdk/Script.ts +9 -53
  18. package/front_end/core/sdk/sdk-meta.ts +0 -431
  19. package/front_end/devtools_compatibility.js +1 -0
  20. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +213 -23
  21. package/front_end/entrypoints/inspector_main/InspectorMain.ts +6 -5
  22. package/front_end/entrypoints/inspector_main/RenderingOptions.ts +14 -15
  23. package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +157 -0
  24. package/front_end/entrypoints/main/MainImpl.ts +32 -0
  25. package/front_end/entrypoints/shell/shell.ts +0 -1
  26. package/front_end/foundation/Universe.ts +8 -0
  27. package/front_end/generated/InspectorBackendCommands.ts +8 -8
  28. package/front_end/generated/SupportedCSSProperties.ts +53 -4
  29. package/front_end/generated/protocol-mapping.d.ts +27 -21
  30. package/front_end/generated/protocol-proxy-api.d.ts +22 -17
  31. package/front_end/generated/protocol.ts +43 -18
  32. package/front_end/models/ai_assistance/AiAgent2.ts +47 -2
  33. package/front_end/models/ai_assistance/AiConversation.ts +22 -5
  34. package/front_end/models/ai_assistance/README.md +52 -26
  35. package/front_end/models/ai_assistance/agents/AiAgent.ts +54 -8
  36. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -1
  37. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +7 -194
  38. package/front_end/models/ai_assistance/agents/StorageAgent.ts +21 -87
  39. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
  40. package/front_end/models/ai_assistance/ai_assistance.ts +24 -0
  41. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +124 -0
  42. package/front_end/models/ai_assistance/contexts/StorageContext.ts +100 -0
  43. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +69 -1
  44. package/front_end/models/ai_assistance/skills/README.md +63 -1
  45. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  46. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +4 -0
  47. package/front_end/models/ai_assistance/skills/accessibility.md +7 -0
  48. package/front_end/models/ai_assistance/skills/performance.md +15 -1
  49. package/front_end/models/ai_assistance/skills/sources.md +16 -0
  50. package/front_end/models/ai_assistance/skills/storage.md +31 -0
  51. package/front_end/models/ai_assistance/tools/GetDetailedCallTree.ts +107 -0
  52. package/front_end/models/ai_assistance/tools/GetFunctionCode.ts +122 -0
  53. package/front_end/models/ai_assistance/tools/GetResourceContent.ts +127 -0
  54. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +101 -0
  55. package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +83 -0
  56. package/front_end/models/ai_assistance/tools/GetTraceMainThreadSummary.ts +106 -0
  57. package/front_end/models/ai_assistance/tools/GetTraceNetworkSummary.ts +104 -0
  58. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +95 -0
  59. package/front_end/models/ai_assistance/tools/ListSources.ts +116 -0
  60. package/front_end/models/ai_assistance/tools/RunLighthouse.ts +89 -0
  61. package/front_end/models/ai_assistance/tools/SelectTraceEventByKey.ts +90 -0
  62. package/front_end/models/ai_assistance/tools/Tool.ts +26 -1
  63. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +22 -0
  64. package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -0
  65. package/front_end/models/bindings/CompilerScriptMapping.ts +4 -0
  66. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +8 -0
  67. package/front_end/models/bindings/ResourceScriptMapping.ts +3 -201
  68. package/front_end/models/bindings/SASSSourceMapping.ts +6 -0
  69. package/front_end/models/breakpoints/BreakpointManager.ts +2 -49
  70. package/front_end/models/comment_manager/CommentManager.ts +141 -0
  71. package/front_end/models/comment_manager/comment_manager.ts +9 -0
  72. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +27 -0
  73. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +10 -2
  74. package/front_end/models/issues_manager/descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  75. package/front_end/models/issues_manager/descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  76. package/front_end/models/issues_manager/descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  77. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
  78. package/front_end/models/persistence/IsolatedFileSystem.ts +7 -8
  79. package/front_end/models/persistence/IsolatedFileSystemManager.ts +2 -2
  80. package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
  81. package/front_end/models/persistence/persistence-meta.ts +9 -9
  82. package/front_end/models/trace/types/TraceEvents.ts +36 -0
  83. package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -3
  84. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +25 -0
  85. package/front_end/panels/accessibility/AccessibilityNodeView.ts +36 -36
  86. package/front_end/panels/accessibility/AccessibilitySidebarView.ts +9 -0
  87. package/front_end/panels/accessibility/AccessibilityStrings.ts +168 -168
  88. package/front_end/panels/accessibility/SourceOrderView.ts +7 -7
  89. package/front_end/panels/accessibility/accessibility-meta.ts +2 -2
  90. package/front_end/panels/accessibility/accessibility.ts +2 -0
  91. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
  92. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +2 -3
  93. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
  94. package/front_end/panels/ai_assistance/components/ChatMessage.ts +92 -12
  95. package/front_end/panels/ai_assistance/components/chatMessage.css +6 -0
  96. package/front_end/panels/application/ApplicationPanelSidebar.ts +10 -4
  97. package/front_end/panels/application/IndexedDBViews.ts +65 -63
  98. package/front_end/panels/application/StorageView.ts +116 -45
  99. package/front_end/panels/application/WebMCPView.ts +16 -7
  100. package/front_end/panels/application/application-meta.ts +11 -0
  101. package/front_end/panels/application/components/AdsView.ts +1 -1
  102. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +5 -5
  103. package/front_end/panels/common/BadgeNotification.ts +8 -8
  104. package/front_end/panels/common/ExtensionPanel.ts +9 -8
  105. package/front_end/panels/common/ExtensionServer.ts +21 -1
  106. package/front_end/panels/common/GdpSignUpDialog.ts +16 -16
  107. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +5 -6
  108. package/front_end/panels/common/PersistenceUtils.ts +2 -2
  109. package/front_end/panels/common/common.ts +0 -97
  110. package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -2
  111. package/front_end/panels/console/ConsolePanel.ts +4 -0
  112. package/front_end/panels/console/ConsolePinPane.ts +2 -2
  113. package/front_end/panels/console/ConsolePrompt.ts +12 -0
  114. package/front_end/panels/console/ConsoleView.ts +31 -20
  115. package/front_end/panels/console/ConsoleViewMessage.ts +37 -13
  116. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -2
  117. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -1
  118. package/front_end/panels/elements/ElementStatePaneWidget.ts +2 -1
  119. package/front_end/panels/elements/ElementsTreeElement.ts +455 -372
  120. package/front_end/panels/elements/LayoutPane.ts +2 -8
  121. package/front_end/panels/elements/StylePropertyTreeElement.ts +16 -15
  122. package/front_end/panels/elements/elements-meta.ts +152 -10
  123. package/front_end/panels/elements/elements.ts +0 -2
  124. package/front_end/panels/emulation/DeviceModeView.ts +9 -1
  125. package/front_end/panels/event_listeners/EventListenersView.ts +8 -4
  126. package/front_end/panels/issues/AffectedTrackingSitesView.ts +25 -14
  127. package/front_end/panels/lighthouse/LighthouseController.ts +3 -2
  128. package/front_end/panels/media/PlayerMessagesView.ts +149 -68
  129. package/front_end/panels/network/BinaryResourceView.ts +134 -81
  130. package/front_end/panels/network/EventSourceMessagesView.ts +10 -10
  131. package/front_end/panels/network/FetchHeaderCommenting.ts +291 -0
  132. package/front_end/panels/network/NetworkConfigView.ts +10 -10
  133. package/front_end/panels/network/NetworkDataGridNode.ts +14 -14
  134. package/front_end/panels/network/NetworkItemView.ts +27 -28
  135. package/front_end/panels/network/NetworkLogView.ts +137 -38
  136. package/front_end/panels/network/NetworkLogViewColumns.ts +35 -35
  137. package/front_end/panels/network/NetworkManageCustomHeadersView.ts +1 -1
  138. package/front_end/panels/network/NetworkPanel.ts +2 -2
  139. package/front_end/panels/network/RequestConditionsDrawer.ts +5 -5
  140. package/front_end/panels/network/RequestCookiesView.ts +4 -4
  141. package/front_end/panels/network/RequestHeadersView.ts +5 -5
  142. package/front_end/panels/network/RequestPayloadView.ts +4 -3
  143. package/front_end/panels/network/RequestTimingView.ts +8 -8
  144. package/front_end/panels/network/ResourceChunkView.ts +1 -1
  145. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -1
  146. package/front_end/panels/network/ResourceWebSocketFrameView.ts +16 -16
  147. package/front_end/panels/network/binaryResourceView.css +14 -12
  148. package/front_end/panels/network/components/DirectSocketConnectionView.ts +2 -2
  149. package/front_end/panels/network/components/HeaderSectionRow.ts +1 -1
  150. package/front_end/panels/network/components/RequestTrustTokensView.ts +2 -2
  151. package/front_end/panels/network/network-meta.ts +1 -1
  152. package/front_end/panels/network/network.ts +2 -0
  153. package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +0 -1
  154. package/front_end/panels/profiler/HeapSnapshotView.ts +0 -2
  155. package/front_end/panels/profiler/heapProfiler.css +0 -9
  156. package/front_end/panels/recorder/RecorderPanel.ts +2 -3
  157. package/front_end/panels/screencast/ScreencastView.ts +148 -138
  158. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -2
  159. package/front_end/panels/sources/BreakpointsView.ts +2 -2
  160. package/front_end/panels/sources/DebuggerPlugin.ts +10 -59
  161. package/front_end/panels/sources/NavigatorView.ts +2 -1
  162. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  163. package/front_end/panels/sources/SourcesPanel.ts +23 -73
  164. package/front_end/panels/sources/SourcesView.ts +248 -157
  165. package/front_end/panels/sources/TabbedEditorContainer.ts +118 -23
  166. package/front_end/panels/sources/UISourceCodeFrame.ts +5 -9
  167. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +4 -2
  168. package/front_end/panels/sources/sources-meta.ts +52 -0
  169. package/front_end/panels/timeline/TimelineController.ts +36 -64
  170. package/front_end/panels/timeline/TimelinePanel.ts +11 -8
  171. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -2
  172. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
  173. package/front_end/panels/timeline/timelinePanel.css +0 -10
  174. package/front_end/panels/utils/utils.ts +7 -7
  175. package/front_end/services/tracing/PerformanceTracing.ts +5 -17
  176. package/front_end/third_party/chromium/README.chromium +1 -1
  177. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  178. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  179. package/front_end/third_party/codemirror.next/package.json +2 -2
  180. package/front_end/third_party/codemirror.next/rebuild.sh +4 -1
  181. package/front_end/ui/comments/CommentAnchorResolver.ts +430 -35
  182. package/front_end/ui/comments/CommentOverlayManager.ts +635 -0
  183. package/front_end/ui/comments/CommentsOverlayWidget.ts +134 -0
  184. package/front_end/ui/comments/comments.ts +4 -0
  185. package/front_end/ui/comments/commentsOverlay.css +49 -0
  186. package/front_end/{panels/common → ui/components/dialogs}/FreDialog.ts +6 -6
  187. package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +96 -0
  188. package/front_end/ui/components/dialogs/dialogs.ts +4 -0
  189. package/front_end/ui/components/settings/SettingCheckbox.ts +3 -3
  190. package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionDisclaimer.ts +13 -13
  191. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +7 -6
  192. package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionTeaser.ts +43 -46
  193. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +22 -26
  194. package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationTeaser.ts +10 -10
  195. package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationUpgradeDialog.ts +5 -5
  196. package/front_end/ui/components/text_editor/text_editor.ts +4 -0
  197. package/front_end/ui/legacy/Toolbar.ts +1 -1
  198. package/front_end/ui/legacy/UIUtils.ts +0 -56
  199. package/front_end/ui/legacy/View.ts +10 -4
  200. package/front_end/ui/legacy/Widget.ts +10 -1
  201. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +2 -1
  202. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +5 -4
  203. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +11 -3
  204. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +507 -209
  205. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +5 -0
  206. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +11 -16
  207. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +5 -12
  208. package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +38 -20
  209. package/front_end/ui/legacy/components/source_frame/JSONView.ts +12 -2
  210. package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +3 -3
  211. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +37 -6
  212. package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +22 -4
  213. package/front_end/ui/settings/SettingUIRegistration.ts +55 -6
  214. package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
  215. package/mcp/mcp.ts +6 -1
  216. package/package.json +6 -6
  217. package/front_end/Images/toolbarResizerVertical.png +0 -0
  218. package/front_end/emulated_devices/MotoG4-landscape.svg +0 -155
  219. package/front_end/emulated_devices/MotoG4-portrait.svg +0 -155
  220. package/front_end/emulated_devices/Nexus5X-landscape.svg +0 -19
  221. package/front_end/emulated_devices/Nexus5X-portrait.svg +0 -19
  222. package/front_end/emulated_devices/Nexus6P-landscape.svg +0 -50
  223. package/front_end/emulated_devices/Nexus6P-portrait.svg +0 -54
  224. package/front_end/emulated_devices/google-nest-hub-horizontal.png +0 -0
  225. package/front_end/emulated_devices/google-nest-hub-max-horizontal.png +0 -0
  226. package/front_end/emulated_devices/google-nexus-5-horizontal-default-1x.png +0 -0
  227. package/front_end/emulated_devices/google-nexus-5-horizontal-default-2x.png +0 -0
  228. package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-1x.png +0 -0
  229. package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-2x.png +0 -0
  230. package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-1x.png +0 -0
  231. package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-2x.png +0 -0
  232. package/front_end/emulated_devices/google-nexus-5-vertical-default-1x.png +0 -0
  233. package/front_end/emulated_devices/google-nexus-5-vertical-default-2x.png +0 -0
  234. package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-1x.png +0 -0
  235. package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-2x.png +0 -0
  236. package/front_end/emulated_devices/google-nexus-5-vertical-navigation-1x.png +0 -0
  237. package/front_end/emulated_devices/google-nexus-5-vertical-navigation-2x.png +0 -0
  238. package/front_end/emulated_devices/google-nexus-5x-horizontal-default-1x.png +0 -0
  239. package/front_end/emulated_devices/google-nexus-5x-horizontal-default-2x.png +0 -0
  240. package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-1x.png +0 -0
  241. package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-2x.png +0 -0
  242. package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-1x.png +0 -0
  243. package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-2x.png +0 -0
  244. package/front_end/emulated_devices/google-nexus-5x-vertical-default-1x.png +0 -0
  245. package/front_end/emulated_devices/google-nexus-5x-vertical-default-2x.png +0 -0
  246. package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-1x.png +0 -0
  247. package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-2x.png +0 -0
  248. package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-1x.png +0 -0
  249. package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-2x.png +0 -0
  250. package/front_end/emulated_devices/iPad-landscape.svg +0 -73
  251. package/front_end/emulated_devices/iPad-portrait.svg +0 -76
  252. package/front_end/emulated_devices/iPhone5-landscape.svg +0 -99
  253. package/front_end/emulated_devices/iPhone5-portrait.svg +0 -83
  254. package/front_end/emulated_devices/iPhone6-landscape.svg +0 -111
  255. package/front_end/emulated_devices/iPhone6-portrait.svg +0 -116
  256. package/front_end/emulated_devices/iPhone6Plus-landscape.svg +0 -118
  257. package/front_end/emulated_devices/iPhone6Plus-portrait.svg +0 -116
  258. package/front_end/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
  259. package/front_end/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
  260. package/front_end/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
  261. package/front_end/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
  262. package/front_end/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
  263. package/front_end/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
  264. package/front_end/emulated_devices/optimized/README.md +0 -9
  265. package/front_end/emulated_devices/optimized/google-nest-hub-horizontal.avif +0 -0
  266. package/front_end/emulated_devices/optimized/google-nest-hub-max-horizontal.avif +0 -0
  267. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
  268. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
  269. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
  270. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
  271. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
  272. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
  273. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
  274. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
  275. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
  276. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
  277. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
  278. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
  279. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
  280. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
  281. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
  282. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
  283. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
  284. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
  285. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
  286. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
  287. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
  288. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
  289. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
  290. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
  291. package/front_end/emulated_devices/optimized/iPad-landscape.avif +0 -0
  292. package/front_end/emulated_devices/optimized/iPad-portrait.avif +0 -0
  293. package/front_end/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
  294. package/front_end/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
  295. package/front_end/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
  296. package/front_end/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
  297. package/front_end/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
  298. package/front_end/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
  299. package/front_end/emulated_devices/optimized/optimized_images.gni +0 -53
  300. package/front_end/models/ai_assistance/agents/README.md +0 -136
  301. package/front_end/panels/elements/ElementsTreeOutlineRenderer.ts +0 -89
  302. package/front_end/ui/legacy/components/object_ui/object_ui-meta.ts +0 -27
  303. /package/front_end/{panels/common → ui/components/dialogs}/freDialog.css +0 -0
  304. /package/front_end/{panels/common/common.css → ui/components/dialogs/typeToAllowDialog.css} +0 -0
  305. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionDisclaimer.css +0 -0
  306. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionTeaser.css +0 -0
  307. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationTeaser.css +0 -0
  308. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationUpgradeDialog.css +0 -0
@@ -3,6 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Host from '../../core/host/host.js';
6
+ import * as SDK from '../../core/sdk/sdk.js';
6
7
  import type * as LHModel from '../lighthouse/lighthouse.js';
7
8
  import type * as Trace from '../trace/trace.js';
8
9
 
@@ -30,6 +31,8 @@ const SKILL_DISPLAY_NAMES: Record<SkillName, string> = {
30
31
  network: 'Network requests',
31
32
  accessibility: 'Accessibility',
32
33
  performance: 'Performance',
34
+ storage: 'Storage',
35
+ sources: 'Workspace files and sources',
33
36
  };
34
37
 
35
38
  const preamble = `You are the most advanced unified AI assistant integrated into Chrome DevTools.
@@ -81,6 +84,33 @@ export class AiAgent2 extends AiAgent<unknown> {
81
84
  return {};
82
85
  }
83
86
 
87
+ protected override async preRun(): Promise<void> {
88
+ if (this.context && !this.context.isLoggingEnabled()) {
89
+ this.setServerSideLoggingActive(false);
90
+ }
91
+ const target = this.targetManager.primaryPageTarget();
92
+ const domModel = target?.model(SDK.DOMModel.DOMModel);
93
+ // Ensure the DOM document is requested and cached in DOMModel so that
94
+ // subsequent synchronous lookups via domModel.existingDocument() (e.g.,
95
+ // in #getDocumentBodyNode()) resolve the document and body immediately.
96
+ if (domModel) {
97
+ if (!domModel.existingDocument()) {
98
+ try {
99
+ await domModel.requestDocument();
100
+ } catch (e) {
101
+ debugLog('AiAgent2: Failed to request document', e);
102
+ }
103
+ }
104
+ if (!domModel.existingDocument()?.body) {
105
+ try {
106
+ await domModel.pushNodeByPathToFrontend('1,HTML,1,BODY');
107
+ } catch (e) {
108
+ debugLog('AiAgent2: Failed to push body node to frontend', e);
109
+ }
110
+ }
111
+ }
112
+ }
113
+
84
114
  readonly #activeSkills = new Set<SkillName>();
85
115
  readonly #declaredTools = new Set<string>();
86
116
 
@@ -213,7 +243,8 @@ User query: ${enhancedQuery}`;
213
243
  }
214
244
 
215
245
  #createExtensionScope(changes: ChangeManager): {install(): Promise<void>, uninstall(): Promise<void>} {
216
- const selectedNode = this.context && this.context instanceof DOMNodeContext ? this.context.getItem() : null;
246
+ const selectedNode =
247
+ this.context && this.context instanceof DOMNodeContext ? this.context.getItem() : this.#getDocumentBodyNode();
217
248
  return new ExtensionScope(changes, this.sessionId, selectedNode);
218
249
  }
219
250
 
@@ -237,17 +268,31 @@ User query: ${enhancedQuery}`;
237
268
  changeManager: this.#changes,
238
269
  createExtensionScope: this.#createExtensionScope.bind(this),
239
270
  execJs: this.#execJs,
240
- getExecutionContextNode: () => this.context instanceof DOMNodeContext ? this.context.getItem() : null,
271
+ getExecutionContextNode: () =>
272
+ (this.context instanceof DOMNodeContext ? this.context.getItem() : this.#getDocumentBodyNode()),
241
273
  getTarget: () => this.targetManager.primaryPageTarget(),
242
274
  getEstablishedOrigin: () => this.#getConversationOrigin(),
243
275
  lighthouseRecording: this.#lighthouseRecording,
244
276
  performanceRecordAndReload: this.#performanceRecordAndReload,
277
+ setLoggingEnabled: (enabled: boolean) => {
278
+ this.setServerSideLoggingActive(enabled);
279
+ },
245
280
  };
246
281
  return tool.handler(args, context, options);
247
282
  },
248
283
  });
249
284
  }
250
285
 
286
+ /**
287
+ * For non-DOM contexts (e.g., Lighthouse accessibility reports or storage items),
288
+ * there is no user-selected DOM node. We fall back to the document body as the
289
+ * default execution context node so scripts have a valid `$0` target.
290
+ */
291
+ #getDocumentBodyNode(): SDK.DOMModel.DOMNode|null {
292
+ const document = this.targetManager.primaryPageTarget()?.model(SDK.DOMModel.DOMModel)?.existingDocument();
293
+ return document?.body ?? null;
294
+ }
295
+
251
296
  #getConversationOrigin(): string|undefined {
252
297
  const allowed = this.#allowedOrigin?.();
253
298
  return allowed && 'origin' in allowed ? allowed.origin : undefined;
@@ -27,7 +27,7 @@ import {ContextSelectionAgent} from './agents/ContextSelectionAgent.js';
27
27
  import {FileAgent} from './agents/FileAgent.js';
28
28
  import {NetworkAgent} from './agents/NetworkAgent.js';
29
29
  import {PerformanceAgent} from './agents/PerformanceAgent.js';
30
- import {StorageAgent, StorageContext} from './agents/StorageAgent.js';
30
+ import {StorageAgent} from './agents/StorageAgent.js';
31
31
  import {StylingAgent} from './agents/StylingAgent.js';
32
32
  import {AiAgent2} from './AiAgent2.js';
33
33
  import {AiHistoryStorage, ConversationType, type SerializedConversation} from './AiHistoryStorage.js';
@@ -37,6 +37,9 @@ import {DOMNodeContext} from './contexts/DOMNodeContext.js';
37
37
  import {FileContext} from './contexts/FileContext.js';
38
38
  import {PerformanceTraceContext} from './contexts/PerformanceTraceContext.js';
39
39
  import {RequestContext} from './contexts/RequestContext.js';
40
+ import {StorageContext} from './contexts/StorageContext.js';
41
+ import {ToolAnnotation} from './tools/Tool.js';
42
+ import {ToolRegistry} from './tools/ToolRegistry.js';
40
43
 
41
44
  export const NOT_FOUND_IMAGE_DATA = '';
42
45
  export const CONTEXT_TITLE = 'Analyzing data';
@@ -324,10 +327,18 @@ export class AiConversation {
324
327
  case ResponseType.SIDE_EFFECT: {
325
328
  return {...item, confirm: undefined};
326
329
  }
327
- case ResponseType.CONTEXT:
328
- case ResponseType.ACTION: {
330
+ case ResponseType.CONTEXT: {
329
331
  return {...item, widgets: undefined};
330
332
  }
333
+ case ResponseType.ACTION: {
334
+ const tool = item.toolName ? ToolRegistry.get(item.toolName) : undefined;
335
+ const shouldRedact = tool?.annotations?.includes(ToolAnnotation.REDACT_FROM_HISTORY);
336
+ return {
337
+ ...item,
338
+ output: shouldRedact ? '<redacted>' : item.output,
339
+ widgets: undefined,
340
+ };
341
+ }
331
342
  default:
332
343
  return item;
333
344
  }
@@ -361,7 +372,7 @@ export class AiConversation {
361
372
 
362
373
  const options = {
363
374
  aidaClient: this.#aidaClient,
364
- serverSideLoggingEnabled: isAiAssistanceServerSideLoggingEnabled(),
375
+ serverSideLoggingAllowed: isAiAssistanceServerSideLoggingAllowed(),
365
376
  sessionId: this.id,
366
377
  changeManager: this.#changeManager,
367
378
  performanceRecordAndReload: this.#performanceRecordAndReload,
@@ -540,7 +551,13 @@ export class AiConversation {
540
551
  };
541
552
  }
542
553
 
543
- function isAiAssistanceServerSideLoggingEnabled(): boolean {
554
+ /**
555
+ * Checks whether server-side logging is allowed by the global system policy.
556
+ * Note that even if this returns true, individual agents can still dynamically
557
+ * deactivate/activate logging during their execution (e.g., when handling
558
+ * sensitive tools).
559
+ */
560
+ function isAiAssistanceServerSideLoggingAllowed(): boolean {
544
561
  return !Root.Runtime.hostConfig.aidaAvailability?.disallowLogging;
545
562
  }
546
563
 
@@ -1,8 +1,15 @@
1
1
  # AI in DevTools
2
2
 
3
- ## High level architecture
3
+ ## Architecture Overview
4
4
 
5
- When the user interacts with AI via the AI Assistance Panel, they are having a _conversation_ with an agent.
5
+ When the user interacts with AI via the AI Assistance Panel, they are having a _conversation_ with an agent. DevTools currently contains two architectural generations for AI assistance:
6
+
7
+ - **Legacy V1 (Multi-Agent Architecture)**: Implemented in `agents/`. Each domain is handled by a specialized agent subclass extending `AiAgent` (for example, `PerformanceAgent`, `StylingAgent`, `NetworkAgent`).
8
+ - **AIAgentV2 (Unified Single-Agent Architecture)**: Implemented in `AiAgent2.ts`. We are migrating from the siloed multi-agent architecture to a unified, skill-based single-agent architecture. In V2, a single agent (`AiAgent2`) handles multiple domains by dynamically loading **Skills** (`skills/`) and calling type-safe **Tools** (`tools/`).
9
+
10
+ Both architectures share the core **Contexts**, **Formatters**, and **Security & Origin Isolation** mechanisms described below.
11
+
12
+ ## Core Concepts & Lifecycle
6
13
 
7
14
  ### Contexts
8
15
 
@@ -24,21 +31,47 @@ Encapsulating prompt formatting and UI generation within the context classes sim
24
31
 
25
32
  To deal with the work to take an object that is the AI agent's context and turn it into a text representation that can be sent to the AI, we use _formatters_. These are typically classes with `static` methods that can take in objects and return their text representation that we want to pass to the AI.
26
33
 
27
- ## Future Architecture (V2) - WIP
34
+ ### Lifecycle & Cache Clearing
35
+
36
+ AI Agents can maintain internal stateful variables to optimize performance or store context (such as stashed tool results, formatters, or instruction flags). However, this state must be carefully managed to prevent security leaks (such as cross-origin data leaks after page navigation) or stale results.
37
+
38
+ The `AiAgent` base class defines a `clearCache()` method. This method is automatically invoked by the system when:
39
+ - An execution error occurs.
40
+ - The user aborts the execution.
41
+ - A cross-origin navigation is detected (via the top-level origin blocking mechanism).
42
+
43
+ If you introduce new stateful member variables in an `AiAgent` subclass, you **must** override `clearCache()` to reset them:
44
+ 1. Always call `super.clearCache()` to ensure base class cleanup is executed.
45
+ 2. Reset any subclass-specific state (such as setting formatters to `null`, clearing lists, or resetting boolean flags).
46
+
47
+ Example from `PerformanceAgent`:
48
+ ```typescript
49
+ override clearCache(): void {
50
+ super.clearCache();
51
+ this.#functionCallCacheForFocus.clear();
52
+ this.#formatter = null;
53
+ this.#traceFacts = [];
54
+ // ... reset other stateful fields
55
+ }
56
+ ```
57
+
58
+ ### Security & Origin Isolation
28
59
 
29
- We are migrating the DevTools AI Assistance from a siloed multi-agent architecture to a unified, skill-based single-agent architecture (`AIAgent2`).
60
+ To prevent prompt injection attacks and cross-origin data leaks, the AI Assistance panel enforces strict origin-lock boundaries:
61
+
62
+ - **Origin Locking**: Once a conversation session begins, it locks to the origin of the initial data context (e.g. `https://google.com` or a specific file path).
63
+ - **Opaque Origins**: Any origin classified as opaque (e.g. `data:`, `about:`, `detached` nodes, unparsed `undefined://` or empty origins) is blocked from starting AI assistance (`isOpaqueOrigin()`).
64
+ - **File Isolation**: Local files (`file://`) do not share a single wildcard origin. Instead, the path is appended (e.g. `file:///path/to/file.js`) to treat each local file as its own unique origin. Swapping local files in the same conversation is blocked.
65
+ - **Trace Isolation**: Imported performance trace recordings are isolated using the virtual origin `imported-trace://${domain}`. This ensures that loaded local trace files do not share origins with live pages, preventing potential cross-origin prompt injection attacks when switching contexts.
66
+ - **Equivalence**: `areOriginsEquivalent()` ensures opaque origins are never equivalent to anything (including themselves), forcing a conversation reset on transitions.
30
67
 
31
- In this new architecture:
32
- - A single agent (`AIAgent2`) handles multiple domains.
33
- - Capabilities are defined as **Skills** in Markdown files.
34
- - The agent can dynamically load skills as needed via a `learnSkill` tool.
68
+ ## AIAgentV2 (Unified Architecture)
35
69
 
36
- This work is currently in progress and behind a feature flag.
70
+ We are migrating DevTools AI Assistance from a siloed multi-agent architecture to a unified, skill-based single-agent architecture (`AiAgent2`). In this new architecture, capabilities are defined as **Skills** in Markdown files, and the agent can dynamically load skills as needed via a `learnSkills` tool.
37
71
 
38
72
  ### Skills Build System
39
73
 
40
- To support dynamic loading of skills, we generate JavaScript files from Markdown files containing skill definitions.
41
- We use a nested `BUILD.gn` file in the `skills/` subdirectory specifically for this purpose. This ensures that GN's `target_gen_dir` points to `gen/front_end/models/ai_assistance/skills/`, placing the generated `.skill.js` files in the same relative structure as their source `.md` files. This allows TypeScript files in the `skills/` directory (like `map.ts`) to import the generated files using relative paths (e.g., `./styling.skill.js`) seamlessly. See the [Skills README](skills/README.md) for full details.
74
+ To support dynamic loading of skills, we generate JavaScript files from Markdown files containing skill definitions. We use a nested `BUILD.gn` file in the `skills/` subdirectory specifically for this purpose. This ensures that GN's `target_gen_dir` points to `gen/front_end/models/ai_assistance/skills/`, placing the generated `.skill.js` files in the same relative structure as their source `.md` files. This allows TypeScript files in the `skills/` directory (like `map.ts`) to import the generated files using relative paths (e.g., `./styling.skill.js`) seamlessly. See the [Skills README](skills/README.md) for full details.
42
75
 
43
76
  ### Tools and ToolRegistry
44
77
 
@@ -49,9 +82,13 @@ To support skills requiring execution of code or fetching page state (like compu
49
82
  - **Capability Contexts**: Instead of passing a monolithic grab-bag context to all tools, dependencies are broken into narrow capability interfaces (e.g. `PageExecutionCapability`, `StyleMutationCapability`, `TargetCapability`, `OriginLockCapability`). Tools declare their required dependencies by intersecting these interfaces on their generic `ContextType` definition. The caller/Agent fulfills the complete capability context (`AllToolsCapabilities`), guaranteeing 100% compile-time type safety for dependencies without runtime checks.
50
83
  - **ToolRegistry**: A static registry (`ToolRegistry`) storing instantiated tools. It uses TypeScript function overloading and generic lookups (`static get<K extends keyof typeof TOOLS>(name: K): typeof TOOLS[K]`) to return the precise class type of each tool, preventing type-erasure and escape-hatches (such as `any` or `as unknown` type assertions) at integration points like `AiAgent2.ts`. See the [Tools README](tools/README.md) for authoring instructions.
51
84
 
52
- ## Performance specific documentation
85
+ ### Adding a new skill
86
+
87
+ See the [Skills README](skills/README.md) for detailed instructions.
53
88
 
54
- ### `PerformanceTraceContext`
89
+ ## Extending Domain Support (Performance Insights)
90
+
91
+ ### PerformanceTraceContext
55
92
 
56
93
  The context for `PerformanceAgent` is `PerformanceTraceContext`, which wraps `AgentFocus`. `AgentFocus` supports different behavior for different entry-points of the "Ask AI" feature for a trace (such as a specific performance insight, flame chart call tree, trace event, or the whole parsed trace). `PerformanceTraceContext` implements `ConversationContext<AgentFocus>` to fetch prompt details, user-facing accordion details, and context-specific AI suggestions.
57
94
 
@@ -73,16 +110,15 @@ In general, the trace bounds are defined by the insight's overlays. If there are
73
110
 
74
111
  See the `insightBounds` function in `InsightAIContext.ts`.
75
112
 
76
-
77
113
  ### Testing the new Insight
78
114
 
79
115
  Once it's working, it's a good idea to manually experiment with the new Insight and ask a bunch of questions on different traces. Try to find (or create) websites that cause the insight to identify a variety of outputs and see how far you can push the AI. Look for instances where you can perhaps clarify the data you are passing into it, or tweak your wording, to try to make it clearer. You can also take the data you are sending and paste it into Gemini to get feedback on your prompt from the AI.
80
116
 
81
117
  (We are working on a better, more automated way, of evaluating these responses).
82
118
 
83
- ## Debugging tips
119
+ ## Debugging & Local Development
84
120
 
85
- To test the AI code, you must be running DevTools in a branded Chrome (e.g. official Chrome Canary) and be signed in. You can use the `npm start` with a canary flag in this repository to run against Chromium, or by running Chrome Canary and pointing it to your local DevTools.":
121
+ To test the AI code, you must be running DevTools in a branded Chrome (e.g. official Chrome Canary) and be signed in. You can use the `npm start` with a canary flag in this repository to run against Chromium, or by running Chrome Canary and pointing it to your local DevTools:
86
122
 
87
123
  ```
88
124
  npm start -- --browser=canary
@@ -108,13 +144,3 @@ Now, when interacting with the AI and sending requests, you will see output logg
108
144
  ### Testing the Accessibility Skill
109
145
 
110
146
  The accessibility skill (`accessibility.md`) relies on an active Lighthouse report. Before interacting with the agent using this skill, ensure you have run a Lighthouse audit on the page you are inspecting so that the `getLighthouseAudits` tool can retrieve the report data.
111
-
112
- ## Security & Origin Isolation
113
-
114
- To prevent prompt injection attacks and cross-origin data leaks, the AI Assistance panel enforces strict origin-lock boundaries:
115
-
116
- * **Origin Locking**: Once a conversation session begins, it locks to the origin of the initial data context (e.g. `https://google.com` or a specific file path).
117
- * **Opaque Origins**: Any origin classified as opaque (e.g. `data:`, `about:`, `detached` nodes, unparsed `undefined://` or empty origins) is blocked from starting AI assistance (`isOpaqueOrigin()`).
118
- * **File Isolation**: Local files (`file://`) do not share a single wildcard origin. Instead, the path is appended (e.g. `file:///path/to/file.js`) to treat each local file as its own unique origin. Swapping local files in the same conversation is blocked.
119
- * **Trace Isolation**: Imported performance trace recordings are isolated using the virtual origin `imported-trace://${domain}`. This ensures that loaded local trace files do not share origins with live pages, preventing potential cross-origin prompt injection attacks when switching contexts.
120
- * **Equivalence**: `areOriginsEquivalent()` ensures opaque origins are never equivalent to anything (including themselves), forcing a conversation reset on transitions.
@@ -122,6 +122,10 @@ export interface ActionResponse {
122
122
  output?: string;
123
123
  canceled: boolean;
124
124
  widgets?: AiWidget[];
125
+ /**
126
+ * The name of the executed tool. Only populated for AI v2.
127
+ */
128
+ toolName?: string;
125
129
  }
126
130
 
127
131
  export interface QueryingResponse {
@@ -161,7 +165,7 @@ export type AllowedOriginResult = {
161
165
 
162
166
  export interface AgentOptions {
163
167
  aidaClient: Host.AidaClient.AidaClient;
164
- serverSideLoggingEnabled?: boolean;
168
+ serverSideLoggingAllowed?: boolean;
165
169
  sessionId?: string;
166
170
  confirmSideEffectForTest?: typeof Promise.withResolvers;
167
171
  onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>;
@@ -193,6 +197,14 @@ export abstract class ConversationContext<T> {
193
197
  abstract getItem(): T;
194
198
  abstract getTitle(): string;
195
199
 
200
+ /**
201
+ * Returns true if the server-side logging is enabled when this context is active.
202
+ * Currently only used for AI v2.
203
+ */
204
+ isLoggingEnabled(): boolean {
205
+ return true;
206
+ }
207
+
196
208
  getOrigin(): string {
197
209
  return extractContextOrigin(this.getURL());
198
210
  }
@@ -387,10 +399,22 @@ export interface SourceCodeAiWidget {
387
399
  };
388
400
  }
389
401
 
402
+ export interface StorageBreakdownAiWidget {
403
+ name: 'STORAGE_BREAKDOWN';
404
+ data: {
405
+ totalUsageBytes: number,
406
+ totalQuotaBytes: number,
407
+ usageBreakdown: Array<{
408
+ storageType: string,
409
+ bytes: number,
410
+ }>,
411
+ };
412
+ }
413
+
390
414
  export type AiWidget = ComputedStyleAiWidget|CoreVitalsAiWidget|StylePropertiesAiWidget|DomTreeAiWidget|
391
415
  PerformanceTraceAiWidget|PerfInsightAiWidget|TimelineRangeSummaryAiWidget|BottomUpTreeAiWidget|SourceFileAiWidget|
392
416
  LighthouseReportAiWidget|TimelineEventSummaryAiWidget|NetworkRequestGeneralHeadersAiWidget|SourceCodeAiWidget|
393
- SourceFilesListAiWidget|NetworkRequestsListAiWidget|NetworkTrackAiWidget;
417
+ SourceFilesListAiWidget|NetworkRequestsListAiWidget|NetworkTrackAiWidget|StorageBreakdownAiWidget;
394
418
 
395
419
  /**
396
420
  * @deprecated Used for v1 agents. Once v2 is shipped, this can be removed.
@@ -472,7 +496,16 @@ export abstract class AiAgent<T> {
472
496
 
473
497
  readonly #sessionId: string;
474
498
  readonly #aidaClient: Host.AidaClient.AidaClient;
475
- #serverSideLoggingEnabled: boolean;
499
+ /**
500
+ * Whether server-side logging is permitted by the system policy (based on
501
+ * user preferences, feature flags, or branding configurations).
502
+ */
503
+ readonly #serverSideLoggingAllowed: boolean;
504
+ /**
505
+ * Tracks the dynamic runtime state of logging. Even if logging is allowed
506
+ * by policy, tools can temporarily deactivate this to avoid logging sensitive data.
507
+ */
508
+ #serverSideLoggingActive: boolean;
476
509
  readonly confirmSideEffect: typeof Promise.withResolvers;
477
510
  readonly #functionDeclarations = new Map<string, FunctionDeclaration<Record<string, unknown>, unknown>>();
478
511
  readonly #allowedOrigin?: () => AllowedOriginResult;
@@ -499,13 +532,15 @@ export abstract class AiAgent<T> {
499
532
 
500
533
  constructor(opts: AgentOptions) {
501
534
  this.#aidaClient = opts.aidaClient;
502
- this.#serverSideLoggingEnabled = opts.serverSideLoggingEnabled ?? false;
535
+ let serverSideLoggingAllowed = opts.serverSideLoggingAllowed ?? false;
503
536
  // Disable logging for now.
504
537
  // For context, see b/454563259#comment35.
505
538
  // We should be able to remove this ~end of April.
506
539
  if (Root.Runtime.hostConfig.devToolsGeminiRebranding?.enabled) {
507
- this.#serverSideLoggingEnabled = false;
540
+ serverSideLoggingAllowed = false;
508
541
  }
542
+ this.#serverSideLoggingAllowed = serverSideLoggingAllowed;
543
+ this.#serverSideLoggingActive = serverSideLoggingAllowed;
509
544
  this.#sessionId = opts.sessionId ?? crypto.randomUUID();
510
545
  this.confirmSideEffect = opts.confirmSideEffectForTest ?? (() => Promise.withResolvers());
511
546
  this.#history = opts.history ?? [];
@@ -558,8 +593,17 @@ export abstract class AiAgent<T> {
558
593
  clearCache(): void {
559
594
  }
560
595
 
561
- protected disableServerSideLogging(): void {
562
- this.#serverSideLoggingEnabled = false;
596
+ /**
597
+ * Toggles whether server-side logging is active.
598
+ * Note that logging can only be activated if it was allowed by policy/configuration
599
+ * at startup (i.e., `#serverSideLoggingAllowed` is true).
600
+ */
601
+ protected setServerSideLoggingActive(active: boolean): void {
602
+ if (active && this.#serverSideLoggingAllowed) {
603
+ this.#serverSideLoggingActive = true;
604
+ } else {
605
+ this.#serverSideLoggingActive = false;
606
+ }
563
607
  }
564
608
 
565
609
  popPendingMultimodalInput(): MultimodalInput|undefined {
@@ -618,7 +662,7 @@ export abstract class AiAgent<T> {
618
662
  model_id: this.options.modelId || undefined,
619
663
  },
620
664
  metadata: {
621
- disable_user_content_logging: !(this.#serverSideLoggingEnabled ?? false),
665
+ disable_user_content_logging: !(this.#serverSideLoggingActive ?? false),
622
666
  string_session_id: this.#sessionId,
623
667
  user_tier: userTier,
624
668
  client_version:
@@ -1027,6 +1071,7 @@ export abstract class AiAgent<T> {
1027
1071
  output: typeof result.result === 'string' ? result.result : JSON.stringify(result.result),
1028
1072
  widgets: result.widgets,
1029
1073
  canceled: false,
1074
+ toolName: name,
1030
1075
  };
1031
1076
  }
1032
1077
 
@@ -1036,6 +1081,7 @@ export abstract class AiAgent<T> {
1036
1081
  code,
1037
1082
  output: result.error,
1038
1083
  canceled: false,
1084
+ toolName: name,
1039
1085
  };
1040
1086
  }
1041
1087
 
@@ -19,6 +19,7 @@ import {DOMNodeContext} from '../contexts/DOMNodeContext.js';
19
19
  import {FileContext} from '../contexts/FileContext.js';
20
20
  import {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
21
21
  import {getRequestContextOrigin, RequestContext} from '../contexts/RequestContext.js';
22
+ import {StorageContext} from '../contexts/StorageContext.js';
22
23
  import {formatBytesToKb, seconds} from '../data_formatters/UnitFormatters.js';
23
24
  import {debugLog} from '../debug.js';
24
25
  import {StorageItem} from '../StorageItem.js';
@@ -30,7 +31,6 @@ import {
30
31
  type ContextResponse,
31
32
  type RequestOptions,
32
33
  } from './AiAgent.js';
33
- import {StorageContext} from './StorageAgent.js';
34
34
 
35
35
  const lockedString = i18n.i18n.lockedString;
36
36
  /**