chrome-devtools-frontend 1.0.1668390 → 1.0.1669021

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 (192) hide show
  1. package/.agents/skills/devtools-ci/SKILL.md +65 -0
  2. package/.agents/skills/gerrit-cli/SKILL.md +59 -0
  3. package/.agents/skills/gerrit-cli/references/commands.md +93 -0
  4. package/.agents/skills/gerrit-cli/references/workflows.md +56 -0
  5. package/.agents/skills/gerrit-cli/scripts/gerrit_client_wrapper.py +47 -0
  6. package/.agents/skills/gerrit-cli/scripts/import_upstream.py +230 -0
  7. package/docs/contributing/infrastructure.md +7 -1
  8. package/front_end/core/host/AidaClient.ts +66 -47
  9. package/front_end/core/host/GcaClient.ts +4 -6
  10. package/front_end/core/host/ResourceLoader.ts +4 -2
  11. package/front_end/core/root/Runtime.ts +0 -5
  12. package/front_end/core/sdk/ConsoleModel.ts +3 -2
  13. package/front_end/core/sdk/DebuggerModel.ts +14 -6
  14. package/front_end/core/sdk/SDKSettings.ts +19 -0
  15. package/front_end/core/sdk/sdk-meta.ts +0 -58
  16. package/front_end/generated/InspectorBackendCommands.ts +2 -2
  17. package/front_end/generated/protocol.ts +11 -3
  18. package/front_end/models/ai_assistance/AiUtils.ts +67 -4
  19. package/front_end/models/ai_assistance/StorageItem.ts +26 -5
  20. package/front_end/models/ai_code_completion/AiCodeCompletion.ts +2 -19
  21. package/front_end/models/ai_code_generation/AiCodeGeneration.ts +2 -3
  22. package/front_end/models/trace/handlers/RendererHandler.ts +20 -4
  23. package/front_end/models/trace/types/File.ts +1 -0
  24. package/front_end/models/workspace/UISourceCode.ts +0 -10
  25. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +61 -182
  26. package/front_end/panels/ai_assistance/components/ChatInput.ts +25 -8
  27. package/front_end/panels/ai_assistance/components/ChatMessage.ts +13 -69
  28. package/front_end/panels/ai_assistance/components/ChatView.ts +14 -8
  29. package/front_end/panels/ai_assistance/components/chatMessage.css +2 -20
  30. package/front_end/panels/application/ApplicationPanelSidebar.ts +2 -2
  31. package/front_end/panels/application/ApplicationPanelTreeElement.ts +41 -3
  32. package/front_end/panels/application/ServiceWorkerUpdateCycleView.ts +116 -79
  33. package/front_end/panels/application/ServiceWorkersView.ts +8 -8
  34. package/front_end/panels/application/application.ts +2 -0
  35. package/front_end/panels/application/components/AdsView.ts +10 -6
  36. package/front_end/panels/application/preloading/PreloadingView.ts +53 -45
  37. package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +111 -119
  38. package/front_end/panels/application/preloading/components/preloadingDetailsReportView.css +21 -23
  39. package/front_end/panels/application/serviceWorkerUpdateCycleView.css +105 -102
  40. package/front_end/panels/common/AiCodeCompletionDisclaimer.ts +107 -96
  41. package/front_end/panels/common/AiCodeCompletionSummaryToolbar.ts +17 -19
  42. package/front_end/panels/common/AiCodeCompletionTeaser.ts +6 -6
  43. package/front_end/panels/common/AiCodeGenerationTeaser.ts +28 -26
  44. package/front_end/panels/common/common.ts +1 -1
  45. package/front_end/panels/console/ConsoleInsightTeaser.ts +3 -6
  46. package/front_end/panels/console/ConsoleView.ts +6 -4
  47. package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
  48. package/front_end/panels/console/console-meta.ts +28 -0
  49. package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +1 -1
  50. package/front_end/panels/elements/StylesSidebarPane.ts +3 -2
  51. package/front_end/panels/emulation/DeviceModeWrapper.ts +18 -4
  52. package/front_end/panels/explain/components/ConsoleInsight.ts +4 -6
  53. package/front_end/panels/explain/explain-meta.ts +7 -49
  54. package/front_end/panels/network/NetworkDataGridNode.ts +1 -1
  55. package/front_end/panels/network/NetworkLogView.ts +1 -0
  56. package/front_end/panels/network/OriginalResourceChunkView.ts +340 -0
  57. package/front_end/panels/network/ResourceChunkView.ts +72 -46
  58. package/front_end/panels/network/ResourceDirectSocketChunkView.ts +3 -2
  59. package/front_end/panels/network/ResourceWebSocketFrameView.ts +3 -3
  60. package/front_end/panels/network/originalResourceChunkView.css +49 -0
  61. package/front_end/panels/screencast/ScreencastView.ts +401 -260
  62. package/front_end/panels/screencast/screencastView.css +113 -100
  63. package/front_end/panels/sensors/LocationsSettingsTab.ts +106 -122
  64. package/front_end/panels/sensors/locationsSettingsTab.css +4 -4
  65. package/front_end/panels/settings/AISettingsTab.ts +17 -100
  66. package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +2 -2
  67. package/front_end/panels/snippets/SnippetsQuickOpen.ts +4 -4
  68. package/front_end/panels/sources/AddSourceMapURLDialog.ts +3 -3
  69. package/front_end/panels/sources/AiCodeCompletionPlugin.ts +4 -3
  70. package/front_end/panels/sources/BreakpointEditDialog.ts +14 -14
  71. package/front_end/panels/sources/BreakpointsView.ts +14 -14
  72. package/front_end/panels/sources/CallStackSidebarPane.ts +6 -6
  73. package/front_end/panels/sources/CategorizedBreakpointL10n.ts +18 -18
  74. package/front_end/panels/sources/CoveragePlugin.ts +7 -7
  75. package/front_end/panels/sources/DebuggerPausedMessage.ts +23 -23
  76. package/front_end/panels/sources/DebuggerPlugin.ts +29 -29
  77. package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +2 -2
  78. package/front_end/panels/sources/GoToLineQuickOpen.ts +10 -10
  79. package/front_end/panels/sources/NavigatorView.ts +34 -27
  80. package/front_end/panels/sources/OutlineQuickOpen.ts +3 -3
  81. package/front_end/panels/sources/PersistenceActions.ts +9 -9
  82. package/front_end/panels/sources/ProfilePlugin.ts +1 -1
  83. package/front_end/panels/sources/ScopeChainSidebarPane.ts +5 -5
  84. package/front_end/panels/sources/SnippetsPlugin.ts +2 -2
  85. package/front_end/panels/sources/SourcesNavigator.ts +20 -18
  86. package/front_end/panels/sources/SourcesPanel.ts +26 -25
  87. package/front_end/panels/sources/SourcesView.ts +5 -6
  88. package/front_end/panels/sources/TabbedEditorContainer.ts +3 -3
  89. package/front_end/panels/sources/ThreadsSidebarPane.ts +1 -1
  90. package/front_end/panels/sources/UISourceCodeFrame.ts +0 -2
  91. package/front_end/panels/sources/WatchExpressionsSidebarPane.ts +7 -7
  92. package/front_end/panels/sources/components/HeadersView.ts +2 -2
  93. package/front_end/panels/sources/sources-meta.ts +109 -71
  94. package/front_end/panels/sources/sources.ts +0 -2
  95. package/front_end/panels/timeline/TimelineHistoryManager.ts +14 -3
  96. package/front_end/panels/timeline/TimelineLoader.ts +72 -42
  97. package/front_end/panels/timeline/TimelinePanel.ts +29 -4
  98. package/front_end/panels/timeline/timelineHistoryManager.css +4 -0
  99. package/front_end/third_party/chromium/README.chromium +1 -1
  100. package/front_end/third_party/puppeteer/README.chromium +2 -2
  101. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.d.ts +187 -1
  102. package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +91 -38
  103. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts +145 -2
  104. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.d.ts.map +1 -1
  105. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js +0 -2
  106. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Browser.js.map +1 -1
  107. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts +0 -2
  108. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.d.ts.map +1 -1
  109. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js +0 -2
  110. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/BrowserContext.js.map +1 -1
  111. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.d.ts +3 -2
  112. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.d.ts.map +1 -1
  113. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.js +8 -2
  114. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Dialog.js.map +1 -1
  115. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.d.ts +0 -2
  116. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.d.ts.map +1 -1
  117. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js +0 -2
  118. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/JSHandle.js.map +1 -1
  119. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts +1 -3
  120. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.d.ts.map +1 -1
  121. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js +0 -2
  122. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Page.js.map +1 -1
  123. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts +0 -1
  124. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.d.ts.map +1 -1
  125. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js +0 -1
  126. package/front_end/third_party/puppeteer/package/lib/puppeteer/api/Realm.js.map +1 -1
  127. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.d.ts.map +1 -1
  128. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js +2 -2
  129. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/BidiOverCdp.js.map +1 -1
  130. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts +5 -1
  131. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.d.ts.map +1 -1
  132. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js +12 -0
  133. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/Browser.js.map +1 -1
  134. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.d.ts.map +1 -1
  135. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js +4 -1
  136. package/front_end/third_party/puppeteer/package/lib/puppeteer/bidi/HTTPResponse.js.map +1 -1
  137. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts +5 -1
  138. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.d.ts.map +1 -1
  139. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js +49 -0
  140. package/front_end/third_party/puppeteer/package/lib/puppeteer/cdp/Browser.js.map +1 -1
  141. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts +0 -6
  142. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.d.ts.map +1 -1
  143. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js +0 -6
  144. package/front_end/third_party/puppeteer/package/lib/puppeteer/common/EventEmitter.js.map +1 -1
  145. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts +1 -1
  146. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.d.ts.map +1 -1
  147. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js +1 -1
  148. package/front_end/third_party/puppeteer/package/lib/puppeteer/generated/injected.js.map +1 -1
  149. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/util.d.ts.map +1 -1
  150. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/util.js +3 -0
  151. package/front_end/third_party/puppeteer/package/lib/puppeteer/injected/util.js.map +1 -1
  152. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts +0 -3
  153. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.d.ts.map +1 -1
  154. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js +0 -3
  155. package/front_end/third_party/puppeteer/package/lib/puppeteer/node/ScreenRecorder.js.map +1 -1
  156. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.d.ts +3 -3
  157. package/front_end/third_party/puppeteer/package/lib/puppeteer/revisions.js +3 -3
  158. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/disposable.d.ts +2 -2
  159. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/disposable.js +2 -2
  160. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.d.ts +1 -1
  161. package/front_end/third_party/puppeteer/package/lib/puppeteer/util/version.js +1 -1
  162. package/front_end/third_party/puppeteer/package/lib/types.d.ts +187 -1
  163. package/front_end/third_party/puppeteer/package/package.json +5 -5
  164. package/front_end/third_party/puppeteer/package/src/api/Browser.ts +155 -2
  165. package/front_end/third_party/puppeteer/package/src/api/BrowserContext.ts +0 -2
  166. package/front_end/third_party/puppeteer/package/src/api/Dialog.ts +10 -2
  167. package/front_end/third_party/puppeteer/package/src/api/JSHandle.ts +0 -2
  168. package/front_end/third_party/puppeteer/package/src/api/Page.ts +1 -3
  169. package/front_end/third_party/puppeteer/package/src/api/Realm.ts +0 -1
  170. package/front_end/third_party/puppeteer/package/src/bidi/BidiOverCdp.ts +4 -2
  171. package/front_end/third_party/puppeteer/package/src/bidi/Browser.ts +17 -0
  172. package/front_end/third_party/puppeteer/package/src/bidi/HTTPResponse.ts +5 -4
  173. package/front_end/third_party/puppeteer/package/src/cdp/Browser.ts +66 -0
  174. package/front_end/third_party/puppeteer/package/src/common/EventEmitter.ts +0 -6
  175. package/front_end/third_party/puppeteer/package/src/generated/injected.ts +1 -1
  176. package/front_end/third_party/puppeteer/package/src/injected/util.ts +4 -1
  177. package/front_end/third_party/puppeteer/package/src/node/ScreenRecorder.ts +0 -3
  178. package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
  179. package/front_end/third_party/puppeteer/package/src/util/disposable.ts +2 -2
  180. package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
  181. package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +9 -7
  182. package/front_end/ui/components/text_editor/AiCodeGenerationProvider.ts +7 -8
  183. package/front_end/ui/legacy/Dialog.ts +12 -2
  184. package/front_end/ui/legacy/TabbedPane.ts +7 -2
  185. package/front_end/ui/legacy/components/cookie_table/CookiesTable.ts +40 -24
  186. package/front_end/ui/legacy/components/data_grid/DataGrid.ts +1 -0
  187. package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +8 -4
  188. package/front_end/ui/legacy/components/perf_ui/FlameChart.ts +14 -7
  189. package/front_end/ui/legacy/components/quick_open/CommandMenu.ts +11 -1
  190. package/front_end/ui/visual_logging/KnownContextValues.ts +2 -0
  191. package/package.json +1 -1
  192. package/front_end/panels/sources/AiWarningInfobarPlugin.ts +0 -78
@@ -33,7 +33,7 @@ import * as GcaClient from './GcaClient.js';
33
33
  import type {GenerateContentResponse} from './GcaTypes.js';
34
34
  import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
35
35
  import type {AidaClientResult, AidaCodeCompleteResult, SyncInformation} from './InspectorFrontendHostAPI.js';
36
- import {bindOutputStream} from './ResourceLoader.js';
36
+ import {bindOutputStream, discardOutputStream} from './ResourceLoader.js';
37
37
 
38
38
  export * from './AidaClientTypes.js';
39
39
 
@@ -159,6 +159,10 @@ export class AidaClient {
159
159
  throw new Error('dispatchHttpRequest is not available');
160
160
  }
161
161
 
162
+ if (options?.signal?.aborted) {
163
+ throw new AidaAbortError();
164
+ }
165
+
162
166
  // Disable logging for now.
163
167
  // For context, see b/454563259#comment35.
164
168
  // We should be able to remove this ~end of April.
@@ -166,51 +170,67 @@ export class AidaClient {
166
170
  request.metadata.disable_user_content_logging = true;
167
171
  }
168
172
 
169
- const stream = (() => {
170
- let {promise, resolve, reject} = Promise.withResolvers<string|null>();
171
- options?.signal?.addEventListener('abort', () => {
172
- reject(new AidaAbortError());
173
- }, {once: true});
174
- return {
175
- write: async(data: string): Promise<void> => {
176
- resolve(data);
177
- ({promise, resolve, reject} = Promise.withResolvers<string|null>());
178
- },
179
- close: async(): Promise<void> => {
180
- resolve(null);
181
- },
182
- read: (): Promise<string|null> => {
183
- return promise;
173
+ let abortListener: (() => void)|undefined;
174
+ let streamId: number|undefined;
175
+ try {
176
+ const stream = (() => {
177
+ let {promise, resolve, reject} = Promise.withResolvers<string|null>();
178
+ // Prevent unhandled promise rejections if stream.fail() is called after
179
+ // doConversation has already exited early (e.g. on recitation block or abort).
180
+ // Active readers calling await stream.read() will still receive the rejection.
181
+ promise.catch(() => {});
182
+ abortListener = () => {
183
+ reject(new AidaAbortError());
184
+ };
185
+ options?.signal?.addEventListener('abort', abortListener, {once: true});
186
+ return {
187
+ write: async(data: string): Promise<void> => {
188
+ resolve(data);
189
+ ({promise, resolve, reject} = Promise.withResolvers<string|null>());
190
+ promise.catch(() => {});
191
+ },
192
+ close: async(): Promise<void> => {
193
+ resolve(null);
194
+ },
195
+ read: (): Promise<string|null> => {
196
+ return promise;
197
+ },
198
+ fail: (e: Error) => reject(e),
199
+ };
200
+ })();
201
+ streamId = bindOutputStream(stream);
202
+
203
+ let response;
204
+ if (this.#gcaClient.enabled()) {
205
+ // Inline and remove the else clause after migration
206
+ response = this.#gcaClient.conversationRequest(request, streamId, options);
207
+ } else {
208
+ response = DispatchHttpRequestClient.makeHttpRequest({
209
+ service: SERVICE_NAME,
210
+ path: '/v1/aida:doConversation',
211
+ method: 'POST',
212
+ body: JSON.stringify(request),
213
+ streamId,
184
214
  },
185
- fail: (e: Error) => reject(e),
186
- };
187
- })();
188
- const streamId = bindOutputStream(stream);
189
-
190
- let response;
191
- if (this.#gcaClient.enabled()) {
192
- // Inline and remove the else clause after migration
193
- response = this.#gcaClient.conversationRequest(request, streamId, options);
194
- } else {
195
- response = DispatchHttpRequestClient.makeHttpRequest(
196
- {
197
- service: SERVICE_NAME,
198
- path: '/v1/aida:doConversation',
199
- method: 'POST',
200
- body: JSON.stringify(request),
201
- streamId,
215
+ options);
216
+ }
217
+ response.then(
218
+ () => {
219
+ void stream.close();
202
220
  },
203
- options);
221
+ err => {
222
+ debugLog('doConversation failed with error:', JSON.stringify(err));
223
+ stream.fail(mapError(err));
224
+ });
225
+ yield* this.#handleResponseStream(stream);
226
+ } finally {
227
+ if (options?.signal && abortListener) {
228
+ options.signal.removeEventListener('abort', abortListener);
229
+ }
230
+ if (streamId !== undefined) {
231
+ discardOutputStream(streamId);
232
+ }
204
233
  }
205
- response.then(
206
- () => {
207
- void stream.close();
208
- },
209
- err => {
210
- debugLog('doConversation failed with error:', JSON.stringify(err));
211
- stream.fail(mapError(err));
212
- });
213
- await (yield* this.#handleResponseStream(stream));
214
234
  }
215
235
 
216
236
  async * #handleResponseStream(stream: AiStream): AsyncGenerator<DoConversationResponse, void, void> {
@@ -397,8 +417,7 @@ export class AidaClient {
397
417
  return {generatedSamples, metadata};
398
418
  }
399
419
 
400
- async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}):
401
- Promise<GenerateCodeResponse|null> {
420
+ async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}): Promise<GenerateCodeResponse> {
402
421
  // Disable logging for now.
403
422
  // For context, see b/454563259#comment35.
404
423
  // We should be able to remove this ~end of April.
@@ -495,8 +514,8 @@ export class HostConfigTracker extends Common.ObjectWrapper.ObjectWrapper<EventT
495
514
  return eventDescriptor;
496
515
  }
497
516
 
498
- override removeEventListener(eventType: Events, listener: Common.EventTarget.EventListener<EventTypes, Events>):
499
- void {
517
+ override removeEventListener(eventType: Events,
518
+ listener: Common.EventTarget.EventListener<EventTypes, Events>): void {
500
519
  super.removeEventListener(eventType, listener);
501
520
  if (!this.hasEventListeners(eventType)) {
502
521
  clearTimeout(this.#pollTimer);
@@ -77,18 +77,16 @@ export class GcaClient {
77
77
  });
78
78
  }
79
79
 
80
- async completeCode(request: CompletionRequest): Promise<CompletionResponse|null> {
80
+ async completeCode(request: CompletionRequest): Promise<CompletionResponse> {
81
81
  const gcaRequest = aidaCompletionRequestToGcaRequest(request);
82
82
  const result = await this.#requestContent(gcaRequest);
83
- const aidaResult = result ? gcaResponseToAidaCompletionResponse(result) : null;
84
- return aidaResult;
83
+ return gcaResponseToAidaCompletionResponse(result);
85
84
  }
86
85
 
87
- async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}):
88
- Promise<GenerateCodeResponse|null> {
86
+ async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}): Promise<GenerateCodeResponse> {
89
87
  const gcaRequest = aidaGenerateCodeRequestToGcaRequest(request);
90
88
  const result = await this.#requestContent(gcaRequest, options);
91
- return result ? gcaResponseToAidaGenerateCodeResponse(result) : null;
89
+ return gcaResponseToAidaGenerateCodeResponse(result);
92
90
  }
93
91
 
94
92
  async #requestContent(request: GenerateContentRequest,
@@ -80,8 +80,10 @@ export const bindOutputStream = function(stream: Common.StringOutputStream.Outpu
80
80
  };
81
81
 
82
82
  export const discardOutputStream = function(id: number): void {
83
- void _boundStreams[id].close();
84
- delete _boundStreams[id];
83
+ if (_boundStreams[id]) {
84
+ void _boundStreams[id].close();
85
+ delete _boundStreams[id];
86
+ }
85
87
  };
86
88
 
87
89
  export const streamWrite = function(id: number, chunk: string): void {
@@ -560,10 +560,6 @@ export interface HostConfigJpegXlImageFormat {
560
560
  enabled: boolean;
561
561
  }
562
562
 
563
- export interface HostConfigAiAssistanceV2 {
564
- enabled: boolean;
565
- }
566
-
567
563
  interface AiGeneratedTimelineLabels {
568
564
  enabled: boolean;
569
565
  }
@@ -677,7 +673,6 @@ export type HostConfig = Platform.TypeScriptUtilities.RecursivePartial<{
677
673
  devToolsAiAssistancePerformanceAgent: HostConfigAiAssistancePerformanceAgent,
678
674
  devToolsAiAssistanceAccessibilityAgent: HostConfigAiAssistanceAccessibilityAgent,
679
675
  devToolsAiAssistanceStorageAgent: HostConfigAiAssistanceStorageAgent,
680
- devToolsAiAssistanceV2: HostConfigAiAssistanceV2,
681
676
  devToolsAiV2Architecture: DevToolsAiV2Architecture,
682
677
  devToolsAiCodeCompletion: HostConfigAiCodeCompletion,
683
678
  devToolsAiCodeGeneration: HostConfigAiCodeGeneration,
@@ -34,6 +34,7 @@ import {
34
34
  RuntimeModel,
35
35
  } from './RuntimeModel.js';
36
36
  import {SDKModel} from './SDKModel.js';
37
+ import {preserveConsoleLogSettingDescriptor} from './SDKSettings.js';
37
38
  import {Capability, type Target, Type} from './Target.js';
38
39
  import type {TargetManager} from './TargetManager.js';
39
40
 
@@ -287,7 +288,7 @@ export class ConsoleModel extends SDKModel<EventTypes> {
287
288
 
288
289
  private clearIfNecessary(): void {
289
290
  const settings = this.target().targetManager().settings;
290
- if (!settings.moduleSetting('preserve-console-log').get()) {
291
+ if (!settings.resolve(preserveConsoleLogSettingDescriptor).get()) {
291
292
  this.clear();
292
293
  }
293
294
  ++this.#pageLoadSequenceNumber;
@@ -296,7 +297,7 @@ export class ConsoleModel extends SDKModel<EventTypes> {
296
297
  private primaryPageChanged(
297
298
  event: Common.EventTarget.EventTargetEvent<{frame: ResourceTreeFrame, type: PrimaryPageChangeType}>): void {
298
299
  const settings = this.target().targetManager().settings;
299
- if (settings.moduleSetting('preserve-console-log').get()) {
300
+ if (settings.resolve(preserveConsoleLogSettingDescriptor).get()) {
300
301
  const {frame} = event.data;
301
302
  if (frame.backForwardCacheDetails.restoredFromCache) {
302
303
  this.#console.log(i18nString(UIStrings.bfcacheNavigation, {PH1: frame.url}));
@@ -15,7 +15,11 @@ import {Events as ResourceTreeModelEvents, ResourceTreeModel} from './ResourceTr
15
15
  import {type EvaluationOptions, type EvaluationResult, type ExecutionContext, RuntimeModel} from './RuntimeModel.js';
16
16
  import {Script} from './Script.js';
17
17
  import {SDKModel} from './SDKModel.js';
18
- import {jsSourceMapsEnabledSettingDescriptor} from './SDKSettings.js';
18
+ import {
19
+ jsSourceMapsEnabledSettingDescriptor,
20
+ pauseOnCaughtExceptionSettingDescriptor,
21
+ pauseOnExceptionEnabledSettingDescriptor,
22
+ } from './SDKSettings.js';
19
23
  import {SourceMap} from './SourceMap.js';
20
24
  import {SourceMapManager} from './SourceMapManager.js';
21
25
  import {Capability, type Target} from './Target.js';
@@ -175,8 +179,10 @@ export class DebuggerModel extends SDKModel<EventTypes> {
175
179
  compiledURL, sourceMappingURL, payload, target.targetManager().getConsole(), script));
176
180
 
177
181
  const settings = this.target().targetManager().settings;
178
- settings.moduleSetting('pause-on-exception-enabled').addChangeListener(this.pauseOnExceptionStateChanged, this);
179
- settings.moduleSetting('pause-on-caught-exception').addChangeListener(this.pauseOnExceptionStateChanged, this);
182
+ settings.resolve(pauseOnExceptionEnabledSettingDescriptor)
183
+ .addChangeListener(this.pauseOnExceptionStateChanged, this);
184
+ settings.resolve(pauseOnCaughtExceptionSettingDescriptor)
185
+ .addChangeListener(this.pauseOnExceptionStateChanged, this);
180
186
  settings.moduleSetting('pause-on-uncaught-exception').addChangeListener(this.pauseOnExceptionStateChanged, this);
181
187
  settings.moduleSetting('disable-async-stack-traces').addChangeListener(this.asyncStackTracesStateChanged, this);
182
188
  settings.moduleSetting('breakpoints-active').addChangeListener(this.breakpointsActiveChanged, this);
@@ -356,7 +362,7 @@ export class DebuggerModel extends SDKModel<EventTypes> {
356
362
 
357
363
  private pauseOnExceptionStateChanged(): void {
358
364
  const settings = this.target().targetManager().settings;
359
- const pauseOnCaughtEnabled = settings.moduleSetting('pause-on-caught-exception').get();
365
+ const pauseOnCaughtEnabled = settings.resolve(pauseOnCaughtExceptionSettingDescriptor).get();
360
366
  let state: Protocol.Debugger.SetPauseOnExceptionsRequestState;
361
367
 
362
368
  const pauseOnUncaughtEnabled = settings.moduleSetting('pause-on-uncaught-exception').get();
@@ -868,8 +874,10 @@ export class DebuggerModel extends SDKModel<EventTypes> {
868
874
  debuggerIdToModel.delete(this.#debuggerId);
869
875
  }
870
876
  const settings = this.target().targetManager().settings;
871
- settings.moduleSetting('pause-on-exception-enabled').removeChangeListener(this.pauseOnExceptionStateChanged, this);
872
- settings.moduleSetting('pause-on-caught-exception').removeChangeListener(this.pauseOnExceptionStateChanged, this);
877
+ settings.resolve(pauseOnExceptionEnabledSettingDescriptor)
878
+ .removeChangeListener(this.pauseOnExceptionStateChanged, this);
879
+ settings.resolve(pauseOnCaughtExceptionSettingDescriptor)
880
+ .removeChangeListener(this.pauseOnExceptionStateChanged, this);
873
881
  settings.moduleSetting('disable-async-stack-traces').removeChangeListener(this.asyncStackTracesStateChanged, this);
874
882
  }
875
883
 
@@ -17,3 +17,22 @@ export const cssSourceMapsEnabledSettingDescriptor: Common.Settings.SettingDescr
17
17
  defaultValue: true,
18
18
  storageType: Common.Settings.SettingStorageType.SYNCED,
19
19
  };
20
+
21
+ export const preserveConsoleLogSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
22
+ name: 'preserve-console-log',
23
+ type: Common.Settings.SettingType.BOOLEAN,
24
+ defaultValue: false,
25
+ storageType: Common.Settings.SettingStorageType.SYNCED,
26
+ };
27
+
28
+ export const pauseOnExceptionEnabledSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
29
+ name: 'pause-on-exception-enabled',
30
+ type: Common.Settings.SettingType.BOOLEAN,
31
+ defaultValue: false,
32
+ };
33
+
34
+ export const pauseOnCaughtExceptionSettingDescriptor: Common.Settings.SettingDescriptor<boolean> = {
35
+ name: 'pause-on-caught-exception',
36
+ type: Common.Settings.SettingType.BOOLEAN,
37
+ defaultValue: false,
38
+ };
@@ -6,22 +6,6 @@ import * as Common from '../common/common.js';
6
6
  import * as i18n from '../i18n/i18n.js';
7
7
 
8
8
  const UIStrings = {
9
- /**
10
- * @description Title of a setting under the Console category that can be invoked through the Command Menu.
11
- */
12
- preserveLogUponNavigation: 'Keep log on navigation',
13
- /**
14
- * @description Title of a setting under the Console category that can be invoked through the Command Menu.
15
- */
16
- doNotPreserveLogUponNavigation: 'Don’t keep log on navigation',
17
- /**
18
- * @description Text for pausing the debugger on exceptions.
19
- */
20
- pauseOnExceptions: 'Pause on exceptions',
21
- /**
22
- * @description Title of a setting under the Debugger category that can be invoked through the Command Menu.
23
- */
24
- doNotPauseOnExceptions: 'Do not pause on exceptions',
25
9
  /**
26
10
  * @description Title of a setting under the Debugger category that can be invoked through the Command Menu.
27
11
  */
@@ -471,48 +455,6 @@ const UIStrings = {
471
455
  const str_ = i18n.i18n.registerUIStrings('core/sdk/sdk-meta.ts', UIStrings);
472
456
  const i18nLazyString = i18n.i18n.getLazilyComputedLocalizedString.bind(undefined, str_);
473
457
 
474
- Common.Settings.registerSettingExtension({
475
- category: Common.Settings.SettingCategory.CONSOLE,
476
- storageType: Common.Settings.SettingStorageType.SYNCED,
477
- title: i18nLazyString(UIStrings.preserveLogUponNavigation),
478
- settingName: 'preserve-console-log',
479
- settingType: Common.Settings.SettingType.BOOLEAN,
480
- defaultValue: false,
481
- options: [
482
- {
483
- value: true,
484
- title: i18nLazyString(UIStrings.preserveLogUponNavigation),
485
- },
486
- {
487
- value: false,
488
- title: i18nLazyString(UIStrings.doNotPreserveLogUponNavigation),
489
- },
490
- ],
491
- });
492
-
493
- Common.Settings.registerSettingExtension({
494
- category: Common.Settings.SettingCategory.DEBUGGER,
495
- settingName: 'pause-on-exception-enabled',
496
- settingType: Common.Settings.SettingType.BOOLEAN,
497
- defaultValue: false,
498
- options: [
499
- {
500
- value: true,
501
- title: i18nLazyString(UIStrings.pauseOnExceptions),
502
- },
503
- {
504
- value: false,
505
- title: i18nLazyString(UIStrings.doNotPauseOnExceptions),
506
- },
507
- ],
508
- });
509
-
510
- Common.Settings.registerSettingExtension({
511
- settingName: 'pause-on-caught-exception',
512
- settingType: Common.Settings.SettingType.BOOLEAN,
513
- defaultValue: false,
514
- });
515
-
516
458
  Common.Settings.registerSettingExtension({
517
459
  settingName: 'pause-on-uncaught-exception',
518
460
  settingType: Common.Settings.SettingType.BOOLEAN,
@@ -1487,9 +1487,9 @@ inspectorBackend.registerCommand("WebAuthn.removeCredential", [{"name": "authent
1487
1487
  inspectorBackend.registerCommand("WebAuthn.clearCredentials", [{"name": "authenticatorId", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorId"}], [], "Clears all the credentials from the specified device.");
1488
1488
  inspectorBackend.registerCommand("WebAuthn.setUserVerified", [{"name": "authenticatorId", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorId"}, {"name": "isUserVerified", "type": "boolean", "optional": false, "description": "", "typeRef": null}], [], "Sets whether User Verification succeeds or fails for an authenticator. The default is true.");
1489
1489
  inspectorBackend.registerCommand("WebAuthn.setAutomaticPresenceSimulation", [{"name": "authenticatorId", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorId"}, {"name": "enabled", "type": "boolean", "optional": false, "description": "", "typeRef": null}], [], "Sets whether tests of user presence will succeed immediately (if true) or fail to resolve (if false) for an authenticator. The default is true.");
1490
- inspectorBackend.registerCommand("WebAuthn.setCredentialProperties", [{"name": "authenticatorId", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorId"}, {"name": "credentialId", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "backupEligibility", "type": "boolean", "optional": true, "description": "", "typeRef": null}, {"name": "backupState", "type": "boolean", "optional": true, "description": "", "typeRef": null}, {"name": "activeCmtgKeyIndex", "type": "number", "optional": true, "description": "", "typeRef": null}, {"name": "generateCmtgKeyOnNextOperation", "type": "boolean", "optional": true, "description": "", "typeRef": null}], [], "Allows setting credential properties. https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties");
1490
+ inspectorBackend.registerCommand("WebAuthn.setCredentialProperties", [{"name": "authenticatorId", "type": "string", "optional": false, "description": "", "typeRef": "WebAuthn.AuthenticatorId"}, {"name": "credentialId", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "backupEligibility", "type": "boolean", "optional": true, "description": "", "typeRef": null}, {"name": "backupState", "type": "boolean", "optional": true, "description": "", "typeRef": null}, {"name": "activeCmtgKeyIndex", "type": "number", "optional": true, "description": "", "typeRef": null}, {"name": "generateCmtgKeyOnNextOperation", "type": "boolean", "optional": true, "description": "", "typeRef": null}, {"name": "signCount", "type": "number", "optional": true, "description": "Must be equal to or greater than -1. If -1, the signature counter is removed from the credential, and every assertion operation will report a value of 0. See https://w3c.github.io/webauthn/#signature-counter", "typeRef": null}], [], "Allows setting credential properties. https://w3c.github.io/webauthn/#sctn-automation-set-credential-properties");
1491
1491
  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": "hasHmacSecret", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the hmac-secret extension. https://fidoalliance.org/specs/fido-v2.1-ps-20210615/fido-client-to-authenticator-protocol-v2.1-ps-20210615.html#sctn-hmac-secret-extension Defaults to false.", "typeRef": null}, {"name": "hasHmacSecretMc", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the hmac-secret-mc extension. https://fidoalliance.org/specs/fido-v2.2-rd-20241003/fido-client-to-authenticator-protocol-v2.2-rd-20241003.html#sctn-hmac-secret-make-cred-extension Defaults to false.", "typeRef": null}, {"name": "hasCmtgKey", "type": "boolean", "optional": true, "description": "If set to true, the authenticator will support the cmtgKey (Credential Manager Trust Group Key) extension. https://github.com/w3c/webauthn/pull/2377 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}]);
1492
- 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}, {"name": "cmtgKeys", "type": "array", "optional": true, "description": "The CMTG keys associated with the credential.", "typeRef": "binary"}, {"name": "activeCmtgKeyIndex", "type": "number", "optional": true, "description": "The 0-based index of the active key in cmtgKeys.", "typeRef": null}, {"name": "generateCmtgKeyOnNextOperation", "type": "boolean", "optional": true, "description": "If true, the authenticator will generate a new CMTG key on the next operation.", "typeRef": null}]);
1492
+ 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": true, "description": "Signature counter. Must be equal to or greater than -1. If -1, the credential won't have an associated signature counter, and every assertion operation will report a value of 0. 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}, {"name": "cmtgKeys", "type": "array", "optional": true, "description": "The CMTG keys associated with the credential.", "typeRef": "binary"}, {"name": "activeCmtgKeyIndex", "type": "number", "optional": true, "description": "The 0-based index of the active key in cmtgKeys.", "typeRef": null}, {"name": "generateCmtgKeyOnNextOperation", "type": "boolean", "optional": true, "description": "If true, the authenticator will generate a new CMTG key on the next operation.", "typeRef": null}]);
1493
1493
 
1494
1494
  // WebMCP.
1495
1495
  inspectorBackend.registerEnum("WebMCP.InvocationStatus", {Completed: "Completed", Canceled: "Canceled", Error: "Error"});
@@ -20327,11 +20327,12 @@ export namespace WebAuthn {
20327
20327
  */
20328
20328
  userHandle?: binary;
20329
20329
  /**
20330
- * Signature counter. This is incremented by one for each successful
20331
- * assertion.
20330
+ * Signature counter. Must be equal to or greater than -1.
20331
+ * If -1, the credential won't have an associated signature counter, and
20332
+ * every assertion operation will report a value of 0.
20332
20333
  * See https://w3c.github.io/webauthn/#signature-counter
20333
20334
  */
20334
- signCount: integer;
20335
+ signCount?: integer;
20335
20336
  /**
20336
20337
  * The large blob associated with the credential.
20337
20338
  * See https://w3c.github.io/webauthn/#sctn-large-blob-extension
@@ -20464,6 +20465,13 @@ export namespace WebAuthn {
20464
20465
  backupState?: boolean;
20465
20466
  activeCmtgKeyIndex?: integer;
20466
20467
  generateCmtgKeyOnNextOperation?: boolean;
20468
+ /**
20469
+ * Must be equal to or greater than -1.
20470
+ * If -1, the signature counter is removed from the credential, and every
20471
+ * assertion operation will report a value of 0.
20472
+ * See https://w3c.github.io/webauthn/#signature-counter
20473
+ */
20474
+ signCount?: integer;
20467
20475
  }
20468
20476
 
20469
20477
  /**
@@ -4,11 +4,78 @@
4
4
 
5
5
  import * as Common from '../../core/common/common.js';
6
6
  import * as Host from '../../core/host/host.js';
7
+ import * as i18n from '../../core/i18n/i18n.js';
7
8
  import type * as Platform from '../../core/platform/platform.js';
8
9
  import * as Root from '../../core/root/root.js';
9
10
 
10
11
  import {debugLog} from './debug.js';
11
12
 
13
+ export const enum DisabledReason {
14
+ GEO_RESTRICTED = 'geo-restricted',
15
+ POLICY_RESTRICTED = 'policy-restricted',
16
+ WRONG_LOCALE = 'wrong-locale',
17
+ NOT_SUPPORTED = 'not-supported',
18
+ }
19
+
20
+ function isLocaleRestricted(): boolean {
21
+ try {
22
+ const devtoolsLocale = i18n.DevToolsLocale.DevToolsLocale.instance();
23
+ return !devtoolsLocale.locale.startsWith('en-');
24
+ } catch {
25
+ return false;
26
+ }
27
+ }
28
+
29
+ function isGeoRestricted(config?: Root.Runtime.HostConfig): boolean {
30
+ return config?.aidaAvailability?.blockedByGeo === true;
31
+ }
32
+
33
+ function isPolicyRestricted(config?: Root.Runtime.HostConfig): boolean {
34
+ return config?.aidaAvailability?.blockedByEnterprisePolicy === true;
35
+ }
36
+
37
+ function isConsoleInsightsFeatureEnabled(config?: Root.Runtime.HostConfig): boolean {
38
+ return config?.aidaAvailability?.enabled !== false && config?.devToolsConsoleInsights?.enabled === true;
39
+ }
40
+
41
+ export const consoleInsightsEnabledSettingDescriptor:
42
+ Common.Settings.ConditionalSettingDescriptor<boolean, DisabledReason[]> = {
43
+ name: 'console-insights-enabled',
44
+ type: Common.Settings.SettingType.BOOLEAN,
45
+ defaultValue: false,
46
+ isAvailable: (config?: Root.Runtime.HostConfig): Common.Settings.SettingAvailabilityStatus<DisabledReason[]> => {
47
+ if (!isConsoleInsightsFeatureEnabled(config)) {
48
+ return {
49
+ status: Common.Settings.SettingAvailability.UNAVAILABLE,
50
+ reason: [DisabledReason.NOT_SUPPORTED],
51
+ };
52
+ }
53
+ const reasons: DisabledReason[] = [];
54
+ if (isGeoRestricted(config)) {
55
+ reasons.push(DisabledReason.GEO_RESTRICTED);
56
+ }
57
+ if (isPolicyRestricted(config)) {
58
+ reasons.push(DisabledReason.POLICY_RESTRICTED);
59
+ }
60
+ if (isLocaleRestricted()) {
61
+ reasons.push(DisabledReason.WRONG_LOCALE);
62
+ }
63
+ if (reasons.length > 0) {
64
+ return {
65
+ status: Common.Settings.SettingAvailability.DISABLED,
66
+ reason: reasons,
67
+ };
68
+ }
69
+ return {
70
+ status: Common.Settings.SettingAvailability.AVAILABLE,
71
+ };
72
+ },
73
+ };
74
+
75
+ export function isGeminiBranding(): boolean {
76
+ return !!Root.Runtime.hostConfig.devToolsGeminiRebranding?.enabled;
77
+ }
78
+
12
79
  /**
13
80
  * Preconditions determined entirely on the DevTools frontend side (e.g. Incognito
14
81
  * mode or age restrictions) that prevent AI assistance features from running.
@@ -53,10 +120,6 @@ export function getDisabledReasons(aidaAvailability: Host.AidaClient.AidaAccessP
53
120
  return reasons;
54
121
  }
55
122
 
56
- export function isGeminiBranding(): boolean {
57
- return !!Root.Runtime.hostConfig.devToolsGeminiRebranding?.enabled;
58
- }
59
-
60
123
  export function getIconName(): string {
61
124
  return isGeminiBranding() ? 'spark' : 'smart-assistant';
62
125
  }
@@ -2,6 +2,8 @@
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
+ export const EMPTY_ORIGIN = '';
6
+
5
7
  export class StorageItem {
6
8
  constructor(
7
9
  /**
@@ -10,12 +12,20 @@ export class StorageItem {
10
12
  */
11
13
  readonly primaryTargetOrigin: string,
12
14
  /**
13
- * The origin of the selected storage or cookie item (if any).
14
- * If no item is selected, this is the same as primaryTargetOrigin.
15
+ * The origin of the selected storage or cookie item.
16
+ * If empty (''), this represents a generic category-level context (e.g., all Local Storage or all Cookies).
15
17
  */
16
- readonly origin: string,
18
+ readonly origin: string = EMPTY_ORIGIN,
17
19
  ) {
18
20
  }
21
+
22
+ get isGenericContext(): boolean {
23
+ return this.origin === EMPTY_ORIGIN;
24
+ }
25
+
26
+ static createGenericContext(primaryTargetOrigin: string, ..._args: unknown[]): StorageItem {
27
+ return new StorageItem(primaryTargetOrigin, EMPTY_ORIGIN);
28
+ }
19
29
  }
20
30
 
21
31
  export class DOMStorageItem extends StorageItem {
@@ -23,18 +33,29 @@ export class DOMStorageItem extends StorageItem {
23
33
  primaryTargetOrigin: string,
24
34
  origin: string,
25
35
  /** The storage key partition identifier used by the browser storage engine. */
26
- readonly storageKey: string,
36
+ readonly storageKey: string|undefined,
27
37
  /** The sub-category of DOM storage: 'localStorage' or 'sessionStorage'. */
28
- readonly type: string,
38
+ readonly type: 'localStorage'|'sessionStorage',
29
39
  /** The optional specific key of the selected item in this storage partition. */
30
40
  readonly key?: string,
31
41
  ) {
32
42
  super(primaryTargetOrigin, origin);
33
43
  }
44
+
45
+ static override createGenericContext(
46
+ primaryTargetOrigin: string,
47
+ type: 'localStorage'|'sessionStorage',
48
+ ): DOMStorageItem {
49
+ return new DOMStorageItem(primaryTargetOrigin, EMPTY_ORIGIN, undefined, type);
50
+ }
34
51
  }
35
52
 
36
53
  export class CookieItem extends StorageItem {
37
54
  constructor(primaryTargetOrigin: string, origin: string, readonly name?: string) {
38
55
  super(primaryTargetOrigin, origin);
39
56
  }
57
+
58
+ static override createGenericContext(primaryTargetOrigin: string): CookieItem {
59
+ return new CookieItem(primaryTargetOrigin, EMPTY_ORIGIN);
60
+ }
40
61
  }
@@ -145,18 +145,15 @@ export class AiCodeCompletion {
145
145
  #renderingTimeout?: number;
146
146
  #aidaRequestCache?: CachedRequest;
147
147
  #lastEmptyResponseText?: string;
148
- // TODO(b/445394511): Remove panel from the class
149
- #panel: ContextFlavor;
150
148
  #callbacks?: Callbacks;
151
149
 
152
150
  readonly #sessionId: string = crypto.randomUUID();
153
151
  readonly #aidaClient: Host.AidaClient.AidaClient;
154
152
  readonly #serverSideLoggingEnabled: boolean;
155
153
 
156
- constructor(opts: AgentOptions, panel: ContextFlavor, callbacks?: Callbacks, stopSequences?: string[]) {
154
+ constructor(opts: AgentOptions, callbacks?: Callbacks, stopSequences?: string[]) {
157
155
  this.#aidaClient = opts.aidaClient;
158
156
  this.#serverSideLoggingEnabled = opts.serverSideLoggingEnabled ?? false;
159
- this.#panel = panel;
160
157
  this.#stopSequences = stopSequences ?? [];
161
158
  this.#callbacks = callbacks;
162
159
  }
@@ -172,15 +169,7 @@ export class AiCodeCompletion {
172
169
  // As a temporary fix for b/441221870 we are prepending a newline for each prefix.
173
170
  prefix = '\n' + prefix;
174
171
 
175
- let additionalContextFiles = additionalFiles;
176
- if (!additionalContextFiles) {
177
- additionalContextFiles = this.#panel === ContextFlavor.CONSOLE ? [{
178
- path: 'devtools-console-context.js',
179
- content: consoleAdditionalContextFileContent,
180
- included_reason: Host.AidaClient.Reason.RELATED_FILE,
181
- }] :
182
- undefined;
183
- }
172
+ const additionalContextFiles = additionalFiles;
184
173
  return {
185
174
  client: Host.AidaClient.CLIENT_NAME,
186
175
  prefix,
@@ -384,9 +373,3 @@ export class AiCodeCompletion {
384
373
  return Boolean(aidaAvailability.enabled && AiCodeCompletion.isAiCodeCompletionStylesAvailable());
385
374
  }
386
375
  }
387
-
388
- export const enum ContextFlavor {
389
- CONSOLE = 'console', // generated code can contain console specific APIs like `$0`.
390
- SOURCES = 'sources',
391
- STYLES = 'styles',
392
- }