chrome-devtools-frontend 1.0.1739869 → 1.0.1742811
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/rules/ui-and-widgets/ui-accessibility-and-semantic-html.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-css-scoping-and-flex-layout.md +44 -7
- package/.agents/rules/ui-and-widgets/ui-lit-declarative-templates-and-directives.md +1 -1
- package/.agents/rules/ui-and-widgets/ui-view-output-and-callback-contracts.md +2 -2
- package/.agents/rules/ui-and-widgets/ui-widget-dom-and-listener-lifecycle.md +1 -1
- package/.agents/skills/code-review/SKILL.md +23 -6
- package/.agents/skills/devtools-verification/SKILL.md +2 -1
- package/.agents/skills/migrate-chromium-test/SKILL.md +1 -0
- package/.agents/skills/ui-eng-vision-local-lit-renderer/SKILL.md +27 -11
- package/.agents/skills/ui-eng-vision-orchestrator/SKILL.md +41 -23
- package/.agents/skills/ui-eng-vision-test-scaffolder/SKILL.md +12 -7
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +3 -0
- package/.agents/skills/ui-widgets/SKILL.md +22 -7
- package/.agents/skills/version-control/SKILL.md +10 -1
- package/.agents/skills/visual-regression-audit/SKILL.md +88 -0
- package/.gitallowed +2 -1
- package/.stylelintignore +1 -0
- package/.stylelintrc.json +2 -0
- package/AUTHORS +1 -0
- package/DIR_METADATA +2 -1
- package/PRESUBMIT_test.py +143 -0
- package/config/owner/INFRA_OWNERS +0 -1
- package/docs/contributing/infrastructure.md +2 -2
- package/docs/ui_engineering.md +14 -4
- package/eslint.config.mjs +1 -18
- package/front_end/application_tokens.css +0 -35
- package/front_end/core/host/AidaClient.ts +1 -1
- package/front_end/core/host/AidaClientTypes.ts +2 -0
- package/front_end/core/host/AidaErrors.ts +3 -3
- package/front_end/core/host/AidaGcaTranslation.ts +39 -0
- package/front_end/core/host/GcaClient.ts +32 -20
- package/front_end/core/host/GcaTypes.ts +4 -2
- package/front_end/core/host/InspectorFrontendHostAPI.ts +2 -0
- package/front_end/core/i18n/DevToolsLocale.ts +0 -1
- package/front_end/core/sdk/DebuggerModel.ts +25 -13
- package/front_end/core/sdk/PreloadingModel.ts +2 -2
- package/front_end/core/sdk/RehydratingConnection.ts +59 -30
- package/front_end/core/sdk/StorageKeyManager.ts +0 -1
- package/front_end/core/sdk/Target.ts +6 -0
- package/front_end/core/sdk/TargetManager.ts +10 -4
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshot.ts +12 -2
- package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +159 -52
- package/front_end/entrypoints/inspector_main/outermostTargetSelector.css +77 -25
- package/front_end/entrypoints/main/MainImpl.ts +32 -15
- package/front_end/models/ai_assistance/AiAgent2.ts +95 -46
- package/front_end/models/ai_assistance/AiConversation.ts +1 -1
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
- package/front_end/models/ai_assistance/agents/ExecuteJavascript.ts +3 -2
- package/front_end/models/ai_assistance/agents/StylingAgent.snapshot.txt +1 -1
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +5 -4
- package/front_end/models/ai_assistance/performance/AICallTree.ts +7 -9
- package/front_end/models/ai_assistance/performance/AIQueries.ts +4 -8
- package/front_end/models/ai_assistance/skills/SkillRegistry.ts +11 -1
- package/front_end/models/ai_assistance/skills/lighthouse.md +1 -0
- package/front_end/models/ai_assistance/skills/network.md +3 -4
- package/front_end/models/ai_assistance/skills/sources.md +1 -2
- package/front_end/models/ai_assistance/skills/styling.md +3 -4
- package/front_end/models/ai_assistance/tools/ExecuteJavaScript.ts +11 -3
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +84 -23
- package/front_end/models/ai_assistance/tools/ListSources.ts +41 -13
- package/front_end/models/badges/Badge.ts +0 -1
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
- package/front_end/models/breakpoints/BreakpointManager.ts +2 -4
- package/front_end/models/breakpoints/RecurringPauseDetector.ts +140 -0
- package/front_end/models/breakpoints/breakpoints.ts +2 -1
- package/front_end/models/heap_snapshot/HeapSnapshotModel.ts +2 -2
- package/front_end/models/persistence/Automapping.ts +0 -1
- package/front_end/models/trace/Processor.ts +16 -7
- package/front_end/models/trace/README.md +17 -1
- package/front_end/models/trace/extras/ThirdParties.ts +4 -6
- package/front_end/models/trace/extras/TraceTree.ts +69 -72
- package/front_end/models/trace/handlers/MetaHandler.ts +3 -0
- package/front_end/models/trace/handlers/types.ts +15 -0
- package/front_end/models/trace/helpers/Trace.ts +5 -3
- package/front_end/models/trace/lantern/simulation/Simulator.ts +4 -1
- package/front_end/models/web_mcp/WebMCPModel.ts +19 -9
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +30 -3
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +2 -4
- package/front_end/panels/ai_assistance/components/chatMessage.css +1 -22
- package/front_end/panels/ai_assistance/components/exploreWidget.css +1 -19
- package/front_end/panels/ai_assistance/components/optInChangeDialog.css +1 -1
- package/front_end/panels/ai_assistance/components/walkthroughView.css +0 -13
- package/front_end/panels/animation/AnimationGroupPreviewUI.ts +3 -2
- package/front_end/panels/animation/AnimationTimeline.ts +5 -3
- package/front_end/panels/animation/animationTimeline.css +10 -8
- package/front_end/panels/application/ApplicationPanelSidebar.ts +14 -11
- package/front_end/panels/application/ReportingApiView.ts +0 -1
- package/front_end/panels/application/SubAppsView.ts +0 -1
- package/front_end/panels/application/WebMCPTreeElement.ts +3 -6
- package/front_end/panels/application/WebMCPView.ts +30 -0
- package/front_end/panels/application/components/ReportsGrid.ts +0 -1
- package/front_end/panels/application/components/backForwardCacheView.css +0 -7
- package/front_end/panels/application/components/permissionsPolicySection.css +2 -2
- package/front_end/panels/application/components/protocolHandlersView.css +46 -39
- package/front_end/panels/application/components/trustTokensView.css +0 -4
- package/front_end/panels/application/cookieItemsView.css +0 -7
- package/front_end/panels/application/indexedDBViews.css +0 -6
- package/front_end/panels/application/preloading/components/PreloadingDetailsReportView.ts +0 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +0 -1
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -5
- package/front_end/panels/application/preloading/components/preloadingGrid.css +0 -9
- package/front_end/panels/application/serviceWorkerUpdateCycleView.css +2 -9
- package/front_end/panels/application/serviceWorkersView.css +5 -4
- package/front_end/panels/application/storageView.css +0 -5
- package/front_end/panels/application/webMCPView.css +17 -0
- package/front_end/panels/browser_debugger/ObjectEventListenersSidebarPane.ts +15 -20
- package/front_end/panels/changes/changesView.css +0 -5
- package/front_end/panels/common/ExtensionServer.ts +80 -10
- package/front_end/panels/console/ConsolePanel.ts +92 -18
- package/front_end/panels/console/consoleContextSelector.css +1 -8
- package/front_end/panels/console/consoleInsightTeaser.css +10 -17
- package/front_end/panels/console/consolePinPane.css +3 -1
- package/front_end/panels/console/consoleView.css +13 -17
- package/front_end/panels/coverage/coverageListView.css +0 -4
- package/front_end/panels/css_overview/cssOverviewCompletedView.css +0 -22
- package/front_end/panels/css_overview/cssOverviewStartView.css +0 -43
- package/front_end/panels/developer_resources/developerResourcesListView.css +0 -4
- package/front_end/panels/elements/ColorSwatchPopoverIcon.ts +52 -45
- package/front_end/panels/elements/LayoutPane.ts +1 -3
- package/front_end/panels/elements/PropertiesWidget.ts +26 -8
- package/front_end/panels/elements/PropertyRenderer.ts +45 -21
- package/front_end/panels/elements/StandaloneStylesContainer.ts +6 -7
- package/front_end/panels/elements/StyleEditorWidget.ts +110 -63
- package/front_end/panels/elements/StylePropertiesSection.ts +14 -5
- package/front_end/panels/elements/StylePropertyTreeElement.ts +529 -518
- package/front_end/panels/elements/StylesContainer.ts +5 -6
- package/front_end/panels/elements/StylesSidebarPane.ts +12 -15
- package/front_end/panels/elements/components/CSSVariableValueView.ts +17 -4
- package/front_end/panels/elements/components/StylePropertyEditor.ts +178 -140
- package/front_end/panels/elements/components/cssQuery.css +1 -1
- package/front_end/panels/elements/components/stylePropertyEditor.css +60 -56
- package/front_end/panels/elements/layoutPane.css +2 -2
- package/front_end/panels/elements/metricsSidebarPane.css +6 -7
- package/front_end/panels/elements/platformFontsWidget.css +1 -1
- package/front_end/panels/elements/stylePropertiesTreeOutline.css +1 -6
- package/front_end/panels/elements/stylesSidebarPane.css +3 -4
- package/front_end/panels/emulation/deviceModeView.css +1 -1
- package/front_end/panels/event_listeners/EventListenersView.ts +9 -2
- package/front_end/panels/event_listeners/eventListenersView.css +1 -1
- package/front_end/panels/explain/components/consoleInsight.css +1 -2
- package/front_end/panels/issues/issuesTree.css +6 -43
- package/front_end/panels/layer_viewer/PaintProfilerView.ts +1 -1
- package/front_end/panels/layer_viewer/paintProfiler.css +4 -3
- package/front_end/panels/lighthouse/LighthouseReportSelector.ts +1 -6
- package/front_end/panels/lighthouse/lighthouseStartView.css +5 -16
- package/front_end/panels/linear_memory_inspector/components/LinearMemoryValueInterpreter.ts +0 -1
- package/front_end/panels/linear_memory_inspector/components/linearMemoryHighlightChipList.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/linearMemoryViewer.css +2 -2
- package/front_end/panels/linear_memory_inspector/components/valueInterpreterSettings.css +1 -1
- package/front_end/panels/media/playerListView.css +1 -2
- package/front_end/panels/media/playerPropertiesView.css +1 -1
- package/front_end/panels/mobile_throttling/throttlingSettingsTab.css +2 -2
- package/front_end/panels/network/NetworkLogView.ts +594 -580
- package/front_end/panels/network/RequestCookiesView.ts +0 -1
- package/front_end/panels/network/networkConfigView.css +1 -2
- package/front_end/panels/network/networkLogView.css +363 -364
- package/front_end/panels/network/networkPanel.css +1 -5
- package/front_end/panels/network/networkTimingTable.css +1 -1
- package/front_end/panels/network/networkWaterfallColumn.css +1 -1
- package/front_end/panels/network/requestConditionsDrawer.css +0 -4
- package/front_end/panels/network/requestCookiesView.css +7 -1
- package/front_end/panels/network/requestPayloadTree.css +0 -4
- package/front_end/panels/profiler/HeapProfileView.ts +1 -3
- package/front_end/panels/profiler/HeapSnapshotView.ts +0 -7
- package/front_end/panels/recorder/RecorderPanel.ts +1 -1
- package/front_end/panels/recorder/RecordingView.ts +10 -10
- package/front_end/panels/recorder/StepView.ts +5 -4
- package/front_end/panels/recorder/createRecordingView.css +1 -1
- package/front_end/panels/recorder/recorderPanel.css +0 -8
- package/front_end/panels/recorder/recordingListView.css +4 -4
- package/front_end/panels/recorder/recordingView.css +12 -20
- package/front_end/panels/recorder/stepEditor.css +4 -4
- package/front_end/panels/recorder/stepView.css +31 -9
- package/front_end/panels/recorder/timelineSection.css +4 -0
- package/front_end/panels/screencast/ScreencastApp.ts +0 -1
- package/front_end/panels/security/mainView.css +1 -1
- package/front_end/panels/security/originView.css +2 -2
- package/front_end/panels/sensors/SensorsView.ts +273 -346
- package/front_end/panels/settings/BackendLinkingSettingsTab.ts +0 -1
- package/front_end/panels/settings/backendLinkingSettingsTab.css +7 -7
- package/front_end/panels/settings/components/syncSection.css +0 -1
- package/front_end/panels/settings/workspaceSettingsTab.css +0 -5
- package/front_end/panels/sources/CSSPlugin.ts +177 -98
- package/front_end/panels/sources/DebuggerPausedMessage.ts +100 -27
- package/front_end/panels/sources/NavigatorView.ts +926 -946
- package/front_end/panels/sources/SourcesPanel.ts +9 -2
- package/front_end/panels/sources/breakpointsView.css +6 -29
- package/front_end/panels/sources/components/HeadersView.css +2 -2
- package/front_end/panels/sources/debuggerPausedMessage.css +7 -0
- package/front_end/panels/sources/navigatorTree.css +7 -2
- package/front_end/panels/sources/sourcesNavigator.css +0 -9
- package/front_end/panels/sources/watchExpressionsSidebarPane.css +0 -10
- package/front_end/panels/timeline/CompatibilityTracksAppender.ts +3 -0
- package/front_end/panels/timeline/LayoutShiftsTrackAppender.ts +0 -10
- package/front_end/panels/timeline/ModificationsManager.ts +0 -1
- package/front_end/panels/timeline/ThreadAppender.ts +2 -6
- package/front_end/panels/timeline/TimelinePanel.ts +2 -2
- package/front_end/panels/timeline/TimelineTreeView.ts +38 -41
- package/front_end/panels/timeline/TimelineUIUtils.ts +8 -10
- package/front_end/panels/timeline/components/LayoutShiftDetails.ts +0 -2
- package/front_end/panels/timeline/components/fieldSettingsDialog.css +1 -6
- package/front_end/panels/timeline/components/insights/baseInsightComponent.css +0 -12
- package/front_end/panels/timeline/components/interactionBreakdown.css +1 -2
- package/front_end/panels/timeline/components/layoutShiftDetails.css +2 -9
- package/front_end/panels/timeline/components/liveMetricsView.css +0 -16
- package/front_end/panels/timeline/components/metricCard.css +1 -5
- package/front_end/panels/timeline/components/networkRequestDetails.css +3 -4
- package/front_end/panels/timeline/components/networkRequestTooltip.css +6 -4
- package/front_end/panels/timeline/components/sidebarAnnotationsTab.css +1 -1
- package/front_end/panels/timeline/components/sidebarInsightsTab.css +1 -2
- package/front_end/panels/timeline/timelineDetailsView.css +1 -12
- package/front_end/panels/timeline/timelineFlamechartPopover.css +0 -4
- package/front_end/panels/timeline/timelineMiniMap.css +1 -4
- package/front_end/panels/timeline/timelinePanel.css +0 -4
- package/front_end/panels/timeline/timelineStatusDialog.css +1 -1
- package/front_end/panels/timeline/timelineTreeView.css +0 -12
- package/front_end/panels/timeline/utils/EntryNodes.ts +1 -1
- package/front_end/panels/webauthn/webauthnPane.css +1 -7
- package/front_end/panels/whats_new/ReleaseNoteText.ts +1 -1
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/ui/components/adorners/adorner.css +1 -1
- package/front_end/ui/components/buttons/button.css +0 -28
- package/front_end/ui/components/buttons/textButton.css +1 -45
- package/front_end/ui/components/input/checkbox.css +3 -3
- package/front_end/ui/components/issue_counter/issueLinkIcon.css +2 -2
- package/front_end/ui/components/menus/Menu.ts +14 -0
- package/front_end/ui/components/menus/menu.css +2 -14
- package/front_end/ui/components/menus/menuItem.css +0 -4
- package/front_end/ui/components/request_link_icon/requestLinkIcon.css +2 -2
- package/front_end/ui/components/survey_link/SurveyLink.ts +1 -1
- package/front_end/ui/components/survey_link/surveyLink.css +3 -3
- package/front_end/ui/components/switch/switch.css +3 -2
- package/front_end/ui/components/text_editor/theme.ts +1 -1
- package/front_end/ui/components/tooltips/Tooltip.ts +3 -3
- package/front_end/ui/components/tree_outline/treeOutline.css +0 -23
- package/front_end/ui/legacy/ContextMenu.ts +5 -5
- package/front_end/ui/legacy/SoftContextMenu.ts +24 -8
- package/front_end/ui/legacy/Toolbar.ts +1 -1
- package/front_end/ui/legacy/Treeoutline.ts +31 -78
- package/front_end/ui/legacy/UIUtils.ts +9 -17
- package/front_end/ui/legacy/checkboxTextLabel.css +2 -44
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +39 -27
- package/front_end/ui/legacy/components/color_picker/spectrum.css +2 -10
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +2 -6
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +34 -26
- package/front_end/ui/legacy/components/inline_editor/SwatchPopoverHelper.ts +1 -0
- package/front_end/ui/legacy/components/inline_editor/cssShadowEditor.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/swatchPopover.css +1 -1
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +49 -1
- package/front_end/ui/legacy/components/object_ui/objectPopover.css +0 -4
- package/front_end/ui/legacy/components/perf_ui/chartViewport.css +1 -9
- package/front_end/ui/legacy/components/perf_ui/filmStripView.css +1 -1
- package/front_end/ui/legacy/components/perf_ui/overviewGrid.css +2 -1
- package/front_end/ui/legacy/components/quick_open/filteredListWidget.css +0 -5
- package/front_end/ui/legacy/components/settings_ui/SettingsUI.ts +6 -3
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +95 -1
- package/front_end/ui/legacy/filter.css +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +6 -28
- package/front_end/ui/legacy/inspectorDrawerTabbedPane.css +1 -1
- package/front_end/ui/legacy/listWidget.css +1 -1
- package/front_end/ui/legacy/progressIndicator.css +1 -1
- package/front_end/ui/legacy/tabbedPane.css +6 -2
- package/front_end/ui/visual_logging/KnownContextValues.ts +1 -0
- package/front_end/ui/visual_logging/LoggingDriver.ts +4 -0
- package/front_end/ui/visual_logging/visual_logging.ts +1 -1
- package/inspector_overlay/common.ts +0 -3
- package/inspector_overlay/main.ts +1 -3
- package/inspector_overlay/tool_source_order.css +0 -4
- package/package.json +1 -1
- package/front_end/generated/SupportedCSSProperties.ts +0 -9705
|
@@ -23,10 +23,12 @@ import {
|
|
|
23
23
|
import {type ExecuteJsAgentOptions, executeJsCode} from './agents/ExecuteJavascript.js';
|
|
24
24
|
import {ChangeManager} from './ChangeManager.js';
|
|
25
25
|
import {DOMNodeContext} from './contexts/DOMNodeContext.js';
|
|
26
|
+
import {FileContext} from './contexts/FileContext.js';
|
|
26
27
|
import {LighthouseContext} from './contexts/LighthouseContext.js';
|
|
27
28
|
import {PerformanceTraceContext} from './contexts/PerformanceTraceContext.js';
|
|
29
|
+
import {RequestContext} from './contexts/RequestContext.js';
|
|
28
30
|
import {ExtensionScope} from './ExtensionScope.js';
|
|
29
|
-
import type {
|
|
31
|
+
import type {SkillName} from './skills/Skill.js';
|
|
30
32
|
import {SKILLS} from './skills/SkillRegistry.js';
|
|
31
33
|
import {
|
|
32
34
|
type AllToolsCapabilities,
|
|
@@ -39,6 +41,9 @@ import {ToolRegistry} from './tools/ToolRegistry.js';
|
|
|
39
41
|
|
|
40
42
|
const {debugLog} = AiUtils.Debug;
|
|
41
43
|
|
|
44
|
+
const UNCHANGED_CONTEXT_PROMPT_NOTICE =
|
|
45
|
+
'The selected context is unchanged since it was last provided earlier in this conversation.';
|
|
46
|
+
|
|
42
47
|
const SKILL_DISPLAY_NAMES: Record<SkillName, string> = {
|
|
43
48
|
styling: 'CSS and styling',
|
|
44
49
|
network: 'Network requests',
|
|
@@ -199,6 +204,18 @@ function hideStreamingSuggestions(text: string): string {
|
|
|
199
204
|
}
|
|
200
205
|
|
|
201
206
|
export class AiAgent2 extends AiAgent<unknown> {
|
|
207
|
+
/**
|
|
208
|
+
* Tracks the last context details sent to the LLM to prevent resending identical
|
|
209
|
+
* large context blocks on subsequent turns in the same conversation.
|
|
210
|
+
*/
|
|
211
|
+
#lastSentPromptDetails: string|null = null;
|
|
212
|
+
|
|
213
|
+
override clearCache(): void {
|
|
214
|
+
super.clearCache();
|
|
215
|
+
// Reset the tracker so that if conversation history is dropped (e.g., after an
|
|
216
|
+
// abort or non-MAX_STEPS error), the full context block is safely resent on the next turn.
|
|
217
|
+
this.#lastSentPromptDetails = null;
|
|
218
|
+
}
|
|
202
219
|
// TODO: The static preamble is a placeholder and will eventually live server-side.
|
|
203
220
|
readonly preamble: string = preamble;
|
|
204
221
|
readonly clientFeature: Host.AidaClient.ClientFeature = Host.AidaClient.ClientFeature.CHROME_DEVTOOLS_V2_AGENT;
|
|
@@ -217,6 +234,7 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
217
234
|
}
|
|
218
235
|
|
|
219
236
|
protected override async preRun(): Promise<void> {
|
|
237
|
+
await super.preRun();
|
|
220
238
|
// One-way latch: once sensitive data enters the conversation history,
|
|
221
239
|
// logging must remain disabled for the lifetime of this agent instance.
|
|
222
240
|
if (this.context && !this.context.isLoggingEnabled()) {
|
|
@@ -252,6 +270,10 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
252
270
|
|
|
253
271
|
readonly #activeSkills = new Set<SkillName>();
|
|
254
272
|
readonly #declaredTools = new Set<string>();
|
|
273
|
+
/**
|
|
274
|
+
* Tracks skills auto-loaded during enhanceQuery() so handleContextDetails() can attach them to ContextResponse for telemetry without rendering a walkthrough step.
|
|
275
|
+
*/
|
|
276
|
+
#pendingAutoLearnedSkills: SkillName[] = [];
|
|
255
277
|
|
|
256
278
|
constructor(opts: AiAgent2Options) {
|
|
257
279
|
super({
|
|
@@ -272,13 +294,16 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
272
294
|
this.#performanceRecordAndReload = opts.performanceRecordAndReload;
|
|
273
295
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
274
296
|
this.#originLock = opts.originLock;
|
|
297
|
+
|
|
275
298
|
this.#declaredTools.add('learnSkills');
|
|
299
|
+
const skillsManifest = Object.entries(SKILLS).map(([name, skill]) => `- ${name}: ${skill.description}`).join('\n');
|
|
276
300
|
this.declareFunction<{skills: SkillName[]}>('learnSkills', {
|
|
277
|
-
description:
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
301
|
+
description: `Loads the specified skills to gain access to their specialized tools and instructions.
|
|
302
|
+
If the user's request requires a skill that has not been loaded yet in this conversation, you MUST call \`learnSkills\` to load that skill first before using its tools, instead of attempting to solve the query using tools from other skills.
|
|
303
|
+
Do NOT call \`learnSkills\` for skills that were already loaded earlier in this conversation.
|
|
304
|
+
|
|
305
|
+
Available skills:
|
|
306
|
+
${skillsManifest}`,
|
|
282
307
|
parameters: {
|
|
283
308
|
type: Host.AidaClient.ParametersTypes.OBJECT,
|
|
284
309
|
description: 'Parameters for learning skills',
|
|
@@ -289,7 +314,7 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
289
314
|
type: Host.AidaClient.ParametersTypes.STRING,
|
|
290
315
|
description: 'Skill name',
|
|
291
316
|
},
|
|
292
|
-
description: 'List of
|
|
317
|
+
description: 'List of skill names to load (only include skills not yet loaded in this conversation)',
|
|
293
318
|
},
|
|
294
319
|
},
|
|
295
320
|
required: ['skills'],
|
|
@@ -338,42 +363,62 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
338
363
|
});
|
|
339
364
|
}
|
|
340
365
|
|
|
366
|
+
/**
|
|
367
|
+
* Maps selected contexts (DOMNodeContext, RequestContext, FileContext) to their domain skill to skip a redundant step-1 learnSkills round trip.
|
|
368
|
+
*/
|
|
369
|
+
#skillForContext(selected: ConversationContext<unknown>|null): SkillName|null {
|
|
370
|
+
if (selected instanceof DOMNodeContext) {
|
|
371
|
+
return 'styling';
|
|
372
|
+
}
|
|
373
|
+
if (selected instanceof RequestContext) {
|
|
374
|
+
return 'network';
|
|
375
|
+
}
|
|
376
|
+
if (selected instanceof FileContext) {
|
|
377
|
+
return 'sources';
|
|
378
|
+
}
|
|
379
|
+
return null;
|
|
380
|
+
}
|
|
381
|
+
|
|
341
382
|
override async enhanceQuery(
|
|
342
383
|
query: string,
|
|
343
384
|
selected: ConversationContext<unknown>|null = null,
|
|
344
385
|
// TODO: support multimodal input in AiAgent2.
|
|
345
386
|
_multimodalInputType?: MultimodalInputType,
|
|
346
387
|
): Promise<string> {
|
|
388
|
+
this.#pendingAutoLearnedSkills = [];
|
|
389
|
+
const promptDetails = selected ? await selected.getPromptDetails() : null;
|
|
347
390
|
let enhancedQuery = query;
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
391
|
+
|
|
392
|
+
if (!promptDetails) {
|
|
393
|
+
// Clear the tracker when there is no context (or an unsupported context type)
|
|
394
|
+
// so that if the user later switches back to a previously sent context, it is
|
|
395
|
+
// sent in full again rather than deduplicated.
|
|
396
|
+
this.#lastSentPromptDetails = null;
|
|
397
|
+
} else {
|
|
398
|
+
let contextDetails: string;
|
|
399
|
+
if (promptDetails === this.#lastSentPromptDetails) {
|
|
400
|
+
contextDetails = UNCHANGED_CONTEXT_PROMPT_NOTICE;
|
|
401
|
+
} else {
|
|
402
|
+
contextDetails = promptDetails;
|
|
403
|
+
this.#lastSentPromptDetails = promptDetails;
|
|
404
|
+
}
|
|
405
|
+
enhancedQuery = `${contextDetails}
|
|
352
406
|
|
|
353
407
|
# User request
|
|
354
408
|
|
|
355
409
|
QUERY: ${query}`;
|
|
356
|
-
}
|
|
357
410
|
}
|
|
358
411
|
|
|
359
|
-
const
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
412
|
+
const mappedSkill = this.#skillForContext(selected);
|
|
413
|
+
if (mappedSkill && SKILLS[mappedSkill] && !this.#activeSkills.has(mappedSkill)) {
|
|
414
|
+
const autoLoadedBlock = await this.learnSkill([mappedSkill]);
|
|
415
|
+
this.#pendingAutoLearnedSkills.push(mappedSkill);
|
|
416
|
+
if (autoLoadedBlock) {
|
|
417
|
+
return `${autoLoadedBlock}\n\n${enhancedQuery}`;
|
|
418
|
+
}
|
|
363
419
|
}
|
|
364
420
|
|
|
365
|
-
|
|
366
|
-
// assertSkillNotLoaded) rely on this formatting (`Available skills that are not yet loaded:`
|
|
367
|
-
// and `- ${name}: ${skill.description}`). If this format is updated, update those helpers too.
|
|
368
|
-
const skillsManifest = unloadedSkills.map(([name, skill]) => `- ${name}: ${skill.description}`).join('\n');
|
|
369
|
-
return `Available skills that are not yet loaded:
|
|
370
|
-
${skillsManifest}
|
|
371
|
-
|
|
372
|
-
You must call \`learnSkills\` to load a skill before you can use its tools.
|
|
373
|
-
If the user's request requires a skill that is not currently loaded, you MUST call \`learnSkills\` to load that skill first, instead of attempting to solve the query using tools from other skills.
|
|
374
|
-
Do NOT call \`learnSkills\` for skills that are already loaded.
|
|
375
|
-
|
|
376
|
-
User query: ${enhancedQuery}`;
|
|
421
|
+
return enhancedQuery;
|
|
377
422
|
}
|
|
378
423
|
|
|
379
424
|
/**
|
|
@@ -394,28 +439,32 @@ User query: ${enhancedQuery}`;
|
|
|
394
439
|
|
|
395
440
|
override async *
|
|
396
441
|
handleContextDetails(selected: ConversationContext<unknown>|null): AsyncGenerator<ContextResponse, void, void> {
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
]);
|
|
402
|
-
if (details) {
|
|
403
|
-
yield {
|
|
404
|
-
type: ResponseType.CONTEXT,
|
|
405
|
-
details,
|
|
406
|
-
...(widgets.length > 0 ? {widgets} : {}),
|
|
407
|
-
};
|
|
408
|
-
}
|
|
442
|
+
const autoLearned = this.#pendingAutoLearnedSkills;
|
|
443
|
+
this.#pendingAutoLearnedSkills = [];
|
|
444
|
+
if (!selected) {
|
|
445
|
+
return;
|
|
409
446
|
}
|
|
410
|
-
}
|
|
411
447
|
|
|
412
|
-
|
|
413
|
-
|
|
448
|
+
const [details, widgets] = await Promise.all([
|
|
449
|
+
selected.getUserFacingDetails(),
|
|
450
|
+
selected.getWidgets(),
|
|
451
|
+
]);
|
|
452
|
+
if (details) {
|
|
453
|
+
// Do not yield a separate TITLE/ACTION walkthrough step for autoLearned skills:
|
|
454
|
+
// DevTools attaches the active panel's selected item before the model evaluates
|
|
455
|
+
// whether the user's question needs that skill, so showing "Loaded skill: ..."
|
|
456
|
+
// in the walkthrough misleads the user when their question is about another domain.
|
|
457
|
+
yield {
|
|
458
|
+
type: ResponseType.CONTEXT,
|
|
459
|
+
details,
|
|
460
|
+
...(widgets.length > 0 ? {widgets} : {}),
|
|
461
|
+
...(autoLearned.length > 0 ? {autoLearnedSkills: autoLearned} : {}),
|
|
462
|
+
};
|
|
463
|
+
}
|
|
414
464
|
}
|
|
415
465
|
|
|
416
466
|
async learnSkill(names: SkillName[]): Promise<string> {
|
|
417
467
|
let response = '';
|
|
418
|
-
const skills = this.getSkills();
|
|
419
468
|
for (const name of names) {
|
|
420
469
|
if (this.#activeSkills.has(name)) {
|
|
421
470
|
debugLog(`[AiAgent2] Skill '${name}' is already loaded`);
|
|
@@ -424,7 +473,7 @@ User query: ${enhancedQuery}`;
|
|
|
424
473
|
continue;
|
|
425
474
|
}
|
|
426
475
|
|
|
427
|
-
const skillObj
|
|
476
|
+
const skillObj = SKILLS[name];
|
|
428
477
|
if (skillObj) {
|
|
429
478
|
this.#activeSkills.add(name);
|
|
430
479
|
debugLog(`[AiAgent2] Loaded skill '${name}' with tools: [${skillObj.allowedTools.join(', ')}]`);
|
|
@@ -437,7 +486,7 @@ User query: ${enhancedQuery}`;
|
|
|
437
486
|
}
|
|
438
487
|
} else {
|
|
439
488
|
debugLog(`[AiAgent2] Failed to load skill '${name}'`);
|
|
440
|
-
response += `Failed to load skill ${name}. Valid skills are: ${Object.keys(
|
|
489
|
+
response += `Failed to load skill ${name}. Valid skills are: ${Object.keys(SKILLS).join(', ')}.\n`;
|
|
441
490
|
}
|
|
442
491
|
}
|
|
443
492
|
return response.trim();
|
|
@@ -344,7 +344,7 @@ export class AiConversation {
|
|
|
344
344
|
return {...item, confirm: undefined};
|
|
345
345
|
}
|
|
346
346
|
case ResponseType.CONTEXT: {
|
|
347
|
-
return {...item, widgets: undefined};
|
|
347
|
+
return {...item, widgets: undefined, autoLearnedSkills: undefined};
|
|
348
348
|
}
|
|
349
349
|
case ResponseType.ACTION: {
|
|
350
350
|
const tool = item.toolName ? ToolRegistry.get(item.toolName) : undefined;
|
|
@@ -186,6 +186,13 @@ export interface ContextResponse {
|
|
|
186
186
|
type: ResponseType.CONTEXT;
|
|
187
187
|
details: [ContextDetail, ...ContextDetail[]];
|
|
188
188
|
widgets?: AiWidget[];
|
|
189
|
+
/**
|
|
190
|
+
* Skills pre-loaded automatically from the selected context during `enhanceQuery()`.
|
|
191
|
+
* Attached to `ContextResponse` for `'ai-v2-auto-learn-skill'` telemetry rather than
|
|
192
|
+
* emitted as a separate walkthrough step, because `selectedContext` is attached
|
|
193
|
+
* before the model evaluates whether the user's question requires that skill.
|
|
194
|
+
*/
|
|
195
|
+
autoLearnedSkills?: string[];
|
|
189
196
|
}
|
|
190
197
|
|
|
191
198
|
/**
|
|
@@ -669,7 +676,7 @@ export interface FunctionDeclaration<Args extends Record<string, unknown>, Retur
|
|
|
669
676
|
* Description of function, this is send to the LLM
|
|
670
677
|
* to explain what will the function do.
|
|
671
678
|
*/
|
|
672
|
-
description: string
|
|
679
|
+
description: string;
|
|
673
680
|
/**
|
|
674
681
|
* JSON schema like representation of the parameters
|
|
675
682
|
* the function needs to be called with.
|
|
@@ -897,7 +904,7 @@ export abstract class AiAgent<T> {
|
|
|
897
904
|
for (const [name, definition] of this.#functionDeclarations.entries()) {
|
|
898
905
|
declarations.push({
|
|
899
906
|
name,
|
|
900
|
-
description:
|
|
907
|
+
description: definition.description,
|
|
901
908
|
parameters: definition.parameters,
|
|
902
909
|
});
|
|
903
910
|
}
|
|
@@ -95,7 +95,7 @@ export async function executeJsCode(
|
|
|
95
95
|
{throwOnSideEffect: !!throwOnSideEffect});
|
|
96
96
|
}
|
|
97
97
|
|
|
98
|
-
const MAX_OBSERVATION_BYTE_LENGTH =
|
|
98
|
+
export const MAX_OBSERVATION_BYTE_LENGTH = 8_000;
|
|
99
99
|
const OBSERVATION_TIMEOUT = 5_000;
|
|
100
100
|
|
|
101
101
|
export interface JavascriptExecutorOptions {
|
|
@@ -226,7 +226,8 @@ export class JavascriptExecutor {
|
|
|
226
226
|
const byteCount = Platform.StringUtilities.countWtf8Bytes(result);
|
|
227
227
|
Host.userMetrics.freestylerEvalResponseSize(byteCount);
|
|
228
228
|
if (byteCount > MAX_OBSERVATION_BYTE_LENGTH) {
|
|
229
|
-
throw new Error(
|
|
229
|
+
throw new Error(
|
|
230
|
+
`Output of ${byteCount} bytes exceeded the maximum allowed (${MAX_OBSERVATION_BYTE_LENGTH} bytes).`);
|
|
230
231
|
}
|
|
231
232
|
return {
|
|
232
233
|
observation: result,
|
|
@@ -78,7 +78,7 @@ Content:
|
|
|
78
78
|
"properties": {
|
|
79
79
|
"code": {
|
|
80
80
|
"type": 1,
|
|
81
|
-
"description": "JavaScript code snippet to run on the inspected page. Make sure the code is formatted for readability.\n\n# Instructions\n\n* To return data, define a top-level `data` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to `data
|
|
81
|
+
"description": "JavaScript code snippet to run on the inspected page. Make sure the code is formatted for readability.\n\n# Instructions\n\n* To return data, define a top-level `data` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to `data`, and serialized output must not exceed 8000 bytes (return targeted properties or slices rather than full DOM subtrees).\n* $0 refers to the currently selected DOM node (or document body if none selected).\n* **CRITICAL** Do not call `console` methods (e.g., `console.log`, `console.warn`, `console.error`) by default when returning data via `data`.\n* **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.\n* **CRITICAL** Variables from previous function calls are not available in subsequent calls.\n* **CRITICAL** Keep code concise (max 40 lines, max 120 characters per line, and max 2,500 total characters). To stay well under 120 characters per line:\n - Put each statement, object property, array item, and `&&`/`||` condition on its own line.\n - Extract long CSS selectors or strings into a variable (or `.join(', ')` array) before calling `querySelectorAll`.\n - Store intermediate DOM lookups (`getComputedStyle`, `getAttribute`) in short local variables instead of chaining them on one line.\n - Split complex logic into multiple steps.\n* **CRITICAL** Network requests (e.g., fetch, XMLHttpRequest) are disabled and cannot be made.\n\nFor example, to query DOM elements:\n\n```\nconst data = {\n title: document.title,\n elementText: $0?.textContent?.trim(),\n childCount: $0?.children.length,\n};\n```\n"
|
|
82
82
|
},
|
|
83
83
|
"explanation": {
|
|
84
84
|
"type": 1,
|
|
@@ -320,7 +320,7 @@ export class PerformanceTraceFormatter {
|
|
|
320
320
|
// No nodes less than 1 ms.
|
|
321
321
|
// Limit.
|
|
322
322
|
const topNodes = [...rootNode.children().values()]
|
|
323
|
-
.filter(n => n.totalTime >=
|
|
323
|
+
.filter(n => n.totalTime >= Trace.Types.Timing.Micro(1_000))
|
|
324
324
|
.sort((a, b) => b.selfTime - a.selfTime)
|
|
325
325
|
.slice(0, limit);
|
|
326
326
|
const callFrames: Protocol.Runtime.CallFrame[] = [];
|
|
@@ -331,7 +331,7 @@ export class PerformanceTraceFormatter {
|
|
|
331
331
|
let frame;
|
|
332
332
|
if (Trace.Types.Events.isProfileCall(event)) {
|
|
333
333
|
frame = event.callFrame;
|
|
334
|
-
if (node.selfTime >=
|
|
334
|
+
if (node.selfTime >= Trace.Types.Timing.Micro(100_000) && callFrames.length < 3) {
|
|
335
335
|
callFrames.push(frame);
|
|
336
336
|
}
|
|
337
337
|
} else {
|
|
@@ -351,7 +351,8 @@ export class PerformanceTraceFormatter {
|
|
|
351
351
|
source += ')';
|
|
352
352
|
}
|
|
353
353
|
|
|
354
|
-
return `- self: ${millis(node.selfTime)}, total: ${
|
|
354
|
+
return `- self: ${millis(Trace.Helpers.Timing.microToMilli(node.selfTime))}, total: ${
|
|
355
|
+
millis(Trace.Helpers.Timing.microToMilli(node.totalTime))}, source: ${source}`;
|
|
355
356
|
}
|
|
356
357
|
|
|
357
358
|
return topNodes.map(node => nodeToText.call(this, node)).join('\n') +
|
|
@@ -428,7 +429,7 @@ export class PerformanceTraceFormatter {
|
|
|
428
429
|
|
|
429
430
|
return longestTaskTrees
|
|
430
431
|
.map(tree => {
|
|
431
|
-
const time = millis(tree.rootNode.totalTime);
|
|
432
|
+
const time = millis(Trace.Helpers.Timing.microToMilli(tree.rootNode.totalTime));
|
|
432
433
|
return `- total time: ${time}, event: ${this.serializeEvent(tree.rootNode.event)}`;
|
|
433
434
|
})
|
|
434
435
|
.join('\n');
|
|
@@ -85,8 +85,8 @@ export class AICallTree {
|
|
|
85
85
|
// Build a tree bounded by the selected event's timestamps, and our other filters applied
|
|
86
86
|
const rootNode = new Trace.Extras.TraceTree.TopDownRootNode(overlappingEvents, {
|
|
87
87
|
filters: [minDurationFilter, compileCodeFilter, visibleEventsFilter],
|
|
88
|
-
startTime:
|
|
89
|
-
endTime:
|
|
88
|
+
startTime: bounds.min,
|
|
89
|
+
endTime: bounds.max,
|
|
90
90
|
doNotAggregate: true,
|
|
91
91
|
includeInstantEvents: true,
|
|
92
92
|
});
|
|
@@ -148,9 +148,7 @@ export class AICallTree {
|
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
const showAllEvents = parsedTrace.data.Meta.config.showAllEvents;
|
|
151
|
-
const
|
|
152
|
-
const selectedEventBounds = Trace.Helpers.Timing.traceWindowFromMicroSeconds(
|
|
153
|
-
Trace.Helpers.Timing.milliToMicro(startTime), Trace.Helpers.Timing.milliToMicro(endTime));
|
|
151
|
+
const selectedEventBounds = Trace.Helpers.Timing.traceWindowFromEvent(selectedEvent);
|
|
154
152
|
let threadEvents = data.Renderer.processes.get(selectedEvent.pid)?.threads.get(selectedEvent.tid)?.entries;
|
|
155
153
|
if (!threadEvents) {
|
|
156
154
|
// None from the renderer: try the samples handler, this might be a CPU trace.
|
|
@@ -176,8 +174,8 @@ export class AICallTree {
|
|
|
176
174
|
// Build a tree bounded by the selected event's timestamps, and our other filters applied
|
|
177
175
|
const rootNode = new Trace.Extras.TraceTree.TopDownRootNode(overlappingEvents, {
|
|
178
176
|
filters,
|
|
179
|
-
startTime,
|
|
180
|
-
endTime,
|
|
177
|
+
startTime: selectedEventBounds.min,
|
|
178
|
+
endTime: selectedEventBounds.max,
|
|
181
179
|
includeInstantEvents: true,
|
|
182
180
|
});
|
|
183
181
|
|
|
@@ -332,10 +330,10 @@ export class AICallTree {
|
|
|
332
330
|
};
|
|
333
331
|
|
|
334
332
|
// 4. Duration
|
|
335
|
-
const durationStr = roundToTenths(node.totalTime);
|
|
333
|
+
const durationStr = roundToTenths(Trace.Helpers.Timing.microToMilli(node.totalTime));
|
|
336
334
|
|
|
337
335
|
// 5. Self Time
|
|
338
|
-
const selfTimeStr = roundToTenths(node.selfTime);
|
|
336
|
+
const selfTimeStr = roundToTenths(Trace.Helpers.Timing.microToMilli(node.selfTime));
|
|
339
337
|
|
|
340
338
|
// 6. URL Index
|
|
341
339
|
const location = SourceMapsResolver.SourceMapsResolver.codeLocationForEntry(parsedTrace, event, this.workspace);
|
|
@@ -70,13 +70,11 @@ export class AIQueries {
|
|
|
70
70
|
visibleEvents.concat([Trace.Types.Events.Name.SYNTHETIC_NETWORK_REQUEST]));
|
|
71
71
|
|
|
72
72
|
// The bottom up root node handles all the "in Tracebounds" checks we need for the insight.
|
|
73
|
-
const startTime = Trace.Helpers.Timing.microToMilli(bounds.min);
|
|
74
|
-
const endTime = Trace.Helpers.Timing.microToMilli(bounds.max);
|
|
75
73
|
return new Trace.Extras.TraceTree.BottomUpRootNode(events, {
|
|
76
74
|
textFilter: new Trace.Extras.TraceFilter.ExclusiveNameFilter([]),
|
|
77
75
|
filters: [filter],
|
|
78
|
-
startTime,
|
|
79
|
-
endTime,
|
|
76
|
+
startTime: bounds.min,
|
|
77
|
+
endTime: bounds.max,
|
|
80
78
|
});
|
|
81
79
|
}
|
|
82
80
|
|
|
@@ -121,13 +119,11 @@ export class AIQueries {
|
|
|
121
119
|
visibleEvents.concat([Trace.Types.Events.Name.SYNTHETIC_NETWORK_REQUEST]));
|
|
122
120
|
|
|
123
121
|
// The bottom up root node handles all the "in Tracebounds" checks we need for the insight.
|
|
124
|
-
const startTime = Trace.Helpers.Timing.microToMilli(bounds.min);
|
|
125
|
-
const endTime = Trace.Helpers.Timing.microToMilli(bounds.max);
|
|
126
122
|
return new Trace.Extras.TraceTree.BottomUpRootNode(events, {
|
|
127
123
|
textFilter: new Trace.Extras.TraceFilter.ExclusiveNameFilter([]),
|
|
128
124
|
filters: [filter],
|
|
129
|
-
startTime,
|
|
130
|
-
endTime,
|
|
125
|
+
startTime: bounds.min,
|
|
126
|
+
endTime: bounds.max,
|
|
131
127
|
});
|
|
132
128
|
}
|
|
133
129
|
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
// Use of this source code is governed by a BSD-style license that can be
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
|
+
import {PerformanceTraceFormatter} from '../data_formatters/PerformanceTraceFormatter.js';
|
|
6
|
+
|
|
5
7
|
import {skill as lighthouseSkill} from './lighthouse.skill.js';
|
|
6
8
|
import {skill as networkSkill} from './network.skill.js';
|
|
7
9
|
import {skill as performanceSkill} from './performance.skill.js';
|
|
@@ -13,7 +15,15 @@ import {skill as stylingSkill} from './styling.skill.js';
|
|
|
13
15
|
export const SKILLS: Record<SkillName, Skill> = {
|
|
14
16
|
styling: stylingSkill,
|
|
15
17
|
network: networkSkill,
|
|
16
|
-
|
|
18
|
+
// Append compressed format descriptions here to keep a single source of truth
|
|
19
|
+
// alongside PerformanceTraceFormatter without inflating performanceSkill.description
|
|
20
|
+
// in the unloaded skills manifest.
|
|
21
|
+
performance: {
|
|
22
|
+
...performanceSkill,
|
|
23
|
+
instructions: `${performanceSkill.instructions}\n\n# Data Formats\n\n${
|
|
24
|
+
PerformanceTraceFormatter.networkDataFormatDescription.trim()}\n\n${
|
|
25
|
+
PerformanceTraceFormatter.callFrameDataFormatDescription.trim()}`,
|
|
26
|
+
},
|
|
17
27
|
storage: storageSkill,
|
|
18
28
|
sources: sourcesSkill,
|
|
19
29
|
lighthouse: lighthouseSkill,
|
|
@@ -46,6 +46,7 @@ Your role is to evaluate websites using Lighthouse audits across performance, ac
|
|
|
46
46
|
|
|
47
47
|
4. **Supplementary DOM & Dynamic Interaction Checks (`executeJavaScript`)**:
|
|
48
48
|
- Only after calling `resolveDevtoolsNodePath`, `getStyles`, and `getElementAccessibilityDetails` on failing elements with a `node path`, you may use `executeJavaScript` if you need supplementary DOM state not available from single-node tools (such as `<head>` `<meta>` tags, `document.body.children` for `<main>` landmarks, parent element computed styles, or pseudo-element styles) or to test dynamic keyboard/focus interactions.
|
|
49
|
+
- Never use executeJavaScript to modify element CSS styles or as a substitute for dedicated skills (such as styling for setElementStyles, storage, network, or sources); call learnSkills to load the relevant skill instead.
|
|
49
50
|
|
|
50
51
|
# Considerations
|
|
51
52
|
|
|
@@ -5,19 +5,18 @@ allowed-tools:
|
|
|
5
5
|
- listNetworkRequests
|
|
6
6
|
- getNetworkRequestDetails
|
|
7
7
|
---
|
|
8
|
-
You are an expert network request debugging assistant.
|
|
9
8
|
|
|
10
9
|
# Tools & Workflow
|
|
11
10
|
|
|
12
11
|
1. **Discover Requests (`listNetworkRequests`)**:
|
|
13
|
-
- Call `listNetworkRequests` to
|
|
12
|
+
- Call `listNetworkRequests` to list recorded requests initiated by the active origin as `id;url;status;duration;size` rows, where same-origin URLs omit the `origin` prefix and long query or `data:` URLs end with `...<truncated>`.
|
|
14
13
|
- Inspect the returned list for URLs, status codes, durations, transfer sizes, and unique request `id` values.
|
|
15
14
|
|
|
16
15
|
2. **Inspect Request Details (`getNetworkRequestDetails`)**:
|
|
17
|
-
- Call `getNetworkRequestDetails` with the specific request `id` to obtain full headers, timing phases (DNS, initial connection, SSL, TTFB, content download), status text, and response body.
|
|
16
|
+
- Call `getNetworkRequestDetails` with the specific request `id` to obtain the full untruncated URL, full headers, timing phases (DNS, initial connection, SSL, TTFB, content download), status text, and response body.
|
|
18
17
|
|
|
19
18
|
# Considerations
|
|
20
19
|
|
|
21
20
|
* **Privacy**: If the request or response payload contains sensitive personal data, authorization tokens, or API secrets, redact or generalize it in your response.
|
|
22
|
-
* **Origin Lock**: Only requests
|
|
21
|
+
* **Origin Lock**: Only requests initiated by the conversation's established origin can be inspected.
|
|
23
22
|
* **Recording**: DevTools only records requests made while DevTools is open and network recording is enabled (and the log has not been cleared). If `listNetworkRequests` reports that no requests have been recorded, ask the user to ensure network recording is enabled, reload the page or repeat the action that triggers the request, and try again.
|
|
@@ -5,13 +5,12 @@ allowed-tools:
|
|
|
5
5
|
- listSources
|
|
6
6
|
- getSourceContent
|
|
7
7
|
---
|
|
8
|
-
You are an expert source code analysis and debugging assistant.
|
|
9
8
|
|
|
10
9
|
# Tools & Workflow
|
|
11
10
|
|
|
12
11
|
1. **Discover Files (`listSources`)**:
|
|
13
12
|
- Call `listSources` to retrieve all deployed and authored source files (including source-mapped files) in the workspace matching the active origin.
|
|
14
|
-
-
|
|
13
|
+
- The output is formatted as `id;name` lines. Same-origin `http(s)` files omit the locked origin scheme and host (e.g. `/assets/app.js`, `/(index)`), while virtual source-map files retain their scheme (e.g. `webpack:///./src/index.ts`).
|
|
15
14
|
|
|
16
15
|
2. **Inspect File Content (`getSourceContent`)**:
|
|
17
16
|
- Call `getSourceContent` with the numeric `id` to retrieve the source code.
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: styling
|
|
3
|
-
description: CSS, styling, layouts, positioning, computed styles, DOM tree structure, and page styles.
|
|
3
|
+
description: Inspecting or modifying live CSS, styling, layouts, positioning, computed styles, DOM tree structure, and page styles.
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- executeJavaScript
|
|
6
6
|
- getStyles
|
|
7
7
|
- setElementStyles
|
|
8
8
|
---
|
|
9
|
-
You are an expert CSS, styling, and layout debugging assistant.
|
|
10
|
-
The user selected a DOM element in DevTools and asks a query about the element or page styles.
|
|
11
9
|
|
|
12
10
|
# Tools & Workflow
|
|
13
11
|
|
|
@@ -22,7 +20,8 @@ The user selected a DOM element in DevTools and asks a query about the element o
|
|
|
22
20
|
- `setElementStyles` is an internal tool name; do not mention `setElementStyles` directly to the user.
|
|
23
21
|
|
|
24
22
|
3. **Inspect Geometry or Traverse DOM (`executeJavaScript`)**:
|
|
25
|
-
- Use `executeJavaScript` ONLY when inspecting computed geometry (`getBoundingClientRect()`), traversing related DOM nodes (`$0.parentElement`, `$0.children`) to inspect their structure/attributes, or reading
|
|
23
|
+
- Use `executeJavaScript` ONLY when inspecting computed geometry (`getBoundingClientRect()`), traversing related DOM nodes (`$0.parentElement`, `$0.children`) to inspect their structure/attributes, or reading DOM/layout state that getStyles cannot provide.
|
|
24
|
+
- Never use executeJavaScript as a substitute for dedicated skills (such as browser storage/cookies, network requests, workspace source files, or accessibility tree inspection); call learnSkills to load the relevant skill instead.
|
|
26
25
|
- Geometry & layout inspection example:
|
|
27
26
|
```javascript
|
|
28
27
|
const rect = $0.getBoundingClientRect();
|
|
@@ -7,7 +7,7 @@ import * as i18n from '../../../core/i18n/i18n.js';
|
|
|
7
7
|
import * as Platform from '../../../core/platform/platform.js';
|
|
8
8
|
import * as Root from '../../../core/root/root.js';
|
|
9
9
|
import type {FunctionHandlerOptions} from '../agents/AiAgent.js';
|
|
10
|
-
import {JavascriptExecutor} from '../agents/ExecuteJavascript.js';
|
|
10
|
+
import {JavascriptExecutor, MAX_OBSERVATION_BYTE_LENGTH} from '../agents/ExecuteJavascript.js';
|
|
11
11
|
|
|
12
12
|
import {
|
|
13
13
|
type BaseToolCapability,
|
|
@@ -25,7 +25,12 @@ import {
|
|
|
25
25
|
const lockedString = i18n.i18n.lockedString;
|
|
26
26
|
|
|
27
27
|
const MAX_LINES = 40;
|
|
28
|
-
|
|
28
|
+
// Deliberately higher than the 120-character soft target in
|
|
29
|
+
// `parameters.properties.code.description`: the prompt keeps the model aiming
|
|
30
|
+
// for <= 120 characters/line for readability, while this 160-character hard stop
|
|
31
|
+
// absorbs minor counting overshoots (`describeSizeLimitViolations()` reports 160
|
|
32
|
+
// when exceeded).
|
|
33
|
+
const MAX_LINE_LENGTH = 160;
|
|
29
34
|
const MAX_TOTAL_CHARACTERS = 2500;
|
|
30
35
|
const MAX_LONG_LINES_REPORTED = 3;
|
|
31
36
|
const LONG_LINE_PREVIEW_LENGTH = 60;
|
|
@@ -127,6 +132,8 @@ export class ExecuteJavaScriptTool implements
|
|
|
127
132
|
description: '',
|
|
128
133
|
nullable: false,
|
|
129
134
|
properties: {
|
|
135
|
+
// The `description` below purposefully states `max 120 characters per line`
|
|
136
|
+
// as a soft target, while `MAX_LINE_LENGTH` enforces 160 as the hard stop.
|
|
130
137
|
code: {
|
|
131
138
|
type: Host.AidaClient.ParametersTypes.STRING,
|
|
132
139
|
description:
|
|
@@ -134,7 +141,8 @@ export class ExecuteJavaScriptTool implements
|
|
|
134
141
|
|
|
135
142
|
# Instructions
|
|
136
143
|
|
|
137
|
-
* To return data, define a top-level \`data\` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to \`data
|
|
144
|
+
* To return data, define a top-level \`data\` variable and populate it with data you want to get. Only JSON-serializable objects can be assigned to \`data\`, and serialized output must not exceed ${
|
|
145
|
+
MAX_OBSERVATION_BYTE_LENGTH} bytes (return targeted properties or slices rather than full DOM subtrees).
|
|
138
146
|
* $0 refers to the currently selected DOM node (or document body if none selected).
|
|
139
147
|
* **CRITICAL** Do not call \`console\` methods (e.g., \`console.log\`, \`console.warn\`, \`console.error\`) by default when returning data via \`data\`.
|
|
140
148
|
* **CRITICAL** Never assume a selector for the elements unless you verified your knowledge.
|