chrome-devtools-frontend 1.0.1595925 → 1.0.1596535

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 (129) hide show
  1. package/.stylelintrc.json +3 -1
  2. package/docs/ui_engineering.md +0 -36
  3. package/front_end/core/common/Console.ts +6 -6
  4. package/front_end/core/common/Settings.ts +12 -8
  5. package/front_end/core/host/UserMetrics.ts +0 -1
  6. package/front_end/core/root/DevToolsContext.ts +13 -7
  7. package/front_end/core/root/ExperimentNames.ts +0 -1
  8. package/front_end/core/sdk/CPUThrottlingManager.ts +12 -9
  9. package/front_end/core/sdk/DOMModel.ts +206 -0
  10. package/front_end/core/sdk/FrameManager.ts +7 -8
  11. package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
  12. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +1 -1
  13. package/front_end/entrypoints/greendev_floaty/floaty.css +2 -2
  14. package/front_end/entrypoints/main/MainImpl.ts +1 -7
  15. package/front_end/foundation/Universe.ts +22 -11
  16. package/front_end/generated/InspectorBackendCommands.ts +7 -0
  17. package/front_end/generated/protocol-mapping.d.ts +16 -0
  18. package/front_end/generated/protocol-proxy-api.d.ts +25 -0
  19. package/front_end/generated/protocol.ts +71 -0
  20. package/front_end/models/ai_assistance/AiConversation.ts +6 -95
  21. package/front_end/models/ai_assistance/ConversationHandler.ts +1 -1
  22. package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -1
  23. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +14 -0
  24. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +1 -1
  25. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +3 -0
  26. package/front_end/panels/ai_assistance/components/ChatMessage.ts +73 -35
  27. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +30 -6
  28. package/front_end/panels/ai_assistance/components/chatMessage.css +4 -2
  29. package/front_end/panels/application/IndexedDBModel.ts +2 -4
  30. package/front_end/panels/application/ServiceWorkersView.ts +3 -11
  31. package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
  32. package/front_end/panels/elements/ComputedStyleWidget.ts +25 -16
  33. package/front_end/panels/elements/ElementsPanel.ts +0 -1
  34. package/front_end/panels/elements/StandaloneStylesContainer.ts +48 -12
  35. package/front_end/panels/elements/StylePropertiesSection.ts +97 -1
  36. package/front_end/panels/elements/StylePropertyTreeElement.ts +27 -5
  37. package/front_end/panels/elements/StylesContainer.ts +1 -0
  38. package/front_end/panels/elements/StylesSidebarPane.ts +48 -32
  39. package/front_end/panels/elements/nodeStackTraceWidget.css +1 -1
  40. package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -1
  41. package/front_end/panels/emulation/DeviceModeToolbar.ts +171 -89
  42. package/front_end/panels/greendev/GreenDevPanel.css +2 -2
  43. package/front_end/panels/issues/AffectedPermissionElementsView.ts +9 -6
  44. package/front_end/panels/lighthouse/LighthouseController.ts +13 -5
  45. package/front_end/panels/lighthouse/LighthousePanel.ts +22 -5
  46. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +11 -3
  47. package/front_end/panels/recorder/components/StepView.ts +0 -2
  48. package/front_end/panels/recorder/components/stepView.css +13 -13
  49. package/front_end/panels/recorder/components/timelineSection.css +6 -7
  50. package/front_end/panels/settings/components/SyncSection.ts +4 -13
  51. package/front_end/panels/timeline/CompatibilityTracksAppender.ts +2 -15
  52. package/front_end/panels/timeline/RecordingMetadata.ts +1 -1
  53. package/front_end/panels/timeline/TimelineDetailsView.ts +2 -2
  54. package/front_end/panels/timeline/TimelinePanel.ts +18 -0
  55. package/front_end/panels/timeline/TimelineUIUtils.ts +7 -4
  56. package/front_end/panels/timeline/components/CWVMetrics.ts +339 -0
  57. package/front_end/panels/timeline/components/Sidebar.ts +17 -0
  58. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +10 -0
  59. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +25 -267
  60. package/front_end/panels/timeline/components/Utils.ts +2 -2
  61. package/front_end/panels/timeline/components/components.ts +2 -0
  62. package/front_end/panels/timeline/components/cwvMetrics.css +107 -0
  63. package/front_end/panels/timeline/components/sidebarSingleInsightSet.css +0 -102
  64. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  65. package/front_end/panels/timeline/utils/Helpers.ts +5 -1
  66. package/front_end/panels/webauthn/webauthnPane.css +1 -1
  67. package/front_end/third_party/chromium/README.chromium +1 -1
  68. package/front_end/third_party/puppeteer/README.chromium +2 -2
  69. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +7 -0
  70. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  71. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +1 -0
  73. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  74. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +3 -0
  75. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  76. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +1 -0
  77. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +6 -0
  79. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  80. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +1 -0
  81. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  82. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +5 -0
  83. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  85. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
  86. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
  87. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  88. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +7 -0
  91. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +14 -3
  92. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +7 -0
  93. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  95. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +1 -0
  96. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +3 -0
  98. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +1 -0
  100. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +6 -0
  102. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +1 -0
  104. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +5 -0
  106. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
  108. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
  109. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/types.d.ts +7 -0
  112. package/front_end/third_party/puppeteer/package/package.json +1 -1
  113. package/front_end/third_party/puppeteer/package/src/api/Page.ts +8 -0
  114. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +4 -0
  115. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +7 -0
  116. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +6 -0
  117. package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
  118. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  119. package/front_end/ui/components/text_editor/AutocompleteHistory.ts +89 -5
  120. package/front_end/ui/components/tree_outline/TreeOutline.ts +1 -1
  121. package/front_end/ui/legacy/ProgressIndicator.ts +1 -1
  122. package/front_end/ui/legacy/Toolbar.ts +1 -1
  123. package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +14 -7
  124. package/front_end/ui/legacy/legacy.ts +0 -2
  125. package/front_end/ui/visual_logging/KnownContextValues.ts +5 -0
  126. package/inspector_overlay/loadCSS.rollup.js +2 -2
  127. package/inspector_overlay/tool_source_order.css +1 -0
  128. package/package.json +1 -1
  129. package/front_end/ui/legacy/Fragment.ts +0 -234
@@ -14,38 +14,49 @@ export interface CreationOptions {
14
14
  }
15
15
 
16
16
  export class Universe {
17
- readonly context = new Root.DevToolsContext.DevToolsContext();
17
+ readonly context: Root.DevToolsContext.DevToolsContext;
18
18
 
19
19
  constructor(options: CreationOptions) {
20
- // TODO(crbug.com/458180550): Store instance on a "DevToolsContext" instead.
21
- // For now the global is fine as we don't anticipate the MCP server to change settings.
20
+ const context = new Root.DevToolsContext.WritableDevToolsContext();
21
+ this.context = context;
22
+
23
+ // TODO(crbug.com/458180550): Store instance only on this.context instead.
24
+ // For now the global is required as not everything in foundation cleanly
25
+ // reads from the scoped `Settings` instance.
22
26
  const settings = Common.Settings.Settings.instance({
23
27
  forceNew: true,
24
28
  ...options.settingsCreationOptions,
25
29
  });
30
+ context.set(Common.Settings.Settings, settings);
31
+
32
+ const console = new Common.Console.Console();
33
+ context.set(Common.Console.Console, console);
34
+
35
+ const targetManager = new SDK.TargetManager.TargetManager(context, options.overrideAutoStartModels);
36
+ context.set(SDK.TargetManager.TargetManager, targetManager);
26
37
 
27
- const targetManager = new SDK.TargetManager.TargetManager(this.context, options.overrideAutoStartModels);
28
- this.context.set(SDK.TargetManager.TargetManager, targetManager);
38
+ const frameManager = new SDK.FrameManager.FrameManager(targetManager);
39
+ context.set(SDK.FrameManager.FrameManager, frameManager);
29
40
 
30
41
  const multitargetNetworkManager = new SDK.NetworkManager.MultitargetNetworkManager(targetManager);
31
- this.context.set(SDK.NetworkManager.MultitargetNetworkManager, multitargetNetworkManager);
42
+ context.set(SDK.NetworkManager.MultitargetNetworkManager, multitargetNetworkManager);
32
43
 
33
44
  const pageResourceLoader =
34
45
  new SDK.PageResourceLoader.PageResourceLoader(targetManager, settings, multitargetNetworkManager, null);
35
- this.context.set(SDK.PageResourceLoader.PageResourceLoader, pageResourceLoader);
46
+ context.set(SDK.PageResourceLoader.PageResourceLoader, pageResourceLoader);
36
47
 
37
48
  const workspace = new Workspace.Workspace.WorkspaceImpl();
38
- this.context.set(Workspace.Workspace.WorkspaceImpl, workspace);
49
+ context.set(Workspace.Workspace.WorkspaceImpl, workspace);
39
50
 
40
51
  const ignoreListManager = new Workspace.IgnoreListManager.IgnoreListManager(settings, targetManager);
41
- this.context.set(Workspace.IgnoreListManager.IgnoreListManager, ignoreListManager);
52
+ context.set(Workspace.IgnoreListManager.IgnoreListManager, ignoreListManager);
42
53
 
43
54
  const resourceMapping = new Bindings.ResourceMapping.ResourceMapping(targetManager, workspace);
44
55
  const cssWorkspaceBinding = new Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding(resourceMapping, targetManager);
45
- this.context.set(Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding, cssWorkspaceBinding);
56
+ context.set(Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding, cssWorkspaceBinding);
46
57
 
47
58
  const debuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding(
48
59
  resourceMapping, targetManager, ignoreListManager, workspace);
49
- this.context.set(Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding, debuggerWorkspaceBinding);
60
+ context.set(Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding, debuggerWorkspaceBinding);
50
61
  }
51
62
  }
@@ -1517,6 +1517,13 @@ inspectorBackend.registerCommand("WebAuthn.setCredentialProperties", [{"name": "
1517
1517
  inspectorBackend.registerType("WebAuthn.VirtualAuthenticatorOptions", [{"name": "protocol", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorProtocol"}, {"name": "ctap2Version", "type": "string", "optional": true, "description": "Defaults to ctap2_0. Ignored if |protocol| == u2f.", "typeRef": "WebAuthn.Ctap2Version"}, {"name": "transport", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorTransport"}, {"name": "hasResidentKey", "type": "boolean", "optional": true, "description": "Defaults to false.", "typeRef": null}, {"name": "hasUserVerification", "type": "boolean", "optional": true, "description": "Defaults to false.", "typeRef": null}, {"name": "hasLargeBlob", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the largeBlob extension. https://w3c.github.io/webauthn#largeBlob Defaults to false.", "typeRef": null}, {"name": "hasCredBlob", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the credBlob extension. https://fidoalliance.org/specs/fido-v2.1-rd-20201208/fido-client-to-authenticator-protocol-v2.1-rd-20201208.html#sctn-credBlob-extension Defaults to false.", "typeRef": null}, {"name": "hasMinPinLength", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the minPinLength extension. https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-minpinlength-extension Defaults to false.", "typeRef": null}, {"name": "hasPrf", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the prf extension. https://w3c.github.io/webauthn/#prf-extension Defaults to false.", "typeRef": null}, {"name": "automaticPresenceSimulation", "type": "boolean", "optional": true, "description": "If set to true, tests of user presence will succeed immediately. Otherwise, they will not be resolved. Defaults to true.", "typeRef": null}, {"name": "isUserVerified", "type": "boolean", "optional": true, "description": "Sets whether User Verification succeeds or fails for an authenticator. Defaults to false.", "typeRef": null}, {"name": "defaultBackupEligibility", "type": "boolean", "optional": true, "description": "Credentials created by this authenticator will have the backup eligibility (BE) flag set to this value. Defaults to false. https://w3c.github.io/webauthn/#sctn-credential-backup", "typeRef": null}, {"name": "defaultBackupState", "type": "boolean", "optional": true, "description": "Credentials created by this authenticator will have the backup state (BS) flag set to this value. Defaults to false. https://w3c.github.io/webauthn/#sctn-credential-backup", "typeRef": null}]);
1518
1518
  inspectorBackend.registerType("WebAuthn.Credential", [{"name": "credentialId", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "isResidentCredential", "type": "boolean", "optional": false, "description": "", "typeRef": null}, {"name": "rpId", "type": "string", "optional": true, "description": "Relying Party ID the credential is scoped to. Must be set when adding a credential.", "typeRef": null}, {"name": "privateKey", "type": "string", "optional": false, "description": "The ECDSA P-256 private key in PKCS#8 format.", "typeRef": null}, {"name": "userHandle", "type": "string", "optional": true, "description": "An opaque byte sequence with a maximum size of 64 bytes mapping the credential to a specific user.", "typeRef": null}, {"name": "signCount", "type": "number", "optional": false, "description": "Signature counter. This is incremented by one for each successful assertion. See https://w3c.github.io/webauthn/#signature-counter", "typeRef": null}, {"name": "largeBlob", "type": "string", "optional": true, "description": "The large blob associated with the credential. See https://w3c.github.io/webauthn/#sctn-large-blob-extension", "typeRef": null}, {"name": "backupEligibility", "type": "boolean", "optional": true, "description": "Assertions returned by this credential will have the backup eligibility (BE) flag set to this value. Defaults to the authenticator's defaultBackupEligibility value.", "typeRef": null}, {"name": "backupState", "type": "boolean", "optional": true, "description": "Assertions returned by this credential will have the backup state (BS) flag set to this value. Defaults to the authenticator's defaultBackupState value.", "typeRef": null}, {"name": "userName", "type": "string", "optional": true, "description": "The credential's user.name property. Equivalent to empty if not set. https://w3c.github.io/webauthn/#dom-publickeycredentialentity-name", "typeRef": null}, {"name": "userDisplayName", "type": "string", "optional": true, "description": "The credential's user.displayName property. Equivalent to empty if not set. https://w3c.github.io/webauthn/#dom-publickeycredentialuserentity-displayname", "typeRef": null}]);
1519
1519
 
1520
+ // WebMCP.
1521
+ inspectorBackend.registerEvent("WebMCP.toolsAdded", ["tools"]);
1522
+ inspectorBackend.registerEvent("WebMCP.toolsRemoved", ["tools"]);
1523
+ inspectorBackend.registerCommand("WebMCP.enable", [], [], "Enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for all currently registered tools.");
1524
+ inspectorBackend.registerType("WebMCP.Annotation", [{"name": "readOnly", "type": "boolean", "optional": true, "description": "A hint indicating that the tool does not modify any state.", "typeRef": null}, {"name": "autosubmit", "type": "boolean", "optional": true, "description": "If the declarative tool was declared with the autosubmit attribute.", "typeRef": null}]);
1525
+ inspectorBackend.registerType("WebMCP.Tool", [{"name": "name", "type": "string", "optional": false, "description": "Tool name.", "typeRef": null}, {"name": "description", "type": "string", "optional": false, "description": "Tool description.", "typeRef": null}, {"name": "inputSchema", "type": "object", "optional": true, "description": "Schema for the tool's input parameters.", "typeRef": null}, {"name": "annotations", "type": "object", "optional": true, "description": "Optional annotations for the tool.", "typeRef": "WebMCP.Annotation"}, {"name": "frameId", "type": "string", "optional": false, "description": "Frame identifier associated with the tool registration.", "typeRef": "Page.FrameId"}, {"name": "backendNodeId", "type": "number", "optional": true, "description": "Optional node ID for declarative tools.", "typeRef": "DOM.BackendNodeId"}, {"name": "stackTrace", "type": "object", "optional": true, "description": "The stack trace at the time of the registration.", "typeRef": "Runtime.StackTrace"}]);
1526
+
1520
1527
  // Debugger.
1521
1528
  inspectorBackend.registerEnum("Debugger.ScopeType", {Global: "global", Local: "local", With: "with", Closure: "closure", Catch: "catch", Block: "block", Script: "script", Eval: "eval", Module: "module", WasmExpressionStack: "wasm-expression-stack"});
1522
1529
  inspectorBackend.registerEnum("Debugger.BreakLocationType", {DebuggerStatement: "debuggerStatement", Call: "call", Return: "return"});
@@ -930,6 +930,14 @@ export namespace ProtocolMapping {
930
930
  * Triggered when a credential is used in a webauthn assertion.
931
931
  */
932
932
  'WebAuthn.credentialAsserted': [Protocol.WebAuthn.CredentialAssertedEvent];
933
+ /**
934
+ * Event fired when new tools are added.
935
+ */
936
+ 'WebMCP.toolsAdded': [Protocol.WebMCP.ToolsAddedEvent];
937
+ /**
938
+ * Event fired when tools are removed.
939
+ */
940
+ 'WebMCP.toolsRemoved': [Protocol.WebMCP.ToolsRemovedEvent];
933
941
  /**
934
942
  * Fired when breakpoint is resolved to an actual script and location.
935
943
  * Deprecated in favor of `resolvedBreakpoints` in the `scriptParsed` event.
@@ -5372,6 +5380,14 @@ export namespace ProtocolMapping {
5372
5380
  paramsType: [Protocol.WebAuthn.SetCredentialPropertiesRequest];
5373
5381
  returnType: void;
5374
5382
  };
5383
+ /**
5384
+ * Enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for
5385
+ * all currently registered tools.
5386
+ */
5387
+ 'WebMCP.enable': {
5388
+ paramsType: [];
5389
+ returnType: void;
5390
+ };
5375
5391
  /**
5376
5392
  * Continues execution until specific location is reached.
5377
5393
  */
@@ -114,6 +114,8 @@ declare namespace ProtocolProxyApi {
114
114
 
115
115
  WebAuthn: WebAuthnApi;
116
116
 
117
+ WebMCP: WebMCPApi;
118
+
117
119
  Debugger: DebuggerApi;
118
120
 
119
121
  HeapProfiler: HeapProfilerApi;
@@ -223,6 +225,8 @@ declare namespace ProtocolProxyApi {
223
225
 
224
226
  WebAuthn: WebAuthnDispatcher;
225
227
 
228
+ WebMCP: WebMCPDispatcher;
229
+
226
230
  Debugger: DebuggerDispatcher;
227
231
 
228
232
  HeapProfiler: HeapProfilerDispatcher;
@@ -4849,6 +4853,27 @@ declare namespace ProtocolProxyApi {
4849
4853
 
4850
4854
  }
4851
4855
 
4856
+ export interface WebMCPApi {
4857
+ /**
4858
+ * Enables the WebMCP domain, allowing events to be sent. Enabling the domain will trigger a toolsAdded event for
4859
+ * all currently registered tools.
4860
+ */
4861
+ invoke_enable(): Promise<Protocol.ProtocolResponseWithError>;
4862
+
4863
+ }
4864
+ export interface WebMCPDispatcher {
4865
+ /**
4866
+ * Event fired when new tools are added.
4867
+ */
4868
+ toolsAdded(params: Protocol.WebMCP.ToolsAddedEvent): void;
4869
+
4870
+ /**
4871
+ * Event fired when tools are removed.
4872
+ */
4873
+ toolsRemoved(params: Protocol.WebMCP.ToolsRemovedEvent): void;
4874
+
4875
+ }
4876
+
4852
4877
  export interface DebuggerApi {
4853
4878
  /**
4854
4879
  * Continues execution until specific location is reached.
@@ -20584,6 +20584,77 @@ export namespace WebAuthn {
20584
20584
  }
20585
20585
  }
20586
20586
 
20587
+ export namespace WebMCP {
20588
+
20589
+ /**
20590
+ * Tool annotations
20591
+ */
20592
+ export interface Annotation {
20593
+ /**
20594
+ * A hint indicating that the tool does not modify any state.
20595
+ */
20596
+ readOnly?: boolean;
20597
+ /**
20598
+ * If the declarative tool was declared with the autosubmit attribute.
20599
+ */
20600
+ autosubmit?: boolean;
20601
+ }
20602
+
20603
+ /**
20604
+ * Definition of a tool that can be invoked.
20605
+ */
20606
+ export interface Tool {
20607
+ /**
20608
+ * Tool name.
20609
+ */
20610
+ name: string;
20611
+ /**
20612
+ * Tool description.
20613
+ */
20614
+ description: string;
20615
+ /**
20616
+ * Schema for the tool's input parameters.
20617
+ */
20618
+ inputSchema?: any;
20619
+ /**
20620
+ * Optional annotations for the tool.
20621
+ */
20622
+ annotations?: Annotation;
20623
+ /**
20624
+ * Frame identifier associated with the tool registration.
20625
+ */
20626
+ frameId: Page.FrameId;
20627
+ /**
20628
+ * Optional node ID for declarative tools.
20629
+ */
20630
+ backendNodeId?: DOM.BackendNodeId;
20631
+ /**
20632
+ * The stack trace at the time of the registration.
20633
+ */
20634
+ stackTrace?: Runtime.StackTrace;
20635
+ }
20636
+
20637
+ /**
20638
+ * Event fired when new tools are added.
20639
+ */
20640
+ export interface ToolsAddedEvent {
20641
+ /**
20642
+ * Array of tools that were added.
20643
+ */
20644
+ tools: Tool[];
20645
+ }
20646
+
20647
+ /**
20648
+ * Event fired when tools are removed.
20649
+ */
20650
+ export interface ToolsRemovedEvent {
20651
+ /**
20652
+ * Array of tools that were removed.
20653
+ */
20654
+ tools: Tool[];
20655
+ }
20656
+ }
20657
+
20587
20658
  /**
20588
20659
  * Debugger domain exposes JavaScript debugging capabilities. It allows setting and removing
20589
20660
  * breakpoints, stepping through execution, exploring stack traces, etc.
@@ -4,10 +4,10 @@
4
4
 
5
5
  import * as Host from '../../core/host/host.js';
6
6
  import * as Root from '../../core/root/root.js';
7
- import * as SDK from '../../core/sdk/sdk.js';
8
- import * as Trace from '../../models/trace/trace.js';
7
+ import type * as SDK from '../../core/sdk/sdk.js';
8
+ import type * as Trace from '../../models/trace/trace.js';
9
9
  import * as Greendev from '../greendev/greendev.js';
10
- import * as NetworkTimeCalculator from '../network_time_calculator/network_time_calculator.js';
10
+ import type * as NetworkTimeCalculator from '../network_time_calculator/network_time_calculator.js';
11
11
 
12
12
  import {
13
13
  type AiAgent,
@@ -26,10 +26,6 @@ import {PerformanceAgent, PerformanceTraceContext} from './agents/PerformanceAge
26
26
  import {NodeContext, StylingAgent} from './agents/StylingAgent.js';
27
27
  import {AiHistoryStorage, ConversationType, type SerializedConversation} from './AiHistoryStorage.js';
28
28
  import type {ChangeManager} from './ChangeManager.js';
29
- import {NetworkRequestFormatter} from './data_formatters/NetworkRequestFormatter.js';
30
- import {PerformanceInsightFormatter} from './data_formatters/PerformanceInsightFormatter.js';
31
- import {micros} from './data_formatters/UnitFormatters.js';
32
- import {AgentFocus} from './performance/AIContext.js';
33
29
 
34
30
  export const NOT_FOUND_IMAGE_DATA = '';
35
31
  const MAX_TITLE_LENGTH = 80;
@@ -274,6 +270,9 @@ export class AiConversation {
274
270
  if (item.type === ResponseType.SIDE_EFFECT) {
275
271
  return {...item, confirm: undefined};
276
272
  }
273
+ if (item.type === ResponseType.CONTEXT && item.widgets) {
274
+ return {...item, widgets: undefined};
275
+ }
277
276
  return item;
278
277
  })
279
278
  .filter(history => !!history),
@@ -342,88 +341,11 @@ export class AiConversation {
342
341
  }
343
342
  }
344
343
 
345
- #factsCache = new Map<ExtraContext, Host.AidaClient.RequestFact>();
346
-
347
- async #createFactsForExtraContext(contexts: ExtraContext[]): Promise<void> {
348
- for (const context of contexts) {
349
- const cached = this.#factsCache.get(context);
350
- if (cached) {
351
- this.#agent.addFact(cached);
352
- continue;
353
- }
354
-
355
- if (context instanceof SDK.DOMModel.DOMNode) {
356
- const desc = await StylingAgent.describeElement(context);
357
-
358
- const fact = {
359
- text: `Relevant HTML element:\n${desc}`,
360
- metadata: {
361
- source: 'devtools-floaty',
362
- score: 1,
363
- }
364
- };
365
- this.#factsCache.set(context, fact);
366
- this.#agent.addFact(fact);
367
- } else if (context instanceof SDK.NetworkRequest.NetworkRequest) {
368
- const calculator = new NetworkTimeCalculator.NetworkTransferTimeCalculator();
369
- calculator.updateBoundaries(context);
370
- const formatter = new NetworkRequestFormatter(context, calculator);
371
- const desc = await formatter.formatNetworkRequest();
372
-
373
- const fact = {
374
- text: `Relevant network request:\n${desc}`,
375
- metadata: {
376
- source: 'devtools-floaty',
377
- score: 1,
378
- }
379
- };
380
- this.#factsCache.set(context, fact);
381
- this.#agent.addFact(fact);
382
- } else if ('insight' in context) {
383
- const focus = AgentFocus.fromInsight(context.trace, context.insight);
384
- const formatter = new PerformanceInsightFormatter(
385
- focus,
386
- context.insight,
387
- );
388
-
389
- const text = `Relevant Performance Insight:\n${formatter.formatInsight()}`;
390
- const fact = {
391
- text,
392
- metadata: {
393
- source: 'devtools-floaty',
394
- score: 1,
395
- }
396
- };
397
- this.#factsCache.set(context, fact);
398
- this.#agent.addFact(fact);
399
- } else {
400
- // Must be a trace event
401
- const time = Trace.Types.Timing.Micro(
402
- context.event.ts - context.traceStartTime,
403
- );
404
-
405
- const desc = `Trace event: ${context.event.name}
406
- Time: ${micros(time)}`;
407
-
408
- const fact = {
409
- text: `Relevant trace event:\n${desc}`,
410
- metadata: {
411
- source: 'devtools-floaty',
412
- score: 1,
413
- }
414
- };
415
- this.#factsCache.set(context, fact);
416
- this.#agent.addFact(fact);
417
- }
418
- }
419
- }
420
-
421
344
  async *
422
345
  run(
423
346
  initialQuery: string,
424
347
  options: {
425
348
  signal?: AbortSignal,
426
- extraContext?: ExtraContext[],
427
349
  multimodalInput?: MultimodalInput,
428
350
  } = {},
429
351
  ): AsyncGenerator<ResponseData, void, void> {
@@ -442,9 +364,6 @@ Time: ${micros(time)}`;
442
364
  void this.addHistoryItem(userQuery);
443
365
  yield userQuery;
444
366
 
445
- if (options.extraContext) {
446
- await this.#createFactsForExtraContext(options.extraContext);
447
- }
448
367
  this.#setOriginIfEmpty(this.selectedContext?.getOrigin());
449
368
 
450
369
  if (this.isBlockedByOrigin) {
@@ -463,7 +382,6 @@ Time: ${micros(time)}`;
463
382
  initialQuery: string,
464
383
  options: {
465
384
  signal?: AbortSignal,
466
- extraContext?: ExtraContext[],
467
385
  multimodalInput?: MultimodalInput,
468
386
  } = {},
469
387
  ): AsyncGenerator<ResponseData, void, void> {
@@ -528,13 +446,6 @@ function isAiAssistanceServerSideLoggingEnabled(): boolean {
528
446
  return !Root.Runtime.hostConfig.aidaAvailability?.disallowLogging;
529
447
  }
530
448
 
531
- // TODO: this is the same as the type in UI.Floaty but we cannot use UI
532
- // here. This is fine for prototyping but if we take this further we can
533
- // rearchitect.
534
- type ExtraContext = SDK.DOMModel.DOMNode|SDK.NetworkRequest.NetworkRequest|
535
- {event: Trace.Types.Events.Event, traceStartTime: Trace.Types.Timing.Micro}|
536
- {insight: Trace.Insights.Types.InsightModel, trace: Trace.TraceModel.ParsedTrace};
537
-
538
449
  function isAiAssistanceContextSelectionAgentEnabled(): boolean {
539
450
  return Boolean(Root.Runtime.hostConfig.devToolsAiAssistanceContextSelectionAgent?.enabled);
540
451
  }
@@ -129,7 +129,7 @@ export class ConversationHandler extends Common.ObjectWrapper.ObjectWrapper<Even
129
129
  }): ConversationHandler {
130
130
  if (opts?.forceNew || conversationHandlerInstance === undefined) {
131
131
  const aidaClient = opts?.aidaClient ?? new Host.AidaClient.AidaClient();
132
- conversationHandlerInstance = new ConversationHandler(aidaClient, opts?.aidaAvailability ?? undefined);
132
+ conversationHandlerInstance = new ConversationHandler(aidaClient, opts?.aidaAvailability);
133
133
  }
134
134
  return conversationHandlerInstance;
135
135
  }
@@ -7,6 +7,7 @@ import * as Root from '../../../core/root/root.js';
7
7
  import type * as SDK from '../../../core/sdk/sdk.js';
8
8
  import type * as Protocol from '../../../generated/protocol.js';
9
9
  import * as Greendev from '../../greendev/greendev.js';
10
+ import type * as Trace from '../../trace/trace.js';
10
11
  import {debugLog, isStructuredLogEnabled} from '../debug.js';
11
12
 
12
13
  export const enum ResponseType {
@@ -69,6 +70,7 @@ export interface ContextResponse {
69
70
  type: ResponseType.CONTEXT;
70
71
  title: string;
71
72
  details: [ContextDetail, ...ContextDetail[]];
73
+ widgets?: AiWidget[];
72
74
  }
73
75
 
74
76
  export interface TitleResponse {
@@ -228,8 +230,16 @@ export interface ComputedStyleAiWidget {
228
230
  properties: string[],
229
231
  };
230
232
  }
233
+ export interface CoreVitalsAiWidget {
234
+ name: 'CORE_VITALS';
235
+ data: {
236
+ insightSetKey: string,
237
+ parsedTrace: Trace.TraceModel.ParsedTrace,
238
+ };
239
+ }
240
+
231
241
  // This type will grow as we add more widgets.
232
- export type AiWidget = ComputedStyleAiWidget;
242
+ export type AiWidget = ComputedStyleAiWidget|CoreVitalsAiWidget;
233
243
 
234
244
  export type FunctionCallHandlerResult<Result> = {
235
245
  requiresApproval: true,
@@ -22,6 +22,7 @@ import {AgentFocus} from '../performance/AIContext.js';
22
22
 
23
23
  import {
24
24
  AiAgent,
25
+ type AiWidget,
25
26
  type ContextResponse,
26
27
  ConversationContext,
27
28
  type ConversationSuggestions,
@@ -381,6 +382,18 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
381
382
  return;
382
383
  }
383
384
 
385
+ const widgets: AiWidget[] = [];
386
+ const primaryInsightSet = context.getItem().primaryInsightSet;
387
+ if (primaryInsightSet) {
388
+ widgets.push({
389
+ name: 'CORE_VITALS',
390
+ data: {
391
+ parsedTrace: context.getItem().parsedTrace,
392
+ insightSetKey: primaryInsightSet.id,
393
+ },
394
+ });
395
+ }
396
+
384
397
  yield {
385
398
  type: ResponseType.CONTEXT,
386
399
  title: lockedString(UIStringsNotTranslated.analyzingTrace),
@@ -390,6 +403,7 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
390
403
  text: this.#formatter?.formatTraceSummary() ?? '',
391
404
  },
392
405
  ],
406
+ widgets,
393
407
  };
394
408
 
395
409
  this.#hasShownAnalyzeTraceContext = true;
@@ -169,7 +169,7 @@ export class AiCodeCompletion {
169
169
  // As a temporary fix for b/441221870 we are prepending a newline for each prefix.
170
170
  prefix = '\n' + prefix;
171
171
 
172
- let additionalContextFiles = additionalFiles ?? undefined;
172
+ let additionalContextFiles = additionalFiles;
173
173
  if (!additionalContextFiles) {
174
174
  additionalContextFiles = this.#panel === ContextFlavor.CONSOLE ? [{
175
175
  path: 'devtools-console-context.js',
@@ -761,6 +761,8 @@ export class AiAssistancePanel extends UI.Panel.Panel {
761
761
  if (isNarrow === this.#walkthrough.isInlined) {
762
762
  return;
763
763
  }
764
+ // If the UI changed, we reset the visibility of the AI Walkthrough.
765
+ this.#clearWalkthrough();
764
766
  this.#walkthrough.isInlined = isNarrow;
765
767
  this.requestUpdate();
766
768
  }
@@ -1712,6 +1714,7 @@ export class AiAssistancePanel extends UI.Panel.Panel {
1712
1714
  case AiAssistanceModel.AiAgent.ResponseType.CONTEXT: {
1713
1715
  step.title = data.title;
1714
1716
  step.contextDetails = data.details;
1717
+ step.widgets = data.widgets;
1715
1718
  step.isLoading = false;
1716
1719
  commitStep();
1717
1720
  break;