chrome-devtools-frontend 1.0.1596260 → 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 (94) hide show
  1. package/front_end/core/common/Console.ts +6 -6
  2. package/front_end/core/common/Settings.ts +12 -8
  3. package/front_end/core/root/DevToolsContext.ts +13 -7
  4. package/front_end/core/sdk/CPUThrottlingManager.ts +12 -9
  5. package/front_end/core/sdk/FrameManager.ts +7 -8
  6. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +1 -1
  7. package/front_end/entrypoints/main/MainImpl.ts +1 -2
  8. package/front_end/foundation/Universe.ts +22 -11
  9. package/front_end/generated/InspectorBackendCommands.ts +7 -0
  10. package/front_end/generated/protocol-mapping.d.ts +16 -0
  11. package/front_end/generated/protocol-proxy-api.d.ts +25 -0
  12. package/front_end/generated/protocol.ts +71 -0
  13. package/front_end/models/ai_assistance/AiConversation.ts +6 -95
  14. package/front_end/models/ai_assistance/agents/AiAgent.ts +11 -1
  15. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +14 -0
  16. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -0
  17. package/front_end/panels/ai_assistance/components/ChatMessage.ts +25 -4
  18. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +2 -2
  19. package/front_end/panels/elements/StandaloneStylesContainer.ts +48 -12
  20. package/front_end/panels/elements/StylePropertiesSection.ts +97 -1
  21. package/front_end/panels/elements/StylePropertyTreeElement.ts +16 -0
  22. package/front_end/panels/elements/StylesContainer.ts +1 -0
  23. package/front_end/panels/elements/StylesSidebarPane.ts +48 -32
  24. package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -1
  25. package/front_end/panels/lighthouse/LighthouseController.ts +13 -5
  26. package/front_end/panels/lighthouse/LighthousePanel.ts +22 -5
  27. package/front_end/panels/recorder/components/StepView.ts +0 -2
  28. package/front_end/panels/recorder/components/stepView.css +13 -13
  29. package/front_end/panels/recorder/components/timelineSection.css +6 -7
  30. package/front_end/panels/timeline/TimelinePanel.ts +18 -0
  31. package/front_end/panels/timeline/components/CWVMetrics.ts +339 -0
  32. package/front_end/panels/timeline/components/Sidebar.ts +17 -0
  33. package/front_end/panels/timeline/components/SidebarInsightsTab.ts +10 -0
  34. package/front_end/panels/timeline/components/SidebarSingleInsightSet.ts +25 -267
  35. package/front_end/panels/timeline/components/components.ts +2 -0
  36. package/front_end/panels/timeline/components/cwvMetrics.css +107 -0
  37. package/front_end/panels/timeline/components/sidebarSingleInsightSet.css +0 -102
  38. package/front_end/panels/timeline/timeline-meta.ts +11 -0
  39. package/front_end/panels/timeline/utils/Helpers.ts +5 -1
  40. package/front_end/third_party/chromium/README.chromium +1 -1
  41. package/front_end/third_party/puppeteer/README.chromium +2 -2
  42. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts +7 -0
  43. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.d.ts.map +1 -1
  44. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/api/Page.js.map +1 -1
  45. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts +1 -0
  46. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.d.ts.map +1 -1
  47. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js +3 -0
  48. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/bidi/Page.js.map +1 -1
  49. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts +1 -0
  50. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.d.ts.map +1 -1
  51. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js +6 -0
  52. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Browser.js.map +1 -1
  53. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts +1 -0
  54. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.d.ts.map +1 -1
  55. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js +5 -0
  56. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/Page.js.map +1 -1
  57. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
  58. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +2 -2
  59. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +2 -2
  60. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
  61. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
  62. package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
  63. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +7 -0
  64. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +14 -3
  65. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts +7 -0
  66. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.d.ts.map +1 -1
  67. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/api/Page.js.map +1 -1
  68. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts +1 -0
  69. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.d.ts.map +1 -1
  70. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js +3 -0
  71. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/bidi/Page.js.map +1 -1
  72. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts +1 -0
  73. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.d.ts.map +1 -1
  74. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js +6 -0
  75. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Browser.js.map +1 -1
  76. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts +1 -0
  77. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.d.ts.map +1 -1
  78. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js +5 -0
  79. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/Page.js.map +1 -1
  80. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +2 -2
  81. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +2 -2
  82. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
  83. package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
  84. package/front_end/third_party/puppeteer/package/lib/types.d.ts +7 -0
  85. package/front_end/third_party/puppeteer/package/package.json +1 -1
  86. package/front_end/third_party/puppeteer/package/src/api/Page.ts +8 -0
  87. package/front_end/third_party/puppeteer/package/src/bidi/Page.ts +4 -0
  88. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +7 -0
  89. package/front_end/third_party/puppeteer/package/src/cdp/Page.ts +6 -0
  90. package/front_end/third_party/puppeteer/package/src/revisions.ts +2 -2
  91. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  92. package/front_end/ui/components/text_editor/AutocompleteHistory.ts +89 -5
  93. package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
  94. package/package.json +1 -1
@@ -2,24 +2,24 @@
2
2
  // Use of this source code is governed by a BSD-style license that can be
3
3
  // found in the LICENSE file.
4
4
 
5
+ import * as Root from '../root/root.js';
6
+
5
7
  import {ObjectWrapper} from './Object.js';
6
8
  import {reveal} from './Revealer.js';
7
9
 
8
- let consoleInstance: Console|undefined;
9
-
10
10
  export class Console extends ObjectWrapper<EventTypes> {
11
11
  readonly #messages: Message[] = [];
12
12
 
13
13
  static instance(opts?: {forceNew: boolean}): Console {
14
- if (!consoleInstance || opts?.forceNew) {
15
- consoleInstance = new Console();
14
+ if (!Root.DevToolsContext.globalInstance().has(Console) || opts?.forceNew) {
15
+ Root.DevToolsContext.globalInstance().set(Console, new Console());
16
16
  }
17
17
 
18
- return consoleInstance;
18
+ return Root.DevToolsContext.globalInstance().get(Console);
19
19
  }
20
20
 
21
21
  static removeInstance(): void {
22
- consoleInstance = undefined;
22
+ Root.DevToolsContext.globalInstance().delete(Console);
23
23
  }
24
24
 
25
25
  /**
@@ -22,8 +22,6 @@ import {
22
22
  SettingType,
23
23
  } from './SettingRegistration.js';
24
24
 
25
- let settingsInstance: Settings|undefined;
26
-
27
25
  export interface SettingsCreationOptions {
28
26
  syncedStorage: SettingsStorage;
29
27
  globalStorage: SettingsStorage;
@@ -85,7 +83,7 @@ export class Settings {
85
83
  }
86
84
 
87
85
  static hasInstance(): boolean {
88
- return typeof settingsInstance !== 'undefined';
86
+ return Root.DevToolsContext.globalInstance().has(Settings);
89
87
  }
90
88
 
91
89
  static instance(opts: {
@@ -107,20 +105,26 @@ export class Settings {
107
105
  logSettingAccess,
108
106
  runSettingsMigration
109
107
  } = opts;
110
- if (!settingsInstance || forceNew) {
108
+ if (!Root.DevToolsContext.globalInstance().has(Settings) || forceNew) {
111
109
  if (!syncedStorage || !globalStorage || !localStorage || !settingRegistrations) {
112
110
  throw new Error(`Unable to create settings: global and local storage must be provided: ${new Error().stack}`);
113
111
  }
114
112
 
115
- settingsInstance = new Settings(
116
- {syncedStorage, globalStorage, localStorage, settingRegistrations, logSettingAccess, runSettingsMigration});
113
+ Root.DevToolsContext.globalInstance().set(Settings, new Settings({
114
+ syncedStorage,
115
+ globalStorage,
116
+ localStorage,
117
+ settingRegistrations,
118
+ logSettingAccess,
119
+ runSettingsMigration
120
+ }));
117
121
  }
118
122
 
119
- return settingsInstance;
123
+ return Root.DevToolsContext.globalInstance().get(Settings);
120
124
  }
121
125
 
122
126
  static removeInstance(): void {
123
- settingsInstance = undefined;
127
+ Root.DevToolsContext.globalInstance().delete(Settings);
124
128
  }
125
129
 
126
130
  private registerModuleSetting(setting: Setting<unknown>): void {
@@ -11,7 +11,14 @@ export type ConstructorT<T> = new (...args: any[]) => T;
11
11
  * via constructor, and not just pass a {@link DevToolsContext} around. That would hide
12
12
  * dependencies and we want to be explicit.
13
13
  */
14
- export class DevToolsContext {
14
+ export interface DevToolsContext {
15
+ get<T>(ctor: ConstructorT<T>): T;
16
+ }
17
+
18
+ /**
19
+ * The actual implementation. Should only be accessed by test-setup code or the bootstrapper.
20
+ */
21
+ export class WritableDevToolsContext implements DevToolsContext {
15
22
  readonly #instances = new Map<ConstructorT<unknown>, unknown>();
16
23
 
17
24
  get<T>(ctor: ConstructorT<T>): T {
@@ -28,8 +35,7 @@ export class DevToolsContext {
28
35
  }
29
36
 
30
37
  /**
31
- * @deprecated Should only be used by existing `instance` accessors and the bootstrapper.
32
- * Exists on the public interface only for migration purposes for now.
38
+ * Should only be used by existing `instance` accessors and the bootstrapper.
33
39
  */
34
40
  set<T>(ctor: ConstructorT<T>, instance: T): void {
35
41
  // TODO(crbug.com/458180550): We need to throw here if an instance was already set!
@@ -42,16 +48,16 @@ export class DevToolsContext {
42
48
  }
43
49
  }
44
50
 
45
- let gInstance: DevToolsContext|null = null;
51
+ let gInstance: WritableDevToolsContext|null = null;
46
52
 
47
53
  /**
48
54
  * @deprecated Exists to migrate instance() methods.
49
55
  */
50
- export function globalInstance(): DevToolsContext {
56
+ export function globalInstance(): WritableDevToolsContext {
51
57
  if (!gInstance) {
52
58
  // TODO(crbug.com/458180550): This should really throw to prevent side-effects and globals
53
59
  // from leaking all over the place.
54
- gInstance = new DevToolsContext();
60
+ gInstance = new WritableDevToolsContext();
55
61
  }
56
62
  return gInstance;
57
63
  }
@@ -59,6 +65,6 @@ export function globalInstance(): DevToolsContext {
59
65
  /**
60
66
  * @deprecated Should only be called by test setup and MainImpl
61
67
  */
62
- export function setGlobalInstance(context: DevToolsContext|null): void {
68
+ export function setGlobalInstance(context: WritableDevToolsContext|null): void {
63
69
  gInstance = context;
64
70
  }
@@ -39,24 +39,27 @@ let throttlingManagerInstance: CPUThrottlingManager;
39
39
 
40
40
  export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes> implements
41
41
  SDKModelObserver<EmulationModel> {
42
+ readonly #targetManager: TargetManager;
42
43
  #cpuThrottlingOption: CPUThrottlingOption;
43
44
  #calibratedThrottlingSetting: Common.Settings.Setting<CalibratedCPUThrottling>;
44
45
  #hardwareConcurrency?: number;
45
46
  #pendingMainTargetPromise?: (r: number) => void;
46
47
 
47
- private constructor() {
48
+ private constructor(settings: Common.Settings.Settings, targetManager: TargetManager) {
48
49
  super();
50
+ this.#targetManager = targetManager;
49
51
  this.#cpuThrottlingOption = NoThrottlingOption;
50
- this.#calibratedThrottlingSetting = Common.Settings.Settings.instance().createSetting<CalibratedCPUThrottling>(
52
+ this.#calibratedThrottlingSetting = settings.createSetting<CalibratedCPUThrottling>(
51
53
  'calibrated-cpu-throttling', {}, Common.Settings.SettingStorageType.GLOBAL);
52
54
  this.#calibratedThrottlingSetting.addChangeListener(this.#onCalibratedSettingChanged, this);
53
- TargetManager.instance().observeModels(EmulationModel, this);
55
+ targetManager.observeModels(EmulationModel, this);
54
56
  }
55
57
 
56
58
  static instance(opts: {forceNew: boolean|null} = {forceNew: null}): CPUThrottlingManager {
57
59
  const {forceNew} = opts;
58
60
  if (!throttlingManagerInstance || forceNew) {
59
- throttlingManagerInstance = new CPUThrottlingManager();
61
+ throttlingManagerInstance =
62
+ new CPUThrottlingManager(Common.Settings.Settings.instance(), TargetManager.instance());
60
63
  }
61
64
 
62
65
  return throttlingManagerInstance;
@@ -84,7 +87,7 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
84
87
  return;
85
88
  }
86
89
 
87
- for (const emulationModel of TargetManager.instance().models(EmulationModel)) {
90
+ for (const emulationModel of this.#targetManager.models(EmulationModel)) {
88
91
  void emulationModel.setCPUThrottlingRate(rate);
89
92
  }
90
93
  this.dispatchEventToListeners(Events.RATE_CHANGED, rate);
@@ -96,7 +99,7 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
96
99
  }
97
100
 
98
101
  this.#cpuThrottlingOption = option;
99
- for (const emulationModel of TargetManager.instance().models(EmulationModel)) {
102
+ for (const emulationModel of this.#targetManager.models(EmulationModel)) {
100
103
  void emulationModel.setCPUThrottlingRate(this.#cpuThrottlingOption.rate());
101
104
  }
102
105
  this.dispatchEventToListeners(Events.RATE_CHANGED, this.#cpuThrottlingOption.rate());
@@ -104,7 +107,7 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
104
107
 
105
108
  setHardwareConcurrency(concurrency: number): void {
106
109
  this.#hardwareConcurrency = concurrency;
107
- for (const emulationModel of TargetManager.instance().models(EmulationModel)) {
110
+ for (const emulationModel of this.#targetManager.models(EmulationModel)) {
108
111
  void emulationModel.setHardwareConcurrency(concurrency);
109
112
  }
110
113
  this.dispatchEventToListeners(Events.HARDWARE_CONCURRENCY_CHANGED, this.#hardwareConcurrency);
@@ -115,14 +118,14 @@ export class CPUThrottlingManager extends Common.ObjectWrapper.ObjectWrapper<Eve
115
118
  // target may error. So if we get any errors here at all, assume that we do
116
119
  // not have a target.
117
120
  try {
118
- return TargetManager.instance().primaryPageTarget() !== null;
121
+ return this.#targetManager.primaryPageTarget() !== null;
119
122
  } catch {
120
123
  return false;
121
124
  }
122
125
  }
123
126
 
124
127
  async getHardwareConcurrency(): Promise<number> {
125
- const target = TargetManager.instance().primaryPageTarget();
128
+ const target = this.#targetManager.primaryPageTarget();
126
129
  const existingCallback = this.#pendingMainTargetPromise;
127
130
 
128
131
  // If the main target hasn't attached yet, block callers until it appears.
@@ -4,14 +4,13 @@
4
4
 
5
5
  import type * as Protocol from '../../generated/protocol.js';
6
6
  import * as Common from '../common/common.js';
7
+ import * as Root from '../root/root.js';
7
8
 
8
9
  import type {Resource} from './Resource.js';
9
10
  import {Events as ResourceTreeModelEvents, type ResourceTreeFrame, ResourceTreeModel} from './ResourceTreeModel.js';
10
11
  import type {Target} from './Target.js';
11
12
  import {type SDKModelObserver, TargetManager} from './TargetManager.js';
12
13
 
13
- let frameManagerInstance: FrameManager|null = null;
14
-
15
14
  /**
16
15
  * The FrameManager is a central storage for all #frames. It collects #frames from all
17
16
  * ResourceTreeModel-instances (one per target), so that #frames can be found by id
@@ -37,22 +36,22 @@ export class FrameManager extends Common.ObjectWrapper.ObjectWrapper<EventTypes>
37
36
  }>();
38
37
  #awaitedFrames = new Map<string, Array<{resolve: (frame: ResourceTreeFrame) => void, notInTarget?: Target}>>();
39
38
 
40
- constructor() {
39
+ constructor(targetManager: TargetManager) {
41
40
  super();
42
- TargetManager.instance().observeModels(ResourceTreeModel, this);
41
+ targetManager.observeModels(ResourceTreeModel, this);
43
42
  }
44
43
 
45
44
  static instance({forceNew}: {
46
45
  forceNew: boolean,
47
46
  } = {forceNew: false}): FrameManager {
48
- if (!frameManagerInstance || forceNew) {
49
- frameManagerInstance = new FrameManager();
47
+ if (!Root.DevToolsContext.globalInstance().has(FrameManager) || forceNew) {
48
+ Root.DevToolsContext.globalInstance().set(FrameManager, new FrameManager(TargetManager.instance()));
50
49
  }
51
- return frameManagerInstance;
50
+ return Root.DevToolsContext.globalInstance().get(FrameManager);
52
51
  }
53
52
 
54
53
  static removeInstance(): void {
55
- frameManagerInstance = null;
54
+ Root.DevToolsContext.globalInstance().delete(FrameManager);
56
55
  }
57
56
 
58
57
  modelAdded(resourceTreeModel: ResourceTreeModel): void {
@@ -431,7 +431,7 @@ async function init(): Promise<void> {
431
431
  settingRegistrations: Common.SettingRegistration.getRegisteredSettings(),
432
432
  }
433
433
  });
434
- Root.DevToolsContext.setGlobalInstance(universe.context);
434
+ Root.DevToolsContext.setGlobalInstance(universe.context as Root.DevToolsContext.WritableDevToolsContext);
435
435
 
436
436
  await i18n.i18n.fetchAndRegisterLocaleData('en-US');
437
437
  Host.InspectorFrontendHost.InspectorFrontendHostInstance.connectionReady();
@@ -201,7 +201,7 @@ export class MainImpl {
201
201
  },
202
202
  };
203
203
  this.#universe = new Foundation.Universe.Universe(creationOptions);
204
- Root.DevToolsContext.setGlobalInstance(this.#universe.context);
204
+ Root.DevToolsContext.setGlobalInstance(this.#universe.context as Root.DevToolsContext.WritableDevToolsContext);
205
205
 
206
206
  await this.requestAndRegisterLocaleData();
207
207
 
@@ -488,7 +488,6 @@ export class MainImpl {
488
488
 
489
489
  // These instances need to be created early so they don't miss any events about requests/issues/etc.
490
490
  Logs.NetworkLog.NetworkLog.instance();
491
- SDK.FrameManager.FrameManager.instance();
492
491
  Logs.LogManager.LogManager.instance();
493
492
  IssuesManager.IssuesManager.IssuesManager.instance({
494
493
  forceNew: true,
@@ -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.