chrome-devtools-frontend 1.0.1706026 → 1.0.1709383
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.
- package/.agents/skills/code-review/SKILL.md +121 -0
- package/AUTHORS +2 -0
- package/front_end/core/common/Color.ts +6 -0
- package/front_end/core/common/VersionController.ts +0 -53
- package/front_end/core/root/Runtime.ts +0 -41
- package/front_end/core/sdk/CSSModel.ts +57 -0
- package/front_end/core/sdk/CSSPropertyParser.ts +10 -17
- package/front_end/core/sdk/DOMModel.ts +13 -6
- package/front_end/core/sdk/DebuggerModel.ts +90 -56
- package/front_end/core/sdk/NetworkRequest.ts +70 -12
- package/front_end/core/sdk/OverlayModel.ts +47 -0
- package/front_end/core/sdk/PageResourceLoader.ts +26 -6
- package/front_end/core/sdk/SourceMap.ts +37 -9
- package/front_end/core/sdk/SourceMapScopesInfo.ts +223 -86
- package/front_end/core/text_utils/ContentData.ts +18 -1
- package/front_end/core/text_utils/TextUtils.ts +1 -1
- package/front_end/entrypoints/devtools_app/devtools_app.ts +1 -0
- package/front_end/entrypoints/heap_snapshot_worker/ContextAnalyzer.ts +102 -4
- package/front_end/entrypoints/main/MainImpl.ts +2 -21
- package/front_end/generated/InspectorBackendCommands.ts +9 -2
- package/front_end/generated/SupportedCSSProperties.ts +12 -3
- package/front_end/generated/protocol-mapping.d.ts +31 -0
- package/front_end/generated/protocol-proxy-api.d.ts +32 -0
- package/front_end/generated/protocol.ts +19 -3
- package/front_end/models/ai_assistance/AiAgent2.ts +127 -2
- package/front_end/models/ai_assistance/AiConversation.ts +2 -2
- package/front_end/models/ai_assistance/AiUtils.ts +4 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +64 -13
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +2 -2
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +4 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +257 -2
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +1 -1
- package/front_end/models/ai_assistance/ai_assistance.ts +2 -2
- package/front_end/models/ai_assistance/contexts/{AccessibilityContext.snapshot.txt → LighthouseContext.snapshot.txt} +23 -2
- package/front_end/models/ai_assistance/contexts/{AccessibilityContext.ts → LighthouseContext.ts} +24 -5
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +26 -3
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +15 -16
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +8 -18
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.ts +2 -2
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +81 -103
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +202 -15
- package/front_end/models/ai_assistance/skills/Skill.ts +1 -2
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +2 -0
- package/front_end/models/ai_assistance/skills/lighthouse.md +33 -0
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +6 -0
- package/front_end/models/ai_assistance/tools/GetCookieValues.ts +3 -0
- package/front_end/models/ai_assistance/tools/GetDetailedCallTree.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetElementAccessibilityDetails.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetInsightDetails.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetLighthouseAudits.ts +8 -7
- package/front_end/models/ai_assistance/tools/GetNetworkRequestDetails.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetSourceContent.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetStorageBreakdown.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetStorageValues.ts +3 -0
- package/front_end/models/ai_assistance/tools/GetStyles.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceEventByKey.ts +3 -1
- package/front_end/models/ai_assistance/tools/GetTraceFunctionCode.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceMainThreadSummary.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceNetworkSummary.ts +2 -0
- package/front_end/models/ai_assistance/tools/GetTraceResourceContent.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListCookies.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListPageOrigins.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListSources.ts +2 -0
- package/front_end/models/ai_assistance/tools/ListStorageKeys.ts +2 -0
- package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +2 -0
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +2 -0
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +20 -12
- package/front_end/models/ai_assistance/tools/SelectTraceEventByKey.ts +2 -0
- package/front_end/models/ai_assistance/tools/Tool.ts +53 -0
- package/front_end/models/bindings/CompilerScriptMapping.ts +102 -45
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +25 -33
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +70 -49
- package/front_end/models/bindings/SourceMapStepping.ts +50 -0
- package/front_end/models/bindings/StylesSourceMapping.ts +3 -0
- package/front_end/models/bindings/bindings.ts +2 -0
- package/front_end/models/emulation/DeviceModeModel.ts +85 -62
- package/front_end/models/extensions/ExtensionEndpoint.ts +27 -6
- package/front_end/models/extensions/LanguageExtensionEndpoint.ts +106 -21
- package/front_end/models/extensions/RecorderExtensionEndpoint.ts +4 -2
- package/front_end/models/har/Importer.ts +2 -3
- package/front_end/models/javascript_metadata/NativeFunctions.ts +6 -2
- package/front_end/models/lighthouse/LighthouseReporterTypes.ts +5 -1
- package/front_end/models/persistence/NetworkPersistenceManager.ts +4 -3
- package/front_end/models/source_map_scopes/NamesResolver.ts +30 -13
- package/front_end/models/stack_trace/StackTraceImpl.ts +138 -47
- package/front_end/models/stack_trace/StackTraceModel.ts +117 -84
- package/front_end/models/stack_trace/Trie.ts +27 -0
- package/front_end/models/trace/LanternComputationData.ts +8 -0
- package/front_end/models/trace/Processor.ts +2 -1
- package/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +7 -2
- package/front_end/models/trace/lantern/graph/NetworkNode.ts +14 -0
- package/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +1 -1
- package/front_end/models/trace/lantern/simulation/ConnectionPool.ts +4 -4
- package/front_end/models/trace/lantern/simulation/Simulator.ts +6 -2
- package/front_end/models/trace/lantern/simulation/TCPConnection.ts +12 -12
- package/front_end/models/trace/lantern/types/Lantern.ts +8 -0
- package/front_end/panels/accessibility/ARIAAttributesView.ts +6 -6
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +2 -2
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +6 -9
- package/front_end/panels/accessibility/AccessibilitySidebarView.ts +83 -69
- package/front_end/panels/accessibility/AccessibilitySubPane.ts +24 -9
- package/front_end/panels/accessibility/SourceOrderView.ts +7 -3
- package/front_end/panels/accessibility/accessibilitySidebarView.css +5 -3
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +14 -12
- package/front_end/panels/ai_assistance/components/ChatInput.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +121 -13
- package/front_end/panels/ai_assistance/components/chatMessage.css +47 -0
- package/front_end/panels/application/BackgroundServiceView.ts +31 -33
- package/front_end/panels/application/IndexedDBModel.ts +8 -20
- package/front_end/panels/application/IndexedDBViews.ts +2 -6
- package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +8 -8
- package/front_end/panels/application/ServiceWorkersView.ts +44 -52
- package/front_end/panels/application/WebMCPView.ts +50 -50
- package/front_end/panels/application/serviceWorkersView.css +1 -1
- package/front_end/panels/comments/CommentsPane.ts +266 -0
- package/front_end/panels/comments/comments-meta.ts +47 -0
- package/front_end/panels/comments/comments.ts +9 -0
- package/front_end/panels/comments/commentsPane.css +206 -0
- package/front_end/panels/common/CommentThreadWidget.ts +30 -1
- package/front_end/panels/common/CommentsOverlayWidget.ts +42 -38
- package/front_end/panels/common/CommentsStatusBarPill.ts +3 -1
- package/front_end/panels/common/common-meta.ts +21 -9
- package/front_end/panels/console/ConsoleInsightTeaser.ts +25 -19
- package/front_end/panels/console/ConsoleViewMessage.ts +52 -23
- package/front_end/panels/console/ConsoleViewport.ts +1 -1
- package/front_end/panels/console/SymbolizedErrorWidget.ts +18 -9
- package/front_end/panels/console/console-meta.ts +1 -5
- package/front_end/panels/elements/CSSValueTraceView.ts +4 -4
- package/front_end/panels/elements/ComputedStyleWidget.ts +46 -42
- package/front_end/panels/elements/DOMPath.ts +11 -1
- package/front_end/panels/elements/DOMTreeContextMenu.ts +15 -0
- package/front_end/panels/elements/DOMTreeWidget.ts +237 -606
- package/front_end/panels/elements/ElementsPanel.ts +15 -16
- package/front_end/panels/elements/ElementsTreeElement.ts +24 -18
- package/front_end/panels/elements/EventListenersWidget.ts +5 -3
- package/front_end/panels/elements/InspectElementModeController.ts +6 -3
- package/front_end/panels/elements/LayoutPane.ts +3 -3
- package/front_end/panels/elements/PropertyRenderer.ts +132 -87
- package/front_end/panels/elements/StandaloneStylesContainer.ts +7 -3
- package/front_end/panels/elements/StylePropertiesSection.ts +49 -4
- package/front_end/panels/elements/StylePropertyTreeElement.ts +139 -36
- package/front_end/panels/elements/StylesContainer.ts +2 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +75 -16
- package/front_end/panels/elements/components/CSSPropertyDocsView.ts +2 -1
- package/front_end/panels/elements/elements-meta.ts +24 -75
- package/front_end/panels/emulation/DeviceModeToolbar.ts +5 -2
- package/front_end/panels/emulation/DeviceModeView.ts +5 -2
- package/front_end/panels/emulation/emulation-meta.ts +3 -8
- package/front_end/panels/layer_viewer/Layers3DView.ts +8 -3
- package/front_end/panels/layer_viewer/layer_viewer-meta.ts +2 -5
- package/front_end/panels/lighthouse/LighthouseController.ts +9 -4
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +13 -3
- package/front_end/panels/network/NetworkConfigView.ts +261 -190
- package/front_end/panels/network/NetworkLogView.ts +7 -5
- package/front_end/panels/network/NetworkPanel.ts +4 -3
- package/front_end/panels/network/NetworkWaterfallColumn.ts +7 -4
- package/front_end/panels/network/RequestPayloadView.ts +22 -14
- package/front_end/panels/network/network-meta.ts +23 -34
- package/front_end/panels/profiler/HeapDetachedElementsDataGrid.ts +0 -1
- package/front_end/panels/profiler/HeapProfileView.ts +20 -24
- package/front_end/panels/profiler/ProfilesPanel.ts +8 -3
- package/front_end/panels/recorder/RecordingView.ts +42 -47
- package/front_end/panels/recorder/StepEditor.ts +1 -0
- package/front_end/panels/recorder/recordingView.css +4 -4
- package/front_end/panels/screencast/ScreencastView.ts +6 -4
- package/front_end/panels/sources/CSSPlugin.ts +11 -0
- package/front_end/panels/sources/CoveragePlugin.ts +34 -23
- package/front_end/panels/sources/NavigatorView.ts +97 -52
- package/front_end/panels/sources/Plugin.ts +15 -1
- package/front_end/panels/sources/SourcesView.ts +47 -80
- package/front_end/panels/sources/TabbedEditorContainer.ts +63 -34
- package/front_end/panels/sources/UISourceCodeFrame.ts +11 -2
- package/front_end/panels/sources/navigatorTree.css +2 -2
- package/front_end/panels/timeline/TimelineHistoryManager.ts +2 -4
- package/front_end/panels/timeline/components/LiveMetricsView.ts +7 -20
- package/front_end/panels/timeline/components/MetricCard.ts +262 -315
- package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
- package/front_end/panels/timeline/components/metricCard.css +2 -24
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +33 -17
- package/front_end/panels/timeline/overlays/components/TimeRangeOverlay.ts +182 -130
- package/front_end/panels/timeline/overlays/components/timeRangeOverlay.css +76 -74
- package/front_end/panels/whats_new/WhatsNewImpl.ts +2 -1
- package/front_end/panels/whats_new/whats_new-meta.ts +2 -5
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/web-vitals/README.chromium +2 -2
- package/front_end/third_party/web-vitals/package/README.md +5 -3
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +1 -1
- package/front_end/third_party/web-vitals/package/dist/modules/attribution/onLCP.js +8 -5
- package/front_end/third_party/web-vitals/package/package.json +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +1 -1
- package/front_end/third_party/web-vitals/package/src/attribution/onLCP.ts +9 -5
- package/front_end/third_party/web-vitals/rebuild.sh +2 -2
- package/front_end/ui/comments/CommentAnchorResolver.ts +17 -0
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +10 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +2 -2
- package/front_end/ui/components/text_editor/aiCodeCompletionTeaser.css +0 -11
- package/front_end/ui/components/text_editor/aiCodeGenerationTeaser.css +0 -11
- package/front_end/ui/components/text_editor/config.ts +2 -1
- package/front_end/ui/legacy/SoftDropDown.ts +17 -4
- package/front_end/ui/legacy/StackPane.ts +141 -0
- package/front_end/ui/legacy/TabbedPane.ts +67 -12
- package/front_end/ui/legacy/TextPrompt.ts +37 -7
- package/front_end/ui/legacy/Toolbar.ts +36 -14
- package/front_end/ui/legacy/Widget.ts +3 -3
- package/front_end/ui/legacy/components/inline_editor/PositionAreaEditor.ts +85 -0
- package/front_end/ui/legacy/components/inline_editor/positionAreaEditor.css +61 -0
- package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +93 -31
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +15 -7
- package/front_end/ui/legacy/components/utils/Linkifier.ts +25 -45
- package/front_end/ui/legacy/inspectorCommon.css +11 -0
- package/front_end/ui/legacy/legacy.ts +2 -0
- package/front_end/ui/legacy/softContextMenu.css +2 -0
- package/front_end/ui/legacy/tabbedPane.css +12 -8
- package/front_end/ui/settings/ConsoleSettings.ts +7 -0
- package/front_end/ui/settings/ElementsSettings.ts +93 -0
- package/front_end/ui/settings/EmulationSettings.ts +17 -0
- package/front_end/ui/settings/LayerViewerSettings.ts +12 -0
- package/front_end/ui/settings/NetworkSettings.ts +26 -0
- package/front_end/ui/settings/WhatsNewSettings.ts +11 -0
- package/front_end/ui/settings/settings.ts +10 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +17 -0
- package/inspector_overlay/highlight_anchor.ts +1 -1
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import type * as Platform from '../../../core/platform/platform.js';
|
|
6
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
6
7
|
import type * as Protocol from '../../../generated/protocol.js';
|
|
7
8
|
import * as CrUXManager from '../../crux-manager/crux-manager.js';
|
|
8
9
|
import type * as SourceMapScopes from '../../source_map_scopes/source_map_scopes.js';
|
|
@@ -15,6 +16,105 @@ import {NetworkRequestFormatter, sanitizeHeaders} from './NetworkRequestFormatte
|
|
|
15
16
|
import {PerformanceInsightFormatter} from './PerformanceInsightFormatter.js';
|
|
16
17
|
import {bytes, micros, millis} from './UnitFormatters.js';
|
|
17
18
|
|
|
19
|
+
/**
|
|
20
|
+
* Filters response headers to the 7 standard CORS-safelisted headers for
|
|
21
|
+
* opaque cross-origin requests.
|
|
22
|
+
*
|
|
23
|
+
* Note: `NetworkRequestFormatter` (`allowHeader` / `sanitizeHeaders`) applies
|
|
24
|
+
* a second, broader allowlist to redact sensitive header values (like
|
|
25
|
+
* `set-cookie`) even on same-origin requests, but that list permits headers
|
|
26
|
+
* such as `location`, `link`, `content-security-policy`, and `x-forwarded-host`
|
|
27
|
+
* that must not be exposed for cross-origin requests.
|
|
28
|
+
*/
|
|
29
|
+
function filterToCorsSafelistedHeaders(headers: Array<{name: string, value: string}>):
|
|
30
|
+
Array<{name: string, value: string}> {
|
|
31
|
+
return headers.filter(
|
|
32
|
+
header => SDK.NetworkRequestAccess.CORS_SAFELISTED_RESPONSE_HEADERS.has(header.name.toLowerCase().trim()));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Evaluates whether a traced network request is same-origin with the trace's
|
|
37
|
+
* main frame origin across its entire redirect chain.
|
|
38
|
+
*
|
|
39
|
+
* Trace events record raw network activity from the renderer (including full
|
|
40
|
+
* redirect chains, final post-redirect URLs, and all response headers), even
|
|
41
|
+
* for cross-origin requests where the browser's Same-Origin Policy would hide
|
|
42
|
+
* those details from the page.
|
|
43
|
+
*
|
|
44
|
+
* Unlike live `SDK.NetworkRequest.NetworkRequest` objects evaluated via
|
|
45
|
+
* `SDK.NetworkRequestAccess.evaluateResponseAccessMode`, traced network
|
|
46
|
+
* requests do not record request headers/cookies (needed to determine if a
|
|
47
|
+
* request is credentialed when evaluating `Access-Control-Allow-Origin: *`),
|
|
48
|
+
* Fetch request mode (`cors` vs `no-cors`), `corsErrorStatus`, or intermediate
|
|
49
|
+
* redirect response headers. Consequently, all cross-origin traced requests
|
|
50
|
+
* are treated as opaque (restricting headers to the CORS safelist and omitting
|
|
51
|
+
* redirect chains).
|
|
52
|
+
*/
|
|
53
|
+
function isSameOriginTraceRequest(
|
|
54
|
+
request: Trace.Types.Events.SyntheticNetworkRequest,
|
|
55
|
+
parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
56
|
+
): boolean {
|
|
57
|
+
const traceUrl = parsedTrace.data?.Meta?.mainFrameURL;
|
|
58
|
+
const targetUrl = request.args.data.url;
|
|
59
|
+
if (!traceUrl || !targetUrl) {
|
|
60
|
+
return false;
|
|
61
|
+
}
|
|
62
|
+
const traceOrigin = SDK.SecurityOrigin.SecurityOrigin.create(traceUrl);
|
|
63
|
+
if (traceOrigin.isOpaque()) {
|
|
64
|
+
return false;
|
|
65
|
+
}
|
|
66
|
+
const redirects = request.args.data.redirects ?? [];
|
|
67
|
+
for (const redirect of redirects) {
|
|
68
|
+
if (!redirect.url || !traceOrigin.isSameOriginWith(SDK.SecurityOrigin.SecurityOrigin.create(redirect.url))) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return traceOrigin.isSameOriginWith(SDK.SecurityOrigin.SecurityOrigin.create(targetUrl));
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function filteredResponseHeaders(
|
|
76
|
+
request: Trace.Types.Events.SyntheticNetworkRequest,
|
|
77
|
+
parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
78
|
+
): Array<{name: string, value: string}>|null {
|
|
79
|
+
const headers = request.args.data.responseHeaders;
|
|
80
|
+
if (!headers) {
|
|
81
|
+
return headers;
|
|
82
|
+
}
|
|
83
|
+
if (isSameOriginTraceRequest(request, parsedTrace)) {
|
|
84
|
+
return headers;
|
|
85
|
+
}
|
|
86
|
+
return filterToCorsSafelistedHeaders(headers);
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function filteredRedirects(
|
|
90
|
+
request: Trace.Types.Events.SyntheticNetworkRequest,
|
|
91
|
+
parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
92
|
+
): Trace.Types.Events.SyntheticNetworkRedirect[] {
|
|
93
|
+
if (isSameOriginTraceRequest(request, parsedTrace)) {
|
|
94
|
+
return request.args.data.redirects ?? [];
|
|
95
|
+
}
|
|
96
|
+
return [];
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Returns the URL safe to expose for a traced network request.
|
|
101
|
+
*
|
|
102
|
+
* `request.args.data.url` is the final post-redirect URL. For cross-origin
|
|
103
|
+
* requests that redirected, the final URL (and any intermediate redirect hops)
|
|
104
|
+
* is hidden from the page by the Same-Origin Policy, whereas `redirects[0].url`
|
|
105
|
+
* is the initial pre-redirect URL that the page itself requested.
|
|
106
|
+
*/
|
|
107
|
+
function filteredUrl(
|
|
108
|
+
request: Trace.Types.Events.SyntheticNetworkRequest,
|
|
109
|
+
parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
110
|
+
): string {
|
|
111
|
+
const redirects = request.args.data.redirects ?? [];
|
|
112
|
+
if (redirects.length === 0 || isSameOriginTraceRequest(request, parsedTrace)) {
|
|
113
|
+
return request.args.data.url;
|
|
114
|
+
}
|
|
115
|
+
return redirects[0].url || '<redacted cross-origin redirect destination>';
|
|
116
|
+
}
|
|
117
|
+
|
|
18
118
|
export interface NetworkRequestFormatOptions {
|
|
19
119
|
verbose?: boolean;
|
|
20
120
|
customTitle?: string;
|
|
@@ -470,12 +570,36 @@ export class PerformanceTraceFormatter {
|
|
|
470
570
|
// number of related events. Mostly, insights probably don't have more than
|
|
471
571
|
// 5.
|
|
472
572
|
const eventsString =
|
|
473
|
-
events.slice(0, 5).map(e =>
|
|
573
|
+
events.slice(0, 5).map(e => this.#safeNameForEntry(e) + ' ' + this.serializeEvent(e)).join(', ');
|
|
474
574
|
results.push(`- ${insightKey}: ${eventsString}`);
|
|
475
575
|
}
|
|
476
576
|
return results.join('\n');
|
|
477
577
|
}
|
|
478
578
|
|
|
579
|
+
/**
|
|
580
|
+
* Returns the display name for a trace event, replacing the final
|
|
581
|
+
* post-redirect URL on cross-origin network requests with the initial
|
|
582
|
+
* pre-redirect URL (`filteredUrl`) before delegating to `Trace.Name.forEntry`.
|
|
583
|
+
*/
|
|
584
|
+
#safeNameForEntry(event: Trace.Types.Events.Event): string {
|
|
585
|
+
if (Trace.Types.Events.isSyntheticNetworkRequest(event)) {
|
|
586
|
+
const safeUrl = filteredUrl(event, this.#parsedTrace);
|
|
587
|
+
if (safeUrl !== event.args.data.url) {
|
|
588
|
+
return Trace.Name.forEntry({
|
|
589
|
+
...event,
|
|
590
|
+
args: {
|
|
591
|
+
...event.args,
|
|
592
|
+
data: {
|
|
593
|
+
...event.args.data,
|
|
594
|
+
url: safeUrl,
|
|
595
|
+
},
|
|
596
|
+
},
|
|
597
|
+
});
|
|
598
|
+
}
|
|
599
|
+
}
|
|
600
|
+
return Trace.Name.forEntry(event);
|
|
601
|
+
}
|
|
602
|
+
|
|
479
603
|
async formatMainThreadTrackSummary(bounds: Trace.Types.Timing.TraceWindowMicro): Promise<string> {
|
|
480
604
|
if (!this.#parsedTrace.insights) {
|
|
481
605
|
return 'No main thread activity found';
|
|
@@ -614,6 +738,10 @@ export class PerformanceTraceFormatter {
|
|
|
614
738
|
return result;
|
|
615
739
|
}
|
|
616
740
|
|
|
741
|
+
formatRequestUrl(request: Trace.Types.Events.SyntheticNetworkRequest): string {
|
|
742
|
+
return filteredUrl(request, this.#parsedTrace);
|
|
743
|
+
}
|
|
744
|
+
|
|
617
745
|
formatNetworkRequests(
|
|
618
746
|
requests: readonly Trace.Types.Events.SyntheticNetworkRequest[], options?: NetworkRequestFormatOptions): string {
|
|
619
747
|
if (requests.length === 0) {
|
|
@@ -679,22 +807,20 @@ export class PerformanceTraceFormatter {
|
|
|
679
807
|
#networkRequestVerbosely(request: Trace.Types.Events.SyntheticNetworkRequest, options?: NetworkRequestFormatOptions):
|
|
680
808
|
string {
|
|
681
809
|
const {
|
|
682
|
-
url,
|
|
683
810
|
statusCode,
|
|
684
811
|
initialPriority,
|
|
685
812
|
priority,
|
|
686
813
|
fromServiceWorker,
|
|
687
814
|
mimeType,
|
|
688
|
-
responseHeaders,
|
|
689
815
|
syntheticData,
|
|
690
816
|
protocol,
|
|
691
817
|
} = request.args.data;
|
|
692
818
|
const parsedTrace = this.#parsedTrace;
|
|
819
|
+
const url = filteredUrl(request, parsedTrace);
|
|
820
|
+
const responseHeaders = filteredResponseHeaders(request, parsedTrace);
|
|
693
821
|
|
|
694
822
|
const titlePrefix = `## ${options?.customTitle ?? 'Network request'}`;
|
|
695
823
|
|
|
696
|
-
// Note: unlike other agents, we do have the ability to include
|
|
697
|
-
// cross-origins, hence why we do not sanitize the URLs here.
|
|
698
824
|
const navigationForEvent = Trace.Helpers.Trace.getNavigationForTraceEvent(
|
|
699
825
|
request,
|
|
700
826
|
request.args.data.frame,
|
|
@@ -727,7 +853,7 @@ export class PerformanceTraceFormatter {
|
|
|
727
853
|
priorityLines.push(`Final priority: ${priority}`);
|
|
728
854
|
}
|
|
729
855
|
|
|
730
|
-
const redirects = request.
|
|
856
|
+
const redirects = filteredRedirects(request, parsedTrace).map((redirect, index) => {
|
|
731
857
|
const startTime = redirect.ts - baseTime;
|
|
732
858
|
return `#### Redirect ${index + 1}: ${redirect.url}
|
|
733
859
|
- Start time: ${micros(startTime)}
|
|
@@ -735,7 +861,7 @@ export class PerformanceTraceFormatter {
|
|
|
735
861
|
});
|
|
736
862
|
|
|
737
863
|
const initiators = this.#getInitiatorChain(parsedTrace, request);
|
|
738
|
-
const initiatorUrls = initiators.map(initiator => initiator
|
|
864
|
+
const initiatorUrls = initiators.map(initiator => filteredUrl(initiator, parsedTrace));
|
|
739
865
|
|
|
740
866
|
const eventKey = this.#eventsSerializer.keyForEvent(request);
|
|
741
867
|
const eventKeyLine = eventKey ? `eventKey: ${eventKey}\n` : '';
|
|
@@ -749,7 +875,7 @@ ${eventKeyLine}Timings:
|
|
|
749
875
|
Durations:
|
|
750
876
|
- Download time: ${micros(downloadTime)}
|
|
751
877
|
- Main thread processing time: ${micros(mainThreadProcessingDuration)}
|
|
752
|
-
- Total duration: ${micros(request.dur)}${initiator ? `\nInitiator: ${initiator
|
|
878
|
+
- Total duration: ${micros(request.dur)}${initiator ? `\nInitiator: ${filteredUrl(initiator, parsedTrace)}` : ''}
|
|
753
879
|
Redirects:${redirects.length ? '\n' + redirects.join('\n') : ' no redirects'}
|
|
754
880
|
Status code: ${statusCode}
|
|
755
881
|
MIME Type: ${mimeType}
|
|
@@ -776,7 +902,8 @@ Network requests data:
|
|
|
776
902
|
const urlIdToIndex = new Map<string, number>();
|
|
777
903
|
const allRequestsText = requests
|
|
778
904
|
.map(request => {
|
|
779
|
-
const urlIndex =
|
|
905
|
+
const urlIndex =
|
|
906
|
+
this.#getOrAssignUrlIndex(urlIdToIndex, filteredUrl(request, this.#parsedTrace));
|
|
780
907
|
return this.#networkRequestCompressedFormat(urlIndex, request, urlIdToIndex);
|
|
781
908
|
})
|
|
782
909
|
.join('\n');
|
|
@@ -867,11 +994,11 @@ The order of headers corresponds to an internal fixed list. If a header is not p
|
|
|
867
994
|
priority,
|
|
868
995
|
fromServiceWorker,
|
|
869
996
|
mimeType,
|
|
870
|
-
responseHeaders,
|
|
871
997
|
syntheticData,
|
|
872
998
|
protocol,
|
|
873
999
|
} = request.args.data;
|
|
874
1000
|
const parsedTrace = this.#parsedTrace;
|
|
1001
|
+
const responseHeaders = filteredResponseHeaders(request, parsedTrace);
|
|
875
1002
|
|
|
876
1003
|
const navigationForEvent = Trace.Helpers.Trace.getNavigationForTraceEvent(
|
|
877
1004
|
request,
|
|
@@ -895,7 +1022,7 @@ The order of headers corresponds to an internal fixed list. If a header is not p
|
|
|
895
1022
|
return `${header.name}: ${value}`;
|
|
896
1023
|
})
|
|
897
1024
|
.join('|');
|
|
898
|
-
const redirects = request
|
|
1025
|
+
const redirects = filteredRedirects(request, parsedTrace)
|
|
899
1026
|
.map(redirect => {
|
|
900
1027
|
const urlIndex = this.#getOrAssignUrlIndex(urlIdToIndex, redirect.url);
|
|
901
1028
|
const redirectStartTime = micros(redirect.ts - baseTime);
|
|
@@ -906,7 +1033,7 @@ The order of headers corresponds to an internal fixed list. If a header is not p
|
|
|
906
1033
|
|
|
907
1034
|
const initiators = this.#getInitiatorChain(parsedTrace, request);
|
|
908
1035
|
const initiatorUrlIndices =
|
|
909
|
-
initiators.map(initiator => this.#getOrAssignUrlIndex(urlIdToIndex, initiator
|
|
1036
|
+
initiators.map(initiator => this.#getOrAssignUrlIndex(urlIdToIndex, filteredUrl(initiator, parsedTrace)));
|
|
910
1037
|
|
|
911
1038
|
const parts = [
|
|
912
1039
|
urlIndex,
|
|
@@ -1037,33 +1164,93 @@ The order of headers corresponds to an internal fixed list. If a header is not p
|
|
|
1037
1164
|
}
|
|
1038
1165
|
}
|
|
1039
1166
|
|
|
1167
|
+
function sanitizeSyntheticNetworkRequestEvent(
|
|
1168
|
+
event: Trace.Types.Events.SyntheticNetworkRequest,
|
|
1169
|
+
parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
1170
|
+
): Trace.Types.Events.SyntheticNetworkRequest {
|
|
1171
|
+
const safeUrl = filteredUrl(event, parsedTrace);
|
|
1172
|
+
const headers = filteredResponseHeaders(event, parsedTrace);
|
|
1173
|
+
const sanitizedEvent: Trace.Types.Events.SyntheticNetworkRequest = {
|
|
1174
|
+
...event,
|
|
1175
|
+
args: {
|
|
1176
|
+
...event.args,
|
|
1177
|
+
data: {
|
|
1178
|
+
...event.args.data,
|
|
1179
|
+
url: safeUrl,
|
|
1180
|
+
redirects: filteredRedirects(event, parsedTrace),
|
|
1181
|
+
responseHeaders: headers ? sanitizeHeaders(headers) : null,
|
|
1182
|
+
},
|
|
1183
|
+
},
|
|
1184
|
+
};
|
|
1185
|
+
if (event.rawSourceEvent?.args?.data) {
|
|
1186
|
+
sanitizedEvent.rawSourceEvent = {
|
|
1187
|
+
...event.rawSourceEvent,
|
|
1188
|
+
args: {
|
|
1189
|
+
...event.rawSourceEvent.args,
|
|
1190
|
+
data: {
|
|
1191
|
+
...event.rawSourceEvent.args.data,
|
|
1192
|
+
url: safeUrl,
|
|
1193
|
+
},
|
|
1194
|
+
},
|
|
1195
|
+
};
|
|
1196
|
+
}
|
|
1197
|
+
return sanitizedEvent;
|
|
1198
|
+
}
|
|
1199
|
+
|
|
1040
1200
|
/**
|
|
1041
1201
|
* Serializes a trace event to a JSON string for AI consumption,
|
|
1042
1202
|
* ensuring sensitive data (like headers and raw script source code)
|
|
1043
1203
|
* is sanitized or redacted.
|
|
1044
1204
|
*/
|
|
1045
|
-
export function formatEventForAI(
|
|
1205
|
+
export function formatEventForAI(
|
|
1206
|
+
event: Trace.Types.Events.Event,
|
|
1207
|
+
parsedTrace: Trace.TraceModel.ParsedTrace,
|
|
1208
|
+
): string {
|
|
1046
1209
|
if (Trace.Types.Events.isSyntheticNetworkRequest(event)) {
|
|
1210
|
+
return JSON.stringify(sanitizeSyntheticNetworkRequestEvent(event, parsedTrace));
|
|
1211
|
+
}
|
|
1212
|
+
|
|
1213
|
+
if (Trace.Types.Events.isResourceSendRequest(event)) {
|
|
1214
|
+
const syntheticRequest =
|
|
1215
|
+
parsedTrace.data?.NetworkRequests?.byTime?.find(r => r.args.data.requestId === event.args.data.requestId);
|
|
1216
|
+
let safeUrl = '<redacted cross-origin redirect destination>';
|
|
1217
|
+
if (syntheticRequest) {
|
|
1218
|
+
safeUrl = isSameOriginTraceRequest(syntheticRequest, parsedTrace) ? event.args.data.url :
|
|
1219
|
+
filteredUrl(syntheticRequest, parsedTrace);
|
|
1220
|
+
} else {
|
|
1221
|
+
const traceUrl = parsedTrace.data?.Meta?.mainFrameURL;
|
|
1222
|
+
const traceOrigin = traceUrl ? SDK.SecurityOrigin.SecurityOrigin.create(traceUrl) : null;
|
|
1223
|
+
if (traceOrigin && !traceOrigin.isOpaque() &&
|
|
1224
|
+
traceOrigin.isSameOriginWith(SDK.SecurityOrigin.SecurityOrigin.create(event.args.data.url))) {
|
|
1225
|
+
safeUrl = event.args.data.url;
|
|
1226
|
+
}
|
|
1227
|
+
}
|
|
1047
1228
|
return JSON.stringify({
|
|
1048
1229
|
...event,
|
|
1049
1230
|
args: {
|
|
1050
1231
|
...event.args,
|
|
1051
1232
|
data: {
|
|
1052
1233
|
...event.args.data,
|
|
1053
|
-
|
|
1234
|
+
url: safeUrl,
|
|
1054
1235
|
},
|
|
1055
1236
|
},
|
|
1056
1237
|
});
|
|
1057
1238
|
}
|
|
1058
1239
|
|
|
1059
1240
|
if (Trace.Types.Events.isResourceReceiveResponse(event)) {
|
|
1241
|
+
const syntheticRequest =
|
|
1242
|
+
parsedTrace.data?.NetworkRequests?.byTime?.find(r => r.args.data.requestId === event.args.data.requestId);
|
|
1243
|
+
const isSameOrigin = Boolean(syntheticRequest && isSameOriginTraceRequest(syntheticRequest, parsedTrace));
|
|
1244
|
+
const filteredHeaders = event.args.data.headers ?
|
|
1245
|
+
(isSameOrigin ? event.args.data.headers : filterToCorsSafelistedHeaders(event.args.data.headers)) :
|
|
1246
|
+
undefined;
|
|
1060
1247
|
return JSON.stringify({
|
|
1061
1248
|
...event,
|
|
1062
1249
|
args: {
|
|
1063
1250
|
...event.args,
|
|
1064
1251
|
data: {
|
|
1065
1252
|
...event.args.data,
|
|
1066
|
-
headers:
|
|
1253
|
+
headers: filteredHeaders ? sanitizeHeaders(filteredHeaders) : undefined,
|
|
1067
1254
|
},
|
|
1068
1255
|
},
|
|
1069
1256
|
});
|
|
@@ -2,8 +2,7 @@
|
|
|
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
|
-
|
|
6
|
-
export type SkillName = 'styling'|'network'|'accessibility'|'performance'|'storage'|'sources';
|
|
5
|
+
export type SkillName = 'styling'|'network'|'accessibility'|'performance'|'storage'|'sources'|'lighthouse';
|
|
7
6
|
|
|
8
7
|
export interface Skill {
|
|
9
8
|
name: SkillName;
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import {skill as accessibilitySkill} from './accessibility.skill.js';
|
|
6
|
+
import {skill as lighthouseSkill} from './lighthouse.skill.js';
|
|
6
7
|
import {skill as networkSkill} from './network.skill.js';
|
|
7
8
|
import {skill as performanceSkill} from './performance.skill.js';
|
|
8
9
|
import type {Skill, SkillName} from './Skill.js';
|
|
@@ -17,4 +18,5 @@ export const SKILLS: Record<SkillName, Skill> = {
|
|
|
17
18
|
performance: performanceSkill,
|
|
18
19
|
storage: storageSkill,
|
|
19
20
|
sources: sourcesSkill,
|
|
21
|
+
lighthouse: lighthouseSkill,
|
|
20
22
|
};
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: lighthouse
|
|
3
|
+
description: Running Lighthouse reports and audits, full-page audits (performance, accessibility, best practices, Search Engine Optimization (SEO)), and inspecting Lighthouse scores.
|
|
4
|
+
allowed-tools:
|
|
5
|
+
- runLighthouse
|
|
6
|
+
- getLighthouseAudits
|
|
7
|
+
- resolveDevtoolsNodePath
|
|
8
|
+
---
|
|
9
|
+
You are an expert web quality and audit assistant integrated into Chrome DevTools.
|
|
10
|
+
Your role is to evaluate websites using Lighthouse audits across performance, accessibility, best practices, and SEO.
|
|
11
|
+
|
|
12
|
+
# Tools & Workflow
|
|
13
|
+
|
|
14
|
+
1. **Lighthouse Audits (`runLighthouse` & `getLighthouseAudits`)**:
|
|
15
|
+
- If an active Lighthouse report context already exists and no fresh audit is requested:
|
|
16
|
+
- To inspect the entire report or multiple categories, call `getLighthouseAudits` with `categoryId: 'all'`.
|
|
17
|
+
- For a specific category, call `getLighthouseAudits` with the corresponding category ID (e.g. `'performance'`, `'accessibility'`, `'best-practices'`, `'seo'`).
|
|
18
|
+
- If no active report exists or a fresh audit is requested, call `runLighthouse`:
|
|
19
|
+
- If the user asks for a general report or multiple categories, use `categoryId: 'all'`.
|
|
20
|
+
- For a single category, pass that category ID.
|
|
21
|
+
- Execution mode:
|
|
22
|
+
- Use `"navigation"` mode for full page-load audits (default for full site reviews).
|
|
23
|
+
- Use `"snapshot"` mode to re-evaluate live in-page DOM/CSS modifications without reloading.
|
|
24
|
+
- Use `"timespan"` mode for user interaction flows.
|
|
25
|
+
- Always honor explicit mode requests from the user.
|
|
26
|
+
|
|
27
|
+
2. **Resolving Node References (`resolveDevtoolsNodePath`)**:
|
|
28
|
+
- When an audit references failing elements by DevTools node path (e.g. `"1,HTML,1,BODY,2,BUTTON"`), use `resolveDevtoolsNodePath` to resolve the path to a `backendNodeId` to identify the failing element (or inspect it using tools from other skills if active).
|
|
29
|
+
|
|
30
|
+
# Considerations
|
|
31
|
+
|
|
32
|
+
- Base all analysis on empirical Lighthouse audit data. Never fabricate audit scores or results.
|
|
33
|
+
- When summarizing a full Lighthouse run, highlight overall category scores first, then detail failing audits (score < 90).
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../../core/common/common.js';
|
|
6
6
|
import * as Host from '../../../core/host/host.js';
|
|
7
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
8
|
import * as Root from '../../../core/root/root.js';
|
|
8
9
|
import * as Formatter from '../../formatter/formatter.js';
|
|
9
10
|
import type {FunctionHandlerOptions} from '../agents/AiAgent.js';
|
|
@@ -16,11 +17,14 @@ import {
|
|
|
16
17
|
isOriginAllowedByLock,
|
|
17
18
|
type OriginLockCapability,
|
|
18
19
|
type PageExecutionCapability,
|
|
20
|
+
PermissionPrompt,
|
|
19
21
|
type StyleMutationCapability,
|
|
20
22
|
type ToolArgs,
|
|
21
23
|
ToolName,
|
|
22
24
|
} from './Tool.js';
|
|
23
25
|
|
|
26
|
+
const lockedString = i18n.i18n.lockedString;
|
|
27
|
+
|
|
24
28
|
const MAX_FORMATTED_LINES = 40;
|
|
25
29
|
const MAX_LINE_LENGTH = 120;
|
|
26
30
|
const MAX_TOTAL_CHARACTERS = 2500;
|
|
@@ -35,6 +39,8 @@ export class ExecuteJavaScriptTool implements
|
|
|
35
39
|
DataTool<ExecuteJavaScriptArgs, unknown,
|
|
36
40
|
BaseToolCapability&PageExecutionCapability&StyleMutationCapability&OriginLockCapability> {
|
|
37
41
|
readonly name: ToolName = ToolName.EXECUTE_JAVASCRIPT;
|
|
42
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.ALLOW_ONCE;
|
|
43
|
+
readonly permissionTitle: string = lockedString('Allow running JavaScript on the page?');
|
|
38
44
|
|
|
39
45
|
readonly description: string =
|
|
40
46
|
'This function allows you to run JavaScript code on the inspected page to access the element styles and page content.\nCall this function to gather additional information or modify the page state. Call this function enough times to investigate the user request. Note: You cannot make network requests using this function.';
|
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
type DataHandlerResult,
|
|
18
18
|
type DataTool,
|
|
19
19
|
type OriginLockCapability,
|
|
20
|
+
PermissionPrompt,
|
|
20
21
|
type ServerLoggingCapability,
|
|
21
22
|
ToolAnnotation,
|
|
22
23
|
type ToolArgs,
|
|
@@ -41,6 +42,8 @@ export interface GetCookieValuesResult {
|
|
|
41
42
|
export class GetCookieValuesTool implements DataTool<GetCookieValuesArgs, GetCookieValuesResult,
|
|
42
43
|
BaseToolCapability&OriginLockCapability&ServerLoggingCapability> {
|
|
43
44
|
readonly name: ToolName = ToolName.GET_COOKIE_VALUES;
|
|
45
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.ALLOW_ONCE;
|
|
46
|
+
readonly permissionTitle: string = lockedString('Allow reading cookie values?');
|
|
44
47
|
readonly description: string =
|
|
45
48
|
'Retrieve the values and detailed metadata of specific cookies by their names across origins.';
|
|
46
49
|
|
|
@@ -12,6 +12,7 @@ import {
|
|
|
12
12
|
type DataHandlerResult,
|
|
13
13
|
type DataTool,
|
|
14
14
|
type PerformanceTraceCapability,
|
|
15
|
+
PermissionPrompt,
|
|
15
16
|
type ToolArgs,
|
|
16
17
|
ToolName,
|
|
17
18
|
} from './Tool.js';
|
|
@@ -29,6 +30,7 @@ export interface GetDetailedCallTreeArgs extends ToolArgs {
|
|
|
29
30
|
export class GetDetailedCallTreeTool implements
|
|
30
31
|
DataTool<GetDetailedCallTreeArgs, string, BaseToolCapability&PerformanceTraceCapability> {
|
|
31
32
|
readonly name: ToolName = ToolName.GET_DETAILED_CALL_TREE;
|
|
33
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
32
34
|
readonly description: string =
|
|
33
35
|
'Retrieves a bottom-up call tree and execution breakdown for a specific main thread event by its eventKey.';
|
|
34
36
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type DataTool,
|
|
14
14
|
isOriginAllowedByLock,
|
|
15
15
|
type OriginLockCapability,
|
|
16
|
+
PermissionPrompt,
|
|
16
17
|
type TargetCapability,
|
|
17
18
|
type ToolArgs,
|
|
18
19
|
ToolName,
|
|
@@ -36,6 +37,7 @@ export interface GetElementAccessibilityDetailsArgs extends ToolArgs {
|
|
|
36
37
|
export class GetElementAccessibilityDetailsTool implements
|
|
37
38
|
DataTool<GetElementAccessibilityDetailsArgs, string, BaseToolCapability&TargetCapability&OriginLockCapability> {
|
|
38
39
|
readonly name: ToolName = ToolName.GET_ELEMENT_ACCESSIBILITY_DETAILS;
|
|
40
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
39
41
|
readonly description: string =
|
|
40
42
|
'Retrieves detailed accessibility properties (computed role, accessible name, name source, ARIA attributes, ignored state) and a DOM tree snapshot for an element by backend node ID.';
|
|
41
43
|
|
|
@@ -18,6 +18,7 @@ import {
|
|
|
18
18
|
type DataTool,
|
|
19
19
|
MAX_FUNCTION_RESULT_BYTE_LENGTH,
|
|
20
20
|
type PerformanceTraceCapability,
|
|
21
|
+
PermissionPrompt,
|
|
21
22
|
type TargetCapability,
|
|
22
23
|
type ToolArgs,
|
|
23
24
|
ToolName,
|
|
@@ -56,6 +57,7 @@ export interface GetInsightDetailsArgs extends ToolArgs {
|
|
|
56
57
|
export class GetInsightDetailsTool implements
|
|
57
58
|
DataTool<GetInsightDetailsArgs, string, BaseToolCapability&TargetCapability&PerformanceTraceCapability> {
|
|
58
59
|
readonly name: ToolName = ToolName.GET_INSIGHT_DETAILS;
|
|
60
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
59
61
|
readonly description: string =
|
|
60
62
|
'Retrieves detailed metrics, subpart timing breakdowns, related DOM elements, and diagnostic data for a performance insight (e.g., \'LCPBreakdown\', \'LCPDiscovery\', \'RenderBlocking\', \'CLSCulprits\', \'INPBreakdown\', \'ThirdParties\'). Use this before commenting on any specific performance issue.';
|
|
61
63
|
|
|
@@ -3,27 +3,28 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../../core/host/host.js';
|
|
6
|
-
import type
|
|
7
|
-
import {LighthouseFormatter} from '../data_formatters/LighthouseFormatter.js';
|
|
6
|
+
import {type LighthouseCategoryArg, LighthouseFormatter} from '../data_formatters/LighthouseFormatter.js';
|
|
8
7
|
|
|
9
8
|
import {
|
|
10
9
|
type BaseToolCapability,
|
|
11
10
|
type DataHandlerResult,
|
|
12
11
|
type DataTool,
|
|
13
12
|
type LighthouseReportCapability,
|
|
13
|
+
PermissionPrompt,
|
|
14
14
|
type ToolArgs,
|
|
15
15
|
ToolName,
|
|
16
16
|
} from './Tool.js';
|
|
17
17
|
|
|
18
18
|
export interface GetLighthouseAuditsArgs extends ToolArgs {
|
|
19
|
-
categoryId:
|
|
19
|
+
categoryId: LighthouseCategoryArg;
|
|
20
20
|
}
|
|
21
21
|
|
|
22
22
|
export class GetLighthouseAuditsTool implements
|
|
23
23
|
DataTool<GetLighthouseAuditsArgs, {audits: string}, BaseToolCapability&LighthouseReportCapability> {
|
|
24
24
|
readonly name: ToolName = ToolName.GET_LIGHTHOUSE_AUDITS;
|
|
25
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
25
26
|
readonly description: string =
|
|
26
|
-
'Retrieves audit results and diagnostic details from the active Lighthouse report for a specific category (e.g., \'accessibility\').';
|
|
27
|
+
'Retrieves audit results and diagnostic details from the active Lighthouse report for all categories (using categoryId: "all") or a specific category (e.g., \'accessibility\').';
|
|
27
28
|
|
|
28
29
|
readonly parameters: Host.AidaClient.FunctionObjectParam<keyof GetLighthouseAuditsArgs> = {
|
|
29
30
|
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
@@ -32,7 +33,8 @@ export class GetLighthouseAuditsTool implements
|
|
|
32
33
|
properties: {
|
|
33
34
|
categoryId: {
|
|
34
35
|
type: Host.AidaClient.ParametersTypes.STRING,
|
|
35
|
-
description:
|
|
36
|
+
description:
|
|
37
|
+
'The category of audits to retrieve. Use "all" to retrieve the full report and all categories, or specify a category: "accessibility", "performance", "best-practices", "seo".',
|
|
36
38
|
nullable: false,
|
|
37
39
|
},
|
|
38
40
|
},
|
|
@@ -52,10 +54,9 @@ export class GetLighthouseAuditsTool implements
|
|
|
52
54
|
if (!report) {
|
|
53
55
|
return {error: 'Error: Active context is not a Lighthouse report.'};
|
|
54
56
|
}
|
|
55
|
-
const audits = new LighthouseFormatter().
|
|
57
|
+
const audits = new LighthouseFormatter().formatReport(report, params.categoryId);
|
|
56
58
|
return {
|
|
57
59
|
result: {audits},
|
|
58
|
-
widgets: [{name: 'LIGHTHOUSE_REPORT', data: {report}}],
|
|
59
60
|
};
|
|
60
61
|
}
|
|
61
62
|
}
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type DataTool,
|
|
15
15
|
isOriginAllowedByLock,
|
|
16
16
|
type OriginLockCapability,
|
|
17
|
+
PermissionPrompt,
|
|
17
18
|
resolveOriginFromLock,
|
|
18
19
|
type ToolArgs,
|
|
19
20
|
ToolName,
|
|
@@ -35,6 +36,7 @@ export interface GetNetworkRequestDetailsArgs extends ToolArgs {
|
|
|
35
36
|
export class GetNetworkRequestDetailsTool implements
|
|
36
37
|
DataTool<GetNetworkRequestDetailsArgs, unknown, BaseToolCapability&OriginLockCapability> {
|
|
37
38
|
readonly name: ToolName = ToolName.GET_NETWORK_REQUEST_DETAILS;
|
|
39
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
38
40
|
readonly description: string =
|
|
39
41
|
'Retrieves the full headers, timing, status, and body details of a specific network request by ID.';
|
|
40
42
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type DataHandlerResult,
|
|
14
14
|
type DataTool,
|
|
15
15
|
type OriginLockCapability,
|
|
16
|
+
PermissionPrompt,
|
|
16
17
|
resolveOriginFromLock,
|
|
17
18
|
type ToolArgs,
|
|
18
19
|
ToolName,
|
|
@@ -35,6 +36,7 @@ export interface GetSourceContentArgs extends ToolArgs {
|
|
|
35
36
|
export class GetSourceContentTool implements
|
|
36
37
|
DataTool<GetSourceContentArgs, {content: string}, BaseToolCapability&OriginLockCapability> {
|
|
37
38
|
readonly name: ToolName = ToolName.GET_SOURCE_CONTENT;
|
|
39
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
38
40
|
readonly description: string =
|
|
39
41
|
'Retrieves the formatted content and metadata of a source file by its numeric ID obtained from listSources.';
|
|
40
42
|
|
|
@@ -14,6 +14,7 @@ import {
|
|
|
14
14
|
type DataHandlerResult,
|
|
15
15
|
type DataTool,
|
|
16
16
|
type OriginLockCapability,
|
|
17
|
+
PermissionPrompt,
|
|
17
18
|
ToolName,
|
|
18
19
|
} from './Tool.js';
|
|
19
20
|
|
|
@@ -31,6 +32,7 @@ export interface GetStorageBreakdownResult {
|
|
|
31
32
|
export class GetStorageBreakdownTool implements
|
|
32
33
|
DataTool<Record<string, never>, GetStorageBreakdownResult, BaseToolCapability&OriginLockCapability> {
|
|
33
34
|
readonly name: ToolName = ToolName.GET_STORAGE_BREAKDOWN;
|
|
35
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
34
36
|
readonly description: string =
|
|
35
37
|
'Retrieves total storage usage and quota breakdown across all storage types (IndexedDB, CacheStorage, LocalStorage, SessionStorage, cookies) for the top-level page origin.';
|
|
36
38
|
|
|
@@ -15,6 +15,7 @@ import {
|
|
|
15
15
|
type DataHandlerResult,
|
|
16
16
|
type DataTool,
|
|
17
17
|
type OriginLockCapability,
|
|
18
|
+
PermissionPrompt,
|
|
18
19
|
type ServerLoggingCapability,
|
|
19
20
|
ToolAnnotation,
|
|
20
21
|
type ToolArgs,
|
|
@@ -46,6 +47,8 @@ export interface GetStorageValuesResult {
|
|
|
46
47
|
export class GetStorageValuesTool implements DataTool<GetStorageValuesArgs, GetStorageValuesResult,
|
|
47
48
|
BaseToolCapability&OriginLockCapability&ServerLoggingCapability> {
|
|
48
49
|
readonly name: ToolName = ToolName.GET_STORAGE_VALUES;
|
|
50
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.ALLOW_ONCE;
|
|
51
|
+
readonly permissionTitle: string = lockedString('Allow reading storage values?');
|
|
49
52
|
readonly description: string =
|
|
50
53
|
'Retrieve specific string values from storage partitions for requested keys across origins.';
|
|
51
54
|
|
|
@@ -13,6 +13,7 @@ import {
|
|
|
13
13
|
type DataTool,
|
|
14
14
|
isOriginAllowedByLock,
|
|
15
15
|
type OriginLockCapability,
|
|
16
|
+
PermissionPrompt,
|
|
16
17
|
type TargetCapability,
|
|
17
18
|
type ToolArgs,
|
|
18
19
|
ToolName,
|
|
@@ -27,6 +28,7 @@ export interface GetStylesArgs extends ToolArgs {
|
|
|
27
28
|
export class GetStylesTool implements
|
|
28
29
|
DataTool<GetStylesArgs, unknown, BaseToolCapability&TargetCapability&OriginLockCapability> {
|
|
29
30
|
readonly name: ToolName = ToolName.GET_STYLES;
|
|
31
|
+
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
30
32
|
readonly description: string =
|
|
31
33
|
`Retrieves computed and authored CSS styles for one or more elements by their backend node IDs (uids).
|
|
32
34
|
|