chrome-devtools-frontend 1.0.1732418 → 1.0.1732697
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/docs/get_the_code.md +1 -73
- package/front_end/Tests.js +0 -5
- package/front_end/core/host/AidaClientTypes.ts +19 -2
- package/front_end/core/sdk/DOMModel.ts +8 -3
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
- package/front_end/generated/SupportedCSSProperties.ts +2 -2
- package/front_end/models/ai-utils/debug.ts +127 -22
- package/front_end/models/ai_assistance/README.md +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -5
- package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
- package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +4 -2
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +6 -0
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +2 -0
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +26 -26
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -1
- package/front_end/models/ai_code_completion/ai_code_completion.ts +11 -2
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -1
- package/front_end/models/ai_code_generation/ai_code_generation.ts +11 -2
- package/front_end/models/trace/LanternComputationData.ts +4 -0
- package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +126 -1
- package/front_end/models/trace/lantern/types/Lantern.ts +3 -0
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +32 -0
- package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
- package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
- package/front_end/panels/ai_assistance/components/chatMessage.css +3 -4
- package/front_end/panels/ai_assistance/components/exploreWidget.css +2 -2
- package/front_end/panels/application/components/reportsGrid.css +1 -1
- package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
- package/front_end/panels/application/components/trustTokensView.css +1 -1
- package/front_end/panels/application/indexedDBViews.css +0 -4
- package/front_end/panels/application/resourcesPanel.css +0 -9
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +3 -3
- package/front_end/panels/application/serviceWorkersView.css +3 -2
- package/front_end/panels/comments/CommentsPane.ts +2 -11
- package/front_end/panels/common/CommentThreadWidget.ts +11 -3
- package/front_end/panels/console/consoleContextSelector.css +1 -1
- package/front_end/panels/console/consolePinPane.css +1 -1
- package/front_end/panels/console/consolePrompt.css +4 -2
- package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
- package/front_end/panels/elements/PropertyRenderer.ts +7 -27
- package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
- package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
- package/front_end/panels/elements/metricsSidebarPane.css +2 -2
- package/front_end/panels/elements/propertiesWidget.css +0 -5
- package/front_end/panels/emulation/deviceModeView.css +3 -3
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/explain/components/consoleInsight.css +2 -2
- package/front_end/panels/issues/issuesTree.css +6 -4
- package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
- package/front_end/panels/lighthouse/lighthousePanel.css +1 -1
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
- package/front_end/panels/media/playerListView.css +8 -4
- package/front_end/panels/media/playerMessagesView.css +9 -5
- package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
- package/front_end/panels/network/networkConfigView.css +3 -3
- package/front_end/panels/network/networkLogView.css +5 -4
- package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
- package/front_end/panels/network/networkTimingTable.css +4 -4
- package/front_end/panels/network/requestPayloadView.css +1 -1
- package/front_end/panels/performance_monitor/performanceMonitor.css +1 -1
- package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
- package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
- package/front_end/panels/recorder/createRecordingView.css +2 -2
- package/front_end/panels/recorder/stepView.css +0 -7
- package/front_end/panels/recorder/timelineSection.css +1 -1
- package/front_end/panels/screencast/screencastView.css +1 -1
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/security/originView.css +1 -1
- package/front_end/panels/sources/breakpointsView.css +3 -3
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +2 -1
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
- package/front_end/panels/timeline/components/networkRequestTooltip.css +2 -2
- package/front_end/panels/timeline/components/relatedInsightChips.css +1 -1
- package/front_end/panels/timeline/timelineFlameChartView.css +4 -4
- package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -2
- package/front_end/panels/timeline/timelineMiniMap.css +2 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/buttons/button.css +0 -1
- package/front_end/ui/components/diff_view/diffView.css +1 -1
- package/front_end/ui/components/markdown_view/codeBlock.css +3 -3
- package/front_end/ui/components/markdown_view/markdownView.css +2 -2
- package/front_end/ui/components/panel_feedback/panelFeedback.css +3 -2
- package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
- package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
- package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/flameChart.css +5 -3
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +7 -4
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +0 -1
- package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +8 -25
- package/front_end/ui/legacy/progressIndicator.css +1 -2
- package/front_end/ui/legacy/reportView.css +4 -1
- package/front_end/ui/legacy/searchableView.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +7 -4
- package/front_end/ui/legacy/treeoutline.css +1 -1
- package/front_end/ui/legacy/viewContainers.css +1 -1
- package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
- package/package.json +1 -1
- package/front_end/models/ai_code_completion/debug.ts +0 -33
- package/front_end/models/ai_code_generation/debug.ts +0 -33
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../core/host/host.js';
|
|
6
6
|
import * as Root from '../../core/root/root.js';
|
|
7
|
+
import * as AiUtils from '../ai-utils/ai-utils.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const {debugCodeGenCompleteLog: debugLog} = AiUtils.Debug;
|
|
9
10
|
|
|
10
11
|
/**
|
|
11
12
|
* TODO(b/404796739): Remove these definitions of AgentOptions and RequestOptions and
|
|
@@ -2,5 +2,14 @@
|
|
|
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
|
-
|
|
5
|
+
import * as AiUtils from '../ai-utils/ai-utils.js';
|
|
6
|
+
|
|
7
|
+
import * as AiCodeCompletion from './AiCodeCompletion.js';
|
|
8
|
+
|
|
9
|
+
export function debugLog(...log: unknown[]): void {
|
|
10
|
+
AiUtils.Debug.debugCodeGenCompleteLog(...log);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
AiCodeCompletion,
|
|
15
|
+
};
|
|
@@ -4,8 +4,9 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../core/host/host.js';
|
|
6
6
|
import * as Root from '../../core/root/root.js';
|
|
7
|
+
import * as AiUtils from '../ai-utils/ai-utils.js';
|
|
7
8
|
|
|
8
|
-
|
|
9
|
+
const {debugCodeGenCompleteLog: debugLog} = AiUtils.Debug;
|
|
9
10
|
|
|
10
11
|
export const basePreamble =
|
|
11
12
|
`You are a highly skilled senior software engineer with deep expertise across multiple web technologies and programming languages, including JavaScript, TypeScript, HTML, and CSS.
|
|
@@ -2,5 +2,14 @@
|
|
|
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
|
-
|
|
5
|
+
import * as AiUtils from '../ai-utils/ai-utils.js';
|
|
6
|
+
|
|
7
|
+
import * as AiCodeGeneration from './AiCodeGeneration.js';
|
|
8
|
+
|
|
9
|
+
export function debugLog(...log: unknown[]): void {
|
|
10
|
+
AiUtils.Debug.debugCodeGenCompleteLog(...log);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export {
|
|
14
|
+
AiCodeGeneration,
|
|
15
|
+
};
|
|
@@ -39,6 +39,8 @@ function createProcessedNavigation(
|
|
|
39
39
|
return metricScore.event.ts;
|
|
40
40
|
};
|
|
41
41
|
const lcpScore = scores.get(Handlers.ModelHandlers.PageLoadMetrics.MetricName.LCP);
|
|
42
|
+
const navigationId = navigation.args.data?.navigationId;
|
|
43
|
+
const lcpRequest = navigationId ? data.LargestImagePaint?.lcpRequestByNavigationId.get(navigationId) : undefined;
|
|
42
44
|
return {
|
|
43
45
|
timestamps: {
|
|
44
46
|
firstContentfulPaint: getTimestamp(Handlers.ModelHandlers.PageLoadMetrics.MetricName.FCP),
|
|
@@ -46,6 +48,8 @@ function createProcessedNavigation(
|
|
|
46
48
|
},
|
|
47
49
|
largestContentfulPaintEvt:
|
|
48
50
|
lcpScore && Handlers.ModelHandlers.PageLoadMetrics.metricIsLCP(lcpScore) ? lcpScore.event : undefined,
|
|
51
|
+
lcpRequestId: lcpRequest?.args.data.requestId,
|
|
52
|
+
lcpImageUrl: lcpRequest?.args.data.url,
|
|
49
53
|
};
|
|
50
54
|
}
|
|
51
55
|
|
|
@@ -16,6 +16,19 @@ import {
|
|
|
16
16
|
type MetricResult,
|
|
17
17
|
} from './Metric.js';
|
|
18
18
|
|
|
19
|
+
function stripUrlHash(urlStr: string): string {
|
|
20
|
+
if (!urlStr.includes('#')) {
|
|
21
|
+
return urlStr;
|
|
22
|
+
}
|
|
23
|
+
try {
|
|
24
|
+
const url = new URL(urlStr);
|
|
25
|
+
url.hash = '';
|
|
26
|
+
return url.href;
|
|
27
|
+
} catch {
|
|
28
|
+
return urlStr;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
19
32
|
class LargestContentfulPaint extends Metric {
|
|
20
33
|
static override get coefficients(): MetricCoefficients {
|
|
21
34
|
return {
|
|
@@ -38,6 +51,80 @@ class LargestContentfulPaint extends Metric {
|
|
|
38
51
|
return !isImage || !isLowPriority;
|
|
39
52
|
}
|
|
40
53
|
|
|
54
|
+
/**
|
|
55
|
+
* Finds the NetworkNode corresponding to the LCP image in the dependency graph, if LCP was an image.
|
|
56
|
+
*/
|
|
57
|
+
static findLcpNode(dependencyGraph: Graph.Node,
|
|
58
|
+
processedNavigation: Types.Simulation.ProcessedNavigation): Graph.NetworkNode|null {
|
|
59
|
+
const lcp = processedNavigation.timestamps.largestContentfulPaint;
|
|
60
|
+
if (!lcp) {
|
|
61
|
+
return null;
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
const lcpEvent = processedNavigation.largestContentfulPaintEvt;
|
|
65
|
+
if (lcpEvent?.args?.data?.type && lcpEvent.args.data.type !== 'image') {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
const {lcpRequestId, lcpImageUrl} = processedNavigation;
|
|
70
|
+
if (!lcpRequestId && !lcpImageUrl) {
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if (lcpRequestId) {
|
|
75
|
+
const idMatches: Graph.NetworkNode[] = [];
|
|
76
|
+
dependencyGraph.traverse(node => {
|
|
77
|
+
if (node.type !== 'network' || node.request.redirectDestination) {
|
|
78
|
+
return;
|
|
79
|
+
}
|
|
80
|
+
if (node.request.finished === false || node.endTime < 0 || node.startTime > lcp) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const baseRequestId = node.request.requestId.replace(/(:redirect|:duplicate)+$/, '');
|
|
84
|
+
if (baseRequestId === lcpRequestId) {
|
|
85
|
+
idMatches.push(node);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
if (idMatches.length) {
|
|
89
|
+
idMatches.sort((a, b) => a.endTime - b.endTime);
|
|
90
|
+
return idMatches[0];
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (!lcpImageUrl) {
|
|
95
|
+
return null;
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
const normalizedLcpUrl = stripUrlHash(lcpImageUrl);
|
|
99
|
+
const lcpFrameId = lcpEvent?.args?.frame;
|
|
100
|
+
const urlMatches: Graph.NetworkNode[] = [];
|
|
101
|
+
dependencyGraph.traverse(node => {
|
|
102
|
+
if (node.type !== 'network' || node.request.redirectDestination) {
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
if (node.request.finished === false || node.endTime < 0 || node.startTime > lcp) {
|
|
106
|
+
return;
|
|
107
|
+
}
|
|
108
|
+
if (lcpFrameId && node.request.frameId && node.request.frameId !== lcpFrameId) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
if (node.request.resourceType && node.request.resourceType !== 'Image' && node.request.resourceType !== 'Media') {
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
const matchesUrl = node.request.url === lcpImageUrl || stripUrlHash(node.request.url) === normalizedLcpUrl ||
|
|
115
|
+
Boolean(node.request.redirects?.some(r => r.url === lcpImageUrl || stripUrlHash(r.url) === normalizedLcpUrl));
|
|
116
|
+
if (matchesUrl) {
|
|
117
|
+
urlMatches.push(node);
|
|
118
|
+
}
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
if (!urlMatches.length) {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
urlMatches.sort((a, b) => a.endTime - b.endTime);
|
|
125
|
+
return urlMatches[0];
|
|
126
|
+
}
|
|
127
|
+
|
|
41
128
|
static override getOptimisticGraph(
|
|
42
129
|
dependencyGraph: Graph.Node, processedNavigation: Types.Simulation.ProcessedNavigation): Graph.Node {
|
|
43
130
|
const {firstContentfulPaint: fcp, largestContentfulPaint: lcp} = processedNavigation.timestamps;
|
|
@@ -48,6 +135,40 @@ class LargestContentfulPaint extends Metric {
|
|
|
48
135
|
return FirstContentfulPaint.getOptimisticGraph(dependencyGraph, processedNavigation);
|
|
49
136
|
}
|
|
50
137
|
|
|
138
|
+
const lcpNode = LargestContentfulPaint.findLcpNode(dependencyGraph, processedNavigation);
|
|
139
|
+
if (lcpNode) {
|
|
140
|
+
const fcpOptimisticGraph = FirstContentfulPaint.getOptimisticGraph(dependencyGraph, processedNavigation);
|
|
141
|
+
const criticalNodeIds = new Set<string>();
|
|
142
|
+
fcpOptimisticGraph.traverse(node => criticalNodeIds.add(node.id));
|
|
143
|
+
criticalNodeIds.add(lcpNode.id);
|
|
144
|
+
|
|
145
|
+
// PageDependencyGraph.linkCPUNodes does not add CPUNode -> Image edges, so if the LCP image
|
|
146
|
+
// has any Script dependencies (e.g. JS-injected hero image or JS-injected stylesheet),
|
|
147
|
+
// include the CPU tasks that evaluated those scripts prior to the LCP request.
|
|
148
|
+
const initiatorScriptUrls = new Set<string>();
|
|
149
|
+
lcpNode.traverse(node => {
|
|
150
|
+
if (node.type === 'network' && node.request.resourceType === 'Script') {
|
|
151
|
+
initiatorScriptUrls.add(node.request.url);
|
|
152
|
+
}
|
|
153
|
+
}, node => node.getDependencies());
|
|
154
|
+
|
|
155
|
+
if (initiatorScriptUrls.size) {
|
|
156
|
+
dependencyGraph.traverse(node => {
|
|
157
|
+
if (node.type !== 'cpu' || node.startTime > lcpNode.startTime) {
|
|
158
|
+
return;
|
|
159
|
+
}
|
|
160
|
+
for (const url of node.getEvaluateScriptURLs()) {
|
|
161
|
+
if (initiatorScriptUrls.has(url)) {
|
|
162
|
+
criticalNodeIds.add(node.id);
|
|
163
|
+
break;
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
return dependencyGraph.cloneWithRelationships(node => criticalNodeIds.has(node.id));
|
|
170
|
+
}
|
|
171
|
+
|
|
51
172
|
return FirstContentfulPaint.getFirstPaintBasedGraph(dependencyGraph, {
|
|
52
173
|
cutoffTimestamp: lcp,
|
|
53
174
|
treatNodeAsRenderBlocking: LargestContentfulPaint.isNotLowPriorityImageNode,
|
|
@@ -72,7 +193,11 @@ class LargestContentfulPaint extends Metric {
|
|
|
72
193
|
});
|
|
73
194
|
}
|
|
74
195
|
|
|
75
|
-
static override getEstimateFromSimulation(simulationResult: Simulation.Result): Simulation.Result {
|
|
196
|
+
static override getEstimateFromSimulation(simulationResult: Simulation.Result, extras?: Extras): Simulation.Result {
|
|
197
|
+
if (extras?.optimistic) {
|
|
198
|
+
return simulationResult;
|
|
199
|
+
}
|
|
200
|
+
|
|
76
201
|
const nodeTimesNotOffscreenImages = Array.from(simulationResult.nodeTimings.entries())
|
|
77
202
|
.filter(entry => LargestContentfulPaint.isNotLowPriorityImageNode(entry[0]))
|
|
78
203
|
.map(entry => entry[1].endTime);
|
|
@@ -223,11 +223,14 @@ export namespace Simulation {
|
|
|
223
223
|
};
|
|
224
224
|
largestContentfulPaintEvt?: {
|
|
225
225
|
args: {
|
|
226
|
+
frame?: string,
|
|
226
227
|
data?: {
|
|
227
228
|
type?: string,
|
|
228
229
|
},
|
|
229
230
|
},
|
|
230
231
|
};
|
|
232
|
+
lcpRequestId?: string;
|
|
233
|
+
lcpImageUrl?: string;
|
|
231
234
|
}
|
|
232
235
|
|
|
233
236
|
export interface NodeTiming {
|
|
@@ -1886,6 +1886,19 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1886
1886
|
break;
|
|
1887
1887
|
}
|
|
1888
1888
|
case AiAssistanceModel.AiAgent.ResponseType.CONTEXT: {
|
|
1889
|
+
// Supersede stale context widgets of the same type (such as an older Lighthouse report)
|
|
1890
|
+
// within the current turn. Filter by widget name rather than clearing all widgets so
|
|
1891
|
+
// cross-domain context changes (such as starting on a performance trace and running
|
|
1892
|
+
// Lighthouse) preserve the earlier context's widgets.
|
|
1893
|
+
if (data.widgets?.length) {
|
|
1894
|
+
const newWidgetNames = new Set(data.widgets.map(widget => widget.name));
|
|
1895
|
+
for (const part of systemMessage.parts) {
|
|
1896
|
+
if (part.type === 'step' && part.step.contextDetails && part.step.widgets) {
|
|
1897
|
+
const remainingWidgets = part.step.widgets.filter(widget => !newWidgetNames.has(widget.name));
|
|
1898
|
+
part.step.widgets = remainingWidgets.length > 0 ? remainingWidgets : undefined;
|
|
1899
|
+
}
|
|
1900
|
+
}
|
|
1901
|
+
}
|
|
1889
1902
|
step.title = lockedString(UIStringsNotTranslate.analyzingData);
|
|
1890
1903
|
step.contextDetails = data.details;
|
|
1891
1904
|
step.widgets = data.widgets;
|
|
@@ -1924,6 +1937,8 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1924
1937
|
const approvalStep = step;
|
|
1925
1938
|
approvalStep.javascriptCode = data.javascriptCode;
|
|
1926
1939
|
const promptShownAt = performance.now();
|
|
1940
|
+
const toolNameForLogging =
|
|
1941
|
+
data.toolName !== undefined ? Platform.StringUtilities.toKebabCase(data.toolName) : undefined;
|
|
1927
1942
|
approvalStep.state = {
|
|
1928
1943
|
type: 'needs_approval',
|
|
1929
1944
|
sideEffectDialog: {
|
|
@@ -1935,6 +1950,20 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1935
1950
|
performance.now() - promptShownAt < PERMISSION_PROMPT_INPUT_PROTECTION_MS) {
|
|
1936
1951
|
return;
|
|
1937
1952
|
}
|
|
1953
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled() &&
|
|
1954
|
+
!this.#conversation?.isReadOnly) {
|
|
1955
|
+
switch (decision) {
|
|
1956
|
+
case AiAssistanceModel.Tool.PermissionDecision.REJECT:
|
|
1957
|
+
void VisualLogging.logFunctionCall('ai-permission-rejected', toolNameForLogging);
|
|
1958
|
+
break;
|
|
1959
|
+
case AiAssistanceModel.Tool.PermissionDecision.ALLOW_ONCE:
|
|
1960
|
+
void VisualLogging.logFunctionCall('ai-permission-allowed-once', toolNameForLogging);
|
|
1961
|
+
break;
|
|
1962
|
+
case AiAssistanceModel.Tool.PermissionDecision.ALLOW_ALWAYS:
|
|
1963
|
+
void VisualLogging.logFunctionCall('ai-permission-allowed-always', toolNameForLogging);
|
|
1964
|
+
break;
|
|
1965
|
+
}
|
|
1966
|
+
}
|
|
1938
1967
|
data.confirm(decision);
|
|
1939
1968
|
approvalStep.state = {type: 'completed'};
|
|
1940
1969
|
this.requestUpdate();
|
|
@@ -1942,6 +1971,9 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
1942
1971
|
},
|
|
1943
1972
|
};
|
|
1944
1973
|
commitStep();
|
|
1974
|
+
if (AiAssistanceModel.AiUtils.isNaturalLanguageInterfaceEnabled() && !this.#conversation?.isReadOnly) {
|
|
1975
|
+
void VisualLogging.logFunctionCall('ai-permission-prompt-shown', toolNameForLogging);
|
|
1976
|
+
}
|
|
1945
1977
|
break;
|
|
1946
1978
|
}
|
|
1947
1979
|
case AiAssistanceModel.AiAgent.ResponseType.ACTION: {
|
|
@@ -55,7 +55,7 @@ export function getMatchingFlavorContext(
|
|
|
55
55
|
}
|
|
56
56
|
|
|
57
57
|
export async function handleExternalAIRequest(options: ExternalAIRequestOptions): Promise<unknown[]> {
|
|
58
|
-
|
|
58
|
+
AiAssistanceModel.Debug.setDevToolsAIDebug({assistance: true});
|
|
59
59
|
localStorage.removeItem('aiAssistanceStructuredLog');
|
|
60
60
|
|
|
61
61
|
const conversationType = resolveConversationType(options.context?.type);
|
|
@@ -119,7 +119,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
119
119
|
html`<devtools-button
|
|
120
120
|
.data=${{
|
|
121
121
|
variant: Buttons.Button.Variant.OUTLINED,
|
|
122
|
-
jslogContext: '
|
|
122
|
+
jslogContext: 'ai-permission-allow-always',
|
|
123
123
|
} as Buttons.Button.ButtonData}
|
|
124
124
|
@click=${() => dialog.onAnswer(AiAssistanceModel.Tool.PermissionDecision.ALLOW_ALWAYS)}
|
|
125
125
|
>${lockedString(UIStringsNotTranslate.allowAlways)}</devtools-button>` :
|
|
@@ -131,7 +131,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
131
131
|
// clang-format off
|
|
132
132
|
return html`${repeat([step], step => step, () => html`
|
|
133
133
|
<div class="permission-prompt"
|
|
134
|
-
jslog=${VisualLogging.section('
|
|
134
|
+
jslog=${VisualLogging.section('ai-permission-prompt')}>
|
|
135
135
|
<div class="permission-prompt-header">
|
|
136
136
|
<devtools-icon name="lock"></devtools-icon>
|
|
137
137
|
<h2 class="permission-prompt-title">${title}</h2>
|
|
@@ -142,7 +142,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
142
142
|
<devtools-button
|
|
143
143
|
.data=${{
|
|
144
144
|
variant: Buttons.Button.Variant.TEXT,
|
|
145
|
-
jslogContext: '
|
|
145
|
+
jslogContext: 'ai-permission-reject',
|
|
146
146
|
} as Buttons.Button.ButtonData}
|
|
147
147
|
@click=${() => dialog.onAnswer(AiAssistanceModel.Tool.PermissionDecision.REJECT)}
|
|
148
148
|
${ref(focusOnFirstRender)}
|
|
@@ -151,7 +151,7 @@ export function renderPermissionPrompt(step: Step, disclaimerText: string): Lit.
|
|
|
151
151
|
<devtools-button
|
|
152
152
|
.data=${{
|
|
153
153
|
variant: Buttons.Button.Variant.PRIMARY,
|
|
154
|
-
jslogContext: '
|
|
154
|
+
jslogContext: 'ai-permission-allow-once',
|
|
155
155
|
} as Buttons.Button.ButtonData}
|
|
156
156
|
@click=${() => dialog.onAnswer(AiAssistanceModel.Tool.PermissionDecision.ALLOW_ONCE)}
|
|
157
157
|
>${lockedString(UIStringsNotTranslate.allowThisTime)}</devtools-button>
|
|
@@ -164,10 +164,9 @@
|
|
|
164
164
|
|
|
165
165
|
.answer-body-wrapper {
|
|
166
166
|
@container(min-width: 700px) {
|
|
167
|
-
/*
|
|
168
|
-
*
|
|
169
|
-
|
|
170
|
-
padding-left: 35px;
|
|
167
|
+
/* Indent the content to align with the walkthrough CTA
|
|
168
|
+
* (icon width + flex gap + button horizontal padding). */
|
|
169
|
+
padding-left: calc(var(--sys-size-9) + var(--sys-size-2) + var(--sys-size-6));
|
|
171
170
|
}
|
|
172
171
|
}
|
|
173
172
|
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
:host {
|
|
7
7
|
display: block;
|
|
8
8
|
white-space: normal;
|
|
9
|
-
max-width:
|
|
9
|
+
max-width: var(--sys-size-32);
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
.router-rules {
|
|
@@ -33,7 +33,7 @@
|
|
|
33
33
|
.item {
|
|
34
34
|
display: flex;
|
|
35
35
|
flex-direction: column;
|
|
36
|
-
padding-left:
|
|
36
|
+
padding-left: var(--sys-size-5);
|
|
37
37
|
}
|
|
38
38
|
|
|
39
39
|
.condition,
|
|
@@ -79,15 +79,6 @@
|
|
|
79
79
|
white-space: pre-wrap;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
.prompt-icon {
|
|
83
|
-
position: absolute;
|
|
84
|
-
display: block;
|
|
85
|
-
left: 7px;
|
|
86
|
-
top: 9px;
|
|
87
|
-
margin-top: -7px;
|
|
88
|
-
user-select: none;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
82
|
.database-query-prompt-container .prompt-icon {
|
|
92
83
|
top: var(--sys-size-4);
|
|
93
84
|
}
|
|
@@ -89,14 +89,14 @@
|
|
|
89
89
|
}
|
|
90
90
|
|
|
91
91
|
.service-worker-update-timing-bar.install {
|
|
92
|
-
|
|
93
|
-
height:
|
|
92
|
+
margin-block: auto;
|
|
93
|
+
height: var(--sys-size-5);
|
|
94
94
|
background-color: var(--sys-color-cyan-bright);
|
|
95
95
|
}
|
|
96
96
|
|
|
97
97
|
.service-worker-update-timing-table > tbody > tr > td {
|
|
98
98
|
padding: var(--sys-size-3) 0;
|
|
99
|
-
padding-right:
|
|
99
|
+
padding-right: var(--sys-size-5);
|
|
100
100
|
}
|
|
101
101
|
|
|
102
102
|
table.service-worker-update-timing-table > tbody > tr.service-worker-update-timing-table-header > td {
|
|
@@ -30,7 +30,7 @@
|
|
|
30
30
|
}
|
|
31
31
|
|
|
32
32
|
.service-worker-version:not(:last-child) {
|
|
33
|
-
margin-bottom:
|
|
33
|
+
margin-bottom: var(--sys-size-4);
|
|
34
34
|
}
|
|
35
35
|
|
|
36
36
|
.service-worker-version-string {
|
|
@@ -187,7 +187,8 @@ devtools-icon.error-icon {
|
|
|
187
187
|
.service-worker-section {
|
|
188
188
|
border-bottom: var(--sys-size-1) solid var(--sys-color-divider);
|
|
189
189
|
grid-column: 1 / 3;
|
|
190
|
-
|
|
190
|
+
/* 12px section bottom spacing (--sys-size-6) minus 1px bottom border (--sys-size-1). */
|
|
191
|
+
padding: 0 var(--sys-size-9) calc(var(--sys-size-6) - var(--sys-size-1)) var(--sys-size-9);
|
|
191
192
|
}
|
|
192
193
|
|
|
193
194
|
.service-worker-section-container {
|
|
@@ -18,7 +18,7 @@ import commentsPaneStyles from './commentsPane.css.js';
|
|
|
18
18
|
|
|
19
19
|
const {html, render, i18nTemplate, Directives: {ref, repeat}} = Lit;
|
|
20
20
|
const {widget} = UI.Widget;
|
|
21
|
-
const {computeCommentTitle} = CommonPanels.CommentThreadWidget;
|
|
21
|
+
const {computeCommentTitle, inputDisclaimer} = CommonPanels.CommentThreadWidget;
|
|
22
22
|
type Title = CommonPanels.CommentThreadWidget.Title;
|
|
23
23
|
|
|
24
24
|
const UIStrings = {
|
|
@@ -92,17 +92,8 @@ const UIStrings = {
|
|
|
92
92
|
sentComments: 'Sent comments',
|
|
93
93
|
} as const;
|
|
94
94
|
|
|
95
|
-
const UIStringsNotTranslate = {
|
|
96
|
-
/**
|
|
97
|
-
* @description Disclaimer text in the comments pane info tooltip.
|
|
98
|
-
*/
|
|
99
|
-
inputDisclaimer:
|
|
100
|
-
'Comment strings, DOM hierarchy snippets, tracked CSS and DOM changes, Visual Element (VE) paths and signatures, and tracked presenter changes are sent to the connected third-party agent to assist with debugging and code updates',
|
|
101
|
-
} as const;
|
|
102
|
-
|
|
103
95
|
const str_ = i18n.i18n.registerUIStrings('panels/comments/CommentsPane.ts', UIStrings);
|
|
104
96
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
105
|
-
const lockedString = i18n.i18n.lockedString;
|
|
106
97
|
|
|
107
98
|
export type Tab = 'queued'|'sent';
|
|
108
99
|
|
|
@@ -290,7 +281,7 @@ export const DEFAULT_VIEW: View = (input: ViewInput, output: ViewOutput, target:
|
|
|
290
281
|
variant="rich"
|
|
291
282
|
>
|
|
292
283
|
<div class="info-tooltip-container">
|
|
293
|
-
${
|
|
284
|
+
${inputDisclaimer()}
|
|
294
285
|
</div>
|
|
295
286
|
</devtools-tooltip>
|
|
296
287
|
<button
|
|
@@ -80,16 +80,24 @@ const UIStrings = {
|
|
|
80
80
|
|
|
81
81
|
const UIStringsNotTranslate = {
|
|
82
82
|
/**
|
|
83
|
-
* @description Disclaimer text in the comment thread
|
|
83
|
+
* @description Disclaimer text in the info tooltips of the comment thread and the comments pane.
|
|
84
84
|
*/
|
|
85
85
|
inputDisclaimer:
|
|
86
|
-
'
|
|
86
|
+
'Comments and content attached to comments, and DOM/CSS changes recorded in the comment mode are sent to the connected third-party agent to assist with debugging and code updates',
|
|
87
87
|
} as const;
|
|
88
88
|
|
|
89
89
|
const str_ = i18n.i18n.registerUIStrings('panels/common/CommentThreadWidget.ts', UIStrings);
|
|
90
90
|
const i18nString = i18n.i18n.getLocalizedString.bind(undefined, str_);
|
|
91
91
|
const lockedString = i18n.i18n.lockedString;
|
|
92
92
|
|
|
93
|
+
/**
|
|
94
|
+
* Returns the disclaimer about the data that is sent to the connected agent. The comment thread and the comments
|
|
95
|
+
* pane both show it in their info tooltips.
|
|
96
|
+
*/
|
|
97
|
+
export function inputDisclaimer(): string {
|
|
98
|
+
return lockedString(UIStringsNotTranslate.inputDisclaimer);
|
|
99
|
+
}
|
|
100
|
+
|
|
93
101
|
/**
|
|
94
102
|
* Either the DOM node the thread is anchored to, or a plain text label for anchors that are not
|
|
95
103
|
* DOM nodes (e.g. network requests).
|
|
@@ -250,7 +258,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
|
|
|
250
258
|
variant="rich"
|
|
251
259
|
>
|
|
252
260
|
<div class="info-tooltip-container">
|
|
253
|
-
${
|
|
261
|
+
${inputDisclaimer()}
|
|
254
262
|
</div>
|
|
255
263
|
</devtools-tooltip>
|
|
256
264
|
<devtools-button
|
|
@@ -40,8 +40,10 @@
|
|
|
40
40
|
|
|
41
41
|
.preview-result-icon {
|
|
42
42
|
position: absolute;
|
|
43
|
-
|
|
44
|
-
|
|
43
|
+
/* Offset both .console-prompt-icon's 12px (--sys-size-6) gutter offset and
|
|
44
|
+
* .console-eager-preview's 4px (--sys-size-3) left margin so both icons align. */
|
|
45
|
+
left: calc(-1 * (var(--sys-size-6) + var(--sys-size-3)));
|
|
46
|
+
top: 0;
|
|
45
47
|
}
|
|
46
48
|
|
|
47
49
|
.console-eager-inner-preview:empty,
|