chrome-devtools-frontend 1.0.1662289 → 1.0.1664496
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.agents/skills/{creating-a-model → devtools-model-management}/SKILL.md +0 -1
- package/.agents/skills/devtools-unicode-escaping/SKILL.md +64 -0
- package/.agents/skills/devtools-ux-writing-refactor/SKILL.md +2 -1
- package/.agents/skills/fixing-skipped-tests/SKILL.md +3 -3
- package/.agents/skills/merging-devtools-module/SKILL.md +1 -1
- package/.agents/skills/migrate-chromium-test/SKILL.md +32 -6
- package/.agents/skills/repro-flaky-tests/SKILL.md +71 -31
- package/.agents/skills/ui-eng-vision-widget-promoter/SKILL.md +1 -0
- package/docs/ui_engineering.md +2 -0
- package/eslint.config.mjs +1 -0
- package/front_end/core/common/SettingRegistration.ts +0 -5
- package/front_end/core/common/Settings.ts +144 -3
- package/front_end/core/platform/StringUtilities.ts +38 -6
- package/front_end/core/protocol_client/PuppeteerDevToolsConnection.ts +112 -0
- package/front_end/core/sdk/CPUProfilerModel.ts +21 -13
- package/front_end/core/sdk/CSSContainerQuery.ts +1 -1
- package/front_end/core/sdk/CSSLayer.ts +1 -1
- package/front_end/core/sdk/CSSMedia.ts +1 -1
- package/front_end/core/sdk/CSSModel.ts +1 -1
- package/front_end/core/sdk/CSSNavigation.ts +1 -1
- package/front_end/core/sdk/CSSProperty.ts +1 -1
- package/front_end/core/sdk/CSSQuery.ts +1 -1
- package/front_end/core/sdk/CSSRule.ts +1 -1
- package/front_end/core/sdk/CSSScope.ts +1 -1
- package/front_end/core/sdk/CSSStartingStyle.ts +1 -1
- package/front_end/core/sdk/CSSStyleDeclaration.ts +1 -1
- package/front_end/core/sdk/CSSStyleSheetHeader.ts +1 -1
- package/front_end/core/sdk/CSSSupports.ts +1 -1
- package/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +1 -1
- package/front_end/core/sdk/NetworkManager.ts +1 -1
- package/front_end/core/sdk/NetworkRequest.ts +7 -7
- package/front_end/core/sdk/Resource.ts +1 -1
- package/front_end/core/sdk/ScopeTreeCache.ts +1 -1
- package/front_end/core/sdk/Script.ts +1 -1
- package/front_end/core/sdk/ServerSentEvents.ts +1 -1
- package/front_end/core/sdk/ServiceWorkerCacheModel.ts +0 -10
- package/front_end/core/sdk/SourceMap.ts +1 -1
- package/front_end/core/sdk/SourceMapScopesInfo.ts +1 -1
- package/front_end/core/sdk/StorageBucketsModel.ts +0 -10
- package/front_end/core/sdk/sdk-meta.ts +3 -4
- package/front_end/{models → core}/text_utils/ContentProvider.ts +4 -6
- package/front_end/{models → core}/text_utils/StaticContentProvider.ts +4 -6
- package/front_end/{models → core}/text_utils/StreamingContentData.ts +1 -2
- package/front_end/{models → core}/text_utils/TextRange.ts +6 -3
- package/front_end/{models → core}/text_utils/TextUtils.ts +7 -7
- package/front_end/{models → core}/text_utils/WasmDisassembly.ts +2 -2
- package/front_end/core/text_utils/text_utils.ts +27 -0
- package/front_end/entrypoints/formatter_worker/AcornTokenizer.ts +1 -1
- package/front_end/entrypoints/heap_snapshot_worker/HeapSnapshotLoader.ts +1 -1
- package/front_end/entrypoints/inspector_main/OutermostTargetSelector.ts +0 -13
- package/front_end/entrypoints/inspector_main/RenderingOptions.ts +8 -3
- package/front_end/entrypoints/inspector_main/inspector_main-meta.ts +3 -3
- package/front_end/entrypoints/main/MainImpl.ts +21 -3
- package/front_end/foundation/Universe.ts +16 -0
- package/front_end/generated/InspectorBackendCommands.ts +2 -14
- package/front_end/generated/protocol-mapping.d.ts +0 -53
- package/front_end/generated/protocol-proxy-api.d.ts +0 -46
- package/front_end/generated/protocol.ts +0 -148
- package/front_end/models/ai_assistance/AgentProject.ts +1 -1
- package/front_end/models/ai_assistance/AiAgent2.ts +3 -3
- package/front_end/models/ai_assistance/AiConversation.ts +21 -10
- package/front_end/models/ai_assistance/AiHistoryStorage.ts +21 -10
- package/front_end/models/ai_assistance/ChangeManager.ts +2 -2
- package/front_end/models/ai_assistance/ExtensionScope.ts +6 -2
- package/front_end/models/ai_assistance/agents/AccessibilityAgent.ts +4 -7
- package/front_end/models/ai_assistance/agents/AiAgent.ts +9 -2
- package/front_end/models/ai_assistance/agents/ContextSelectionAgent.ts +19 -11
- package/front_end/models/ai_assistance/agents/PerformanceAgent.snapshot.txt +2 -2
- package/front_end/models/ai_assistance/agents/PerformanceAgent.ts +23 -10
- package/front_end/models/ai_assistance/agents/StorageAgent.ts +19 -18
- package/front_end/models/ai_assistance/agents/StylingAgent.ts +3 -4
- package/front_end/models/ai_assistance/contexts/FileContext.ts +7 -3
- package/front_end/models/ai_assistance/contexts/PerformanceTraceContext.ts +39 -11
- package/front_end/models/ai_assistance/data_formatters/FileFormatter.ts +6 -3
- package/front_end/models/ai_assistance/data_formatters/NetworkRequestFormatter.ts +1 -1
- package/front_end/models/ai_assistance/data_formatters/PerformanceInsightFormatter.snapshot.txt +4 -4
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.snapshot.txt +8 -8
- package/front_end/models/ai_assistance/data_formatters/PerformanceTraceFormatter.ts +76 -3
- package/front_end/models/ai_assistance/tools/ListNetworkRequests.ts +11 -1
- package/front_end/models/badges/AiExplorerBadge.ts +8 -3
- package/front_end/models/badges/Badge.ts +1 -0
- package/front_end/models/badges/UserBadges.ts +43 -23
- package/front_end/models/bindings/CompilerScriptMapping.ts +1 -1
- package/front_end/models/bindings/ContentProviderBasedProject.ts +1 -1
- package/front_end/models/bindings/DebuggerLanguagePlugins.ts +2 -2
- package/front_end/models/bindings/DebuggerWorkspaceBinding.ts +1 -1
- package/front_end/models/bindings/DefaultScriptMapping.ts +1 -1
- package/front_end/models/bindings/FileUtils.ts +1 -1
- package/front_end/models/bindings/NetworkProject.ts +16 -4
- package/front_end/models/bindings/PresentationConsoleMessageHelper.ts +7 -10
- package/front_end/models/bindings/ResourceMapping.ts +1 -1
- package/front_end/models/bindings/ResourceScriptMapping.ts +1 -1
- package/front_end/models/bindings/SASSSourceMapping.ts +1 -1
- package/front_end/models/bindings/StylesSourceMapping.ts +1 -1
- package/front_end/models/breakpoints/BreakpointManager.ts +1 -1
- package/front_end/models/crux-manager/CrUXManager.ts +1 -1
- package/front_end/models/emulation/DeviceModeModel.ts +67 -5
- package/front_end/models/emulation/EmulatedDevices.ts +3 -2
- package/front_end/models/extensions/RecorderPluginManager.ts +10 -6
- package/front_end/models/har/Importer.ts +1 -1
- package/front_end/models/har/Log.snapshot.txt +193 -0
- package/front_end/models/har/Log.ts +3 -2
- package/front_end/models/har/Writer.ts +1 -1
- package/front_end/models/issues_manager/IssueAggregator.ts +9 -0
- package/front_end/models/issues_manager/IssuesManager.ts +5 -0
- package/front_end/models/issues_manager/LazyLoadImageIssue.ts +76 -0
- package/front_end/models/issues_manager/descriptions/lazyLoadImageZeroSize.md +7 -0
- package/front_end/models/issues_manager/issues_manager.ts +2 -0
- package/front_end/models/javascript_metadata/NativeFunctions.js +9 -10
- package/front_end/models/live-metrics/LiveMetrics.ts +2 -3
- package/front_end/models/logs/NetworkLog.ts +4 -3
- package/front_end/models/logs/logs-meta.ts +3 -3
- package/front_end/models/network_time_calculator/NetworkTimeCalculator.ts +4 -4
- package/front_end/models/persistence/Automapping.ts +1 -1
- package/front_end/models/persistence/AutomaticFileSystemWorkspaceBinding.ts +2 -2
- package/front_end/models/persistence/FileSystemWorkspaceBinding.ts +1 -1
- package/front_end/models/persistence/IsolatedFileSystem.ts +2 -2
- package/front_end/models/persistence/NetworkPersistenceManager.ts +1 -1
- package/front_end/models/persistence/PersistenceImpl.ts +1 -1
- package/front_end/models/persistence/PlatformFileSystem.ts +1 -1
- package/front_end/models/source_map_scopes/FunctionCodeResolver.ts +8 -6
- package/front_end/models/source_map_scopes/NamesResolver.ts +37 -31
- package/front_end/models/stack_trace/StackTrace.ts +17 -0
- package/front_end/models/text_utils/text_utils.ts +2 -24
- package/front_end/models/trace/insights/ImageDelivery.ts +2 -2
- package/front_end/models/trace/insights/LegacyJavaScript.ts +1 -1
- package/front_end/models/trace/insights/RenderBlocking.ts +1 -1
- package/front_end/models/trace/insights/ThirdParties.ts +1 -1
- package/front_end/models/workspace/FileManager.ts +1 -1
- package/front_end/models/workspace/UISourceCode.ts +1 -1
- package/front_end/models/workspace/WorkspaceImpl.ts +1 -1
- package/front_end/models/workspace_diff/WorkspaceDiff.ts +1 -1
- package/front_end/panels/accessibility/AccessibilityNodeView.ts +1 -1
- package/front_end/panels/accessibility/AccessibilityStrings.ts +2 -2
- package/front_end/panels/ai_assistance/AiAssistancePanel.ts +1 -1
- package/front_end/panels/ai_assistance/ExportConversation.ts +1 -1
- package/front_end/panels/ai_assistance/ai_assistance-meta.ts +1 -1
- package/front_end/panels/ai_assistance/components/ChatMessage.ts +1 -1
- package/front_end/panels/application/AppManifestView.ts +4 -4
- package/front_end/panels/application/ApplicationPanelSidebar.ts +1 -2
- package/front_end/panels/application/CrashReportContextView.ts +1 -1
- package/front_end/panels/application/DOMStorageItemsView.ts +1 -1
- package/front_end/panels/application/DeviceBoundSessionsView.ts +4 -4
- package/front_end/panels/application/ExtensionStorageItemsView.ts +1 -1
- package/front_end/panels/application/FrameDetailsView.ts +1 -1
- package/front_end/panels/application/IndexedDBModel.ts +0 -10
- package/front_end/panels/application/IndexedDBViews.ts +240 -164
- package/front_end/panels/application/ServiceWorkerCacheTreeElement.ts +12 -2
- package/front_end/panels/application/ServiceWorkerCacheViews.ts +1 -1
- package/front_end/panels/application/SharedStorageModel.ts +0 -10
- package/front_end/panels/application/application.ts +2 -0
- package/front_end/panels/application/components/AdsView.ts +23 -0
- package/front_end/panels/application/components/BackForwardCacheView.ts +21 -5
- package/front_end/panels/application/components/CrashReportContextGrid.ts +1 -1
- package/front_end/panels/application/components/SharedStorageAccessGrid.ts +1 -1
- package/front_end/panels/application/components/TrustTokensView.ts +2 -2
- package/front_end/panels/application/components/adsView.css +21 -1
- package/front_end/panels/application/indexedDBViews.css +1 -1
- package/front_end/panels/application/preloading/PreloadingView.ts +1 -1
- package/front_end/panels/application/preloading/components/PreloadingDisabledInfobar.ts +2 -2
- package/front_end/panels/application/preloading/components/PreloadingString.ts +2 -2
- package/front_end/panels/application/preloading/components/UsedPreloadingView.ts +4 -4
- package/front_end/panels/autofill/AutofillView.ts +1 -1
- package/front_end/panels/common/AiCodeCompletionTeaser.ts +1 -1
- package/front_end/panels/common/ExtensionServer.ts +1 -1
- package/front_end/panels/console/ConsoleFilter.ts +1 -1
- package/front_end/panels/console/ConsoleSidebar.ts +1 -1
- package/front_end/panels/console/ConsoleView.ts +1 -1
- package/front_end/panels/console/ConsoleViewMessage.ts +1 -1
- package/front_end/panels/console/PromptBuilder.ts +1 -1
- package/front_end/panels/coverage/CoverageDecorationManager.ts +9 -1
- package/front_end/panels/coverage/CoverageModel.ts +1 -1
- package/front_end/panels/css_overview/CSSOverviewCompletedView.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesListView.ts +1 -1
- package/front_end/panels/developer_resources/DeveloperResourcesView.ts +1 -1
- package/front_end/panels/elements/AccessibilityTreeView.ts +38 -3
- package/front_end/panels/elements/AdoptedStyleSheetTreeElement.ts +1 -1
- package/front_end/panels/elements/ElementIssueUtils.ts +2 -2
- package/front_end/panels/elements/ElementsTreeElement.ts +10 -3
- package/front_end/panels/elements/StandaloneStylesContainer.ts +1 -1
- package/front_end/panels/elements/StylePropertiesSection.ts +1 -1
- package/front_end/panels/elements/StylePropertyTreeElement.ts +1 -1
- package/front_end/panels/elements/StylesAiCodeCompletionProvider.ts +1 -1
- package/front_end/panels/elements/StylesContainer.ts +1 -1
- package/front_end/panels/elements/StylesSidebarPane.ts +1 -1
- package/front_end/panels/elements/components/CSSPropertyDocsView.ts +1 -1
- package/front_end/panels/explain/components/ConsoleInsight.ts +2 -2
- package/front_end/panels/issues/AffectedLazyLoadImagesView.ts +76 -0
- package/front_end/panels/issues/AffectedResourcesView.ts +1 -1
- package/front_end/panels/issues/CorsIssueDetailsView.ts +1 -1
- package/front_end/panels/issues/IssueView.ts +2 -0
- package/front_end/panels/issues/issues.ts +2 -0
- package/front_end/panels/layer_viewer/Layers3DView.ts +1 -1
- package/front_end/panels/lighthouse/LighthouseController.ts +5 -0
- package/front_end/panels/lighthouse/LighthouseReportRenderer.ts +1 -1
- package/front_end/panels/network/BinaryResourceView.ts +1 -1
- package/front_end/panels/network/NetworkDataGridNode.ts +72 -8
- package/front_end/panels/network/NetworkLogView.ts +1 -1
- package/front_end/panels/network/NetworkLogViewColumns.ts +6 -6
- package/front_end/panels/network/NetworkPanel.ts +4 -4
- package/front_end/panels/network/NetworkSearchScope.ts +1 -1
- package/front_end/panels/network/RequestConditionsDrawer.ts +1 -1
- package/front_end/panels/network/RequestHTMLView.ts +1 -1
- package/front_end/panels/network/RequestInitiatorView.ts +24 -2
- package/front_end/panels/network/RequestPayloadView.ts +1 -1
- package/front_end/panels/network/RequestPreviewView.ts +1 -1
- package/front_end/panels/network/RequestResponseView.ts +1 -1
- package/front_end/panels/network/ResourceChunkView.ts +1 -1
- package/front_end/panels/network/ResourceDirectSocketChunkView.ts +1 -1
- package/front_end/panels/network/ResourceWebSocketFrameView.ts +1 -1
- package/front_end/panels/network/components/ResponseHeaderSection.ts +1 -1
- package/front_end/panels/network/forward/UIRequestLocation.ts +1 -1
- package/front_end/panels/network/network-meta.ts +3 -3
- package/front_end/panels/network/networkLogView.css +5 -0
- package/front_end/panels/network/requestInitiatorViewTree.css +5 -0
- package/front_end/panels/profiler/HeapProfileView.ts +200 -81
- package/front_end/panels/profiler/HeapSnapshotView.ts +1 -1
- package/front_end/panels/profiler/ProfileDataGrid.ts +12 -8
- package/front_end/panels/protocol_monitor/ProtocolMonitor.ts +1 -1
- package/front_end/panels/recorder/README.md +1 -2
- package/front_end/panels/recorder/RecorderPanel.ts +1861 -17
- package/front_end/panels/recorder/RecordingListView.ts +8 -37
- package/front_end/panels/recorder/RecordingView.ts +54 -27
- package/front_end/panels/recorder/SelectorPicker.ts +0 -13
- package/front_end/panels/recorder/StepEditor.ts +6 -14
- package/front_end/panels/recorder/StepView.ts +36 -105
- package/front_end/panels/recorder/recorder.ts +0 -2
- package/front_end/panels/search/SearchResultsPane.ts +1 -1
- package/front_end/panels/security/SecurityPanel.ts +3 -3
- package/front_end/panels/settings/AISettingsTab.ts +17 -4
- package/front_end/panels/settings/components/SyncSection.ts +4 -4
- package/front_end/panels/settings/emulation/components/UserAgentClientHintsForm.ts +3 -3
- package/front_end/panels/snippets/ScriptSnippetFileSystem.ts +1 -1
- package/front_end/panels/sources/BreakpointsView.ts +1 -1
- package/front_end/panels/sources/CoveragePlugin.ts +1 -1
- package/front_end/panels/sources/DebuggerPlugin.ts +4 -4
- package/front_end/panels/sources/FilteredUISourceCodeListProvider.ts +27 -3
- package/front_end/panels/sources/NavigatorView.ts +1 -1
- package/front_end/panels/sources/PersistenceActions.ts +1 -1
- package/front_end/panels/sources/SourcesNavigator.ts +1 -1
- package/front_end/panels/sources/SourcesSearchScope.ts +1 -1
- package/front_end/panels/sources/TabbedEditorContainer.ts +3 -3
- package/front_end/panels/sources/UISourceCodeFrame.ts +1 -1
- package/front_end/panels/sources/components/HeadersView.ts +1 -1
- package/front_end/panels/sources/filteredUISourceCodeListProvider.css +12 -1
- package/front_end/panels/sources/sources-meta.ts +1 -1
- package/front_end/panels/timeline/StatusDialog.ts +1 -1
- package/front_end/panels/timeline/TimelineController.ts +24 -3
- package/front_end/panels/timeline/TimelinePanel.ts +116 -25
- package/front_end/panels/timeline/TimelineSelectorStatsView.ts +2 -2
- package/front_end/panels/timeline/TimelineUIUtils.ts +1 -1
- package/front_end/panels/timeline/components/CWVMetrics.ts +1 -1
- package/front_end/panels/timeline/components/IgnoreListSetting.ts +1 -1
- package/front_end/panels/timeline/overlays/components/EntryLabelOverlay.ts +2 -2
- package/front_end/panels/timeline/timeline-meta.ts +13 -0
- package/front_end/services/tracing/TracingManager.ts +27 -2
- package/front_end/third_party/chromium/README.chromium +1 -1
- package/front_end/third_party/lighthouse/README.chromium +2 -2
- package/front_end/third_party/lighthouse/lighthouse-dt-bundle.js +1418 -1413
- package/front_end/third_party/lighthouse/locales/en-US.json +12 -6
- package/front_end/third_party/lighthouse/locales/en-XL.json +12 -6
- package/front_end/third_party/lighthouse/report-assets/report-generator.mjs +1 -1
- package/front_end/third_party/puppeteer/puppeteer.ts +20 -1
- package/front_end/ui/components/highlighting/HighlightElement.ts +4 -1
- package/front_end/ui/components/highlighting/HighlightManager.ts +1 -1
- package/front_end/ui/components/highlighting/MarkupHighlight.ts +1 -1
- package/front_end/ui/components/markdown_view/MarkdownView.ts +46 -2
- package/front_end/ui/components/markdown_view/markdownView.css +23 -0
- package/front_end/ui/components/spinners/Spinner.ts +29 -32
- package/front_end/ui/components/spinners/spinner.css +32 -84
- package/front_end/ui/components/text_editor/config.ts +1 -1
- package/front_end/ui/components/tree_outline/TreeOutline.ts +7 -1
- package/front_end/ui/legacy/Infobar.ts +1 -1
- package/front_end/ui/legacy/InspectorView.ts +12 -7
- package/front_end/ui/legacy/SuggestBox.ts +1 -1
- package/front_end/ui/legacy/TextPrompt.ts +1 -1
- package/front_end/ui/legacy/Toolbar.ts +5 -2
- package/front_end/ui/legacy/Treeoutline.ts +40 -13
- package/front_end/ui/legacy/UIUtils.ts +25 -10
- package/front_end/ui/legacy/Widget.ts +17 -10
- package/front_end/ui/legacy/components/color_picker/Spectrum.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/DataGridElement.ts +37 -8
- package/front_end/ui/legacy/components/data_grid/ViewportDataGrid.ts +1 -1
- package/front_end/ui/legacy/components/data_grid/dataGrid.css +1 -1
- package/front_end/ui/legacy/components/inline_editor/AnimationTimingUI.ts +27 -13
- package/front_end/ui/legacy/components/inline_editor/BezierEditor.ts +5 -2
- package/front_end/ui/legacy/components/inline_editor/CSSLinearEasingModel.ts +23 -0
- package/front_end/ui/legacy/components/object_ui/ObjectPropertiesSection.ts +223 -121
- package/front_end/ui/legacy/components/object_ui/RemoteObjectPreviewFormatter.ts +1 -1
- package/front_end/ui/legacy/components/object_ui/objectValue.css +2 -1
- package/front_end/ui/legacy/components/quick_open/FilteredListWidget.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/BinaryResourceViewFactory.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/FontView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/ImageView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/JSONView.ts +105 -115
- package/front_end/ui/legacy/components/source_frame/PreviewFactory.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/ResourceSourceFrame.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/SourceFrame.ts +3 -3
- package/front_end/ui/legacy/components/source_frame/StreamingContentHexView.ts +1 -1
- package/front_end/ui/legacy/components/source_frame/XMLView.ts +5 -1
- package/front_end/ui/legacy/components/source_frame/jsonView.css +4 -0
- package/front_end/ui/legacy/components/utils/Linkifier.ts +1 -1
- package/front_end/ui/legacy/inspectorCommon.css +10 -6
- package/front_end/ui/lit/lit.ts +1 -0
- package/front_end/ui/lit/render.ts +44 -10
- package/front_end/ui/lit/strip-whitespace.ts +23 -2
- package/front_end/ui/settings/SettingUIRegistration.ts +105 -0
- package/front_end/ui/settings/settings.ts +9 -0
- package/front_end/ui/visual_logging/KnownContextValues.ts +13 -0
- package/mcp/mcp.ts +1 -0
- package/package.json +1 -1
- package/front_end/panels/recorder/RecorderController.ts +0 -1759
- /package/.agents/skills/{verification → devtools-verification}/SKILL.md +0 -0
- /package/front_end/{models → core}/text_utils/CodeMirrorUtils.ts +0 -0
- /package/front_end/{models → core}/text_utils/ContentData.ts +0 -0
- /package/front_end/{models → core}/text_utils/Text.ts +0 -0
- /package/front_end/{models → core}/text_utils/TextCursor.ts +0 -0
- /package/front_end/{models → core}/text_utils/TextUtils.snapshot.txt +0 -0
- /package/front_end/panels/recorder/{recorderController.css → recorderPanel.css} +0 -0
|
@@ -943,7 +943,6 @@ export namespace Audits {
|
|
|
943
943
|
}
|
|
944
944
|
|
|
945
945
|
export const enum MixedContentResourceType {
|
|
946
|
-
AttributionSrc = 'AttributionSrc',
|
|
947
946
|
Audio = 'Audio',
|
|
948
947
|
Beacon = 'Beacon',
|
|
949
948
|
CSPReport = 'CSPReport',
|
|
@@ -2507,11 +2506,6 @@ export namespace Browser {
|
|
|
2507
2506
|
buckets: Bucket[];
|
|
2508
2507
|
}
|
|
2509
2508
|
|
|
2510
|
-
export const enum PrivacySandboxAPI {
|
|
2511
|
-
BiddingAndAuctionServices = 'BiddingAndAuctionServices',
|
|
2512
|
-
TrustedKeyValue = 'TrustedKeyValue',
|
|
2513
|
-
}
|
|
2514
|
-
|
|
2515
2509
|
export interface SetPermissionRequest {
|
|
2516
2510
|
/**
|
|
2517
2511
|
* Descriptor of permission to override.
|
|
@@ -2743,17 +2737,6 @@ export namespace Browser {
|
|
|
2743
2737
|
url: string;
|
|
2744
2738
|
}
|
|
2745
2739
|
|
|
2746
|
-
export interface AddPrivacySandboxCoordinatorKeyConfigRequest {
|
|
2747
|
-
api: PrivacySandboxAPI;
|
|
2748
|
-
coordinatorOrigin: string;
|
|
2749
|
-
keyConfig: string;
|
|
2750
|
-
/**
|
|
2751
|
-
* BrowserContext to perform the action in. When omitted, default browser
|
|
2752
|
-
* context is used.
|
|
2753
|
-
*/
|
|
2754
|
-
browserContextId?: BrowserContextID;
|
|
2755
|
-
}
|
|
2756
|
-
|
|
2757
2740
|
/**
|
|
2758
2741
|
* Fired when page is about to start a download.
|
|
2759
2742
|
*/
|
|
@@ -18317,54 +18300,12 @@ export namespace Storage {
|
|
|
18317
18300
|
count: number;
|
|
18318
18301
|
}
|
|
18319
18302
|
|
|
18320
|
-
/**
|
|
18321
|
-
* Protected audience interest group auction identifier.
|
|
18322
|
-
*/
|
|
18323
|
-
export type InterestGroupAuctionId = OpaqueIdentifier<string, 'Protocol.Storage.InterestGroupAuctionId'>;
|
|
18324
|
-
|
|
18325
|
-
/**
|
|
18326
|
-
* Enum of interest group access types.
|
|
18327
|
-
*/
|
|
18328
|
-
export const enum InterestGroupAccessType {
|
|
18329
|
-
Join = 'join',
|
|
18330
|
-
Leave = 'leave',
|
|
18331
|
-
Update = 'update',
|
|
18332
|
-
Loaded = 'loaded',
|
|
18333
|
-
Bid = 'bid',
|
|
18334
|
-
Win = 'win',
|
|
18335
|
-
AdditionalBid = 'additionalBid',
|
|
18336
|
-
AdditionalBidWin = 'additionalBidWin',
|
|
18337
|
-
TopLevelBid = 'topLevelBid',
|
|
18338
|
-
TopLevelAdditionalBid = 'topLevelAdditionalBid',
|
|
18339
|
-
Clear = 'clear',
|
|
18340
|
-
}
|
|
18341
|
-
|
|
18342
|
-
/**
|
|
18343
|
-
* Enum of auction events.
|
|
18344
|
-
*/
|
|
18345
|
-
export const enum InterestGroupAuctionEventType {
|
|
18346
|
-
Started = 'started',
|
|
18347
|
-
ConfigResolved = 'configResolved',
|
|
18348
|
-
}
|
|
18349
|
-
|
|
18350
|
-
/**
|
|
18351
|
-
* Enum of network fetches auctions can do.
|
|
18352
|
-
*/
|
|
18353
|
-
export const enum InterestGroupAuctionFetchType {
|
|
18354
|
-
BidderJs = 'bidderJs',
|
|
18355
|
-
BidderWasm = 'bidderWasm',
|
|
18356
|
-
SellerJs = 'sellerJs',
|
|
18357
|
-
BidderTrustedSignals = 'bidderTrustedSignals',
|
|
18358
|
-
SellerTrustedSignals = 'sellerTrustedSignals',
|
|
18359
|
-
}
|
|
18360
|
-
|
|
18361
18303
|
/**
|
|
18362
18304
|
* Enum of shared storage access scopes.
|
|
18363
18305
|
*/
|
|
18364
18306
|
export const enum SharedStorageAccessScope {
|
|
18365
18307
|
Window = 'window',
|
|
18366
18308
|
SharedStorageWorklet = 'sharedStorageWorklet',
|
|
18367
|
-
ProtectedAudienceWorklet = 'protectedAudienceWorklet',
|
|
18368
18309
|
Header = 'header',
|
|
18369
18310
|
}
|
|
18370
18311
|
|
|
@@ -18797,29 +18738,6 @@ export namespace Storage {
|
|
|
18797
18738
|
didDeleteTokens: boolean;
|
|
18798
18739
|
}
|
|
18799
18740
|
|
|
18800
|
-
export interface GetInterestGroupDetailsRequest {
|
|
18801
|
-
ownerOrigin: string;
|
|
18802
|
-
name: string;
|
|
18803
|
-
}
|
|
18804
|
-
|
|
18805
|
-
export interface GetInterestGroupDetailsResponse extends ProtocolResponseWithError {
|
|
18806
|
-
/**
|
|
18807
|
-
* This largely corresponds to:
|
|
18808
|
-
* https://wicg.github.io/turtledove/#dictdef-generatebidinterestgroup
|
|
18809
|
-
* but has absolute expirationTime instead of relative lifetimeMs and
|
|
18810
|
-
* also adds joiningOrigin.
|
|
18811
|
-
*/
|
|
18812
|
-
details: any;
|
|
18813
|
-
}
|
|
18814
|
-
|
|
18815
|
-
export interface SetInterestGroupTrackingRequest {
|
|
18816
|
-
enable: boolean;
|
|
18817
|
-
}
|
|
18818
|
-
|
|
18819
|
-
export interface SetInterestGroupAuctionTrackingRequest {
|
|
18820
|
-
enable: boolean;
|
|
18821
|
-
}
|
|
18822
|
-
|
|
18823
18741
|
export interface GetSharedStorageMetadataRequest {
|
|
18824
18742
|
ownerOrigin: string;
|
|
18825
18743
|
}
|
|
@@ -18881,12 +18799,6 @@ export namespace Storage {
|
|
|
18881
18799
|
sets: RelatedWebsiteSet[];
|
|
18882
18800
|
}
|
|
18883
18801
|
|
|
18884
|
-
export interface SetProtectedAudienceKAnonymityRequest {
|
|
18885
|
-
owner: string;
|
|
18886
|
-
name: string;
|
|
18887
|
-
hashes: binary[];
|
|
18888
|
-
}
|
|
18889
|
-
|
|
18890
18802
|
/**
|
|
18891
18803
|
* A cache's contents have been modified.
|
|
18892
18804
|
*/
|
|
@@ -18971,66 +18883,6 @@ export namespace Storage {
|
|
|
18971
18883
|
bucketId: string;
|
|
18972
18884
|
}
|
|
18973
18885
|
|
|
18974
|
-
/**
|
|
18975
|
-
* One of the interest groups was accessed. Note that these events are global
|
|
18976
|
-
* to all targets sharing an interest group store.
|
|
18977
|
-
*/
|
|
18978
|
-
export interface InterestGroupAccessedEvent {
|
|
18979
|
-
accessTime: Network.TimeSinceEpoch;
|
|
18980
|
-
type: InterestGroupAccessType;
|
|
18981
|
-
ownerOrigin: string;
|
|
18982
|
-
name: string;
|
|
18983
|
-
/**
|
|
18984
|
-
* For topLevelBid/topLevelAdditionalBid, and when appropriate,
|
|
18985
|
-
* win and additionalBidWin
|
|
18986
|
-
*/
|
|
18987
|
-
componentSellerOrigin?: string;
|
|
18988
|
-
/**
|
|
18989
|
-
* For bid or somethingBid event, if done locally and not on a server.
|
|
18990
|
-
*/
|
|
18991
|
-
bid?: number;
|
|
18992
|
-
bidCurrency?: string;
|
|
18993
|
-
/**
|
|
18994
|
-
* For non-global events --- links to interestGroupAuctionEvent
|
|
18995
|
-
*/
|
|
18996
|
-
uniqueAuctionId?: InterestGroupAuctionId;
|
|
18997
|
-
}
|
|
18998
|
-
|
|
18999
|
-
/**
|
|
19000
|
-
* An auction involving interest groups is taking place. These events are
|
|
19001
|
-
* target-specific.
|
|
19002
|
-
*/
|
|
19003
|
-
export interface InterestGroupAuctionEventOccurredEvent {
|
|
19004
|
-
eventTime: Network.TimeSinceEpoch;
|
|
19005
|
-
type: InterestGroupAuctionEventType;
|
|
19006
|
-
uniqueAuctionId: InterestGroupAuctionId;
|
|
19007
|
-
/**
|
|
19008
|
-
* Set for child auctions.
|
|
19009
|
-
*/
|
|
19010
|
-
parentAuctionId?: InterestGroupAuctionId;
|
|
19011
|
-
/**
|
|
19012
|
-
* Set for started and configResolved
|
|
19013
|
-
*/
|
|
19014
|
-
auctionConfig?: any;
|
|
19015
|
-
}
|
|
19016
|
-
|
|
19017
|
-
/**
|
|
19018
|
-
* Specifies which auctions a particular network fetch may be related to, and
|
|
19019
|
-
* in what role. Note that it is not ordered with respect to
|
|
19020
|
-
* Network.requestWillBeSent (but will happen before loadingFinished
|
|
19021
|
-
* loadingFailed).
|
|
19022
|
-
*/
|
|
19023
|
-
export interface InterestGroupAuctionNetworkRequestCreatedEvent {
|
|
19024
|
-
type: InterestGroupAuctionFetchType;
|
|
19025
|
-
requestId: Network.RequestId;
|
|
19026
|
-
/**
|
|
19027
|
-
* This is the set of the auctions using the worklet that issued this
|
|
19028
|
-
* request. In the case of trusted signals, it's possible that only some of
|
|
19029
|
-
* them actually care about the keys being queried.
|
|
19030
|
-
*/
|
|
19031
|
-
auctions: InterestGroupAuctionId[];
|
|
19032
|
-
}
|
|
19033
|
-
|
|
19034
18886
|
/**
|
|
19035
18887
|
* Shared storage was accessed by the associated page.
|
|
19036
18888
|
* The following parameters are included in all events.
|
|
@@ -2,9 +2,9 @@
|
|
|
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 * as TextUtils from '../../core/text_utils/text_utils.js';
|
|
5
6
|
import * as Diff from '../../third_party/diff/diff.js';
|
|
6
7
|
import * as Persistence from '../persistence/persistence.js';
|
|
7
|
-
import * as TextUtils from '../text_utils/text_utils.js';
|
|
8
8
|
import type * as Workspace from '../workspace/workspace.js';
|
|
9
9
|
|
|
10
10
|
import {debugLog} from './debug.js';
|
|
@@ -3,7 +3,6 @@
|
|
|
3
3
|
// found in the LICENSE file.
|
|
4
4
|
|
|
5
5
|
import * as Host from '../../core/host/host.js';
|
|
6
|
-
import * as SDK from '../../core/sdk/sdk.js';
|
|
7
6
|
import type * as LHModel from '../lighthouse/lighthouse.js';
|
|
8
7
|
|
|
9
8
|
import {
|
|
@@ -68,7 +67,7 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
68
67
|
readonly clientFeature = Host.AidaClient.ClientFeature.CHROME_DEVTOOLS_V2_AGENT;
|
|
69
68
|
readonly userTier = 'TESTERS';
|
|
70
69
|
|
|
71
|
-
#changes
|
|
70
|
+
#changes: ChangeManager;
|
|
72
71
|
#execJs: typeof executeJsCode;
|
|
73
72
|
readonly #allowedOrigin?: () => AllowedOriginResult;
|
|
74
73
|
readonly #lighthouseRecording?:
|
|
@@ -83,6 +82,7 @@ export class AiAgent2 extends AiAgent<unknown> {
|
|
|
83
82
|
|
|
84
83
|
constructor(opts: AiAgent2Options) {
|
|
85
84
|
super(opts);
|
|
85
|
+
this.#changes = new ChangeManager(opts.targetManager);
|
|
86
86
|
this.#lighthouseRecording = opts.lighthouseRecording;
|
|
87
87
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
88
88
|
this.#allowedOrigin = opts.allowedOrigin;
|
|
@@ -231,7 +231,7 @@ User query: ${enhancedQuery}`;
|
|
|
231
231
|
createExtensionScope: this.#createExtensionScope.bind(this),
|
|
232
232
|
execJs: this.#execJs,
|
|
233
233
|
getExecutionContextNode: () => this.context instanceof DOMNodeContext ? this.context.getItem() : null,
|
|
234
|
-
getTarget: () =>
|
|
234
|
+
getTarget: () => this.targetManager.primaryPageTarget(),
|
|
235
235
|
getEstablishedOrigin: () => this.#getConversationOrigin(),
|
|
236
236
|
lighthouseRecording: this.#lighthouseRecording,
|
|
237
237
|
};
|
|
@@ -72,6 +72,8 @@ export interface AiConversationOptions {
|
|
|
72
72
|
onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>;
|
|
73
73
|
networkTimeCalculator?: NetworkTimeCalculator.NetworkTransferTimeCalculator;
|
|
74
74
|
lighthouseRecording?: (overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
75
|
+
aiHistoryStorage?: AiHistoryStorage;
|
|
76
|
+
targetManager?: SDK.TargetManager.TargetManager;
|
|
75
77
|
}
|
|
76
78
|
|
|
77
79
|
export class AiConversation {
|
|
@@ -110,6 +112,8 @@ export class AiConversation {
|
|
|
110
112
|
#lighthouseRecording?: (overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
111
113
|
#onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>;
|
|
112
114
|
#networkTimeCalculator?: NetworkTimeCalculator.NetworkTransferTimeCalculator;
|
|
115
|
+
readonly #aiHistoryStorage: AiHistoryStorage;
|
|
116
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
113
117
|
|
|
114
118
|
constructor(options: AiConversationOptions) {
|
|
115
119
|
const {
|
|
@@ -123,6 +127,8 @@ export class AiConversation {
|
|
|
123
127
|
onInspectElement,
|
|
124
128
|
networkTimeCalculator,
|
|
125
129
|
lighthouseRecording,
|
|
130
|
+
aiHistoryStorage = AiHistoryStorage.instance(),
|
|
131
|
+
targetManager = SDK.TargetManager.TargetManager.instance(),
|
|
126
132
|
} = options;
|
|
127
133
|
this.#changeManager = changeManager;
|
|
128
134
|
this.#aidaClient = aidaClient;
|
|
@@ -130,6 +136,8 @@ export class AiConversation {
|
|
|
130
136
|
this.#onInspectElement = onInspectElement;
|
|
131
137
|
this.#networkTimeCalculator = networkTimeCalculator;
|
|
132
138
|
this.#lighthouseRecording = lighthouseRecording;
|
|
139
|
+
this.#aiHistoryStorage = aiHistoryStorage;
|
|
140
|
+
this.#targetManager = targetManager;
|
|
133
141
|
|
|
134
142
|
this.id = id;
|
|
135
143
|
this.#isReadOnly = isReadOnly;
|
|
@@ -208,7 +216,7 @@ export class AiConversation {
|
|
|
208
216
|
}
|
|
209
217
|
|
|
210
218
|
#reconstructHistory(historyWithoutImages: ResponseData[]): ResponseData[] {
|
|
211
|
-
const imageHistory =
|
|
219
|
+
const imageHistory = this.#aiHistoryStorage.getImageHistory();
|
|
212
220
|
if (imageHistory && imageHistory.length > 0) {
|
|
213
221
|
const history: ResponseData[] = [];
|
|
214
222
|
for (const data of historyWithoutImages) {
|
|
@@ -286,12 +294,12 @@ export class AiConversation {
|
|
|
286
294
|
|
|
287
295
|
async addHistoryItem(item: ResponseData): Promise<void> {
|
|
288
296
|
this.history.push(item);
|
|
289
|
-
await
|
|
297
|
+
await this.#aiHistoryStorage.upsertHistoryEntry(this.serialize());
|
|
290
298
|
if (item.type === ResponseType.USER_QUERY) {
|
|
291
|
-
void
|
|
299
|
+
void this.#aiHistoryStorage.addRecentPrompt(item.query);
|
|
292
300
|
if (item.imageId && item.imageInput && 'inlineData' in item.imageInput) {
|
|
293
301
|
const inlineData = item.imageInput.inlineData;
|
|
294
|
-
await
|
|
302
|
+
await this.#aiHistoryStorage.upsertImage({
|
|
295
303
|
id: item.imageId,
|
|
296
304
|
data: inlineData.data,
|
|
297
305
|
mimeType: inlineData.mimeType,
|
|
@@ -361,6 +369,7 @@ export class AiConversation {
|
|
|
361
369
|
lighthouseRecording: this.#lighthouseRecording,
|
|
362
370
|
allowedOrigin: this.allowedOrigin,
|
|
363
371
|
history,
|
|
372
|
+
targetManager: this.#targetManager,
|
|
364
373
|
};
|
|
365
374
|
|
|
366
375
|
this.#agent = Root.Runtime.hostConfig.devToolsAiV2Architecture?.enabled ? new AiAgent2(options) :
|
|
@@ -397,18 +406,18 @@ export class AiConversation {
|
|
|
397
406
|
} = {},
|
|
398
407
|
): AsyncGenerator<ResponseData, void, void> {
|
|
399
408
|
this.#navigationOccurredDuringRun = false;
|
|
400
|
-
const originAtRunStart = getPrimaryPageOrigin();
|
|
409
|
+
const originAtRunStart = getPrimaryPageOrigin(this.#targetManager);
|
|
401
410
|
const listener = (): void => {
|
|
402
411
|
// If an unexpected navigation to a different origin occurred
|
|
403
412
|
// during processing the user's request, we don't want to allow
|
|
404
413
|
// the agent to run any function calls and retrieve data from the new origin.
|
|
405
414
|
// Performance agent and accessibility agent navigate to 'about://' or 'chrome://terms'
|
|
406
|
-
const newOrigin = getPrimaryPageOrigin();
|
|
415
|
+
const newOrigin = getPrimaryPageOrigin(this.#targetManager);
|
|
407
416
|
if (originAtRunStart !== newOrigin && newOrigin && !ALLOWED_PAGE_NAVIGATIONS.includes(newOrigin)) {
|
|
408
417
|
this.#navigationOccurredDuringRun = true;
|
|
409
418
|
}
|
|
410
419
|
};
|
|
411
|
-
const targetManager =
|
|
420
|
+
const targetManager = this.#targetManager;
|
|
412
421
|
targetManager.addModelListener(SDK.ResourceTreeModel.ResourceTreeModel,
|
|
413
422
|
SDK.ResourceTreeModel.Events.PrimaryPageChanged, listener, this);
|
|
414
423
|
|
|
@@ -524,7 +533,7 @@ export class AiConversation {
|
|
|
524
533
|
if (this.#origin) {
|
|
525
534
|
return {origin: this.#origin};
|
|
526
535
|
}
|
|
527
|
-
this.#origin = getPrimaryPageOrigin();
|
|
536
|
+
this.#origin = getPrimaryPageOrigin(this.#targetManager);
|
|
528
537
|
|
|
529
538
|
return {origin: this.#origin};
|
|
530
539
|
};
|
|
@@ -538,8 +547,10 @@ function isAiAssistanceContextSelectionAgentEnabled(): boolean {
|
|
|
538
547
|
return Boolean(Root.Runtime.hostConfig.devToolsAiAssistanceContextSelectionAgent?.enabled);
|
|
539
548
|
}
|
|
540
549
|
|
|
541
|
-
function getPrimaryPageOrigin(
|
|
542
|
-
|
|
550
|
+
function getPrimaryPageOrigin(
|
|
551
|
+
targetManager: SDK.TargetManager.TargetManager,
|
|
552
|
+
): Platform.DevToolsPath.UrlString|undefined {
|
|
553
|
+
const target = targetManager.primaryPageTarget();
|
|
543
554
|
const inspectedURL = target?.inspectedURL();
|
|
544
555
|
return inspectedURL ? new Common.ParsedURL.ParsedURL(inspectedURL).securityOrigin() : undefined;
|
|
545
556
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
// found in the LICENSE file.
|
|
5
5
|
|
|
6
6
|
import * as Common from '../../core/common/common.js';
|
|
7
|
+
import * as Root from '../../core/root/root.js';
|
|
7
8
|
|
|
8
9
|
import {ResponseType, type SerializedResponseData} from './agents/AiAgent.js';
|
|
9
10
|
|
|
@@ -33,8 +34,6 @@ export interface SerializedImage {
|
|
|
33
34
|
data: string;
|
|
34
35
|
}
|
|
35
36
|
|
|
36
|
-
let instance: AiHistoryStorage|null = null;
|
|
37
|
-
|
|
38
37
|
const DEFAULT_MAX_STORAGE_SIZE = 50 * 1024 * 1024;
|
|
39
38
|
export const MAX_RECENT_PROMPTS_COUNT = 20;
|
|
40
39
|
export const MAX_CONVERSATIONS_COUNT = 50;
|
|
@@ -55,14 +54,17 @@ export class AiHistoryStorage extends Common.ObjectWrapper.ObjectWrapper<EventTy
|
|
|
55
54
|
#mutex = new Common.Mutex.Mutex();
|
|
56
55
|
#maxStorageSize: number;
|
|
57
56
|
|
|
58
|
-
constructor(
|
|
57
|
+
constructor(
|
|
58
|
+
settings: Common.Settings.Settings = Common.Settings.Settings.instance(),
|
|
59
|
+
maxStorageSize = DEFAULT_MAX_STORAGE_SIZE,
|
|
60
|
+
) {
|
|
59
61
|
super();
|
|
60
|
-
this.#historySetting =
|
|
61
|
-
this.#imageHistorySettings =
|
|
62
|
+
this.#historySetting = settings.createSetting('ai-assistance-history-entries', []);
|
|
63
|
+
this.#imageHistorySettings = settings.createSetting(
|
|
62
64
|
'ai-assistance-history-images',
|
|
63
65
|
[],
|
|
64
66
|
);
|
|
65
|
-
this.#recentPromptsSetting =
|
|
67
|
+
this.#recentPromptsSetting = settings.createSetting('ai-assistance-recent-prompts', []);
|
|
66
68
|
this.#maxStorageSize = maxStorageSize;
|
|
67
69
|
}
|
|
68
70
|
|
|
@@ -225,12 +227,21 @@ export class AiHistoryStorage extends Common.ObjectWrapper.ObjectWrapper<EventTy
|
|
|
225
227
|
opts: {
|
|
226
228
|
forceNew: boolean,
|
|
227
229
|
maxStorageSize?: number,
|
|
230
|
+
settings?: Common.Settings.Settings,
|
|
228
231
|
} = {forceNew: false, maxStorageSize: DEFAULT_MAX_STORAGE_SIZE},
|
|
229
232
|
): AiHistoryStorage {
|
|
230
|
-
const {forceNew, maxStorageSize} = opts;
|
|
231
|
-
if (!
|
|
232
|
-
|
|
233
|
+
const {forceNew, maxStorageSize, settings} = opts;
|
|
234
|
+
if (!Root.DevToolsContext.globalInstance().has(AiHistoryStorage) || forceNew) {
|
|
235
|
+
Root.DevToolsContext.globalInstance().set(AiHistoryStorage,
|
|
236
|
+
new AiHistoryStorage(
|
|
237
|
+
settings ?? Common.Settings.Settings.instance(),
|
|
238
|
+
maxStorageSize,
|
|
239
|
+
));
|
|
233
240
|
}
|
|
234
|
-
return
|
|
241
|
+
return Root.DevToolsContext.globalInstance().get(AiHistoryStorage);
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
static removeInstance(): void {
|
|
245
|
+
Root.DevToolsContext.globalInstance().delete(AiHistoryStorage);
|
|
235
246
|
}
|
|
236
247
|
}
|
|
@@ -36,8 +36,8 @@ export class ChangeManager {
|
|
|
36
36
|
readonly #stylesheetChanges = new Map<Protocol.DOM.StyleSheetId, Change[]>();
|
|
37
37
|
readonly #backupStylesheetChanges = new Map<Protocol.DOM.StyleSheetId, Change[]>();
|
|
38
38
|
|
|
39
|
-
constructor() {
|
|
40
|
-
|
|
39
|
+
constructor(targetManager: SDK.TargetManager.TargetManager = SDK.TargetManager.TargetManager.instance()) {
|
|
40
|
+
targetManager.addModelListener(
|
|
41
41
|
SDK.ResourceTreeModel.ResourceTreeModel,
|
|
42
42
|
SDK.ResourceTreeModel.Events.PrimaryPageChanged,
|
|
43
43
|
this.clear,
|
|
@@ -237,7 +237,11 @@ export class ExtensionScope {
|
|
|
237
237
|
return node.localName() || node.nodeName().toLowerCase();
|
|
238
238
|
}
|
|
239
239
|
|
|
240
|
-
static getSourceLocation(
|
|
240
|
+
static getSourceLocation(
|
|
241
|
+
styleRule: SDK.CSSRule.CSSStyleRule,
|
|
242
|
+
cssWorkspaceBinding: Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding =
|
|
243
|
+
Bindings.CSSWorkspaceBinding.CSSWorkspaceBinding.instance(),
|
|
244
|
+
): string|undefined {
|
|
241
245
|
const styleSheetHeader = styleRule.header;
|
|
242
246
|
if (!styleSheetHeader) {
|
|
243
247
|
return;
|
|
@@ -250,7 +254,7 @@ export class ExtensionScope {
|
|
|
250
254
|
const lineNumber = styleSheetHeader.lineNumberInSource(range.startLine);
|
|
251
255
|
const columnNumber = styleSheetHeader.columnNumberInSource(range.startLine, range.startColumn);
|
|
252
256
|
const location = new SDK.CSSModel.CSSLocation(styleSheetHeader, lineNumber, columnNumber);
|
|
253
|
-
const uiLocation =
|
|
257
|
+
const uiLocation = cssWorkspaceBinding.rawLocationToUILocation(location);
|
|
254
258
|
return uiLocation?.linkText(/* skipTrim= */ true, /* showColumnNumber= */ true);
|
|
255
259
|
}
|
|
256
260
|
|
|
@@ -97,7 +97,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
97
97
|
constructor(opts: ExecuteJsAgentOptions) {
|
|
98
98
|
super(opts);
|
|
99
99
|
this.#lighthouseRecording = opts.lighthouseRecording;
|
|
100
|
-
this.#changes = opts.changeManager || new ChangeManager();
|
|
100
|
+
this.#changes = opts.changeManager || new ChangeManager(opts.targetManager);
|
|
101
101
|
this.#execJs = opts.execJs ?? executeJsCode;
|
|
102
102
|
this.#createExtensionScope = opts.createExtensionScope ?? ((changes: ChangeManager) => {
|
|
103
103
|
return new ExtensionScope(changes, this.sessionId, this.#getDocumentBodyNode());
|
|
@@ -125,7 +125,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
protected override async preRun(): Promise<void> {
|
|
128
|
-
const target =
|
|
128
|
+
const target = this.targetManager.primaryPageTarget();
|
|
129
129
|
const domModel = target?.model(SDK.DOMModel.DOMModel);
|
|
130
130
|
// We need to ensure the document is requested so that #getDocumentBodyNode()
|
|
131
131
|
// can return a valid node for the JavaScript execution context.
|
|
@@ -144,10 +144,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
144
144
|
* so that the AI has a valid $0 to start with.
|
|
145
145
|
*/
|
|
146
146
|
#getDocumentBodyNode(): SDK.DOMModel.DOMNode|null {
|
|
147
|
-
const document = SDK.
|
|
148
|
-
.primaryPageTarget()
|
|
149
|
-
?.model(SDK.DOMModel.DOMModel)
|
|
150
|
-
?.existingDocument();
|
|
147
|
+
const document = this.targetManager.primaryPageTarget()?.model(SDK.DOMModel.DOMModel)?.existingDocument();
|
|
151
148
|
return document?.body ?? document ?? null;
|
|
152
149
|
}
|
|
153
150
|
|
|
@@ -168,7 +165,7 @@ export class AccessibilityAgent extends AiAgent<LHModel.ReporterTypes.ReportJSON
|
|
|
168
165
|
}
|
|
169
166
|
|
|
170
167
|
async #resolvePathToNode(path: string): Promise<SDK.DOMModel.DOMNode|null> {
|
|
171
|
-
const target =
|
|
168
|
+
const target = this.targetManager.primaryPageTarget();
|
|
172
169
|
if (!target) {
|
|
173
170
|
return null;
|
|
174
171
|
}
|
|
@@ -6,10 +6,10 @@ import * as Host from '../../../core/host/host.js';
|
|
|
6
6
|
import type {UrlString} from '../../../core/platform/DevToolsPath.js';
|
|
7
7
|
import type * as Platform from '../../../core/platform/platform.js';
|
|
8
8
|
import * as Root from '../../../core/root/root.js';
|
|
9
|
-
import
|
|
9
|
+
import * as SDK from '../../../core/sdk/sdk.js';
|
|
10
|
+
import type * as TextUtils from '../../../core/text_utils/text_utils.js';
|
|
10
11
|
import type * as Protocol from '../../../generated/protocol.js';
|
|
11
12
|
import type * as LHModel from '../../lighthouse/lighthouse.js';
|
|
12
|
-
import type * as TextUtils from '../../text_utils/text_utils.js';
|
|
13
13
|
import type * as Trace from '../../trace/trace.js';
|
|
14
14
|
import type * as Workspace from '../../workspace/workspace.js';
|
|
15
15
|
import {areOriginsEquivalent, extractContextOrigin, isOpaqueOrigin} from '../AiOrigins.js';
|
|
@@ -166,6 +166,7 @@ export interface AgentOptions {
|
|
|
166
166
|
history?: Host.AidaClient.Content[];
|
|
167
167
|
allowedOrigin?: () => AllowedOriginResult;
|
|
168
168
|
lighthouseRecording?: (overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
169
|
+
targetManager?: SDK.TargetManager.TargetManager;
|
|
169
170
|
}
|
|
170
171
|
|
|
171
172
|
export interface ParsedAnswer {
|
|
@@ -485,6 +486,7 @@ export abstract class AiAgent<T> {
|
|
|
485
486
|
readonly confirmSideEffect: typeof Promise.withResolvers;
|
|
486
487
|
readonly #functionDeclarations = new Map<string, FunctionDeclaration<Record<string, unknown>, unknown>>();
|
|
487
488
|
readonly #allowedOrigin?: () => AllowedOriginResult;
|
|
489
|
+
readonly #targetManager: SDK.TargetManager.TargetManager;
|
|
488
490
|
|
|
489
491
|
/**
|
|
490
492
|
* Used in the debug mode and evals.
|
|
@@ -518,6 +520,7 @@ export abstract class AiAgent<T> {
|
|
|
518
520
|
this.confirmSideEffect = opts.confirmSideEffectForTest ?? (() => Promise.withResolvers());
|
|
519
521
|
this.#history = opts.history ?? [];
|
|
520
522
|
this.#allowedOrigin = opts.allowedOrigin;
|
|
523
|
+
this.#targetManager = opts.targetManager ?? SDK.TargetManager.TargetManager.instance();
|
|
521
524
|
}
|
|
522
525
|
|
|
523
526
|
async enhanceQuery(query: string, selected: ConversationContext<T>|null,
|
|
@@ -534,6 +537,10 @@ export abstract class AiAgent<T> {
|
|
|
534
537
|
return [...this.#history];
|
|
535
538
|
}
|
|
536
539
|
|
|
540
|
+
get targetManager(): SDK.TargetManager.TargetManager {
|
|
541
|
+
return this.#targetManager;
|
|
542
|
+
}
|
|
543
|
+
|
|
537
544
|
/**
|
|
538
545
|
* Add a fact which will be sent for any subsequent requests.
|
|
539
546
|
* Returns the new list of all facts.
|
|
@@ -74,6 +74,14 @@ Your role is to understand the user's query, identify the appropriate specialize
|
|
|
74
74
|
* The only available types are \`#req\` for network request and \`#file\` for source files. Only use ID inside the link, never ask about user selecting by ID.
|
|
75
75
|
`;
|
|
76
76
|
|
|
77
|
+
export interface ContextSelectionAgentOptions extends AgentOptions {
|
|
78
|
+
performanceRecordAndReload?: () => Promise<Trace.TraceModel.ParsedTrace>;
|
|
79
|
+
onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>;
|
|
80
|
+
networkTimeCalculator?: NetworkTimeCalculator.NetworkTransferTimeCalculator;
|
|
81
|
+
networkLog?: Logs.NetworkLog.NetworkLog;
|
|
82
|
+
workspace?: Workspace.Workspace.WorkspaceImpl;
|
|
83
|
+
}
|
|
84
|
+
|
|
77
85
|
/**
|
|
78
86
|
* One agent instance handles one conversation. Create a new agent
|
|
79
87
|
* instance for a new conversation.
|
|
@@ -101,13 +109,13 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
101
109
|
readonly #lighthouseRecording?:
|
|
102
110
|
(overrides?: LHModel.RunTypes.RunOverrides) => Promise<LHModel.ReporterTypes.ReportJSON|null>;
|
|
103
111
|
#allowedOrigin: () => AllowedOriginResult;
|
|
112
|
+
readonly #networkLog: Logs.NetworkLog.NetworkLog;
|
|
113
|
+
readonly #workspace: Workspace.Workspace.WorkspaceImpl;
|
|
104
114
|
|
|
105
|
-
constructor(opts:
|
|
106
|
-
performanceRecordAndReload?: () => Promise<Trace.TraceModel.ParsedTrace>,
|
|
107
|
-
onInspectElement?: () => Promise<SDK.DOMModel.DOMNode|null>,
|
|
108
|
-
networkTimeCalculator?: NetworkTimeCalculator.NetworkTransferTimeCalculator,
|
|
109
|
-
}) {
|
|
115
|
+
constructor(opts: ContextSelectionAgentOptions) {
|
|
110
116
|
super(opts);
|
|
117
|
+
this.#networkLog = opts.networkLog ?? Logs.NetworkLog.NetworkLog.instance();
|
|
118
|
+
this.#workspace = opts.workspace ?? Workspace.Workspace.WorkspaceImpl.instance();
|
|
111
119
|
this.#performanceRecordAndReload = opts.performanceRecordAndReload;
|
|
112
120
|
this.#lighthouseRecording = opts.lighthouseRecording;
|
|
113
121
|
this.#onInspectElement = opts.onInspectElement;
|
|
@@ -146,7 +154,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
146
154
|
|
|
147
155
|
let hasCrossOriginRequest = false;
|
|
148
156
|
const requestsToShow: NetworkRequest[] = [];
|
|
149
|
-
for (const request of
|
|
157
|
+
for (const request of this.#networkLog.requests()) {
|
|
150
158
|
const requestOrigin = getRequestContextOrigin(request);
|
|
151
159
|
/**
|
|
152
160
|
* NOTE: this origin check does not ensure that all the requests are
|
|
@@ -226,7 +234,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
226
234
|
error: 'No request found',
|
|
227
235
|
};
|
|
228
236
|
}
|
|
229
|
-
const request =
|
|
237
|
+
const request = this.#networkLog.requests().find(req => {
|
|
230
238
|
if (req.requestId() !== id) {
|
|
231
239
|
return false;
|
|
232
240
|
}
|
|
@@ -281,7 +289,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
281
289
|
|
|
282
290
|
const files: Array<{file: string, id: number | undefined}> = [];
|
|
283
291
|
const uiSourceCodes: Workspace.UISourceCode.UISourceCode[] = [];
|
|
284
|
-
for (const file of ContextSelectionAgent.getUISourceCodes()) {
|
|
292
|
+
for (const file of ContextSelectionAgent.getUISourceCodes(this.#workspace)) {
|
|
285
293
|
const fileUrl = file.url();
|
|
286
294
|
const fileOrigin = Common.ParsedURL.ParsedURL.extractOrigin(fileUrl);
|
|
287
295
|
|
|
@@ -339,7 +347,7 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
339
347
|
}
|
|
340
348
|
const origin = allowedOriginResult.origin;
|
|
341
349
|
|
|
342
|
-
const file = ContextSelectionAgent.getUISourceCodes().find(file => {
|
|
350
|
+
const file = ContextSelectionAgent.getUISourceCodes(this.#workspace).find(file => {
|
|
343
351
|
if (ContextSelectionAgent.uiSourceCodeId.get(file) !== params.id) {
|
|
344
352
|
return false;
|
|
345
353
|
}
|
|
@@ -554,8 +562,8 @@ export class ContextSelectionAgent extends AiAgent<never> {
|
|
|
554
562
|
* coming from SourceMaps (usually only one) as that has simple code and
|
|
555
563
|
* usually is what the user authored.
|
|
556
564
|
*/
|
|
557
|
-
static getUISourceCodes(
|
|
558
|
-
|
|
565
|
+
static getUISourceCodes(workspace: Workspace.Workspace.WorkspaceImpl = Workspace.Workspace.WorkspaceImpl.instance()):
|
|
566
|
+
Workspace.UISourceCode.UISourceCode[] {
|
|
559
567
|
const projects =
|
|
560
568
|
workspace.projects().filter(project => project.type() === Workspace.Workspace.projectTypes.Network);
|
|
561
569
|
const uiSourceCodes = new Map<string, Workspace.UISourceCode.UISourceCode>();
|