chrome-devtools-frontend 1.0.1711155 → 1.0.1715126
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 +16 -12
- package/AUTHORS +2 -0
- package/DIR_METADATA +32 -0
- package/eslint.config.mjs +1 -0
- package/front_end/core/sdk/CSSPropertyParserMatchers.ts +4 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +2 -2
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
- package/front_end/core/sdk/DebuggerModel.ts +19 -10
- package/front_end/core/sdk/NetworkRequest.ts +11 -11
- package/front_end/core/sdk/PageFunctions.ts +7 -2
- package/front_end/core/sdk/ResourceTreeModel.ts +17 -1
- package/front_end/core/sdk/ServerSentEventsProtocol.ts +4 -2
- package/front_end/core/sdk/SourceMap.ts +4 -3
- package/front_end/core/sdk/SourceMapScopesInfo.ts +21 -7
- package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +7 -7
- package/front_end/generated/Deprecation.ts +8 -0
- package/front_end/generated/InspectorBackendCommands.ts +3 -2
- package/front_end/generated/protocol-mapping.d.ts +10 -0
- package/front_end/generated/protocol-proxy-api.d.ts +8 -0
- package/front_end/generated/protocol.ts +15 -0
- package/front_end/models/ai_assistance/agents/AiAgent.ts +179 -13
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +7 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +11 -16
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/skills/lighthouse.md +2 -1
- package/front_end/models/ai_assistance/skills/performance.md +10 -6
- package/front_end/models/ai_assistance/tools/RecordPerformanceTrace.ts +1 -1
- package/front_end/models/ai_assistance/tools/ResolveDevtoolsNodePath.ts +12 -0
- package/front_end/models/ai_assistance/tools/RunLighthouse.ts +1 -1
- package/front_end/models/ai_assistance/tools/Tool.ts +11 -2
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +4 -0
- package/front_end/models/bindings/SourceMapStepping.ts +71 -3
- package/front_end/models/comment_manager/CommentManager.ts +8 -0
- package/front_end/models/issues_manager/Issue.ts +1 -1
- package/front_end/models/javascript_metadata/NativeFunctions.ts +28 -16
- package/front_end/models/trace/LanternComputationData.ts +3 -0
- package/front_end/models/trace/ModelImpl.ts +1 -1
- package/front_end/models/trace/Processor.ts +9 -3
- package/front_end/models/trace/extras/TraceTree.ts +1 -1
- package/front_end/models/trace/handlers/LayoutShiftsHandler.ts +1 -1
- package/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +2 -2
- package/front_end/models/trace/handlers/Threads.ts +1 -1
- package/front_end/models/trace/handlers/helpers.ts +1 -1
- package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -1
- package/front_end/models/trace/insights/CLSCulprits.ts +3 -3
- package/front_end/models/trace/insights/ImageDelivery.ts +3 -2
- package/front_end/models/trace/lantern/graph/CPUNode.ts +26 -7
- package/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +27 -2
- package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +8 -2
- package/front_end/models/trace/lantern/types/Lantern.ts +10 -0
- package/front_end/models/trace/types/File.ts +3 -3
- package/front_end/models/trace/types/TraceEvents.ts +39 -35
- package/front_end/models/workspace/IgnoreListManager.ts +38 -6
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingListView.ts +40 -8
- package/front_end/panels/accessibility/AccessibilityAnnouncementRecordingView.ts +108 -2
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +2 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +35 -5
- package/front_end/panels/ai_assistance/README.md +55 -14
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +3 -4
- package/front_end/panels/ai_assistance/components/DisabledWidget.ts +1 -1
- package/front_end/panels/ai_assistance/components/OptInChangeDialog.ts +1 -1
- package/front_end/panels/application/ResourcesPanel.ts +3 -4
- package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +3 -2
- package/front_end/panels/application/WebMCPView.ts +8 -4
- package/front_end/panels/application/components/AdsView.ts +28 -29
- package/front_end/panels/application/components/BackForwardCacheStrings.ts +188 -204
- package/front_end/panels/application/components/BackForwardCacheView.ts +33 -45
- package/front_end/panels/application/components/BounceTrackingMitigationsView.ts +10 -12
- package/front_end/panels/application/components/CrashReportContextGrid.ts +4 -4
- package/front_end/panels/application/components/EndpointsGrid.ts +3 -5
- package/front_end/panels/application/components/PermissionsPolicySection.ts +12 -15
- package/front_end/panels/application/components/ProtocolHandlersView.ts +9 -9
- package/front_end/panels/application/components/ReportsGrid.ts +7 -12
- package/front_end/panels/application/components/StorageMetadataView.ts +22 -24
- package/front_end/panels/application/components/TrustTokensView.ts +8 -10
- package/front_end/panels/application/preloading/PreloadingView.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +28 -29
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +1 -1
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +5 -2
- package/front_end/panels/browser_debugger/XHRBreakpointsSidebarPane.ts +7 -3
- package/front_end/panels/comments/CommentsPane.ts +66 -17
- package/front_end/panels/comments/commentsPane.css +12 -15
- package/front_end/panels/common/CPUThrottlingOption.ts +1 -1
- package/front_end/panels/common/CommentThreadWidget.ts +129 -18
- package/front_end/panels/common/CommentsOverlayWidget.ts +33 -9
- package/front_end/panels/common/CommentsStatusBarPill.ts +8 -39
- package/front_end/panels/console/ConsoleInsightTeaser.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -0
- package/front_end/panels/console/ConsoleViewport.ts +35 -4
- package/front_end/panels/coverage/CoverageListView.ts +2 -2
- package/front_end/panels/coverage/CoverageView.ts +2 -2
- package/front_end/panels/elements/CSSRuleValidator.ts +1 -1
- package/front_end/panels/elements/DOMTreeWidget.ts +12 -19
- package/front_end/panels/elements/ElementsPanel.ts +3 -3
- package/front_end/panels/elements/ElementsTreeElement.ts +6 -3
- package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
- package/front_end/panels/elements/components/CSSVariableValueView.ts +1 -1
- package/front_end/panels/elements/elements-meta.ts +3 -3
- package/front_end/panels/explain/components/ConsoleInsight.ts +1 -1
- package/front_end/panels/issues/AffectedSharedArrayBufferIssueDetailsView.ts +2 -3
- package/front_end/panels/linear_memory_inspector/LinearMemoryInspectorController.ts +1 -1
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +13 -17
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryViewer.ts +234 -182
- package/front_end/panels/linear_memory_inspector/components/linearMemoryInspector.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +63 -56
- package/front_end/panels/network/FetchHeaderCommenting.ts +1 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +2 -2
- package/front_end/panels/network/RequestConditionsDrawer.ts +2 -2
- package/front_end/panels/network/RequestCookiesView.ts +1 -1
- package/front_end/panels/network/RequestDeviceBoundSessionsView.ts +3 -3
- package/front_end/panels/network/RequestPreviewView.ts +2 -6
- package/front_end/panels/network/components/RequestHeaderSection.ts +1 -1
- package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
- package/front_end/panels/profiler/HeapDetachedElementsView.ts +5 -2
- package/front_end/panels/profiler/HeapSnapshotView.ts +5 -2
- package/front_end/panels/profiler/ProfilesPanel.ts +2 -6
- package/front_end/panels/protocol_monitor/JSONEditor.ts +10 -3
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +2 -1
- package/front_end/panels/recorder/RecordingView.ts +2 -2
- package/front_end/panels/recorder/StepView.ts +5 -3
- package/front_end/panels/recorder/stepView.css +4 -0
- package/front_end/panels/sensors/LocationsSettingsTab.ts +4 -9
- package/front_end/panels/sensors/SensorsView.ts +2 -2
- package/front_end/panels/sensors/sensors-meta.ts +0 -83
- package/front_end/panels/settings/AISettingsTab.ts +5 -5
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +1 -1
- package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +4 -4
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +36 -19
- package/front_end/panels/sources/BreakpointEditDialog.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +5 -2
- package/front_end/panels/sources/EditorHistory.ts +172 -0
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +4 -1
- package/front_end/panels/sources/NavigatorView.ts +9 -6
- package/front_end/panels/sources/PersistenceActions.ts +1 -1
- package/front_end/panels/sources/Plugin.ts +2 -2
- package/front_end/panels/sources/SnippetsPlugin.ts +20 -6
- package/front_end/panels/sources/SourcesPanel.ts +65 -12
- package/front_end/panels/sources/SourcesSearchScope.ts +4 -1
- package/front_end/panels/sources/SourcesView.ts +184 -183
- package/front_end/panels/sources/TabbedEditorContainer.ts +260 -419
- package/front_end/panels/sources/UISourceCodeFrame.ts +5 -5
- package/front_end/panels/sources/sources-meta.ts +32 -92
- package/front_end/panels/sources/sources.ts +2 -0
- package/front_end/panels/sources/tabbedEditorContainer.css +98 -0
- package/front_end/panels/timeline/CountersGraph.ts +18 -8
- package/front_end/panels/timeline/TimelinePanel.ts +12 -5
- package/front_end/panels/timeline/TimelineUIUtils.ts +7 -13
- package/front_end/panels/timeline/components/DetailsView.ts +4 -4
- package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +5 -8
- package/front_end/panels/timeline/overlays/OverlaysImpl.ts +8 -4
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +4 -4
- package/front_end/panels/timeline/overlays/components/TimespanBreakdownOverlay.ts +9 -0
- package/front_end/panels/timeline/timeline-meta.ts +11 -21
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/legacy-javascript/README.chromium +2 -2
- package/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +337 -161
- package/front_end/third_party/legacy-javascript/package.json +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +105 -39
- package/front_end/ui/comments/CommentOverlayManager.ts +37 -15
- package/front_end/ui/components/lists/list.css +1 -2
- package/front_end/ui/components/suggestion_input/SuggestionInput.ts +8 -5
- package/front_end/ui/components/text_editor/AiCodeCompletionDisclaimer.ts +3 -3
- package/front_end/ui/components/text_editor/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeGenerationTeaser.ts +3 -3
- package/front_end/ui/components/text_editor/AiCodeGenerationUpgradeDialog.ts +1 -1
- package/front_end/ui/components/text_editor/config.ts +29 -26
- package/front_end/ui/legacy/SearchableView.ts +118 -99
- package/front_end/ui/legacy/SplitWidget.ts +30 -11
- package/front_end/ui/legacy/StackPane.ts +1 -2
- package/front_end/ui/legacy/StackedPane.ts +1 -2
- package/front_end/ui/legacy/Toolbar.ts +2 -2
- package/front_end/ui/legacy/View.ts +5 -5
- package/front_end/ui/legacy/ViewManager.ts +8 -14
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +1 -0
- package/front_end/ui/legacy/components/perf_ui/ChartViewport.ts +4 -1
- package/front_end/ui/legacy/components/perf_ui/perf_ui-meta.ts +2 -5
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +98 -65
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +57 -24
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +123 -50
- package/front_end/ui/legacy/components/source_frame/imageView.css +27 -25
- package/front_end/ui/legacy/components/source_frame/resourceSourceFrame.css +8 -6
- package/front_end/ui/legacy/inspectorCommon.css +1 -1
- package/front_end/ui/legacy/listWidget.css +1 -6
- package/front_end/ui/legacy/tabbedPane.css +0 -91
- package/front_end/ui/settings/EmulationSettings.ts +91 -0
- package/front_end/ui/settings/SourcesSettings.ts +99 -0
- package/front_end/ui/settings/TimelineSettings.ts +28 -0
- package/front_end/ui/settings/settings.ts +2 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +3 -0
- package/package.json +1 -1
- package/front_end/panels/common/commentsStatusBarPill.css +0 -13
|
@@ -23,6 +23,65 @@ import {
|
|
|
23
23
|
type UrlString = Platform.DevToolsPath.UrlString;
|
|
24
24
|
const MAX_SUGGESTION_LENGTH = 200;
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* The types of event in the response stream that `AiConversation#run()`
|
|
28
|
+
* yields to the AI assistance panel. The same events, minus a few, are saved
|
|
29
|
+
* as the conversation history and replayed when a saved conversation opens.
|
|
30
|
+
*
|
|
31
|
+
* ## Order of events in one run
|
|
32
|
+
*
|
|
33
|
+
* ```
|
|
34
|
+
* USER_QUERY (AiConversation, first run of a query only)
|
|
35
|
+
* CONTEXT* (agent's handleContextDetails())
|
|
36
|
+
* repeated for each model request, up to MAX_STEPS:
|
|
37
|
+
* QUERYING
|
|
38
|
+
* one of:
|
|
39
|
+
* ANSWER (complete: false)*, ANSWER (complete: true) text-only reply; the run ends
|
|
40
|
+
* [ANSWER (complete: true)], <tool call events> function call, optionally with text
|
|
41
|
+
* ERROR the run ends
|
|
42
|
+
* ```
|
|
43
|
+
*
|
|
44
|
+
* An `ERROR` can also follow the tool call events, for example when the user
|
|
45
|
+
* aborts, the page navigates cross-origin, or the run reaches `MAX_STEPS`.
|
|
46
|
+
*
|
|
47
|
+
* ## Events for one tool call
|
|
48
|
+
*
|
|
49
|
+
* `AiAgent#callFunction()` yields these. All events for one call carry the
|
|
50
|
+
* same `callId`.
|
|
51
|
+
*
|
|
52
|
+
* ```
|
|
53
|
+
* TITLE?, THOUGHT? from the tool's displayInfoFromArgs()
|
|
54
|
+
* if the tool needs approval:
|
|
55
|
+
* ACTION {code} code only, shown above the approval prompt;
|
|
56
|
+
* skipped if displayInfoFromArgs() has no action
|
|
57
|
+
* SIDE_EFFECT the panel shows the prompt and calls confirm()
|
|
58
|
+
* if denied: ACTION {code, output, canceled: true}, and the call ends
|
|
59
|
+
* ACTION {code, output, widgets, toolName} result or error
|
|
60
|
+
* ```
|
|
61
|
+
*
|
|
62
|
+
* If the tool switches context instead of returning a result, there is no
|
|
63
|
+
* result `ACTION`. `AiAgent#run()` yields `CONTEXT_CHANGE` and returns, and
|
|
64
|
+
* `AiConversation` starts a new run with the agent for the new context.
|
|
65
|
+
*
|
|
66
|
+
* ## Saved history
|
|
67
|
+
*
|
|
68
|
+
* `AiConversation` saves every event except `CONTEXT_CHANGE` and partial
|
|
69
|
+
* `ANSWER`s. `AiConversation#serialize()` removes `confirm`, images and
|
|
70
|
+
* widgets, and redacts the `ACTION` output of tools annotated with
|
|
71
|
+
* `REDACT_FROM_HISTORY`. Saved data has no version field, so new fields must
|
|
72
|
+
* be optional.
|
|
73
|
+
*
|
|
74
|
+
* ## How the panel renders events
|
|
75
|
+
*
|
|
76
|
+
* `AiAssistancePanel#consumeResponseStream()` builds one chat message per
|
|
77
|
+
* `USER_QUERY` and one step per tool call:
|
|
78
|
+
* - `QUERYING` starts a new step with a spinner. The panel shows the step only
|
|
79
|
+
* if it is the first part of the message. Otherwise, the step stays hidden
|
|
80
|
+
* until a tool call fills it in.
|
|
81
|
+
* - `TITLE`, `THOUGHT`, `ACTION` and `SIDE_EFFECT` update the step for their
|
|
82
|
+
* `callId`. Events saved before `callId` existed update the current step.
|
|
83
|
+
* - `ANSWER` adds the answer text. `ERROR` sets the message error.
|
|
84
|
+
*/
|
|
26
85
|
export const enum ResponseType {
|
|
27
86
|
CONTEXT = 'context',
|
|
28
87
|
TITLE = 'title',
|
|
@@ -68,6 +127,10 @@ export interface AnswerResponse {
|
|
|
68
127
|
widgets?: AiWidget[];
|
|
69
128
|
}
|
|
70
129
|
|
|
130
|
+
/**
|
|
131
|
+
* No agent yields this event. The panel still handles it by attaching the
|
|
132
|
+
* suggestions to the last answer.
|
|
133
|
+
*/
|
|
71
134
|
export interface SuggestionsResponse {
|
|
72
135
|
type: ResponseType.SUGGESTIONS;
|
|
73
136
|
suggestions: [string, ...string[]];
|
|
@@ -83,32 +146,79 @@ export interface ContextDetail {
|
|
|
83
146
|
text: string;
|
|
84
147
|
codeLang?: string;
|
|
85
148
|
}
|
|
149
|
+
|
|
150
|
+
/**
|
|
151
|
+
* Describes the context sent with the user's query, such as the selected
|
|
152
|
+
* element. The agent's `handleContextDetails()` yields it before the first
|
|
153
|
+
* model request. The panel shows it as a completed "Analyzing data" step.
|
|
154
|
+
*/
|
|
86
155
|
export interface ContextResponse {
|
|
87
156
|
type: ResponseType.CONTEXT;
|
|
88
157
|
details: [ContextDetail, ...ContextDetail[]];
|
|
89
158
|
widgets?: AiWidget[];
|
|
90
159
|
}
|
|
91
160
|
|
|
92
|
-
|
|
161
|
+
/**
|
|
162
|
+
* Identifies the tool call that an event belongs to. `AiAgent#callFunction()`
|
|
163
|
+
* generates one per call and sets it on every event for that call. Only the
|
|
164
|
+
* UI reads it; the agent never sends it to the model.
|
|
165
|
+
*
|
|
166
|
+
* Conversations saved before this field existed do not have it. The panel
|
|
167
|
+
* applies events without a `callId` to the current step.
|
|
168
|
+
*/
|
|
169
|
+
interface ToolCallEvent {
|
|
170
|
+
callId?: string;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* The heading of a tool call's step, from `displayInfoFromArgs().title`.
|
|
175
|
+
*/
|
|
176
|
+
export interface TitleResponse extends ToolCallEvent {
|
|
93
177
|
type: ResponseType.TITLE;
|
|
94
178
|
title: string;
|
|
179
|
+
/**
|
|
180
|
+
* No agent sets this field.
|
|
181
|
+
*/
|
|
95
182
|
rpcId?: Host.AidaClient.RpcGlobalId;
|
|
96
183
|
}
|
|
97
184
|
|
|
98
|
-
|
|
185
|
+
/**
|
|
186
|
+
* Explanation text for a tool call's step, from
|
|
187
|
+
* `displayInfoFromArgs().thought`. The panel marks the step as completed when
|
|
188
|
+
* it receives a thought, even though the tool has not run yet.
|
|
189
|
+
*/
|
|
190
|
+
export interface ThoughtResponse extends ToolCallEvent {
|
|
99
191
|
type: ResponseType.THOUGHT;
|
|
100
192
|
thought: string;
|
|
193
|
+
/**
|
|
194
|
+
* No agent sets this field.
|
|
195
|
+
*/
|
|
101
196
|
rpcId?: Host.AidaClient.RpcGlobalId;
|
|
102
197
|
}
|
|
103
198
|
|
|
104
|
-
|
|
199
|
+
/**
|
|
200
|
+
* Asks the user to approve a tool call that has side effects. The agent waits
|
|
201
|
+
* until `confirm()` is called. If `displayInfoFromArgs()` returns an
|
|
202
|
+
* `action`, the agent yields it in a code-only `ACTION` just before this
|
|
203
|
+
* event.
|
|
204
|
+
*/
|
|
205
|
+
export interface SideEffectResponse extends ToolCallEvent {
|
|
105
206
|
type: ResponseType.SIDE_EFFECT;
|
|
106
207
|
description: string|null;
|
|
208
|
+
/**
|
|
209
|
+
* No agent sets this field. The code comes from the preceding `ACTION`.
|
|
210
|
+
*/
|
|
107
211
|
code?: string;
|
|
108
212
|
confirm: (decision: PermissionDecision) => void;
|
|
109
213
|
permissionPrompt?: PermissionPrompt;
|
|
110
214
|
permissionTitle?: string;
|
|
111
215
|
}
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Yielded when a tool selects a new context, for example a network request.
|
|
219
|
+
* `AiConversation` switches to the agent for that context and starts a new
|
|
220
|
+
* run. `AiConversation` does not save this event in the history.
|
|
221
|
+
*/
|
|
112
222
|
export interface ContextChangeResponse {
|
|
113
223
|
type: ResponseType.CONTEXT_CHANGE;
|
|
114
224
|
/**
|
|
@@ -123,22 +233,51 @@ export interface ContextChangeResponse {
|
|
|
123
233
|
|
|
124
234
|
interface SerializedSideEffectResponse extends Omit<SideEffectResponse, 'confirm'> {}
|
|
125
235
|
|
|
126
|
-
|
|
236
|
+
/**
|
|
237
|
+
* The code and result of a tool call. A call yields one or two:
|
|
238
|
+
* - Calls that need approval and have code first yield a code-only `ACTION`
|
|
239
|
+
* (no `output`), so the panel can show the code above the approval prompt.
|
|
240
|
+
* - Every call that runs, fails or is denied ends with an `ACTION` that has
|
|
241
|
+
* an `output`.
|
|
242
|
+
*/
|
|
243
|
+
export interface ActionResponse extends ToolCallEvent {
|
|
127
244
|
type: ResponseType.ACTION;
|
|
245
|
+
/**
|
|
246
|
+
* The text shown in the step's code box, from
|
|
247
|
+
* `displayInfoFromArgs().action`. It is real code only for tools that run
|
|
248
|
+
* code, such as `executeJavaScript`. For other tools it is a readable form of
|
|
249
|
+
* the call.
|
|
250
|
+
*/
|
|
128
251
|
code?: string;
|
|
252
|
+
/**
|
|
253
|
+
* The tool's result, error message, or the denial message. Missing on the
|
|
254
|
+
* code-only `ACTION` that precedes an approval prompt.
|
|
255
|
+
*/
|
|
129
256
|
output?: string;
|
|
257
|
+
/**
|
|
258
|
+
* True if the user denied the call, so the tool did not run.
|
|
259
|
+
*/
|
|
130
260
|
canceled: boolean;
|
|
131
261
|
widgets?: AiWidget[];
|
|
132
262
|
/**
|
|
133
|
-
* The name of the
|
|
263
|
+
* The name of the tool. Set on the result `ACTION` but not on the code-only
|
|
264
|
+
* or denied `ACTION`. `AiConversation#serialize()` uses it to redact the
|
|
265
|
+
* output of tools annotated with `REDACT_FROM_HISTORY`.
|
|
134
266
|
*/
|
|
135
267
|
toolName?: string;
|
|
136
268
|
}
|
|
137
269
|
|
|
270
|
+
/**
|
|
271
|
+
* Yielded before each model request. The panel starts a new step for it.
|
|
272
|
+
*/
|
|
138
273
|
export interface QueryingResponse {
|
|
139
274
|
type: ResponseType.QUERYING;
|
|
140
275
|
}
|
|
141
276
|
|
|
277
|
+
/**
|
|
278
|
+
* The user's query. Yielded by `AiConversation`, not by the agent, before
|
|
279
|
+
* the first run for the query. The panel starts a new chat message for it.
|
|
280
|
+
*/
|
|
142
281
|
export interface UserQuery {
|
|
143
282
|
type: ResponseType.USER_QUERY;
|
|
144
283
|
query: string;
|
|
@@ -476,7 +615,17 @@ export interface FunctionDeclaration<Args extends Record<string, unknown>, Retur
|
|
|
476
615
|
*/
|
|
477
616
|
parameters: Host.AidaClient.FunctionObjectParam<keyof Args>;
|
|
478
617
|
/**
|
|
479
|
-
*
|
|
618
|
+
* Returns the text the UI shows for a call to this function. The agent
|
|
619
|
+
* calls it before the handler runs.
|
|
620
|
+
*
|
|
621
|
+
* - `title`: the step heading, sent as `TITLE`.
|
|
622
|
+
* - `thought`: optional explanation shown in the step, sent as `THOUGHT`.
|
|
623
|
+
* - `action`: the text shown in the step's code box, sent as
|
|
624
|
+
* `ACTION.code`. It is real code only for tools that run code, such as
|
|
625
|
+
* `executeJavaScript`. For other tools it is a readable form of the call,
|
|
626
|
+
* for example `getInsightDetails('NAVIGATION_0', 'LCPBreakdown')`, and is
|
|
627
|
+
* never executed.
|
|
628
|
+
* - `suggestions`: `AiAgent` does not use this field.
|
|
480
629
|
*/
|
|
481
630
|
displayInfoFromArgs?: (
|
|
482
631
|
args: Args,
|
|
@@ -981,6 +1130,17 @@ export abstract class AiAgent<T> {
|
|
|
981
1130
|
response: {...result, widgets: undefined},
|
|
982
1131
|
},
|
|
983
1132
|
};
|
|
1133
|
+
if (i === MAX_STEPS - 1) {
|
|
1134
|
+
// Normally, the functionResponse is pushed at the start of the next
|
|
1135
|
+
// iteration. Since no further iteration will run, push it here so the
|
|
1136
|
+
// last functionCall is not left unpaired in history.
|
|
1137
|
+
this.#history.push({
|
|
1138
|
+
parts: [query],
|
|
1139
|
+
role: Host.AidaClient.Role.ROLE_UNSPECIFIED,
|
|
1140
|
+
});
|
|
1141
|
+
yield this.#createErrorResponse(ErrorType.MAX_STEPS);
|
|
1142
|
+
break;
|
|
1143
|
+
}
|
|
984
1144
|
request = this.buildRequest(query, Host.AidaClient.Role.ROLE_UNSPECIFIED);
|
|
985
1145
|
} catch (err) {
|
|
986
1146
|
if (err instanceof CrossOriginError) {
|
|
@@ -995,11 +1155,6 @@ export abstract class AiAgent<T> {
|
|
|
995
1155
|
yield this.#createErrorResponse(ErrorType.UNKNOWN);
|
|
996
1156
|
break;
|
|
997
1157
|
}
|
|
998
|
-
|
|
999
|
-
if (i === MAX_STEPS - 1) {
|
|
1000
|
-
yield this.#createErrorResponse(ErrorType.MAX_STEPS);
|
|
1001
|
-
break;
|
|
1002
|
-
}
|
|
1003
1158
|
}
|
|
1004
1159
|
|
|
1005
1160
|
if (isStructuredLogEnabled()) {
|
|
@@ -1042,6 +1197,7 @@ export abstract class AiAgent<T> {
|
|
|
1042
1197
|
role: Host.AidaClient.Role.MODEL,
|
|
1043
1198
|
});
|
|
1044
1199
|
|
|
1200
|
+
const callId = crypto.randomUUID();
|
|
1045
1201
|
let code;
|
|
1046
1202
|
if (call.displayInfoFromArgs) {
|
|
1047
1203
|
const {title, thought, action: callCode} = call.displayInfoFromArgs(args);
|
|
@@ -1049,6 +1205,7 @@ export abstract class AiAgent<T> {
|
|
|
1049
1205
|
if (title) {
|
|
1050
1206
|
yield {
|
|
1051
1207
|
type: ResponseType.TITLE,
|
|
1208
|
+
callId,
|
|
1052
1209
|
title,
|
|
1053
1210
|
};
|
|
1054
1211
|
}
|
|
@@ -1056,6 +1213,7 @@ export abstract class AiAgent<T> {
|
|
|
1056
1213
|
if (thought) {
|
|
1057
1214
|
yield {
|
|
1058
1215
|
type: ResponseType.THOUGHT,
|
|
1216
|
+
callId,
|
|
1059
1217
|
thought,
|
|
1060
1218
|
};
|
|
1061
1219
|
}
|
|
@@ -1078,6 +1236,7 @@ export abstract class AiAgent<T> {
|
|
|
1078
1236
|
if (code) {
|
|
1079
1237
|
yield {
|
|
1080
1238
|
type: ResponseType.ACTION,
|
|
1239
|
+
callId,
|
|
1081
1240
|
code,
|
|
1082
1241
|
canceled: false,
|
|
1083
1242
|
};
|
|
@@ -1104,6 +1263,7 @@ export abstract class AiAgent<T> {
|
|
|
1104
1263
|
|
|
1105
1264
|
yield {
|
|
1106
1265
|
type: ResponseType.SIDE_EFFECT,
|
|
1266
|
+
callId,
|
|
1107
1267
|
confirm: sideEffectConfirmationPromiseWithResolvers.resolve,
|
|
1108
1268
|
description: result.description,
|
|
1109
1269
|
permissionPrompt: call.permissionPrompt,
|
|
@@ -1119,6 +1279,7 @@ export abstract class AiAgent<T> {
|
|
|
1119
1279
|
if (decision === PermissionDecision.REJECT) {
|
|
1120
1280
|
yield {
|
|
1121
1281
|
type: ResponseType.ACTION,
|
|
1282
|
+
callId,
|
|
1122
1283
|
code,
|
|
1123
1284
|
output: 'Error: User denied code execution with side effects.',
|
|
1124
1285
|
canceled: true,
|
|
@@ -1152,6 +1313,7 @@ export abstract class AiAgent<T> {
|
|
|
1152
1313
|
if ('result' in result) {
|
|
1153
1314
|
yield {
|
|
1154
1315
|
type: ResponseType.ACTION,
|
|
1316
|
+
callId,
|
|
1155
1317
|
code,
|
|
1156
1318
|
output: typeof result.result === 'string' ? result.result : JSON.stringify(result.result),
|
|
1157
1319
|
widgets: result.widgets,
|
|
@@ -1163,6 +1325,7 @@ export abstract class AiAgent<T> {
|
|
|
1163
1325
|
if ('error' in result) {
|
|
1164
1326
|
yield {
|
|
1165
1327
|
type: ResponseType.ACTION,
|
|
1328
|
+
callId,
|
|
1166
1329
|
code,
|
|
1167
1330
|
output: result.error,
|
|
1168
1331
|
canceled: false,
|
|
@@ -1228,8 +1391,11 @@ export abstract class AiAgent<T> {
|
|
|
1228
1391
|
}
|
|
1229
1392
|
|
|
1230
1393
|
#createErrorResponse(error: ErrorType): ResponseData {
|
|
1231
|
-
this
|
|
1232
|
-
|
|
1394
|
+
// If we hit MAX_STEPS, we still want to keep the call history as this may be relevant for follow-up requests.
|
|
1395
|
+
if (error !== ErrorType.MAX_STEPS) {
|
|
1396
|
+
this.#removeLastRunParts();
|
|
1397
|
+
this.clearCache();
|
|
1398
|
+
}
|
|
1233
1399
|
if (error !== ErrorType.ABORT) {
|
|
1234
1400
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.AiAssistanceError);
|
|
1235
1401
|
}
|
|
@@ -150,10 +150,10 @@ Content:
|
|
|
150
150
|
"",
|
|
151
151
|
"## insight set id: NAVIGATION_1",
|
|
152
152
|
"",
|
|
153
|
-
"- name: Google CDN, main thread time:
|
|
153
|
+
"- name: Google CDN, main thread time: 43 ms, network transfer size: 990 B",
|
|
154
154
|
"- name: web.dev, main thread time: 3 ms, network transfer size: 84.3 kB",
|
|
155
155
|
"- name: Google Analytics, main thread time: 0.6 ms, network transfer size: 52.9 kB",
|
|
156
|
-
"- name: Google Fonts, main thread time: 0 ms, network transfer size: 42.2 kB",
|
|
156
|
+
"- name: Google Fonts, main thread time: 0.4 ms, network transfer size: 42.2 kB",
|
|
157
157
|
"",
|
|
158
158
|
"# Longest tasks",
|
|
159
159
|
"",
|
|
@@ -256,6 +256,10 @@ Content:
|
|
|
256
256
|
" relevant trace bounds: {min: 658799775876µs, max: 658799791419µs}",
|
|
257
257
|
" example question: Show me the most impactful render-blocking requests that I should focus on",
|
|
258
258
|
" example question: How can I reduce the number of render-blocking requests?",
|
|
259
|
+
" - insight name: ThirdParties",
|
|
260
|
+
" description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page’s content.",
|
|
261
|
+
" relevant trace bounds: {min: 658799775876µs, max: 658799789804µs}",
|
|
262
|
+
" example question: Which third parties are having the largest impact on my page performance?",
|
|
259
263
|
" - insight name: Cache",
|
|
260
264
|
" description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).",
|
|
261
265
|
" relevant trace bounds: {min: 658799777502µs, max: 658799791419µs}",
|
|
@@ -280,6 +284,7 @@ Content:
|
|
|
280
284
|
"# 3rd party summary",
|
|
281
285
|
"",
|
|
282
286
|
"- name: GitHub, main thread time: 3 ms, network transfer size: 0 B",
|
|
287
|
+
"- name: Google Fonts, main thread time: 0.6 ms, network transfer size: 0 B",
|
|
283
288
|
"",
|
|
284
289
|
"# Longest tasks",
|
|
285
290
|
"",
|
|
@@ -359,10 +359,12 @@ Content:
|
|
|
359
359
|
},
|
|
360
360
|
{
|
|
361
361
|
"type": "thought",
|
|
362
|
+
"callId": "00000000-0000-0000-0000-000000000001",
|
|
362
363
|
"thought": "I am thinking."
|
|
363
364
|
},
|
|
364
365
|
{
|
|
365
366
|
"type": "action",
|
|
367
|
+
"callId": "00000000-0000-0000-0000-000000000001",
|
|
366
368
|
"code": "console.log('hello');",
|
|
367
369
|
"output": "hello",
|
|
368
370
|
"canceled": false,
|
package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt
CHANGED
|
@@ -796,43 +796,38 @@ This insight identified legacy JavaScript in your application's modules that may
|
|
|
796
796
|
Polyfills and transforms enable older browsers to use new JavaScript features. However, many are not necessary for modern browsers. Consider modifying your JavaScript build process to not transpile Baseline features, unless you know you must support older browsers.
|
|
797
797
|
|
|
798
798
|
## Detailed analysis:
|
|
799
|
-
Total legacy JavaScript:
|
|
799
|
+
Total legacy JavaScript: 7 files.
|
|
800
800
|
|
|
801
801
|
Legacy JavaScript by file:
|
|
802
802
|
|
|
803
|
-
- Script: https://s.yimg.com/aaq/
|
|
804
|
-
Matches:
|
|
805
|
-
Line: 0, Column: 133, Name: Promise.allSettled
|
|
806
|
-
|
|
807
|
-
- Script: https://s.yimg.com/aaq/c/25fa214.caas-news_web.min.js (eventKey: s-3412, ts: 157423743431) - Wasted bytes: 36084 bytes
|
|
803
|
+
- Script: https://s.yimg.com/aaq/c/25fa214.caas-news_web.min.js (eventKey: s-3412, ts: 157423743431) - Wasted bytes: 37667 bytes
|
|
808
804
|
Matches:
|
|
809
805
|
Line: 0, Column: 13310, Name: Array.from
|
|
810
806
|
Line: 0, Column: 14623, Name: Object.assign
|
|
811
807
|
|
|
812
|
-
- Script: https://s.yimg.com/
|
|
808
|
+
- Script: https://s.yimg.com/aaq/benji/benji-2.2.99.js (eventKey: s-3387, ts: 157423742567) - Wasted bytes: 36554 bytes
|
|
809
|
+
Matches:
|
|
810
|
+
Line: 0, Column: 133, Name: Promise.allSettled
|
|
811
|
+
|
|
812
|
+
- Script: https://s.yimg.com/du/ay/wnsrvbjmeprtfrnfx.js (eventKey: s-6273, ts: 157423760794) - Wasted bytes: 12851 bytes
|
|
813
813
|
Matches:
|
|
814
814
|
Line: 111, Column: 7829, Name: @babel/plugin-transform-spread
|
|
815
815
|
Line: 111, Column: 1794, Name: Array.prototype.find
|
|
816
|
-
Line: 111, Column: 2127, Name: Array.prototype.includes
|
|
817
816
|
Line: 111, Column: 2748, Name: Object.values
|
|
818
817
|
Line: 111, Column: 2473, Name: String.prototype.includes
|
|
819
818
|
Line: 111, Column: 2627, Name: String.prototype.startsWith
|
|
820
819
|
|
|
821
|
-
- Script: https://static.criteo.net/js/ld/publishertag.prebid.144.js (eventKey: s-257378, ts: 157426026656) - Wasted bytes:
|
|
820
|
+
- Script: https://static.criteo.net/js/ld/publishertag.prebid.144.js (eventKey: s-257378, ts: 157426026656) - Wasted bytes: 10904 bytes
|
|
822
821
|
Matches:
|
|
823
822
|
Line: 1, Column: 74871, Name: Array.isArray
|
|
824
823
|
Line: 1, Column: 75344, Name: Array.prototype.filter
|
|
825
824
|
Line: 1, Column: 75013, Name: Array.prototype.indexOf
|
|
826
825
|
|
|
827
|
-
- Script: https://
|
|
828
|
-
Matches:
|
|
829
|
-
Line: 1, Column: 132267, Name: Array.prototype.includes
|
|
830
|
-
|
|
831
|
-
- Script: https://pm-widget.taboola.com/yahooweb-network/pmk-20220605.1.js (eventKey: s-52229, ts: 157424128231) - Wasted bytes: 7625 bytes
|
|
826
|
+
- Script: https://pm-widget.taboola.com/yahooweb-network/pmk-20220605.1.js (eventKey: s-52229, ts: 157424128231) - Wasted bytes: 7655 bytes
|
|
832
827
|
Matches:
|
|
833
828
|
Line: 181, Column: 26, Name: Object.keys
|
|
834
829
|
|
|
835
|
-
- Script: https://news.yahoo.com/ (eventKey: s-2116, ts: 157423489126) - Wasted bytes:
|
|
830
|
+
- Script: https://news.yahoo.com/ (eventKey: s-2116, ts: 157423489126) - Wasted bytes: 7235 bytes
|
|
836
831
|
Matches:
|
|
837
832
|
Line: 0, Column: 8382, Name: @babel/plugin-transform-classes
|
|
838
833
|
Line: 0, Column: 107712, Name: Array.prototype.filter
|
|
@@ -840,7 +835,7 @@ Line: 0, Column: 107393, Name: Array.prototype.forEach
|
|
|
840
835
|
Line: 0, Column: 108005, Name: Array.prototype.map
|
|
841
836
|
Line: 0, Column: 108358, Name: String.prototype.includes
|
|
842
837
|
|
|
843
|
-
- Script: https://cdn.taboola.com/libtrc/yahooweb-network/loader.js (eventKey: s-6352, ts: 157423761978) - Wasted bytes:
|
|
838
|
+
- Script: https://cdn.taboola.com/libtrc/yahooweb-network/loader.js (eventKey: s-6352, ts: 157423761978) - Wasted bytes: 7087 bytes
|
|
844
839
|
Matches:
|
|
845
840
|
Line: 0, Column: 390544, Name: Object.entries
|
|
846
841
|
Line: 0, Column: 390688, Name: Object.values
|
package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt
CHANGED
|
@@ -265,7 +265,7 @@ Here are all the insights that contain some related request from the given range
|
|
|
265
265
|
- ThirdParties: cmp.js (consent.cmp.oath.com) (eventKey: s-3382, ts: 157423742399), gpt.js (securepubads.g.doubleclick.net) (eventKey: s-6244, ts: 157423760529), loader.js (cdn.taboola.com) (eventKey: s-6352, ts: 157423761978)
|
|
266
266
|
- Cache: prebid-2.0.js (s.yimg.com) (eventKey: s-6279, ts: 157423760925), cmp.js (consent.cmp.oath.com) (eventKey: s-3382, ts: 157423742399), d1irmdsmbztlvx.js (s.yimg.com) (eventKey: s-6185, ts: 157423759200), consent.js (s.yimg.com) (eventKey: s-3384, ts: 157423742450), wnsrvbjmeprtfrnfx.js (s.yimg.com) (eventKey: s-6273, ts: 157423760794)
|
|
267
267
|
- CharacterSet: news.yahoo.com/ (news.yahoo.com) (eventKey: s-2116, ts: 157423489126)
|
|
268
|
-
- LegacyJavaScript:
|
|
268
|
+
- LegacyJavaScript: 25fa214.caas-news_web.min.js (s.yimg.com) (eventKey: s-3412, ts: 157423743431), benji-2.2.99.js (s.yimg.com) (eventKey: s-3387, ts: 157423742567), wnsrvbjmeprtfrnfx.js (s.yimg.com) (eventKey: s-6273, ts: 157423760794), news.yahoo.com/ (news.yahoo.com) (eventKey: s-2116, ts: 157423489126), loader.js (cdn.taboola.com) (eventKey: s-6352, ts: 157423761978)
|
|
269
269
|
=== end content
|
|
270
270
|
|
|
271
271
|
Title: PerformanceTraceFormatter formatTraceSummary web-dev.json.gz
|
|
@@ -380,7 +380,7 @@ Available insights:
|
|
|
380
380
|
description: Polyfills and transforms enable older browsers to use new JavaScript features. However, many aren’t necessary for modern browsers. Consider modifying your JavaScript build process to not transpile [Baseline](https://web.dev/articles/baseline-and-polyfills) features, unless you know you must support older browsers. [Learn why most sites can deploy ES6+ code without transpiling](https://developer.chrome.com/docs/performance/insights/legacy-javascript).
|
|
381
381
|
relevant trace bounds: {min: 157423489126µs, max: 157426132225µs}
|
|
382
382
|
estimated metric savings: FCP 0 ms, LCP 0 ms
|
|
383
|
-
estimated wasted bytes:
|
|
383
|
+
estimated wasted bytes: 120 kB
|
|
384
384
|
example question: Is my site polyfilling modern JavaScript features?
|
|
385
385
|
example question: How can I reduce the amount of legacy JavaScript on my page?
|
|
386
386
|
=== end content
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: lighthouse
|
|
3
|
-
description: Running Lighthouse reports and audits,
|
|
3
|
+
description: Running Lighthouse reports and audits when the user explicitly asks for Lighthouse, a Lighthouse score, or a multi-category audit (accessibility, best practices, Search Engine Optimization (SEO)). Not for general page performance measurement; use the performance skill for that.
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- runLighthouse
|
|
6
6
|
- getLighthouseAudits
|
|
@@ -31,4 +31,5 @@ Your role is to evaluate websites using Lighthouse audits across performance, ac
|
|
|
31
31
|
# Considerations
|
|
32
32
|
|
|
33
33
|
- Base all analysis on empirical Lighthouse audit data. Never fabricate audit scores or results.
|
|
34
|
+
- For performance-only questions (e.g. loading speed, Core Web Vitals), do not run Lighthouse unless the user mentions Lighthouse or a Lighthouse score. Record a performance trace with the performance skill instead.
|
|
34
35
|
- When summarizing a full Lighthouse run, highlight overall category scores first, then detail failing audits (score < 90).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: performance
|
|
3
|
-
description:
|
|
3
|
+
description: Default skill for any page performance question. Measuring, testing, or debugging how fast a page loads or responds, Core Web Vitals (LCP, INP, CLS), recording performance traces, and trace analysis.
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- recordPerformanceTrace
|
|
6
6
|
- getTraceEventByKey
|
|
@@ -17,24 +17,28 @@ Your goal is to provide actionable advice about web page performance by analyzin
|
|
|
17
17
|
|
|
18
18
|
# Investigation Workflow
|
|
19
19
|
|
|
20
|
-
1. **
|
|
20
|
+
1. **Trace Recording (`recordPerformanceTrace`)**:
|
|
21
|
+
- If no performance trace is in context and the user asks to measure, test, or debug page performance (e.g. loading speed, Core Web Vitals), call `recordPerformanceTrace` first.
|
|
22
|
+
- Prefer recording a trace over running Lighthouse for performance questions, unless the user explicitly asks for Lighthouse or a Lighthouse score.
|
|
23
|
+
- Use `recordPerformanceTrace` when the user requests a fresh live trace measurement.
|
|
24
|
+
|
|
25
|
+
2. **Insight Inspection (`getInsightDetails`)**:
|
|
21
26
|
- When asked about performance bottlenecks or Core Web Vitals (LCP, INP, CLS), never reply using only the initial summary.
|
|
22
27
|
- Always call `getInsightDetails` with the relevant `insightSetId` and `insightName` (e.g. `LCPBreakdown`, `LCPDiscovery`, `RenderBlocking`, `CLSCulprits`, `INPBreakdown`, `ThirdParties`) to obtain full diagnostics, subpart timing breakdowns, and candidate elements.
|
|
23
28
|
- For LCP investigations, inspect both `LCPBreakdown` and `LCPDiscovery` (TTFB, load delay, load duration, render delay).
|
|
24
29
|
|
|
25
|
-
|
|
30
|
+
3. **Main Thread & Network Inspection (`getTraceMainThreadSummary` & `getTraceNetworkSummary`)**:
|
|
26
31
|
- Call `getTraceMainThreadSummary` with specific period labels (e.g. `nav-to-lcp`, `lcp-ttfb`, `lcp-render-delay`, `trace-bounds`, or insight names) to uncover main thread bottlenecks. Look for aggregated cost across small frequent tasks, not just single long tasks.
|
|
27
32
|
- Use `getTraceNetworkSummary` with time bounds to inspect network requests during specific phases.
|
|
28
33
|
|
|
29
|
-
|
|
34
|
+
4. **Call Tree, Event & Source Inspection**:
|
|
30
35
|
- Use `getDetailedCallTree` to retrieve bottom-up execution trees for expensive main thread tasks.
|
|
31
36
|
- Use `getTraceEventByKey` to inspect timing and payload data for individual events.
|
|
32
37
|
- Use `getTraceFunctionCode` to inspect a specific function identified in the call tree, including line-by-line CPU profile execution costs.
|
|
33
38
|
- Use `getTraceResourceContent` to inspect the full text of a script or resource captured within the trace by URL.
|
|
34
39
|
|
|
35
|
-
|
|
40
|
+
5. **UI Selection**:
|
|
36
41
|
- Use `selectTraceEventByKey` to reveal and select an event in the Performance Flamechart if requested.
|
|
37
|
-
- Use `recordPerformanceTrace` when the user requests a fresh live trace measurement.
|
|
38
42
|
|
|
39
43
|
# Considerations
|
|
40
44
|
|
|
@@ -27,7 +27,7 @@ export class RecordPerformanceTraceTool implements
|
|
|
27
27
|
readonly name: ToolName = ToolName.RECORD_PERFORMANCE_TRACE;
|
|
28
28
|
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
29
29
|
readonly description: string =
|
|
30
|
-
'Reloads the page and records a new performance trace to measure, analyze, and debug page performance.';
|
|
30
|
+
'Reloads the page and records a new performance trace to measure, analyze, and debug page performance. Preferred tool for measuring page load performance and Core Web Vitals.';
|
|
31
31
|
|
|
32
32
|
readonly parameters: Host.AidaClient.FunctionObjectParam<never> = {
|
|
33
33
|
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../../core/host/host.js';
|
|
6
|
+
import * as i18n from '../../../core/i18n/i18n.js';
|
|
6
7
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
7
8
|
|
|
8
9
|
import {
|
|
@@ -116,8 +117,19 @@ export class ResolveDevtoolsNodePathTool implements DataTool<ResolveDevtoolsNode
|
|
|
116
117
|
return {error: 'Error: Node does not belong to the current origin.'};
|
|
117
118
|
}
|
|
118
119
|
|
|
120
|
+
// Take a snapshot of the resolved node's DOM structure. This is required
|
|
121
|
+
// by the DOM_TREE UI widget to render the element's local tree in the AI response panel.
|
|
122
|
+
const snapshot = await node.takeSnapshot();
|
|
119
123
|
return {
|
|
120
124
|
result: {backendNodeId: node.backendNodeId()},
|
|
125
|
+
widgets: [{
|
|
126
|
+
name: 'DOM_TREE',
|
|
127
|
+
data: {
|
|
128
|
+
root: snapshot,
|
|
129
|
+
title: i18n.i18n.lockedString('Element details'),
|
|
130
|
+
accessibleRevealLabel: i18n.i18n.lockedString('Reveal element'),
|
|
131
|
+
},
|
|
132
|
+
}],
|
|
121
133
|
};
|
|
122
134
|
}
|
|
123
135
|
}
|
|
@@ -31,7 +31,7 @@ export class RunLighthouseTool implements
|
|
|
31
31
|
readonly name: ToolName = ToolName.RUN_LIGHTHOUSE;
|
|
32
32
|
readonly permissionPrompt: PermissionPrompt = PermissionPrompt.NEVER;
|
|
33
33
|
readonly description: string =
|
|
34
|
-
'Runs Lighthouse audits on the active page. Supports "navigation" (for full initial page load audits), "snapshot" (for inspecting live in-page modifications without reload), and "timespan" (for interactions).';
|
|
34
|
+
'Runs Lighthouse audits on the active page. Supports "navigation" (for full initial page load audits), "snapshot" (for inspecting live in-page modifications without reload), and "timespan" (for interactions). Use only when the user asks for Lighthouse, a Lighthouse score, or a multi-category audit. For measuring page performance, record a performance trace instead.';
|
|
35
35
|
|
|
36
36
|
readonly parameters: Host.AidaClient.FunctionObjectParam<keyof RunLighthouseArgs> = {
|
|
37
37
|
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
@@ -331,8 +331,17 @@ export interface BaseTool<ArgsType extends ToolArgs = ToolArgs> {
|
|
|
331
331
|
*/
|
|
332
332
|
readonly parameters: Host.AidaClient.FunctionObjectParam<keyof ArgsType>;
|
|
333
333
|
/**
|
|
334
|
-
* Converts the tool arguments into
|
|
335
|
-
*
|
|
334
|
+
* Converts the tool arguments into the text the UI shows for a call to
|
|
335
|
+
* this tool. The agent calls it before the tool runs.
|
|
336
|
+
*
|
|
337
|
+
* - `title`: the step heading, sent as `TITLE`.
|
|
338
|
+
* - `thought`: optional explanation shown in the step, sent as `THOUGHT`.
|
|
339
|
+
* - `action`: the text shown in the step's code box, sent as
|
|
340
|
+
* `ACTION.code`. It is real code only for tools that run code, such as
|
|
341
|
+
* `executeJavaScript`. For other tools it is a readable form of the call,
|
|
342
|
+
* for example `getInsightDetails('NAVIGATION_0', 'LCPBreakdown')`, and is
|
|
343
|
+
* never executed.
|
|
344
|
+
* - `suggestions`: `AiAgent` does not use this field.
|
|
336
345
|
*/
|
|
337
346
|
readonly displayInfoFromArgs?: (
|
|
338
347
|
args: ArgsType,
|
|
@@ -158,6 +158,10 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
158
158
|
// Step out of an inlined function by stepping over its body.
|
|
159
159
|
return {command: SDK.DebuggerModel.StepMode.STEP_OVER, ranges};
|
|
160
160
|
}
|
|
161
|
+
if (mode === SDK.DebuggerModel.StepMode.STEP_OVER) {
|
|
162
|
+
// Enter outlined parts of the current function instead of stepping over the calls into them.
|
|
163
|
+
return {command: mode, ranges, enterRanges: SourceMapStepping.outlinedFunctionRanges(callFrames[0])};
|
|
164
|
+
}
|
|
161
165
|
return {command: mode, ranges};
|
|
162
166
|
}
|
|
163
167
|
|