devtools-tracing 1.0.0
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/generate.ts +643 -0
- package/index.ts +16 -0
- package/lib/front_end/core/common/App.ts +7 -0
- package/lib/front_end/core/common/AppProvider.ts +32 -0
- package/lib/front_end/core/common/Base64.ts +47 -0
- package/lib/front_end/core/common/CharacterIdMap.ts +30 -0
- package/lib/front_end/core/common/Color.ts +2506 -0
- package/lib/front_end/core/common/ColorConverter.ts +402 -0
- package/lib/front_end/core/common/ColorUtils.ts +252 -0
- package/lib/front_end/core/common/Console.ts +114 -0
- package/lib/front_end/core/common/Debouncer.ts +15 -0
- package/lib/front_end/core/common/EventTarget.ts +52 -0
- package/lib/front_end/core/common/Gzip.ts +74 -0
- package/lib/front_end/core/common/JavaScriptMetaData.ts +29 -0
- package/lib/front_end/core/common/Lazy.ts +31 -0
- package/lib/front_end/core/common/Linkifier.ts +55 -0
- package/lib/front_end/core/common/MapWithDefault.ts +26 -0
- package/lib/front_end/core/common/Mutex.ts +55 -0
- package/lib/front_end/core/common/Object.ts +145 -0
- package/lib/front_end/core/common/ParsedURL.ts +554 -0
- package/lib/front_end/core/common/Progress.ts +180 -0
- package/lib/front_end/core/common/QueryParamHandler.ts +7 -0
- package/lib/front_end/core/common/ResolverBase.ts +85 -0
- package/lib/front_end/core/common/ResourceType.ts +588 -0
- package/lib/front_end/core/common/ReturnToPanel.ts +17 -0
- package/lib/front_end/core/common/Revealer.ts +192 -0
- package/lib/front_end/core/common/Runnable.ts +41 -0
- package/lib/front_end/core/common/SegmentedRange.ts +87 -0
- package/lib/front_end/core/common/SettingRegistration.ts +339 -0
- package/lib/front_end/core/common/Settings.ts +1497 -0
- package/lib/front_end/core/common/SimpleHistoryManager.ts +124 -0
- package/lib/front_end/core/common/StringOutputStream.ts +26 -0
- package/lib/front_end/core/common/TextDictionary.ts +48 -0
- package/lib/front_end/core/common/Throttler.ts +99 -0
- package/lib/front_end/core/common/Trie.ts +152 -0
- package/lib/front_end/core/common/Worker.ts +60 -0
- package/lib/front_end/core/common/common.ts +81 -0
- package/lib/front_end/core/host/AidaClient.ts +733 -0
- package/lib/front_end/core/host/GdpClient.ts +316 -0
- package/lib/front_end/core/host/InspectorFrontendHost.ts +648 -0
- package/lib/front_end/core/host/InspectorFrontendHostAPI.ts +551 -0
- package/lib/front_end/core/host/Platform.ts +76 -0
- package/lib/front_end/core/host/ResourceLoader.ts +282 -0
- package/lib/front_end/core/host/UserMetrics.ts +1230 -0
- package/lib/front_end/core/host/host.ts +23 -0
- package/lib/front_end/core/i18n/ByteUtilities.ts +82 -0
- package/lib/front_end/core/i18n/DevToolsLocale.ts +87 -0
- package/lib/front_end/core/i18n/NumberFormatter.ts +82 -0
- package/lib/front_end/core/i18n/i18n.ts +17 -0
- package/lib/front_end/core/i18n/i18nImpl.ts +204 -0
- package/lib/front_end/core/i18n/i18nTypes.ts +10 -0
- package/lib/front_end/core/i18n/locales.js +14 -0
- package/lib/front_end/core/i18n/time-utilities.ts +174 -0
- package/lib/front_end/core/platform/ArrayUtilities.ts +271 -0
- package/lib/front_end/core/platform/Brand.ts +23 -0
- package/lib/front_end/core/platform/Constructor.ts +10 -0
- package/lib/front_end/core/platform/DOMUtilities.ts +138 -0
- package/lib/front_end/core/platform/DateUtilities.ts +15 -0
- package/lib/front_end/core/platform/DevToolsPath.ts +53 -0
- package/lib/front_end/core/platform/KeyboardUtilities.ts +38 -0
- package/lib/front_end/core/platform/MapUtilities.ts +95 -0
- package/lib/front_end/core/platform/MimeType.ts +175 -0
- package/lib/front_end/core/platform/NumberUtilities.ts +80 -0
- package/lib/front_end/core/platform/StringUtilities.ts +588 -0
- package/lib/front_end/core/platform/Timing.ts +17 -0
- package/lib/front_end/core/platform/TypedArrayUtilities.ts +189 -0
- package/lib/front_end/core/platform/TypescriptUtilities.ts +86 -0
- package/lib/front_end/core/platform/UIString.ts +39 -0
- package/lib/front_end/core/platform/UserVisibleError.ts +28 -0
- package/lib/front_end/core/platform/platform.ts +45 -0
- package/lib/front_end/core/protocol_client/ConnectionTransport.ts +26 -0
- package/lib/front_end/core/protocol_client/InspectorBackend.ts +1050 -0
- package/lib/front_end/core/protocol_client/NodeURL.ts +42 -0
- package/lib/front_end/core/protocol_client/protocol_client.ts +13 -0
- package/lib/front_end/core/root/Runtime.ts +609 -0
- package/lib/front_end/core/root/root.ts +6 -0
- package/lib/front_end/core/sdk/AccessibilityModel.ts +353 -0
- package/lib/front_end/core/sdk/AnimationModel.ts +1041 -0
- package/lib/front_end/core/sdk/AutofillModel.ts +184 -0
- package/lib/front_end/core/sdk/CPUProfilerModel.ts +148 -0
- package/lib/front_end/core/sdk/CPUThrottlingManager.ts +282 -0
- package/lib/front_end/core/sdk/CSSContainerQuery.ts +139 -0
- package/lib/front_end/core/sdk/CSSFontFace.ts +40 -0
- package/lib/front_end/core/sdk/CSSLayer.ts +30 -0
- package/lib/front_end/core/sdk/CSSMatchedStyles.ts +1646 -0
- package/lib/front_end/core/sdk/CSSMedia.ts +121 -0
- package/lib/front_end/core/sdk/CSSMetadata.ts +1647 -0
- package/lib/front_end/core/sdk/CSSModel.ts +1128 -0
- package/lib/front_end/core/sdk/CSSProperty.ts +384 -0
- package/lib/front_end/core/sdk/CSSPropertyParser.ts +681 -0
- package/lib/front_end/core/sdk/CSSPropertyParserMatchers.ts +1395 -0
- package/lib/front_end/core/sdk/CSSQuery.ts +72 -0
- package/lib/front_end/core/sdk/CSSRule.ts +465 -0
- package/lib/front_end/core/sdk/CSSScope.ts +30 -0
- package/lib/front_end/core/sdk/CSSStartingStyle.ts +29 -0
- package/lib/front_end/core/sdk/CSSStyleDeclaration.ts +313 -0
- package/lib/front_end/core/sdk/CSSStyleSheetHeader.ts +196 -0
- package/lib/front_end/core/sdk/CSSSupports.ts +33 -0
- package/lib/front_end/core/sdk/CategorizedBreakpoint.ts +64 -0
- package/lib/front_end/core/sdk/ChildTargetManager.ts +314 -0
- package/lib/front_end/core/sdk/CompilerSourceMappingContentProvider.ts +62 -0
- package/lib/front_end/core/sdk/Connections.ts +293 -0
- package/lib/front_end/core/sdk/ConsoleModel.ts +808 -0
- package/lib/front_end/core/sdk/ConsoleModelTypes.ts +15 -0
- package/lib/front_end/core/sdk/Cookie.ts +319 -0
- package/lib/front_end/core/sdk/CookieModel.ts +239 -0
- package/lib/front_end/core/sdk/CookieParser.ts +185 -0
- package/lib/front_end/core/sdk/DOMDebuggerModel.ts +787 -0
- package/lib/front_end/core/sdk/DOMModel.ts +1961 -0
- package/lib/front_end/core/sdk/DebuggerModel.ts +1605 -0
- package/lib/front_end/core/sdk/EmulationModel.ts +648 -0
- package/lib/front_end/core/sdk/EnhancedTracesParser.ts +515 -0
- package/lib/front_end/core/sdk/EventBreakpointsModel.ts +183 -0
- package/lib/front_end/core/sdk/FrameAssociated.ts +11 -0
- package/lib/front_end/core/sdk/FrameManager.ts +259 -0
- package/lib/front_end/core/sdk/HeapProfilerModel.ts +225 -0
- package/lib/front_end/core/sdk/HttpReasonPhraseStrings.ts +77 -0
- package/lib/front_end/core/sdk/IOModel.ts +91 -0
- package/lib/front_end/core/sdk/IsolateManager.ts +257 -0
- package/lib/front_end/core/sdk/IssuesModel.ts +70 -0
- package/lib/front_end/core/sdk/LayerTreeBase.ts +169 -0
- package/lib/front_end/core/sdk/LogModel.ts +56 -0
- package/lib/front_end/core/sdk/NetworkManager.ts +2823 -0
- package/lib/front_end/core/sdk/NetworkRequest.ts +2253 -0
- package/lib/front_end/core/sdk/OverlayColorGenerator.ts +52 -0
- package/lib/front_end/core/sdk/OverlayModel.ts +1011 -0
- package/lib/front_end/core/sdk/OverlayPersistentHighlighter.ts +522 -0
- package/lib/front_end/core/sdk/PageLoad.ts +35 -0
- package/lib/front_end/core/sdk/PageResourceLoader.ts +435 -0
- package/lib/front_end/core/sdk/PaintProfiler.ts +110 -0
- package/lib/front_end/core/sdk/PerformanceMetricsModel.ts +84 -0
- package/lib/front_end/core/sdk/PreloadingModel.ts +863 -0
- package/lib/front_end/core/sdk/RehydratingConnection.ts +386 -0
- package/lib/front_end/core/sdk/RehydratingObject.ts +66 -0
- package/lib/front_end/core/sdk/RemoteObject.ts +1160 -0
- package/lib/front_end/core/sdk/Resource.ts +232 -0
- package/lib/front_end/core/sdk/ResourceTreeModel.ts +1160 -0
- package/lib/front_end/core/sdk/RuntimeModel.ts +732 -0
- package/lib/front_end/core/sdk/SDKModel.ts +65 -0
- package/lib/front_end/core/sdk/ScopeTreeCache.ts +45 -0
- package/lib/front_end/core/sdk/ScreenCaptureModel.ts +255 -0
- package/lib/front_end/core/sdk/Script.ts +534 -0
- package/lib/front_end/core/sdk/SecurityOriginManager.ts +76 -0
- package/lib/front_end/core/sdk/ServerSentEvents.ts +80 -0
- package/lib/front_end/core/sdk/ServerSentEventsProtocol.ts +122 -0
- package/lib/front_end/core/sdk/ServerTiming.ts +260 -0
- package/lib/front_end/core/sdk/ServiceWorkerCacheModel.ts +377 -0
- package/lib/front_end/core/sdk/ServiceWorkerManager.ts +605 -0
- package/lib/front_end/core/sdk/SourceMap.ts +867 -0
- package/lib/front_end/core/sdk/SourceMapCache.ts +54 -0
- package/lib/front_end/core/sdk/SourceMapFunctionRanges.ts +156 -0
- package/lib/front_end/core/sdk/SourceMapManager.ts +239 -0
- package/lib/front_end/core/sdk/SourceMapScopeChainEntry.ts +189 -0
- package/lib/front_end/core/sdk/SourceMapScopesInfo.ts +508 -0
- package/lib/front_end/core/sdk/StorageBucketsModel.ts +204 -0
- package/lib/front_end/core/sdk/StorageKeyManager.ts +98 -0
- package/lib/front_end/core/sdk/Target.ts +332 -0
- package/lib/front_end/core/sdk/TargetManager.ts +453 -0
- package/lib/front_end/core/sdk/TraceObject.ts +61 -0
- package/lib/front_end/core/sdk/WebAuthnModel.ts +104 -0
- package/lib/front_end/core/sdk/sdk.ts +174 -0
- package/lib/front_end/entrypoints/formatter_worker/FormatterActions.ts +59 -0
- package/lib/front_end/generated/InspectorBackendCommands.js +1617 -0
- package/lib/front_end/generated/SupportedCSSProperties.js +7512 -0
- package/lib/front_end/generated/protocol-proxy-api.d.ts +5022 -0
- package/lib/front_end/generated/protocol.ts +22014 -0
- package/lib/front_end/models/cpu_profile/CPUProfileDataModel.ts +571 -0
- package/lib/front_end/models/cpu_profile/ProfileTreeModel.ts +103 -0
- package/lib/front_end/models/cpu_profile/cpu_profile.ts +11 -0
- package/lib/front_end/models/formatter/FormatterWorkerPool.ts +219 -0
- package/lib/front_end/models/formatter/ScriptFormatter.ts +112 -0
- package/lib/front_end/models/formatter/formatter.ts +8 -0
- package/lib/front_end/models/text_utils/CodeMirrorUtils.ts +37 -0
- package/lib/front_end/models/text_utils/ContentData.ts +199 -0
- package/lib/front_end/models/text_utils/ContentProvider.ts +68 -0
- package/lib/front_end/models/text_utils/StaticContentProvider.ts +49 -0
- package/lib/front_end/models/text_utils/StreamingContentData.ts +108 -0
- package/lib/front_end/models/text_utils/Text.ts +90 -0
- package/lib/front_end/models/text_utils/TextCursor.ts +44 -0
- package/lib/front_end/models/text_utils/TextRange.ts +266 -0
- package/lib/front_end/models/text_utils/TextUtils.ts +401 -0
- package/lib/front_end/models/text_utils/WasmDisassembly.ts +87 -0
- package/lib/front_end/models/text_utils/text_utils.ts +27 -0
- package/lib/front_end/models/trace/EntityMapper.ts +141 -0
- package/lib/front_end/models/trace/EventsSerializer.ts +101 -0
- package/lib/front_end/models/trace/LanternComputationData.ts +438 -0
- package/lib/front_end/models/trace/ModelImpl.ts +236 -0
- package/lib/front_end/models/trace/Name.ts +136 -0
- package/lib/front_end/models/trace/Processor.ts +652 -0
- package/lib/front_end/models/trace/Styles.ts +1138 -0
- package/lib/front_end/models/trace/extras/FilmStrip.ts +78 -0
- package/lib/front_end/models/trace/extras/MainThreadActivity.ts +86 -0
- package/lib/front_end/models/trace/extras/ScriptDuplication.ts +236 -0
- package/lib/front_end/models/trace/extras/StackTraceForEvent.ts +203 -0
- package/lib/front_end/models/trace/extras/ThirdParties.ts +164 -0
- package/lib/front_end/models/trace/extras/TraceFilter.ts +62 -0
- package/lib/front_end/models/trace/extras/TraceTree.ts +701 -0
- package/lib/front_end/models/trace/extras/extras.ts +11 -0
- package/lib/front_end/models/trace/handlers/AnimationFramesHandler.ts +128 -0
- package/lib/front_end/models/trace/handlers/AnimationHandler.ts +36 -0
- package/lib/front_end/models/trace/handlers/AsyncJSCallsHandler.ts +239 -0
- package/lib/front_end/models/trace/handlers/AuctionWorkletsHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/DOMStatsHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/ExtensionTraceDataHandler.ts +306 -0
- package/lib/front_end/models/trace/handlers/FlowsHandler.ts +175 -0
- package/lib/front_end/models/trace/handlers/FramesHandler.ts +571 -0
- package/lib/front_end/models/trace/handlers/GPUHandler.ts +50 -0
- package/lib/front_end/models/trace/handlers/ImagePaintingHandler.ts +183 -0
- package/lib/front_end/models/trace/handlers/InitiatorsHandler.ts +193 -0
- package/lib/front_end/models/trace/handlers/InvalidationsHandler.ts +168 -0
- package/lib/front_end/models/trace/handlers/LargestImagePaintHandler.ts +109 -0
- package/lib/front_end/models/trace/handlers/LargestTextPaintHandler.ts +35 -0
- package/lib/front_end/models/trace/handlers/LayerTreeHandler.ts +123 -0
- package/lib/front_end/models/trace/handlers/LayoutShiftsHandler.ts +573 -0
- package/lib/front_end/models/trace/handlers/MemoryHandler.ts +31 -0
- package/lib/front_end/models/trace/handlers/MetaHandler.ts +525 -0
- package/lib/front_end/models/trace/handlers/ModelHandlers.ts +34 -0
- package/lib/front_end/models/trace/handlers/NetworkRequestsHandler.ts +672 -0
- package/lib/front_end/models/trace/handlers/PageFramesHandler.ts +52 -0
- package/lib/front_end/models/trace/handlers/PageLoadMetricsHandler.ts +460 -0
- package/lib/front_end/models/trace/handlers/RendererHandler.ts +428 -0
- package/lib/front_end/models/trace/handlers/SamplesHandler.ts +271 -0
- package/lib/front_end/models/trace/handlers/ScreenshotsHandler.ts +122 -0
- package/lib/front_end/models/trace/handlers/ScriptsHandler.ts +336 -0
- package/lib/front_end/models/trace/handlers/SelectorStatsHandler.ts +110 -0
- package/lib/front_end/models/trace/handlers/Threads.ts +139 -0
- package/lib/front_end/models/trace/handlers/UserInteractionsHandler.ts +400 -0
- package/lib/front_end/models/trace/handlers/UserTimingsHandler.ts +233 -0
- package/lib/front_end/models/trace/handlers/WarningsHandler.ts +162 -0
- package/lib/front_end/models/trace/handlers/WorkersHandler.ts +45 -0
- package/lib/front_end/models/trace/handlers/handlers.ts +8 -0
- package/lib/front_end/models/trace/handlers/helpers.ts +196 -0
- package/lib/front_end/models/trace/handlers/types.ts +75 -0
- package/lib/front_end/models/trace/helpers/Extensions.ts +54 -0
- package/lib/front_end/models/trace/helpers/Network.ts +129 -0
- package/lib/front_end/models/trace/helpers/SamplesIntegrator.ts +544 -0
- package/lib/front_end/models/trace/helpers/SyntheticEvents.ts +87 -0
- package/lib/front_end/models/trace/helpers/Timing.ts +248 -0
- package/lib/front_end/models/trace/helpers/Trace.ts +928 -0
- package/lib/front_end/models/trace/helpers/TreeHelpers.ts +320 -0
- package/lib/front_end/models/trace/helpers/helpers.ts +11 -0
- package/lib/front_end/models/trace/insights/CLSCulprits.ts +668 -0
- package/lib/front_end/models/trace/insights/Cache.ts +269 -0
- package/lib/front_end/models/trace/insights/Common.ts +453 -0
- package/lib/front_end/models/trace/insights/DOMSize.ts +223 -0
- package/lib/front_end/models/trace/insights/DocumentLatency.ts +319 -0
- package/lib/front_end/models/trace/insights/DuplicatedJavaScript.ts +126 -0
- package/lib/front_end/models/trace/insights/FontDisplay.ts +119 -0
- package/lib/front_end/models/trace/insights/ForcedReflow.ts +220 -0
- package/lib/front_end/models/trace/insights/INPBreakdown.ts +171 -0
- package/lib/front_end/models/trace/insights/ImageDelivery.ts +348 -0
- package/lib/front_end/models/trace/insights/LCPBreakdown.ts +268 -0
- package/lib/front_end/models/trace/insights/LCPDiscovery.ts +237 -0
- package/lib/front_end/models/trace/insights/LegacyJavaScript.ts +138 -0
- package/lib/front_end/models/trace/insights/Models.ts +22 -0
- package/lib/front_end/models/trace/insights/ModernHTTP.ts +257 -0
- package/lib/front_end/models/trace/insights/NetworkDependencyTree.ts +726 -0
- package/lib/front_end/models/trace/insights/RenderBlocking.ts +257 -0
- package/lib/front_end/models/trace/insights/SlowCSSSelector.ts +175 -0
- package/lib/front_end/models/trace/insights/Statistics.ts +101 -0
- package/lib/front_end/models/trace/insights/ThirdParties.ts +130 -0
- package/lib/front_end/models/trace/insights/Viewport.ts +138 -0
- package/lib/front_end/models/trace/insights/insights.ts +10 -0
- package/lib/front_end/models/trace/insights/types.ts +157 -0
- package/lib/front_end/models/trace/lantern/core/LanternError.ts +7 -0
- package/lib/front_end/models/trace/lantern/core/NetworkAnalyzer.ts +619 -0
- package/lib/front_end/models/trace/lantern/core/core.ts +6 -0
- package/lib/front_end/models/trace/lantern/graph/BaseNode.ts +345 -0
- package/lib/front_end/models/trace/lantern/graph/CPUNode.ts +80 -0
- package/lib/front_end/models/trace/lantern/graph/NetworkNode.ts +101 -0
- package/lib/front_end/models/trace/lantern/graph/PageDependencyGraph.ts +636 -0
- package/lib/front_end/models/trace/lantern/graph/graph.ts +8 -0
- package/lib/front_end/models/trace/lantern/lantern.ts +17 -0
- package/lib/front_end/models/trace/lantern/metrics/FirstContentfulPaint.ts +187 -0
- package/lib/front_end/models/trace/lantern/metrics/Interactive.ts +88 -0
- package/lib/front_end/models/trace/lantern/metrics/LargestContentfulPaint.ts +92 -0
- package/lib/front_end/models/trace/lantern/metrics/MaxPotentialFID.ts +72 -0
- package/lib/front_end/models/trace/lantern/metrics/Metric.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/SpeedIndex.ts +126 -0
- package/lib/front_end/models/trace/lantern/metrics/TBTUtils.ts +82 -0
- package/lib/front_end/models/trace/lantern/metrics/TotalBlockingTime.ts +112 -0
- package/lib/front_end/models/trace/lantern/metrics/metrics.ts +12 -0
- package/lib/front_end/models/trace/lantern/simulation/ConnectionPool.ts +150 -0
- package/lib/front_end/models/trace/lantern/simulation/Constants.ts +46 -0
- package/lib/front_end/models/trace/lantern/simulation/DNSCache.ts +61 -0
- package/lib/front_end/models/trace/lantern/simulation/SimulationTimingMap.ts +196 -0
- package/lib/front_end/models/trace/lantern/simulation/Simulator.ts +556 -0
- package/lib/front_end/models/trace/lantern/simulation/TCPConnection.ts +192 -0
- package/lib/front_end/models/trace/lantern/simulation/simulation.ts +10 -0
- package/lib/front_end/models/trace/lantern/types/Lantern.ts +220 -0
- package/lib/front_end/models/trace/lantern/types/types.ts +5 -0
- package/lib/front_end/models/trace/trace.ts +33 -0
- package/lib/front_end/models/trace/types/Configuration.ts +110 -0
- package/lib/front_end/models/trace/types/Extensions.ts +136 -0
- package/lib/front_end/models/trace/types/File.ts +281 -0
- package/lib/front_end/models/trace/types/Overlays.ts +138 -0
- package/lib/front_end/models/trace/types/Timing.ts +30 -0
- package/lib/front_end/models/trace/types/TraceEvents.ts +3277 -0
- package/lib/front_end/models/trace/types/types.ts +10 -0
- package/lib/front_end/third_party/i18n/LICENSE +202 -0
- package/lib/front_end/third_party/i18n/README.chromium +15 -0
- package/lib/front_end/third_party/i18n/i18n-impl.ts +61 -0
- package/lib/front_end/third_party/i18n/i18n.ts +11 -0
- package/lib/front_end/third_party/i18n/localized-string-set.ts +129 -0
- package/lib/front_end/third_party/intl-messageformat/LICENSE +33 -0
- package/lib/front_end/third_party/intl-messageformat/README.chromium +24 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat-tsconfig.json +16 -0
- package/lib/front_end/third_party/intl-messageformat/intl-messageformat.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/LICENSE.md +33 -0
- package/lib/front_end/third_party/intl-messageformat/package/README.md +3 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/index.js +13 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.d.ts +5 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.esm.js +1710 -0
- package/lib/front_end/third_party/intl-messageformat/package/intl-messageformat.iife.js +1815 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts +6 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/index.js +10 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/core.js +229 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/error.js +48 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/lib/src/formatters.js +179 -0
- package/lib/front_end/third_party/intl-messageformat/package/package.json +42 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/core.js +230 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts +28 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/error.js +51 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts +34 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.d.ts.map +1 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/formatters.js +182 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/error.d.ts +79 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/index.d.ts +15 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/parser.d.ts +153 -0
- package/lib/front_end/third_party/intl-messageformat/package/src/icu-messageformat-parser/types.d.ts +139 -0
- package/lib/front_end/third_party/legacy-javascript/LICENSE +202 -0
- package/lib/front_end/third_party/legacy-javascript/README.chromium +13 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript-tsconfig.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/legacy-javascript.ts +3 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.d.ts +18 -0
- package/lib/front_end/third_party/legacy-javascript/lib/legacy-javascript.js +943 -0
- package/lib/front_end/third_party/legacy-javascript/package.json +8 -0
- package/lib/front_end/third_party/legacy-javascript/rebuild.sh +9 -0
- package/lib/front_end/third_party/third-party-web/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/README.chromium +13 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.d.ts +2 -0
- package/lib/front_end/third_party/third-party-web/lib/nostats-subset.js +149 -0
- package/lib/front_end/third_party/third-party-web/package/LICENSE +20 -0
- package/lib/front_end/third_party/third-party-web/package/README.md +929 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-httparchive.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities-nostats.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/dist/entities.json +1 -0
- package/lib/front_end/third_party/third-party-web/package/facades.md +46 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/httparchive-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/__snapshots__/index.test.js.snap +1006 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.js +139 -0
- package/lib/front_end/third_party/third-party-web/package/lib/create-entity-finder-api.test.js +44 -0
- package/lib/front_end/third_party/third-party-web/package/lib/entities.test.js +27 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.d.ts +34 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/index.test.js +246 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/faqs.partial.md +36 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/goals.partial.md +9 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/methodology.partial.md +5 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/template.md +151 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-02-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-03-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-06.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2019-05-13.md +14 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2021-01-01.md +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/markdown/updates/2024-07-01.md +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive-nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/httparchive.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/lib/subsets/nostats.js +3 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.d.ts +1 -0
- package/lib/front_end/third_party/third-party-web/package/nostats-subset.js +1 -0
- package/lib/front_end/third_party/third-party-web/package/package.json +46 -0
- package/lib/front_end/third_party/third-party-web/package.json +8 -0
- package/lib/front_end/third_party/third-party-web/rebuild.sh +13 -0
- package/lib/front_end/third_party/third-party-web/third-party-web-tsconfig.json +8 -0
- package/lib/front_end/third_party/third-party-web/third-party-web.ts +3 -0
- package/package.json +24 -0
- package/patches/chrome-devtools-frontend+1.0.1533544.patch +187 -0
|
@@ -0,0 +1,733 @@
|
|
|
1
|
+
// Copyright 2023 The Chromium Authors
|
|
2
|
+
// Use of this source code is governed by a BSD-style license that can be
|
|
3
|
+
// found in the LICENSE file.
|
|
4
|
+
|
|
5
|
+
import * as Common from '../common/common.js';
|
|
6
|
+
import * as Root from '../root/root.js';
|
|
7
|
+
|
|
8
|
+
import {InspectorFrontendHostInstance} from './InspectorFrontendHost.js';
|
|
9
|
+
import type {AidaClientResult, AidaCodeCompleteResult, SyncInformation} from './InspectorFrontendHostAPI.js';
|
|
10
|
+
import {bindOutputStream} from './ResourceLoader.js';
|
|
11
|
+
|
|
12
|
+
export enum Role {
|
|
13
|
+
/** Provide this role when giving a function call response */
|
|
14
|
+
ROLE_UNSPECIFIED = 0,
|
|
15
|
+
/** Tags the content came from the user */
|
|
16
|
+
USER = 1,
|
|
17
|
+
/** Tags the content came from the LLM */
|
|
18
|
+
MODEL = 2,
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export const enum Rating {
|
|
22
|
+
// Resets the vote to null in the logs
|
|
23
|
+
SENTIMENT_UNSPECIFIED = 'SENTIMENT_UNSPECIFIED',
|
|
24
|
+
POSITIVE = 'POSITIVE',
|
|
25
|
+
NEGATIVE = 'NEGATIVE',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* A `Content` represents a single turn message.
|
|
30
|
+
*/
|
|
31
|
+
export interface Content {
|
|
32
|
+
parts: Part[];
|
|
33
|
+
/** The producer of the content. */
|
|
34
|
+
role: Role;
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
export type Part = {
|
|
38
|
+
text: string,
|
|
39
|
+
}|{
|
|
40
|
+
functionCall: {
|
|
41
|
+
name: string,
|
|
42
|
+
args: Record<string, unknown>,
|
|
43
|
+
},
|
|
44
|
+
}|{
|
|
45
|
+
functionResponse: {
|
|
46
|
+
name: string,
|
|
47
|
+
response: Record<string, unknown>,
|
|
48
|
+
},
|
|
49
|
+
}|{
|
|
50
|
+
/** Inline media bytes. */
|
|
51
|
+
inlineData: MediaBlob,
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
export const enum ParametersTypes {
|
|
55
|
+
STRING = 1,
|
|
56
|
+
NUMBER = 2,
|
|
57
|
+
INTEGER = 3,
|
|
58
|
+
BOOLEAN = 4,
|
|
59
|
+
ARRAY = 5,
|
|
60
|
+
OBJECT = 6,
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
interface BaseFunctionParam {
|
|
64
|
+
description: string;
|
|
65
|
+
nullable?: boolean;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
export interface FunctionPrimitiveParams extends BaseFunctionParam {
|
|
69
|
+
type: ParametersTypes.BOOLEAN|ParametersTypes.INTEGER|ParametersTypes.STRING|ParametersTypes.BOOLEAN;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
interface FunctionArrayParam extends BaseFunctionParam {
|
|
73
|
+
type: ParametersTypes.ARRAY;
|
|
74
|
+
items: FunctionPrimitiveParams;
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
export interface FunctionObjectParam<T extends string|number|symbol = string> extends BaseFunctionParam {
|
|
78
|
+
type: ParametersTypes.OBJECT;
|
|
79
|
+
// TODO: this can be also be ObjectParams
|
|
80
|
+
properties: Record<T, FunctionPrimitiveParams|FunctionArrayParam>;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* More about function declaration can be read at
|
|
85
|
+
* https://ai.google.dev/gemini-api/docs/function-calling
|
|
86
|
+
*/
|
|
87
|
+
export interface FunctionDeclaration<T extends string|number|symbol = string> {
|
|
88
|
+
name: string;
|
|
89
|
+
/**
|
|
90
|
+
* A description for the LLM to understand what the specific function will do once called.
|
|
91
|
+
*/
|
|
92
|
+
description: string;
|
|
93
|
+
parameters: FunctionObjectParam<T>;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/** Raw media bytes. **/
|
|
97
|
+
export interface MediaBlob {
|
|
98
|
+
// The IANA standard MIME type of the source data.
|
|
99
|
+
// Currently supported types are: image/png, image/jpeg.
|
|
100
|
+
// Format: base64-encoded
|
|
101
|
+
// For reference: google3/google/x/pitchfork/aida/v1/content.proto
|
|
102
|
+
mimeType: string;
|
|
103
|
+
data: string;
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
export enum FunctionalityType {
|
|
107
|
+
// Unspecified functionality type.
|
|
108
|
+
FUNCTIONALITY_TYPE_UNSPECIFIED = 0,
|
|
109
|
+
// The generic AI chatbot functionality.
|
|
110
|
+
CHAT = 1,
|
|
111
|
+
// The explain error functionality.
|
|
112
|
+
EXPLAIN_ERROR = 2,
|
|
113
|
+
AGENTIC_CHAT = 5,
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** See: cs/aida.proto (google3). **/
|
|
117
|
+
export enum ClientFeature {
|
|
118
|
+
// Unspecified client feature.
|
|
119
|
+
CLIENT_FEATURE_UNSPECIFIED = 0,
|
|
120
|
+
// Chrome console insights feature.
|
|
121
|
+
CHROME_CONSOLE_INSIGHTS = 1,
|
|
122
|
+
// Chrome AI Assistance Styling Agent.
|
|
123
|
+
CHROME_STYLING_AGENT = 2,
|
|
124
|
+
// Chrome AI Assistance Network Agent.
|
|
125
|
+
CHROME_NETWORK_AGENT = 7,
|
|
126
|
+
// Chrome AI Annotations Performance Agent
|
|
127
|
+
CHROME_PERFORMANCE_ANNOTATIONS_AGENT = 20,
|
|
128
|
+
// Chrome AI Assistance File Agent.
|
|
129
|
+
CHROME_FILE_AGENT = 9,
|
|
130
|
+
// Chrome AI Patch Agent.
|
|
131
|
+
CHROME_PATCH_AGENT = 12,
|
|
132
|
+
// Chrome AI Assistance Performance Agent.
|
|
133
|
+
CHROME_PERFORMANCE_FULL_AGENT = 24,
|
|
134
|
+
|
|
135
|
+
// Removed features (for reference).
|
|
136
|
+
// Chrome AI Assistance Performance Insights Agent.
|
|
137
|
+
// CHROME_PERFORMANCE_INSIGHTS_AGENT = 13,
|
|
138
|
+
// Chrome AI Assistance Performance Agent (call trees).
|
|
139
|
+
// CHROME_PERFORMANCE_AGENT = 8,
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
export enum UserTier {
|
|
143
|
+
// Unspecified user tier.
|
|
144
|
+
USER_TIER_UNSPECIFIED = 0,
|
|
145
|
+
// Users who are internal testers.
|
|
146
|
+
TESTERS = 1,
|
|
147
|
+
// Users who are early adopters.
|
|
148
|
+
BETA = 2,
|
|
149
|
+
// Users in the general public.
|
|
150
|
+
PUBLIC = 3,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
/** Googlers: see the Aida `retrieval` proto; this type is based on that. **/
|
|
154
|
+
export interface RequestFactMetadata {
|
|
155
|
+
/**
|
|
156
|
+
* A description of where the fact comes from.
|
|
157
|
+
*/
|
|
158
|
+
source: string;
|
|
159
|
+
/**
|
|
160
|
+
* Optional: a score to give this fact. Used because
|
|
161
|
+
* if there are more facts than space in the context window,
|
|
162
|
+
* higher scoring facts will be prioritized.
|
|
163
|
+
*/
|
|
164
|
+
score?: number;
|
|
165
|
+
}
|
|
166
|
+
export interface RequestFact {
|
|
167
|
+
/**
|
|
168
|
+
* Content of the fact.
|
|
169
|
+
*/
|
|
170
|
+
text: string;
|
|
171
|
+
metadata: RequestFactMetadata;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
export type RpcGlobalId = string|number;
|
|
175
|
+
|
|
176
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
177
|
+
export interface RequestMetadata {
|
|
178
|
+
string_session_id?: string;
|
|
179
|
+
user_tier?: UserTier;
|
|
180
|
+
disable_user_content_logging: boolean;
|
|
181
|
+
client_version: string;
|
|
182
|
+
}
|
|
183
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
184
|
+
|
|
185
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
186
|
+
export interface ConversationOptions {
|
|
187
|
+
temperature?: number;
|
|
188
|
+
model_id?: string;
|
|
189
|
+
}
|
|
190
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
191
|
+
|
|
192
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
193
|
+
export interface DoConversationRequest {
|
|
194
|
+
client: string;
|
|
195
|
+
current_message: Content;
|
|
196
|
+
preamble?: string;
|
|
197
|
+
historical_contexts?: Content[];
|
|
198
|
+
function_declarations?: FunctionDeclaration[];
|
|
199
|
+
facts?: RequestFact[];
|
|
200
|
+
options?: ConversationOptions;
|
|
201
|
+
metadata: RequestMetadata;
|
|
202
|
+
functionality_type?: FunctionalityType;
|
|
203
|
+
client_feature?: ClientFeature;
|
|
204
|
+
}
|
|
205
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
206
|
+
|
|
207
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
208
|
+
export interface CompleteCodeOptions {
|
|
209
|
+
temperature?: number;
|
|
210
|
+
model_id?: string;
|
|
211
|
+
inference_language?: AidaInferenceLanguage;
|
|
212
|
+
stop_sequences?: string[];
|
|
213
|
+
}
|
|
214
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
215
|
+
|
|
216
|
+
export enum EditType {
|
|
217
|
+
// Unknown edit type
|
|
218
|
+
EDIT_TYPE_UNSPECIFIED = 0,
|
|
219
|
+
// User typed code/text into file
|
|
220
|
+
ADD = 1,
|
|
221
|
+
// User deleted code/text from file
|
|
222
|
+
DELETE = 2,
|
|
223
|
+
// User pasted into file (this includes smart paste)
|
|
224
|
+
PASTE = 3,
|
|
225
|
+
// User performs an undo action
|
|
226
|
+
UNDO = 4,
|
|
227
|
+
// User performs a redo action
|
|
228
|
+
REDO = 5,
|
|
229
|
+
// User accepted a completion from AIDA
|
|
230
|
+
ACCEPT_COMPLETION = 6,
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
export enum Reason {
|
|
234
|
+
// Unknown reason.
|
|
235
|
+
UNKNOWN = 0,
|
|
236
|
+
|
|
237
|
+
// The file is currently open.
|
|
238
|
+
CURRENTLY_OPEN = 1,
|
|
239
|
+
|
|
240
|
+
// The file is opened recently.
|
|
241
|
+
RECENTLY_OPENED = 2,
|
|
242
|
+
|
|
243
|
+
// The file is edited recently.
|
|
244
|
+
RECENTLY_EDITED = 3,
|
|
245
|
+
|
|
246
|
+
// The file is located within the same directory.
|
|
247
|
+
COLOCATED = 4,
|
|
248
|
+
|
|
249
|
+
// Included based on relation to code around the cursor (e.g: could be
|
|
250
|
+
// provided by local IDE analysis)
|
|
251
|
+
RELATED_FILE = 5,
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
255
|
+
export interface CompletionRequest {
|
|
256
|
+
client: string;
|
|
257
|
+
prefix: string;
|
|
258
|
+
suffix?: string;
|
|
259
|
+
options?: CompleteCodeOptions;
|
|
260
|
+
metadata: RequestMetadata;
|
|
261
|
+
last_user_action?: EditType;
|
|
262
|
+
additional_files?: Array<{
|
|
263
|
+
path: string,
|
|
264
|
+
content: string,
|
|
265
|
+
included_reason: Reason,
|
|
266
|
+
}>;
|
|
267
|
+
}
|
|
268
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
269
|
+
|
|
270
|
+
/* eslint-disable @typescript-eslint/naming-convention */
|
|
271
|
+
export interface DoConversationClientEvent {
|
|
272
|
+
user_feedback: {
|
|
273
|
+
sentiment?: Rating,
|
|
274
|
+
user_input?: {
|
|
275
|
+
comment?: string,
|
|
276
|
+
},
|
|
277
|
+
};
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
export interface UserImpression {
|
|
281
|
+
sample: {
|
|
282
|
+
sample_id?: number,
|
|
283
|
+
};
|
|
284
|
+
latency: {
|
|
285
|
+
duration: {
|
|
286
|
+
seconds: number,
|
|
287
|
+
nanos: number,
|
|
288
|
+
},
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
|
|
292
|
+
export interface UserAcceptance {
|
|
293
|
+
sample: {
|
|
294
|
+
sample_id?: number,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
export interface AidaRegisterClientEvent {
|
|
299
|
+
corresponding_aida_rpc_global_id: RpcGlobalId;
|
|
300
|
+
disable_user_content_logging: boolean;
|
|
301
|
+
do_conversation_client_event?: DoConversationClientEvent;
|
|
302
|
+
complete_code_client_event?: {user_acceptance: UserAcceptance}|{user_impression: UserImpression};
|
|
303
|
+
}
|
|
304
|
+
/* eslint-enable @typescript-eslint/naming-convention */
|
|
305
|
+
|
|
306
|
+
export enum RecitationAction {
|
|
307
|
+
ACTION_UNSPECIFIED = 'ACTION_UNSPECIFIED',
|
|
308
|
+
CITE = 'CITE',
|
|
309
|
+
BLOCK = 'BLOCK',
|
|
310
|
+
NO_ACTION = 'NO_ACTION',
|
|
311
|
+
EXEMPT_FOUND_IN_PROMPT = 'EXEMPT_FOUND_IN_PROMPT',
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
export enum CitationSourceType {
|
|
315
|
+
CITATION_SOURCE_TYPE_UNSPECIFIED = 'CITATION_SOURCE_TYPE_UNSPECIFIED',
|
|
316
|
+
TRAINING_DATA = 'TRAINING_DATA',
|
|
317
|
+
WORLD_FACTS = 'WORLD_FACTS',
|
|
318
|
+
LOCAL_FACTS = 'LOCAL_FACTS',
|
|
319
|
+
INDIRECT = 'INDIRECT',
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
export interface Citation {
|
|
323
|
+
startIndex?: number;
|
|
324
|
+
endIndex?: number;
|
|
325
|
+
uri?: string;
|
|
326
|
+
sourceType?: CitationSourceType;
|
|
327
|
+
repository?: string;
|
|
328
|
+
}
|
|
329
|
+
|
|
330
|
+
export interface AttributionMetadata {
|
|
331
|
+
attributionAction: RecitationAction;
|
|
332
|
+
citations: Citation[];
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
export interface AidaFunctionCallResponse {
|
|
336
|
+
name: string;
|
|
337
|
+
args: Record<string, unknown>;
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
export interface FactualityFact {
|
|
341
|
+
sourceUri?: string;
|
|
342
|
+
}
|
|
343
|
+
|
|
344
|
+
export interface FactualityMetadata {
|
|
345
|
+
facts: FactualityFact[];
|
|
346
|
+
}
|
|
347
|
+
|
|
348
|
+
export interface ResponseMetadata {
|
|
349
|
+
rpcGlobalId?: RpcGlobalId;
|
|
350
|
+
attributionMetadata?: AttributionMetadata;
|
|
351
|
+
factualityMetadata?: FactualityMetadata;
|
|
352
|
+
}
|
|
353
|
+
|
|
354
|
+
export interface DoConversationResponse {
|
|
355
|
+
explanation: string;
|
|
356
|
+
metadata: ResponseMetadata;
|
|
357
|
+
functionCalls?: [AidaFunctionCallResponse, ...AidaFunctionCallResponse[]];
|
|
358
|
+
completed: boolean;
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
export interface CompletionResponse {
|
|
362
|
+
generatedSamples: GenerationSample[];
|
|
363
|
+
metadata: ResponseMetadata;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface GenerationSample {
|
|
367
|
+
generationString: string;
|
|
368
|
+
score: number;
|
|
369
|
+
sampleId?: number;
|
|
370
|
+
attributionMetadata?: AttributionMetadata;
|
|
371
|
+
}
|
|
372
|
+
|
|
373
|
+
export const enum AidaAccessPreconditions {
|
|
374
|
+
AVAILABLE = 'available',
|
|
375
|
+
NO_ACCOUNT_EMAIL = 'no-account-email',
|
|
376
|
+
NO_INTERNET = 'no-internet',
|
|
377
|
+
// This is the state (mostly enterprise) users are in, when they are automatically logged out from
|
|
378
|
+
// Chrome after a certain time period. For making AIDA requests, they need to log in again.
|
|
379
|
+
SYNC_IS_PAUSED = 'sync-is-paused',
|
|
380
|
+
}
|
|
381
|
+
|
|
382
|
+
export const enum AidaInferenceLanguage {
|
|
383
|
+
CPP = 'CPP',
|
|
384
|
+
PYTHON = 'PYTHON',
|
|
385
|
+
KOTLIN = 'KOTLIN',
|
|
386
|
+
JAVA = 'JAVA',
|
|
387
|
+
JAVASCRIPT = 'JAVASCRIPT',
|
|
388
|
+
GO = 'GO',
|
|
389
|
+
TYPESCRIPT = 'TYPESCRIPT',
|
|
390
|
+
HTML = 'HTML',
|
|
391
|
+
BASH = 'BASH',
|
|
392
|
+
CSS = 'CSS',
|
|
393
|
+
DART = 'DART',
|
|
394
|
+
JSON = 'JSON',
|
|
395
|
+
MARKDOWN = 'MARKDOWN',
|
|
396
|
+
VUE = 'VUE',
|
|
397
|
+
XML = 'XML',
|
|
398
|
+
}
|
|
399
|
+
|
|
400
|
+
const AidaLanguageToMarkdown: Record<AidaInferenceLanguage, string> = {
|
|
401
|
+
CPP: 'cpp',
|
|
402
|
+
PYTHON: 'py',
|
|
403
|
+
KOTLIN: 'kt',
|
|
404
|
+
JAVA: 'java',
|
|
405
|
+
JAVASCRIPT: 'js',
|
|
406
|
+
GO: 'go',
|
|
407
|
+
TYPESCRIPT: 'ts',
|
|
408
|
+
HTML: 'html',
|
|
409
|
+
BASH: 'sh',
|
|
410
|
+
CSS: 'css',
|
|
411
|
+
DART: 'dart',
|
|
412
|
+
JSON: 'json',
|
|
413
|
+
MARKDOWN: 'md',
|
|
414
|
+
VUE: 'vue',
|
|
415
|
+
XML: 'xml',
|
|
416
|
+
};
|
|
417
|
+
|
|
418
|
+
export const CLIENT_NAME = 'CHROME_DEVTOOLS';
|
|
419
|
+
|
|
420
|
+
const CODE_CHUNK_SEPARATOR = (lang = ''): string => ('\n`````' + lang + '\n');
|
|
421
|
+
|
|
422
|
+
export class AidaAbortError extends Error {}
|
|
423
|
+
export class AidaBlockError extends Error {}
|
|
424
|
+
|
|
425
|
+
export class AidaClient {
|
|
426
|
+
static buildConsoleInsightsRequest(input: string): DoConversationRequest {
|
|
427
|
+
const disallowLogging = Root.Runtime.hostConfig.aidaAvailability?.disallowLogging ?? true;
|
|
428
|
+
const chromeVersion = Root.Runtime.getChromeVersion();
|
|
429
|
+
if (!chromeVersion) {
|
|
430
|
+
throw new Error('Cannot determine Chrome version');
|
|
431
|
+
}
|
|
432
|
+
const request: DoConversationRequest = {
|
|
433
|
+
current_message: {parts: [{text: input}], role: Role.USER},
|
|
434
|
+
client: CLIENT_NAME,
|
|
435
|
+
functionality_type: FunctionalityType.EXPLAIN_ERROR,
|
|
436
|
+
client_feature: ClientFeature.CHROME_CONSOLE_INSIGHTS,
|
|
437
|
+
metadata: {
|
|
438
|
+
disable_user_content_logging: disallowLogging,
|
|
439
|
+
client_version: chromeVersion,
|
|
440
|
+
},
|
|
441
|
+
};
|
|
442
|
+
|
|
443
|
+
let temperature = -1;
|
|
444
|
+
let modelId;
|
|
445
|
+
if (Root.Runtime.hostConfig.devToolsConsoleInsights?.enabled) {
|
|
446
|
+
temperature = Root.Runtime.hostConfig.devToolsConsoleInsights.temperature ?? -1;
|
|
447
|
+
modelId = Root.Runtime.hostConfig.devToolsConsoleInsights.modelId;
|
|
448
|
+
}
|
|
449
|
+
if (temperature >= 0) {
|
|
450
|
+
request.options ??= {};
|
|
451
|
+
request.options.temperature = temperature;
|
|
452
|
+
}
|
|
453
|
+
if (modelId) {
|
|
454
|
+
request.options ??= {};
|
|
455
|
+
request.options.model_id = modelId;
|
|
456
|
+
}
|
|
457
|
+
return request;
|
|
458
|
+
}
|
|
459
|
+
|
|
460
|
+
static async checkAccessPreconditions(): Promise<AidaAccessPreconditions> {
|
|
461
|
+
if (!navigator.onLine) {
|
|
462
|
+
return AidaAccessPreconditions.NO_INTERNET;
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
const syncInfo = await new Promise<SyncInformation>(
|
|
466
|
+
resolve => InspectorFrontendHostInstance.getSyncInformation(syncInfo => resolve(syncInfo)));
|
|
467
|
+
if (!syncInfo.accountEmail) {
|
|
468
|
+
return AidaAccessPreconditions.NO_ACCOUNT_EMAIL;
|
|
469
|
+
}
|
|
470
|
+
|
|
471
|
+
if (syncInfo.isSyncPaused) {
|
|
472
|
+
return AidaAccessPreconditions.SYNC_IS_PAUSED;
|
|
473
|
+
}
|
|
474
|
+
|
|
475
|
+
return AidaAccessPreconditions.AVAILABLE;
|
|
476
|
+
}
|
|
477
|
+
|
|
478
|
+
async *
|
|
479
|
+
doConversation(request: DoConversationRequest, options?: {signal?: AbortSignal}):
|
|
480
|
+
AsyncGenerator<DoConversationResponse, void, void> {
|
|
481
|
+
if (!InspectorFrontendHostInstance.doAidaConversation) {
|
|
482
|
+
throw new Error('doAidaConversation is not available');
|
|
483
|
+
}
|
|
484
|
+
const stream = (() => {
|
|
485
|
+
let {promise, resolve, reject} = Promise.withResolvers<string|null>();
|
|
486
|
+
options?.signal?.addEventListener('abort', () => {
|
|
487
|
+
reject(new AidaAbortError());
|
|
488
|
+
}, {once: true});
|
|
489
|
+
return {
|
|
490
|
+
write: async(data: string): Promise<void> => {
|
|
491
|
+
resolve(data);
|
|
492
|
+
({promise, resolve, reject} = Promise.withResolvers<string|null>());
|
|
493
|
+
},
|
|
494
|
+
close: async(): Promise<void> => {
|
|
495
|
+
resolve(null);
|
|
496
|
+
},
|
|
497
|
+
read: (): Promise<string|null> => {
|
|
498
|
+
return promise;
|
|
499
|
+
},
|
|
500
|
+
fail: (e: Error) => reject(e),
|
|
501
|
+
};
|
|
502
|
+
})();
|
|
503
|
+
const streamId = bindOutputStream(stream);
|
|
504
|
+
InspectorFrontendHostInstance.doAidaConversation(JSON.stringify(request), streamId, result => {
|
|
505
|
+
if (result.statusCode === 403) {
|
|
506
|
+
stream.fail(new Error('Server responded: permission denied'));
|
|
507
|
+
} else if (result.error) {
|
|
508
|
+
stream.fail(new Error(`Cannot send request: ${result.error} ${result.detail || ''}`));
|
|
509
|
+
} else if (result.netErrorName === 'net::ERR_TIMED_OUT') {
|
|
510
|
+
stream.fail(new Error('doAidaConversation timed out'));
|
|
511
|
+
} else if (result.statusCode !== 200) {
|
|
512
|
+
stream.fail(new Error(`Request failed: ${JSON.stringify(result)}`));
|
|
513
|
+
} else {
|
|
514
|
+
void stream.close();
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
let chunk;
|
|
518
|
+
const text = [];
|
|
519
|
+
let inCodeChunk = false;
|
|
520
|
+
const functionCalls: AidaFunctionCallResponse[] = [];
|
|
521
|
+
let metadata: ResponseMetadata = {rpcGlobalId: 0};
|
|
522
|
+
while ((chunk = await stream.read())) {
|
|
523
|
+
let textUpdated = false;
|
|
524
|
+
// The AIDA response is a JSON array of objects, split at the object
|
|
525
|
+
// boundary. Therefore each chunk may start with `[` or `,` and possibly
|
|
526
|
+
// followed by `]`. Each chunk may include one or more objects, so we
|
|
527
|
+
// make sure that each chunk becomes a well-formed JSON array when we
|
|
528
|
+
// parse it by adding `[` and `]` and removing `,` where appropriate.
|
|
529
|
+
if (!chunk.length) {
|
|
530
|
+
continue;
|
|
531
|
+
}
|
|
532
|
+
if (chunk.startsWith(',')) {
|
|
533
|
+
chunk = chunk.slice(1);
|
|
534
|
+
}
|
|
535
|
+
if (!chunk.startsWith('[')) {
|
|
536
|
+
chunk = '[' + chunk;
|
|
537
|
+
}
|
|
538
|
+
if (!chunk.endsWith(']')) {
|
|
539
|
+
chunk = chunk + ']';
|
|
540
|
+
}
|
|
541
|
+
let results;
|
|
542
|
+
try {
|
|
543
|
+
results = JSON.parse(chunk);
|
|
544
|
+
} catch (error) {
|
|
545
|
+
throw new Error('Cannot parse chunk: ' + chunk, {cause: error});
|
|
546
|
+
}
|
|
547
|
+
|
|
548
|
+
for (const result of results) {
|
|
549
|
+
if ('metadata' in result) {
|
|
550
|
+
metadata = result.metadata;
|
|
551
|
+
if (metadata?.attributionMetadata?.attributionAction === RecitationAction.BLOCK) {
|
|
552
|
+
throw new AidaBlockError();
|
|
553
|
+
}
|
|
554
|
+
}
|
|
555
|
+
if ('textChunk' in result) {
|
|
556
|
+
if (inCodeChunk) {
|
|
557
|
+
text.push(CODE_CHUNK_SEPARATOR());
|
|
558
|
+
inCodeChunk = false;
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
text.push(result.textChunk.text);
|
|
562
|
+
textUpdated = true;
|
|
563
|
+
} else if ('codeChunk' in result) {
|
|
564
|
+
if (!inCodeChunk) {
|
|
565
|
+
const language = AidaLanguageToMarkdown[result.codeChunk.inferenceLanguage as AidaInferenceLanguage] ?? '';
|
|
566
|
+
text.push(CODE_CHUNK_SEPARATOR(language));
|
|
567
|
+
inCodeChunk = true;
|
|
568
|
+
}
|
|
569
|
+
|
|
570
|
+
text.push(result.codeChunk.code);
|
|
571
|
+
textUpdated = true;
|
|
572
|
+
} else if ('functionCallChunk' in result) {
|
|
573
|
+
functionCalls.push({
|
|
574
|
+
name: result.functionCallChunk.functionCall.name,
|
|
575
|
+
args: result.functionCallChunk.functionCall.args,
|
|
576
|
+
});
|
|
577
|
+
} else if ('error' in result) {
|
|
578
|
+
throw new Error(`Server responded: ${JSON.stringify(result)}`);
|
|
579
|
+
} else {
|
|
580
|
+
throw new Error('Unknown chunk result');
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
if (textUpdated) {
|
|
584
|
+
yield {
|
|
585
|
+
explanation: text.join('') + (inCodeChunk ? CODE_CHUNK_SEPARATOR() : ''),
|
|
586
|
+
metadata,
|
|
587
|
+
completed: false,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
yield {
|
|
592
|
+
explanation: text.join('') + (inCodeChunk ? CODE_CHUNK_SEPARATOR() : ''),
|
|
593
|
+
metadata,
|
|
594
|
+
functionCalls: functionCalls.length ? functionCalls as [AidaFunctionCallResponse, ...AidaFunctionCallResponse[]] :
|
|
595
|
+
undefined,
|
|
596
|
+
completed: true,
|
|
597
|
+
};
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
registerClientEvent(clientEvent: AidaRegisterClientEvent): Promise<AidaClientResult> {
|
|
601
|
+
const {promise, resolve} = Promise.withResolvers<AidaClientResult>();
|
|
602
|
+
InspectorFrontendHostInstance.registerAidaClientEvent(
|
|
603
|
+
JSON.stringify({
|
|
604
|
+
client: CLIENT_NAME,
|
|
605
|
+
event_time: new Date().toISOString(),
|
|
606
|
+
...clientEvent,
|
|
607
|
+
}),
|
|
608
|
+
resolve,
|
|
609
|
+
);
|
|
610
|
+
|
|
611
|
+
return promise;
|
|
612
|
+
}
|
|
613
|
+
|
|
614
|
+
async completeCode(request: CompletionRequest): Promise<CompletionResponse|null> {
|
|
615
|
+
if (!InspectorFrontendHostInstance.aidaCodeComplete) {
|
|
616
|
+
throw new Error('aidaCodeComplete is not available');
|
|
617
|
+
}
|
|
618
|
+
const {promise, resolve} = Promise.withResolvers<AidaCodeCompleteResult>();
|
|
619
|
+
InspectorFrontendHostInstance.aidaCodeComplete(JSON.stringify(request), resolve);
|
|
620
|
+
const completeCodeResult = await promise;
|
|
621
|
+
|
|
622
|
+
if (completeCodeResult.error) {
|
|
623
|
+
throw new Error(`Cannot send request: ${completeCodeResult.error} ${completeCodeResult.detail || ''}`);
|
|
624
|
+
}
|
|
625
|
+
const response = completeCodeResult.response;
|
|
626
|
+
if (!response?.length) {
|
|
627
|
+
throw new Error('Empty response');
|
|
628
|
+
}
|
|
629
|
+
let parsedResponse;
|
|
630
|
+
try {
|
|
631
|
+
parsedResponse = JSON.parse(response);
|
|
632
|
+
} catch (error) {
|
|
633
|
+
throw new Error('Cannot parse response: ' + response, {cause: error});
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
const generatedSamples: GenerationSample[] = [];
|
|
637
|
+
let metadata: ResponseMetadata = {rpcGlobalId: 0};
|
|
638
|
+
if ('metadata' in parsedResponse) {
|
|
639
|
+
metadata = parsedResponse.metadata;
|
|
640
|
+
}
|
|
641
|
+
|
|
642
|
+
if ('generatedSamples' in parsedResponse) {
|
|
643
|
+
for (const generatedSample of parsedResponse.generatedSamples) {
|
|
644
|
+
const sample: GenerationSample = {
|
|
645
|
+
generationString: generatedSample.generationString,
|
|
646
|
+
score: generatedSample.score,
|
|
647
|
+
sampleId: generatedSample.sampleId,
|
|
648
|
+
};
|
|
649
|
+
if ('metadata' in generatedSample && 'attributionMetadata' in generatedSample.metadata) {
|
|
650
|
+
sample.attributionMetadata = generatedSample.metadata.attributionMetadata;
|
|
651
|
+
}
|
|
652
|
+
generatedSamples.push(sample);
|
|
653
|
+
}
|
|
654
|
+
} else {
|
|
655
|
+
return null;
|
|
656
|
+
}
|
|
657
|
+
|
|
658
|
+
return {generatedSamples, metadata};
|
|
659
|
+
}
|
|
660
|
+
}
|
|
661
|
+
|
|
662
|
+
export function convertToUserTierEnum(userTier: string|undefined): UserTier {
|
|
663
|
+
if (userTier) {
|
|
664
|
+
switch (userTier) {
|
|
665
|
+
case 'TESTERS':
|
|
666
|
+
return UserTier.TESTERS;
|
|
667
|
+
case 'BETA':
|
|
668
|
+
return UserTier.BETA;
|
|
669
|
+
case 'PUBLIC':
|
|
670
|
+
return UserTier.PUBLIC;
|
|
671
|
+
}
|
|
672
|
+
}
|
|
673
|
+
return UserTier.BETA;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
let hostConfigTrackerInstance: HostConfigTracker|undefined;
|
|
677
|
+
|
|
678
|
+
export class HostConfigTracker extends Common.ObjectWrapper.ObjectWrapper<EventTypes> {
|
|
679
|
+
#pollTimer?: number;
|
|
680
|
+
#aidaAvailability?: AidaAccessPreconditions;
|
|
681
|
+
|
|
682
|
+
private constructor() {
|
|
683
|
+
super();
|
|
684
|
+
}
|
|
685
|
+
|
|
686
|
+
static instance(): HostConfigTracker {
|
|
687
|
+
if (!hostConfigTrackerInstance) {
|
|
688
|
+
hostConfigTrackerInstance = new HostConfigTracker();
|
|
689
|
+
}
|
|
690
|
+
return hostConfigTrackerInstance;
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
override addEventListener(eventType: Events, listener: Common.EventTarget.EventListener<EventTypes, Events>):
|
|
694
|
+
Common.EventTarget.EventDescriptor<EventTypes> {
|
|
695
|
+
const isFirst = !this.hasEventListeners(eventType);
|
|
696
|
+
const eventDescriptor = super.addEventListener(eventType, listener);
|
|
697
|
+
if (isFirst) {
|
|
698
|
+
window.clearTimeout(this.#pollTimer);
|
|
699
|
+
void this.pollAidaAvailability();
|
|
700
|
+
}
|
|
701
|
+
return eventDescriptor;
|
|
702
|
+
}
|
|
703
|
+
|
|
704
|
+
override removeEventListener(eventType: Events, listener: Common.EventTarget.EventListener<EventTypes, Events>):
|
|
705
|
+
void {
|
|
706
|
+
super.removeEventListener(eventType, listener);
|
|
707
|
+
if (!this.hasEventListeners(eventType)) {
|
|
708
|
+
window.clearTimeout(this.#pollTimer);
|
|
709
|
+
}
|
|
710
|
+
}
|
|
711
|
+
|
|
712
|
+
async pollAidaAvailability(): Promise<void> {
|
|
713
|
+
this.#pollTimer = window.setTimeout(() => this.pollAidaAvailability(), 2000);
|
|
714
|
+
const currentAidaAvailability = await AidaClient.checkAccessPreconditions();
|
|
715
|
+
if (currentAidaAvailability !== this.#aidaAvailability) {
|
|
716
|
+
this.#aidaAvailability = currentAidaAvailability;
|
|
717
|
+
const config =
|
|
718
|
+
await new Promise<Root.Runtime.HostConfig>(resolve => InspectorFrontendHostInstance.getHostConfig(resolve));
|
|
719
|
+
Object.assign(Root.Runtime.hostConfig, config);
|
|
720
|
+
// TODO(crbug.com/442545623): Send `currentAidaAvailability` to the listeners as part of the event so that
|
|
721
|
+
// `await AidaClient.checkAccessPreconditions()` does not need to be called again in the event handlers.
|
|
722
|
+
this.dispatchEventToListeners(Events.AIDA_AVAILABILITY_CHANGED);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
|
|
727
|
+
export const enum Events {
|
|
728
|
+
AIDA_AVAILABILITY_CHANGED = 'aidaAvailabilityChanged',
|
|
729
|
+
}
|
|
730
|
+
|
|
731
|
+
export interface EventTypes {
|
|
732
|
+
[Events.AIDA_AVAILABILITY_CHANGED]: void;
|
|
733
|
+
}
|