chrome-devtools-frontend 1.0.1543472 → 1.0.1544076
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/AUTHORS +1 -0
- package/front_end/core/host/AidaClient.ts +10 -7
- package/front_end/core/host/DispatchHttpRequestClient.ts +18 -3
- package/front_end/core/root/Runtime.ts +8 -7
- package/front_end/core/sdk/CPUThrottlingManager.ts +0 -4
- package/front_end/core/sdk/CSSMatchedStyles.ts +7 -9
- package/front_end/core/sdk/CSSModel.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +18 -6
- package/front_end/core/sdk/ChildTargetManager.ts +2 -2
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +2 -0
- package/front_end/entrypoints/main/MainImpl.ts +0 -16
- package/front_end/foundation/Universe.ts +12 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +10 -8
- package/front_end/models/ai_assistance/agents/PatchAgent.ts +7 -1
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +0 -5
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +4 -8
- package/front_end/models/ai_code_completion/AiCodeCompletion.ts +1 -1
- package/front_end/models/ai_code_generation/AiCodeGeneration.ts +5 -3
- package/front_end/models/bindings/CSSWorkspaceBinding.ts +8 -7
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +9 -8
- package/front_end/models/bindings/ResourceMapping.ts +57 -15
- package/front_end/models/live-metrics/LiveMetrics.ts +12 -20
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +6 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatView.ts +2 -4
- package/front_end/panels/ai_assistance/components/PerformanceAgentMarkdownRenderer.ts +2 -1
- package/front_end/panels/animation/AnimationTimeline.ts +6 -6
- package/front_end/panels/application/components/ReportsGrid.ts +7 -2
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +5 -3
- package/front_end/panels/application/components/TrustTokensView.ts +7 -1
- package/front_end/panels/application/preloading/PreloadingView.ts +10 -4
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +7 -11
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +15 -3
- package/front_end/panels/browser_debugger/DOMBreakpointsSidebarPane.ts +12 -13
- package/front_end/panels/{elements → common}/DOMLinkifier.ts +6 -6
- package/front_end/panels/common/common.ts +1 -0
- package/front_end/panels/console/ConsoleViewMessage.ts +4 -4
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +2 -1
- package/front_end/panels/elements/ElementsTreeElement.ts +3 -1
- package/front_end/panels/elements/StylePropertiesSection.ts +52 -15
- package/front_end/panels/elements/StylePropertyTreeElement.ts +8 -3
- package/front_end/panels/elements/StylesSidebarPane.ts +24 -14
- package/front_end/panels/elements/elements-meta.ts +11 -2
- package/front_end/panels/elements/elements.ts +0 -3
- package/front_end/panels/explain/components/ConsoleInsight.ts +31 -20
- package/front_end/panels/issues/AffectedResourcesView.ts +2 -1
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +2 -1
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/panels/recorder/RecorderController.ts +7 -1
- package/front_end/panels/sources/AiCodeCompletionPlugin.ts +42 -294
- package/front_end/panels/sources/DebuggerPausedMessage.ts +3 -3
- package/front_end/panels/sources/SourcesPanel.ts +5 -1
- package/front_end/panels/timeline/TimelineUIUtils.ts +3 -2
- package/front_end/panels/timeline/components/LiveMetricsView.ts +7 -4
- package/front_end/panels/timeline/components/insights/NodeLink.ts +3 -2
- package/front_end/third_party/puppeteer/README.chromium +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.js +8 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/injected/injected.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/Mutex.d.ts +2 -2
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/cjs/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/lib/es5-iife/puppeteer-core-browser.js +34 -6
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js +4 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/HTTPRequest.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts +1 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.js +8 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkEventManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.d.ts.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js +22 -0
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/cdp/NetworkManager.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.d.ts +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js +3 -3
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/revisions.js.map +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.d.ts +1 -1
- package/front_end/third_party/puppeteer/package/lib/esm/puppeteer/util/version.js +1 -1
- package/front_end/third_party/puppeteer/package/package.json +2 -2
- package/front_end/third_party/puppeteer/package/src/cdp/HTTPRequest.ts +5 -1
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkEventManager.ts +16 -1
- package/front_end/third_party/puppeteer/package/src/cdp/NetworkManager.ts +28 -0
- package/front_end/third_party/puppeteer/package/src/revisions.ts +3 -3
- package/front_end/third_party/puppeteer/package/src/util/version.ts +1 -1
- package/front_end/ui/components/text_editor/AiCodeCompletionProvider.ts +8 -5
- package/front_end/ui/i18n/i18n.ts +16 -0
- package/front_end/ui/legacy/UIUtils.ts +1 -1
- package/front_end/ui/legacy/Widget.ts +56 -25
- package/front_end/ui/legacy/XLink.ts +0 -2
- package/front_end/ui/legacy/components/object_ui/ObjectPopoverHelper.ts +3 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +155 -198
- package/front_end/ui/legacy/inspectorCommon.css +0 -4
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -1
- package/front_end/ui/components/expandable_list/ExpandableList.docs.ts +0 -30
- /package/front_end/panels/{elements → common}/domLinkifier.css +0 -0
package/AUTHORS
CHANGED
|
@@ -18,6 +18,7 @@ Alex Ho <wjhe1016@gmail.com>
|
|
|
18
18
|
Alexander Stammbach <alexander@stammbach.io>
|
|
19
19
|
Alexey Rodionov <fluorescent.hallucinogen@gmail.com>
|
|
20
20
|
Ameen Basha <ameenbasha111@gmail.com>
|
|
21
|
+
Ankit Kumar Sahu <sahuankit.murhu@gmail.com>
|
|
21
22
|
Ankit Mishra <ankit.mishra131990@gmail.com>
|
|
22
23
|
Anna Agoha <annaagoha@gmail.com>
|
|
23
24
|
Anthony Xie <anthonyxie64@gmail.com>
|
|
@@ -707,13 +707,16 @@ export class AidaClient {
|
|
|
707
707
|
return {generatedSamples, metadata};
|
|
708
708
|
}
|
|
709
709
|
|
|
710
|
-
async generateCode(request: GenerateCodeRequest
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
710
|
+
async generateCode(request: GenerateCodeRequest, options?: {signal?: AbortSignal}):
|
|
711
|
+
Promise<GenerateCodeResponse|null> {
|
|
712
|
+
const response = await DispatchHttpRequestClient.makeHttpRequest<GenerateCodeResponse>(
|
|
713
|
+
{
|
|
714
|
+
service: SERVICE_NAME,
|
|
715
|
+
path: '/v1/aida:generateCode',
|
|
716
|
+
method: 'POST',
|
|
717
|
+
body: JSON.stringify(request),
|
|
718
|
+
},
|
|
719
|
+
options);
|
|
717
720
|
|
|
718
721
|
return response;
|
|
719
722
|
}
|
|
@@ -8,6 +8,7 @@ import type {DispatchHttpRequestRequest, DispatchHttpRequestResult} from './Insp
|
|
|
8
8
|
export enum ErrorType {
|
|
9
9
|
HTTP_RESPONSE_UNAVAILABLE = 'HTTP_RESPONSE_UNAVAILABLE',
|
|
10
10
|
NOT_FOUND = 'NOT_FOUND',
|
|
11
|
+
ABORT = 'ABORT',
|
|
11
12
|
}
|
|
12
13
|
|
|
13
14
|
export class DispatchHttpRequestError extends Error {
|
|
@@ -16,9 +17,23 @@ export class DispatchHttpRequestError extends Error {
|
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
19
|
-
export async function makeHttpRequest<R>(
|
|
20
|
-
|
|
21
|
-
|
|
20
|
+
export async function makeHttpRequest<R>(
|
|
21
|
+
request: DispatchHttpRequestRequest, options?: {signal?: AbortSignal}): Promise<R> {
|
|
22
|
+
const signal = options?.signal;
|
|
23
|
+
if (signal?.aborted) {
|
|
24
|
+
throw new DispatchHttpRequestError(ErrorType.ABORT);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
const response = await new Promise<DispatchHttpRequestResult>((resolve, reject) => {
|
|
28
|
+
const onAbort = (): void => {
|
|
29
|
+
reject(new DispatchHttpRequestError(ErrorType.ABORT));
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
signal?.addEventListener('abort', onAbort, {once: true});
|
|
33
|
+
InspectorFrontendHostInstance.dispatchHttpRequest(request, result => {
|
|
34
|
+
signal?.removeEventListener('abort', onAbort);
|
|
35
|
+
resolve(result);
|
|
36
|
+
});
|
|
22
37
|
});
|
|
23
38
|
|
|
24
39
|
debugLog({request, response});
|
|
@@ -70,21 +70,22 @@ export class Runtime {
|
|
|
70
70
|
runtimeInstance = undefined;
|
|
71
71
|
}
|
|
72
72
|
|
|
73
|
-
static queryParamsObject: URLSearchParams;
|
|
73
|
+
static #queryParamsObject: URLSearchParams;
|
|
74
74
|
|
|
75
|
-
static getSearchParams(): URLSearchParams {
|
|
76
|
-
|
|
77
|
-
|
|
75
|
+
static #getSearchParams(): URLSearchParams|null {
|
|
76
|
+
// TODO(crbug.com/451502260): Find a more explicit way to support running in Node.js
|
|
77
|
+
if (!Runtime.#queryParamsObject && 'location' in globalThis) {
|
|
78
|
+
Runtime.#queryParamsObject = new URLSearchParams(location.search);
|
|
78
79
|
}
|
|
79
|
-
return Runtime
|
|
80
|
+
return Runtime.#queryParamsObject;
|
|
80
81
|
}
|
|
81
82
|
|
|
82
83
|
static queryParam(name: string): string|null {
|
|
83
|
-
return Runtime
|
|
84
|
+
return Runtime.#getSearchParams()?.get(name) ?? null;
|
|
84
85
|
}
|
|
85
86
|
|
|
86
87
|
static setQueryParamForTesting(name: string, value: string): void {
|
|
87
|
-
Runtime
|
|
88
|
+
Runtime.#getSearchParams()?.set(name, value);
|
|
88
89
|
}
|
|
89
90
|
|
|
90
91
|
static isNode(): boolean {
|
|
@@ -184,10 +184,6 @@ export interface EventTypes {
|
|
|
184
184
|
[Events.HARDWARE_CONCURRENCY_CHANGED]: number;
|
|
185
185
|
}
|
|
186
186
|
|
|
187
|
-
export function throttlingManager(): CPUThrottlingManager {
|
|
188
|
-
return CPUThrottlingManager.instance();
|
|
189
|
-
}
|
|
190
|
-
|
|
191
187
|
export enum CPUThrottlingRates {
|
|
192
188
|
NO_THROTTLING = 1,
|
|
193
189
|
MID_TIER_MOBILE = 4,
|
|
@@ -41,7 +41,7 @@ import {
|
|
|
41
41
|
VariableMatcher
|
|
42
42
|
} from './CSSPropertyParserMatchers.js';
|
|
43
43
|
import {
|
|
44
|
-
|
|
44
|
+
CSSAtRule,
|
|
45
45
|
CSSFunctionRule,
|
|
46
46
|
CSSKeyframeRule,
|
|
47
47
|
CSSKeyframesRule,
|
|
@@ -210,7 +210,7 @@ export interface CSSMatchedStylesPayload {
|
|
|
210
210
|
positionTryRules: Protocol.CSS.CSSPositionTryRule[];
|
|
211
211
|
propertyRules: Protocol.CSS.CSSPropertyRule[];
|
|
212
212
|
cssPropertyRegistrations: Protocol.CSS.CSSPropertyRegistration[];
|
|
213
|
-
|
|
213
|
+
atRules: Protocol.CSS.CSSAtRule[];
|
|
214
214
|
animationStylesPayload: Protocol.CSS.CSSAnimationStyle[];
|
|
215
215
|
transitionsStylePayload: Protocol.CSS.CSSStyle|null;
|
|
216
216
|
inheritedAnimatedPayload: Protocol.CSS.InheritedAnimatedStyleEntry[];
|
|
@@ -305,8 +305,8 @@ export class CSSMatchedStyles {
|
|
|
305
305
|
#pseudoDOMCascades?: Map<Protocol.DOM.PseudoType, DOMInheritanceCascade>;
|
|
306
306
|
#customHighlightPseudoDOMCascades?: Map<string, DOMInheritanceCascade>;
|
|
307
307
|
#functionRules: CSSFunctionRule[];
|
|
308
|
+
#atRules: CSSAtRule[];
|
|
308
309
|
#functionRuleMap = new Map<string, CSSFunctionRule>();
|
|
309
|
-
readonly #fontPaletteValuesRule: CSSFontPaletteValuesRule|undefined;
|
|
310
310
|
#environmentVariables: Record<string, string> = {};
|
|
311
311
|
|
|
312
312
|
static async create(payload: CSSMatchedStylesPayload): Promise<CSSMatchedStyles> {
|
|
@@ -323,9 +323,9 @@ export class CSSMatchedStyles {
|
|
|
323
323
|
positionTryRules,
|
|
324
324
|
propertyRules,
|
|
325
325
|
cssPropertyRegistrations,
|
|
326
|
-
fontPaletteValuesRule,
|
|
327
326
|
activePositionFallbackIndex,
|
|
328
327
|
functionRules,
|
|
328
|
+
atRules,
|
|
329
329
|
}: CSSMatchedStylesPayload) {
|
|
330
330
|
this.#cssModel = cssModel;
|
|
331
331
|
this.#node = node;
|
|
@@ -338,11 +338,9 @@ export class CSSMatchedStyles {
|
|
|
338
338
|
}
|
|
339
339
|
this.#positionTryRules = positionTryRules.map(rule => new CSSPositionTryRule(cssModel, rule));
|
|
340
340
|
this.#parentLayoutNodeId = parentLayoutNodeId;
|
|
341
|
-
this.#fontPaletteValuesRule =
|
|
342
|
-
fontPaletteValuesRule ? new CSSFontPaletteValuesRule(cssModel, fontPaletteValuesRule) : undefined;
|
|
343
|
-
|
|
344
341
|
this.#activePositionFallbackIndex = activePositionFallbackIndex;
|
|
345
342
|
this.#functionRules = functionRules.map(rule => new CSSFunctionRule(cssModel, rule));
|
|
343
|
+
this.#atRules = atRules.map(rule => new CSSAtRule(cssModel, rule));
|
|
346
344
|
}
|
|
347
345
|
|
|
348
346
|
private async init({
|
|
@@ -799,8 +797,8 @@ export class CSSMatchedStyles {
|
|
|
799
797
|
return this.#functionRules;
|
|
800
798
|
}
|
|
801
799
|
|
|
802
|
-
|
|
803
|
-
return this.#
|
|
800
|
+
atRules(): CSSAtRule[] {
|
|
801
|
+
return this.#atRules;
|
|
804
802
|
}
|
|
805
803
|
|
|
806
804
|
keyframes(): CSSKeyframesRule[] {
|
|
@@ -358,7 +358,7 @@ export class CSSModel extends SDKModel<EventTypes> {
|
|
|
358
358
|
propertyRules: matchedStylesResponse.cssPropertyRules ?? [],
|
|
359
359
|
functionRules: matchedStylesResponse.cssFunctionRules ?? [],
|
|
360
360
|
cssPropertyRegistrations: matchedStylesResponse.cssPropertyRegistrations ?? [],
|
|
361
|
-
|
|
361
|
+
atRules: matchedStylesResponse.cssAtRules ?? [],
|
|
362
362
|
activePositionFallbackIndex: matchedStylesResponse.activePositionFallbackIndex ?? -1,
|
|
363
363
|
animationStylesPayload: animatedStylesResponse?.animationStyles || [],
|
|
364
364
|
inheritedAnimatedPayload: animatedStylesResponse?.inherited || [],
|
|
@@ -268,20 +268,32 @@ export class CSSPropertyRule extends CSSRule {
|
|
|
268
268
|
}
|
|
269
269
|
}
|
|
270
270
|
|
|
271
|
-
export class
|
|
272
|
-
readonly #
|
|
273
|
-
|
|
271
|
+
export class CSSAtRule extends CSSRule {
|
|
272
|
+
readonly #name: CSSValue|null;
|
|
273
|
+
readonly #type: string;
|
|
274
|
+
readonly #subsection: string|null;
|
|
275
|
+
constructor(cssModel: CSSModel, payload: Protocol.CSS.CSSAtRule) {
|
|
274
276
|
super(cssModel, {
|
|
275
277
|
origin: payload.origin,
|
|
276
278
|
style: payload.style,
|
|
277
279
|
header: styleSheetHeaderForRule(cssModel, payload),
|
|
278
280
|
originTreeScopeNodeId: undefined
|
|
279
281
|
});
|
|
280
|
-
this.#
|
|
282
|
+
this.#name = payload.name ? new CSSValue(payload.name) : null;
|
|
283
|
+
this.#type = payload.type;
|
|
284
|
+
this.#subsection = payload.subsection ?? null;
|
|
281
285
|
}
|
|
282
286
|
|
|
283
|
-
name(): CSSValue {
|
|
284
|
-
return this.#
|
|
287
|
+
name(): CSSValue|null {
|
|
288
|
+
return this.#name;
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
type(): string {
|
|
292
|
+
return this.#type;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
subsection(): string|null {
|
|
296
|
+
return this.#subsection;
|
|
285
297
|
}
|
|
286
298
|
}
|
|
287
299
|
|
|
@@ -13,7 +13,7 @@ import {SDKModel} from './SDKModel.js';
|
|
|
13
13
|
import {SecurityOriginManager} from './SecurityOriginManager.js';
|
|
14
14
|
import {StorageKeyManager} from './StorageKeyManager.js';
|
|
15
15
|
import {Capability, type Target, Type} from './Target.js';
|
|
16
|
-
import {Events as TargetManagerEvents, TargetManager} from './TargetManager.js';
|
|
16
|
+
import {Events as TargetManagerEvents, type TargetManager} from './TargetManager.js';
|
|
17
17
|
|
|
18
18
|
const UIStrings = {
|
|
19
19
|
/**
|
|
@@ -126,7 +126,7 @@ export class ChildTargetManager extends SDKModel<EventTypes> implements Protocol
|
|
|
126
126
|
}
|
|
127
127
|
|
|
128
128
|
private fireAvailableTargetsChanged(): void {
|
|
129
|
-
|
|
129
|
+
this.#targetManager.dispatchEventToListeners(
|
|
130
130
|
TargetManagerEvents.AVAILABLE_TARGETS_CHANGED, [...this.#targetInfos.values()]);
|
|
131
131
|
}
|
|
132
132
|
|
|
@@ -448,23 +448,7 @@ export class MainImpl {
|
|
|
448
448
|
Workspace.FileManager.FileManager.instance({forceNew: true});
|
|
449
449
|
|
|
450
450
|
Bindings.NetworkProject.NetworkProjectManager.instance();
|
|
451
|
-
const resourceMapping = new Bindings.ResourceMapping.ResourceMapping(
|
|
452
|
-
targetManager,
|
|
453
|
-
Workspace.Workspace.WorkspaceImpl.instance(),
|
|
454
|
-
);
|
|
455
451
|
new Bindings.PresentationConsoleMessageHelper.PresentationConsoleMessageManager();
|
|
456
|
-
Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance({
|
|
457
|
-
forceNew: true,
|
|
458
|
-
resourceMapping,
|
|
459
|
-
targetManager,
|
|
460
|
-
});
|
|
461
|
-
Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding.instance({
|
|
462
|
-
forceNew: true,
|
|
463
|
-
resourceMapping,
|
|
464
|
-
targetManager,
|
|
465
|
-
ignoreListManager: Workspace.IgnoreListManager.IgnoreListManager.instance(),
|
|
466
|
-
workspace: Workspace.Workspace.WorkspaceImpl.instance(),
|
|
467
|
-
});
|
|
468
452
|
targetManager.setScopeTarget(targetManager.primaryPageTarget());
|
|
469
453
|
UI.Context.Context.instance().addFlavorChangeListener(SDK.Target.Target, ({data}) => {
|
|
470
454
|
const outermostTarget = data?.outermostTarget();
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import * as Common from '../core/common/common.js';
|
|
6
6
|
import * as Root from '../core/root/root.js';
|
|
7
7
|
import * as SDK from '../core/sdk/sdk.js';
|
|
8
|
+
import * as Bindings from '../models/bindings/bindings.js';
|
|
8
9
|
import * as Workspace from '../models/workspace/workspace.js';
|
|
9
10
|
|
|
10
11
|
export interface CreationOptions {
|
|
@@ -25,9 +26,19 @@ export class Universe {
|
|
|
25
26
|
|
|
26
27
|
const targetManager = new SDK.TargetManager.TargetManager();
|
|
27
28
|
this.context.set(SDK.TargetManager.TargetManager, targetManager);
|
|
28
|
-
|
|
29
|
+
|
|
30
|
+
const workspace = new Workspace.Workspace.WorkspaceImpl();
|
|
31
|
+
this.context.set(Workspace.Workspace.WorkspaceImpl, workspace);
|
|
29
32
|
|
|
30
33
|
const ignoreListManager = new Workspace.IgnoreListManager.IgnoreListManager(settings, targetManager);
|
|
31
34
|
this.context.set(Workspace.IgnoreListManager.IgnoreListManager, ignoreListManager);
|
|
35
|
+
|
|
36
|
+
const resourceMapping = new Bindings.ResourceMapping.ResourceMapping(targetManager, workspace);
|
|
37
|
+
const cssWorkspaceBinding = new Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding(resourceMapping, targetManager);
|
|
38
|
+
this.context.set(Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding, cssWorkspaceBinding);
|
|
39
|
+
|
|
40
|
+
const debuggerWorkspaceBinding = new Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding(
|
|
41
|
+
resourceMapping, targetManager, ignoreListManager, workspace);
|
|
42
|
+
this.context.set(Bindings.DebuggerWorkspaceBinding.DebuggerWorkspaceBinding, debuggerWorkspaceBinding);
|
|
32
43
|
}
|
|
33
44
|
}
|
|
@@ -204,6 +204,15 @@ export type FunctionCallHandlerResult<Result> = {
|
|
|
204
204
|
requiresApproval: true,
|
|
205
205
|
}|{error: string};
|
|
206
206
|
|
|
207
|
+
export interface FunctionHandlerOptions {
|
|
208
|
+
/**
|
|
209
|
+
* Shows that the user approved
|
|
210
|
+
* the execution if it was required
|
|
211
|
+
*/
|
|
212
|
+
approved?: boolean;
|
|
213
|
+
signal?: AbortSignal;
|
|
214
|
+
}
|
|
215
|
+
|
|
207
216
|
export interface FunctionDeclaration<Args extends Record<string, unknown>, ReturnType> {
|
|
208
217
|
/**
|
|
209
218
|
* Description of function, this is send to the LLM
|
|
@@ -228,14 +237,7 @@ export interface FunctionDeclaration<Args extends Record<string, unknown>, Retur
|
|
|
228
237
|
/**
|
|
229
238
|
* Function implementation that the LLM will try to execute,
|
|
230
239
|
*/
|
|
231
|
-
handler: (args: Args, options?:
|
|
232
|
-
/**
|
|
233
|
-
* Shows that the user approved
|
|
234
|
-
* the execution if it was required
|
|
235
|
-
*/
|
|
236
|
-
approved?: boolean,
|
|
237
|
-
signal?: AbortSignal,
|
|
238
|
-
}) => Promise<FunctionCallHandlerResult<ReturnType>>;
|
|
240
|
+
handler: (args: Args, options?: FunctionHandlerOptions) => Promise<FunctionCallHandlerResult<ReturnType>>;
|
|
239
241
|
}
|
|
240
242
|
|
|
241
243
|
interface AidaFetchResult {
|
|
@@ -151,7 +151,13 @@ export class PatchAgent extends AiAgent<Workspace.Workspace.Project> {
|
|
|
151
151
|
return {
|
|
152
152
|
result: {
|
|
153
153
|
matches: await this.#project.searchFiles(
|
|
154
|
-
args.query,
|
|
154
|
+
args.query,
|
|
155
|
+
args.caseSensitive,
|
|
156
|
+
args.isRegex,
|
|
157
|
+
{
|
|
158
|
+
signal: options?.signal,
|
|
159
|
+
},
|
|
160
|
+
),
|
|
155
161
|
}
|
|
156
162
|
};
|
|
157
163
|
},
|
|
@@ -10,7 +10,6 @@ import * as Root from '../../../core/root/root.js';
|
|
|
10
10
|
import * as SDK from '../../../core/sdk/sdk.js';
|
|
11
11
|
import * as Tracing from '../../../services/tracing/tracing.js';
|
|
12
12
|
import * as Trace from '../../trace/trace.js';
|
|
13
|
-
import {ConversationType} from '../AiHistoryStorage.js';
|
|
14
13
|
import {
|
|
15
14
|
PerformanceInsightFormatter,
|
|
16
15
|
} from '../data_formatters/PerformanceInsightFormatter.js';
|
|
@@ -323,10 +322,6 @@ export class PerformanceAgent extends AiAgent<AgentFocus> {
|
|
|
323
322
|
};
|
|
324
323
|
}
|
|
325
324
|
|
|
326
|
-
getConversationType(): ConversationType {
|
|
327
|
-
return ConversationType.PERFORMANCE;
|
|
328
|
-
}
|
|
329
|
-
|
|
330
325
|
async *
|
|
331
326
|
handleContextDetails(context: ConversationContext<AgentFocus>|null): AsyncGenerator<ContextResponse, void, void> {
|
|
332
327
|
if (!context) {
|
|
@@ -21,9 +21,10 @@ import {
|
|
|
21
21
|
ConversationContext,
|
|
22
22
|
type ConversationSuggestions,
|
|
23
23
|
type FunctionCallHandlerResult,
|
|
24
|
+
type FunctionHandlerOptions,
|
|
24
25
|
MultimodalInputType,
|
|
25
26
|
type RequestOptions,
|
|
26
|
-
ResponseType
|
|
27
|
+
ResponseType
|
|
27
28
|
} from './AiAgent.js';
|
|
28
29
|
|
|
29
30
|
/*
|
|
@@ -268,11 +269,7 @@ export class StylingAgent extends AiAgent<SDK.DOMModel.DOMNode> {
|
|
|
268
269
|
#createExtensionScope: CreateExtensionScopeFunction;
|
|
269
270
|
|
|
270
271
|
constructor(opts: AgentOptions) {
|
|
271
|
-
super(
|
|
272
|
-
aidaClient: opts.aidaClient,
|
|
273
|
-
serverSideLoggingEnabled: opts.serverSideLoggingEnabled,
|
|
274
|
-
confirmSideEffectForTest: opts.confirmSideEffectForTest,
|
|
275
|
-
});
|
|
272
|
+
super(opts);
|
|
276
273
|
|
|
277
274
|
this.#changes = opts.changeManager || new ChangeManager();
|
|
278
275
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
@@ -633,8 +630,7 @@ const data = {
|
|
|
633
630
|
};
|
|
634
631
|
}
|
|
635
632
|
|
|
636
|
-
async executeAction(action: string, options?:
|
|
637
|
-
Promise<FunctionCallHandlerResult<unknown>> {
|
|
633
|
+
async executeAction(action: string, options?: FunctionHandlerOptions): Promise<FunctionCallHandlerResult<unknown>> {
|
|
638
634
|
debugLog(`Action to execute: ${action}`);
|
|
639
635
|
|
|
640
636
|
if (options?.approved === false) {
|
|
@@ -46,7 +46,7 @@ export interface Callbacks {
|
|
|
46
46
|
}
|
|
47
47
|
|
|
48
48
|
/* clang-format off */
|
|
49
|
-
const consoleAdditionalContextFileContent = `/**
|
|
49
|
+
export const consoleAdditionalContextFileContent = `/**
|
|
50
50
|
* This file describes the execution environment of the Chrome DevTools Console.
|
|
51
51
|
* The code is JavaScript, but with special global functions and variables.
|
|
52
52
|
* Top-level await is available.
|
|
@@ -73,6 +73,7 @@ export class AiCodeGeneration {
|
|
|
73
73
|
inference_language: inferenceLanguage,
|
|
74
74
|
temperature: validTemperature(this.#options.temperature),
|
|
75
75
|
model_id: this.#options.modelId || undefined,
|
|
76
|
+
expect_code_output: true,
|
|
76
77
|
},
|
|
77
78
|
metadata: {
|
|
78
79
|
disable_user_content_logging: !(this.#serverSideLoggingEnabled ?? false),
|
|
@@ -139,10 +140,11 @@ export class AiCodeGeneration {
|
|
|
139
140
|
Host.userMetrics.actionTaken(Host.UserMetrics.Action.AiCodeGenerationSuggestionAccepted);
|
|
140
141
|
}
|
|
141
142
|
|
|
142
|
-
async generateCode(
|
|
143
|
-
|
|
143
|
+
async generateCode(
|
|
144
|
+
prompt: string, preamble: string, inferenceLanguage?: Host.AidaClient.AidaInferenceLanguage,
|
|
145
|
+
options?: {signal?: AbortSignal}): Promise<Host.AidaClient.GenerateCodeResponse|null> {
|
|
144
146
|
const request = this.#buildRequest(prompt, preamble, inferenceLanguage);
|
|
145
|
-
const response = await this.#aidaClient.generateCode(request);
|
|
147
|
+
const response = await this.#aidaClient.generateCode(request, options);
|
|
146
148
|
|
|
147
149
|
debugLog({request, response});
|
|
148
150
|
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
|
+
import * as Root from '../../core/root/root.js';
|
|
7
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
9
|
import type * as Workspace from '../workspace/workspace.js';
|
|
9
10
|
|
|
@@ -16,15 +17,14 @@ import type {ResourceMapping} from './ResourceMapping.js';
|
|
|
16
17
|
import {SASSSourceMapping} from './SASSSourceMapping.js';
|
|
17
18
|
import {StylesSourceMapping} from './StylesSourceMapping.js';
|
|
18
19
|
|
|
19
|
-
let cssWorkspaceBindingInstance: CSSWorkspaceBinding|undefined;
|
|
20
|
-
|
|
21
20
|
export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<SDK.CSSModel.CSSModel> {
|
|
22
21
|
readonly #resourceMapping: ResourceMapping;
|
|
23
22
|
readonly #modelToInfo: Map<SDK.CSSModel.CSSModel, ModelInfo>;
|
|
24
23
|
readonly #liveLocationPromises: Set<Promise<unknown>>;
|
|
25
24
|
|
|
26
|
-
|
|
25
|
+
constructor(resourceMapping: ResourceMapping, targetManager: SDK.TargetManager.TargetManager) {
|
|
27
26
|
this.#resourceMapping = resourceMapping;
|
|
27
|
+
this.#resourceMapping.cssWorkspaceBinding = this;
|
|
28
28
|
this.#modelToInfo = new Map();
|
|
29
29
|
targetManager.observeModels(SDK.CSSModel.CSSModel, this);
|
|
30
30
|
|
|
@@ -37,20 +37,21 @@ export class CSSWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<S
|
|
|
37
37
|
targetManager: SDK.TargetManager.TargetManager|null,
|
|
38
38
|
} = {forceNew: null, resourceMapping: null, targetManager: null}): CSSWorkspaceBinding {
|
|
39
39
|
const {forceNew, resourceMapping, targetManager} = opts;
|
|
40
|
-
if (
|
|
40
|
+
if (forceNew) {
|
|
41
41
|
if (!resourceMapping || !targetManager) {
|
|
42
42
|
throw new Error(`Unable to create CSSWorkspaceBinding: resourceMapping and targetManager must be provided: ${
|
|
43
43
|
new Error().stack}`);
|
|
44
44
|
}
|
|
45
45
|
|
|
46
|
-
|
|
46
|
+
Root.DevToolsContext.globalInstance().set(
|
|
47
|
+
CSSWorkspaceBinding, new CSSWorkspaceBinding(resourceMapping, targetManager));
|
|
47
48
|
}
|
|
48
49
|
|
|
49
|
-
return
|
|
50
|
+
return Root.DevToolsContext.globalInstance().get(CSSWorkspaceBinding);
|
|
50
51
|
}
|
|
51
52
|
|
|
52
53
|
static removeInstance(): void {
|
|
53
|
-
|
|
54
|
+
Root.DevToolsContext.globalInstance().delete(CSSWorkspaceBinding);
|
|
54
55
|
}
|
|
55
56
|
|
|
56
57
|
get modelToInfo(): Map<SDK.CSSModel.CSSModel, ModelInfo> {
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import * as Common from '../../core/common/common.js';
|
|
6
6
|
import * as Platform from '../../core/platform/platform.js';
|
|
7
|
+
import * as Root from '../../core/root/root.js';
|
|
7
8
|
import * as SDK from '../../core/sdk/sdk.js';
|
|
8
9
|
import * as Protocol from '../../generated/protocol.js';
|
|
9
10
|
import type * as StackTrace from '../stack_trace/stack_trace.js';
|
|
@@ -20,8 +21,6 @@ import {NetworkProject} from './NetworkProject.js';
|
|
|
20
21
|
import type {ResourceMapping} from './ResourceMapping.js';
|
|
21
22
|
import {type ResourceScriptFile, ResourceScriptMapping} from './ResourceScriptMapping.js';
|
|
22
23
|
|
|
23
|
-
let debuggerWorkspaceBindingInstance: DebuggerWorkspaceBinding|undefined;
|
|
24
|
-
|
|
25
24
|
export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObserver<SDK.DebuggerModel.DebuggerModel> {
|
|
26
25
|
readonly resourceMapping: ResourceMapping;
|
|
27
26
|
readonly #debuggerModelToData: Map<SDK.DebuggerModel.DebuggerModel, ModelData>;
|
|
@@ -30,10 +29,11 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
30
29
|
readonly ignoreListManager: Workspace.IgnoreListManager.IgnoreListManager;
|
|
31
30
|
readonly workspace: Workspace.Workspace.WorkspaceImpl;
|
|
32
31
|
|
|
33
|
-
|
|
32
|
+
constructor(
|
|
34
33
|
resourceMapping: ResourceMapping, targetManager: SDK.TargetManager.TargetManager,
|
|
35
34
|
ignoreListManager: Workspace.IgnoreListManager.IgnoreListManager, workspace: Workspace.Workspace.WorkspaceImpl) {
|
|
36
35
|
this.resourceMapping = resourceMapping;
|
|
36
|
+
this.resourceMapping.debuggerWorkspaceBinding = this;
|
|
37
37
|
this.ignoreListManager = ignoreListManager;
|
|
38
38
|
this.workspace = workspace;
|
|
39
39
|
|
|
@@ -68,22 +68,23 @@ export class DebuggerWorkspaceBinding implements SDK.TargetManager.SDKModelObser
|
|
|
68
68
|
} = {forceNew: null, resourceMapping: null, targetManager: null, ignoreListManager: null, workspace: null}):
|
|
69
69
|
DebuggerWorkspaceBinding {
|
|
70
70
|
const {forceNew, resourceMapping, targetManager, ignoreListManager, workspace} = opts;
|
|
71
|
-
if (
|
|
71
|
+
if (forceNew) {
|
|
72
72
|
if (!resourceMapping || !targetManager || !ignoreListManager || !workspace) {
|
|
73
73
|
throw new Error(
|
|
74
74
|
`Unable to create DebuggerWorkspaceBinding: resourceMapping, targetManager and IgnoreLIstManager must be provided: ${
|
|
75
75
|
new Error().stack}`);
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
Root.DevToolsContext.globalInstance().set(
|
|
79
|
+
DebuggerWorkspaceBinding,
|
|
80
|
+
new DebuggerWorkspaceBinding(resourceMapping, targetManager, ignoreListManager, workspace));
|
|
80
81
|
}
|
|
81
82
|
|
|
82
|
-
return
|
|
83
|
+
return Root.DevToolsContext.globalInstance().get(DebuggerWorkspaceBinding);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
86
|
static removeInstance(): void {
|
|
86
|
-
|
|
87
|
+
Root.DevToolsContext.globalInstance().delete(DebuggerWorkspaceBinding);
|
|
87
88
|
}
|
|
88
89
|
|
|
89
90
|
private async computeAutoStepRanges(mode: SDK.DebuggerModel.StepMode, callFrame: SDK.DebuggerModel.CallFrame):
|