chrome-devtools-frontend 1.0.1654411 → 1.0.1656897

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 (204) hide show
  1. package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +116 -0
  2. package/.agents/skills/ui-eng-vision-logic-consolidator/SKILL.md +82 -0
  3. package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +123 -0
  4. package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +125 -0
  5. package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +75 -0
  6. package/AUTHORS +1 -0
  7. package/config/owner/COMMON_OWNERS +0 -4
  8. package/docs/playbook.md +1 -1
  9. package/front_end/Tests.js +1 -0
  10. package/front_end/core/common/Settings.ts +47 -30
  11. package/front_end/core/sdk/CPUThrottlingManager.ts +10 -159
  12. package/front_end/core/sdk/ConsoleModel.ts +13 -11
  13. package/front_end/core/sdk/DOMDebuggerModel.ts +11 -5
  14. package/front_end/core/sdk/DOMModel.ts +7 -5
  15. package/front_end/core/sdk/EventBreakpointsModel.ts +9 -5
  16. package/front_end/core/sdk/IsolateManager.ts +6 -6
  17. package/front_end/core/sdk/ResourceTreeModel.ts +5 -3
  18. package/front_end/core/sdk/SourceMapCache.ts +2 -4
  19. package/front_end/core/sdk/SourceMapManager.ts +8 -7
  20. package/front_end/core/sdk/TargetManager.ts +17 -0
  21. package/front_end/entrypoints/devtools_app/devtools_app.ts +0 -1
  22. package/front_end/entrypoints/main/MainImpl.ts +12 -36
  23. package/front_end/entrypoints/main/SimpleApp.ts +0 -13
  24. package/front_end/entrypoints/main/main-meta.ts +1 -1
  25. package/front_end/foundation/Universe.ts +110 -3
  26. package/front_end/generated/InspectorBackendCommands.ts +5 -1
  27. package/front_end/generated/SupportedCSSProperties.js +2 -6
  28. package/front_end/generated/protocol-mapping.d.ts +8 -0
  29. package/front_end/generated/protocol-proxy-api.d.ts +15 -0
  30. package/front_end/generated/protocol.ts +36 -1
  31. package/front_end/models/ai_assistance/AiConversation.ts +0 -6
  32. package/front_end/models/ai_assistance/agents/NetworkAgent.snapshot.txt +1 -1
  33. package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +2 -156
  34. package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +0 -24
  35. package/front_end/models/ai_assistance/agents/StylingAgent.ts +2 -358
  36. package/front_end/models/ai_assistance/ai_assistance.ts +0 -6
  37. package/front_end/models/ai_assistance/contexts/RequestContext.snapshot.txt +0 -1
  38. package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +0 -2
  39. package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +1 -14
  40. package/front_end/models/autofill_manager/AutofillManager.ts +1 -2
  41. package/front_end/models/crux-manager/CrUXManager.ts +16 -11
  42. package/front_end/models/javascript_metadata/NativeFunctions.js +1 -1
  43. package/front_end/models/persistence/AutomaticFileSystemManager.ts +14 -13
  44. package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +12 -9
  45. package/front_end/models/persistence/IsolatedFileSystemManager.ts +18 -9
  46. package/front_end/models/project_settings/ProjectSettingsModel.ts +12 -11
  47. package/front_end/models/trace/handlers/ScreenshotsHandler.ts +14 -59
  48. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +3 -29
  49. package/front_end/panels/application/DeviceBoundSessionsView.ts +15 -3
  50. package/front_end/panels/application/FrameDetailsView.ts +2 -1
  51. package/front_end/panels/application/ServiceWorkersView.ts +193 -161
  52. package/front_end/panels/application/serviceWorkersView.css +8 -0
  53. package/front_end/panels/common/CPUThrottlingOption.ts +142 -0
  54. package/front_end/panels/common/ThrottlingUtils.ts +9 -4
  55. package/front_end/panels/common/common.ts +1 -1
  56. package/front_end/panels/console/ConsoleViewMessage.ts +45 -0
  57. package/front_end/panels/elements/ElementsPanel.ts +35 -102
  58. package/front_end/panels/elements/ElementsTreeOutline.ts +0 -4
  59. package/front_end/panels/elements/elements-meta.ts +3 -2
  60. package/front_end/panels/emulation/DeviceModeToolbar.ts +46 -45
  61. package/front_end/panels/mobile_throttling/CalibrationController.ts +6 -5
  62. package/front_end/panels/mobile_throttling/MobileThrottlingSelector.ts +1 -1
  63. package/front_end/panels/mobile_throttling/ThrottlingManager.ts +40 -13
  64. package/front_end/panels/mobile_throttling/ThrottlingPresets.ts +13 -17
  65. package/front_end/panels/mobile_throttling/ThrottlingSettingsTab.ts +15 -13
  66. package/front_end/panels/network/NetworkLogView.ts +0 -9
  67. package/front_end/panels/network/NetworkPanel.ts +1 -63
  68. package/front_end/panels/network/RequestInitiatorView.ts +29 -4
  69. package/front_end/panels/network/components/HeaderSectionRow.css +9 -7
  70. package/front_end/panels/network/components/HeaderSectionRow.ts +20 -1
  71. package/front_end/panels/network/components/RequestHeaderSection.css +5 -3
  72. package/front_end/panels/network/components/RequestHeaderSection.ts +1 -2
  73. package/front_end/panels/network/components/RequestHeadersView.css +1 -1
  74. package/front_end/panels/security/SecurityPanel.ts +36 -23
  75. package/front_end/panels/settings/SettingsScreen.ts +18 -103
  76. package/front_end/panels/settings/settings-meta.ts +0 -24
  77. package/front_end/panels/timeline/TimelineController.ts +3 -2
  78. package/front_end/panels/timeline/TimelinePanel.ts +20 -3
  79. package/front_end/panels/timeline/components/CPUThrottlingSelector.ts +15 -14
  80. package/front_end/panels/timeline/timelineFlamechartPopover.css +2 -0
  81. package/front_end/panels/utils/utils.ts +25 -24
  82. package/front_end/third_party/chromium/README.chromium +1 -1
  83. package/front_end/third_party/puppeteer/README.chromium +2 -2
  84. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +34 -55
  85. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +96 -83
  86. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +10 -1
  87. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
  88. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
  89. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
  90. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +1 -1
  91. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
  92. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.d.ts.map +1 -1
  93. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/CDPSession.js.map +1 -1
  94. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts +3 -2
  95. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.d.ts.map +1 -1
  96. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/HTTPResponse.js.map +1 -1
  97. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
  98. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
  99. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.d.ts +1 -1
  100. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Target.js +1 -1
  101. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.d.ts.map +1 -1
  102. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/locators/locators.js.map +1 -1
  103. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  104. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +2 -1
  105. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
  106. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.d.ts.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/core/Realm.js.map +1 -1
  108. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +2 -2
  109. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  110. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +5 -2
  111. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  112. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Frame.js.map +1 -1
  114. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.d.ts.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js +23 -13
  116. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/FrameManager.js.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.d.ts.map +1 -1
  118. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js +4 -1
  119. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/HTTPResponse.js.map +1 -1
  120. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Input.js +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.d.ts.map +1 -1
  122. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/LifecycleWatcher.js.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.d.ts.map +1 -1
  124. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Target.js.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts +3 -41
  126. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.d.ts.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/WebMCP.js.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/ConnectOptions.d.ts.map +1 -1
  129. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.d.ts.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js +4 -2
  131. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/BrowserLauncher.js.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts +5 -0
  133. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/LaunchOptions.d.ts.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +1 -1
  136. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.d.ts.map +1 -1
  138. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js +5 -5
  139. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/httpUtils.js.map +1 -1
  140. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  142. package/front_end/third_party/puppeteer/package/lib/types.d.ts +34 -55
  143. package/front_end/third_party/puppeteer/package/package.json +4 -4
  144. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +13 -1
  145. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +2 -3
  146. package/front_end/third_party/puppeteer/package/src/api/CDPSession.ts +3 -1
  147. package/front_end/third_party/puppeteer/package/src/api/HTTPResponse.ts +3 -2
  148. package/front_end/third_party/puppeteer/package/src/api/Realm.ts +1 -2
  149. package/front_end/third_party/puppeteer/package/src/api/Target.ts +1 -1
  150. package/front_end/third_party/puppeteer/package/src/api/locators/locators.ts +1 -2
  151. package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +3 -1
  152. package/front_end/third_party/puppeteer/package/src/bidi/core/Realm.ts +1 -3
  153. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +13 -3
  154. package/front_end/third_party/puppeteer/package/src/cdp/Frame.ts +1 -1
  155. package/front_end/third_party/puppeteer/package/src/cdp/FrameManager.ts +24 -13
  156. package/front_end/third_party/puppeteer/package/src/cdp/HTTPResponse.ts +4 -1
  157. package/front_end/third_party/puppeteer/package/src/cdp/Input.ts +1 -1
  158. package/front_end/third_party/puppeteer/package/src/cdp/LifecycleWatcher.ts +1 -4
  159. package/front_end/third_party/puppeteer/package/src/cdp/Target.ts +2 -4
  160. package/front_end/third_party/puppeteer/package/src/cdp/WebMCP.ts +7 -76
  161. package/front_end/third_party/puppeteer/package/src/common/ConnectOptions.ts +1 -4
  162. package/front_end/third_party/puppeteer/package/src/node/BrowserLauncher.ts +4 -1
  163. package/front_end/third_party/puppeteer/package/src/node/LaunchOptions.ts +5 -0
  164. package/front_end/third_party/puppeteer/package/src/revisions.ts +1 -1
  165. package/front_end/third_party/puppeteer/package/src/util/httpUtils.ts +5 -5
  166. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  167. package/front_end/third_party/puppeteer/third_party/parsel/README.chromium +1 -1
  168. package/front_end/ui/components/dialogs/Dialog.ts +3 -0
  169. package/front_end/ui/components/markdown_view/MarkdownLinksMap.ts +0 -7
  170. package/front_end/ui/helpers/OpenInNewTab.ts +15 -7
  171. package/front_end/ui/legacy/TabbedPane.ts +1 -108
  172. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +9 -0
  173. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +172 -123
  174. package/front_end/ui/legacy/components/data_grid/DataGridExporter.ts +89 -0
  175. package/front_end/ui/legacy/components/data_grid/dataGrid.css +10 -0
  176. package/front_end/ui/legacy/components/data_grid/data_grid.ts +3 -1
  177. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +89 -40
  178. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  179. package/package.json +1 -1
  180. package/front_end/Images/navigationControls.png +0 -0
  181. package/front_end/Images/navigationControls_2x.png +0 -0
  182. package/front_end/Images/popoverArrows.png +0 -0
  183. package/front_end/entrypoints/greendev_floaty/FloatyEntrypoint.ts +0 -746
  184. package/front_end/entrypoints/greendev_floaty/floaty.css +0 -301
  185. package/front_end/entrypoints/greendev_floaty/floaty.html +0 -38
  186. package/front_end/entrypoints/greendev_floaty/greendev_floaty.ts +0 -415
  187. package/front_end/models/ai_assistance/agents/GreenDevAgent.ts +0 -834
  188. package/front_end/models/ai_assistance/agents/GreenDevAgentAntigravityCliSocketClient.ts +0 -53
  189. package/front_end/models/ai_assistance/agents/GreenDevAgentGeminiCliSocketClient.ts +0 -117
  190. package/front_end/models/annotations/AnnotationRepository.ts +0 -238
  191. package/front_end/models/annotations/AnnotationType.ts +0 -10
  192. package/front_end/models/annotations/README.md +0 -7
  193. package/front_end/models/annotations/annotations.ts +0 -6
  194. package/front_end/models/greendev/Prototypes.ts +0 -68
  195. package/front_end/models/greendev/README.md +0 -5
  196. package/front_end/models/greendev/greendev.ts +0 -5
  197. package/front_end/panels/common/Annotation.ts +0 -184
  198. package/front_end/panels/common/AnnotationManager.ts +0 -208
  199. package/front_end/panels/common/annotation.css +0 -40
  200. package/front_end/panels/greendev/GreenDevPanel.css +0 -282
  201. package/front_end/panels/greendev/GreenDevPanel.ts +0 -364
  202. package/front_end/panels/greendev/GreenDevShared.ts +0 -13
  203. package/front_end/panels/greendev/greendev-meta.ts +0 -52
  204. package/front_end/panels/greendev/greendev.ts +0 -9
@@ -1,53 +0,0 @@
1
- // Copyright 2026 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- export class GreenDevAgentAntigravityCliSocketClient {
6
- #websocket: WebSocket;
7
- sessionReady: Promise<void>;
8
- #sessionReadyResolve: ((value: void|PromiseLike<void>) => void)|null = null;
9
-
10
- constructor() {
11
- this.sessionReady = new Promise(resolve => {
12
- this.#sessionReadyResolve = resolve;
13
- });
14
- this.#websocket = new WebSocket('ws://localhost:5566');
15
- this.#websocket.onopen = this.#onOpen.bind(this);
16
- this.#websocket.onmessage = this.#onMessage.bind(this);
17
- this.#websocket.onclose = this.#onClose.bind(this);
18
- this.#websocket.onerror = this.#onError.bind(this);
19
- }
20
-
21
- #onOpen(): void {
22
- console.warn('WebSocket connected (Antigravity).');
23
- if (this.#sessionReadyResolve) {
24
- this.#sessionReadyResolve();
25
- this.#sessionReadyResolve = null;
26
- }
27
- }
28
-
29
- #onMessage(event: MessageEvent): void {
30
- console.warn('Antigravity WebSocket message received:', event.data);
31
- if (this.#onChunkCallback) {
32
- this.#onChunkCallback(event.data);
33
- }
34
- }
35
-
36
- #onClose(): void {
37
- console.warn('WebSocket disconnected (Antigravity).');
38
- }
39
-
40
- #onError(error: Event): void {
41
- console.error('WebSocket error (Antigravity):', error);
42
- }
43
-
44
- #onChunkCallback: ((chunk: string) => void)|null = null;
45
-
46
- sendPrompt(promptText: string, onChunk: (chunk: string) => void): Promise<void> {
47
- this.#onChunkCallback = onChunk;
48
-
49
- console.warn(`Sending Antigravity prompt: "${promptText}"`);
50
- this.#websocket.send(promptText);
51
- return Promise.resolve();
52
- }
53
- }
@@ -1,117 +0,0 @@
1
- // Copyright 2026 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- export class GreenDevAgentGeminiCliSocketClient {
6
- #websocket: WebSocket;
7
- #sessionId?: string;
8
- #activeMessage = '';
9
- #messageLog: string[] = [];
10
- #promptResolve: ((response: string) => void)|null = null;
11
- sessionReady: Promise<void>;
12
- #sessionReadyResolve: ((value: void|PromiseLike<void>) => void)|null = null;
13
-
14
- constructor() {
15
- this.sessionReady = new Promise(resolve => {
16
- this.#sessionReadyResolve = resolve;
17
- });
18
- this.#websocket = new WebSocket('ws://localhost:6655');
19
- this.#websocket.onopen = this.#onOpen.bind(this);
20
- this.#websocket.onmessage = this.#onMessage.bind(this);
21
- this.#websocket.onclose = this.#onClose.bind(this);
22
- this.#websocket.onerror = this.#onError.bind(this);
23
- }
24
-
25
- #onOpen(): void {
26
- console.warn('WebSocket connected.');
27
- this.#websocket.send(
28
- JSON.stringify({jsonrpc: '2.0', method: 'session/new', params: {cwd: '.', mcpServers: []}, id: 14}));
29
- }
30
-
31
- #onMessage(event: MessageEvent): void {
32
- this.#messageLog.push(event.data);
33
-
34
- try {
35
- const data = JSON.parse(event.data);
36
-
37
- if (data?.result?.sessionId && !this.#sessionId) {
38
- this.#sessionId = data.result.sessionId;
39
- console.warn(`Successfully created new session with ID: ${this.#sessionId}`);
40
- if (this.#sessionReadyResolve) {
41
- this.#sessionReadyResolve();
42
- this.#sessionReadyResolve = null;
43
- }
44
- }
45
-
46
- const update = data?.params?.update;
47
- if (update?.sessionUpdate === 'agent_message_chunk') {
48
- this.#activeMessage += update.content?.text || '';
49
- }
50
-
51
- if (data?.result?.stopReason) {
52
- if (this.#activeMessage) {
53
- console.warn(this.#activeMessage);
54
- }
55
- console.warn(`Stop Reason: ${data.result.stopReason}`, this.#messageLog);
56
-
57
- if (this.#promptResolve) {
58
- this.#promptResolve(this.#activeMessage);
59
- this.#promptResolve = null;
60
- }
61
-
62
- this.#activeMessage = '';
63
- this.#messageLog = [];
64
- } else if (data?.method === 'session/request_permission') {
65
- // TODO(finnur): Needs augmenting once I turn off YOLO in the bridge.
66
- this.#websocket.send(JSON.stringify({
67
- jsonrpc: '2.0',
68
- id: data.id,
69
- result: {
70
- outcome: {
71
- selected: {
72
- optionId: 'proceed_always',
73
- },
74
- },
75
- },
76
- }));
77
- }
78
- } catch (e) {
79
- // Log the raw data if it's not valid JSON.
80
- console.error('Failed to parse WebSocket message or process data:', event.data, e);
81
- }
82
- }
83
-
84
- #onClose(): void {
85
- console.warn('WebSocket disconnected.');
86
- }
87
-
88
- #onError(error: Event): void {
89
- console.error('WebSocket error:', error);
90
- }
91
-
92
- sendPrompt(promptText: string): Promise<string> {
93
- return new Promise((resolve, reject) => {
94
- if (this.#promptResolve) {
95
- reject(new Error('Another prompt is already in progress.'));
96
- return;
97
- }
98
- if (!this.#sessionId) {
99
- reject(new Error('Cannot send prompt without a session ID.'));
100
- return;
101
- }
102
- this.#promptResolve = resolve;
103
-
104
- console.warn(`Sending prompt: "${promptText}"`);
105
- console.warn('Thinking...');
106
- this.#websocket.send(JSON.stringify({
107
- jsonrpc: '2.0',
108
- method: 'session/prompt',
109
- params: {
110
- prompt: [{type: 'text', text: promptText}],
111
- sessionId: this.#sessionId,
112
- },
113
- id: 15,
114
- }));
115
- });
116
- }
117
- }
@@ -1,238 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../core/common/common.js';
6
- import type * as SDK from '../../core/sdk/sdk.js';
7
- import * as GreenDev from '../greendev/greendev.js';
8
-
9
- import {AnnotationType} from './AnnotationType.js';
10
-
11
- export interface BaseAnnotationData {
12
- id: number;
13
- type: AnnotationType;
14
- message: string;
15
- // Sometimes the anchor for an annotation is not known, but is provided using a
16
- // string id instead (which can be converted to a proper `anchor`).
17
- lookupId: string;
18
- // Sometimes we want annotations to anchor to a particular string on the page.
19
- anchorToString?: string;
20
- }
21
-
22
- export interface ElementsAnnotationData extends BaseAnnotationData {
23
- type: AnnotationType.ELEMENT_NODE;
24
- anchor?: SDK.DOMModel.DOMNode;
25
- }
26
-
27
- export interface NetworkRequestAnnotationData extends BaseAnnotationData {
28
- type: AnnotationType.NETWORK_REQUEST;
29
- anchor?: SDK.NetworkRequest.NetworkRequest;
30
- }
31
-
32
- export interface NetworkRequestDetailsAnnotationData extends BaseAnnotationData {
33
- type: AnnotationType.NETWORK_REQUEST_SUBPANEL_HEADERS;
34
- anchor?: SDK.NetworkRequest.NetworkRequest;
35
- }
36
-
37
- export const enum Events {
38
- ANNOTATION_ADDED = 'AnnotationAdded',
39
- ANNOTATION_DELETED = 'AnnotationDeleted',
40
- ALL_ANNOTATIONS_DELETED = 'AllAnnotationsDeleted',
41
- }
42
-
43
- export interface EventTypes {
44
- [Events.ANNOTATION_ADDED]: BaseAnnotationData;
45
- [Events.ANNOTATION_DELETED]: {id: number};
46
- [Events.ALL_ANNOTATIONS_DELETED]: void;
47
- }
48
-
49
- export class AnnotationRepository {
50
- static #instance: AnnotationRepository|null = null;
51
- static #hasRepliedGreenDevDisabled = false;
52
- static #hasShownFlagWarning = false;
53
-
54
- #events = new Common.ObjectWrapper.ObjectWrapper<EventTypes>();
55
- #annotationData: BaseAnnotationData[] = [];
56
- #nextId = 0;
57
-
58
- static instance(): AnnotationRepository {
59
- if (!AnnotationRepository.#instance) {
60
- AnnotationRepository.#instance = new AnnotationRepository();
61
- }
62
- return AnnotationRepository.#instance;
63
- }
64
-
65
- static annotationsEnabled(): boolean {
66
- const enabled = GreenDev.Prototypes.instance().isEnabled('aiAnnotations');
67
- // TODO(finnur): Fix race when Repository is created before feature flags have been set properly.
68
- if (!enabled) {
69
- this.#hasRepliedGreenDevDisabled = true;
70
- } else if (this.#hasRepliedGreenDevDisabled && !this.#hasShownFlagWarning) {
71
- console.warn(
72
- 'Flag controlling GreenDev has flipped from false to true. ' +
73
- 'Only some callers will expect GreenDev to be enabled, which can lead to unexpected results.');
74
- this.#hasShownFlagWarning = true;
75
- }
76
- return Boolean(enabled);
77
- }
78
-
79
- addEventListener<T extends keyof EventTypes>(
80
- eventType: T, listener: (arg0: Common.EventTarget.EventTargetEvent<EventTypes[T]>) => void,
81
- thisObject?: Object): Common.EventTarget.EventDescriptor<EventTypes, T> {
82
- if (!AnnotationRepository.annotationsEnabled()) {
83
- console.warn('Received request to add event listener with annotations disabled');
84
- }
85
- return this.#events.addEventListener(eventType, listener, thisObject);
86
- }
87
-
88
- getAnnotationDataByType(type: AnnotationType): BaseAnnotationData[] {
89
- if (!AnnotationRepository.annotationsEnabled()) {
90
- console.warn('Received query for annotation types with annotations disabled');
91
- return [];
92
- }
93
-
94
- const annotations = this.#annotationData.filter(annotation => annotation.type === type);
95
- return annotations;
96
- }
97
-
98
- getAnnotationDataById(id: number): BaseAnnotationData|undefined {
99
- if (!AnnotationRepository.annotationsEnabled()) {
100
- console.warn('Received query for annotation type with annotations disabled');
101
- return undefined;
102
- }
103
-
104
- return this.#annotationData.find(annotation => annotation.id === id);
105
- }
106
-
107
- #getExistingAnnotation(type: AnnotationType, anchor?: SDK.DOMModel.DOMNode|SDK.NetworkRequest.NetworkRequest|string):
108
- BaseAnnotationData|undefined {
109
- const annotations = this.getAnnotationDataByType(type);
110
- const annotation = annotations.find(annotation => {
111
- if (typeof anchor === 'string') {
112
- return annotation.lookupId === anchor;
113
- }
114
- switch (type) {
115
- case AnnotationType.ELEMENT_NODE: {
116
- const elementAnnotation = annotation as ElementsAnnotationData;
117
- return elementAnnotation.anchor === anchor;
118
- }
119
- case AnnotationType.NETWORK_REQUEST_SUBPANEL_HEADERS: {
120
- const networkRequestDetailsAnnotation = annotation as NetworkRequestDetailsAnnotationData;
121
- return networkRequestDetailsAnnotation.anchor === anchor;
122
- }
123
- default:
124
- console.warn('[AnnotationRepository] Unknown AnnotationType', type);
125
- return false;
126
- }
127
- });
128
- return annotation;
129
- }
130
-
131
- #updateExistingAnnotationLabel(
132
- label: string, type: AnnotationType,
133
- anchor?: SDK.DOMModel.DOMNode|SDK.NetworkRequest.NetworkRequest|string): boolean {
134
- const annotation = this.#getExistingAnnotation(type, anchor);
135
- if (annotation) {
136
- // TODO(finnur): This should work for annotations that have not been displayed yet,
137
- // but we need to also notify the AnnotationManager for those that have been shown.
138
- annotation.message = label;
139
- return true;
140
- }
141
- return false;
142
- }
143
-
144
- addElementsAnnotation(
145
- label: string,
146
- anchor?: SDK.DOMModel.DOMNode|string,
147
- anchorToString?: string,
148
- ): void {
149
- if (!AnnotationRepository.annotationsEnabled()) {
150
- console.warn('Received annotation registration with annotations disabled');
151
- return;
152
- }
153
-
154
- if (this.#updateExistingAnnotationLabel(label, AnnotationType.ELEMENT_NODE, anchor)) {
155
- return;
156
- }
157
-
158
- const annotationData: ElementsAnnotationData = {
159
- id: this.#nextId++,
160
- type: AnnotationType.ELEMENT_NODE,
161
- message: label,
162
- lookupId: typeof anchor === 'string' ? anchor : '',
163
- anchor: typeof anchor !== 'string' ? anchor : undefined,
164
- anchorToString,
165
- };
166
- this.#annotationData.push(annotationData);
167
- // eslint-disable-next-line no-console
168
- console.log('[AnnotationRepository] Added element annotation:', label, {
169
- annotationData,
170
- annotations: this.#annotationData.length,
171
- });
172
- this.#events.dispatchEventToListeners(Events.ANNOTATION_ADDED, annotationData);
173
- }
174
-
175
- addNetworkRequestAnnotation(
176
- label: string,
177
- anchor?: SDK.NetworkRequest.NetworkRequest|string,
178
- anchorToString?: string,
179
- ): void {
180
- if (!AnnotationRepository.annotationsEnabled()) {
181
- console.warn('Received annotation registration with annotations disabled');
182
- return;
183
- }
184
-
185
- // We only need to update the NETWORK_REQUEST_SUBPANEL_HEADERS because the
186
- // NETWORK_REQUEST Annotation has no meaningful label.
187
- if (this.#updateExistingAnnotationLabel(label, AnnotationType.NETWORK_REQUEST_SUBPANEL_HEADERS, anchor)) {
188
- return;
189
- }
190
-
191
- const annotationData: NetworkRequestAnnotationData = {
192
- id: this.#nextId++,
193
- type: AnnotationType.NETWORK_REQUEST,
194
- message: '',
195
- lookupId: typeof anchor === 'string' ? anchor : '',
196
- anchor: typeof anchor !== 'string' ? anchor : undefined,
197
- anchorToString,
198
- };
199
- this.#annotationData.push(annotationData);
200
- // eslint-disable-next-line no-console
201
- console.log('[AnnotationRepository] Added annotation:', label, {
202
- annotationData,
203
- annotations: this.#annotationData.length,
204
- });
205
- this.#events.dispatchEventToListeners(Events.ANNOTATION_ADDED, annotationData);
206
-
207
- const annotationDetailsData: NetworkRequestDetailsAnnotationData = {
208
- id: this.#nextId++,
209
- type: AnnotationType.NETWORK_REQUEST_SUBPANEL_HEADERS,
210
- message: label,
211
- lookupId: typeof anchor === 'string' ? anchor : '',
212
- anchor: typeof anchor !== 'string' ? anchor : undefined,
213
- anchorToString,
214
- };
215
-
216
- this.#annotationData.push(annotationDetailsData);
217
- this.#events.dispatchEventToListeners(Events.ANNOTATION_ADDED, annotationDetailsData);
218
- }
219
-
220
- deleteAllAnnotations(): void {
221
- this.#annotationData = [];
222
- this.#events.dispatchEventToListeners(Events.ALL_ANNOTATIONS_DELETED);
223
- // eslint-disable-next-line no-console
224
- console.log('[AnnotationRepository] Deleting all annotations');
225
- }
226
-
227
- deleteAnnotation(id: number): void {
228
- const index = this.#annotationData.findIndex(annotation => annotation.id === id);
229
- if (index === -1) {
230
- console.warn(`[AnnotationRepository] Could not find annotation with id ${id}`);
231
- return;
232
- }
233
- this.#annotationData.splice(index, 1);
234
- this.#events.dispatchEventToListeners(Events.ANNOTATION_DELETED, {id});
235
- // eslint-disable-next-line no-console
236
- console.log(`[AnnotationRepository] Deleted annotation with id ${id}`);
237
- }
238
- }
@@ -1,10 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- export enum AnnotationType {
6
- ELEMENT_NODE = 0,
7
- STYLE_RULE = 1,
8
- NETWORK_REQUEST = 2,
9
- NETWORK_REQUEST_SUBPANEL_HEADERS = 3,
10
- }
@@ -1,7 +0,0 @@
1
- # Annotations Model
2
-
3
- **IMPORTANT**: this model exists because on the GreenDev project we prototyped a build of DevTools that is able to add annotations to various parts of the UI.
4
-
5
- This feature is only enabled when Chromium is run with the GreenDev feature flag enabled. There are currently NO PLANS to ship this code to production.
6
-
7
- If you are reading this and you want to use this code, please speak to jacktfranklin@ first. This code is for a prototype and not in a production state.
@@ -1,6 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- export * from './AnnotationRepository.js';
6
- export * from './AnnotationType.js';
@@ -1,68 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- import * as Common from '../../core/common/common.js';
6
- import * as Root from '../../core/root/root.js';
7
-
8
- let instance: Prototypes|null = null;
9
-
10
- export interface GreenDevSettings {
11
- aiAnnotations: Common.Settings.Setting<boolean>;
12
- beyondStylingGemini: Common.Settings.Setting<boolean>;
13
- beyondStylingAntigravity: Common.Settings.Setting<boolean>;
14
- emulationCapabilities: Common.Settings.Setting<boolean>;
15
- }
16
-
17
- export class Prototypes {
18
- private constructor() {
19
- }
20
-
21
- static instance(): Prototypes {
22
- if (instance) {
23
- return instance;
24
- }
25
- instance = new Prototypes();
26
- return instance;
27
- }
28
-
29
- /**
30
- * Returns true if the specific setting is turned on AND the GreenDev flag is enabled
31
- */
32
- isEnabled(setting: keyof GreenDevSettings): boolean {
33
- const greendevFlagEnabled = Boolean(Root.Runtime.hostConfig.devToolsGreenDevUi?.enabled);
34
-
35
- return greendevFlagEnabled && this.settings()[setting].get();
36
- }
37
-
38
- settings(): Readonly<GreenDevSettings> {
39
- const settings = Common.Settings.Settings.instance();
40
- const aiAnnotations = settings.createSetting(
41
- 'greendev-ai-annotations-enabled',
42
- false,
43
- Common.Settings.SettingStorageType.LOCAL,
44
- );
45
- const beyondStylingGemini = settings.createSetting(
46
- 'greendev-beyond-styling-gemini-enabled',
47
- false,
48
- Common.Settings.SettingStorageType.GLOBAL,
49
- );
50
- const beyondStylingAntigravity = settings.createSetting(
51
- 'greendev-beyond-styling-antigravity-enabled',
52
- false,
53
- Common.Settings.SettingStorageType.GLOBAL,
54
- );
55
- const emulationCapabilities = settings.createSetting(
56
- 'greendev-emulation-capabilities-enabled',
57
- false,
58
- Common.Settings.SettingStorageType.LOCAL,
59
- );
60
-
61
- return {
62
- aiAnnotations,
63
- beyondStylingGemini,
64
- beyondStylingAntigravity,
65
- emulationCapabilities
66
- };
67
- }
68
- }
@@ -1,5 +0,0 @@
1
- # GreenDev Model
2
-
3
- As part of GreenDev we are building a bunch of prototypes into DevTools to user test. This model holds which prototypes are enabled for a given user.
4
-
5
- The settings is only stored in local storage, and not synced across devices or persisted in anyway beyond that.
@@ -1,5 +0,0 @@
1
- // Copyright 2025 The Chromium Authors
2
- // Use of this source code is governed by a BSD-style license that can be
3
- // found in the LICENSE file.
4
-
5
- export * from './Prototypes.js';