chrome-devtools-frontend 1.0.1613465 → 1.0.1614363

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 (65) hide show
  1. package/.agents/skills/verification/SKILL.md +5 -1
  2. package/AUTHORS +1 -0
  3. package/front_end/core/common/VersionController.ts +17 -1
  4. package/front_end/core/host/UserMetrics.ts +0 -1
  5. package/front_end/core/root/ExperimentNames.ts +0 -1
  6. package/front_end/core/sdk/OverlayModel.ts +2 -4
  7. package/front_end/core/sdk/sdk-meta.ts +13 -0
  8. package/front_end/entrypoints/device_mode_emulation_frame/device_mode_emulation_frame.ts +4 -0
  9. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -1
  10. package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -1
  11. package/front_end/entrypoints/main/MainImpl.ts +0 -6
  12. package/front_end/entrypoints/shell/shell.ts +4 -0
  13. package/front_end/entrypoints/trace_app/trace_app.ts +4 -0
  14. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  15. package/front_end/generated/protocol.ts +5 -3
  16. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.snapshot.txt +10 -2
  17. package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +23 -7
  18. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +161 -36
  19. package/front_end/models/ai_assistance/agents/README.md +77 -0
  20. package/front_end/models/heap_snapshot/HeapSnapshotProxy.ts +6 -4
  21. package/front_end/models/javascript_metadata/NativeFunctions.js +673 -639
  22. package/front_end/models/stack_trace/DetailedErrorStackParser.ts +142 -0
  23. package/front_end/models/stack_trace/StackTrace.ts +18 -0
  24. package/front_end/models/stack_trace/StackTraceImpl.ts +96 -4
  25. package/front_end/models/stack_trace/Trie.ts +21 -0
  26. package/front_end/models/stack_trace/stack_trace_impl.ts +2 -0
  27. package/front_end/panels/ai_assistance/components/ChatMessage.ts +13 -3
  28. package/front_end/panels/ai_assistance/components/ChatView.ts +4 -3
  29. package/front_end/panels/ai_assistance/components/ExportForAgentsDialog.ts +6 -2
  30. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +4 -3
  31. package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -2
  32. package/front_end/panels/application/WebMCPView.ts +249 -17
  33. package/front_end/panels/application/components/ProtocolHandlersView.ts +2 -2
  34. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +7 -0
  35. package/front_end/panels/console/ConsoleContextSelector.ts +1 -1
  36. package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -3
  37. package/front_end/panels/css_overview/CSSOverviewModel.ts +1 -2
  38. package/front_end/panels/elements/StylesSidebarPane.ts +3 -1
  39. package/front_end/panels/emulation/DeviceModeToolbar.ts +13 -4
  40. package/front_end/panels/network/RequestConditionsDrawer.ts +4 -2
  41. package/front_end/panels/network/RequestPayloadView.ts +8 -3
  42. package/front_end/panels/network/RequestTimingView.ts +6 -7
  43. package/front_end/panels/performance_monitor/PerformanceMonitor.ts +7 -5
  44. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +1 -1
  45. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +9 -17
  46. package/front_end/panels/protocol_monitor/JSONEditor.ts +29 -3
  47. package/front_end/panels/settings/AISettingsTab.ts +14 -3
  48. package/front_end/third_party/chromium/README.chromium +1 -1
  49. package/front_end/third_party/codemirror/codemirror-tsconfig.json +4 -4
  50. package/front_end/third_party/lighthouse/lighthouse-tsconfig.json +1 -1
  51. package/front_end/tsconfig.json +2 -1
  52. package/front_end/ui/legacy/EmptyWidget.ts +2 -2
  53. package/front_end/ui/legacy/TextPrompt.ts +1 -1
  54. package/front_end/ui/legacy/components/color_picker/ContrastDetails.ts +1 -2
  55. package/front_end/ui/legacy/components/color_picker/ContrastOverlay.ts +4 -5
  56. package/front_end/ui/legacy/components/source_frame/XMLView.ts +12 -7
  57. package/front_end/ui/lit/lit.ts +4 -1
  58. package/front_end/ui/lit/render.ts +81 -0
  59. package/front_end/ui/visual_logging/KnownContextValues.ts +8 -1
  60. package/package.json +1 -1
  61. /package/front_end/third_party/codemirror/package/addon/runmode/{runmode-standalone.mjs.d.ts → runmode-standalone.d.mts} +0 -0
  62. /package/front_end/third_party/codemirror/package/mode/css/{css.mjs.d.ts → css.d.mts} +0 -0
  63. /package/front_end/third_party/codemirror/package/mode/javascript/{javascript.mjs.d.ts → javascript.d.mts} +0 -0
  64. /package/front_end/third_party/codemirror/package/mode/xml/{xml.mjs.d.ts → xml.d.mts} +0 -0
  65. /package/front_end/third_party/lighthouse/report-assets/{report-generator.mjs.d.ts → report-generator.d.mts} +0 -0
@@ -0,0 +1,77 @@
1
+ # AI Agents
2
+
3
+ This directory contains the implementations of various AI agents used in the AI Assistance panel in Chrome DevTools.
4
+
5
+ ## Performance Agent
6
+
7
+ The `PerformanceAgent` analyzes performance traces. This documentation details the specific data provided to the agent and the data it can retrieve via functions.
8
+
9
+ ### Initial Data Provided to the Agent
10
+
11
+ When a conversation starts or the context changes, the agent is provided with a set of "facts" and query enhancements. This data forms the agent's base knowledge about the trace.
12
+
13
+ #### Trace Facts (Initial Context)
14
+
15
+ Facts are text-based data summaries injected into the conversation. The agent receives:
16
+
17
+ - **Data Schema Descriptions**: Text explaining the format of call frame and network data to help the agent interpret subsequent tool outputs.
18
+ - **Environment State**: Flags indicating if the trace is a fresh recording or loaded from an external file.
19
+ - **Trace Summary Data**: A text summary containing key performance metrics (LCP, INP, CLS) and basic trace metadata.
20
+ - **Critical Requests Data**: A text list of the most critical network requests identified in the trace.
21
+ - **Main Thread Activity Data**: A bottom-up aggregated summary of where time was spent on the main thread.
22
+ - **Longest Tasks Data**: A list of the longest tasks found on the main thread.
23
+ - **Third Party Activity Data**: A summary of time spent on third-party scripts.
24
+
25
+ #### Context Selection (Additional initial context)
26
+
27
+ The agent receives additional initial context based on the user's context selection. The context can be a Trace, an Insight, or a specific Event:
28
+
29
+ - **Trace Context**: No additional context is added beyond the base trace facts.
30
+ - **Insight Context**: The agent receives the name and key of the specific performance insight selected.
31
+ - **Event Context**: The agent receives the serialized details of the specific trace event selected.
32
+
33
+
34
+ ### Data Retrieval Functions (Tools)
35
+
36
+ The agent can request additional data by calling functions. Here is the data the agent receives from each function:
37
+
38
+ #### `getInsightDetails`
39
+ - **Arguments**: `insightSetId` (string), `insightName` (string)
40
+ - **Data Returned to Agent**: A detailed text representation of the specific insight (e.g., LCP breakdown components, render-blocking resource URLs).
41
+
42
+ #### `getEventByKey`
43
+ - **Arguments**: `eventKey` (string)
44
+ - **Data Returned to Agent**: The full JSON representation of the specific trace event.
45
+
46
+ #### `getMainThreadTrackSummary`
47
+ - **Arguments**: `min` (integer, optional), `max` (integer, optional)
48
+ - **Data Returned to Agent**: A comprehensive text summary of main thread activity *within the specified bounds*.
49
+ - **Note**: This differs from the initial "Main Thread Activity Data" fact as it is scoped to the provided time range and includes significantly more data: a **top-down tree**, a **bottom-up tree**, a **third-parties summary**, and a list of **related insights** for events in that range.
50
+
51
+ #### `getNetworkTrackSummary`
52
+ - **Arguments**: `min` (integer, optional), `max` (integer, optional)
53
+ - **Data Returned to Agent**: A text summary of network requests and activity within the bounds.
54
+
55
+ #### `getDetailedCallTree`
56
+ - **Arguments**: `eventKey` (string)
57
+ - **Data Returned to Agent**: A detailed call tree representation for the specified event.
58
+
59
+ #### `addElementAnnotation`
60
+ - **Arguments**: `elementId` (string), `annotationMessage` (string)
61
+ - **Data Returned to Agent**: Confirmation of success or an error message. (Note: This function also modifies the DevTools UI by adding a visual annotation).
62
+
63
+ #### `addNetworkRequestAnnotation`
64
+ - **Arguments**: `eventKey` (string), `annotationMessage` (string)
65
+ - **Data Returned to Agent**: Confirmation of success or an error message. (Note: This function also modifies the DevTools UI by adding a visual annotation).
66
+
67
+ #### `getFunctionCode`
68
+ - **Arguments**: `scriptUrl` (string), `line` (integer), `column` (integer)
69
+ - **Data Returned to Agent**: The source code lines for the function, annotated with performance cost per line if available.
70
+
71
+ #### `getResourceContent`
72
+ - **Arguments**: `url` (string)
73
+ - **Data Returned to Agent**: The full text content of the specified resource (e.g., script file).
74
+
75
+ #### `selectEventByKey`
76
+ - **Arguments**: `eventKey` (string)
77
+ - **Data Returned to Agent**: Confirmation of success or an error message. (Note: This function also modifies the DevTools UI by selecting the event in the flamechart).
@@ -17,13 +17,15 @@ export class HeapSnapshotWorkerProxy extends Common.ObjectWrapper.ObjectWrapper<
17
17
  readonly previousCallbacks = new Set<number>();
18
18
  readonly worker: PlatformApi.HostRuntime.Worker;
19
19
  interval?: number;
20
+ readonly workerUrl?: string;
20
21
 
21
- constructor(eventHandler: (arg0: string, arg1: string) => void) {
22
+ constructor(eventHandler: (arg0: string, arg1: string) => void, workerUrl?: string) {
22
23
  super();
23
24
  this.eventHandler = eventHandler;
25
+ this.workerUrl = workerUrl;
24
26
  this.worker = Platform.HostRuntime.HOST_RUNTIME.createWorker(
25
- new URL('../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js', import.meta.url)
26
- .toString());
27
+ workerUrl ?? import.meta.resolve('../../entrypoints/heap_snapshot_worker/heap_snapshot_worker-entrypoint.js'),
28
+ );
27
29
  this.worker.onmessage = this.messageReceived.bind(this);
28
30
  }
29
31
 
@@ -236,7 +238,7 @@ export class HeapSnapshotLoaderProxy extends HeapSnapshotProxyObject implements
236
238
 
237
239
  async close(): Promise<void> {
238
240
  await this.callMethodPromise('close');
239
- const secondWorker = new HeapSnapshotWorkerProxy(() => {});
241
+ const secondWorker = new HeapSnapshotWorkerProxy(() => {}, this.worker.workerUrl);
240
242
  const channel = new MessageChannel();
241
243
  await secondWorker.setupForSecondaryInit(channel.port2);
242
244
  const snapshotProxy = await this.callFactoryMethodPromise('buildSnapshot', HeapSnapshotProxy, [channel.port1]);