chrome-devtools-frontend 1.0.1651641 → 1.0.1652307
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/front_end/generated/InspectorBackendCommands.ts +2 -2
- package/front_end/generated/SupportedCSSProperties.js +86 -6
- package/front_end/generated/protocol.ts +6 -7
- package/front_end/models/ai_assistance/AiAgent2.ts +3 -3
- package/front_end/models/ai_assistance/README.md +1 -1
- package/front_end/models/ai_assistance/tools/README.md +1 -1
- package/front_end/models/ai_assistance/tools/Tool.ts +1 -1
- package/front_end/models/ai_assistance/tools/ToolRegistry.ts +6 -6
- package/front_end/panels/sources/ScopeChainSidebarPane.ts +0 -12
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/package.json +1 -1
|
@@ -357,7 +357,7 @@ inspectorBackend.registerCommand("CrashReportContext.getEntries", [], ["entries"
|
|
|
357
357
|
inspectorBackend.registerType("CrashReportContext.CrashReportContextEntry", [{"name": "key", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "value", "type": "string", "optional": false, "description": "", "typeRef": null}, {"name": "frameId", "type": "string", "optional": false, "description": "The ID of the frame where the key-value pair was set.", "typeRef": "Page.FrameId"}]);
|
|
358
358
|
|
|
359
359
|
// DOM.
|
|
360
|
-
inspectorBackend.registerEnum("DOM.PseudoType", {FirstLine: "first-line", FirstLetter: "first-letter", Checkmark: "checkmark", Before: "before", After: "after", ExpandIcon: "expand-icon", PickerIcon: "picker-icon", InterestButton: "interest-button", Marker: "marker", Backdrop: "backdrop", Column: "column", Selection: "selection", SearchText: "search-text", TargetText: "target-text", SpellingError: "spelling-error", GrammarError: "grammar-error", Highlight: "highlight", FirstLineInherited: "first-line-inherited", ScrollMarker: "scroll-marker", ScrollMarkerGroup: "scroll-marker-group", ScrollButton: "scroll-button", Scrollbar: "scrollbar", ScrollbarThumb: "scrollbar-thumb", ScrollbarButton: "scrollbar-button", ScrollbarTrack: "scrollbar-track", ScrollbarTrackPiece: "scrollbar-track-piece", ScrollbarCorner: "scrollbar-corner", Resizer: "resizer", InputListButton: "input-list-button", ViewTransition: "view-transition", ViewTransitionGroup: "view-transition-group", ViewTransitionImagePair: "view-transition-image-pair", ViewTransitionGroupChildren: "view-transition-group-children", ViewTransitionOld: "view-transition-old", ViewTransitionNew: "view-transition-new", Placeholder: "placeholder", FileSelectorButton: "file-selector-button", DetailsContent: "details-content", Picker: "picker", PermissionIcon: "permission-icon", OverscrollAreaParent: "overscroll-area-parent", Skeleton: "skeleton"});
|
|
360
|
+
inspectorBackend.registerEnum("DOM.PseudoType", {FirstLine: "first-line", FirstLetter: "first-letter", Checkmark: "checkmark", Before: "before", After: "after", ExpandIcon: "expand-icon", PickerIcon: "picker-icon", InterestButton: "interest-button", Marker: "marker", Backdrop: "backdrop", Column: "column", Selection: "selection", SearchText: "search-text", TargetText: "target-text", SpellingError: "spelling-error", GrammarError: "grammar-error", Highlight: "highlight", FirstLineInherited: "first-line-inherited", ScrollMarker: "scroll-marker", ScrollMarkerGroup: "scroll-marker-group", ScrollButton: "scroll-button", Scrollbar: "scrollbar", ScrollbarThumb: "scrollbar-thumb", ScrollbarButton: "scrollbar-button", ScrollbarTrack: "scrollbar-track", ScrollbarTrackPiece: "scrollbar-track-piece", ScrollbarCorner: "scrollbar-corner", Resizer: "resizer", InputListButton: "input-list-button", ViewTransition: "view-transition", ViewTransitionGroup: "view-transition-group", ViewTransitionImagePair: "view-transition-image-pair", ViewTransitionGroupChildren: "view-transition-group-children", ViewTransitionOld: "view-transition-old", ViewTransitionNew: "view-transition-new", Placeholder: "placeholder", FileSelectorButton: "file-selector-button", DetailsContent: "details-content", Picker: "picker", SelectListbox: "select-listbox", PermissionIcon: "permission-icon", OverscrollAreaParent: "overscroll-area-parent", Skeleton: "skeleton"});
|
|
361
361
|
inspectorBackend.registerEnum("DOM.ShadowRootType", {UserAgent: "user-agent", Open: "open", Closed: "closed"});
|
|
362
362
|
inspectorBackend.registerEnum("DOM.CompatibilityMode", {QuirksMode: "QuirksMode", LimitedQuirksMode: "LimitedQuirksMode", NoQuirksMode: "NoQuirksMode"});
|
|
363
363
|
inspectorBackend.registerEnum("DOM.PhysicalAxes", {Horizontal: "Horizontal", Vertical: "Vertical", Both: "Both"});
|
|
@@ -1407,7 +1407,7 @@ inspectorBackend.registerCommand("Target.closeTarget", [{"name": "targetId", "ty
|
|
|
1407
1407
|
inspectorBackend.registerCommand("Target.exposeDevToolsProtocol", [{"name": "targetId", "type": "string", "optional": false, "description": "", "typeRef": "Target.TargetID"}, {"name": "bindingName", "type": "string", "optional": true, "description": "Binding name, 'cdp' if not specified.", "typeRef": null}, {"name": "inheritPermissions", "type": "boolean", "optional": true, "description": "If true, inherits the current root session's permissions (default: false).", "typeRef": null}], [], "Inject object to the target's main frame that provides a communication channel with browser target. Injected object will be available as `window[bindingName]`. The object has the following API: - `binding.send(json)` - a method to send messages over the remote debugging protocol - `binding.onmessage = json => handleMessage(json)` - a callback that will be called for the protocol notifications and command responses.");
|
|
1408
1408
|
inspectorBackend.registerCommand("Target.createBrowserContext", [{"name": "disposeOnDetach", "type": "boolean", "optional": true, "description": "If specified, disposes this context when debugging session disconnects.", "typeRef": null}, {"name": "proxyServer", "type": "string", "optional": true, "description": "Proxy server, similar to the one passed to --proxy-server", "typeRef": null}, {"name": "proxyBypassList", "type": "string", "optional": true, "description": "Proxy bypass list, similar to the one passed to --proxy-bypass-list", "typeRef": null}, {"name": "originsWithUniversalNetworkAccess", "type": "array", "optional": true, "description": "An optional list of origins to grant unlimited cross-origin access to. Parts of the URL other than those constituting origin are ignored.", "typeRef": "string"}], ["browserContextId"], "Creates a new empty BrowserContext. Similar to an incognito profile but you can have more than one.");
|
|
1409
1409
|
inspectorBackend.registerCommand("Target.getBrowserContexts", [], ["browserContextIds", "defaultBrowserContextId"], "Returns all browser contexts created with `Target.createBrowserContext` method.");
|
|
1410
|
-
inspectorBackend.registerCommand("Target.createTarget", [{"name": "url", "type": "string", "optional": false, "description": "The initial URL the page will be navigated to. An empty string indicates about:blank.", "typeRef": null}, {"name": "left", "type": "number", "optional": true, "description": "Frame left origin in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "top", "type": "number", "optional": true, "description": "Frame top origin in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "width", "type": "number", "optional": true, "description": "Frame width in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "height", "type": "number", "optional": true, "description": "Frame height in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "windowState", "type": "string", "optional": true, "description": "Frame window state (requires newWindow to be true or headless shell). Default is normal.", "typeRef": "Target.WindowState"}, {"name": "browserContextId", "type": "string", "optional": true, "description": "The browser context to create the page in.", "typeRef": "Browser.BrowserContextID"}, {"name": "enableBeginFrameControl", "type": "boolean", "optional": true, "description": "Whether BeginFrames for this target will be controlled via DevTools (headless shell only, not supported on MacOS yet, false by default).", "typeRef": null}, {"name": "newWindow", "type": "boolean", "optional": true, "description": "Whether to create a new Window or Tab (false by default, not supported by headless shell).", "typeRef": null}, {"name": "background", "type": "boolean", "optional": true, "description": "Whether to create the target in background or foreground (false by default, not supported by headless shell).", "typeRef": null}, {"name": "forTab", "type": "boolean", "optional": true, "description": "Whether to create the target of type \\\"tab\\\".", "typeRef": null}, {"name": "hidden", "type": "boolean", "optional": true, "description": "Whether to create a hidden target. The hidden target is observable via protocol, but not present in the tab UI strip. Cannot be created with `forTab: true`, `newWindow: true` or `background: false`. The life-time of the tab is limited to the life-time of the session.", "typeRef": null}, {"name": "focus", "type": "boolean", "optional": true, "description": "If specified,
|
|
1410
|
+
inspectorBackend.registerCommand("Target.createTarget", [{"name": "url", "type": "string", "optional": false, "description": "The initial URL the page will be navigated to. An empty string indicates about:blank.", "typeRef": null}, {"name": "left", "type": "number", "optional": true, "description": "Frame left origin in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "top", "type": "number", "optional": true, "description": "Frame top origin in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "width", "type": "number", "optional": true, "description": "Frame width in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "height", "type": "number", "optional": true, "description": "Frame height in DIP (requires newWindow to be true or headless shell).", "typeRef": null}, {"name": "windowState", "type": "string", "optional": true, "description": "Frame window state (requires newWindow to be true or headless shell). Default is normal.", "typeRef": "Target.WindowState"}, {"name": "browserContextId", "type": "string", "optional": true, "description": "The browser context to create the page in.", "typeRef": "Browser.BrowserContextID"}, {"name": "enableBeginFrameControl", "type": "boolean", "optional": true, "description": "Whether BeginFrames for this target will be controlled via DevTools (headless shell only, not supported on MacOS yet, false by default).", "typeRef": null}, {"name": "newWindow", "type": "boolean", "optional": true, "description": "Whether to create a new Window or Tab (false by default, not supported by headless shell).", "typeRef": null}, {"name": "background", "type": "boolean", "optional": true, "description": "Whether to create the target in background or foreground (false by default, not supported by headless shell).", "typeRef": null}, {"name": "forTab", "type": "boolean", "optional": true, "description": "Whether to create the target of type \\\"tab\\\".", "typeRef": null}, {"name": "hidden", "type": "boolean", "optional": true, "description": "Whether to create a hidden target. The hidden target is observable via protocol, but not present in the tab UI strip. Cannot be created with `forTab: true`, `newWindow: true` or `background: false`. The life-time of the tab is limited to the life-time of the session.", "typeRef": null}, {"name": "focus", "type": "boolean", "optional": true, "description": "If specified, determines whether the new target should be focused. By default, the focus behavior depends on the `background` parameter: - If `background` is false (default) and `focus` is omitted, the new target is focused and the browser window is brought to the foreground. - If `background` is false and `focus` is false, the target is opened but the browser window's focus remains unchanged (e.g., if the window was in the background, it stays there). - If `background` is true, setting `focus` to true is not supported and will result in an error.", "typeRef": null}], ["targetId"], "Creates a new page.");
|
|
1411
1411
|
inspectorBackend.registerCommand("Target.detachFromTarget", [{"name": "sessionId", "type": "string", "optional": true, "description": "Session to detach.", "typeRef": "Target.SessionID"}, {"name": "targetId", "type": "string", "optional": true, "description": "Deprecated.", "typeRef": "Target.TargetID"}], [], "Detaches session with given id.");
|
|
1412
1412
|
inspectorBackend.registerCommand("Target.disposeBrowserContext", [{"name": "browserContextId", "type": "string", "optional": false, "description": "", "typeRef": "Browser.BrowserContextID"}], [], "Deletes a BrowserContext. All the belonging pages will be closed without calling their beforeunload hooks.");
|
|
1413
1413
|
inspectorBackend.registerCommand("Target.getTargetInfo", [{"name": "targetId", "type": "string", "optional": true, "description": "", "typeRef": "Target.TargetID"}], ["targetInfo"], "Returns information about a target.");
|
|
@@ -216,6 +216,10 @@ export const generatedProperties = [
|
|
|
216
216
|
},
|
|
217
217
|
{
|
|
218
218
|
"inherited": true,
|
|
219
|
+
"keywords": [
|
|
220
|
+
"before",
|
|
221
|
+
"after"
|
|
222
|
+
],
|
|
219
223
|
"name": "-webkit-ruby-position"
|
|
220
224
|
},
|
|
221
225
|
{
|
|
@@ -2150,8 +2154,7 @@ export const generatedProperties = [
|
|
|
2150
2154
|
"layout",
|
|
2151
2155
|
"style",
|
|
2152
2156
|
"paint",
|
|
2153
|
-
"inline-size"
|
|
2154
|
-
"block-size"
|
|
2157
|
+
"inline-size"
|
|
2155
2158
|
],
|
|
2156
2159
|
"name": "contain"
|
|
2157
2160
|
},
|
|
@@ -4433,7 +4436,43 @@ export const generatedProperties = [
|
|
|
4433
4436
|
"end",
|
|
4434
4437
|
"self-start",
|
|
4435
4438
|
"self-end",
|
|
4436
|
-
"all"
|
|
4439
|
+
"span-all",
|
|
4440
|
+
"span-left",
|
|
4441
|
+
"span-right",
|
|
4442
|
+
"span-x-start",
|
|
4443
|
+
"span-x-end",
|
|
4444
|
+
"self-x-start",
|
|
4445
|
+
"self-x-end",
|
|
4446
|
+
"span-self-x-start",
|
|
4447
|
+
"span-self-x-end",
|
|
4448
|
+
"span-top",
|
|
4449
|
+
"span-bottom",
|
|
4450
|
+
"span-y-start",
|
|
4451
|
+
"span-y-end",
|
|
4452
|
+
"self-y-start",
|
|
4453
|
+
"self-y-end",
|
|
4454
|
+
"span-self-y-start",
|
|
4455
|
+
"span-self-y-end",
|
|
4456
|
+
"block-start",
|
|
4457
|
+
"block-end",
|
|
4458
|
+
"span-block-start",
|
|
4459
|
+
"span-block-end",
|
|
4460
|
+
"inline-start",
|
|
4461
|
+
"inline-end",
|
|
4462
|
+
"span-inline-start",
|
|
4463
|
+
"span-inline-end",
|
|
4464
|
+
"self-block-start",
|
|
4465
|
+
"self-block-end",
|
|
4466
|
+
"span-self-block-start",
|
|
4467
|
+
"span-self-block-end",
|
|
4468
|
+
"self-inline-start",
|
|
4469
|
+
"self-inline-end",
|
|
4470
|
+
"span-self-inline-start",
|
|
4471
|
+
"span-self-inline-end",
|
|
4472
|
+
"span-start",
|
|
4473
|
+
"span-end",
|
|
4474
|
+
"span-self-start",
|
|
4475
|
+
"span-self-end"
|
|
4437
4476
|
],
|
|
4438
4477
|
"name": "position-area"
|
|
4439
4478
|
},
|
|
@@ -6083,6 +6122,12 @@ export const generatedPropertyValues = {
|
|
|
6083
6122
|
"visual"
|
|
6084
6123
|
]
|
|
6085
6124
|
},
|
|
6125
|
+
"-webkit-ruby-position": {
|
|
6126
|
+
"values": [
|
|
6127
|
+
"before",
|
|
6128
|
+
"after"
|
|
6129
|
+
]
|
|
6130
|
+
},
|
|
6086
6131
|
"-webkit-text-combine": {
|
|
6087
6132
|
"values": [
|
|
6088
6133
|
"none",
|
|
@@ -6912,8 +6957,7 @@ export const generatedPropertyValues = {
|
|
|
6912
6957
|
"layout",
|
|
6913
6958
|
"style",
|
|
6914
6959
|
"paint",
|
|
6915
|
-
"inline-size"
|
|
6916
|
-
"block-size"
|
|
6960
|
+
"inline-size"
|
|
6917
6961
|
]
|
|
6918
6962
|
},
|
|
6919
6963
|
"contain-intrinsic-block-size": {
|
|
@@ -8224,7 +8268,43 @@ export const generatedPropertyValues = {
|
|
|
8224
8268
|
"end",
|
|
8225
8269
|
"self-start",
|
|
8226
8270
|
"self-end",
|
|
8227
|
-
"all"
|
|
8271
|
+
"span-all",
|
|
8272
|
+
"span-left",
|
|
8273
|
+
"span-right",
|
|
8274
|
+
"span-x-start",
|
|
8275
|
+
"span-x-end",
|
|
8276
|
+
"self-x-start",
|
|
8277
|
+
"self-x-end",
|
|
8278
|
+
"span-self-x-start",
|
|
8279
|
+
"span-self-x-end",
|
|
8280
|
+
"span-top",
|
|
8281
|
+
"span-bottom",
|
|
8282
|
+
"span-y-start",
|
|
8283
|
+
"span-y-end",
|
|
8284
|
+
"self-y-start",
|
|
8285
|
+
"self-y-end",
|
|
8286
|
+
"span-self-y-start",
|
|
8287
|
+
"span-self-y-end",
|
|
8288
|
+
"block-start",
|
|
8289
|
+
"block-end",
|
|
8290
|
+
"span-block-start",
|
|
8291
|
+
"span-block-end",
|
|
8292
|
+
"inline-start",
|
|
8293
|
+
"inline-end",
|
|
8294
|
+
"span-inline-start",
|
|
8295
|
+
"span-inline-end",
|
|
8296
|
+
"self-block-start",
|
|
8297
|
+
"self-block-end",
|
|
8298
|
+
"span-self-block-start",
|
|
8299
|
+
"span-self-block-end",
|
|
8300
|
+
"self-inline-start",
|
|
8301
|
+
"self-inline-end",
|
|
8302
|
+
"span-self-inline-start",
|
|
8303
|
+
"span-self-inline-end",
|
|
8304
|
+
"span-start",
|
|
8305
|
+
"span-end",
|
|
8306
|
+
"span-self-start",
|
|
8307
|
+
"span-self-end"
|
|
8228
8308
|
]
|
|
8229
8309
|
},
|
|
8230
8310
|
"position-try-fallbacks": {
|
|
@@ -4804,6 +4804,7 @@ export namespace DOM {
|
|
|
4804
4804
|
FileSelectorButton = 'file-selector-button',
|
|
4805
4805
|
DetailsContent = 'details-content',
|
|
4806
4806
|
Picker = 'picker',
|
|
4807
|
+
SelectListbox = 'select-listbox',
|
|
4807
4808
|
PermissionIcon = 'permission-icon',
|
|
4808
4809
|
OverscrollAreaParent = 'overscroll-area-parent',
|
|
4809
4810
|
Skeleton = 'skeleton',
|
|
@@ -19491,13 +19492,11 @@ export namespace Target {
|
|
|
19491
19492
|
*/
|
|
19492
19493
|
hidden?: boolean;
|
|
19493
19494
|
/**
|
|
19494
|
-
* If specified,
|
|
19495
|
-
*
|
|
19496
|
-
*
|
|
19497
|
-
*
|
|
19498
|
-
*
|
|
19499
|
-
* and background=false with focus=undefined will result in the window being focused.
|
|
19500
|
-
* Using background: true and focus: true is not supported and will result in an error.
|
|
19495
|
+
* If specified, determines whether the new target should be focused.
|
|
19496
|
+
* By default, the focus behavior depends on the `background` parameter:
|
|
19497
|
+
* - If `background` is false (default) and `focus` is omitted, the new target is focused and the browser window is brought to the foreground.
|
|
19498
|
+
* - If `background` is false and `focus` is false, the target is opened but the browser window's focus remains unchanged (e.g., if the window was in the background, it stays there).
|
|
19499
|
+
* - If `background` is true, setting `focus` to true is not supported and will result in an error.
|
|
19501
19500
|
*/
|
|
19502
19501
|
focus?: boolean;
|
|
19503
19502
|
}
|
|
@@ -22,7 +22,7 @@ import {debugLog} from './debug.js';
|
|
|
22
22
|
import {ExtensionScope} from './ExtensionScope.js';
|
|
23
23
|
import type {Skill, SkillName} from './skills/Skill.js';
|
|
24
24
|
import {SKILLS} from './skills/SkillRegistry.js';
|
|
25
|
-
import type {
|
|
25
|
+
import type {AllToolsCapabilities, Tool, ToolArgs} from './tools/Tool.js';
|
|
26
26
|
import {ToolRegistry} from './tools/ToolRegistry.js';
|
|
27
27
|
|
|
28
28
|
const SKILL_DISPLAY_NAMES: Record<SkillName, string> = {
|
|
@@ -214,7 +214,7 @@ User query: ${enhancedQuery}`;
|
|
|
214
214
|
* Declares a tool to be available to the agent model, verifying first that
|
|
215
215
|
* it hasn't already been declared to prevent duplicate declaration errors.
|
|
216
216
|
*/
|
|
217
|
-
#declareTool(tool: Tool<ToolArgs, unknown,
|
|
217
|
+
#declareTool(tool: Tool<ToolArgs, unknown, AllToolsCapabilities>): void {
|
|
218
218
|
if (this.#declaredTools.has(tool.name)) {
|
|
219
219
|
debugLog(`AiAgent2: Tool ${tool.name} is already declared`);
|
|
220
220
|
return;
|
|
@@ -225,7 +225,7 @@ User query: ${enhancedQuery}`;
|
|
|
225
225
|
parameters: tool.parameters,
|
|
226
226
|
displayInfoFromArgs: tool.displayInfoFromArgs,
|
|
227
227
|
handler: (args, options) => {
|
|
228
|
-
const context:
|
|
228
|
+
const context: AllToolsCapabilities = {
|
|
229
229
|
conversationContext: this.context ?? null,
|
|
230
230
|
changeManager: this.#changes,
|
|
231
231
|
createExtensionScope: this.#createExtensionScope.bind(this),
|
|
@@ -46,7 +46,7 @@ To support skills requiring execution of code or fetching page state (like compu
|
|
|
46
46
|
|
|
47
47
|
- **BaseTool**: A non-generic base interface capturing tool metadata (`name`, `description`, `parameters`). This acts as the type-erased representation for generic registry storage and fallback string lookups.
|
|
48
48
|
- **Tool**: A generic interface parameterized by `<Args, ReturnType, ContextType>` that binds parameter argument types and handler execution to strict contracts. `ContextType` defaults to `BaseToolCapability`, ensuring that each tool explicitly requests only the dependencies it requires.
|
|
49
|
-
- **Capability Contexts**: Instead of passing a monolithic grab-bag context to all tools, dependencies are broken into narrow capability interfaces (e.g. `PageExecutionCapability`, `StyleMutationCapability`, `TargetCapability`, `OriginLockCapability`). Tools declare their required dependencies by intersecting these interfaces on their generic `ContextType` definition. The caller/Agent fulfills the complete capability context (`
|
|
49
|
+
- **Capability Contexts**: Instead of passing a monolithic grab-bag context to all tools, dependencies are broken into narrow capability interfaces (e.g. `PageExecutionCapability`, `StyleMutationCapability`, `TargetCapability`, `OriginLockCapability`). Tools declare their required dependencies by intersecting these interfaces on their generic `ContextType` definition. The caller/Agent fulfills the complete capability context (`AllToolsCapabilities`), guaranteeing 100% compile-time type safety for dependencies without runtime checks.
|
|
50
50
|
- **ToolRegistry**: A static registry (`ToolRegistry`) storing instantiated tools. It uses TypeScript function overloading and generic lookups (`static get<K extends keyof typeof TOOLS>(name: K): typeof TOOLS[K]`) to return the precise class type of each tool, preventing type-erasure and escape-hatches (such as `any` or `as unknown` type assertions) at integration points like `AiAgent2.ts`. See the [Tools README](tools/README.md) for authoring instructions.
|
|
51
51
|
|
|
52
52
|
## Performance specific documentation
|
|
@@ -21,7 +21,7 @@ Instead of passing a monolithic "grab-bag" context object to all tool handlers,
|
|
|
21
21
|
|
|
22
22
|
### Unified Context
|
|
23
23
|
|
|
24
|
-
The Agent (e.g., `AiAgent2`) builds the complete dependency union (`
|
|
24
|
+
The Agent (e.g., `AiAgent2`) builds the complete dependency union (`AllToolsCapabilities`) and fulfills all capabilities. When the handler is invoked, TypeScript validates that the provided context matches the intersection of capabilities requested by that tool.
|
|
25
25
|
|
|
26
26
|
## Authoring a New Tool
|
|
27
27
|
|
|
@@ -84,7 +84,7 @@ export interface LighthouseCapability {
|
|
|
84
84
|
* Unified context interface providing all capabilities available in the project.
|
|
85
85
|
* Used by the agent to pass a complete context to any tool type-safely.
|
|
86
86
|
*/
|
|
87
|
-
export type
|
|
87
|
+
export type AllToolsCapabilities = BaseToolCapability&PageExecutionCapability&StyleMutationCapability&TargetCapability&
|
|
88
88
|
OriginLockCapability&LighthouseCapability;
|
|
89
89
|
|
|
90
90
|
/**
|
|
@@ -8,7 +8,7 @@ import {GetNetworkRequestDetailsTool} from './GetNetworkRequestDetails.js';
|
|
|
8
8
|
import {GetStylesTool} from './GetStyles.js';
|
|
9
9
|
import {ListNetworkRequestsTool} from './ListNetworkRequests.js';
|
|
10
10
|
import {ResolveLighthousePathTool} from './ResolveLighthousePath.js';
|
|
11
|
-
import {type
|
|
11
|
+
import {type AllToolsCapabilities, type Tool, type ToolArgs, ToolName} from './Tool.js';
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
14
|
* Plain object registry containing concrete instantiated tools.
|
|
@@ -45,16 +45,16 @@ export class ToolRegistry {
|
|
|
45
45
|
* @param name The string name of the tool to retrieve, used when the tool name is only known at runtime.
|
|
46
46
|
* @returns The generic Tool interface, or undefined if not found.
|
|
47
47
|
*/
|
|
48
|
-
static get(name: string): Tool<ToolArgs, unknown,
|
|
49
|
-
static get(name: string): Tool<ToolArgs, unknown,
|
|
48
|
+
static get(name: string): Tool<ToolArgs, unknown, AllToolsCapabilities>|undefined;
|
|
49
|
+
static get(name: string): Tool<ToolArgs, unknown, AllToolsCapabilities>|undefined {
|
|
50
50
|
// We use a double assertion (`as unknown as Tool<...>`) here. TypeScript's variance
|
|
51
51
|
// rules prevent direct casting from specific concrete tools (which have narrowed,
|
|
52
|
-
// capability-specific contexts) to the generic `Tool` signature that uses `
|
|
52
|
+
// capability-specific contexts) to the generic `Tool` signature that uses `AllToolsCapabilities`.
|
|
53
53
|
// This cast is runtime-safe because any capability requested by a specific tool is
|
|
54
|
-
// guaranteed to be satisfied by `
|
|
54
|
+
// guaranteed to be satisfied by `AllToolsCapabilities`, and the handler will only access
|
|
55
55
|
// the capabilities it expects.
|
|
56
56
|
return Object.prototype.hasOwnProperty.call(TOOLS, name) ?
|
|
57
|
-
TOOLS[name as keyof typeof TOOLS] as unknown as Tool<ToolArgs, unknown,
|
|
57
|
+
TOOLS[name as keyof typeof TOOLS] as unknown as Tool<ToolArgs, unknown, AllToolsCapabilities>:
|
|
58
58
|
undefined;
|
|
59
59
|
}
|
|
60
60
|
}
|
|
@@ -191,18 +191,6 @@ export class ScopeChainSidebarPane extends UI.Widget.VBox implements UI.ContextF
|
|
|
191
191
|
return scopeChainSidebarPaneInstance;
|
|
192
192
|
}
|
|
193
193
|
|
|
194
|
-
/**
|
|
195
|
-
* @deprecated Required for legacy web tests via DebuggerTestRunner.js
|
|
196
|
-
*/
|
|
197
|
-
get treeOutline(): ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeOutline|null {
|
|
198
|
-
const devtoolsTree = this.contentElement.querySelector('devtools-tree');
|
|
199
|
-
if (devtoolsTree) {
|
|
200
|
-
return (devtoolsTree as UI.TreeOutline.TreeViewElement).getInternalTreeOutlineForTest() as
|
|
201
|
-
ObjectUI.ObjectPropertiesSection.ObjectPropertiesSectionsTreeOutline;
|
|
202
|
-
}
|
|
203
|
-
return null;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
194
|
flavorChanged(callFrame: StackTrace.StackTrace.DebuggableFrameFlavor|null): void {
|
|
207
195
|
this.#scopeChainModel?.dispose();
|
|
208
196
|
this.#scopeChainModel = null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
Name: Dependencies sourced from the upstream `chromium` repository
|
|
2
2
|
URL: Internal
|
|
3
3
|
Version: N/A
|
|
4
|
-
Revision:
|
|
4
|
+
Revision: 6582413b9079ea54aca3360b183c9206bc30ce81
|
|
5
5
|
Update Mechanism: Manual (https://crbug.com/428069060)
|
|
6
6
|
License: BSD-3-Clause
|
|
7
7
|
License File: LICENSE
|
package/package.json
CHANGED