chrome-devtools-frontend 1.0.1603822 → 1.0.1604514

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 (42) hide show
  1. package/front_end/core/host/AidaClient.ts +39 -462
  2. package/front_end/core/host/AidaClientTypes.ts +470 -0
  3. package/front_end/core/host/AidaGcaTranslation.ts +225 -122
  4. package/front_end/core/host/GcaTypes.ts +107 -155
  5. package/front_end/core/protocol_client/DevToolsCDPConnection.ts +1 -1
  6. package/front_end/core/sdk/DOMModel.ts +24 -22
  7. package/front_end/core/sdk/EmulationModel.ts +21 -23
  8. package/front_end/core/sdk/HeapProfilerModel.ts +4 -7
  9. package/front_end/core/sdk/NetworkManager.ts +35 -28
  10. package/front_end/core/sdk/OverlayModel.ts +10 -10
  11. package/front_end/core/sdk/PreloadingModel.ts +3 -4
  12. package/front_end/core/sdk/ServiceWorkerManager.ts +2 -3
  13. package/front_end/core/sdk/SourceMapScopesInfo.ts +93 -63
  14. package/front_end/entrypoints/formatter_worker/FormatterWorker.ts +1 -3
  15. package/front_end/entrypoints/heap_snapshot_worker/AllocationProfile.ts +22 -48
  16. package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +1 -1
  17. package/front_end/generated/InspectorBackendCommands.ts +4 -0
  18. package/front_end/generated/SupportedCSSProperties.js +68 -2
  19. package/front_end/generated/protocol-mapping.d.ts +7 -0
  20. package/front_end/generated/protocol-proxy-api.d.ts +14 -0
  21. package/front_end/generated/protocol.ts +22 -0
  22. package/front_end/models/bindings/TempFile.ts +1 -4
  23. package/front_end/models/extensions/ExtensionAPI.ts +1 -1
  24. package/front_end/models/heap_snapshot_model/HeapSnapshotModel.ts +34 -47
  25. package/front_end/models/javascript_metadata/NativeFunctions.js +6 -6
  26. package/front_end/panels/ai_assistance/AiAssistancePanel.ts +88 -19
  27. package/front_end/panels/ai_assistance/components/ChatMessage.ts +14 -20
  28. package/front_end/panels/ai_assistance/components/ChatView.ts +3 -2
  29. package/front_end/panels/ai_assistance/components/WalkthroughView.ts +35 -7
  30. package/front_end/panels/elements/ElementsTreeElement.ts +91 -13
  31. package/front_end/panels/elements/elementsTreeOutline.css +18 -0
  32. package/front_end/panels/profiler/HeapSnapshotDataGrids.ts +15 -19
  33. package/front_end/panels/profiler/HeapSnapshotGridNodes.ts +4 -2
  34. package/front_end/panels/profiler/HeapSnapshotProxy.ts +12 -16
  35. package/front_end/panels/profiler/HeapSnapshotView.ts +3 -10
  36. package/front_end/panels/profiler/ProfilesPanel.ts +5 -7
  37. package/front_end/panels/sensors/SensorsView.ts +0 -2
  38. package/front_end/panels/timeline/TimelinePanel.ts +1 -3
  39. package/front_end/panels/timeline/components/LiveMetricsView.ts +35 -63
  40. package/front_end/panels/timeline/components/liveMetricsView.css +4 -0
  41. package/front_end/third_party/chromium/README.chromium +1 -1
  42. package/package.json +1 -1
@@ -5,479 +5,56 @@
5
5
  import * as Common from '../common/common.js';
6
6
  import * as Root from '../root/root.js';
7
7
 
8
+ import {
9
+ AidaAccessPreconditions,
10
+ type AidaFunctionCallResponse,
11
+ AidaInferenceLanguage,
12
+ type AidaRegisterClientEvent,
13
+ ClientFeature,
14
+ type CompletionRequest,
15
+ type CompletionResponse,
16
+ type DoConversationRequest,
17
+ type DoConversationResponse,
18
+ FunctionalityType,
19
+ type GenerateCodeRequest,
20
+ type GenerateCodeResponse,
21
+ type GenerationSample,
22
+ RecitationAction,
23
+ type ResponseMetadata,
24
+ Role,
25
+ UserTier,
26
+ } from './AidaClientTypes.js';
8
27
  import * as DispatchHttpRequestClient from './DispatchHttpRequestClient.js';
9
28
  import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
10
29
  import type {AidaClientResult, AidaCodeCompleteResult, SyncInformation} from './InspectorFrontendHostAPI.js';
11
30
  import {bindOutputStream} from './ResourceLoader.js';
12
31
 
13
- export enum Role {
14
- /** Provide this role when giving a function call response */
15
- ROLE_UNSPECIFIED = 0,
16
- /** Tags the content came from the user */
17
- USER = 1,
18
- /** Tags the content came from the LLM */
19
- MODEL = 2,
20
- }
21
-
22
- export const enum Rating {
23
- // Resets the vote to null in the logs
24
- SENTIMENT_UNSPECIFIED = 'SENTIMENT_UNSPECIFIED',
25
- POSITIVE = 'POSITIVE',
26
- NEGATIVE = 'NEGATIVE',
27
- }
28
-
29
- /**
30
- * A `Content` represents a single turn message.
31
- */
32
- export interface Content {
33
- parts: Part[];
34
- /** The producer of the content. */
35
- role: Role;
36
- }
37
-
38
- export type Part = {
39
- text: string,
40
- }|{
41
- functionCall: {
42
- name: string,
43
- args: Record<string, unknown>,
44
- },
45
- }|{
46
- functionResponse: {
47
- name: string,
48
- response: Record<string, unknown>,
49
- },
50
- }|{
51
- /** Inline media bytes. */
52
- inlineData: MediaBlob,
53
- };
54
-
55
- export const enum ParametersTypes {
56
- STRING = 1,
57
- NUMBER = 2,
58
- INTEGER = 3,
59
- BOOLEAN = 4,
60
- ARRAY = 5,
61
- OBJECT = 6,
62
- }
63
-
64
- interface BaseFunctionParam {
65
- description: string;
66
- nullable?: boolean;
67
- }
68
-
69
- export interface FunctionPrimitiveParams extends BaseFunctionParam {
70
- type: ParametersTypes.BOOLEAN|ParametersTypes.INTEGER|ParametersTypes.STRING;
71
- }
72
-
73
- export interface FunctionArrayParam extends BaseFunctionParam {
74
- type: ParametersTypes.ARRAY;
75
- items: FunctionPrimitiveParams;
76
- }
77
-
78
- export interface FunctionObjectParam<T extends string|number|symbol = string> extends BaseFunctionParam {
79
- type: ParametersTypes.OBJECT;
80
- // TODO: this can be also be ObjectParams
81
- properties: Record<T, FunctionPrimitiveParams|FunctionArrayParam>;
82
- required: T[];
83
- }
84
-
85
- /**
86
- * More about function declaration can be read at
87
- * https://ai.google.dev/gemini-api/docs/function-calling
88
- */
89
- export interface FunctionDeclaration<T extends string|number|symbol = string> {
90
- name: string;
91
- /**
92
- * A description for the LLM to understand what the specific function will do once called.
93
- */
94
- description: string;
95
- parameters: FunctionObjectParam<T>;
96
- }
97
-
98
- /** Raw media bytes. **/
99
- export interface MediaBlob {
100
- // The IANA standard MIME type of the source data.
101
- // Currently supported types are: image/png, image/jpeg.
102
- // Format: base64-encoded
103
- // For reference: google3/google/x/pitchfork/aida/v1/content.proto
104
- mimeType: string;
105
- data: string;
106
- }
107
-
108
- export enum FunctionalityType {
109
- // Unspecified functionality type.
110
- FUNCTIONALITY_TYPE_UNSPECIFIED = 0,
111
- // The generic AI chatbot functionality.
112
- CHAT = 1,
113
- // The explain error functionality.
114
- EXPLAIN_ERROR = 2,
115
- AGENTIC_CHAT = 5,
116
- }
117
-
118
- /** See: cs/aida.proto (google3). **/
119
- export enum ClientFeature {
120
- // Unspecified client feature.
121
- CLIENT_FEATURE_UNSPECIFIED = 0,
122
- // Chrome console insights feature.
123
- CHROME_CONSOLE_INSIGHTS = 1,
124
- // Chrome AI Assistance Styling Agent.
125
- CHROME_STYLING_AGENT = 2,
126
- // Chrome AI Assistance Network Agent.
127
- CHROME_NETWORK_AGENT = 7,
128
- // Chrome AI Annotations Performance Agent
129
- CHROME_PERFORMANCE_ANNOTATIONS_AGENT = 20,
130
- // Chrome AI Assistance File Agent.
131
- CHROME_FILE_AGENT = 9,
132
- // Chrome AI Patch Agent.
133
- CHROME_PATCH_AGENT = 12,
134
- // Chrome AI Assistance Performance Agent.
135
- CHROME_PERFORMANCE_FULL_AGENT = 24,
136
- // Chrome Context Selection Agent.
137
- CHROME_CONTEXT_SELECTION_AGENT = 25,
138
- // Chrome Accessibility Agent
139
- CHROME_ACCESSIBILITY_AGENT = 26,
140
- // Chrome AI Assistance Conversation Summary Agent.
141
- CHROME_CONVERSATION_SUMMARY_AGENT = 27,
142
-
143
- // Removed features (for reference).
144
- // Chrome AI Assistance Performance Insights Agent.
145
- // CHROME_PERFORMANCE_INSIGHTS_AGENT = 13,
146
- // Chrome AI Assistance Performance Agent (call trees).
147
- // CHROME_PERFORMANCE_AGENT = 8,
148
- }
149
-
150
- export enum UserTier {
151
- // Unspecified user tier.
152
- USER_TIER_UNSPECIFIED = 0,
153
- // Users who are internal testers.
154
- TESTERS = 1,
155
- // Users who are early adopters.
156
- BETA = 2,
157
- // Users in the general public.
158
- PUBLIC = 3,
159
- }
160
-
161
- /** Googlers: see the Aida `retrieval` proto; this type is based on that. **/
162
- export interface RequestFactMetadata {
163
- /**
164
- * A description of where the fact comes from.
165
- */
166
- source: string;
167
- /**
168
- * Optional: a score to give this fact. Used because
169
- * if there are more facts than space in the context window,
170
- * higher scoring facts will be prioritized.
171
- */
172
- score?: number;
173
- }
174
- export interface RequestFact {
175
- /**
176
- * Content of the fact.
177
- */
178
- text: string;
179
- metadata: RequestFactMetadata;
180
- }
181
-
182
- export type RpcGlobalId = string|number;
183
-
184
- /* eslint-disable @typescript-eslint/naming-convention */
185
- export interface RequestMetadata {
186
- string_session_id?: string;
187
- user_tier?: UserTier;
188
- disable_user_content_logging: boolean;
189
- client_version: string;
190
- }
191
- /* eslint-enable @typescript-eslint/naming-convention */
192
-
193
- /* eslint-disable @typescript-eslint/naming-convention */
194
- export interface ConversationOptions {
195
- temperature?: number;
196
- model_id?: string;
197
- }
198
- /* eslint-enable @typescript-eslint/naming-convention */
199
-
200
- /* eslint-disable @typescript-eslint/naming-convention */
201
- export interface DoConversationRequest {
202
- client: string;
203
- current_message: Content;
204
- preamble?: string;
205
- historical_contexts?: Content[];
206
- function_declarations?: FunctionDeclaration[];
207
- facts?: RequestFact[];
208
- options?: ConversationOptions;
209
- metadata: RequestMetadata;
210
- functionality_type?: FunctionalityType;
211
- client_feature?: ClientFeature;
212
- }
213
- /* eslint-enable @typescript-eslint/naming-convention */
214
-
215
- /* eslint-disable @typescript-eslint/naming-convention */
216
- export interface CompleteCodeOptions {
217
- temperature?: number;
218
- model_id?: string;
219
- inference_language?: AidaInferenceLanguage;
220
- stop_sequences?: string[];
221
- }
222
- /* eslint-enable @typescript-eslint/naming-convention */
223
-
224
- /* eslint-disable @typescript-eslint/naming-convention */
225
- export interface GenerateCodeOptions {
226
- temperature?: number;
227
- model_id?: string;
228
- inference_language?: AidaInferenceLanguage;
229
- expect_code_output?: boolean;
230
- }
231
- /* eslint-enable @typescript-eslint/naming-convention */
232
-
233
- /* eslint-disable @typescript-eslint/naming-convention */
234
- export interface ContextFile {
235
- path: string;
236
- full_content: string;
237
- selected_content?: string;
238
- programming_language: AidaInferenceLanguage;
239
- }
240
- /* eslint-enable @typescript-eslint/naming-convention */
241
-
242
- export enum EditType {
243
- // Unknown edit type
244
- EDIT_TYPE_UNSPECIFIED = 0,
245
- // User typed code/text into file
246
- ADD = 1,
247
- // User deleted code/text from file
248
- DELETE = 2,
249
- // User pasted into file (this includes smart paste)
250
- PASTE = 3,
251
- // User performs an undo action
252
- UNDO = 4,
253
- // User performs a redo action
254
- REDO = 5,
255
- // User accepted a completion from AIDA
256
- ACCEPT_COMPLETION = 6,
257
- }
258
-
259
- export enum Reason {
260
- // Unknown reason.
261
- UNKNOWN = 0,
262
-
263
- // The file is currently open.
264
- CURRENTLY_OPEN = 1,
265
-
266
- // The file is opened recently.
267
- RECENTLY_OPENED = 2,
268
-
269
- // The file is edited recently.
270
- RECENTLY_EDITED = 3,
271
-
272
- // The file is located within the same directory.
273
- COLOCATED = 4,
274
-
275
- // Included based on relation to code around the cursor (e.g: could be
276
- // provided by local IDE analysis)
277
- RELATED_FILE = 5,
278
- }
279
-
280
- /* eslint-disable @typescript-eslint/naming-convention */
281
- export interface AdditionalFile {
282
- path: string;
283
- content: string;
284
- included_reason: Reason;
285
- }
286
-
287
- export interface CompletionRequest {
288
- client: string;
289
- prefix: string;
290
- suffix?: string;
291
- options?: CompleteCodeOptions;
292
- metadata: RequestMetadata;
293
- last_user_action?: EditType;
294
- additional_files?: AdditionalFile[];
295
- }
296
- /* eslint-enable @typescript-eslint/naming-convention */
297
-
298
- export enum UseCase {
299
- // Unspecified usecase.
300
- USE_CASE_UNSPECIFIED = 0,
301
-
302
- // Code generation use case is expected to generate code from scratch
303
- CODE_GENERATION = 1,
304
-
305
- // Code transformation or code editing use case.
306
- CODE_TRANSFORMATION = 2,
307
- }
308
-
309
- /* eslint-disable @typescript-eslint/naming-convention */
310
- export interface GenerateCodeRequest {
311
- client: string;
312
- preamble: string;
313
- current_message: Content;
314
- options?: GenerateCodeOptions;
315
- context_files?: ContextFile[];
316
- use_case: UseCase;
317
- metadata: RequestMetadata;
318
- client_feature?: ClientFeature;
319
- }
320
- /* eslint-enable @typescript-eslint/naming-convention */
321
-
322
- /* eslint-disable @typescript-eslint/naming-convention */
323
- export interface DoConversationClientEvent {
324
- user_feedback: {
325
- sentiment?: Rating,
326
- user_input?: {
327
- comment?: string,
328
- },
329
- };
330
- }
331
-
332
- export interface UserImpression {
333
- sample: {
334
- sample_id?: number,
335
- };
336
- latency: {
337
- duration: {
338
- seconds: number,
339
- nanos: number,
340
- },
341
- };
342
- }
343
-
344
- export interface UserAcceptance {
345
- sample: {
346
- sample_id?: number,
347
- };
348
- }
349
-
350
- export interface AidaRegisterClientEvent {
351
- corresponding_aida_rpc_global_id: RpcGlobalId;
352
- disable_user_content_logging: boolean;
353
- do_conversation_client_event?: DoConversationClientEvent;
354
- complete_code_client_event?: {user_acceptance: UserAcceptance}|{user_impression: UserImpression};
355
- generate_code_client_event?: {user_acceptance: UserAcceptance}|{user_impression: UserImpression};
356
- }
357
- /* eslint-enable @typescript-eslint/naming-convention */
358
-
359
- export enum RecitationAction {
360
- ACTION_UNSPECIFIED = 'ACTION_UNSPECIFIED',
361
- CITE = 'CITE',
362
- BLOCK = 'BLOCK',
363
- NO_ACTION = 'NO_ACTION',
364
- EXEMPT_FOUND_IN_PROMPT = 'EXEMPT_FOUND_IN_PROMPT',
365
- }
366
-
367
- export enum CitationSourceType {
368
- CITATION_SOURCE_TYPE_UNSPECIFIED = 'CITATION_SOURCE_TYPE_UNSPECIFIED',
369
- TRAINING_DATA = 'TRAINING_DATA',
370
- WORLD_FACTS = 'WORLD_FACTS',
371
- LOCAL_FACTS = 'LOCAL_FACTS',
372
- INDIRECT = 'INDIRECT',
373
- }
374
-
375
- export interface Citation {
376
- startIndex?: number;
377
- endIndex?: number;
378
- uri?: string;
379
- sourceType?: CitationSourceType;
380
- repository?: string;
381
- }
382
-
383
- export interface AttributionMetadata {
384
- attributionAction: RecitationAction;
385
- citations: Citation[];
386
- }
387
-
388
- export interface AidaFunctionCallResponse {
389
- name: string;
390
- args: Record<string, unknown>;
391
- }
392
-
393
- export interface FactualityFact {
394
- sourceUri?: string;
395
- }
396
-
397
- export interface FactualityMetadata {
398
- facts: FactualityFact[];
399
- }
400
-
401
- export interface ResponseMetadata {
402
- rpcGlobalId?: RpcGlobalId;
403
- attributionMetadata?: AttributionMetadata;
404
- factualityMetadata?: FactualityMetadata;
405
- }
406
-
407
- export interface DoConversationResponse {
408
- explanation: string;
409
- metadata: ResponseMetadata;
410
- functionCalls?: [AidaFunctionCallResponse, ...AidaFunctionCallResponse[]];
411
- completed: boolean;
412
- }
413
-
414
- export interface CompletionResponse {
415
- generatedSamples: GenerationSample[];
416
- metadata: ResponseMetadata;
417
- }
418
-
419
- export interface GenerateCodeResponse {
420
- samples: GenerationSample[];
421
- metadata: ResponseMetadata;
422
- }
423
-
424
- export interface GenerationSample {
425
- generationString: string;
426
- score: number;
427
- sampleId?: number;
428
- attributionMetadata?: AttributionMetadata;
429
- }
430
-
431
- export const enum AidaAccessPreconditions {
432
- AVAILABLE = 'available',
433
- NO_ACCOUNT_EMAIL = 'no-account-email',
434
- NO_INTERNET = 'no-internet',
435
- // This is the state (mostly enterprise) users are in, when they are automatically logged out from
436
- // Chrome after a certain time period. For making AIDA requests, they need to log in again.
437
- SYNC_IS_PAUSED = 'sync-is-paused',
438
- }
439
-
440
- export const enum AidaInferenceLanguage {
441
- CPP = 'CPP',
442
- PYTHON = 'PYTHON',
443
- KOTLIN = 'KOTLIN',
444
- JAVA = 'JAVA',
445
- JAVASCRIPT = 'JAVASCRIPT',
446
- GO = 'GO',
447
- TYPESCRIPT = 'TYPESCRIPT',
448
- HTML = 'HTML',
449
- BASH = 'BASH',
450
- CSS = 'CSS',
451
- DART = 'DART',
452
- JSON = 'JSON',
453
- MARKDOWN = 'MARKDOWN',
454
- VUE = 'VUE',
455
- XML = 'XML',
456
- }
457
-
458
- const AidaLanguageToMarkdown: Record<AidaInferenceLanguage, string> = {
459
- CPP: 'cpp',
460
- PYTHON: 'py',
461
- KOTLIN: 'kt',
462
- JAVA: 'java',
463
- JAVASCRIPT: 'js',
464
- GO: 'go',
465
- TYPESCRIPT: 'ts',
466
- HTML: 'html',
467
- BASH: 'sh',
468
- CSS: 'css',
469
- DART: 'dart',
470
- JSON: 'json',
471
- MARKDOWN: 'md',
472
- VUE: 'vue',
473
- XML: 'xml',
474
- };
32
+ export * from './AidaClientTypes.js';
475
33
 
476
34
  export const CLIENT_NAME = 'CHROME_DEVTOOLS';
477
35
  export const SERVICE_NAME = 'aidaService';
478
36
 
479
37
  const CODE_CHUNK_SEPARATOR = (lang = ''): string => ('\n`````' + lang + '\n');
480
38
 
39
+ const AidaLanguageToMarkdown: Record<AidaInferenceLanguage, string> = {
40
+ [AidaInferenceLanguage.CPP]: 'cpp',
41
+ [AidaInferenceLanguage.PYTHON]: 'py',
42
+ [AidaInferenceLanguage.KOTLIN]: 'kt',
43
+ [AidaInferenceLanguage.JAVA]: 'java',
44
+ [AidaInferenceLanguage.JAVASCRIPT]: 'js',
45
+ [AidaInferenceLanguage.GO]: 'go',
46
+ [AidaInferenceLanguage.TYPESCRIPT]: 'ts',
47
+ [AidaInferenceLanguage.HTML]: 'html',
48
+ [AidaInferenceLanguage.BASH]: 'sh',
49
+ [AidaInferenceLanguage.CSS]: 'css',
50
+ [AidaInferenceLanguage.DART]: 'dart',
51
+ [AidaInferenceLanguage.JSON]: 'json',
52
+ [AidaInferenceLanguage.MARKDOWN]: 'md',
53
+ [AidaInferenceLanguage.VUE]: 'vue',
54
+ [AidaInferenceLanguage.XML]: 'xml',
55
+ [AidaInferenceLanguage.UNKNOWN]: 'unknown',
56
+ };
57
+
481
58
  export class AidaAbortError extends Error {}
482
59
  export class AidaBlockError extends Error {}
483
60