chrome-devtools-frontend 1.0.1604514 → 1.0.1605390

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (80) hide show
  1. package/AUTHORS +1 -0
  2. package/front_end/Images/src/dots-circle.svg +10 -0
  3. package/front_end/Tests.js +23 -7
  4. package/front_end/core/host/AidaClient.ts +114 -63
  5. package/front_end/core/host/AidaGcaTranslation.ts +6 -0
  6. package/front_end/core/host/GcaClient.ts +112 -0
  7. package/front_end/core/host/UserMetrics.ts +0 -1
  8. package/front_end/core/host/host.ts +2 -0
  9. package/front_end/core/root/ExperimentNames.ts +0 -1
  10. package/front_end/core/root/Runtime.ts +5 -0
  11. package/front_end/core/sdk/AutofillModel.ts +3 -2
  12. package/front_end/core/sdk/CSSModel.ts +3 -4
  13. package/front_end/core/sdk/CSSProperty.ts +1 -1
  14. package/front_end/core/sdk/ConsoleModel.ts +15 -13
  15. package/front_end/core/sdk/CookieModel.ts +5 -4
  16. package/front_end/core/sdk/DOMDebuggerModel.ts +20 -14
  17. package/front_end/core/sdk/DebuggerModel.ts +21 -36
  18. package/front_end/core/sdk/EventBreakpointsModel.ts +16 -6
  19. package/front_end/core/sdk/IsolateManager.ts +12 -7
  20. package/front_end/core/sdk/WebMCPModel.ts +57 -2
  21. package/front_end/entrypoints/main/MainImpl.ts +0 -4
  22. package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -1
  23. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +10 -9
  24. package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +301 -0
  25. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +50 -25
  26. package/front_end/models/ai_assistance/agents/StylingAgent.ts +12 -264
  27. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
  28. package/front_end/models/emulation/DeviceModeModel.ts +21 -26
  29. package/front_end/models/trace/insights/LCPDiscovery.ts +14 -6
  30. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +2 -17
  31. package/front_end/panels/ai_assistance/components/ChatMessage.ts +165 -65
  32. package/front_end/panels/ai_assistance/components/ChatView.ts +2 -13
  33. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +1 -1
  34. package/front_end/panels/ai_assistance/components/chatMessage.css +48 -2
  35. package/front_end/panels/ai_assistance/components/chatView.css +0 -8
  36. package/front_end/panels/application/ApplicationPanelSidebar.ts +6 -0
  37. package/front_end/panels/application/IndexedDBViews.ts +0 -9
  38. package/front_end/panels/application/WebMCPTreeElement.ts +35 -0
  39. package/front_end/panels/application/WebMCPView.ts +468 -0
  40. package/front_end/panels/application/application.ts +4 -0
  41. package/front_end/panels/application/webMCPView.css +90 -0
  42. package/front_end/panels/common/aiCodeCompletionSummaryToolbar.css +1 -1
  43. package/front_end/panels/console/consoleView.css +4 -0
  44. package/front_end/panels/elements/ElementsTreeOutline.ts +87 -0
  45. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +23 -2
  46. package/front_end/panels/elements/StylesSidebarPane.ts +85 -20
  47. package/front_end/panels/elements/elementsPanel.css +14 -0
  48. package/front_end/panels/elements/elementsTreeOutline.css +21 -0
  49. package/front_end/panels/network/NetworkLogViewColumns.ts +3 -3
  50. package/front_end/panels/profiler/HeapDetachedElementsView.ts +0 -4
  51. package/front_end/panels/profiler/HeapProfileView.ts +0 -4
  52. package/front_end/panels/profiler/HeapProfilerPanel.ts +4 -13
  53. package/front_end/panels/profiler/HeapSnapshotView.ts +12 -16
  54. package/front_end/panels/profiler/ProfileHeader.ts +0 -11
  55. package/front_end/panels/profiler/ProfileTypeRegistry.ts +4 -12
  56. package/front_end/panels/profiler/ProfileView.ts +1 -6
  57. package/front_end/panels/profiler/ProfilesPanel.ts +60 -7
  58. package/front_end/panels/recorder/components/recordingView.css +0 -6
  59. package/front_end/panels/sensors/SensorsView.ts +28 -59
  60. package/front_end/panels/timeline/EventsTimelineTreeView.ts +3 -3
  61. package/front_end/panels/timeline/ThirdPartyTreeView.ts +37 -38
  62. package/front_end/panels/timeline/TimelineDetailsView.ts +47 -41
  63. package/front_end/panels/timeline/TimelinePanel.ts +11 -0
  64. package/front_end/panels/timeline/TimelineTreeView.ts +149 -60
  65. package/front_end/panels/timeline/components/CWVMetrics.ts +18 -2
  66. package/front_end/panels/timeline/components/LiveMetricsView.ts +839 -783
  67. package/front_end/panels/timeline/thirdPartyTreeView.css +2 -2
  68. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  69. package/front_end/panels/timeline/utils/Helpers.ts +5 -0
  70. package/front_end/ui/components/buttons/button.css +2 -2
  71. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +0 -11
  72. package/front_end/ui/legacy/FilterBar.ts +2 -0
  73. package/front_end/ui/legacy/InspectorDrawerView.ts +206 -0
  74. package/front_end/ui/legacy/InspectorView.ts +41 -91
  75. package/front_end/ui/legacy/SplitWidget.ts +33 -27
  76. package/front_end/ui/legacy/ViewManager.ts +14 -5
  77. package/front_end/ui/legacy/Widget.ts +36 -28
  78. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +5 -0
  79. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -1
  80. package/package.json +1 -1
@@ -4,7 +4,6 @@
4
4
 
5
5
  import * as Host from '../../../core/host/host.js';
6
6
  import * as i18n from '../../../core/i18n/i18n.js';
7
- import * as Platform from '../../../core/platform/platform.js';
8
7
  import * as Root from '../../../core/root/root.js';
9
8
  import * as SDK from '../../../core/sdk/sdk.js';
10
9
  import * as Protocol from '../../../generated/protocol.js';
@@ -13,9 +12,8 @@ import * as Annotations from '../../annotations/annotations.js';
13
12
  import * as Emulation from '../../emulation/emulation.js';
14
13
  import {ChangeManager} from '../ChangeManager.js';
15
14
  import {debugLog} from '../debug.js';
16
- import {EvaluateAction, formatError, SideEffectError} from '../EvaluateAction.js';
17
15
  import {ExtensionScope} from '../ExtensionScope.js';
18
- import {AI_ASSISTANCE_CSS_CLASS_NAME, FREESTYLER_WORLD_NAME} from '../injected.js';
16
+ import {AI_ASSISTANCE_CSS_CLASS_NAME} from '../injected.js';
19
17
 
20
18
  import {
21
19
  type AgentOptions as BaseAgentOptions,
@@ -25,12 +23,12 @@ import {
25
23
  ConversationContext,
26
24
  type ConversationSuggestions,
27
25
  type FunctionCallHandlerResult,
28
- type FunctionHandlerOptions,
29
26
  type MultimodalInput,
30
27
  MultimodalInputType,
31
28
  type RequestOptions,
32
29
  ResponseType
33
30
  } from './AiAgent.js';
31
+ import {executeJavaScriptFunction, executeJsCode, JavascriptExecutor} from './ExecuteJavascript.js';
34
32
 
35
33
  /*
36
34
  * Strings that don't need to be translated at this time.
@@ -145,51 +143,6 @@ const MULTIMODAL_ENHANCEMENT_PROMPTS: Record<MultimodalInputType, string> = {
145
143
  [MultimodalInputType.UPLOADED_IMAGE]: promptForUploadedImage + considerationsForMultimodalInputEvaluation,
146
144
  };
147
145
 
148
- async function executeJsCode(
149
- functionDeclaration: string,
150
- {throwOnSideEffect, contextNode}: {throwOnSideEffect: boolean, contextNode: SDK.DOMModel.DOMNode|null}):
151
- Promise<string> {
152
- if (!contextNode) {
153
- throw new Error('Cannot execute JavaScript because of missing context node');
154
- }
155
- const target = contextNode.domModel().target();
156
-
157
- if (!target) {
158
- throw new Error('Target is not found for executing code');
159
- }
160
-
161
- const resourceTreeModel = target.model(SDK.ResourceTreeModel.ResourceTreeModel);
162
- const frameId = contextNode.frameId() ?? resourceTreeModel?.mainFrame?.id;
163
-
164
- if (!frameId) {
165
- throw new Error('Main frame is not found for executing code');
166
- }
167
-
168
- const runtimeModel = target.model(SDK.RuntimeModel.RuntimeModel);
169
- const pageAgent = target.pageAgent();
170
-
171
- // This returns previously created world if it exists for the frame.
172
- const {executionContextId} = await pageAgent.invoke_createIsolatedWorld({frameId, worldName: FREESTYLER_WORLD_NAME});
173
- const executionContext = runtimeModel?.executionContext(executionContextId);
174
- if (!executionContext) {
175
- throw new Error('Execution context is not found for executing code');
176
- }
177
-
178
- if (executionContext.debuggerModel.selectedCallFrame()) {
179
- return formatError('Cannot evaluate JavaScript because the execution is paused on a breakpoint.');
180
- }
181
-
182
- const remoteObject = await contextNode.resolveToObject(undefined, executionContextId);
183
- if (!remoteObject) {
184
- throw new Error('Cannot execute JavaScript because remote object cannot be resolved');
185
- }
186
-
187
- return await EvaluateAction.execute(functionDeclaration, [remoteObject], executionContext, {throwOnSideEffect});
188
- }
189
-
190
- const MAX_OBSERVATION_BYTE_LENGTH = 25_000;
191
- const OBSERVATION_TIMEOUT = 5_000;
192
-
193
146
  export const AI_ASSISTANCE_FILTER_REGEX = `\\.${AI_ASSISTANCE_CSS_CLASS_NAME}-.*&`;
194
147
 
195
148
  type CreateExtensionScopeFunction = (changes: ChangeManager) => {
@@ -310,6 +263,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
310
263
  }
311
264
 
312
265
  #execJs: typeof executeJsCode;
266
+ #javascriptExecutor: JavascriptExecutor;
313
267
 
314
268
  #changes: ChangeManager;
315
269
  #createExtensionScope: CreateExtensionScopeFunction;
@@ -326,6 +280,14 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
326
280
  opts.createExtensionScope ?? ((changes: ChangeManager) => {
327
281
  return new ExtensionScope(changes, this.sessionId, this.context?.getItem() ?? null, this.#currentTurnId);
328
282
  });
283
+ this.#javascriptExecutor = new JavascriptExecutor(
284
+ {
285
+ executionMode: this.executionMode,
286
+ getContextNode: () => this.#getSelectedNode(),
287
+ createExtensionScope: this.#createExtensionScope.bind(this),
288
+ changes: this.#changes,
289
+ },
290
+ this.#execJs);
329
291
 
330
292
  this.declareFunction<{
331
293
  elements: number[],
@@ -378,91 +340,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
378
340
  },
379
341
  });
380
342
 
381
- this.declareFunction<{
382
- title: string,
383
- explanation: string,
384
- code: string,
385
- }>('executeJavaScript', {
386
- description:
387
- `This function allows you to run JavaScript code on the inspected page to access the element styles and page content.
388
- Call this function to gather additional information or modify the page state. Call this function enough times to investigate the user request.`,
389
- parameters: {
390
- type: Host.AidaClient.ParametersTypes.OBJECT,
391
- description: '',
392
- nullable: false,
393
- properties: {
394
- code: {
395
- type: Host.AidaClient.ParametersTypes.STRING,
396
- description:
397
- `JavaScript code snippet to run on the inspected page. Make sure the code is formatted for readability.
398
-
399
- # Instructions
400
-
401
- * To return data, define a top-level \`data\` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to \`data\`.
402
- * If you modify styles on an element, ALWAYS call the pre-defined global \`async setElementStyles(el: Element, styles: object)\` function. This function is an internal mechanism for you and should never be presented as a command/advice to the user.
403
- * **CRITICAL** Only get styles that might be relevant to the user request.
404
- * **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.
405
- * **CRITICAL** Consider that \`data\` variable from the previous function calls are not available in a new function call.
406
-
407
- For example, the code to change element styles:
408
-
409
- \`\`\`
410
- await setElementStyles($0, {
411
- color: 'blue',
412
- });
413
- \`\`\`
414
-
415
- For example, the code to get overlapping elements:
416
-
417
- \`\`\`
418
- const data = {
419
- overlappingElements: Array.from(document.querySelectorAll('*'))
420
- .filter(el => {
421
- const rect = el.getBoundingClientRect();
422
- const popupRect = $0.getBoundingClientRect();
423
- return (
424
- el !== $0 &&
425
- rect.left < popupRect.right &&
426
- rect.right > popupRect.left &&
427
- rect.top < popupRect.bottom &&
428
- rect.bottom > popupRect.top
429
- );
430
- })
431
- .map(el => ({
432
- tagName: el.tagName,
433
- id: el.id,
434
- className: el.className,
435
- zIndex: window.getComputedStyle(el)['z-index']
436
- }))
437
- };
438
- \`\`\`
439
- `,
440
- },
441
- explanation: {
442
- type: Host.AidaClient.ParametersTypes.STRING,
443
- description: 'Explain why you want to run this code',
444
- },
445
- title: {
446
- type: Host.AidaClient.ParametersTypes.STRING,
447
- description: 'Provide a summary of what the code does. For example, "Checking related element styles".',
448
- },
449
- },
450
- required: ['code', 'explanation', 'title']
451
- },
452
- displayInfoFromArgs: params => {
453
- return {
454
- title: params.title,
455
- thought: params.explanation,
456
- action: params.code,
457
- };
458
- },
459
- handler: async (
460
- params,
461
- options,
462
- ) => {
463
- return await this.executeAction(params.code, options);
464
- },
465
- });
343
+ this.declareFunction('executeJavaScript', executeJavaScriptFunction(this.#javascriptExecutor));
466
344
 
467
345
  if (Annotations.AnnotationRepository.annotationsEnabled()) {
468
346
  this.declareFunction<{
@@ -528,68 +406,6 @@ const data = {
528
406
  });
529
407
  }
530
408
 
531
- async generateObservation(
532
- action: string,
533
- {
534
- throwOnSideEffect,
535
- }: {
536
- throwOnSideEffect: boolean,
537
- },
538
- ): Promise<{
539
- observation: string,
540
- sideEffect: boolean,
541
- canceled: boolean,
542
- }> {
543
- const functionDeclaration = `async function ($0) {
544
- try {
545
- ${action}
546
- ;
547
- return ((typeof data !== "undefined") ? data : undefined);
548
- } catch (error) {
549
- return error;
550
- }
551
- }`;
552
- try {
553
- const result = await Promise.race([
554
- this.#execJs(
555
- functionDeclaration,
556
- {
557
- throwOnSideEffect,
558
- contextNode: this.context?.getItem() || null,
559
- },
560
- ),
561
- new Promise<never>((_, reject) => {
562
- setTimeout(
563
- () => reject(new Error('Script execution exceeded the maximum allowed time.')), OBSERVATION_TIMEOUT);
564
- }),
565
- ]);
566
- const byteCount = Platform.StringUtilities.countWtf8Bytes(result);
567
- Host.userMetrics.freestylerEvalResponseSize(byteCount);
568
- if (byteCount > MAX_OBSERVATION_BYTE_LENGTH) {
569
- throw new Error('Output exceeded the maximum allowed length.');
570
- }
571
- return {
572
- observation: result,
573
- sideEffect: false,
574
- canceled: false,
575
- };
576
- } catch (error) {
577
- if (error instanceof SideEffectError) {
578
- return {
579
- observation: error.message,
580
- sideEffect: true,
581
- canceled: false,
582
- };
583
- }
584
-
585
- return {
586
- observation: `Error: ${error.message}`,
587
- sideEffect: false,
588
- canceled: false,
589
- };
590
- }
591
- }
592
-
593
409
  static async describeElement(element: SDK.DOMModel.DOMNode): Promise<string> {
594
410
  let output = `* Element's uid is ${element.backendNodeId()}.
595
411
  * Its selector is \`${element.simpleSelector()}\``;
@@ -742,74 +558,6 @@ const data = {
742
558
  };
743
559
  }
744
560
 
745
- async executeAction(action: string, options?: FunctionHandlerOptions): Promise<FunctionCallHandlerResult<unknown>> {
746
- debugLog(`Action to execute: ${action}`);
747
-
748
- if (options?.approved === false) {
749
- return {
750
- error: 'Error: User denied code execution with side effects.',
751
- };
752
- }
753
-
754
- if (this.executionMode === Root.Runtime.HostConfigFreestylerExecutionMode.NO_SCRIPTS) {
755
- return {
756
- error: 'Error: JavaScript execution is currently disabled.',
757
- };
758
- }
759
-
760
- const selectedNode = this.#getSelectedNode();
761
- if (!selectedNode) {
762
- return {error: 'Error: no selected node found.'};
763
- }
764
- const target = selectedNode.domModel().target();
765
- if (target.model(SDK.DebuggerModel.DebuggerModel)?.selectedCallFrame()) {
766
- return {
767
- error: 'Error: Cannot evaluate JavaScript because the execution is paused on a breakpoint.',
768
- };
769
- }
770
-
771
- const scope = this.#createExtensionScope(this.#changes);
772
- await scope.install();
773
- try {
774
- let throwOnSideEffect = true;
775
- if (options?.approved) {
776
- throwOnSideEffect = false;
777
- }
778
-
779
- const result = await this.generateObservation(action, {throwOnSideEffect});
780
- debugLog(`Action result: ${JSON.stringify(result)}`);
781
- if (result.sideEffect) {
782
- if (this.executionMode === Root.Runtime.HostConfigFreestylerExecutionMode.SIDE_EFFECT_FREE_SCRIPTS_ONLY) {
783
- return {
784
- error: 'Error: JavaScript execution that modifies the page is currently disabled.',
785
- };
786
- }
787
-
788
- if (options?.signal?.aborted) {
789
- return {
790
- error: 'Error: evaluation has been cancelled',
791
- };
792
- }
793
-
794
- return {
795
- requiresApproval: true,
796
- description: lockedString('This code may modify page content. Continue?'),
797
- };
798
- }
799
- if (result.canceled) {
800
- return {
801
- error: result.observation,
802
- };
803
- }
804
-
805
- return {
806
- result: result.observation,
807
- };
808
- } finally {
809
- await scope.uninstall();
810
- }
811
- }
812
-
813
561
  async addElementAnnotation(elementId: string, annotationMessage: string):
814
562
  Promise<FunctionCallHandlerResult<unknown>> {
815
563
  if (!Annotations.AnnotationRepository.annotationsEnabled()) {
@@ -226,7 +226,7 @@ Response headers
226
226
 
227
227
  The result of the checks for this insight are:
228
228
  - fetchpriority=high should be applied: FAILED
229
- - lazy load not applied: PASSED
229
+ - LCP resources should not use loading=lazy: PASSED
230
230
  - Request is discoverable in initial document: PASSED
231
231
 
232
232
  ## Estimated savings: none
@@ -795,35 +795,30 @@ export class DeviceModeModel extends Common.ObjectWrapper.ObjectWrapper<EventTyp
795
795
  overlayModel.setShowViewportSizeOnResize(false);
796
796
  }
797
797
 
798
- const screenshot = await screenCaptureModel.captureScreenshot(
799
- Protocol.Page.CaptureScreenshotRequestFormat.Png, 100, screenshotMode, clip);
800
-
801
- const deviceMetrics: Protocol.Page.SetDeviceMetricsOverrideRequest = {
802
- width: 0,
803
- height: 0,
804
- deviceScaleFactor: 0,
805
- mobile: false,
806
- };
807
- if (fullSize && this.#emulationModel) {
808
- if (this.#device && this.#mode) {
809
- const orientation = this.#device.orientationByName(this.#mode.orientation);
810
- deviceMetrics.width = orientation.width;
811
- deviceMetrics.height = orientation.height;
812
- const dispFeature = this.getDisplayFeature();
813
- if (dispFeature) {
814
- // @ts-expect-error: displayFeature isn't in protocol.ts but is an
815
- // experimental flag:
816
- // https://chromedevtools.github.io/devtools-protocol/tot/Emulation/#method-setDeviceMetricsOverride
817
- deviceMetrics.displayFeature = dispFeature;
818
- }
819
- } else {
820
- deviceMetrics.width = 0;
821
- deviceMetrics.height = 0;
798
+ if (this.#emulationModel && this.#device && this.#mode) {
799
+ const orientation = this.#device.orientationByName(this.#mode.orientation);
800
+ const deviceMetrics: Protocol.Emulation.SetDeviceMetricsOverrideRequest = {
801
+ width: orientation.width,
802
+ height: orientation.height,
803
+ deviceScaleFactor: this.#device.deviceScaleFactor,
804
+ mobile: this.isMobile(),
805
+ };
806
+ const dispFeature = this.getDisplayFeature();
807
+ if (dispFeature) {
808
+ deviceMetrics.displayFeature = dispFeature;
822
809
  }
823
810
  await this.#emulationModel.emulateDevice(deviceMetrics);
824
811
  }
825
- this.calculateAndEmulate(false);
826
- return screenshot;
812
+
813
+ try {
814
+ const screenshot = await screenCaptureModel.captureScreenshot(
815
+ Protocol.Page.CaptureScreenshotRequestFormat.Png, 100, screenshotMode, clip);
816
+ return screenshot;
817
+ } finally {
818
+ await this.#emulationModel?.emulateDevice(null);
819
+ overlayModel?.setShowViewportSizeOnResize(this.#type === Type.None);
820
+ this.calculateAndEmulate(false);
821
+ }
827
822
  }
828
823
 
829
824
  private applyTouch(touchEnabled: boolean, mobile: boolean): void {
@@ -41,14 +41,18 @@ export const UIStrings = {
41
41
  * @description Text to tell the user that a fetchpriority property value of "high" should be applied to the LCP request.
42
42
  */
43
43
  fetchPriorityShouldBeApplied: 'fetchpriority=high should be applied',
44
+ /**
45
+ * @description Text to tell the user that a fetchpriority property value of "high" should be applied to the preload request that loads the LCP image.
46
+ */
47
+ fetchPriorityShouldBeAppliedToImagePreload: 'fetchpriority=high should be applied to the image preload request',
44
48
  /**
45
49
  * @description Text to tell the user that the LCP request is discoverable in the initial document.
46
50
  */
47
51
  requestDiscoverable: 'Request is discoverable in initial document',
48
52
  /**
49
- * @description Text to tell the user that the LCP request does not have the lazy load property applied.
53
+ * @description Text to tell the user that LCP resources should avoid using loading=lazy.
50
54
  */
51
- lazyLoadNotApplied: 'lazy load not applied',
55
+ lazyLoadNotApplied: 'LCP resources should not use loading=lazy',
52
56
  /**
53
57
  * @description Text status indicating that the the Largest Contentful Paint (LCP) metric timing was not found. "LCP" is an acronym and should not be translated.
54
58
  */
@@ -133,12 +137,17 @@ export function generateInsight(
133
137
  lcpRequest?.args.data.initiator?.type === 'parser' && docRequest.args.data.url === initiatorUrl;
134
138
  const imgPreloadedOrFoundInHTML = lcpRequest?.args.data.isLinkPreload || initiatedByMainDoc;
135
139
 
136
- const imageLoadingAttr = lcpEvent.args.data?.loadingAttr;
137
140
  const imageFetchPriorityHint = lcpRequest?.args.data.fetchPriorityHint;
138
141
  // This is the earliest discovery time an LCP request could have - it's TTFB (as an absolute timestamp).
139
142
  const earliestDiscoveryTime = calculateDocFirstByteTs(docRequest);
140
143
 
141
144
  const priorityHintFound = imageFetchPriorityHint === 'high';
145
+ const missingPriorityHintLabel = lcpRequest.args.data.isLinkPreload ?
146
+ i18nString(UIStrings.fetchPriorityShouldBeAppliedToImagePreload) :
147
+ i18nString(UIStrings.fetchPriorityShouldBeApplied);
148
+ // A lazy-loaded LCP image can still be eagerly loaded when its request is
149
+ // initiated by a preload.
150
+ const lcpNotLazyLoaded = lcpEvent.args.data?.loadingAttr !== 'lazy' || lcpRequest.args.data.isLinkPreload;
142
151
 
143
152
  return finalize({
144
153
  lcpEvent,
@@ -146,12 +155,11 @@ export function generateInsight(
146
155
  earliestDiscoveryTimeTs: earliestDiscoveryTime ? Types.Timing.Micro(earliestDiscoveryTime) : undefined,
147
156
  checklist: {
148
157
  priorityHinted: {
149
- label: priorityHintFound ? i18nString(UIStrings.fetchPriorityApplied) :
150
- i18nString(UIStrings.fetchPriorityShouldBeApplied),
158
+ label: priorityHintFound ? i18nString(UIStrings.fetchPriorityApplied) : missingPriorityHintLabel,
151
159
  value: priorityHintFound
152
160
  },
153
161
  requestDiscoverable: {label: i18nString(UIStrings.requestDiscoverable), value: imgPreloadedOrFoundInHTML},
154
- eagerlyLoaded: {label: i18nString(UIStrings.lazyLoadNotApplied), value: imageLoadingAttr !== 'lazy'},
162
+ eagerlyLoaded: {label: i18nString(UIStrings.lazyLoadNotApplied), value: lcpNotLazyLoaded},
155
163
  },
156
164
  });
157
165
  }
@@ -379,14 +379,6 @@ interface ToolbarViewInput {
379
379
  showChatActions: boolean;
380
380
  showActiveConversationActions: boolean;
381
381
  isLoading: boolean;
382
-
383
- walkthrough: {
384
- isExpanded: boolean,
385
- isInlined: boolean,
386
- onToggle: (isOpen: boolean, message: ModelChatMessage) => void,
387
- activeSidebarMessage: ModelChatMessage|null,
388
- inlineExpandedMessages: ModelChatMessage[],
389
- };
390
382
  }
391
383
 
392
384
  export const enum ViewState {
@@ -514,7 +506,7 @@ function defaultView(input: ViewInput, output: PanelViewOutput, target: HTMLElem
514
506
  if (Root.Runtime.hostConfig.devToolsAiAssistanceV2?.enabled ||
515
507
  Greendev.Prototypes.instance().isEnabled('breakpointDebuggerAgent')) {
516
508
 
517
- const shouldShowWalkthrough = input.state === ViewState.CHAT_VIEW && input.walkthrough.isExpanded;
509
+ const shouldShowWalkthrough = input.state === ViewState.CHAT_VIEW && input.props.walkthrough.isExpanded;
518
510
  /**
519
511
  * We want to mark the walkthrough as loading only if it's showing the last
520
512
  * message. Otherwise, a previous walkthrough will show as loading if we
@@ -535,7 +527,7 @@ function defaultView(input: ViewInput, output: PanelViewOutput, target: HTMLElem
535
527
  name="ai-assistance-split-view-state"
536
528
  direction="column"
537
529
  sidebar-position="second"
538
- sidebar-visibility=${shouldShowWalkthrough && !input.walkthrough.isInlined ? 'visible' : 'hidden'}
530
+ sidebar-visibility=${shouldShowWalkthrough && !input.props.walkthrough.isInlined ? 'visible' : 'hidden'}
539
531
  sidebar-initial-size=${WALKTHROUGH_SIDEBAR_INITIAL_WIDTH}
540
532
  >
541
533
  <div slot="main" class="main-view">
@@ -716,13 +708,6 @@ export class AiAssistancePanel extends UI.Panel.Panel {
716
708
  onSettingsClick: () => {
717
709
  void UI.ViewManager.ViewManager.instance().showView('chrome-ai');
718
710
  },
719
- walkthrough: {
720
- isExpanded: this.#walkthrough.isExpanded,
721
- isInlined: this.#walkthrough.isInlined,
722
- onToggle: this.#toggleWalkthrough.bind(this),
723
- activeSidebarMessage: this.#walkthrough.activeSidebarMessage,
724
- inlineExpandedMessages: this.#walkthrough.inlineExpandedMessages,
725
- }
726
711
  };
727
712
  }
728
713