chrome-devtools-frontend 1.0.1662289 → 1.0.1662965
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.
- package/.agents/skills/devtools-unicode-escaping/SKILL.md +64 -0
- package/.agents/skills/migrate-chromium-test/SKILL.md +29 -4
- package/front_end/core/common/SettingRegistration.ts +0 -5
- package/front_end/core/common/Settings.ts +69 -3
- package/front_end/core/platform/StringUtilities.ts +38 -6
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -10
- package/front_end/core/sdk/StorageBucketsModel.ts +0 -10
- package/front_end/core/sdk/sdk-meta.ts +0 -1
- package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +0 -13
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +8 -3
- package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +3 -3
- package/front_end/entrypoints/main/MainImpl.ts +7 -2
- package/front_end/foundation/Universe.ts +16 -0
- package/front_end/generated/InspectorBackendCommands.ts +2 -14
- package/front_end/generated/protocol-mapping.d.ts +0 -53
- package/front_end/generated/protocol-proxy-api.d.ts +0 -46
- package/front_end/generated/protocol.ts +0 -148
- package/front_end/models/ai_assistance/AiAgent2.ts +3 -3
- package/front_end/models/ai_assistance/AiConversation.ts +21 -10
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +21 -10
- package/front_end/models/ai_assistance/ChangeManager.ts +2 -2
- package/front_end/models/ai_assistance/ExtensionScope.ts +6 -2
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +8 -1
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +1 -1
- package/front_end/models/badges/UserBadges.ts +31 -17
- package/front_end/models/bindings/NetworkProject.ts +16 -4
- package/front_end/models/emulation/DeviceModeModel.ts +67 -5
- package/front_end/models/extensions/RecorderPluginManager.ts +10 -6
- package/front_end/models/har/Log.snapshot.txt +193 -0
- package/front_end/models/har/Log.ts +3 -2
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +7 -5
- package/front_end/models/source_map_scopes/NamesResolver.ts +36 -30
- package/front_end/models/stack_trace/StackTrace.ts +17 -0
- package/front_end/panels/application/IndexedDBModel.ts +0 -10
- package/front_end/panels/application/IndexedDBViews.ts +240 -164
- package/front_end/panels/application/SharedStorageModel.ts +0 -10
- package/front_end/panels/application/components/AdsView.ts +23 -0
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +1 -1
- package/front_end/panels/application/components/adsView.css +21 -1
- package/front_end/panels/application/indexedDBViews.css +1 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +43 -1
- package/front_end/panels/network/RequestInitiatorView.ts +24 -2
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/network/requestInitiatorViewTree.css +5 -0
- package/front_end/panels/profiler/HeapProfileView.ts +198 -79
- package/front_end/panels/recorder/README.md +1 -2
- package/front_end/panels/recorder/RecorderPanel.ts +1749 -17
- package/front_end/panels/recorder/recorder.ts +0 -2
- package/front_end/panels/settings/AISettingsTab.ts +13 -0
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/spinners/Spinner.ts +29 -32
- package/front_end/ui/components/spinners/spinner.css +32 -84
- package/front_end/ui/legacy/Treeoutline.ts +14 -6
- package/front_end/ui/legacy/UIUtils.ts +25 -10
- package/front_end/ui/legacy/Widget.ts +17 -10
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +36 -7
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +63 -68
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/objectValue.css +2 -1
- package/front_end/ui/legacy/inspectorCommon.css +4 -4
- package/front_end/ui/lit/lit.ts +1 -0
- package/front_end/ui/lit/render.ts +44 -10
- package/front_end/ui/lit/strip-whitespace.ts +23 -2
- package/package.json +1 -1
- package/front_end/panels/recorder/RecorderController.ts +0 -1759
- /package/front_end/panels/recorder/{recorderController.css → recorderPanel.css} +0 -0
|
@@ -713,14 +713,6 @@ declare namespace ProtocolProxyApi {
|
|
|
713
713
|
*/
|
|
714
714
|
invoke_addPrivacySandboxEnrollmentOverride(params: Protocol.Browser.AddPrivacySandboxEnrollmentOverrideRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
715
715
|
|
|
716
|
-
/**
|
|
717
|
-
* Configures encryption keys used with a given privacy sandbox API to talk
|
|
718
|
-
* to a trusted coordinator. Since this is intended for test automation only,
|
|
719
|
-
* coordinatorOrigin must be a .test domain. No existing coordinator
|
|
720
|
-
* configuration for the origin may exist.
|
|
721
|
-
*/
|
|
722
|
-
invoke_addPrivacySandboxCoordinatorKeyConfig(params: Protocol.Browser.AddPrivacySandboxCoordinatorKeyConfigRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
723
|
-
|
|
724
716
|
}
|
|
725
717
|
export interface BrowserDispatcher {
|
|
726
718
|
/**
|
|
@@ -4294,22 +4286,6 @@ declare namespace ProtocolProxyApi {
|
|
|
4294
4286
|
*/
|
|
4295
4287
|
invoke_clearTrustTokens(params: Protocol.Storage.ClearTrustTokensRequest): Promise<Protocol.Storage.ClearTrustTokensResponse>;
|
|
4296
4288
|
|
|
4297
|
-
/**
|
|
4298
|
-
* Gets details for a named interest group.
|
|
4299
|
-
*/
|
|
4300
|
-
invoke_getInterestGroupDetails(params: Protocol.Storage.GetInterestGroupDetailsRequest): Promise<Protocol.Storage.GetInterestGroupDetailsResponse>;
|
|
4301
|
-
|
|
4302
|
-
/**
|
|
4303
|
-
* Enables/Disables issuing of interestGroupAccessed events.
|
|
4304
|
-
*/
|
|
4305
|
-
invoke_setInterestGroupTracking(params: Protocol.Storage.SetInterestGroupTrackingRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
4306
|
-
|
|
4307
|
-
/**
|
|
4308
|
-
* Enables/Disables issuing of interestGroupAuctionEventOccurred and
|
|
4309
|
-
* interestGroupAuctionNetworkRequestCreated.
|
|
4310
|
-
*/
|
|
4311
|
-
invoke_setInterestGroupAuctionTracking(params: Protocol.Storage.SetInterestGroupAuctionTrackingRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
4312
|
-
|
|
4313
4289
|
/**
|
|
4314
4290
|
* Gets metadata for an origin's shared storage.
|
|
4315
4291
|
*/
|
|
@@ -4366,8 +4342,6 @@ declare namespace ProtocolProxyApi {
|
|
|
4366
4342
|
*/
|
|
4367
4343
|
invoke_getRelatedWebsiteSets(): Promise<Protocol.Storage.GetRelatedWebsiteSetsResponse>;
|
|
4368
4344
|
|
|
4369
|
-
invoke_setProtectedAudienceKAnonymity(params: Protocol.Storage.SetProtectedAudienceKAnonymityRequest): Promise<Protocol.ProtocolResponseWithError>;
|
|
4370
|
-
|
|
4371
4345
|
}
|
|
4372
4346
|
export interface StorageDispatcher {
|
|
4373
4347
|
/**
|
|
@@ -4390,26 +4364,6 @@ declare namespace ProtocolProxyApi {
|
|
|
4390
4364
|
*/
|
|
4391
4365
|
indexedDBListUpdated(params: Protocol.Storage.IndexedDBListUpdatedEvent): void;
|
|
4392
4366
|
|
|
4393
|
-
/**
|
|
4394
|
-
* One of the interest groups was accessed. Note that these events are global
|
|
4395
|
-
* to all targets sharing an interest group store.
|
|
4396
|
-
*/
|
|
4397
|
-
interestGroupAccessed(params: Protocol.Storage.InterestGroupAccessedEvent): void;
|
|
4398
|
-
|
|
4399
|
-
/**
|
|
4400
|
-
* An auction involving interest groups is taking place. These events are
|
|
4401
|
-
* target-specific.
|
|
4402
|
-
*/
|
|
4403
|
-
interestGroupAuctionEventOccurred(params: Protocol.Storage.InterestGroupAuctionEventOccurredEvent): void;
|
|
4404
|
-
|
|
4405
|
-
/**
|
|
4406
|
-
* Specifies which auctions a particular network fetch may be related to, and
|
|
4407
|
-
* in what role. Note that it is not ordered with respect to
|
|
4408
|
-
* Network.requestWillBeSent (but will happen before loadingFinished
|
|
4409
|
-
* loadingFailed).
|
|
4410
|
-
*/
|
|
4411
|
-
interestGroupAuctionNetworkRequestCreated(params: Protocol.Storage.InterestGroupAuctionNetworkRequestCreatedEvent): void;
|
|
4412
|
-
|
|
4413
4367
|
/**
|
|
4414
4368
|
* Shared storage was accessed by the associated page.
|
|
4415
4369
|
* The following parameters are included in all events.
|
|
@@ -943,7 +943,6 @@ export namespace Audits {
|
|
|
943
943
|
}
|
|
944
944
|
|
|
945
945
|
export const enum MixedContentResourceType {
|
|
946
|
-
AttributionSrc = 'AttributionSrc',
|
|
947
946
|
Audio = 'Audio',
|
|
948
947
|
Beacon = 'Beacon',
|
|
949
948
|
CSPReport = 'CSPReport',
|
|
@@ -2507,11 +2506,6 @@ export namespace Browser {
|
|
|
2507
2506
|
buckets: Bucket[];
|
|
2508
2507
|
}
|
|
2509
2508
|
|
|
2510
|
-
export const enum PrivacySandboxAPI {
|
|
2511
|
-
BiddingAndAuctionServices = 'BiddingAndAuctionServices',
|
|
2512
|
-
TrustedKeyValue = 'TrustedKeyValue',
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
2509
|
export interface SetPermissionRequest {
|
|
2516
2510
|
/**
|
|
2517
2511
|
* Descriptor of permission to override.
|
|
@@ -2743,17 +2737,6 @@ export namespace Browser {
|
|
|
2743
2737
|
url: string;
|
|
2744
2738
|
}
|
|
2745
2739
|
|
|
2746
|
-
export interface AddPrivacySandboxCoordinatorKeyConfigRequest {
|
|
2747
|
-
api: PrivacySandboxAPI;
|
|
2748
|
-
coordinatorOrigin: string;
|
|
2749
|
-
keyConfig: string;
|
|
2750
|
-
/**
|
|
2751
|
-
* BrowserContext to perform the action in. When omitted, default browser
|
|
2752
|
-
* context is used.
|
|
2753
|
-
*/
|
|
2754
|
-
browserContextId?: BrowserContextID;
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
2740
|
/**
|
|
2758
2741
|
* Fired when page is about to start a download.
|
|
2759
2742
|
*/
|
|
@@ -18317,54 +18300,12 @@ export namespace Storage {
|
|
|
18317
18300
|
count: number;
|
|
18318
18301
|
}
|
|
18319
18302
|
|
|
18320
|
-
/**
|
|
18321
|
-
* Protected audience interest group auction identifier.
|
|
18322
|
-
*/
|
|
18323
|
-
export type InterestGroupAuctionId = OpaqueIdentifier<string, 'Protocol.Storage.InterestGroupAuctionId'>;
|
|
18324
|
-
|
|
18325
|
-
/**
|
|
18326
|
-
* Enum of interest group access types.
|
|
18327
|
-
*/
|
|
18328
|
-
export const enum InterestGroupAccessType {
|
|
18329
|
-
Join = 'join',
|
|
18330
|
-
Leave = 'leave',
|
|
18331
|
-
Update = 'update',
|
|
18332
|
-
Loaded = 'loaded',
|
|
18333
|
-
Bid = 'bid',
|
|
18334
|
-
Win = 'win',
|
|
18335
|
-
AdditionalBid = 'additionalBid',
|
|
18336
|
-
AdditionalBidWin = 'additionalBidWin',
|
|
18337
|
-
TopLevelBid = 'topLevelBid',
|
|
18338
|
-
TopLevelAdditionalBid = 'topLevelAdditionalBid',
|
|
18339
|
-
Clear = 'clear',
|
|
18340
|
-
}
|
|
18341
|
-
|
|
18342
|
-
/**
|
|
18343
|
-
* Enum of auction events.
|
|
18344
|
-
*/
|
|
18345
|
-
export const enum InterestGroupAuctionEventType {
|
|
18346
|
-
Started = 'started',
|
|
18347
|
-
ConfigResolved = 'configResolved',
|
|
18348
|
-
}
|
|
18349
|
-
|
|
18350
|
-
/**
|
|
18351
|
-
* Enum of network fetches auctions can do.
|
|
18352
|
-
*/
|
|
18353
|
-
export const enum InterestGroupAuctionFetchType {
|
|
18354
|
-
BidderJs = 'bidderJs',
|
|
18355
|
-
BidderWasm = 'bidderWasm',
|
|
18356
|
-
SellerJs = 'sellerJs',
|
|
18357
|
-
BidderTrustedSignals = 'bidderTrustedSignals',
|
|
18358
|
-
SellerTrustedSignals = 'sellerTrustedSignals',
|
|
18359
|
-
}
|
|
18360
|
-
|
|
18361
18303
|
/**
|
|
18362
18304
|
* Enum of shared storage access scopes.
|
|
18363
18305
|
*/
|
|
18364
18306
|
export const enum SharedStorageAccessScope {
|
|
18365
18307
|
Window = 'window',
|
|
18366
18308
|
SharedStorageWorklet = 'sharedStorageWorklet',
|
|
18367
|
-
ProtectedAudienceWorklet = 'protectedAudienceWorklet',
|
|
18368
18309
|
Header = 'header',
|
|
18369
18310
|
}
|
|
18370
18311
|
|
|
@@ -18797,29 +18738,6 @@ export namespace Storage {
|
|
|
18797
18738
|
didDeleteTokens: boolean;
|
|
18798
18739
|
}
|
|
18799
18740
|
|
|
18800
|
-
export interface GetInterestGroupDetailsRequest {
|
|
18801
|
-
ownerOrigin: string;
|
|
18802
|
-
name: string;
|
|
18803
|
-
}
|
|
18804
|
-
|
|
18805
|
-
export interface GetInterestGroupDetailsResponse extends ProtocolResponseWithError {
|
|
18806
|
-
/**
|
|
18807
|
-
* This largely corresponds to:
|
|
18808
|
-
* https://wicg.github.io/turtledove/#dictdef-generatebidinterestgroup
|
|
18809
|
-
* but has absolute expirationTime instead of relative lifetimeMs and
|
|
18810
|
-
* also adds joiningOrigin.
|
|
18811
|
-
*/
|
|
18812
|
-
details: any;
|
|
18813
|
-
}
|
|
18814
|
-
|
|
18815
|
-
export interface SetInterestGroupTrackingRequest {
|
|
18816
|
-
enable: boolean;
|
|
18817
|
-
}
|
|
18818
|
-
|
|
18819
|
-
export interface SetInterestGroupAuctionTrackingRequest {
|
|
18820
|
-
enable: boolean;
|
|
18821
|
-
}
|
|
18822
|
-
|
|
18823
18741
|
export interface GetSharedStorageMetadataRequest {
|
|
18824
18742
|
ownerOrigin: string;
|
|
18825
18743
|
}
|
|
@@ -18881,12 +18799,6 @@ export namespace Storage {
|
|
|
18881
18799
|
sets: RelatedWebsiteSet[];
|
|
18882
18800
|
}
|
|
18883
18801
|
|
|
18884
|
-
export interface SetProtectedAudienceKAnonymityRequest {
|
|
18885
|
-
owner: string;
|
|
18886
|
-
name: string;
|
|
18887
|
-
hashes: binary[];
|
|
18888
|
-
}
|
|
18889
|
-
|
|
18890
18802
|
/**
|
|
18891
18803
|
* A cache's contents have been modified.
|
|
18892
18804
|
*/
|
|
@@ -18971,66 +18883,6 @@ export namespace Storage {
|
|
|
18971
18883
|
bucketId: string;
|
|
18972
18884
|
}
|
|
18973
18885
|
|
|
18974
|
-
/**
|
|
18975
|
-
* One of the interest groups was accessed. Note that these events are global
|
|
18976
|
-
* to all targets sharing an interest group store.
|
|
18977
|
-
*/
|
|
18978
|
-
export interface InterestGroupAccessedEvent {
|
|
18979
|
-
accessTime: Network.TimeSinceEpoch;
|
|
18980
|
-
type: InterestGroupAccessType;
|
|
18981
|
-
ownerOrigin: string;
|
|
18982
|
-
name: string;
|
|
18983
|
-
/**
|
|
18984
|
-
* For topLevelBid/topLevelAdditionalBid, and when appropriate,
|
|
18985
|
-
* win and additionalBidWin
|
|
18986
|
-
*/
|
|
18987
|
-
componentSellerOrigin?: string;
|
|
18988
|
-
/**
|
|
18989
|
-
* For bid or somethingBid event, if done locally and not on a server.
|
|
18990
|
-
*/
|
|
18991
|
-
bid?: number;
|
|
18992
|
-
bidCurrency?: string;
|
|
18993
|
-
/**
|
|
18994
|
-
* For non-global events --- links to interestGroupAuctionEvent
|
|
18995
|
-
*/
|
|
18996
|
-
uniqueAuctionId?: InterestGroupAuctionId;
|
|
18997
|
-
}
|
|
18998
|
-
|
|
18999
|
-
/**
|
|
19000
|
-
* An auction involving interest groups is taking place. These events are
|
|
19001
|
-
* target-specific.
|
|
19002
|
-
*/
|
|
19003
|
-
export interface InterestGroupAuctionEventOccurredEvent {
|
|
19004
|
-
eventTime: Network.TimeSinceEpoch;
|
|
19005
|
-
type: InterestGroupAuctionEventType;
|
|
19006
|
-
uniqueAuctionId: InterestGroupAuctionId;
|
|
19007
|
-
/**
|
|
19008
|
-
* Set for child auctions.
|
|
19009
|
-
*/
|
|
19010
|
-
parentAuctionId?: InterestGroupAuctionId;
|
|
19011
|
-
/**
|
|
19012
|
-
* Set for started and configResolved
|
|
19013
|
-
*/
|
|
19014
|
-
auctionConfig?: any;
|
|
19015
|
-
}
|
|
19016
|
-
|
|
19017
|
-
/**
|
|
19018
|
-
* Specifies which auctions a particular network fetch may be related to, and
|
|
19019
|
-
* in what role. Note that it is not ordered with respect to
|
|
19020
|
-
* Network.requestWillBeSent (but will happen before loadingFinished
|
|
19021
|
-
* loadingFailed).
|
|
19022
|
-
*/
|
|
19023
|
-
export interface InterestGroupAuctionNetworkRequestCreatedEvent {
|
|
19024
|
-
type: InterestGroupAuctionFetchType;
|
|
19025
|
-
requestId: Network.RequestId;
|
|
19026
|
-
/**
|
|
19027
|
-
* This is the set of the auctions using the worklet that issued this
|
|
19028
|
-
* request. In the case of trusted signals, it's possible that only some of
|
|
19029
|
-
* them actually care about the keys being queried.
|
|
19030
|
-
*/
|
|
19031
|
-
auctions: InterestGroupAuctionId[];
|
|
19032
|
-
}
|
|
19033
|
-
|
|
19034
18886
|
/**
|
|
19035
18887
|
* Shared storage was accessed by the associated page.
|
|
19036
18888
|
* The following parameters are included in all events.
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../core/host/host.js';
|
|
6
|
-
import * as SDK from '../../core/sdk/sdk.js';
|
|
7
6
|
import type * as LHModel from '../lighthouse/lighthouse.js';
|
|
8
7
|
|
|
9
8
|
import {
|
|
@@ -68,7 +67,7 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
68
67
|
readonly clientFeature = Host.AidaClient.ClientFeature.CHROME_DEVTOOLS_V2_AGENT;
|
|
69
68
|
readonly userTier = 'TESTERS';
|
|
70
69
|
|
|
71
|
-
#changes
|
|
70
|
+
#changes: ChangeManager;
|
|
72
71
|
#execJs: typeof executeJsCode;
|
|
73
72
|
readonly #allowedOrigin?: () => AllowedOriginResult;
|
|
74
73
|
readonly #lighthouseRecording?:
|
|
@@ -83,6 +82,7 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
83
82
|
|
|
84
83
|
constructor(opts: AiAgent2Options) {
|
|
85
84
|
super(opts);
|
|
85
|
+
this.#changes = new ChangeManager(opts.targetManager);
|
|
86
86
|
this.#lighthouseRecording = opts.lighthouseRecording;
|
|
87
87
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
88
88
|
this.#allowedOrigin = opts.allowedOrigin;
|
|
@@ -231,7 +231,7 @@ User query: ${enhancedQuery}`;
|
|
|
231
231
|
createExtensionScope: this.#createExtensionScope.bind(this),
|
|
232
232
|
execJs: this.#execJs,
|
|
233
233
|
getExecutionContextNode: () => this.context instanceof DOMNodeContext ? this.context.getItem() : null,
|
|
234
|
-
getTarget: () =>
|
|
234
|
+
getTarget: () => this.targetManager.primaryPageTarget(),
|
|
235
235
|
getEstablishedOrigin: () => this.#getConversationOrigin(),
|
|
236
236
|
lighthouseRecording: this.#lighthouseRecording,
|
|
237
237
|
};
|
|
@@ -72,6 +72,8 @@ export interface AiConversationOptions {
|
|
|
72
72
|
onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>;
|
|
73
73
|
networkTimeCalculator?: NetworkTimeCalculator.NetworkTransferTimeCalculator;
|
|
74
74
|
lighthouseRecording?: (overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
75
|
+
aiHistoryStorage?: AiHistoryStorage;
|
|
76
|
+
targetManager?: SDK.TargetManager.TargetManager;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export class AiConversation {
|
|
@@ -110,6 +112,8 @@ export class AiConversation {
|
|
|
110
112
|
#lighthouseRecording?: (overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
111
113
|
#onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>;
|
|
112
114
|
#networkTimeCalculator?: NetworkTimeCalculator.NetworkTransferTimeCalculator;
|
|
115
|
+
readonly #aiHistoryStorage: AiHistoryStorage;
|
|
116
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
113
117
|
|
|
114
118
|
constructor(options: AiConversationOptions) {
|
|
115
119
|
const {
|
|
@@ -123,6 +127,8 @@ export class AiConversation {
|
|
|
123
127
|
onInspectElement,
|
|
124
128
|
networkTimeCalculator,
|
|
125
129
|
lighthouseRecording,
|
|
130
|
+
aiHistoryStorage = AiHistoryStorage.instance(),
|
|
131
|
+
targetManager = SDK.TargetManager.TargetManager.instance(),
|
|
126
132
|
} = options;
|
|
127
133
|
this.#changeManager = changeManager;
|
|
128
134
|
this.#aidaClient = aidaClient;
|
|
@@ -130,6 +136,8 @@ export class AiConversation {
|
|
|
130
136
|
this.#onInspectElement = onInspectElement;
|
|
131
137
|
this.#networkTimeCalculator = networkTimeCalculator;
|
|
132
138
|
this.#lighthouseRecording = lighthouseRecording;
|
|
139
|
+
this.#aiHistoryStorage = aiHistoryStorage;
|
|
140
|
+
this.#targetManager = targetManager;
|
|
133
141
|
|
|
134
142
|
this.id = id;
|
|
135
143
|
this.#isReadOnly = isReadOnly;
|
|
@@ -208,7 +216,7 @@ export class AiConversation {
|
|
|
208
216
|
}
|
|
209
217
|
|
|
210
218
|
#reconstructHistory(historyWithoutImages: ResponseData[]): ResponseData[] {
|
|
211
|
-
const imageHistory =
|
|
219
|
+
const imageHistory = this.#aiHistoryStorage.getImageHistory();
|
|
212
220
|
if (imageHistory && imageHistory.length > 0) {
|
|
213
221
|
const history: ResponseData[] = [];
|
|
214
222
|
for (const data of historyWithoutImages) {
|
|
@@ -286,12 +294,12 @@ export class AiConversation {
|
|
|
286
294
|
|
|
287
295
|
async addHistoryItem(item: ResponseData): Promise<void> {
|
|
288
296
|
this.history.push(item);
|
|
289
|
-
await
|
|
297
|
+
await this.#aiHistoryStorage.upsertHistoryEntry(this.serialize());
|
|
290
298
|
if (item.type === ResponseType.USER_QUERY) {
|
|
291
|
-
void
|
|
299
|
+
void this.#aiHistoryStorage.addRecentPrompt(item.query);
|
|
292
300
|
if (item.imageId && item.imageInput && 'inlineData' in item.imageInput) {
|
|
293
301
|
const inlineData = item.imageInput.inlineData;
|
|
294
|
-
await
|
|
302
|
+
await this.#aiHistoryStorage.upsertImage({
|
|
295
303
|
id: item.imageId,
|
|
296
304
|
data: inlineData.data,
|
|
297
305
|
mimeType: inlineData.mimeType,
|
|
@@ -361,6 +369,7 @@ export class AiConversation {
|
|
|
361
369
|
lighthouseRecording: this.#lighthouseRecording,
|
|
362
370
|
allowedOrigin: this.allowedOrigin,
|
|
363
371
|
history,
|
|
372
|
+
targetManager: this.#targetManager,
|
|
364
373
|
};
|
|
365
374
|
|
|
366
375
|
this.#agent = Root.Runtime.hostConfig.devToolsAiV2Architecture?.enabled ? new AiAgent2(options) :
|
|
@@ -397,18 +406,18 @@ export class AiConversation {
|
|
|
397
406
|
} = {},
|
|
398
407
|
): AsyncGenerator<ResponseData, void, void> {
|
|
399
408
|
this.#navigationOccurredDuringRun = false;
|
|
400
|
-
const originAtRunStart = getPrimaryPageOrigin();
|
|
409
|
+
const originAtRunStart = getPrimaryPageOrigin(this.#targetManager);
|
|
401
410
|
const listener = (): void => {
|
|
402
411
|
// If an unexpected navigation to a different origin occurred
|
|
403
412
|
// during processing the user's request, we don't want to allow
|
|
404
413
|
// the agent to run any function calls and retrieve data from the new origin.
|
|
405
414
|
// Performance agent and accessibility agent navigate to 'about://' or 'chrome://terms'
|
|
406
|
-
const newOrigin = getPrimaryPageOrigin();
|
|
415
|
+
const newOrigin = getPrimaryPageOrigin(this.#targetManager);
|
|
407
416
|
if (originAtRunStart !== newOrigin && newOrigin && !ALLOWED_PAGE_NAVIGATIONS.includes(newOrigin)) {
|
|
408
417
|
this.#navigationOccurredDuringRun = true;
|
|
409
418
|
}
|
|
410
419
|
};
|
|
411
|
-
const targetManager =
|
|
420
|
+
const targetManager = this.#targetManager;
|
|
412
421
|
targetManager.addModelListener(SDK.ResourceTreeModel.ResourceTreeModel,
|
|
413
422
|
SDK.ResourceTreeModel.Events.PrimaryPageChanged, listener, this);
|
|
414
423
|
|
|
@@ -524,7 +533,7 @@ export class AiConversation {
|
|
|
524
533
|
if (this.#origin) {
|
|
525
534
|
return {origin: this.#origin};
|
|
526
535
|
}
|
|
527
|
-
this.#origin = getPrimaryPageOrigin();
|
|
536
|
+
this.#origin = getPrimaryPageOrigin(this.#targetManager);
|
|
528
537
|
|
|
529
538
|
return {origin: this.#origin};
|
|
530
539
|
};
|
|
@@ -538,8 +547,10 @@ function isAiAssistanceContextSelectionAgentEnabled(): boolean {
|
|
|
538
547
|
return Boolean(Root.Runtime.hostConfig.devToolsAiAssistanceContextSelectionAgent?.enabled);
|
|
539
548
|
}
|
|
540
549
|
|
|
541
|
-
function getPrimaryPageOrigin(
|
|
542
|
-
|
|
550
|
+
function getPrimaryPageOrigin(
|
|
551
|
+
targetManager: SDK.TargetManager.TargetManager,
|
|
552
|
+
): Platform.DevToolsPath.UrlString|undefined {
|
|
553
|
+
const target = targetManager.primaryPageTarget();
|
|
543
554
|
const inspectedURL = target?.inspectedURL();
|
|
544
555
|
return inspectedURL ? new Common.ParsedURL.ParsedURL(inspectedURL).securityOrigin() : undefined;
|
|
545
556
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// found in the LICENSE file.
|
|
5
5
|
|
|
6
6
|
import * as Common from '../../core/common/common.js';
|
|
7
|
+
import * as Root from '../../core/root/root.js';
|
|
7
8
|
|
|
8
9
|
import {ResponseType, type SerializedResponseData} from './agents/AiAgent.js';
|
|
9
10
|
|
|
@@ -33,8 +34,6 @@ export interface SerializedImage {
|
|
|
33
34
|
data: string;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
let instance: AiHistoryStorage|null = null;
|
|
37
|
-
|
|
38
37
|
const DEFAULT_MAX_STORAGE_SIZE = 50 * 1024 * 1024;
|
|
39
38
|
export const MAX_RECENT_PROMPTS_COUNT = 20;
|
|
40
39
|
export const MAX_CONVERSATIONS_COUNT = 50;
|
|
@@ -55,14 +54,17 @@ export class AiHistoryStorage extends Common.ObjectWrapper.ObjectWrapper<EventTy
|
|
|
55
54
|
#mutex = new Common.Mutex.Mutex();
|
|
56
55
|
#maxStorageSize: number;
|
|
57
56
|
|
|
58
|
-
constructor(
|
|
57
|
+
constructor(
|
|
58
|
+
settings: Common.Settings.Settings = Common.Settings.Settings.instance(),
|
|
59
|
+
maxStorageSize = DEFAULT_MAX_STORAGE_SIZE,
|
|
60
|
+
) {
|
|
59
61
|
super();
|
|
60
|
-
this.#historySetting =
|
|
61
|
-
this.#imageHistorySettings =
|
|
62
|
+
this.#historySetting = settings.createSetting('ai-assistance-history-entries', []);
|
|
63
|
+
this.#imageHistorySettings = settings.createSetting(
|
|
62
64
|
'ai-assistance-history-images',
|
|
63
65
|
[],
|
|
64
66
|
);
|
|
65
|
-
this.#recentPromptsSetting =
|
|
67
|
+
this.#recentPromptsSetting = settings.createSetting('ai-assistance-recent-prompts', []);
|
|
66
68
|
this.#maxStorageSize = maxStorageSize;
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -225,12 +227,21 @@ export class AiHistoryStorage extends Common.ObjectWrapper.ObjectWrapper<EventTy
|
|
|
225
227
|
opts: {
|
|
226
228
|
forceNew: boolean,
|
|
227
229
|
maxStorageSize?: number,
|
|
230
|
+
settings?: Common.Settings.Settings,
|
|
228
231
|
} = {forceNew: false, maxStorageSize: DEFAULT_MAX_STORAGE_SIZE},
|
|
229
232
|
): AiHistoryStorage {
|
|
230
|
-
const {forceNew, maxStorageSize} = opts;
|
|
231
|
-
if (!
|
|
232
|
-
|
|
233
|
+
const {forceNew, maxStorageSize, settings} = opts;
|
|
234
|
+
if (!Root.DevToolsContext.globalInstance().has(AiHistoryStorage) || forceNew) {
|
|
235
|
+
Root.DevToolsContext.globalInstance().set(AiHistoryStorage,
|
|
236
|
+
new AiHistoryStorage(
|
|
237
|
+
settings ?? Common.Settings.Settings.instance(),
|
|
238
|
+
maxStorageSize,
|
|
239
|
+
));
|
|
233
240
|
}
|
|
234
|
-
return
|
|
241
|
+
return Root.DevToolsContext.globalInstance().get(AiHistoryStorage);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
static removeInstance(): void {
|
|
245
|
+
Root.DevToolsContext.globalInstance().delete(AiHistoryStorage);
|
|
235
246
|
}
|
|
236
247
|
}
|
|
@@ -36,8 +36,8 @@ export class ChangeManager {
|
|
|
36
36
|
readonly #stylesheetChanges = new Map<Protocol.DOM.StyleSheetId, Change[]>();
|
|
37
37
|
readonly #backupStylesheetChanges = new Map<Protocol.DOM.StyleSheetId, Change[]>();
|
|
38
38
|
|
|
39
|
-
constructor() {
|
|
40
|
-
|
|
39
|
+
constructor(targetManager: SDK.TargetManager.TargetManager = SDK.TargetManager.TargetManager.instance()) {
|
|
40
|
+
targetManager.addModelListener(
|
|
41
41
|
SDK.ResourceTreeModel.ResourceTreeModel,
|
|
42
42
|
SDK.ResourceTreeModel.Events.PrimaryPageChanged,
|
|
43
43
|
this.clear,
|
|
@@ -237,7 +237,11 @@ export class ExtensionScope {
|
|
|
237
237
|
return node.localName() || node.nodeName().toLowerCase();
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
static getSourceLocation(
|
|
240
|
+
static getSourceLocation(
|
|
241
|
+
styleRule: SDK.CSSRule.CSSStyleRule,
|
|
242
|
+
cssWorkspaceBinding: Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding =
|
|
243
|
+
Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance(),
|
|
244
|
+
): string|undefined {
|
|
241
245
|
const styleSheetHeader = styleRule.header;
|
|
242
246
|
if (!styleSheetHeader) {
|
|
243
247
|
return;
|
|
@@ -250,7 +254,7 @@ export class ExtensionScope {
|
|
|
250
254
|
const lineNumber = styleSheetHeader.lineNumberInSource(range.startLine);
|
|
251
255
|
const columnNumber = styleSheetHeader.columnNumberInSource(range.startLine, range.startColumn);
|
|
252
256
|
const location = new SDK.CSSModel.CSSLocation(styleSheetHeader, lineNumber, columnNumber);
|
|
253
|
-
const uiLocation =
|
|
257
|
+
const uiLocation = cssWorkspaceBinding.rawLocationToUILocation(location);
|
|
254
258
|
return uiLocation?.linkText(/* skipTrim= */ true, /* showColumnNumber= */ true);
|
|
255
259
|
}
|
|
256
260
|
|
|
@@ -97,7 +97,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
97
97
|
constructor(opts: ExecuteJsAgentOptions) {
|
|
98
98
|
super(opts);
|
|
99
99
|
this.#lighthouseRecording = opts.lighthouseRecording;
|
|
100
|
-
this.#changes = opts.changeManager || new ChangeManager();
|
|
100
|
+
this.#changes = opts.changeManager || new ChangeManager(opts.targetManager);
|
|
101
101
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
102
102
|
this.#createExtensionScope = opts.createExtensionScope ?? ((changes: ChangeManager) => {
|
|
103
103
|
return new ExtensionScope(changes, this.sessionId, this.#getDocumentBodyNode());
|
|
@@ -6,7 +6,7 @@ import * as Host from '../../../core/host/host.js';
|
|
|
6
6
|
import type {UrlString} from '../../../core/platform/DevToolsPath.js';
|
|
7
7
|
import type * as Platform from '../../../core/platform/platform.js';
|
|
8
8
|
import * as Root from '../../../core/root/root.js';
|
|
9
|
-
import
|
|
9
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
10
10
|
import type * as Protocol from '../../../generated/protocol.js';
|
|
11
11
|
import type * as LHModel from '../../lighthouse/lighthouse.js';
|
|
12
12
|
import type * as TextUtils from '../../text_utils/text_utils.js';
|
|
@@ -166,6 +166,7 @@ export interface AgentOptions {
|
|
|
166
166
|
history?: Host.AidaClient.Content[];
|
|
167
167
|
allowedOrigin?: () => AllowedOriginResult;
|
|
168
168
|
lighthouseRecording?: (overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
169
|
+
targetManager?: SDK.TargetManager.TargetManager;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
export interface ParsedAnswer {
|
|
@@ -485,6 +486,7 @@ export abstract class AiAgent<T> {
|
|
|
485
486
|
readonly confirmSideEffect: typeof Promise.withResolvers;
|
|
486
487
|
readonly #functionDeclarations = new Map<string, FunctionDeclaration<Record<string, unknown>, unknown>>();
|
|
487
488
|
readonly #allowedOrigin?: () => AllowedOriginResult;
|
|
489
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
488
490
|
|
|
489
491
|
/**
|
|
490
492
|
* Used in the debug mode and evals.
|
|
@@ -518,6 +520,7 @@ export abstract class AiAgent<T> {
|
|
|
518
520
|
this.confirmSideEffect = opts.confirmSideEffectForTest ?? (() => Promise.withResolvers());
|
|
519
521
|
this.#history = opts.history ?? [];
|
|
520
522
|
this.#allowedOrigin = opts.allowedOrigin;
|
|
523
|
+
this.#targetManager = opts.targetManager ?? SDK.TargetManager.TargetManager.instance();
|
|
521
524
|
}
|
|
522
525
|
|
|
523
526
|
async enhanceQuery(query: string, selected: ConversationContext<T>|null,
|
|
@@ -534,6 +537,10 @@ export abstract class AiAgent<T> {
|
|
|
534
537
|
return [...this.#history];
|
|
535
538
|
}
|
|
536
539
|
|
|
540
|
+
get targetManager(): SDK.TargetManager.TargetManager {
|
|
541
|
+
return this.#targetManager;
|
|
542
|
+
}
|
|
543
|
+
|
|
537
544
|
/**
|
|
538
545
|
* Add a fact which will be sent for any subsequent requests.
|
|
539
546
|
* Returns the new list of all facts.
|
|
@@ -133,7 +133,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
|
|
|
133
133
|
constructor(opts: ExecuteJsAgentOptions) {
|
|
134
134
|
super(opts);
|
|
135
135
|
|
|
136
|
-
this.#changes = opts.changeManager || new ChangeManager();
|
|
136
|
+
this.#changes = opts.changeManager || new ChangeManager(opts.targetManager);
|
|
137
137
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
138
138
|
this.#createExtensionScope = opts.createExtensionScope ?? ((changes: ChangeManager) => {
|
|
139
139
|
return new ExtensionScope(changes, this.sessionId, this.context?.getItem() ?? null);
|