chrome-devtools-frontend 1.0.1675430 → 1.0.1676824

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 (225) hide show
  1. package/WATCHLISTS +0 -4
  2. package/front_end/core/common/Settings.ts +0 -66
  3. package/front_end/core/root/Runtime.ts +0 -5
  4. package/front_end/core/sdk/CSSMetadata.ts +5 -9
  5. package/front_end/core/sdk/CSSPropertyParserMatchers.ts +8 -28
  6. package/front_end/core/sdk/DebuggerModel.ts +50 -30
  7. package/front_end/core/sdk/ResourceTreeModel.ts +20 -1
  8. package/front_end/core/sdk/Script.ts +9 -53
  9. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +213 -23
  10. package/front_end/entrypoints/main/MainImpl.ts +31 -0
  11. package/front_end/generated/InspectorBackendCommands.ts +3 -1
  12. package/front_end/generated/SupportedCSSProperties.ts +21 -4
  13. package/front_end/generated/protocol-mapping.d.ts +14 -0
  14. package/front_end/generated/protocol-proxy-api.d.ts +10 -0
  15. package/front_end/generated/protocol.ts +35 -0
  16. package/front_end/models/ai_assistance/AiAgent2.ts +11 -0
  17. package/front_end/models/ai_assistance/AiConversation.ts +22 -5
  18. package/front_end/models/ai_assistance/README.md +52 -26
  19. package/front_end/models/ai_assistance/agents/AiAgent.ts +54 -8
  20. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +1 -1
  21. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +7 -194
  22. package/front_end/models/ai_assistance/agents/StorageAgent.ts +8 -87
  23. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -1
  24. package/front_end/models/ai_assistance/ai_assistance.ts +16 -0
  25. package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +124 -0
  26. package/front_end/models/ai_assistance/contexts/StorageContext.ts +111 -0
  27. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +69 -1
  28. package/front_end/models/ai_assistance/skills/README.md +63 -1
  29. package/front_end/models/ai_assistance/skills/Skill.ts +1 -1
  30. package/front_end/models/ai_assistance/skills/SkillRegistry.ts +4 -0
  31. package/front_end/models/ai_assistance/skills/performance.md +8 -0
  32. package/front_end/models/ai_assistance/skills/sources.md +16 -0
  33. package/front_end/models/ai_assistance/skills/storage.md +31 -0
  34. package/front_end/models/ai_assistance/tools/GetSourceContent.ts +101 -0
  35. package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +83 -0
  36. package/front_end/models/ai_assistance/tools/GetTraceMainThreadSummary.ts +106 -0
  37. package/front_end/models/ai_assistance/tools/GetTraceNetworkSummary.ts +104 -0
  38. package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +81 -0
  39. package/front_end/models/ai_assistance/tools/ListSources.ts +116 -0
  40. package/front_end/models/ai_assistance/tools/SelectTraceEventByKey.ts +90 -0
  41. package/front_end/models/ai_assistance/tools/Tool.ts +22 -1
  42. package/front_end/models/ai_assistance/tools/ToolRegistry.ts +14 -0
  43. package/front_end/models/bindings/CSSWorkspaceBinding.ts +4 -0
  44. package/front_end/models/bindings/CompilerScriptMapping.ts +4 -0
  45. package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +8 -0
  46. package/front_end/models/bindings/ResourceScriptMapping.ts +3 -201
  47. package/front_end/models/bindings/SASSSourceMapping.ts +6 -0
  48. package/front_end/models/breakpoints/BreakpointManager.ts +2 -49
  49. package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +27 -0
  50. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +10 -2
  51. package/front_end/models/issues_manager/descriptions/connectionAllowlistEmbeddingRequirementNotSatisfied.md +26 -0
  52. package/front_end/models/issues_manager/descriptions/connectionAllowlistIFrameAttributeLoosensEmbeddingRequirement.md +19 -0
  53. package/front_end/models/issues_manager/descriptions/connectionAllowlistInvalidAllowConnectionAllowlistFrom.md +21 -0
  54. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  55. package/front_end/models/persistence/IsolatedFileSystem.ts +7 -8
  56. package/front_end/models/persistence/IsolatedFileSystemManager.ts +2 -2
  57. package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
  58. package/front_end/models/persistence/persistence-meta.ts +9 -9
  59. package/front_end/models/trace/types/TraceEvents.ts +36 -0
  60. package/front_end/panels/accessibility/ARIAAttributesView.ts +3 -3
  61. package/front_end/panels/accessibility/AccessibilityNodeView.ts +36 -36
  62. package/front_end/panels/accessibility/AccessibilityStrings.ts +168 -168
  63. package/front_end/panels/accessibility/SourceOrderView.ts +7 -7
  64. package/front_end/panels/accessibility/accessibility-meta.ts +2 -2
  65. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +5 -5
  66. package/front_end/panels/ai_assistance/components/AIv2MarkdownRenderer.ts +2 -3
  67. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -2
  68. package/front_end/panels/ai_assistance/components/ChatMessage.ts +27 -2
  69. package/front_end/panels/application/IndexedDBViews.ts +65 -63
  70. package/front_end/panels/application/WebMCPView.ts +16 -7
  71. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +5 -5
  72. package/front_end/panels/common/BadgeNotification.ts +8 -8
  73. package/front_end/panels/common/ExtensionServer.ts +21 -1
  74. package/front_end/panels/common/GdpSignUpDialog.ts +16 -16
  75. package/front_end/panels/common/GeminiRebrandPromoDialog.ts +5 -6
  76. package/front_end/panels/common/PersistenceUtils.ts +2 -2
  77. package/front_end/panels/common/common.ts +0 -97
  78. package/front_end/panels/console/ConsoleInsightTeaser.ts +2 -2
  79. package/front_end/panels/console/ConsolePinPane.ts +2 -2
  80. package/front_end/panels/console/ConsoleView.ts +20 -19
  81. package/front_end/panels/elements/LayoutPane.ts +2 -8
  82. package/front_end/panels/event_listeners/EventListenersView.ts +8 -4
  83. package/front_end/panels/issues/AffectedTrackingSitesView.ts +25 -14
  84. package/front_end/panels/media/PlayerMessagesView.ts +149 -68
  85. package/front_end/panels/network/NetworkPanel.ts +1 -1
  86. package/front_end/panels/network/RequestPayloadView.ts +1 -0
  87. package/front_end/panels/profiler/HeapSnapshotView.ts +0 -2
  88. package/front_end/panels/profiler/heapProfiler.css +0 -9
  89. package/front_end/panels/recorder/RecorderPanel.ts +2 -3
  90. package/front_end/panels/screencast/ScreencastView.ts +148 -138
  91. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +2 -2
  92. package/front_end/panels/sources/DebuggerPlugin.ts +9 -58
  93. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  94. package/front_end/panels/sources/UISourceCodeFrame.ts +3 -8
  95. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +4 -2
  96. package/front_end/panels/timeline/TimelineController.ts +36 -64
  97. package/front_end/panels/timeline/TimelinePanel.ts +11 -8
  98. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -2
  99. package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
  100. package/front_end/panels/timeline/timelinePanel.css +0 -10
  101. package/front_end/panels/utils/utils.ts +7 -7
  102. package/front_end/services/tracing/PerformanceTracing.ts +5 -17
  103. package/front_end/third_party/chromium/README.chromium +1 -1
  104. package/front_end/third_party/codemirror.next/chunk/codemirror.js +1 -1
  105. package/front_end/third_party/codemirror.next/chunk/codemirror.js.map +1 -1
  106. package/front_end/third_party/codemirror.next/package.json +2 -2
  107. package/front_end/third_party/codemirror.next/rebuild.sh +4 -1
  108. package/front_end/ui/comments/CommentAnchorResolver.ts +436 -10
  109. package/front_end/ui/comments/CommentManager.ts +640 -0
  110. package/front_end/ui/comments/CommentsOverlayWidget.ts +121 -0
  111. package/front_end/ui/comments/comments.ts +4 -0
  112. package/front_end/ui/comments/commentsOverlay.css +49 -0
  113. package/front_end/{panels/common → ui/components/dialogs}/FreDialog.ts +6 -6
  114. package/front_end/ui/components/dialogs/TypeToAllowDialog.ts +96 -0
  115. package/front_end/ui/components/dialogs/dialogs.ts +4 -0
  116. package/front_end/ui/components/settings/SettingCheckbox.ts +3 -3
  117. package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionDisclaimer.ts +13 -13
  118. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +7 -6
  119. package/front_end/{panels/common → ui/components/text_editor}/AiCodeCompletionTeaser.ts +43 -46
  120. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +22 -26
  121. package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationTeaser.ts +10 -10
  122. package/front_end/{panels/common → ui/components/text_editor}/AiCodeGenerationUpgradeDialog.ts +5 -5
  123. package/front_end/ui/components/text_editor/text_editor.ts +4 -0
  124. package/front_end/ui/legacy/Toolbar.ts +1 -1
  125. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +11 -3
  126. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +270 -162
  127. package/front_end/ui/legacy/components/object_ui/objectPropertiesSection.css +5 -0
  128. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +11 -16
  129. package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +5 -12
  130. package/front_end/ui/legacy/components/source_frame/JSONView.ts +8 -1
  131. package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +2 -2
  132. package/front_end/ui/settings/SettingUIRegistration.ts +55 -6
  133. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  134. package/mcp/mcp.ts +6 -1
  135. package/package.json +1 -1
  136. package/front_end/Images/toolbarResizerVertical.png +0 -0
  137. package/front_end/emulated_devices/MotoG4-landscape.svg +0 -155
  138. package/front_end/emulated_devices/MotoG4-portrait.svg +0 -155
  139. package/front_end/emulated_devices/Nexus5X-landscape.svg +0 -19
  140. package/front_end/emulated_devices/Nexus5X-portrait.svg +0 -19
  141. package/front_end/emulated_devices/Nexus6P-landscape.svg +0 -50
  142. package/front_end/emulated_devices/Nexus6P-portrait.svg +0 -54
  143. package/front_end/emulated_devices/google-nest-hub-horizontal.png +0 -0
  144. package/front_end/emulated_devices/google-nest-hub-max-horizontal.png +0 -0
  145. package/front_end/emulated_devices/google-nexus-5-horizontal-default-1x.png +0 -0
  146. package/front_end/emulated_devices/google-nexus-5-horizontal-default-2x.png +0 -0
  147. package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-1x.png +0 -0
  148. package/front_end/emulated_devices/google-nexus-5-horizontal-keyboard-2x.png +0 -0
  149. package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-1x.png +0 -0
  150. package/front_end/emulated_devices/google-nexus-5-horizontal-navigation-2x.png +0 -0
  151. package/front_end/emulated_devices/google-nexus-5-vertical-default-1x.png +0 -0
  152. package/front_end/emulated_devices/google-nexus-5-vertical-default-2x.png +0 -0
  153. package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-1x.png +0 -0
  154. package/front_end/emulated_devices/google-nexus-5-vertical-keyboard-2x.png +0 -0
  155. package/front_end/emulated_devices/google-nexus-5-vertical-navigation-1x.png +0 -0
  156. package/front_end/emulated_devices/google-nexus-5-vertical-navigation-2x.png +0 -0
  157. package/front_end/emulated_devices/google-nexus-5x-horizontal-default-1x.png +0 -0
  158. package/front_end/emulated_devices/google-nexus-5x-horizontal-default-2x.png +0 -0
  159. package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-1x.png +0 -0
  160. package/front_end/emulated_devices/google-nexus-5x-horizontal-keyboard-2x.png +0 -0
  161. package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-1x.png +0 -0
  162. package/front_end/emulated_devices/google-nexus-5x-horizontal-navigation-2x.png +0 -0
  163. package/front_end/emulated_devices/google-nexus-5x-vertical-default-1x.png +0 -0
  164. package/front_end/emulated_devices/google-nexus-5x-vertical-default-2x.png +0 -0
  165. package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-1x.png +0 -0
  166. package/front_end/emulated_devices/google-nexus-5x-vertical-keyboard-2x.png +0 -0
  167. package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-1x.png +0 -0
  168. package/front_end/emulated_devices/google-nexus-5x-vertical-navigation-2x.png +0 -0
  169. package/front_end/emulated_devices/iPad-landscape.svg +0 -73
  170. package/front_end/emulated_devices/iPad-portrait.svg +0 -76
  171. package/front_end/emulated_devices/iPhone5-landscape.svg +0 -99
  172. package/front_end/emulated_devices/iPhone5-portrait.svg +0 -83
  173. package/front_end/emulated_devices/iPhone6-landscape.svg +0 -111
  174. package/front_end/emulated_devices/iPhone6-portrait.svg +0 -116
  175. package/front_end/emulated_devices/iPhone6Plus-landscape.svg +0 -118
  176. package/front_end/emulated_devices/iPhone6Plus-portrait.svg +0 -116
  177. package/front_end/emulated_devices/optimized/MotoG4-landscape.avif +0 -0
  178. package/front_end/emulated_devices/optimized/MotoG4-portrait.avif +0 -0
  179. package/front_end/emulated_devices/optimized/Nexus5X-landscape.avif +0 -0
  180. package/front_end/emulated_devices/optimized/Nexus5X-portrait.avif +0 -0
  181. package/front_end/emulated_devices/optimized/Nexus6P-landscape.avif +0 -0
  182. package/front_end/emulated_devices/optimized/Nexus6P-portrait.avif +0 -0
  183. package/front_end/emulated_devices/optimized/README.md +0 -9
  184. package/front_end/emulated_devices/optimized/google-nest-hub-horizontal.avif +0 -0
  185. package/front_end/emulated_devices/optimized/google-nest-hub-max-horizontal.avif +0 -0
  186. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-1x.avif +0 -0
  187. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-default-2x.avif +0 -0
  188. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-1x.avif +0 -0
  189. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-keyboard-2x.avif +0 -0
  190. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-1x.avif +0 -0
  191. package/front_end/emulated_devices/optimized/google-nexus-5-horizontal-navigation-2x.avif +0 -0
  192. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-1x.avif +0 -0
  193. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-default-2x.avif +0 -0
  194. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-1x.avif +0 -0
  195. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-keyboard-2x.avif +0 -0
  196. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-1x.avif +0 -0
  197. package/front_end/emulated_devices/optimized/google-nexus-5-vertical-navigation-2x.avif +0 -0
  198. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-1x.avif +0 -0
  199. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-default-2x.avif +0 -0
  200. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-1x.avif +0 -0
  201. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-keyboard-2x.avif +0 -0
  202. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-1x.avif +0 -0
  203. package/front_end/emulated_devices/optimized/google-nexus-5x-horizontal-navigation-2x.avif +0 -0
  204. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-1x.avif +0 -0
  205. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-default-2x.avif +0 -0
  206. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-1x.avif +0 -0
  207. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-keyboard-2x.avif +0 -0
  208. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-1x.avif +0 -0
  209. package/front_end/emulated_devices/optimized/google-nexus-5x-vertical-navigation-2x.avif +0 -0
  210. package/front_end/emulated_devices/optimized/iPad-landscape.avif +0 -0
  211. package/front_end/emulated_devices/optimized/iPad-portrait.avif +0 -0
  212. package/front_end/emulated_devices/optimized/iPhone5-landscape.avif +0 -0
  213. package/front_end/emulated_devices/optimized/iPhone5-portrait.avif +0 -0
  214. package/front_end/emulated_devices/optimized/iPhone6-landscape.avif +0 -0
  215. package/front_end/emulated_devices/optimized/iPhone6-portrait.avif +0 -0
  216. package/front_end/emulated_devices/optimized/iPhone6Plus-landscape.avif +0 -0
  217. package/front_end/emulated_devices/optimized/iPhone6Plus-portrait.avif +0 -0
  218. package/front_end/emulated_devices/optimized/optimized_images.gni +0 -53
  219. package/front_end/models/ai_assistance/agents/README.md +0 -136
  220. /package/front_end/{panels/common → ui/components/dialogs}/freDialog.css +0 -0
  221. /package/front_end/{panels/common/common.css → ui/components/dialogs/typeToAllowDialog.css} +0 -0
  222. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionDisclaimer.css +0 -0
  223. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeCompletionTeaser.css +0 -0
  224. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationTeaser.css +0 -0
  225. /package/front_end/{panels/common → ui/components/text_editor}/aiCodeGenerationUpgradeDialog.css +0 -0
@@ -0,0 +1,31 @@
1
+ ---
2
+ name: storage
3
+ description: inspect, understand, and audit the state stored in browser storage (LocalStorage, SessionStorage) or cookies.
4
+ allowed-tools:
5
+ - listPageOrigins
6
+ ---
7
+ You are a Senior Software Engineer specializing in state audit and storage analysis within Chrome DevTools. Your mission is to help developers debug storage-related issues faster by analyzing the evidence in LocalStorage, SessionStorage, and Cookies.
8
+
9
+ You have access to the site's storage using tools.
10
+
11
+ # Goals
12
+
13
+ 1. **Explain Purpose**: Identify what specific storage entries or cookies are for.
14
+ 2. **Understand Application State**: Help users inspect, understand, and audit the state stored in browser storage or cookies, and how it relates to application behavior or issues (such as state mismatch/drift, security misconfigurations, or oversized cookies).
15
+ 3. **Top-Level Page First**: Your primary goal is to assist the user in understanding and debugging the storage of the **top-level page**. This context is the most critical for debugging and should be your default starting point for any analysis.
16
+
17
+ # Tools & Workflow
18
+
19
+ - **Top-Level Context**: Generally, questions refer to the primary page target ("my page", "this page", etc.). If the user selects a general category or a specific selection, answers should refer to that particular selection, but follow-up questions may switch to the primary page target.
20
+ - **Address Specific Selections**: The user can select individual storage items in the DevTools UI (provided in the '# Active Context' section of the prompt). If the query is about a selected item (e.g., "Why is this cookie set?"), focus your response on that specific item.
21
+ - **General Category Selection**: If a general storage category (such as Cookies, Local Storage, or Session Storage) is selected in the active context (indicated by an empty context origin), your first step MUST be to look through all active page origins by calling `listPageOrigins` to discover origins, unless the user's explicit request hints otherwise.
22
+ - **Expand Scope When Necessary**: For general questions or those implying a wider scope (e.g., "Check all storages," "Are there related cookies on subdomains?"), proactively use your tools to explore other relevant storage contexts, including iframes and different origins.
23
+ - **Discovery**: Start by calling `listPageOrigins` to discover all active, non-empty frame origins loaded by the page.
24
+ - **Active Context**: Start by inspecting the active context's origin (provided in the '# Active Context' section of the prompt).
25
+
26
+ # Considerations
27
+
28
+ - **Strictly Read-Only**: You cannot write, clear, delete, or edit storage or cookies.
29
+ - **DevTools UI Fallback**: If the user asks you to modify state, politely decline and provide exact step-by-step visual navigation directions on how they can perform the edit manually in the DevTools Application panel. Do NOT supply Console scripts.
30
+ - **Raw Evidence**: Treat storage data as raw evidence. Do not make assumptions about values without reading them first.
31
+ - **Dynamic State**: Always re-request values if you suspect they might have changed, rather than relying on past tool outputs.
@@ -0,0 +1,101 @@
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 i18n from '../../../core/i18n/i18n.js';
8
+ import * as TextUtils from '../../../core/text_utils/text_utils.js';
9
+ import {FileFormatter} from '../data_formatters/FileFormatter.js';
10
+
11
+ import {ListSourcesTool} from './ListSources.js';
12
+ import {
13
+ type BaseToolCapability,
14
+ type DataHandlerResult,
15
+ type DataTool,
16
+ type OriginLockCapability,
17
+ type ToolArgs,
18
+ ToolName,
19
+ } from './Tool.js';
20
+
21
+ const UIStringsNotTranslate = {
22
+ readingSource: 'Reading source content',
23
+ } as const;
24
+
25
+ const lockedString = i18n.i18n.lockedString;
26
+
27
+ export interface GetSourceContentArgs extends ToolArgs {
28
+ id: number;
29
+ }
30
+
31
+ /**
32
+ * A tool that retrieves the contents of a source file by its unique ID.
33
+ * Filters access by origin lock to prevent cross-origin leakage.
34
+ */
35
+ export class GetSourceContentTool implements
36
+ DataTool<GetSourceContentArgs, {content: string}, BaseToolCapability&OriginLockCapability> {
37
+ readonly name = ToolName.GET_SOURCE_CONTENT;
38
+ readonly description = 'Gets the content and metadata of a source file by its ID.';
39
+
40
+ readonly parameters: Host.AidaClient.FunctionObjectParam<keyof GetSourceContentArgs> = {
41
+ type: Host.AidaClient.ParametersTypes.OBJECT,
42
+ description: '',
43
+ properties: {
44
+ id: {
45
+ type: Host.AidaClient.ParametersTypes.INTEGER,
46
+ description: 'The unique numeric ID of the source file to retrieve.',
47
+ nullable: false,
48
+ },
49
+ },
50
+ required: ['id'],
51
+ };
52
+
53
+ displayInfoFromArgs(args: GetSourceContentArgs): {
54
+ title: string,
55
+ action: string,
56
+ } {
57
+ return {
58
+ title: lockedString(UIStringsNotTranslate.readingSource),
59
+ action: `getSourceContent(${args.id})`,
60
+ };
61
+ }
62
+
63
+ async handler(
64
+ args: GetSourceContentArgs,
65
+ context: BaseToolCapability&OriginLockCapability,
66
+ ): Promise<DataHandlerResult<{content: string}>> {
67
+ const origin = context.getEstablishedOrigin();
68
+ const file = ListSourcesTool.getUISourceCodes().find(
69
+ f => ListSourcesTool.uiSourceCodeId.get(f) === args.id,
70
+ );
71
+
72
+ if (!file) {
73
+ return {
74
+ error: 'Unable to find file.',
75
+ };
76
+ }
77
+
78
+ const fileUrl = file.url();
79
+ const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
80
+ if (origin && fileOrigin !== origin) {
81
+ return {
82
+ error: 'Cross-origin access blocked.',
83
+ };
84
+ }
85
+
86
+ const contentData = await file.requestContentData();
87
+ if (TextUtils.ContentData.ContentData.isError(contentData)) {
88
+ return {
89
+ error: `Failed to load file content: ${contentData.error}`,
90
+ };
91
+ }
92
+
93
+ const formatter = new FileFormatter(file);
94
+
95
+ return {
96
+ result: {
97
+ content: formatter.formatFile(),
98
+ },
99
+ };
100
+ }
101
+ }
@@ -0,0 +1,83 @@
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 Host from '../../../core/host/host.js';
6
+ import * as i18n from '../../../core/i18n/i18n.js';
7
+ import {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
8
+ import {formatEventForAI} from '../data_formatters/PerformanceTraceFormatter.js';
9
+
10
+ import {
11
+ type BaseToolCapability,
12
+ type DataHandlerResult,
13
+ type DataTool,
14
+ type ToolArgs,
15
+ ToolName,
16
+ } from './Tool.js';
17
+
18
+ const UIStringsNotTranslate = {
19
+ lookingAtTraceEvent: 'Looking at trace event',
20
+ } as const;
21
+
22
+ const lockedString = i18n.i18n.lockedString;
23
+
24
+ export interface GetTraceEventByKeyArgs extends ToolArgs {
25
+ eventKey: string;
26
+ }
27
+
28
+ export class GetTraceEventByKeyTool implements DataTool<GetTraceEventByKeyArgs, string, BaseToolCapability> {
29
+ readonly name = ToolName.GET_TRACE_EVENT_BY_KEY;
30
+ readonly description = 'Get details for a specific trace event by its event key.';
31
+
32
+ readonly parameters: Host.AidaClient.FunctionObjectParam<keyof GetTraceEventByKeyArgs> = {
33
+ type: Host.AidaClient.ParametersTypes.OBJECT,
34
+ description: 'Arguments for looking up a trace event.',
35
+ nullable: false,
36
+ properties: {
37
+ eventKey: {
38
+ type: Host.AidaClient.ParametersTypes.STRING,
39
+ description: 'The key of the event to look up.',
40
+ nullable: false,
41
+ },
42
+ },
43
+ required: ['eventKey'],
44
+ };
45
+
46
+ displayInfoFromArgs(params: GetTraceEventByKeyArgs): {
47
+ title: string,
48
+ action: string,
49
+ } {
50
+ return {
51
+ title: lockedString(UIStringsNotTranslate.lookingAtTraceEvent),
52
+ action: `getTraceEventByKey('${params.eventKey}')`,
53
+ };
54
+ }
55
+
56
+ async handler(
57
+ params: GetTraceEventByKeyArgs,
58
+ capabilities: BaseToolCapability,
59
+ ): Promise<DataHandlerResult<string>> {
60
+ const conversationContext = capabilities.conversationContext;
61
+ if (!conversationContext || !(conversationContext instanceof PerformanceTraceContext)) {
62
+ return {error: 'Performance trace context is not available.'};
63
+ }
64
+
65
+ const focus = conversationContext.getItem();
66
+ const event = focus.lookupEvent(params.eventKey);
67
+ if (!event) {
68
+ return {error: `Could not find event with key "${params.eventKey}".`};
69
+ }
70
+
71
+ const details = formatEventForAI(event);
72
+ return {
73
+ result: details,
74
+ widgets: [{
75
+ name: 'TIMELINE_EVENT_SUMMARY',
76
+ data: {
77
+ event,
78
+ parsedTrace: focus.parsedTrace,
79
+ },
80
+ }],
81
+ };
82
+ }
83
+ }
@@ -0,0 +1,106 @@
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 Host from '../../../core/host/host.js';
6
+ import * as i18n from '../../../core/i18n/i18n.js';
7
+ import {
8
+ type MainThreadSectionLabel,
9
+ PerformanceTraceContext,
10
+ } from '../contexts/PerformanceTraceContext.js';
11
+
12
+ import {
13
+ type BaseToolCapability,
14
+ type DataHandlerResult,
15
+ type DataTool,
16
+ MAX_FUNCTION_RESULT_BYTE_LENGTH,
17
+ type ToolArgs,
18
+ ToolName,
19
+ } from './Tool.js';
20
+
21
+ const UIStringsNotTranslate = {
22
+ mainThreadActivity: 'Main thread activity',
23
+ } as const;
24
+
25
+ const lockedString = i18n.i18n.lockedString;
26
+
27
+ export interface GetTraceMainThreadSummaryArgs extends ToolArgs {
28
+ label: MainThreadSectionLabel;
29
+ }
30
+
31
+ export class GetTraceMainThreadSummaryTool implements
32
+ DataTool<GetTraceMainThreadSummaryArgs, string, BaseToolCapability> {
33
+ readonly name = ToolName.GET_TRACE_MAIN_THREAD_SUMMARY;
34
+ readonly description = 'Returns a focused, detailed summary of the main thread for a predefined labeled period.';
35
+
36
+ readonly parameters: Host.AidaClient.FunctionObjectParam<keyof GetTraceMainThreadSummaryArgs> = {
37
+ type: Host.AidaClient.ParametersTypes.OBJECT,
38
+ description: 'Arguments for looking up a main thread summary.',
39
+ nullable: false,
40
+ properties: {
41
+ label: {
42
+ type: Host.AidaClient.ParametersTypes.STRING,
43
+ description:
44
+ 'The label of the period to investigate (e.g., \'LCPBreakdown\', \'CLSCulprits\', \'nav-to-lcp\').',
45
+ nullable: false,
46
+ },
47
+ },
48
+ required: ['label'],
49
+ };
50
+
51
+ displayInfoFromArgs(params: GetTraceMainThreadSummaryArgs): {
52
+ title: string,
53
+ action: string,
54
+ } {
55
+ return {
56
+ title: `${lockedString(UIStringsNotTranslate.mainThreadActivity)}: ${params.label}`,
57
+ action: `getTraceMainThreadSummary('${params.label}')`,
58
+ };
59
+ }
60
+
61
+ async handler(
62
+ params: GetTraceMainThreadSummaryArgs,
63
+ capabilities: BaseToolCapability,
64
+ ): Promise<DataHandlerResult<string>> {
65
+ const conversationContext = capabilities.conversationContext;
66
+ if (!conversationContext || !(conversationContext instanceof PerformanceTraceContext)) {
67
+ return {error: 'Performance trace context is not available.'};
68
+ }
69
+
70
+ const focus = conversationContext.getItem();
71
+ const bounds = conversationContext.getBoundsForLabel(params.label);
72
+ if (!bounds) {
73
+ return {error: `Invalid label: ${params.label}`};
74
+ }
75
+
76
+ const formatter = conversationContext.createFormatter();
77
+ const summary = await formatter.formatMainThreadTrackSummary(bounds);
78
+ if (summary.length > MAX_FUNCTION_RESULT_BYTE_LENGTH) {
79
+ return {
80
+ error:
81
+ 'getTraceMainThreadSummary response is too large. Try investigating using other functions, or a more narrow bounds',
82
+ };
83
+ }
84
+
85
+ return {
86
+ result: summary,
87
+ widgets: [
88
+ {
89
+ name: 'TIMELINE_RANGE_SUMMARY',
90
+ data: {
91
+ parsedTrace: focus.parsedTrace,
92
+ bounds,
93
+ track: 'main',
94
+ },
95
+ },
96
+ {
97
+ name: 'BOTTOM_UP_TREE',
98
+ data: {
99
+ bounds,
100
+ parsedTrace: focus.parsedTrace,
101
+ },
102
+ },
103
+ ],
104
+ };
105
+ }
106
+ }
@@ -0,0 +1,104 @@
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 Host from '../../../core/host/host.js';
6
+ import * as i18n from '../../../core/i18n/i18n.js';
7
+ import {PerformanceTraceContext} from '../contexts/PerformanceTraceContext.js';
8
+
9
+ import {
10
+ type BaseToolCapability,
11
+ type DataHandlerResult,
12
+ type DataTool,
13
+ MAX_FUNCTION_RESULT_BYTE_LENGTH,
14
+ type ToolArgs,
15
+ ToolName,
16
+ } from './Tool.js';
17
+
18
+ const UIStringsNotTranslate = {
19
+ networkActivitySummary: 'Network activity summary',
20
+ } as const;
21
+
22
+ const lockedString = i18n.i18n.lockedString;
23
+
24
+ export interface GetTraceNetworkSummaryArgs extends ToolArgs {
25
+ min?: number;
26
+ max?: number;
27
+ }
28
+
29
+ export class GetTraceNetworkSummaryTool implements DataTool<GetTraceNetworkSummaryArgs, string, BaseToolCapability> {
30
+ readonly name = ToolName.GET_TRACE_NETWORK_SUMMARY;
31
+ readonly description = 'Returns a summary of the network requests for the given bounds.';
32
+
33
+ readonly parameters: Host.AidaClient.FunctionObjectParam<keyof GetTraceNetworkSummaryArgs> = {
34
+ type: Host.AidaClient.ParametersTypes.OBJECT,
35
+ description: 'Arguments for looking up a network track summary.',
36
+ nullable: false,
37
+ properties: {
38
+ min: {
39
+ type: Host.AidaClient.ParametersTypes.INTEGER,
40
+ description: 'The minimum time of the bounds, in microseconds.',
41
+ nullable: true,
42
+ },
43
+ max: {
44
+ type: Host.AidaClient.ParametersTypes.INTEGER,
45
+ description: 'The maximum time of the bounds, in microseconds.',
46
+ nullable: true,
47
+ },
48
+ },
49
+ required: [],
50
+ };
51
+
52
+ displayInfoFromArgs(params: GetTraceNetworkSummaryArgs): {
53
+ title: string,
54
+ action: string,
55
+ } {
56
+ const parts = [];
57
+ if (params.min !== undefined) {
58
+ parts.push(`min: ${params.min}`);
59
+ }
60
+ if (params.max !== undefined) {
61
+ parts.push(`max: ${params.max}`);
62
+ }
63
+ return {
64
+ title: lockedString(UIStringsNotTranslate.networkActivitySummary),
65
+ action: `getTraceNetworkSummary({${parts.join(', ')}})`,
66
+ };
67
+ }
68
+
69
+ async handler(
70
+ params: GetTraceNetworkSummaryArgs,
71
+ capabilities: BaseToolCapability,
72
+ ): Promise<DataHandlerResult<string>> {
73
+ const conversationContext = capabilities.conversationContext;
74
+ if (!conversationContext || !(conversationContext instanceof PerformanceTraceContext)) {
75
+ return {error: 'Performance trace context is not available.'};
76
+ }
77
+
78
+ const focus = conversationContext.getItem();
79
+ const bounds = conversationContext.createBounds(params.min, params.max);
80
+ if (!bounds) {
81
+ return {error: 'Invalid bounds.'};
82
+ }
83
+
84
+ const formatter = conversationContext.createFormatter();
85
+ const summary = formatter.formatNetworkTrackSummary(bounds);
86
+ if (summary.length > MAX_FUNCTION_RESULT_BYTE_LENGTH) {
87
+ return {
88
+ error:
89
+ 'getTraceNetworkSummary response is too large. Try investigating using other functions, or a more narrow bounds',
90
+ };
91
+ }
92
+
93
+ return {
94
+ result: summary,
95
+ widgets: [{
96
+ name: 'NETWORK_TRACK',
97
+ data: {
98
+ parsedTrace: focus.parsedTrace,
99
+ bounds,
100
+ },
101
+ }],
102
+ };
103
+ }
104
+ }
@@ -0,0 +1,81 @@
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 i18n from '../../../core/i18n/i18n.js';
8
+ import * as SDK from '../../../core/sdk/sdk.js';
9
+ import {areOriginsEquivalent, isOpaqueOrigin} from '../AiOrigins.js';
10
+ import {isSamePageOrigin} from '../contexts/StorageContext.js';
11
+
12
+ import {
13
+ type BaseToolCapability,
14
+ type DataHandlerResult,
15
+ type DataTool,
16
+ type OriginLockCapability,
17
+ ToolName,
18
+ } from './Tool.js';
19
+
20
+ const lockedString = i18n.i18n.lockedString;
21
+
22
+ export class ListPageOriginsTool implements
23
+ DataTool<Record<string, never>, {origins: string[]}, BaseToolCapability&OriginLockCapability> {
24
+ readonly name = ToolName.LIST_PAGE_ORIGINS;
25
+ readonly description =
26
+ 'Lists all active, non-empty frame origins loaded by the page. Use this first when generic category context is active to discover all page origins, then pass them to listCookies or listStorageKeys, unless the user\'s explicit request hints at focusing only on the primary page.';
27
+
28
+ readonly parameters: Host.AidaClient.FunctionObjectParam<never> = {
29
+ type: Host.AidaClient.ParametersTypes.OBJECT,
30
+ description: '',
31
+ nullable: false,
32
+ properties: {},
33
+ required: [],
34
+ };
35
+
36
+ displayInfoFromArgs(): {
37
+ title: string,
38
+ action: string,
39
+ } {
40
+ return {
41
+ title: lockedString('Listing page origins'),
42
+ action: 'listPageOrigins()',
43
+ };
44
+ }
45
+
46
+ async handler(
47
+ _args: Record<string, never>,
48
+ context: BaseToolCapability&OriginLockCapability,
49
+ ): Promise<DataHandlerResult<{origins: string[]}>> {
50
+ // eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
51
+ const targetManager = SDK.TargetManager.TargetManager.instance();
52
+ const primaryPageTarget = targetManager.primaryPageTarget();
53
+
54
+ const allowedOrigin = context.getEstablishedOrigin();
55
+ if (!allowedOrigin || isOpaqueOrigin(allowedOrigin)) {
56
+ return {error: 'No origin available or not allowed.'};
57
+ }
58
+
59
+ const pageOrigin =
60
+ primaryPageTarget ? Common.ParsedURL.ParsedURL.extractOrigin(primaryPageTarget.inspectedURL()) : '';
61
+ const isAllowed = pageOrigin !== '' && areOriginsEquivalent(pageOrigin, allowedOrigin);
62
+
63
+ if (!isAllowed) {
64
+ return {error: 'No origin available or not allowed.'};
65
+ }
66
+
67
+ const origins = new Set<string>();
68
+ for (const frame of SDK.ResourceTreeModel.ResourceTreeModel.frames(targetManager)) {
69
+ if (!isSamePageOrigin(frame.resourceTreeModel().target().outermostTarget(), allowedOrigin)) {
70
+ continue;
71
+ }
72
+ const origin = frame.securityOrigin;
73
+ if (!origin || isOpaqueOrigin(origin) || origins.has(origin)) {
74
+ continue;
75
+ }
76
+ origins.add(origin);
77
+ }
78
+
79
+ return {result: {origins: Array.from(origins)}};
80
+ }
81
+ }
@@ -0,0 +1,116 @@
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 i18n from '../../../core/i18n/i18n.js';
8
+ import * as Workspace from '../../workspace/workspace.js';
9
+ import {isOpaqueOrigin} from '../AiOrigins.js';
10
+
11
+ import {
12
+ type BaseToolCapability,
13
+ type DataHandlerResult,
14
+ type DataTool,
15
+ type OriginLockCapability,
16
+ ToolName,
17
+ } from './Tool.js';
18
+
19
+ const UIStringsNotTranslate = {
20
+ listingSources: 'Listing workspace sources',
21
+ } as const;
22
+
23
+ const lockedString = i18n.i18n.lockedString;
24
+
25
+ interface SourceSummary {
26
+ id: number;
27
+ name: string;
28
+ }
29
+
30
+ /**
31
+ * A tool that lists all network source files in the workspace.
32
+ * Each file is returned with its displayName and a unique session-based numeric ID.
33
+ */
34
+ export class ListSourcesTool implements
35
+ DataTool<Record<string, never>, {files: SourceSummary[]}, BaseToolCapability&OriginLockCapability> {
36
+ readonly name = ToolName.LIST_SOURCES;
37
+ readonly description = 'Lists all source files in the workspace with their name and a unique ID.';
38
+
39
+ static lastSourceId = 0;
40
+ static uiSourceCodeId = new WeakMap<Workspace.UISourceCode.UISourceCode, number>();
41
+
42
+ static reset(): void {
43
+ ListSourcesTool.lastSourceId = 0;
44
+ ListSourcesTool.uiSourceCodeId = new WeakMap();
45
+ }
46
+
47
+ // eslint-disable-next-line @devtools/no-instance-of-migrated-singletons
48
+ static getUISourceCodes(workspace: Workspace.Workspace.WorkspaceImpl = Workspace.Workspace.WorkspaceImpl.instance()):
49
+ Workspace.UISourceCode.UISourceCode[] {
50
+ const projects =
51
+ workspace.projects().filter(project => project.type() === Workspace.Workspace.projectTypes.Network);
52
+ const uiSourceCodes = new Map<string, Workspace.UISourceCode.UISourceCode>();
53
+
54
+ for (const project of projects) {
55
+ for (const uiSourceCode of project.uiSourceCodes()) {
56
+ if (uiSourceCode.isIgnoreListed()) {
57
+ continue;
58
+ }
59
+ const url = uiSourceCode.url();
60
+ if (!uiSourceCodes.get(url) || uiSourceCode.contentType().isFromSourceMap()) {
61
+ uiSourceCodes.set(url, uiSourceCode);
62
+ if (!ListSourcesTool.uiSourceCodeId.has(uiSourceCode)) {
63
+ ListSourcesTool.uiSourceCodeId.set(uiSourceCode, ++ListSourcesTool.lastSourceId);
64
+ }
65
+ }
66
+ }
67
+ }
68
+
69
+ return [...uiSourceCodes.values()];
70
+ }
71
+
72
+ readonly parameters: Host.AidaClient.FunctionObjectParam<never> = {
73
+ type: Host.AidaClient.ParametersTypes.OBJECT,
74
+ description: '',
75
+ nullable: true,
76
+ required: [],
77
+ properties: {},
78
+ };
79
+
80
+ displayInfoFromArgs(): {
81
+ title: string,
82
+ action: string,
83
+ } {
84
+ return {
85
+ title: lockedString(UIStringsNotTranslate.listingSources),
86
+ action: 'listSources()',
87
+ };
88
+ }
89
+
90
+ async handler(
91
+ _params: Record<string, never>,
92
+ context: BaseToolCapability&OriginLockCapability,
93
+ ): Promise<DataHandlerResult<{files: SourceSummary[]}>> {
94
+ const origin = context.getEstablishedOrigin();
95
+ if (origin && isOpaqueOrigin(origin)) {
96
+ return {
97
+ error: 'Opaque origin not allowed',
98
+ };
99
+ }
100
+
101
+ const files = ListSourcesTool.getUISourceCodes().filter(file => {
102
+ const fileUrl = file.url();
103
+ const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
104
+ return !origin || fileOrigin === origin;
105
+ });
106
+
107
+ return {
108
+ result: {
109
+ files: files.map(file => ({
110
+ id: ListSourcesTool.uiSourceCodeId.get(file) ?? 0,
111
+ name: file.fullDisplayName(),
112
+ })),
113
+ },
114
+ };
115
+ }
116
+ }