chrome-devtools-frontend 1.0.1598808 → 1.0.1601661

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 (161) hide show
  1. package/.agents/README.md +13 -0
  2. package/{agents/prompts/creating-a-model.md → .agents/skills/creating-a-model/SKILL.md} +7 -1
  3. package/{agents/prompts/devtools-imports.md → .agents/skills/devtools-imports/SKILL.md} +10 -5
  4. package/{agents/prompts/merging-devtools-module.md → .agents/skills/merging-devtools-module/SKILL.md} +5 -0
  5. package/{agents/prompts/ui-widgets.md → .agents/skills/ui-widgets/SKILL.md} +5 -0
  6. package/{agents/prompts/verification.md → .agents/skills/verification/SKILL.md} +5 -0
  7. package/front_end/core/common/Settings.ts +24 -1
  8. package/front_end/core/dom_extension/DOMExtension.ts +1 -0
  9. package/front_end/core/host/AidaClient.ts +5 -2
  10. package/front_end/core/host/AidaGcaTranslation.ts +377 -0
  11. package/front_end/core/host/GcaTypes.ts +520 -0
  12. package/front_end/core/host/UserMetrics.ts +0 -3
  13. package/front_end/core/host/host.ts +4 -0
  14. package/front_end/core/root/ExperimentNames.ts +0 -3
  15. package/front_end/core/sdk/CPUThrottlingManager.ts +12 -9
  16. package/front_end/core/sdk/ResourceTreeModel.ts +1 -1
  17. package/front_end/core/sdk/SourceMap.ts +4 -2
  18. package/front_end/entrypoints/main/MainImpl.ts +1 -12
  19. package/front_end/generated/Deprecation.ts +16 -0
  20. package/front_end/generated/InspectorBackendCommands.ts +4 -6
  21. package/front_end/generated/protocol.ts +46 -77
  22. package/front_end/models/ai_assistance/AiConversation.ts +49 -22
  23. package/front_end/models/ai_assistance/AiHistoryStorage.snapshot.txt +1 -1
  24. package/front_end/models/ai_assistance/AiHistoryStorage.ts +1 -0
  25. package/front_end/models/ai_assistance/ConversationHandler.ts +16 -11
  26. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +76 -36
  27. package/front_end/models/ai_assistance/agents/AiAgent.ts +26 -2
  28. package/front_end/models/ai_assistance/agents/BreakpointDebuggerAgent.ts +0 -1
  29. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +11 -0
  30. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +39 -0
  31. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +53 -12
  32. package/front_end/models/ai_assistance/agents/FileAgent.ts +0 -15
  33. package/front_end/models/ai_assistance/agents/NetworkAgent.ts +0 -5
  34. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +57 -0
  35. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +87 -15
  36. package/front_end/models/ai_assistance/agents/PerformanceAnnotationsAgent.ts +0 -10
  37. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -6
  38. package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -5
  39. package/front_end/models/ai_assistance/ai_assistance.ts +2 -0
  40. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +84 -0
  41. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +172 -0
  42. package/front_end/models/breakpoints/BreakpointManager.ts +20 -12
  43. package/front_end/models/emulation/DeviceModeModel.ts +5 -1
  44. package/front_end/models/emulation/EmulatedDevices.ts +3 -2
  45. package/front_end/models/javascript_metadata/NativeFunctions.js +60 -0
  46. package/front_end/models/lighthouse/LighthouseReporterTypes.ts +104 -10
  47. package/front_end/models/lighthouse/RunTypes.ts +42 -0
  48. package/front_end/models/lighthouse/lighthouse.ts +2 -0
  49. package/front_end/models/live-metrics/web-vitals-injected/web-vitals-injected.ts +59 -35
  50. package/front_end/models/stack_trace/StackTrace.ts +5 -0
  51. package/front_end/models/stack_trace/StackTraceImpl.ts +7 -1
  52. package/front_end/models/stack_trace/StackTraceModel.ts +2 -1
  53. package/front_end/models/stack_trace/stack_trace.ts +4 -0
  54. package/front_end/models/trace/ModelImpl.ts +4 -0
  55. package/front_end/models/trace/helpers/SamplesIntegrator.ts +1 -8
  56. package/front_end/models/trace/types/Configuration.ts +0 -5
  57. package/front_end/panels/accessibility/AccessibilityNodeView.ts +7 -3
  58. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +163 -74
  59. package/front_end/panels/ai_assistance/ExportConversation.ts +25 -0
  60. package/front_end/panels/ai_assistance/ai_assistance.ts +2 -0
  61. package/front_end/panels/ai_assistance/components/ChatInput.ts +2 -0
  62. package/front_end/panels/ai_assistance/components/ChatMessage.ts +120 -32
  63. package/front_end/panels/ai_assistance/components/ChatView.ts +44 -0
  64. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +240 -0
  65. package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +4 -12
  66. package/front_end/panels/ai_assistance/components/StylingAgentMarkdownRenderer.ts +5 -27
  67. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +115 -17
  68. package/front_end/panels/ai_assistance/components/chatMessage.css +65 -1
  69. package/front_end/panels/ai_assistance/components/chatView.css +8 -0
  70. package/front_end/panels/ai_assistance/components/exportForAgentsDialog.css +82 -0
  71. package/front_end/panels/ai_assistance/components/walkthroughView.css +9 -1
  72. package/front_end/panels/animation/AnimationTimeline.ts +5 -5
  73. package/front_end/panels/application/AppManifestView.ts +13 -7
  74. package/front_end/panels/application/FrameDetailsView.ts +4 -4
  75. package/front_end/panels/application/preloading/PreloadingView.ts +2 -4
  76. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +6 -3
  77. package/front_end/panels/application/preloading/components/PreloadingString.ts +15 -2
  78. package/front_end/panels/application/preloading/helper/PreloadingForward.ts +31 -2
  79. package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +3 -2
  80. package/front_end/panels/common/DOMLinkifier.ts +10 -8
  81. package/front_end/panels/console/ConsoleView.ts +24 -2
  82. package/front_end/panels/console/ConsoleViewMessage.ts +22 -23
  83. package/front_end/panels/console/console.ts +0 -2
  84. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +5 -5
  85. package/front_end/panels/elements/ElementsTreeElement.ts +2 -3
  86. package/front_end/panels/elements/PropertiesWidget.ts +5 -3
  87. package/front_end/panels/elements/StandaloneStylesContainer.ts +21 -9
  88. package/front_end/panels/elements/StylePropertiesSection.ts +98 -50
  89. package/front_end/panels/elements/StylePropertyTreeElement.ts +38 -4
  90. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +43 -35
  91. package/front_end/panels/elements/StylesSidebarPane.ts +154 -24
  92. package/front_end/panels/elements/components/ComputedStyleTrace.ts +3 -2
  93. package/front_end/panels/event_listeners/EventListenersView.ts +16 -4
  94. package/front_end/panels/explain/components/ConsoleInsight.ts +6 -9
  95. package/front_end/panels/explain/explain-meta.ts +5 -0
  96. package/front_end/panels/issues/AffectedResourcesView.ts +5 -9
  97. package/front_end/panels/issues/AffectedSelectivePermissionsInterventionView.ts +1 -1
  98. package/front_end/panels/lighthouse/LighthouseController.ts +154 -164
  99. package/front_end/panels/lighthouse/LighthousePanel.ts +5 -9
  100. package/front_end/panels/lighthouse/LighthouseProtocolService.ts +1 -0
  101. package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +9 -6
  102. package/front_end/panels/lighthouse/LighthouseStartView.ts +7 -6
  103. package/front_end/panels/lighthouse/LighthouseStatusView.ts +32 -8
  104. package/front_end/panels/linear_memory_inspector/components/LinearMemoryInspector.ts +7 -3
  105. package/front_end/panels/network/NetworkDataGridNode.ts +34 -0
  106. package/front_end/panels/network/NetworkLogViewColumns.ts +10 -0
  107. package/front_end/panels/network/RequestPayloadView.ts +4 -1
  108. package/front_end/panels/network/RequestTimingView.ts +8 -2
  109. package/front_end/panels/performance_monitor/performanceMonitor.css +6 -4
  110. package/front_end/panels/recorder/RecorderController.ts +52 -14
  111. package/front_end/panels/recorder/components/RecordingView.ts +2 -1
  112. package/front_end/panels/recorder/models/RecordingStorage.ts +15 -20
  113. package/front_end/panels/sensors/SensorsView.ts +333 -157
  114. package/front_end/panels/settings/emulation/DevicesSettingsTab.ts +18 -4
  115. package/front_end/panels/sources/DebuggerPausedMessage.ts +6 -6
  116. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -3
  117. package/front_end/panels/sources/NavigatorView.ts +11 -7
  118. package/front_end/panels/sources/ScopeChainSidebarPane.ts +1 -1
  119. package/front_end/panels/sources/SourcesPanel.ts +12 -34
  120. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +5 -1
  121. package/front_end/panels/sources/sources-meta.ts +6 -0
  122. package/front_end/panels/timeline/StatusDialog.ts +159 -83
  123. package/front_end/panels/timeline/ThirdPartyTreeView.ts +6 -2
  124. package/front_end/panels/timeline/TimelineController.ts +0 -4
  125. package/front_end/panels/timeline/TimelineDetailsView.ts +35 -3
  126. package/front_end/panels/timeline/TimelineFlameChartDataProvider.ts +6 -1
  127. package/front_end/panels/timeline/TimelineFlameChartNetworkDataProvider.ts +9 -4
  128. package/front_end/panels/timeline/TimelinePanel.ts +36 -11
  129. package/front_end/panels/timeline/TimelineTreeView.ts +14 -3
  130. package/front_end/panels/timeline/TimelineUIUtils.ts +5 -57
  131. package/front_end/panels/timeline/components/InteractionBreakdown.ts +2 -1
  132. package/front_end/panels/timeline/components/LiveMetricsView.ts +2 -2
  133. package/front_end/panels/timeline/components/NetworkRequestTooltip.ts +3 -7
  134. package/front_end/panels/timeline/components/Sidebar.ts +11 -19
  135. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +2 -1
  136. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +60 -27
  137. package/front_end/panels/timeline/components/TimelineRangeSummaryView.ts +66 -0
  138. package/front_end/panels/timeline/components/TimelineSummary.ts +7 -19
  139. package/front_end/panels/timeline/components/components.ts +2 -0
  140. package/front_end/panels/timeline/components/insights/BaseInsightComponent.ts +55 -28
  141. package/front_end/panels/timeline/components/insights/NodeLink.ts +3 -3
  142. package/front_end/panels/timeline/components/insights/baseInsightComponent.css +7 -0
  143. package/front_end/panels/timeline/components/insights/insights.ts +0 -2
  144. package/front_end/panels/timeline/components/timelineRangeSummaryView.css +20 -0
  145. package/front_end/panels/timeline/overlays/OverlaysImpl.ts +7 -7
  146. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  147. package/front_end/panels/timeline/timelineDetailsView.css +0 -9
  148. package/front_end/third_party/chromium/README.chromium +1 -1
  149. package/front_end/third_party/web-vitals/package/dist/modules/attribution/onINP.js +11 -2
  150. package/front_end/third_party/web-vitals/package/src/attribution/onINP.ts +11 -2
  151. package/front_end/third_party/web-vitals/patches/0001-Add-onEachInteraction-to-onINP-options.patch +65 -4
  152. package/front_end/ui/kit/link/link.css +2 -2
  153. package/front_end/ui/legacy/Widget.ts +5 -3
  154. package/front_end/ui/legacy/components/object_ui/CustomPreviewComponent.ts +7 -2
  155. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +57 -35
  156. package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -0
  157. package/front_end/ui/visual_logging/KnownContextValues.ts +6 -1
  158. package/package.json +1 -1
  159. package/agents/prompts/README.md +0 -18
  160. package/front_end/panels/timeline/components/insights/InsightRenderer.ts +0 -93
  161. /package/front_end/{panels/console → models/stack_trace}/ErrorStackParser.ts +0 -0
@@ -12,7 +12,6 @@ import * as EmulationModel from '../../models/emulation/emulation.js';
12
12
  import type * as LighthouseModel from '../../models/lighthouse/lighthouse.js';
13
13
  import * as Emulation from '../emulation/emulation.js';
14
14
 
15
- import type {RunOverrides} from './LighthousePanel.js';
16
15
  import type {LighthouseRun as LighthouseRunType, ProtocolService} from './LighthouseProtocolService.js';
17
16
 
18
17
  const UIStrings = {
@@ -192,6 +191,7 @@ class LighthouseRun {
192
191
  formFactor: (string|undefined),
193
192
  mode: string,
194
193
  };
194
+ readonly isAIControlled: boolean;
195
195
  private emulationStateBefore?: {
196
196
  emulation: {
197
197
  type: EmulationModel.DeviceModeModel.Type,
@@ -210,12 +210,13 @@ class LighthouseRun {
210
210
 
211
211
  constructor(
212
212
  controller: LighthouseController, protocolService: ProtocolService, inspectedURL: Platform.DevToolsPath.UrlString,
213
- categoryIDs: string[], flags: {formFactor: (string|undefined), mode: string}) {
213
+ categoryIDs: string[], flags: {formFactor: (string|undefined), mode: string}, isAIControlled: boolean) {
214
214
  this.controller = controller;
215
215
  this.protocolService = protocolService;
216
216
  this.inspectedURL = inspectedURL;
217
217
  this.categoryIDs = categoryIDs;
218
218
  this.flags = flags;
219
+ this.isAIControlled = isAIControlled;
219
220
  this.#isRunning = false;
220
221
  }
221
222
 
@@ -370,11 +371,11 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
370
371
  protocolService.registerStatusCallback(
371
372
  message => this.dispatchEventToListeners(Events.AuditProgressChanged, {message}));
372
373
 
373
- for (const preset of Presets) {
374
+ for (const preset of getPresets()) {
374
375
  preset.setting.addChangeListener(this.recomputePageAuditability.bind(this));
375
376
  }
376
377
 
377
- for (const runtimeSetting of RuntimeSettings) {
378
+ for (const runtimeSetting of getRuntimeSettings()) {
378
379
  runtimeSetting.setting.addChangeListener(this.recomputePageAuditability.bind(this));
379
380
  }
380
381
 
@@ -441,7 +442,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
441
442
  }
442
443
 
443
444
  private hasAtLeastOneCategory(): boolean {
444
- return Presets.some(preset => preset.setting.get());
445
+ return getPresets().some(preset => preset.setting.get());
445
446
  }
446
447
 
447
448
  private unauditablePageMessage(): string|null {
@@ -492,7 +493,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
492
493
 
493
494
  private async hasImportantResourcesNotCleared(): Promise<string> {
494
495
  const clearStorageSetting =
495
- RuntimeSettings.find(runtimeSetting => runtimeSetting.setting.name === 'lighthouse.clear-storage');
496
+ getRuntimeSettings().find(runtimeSetting => runtimeSetting.setting.name === 'lighthouse.clear-storage');
496
497
  if (clearStorageSetting && !clearStorageSetting.setting.get()) {
497
498
  return '';
498
499
  }
@@ -551,6 +552,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
551
552
  inspectedURL: this.currentLighthouseRun.inspectedURL,
552
553
  categoryIDs: this.currentLighthouseRun.categoryIDs,
553
554
  flags: this.currentLighthouseRun.flags,
555
+ isAIControlled: this.currentLighthouseRun.isAIControlled,
554
556
  };
555
557
  }
556
558
 
@@ -559,7 +561,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
559
561
  mode: string,
560
562
  } {
561
563
  const flags = {};
562
- for (const runtimeSetting of RuntimeSettings) {
564
+ for (const runtimeSetting of getRuntimeSettings()) {
563
565
  runtimeSetting.setFlags(flags, runtimeSetting.setting.get());
564
566
  }
565
567
  return flags as {
@@ -568,10 +570,10 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
568
570
  };
569
571
  }
570
572
 
571
- getCategoryIDs(): CategoryId[] {
573
+ getCategoryIDs(): LighthouseModel.RunTypes.CategoryId[] {
572
574
  const {mode} = this.getFlags();
573
- const categoryIDs: CategoryId[] = [];
574
- for (const preset of Presets) {
575
+ const categoryIDs: LighthouseModel.RunTypes.CategoryId[] = [];
576
+ for (const preset of getPresets()) {
575
577
  if (mode && !preset.supportedModes.includes(mode)) {
576
578
  continue;
577
579
  }
@@ -620,7 +622,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
620
622
  private recordMetrics(flags: {mode: string}, categoryIds: string[]): void {
621
623
  Host.userMetrics.actionTaken(Host.UserMetrics.Action.LighthouseStarted);
622
624
 
623
- for (const preset of Presets) {
625
+ for (const preset of getPresets()) {
624
626
  if (!categoryIds.includes(preset.configID)) {
625
627
  continue;
626
628
  }
@@ -645,7 +647,7 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
645
647
  * user has selected in the UI, but these can be overridden by passing in the
646
648
  * category IDs, in which case these take priority.
647
649
  */
648
- async startLighthouse(overrides?: RunOverrides): Promise<void> {
650
+ async startLighthouse(overrides?: LighthouseModel.RunTypes.RunOverrides): Promise<void> {
649
651
  if (this.lastAction) {
650
652
  await this.lastAction;
651
653
  }
@@ -662,7 +664,8 @@ export class LighthouseController extends Common.ObjectWrapper.ObjectWrapper<Eve
662
664
 
663
665
  this.recordMetrics(flags, categoryIDs);
664
666
 
665
- this.currentLighthouseRun = new LighthouseRun(this, this.protocolService, inspectedURL, categoryIDs, flags);
667
+ this.currentLighthouseRun = new LighthouseRun(
668
+ this, this.protocolService, inspectedURL, categoryIDs, flags, Boolean(overrides?.isAIControlled));
666
669
  await this.currentLighthouseRun.start();
667
670
  resolve();
668
671
  });
@@ -702,144 +705,154 @@ const STORAGE_TYPE_NAMES = new Map([
702
705
  [Protocol.Storage.StorageType.Websql, i18nLazyString(UIStrings.webSql)],
703
706
  ]);
704
707
 
705
- export const Presets: Preset[] = [
706
- // configID maps to Lighthouse's Object.keys(config.categories)[0] value
707
- {
708
- setting: Common.Settings.Settings.instance().createSetting(
709
- 'lighthouse.cat-perf', true, Common.Settings.SettingStorageType.SYNCED),
710
- configID: 'performance',
711
- title: i18nLazyString(UIStrings.performance),
712
- description: i18nLazyString(UIStrings.howLongDoesThisAppTakeToShow),
713
- supportedModes: ['navigation', 'timespan', 'snapshot'],
714
- userMetric: Host.UserMetrics.LighthouseCategoryUsed.PERFORMANCE,
715
- },
716
- {
717
- setting: Common.Settings.Settings.instance().createSetting(
718
- 'lighthouse.cat-a11y', true, Common.Settings.SettingStorageType.SYNCED),
719
- configID: 'accessibility',
720
- title: i18nLazyString(UIStrings.accessibility),
721
- description: i18nLazyString(UIStrings.isThisPageUsableByPeopleWith),
722
- supportedModes: ['navigation', 'snapshot'],
723
- userMetric: Host.UserMetrics.LighthouseCategoryUsed.ACCESSIBILITY,
724
- },
725
- {
726
- setting: Common.Settings.Settings.instance().createSetting(
727
- 'lighthouse.cat-best-practices', true, Common.Settings.SettingStorageType.SYNCED),
728
- configID: 'best-practices',
729
- title: i18nLazyString(UIStrings.bestPractices),
730
- description: i18nLazyString(UIStrings.doesThisPageFollowBestPractices),
731
- supportedModes: ['navigation', 'timespan', 'snapshot'],
732
- userMetric: Host.UserMetrics.LighthouseCategoryUsed.BEST_PRACTICES,
733
- },
734
- {
735
- setting: Common.Settings.Settings.instance().createSetting(
736
- 'lighthouse.cat-seo', true, Common.Settings.SettingStorageType.SYNCED),
737
- configID: 'seo',
738
- title: i18nLazyString(UIStrings.seo),
739
- description: i18nLazyString(UIStrings.isThisPageOptimizedForSearch),
740
- supportedModes: ['navigation', 'snapshot'],
741
- userMetric: Host.UserMetrics.LighthouseCategoryUsed.SEO,
742
- },
743
- ];
744
-
745
- export type Flags = Record<string, string|boolean>;
746
-
747
- export const RuntimeSettings: RuntimeSetting[] = [
748
- {
749
- setting: Common.Settings.Settings.instance().createSetting(
750
- 'lighthouse.device-type', 'mobile', Common.Settings.SettingStorageType.SYNCED),
751
- title: i18nLazyString(UIStrings.applyMobileEmulation),
752
- description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
753
- setFlags: (flags: Flags, value: string|boolean) => {
754
- // See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
755
- flags.formFactor = value;
756
- },
757
- options: [
708
+ let presets: LighthouseModel.RunTypes.Preset[]|null = null;
709
+ export function getPresets(): LighthouseModel.RunTypes.Preset[] {
710
+ if (!presets) {
711
+ presets = [
712
+ // configID maps to Lighthouse's Object.keys(config.categories)[0] value
758
713
  {
759
- label: i18nLazyString(UIStrings.mobile),
760
- tooltip: i18nLazyString(UIStrings.applyMobileEmulationDuring),
761
- value: 'mobile'
714
+ setting: Common.Settings.Settings.instance().createSetting(
715
+ 'lighthouse.cat-perf', true, Common.Settings.SettingStorageType.SYNCED),
716
+ configID: 'performance',
717
+ title: i18nLazyString(UIStrings.performance),
718
+ description: i18nLazyString(UIStrings.howLongDoesThisAppTakeToShow),
719
+ supportedModes: ['navigation', 'timespan', 'snapshot'],
720
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.PERFORMANCE,
762
721
  },
763
722
  {
764
- label: i18nLazyString(UIStrings.desktop),
765
- tooltip: i18nLazyString(UIStrings.applyDesktopEmulationDuring),
766
- value: 'desktop'
723
+ setting: Common.Settings.Settings.instance().createSetting(
724
+ 'lighthouse.cat-a11y', true, Common.Settings.SettingStorageType.SYNCED),
725
+ configID: 'accessibility',
726
+ title: i18nLazyString(UIStrings.accessibility),
727
+ description: i18nLazyString(UIStrings.isThisPageUsableByPeopleWith),
728
+ supportedModes: ['navigation', 'snapshot'],
729
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.ACCESSIBILITY,
767
730
  },
768
- ],
769
- },
770
- {
771
- setting: Common.Settings.Settings.instance().createSetting(
772
- 'lighthouse.mode', 'navigation', Common.Settings.SettingStorageType.SYNCED),
773
- title: i18nLazyString(UIStrings.lighthouseMode),
774
- description: i18nLazyString(UIStrings.runLighthouseInMode),
775
- setFlags: (flags: Flags, value: string|boolean) => {
776
- flags.mode = value;
777
- },
778
- options: [
779
731
  {
780
- label: i18nLazyString(UIStrings.navigation),
781
- tooltip: i18nLazyString(UIStrings.navigationTooltip),
782
- value: 'navigation',
732
+ setting: Common.Settings.Settings.instance().createSetting(
733
+ 'lighthouse.cat-best-practices', true, Common.Settings.SettingStorageType.SYNCED),
734
+ configID: 'best-practices',
735
+ title: i18nLazyString(UIStrings.bestPractices),
736
+ description: i18nLazyString(UIStrings.doesThisPageFollowBestPractices),
737
+ supportedModes: ['navigation', 'timespan', 'snapshot'],
738
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.BEST_PRACTICES,
783
739
  },
784
740
  {
785
- label: i18nLazyString(UIStrings.timespan),
786
- tooltip: i18nLazyString(UIStrings.timespanTooltip),
787
- value: 'timespan',
741
+ setting: Common.Settings.Settings.instance().createSetting(
742
+ 'lighthouse.cat-seo', true, Common.Settings.SettingStorageType.SYNCED),
743
+ configID: 'seo',
744
+ title: i18nLazyString(UIStrings.seo),
745
+ description: i18nLazyString(UIStrings.isThisPageOptimizedForSearch),
746
+ supportedModes: ['navigation', 'snapshot'],
747
+ userMetric: Host.UserMetrics.LighthouseCategoryUsed.SEO,
788
748
  },
749
+ ];
750
+ }
751
+ return presets;
752
+ }
753
+
754
+ let runtimeSettings: LighthouseModel.RunTypes.RuntimeSetting[]|null = null;
755
+ export function getRuntimeSettings(): LighthouseModel.RunTypes.RuntimeSetting[] {
756
+ if (!runtimeSettings) {
757
+ runtimeSettings = [
789
758
  {
790
- label: i18nLazyString(UIStrings.snapshot),
791
- tooltip: i18nLazyString(UIStrings.snapshotTooltip),
792
- value: 'snapshot',
759
+ setting: Common.Settings.Settings.instance().createSetting(
760
+ 'lighthouse.device-type', 'mobile', Common.Settings.SettingStorageType.SYNCED),
761
+ title: i18nLazyString(UIStrings.applyMobileEmulation),
762
+ description: i18nLazyString(UIStrings.applyMobileEmulationDuring),
763
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
764
+ // See Audits.AuditsPanel._setupEmulationAndProtocolConnection()
765
+ flags.formFactor = value;
766
+ },
767
+ options: [
768
+ {
769
+ label: i18nLazyString(UIStrings.mobile),
770
+ tooltip: i18nLazyString(UIStrings.applyMobileEmulationDuring),
771
+ value: 'mobile'
772
+ },
773
+ {
774
+ label: i18nLazyString(UIStrings.desktop),
775
+ tooltip: i18nLazyString(UIStrings.applyDesktopEmulationDuring),
776
+ value: 'desktop'
777
+ },
778
+ ],
793
779
  },
794
- ],
795
- learnMore: 'https://github.com/GoogleChrome/lighthouse/blob/HEAD/docs/user-flows.md' as
796
- Platform.DevToolsPath.UrlString,
797
- },
798
- {
799
- // This setting is disabled, but we keep it around to show in the UI.
800
- setting: Common.Settings.Settings.instance().createSetting(
801
- 'lighthouse.throttling', 'simulate', Common.Settings.SettingStorageType.SYNCED),
802
- title: i18nLazyString(UIStrings.throttlingMethod),
803
- // We will disable this when we have a Lantern trace viewer within DevTools.
804
- learnMore:
805
- 'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling' as
806
- Platform.DevToolsPath.UrlString,
807
- description: i18nLazyString(UIStrings.simulateASlowerPageLoadBasedOn),
808
- setFlags: (flags: Flags, value: string|boolean) => {
809
- if (typeof value === 'string') {
810
- flags.throttlingMethod = value;
811
- } else {
812
- flags.throttlingMethod = value ? 'simulate' : 'devtools';
813
- }
814
- },
815
- options: [
816
- {label: i18nLazyString(UIStrings.simulatedThrottling), value: 'simulate'},
817
- {label: i18nLazyString(UIStrings.devtoolsThrottling), value: 'devtools'},
818
- ],
819
- },
820
- {
821
- setting: Common.Settings.Settings.instance().createSetting(
822
- 'lighthouse.clear-storage', true, Common.Settings.SettingStorageType.SYNCED),
823
- title: i18nLazyString(UIStrings.clearStorage),
824
- description: i18nLazyString(UIStrings.resetStorageLocalstorage),
825
- setFlags: (flags: Flags, value: string|boolean) => {
826
- flags.disableStorageReset = !value;
827
- },
828
- },
829
- {
830
- setting: Common.Settings.Settings.instance().createSetting(
831
- 'lighthouse.enable-sampling', false, Common.Settings.SettingStorageType.SYNCED),
832
- title: i18nLazyString(UIStrings.enableSampling),
833
- description: i18nLazyString(UIStrings.enableJavaScriptSampling),
834
- setFlags: (flags: Flags, value: string|boolean) => {
835
- if (value) {
836
- flags.additionalTraceCategories = 'disabled-by-default-v8.cpu_profiler';
837
- } else {
838
- flags.additionalTraceCategories = '';
839
- }
840
- },
841
- },
842
- ];
780
+ {
781
+ setting: Common.Settings.Settings.instance().createSetting(
782
+ 'lighthouse.mode', 'navigation', Common.Settings.SettingStorageType.SYNCED),
783
+ title: i18nLazyString(UIStrings.lighthouseMode),
784
+ description: i18nLazyString(UIStrings.runLighthouseInMode),
785
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
786
+ flags.mode = value;
787
+ },
788
+ options: [
789
+ {
790
+ label: i18nLazyString(UIStrings.navigation),
791
+ tooltip: i18nLazyString(UIStrings.navigationTooltip),
792
+ value: 'navigation',
793
+ },
794
+ {
795
+ label: i18nLazyString(UIStrings.timespan),
796
+ tooltip: i18nLazyString(UIStrings.timespanTooltip),
797
+ value: 'timespan',
798
+ },
799
+ {
800
+ label: i18nLazyString(UIStrings.snapshot),
801
+ tooltip: i18nLazyString(UIStrings.snapshotTooltip),
802
+ value: 'snapshot',
803
+ },
804
+ ],
805
+ learnMore: 'https://github.com/GoogleChrome/lighthouse/blob/HEAD/docs/user-flows.md' as
806
+ Platform.DevToolsPath.UrlString,
807
+ },
808
+ {
809
+ // This setting is disabled, but we keep it around to show in the UI.
810
+ setting: Common.Settings.Settings.instance().createSetting(
811
+ 'lighthouse.throttling', 'simulate', Common.Settings.SettingStorageType.SYNCED),
812
+ title: i18nLazyString(UIStrings.throttlingMethod),
813
+ // We will disable this when we have a Lantern trace viewer within DevTools.
814
+ learnMore:
815
+ 'https://github.com/GoogleChrome/lighthouse/blob/master/docs/throttling.md#devtools-lighthouse-panel-throttling' as
816
+ Platform.DevToolsPath.UrlString,
817
+ description: i18nLazyString(UIStrings.simulateASlowerPageLoadBasedOn),
818
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
819
+ if (typeof value === 'string') {
820
+ flags.throttlingMethod = value;
821
+ } else {
822
+ flags.throttlingMethod = value ? 'simulate' : 'devtools';
823
+ }
824
+ },
825
+ options: [
826
+ {label: i18nLazyString(UIStrings.simulatedThrottling), value: 'simulate'},
827
+ {label: i18nLazyString(UIStrings.devtoolsThrottling), value: 'devtools'},
828
+ ],
829
+ },
830
+ {
831
+ setting: Common.Settings.Settings.instance().createSetting(
832
+ 'lighthouse.clear-storage', true, Common.Settings.SettingStorageType.SYNCED),
833
+ title: i18nLazyString(UIStrings.clearStorage),
834
+ description: i18nLazyString(UIStrings.resetStorageLocalstorage),
835
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
836
+ flags.disableStorageReset = !value;
837
+ },
838
+ },
839
+ {
840
+ setting: Common.Settings.Settings.instance().createSetting(
841
+ 'lighthouse.enable-sampling', false, Common.Settings.SettingStorageType.SYNCED),
842
+ title: i18nLazyString(UIStrings.enableSampling),
843
+ description: i18nLazyString(UIStrings.enableJavaScriptSampling),
844
+ setFlags: (flags: LighthouseModel.RunTypes.Flags, value: string|boolean) => {
845
+ if (value) {
846
+ flags.additionalTraceCategories = 'disabled-by-default-v8.cpu_profiler';
847
+ } else {
848
+ flags.additionalTraceCategories = '';
849
+ }
850
+ },
851
+ },
852
+ ];
853
+ }
854
+ return runtimeSettings;
855
+ }
843
856
 
844
857
  export enum Events {
845
858
  /* eslint-disable @typescript-eslint/naming-convention -- Used by web_tests. */
@@ -866,26 +879,3 @@ export interface EventTypes {
866
879
  [Events.PageWarningsChanged]: PageWarningsChangedEvent;
867
880
  [Events.AuditProgressChanged]: AuditProgressChangedEvent;
868
881
  }
869
-
870
- export type CategoryId = 'performance'|'accessibility'|'best-practices'|'seo';
871
-
872
- export interface Preset {
873
- setting: Common.Settings.Setting<boolean>;
874
- configID: CategoryId;
875
- title: () => Common.UIString.LocalizedString;
876
- description: () => Common.UIString.LocalizedString;
877
- supportedModes: string[];
878
- userMetric: Host.UserMetrics.LighthouseCategoryUsed;
879
- }
880
- export interface RuntimeSetting {
881
- setting: Common.Settings.Setting<string|boolean>;
882
- description: () => Common.UIString.LocalizedString;
883
- setFlags: (flags: Flags, value: string|boolean) => void;
884
- options?: Array<{
885
- label: () => Common.UIString.LocalizedString,
886
- value: string,
887
- tooltip?: () => Common.UIString.LocalizedString,
888
- }>;
889
- title?: () => Common.UIString.LocalizedString;
890
- learnMore?: Platform.DevToolsPath.UrlString;
891
- }
@@ -13,7 +13,6 @@ import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
13
13
 
14
14
  import {
15
15
  type AuditProgressChangedEvent,
16
- type CategoryId,
17
16
  Events,
18
17
  LighthouseController,
19
18
  type PageAuditabilityChangedEvent,
@@ -153,7 +152,7 @@ export class LighthousePanel extends UI.Panel.Panel {
153
152
  }
154
153
  }
155
154
 
156
- async handleCompleteRun(overrides?: RunOverrides):
155
+ async handleCompleteRun(overrides?: LighthouseModel.RunTypes.RunOverrides):
157
156
  Promise<{report: LighthouseModel.ReporterTypes.ReportJSON | null}> {
158
157
  try {
159
158
  await this.controller.startLighthouse(overrides);
@@ -290,9 +289,10 @@ export class LighthousePanel extends UI.Panel.Panel {
290
289
  }
291
290
 
292
291
  private renderStatusView(): void {
293
- const inspectedURL = this.controller.getCurrentRun()?.inspectedURL;
292
+ const currentRun = this.controller.getCurrentRun();
294
293
  this.contentElement.classList.toggle('in-progress', true);
295
- this.statusView.setInspectedURL(inspectedURL);
294
+ this.statusView.setInspectedURL(currentRun?.inspectedURL);
295
+ this.statusView.setAIControlled(Boolean(currentRun?.isAIControlled));
296
296
  this.statusView.show(this.contentElement);
297
297
  }
298
298
 
@@ -392,7 +392,7 @@ export class LighthousePanel extends UI.Panel.Panel {
392
392
  }
393
393
 
394
394
  static async executeLighthouseRecording(
395
- overrides?: RunOverrides,
395
+ overrides?: LighthouseModel.RunTypes.RunOverrides,
396
396
  ): Promise<LighthouseModel.ReporterTypes.ReportJSON|null> {
397
397
  const panel = LighthousePanel.instance();
398
398
  await UI.ViewManager.ViewManager.instance().showView('lighthouse');
@@ -401,7 +401,3 @@ export class LighthousePanel extends UI.Panel.Panel {
401
401
  return report;
402
402
  }
403
403
  }
404
-
405
- export interface RunOverrides {
406
- categoryIds: CategoryId[];
407
- }
@@ -55,6 +55,7 @@ export interface LighthouseRun {
55
55
  formFactor: (string|undefined),
56
56
  mode: string,
57
57
  };
58
+ isAIControlled?: boolean;
58
59
  }
59
60
 
60
61
  /**
@@ -1,6 +1,7 @@
1
1
  // Copyright 2018 The Chromium Authors
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
+ /* eslint-disable @devtools/no-lit-render-outside-of-view */
4
5
 
5
6
  import * as Common from '../../core/common/common.js';
6
7
  import * as Host from '../../core/host/host.js';
@@ -13,6 +14,7 @@ import * as LighthouseReport from '../../third_party/lighthouse/report/report.js
13
14
  import * as Components from '../../ui/legacy/components/utils/utils.js';
14
15
  import * as UI from '../../ui/legacy/legacy.js';
15
16
  import * as ThemeSupport from '../../ui/legacy/theme_support/theme_support.js';
17
+ import {html, nothing, render} from '../../ui/lit/lit.js';
16
18
  import * as VisualLogging from '../../ui/visual_logging/visual_logging.js';
17
19
  import * as PanelsCommon from '../common/common.js';
18
20
 
@@ -154,24 +156,25 @@ export class LighthouseReportRenderer {
154
156
 
155
157
  const screenshotElement = origHTMLElement.querySelector('.lh-element-screenshot');
156
158
  origHTMLElement.textContent = '';
157
- if (screenshotElement) {
158
- origHTMLElement.append(screenshotElement);
159
- }
160
- origHTMLElement.appendChild(element);
159
+ render(html`${screenshotElement ?? nothing}${element}`, origHTMLElement);
161
160
  }
162
161
  }
163
162
 
164
163
  static async linkifySourceLocationDetails(el: Element): Promise<void> {
165
164
  for (const origElement of el.getElementsByClassName('lh-source-location')) {
166
165
  const origHTMLElement = origElement as HTMLElement;
167
- const detailsItem = origHTMLElement.dataset as LighthouseModel.ReporterTypes.SourceLocationDetailsJSON;
166
+ const detailsItem = origHTMLElement.dataset as {
167
+ sourceUrl?: Platform.DevToolsPath.UrlString,
168
+ sourceLine?: string,
169
+ sourceColumn?: string,
170
+ };
168
171
  if (!detailsItem.sourceUrl || !detailsItem.sourceLine || !detailsItem.sourceColumn) {
169
172
  continue;
170
173
  }
171
174
  const url = detailsItem.sourceUrl;
172
175
  const line = Number(detailsItem.sourceLine);
173
176
  const column = Number(detailsItem.sourceColumn);
174
- const element = await Components.Linkifier.Linkifier.linkifyURL(url, {
177
+ const element = Components.Linkifier.Linkifier.linkifyURL(url, {
175
178
  lineNumber: line,
176
179
  columnNumber: column,
177
180
  showColumnNumber: false,
@@ -8,12 +8,13 @@ import '../../ui/legacy/legacy.js';
8
8
  import type * as Common from '../../core/common/common.js';
9
9
  import * as i18n from '../../core/i18n/i18n.js';
10
10
  import type * as Platform from '../../core/platform/platform.js';
11
+ import type * as LHModel from '../../models/lighthouse/lighthouse.js';
11
12
  import * as Buttons from '../../ui/components/buttons/buttons.js';
12
13
  import {Link} from '../../ui/kit/kit.js';
13
14
  import * as UI from '../../ui/legacy/legacy.js';
14
15
  import {Directives, html, render} from '../../ui/lit/lit.js';
15
16
 
16
- import {type LighthouseController, type Preset, Presets, RuntimeSettings} from './LighthouseController.js';
17
+ import {getPresets, getRuntimeSettings, type LighthouseController} from './LighthouseController.js';
17
18
  import type {LighthousePanel} from './LighthousePanel.js';
18
19
  import lighthouseStartViewStyles from './lighthouseStartView.css.js';
19
20
  import {RadioSetting} from './RadioSetting.js';
@@ -135,7 +136,7 @@ export class StartView extends UI.Widget.Widget {
135
136
  private startButton!: Buttons.Button.Button;
136
137
  private helpText?: Element;
137
138
  private warningText?: Element;
138
- private checkboxes: Array<{preset: Preset, checkbox: UI.Toolbar.ToolbarCheckbox}> = [];
139
+ private checkboxes: Array<{preset: LHModel.RunTypes.Preset, checkbox: UI.Toolbar.ToolbarCheckbox}> = [];
139
140
 
140
141
  changeFormMode?: (mode: string) => void;
141
142
 
@@ -151,7 +152,7 @@ export class StartView extends UI.Widget.Widget {
151
152
  }
152
153
 
153
154
  private populateRuntimeSettingAsRadio(settingName: string, label: string, parentElement: Element): void {
154
- const runtimeSetting = RuntimeSettings.find(item => item.setting.name === settingName);
155
+ const runtimeSetting = getRuntimeSettings().find(item => item.setting.name === settingName);
155
156
  if (!runtimeSetting?.options) {
156
157
  throw new Error(`${settingName} is not a setting with options`);
157
158
  }
@@ -175,7 +176,7 @@ export class StartView extends UI.Widget.Widget {
175
176
  }
176
177
 
177
178
  private populateRuntimeSettingAsToolbarCheckbox(settingName: string, toolbar: UI.Toolbar.Toolbar): void {
178
- const runtimeSetting = RuntimeSettings.find(item => item.setting.name === settingName);
179
+ const runtimeSetting = getRuntimeSettings().find(item => item.setting.name === settingName);
179
180
  if (!runtimeSetting?.title) {
180
181
  throw new Error(`${settingName} is not a setting with a title`);
181
182
  }
@@ -193,7 +194,7 @@ export class StartView extends UI.Widget.Widget {
193
194
  }
194
195
 
195
196
  private populateRuntimeSettingAsToolbarDropdown(settingName: string, toolbar: UI.Toolbar.Toolbar): void {
196
- const runtimeSetting = RuntimeSettings.find(item => item.setting.name === settingName);
197
+ const runtimeSetting = getRuntimeSettings().find(item => item.setting.name === settingName);
197
198
  if (!runtimeSetting?.title) {
198
199
  throw new Error(`${settingName} is not a setting with a title`);
199
200
  }
@@ -225,7 +226,7 @@ export class StartView extends UI.Widget.Widget {
225
226
  // Populate the categories
226
227
 
227
228
  this.checkboxes = [];
228
- for (const preset of Presets) {
229
+ for (const preset of getPresets()) {
229
230
  preset.setting.setTitle(preset.title());
230
231
  const checkbox = new UI.Toolbar.ToolbarSettingCheckbox(preset.setting, preset.description());
231
232
  const row = categoryFormElements.createChild('div', 'vbox lighthouse-launcher-row');