chrome-devtools-frontend 1.0.1730971 → 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 +15 -0
- package/front_end/core/host/AidaClient.ts +47 -3
- package/front_end/core/host/AidaClientTypes.ts +27 -3
- package/front_end/core/host/AidaGcaTranslation.ts +1 -1
- package/front_end/core/sdk/DOMModel.ts +8 -3
- package/front_end/core/sdk/NetworkManager.ts +2 -1
- package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
- package/front_end/generated/Deprecation.ts +0 -8
- package/front_end/generated/InspectorBackendCommands.ts +2 -1
- package/front_end/generated/SupportedCSSProperties.ts +2 -2
- package/front_end/generated/protocol.ts +9 -0
- 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/agents/StylingAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
- package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +9 -2
- package/front_end/models/ai_assistance/contexts/LighthouseContext.ts +4 -3
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +97 -11
- package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +92 -43
- 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_assistance/skills/styling.md +4 -2
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +31 -36
- 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/bindings/CompilerScriptMapping.ts +0 -1
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +0 -1
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +0 -1
- package/front_end/models/har/HARFormat.ts +1 -0
- package/front_end/models/har/Importer.ts +7 -1
- package/front_end/models/har/Log.snapshot.txt +2 -0
- package/front_end/models/har/Log.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.ts +0 -4
- 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 +33 -1
- package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
- package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
- package/front_end/panels/ai_assistance/components/chatInput.css +1 -1
- package/front_end/panels/ai_assistance/components/chatMessage.css +3 -4
- package/front_end/panels/ai_assistance/components/exploreWidget.css +3 -3
- package/front_end/panels/animation/animationTimeline.css +11 -9
- package/front_end/panels/application/IndexedDBViews.ts +2 -2
- package/front_end/panels/application/PrivateVerificationTokensView.ts +217 -9
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
- package/front_end/panels/application/ServiceWorkersView.ts +1 -1
- package/front_end/panels/application/StorageView.ts +1 -1
- package/front_end/panels/application/appManifestView.css +0 -6
- package/front_end/panels/application/backgroundServiceView.css +0 -21
- package/front_end/panels/application/components/backForwardCacheView.css +1 -9
- package/front_end/panels/application/components/endpointsGrid.css +1 -1
- package/front_end/panels/application/components/permissionsPolicySection.css +1 -1
- 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/cookieItemsView.css +0 -1
- package/front_end/panels/application/frameDetailsReportView.css +0 -10
- package/front_end/panels/application/indexedDBViews.css +0 -10
- package/front_end/panels/application/privateVerificationTokensView.css +12 -0
- package/front_end/panels/application/resourcesPanel.css +0 -23
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +7 -7
- package/front_end/panels/application/serviceWorkersView.css +4 -3
- package/front_end/panels/changes/CombinedDiffView.ts +1 -1
- package/front_end/panels/comments/CommentsPane.ts +7 -11
- package/front_end/panels/common/CommentThreadWidget.ts +11 -3
- package/front_end/panels/common/CommentsOverlayWidget.ts +337 -117
- 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/console/consoleView.css +5 -3
- package/front_end/panels/coverage/CoverageView.ts +0 -1
- package/front_end/panels/coverage/coverageView.css +4 -3
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +0 -1
- package/front_end/panels/elements/AccessibilityTreeView.ts +1 -1
- package/front_end/panels/elements/CSSValueTraceView.ts +2 -4
- package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
- package/front_end/panels/elements/DOMTreeContextMenu.ts +1 -1
- package/front_end/panels/elements/DOMTreeWidget.ts +14 -0
- package/front_end/panels/elements/MetricsSidebarPane.ts +1 -1
- package/front_end/panels/elements/PlatformFontsWidget.ts +0 -1
- package/front_end/panels/elements/PropertiesWidget.ts +1 -1
- package/front_end/panels/elements/PropertyRenderer.ts +7 -27
- package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
- package/front_end/panels/elements/StylesSidebarPane.ts +2 -0
- package/front_end/panels/elements/WebCustomData.ts +1 -1
- package/front_end/panels/elements/components/cssHintDetailsView.css +1 -1
- package/front_end/panels/elements/components/cssVariableValueView.css +3 -1
- package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
- package/front_end/panels/elements/components/elementsTreeExpandButton.css +3 -2
- package/front_end/panels/elements/components/stylePropertyEditor.css +2 -2
- package/front_end/panels/elements/layoutPane.css +1 -1
- package/front_end/panels/elements/metricsSidebarPane.css +6 -6
- package/front_end/panels/elements/platformFontsWidget.css +1 -1
- package/front_end/panels/elements/propertiesWidget.css +0 -5
- package/front_end/panels/elements/stylesSidebarPane.css +1 -1
- package/front_end/panels/emulation/DeviceModeView.ts +4 -3
- package/front_end/panels/emulation/deviceModeView.css +9 -10
- package/front_end/panels/event_listeners/eventListenersView.css +5 -5
- package/front_end/panels/explain/components/consoleInsight.css +5 -20
- package/front_end/panels/issues/issuesTree.css +11 -10
- package/front_end/panels/layer_viewer/LayerDetailsView.ts +4 -2
- package/front_end/panels/layer_viewer/TransformController.ts +106 -54
- package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
- package/front_end/panels/lighthouse/lighthousePanel.css +5 -8
- package/front_end/panels/lighthouse/lighthouseStartView.css +1 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +4 -4
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
- package/front_end/panels/media/EventTimelineView.ts +1 -4
- package/front_end/panels/media/TickingFlameChart.ts +3 -2
- package/front_end/panels/media/playerListView.css +14 -7
- package/front_end/panels/media/playerMessagesView.css +11 -7
- package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +1 -1
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +5 -7
- package/front_end/panels/network/NetworkConfigView.ts +1 -1
- package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
- package/front_end/panels/network/binaryResourceView.css +0 -7
- package/front_end/panels/network/networkConfigView.css +3 -3
- package/front_end/panels/network/networkLogView.css +5 -11
- package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
- package/front_end/panels/network/networkTimingTable.css +6 -6
- package/front_end/panels/network/requestConditionsDrawer.css +1 -24
- package/front_end/panels/network/requestPayloadView.css +1 -1
- package/front_end/panels/performance_monitor/PerformanceMonitor.ts +1 -1
- package/front_end/panels/performance_monitor/performanceMonitor.css +2 -2
- package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
- package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
- package/front_end/panels/protocol_monitor/JSONEditor.ts +1 -1
- package/front_end/panels/protocol_monitor/protocolMonitor.css +1 -1
- package/front_end/panels/recorder/createRecordingView.css +2 -2
- package/front_end/panels/recorder/extensionView.css +1 -1
- package/front_end/panels/recorder/recorderPanel.css +3 -3
- package/front_end/panels/recorder/recordingListView.css +1 -1
- package/front_end/panels/recorder/stepEditor.css +2 -2
- package/front_end/panels/recorder/stepView.css +0 -31
- package/front_end/panels/recorder/timelineSection.css +1 -1
- package/front_end/panels/screencast/screencastView.css +3 -2
- package/front_end/panels/search/searchView.css +4 -3
- package/front_end/panels/security/SecurityPanelSidebar.ts +0 -1
- package/front_end/panels/security/mainView.css +2 -2
- package/front_end/panels/security/originView.css +1 -5
- package/front_end/panels/settings/FrameworkIgnoreListSettingsTab.ts +2 -1
- package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +1 -2
- package/front_end/panels/sources/breakpointsView.css +3 -4
- package/front_end/panels/sources/tabbedEditorContainer.css +1 -1
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +4 -3
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +1 -1
- package/front_end/panels/timeline/components/OriginMap.ts +1 -1
- package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -1
- package/front_end/panels/timeline/components/metricCard.css +1 -1
- package/front_end/panels/timeline/components/networkRequestDetails.css +0 -1
- package/front_end/panels/timeline/components/networkRequestTooltip.css +4 -4
- 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 +3 -3
- package/front_end/panels/timeline/timelineHistoryManager.css +1 -1
- package/front_end/panels/timeline/timelineMiniMap.css +3 -2
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/web_audio/webAudio.css +0 -20
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/comments/CommentAnchorResolver.ts +166 -8
- package/front_end/ui/comments/CommentOverlayManager.ts +17 -2
- package/front_end/ui/components/buttons/button.css +0 -1
- package/front_end/ui/components/diff_view/diffView.css +2 -2
- package/front_end/ui/components/markdown_view/codeBlock.css +3 -3
- package/front_end/ui/components/markdown_view/markdownView.css +3 -3
- package/front_end/ui/components/menus/Menu.ts +1 -1
- package/front_end/ui/components/menus/menuItem.css +1 -1
- package/front_end/ui/components/panel_feedback/panelFeedback.css +5 -4
- package/front_end/ui/components/panel_introduction_steps/panelIntroductionSteps.css +1 -1
- package/front_end/ui/components/report_view/reportValue.css +5 -2
- package/front_end/ui/components/suggestion_input/suggestionInput.css +6 -6
- package/front_end/ui/legacy/ContextMenu.ts +3 -0
- package/front_end/ui/legacy/GlassPane.ts +3 -3
- package/front_end/ui/legacy/SoftContextMenu.ts +7 -1
- package/front_end/ui/legacy/components/data_grid/DataGrid.ts +2 -0
- package/front_end/ui/legacy/components/inline_editor/bezierEditor.css +7 -6
- package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
- package/front_end/ui/legacy/components/inline_editor/cssAngleEditor.css +3 -3
- 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 +12 -9
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +11 -7
- package/front_end/ui/legacy/components/perf_ui/pieChart.css +3 -4
- package/front_end/ui/legacy/components/source_frame/imageView.css +4 -4
- package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
- package/front_end/ui/legacy/components/utils/jsUtils.css +2 -1
- package/front_end/ui/legacy/dropTarget.css +1 -1
- package/front_end/ui/legacy/filter.css +4 -3
- package/front_end/ui/legacy/inspectorCommon.css +16 -48
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
- 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/suggestBox.css +2 -1
- package/front_end/ui/legacy/tabbedPane.css +7 -4
- package/front_end/ui/legacy/toolbar.css +2 -1
- package/front_end/ui/legacy/treeoutline.css +6 -5
- package/front_end/ui/legacy/viewContainers.css +3 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +15 -0
- package/inspector_overlay/highlight_anchor.ts +8 -11
- 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
|
@@ -6,7 +6,6 @@ import * as Host from '../../../core/host/host.js';
|
|
|
6
6
|
import * as i18n from '../../../core/i18n/i18n.js';
|
|
7
7
|
import * as Platform from '../../../core/platform/platform.js';
|
|
8
8
|
import * as Root from '../../../core/root/root.js';
|
|
9
|
-
import * as Formatter from '../../formatter/formatter.js';
|
|
10
9
|
import type {FunctionHandlerOptions} from '../agents/AiAgent.js';
|
|
11
10
|
import {JavascriptExecutor} from '../agents/ExecuteJavascript.js';
|
|
12
11
|
|
|
@@ -25,7 +24,7 @@ import {
|
|
|
25
24
|
|
|
26
25
|
const lockedString = i18n.i18n.lockedString;
|
|
27
26
|
|
|
28
|
-
const
|
|
27
|
+
const MAX_LINES = 40;
|
|
29
28
|
const MAX_LINE_LENGTH = 120;
|
|
30
29
|
const MAX_TOTAL_CHARACTERS = 2500;
|
|
31
30
|
const MAX_LONG_LINES_REPORTED = 3;
|
|
@@ -50,16 +49,16 @@ const NETWORK_TOOLS_HINT =
|
|
|
50
49
|
'To inspect the page\'s network requests, load the `network` skill with `learnSkills` if it is not loaded yet, then use `listNetworkRequests` and `getNetworkRequestDetails`.';
|
|
51
50
|
|
|
52
51
|
/**
|
|
53
|
-
* Returns one message per size limit that the
|
|
54
|
-
*
|
|
55
|
-
*
|
|
52
|
+
* Returns one message per size limit that the code exceeds. Each message states
|
|
53
|
+
* the actual value, the limit, and how to fix it, so the model can correct
|
|
54
|
+
* every problem in a single retry.
|
|
56
55
|
*/
|
|
57
|
-
function describeSizeLimitViolations(
|
|
56
|
+
function describeSizeLimitViolations(code: string): string[] {
|
|
58
57
|
const violations: string[] = [];
|
|
59
|
-
const lines =
|
|
58
|
+
const lines = code.split('\n');
|
|
60
59
|
|
|
61
|
-
if (lines.length >
|
|
62
|
-
violations.push(`- The code is ${lines.length} lines (max ${
|
|
60
|
+
if (lines.length > MAX_LINES) {
|
|
61
|
+
violations.push(`- The code is ${lines.length} lines (max ${MAX_LINES}). ` +
|
|
63
62
|
'Split the logic into smaller calls and return intermediate results in `data`.');
|
|
64
63
|
}
|
|
65
64
|
|
|
@@ -79,8 +78,8 @@ function describeSizeLimitViolations(formattedCode: string): string[] {
|
|
|
79
78
|
}
|
|
80
79
|
}
|
|
81
80
|
|
|
82
|
-
if (
|
|
83
|
-
violations.push(`- The code is ${
|
|
81
|
+
if (code.length > MAX_TOTAL_CHARACTERS) {
|
|
82
|
+
violations.push(`- The code is ${code.length} characters (max ${MAX_TOTAL_CHARACTERS}). ` +
|
|
84
83
|
'Remove unneeded code or split the logic into smaller calls.');
|
|
85
84
|
}
|
|
86
85
|
|
|
@@ -105,27 +104,22 @@ export class ExecuteJavaScriptTool implements
|
|
|
105
104
|
'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.';
|
|
106
105
|
|
|
107
106
|
/**
|
|
108
|
-
*
|
|
109
|
-
*
|
|
110
|
-
*
|
|
107
|
+
* Checks the raw AI-generated code against the size limits and returns an
|
|
108
|
+
* error message if any limit is exceeded.
|
|
109
|
+
*
|
|
110
|
+
* Validation runs directly on the unformatted input string so that line-length
|
|
111
|
+
* checks match what `PermissionPrompt` displays and avoid false rejections
|
|
112
|
+
* from formatter line collapsing.
|
|
111
113
|
*/
|
|
112
|
-
static
|
|
113
|
-
const
|
|
114
|
-
'text/javascript',
|
|
115
|
-
code,
|
|
116
|
-
' ',
|
|
117
|
-
);
|
|
118
|
-
const formattedCode = formatted.formattedContent;
|
|
119
|
-
const violations = describeSizeLimitViolations(formattedCode);
|
|
114
|
+
static validateCode(code: string): string|undefined {
|
|
115
|
+
const violations = describeSizeLimitViolations(code);
|
|
120
116
|
if (violations.length > 0) {
|
|
121
|
-
return
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
].join('\n'),
|
|
126
|
-
};
|
|
117
|
+
return [
|
|
118
|
+
'Error: The code was not run because it exceeds size limits:',
|
|
119
|
+
...violations,
|
|
120
|
+
].join('\n');
|
|
127
121
|
}
|
|
128
|
-
return
|
|
122
|
+
return undefined;
|
|
129
123
|
}
|
|
130
124
|
|
|
131
125
|
readonly parameters: Host.AidaClient.FunctionObjectParam<keyof ExecuteJavaScriptArgs> = {
|
|
@@ -145,7 +139,11 @@ export class ExecuteJavaScriptTool implements
|
|
|
145
139
|
* **CRITICAL** Do not call \`console\` methods (e.g., \`console.log\`, \`console.warn\`, \`console.error\`) by default when returning data via \`data\`.
|
|
146
140
|
* **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.
|
|
147
141
|
* **CRITICAL** Variables from previous function calls are not available in subsequent calls.
|
|
148
|
-
* **CRITICAL** Keep code concise (max 40 lines, 120 characters per line, and 2,500 characters).
|
|
142
|
+
* **CRITICAL** Keep code concise (max 40 lines, max 120 characters per line, and max 2,500 total characters). To stay well under 120 characters per line:
|
|
143
|
+
- Put each statement, object property, array item, and \`&&\`/\`||\` condition on its own line.
|
|
144
|
+
- Extract long CSS selectors or strings into a variable (or \`.join(', ')\` array) before calling \`querySelectorAll\`.
|
|
145
|
+
- Store intermediate DOM lookups (\`getComputedStyle\`, \`getAttribute\`) in short local variables instead of chaining them on one line.
|
|
146
|
+
- Split complex logic into multiple steps.
|
|
149
147
|
* **CRITICAL** Network requests (e.g., fetch, XMLHttpRequest) are disabled and cannot be made.
|
|
150
148
|
|
|
151
149
|
For example, to query DOM elements:
|
|
@@ -201,12 +199,9 @@ const data = {
|
|
|
201
199
|
|
|
202
200
|
const isV2Architecture = Root.Runtime.hostConfig.devToolsAiV2Architecture?.enabled;
|
|
203
201
|
if (isV2Architecture) {
|
|
204
|
-
const
|
|
205
|
-
if (
|
|
206
|
-
return {error:
|
|
207
|
-
}
|
|
208
|
-
if (validationResult.formattedCode) {
|
|
209
|
-
params.code = validationResult.formattedCode;
|
|
202
|
+
const validationError = ExecuteJavaScriptTool.validateCode(params.code);
|
|
203
|
+
if (validationError) {
|
|
204
|
+
return {error: validationError};
|
|
210
205
|
}
|
|
211
206
|
}
|
|
212
207
|
|
|
@@ -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
|
+
};
|
|
@@ -6,7 +6,6 @@ import * as Common from '../../core/common/common.js';
|
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
7
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
8
|
import * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
9
|
-
// eslint-disable-next-line @devtools/es-modules-import
|
|
10
9
|
import * as StackTraceImpl from '../stack_trace/stack_trace_impl.js';
|
|
11
10
|
import * as Workspace from '../workspace/workspace.js';
|
|
12
11
|
|
|
@@ -11,7 +11,6 @@ import * as SDK from '../../core/sdk/sdk.js';
|
|
|
11
11
|
import * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
12
12
|
import * as Protocol from '../../generated/protocol.js';
|
|
13
13
|
import * as StackTrace from '../stack_trace/stack_trace.js';
|
|
14
|
-
// eslint-disable-next-line @devtools/es-modules-import
|
|
15
14
|
import * as StackTraceImpl from '../stack_trace/stack_trace_impl.js';
|
|
16
15
|
import * as Workspace from '../workspace/workspace.js';
|
|
17
16
|
|
|
@@ -9,7 +9,6 @@ import * as SDK from '../../core/sdk/sdk.js';
|
|
|
9
9
|
import type * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
10
10
|
import * as Protocol from '../../generated/protocol.js';
|
|
11
11
|
import type * as StackTrace from '../stack_trace/stack_trace.js';
|
|
12
|
-
// eslint-disable-next-line @devtools/es-modules-import
|
|
13
12
|
import * as StackTraceImpl from '../stack_trace/stack_trace_impl.js';
|
|
14
13
|
import * as Workspace from '../workspace/workspace.js';
|
|
15
14
|
|
|
@@ -168,6 +168,7 @@ export class HAREntry extends HARBase {
|
|
|
168
168
|
// Chrome specific.
|
|
169
169
|
this.custom.set('connectionId', HARBase.optionalString(data['_connectionId']));
|
|
170
170
|
this.custom.set('fromCache', HARBase.optionalString(data['_fromCache']));
|
|
171
|
+
this.custom.set('initialPriority', HARBase.optionalString(data['_initialPriority']));
|
|
171
172
|
this.custom.set('initiator', this.#importInitiator(data['_initiator']));
|
|
172
173
|
this.custom.set('priority', HARBase.optionalString(data['_priority']));
|
|
173
174
|
this.custom.set('resourceType', HARBase.optionalString(data['_resourceType']));
|
|
@@ -182,8 +182,14 @@ export class Importer {
|
|
|
182
182
|
entry.response.cookies.map(this.fillCookieFromHARCookie.bind(this, SDK.Cookie.Type.RESPONSE));
|
|
183
183
|
request.responseCookies = responseCookies;
|
|
184
184
|
|
|
185
|
+
const initialPriority = entry.customAsString('initialPriority');
|
|
186
|
+
// @ts-expect-error This accesses globalThis['Protocol'] where the enum is a JS object, not a TS const enum.
|
|
187
|
+
if (initialPriority && Protocol.Network.ResourcePriority.hasOwnProperty(initialPriority)) {
|
|
188
|
+
request.setInitialPriority(initialPriority as Protocol.Network.ResourcePriority);
|
|
189
|
+
}
|
|
190
|
+
|
|
185
191
|
const priority = entry.customAsString('priority');
|
|
186
|
-
// @ts-expect-error This accesses
|
|
192
|
+
// @ts-expect-error This accesses globalThis['Protocol'] where the enum is a JS object, not a TS const enum.
|
|
187
193
|
if (priority && Protocol.Network.ResourcePriority.hasOwnProperty(priority)) {
|
|
188
194
|
request.setPriority((priority as Protocol.Network.ResourcePriority));
|
|
189
195
|
}
|
|
@@ -19,6 +19,7 @@ Content:
|
|
|
19
19
|
],
|
|
20
20
|
"entries": [
|
|
21
21
|
{
|
|
22
|
+
"_initialPriority": null,
|
|
22
23
|
"_initiator": null,
|
|
23
24
|
"_priority": null,
|
|
24
25
|
"_resourceType": "document",
|
|
@@ -133,6 +134,7 @@ Content:
|
|
|
133
134
|
"pageref": "page_1"
|
|
134
135
|
},
|
|
135
136
|
{
|
|
137
|
+
"_initialPriority": null,
|
|
136
138
|
"_initiator": null,
|
|
137
139
|
"_priority": null,
|
|
138
140
|
"_resourceType": "xhr",
|
|
@@ -121,6 +121,7 @@ export class Entry {
|
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
const entry: EntryDTO = {
|
|
124
|
+
_initialPriority: harEntry.request.initialPriority(),
|
|
124
125
|
_initiator: exportedInitiator,
|
|
125
126
|
_priority: harEntry.request.priority(),
|
|
126
127
|
_resourceType: harEntry.request.resourceType().name(),
|
|
@@ -507,6 +508,7 @@ export interface Response {
|
|
|
507
508
|
export interface EntryDTO {
|
|
508
509
|
_connectionId?: string;
|
|
509
510
|
_fromCache?: string;
|
|
511
|
+
_initialPriority: Protocol.Network.ResourcePriority|null;
|
|
510
512
|
_initiator: Protocol.Network.Initiator|null;
|
|
511
513
|
_priority: Protocol.Network.ResourcePriority|null;
|
|
512
514
|
_resourceType: string;
|
|
@@ -8301,10 +8301,6 @@ export const NativeFunctions: readonly NativeFunctionValue[] = [
|
|
|
8301
8301
|
name: "embed",
|
|
8302
8302
|
signatures: [["input","?options"]]
|
|
8303
8303
|
},
|
|
8304
|
-
{
|
|
8305
|
-
name: "queryFeatureSupport",
|
|
8306
|
-
signatures: [["feature"]]
|
|
8307
|
-
},
|
|
8308
8304
|
{
|
|
8309
8305
|
name: "setPrivateToken",
|
|
8310
8306
|
signatures: [["privateToken"]]
|
|
@@ -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 {
|
|
@@ -480,6 +480,7 @@ function defaultView(input: ViewInput, output: PanelViewOutput, target: HTMLElem
|
|
|
480
480
|
}
|
|
481
481
|
|
|
482
482
|
Lit.render(html`
|
|
483
|
+
<style>${aiAssistancePanelStyles}</style>
|
|
483
484
|
${toolbarView(input)}
|
|
484
485
|
<div class="ai-assistance-view-container">
|
|
485
486
|
<devtools-split-view
|
|
@@ -638,7 +639,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
|
|
|
638
639
|
}) {
|
|
639
640
|
super(AiAssistancePanel.panelName);
|
|
640
641
|
this.view = view;
|
|
641
|
-
this.registerRequiredCSS(aiAssistancePanelStyles);
|
|
642
642
|
this.#aiAssistanceEnabledSetting = this.#getAiAssistanceEnabledSetting();
|
|
643
643
|
|
|
644
644
|
this.#aidaClient = aidaClient;
|
|
@@ -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);
|
|
@@ -225,6 +225,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
|
|
|
225
225
|
aria-label=${lockedString(UIStringsNotTranslate.startNewChat)}
|
|
226
226
|
class="chat-inline-button"
|
|
227
227
|
@click=${input.onNewConversation}
|
|
228
|
+
.reducedFocusRing=${true}
|
|
228
229
|
.data=${{
|
|
229
230
|
variant: Buttons.Button.Variant.TEXT,
|
|
230
231
|
title: lockedString(UIStringsNotTranslate.startNewChat),
|
|
@@ -430,6 +431,7 @@ export const DEFAULT_VIEW = (input: ViewInput, _output: ViewOutput, target: HTML
|
|
|
430
431
|
class="start-new-chat-button"
|
|
431
432
|
aria-label=${lockedString(UIStringsNotTranslate.startNewChat)}
|
|
432
433
|
@click=${input.onNewConversation}
|
|
434
|
+
.reducedFocusRing=${true}
|
|
433
435
|
.data=${{
|
|
434
436
|
variant: Buttons.Button.Variant.OUTLINED,
|
|
435
437
|
size: Buttons.Button.Size.SMALL,
|
|
@@ -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
|
|
|
@@ -27,7 +27,7 @@
|
|
|
27
27
|
|
|
28
28
|
.link {
|
|
29
29
|
padding: 0;
|
|
30
|
-
margin: 0
|
|
30
|
+
margin: 0 var(--sys-size-3);
|
|
31
31
|
}
|
|
32
32
|
|
|
33
33
|
.header {
|
|
@@ -97,8 +97,8 @@
|
|
|
97
97
|
border-radius: var(--sys-shape-corner-full);
|
|
98
98
|
|
|
99
99
|
devtools-icon {
|
|
100
|
-
width:
|
|
101
|
-
height:
|
|
100
|
+
width: var(--sys-size-9);
|
|
101
|
+
height: var(--sys-size-9);
|
|
102
102
|
}
|
|
103
103
|
}
|
|
104
104
|
|