chrome-devtools-frontend 1.0.1732418 → 1.0.1732697

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. package/docs/get_the_code.md +1 -73
  2. package/front_end/Tests.js +0 -5
  3. package/front_end/core/host/AidaClientTypes.ts +19 -2
  4. package/front_end/core/sdk/DOMModel.ts +8 -3
  5. package/front_end/entrypoints/formatter_worker/ScopeParser.ts +2 -2
  6. package/front_end/generated/SupportedCSSProperties.ts +2 -2
  7. package/front_end/models/ai-utils/debug.ts +127 -22
  8. package/front_end/models/ai_assistance/README.md +1 -1
  9. package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -5
  10. package/front_end/models/ai_assistance/contexts/DOMNodeContext.ts +4 -3
  11. package/front_end/models/ai_assistance/contexts/LighthouseContext.snapshot.txt +4 -2
  12. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.snapshot.txt +6 -0
  13. package/front_end/models/ai_assistance/data_formatters/LighthouseFormatter.ts +2 -0
  14. package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +1 -1
  15. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +26 -26
  16. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -1
  17. package/front_end/models/ai_code_completion/ai_code_completion.ts +11 -2
  18. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -1
  19. package/front_end/models/ai_code_generation/ai_code_generation.ts +11 -2
  20. package/front_end/models/trace/LanternComputationData.ts +4 -0
  21. package/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +126 -1
  22. package/front_end/models/trace/lantern/types/Lantern.ts +3 -0
  23. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +32 -0
  24. package/front_end/panels/ai_assistance/ExternalHandler.ts +1 -1
  25. package/front_end/panels/ai_assistance/components/PermissionPrompt.ts +4 -4
  26. package/front_end/panels/ai_assistance/components/chatMessage.css +3 -4
  27. package/front_end/panels/ai_assistance/components/exploreWidget.css +2 -2
  28. package/front_end/panels/application/components/reportsGrid.css +1 -1
  29. package/front_end/panels/application/components/serviceWorkerRouterView.css +2 -2
  30. package/front_end/panels/application/components/trustTokensView.css +1 -1
  31. package/front_end/panels/application/indexedDBViews.css +0 -4
  32. package/front_end/panels/application/resourcesPanel.css +0 -9
  33. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +3 -3
  34. package/front_end/panels/application/serviceWorkersView.css +3 -2
  35. package/front_end/panels/comments/CommentsPane.ts +2 -11
  36. package/front_end/panels/common/CommentThreadWidget.ts +11 -3
  37. package/front_end/panels/console/consoleContextSelector.css +1 -1
  38. package/front_end/panels/console/consolePinPane.css +1 -1
  39. package/front_end/panels/console/consolePrompt.css +4 -2
  40. package/front_end/panels/elements/ComputedStyleWidget.ts +8 -19
  41. package/front_end/panels/elements/PropertyRenderer.ts +7 -27
  42. package/front_end/panels/elements/StylePropertyTreeElement.ts +61 -72
  43. package/front_end/panels/elements/components/elementsBreadcrumbs.css +1 -1
  44. package/front_end/panels/elements/metricsSidebarPane.css +2 -2
  45. package/front_end/panels/elements/propertiesWidget.css +0 -5
  46. package/front_end/panels/emulation/deviceModeView.css +3 -3
  47. package/front_end/panels/event_listeners/eventListenersView.css +1 -1
  48. package/front_end/panels/explain/components/consoleInsight.css +2 -2
  49. package/front_end/panels/issues/issuesTree.css +6 -4
  50. package/front_end/panels/layer_viewer/layerTreeOutline.css +1 -1
  51. package/front_end/panels/lighthouse/lighthousePanel.css +1 -1
  52. package/front_end/panels/linear_memory_inspector/components/valueInterpreterDisplay.css +1 -1
  53. package/front_end/panels/media/playerListView.css +8 -4
  54. package/front_end/panels/media/playerMessagesView.css +9 -5
  55. package/front_end/panels/network/NetworkWaterfallColumn.ts +92 -55
  56. package/front_end/panels/network/networkConfigView.css +3 -3
  57. package/front_end/panels/network/networkLogView.css +5 -4
  58. package/front_end/panels/network/networkManageCustomHeadersView.css +1 -1
  59. package/front_end/panels/network/networkTimingTable.css +4 -4
  60. package/front_end/panels/network/requestPayloadView.css +1 -1
  61. package/front_end/panels/performance_monitor/performanceMonitor.css +1 -1
  62. package/front_end/panels/profiler/ModuleUIStrings.ts +12 -0
  63. package/front_end/panels/protocol_monitor/JSONEditor.css +4 -3
  64. package/front_end/panels/recorder/createRecordingView.css +2 -2
  65. package/front_end/panels/recorder/stepView.css +0 -7
  66. package/front_end/panels/recorder/timelineSection.css +1 -1
  67. package/front_end/panels/screencast/screencastView.css +1 -1
  68. package/front_end/panels/security/mainView.css +1 -1
  69. package/front_end/panels/security/originView.css +1 -1
  70. package/front_end/panels/sources/breakpointsView.css +3 -3
  71. package/front_end/panels/sources/watchExpressionsSidebarPane.css +2 -1
  72. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +30 -10
  73. package/front_end/panels/timeline/components/networkRequestTooltip.css +2 -2
  74. package/front_end/panels/timeline/components/relatedInsightChips.css +1 -1
  75. package/front_end/panels/timeline/timelineFlameChartView.css +4 -4
  76. package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -2
  77. package/front_end/panels/timeline/timelineMiniMap.css +2 -1
  78. package/front_end/third_party/chromium/README.chromium +1 -1
  79. package/front_end/ui/components/buttons/button.css +0 -1
  80. package/front_end/ui/components/diff_view/diffView.css +1 -1
  81. package/front_end/ui/components/markdown_view/codeBlock.css +3 -3
  82. package/front_end/ui/components/markdown_view/markdownView.css +2 -2
  83. package/front_end/ui/components/panel_feedback/panelFeedback.css +3 -2
  84. package/front_end/ui/components/suggestion_input/suggestionInput.css +2 -2
  85. package/front_end/ui/legacy/components/inline_editor/colorSwatch.css +1 -2
  86. package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -1
  87. package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
  88. package/front_end/ui/legacy/components/perf_ui/flameChart.css +5 -3
  89. package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +7 -4
  90. package/front_end/ui/legacy/components/perf_ui/pieChart.css +0 -1
  91. package/front_end/ui/legacy/components/utils/imagePreview.css +1 -1
  92. package/front_end/ui/legacy/inspectorCommon.css +8 -25
  93. package/front_end/ui/legacy/progressIndicator.css +1 -2
  94. package/front_end/ui/legacy/reportView.css +4 -1
  95. package/front_end/ui/legacy/searchableView.css +1 -1
  96. package/front_end/ui/legacy/tabbedPane.css +7 -4
  97. package/front_end/ui/legacy/treeoutline.css +1 -1
  98. package/front_end/ui/legacy/viewContainers.css +1 -1
  99. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -0
  100. package/package.json +1 -1
  101. package/front_end/models/ai_code_completion/debug.ts +0 -33
  102. package/front_end/models/ai_code_generation/debug.ts +0 -33
@@ -8,7 +8,7 @@ In order to make changes to DevTools frontend, build, run, test, and submit chan
8
8
 
9
9
  As a standalone project, Chrome DevTools frontend can be checked out and built independently from Chromium. The main advantage is not having to check out and build Chromium.
10
10
 
11
- However, to run layout tests, you need to use the [chromium checkout](#Chromium-checkout) or [integrated checkout](#Integrated-checkout).
11
+ However, to run layout tests, you need to use the [Chromium checkout](#Chromium-checkout).
12
12
 
13
13
  ### Checking out source
14
14
 
@@ -452,75 +452,3 @@ ended up on. If you switch back and forth across the revision that moved
452
452
  `node_modules/` out of git, `gclient sync` repairs the directory on its own
453
453
  (`ensure_node_modules` hook); in the worst case it asks you to run it once
454
454
  more.
455
-
456
- ## Integrated checkout
457
-
458
- **This solution is experimental, please report any trouble that you run into!**
459
-
460
- The integrated workflow offers the best of both worlds, and allows for working
461
- on both Chromium and DevTools frontend side-by-side.
462
-
463
- A full [Chromium checkout](#Chromium-checkout) is a pre-requisite for the
464
- following steps.
465
-
466
- ### Untrack the existing devtools-frontend submodule
467
-
468
- First, you need to untrack the existing devtools-frontend submodule in the chromium checkout. This ensures that devtools
469
- isn't dragged along whenever you update your chromium dependencies.
470
-
471
- In `chromium/src`, run `gclient sync` to make sure you have installed all required submodules.
472
-
473
- ```bash
474
- gclient sync
475
- ```
476
-
477
- Then, disable `gclient sync` for DevTools frontend inside of Chromium by editing `.gclient` config. From
478
- `chromium/src/`, run
479
-
480
- ```bash
481
- vim "$(gclient root)/.gclient"
482
- ```
483
-
484
- In the `custom_deps` section, insert this line:
485
-
486
- ```python
487
- "src/third_party/devtools-frontend/src": None,
488
- ```
489
-
490
- For the integrated checkout, create a single gclient project that automatically `gclient sync`s all dependencies for both
491
- repositories. After checking out chromium, modify the `.gclient` file for `chromium/src` to add the DevTools project:
492
-
493
- ```python
494
- solutions = [
495
- {
496
- # Chromium src project
497
- "name": "src",
498
- "url": "https://chromium.googlesource.com/chromium/src.git",
499
- "custom_deps": {
500
- "src/third_party/devtools-frontend/src": None,
501
- },
502
- },
503
- {
504
- # devtools-frontend project
505
- "name": "devtools-frontend",
506
- "managed": False,
507
- "url": "https://chromium.googlesource.com/devtools/devtools-frontend.git",
508
- }
509
- ]
510
- ```
511
-
512
- Do not run `gclient sync` now, first create the symlink. In the same directory as the .gclient file, run:
513
-
514
- ```bash
515
- ln -s src/third_party/devtools-frontend/src devtools-frontend
516
- ```
517
-
518
- If you did run `gclient sync` first, remove the devtools-frontend directory and start over.
519
-
520
- Run `gclient sync` after creating the link to fetch the dependencies for the standalone checkout.
521
-
522
- ### Known issues
523
-
524
- - GN/Siso wrappers in `depot_tools` don't assume the side-by-side solutions, and
525
- always use the binaries in Chromium. Please make sure updating Chromium when
526
- you get a build error.
@@ -251,11 +251,6 @@
251
251
  * @param panelName Name of the panel to show.
252
252
  */
253
253
  TestSuite.prototype.showPanel = function(panelName) {
254
- // TODO(crbug.com/518066451): Remove fallback once https://crrev.com/c/8702200
255
- // lands in chromium/src (see https://crrev.com/c/8704657).
256
- if (!UI.ViewManager.ViewManager.instance().hasView(panelName)) {
257
- return this.showExtensionSidebarPane(panelName);
258
- }
259
254
  return UI.InspectorView.InspectorView.instance().showPanel(panelName);
260
255
  };
261
256
 
@@ -65,7 +65,7 @@ export interface FunctionPrimitiveParams extends BaseFunctionParam {
65
65
 
66
66
  export interface FunctionArrayParam extends BaseFunctionParam {
67
67
  type: ParametersTypes.ARRAY;
68
- items: FunctionPrimitiveParams;
68
+ items: FunctionPrimitiveParams|FunctionObjectParam;
69
69
  }
70
70
 
71
71
  export interface FunctionObjectParam<T extends string|number|symbol = string> extends BaseFunctionParam {
@@ -475,8 +475,25 @@ export interface AidaChunkResponse {
475
475
  error?: string|Record<string, unknown>;
476
476
  }
477
477
 
478
+ // Reads `devToolsAiDebug` directly because `core/host` cannot depend on `models/ai-utils`.
479
+ function isGcaDebugMode(): boolean {
480
+ try {
481
+ const raw = Platform.HostRuntime.HOST_RUNTIME.getLocalStorage()?.getItem('devToolsAiDebug');
482
+ if (!raw) {
483
+ return false;
484
+ }
485
+ const parsed: unknown = JSON.parse(raw);
486
+ if (typeof parsed !== 'object' || parsed === null) {
487
+ return false;
488
+ }
489
+ return Boolean((parsed as Record<string, unknown>).gca);
490
+ } catch {
491
+ return false;
492
+ }
493
+ }
494
+
478
495
  export function debugLog(...log: unknown[]): void {
479
- if (!Boolean(Platform.HostRuntime.HOST_RUNTIME.getLocalStorage()?.getItem('debugAiServicesEnabled'))) {
496
+ if (!isGcaDebugMode()) {
480
497
  return;
481
498
  }
482
499
 
@@ -1308,10 +1308,15 @@ export class DOMNode extends Common.ObjectWrapper.ObjectWrapper<DOMNodeEventType
1308
1308
  }
1309
1309
 
1310
1310
  async saveNodeToTempVariable(): Promise<void> {
1311
- const remoteObjectForConsole = await this.resolveToObject();
1311
+ const runtimeModel = this.#domModel.runtimeModel();
1312
+ const frameId = this.frameId() ?? this.ownerDocument?.frameId();
1313
+ const executionContext =
1314
+ (frameId ? runtimeModel.executionContexts().find(context => context.frameId === frameId && context.isDefault) :
1315
+ null) ??
1316
+ runtimeModel.defaultExecutionContext();
1317
+ const remoteObjectForConsole = await this.resolveToObject(undefined, executionContext?.id);
1312
1318
  const consoleModel = this.#domModel.target().model(ConsoleModel);
1313
- await consoleModel?.saveToTempVariable(remoteObjectForConsole?.runtimeModel().defaultExecutionContext() ?? null,
1314
- remoteObjectForConsole);
1319
+ await consoleModel?.saveToTempVariable(executionContext, remoteObjectForConsole);
1315
1320
  }
1316
1321
 
1317
1322
  async scrollIntoView(): Promise<void> {
@@ -275,7 +275,7 @@ export class ScopeVariableAnalysis {
275
275
  mappingLocationsForFunctionDeclaration(node, this.#sourceText));
276
276
  this.#addVariable('this', node.start, DefinitionKind.FIXED);
277
277
  this.#addVariable('arguments', node.start, DefinitionKind.FIXED);
278
- node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.LET, false));
278
+ node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.VAR, false));
279
279
  // Process the body of the block statement directly to avoid creating new scope.
280
280
  node.body.body.forEach(this.#processNode.bind(this));
281
281
  this.#popScope(true);
@@ -288,7 +288,7 @@ export class ScopeVariableAnalysis {
288
288
  this.#methodName = undefined;
289
289
  this.#addVariable('this', node.start, DefinitionKind.FIXED);
290
290
  this.#addVariable('arguments', node.start, DefinitionKind.FIXED);
291
- node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.LET, false));
291
+ node.params.forEach(this.#processNodeAsDefinition.bind(this, DefinitionKind.VAR, false));
292
292
  // Process the body of the block statement directly to avoid creating new scope.
293
293
  node.body.body.forEach(this.#processNode.bind(this));
294
294
  this.#popScope(true);
@@ -4214,9 +4214,9 @@ export const generatedProperties: CSSProperty[] = [
4214
4214
  "thin"
4215
4215
  ],
4216
4216
  "longhands": [
4217
- "outline-color",
4217
+ "outline-width",
4218
4218
  "outline-style",
4219
- "outline-width"
4219
+ "outline-color"
4220
4220
  ],
4221
4221
  "name": "outline"
4222
4222
  },
@@ -3,23 +3,86 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  /**
6
- * @file Local debugging utilities.
6
+ * @file Local debugging utilities for DevTools AI subsystems.
7
7
  */
8
8
 
9
- export function isDebugMode(): boolean {
9
+ import * as Platform from '../../core/platform/platform.js';
10
+
11
+ export const DEVTOOLS_AI_DEBUG_STORAGE_KEY = 'devToolsAiDebug';
12
+
13
+ /**
14
+ * Configuration options for enabling DevTools AI debug logging in the console.
15
+ * Passed to `window.setDevToolsAIDebug(config)` and persisted in `localStorage`.
16
+ */
17
+ export interface DevToolsAIDebugConfig {
18
+ /**
19
+ * Enables console debug logging and structured log persistence for DevTools AI
20
+ * Assistance (`AiAgent`, `AiAgent2`, `AiUtils`, and `panels/ai_assistance/`).
21
+ */
22
+ assistance?: boolean;
23
+ /**
24
+ * Enables console debug logging for the AIDA and GCA host client and
25
+ * request/response translation layer (`AidaClient`, `GcaClient`, and
26
+ * `AidaGcaTranslation`).
27
+ */
28
+ gca?: boolean;
29
+ /**
30
+ * Enables console debug logging for AI Code Completion and AI Code Generation
31
+ * (`AiCodeCompletion` and `AiCodeGeneration`), replacing the separate
32
+ * `debug.ts` helpers in `models/ai_code_completion/` and
33
+ * `models/ai_code_generation/`.
34
+ */
35
+ codeGenComplete?: boolean;
36
+ }
37
+
38
+ /**
39
+ * Reads the persisted DevTools AI debug configuration from `localStorage`.
40
+ */
41
+ export function getDevToolsAIDebugConfig(): Required<DevToolsAIDebugConfig> {
10
42
  try {
11
- return Boolean(localStorage.getItem('debugAiAssistancePanelEnabled'));
43
+ const raw = Platform.HostRuntime.HOST_RUNTIME.getLocalStorage()?.getItem(DEVTOOLS_AI_DEBUG_STORAGE_KEY);
44
+ if (!raw) {
45
+ return {assistance: false, gca: false, codeGenComplete: false};
46
+ }
47
+ const parsed: unknown = JSON.parse(raw);
48
+ if (typeof parsed !== 'object' || parsed === null) {
49
+ return {assistance: false, gca: false, codeGenComplete: false};
50
+ }
51
+ const record = parsed as Record<string, unknown>;
52
+ return {
53
+ assistance: Boolean(record.assistance),
54
+ gca: Boolean(record.gca),
55
+ codeGenComplete: Boolean(record.codeGenComplete),
56
+ };
12
57
  } catch {
13
- return false;
58
+ return {assistance: false, gca: false, codeGenComplete: false};
14
59
  }
15
60
  }
16
61
 
17
- export function isStructuredLogEnabled(): boolean {
62
+ /**
63
+ * Merges `config` into the persisted `devToolsAiDebug` object in `localStorage`
64
+ * and logs the resulting state to the console.
65
+ */
66
+ export function setDevToolsAIDebug(config: DevToolsAIDebugConfig = {}): Required<DevToolsAIDebugConfig> {
67
+ const current = getDevToolsAIDebugConfig();
68
+ const nextConfig: Required<DevToolsAIDebugConfig> = {
69
+ assistance: config.assistance ?? current.assistance,
70
+ gca: config.gca ?? current.gca,
71
+ codeGenComplete: config.codeGenComplete ?? current.codeGenComplete,
72
+ };
73
+ const storage = Platform.HostRuntime.HOST_RUNTIME.getLocalStorage();
18
74
  try {
19
- return Boolean(localStorage.getItem('aiAssistanceStructuredLogEnabled'));
75
+ storage?.setItem(DEVTOOLS_AI_DEBUG_STORAGE_KEY, JSON.stringify(nextConfig));
20
76
  } catch {
21
- return false;
77
+ // Ignore storage write errors in restricted contexts.
22
78
  }
79
+ // eslint-disable-next-line no-console
80
+ console.log('DevTools AI debug config:', nextConfig);
81
+ return nextConfig;
82
+ }
83
+
84
+ export function isDebugMode(): boolean {
85
+ return getDevToolsAIDebugConfig().assistance;
23
86
  }
24
87
 
25
88
  export function debugLog(...log: unknown[]): void {
@@ -31,23 +94,65 @@ export function debugLog(...log: unknown[]): void {
31
94
  console.log(...log);
32
95
  }
33
96
 
34
- function setDebugAiAssistanceEnabled(enabled: boolean): void {
35
- if (enabled) {
36
- localStorage.setItem('debugAiAssistancePanelEnabled', 'true');
37
- } else {
38
- localStorage.removeItem('debugAiAssistancePanelEnabled');
39
- }
40
- setAiAssistanceStructuredLogEnabled(enabled);
97
+ export function isCodeGenCompleteDebugMode(): boolean {
98
+ return getDevToolsAIDebugConfig().codeGenComplete;
41
99
  }
42
- // @ts-expect-error
43
- globalThis.setDebugAiAssistanceEnabled = setDebugAiAssistanceEnabled;
44
100
 
45
- function setAiAssistanceStructuredLogEnabled(enabled: boolean): void {
46
- if (enabled) {
47
- localStorage.setItem('aiAssistanceStructuredLogEnabled', 'true');
48
- } else {
49
- localStorage.removeItem('aiAssistanceStructuredLogEnabled');
101
+ export function debugCodeGenCompleteLog(...log: unknown[]): void {
102
+ if (!isCodeGenCompleteDebugMode()) {
103
+ return;
50
104
  }
105
+
106
+ // eslint-disable-next-line no-console
107
+ console.log(...log);
51
108
  }
52
- // @ts-expect-error
109
+
110
+ /**
111
+ * @deprecated Use `setDevToolsAIDebug({assistance: enabled, gca: enabled})` instead.
112
+ */
113
+ export function setDebugAiAssistanceEnabled(enabled: boolean): void {
114
+ console.warn('setDebugAiAssistanceEnabled is deprecated and will be removed soon. ' +
115
+ `Use setDevToolsAIDebug({assistance: ${Boolean(enabled)}, gca: ${Boolean(enabled)}}) instead.`);
116
+ setDevToolsAIDebug({assistance: Boolean(enabled), gca: Boolean(enabled)});
117
+ }
118
+
119
+ /**
120
+ * @deprecated Use `setDevToolsAIDebug({assistance: enabled})` instead.
121
+ */
122
+ export function setAiAssistanceStructuredLogEnabled(enabled: boolean): void {
123
+ console.warn('setAiAssistanceStructuredLogEnabled is deprecated and will be removed soon. ' +
124
+ `Use setDevToolsAIDebug({assistance: ${Boolean(enabled)}}) instead.`);
125
+ setDevToolsAIDebug({assistance: Boolean(enabled)});
126
+ }
127
+
128
+ /**
129
+ * @deprecated Use `setDevToolsAIDebug({codeGenComplete: enabled})` instead.
130
+ */
131
+ export function setDebugAiCodeCompletionEnabled(enabled: boolean): void {
132
+ console.warn('setDebugAiCodeCompletionEnabled is deprecated and will be removed soon. ' +
133
+ `Use setDevToolsAIDebug({codeGenComplete: ${Boolean(enabled)}}) instead.`);
134
+ setDevToolsAIDebug({codeGenComplete: Boolean(enabled)});
135
+ }
136
+
137
+ /**
138
+ * @deprecated Use `setDevToolsAIDebug({codeGenComplete: enabled})` instead.
139
+ */
140
+ export function setDebugAiCodeGenerationEnabled(enabled: boolean): void {
141
+ console.warn('setDebugAiCodeGenerationEnabled is deprecated and will be removed soon. ' +
142
+ `Use setDevToolsAIDebug({codeGenComplete: ${Boolean(enabled)}}) instead.`);
143
+ setDevToolsAIDebug({codeGenComplete: Boolean(enabled)});
144
+ }
145
+
146
+ declare global {
147
+ var setDevToolsAIDebug: (config?: DevToolsAIDebugConfig) => Required<DevToolsAIDebugConfig>;
148
+ var setDebugAiAssistanceEnabled: (enabled: boolean) => void;
149
+ var setAiAssistanceStructuredLogEnabled: (enabled: boolean) => void;
150
+ var setDebugAiCodeCompletionEnabled: (enabled: boolean) => void;
151
+ var setDebugAiCodeGenerationEnabled: (enabled: boolean) => void;
152
+ }
153
+
154
+ globalThis.setDevToolsAIDebug = setDevToolsAIDebug;
155
+ globalThis.setDebugAiAssistanceEnabled = setDebugAiAssistanceEnabled;
53
156
  globalThis.setAiAssistanceStructuredLogEnabled = setAiAssistanceStructuredLogEnabled;
157
+ globalThis.setDebugAiCodeCompletionEnabled = setDebugAiCodeCompletionEnabled;
158
+ globalThis.setDebugAiCodeGenerationEnabled = setDebugAiCodeGenerationEnabled;
@@ -139,7 +139,7 @@ To aid debugging, you can enable the AI Assistance logging. This setting is stor
139
139
  1. Load up your local DevTools in Canary
140
140
  2. Load the AI Assistance Panel
141
141
  3. Open DevTools on DevTools.
142
- 4. In the console, run `setDebugAiAssistanceEnabled(true)`.
142
+ 4. In the console, run `setDevToolsAIDebug({assistance: true})`.
143
143
 
144
144
  Now, when interacting with the AI and sending requests, you will see output logged to the console. You can use the `debugLog` helper to add your own logging as you are building out your feature.
145
145
 
@@ -3,7 +3,7 @@
3
3
  // found in the LICENSE file.
4
4
 
5
5
  import * as Host from '../../../core/host/host.js';
6
- import type * as Platform from '../../../core/platform/platform.js';
6
+ import * as Platform from '../../../core/platform/platform.js';
7
7
  import * as Root from '../../../core/root/root.js';
8
8
  import * as SDK from '../../../core/sdk/sdk.js';
9
9
  import type * as TextUtils from '../../../core/text_utils/text_utils.js';
@@ -22,7 +22,7 @@ import {
22
22
  type ToolName,
23
23
  } from '../tools/Tool.js';
24
24
 
25
- const {debugLog, isStructuredLogEnabled} = AiUtils.Debug;
25
+ const {debugLog, isDebugMode} = AiUtils.Debug;
26
26
 
27
27
  type UrlString = Platform.DevToolsPath.UrlString;
28
28
  const MAX_SUGGESTION_LENGTH = 200;
@@ -239,6 +239,7 @@ export interface SideEffectResponse extends ToolCallEvent {
239
239
  confirm: (decision: PermissionDecision) => void;
240
240
  permissionPrompt?: PermissionPrompt;
241
241
  permissionTitle?: string;
242
+ toolName?: string;
242
243
  }
243
244
 
244
245
  /**
@@ -1155,7 +1156,7 @@ export abstract class AiAgent<T> {
1155
1156
  request = this.buildRequest(outcome.functionResponses, Host.AidaClient.Role.ROLE_UNSPECIFIED);
1156
1157
  }
1157
1158
 
1158
- if (isStructuredLogEnabled()) {
1159
+ if (isDebugMode()) {
1159
1160
  dispatchAiAssistanceDoneEvent();
1160
1161
  }
1161
1162
  return;
@@ -1178,6 +1179,8 @@ export abstract class AiAgent<T> {
1178
1179
  rpcId: Host.AidaClient.RpcGlobalId|undefined,
1179
1180
  ): AsyncGenerator<ResponseData, void, void> {
1180
1181
  if (!textResponse) {
1182
+ debugLog('[AiAgent] Model returned an empty text response without tool calls:',
1183
+ {step: stepIndex + 1, rpcId, functionCalls});
1181
1184
  yield this.#createErrorResponse(ErrorType.UNKNOWN);
1182
1185
  return;
1183
1186
  }
@@ -1457,6 +1460,7 @@ export abstract class AiAgent<T> {
1457
1460
  javascriptCode,
1458
1461
  permissionPrompt: call.permissionPrompt,
1459
1462
  permissionTitle: call.permissionTitle,
1463
+ toolName: name,
1460
1464
  };
1461
1465
 
1462
1466
  let decision = PermissionDecision.REJECT;
@@ -1560,13 +1564,14 @@ export abstract class AiAgent<T> {
1560
1564
  };
1561
1565
  }
1562
1566
 
1563
- if (isStructuredLogEnabled() && aidaResponse) {
1567
+ if (isDebugMode() && aidaResponse) {
1564
1568
  this.#structuredLog.push({
1565
1569
  request: structuredClone(request),
1566
1570
  aidaResponse,
1567
1571
  });
1568
1572
  try {
1569
- localStorage.setItem('aiAssistanceStructuredLog', JSON.stringify(this.#structuredLog));
1573
+ Platform.HostRuntime.HOST_RUNTIME.getLocalStorage()?.setItem('aiAssistanceStructuredLog',
1574
+ JSON.stringify(this.#structuredLog));
1570
1575
  } catch (err) {
1571
1576
  console.warn('Failed to write to local storage "aiAssistanceStructuredLog":', err);
1572
1577
  }
@@ -127,16 +127,17 @@ ${await this.describe()}`;
127
127
  const textChildNodes = childNodes.filter(childNode => childNode.nodeType() === SDK.DOMModel.NodeType.TEXT_NODE);
128
128
  const elementChildNodes =
129
129
  childNodes.filter(childNode => childNode.nodeType() === SDK.DOMModel.NodeType.ELEMENT_NODE);
130
+ const formattedChildren =
131
+ elementChildNodes.map(node => `\`${node.simpleSelector()}\` (uid=${node.backendNodeId()})`).join(', ');
130
132
  switch (elementChildNodes.length) {
131
133
  case 0:
132
134
  output += '\n* It doesn\'t have any child element nodes';
133
135
  break;
134
136
  case 1:
135
- output += `\n* It only has 1 child element node: \`${elementChildNodes[0].simpleSelector()}\``;
137
+ output += `\n* It only has 1 child element node: ${formattedChildren}`;
136
138
  break;
137
139
  default:
138
- output += `\n* It has ${elementChildNodes.length} child element nodes: ${
139
- elementChildNodes.map(node => `\`${node.simpleSelector()}\` (uid=${node.backendNodeId()})`).join(', ')}`;
140
+ output += `\n* It has ${elementChildNodes.length} child element nodes: ${formattedChildren}`;
140
141
  }
141
142
 
142
143
  switch (textChildNodes.length) {
@@ -10,6 +10,7 @@ Lighthouse Version: 1.0.0
10
10
  - Accessibility: 50
11
11
 
12
12
  ## Failing audits
13
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
13
14
 
14
15
  ### Accessibility (categoryId: "accessibility")
15
16
  - Accessibility Audit: 50
@@ -25,7 +26,7 @@ Content:
25
26
  [
26
27
  {
27
28
  "title": "Lighthouse report",
28
- "text": "# Lighthouse Report:\n# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50\n# Audits for Accessibility\n\nThe following audits in this category have a score below 90 and may need attention:\n- **Accessibility Audit**: 50 (Fail)\n * Description of accessibility audit"
29
+ "text": "# Lighthouse Report:\n# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\nOnly audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50\n# Audits for Accessibility\n\nThe following audits in this category have a score below 90 and may need attention:\n- **Accessibility Audit**: 50 (Fail)\n * Description of accessibility audit"
29
30
  }
30
31
  ]
31
32
  === end content
@@ -41,6 +42,7 @@ Lighthouse Version: 1.0.0
41
42
  - Accessibility: 50
42
43
 
43
44
  ## Failing audits
45
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
44
46
 
45
47
  ### Accessibility (categoryId: "accessibility")
46
48
  - Accessibility Audit: 50
@@ -51,7 +53,7 @@ Content:
51
53
  [
52
54
  {
53
55
  "title": "Lighthouse report",
54
- "text": "# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50"
56
+ "text": "# Lighthouse Report Summary\nURL: https://example.com\nFetch Time: 2026-03-12\nLighthouse Version: 1.0.0\n\n## Category Scores\n- Accessibility: 50\n\n## Failing audits\nOnly audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.\n\n### Accessibility (categoryId: \"accessibility\")\n- Accessibility Audit: 50"
55
57
  }
56
58
  ]
57
59
  === end content
@@ -10,6 +10,7 @@ Lighthouse Version: 12.0.0
10
10
  - Accessibility: 100
11
11
 
12
12
  ## Failing audits
13
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
13
14
 
14
15
  ### Performance (categoryId: "performance")
15
16
  - First Audit: 80
@@ -197,6 +198,7 @@ Mode: navigation
197
198
  - Agentic Browsing: 1/2 audits passed
198
199
 
199
200
  ## Failing audits
201
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
200
202
 
201
203
  ### Performance (categoryId: "performance")
202
204
  - First Audit: 80
@@ -216,6 +218,7 @@ Lighthouse Version: 12.0.0
216
218
  - Performance: 50
217
219
 
218
220
  ## Failing audits
221
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
219
222
 
220
223
  ### Performance (categoryId: "performance")
221
224
  - First Audit: 80
@@ -232,6 +235,7 @@ The following audits in this category errored:
232
235
  * An audit that threw an error during execution.
233
236
  * Error: Audit execution timed out
234
237
  === end content
238
+
235
239
  Title: LighthouseFormatter excludes hidden audits
236
240
  Content:
237
241
  # Lighthouse Report Summary
@@ -243,6 +247,7 @@ Lighthouse Version: 12.0.0
243
247
  - Performance: 100
244
248
 
245
249
  ## Failing audits
250
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
246
251
 
247
252
  ### Performance (categoryId: "performance")
248
253
  - No failing audits.
@@ -325,6 +330,7 @@ Lighthouse Version: 12.0.0
325
330
  - Performance: 80
326
331
 
327
332
  ## Failing audits
333
+ Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.
328
334
 
329
335
  ### Agentic Browsing (categoryId: "agentic-browsing")
330
336
  - No audits scored below 90, but these informative audits report findings:
@@ -58,6 +58,8 @@ export class LighthouseFormatter {
58
58
  }
59
59
  lines.push('');
60
60
  lines.push('## Failing audits');
61
+ lines.push(
62
+ 'Only audit titles and scores are listed below. Load the `lighthouse` skill and call `getLighthouseAudits` with the relevant `categoryId` to retrieve full audit descriptions, diagnostics, and failing elements.');
61
63
  for (const [categoryId, category] of Object.entries(report.categories)) {
62
64
  lines.push('');
63
65
  lines.push(`### ${category.title} (categoryId: "${categoryId}")`);
@@ -950,7 +950,7 @@ Increasing the image compression factor could improve this image’s download si
950
950
  - Optimizations:
951
951
  This image file is larger than it needs to be (2048x1356) for its displayed dimensions (200x132). Use responsive images to reduce the image download size. (Est 41.4 kB)
952
952
 
953
- ## Estimated savings: FCP 0 ms, LCP 100 ms
953
+ ## Estimated savings: FCP 0 ms, LCP 0 ms
954
954
 
955
955
  ## External resources:
956
956
  - https://developer.chrome.com/docs/performance/insights/image-delivery
@@ -478,19 +478,6 @@ Metrics (lab / observed):
478
478
  - CLS: 0.31, event: (eventKey: c-13074, ts: 59729100192)
479
479
  Metrics (field / real users): n/a – no data for this page in CrUX
480
480
  Available insights:
481
- - insight name: Cache
482
- description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
483
- relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
484
- estimated metric savings: FCP 0 ms, LCP 150 ms
485
- estimated wasted bytes: 971.5 kB
486
- example question: What caching strategies can I apply to improve my page performance?
487
- - insight name: ImageDelivery
488
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
489
- relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
490
- estimated metric savings: FCP 0 ms, LCP 100 ms
491
- estimated wasted bytes: 2 MB
492
- example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
493
- example question: Are all images on my site optimized?
494
481
  - insight name: LCPBreakdown
495
482
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
496
483
  relevant trace bounds: {min: 59728649746µs, max: 59729312744µs}
@@ -508,6 +495,13 @@ Available insights:
508
495
  relevant trace bounds: {min: 59729100192µs, max: 59730317334µs}
509
496
  example question: Help me optimize my CLS score
510
497
  example question: How can I prevent layout shifts on this page?
498
+ - insight name: ImageDelivery
499
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
500
+ relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
501
+ estimated metric savings: FCP 0 ms, LCP 0 ms
502
+ estimated wasted bytes: 2 MB
503
+ example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
504
+ example question: Are all images on my site optimized?
511
505
  - insight name: DocumentLatency
512
506
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
513
507
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -524,6 +518,12 @@ Available insights:
524
518
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page’s content.
525
519
  relevant trace bounds: {min: 59728701403µs, max: 59729465969µs}
526
520
  example question: Which third parties are having the largest impact on my page performance?
521
+ - insight name: Cache
522
+ description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
523
+ relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
524
+ estimated metric savings: FCP 0 ms, LCP 0 ms
525
+ estimated wasted bytes: 971.5 kB
526
+ example question: What caching strategies can I apply to improve my page performance?
527
527
  - insight name: CharacterSet
528
528
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
529
529
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -562,19 +562,6 @@ Metrics (field / real users):
562
562
  - The scope indicates if the data came from the entire origin, or a specific url
563
563
  - Lab metrics describe how this specific page load performed, while field metrics are an aggregation of results from real-world users. Best practice is to prioritize metrics that are bad in field data. Lab metrics may be better or worse than fields metrics depending on the developer's machine, network, or the actions performed while tracing.
564
564
  Available insights:
565
- - insight name: Cache
566
- description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
567
- relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
568
- estimated metric savings: FCP 0 ms, LCP 150 ms
569
- estimated wasted bytes: 971.5 kB
570
- example question: What caching strategies can I apply to improve my page performance?
571
- - insight name: ImageDelivery
572
- description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
573
- relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
574
- estimated metric savings: FCP 0 ms, LCP 100 ms
575
- estimated wasted bytes: 2 MB
576
- example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
577
- example question: Are all images on my site optimized?
578
565
  - insight name: LCPBreakdown
579
566
  description: Each [subpart has specific improvement strategies](https://developer.chrome.com/docs/performance/insights/lcp-breakdown). Ideally, most of the LCP time should be spent on loading the resources, not within delays.
580
567
  relevant trace bounds: {min: 59728649746µs, max: 59729312744µs}
@@ -592,6 +579,13 @@ Available insights:
592
579
  relevant trace bounds: {min: 59729100192µs, max: 59730317334µs}
593
580
  example question: Help me optimize my CLS score
594
581
  example question: How can I prevent layout shifts on this page?
582
+ - insight name: ImageDelivery
583
+ description: Reducing the download time of images can improve the perceived load time of the page and LCP. [Learn more about optimizing image size](https://developer.chrome.com/docs/performance/insights/image-delivery).
584
+ relevant trace bounds: {min: 59728701403µs, max: 59729395208µs}
585
+ estimated metric savings: FCP 0 ms, LCP 0 ms
586
+ estimated wasted bytes: 2 MB
587
+ example question: What should I do to improve and optimize the time taken to fetch and display images on the page?
588
+ example question: Are all images on my site optimized?
595
589
  - insight name: DocumentLatency
596
590
  description: Your first network request is the most important. [Reduce its latency](https://developer.chrome.com/docs/performance/insights/document-latency) by avoiding redirects, ensuring a fast server response, and enabling text compression.
597
591
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}
@@ -608,6 +602,12 @@ Available insights:
608
602
  description: 3rd party code can significantly impact load performance. [Reduce and defer loading of 3rd party code](https://developer.chrome.com/docs/performance/insights/third-parties) to prioritize your page’s content.
609
603
  relevant trace bounds: {min: 59728701403µs, max: 59729465969µs}
610
604
  example question: Which third parties are having the largest impact on my page performance?
605
+ - insight name: Cache
606
+ description: A long cache lifetime can speed up repeat visits to your page. [Learn more about caching](https://developer.chrome.com/docs/performance/insights/cache).
607
+ relevant trace bounds: {min: 59728702014µs, max: 59728867430µs}
608
+ estimated metric savings: FCP 0 ms, LCP 0 ms
609
+ estimated wasted bytes: 971.5 kB
610
+ example question: What caching strategies can I apply to improve my page performance?
611
611
  - insight name: CharacterSet
612
612
  description: A character encoding declaration is required. It can be done with a meta charset tag in the first 1024 bytes of the HTML or in the Content-Type HTTP response header. [Learn more about declaring the character encoding](https://developer.chrome.com/docs/insights/charset/).
613
613
  relevant trace bounds: {min: 59728651057µs, max: 59728790724µs}