chrome-devtools-frontend 1.0.1608868 → 1.0.1611099

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 (59) hide show
  1. package/eslint.config.mjs +3 -1
  2. package/front_end/core/host/AidaGcaTranslation.ts +13 -0
  3. package/front_end/core/sdk/PreloadingModel.ts +1 -1
  4. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +1 -1
  5. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -11
  6. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotWorkerDispatcher.ts +1 -1
  7. package/front_end/generated/InspectorBackendCommands.ts +1 -2
  8. package/front_end/generated/SupportedCSSProperties.js +23 -4
  9. package/front_end/generated/protocol-mapping.d.ts +0 -9
  10. package/front_end/generated/protocol-proxy-api.d.ts +0 -7
  11. package/front_end/generated/protocol.ts +0 -20
  12. package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +12 -3
  13. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +5 -4
  14. package/front_end/models/ai_assistance/agents/ConversationSummaryAgent.ts +24 -1
  15. package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
  16. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +41 -22
  17. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +2 -2
  18. package/front_end/models/ai_assistance/agents/StylingAgent.ts +5 -3
  19. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +10 -5
  20. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +69 -69
  21. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -1
  22. package/front_end/models/javascript_metadata/NativeFunctions.js +8 -12
  23. package/front_end/models/live-metrics/LiveMetrics.ts +43 -41
  24. package/front_end/models/trace/EntityMapper.ts +12 -0
  25. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +7 -9
  26. package/front_end/panels/ai_assistance/components/ChatMessage.ts +66 -34
  27. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +1 -1
  28. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +1 -0
  29. package/front_end/panels/ai_assistance/components/chatMessage.css +15 -0
  30. package/front_end/panels/ai_assistance/components/walkthroughView.css +5 -4
  31. package/front_end/panels/application/ApplicationPanelSidebar.ts +8 -0
  32. package/front_end/panels/application/IndexedDBViews.ts +1 -1
  33. package/front_end/panels/application/ResourcesPanel.ts +8 -0
  34. package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
  35. package/front_end/panels/application/application-meta.ts +11 -0
  36. package/front_end/panels/application/application.ts +1 -0
  37. package/front_end/panels/application/components/StorageMetadataView.ts +31 -7
  38. package/front_end/panels/application/components/backForwardCacheView.css +4 -0
  39. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +29 -0
  40. package/front_end/panels/elements/ElementsTreeElement.ts +4 -0
  41. package/front_end/panels/lighthouse/LighthousePanel.ts +3 -1
  42. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +1 -1
  43. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +1 -1
  44. package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
  45. package/front_end/panels/timeline/TimelinePanel.ts +2 -6
  46. package/front_end/panels/timeline/utils/Helpers.ts +1 -1
  47. package/front_end/third_party/chromium/README.chromium +1 -1
  48. package/front_end/ui/legacy/InspectorDrawerView.ts +188 -15
  49. package/front_end/ui/legacy/InspectorView.ts +162 -11
  50. package/front_end/ui/legacy/TabbedPane.ts +2 -2
  51. package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +54 -0
  52. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  53. package/front_end/ui/visual_logging/LoggingDriver.ts +3 -3
  54. package/mcp/mcp.ts +2 -1
  55. package/package.json +4 -5
  56. /package/front_end/models/{heap_snapshot_model → heap_snapshot}/ChildrenProvider.ts +0 -0
  57. /package/front_end/models/{heap_snapshot_model → heap_snapshot}/HeapSnapshotModel.ts +0 -0
  58. /package/front_end/models/{heap_snapshot_model → heap_snapshot}/HeapSnapshotProxy.ts +0 -0
  59. /package/front_end/models/{heap_snapshot_model/heap_snapshot_model.ts → heap_snapshot/heap_snapshot.ts} +0 -0
@@ -141,7 +141,8 @@ Note: if the user asks a specific question about the trace (such as "What is my
141
141
  - Use the provided functions to get detailed performance data. Prioritize functions that provide context relevant to the performance issue being investigated.
142
142
  - Before finalizing your advice, look over it and validate using any relevant functions. If something seems off, refine the advice before giving it to the user.
143
143
  - Base your analysis and advice solely on the data retrieved through the provided functions. Always use the provided functions to gather sufficient data when needed.
144
- - Use the track summary functions to get high-level detail about portions of the trace. For the \`bounds\` parameter, default to using the bounds of the trace. Never specifically ask the user for a bounds. You can use more narrow bounds (such as the bounds relevant to a specific insight) when appropriate. Narrow the bounds given functions when possible.
144
+ - Use absolute microsecond timestamps for any function that requires a \`min\` and \`max\` bounds. These timestamps can be found in the trace summary or within the details of an insight.
145
+ - Example: If the trace bounds are {min: 1000, max: 5000} and you want to investigate a specific interaction that happened between 2000 and 3000, you should call \`getMainThreadTrackSummary({min: 2000, max: 3000})\`.
145
146
  - Use \`getEventByKey\` to get data on a specific trace event. This is great for root-cause analysis or validating any assumptions.
146
147
  - Provide clear, actionable recommendations. Avoid technical jargon unless necessary, and explain any technical terms used.
147
148
  - If you see a generic task like "Task", "Evaluate script" or "(anonymous)" in the main thread activity, try to look at its children to see what actual functions are executed and refer to those. When referencing the main thread activity, be as specific as you can. Ensure you identify to the user relevant functions and which script they were defined in. Avoid referencing "Task", "Evaluate script" and "(anonymous)" nodes if possible and instead focus on their children.
@@ -922,13 +923,11 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
922
923
  });
923
924
 
924
925
  const createBounds =
925
- (min: Trace.Types.Timing.Micro, max: Trace.Types.Timing.Micro): Trace.Types.Timing.TraceWindowMicro|null => {
926
- if (min > max) {
927
- return null;
928
- }
926
+ (min?: Trace.Types.Timing.Micro, max?: Trace.Types.Timing.Micro): Trace.Types.Timing.TraceWindowMicro|null => {
927
+ const {min: bMin, max: bMax} = parsedTrace.data.Meta.traceBounds;
928
+ const clampedMin = Math.max(min ?? bMin, bMin);
929
+ const clampedMax = Math.min(max ?? bMax, bMax);
929
930
 
930
- const clampedMin = Math.max(min ?? 0, parsedTrace.data.Meta.traceBounds.min);
931
- const clampedMax = Math.min(max ?? Number.POSITIVE_INFINITY, parsedTrace.data.Meta.traceBounds.max);
932
931
  if (clampedMin > clampedMax) {
933
932
  return null;
934
933
  }
@@ -937,7 +936,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
937
936
  clampedMin as Trace.Types.Timing.Micro, clampedMax as Trace.Types.Timing.Micro);
938
937
  };
939
938
 
940
- this.declareFunction<{min: Trace.Types.Timing.Micro, max: Trace.Types.Timing.Micro}, {
939
+ this.declareFunction<{min?: Trace.Types.Timing.Micro, max?: Trace.Types.Timing.Micro}, {
941
940
  summary: string,
942
941
  }>('getMainThreadTrackSummary', {
943
942
  description:
@@ -949,21 +948,25 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
949
948
  properties: {
950
949
  min: {
951
950
  type: Host.AidaClient.ParametersTypes.INTEGER,
952
- description: 'The minimum time of the bounds, in microseconds',
953
- nullable: false,
951
+ description: `The minimum time of the bounds, in microseconds (the current trace starts at ${
952
+ parsedTrace.data.Meta.traceBounds.min})`,
953
+ nullable: true,
954
954
  },
955
955
  max: {
956
956
  type: Host.AidaClient.ParametersTypes.INTEGER,
957
- description: 'The maximum time of the bounds, in microseconds',
958
- nullable: false,
957
+ description: `The maximum time of the bounds, in microseconds (the current trace ends at ${
958
+ parsedTrace.data.Meta.traceBounds.max})`,
959
+ nullable: true,
959
960
  },
960
961
  },
961
- required: ['min', 'max']
962
+ required: []
962
963
  },
963
964
  displayInfoFromArgs: args => {
965
+ const min = args.min ?? parsedTrace.data.Meta.traceBounds.min;
966
+ const max = args.max ?? parsedTrace.data.Meta.traceBounds.max;
964
967
  return {
965
968
  title: lockedString(UIStringsNotTranslated.mainThreadActivity),
966
- action: `getMainThreadTrackSummary({min: ${args.min}, max: ${args.max}})`
969
+ action: `getMainThreadTrackSummary({min: ${min}, max: ${max}})`
967
970
  };
968
971
  },
969
972
  handler: async args => {
@@ -1019,7 +1022,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1019
1022
  });
1020
1023
 
1021
1024
  this.declareFunction<
1022
- {min: Trace.Types.Timing.Micro, max: Trace.Types.Timing.Micro}, {summary: string}>('getNetworkTrackSummary', {
1025
+ {min?: Trace.Types.Timing.Micro, max?: Trace.Types.Timing.Micro}, {summary: string}>('getNetworkTrackSummary', {
1023
1026
  description: 'Returns a summary of the network for the given bounds.',
1024
1027
  parameters: {
1025
1028
  type: Host.AidaClient.ParametersTypes.OBJECT,
@@ -1028,21 +1031,25 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1028
1031
  properties: {
1029
1032
  min: {
1030
1033
  type: Host.AidaClient.ParametersTypes.INTEGER,
1031
- description: 'The minimum time of the bounds, in microseconds',
1032
- nullable: false,
1034
+ description: `The minimum time of the bounds, in microseconds (the current trace starts at ${
1035
+ parsedTrace.data.Meta.traceBounds.min})`,
1036
+ nullable: true,
1033
1037
  },
1034
1038
  max: {
1035
1039
  type: Host.AidaClient.ParametersTypes.INTEGER,
1036
- description: 'The maximum time of the bounds, in microseconds',
1037
- nullable: false,
1040
+ description: `The maximum time of the bounds, in microseconds (the current trace ends at ${
1041
+ parsedTrace.data.Meta.traceBounds.max})`,
1042
+ nullable: true,
1038
1043
  },
1039
1044
  },
1040
- required: ['min', 'max']
1045
+ required: []
1041
1046
  },
1042
1047
  displayInfoFromArgs: args => {
1048
+ const min = args.min ?? parsedTrace.data.Meta.traceBounds.min;
1049
+ const max = args.max ?? parsedTrace.data.Meta.traceBounds.max;
1043
1050
  return {
1044
1051
  title: lockedString(UIStringsNotTranslated.networkActivitySummary),
1045
- action: `getNetworkTrackSummary({min: ${args.min}, max: ${args.max}})`
1052
+ action: `getNetworkTrackSummary({min: ${min}, max: ${max}})`
1046
1053
  };
1047
1054
  },
1048
1055
  handler: async args => {
@@ -1117,7 +1124,19 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
1117
1124
 
1118
1125
  const key = `getDetailedCallTree(${args.eventKey})`;
1119
1126
  this.#cacheFunctionResult(focus, key, callTree);
1120
- return {result: {callTree}};
1127
+
1128
+ const {startTime, endTime} = Trace.Helpers.Timing.eventTimingsMicroSeconds(event);
1129
+ const bounds = Trace.Helpers.Timing.traceWindowFromMicroSeconds(startTime, endTime);
1130
+
1131
+ const widgets: AiWidget[] = [{
1132
+ name: 'BOTTOM_UP_TREE',
1133
+ data: {
1134
+ bounds,
1135
+ parsedTrace,
1136
+ },
1137
+ }];
1138
+
1139
+ return {result: {callTree}, widgets};
1121
1140
  },
1122
1141
 
1123
1142
  });
@@ -57,7 +57,7 @@ Content:
57
57
  "function_declarations": [
58
58
  {
59
59
  "name": "getStyles",
60
- "description": "Get computed and source styles for one or multiple elements on the inspected page for multiple elements at once by uid.\n\n**CRITICAL** An element uid is a number, not a selector.\n**CRITICAL** Use selectors to refer to elements in the text output. Do not use uids.\n**CRITICAL** Always provide the explanation argument to explain what and why you query.",
60
+ "description": "Get computed and source styles for one or multiple elements on the inspected page for multiple elements at once by uid.\n\n**CRITICAL** An element uid is a number, not a selector.\n**CRITICAL** Use selectors to refer to elements in the text output. Do not use uids.\n**CRITICAL** Always provide the explanation argument to explain what and why you query.\n**CRITICAL** You MUST provide a specific list of CSS property names. Do not use generic values like \"all\" or \"*\".",
61
61
  "parameters": {
62
62
  "type": 6,
63
63
  "description": "",
@@ -79,7 +79,7 @@ Content:
79
79
  },
80
80
  "styleProperties": {
81
81
  "type": 5,
82
- "description": "One or more CSS style property names to fetch.",
82
+ "description": "One or more specific CSS style property names to fetch. Generic values like \"all\" or \"*\" are not supported.",
83
83
  "nullable": false,
84
84
  "items": {
85
85
  "type": 1,
@@ -75,7 +75,7 @@ First, examine the provided context, then use the functions to gather additional
75
75
  * Use the precision of Strunk & White, the brevity of Hemingway, and the simple clarity of Vonnegut. Don't add repeated information, and keep the whole answer short.
76
76
  * **CRITICAL** NEVER write full Python programs - you should only write individual statements that invoke a single function from the provided library.
77
77
  * **CRITICAL** NEVER output text before a function call. Always do a function call first.
78
- * **CRITICAL** When answering questions about positioning or layout, ALWAYS inspect \`position\`, \`display\` and ALL related properties.
78
+ * **CRITICAL** When answering questions about positioning or layout, ALWAYS inspect \`position\`, \`display\` and all other related properties. You MUST provide a specific list of CSS property names when calling functions to get styles. Do not use generic values like "all" or "*".
79
79
  * **CRITICAL** You are a CSS/DOM/HTML debugging assistant. NEVER provide answers to questions of unrelated topics such as legal advice, financial advice, personal opinions, medical advice, religion, race, politics, sexuality, gender, or any other non web-development topics. Answer "Sorry, I can't answer that. I'm best at questions about debugging web pages." to such questions.
80
80
 
81
81
  ## Response Structure
@@ -308,7 +308,8 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
308
308
 
309
309
  **CRITICAL** An element uid is a number, not a selector.
310
310
  **CRITICAL** Use selectors to refer to elements in the text output. Do not use uids.
311
- **CRITICAL** Always provide the explanation argument to explain what and why you query.`,
311
+ **CRITICAL** Always provide the explanation argument to explain what and why you query.
312
+ **CRITICAL** You MUST provide a specific list of CSS property names. Do not use generic values like "all" or "*".`,
312
313
  parameters: {
313
314
  type: Host.AidaClient.ParametersTypes.OBJECT,
314
315
  description: '',
@@ -327,7 +328,8 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
327
328
  },
328
329
  styleProperties: {
329
330
  type: Host.AidaClient.ParametersTypes.ARRAY,
330
- description: 'One or more CSS style property names to fetch.',
331
+ description:
332
+ 'One or more specific CSS style property names to fetch. Generic values like "all" or "*" are not supported.',
331
333
  nullable: false,
332
334
  items: {
333
335
  type: Host.AidaClient.ParametersTypes.STRING,
@@ -17,7 +17,7 @@ const MAX_BODY_SIZE = 10000;
17
17
  /**
18
18
  * Sanitizes the set of headers, removing values that are not on the allow-list and replacing them with '<redacted>'.
19
19
  */
20
- function sanitizeHeaders(headers: Array<{name: string, value: string}>): Array<{name: string, value: string}> {
20
+ export function sanitizeHeaders(headers: Array<{name: string, value: string}>): Array<{name: string, value: string}> {
21
21
  return headers.map(header => {
22
22
  if (NetworkRequestFormatter.allowHeader(header.name)) {
23
23
  return header;
@@ -69,11 +69,16 @@ export class NetworkRequestFormatter {
69
69
  }
70
70
 
71
71
  static formatInitiatorUrl(initiatorUrl: string, allowedOrigin: string): string {
72
- const initiatorOrigin = new URL(initiatorUrl).origin;
73
- if (initiatorOrigin === allowedOrigin) {
74
- return initiatorUrl;
72
+ try {
73
+ // Some scheme or URLs might cause errors depending on the runtime environment.
74
+ const initiatorOrigin = new URL(initiatorUrl).origin;
75
+ if (initiatorOrigin === allowedOrigin) {
76
+ return initiatorUrl;
77
+ }
78
+ return '<redacted cross-origin initiator URL>';
79
+ } catch {
80
+ return '<redacted cross-origin initiator URL>';
75
81
  }
76
- return '<redacted cross-origin initiator URL>';
77
82
  }
78
83
 
79
84
  static formatStatus(status: {