chrome-devtools-frontend 1.0.1690531 → 1.0.1695017

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 (304) hide show
  1. package/.agents/skills/devtools-model-management/SKILL.md +3 -3
  2. package/.agents/skills/foundation-test-migration/SKILL.md +2 -2
  3. package/.agents/skills/merging-devtools-module/SKILL.md +5 -5
  4. package/.gitmodules +0 -4
  5. package/AUTHORS +3 -0
  6. package/config/typescript/tsconfig.base.json +1 -0
  7. package/docs/get_the_code.md +4 -9
  8. package/front_end/Images/src/comment-mode-cursor.svg +23 -0
  9. package/front_end/Tests.js +1 -1
  10. package/front_end/application_tokens.css +5 -0
  11. package/front_end/core/common/ColorConverter.ts +3 -3
  12. package/front_end/core/host/UserMetrics.ts +27 -0
  13. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +0 -46
  14. package/front_end/core/protocol_client/InspectorBackend.ts +6 -6
  15. package/front_end/core/sdk/CSSLocation.ts +32 -0
  16. package/front_end/core/sdk/CSSModel.ts +2 -22
  17. package/front_end/core/sdk/CSSQuery.ts +2 -1
  18. package/front_end/core/sdk/CSSRule.ts +29 -0
  19. package/front_end/core/sdk/DebuggerModel.ts +5 -1
  20. package/front_end/core/sdk/NetworkManager.ts +2 -0
  21. package/front_end/core/sdk/NetworkRequest.ts +14 -1
  22. package/front_end/core/sdk/NetworkRequestAccess.ts +41 -22
  23. package/front_end/core/sdk/ResourceTreeModel.ts +72 -23
  24. package/front_end/core/sdk/SecurityOrigin.ts +89 -29
  25. package/front_end/core/sdk/Target.ts +18 -0
  26. package/front_end/core/sdk/sdk.ts +2 -0
  27. package/front_end/entrypoints/main/MainImpl.ts +8 -1
  28. package/front_end/foundation/Universe.ts +14 -11
  29. package/front_end/generated/Deprecation.ts +8 -0
  30. package/front_end/generated/InspectorBackendCommands.ts +9 -8
  31. package/front_end/generated/SupportedCSSProperties.ts +13 -3
  32. package/front_end/generated/protocol.ts +24 -0
  33. package/front_end/models/ai_assistance/AiAgent2.ts +42 -9
  34. package/front_end/models/ai_assistance/AiConversation.ts +6 -6
  35. package/front_end/models/ai_assistance/README.md +5 -3
  36. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +1 -0
  37. package/front_end/models/ai_assistance/agents/AiAgent.ts +28 -34
  38. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +13 -17
  39. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +5 -3
  40. package/front_end/models/ai_assistance/agents/StorageAgent.ts +16 -10
  41. package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -4
  42. package/front_end/models/ai_assistance/ai_assistance.ts +0 -2
  43. package/front_end/models/ai_assistance/contexts/AccessibilityContext.ts +11 -2
  44. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +17 -5
  45. package/front_end/models/ai_assistance/contexts/FileContext.ts +13 -6
  46. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +52 -25
  47. package/front_end/models/ai_assistance/contexts/RequestContext.ts +18 -34
  48. package/front_end/models/ai_assistance/contexts/StorageContext.ts +14 -3
  49. package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +2 -5
  50. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +135 -58
  51. package/front_end/models/ai_assistance/tools/CookieUtils.ts +25 -35
  52. package/front_end/models/ai_assistance/tools/DOMStorageUtils.ts +6 -3
  53. package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +9 -2
  54. package/front_end/models/ai_assistance/tools/GetCookieValues.ts +1 -1
  55. package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +3 -2
  56. package/front_end/models/ai_assistance/tools/GetFunctionCode.ts +3 -5
  57. package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +1 -1
  58. package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +8 -11
  59. package/front_end/models/ai_assistance/tools/GetResourceContent.ts +2 -4
  60. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +6 -13
  61. package/front_end/models/ai_assistance/tools/GetStorageBreakdown.ts +1 -1
  62. package/front_end/models/ai_assistance/tools/GetStorageValues.ts +9 -9
  63. package/front_end/models/ai_assistance/tools/GetStyles.ts +3 -2
  64. package/front_end/models/ai_assistance/tools/ListCookies.ts +1 -1
  65. package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +6 -14
  66. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +10 -15
  67. package/front_end/models/ai_assistance/tools/ListSources.ts +5 -7
  68. package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +9 -9
  69. package/front_end/models/ai_assistance/tools/README.md +4 -2
  70. package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +3 -2
  71. package/front_end/models/ai_assistance/tools/Tool.ts +27 -3
  72. package/front_end/models/comment_manager/CD4ABridge.ts +128 -0
  73. package/front_end/models/comment_manager/CommentManager.ts +50 -8
  74. package/front_end/models/comment_manager/comment_manager.ts +2 -0
  75. package/front_end/models/emulation/DeviceModeModel.ts +37 -47
  76. package/front_end/models/javascript_metadata/NativeFunctions.ts +9 -1
  77. package/front_end/models/live-metrics/web-vitals-injected/README.md +1 -1
  78. package/front_end/models/source_map_scopes/NamesResolver.ts +9 -7
  79. package/front_end/models/trace/ModelImpl.ts +2 -0
  80. package/front_end/models/trace/Processor.ts +6 -4
  81. package/front_end/models/trace/handlers/LayerTreeHandler.ts +3 -3
  82. package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -1
  83. package/front_end/models/trace/helpers/SyntheticEvents.ts +23 -1
  84. package/front_end/models/trace/types/Configuration.ts +7 -0
  85. package/front_end/models/trace/types/TraceEvents.ts +20 -4
  86. package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -0
  87. package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingListView.ts +177 -0
  88. package/front_end/panels/accessibility/accessibility.ts +2 -0
  89. package/front_end/panels/accessibility/accessibilityAnnouncementRecordingListView.css +33 -0
  90. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +25 -15
  91. package/front_end/panels/ai_assistance/components/ChatMessage.ts +6 -35
  92. package/front_end/panels/ai_assistance/components/DisabledWidget.ts +4 -3
  93. package/front_end/panels/animation/AnimationTimeline.ts +1 -0
  94. package/front_end/panels/application/CrashReportContextView.ts +0 -1
  95. package/front_end/panels/application/FrameDetailsView.ts +5 -4
  96. package/front_end/panels/application/IndexedDBViews.ts +4 -4
  97. package/front_end/panels/application/indexedDBViews.css +0 -14
  98. package/front_end/panels/console/ConsoleContextSelector.ts +12 -5
  99. package/front_end/panels/console/ConsoleViewMessage.ts +12 -8
  100. package/front_end/panels/coverage/coverageView.css +8 -8
  101. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +4 -5
  102. package/front_end/panels/developer_resources/developerResourcesView.css +3 -3
  103. package/front_end/panels/elements/ElementsTreeElement.ts +39 -12
  104. package/front_end/panels/elements/ElementsTreeOutline.ts +183 -107
  105. package/front_end/panels/elements/ShortcutTreeElement.ts +4 -0
  106. package/front_end/panels/elements/StylePropertiesSection.ts +1 -34
  107. package/front_end/panels/elements/components/CSSPropertyIconResolver.ts +5 -4
  108. package/front_end/panels/elements/components/StylePropertyEditor.ts +1 -0
  109. package/front_end/panels/elements/components/computedStyleProperty.css +5 -5
  110. package/front_end/panels/elements/components/computedStyleTrace.css +5 -5
  111. package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
  112. package/front_end/panels/elements/components/cssPropertyDocsView.css +3 -3
  113. package/front_end/panels/elements/components/cssVariableValueView.css +4 -4
  114. package/front_end/panels/elements/components/elementsBreadcrumbs.css +3 -3
  115. package/front_end/panels/elements/components/elementsTreeExpandButton.css +5 -5
  116. package/front_end/panels/elements/components/queryContainer.css +2 -2
  117. package/front_end/panels/elements/elementsTreeOutline.css +20 -4
  118. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  119. package/front_end/panels/issues/AffectedElementsView.ts +3 -0
  120. package/front_end/panels/issues/issues.ts +2 -0
  121. package/front_end/panels/layer_viewer/LayerDetailsView.ts +12 -10
  122. package/front_end/panels/layer_viewer/LayerTreeOutline.ts +1 -0
  123. package/front_end/panels/layer_viewer/Layers3DView.ts +13 -11
  124. package/front_end/panels/linear_memory_inspector/components/LinearMemoryHighlightChipList.ts +1 -1
  125. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspectorUtils.ts +2 -2
  126. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterDisplayUtils.ts +1 -1
  127. package/front_end/panels/linear_memory_inspector/components/ValueInterpreterSettings.ts +1 -1
  128. package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +11 -11
  129. package/front_end/panels/media/PlayerPropertiesView.ts +1 -1
  130. package/front_end/panels/media/TickingFlameChart.ts +3 -2
  131. package/front_end/panels/mobile_throttling/NetworkThrottlingSelector.ts +2 -1
  132. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +1 -1
  133. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +2 -1
  134. package/front_end/panels/network/NetworkLogViewColumns.ts +5 -2
  135. package/front_end/panels/network/RequestHeadersView.ts +46 -10
  136. package/front_end/panels/network/components/RequestHeadersView.css +12 -0
  137. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +3 -3
  138. package/front_end/panels/profiler/HeapProfileView.ts +1 -1
  139. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
  140. package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
  141. package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +3 -3
  142. package/front_end/panels/recorder/RecordingListView.ts +0 -6
  143. package/front_end/panels/recorder/RecordingView.ts +0 -6
  144. package/front_end/panels/recorder/controlButton.css +10 -10
  145. package/front_end/panels/recorder/startView.css +1 -1
  146. package/front_end/panels/screencast/ScreencastView.ts +4 -2
  147. package/front_end/panels/search/SearchView.ts +1 -1
  148. package/front_end/panels/security/SecurityPanel.ts +46 -35
  149. package/front_end/panels/timeline/TimelineFlameChartView.ts +0 -32
  150. package/front_end/panels/timeline/TimelinePanel.ts +0 -17
  151. package/front_end/panels/timeline/components/cwvMetrics.css +2 -2
  152. package/front_end/panels/timeline/components/insights/checklist.css +1 -1
  153. package/front_end/panels/timeline/components/insights/table.css +3 -3
  154. package/front_end/panels/timeline/overlays/components/entriesLinkOverlay.css +4 -4
  155. package/front_end/panels/timeline/overlays/components/entryLabelOverlay.css +4 -4
  156. package/front_end/panels/timeline/overlays/components/timeRangeOverlay.css +2 -2
  157. package/front_end/panels/timeline/overlays/components/timespanBreakdownOverlay.css +4 -4
  158. package/front_end/panels/timeline/timelinePanel.css +0 -74
  159. package/front_end/panels/web_audio/webAudio.css +5 -5
  160. package/front_end/third_party/chromium/README.chromium +1 -1
  161. package/front_end/third_party/csp_evaluator/package/tsconfig.json +1 -0
  162. package/front_end/third_party/diff/DiffWrapper.ts +1 -8
  163. package/front_end/third_party/puppeteer/README.chromium +2 -2
  164. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +183 -4
  165. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +708 -122
  166. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +85 -3
  167. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  168. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +84 -11
  169. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  170. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts +75 -0
  171. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.d.ts.map +1 -0
  172. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js +102 -0
  173. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/ScreenRecording.js.map +1 -0
  174. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts +1 -0
  175. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.d.ts.map +1 -1
  176. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js +1 -0
  177. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/api.js.map +1 -1
  178. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts +6 -1
  179. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.d.ts.map +1 -1
  180. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js +7 -0
  181. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Page.js.map +1 -1
  182. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts +31 -0
  183. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.d.ts.map +1 -0
  184. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js +138 -0
  185. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/ScreenRecording.js.map +1 -0
  186. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts +1 -0
  187. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.d.ts.map +1 -1
  188. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js +1 -0
  189. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/bidi.js.map +1 -1
  190. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts +6 -0
  191. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.d.ts.map +1 -1
  192. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js +23 -0
  193. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/BrowsingContext.js.map +1 -1
  194. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts +6 -1
  195. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.d.ts.map +1 -1
  196. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js +7 -0
  197. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Page.js.map +1 -1
  198. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts +31 -0
  199. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.d.ts.map +1 -0
  200. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js +131 -0
  201. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/ScreenRecording.js.map +1 -0
  202. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts +1 -0
  203. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.d.ts.map +1 -1
  204. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js +1 -0
  205. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/cdp.js.map +1 -1
  206. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js +7 -4
  207. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserConnector.js.map +1 -1
  208. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts +4 -1
  209. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.d.ts.map +1 -1
  210. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js +5 -1
  211. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/BrowserWebSocketTransport.js.map +1 -1
  212. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts +42 -0
  213. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  214. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts +2 -2
  215. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.d.ts.map +1 -1
  216. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js +265 -1
  217. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/Device.js.map +1 -1
  218. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts +4 -0
  219. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  220. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +24 -3
  221. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  222. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts +23 -2
  223. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.d.ts.map +1 -1
  224. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js +49 -3
  225. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/NodeWebSocketTransport.js.map +1 -1
  226. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  227. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  228. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  229. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts.map +1 -1
  230. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  231. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js.map +1 -1
  232. package/front_end/third_party/puppeteer/package/lib/types.d.ts +183 -4
  233. package/front_end/third_party/puppeteer/package/package.json +4 -4
  234. package/front_end/third_party/puppeteer/package/src/api/Page.ts +143 -11
  235. package/front_end/third_party/puppeteer/package/src/api/ScreenRecording.ts +145 -0
  236. package/front_end/third_party/puppeteer/package/src/api/api.ts +1 -0
  237. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +11 -0
  238. package/front_end/third_party/puppeteer/package/src/bidi/ScreenRecording.ts +106 -0
  239. package/front_end/third_party/puppeteer/package/src/bidi/bidi.ts +1 -0
  240. package/front_end/third_party/puppeteer/package/src/bidi/core/BrowsingContext.ts +41 -0
  241. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +11 -0
  242. package/front_end/third_party/puppeteer/package/src/cdp/ScreenRecording.ts +101 -0
  243. package/front_end/third_party/puppeteer/package/src/cdp/cdp.ts +1 -0
  244. package/front_end/third_party/puppeteer/package/src/common/BrowserConnector.ts +17 -9
  245. package/front_end/third_party/puppeteer/package/src/common/BrowserWebSocketTransport.ts +4 -0
  246. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +46 -0
  247. package/front_end/third_party/puppeteer/package/src/common/Device.ts +287 -1
  248. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +30 -1
  249. package/front_end/third_party/puppeteer/package/src/node/NodeWebSocketTransport.ts +73 -2
  250. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  251. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  252. package/front_end/third_party/puppeteer/puppeteer-tsconfig.json +194 -0
  253. package/front_end/tsconfig.json +1 -2
  254. package/front_end/ui/comments/CommentAnchorResolver.ts +8 -3
  255. package/front_end/ui/comments/CommentOverlayManager.ts +53 -12
  256. package/front_end/ui/comments/CommentsOverlayWidget.ts +3 -3
  257. package/front_end/ui/comments/CommentsStatusBarPill.ts +96 -0
  258. package/front_end/ui/comments/comments-meta.ts +21 -0
  259. package/front_end/ui/comments/comments.ts +2 -0
  260. package/front_end/ui/comments/commentsOverlay.css +22 -3
  261. package/front_end/ui/components/markdown_view/MarkdownView.ts +31 -1
  262. package/front_end/ui/kit/icons/Icon.ts +0 -1
  263. package/front_end/ui/kit/link/Link.ts +8 -1
  264. package/front_end/ui/legacy/InspectorView.ts +17 -1
  265. package/front_end/ui/legacy/SplitWidget.ts +16 -2
  266. package/front_end/ui/legacy/StatusBar.ts +78 -0
  267. package/front_end/ui/legacy/Toolbar.ts +4 -0
  268. package/front_end/ui/legacy/Treeoutline.ts +78 -11
  269. package/front_end/ui/legacy/UIUtils.ts +2 -1
  270. package/front_end/ui/legacy/ViewRegistration.ts +1 -0
  271. package/front_end/ui/legacy/components/data_grid/dataGrid.css +23 -23
  272. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.docs.ts +83 -0
  273. package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +600 -0
  274. package/front_end/ui/legacy/components/inline_editor/animationNameSwatch.css +1 -1
  275. package/front_end/ui/legacy/components/inline_editor/colorMixSwatch.css +4 -4
  276. package/front_end/ui/legacy/components/inline_editor/cssAngleSwatch.css +3 -3
  277. package/front_end/ui/legacy/components/inline_editor/inline_editor.ts +2 -0
  278. package/front_end/ui/legacy/components/inline_editor/linkSwatch.css +1 -1
  279. package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +154 -0
  280. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +113 -51
  281. package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +10 -7
  282. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +16 -97
  283. package/front_end/ui/legacy/components/object_ui/customPreviewComponent.css +7 -3
  284. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +1 -1
  285. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +0 -66
  286. package/front_end/ui/legacy/components/perf_ui/perf_ui.ts +0 -2
  287. package/front_end/ui/legacy/inspectorCommon.css +30 -6
  288. package/front_end/ui/legacy/legacy.ts +2 -0
  289. package/front_end/ui/legacy/statusBar.css +18 -0
  290. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  291. package/inspector_overlay/main.ts +8 -8
  292. package/mcp/mcp.ts +5 -0
  293. package/package.json +2 -9
  294. package/front_end/Images/generate-css-vars.js +0 -52
  295. package/front_end/Images/rollup.config.mjs +0 -36
  296. package/front_end/models/ai_assistance/AiOrigins.ts +0 -107
  297. package/front_end/models/live-metrics/web-vitals-injected/rollup.config.mjs +0 -20
  298. package/front_end/panels/recorder/injected/rollup.config.mjs +0 -20
  299. package/front_end/panels/timeline/EasterEgg.d.ts +0 -6
  300. package/front_end/panels/timeline/easter-egg-tsconfig.json +0 -8
  301. package/front_end/panels/timeline/enable-easter-egg.js +0 -20
  302. package/front_end/third_party/puppeteer-replay/puppeteer-replay-tsconfig.json +0 -8
  303. package/front_end/ui/legacy/components/perf_ui/BrickBreaker.ts +0 -606
  304. package/inspector_overlay/loadCSS.rollup.js +0 -29
@@ -2,13 +2,11 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Common from '../../../core/common/common.js';
6
5
  import * as Host from '../../../core/host/host.js';
7
6
  import * as i18n from '../../../core/i18n/i18n.js';
8
7
  import * as Platform from '../../../core/platform/platform.js';
9
8
  import * as SDK from '../../../core/sdk/sdk.js';
10
9
  import type {FunctionHandlerOptions} from '../agents/AiAgent.js';
11
- import {areOriginsEquivalent, extractContextOrigin, isOpaqueOrigin} from '../AiOrigins.js';
12
10
 
13
11
  import {MAX_TARGET_ORIGINS, resolveDOMStorages} from './DOMStorageUtils.js';
14
12
  import {
@@ -116,8 +114,8 @@ export class GetStorageValuesTool implements DataTool<GetStorageValuesArgs, GetS
116
114
  const targetManager = SDK.TargetManager.TargetManager.instance();
117
115
  const primaryPageTarget = targetManager.primaryPageTarget();
118
116
 
119
- const allowedOrigin = context.getEstablishedOrigin();
120
- if (!allowedOrigin || isOpaqueOrigin(allowedOrigin)) {
117
+ const establishedOrigin = context.getEstablishedOrigin();
118
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
121
119
  return {error: 'No origin available or not allowed.'};
122
120
  }
123
121
 
@@ -125,14 +123,16 @@ export class GetStorageValuesTool implements DataTool<GetStorageValuesArgs, GetS
125
123
  return {error: 'No origin available or not allowed.'};
126
124
  }
127
125
 
128
- const pageOrigin = Common.ParsedURL.ParsedURL.extractOrigin(primaryPageTarget.inspectedURL());
129
- if (!pageOrigin || !areOriginsEquivalent(pageOrigin, allowedOrigin)) {
126
+ const pageOrigin = primaryPageTarget.inspectedSecurityOrigin();
127
+ if (!pageOrigin.isSameOriginWith(establishedOrigin)) {
130
128
  return {error: 'No origin available or not allowed.'};
131
129
  }
132
130
 
133
- const rawList = (args.origins && args.origins.length > 0) ? args.origins : [allowedOrigin];
134
- const validOrigins = rawList.map(origin => extractContextOrigin(origin))
135
- .filter(origin => areOriginsEquivalent(origin, allowedOrigin));
131
+ const candidateOrigins: SDK.SecurityOrigin.SecurityOrigin[] = (args.origins && args.origins.length > 0) ?
132
+ args.origins.map(origin => SDK.SecurityOrigin.SecurityOrigin.create(origin)) :
133
+ [establishedOrigin];
134
+ const validOrigins =
135
+ candidateOrigins.filter(origin => origin.isSameOriginWith(establishedOrigin)).map(origin => origin.siteId());
136
136
  const targetOrigins = Array.from(new Set(validOrigins)).slice(0, MAX_TARGET_ORIGINS);
137
137
  if (targetOrigins.length === 0) {
138
138
  return {error: 'No valid origins found.'};
@@ -12,6 +12,7 @@ import {
12
12
  type BaseToolCapability,
13
13
  type DataHandlerResult,
14
14
  type DataTool,
15
+ isOriginAllowedByLock,
15
16
  type OriginLockCapability,
16
17
  type TargetCapability,
17
18
  type ToolArgs,
@@ -92,7 +93,7 @@ export class GetStylesTool implements
92
93
  }
93
94
 
94
95
  const establishedOrigin = context.getEstablishedOrigin();
95
- if (!establishedOrigin) {
96
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
96
97
  return {error: 'Error: Origin lock is not established.'};
97
98
  }
98
99
 
@@ -104,7 +105,7 @@ export class GetStylesTool implements
104
105
  return {error: 'Error: Could not find the element with uid=' + uid};
105
106
  }
106
107
  const newContext = new DOMNodeContext(resolved);
107
- if (!newContext.isOriginAllowed(establishedOrigin)) {
108
+ if (!isOriginAllowedByLock(establishedOrigin, newContext.getOrigin())) {
108
109
  return {error: 'Error: Node does not belong to the current origin.'};
109
110
  }
110
111
  const styles = await resolved.domModel().cssModel().getComputedStyle(resolved.id);
@@ -78,7 +78,7 @@ export class ListCookiesTool implements
78
78
  const cookieNamesByOrigin: ListCookiesResult['cookieNamesByOrigin'] = {};
79
79
 
80
80
  await Promise.all(targetOrigins.map(async origin => {
81
- const result = await getCookiesForOrigin(origin, targetManager, primaryPageTarget);
81
+ const result = await getCookiesForOrigin(origin, primaryPageTarget);
82
82
  if ('error' in result) {
83
83
  cookieNamesByOrigin[origin] = {error: result.error};
84
84
  return;
@@ -6,14 +6,13 @@ import * as Host from '../../../core/host/host.js';
6
6
  import * as i18n from '../../../core/i18n/i18n.js';
7
7
  import type * as SDK from '../../../core/sdk/sdk.js';
8
8
  import * as Logs from '../../logs/logs.js';
9
- import {isOpaqueOrigin} from '../AiOrigins.js';
10
- import {getRequestContextOrigin} from '../contexts/RequestContext.js';
11
9
  import {formatBytesToKb, seconds} from '../data_formatters/UnitFormatters.js';
12
10
 
13
11
  import {
14
12
  type BaseToolCapability,
15
13
  type DataHandlerResult,
16
14
  type DataTool,
15
+ isOriginAllowedByLock,
17
16
  type OriginLockCapability,
18
17
  ToolName,
19
18
  } from './Tool.js';
@@ -77,10 +76,8 @@ export class ListNetworkRequestsTool implements
77
76
  const requests: NetworkRequestSummary[] = [];
78
77
  // A conversation is locked to an origin once the first query is made.
79
78
  // We only allow inspecting requests matching the conversation's established origin.
80
- const origin = context.getEstablishedOrigin();
81
-
82
- // Opaque origins are never allowed to be used as context.
83
- if (origin && isOpaqueOrigin(origin)) {
79
+ const establishedOrigin = context.getEstablishedOrigin();
80
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
84
81
  return {
85
82
  error: 'Opaque origin not allowed',
86
83
  };
@@ -91,13 +88,8 @@ export class ListNetworkRequestsTool implements
91
88
  let hasCrossOriginRequest = false;
92
89
  const requestsToShow: SDK.NetworkRequest.NetworkRequest[] = [];
93
90
  for (const request of networkLog.requests()) {
94
- // To prevent cross-origin prompt injection attacks, HAR-imported requests
95
- // are assigned a virtual origin (e.g., `imported-har://${domain}`) rather than
96
- // sharing the origin of live pages.
97
- const requestOrigin = getRequestContextOrigin(request);
98
-
99
- // If the conversation is locked to an origin, skip requests from other origins.
100
- if (origin && requestOrigin !== origin) {
91
+ // If the request's initiator origin does not match the locked origin, skip it.
92
+ if (!isOriginAllowedByLock(establishedOrigin, request.initiatorSecurityOrigin())) {
101
93
  hasCrossOriginRequest = true;
102
94
  continue;
103
95
  }
@@ -115,7 +107,7 @@ export class ListNetworkRequestsTool implements
115
107
  if (requests.length === 0) {
116
108
  if (hasCrossOriginRequest) {
117
109
  return {
118
- error: `No requests showing with origin ${origin}. Tell the user to start a new chat`,
110
+ error: `No requests showing with origin ${establishedOrigin.siteId()}. Tell the user to start a new chat`,
119
111
  };
120
112
  }
121
113
  return {
@@ -2,11 +2,9 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Common from '../../../core/common/common.js';
6
5
  import * as Host from '../../../core/host/host.js';
7
6
  import * as i18n from '../../../core/i18n/i18n.js';
8
7
  import * as SDK from '../../../core/sdk/sdk.js';
9
- import {areOriginsEquivalent, isOpaqueOrigin} from '../AiOrigins.js';
10
8
 
11
9
  import {
12
10
  type BaseToolCapability,
@@ -59,37 +57,34 @@ export class ListPageOriginsTool implements
59
57
  const targetManager = SDK.TargetManager.TargetManager.instance();
60
58
  const primaryPageTarget = targetManager.primaryPageTarget();
61
59
 
62
- const allowedOrigin = context.getEstablishedOrigin();
63
- if (!allowedOrigin || isOpaqueOrigin(allowedOrigin)) {
60
+ const establishedOrigin = context.getEstablishedOrigin();
61
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
64
62
  return {error: 'No origin available or not allowed.'};
65
63
  }
66
64
 
67
65
  const pageOrigin =
68
- primaryPageTarget ? Common.ParsedURL.ParsedURL.extractOrigin(primaryPageTarget.inspectedURL()) : '';
69
- const isAllowed = pageOrigin !== '' && areOriginsEquivalent(pageOrigin, allowedOrigin);
70
-
71
- if (!isAllowed) {
66
+ primaryPageTarget ? SDK.SecurityOrigin.SecurityOrigin.create(primaryPageTarget.inspectedURL()) : null;
67
+ if (!pageOrigin || !pageOrigin.isSameOriginWith(establishedOrigin)) {
72
68
  return {error: 'No origin available or not allowed.'};
73
69
  }
74
70
 
75
- const origins = new Set<string>();
71
+ const origins: SDK.SecurityOrigin.SecurityOrigin[] = [];
76
72
  for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(targetManager)) {
77
73
  if (frame.resourceTreeModel().target().outermostTarget() !== primaryPageTarget) {
78
74
  continue;
79
75
  }
80
- const origin = frame.securityOrigin;
76
+ const frameOrigin = frame.securityOrigin();
81
77
  // Filter out frames that are not same-origin to the page's allowed origin.
82
78
  // Under site isolation, frames can be hosted on different targets/processes,
83
79
  // so we check the security origin of the frame directly instead of the target.
84
- if (!origin || !areOriginsEquivalent(origin, allowedOrigin)) {
80
+ if (!frameOrigin.isSameOriginWith(establishedOrigin)) {
85
81
  continue;
86
82
  }
87
- if (origins.has(origin)) {
88
- continue;
83
+ if (!origins.some(existing => existing.isSameOriginWith(frameOrigin))) {
84
+ origins.push(frameOrigin);
89
85
  }
90
- origins.add(origin);
91
86
  }
92
87
 
93
- return {result: {origins: Array.from(origins)}};
88
+ return {result: {origins: origins.map(o => o.siteId())}};
94
89
  }
95
90
  }
@@ -2,16 +2,16 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Common from '../../../core/common/common.js';
6
5
  import * as Host from '../../../core/host/host.js';
7
6
  import * as i18n from '../../../core/i18n/i18n.js';
8
7
  import * as Workspace from '../../workspace/workspace.js';
9
- import {isOpaqueOrigin} from '../AiOrigins.js';
8
+ import {FileContext} from '../contexts/FileContext.js';
10
9
 
11
10
  import {
12
11
  type BaseToolCapability,
13
12
  type DataHandlerResult,
14
13
  type DataTool,
14
+ isOriginAllowedByLock,
15
15
  type OriginLockCapability,
16
16
  ToolName,
17
17
  } from './Tool.js';
@@ -93,17 +93,15 @@ export class ListSourcesTool implements
93
93
  _params: Record<string, never>,
94
94
  context: BaseToolCapability&OriginLockCapability,
95
95
  ): Promise<DataHandlerResult<{files: SourceSummary[]}>> {
96
- const origin = context.getEstablishedOrigin();
97
- if (origin && isOpaqueOrigin(origin)) {
96
+ const establishedOrigin = context.getEstablishedOrigin();
97
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
98
98
  return {
99
99
  error: 'Opaque origin not allowed',
100
100
  };
101
101
  }
102
102
 
103
103
  const files = ListSourcesTool.getUISourceCodes().filter(file => {
104
- const fileUrl = file.url();
105
- const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
106
- return !origin || fileOrigin === origin;
104
+ return isOriginAllowedByLock(establishedOrigin, FileContext.originForUISourceCode(file));
107
105
  });
108
106
 
109
107
  return {
@@ -2,12 +2,10 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
- import * as Common from '../../../core/common/common.js';
6
5
  import * as Host from '../../../core/host/host.js';
7
6
  import * as i18n from '../../../core/i18n/i18n.js';
8
7
  import * as Platform from '../../../core/platform/platform.js';
9
8
  import * as SDK from '../../../core/sdk/sdk.js';
10
- import {areOriginsEquivalent, extractContextOrigin, isOpaqueOrigin} from '../AiOrigins.js';
11
9
 
12
10
  import {MAX_TARGET_ORIGINS, resolveDOMStorages} from './DOMStorageUtils.js';
13
11
  import {
@@ -102,8 +100,8 @@ export class ListStorageKeysTool implements DataTool<ListStorageKeysArgs, ListSt
102
100
  const targetManager = SDK.TargetManager.TargetManager.instance();
103
101
  const primaryPageTarget = targetManager.primaryPageTarget();
104
102
 
105
- const allowedOrigin = context.getEstablishedOrigin();
106
- if (!allowedOrigin || isOpaqueOrigin(allowedOrigin)) {
103
+ const establishedOrigin = context.getEstablishedOrigin();
104
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
107
105
  return {error: 'No origin available or not allowed.'};
108
106
  }
109
107
 
@@ -111,14 +109,16 @@ export class ListStorageKeysTool implements DataTool<ListStorageKeysArgs, ListSt
111
109
  return {error: 'No origin available or not allowed.'};
112
110
  }
113
111
 
114
- const pageOrigin = Common.ParsedURL.ParsedURL.extractOrigin(primaryPageTarget.inspectedURL());
115
- if (!pageOrigin || !areOriginsEquivalent(pageOrigin, allowedOrigin)) {
112
+ const pageOrigin = primaryPageTarget.inspectedSecurityOrigin();
113
+ if (!pageOrigin.isSameOriginWith(establishedOrigin)) {
116
114
  return {error: 'No origin available or not allowed.'};
117
115
  }
118
116
 
119
- const rawList = (args.origins && args.origins.length > 0) ? args.origins : [allowedOrigin];
120
- const validOrigins = rawList.map(origin => extractContextOrigin(origin))
121
- .filter(origin => areOriginsEquivalent(origin, allowedOrigin));
117
+ const candidateOrigins: SDK.SecurityOrigin.SecurityOrigin[] = (args.origins && args.origins.length > 0) ?
118
+ args.origins.map(origin => SDK.SecurityOrigin.SecurityOrigin.create(origin)) :
119
+ [establishedOrigin];
120
+ const validOrigins =
121
+ candidateOrigins.filter(origin => origin.isSameOriginWith(establishedOrigin)).map(origin => origin.siteId());
122
122
  const targetOrigins = Array.from(new Set(validOrigins)).slice(0, MAX_TARGET_ORIGINS);
123
123
  if (targetOrigins.length === 0) {
124
124
  return {error: 'No valid origins found.'};
@@ -16,8 +16,10 @@ Instead of passing a monolithic "grab-bag" context object to all tool handlers,
16
16
  - `BaseToolCapability`: Base interface providing access to the top-level conversation context step.
17
17
  - `PageExecutionCapability`: For tools executing JavaScript code on the inspected page.
18
18
  - `StyleMutationCapability`: For tools managing and applying style mutations via a `ChangeManager`.
19
- - `TargetCapability`: For tools requiring access to the page's current SDK `Target`.
20
- - `OriginLockCapability`: For tools enforcing cross-origin security via origin locks. Tools that fetch resources or state from the inspected page (such as styling or source code) must use this capability to verify that the target resource matches the conversation's established origin. This prevents the LLM from executing tools against out-of-origin elements or documents. Verification should be done by wrapping resolved resources in helper context classes (e.g., `DOMNodeContext`) and calling `isOriginAllowed(establishedOrigin)`.
19
+ - `OriginLockCapability`: Enforces origin boundaries for tools that access inspected page state or resources. Tools verify targets against the established origin before reading data to prevent unauthorized cross-origin access.
20
+ - For DOM nodes and source files: wrap the target in a context helper (such as `DOMNodeContext` or `FileContext`) and call `isOriginAllowed(establishedOrigin)`.
21
+ - For cookies and DOM storage: validate target origins using `resolveAllowedTargetOrigins()`.
22
+ - For network requests: compare `request.initiatorSecurityOrigin()` to the established origin.
21
23
 
22
24
  ### Unified Context
23
25
 
@@ -10,6 +10,7 @@ import {
10
10
  type BaseToolCapability,
11
11
  type DataHandlerResult,
12
12
  type DataTool,
13
+ isOriginAllowedByLock,
13
14
  type OriginLockCapability,
14
15
  type TargetCapability,
15
16
  type ToolArgs,
@@ -85,7 +86,7 @@ export class ResolveDevtoolsNodePathTool implements DataTool<ResolveDevtoolsNode
85
86
  context: BaseToolCapability&TargetCapability&OriginLockCapability,
86
87
  ): Promise<DataHandlerResult<{backendNodeId: number}>> {
87
88
  const establishedOrigin = context.getEstablishedOrigin();
88
- if (!establishedOrigin) {
89
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
89
90
  return {error: 'Error: Origin lock is not established.'};
90
91
  }
91
92
 
@@ -115,7 +116,7 @@ export class ResolveDevtoolsNodePathTool implements DataTool<ResolveDevtoolsNode
115
116
  const nodeContext = new DOMNodeContext(node);
116
117
  // Security check: Ensure the resolved node belongs to the same origin
117
118
  // that this AI assistance session is locked to, preventing cross-origin access.
118
- if (!nodeContext.isOriginAllowed(establishedOrigin)) {
119
+ if (!isOriginAllowedByLock(establishedOrigin, nodeContext.getOrigin())) {
119
120
  return {error: 'Error: Node does not belong to the locked origin.'};
120
121
  }
121
122
 
@@ -112,13 +112,37 @@ export interface TargetCapability {
112
112
  }
113
113
 
114
114
  /**
115
- * Capability for tools that need to enforce origin locking for security.
115
+ * Capability for tools that enforce conversation origin boundaries.
116
116
  */
117
117
  export interface OriginLockCapability {
118
118
  /**
119
- * Returns the origin that the current conversation is locked to, if any.
119
+ * Returns the security origin locked for the current conversation.
120
+ *
121
+ * TODO: When V1 agents (StylingAgent, AccessibilityAgent) are removed,
122
+ * simplify getEstablishedOrigin() to return SDK.SecurityOrigin.SecurityOrigin
123
+ * non-optionally.
124
+ *
125
+ * @returns The established {@link SDK.SecurityOrigin.SecurityOrigin}, or `undefined`
126
+ * if the conversation is not yet locked to an origin (e.g. before the first query).
120
127
  */
121
- getEstablishedOrigin(): string|undefined;
128
+ getEstablishedOrigin(): SDK.SecurityOrigin.SecurityOrigin|undefined;
129
+ }
130
+
131
+ /**
132
+ * Checks whether a target origin matches the established conversation origin lock.
133
+ * Fails closed (returns false) if established origin is missing/opaque or target is cross-origin.
134
+ */
135
+ export function isOriginAllowedByLock(
136
+ establishedOrigin: SDK.SecurityOrigin.SecurityOrigin|undefined,
137
+ targetOrigin: SDK.SecurityOrigin.SecurityOrigin|null|undefined,
138
+ ): boolean {
139
+ if (!establishedOrigin || establishedOrigin.isOpaque()) {
140
+ return false;
141
+ }
142
+ if (!targetOrigin || targetOrigin.isOpaque()) {
143
+ return false;
144
+ }
145
+ return targetOrigin.isSameOriginWith(establishedOrigin);
122
146
  }
123
147
 
124
148
  /**
@@ -0,0 +1,128 @@
1
+ // Copyright 2026 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 * as Common from '../../core/common/common.js';
6
+ import * as Host from '../../core/host/host.js';
7
+ import * as SDK from '../../core/sdk/sdk.js';
8
+ import type * as Protocol from '../../generated/protocol.js';
9
+ import type * as Logs from '../logs/logs.js';
10
+
11
+ import * as CommentManager from './CommentManager.js';
12
+
13
+ export interface CommentThread {
14
+ id: string;
15
+ text: string;
16
+ networkRequestId?: string;
17
+ backendNodeId?: number;
18
+ editor?: CommentManager.EditorAnchorSignature;
19
+ }
20
+
21
+ export interface RevealTarget {
22
+ networkRequestId?: string;
23
+ backendNodeId?: number;
24
+ }
25
+
26
+ export const enum Events {
27
+ COMMENT_THREADS_CHANGED = 'CommentThreadsChanged',
28
+ }
29
+
30
+ export interface EventTypes {
31
+ [Events.COMMENT_THREADS_CHANGED]: void;
32
+ }
33
+
34
+ /**
35
+ * Headless model bridge connecting DevTools comments subsystem to CD4A.
36
+ * Provides serialization, transmission state tracking, and element reveal capabilities.
37
+ */
38
+ export class CD4ABridge extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
39
+ readonly #commentManager: CommentManager.CommentManager;
40
+ readonly #targetManager?: SDK.TargetManager.TargetManager;
41
+ readonly #networkLog?: Logs.NetworkLog.NetworkLog;
42
+ readonly #inspectorFrontendHost: Host.InspectorFrontendHostAPI.InspectorFrontendHostAPI;
43
+ readonly #eventListeners: Common.EventTarget.EventDescriptor[];
44
+
45
+ constructor(
46
+ commentManager: CommentManager.CommentManager,
47
+ targetManager?: SDK.TargetManager.TargetManager,
48
+ networkLog?: Logs.NetworkLog.NetworkLog,
49
+ inspectorFrontendHost: Host.InspectorFrontendHostAPI.InspectorFrontendHostAPI =
50
+ Host.InspectorFrontendHost.InspectorFrontendHostInstance,
51
+ ) {
52
+ super();
53
+ this.#commentManager = commentManager;
54
+ this.#targetManager = targetManager;
55
+ this.#networkLog = networkLog;
56
+ this.#inspectorFrontendHost = inspectorFrontendHost;
57
+
58
+ this.#eventListeners = [
59
+ this.#commentManager.addEventListener(
60
+ CommentManager.Events.COMMENT_THREADS_CHANGED,
61
+ () => {
62
+ this.dispatchEventToListeners(Events.COMMENT_THREADS_CHANGED);
63
+ },
64
+ ),
65
+ ];
66
+ }
67
+
68
+ dispose(): void {
69
+ Common.EventTarget.removeEventListeners(this.#eventListeners);
70
+ }
71
+
72
+ getCommentThreads(): CommentThread[] {
73
+ const threads = this.#commentManager.takeComments();
74
+ return threads.map(thread => {
75
+ const threadPayload: CommentThread = {
76
+ id: thread.id,
77
+ text: thread.comments[0]?.text ?? '',
78
+ };
79
+ if (thread.anchor.networkRequestId) {
80
+ threadPayload.networkRequestId = thread.anchor.networkRequestId;
81
+ }
82
+ if (thread.anchor.node) {
83
+ threadPayload.backendNodeId = thread.anchor.node.backendNodeId;
84
+ }
85
+ if (thread.anchor.editor) {
86
+ threadPayload.editor = thread.anchor.editor;
87
+ }
88
+ return threadPayload;
89
+ });
90
+ }
91
+
92
+ takeComments(): CommentThread[] {
93
+ return this.getCommentThreads();
94
+ }
95
+
96
+ resolveCommentThread(threadId: string, replyText?: string): boolean {
97
+ return this.#commentManager.resolveCommentThread(threadId, replyText);
98
+ }
99
+
100
+ async reveal(panelName: string, target?: RevealTarget): Promise<void> {
101
+ if (panelName) {
102
+ this.#inspectorFrontendHost.events.dispatchEventToListeners(
103
+ Host.InspectorFrontendHostAPI.Events.ShowPanel,
104
+ panelName,
105
+ );
106
+ }
107
+
108
+ if (target?.networkRequestId && this.#networkLog) {
109
+ const [request] = this.#networkLog.requestsForId(target.networkRequestId);
110
+ if (request) {
111
+ await Common.Revealer.reveal(request);
112
+ }
113
+ }
114
+
115
+ if (target?.backendNodeId !== undefined && this.#targetManager) {
116
+ const primaryTarget = this.#targetManager.primaryPageTarget();
117
+ const domModel = primaryTarget?.model(SDK.DOMModel.DOMModel);
118
+ if (domModel) {
119
+ const cdpNodeId = target.backendNodeId as Protocol.DOM.BackendNodeId;
120
+ const nodeMap = await domModel.pushNodesByBackendIdsToFrontend(new Set([cdpNodeId]));
121
+ const node = nodeMap?.get(cdpNodeId);
122
+ if (node) {
123
+ await Common.Revealer.reveal(node);
124
+ }
125
+ }
126
+ }
127
+ }
128
+ }
@@ -11,6 +11,13 @@ export interface EditorAnchorSignature {
11
11
  filePath?: string;
12
12
  }
13
13
 
14
+ export interface DOMNodeAnchorSignature {
15
+ /** Backend NodeId for DOM nodes (`data-backend-node-id`) */
16
+ backendNodeId: number;
17
+ /** Target ID associated with the DOM node (`data-target-id`) */
18
+ targetId: string;
19
+ }
20
+
14
21
  export interface CommentAnchorSignature {
15
22
  /** Visual logging tree path, e.g. "Panel: elements > Pane: styles > TreeOutline > TreeItem: color" */
16
23
  vePath: string;
@@ -22,8 +29,8 @@ export interface CommentAnchorSignature {
22
29
  siblingIndex?: number;
23
30
  /** Optional backend RequestId for Network panel elements (`data-network-request-id`) */
24
31
  networkRequestId?: string;
25
- /** Optional backend NodeId for Elements panel DOM nodes (`data-backend-node-id`) */
26
- backendNodeId?: number;
32
+ /** Optional DOM node identifiers (`data-backend-node-id`, `data-target-id`) */
33
+ node?: DOMNodeAnchorSignature;
27
34
  /** Optional editor anchor coordinates for CodeMirror text editors */
28
35
  editor?: EditorAnchorSignature;
29
36
  }
@@ -39,7 +46,9 @@ export interface CommentThread {
39
46
  anchor: CommentAnchorSignature;
40
47
  comments: Comment[];
41
48
  status: 'ACTIVE'|'RESOLVED';
49
+ transmitted?: boolean;
42
50
  changes?: Array<Record<string, unknown>>;
51
+ index: number;
43
52
  }
44
53
 
45
54
  export const enum Events {
@@ -78,17 +87,21 @@ export class CommentManager extends Common.ObjectWrapper.ObjectWrapper<EventType
78
87
  author: 'DEVELOPER'|'AGENT' = 'DEVELOPER',
79
88
  changes?: Array<Record<string, unknown>>,
80
89
  ): CommentThread {
81
- const id = `comment-${this.#nextId++}`;
90
+ const index = this.#nextId++;
91
+ const id = `comment-${index}`;
92
+ const comment: Comment = {
93
+ author,
94
+ text,
95
+ timestamp: Date.now(),
96
+ };
82
97
  const thread: CommentThread = {
83
98
  id,
84
99
  anchor,
85
- comments: [{
86
- author,
87
- text,
88
- timestamp: Date.now(),
89
- }],
100
+ comments: [comment],
90
101
  status: 'ACTIVE',
102
+ transmitted: false,
91
103
  changes,
104
+ index,
92
105
  };
93
106
 
94
107
  this.#commentThreads.set(id, thread);
@@ -104,6 +117,35 @@ export class CommentManager extends Common.ObjectWrapper.ObjectWrapper<EventType
104
117
  return Array.from(this.#commentThreads.values());
105
118
  }
106
119
 
120
+ takeComments(): CommentThread[] {
121
+ const threads: CommentThread[] = [];
122
+ for (const thread of this.#commentThreads.values()) {
123
+ if (!thread.transmitted) {
124
+ thread.transmitted = true;
125
+ threads.push(thread);
126
+ }
127
+ }
128
+ return threads;
129
+ }
130
+
131
+ resolveCommentThread(threadId: string, replyText?: string): boolean {
132
+ const thread = this.#commentThreads.get(threadId);
133
+ if (!thread) {
134
+ return false;
135
+ }
136
+ if (replyText && replyText.trim().length > 0) {
137
+ const comment: Comment = {
138
+ author: 'AGENT',
139
+ text: replyText.trim(),
140
+ timestamp: Date.now(),
141
+ };
142
+ thread.comments.push(comment);
143
+ }
144
+ thread.status = 'RESOLVED';
145
+ this.dispatchEventToListeners(Events.COMMENT_THREADS_CHANGED, this.getCommentThreads());
146
+ return true;
147
+ }
148
+
107
149
  removeCommentThread(id: string): void {
108
150
  if (!this.#commentThreads.has(id)) {
109
151
  return;
@@ -2,8 +2,10 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as CD4ABridge from './CD4ABridge.js';
5
6
  import * as CommentManager from './CommentManager.js';
6
7
 
7
8
  export {
9
+ CD4ABridge,
8
10
  CommentManager,
9
11
  };