@codingame/monaco-vscode-chat-service-override 31.0.1 → 32.0.1
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/index.d.ts +1 -1
- package/index.js +22 -5
- package/package.json +5 -5
- package/vscode/src/vs/base/common/defaultAccount.d.ts +69 -0
- package/vscode/src/vs/base/common/defaultAccount.js +12 -0
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.d.ts +91 -22
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostProtocolClient.js +301 -68
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.d.ts +24 -5
- package/vscode/src/vs/platform/agentHost/browser/remoteAgentHostServiceImpl.js +89 -16
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.d.ts +17 -5
- package/vscode/src/vs/platform/agentHost/browser/webSocketClientTransport.js +73 -10
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.d.ts +32 -6
- package/vscode/src/vs/platform/agentHost/common/agentHostFileSystemProvider.js +32 -20
- package/vscode/src/vs/platform/agentHost/common/agentHostPermissionService.d.ts +37 -0
- package/vscode/src/vs/platform/agentHost/common/agentHostPermissionService.js +15 -0
- package/vscode/src/vs/platform/agentHost/common/agentService.d.ts +242 -201
- package/vscode/src/vs/platform/agentHost/common/agentService.js +3 -1
- package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.d.ts +35 -0
- package/vscode/src/vs/platform/agentHost/common/ahpJsonlLogger.js +106 -0
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.d.ts +38 -30
- package/vscode/src/vs/platform/agentHost/common/state/agentSubscription.js +2 -1
- package/vscode/src/vs/platform/agentHost/common/state/protocol/errors.d.ts +114 -4
- package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.d.ts +10 -10
- package/vscode/src/vs/platform/agentHost/common/state/protocol/reducers.js +52 -19
- package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.d.ts +42 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/version/registry.js +7 -0
- package/vscode/src/vs/platform/agentHost/common/state/sessionActions.d.ts +42 -41
- package/vscode/src/vs/platform/agentHost/common/state/sessionTransport.d.ts +6 -6
- package/vscode/src/vs/platform/agentHost/common/transportConstants.d.ts +15 -0
- package/vscode/src/vs/platform/agentHost/common/transportConstants.js +6 -0
- package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.d.ts +4 -3
- package/vscode/src/vs/platform/agentPlugins/common/pluginParsers.js +4 -3
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.d.ts +4 -2
- package/vscode/src/vs/platform/networkFilter/common/networkFilterService.js +15 -7
- package/vscode/src/vs/workbench/contrib/browserView/common/browserChatToolReferenceNames.d.ts +19 -0
- package/vscode/src/vs/workbench/contrib/browserView/common/browserChatToolReferenceNames.js +17 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatAccessibilityService.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/accessibility/chatResponseAccessibleView.js +16 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityActions.js +14 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAccessibilityHelp.js +64 -59
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatAgentRecommendationActions.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCodeblockActions.js +31 -16
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatContextActions.js +18 -9
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.d.ts +16 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatCopyActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatDeveloperActions.js +30 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatFileTreeActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatForkActions.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatImportExport.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatLanguageModelActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatMoveActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatNewActions.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatOpenAgentDebugPanelAction.js +12 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPluginActions.js +27 -18
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatPromptNavigationActions.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQueueActions.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/chatQuickInputActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/codeBlockOperations.js +21 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/createPluginAction.js +22 -22
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/reviewEdits.d.ts +12 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/actions/reviewEdits.js +171 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginActions.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditor.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginEditor/agentPluginItems.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginRepositoryService.js +12 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.d.ts +0 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentPluginsView.js +16 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.d.ts +28 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostPermissionUiContribution.js +99 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentHost/agentHostSessionWorkingDirectoryResolver.js +11 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessions.contribution.js +9 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsActions.js +63 -53
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsPicker.js +10 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/agentSessionsQuickAccess.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjection.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionProjectionService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentSessionsExperiments.contribution.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/agentTitleBarStatusWidget.js +25 -48
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccess.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/experiments/unifiedQuickAccessActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/agentSessions/localAgentSessionsController.js +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.d.ts +8 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationDebugPanel.js +99 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationIcons.js +17 -30
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.d.ts +78 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemsModel.js +38 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.d.ts +35 -37
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidget.js +347 -326
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.d.ts +6 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationListWidgetUtils.js +1 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagement.contribution.js +113 -109
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.d.ts +37 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditor.js +436 -134
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationManagementEditorInput.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationWelcomePagePromptLaunchers.js +52 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationCreatorService.js +7 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/customizationHarnessService.js +13 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.d.ts +23 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedAgentPluginDetail.js +60 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.d.ts +25 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/embeddedMcpServerDetail.js +93 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.d.ts +9 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/mcpListWidget.js +73 -104
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationManagement.css +272 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/media/aiCustomizationWelcomePromptLaunchers.css +12 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.d.ts +30 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/pluginListWidget.js +430 -185
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.d.ts +5 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/attachments/chatAttachmentResolveService.js +44 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.contribution.js +480 -279
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.view.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chat.view.contribution.js +5 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatCustomizationDiscoveryRenderer.js +32 -32
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheDiff.d.ts +138 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheDiff.js +221 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.d.ts +84 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugCacheExplorerView.js +1216 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugDetailPanel.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditor.js +32 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventDetailRenderer.js +26 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugEventList.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFilters.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowChartView.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugFlowGraph.js +28 -25
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHomeView.js +13 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugHookContentRenderer.js +17 -17
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugLogsView.js +25 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugMessageContentRenderer.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugModelTurnContentRenderer.js +23 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugOverviewView.js +68 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugToolCallContentRenderer.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/chatDebugTypes.js +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatDebug/media/chatDebug.css +650 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingCodeEditorIntegration.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.d.ts +46 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorActions.js +533 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.d.ts +29 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingEditorOverlay.js +390 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationModelManager.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.d.ts +101 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingExplanationWidget.js +509 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedDocumentEntry.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedFileEntry.js +18 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingModifiedNotebookEntry.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingServiceImpl.js +11 -11
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/chatEditingSession.js +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingEditorOverlay.css +130 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/media/chatEditingExplanationWidget.css +276 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatEditing/notebook/chatEditingNotebookEditorIntegration.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatImageCarouselService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagement.contribution.js +8 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatManagementEditorInput.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.d.ts +1 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsViewModel.js +6 -87
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/chatModelsWidget.js +116 -182
- package/vscode/src/vs/workbench/contrib/chat/browser/chatManagement/media/chatModelsWidget.css +12 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/chatOutputItemRenderer.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/chatParticipant.contribution.js +31 -31
- package/vscode/src/vs/workbench/contrib/chat/browser/chatRepoInfo.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupContributions.js +61 -41
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupController.js +10 -10
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupGrowthSession.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupProviders.js +27 -27
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSetup/chatSetupRunner.js +16 -13
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.d.ts +20 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatSlashCommands.js +106 -36
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.d.ts +25 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusDashboard.js +629 -425
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusEntry.js +105 -29
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/chatStatusItemService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/chatStatus/media/chatStatus.css +175 -148
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipCatalog.js +20 -33
- package/vscode/src/vs/workbench/contrib/chat/browser/chatTipService.js +9 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/chatWindowNotifier.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/claudePluginRecommendations.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/defaultModelContribution.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementActions.js +4 -4
- package/vscode/src/vs/workbench/contrib/chat/browser/enablementStatusWidget.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.d.ts +58 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/githubRepoFetcher.js +339 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/languageModelsConfigurationService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/media/planReviewFeedback.css +160 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.d.ts +9 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorActions.js +123 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.d.ts +37 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackEditorContribution.js +572 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.d.ts +36 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/planReviewFeedback/planReviewFeedbackService.js +167 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.d.ts +49 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginGitCommandService.js +315 -19
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginInstallService.js +45 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginSources.js +15 -15
- package/vscode/src/vs/workbench/contrib/chat/browser/pluginUrlHandler.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/chatModeActions.js +6 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookActions.js +44 -40
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/hookUtils.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptCodingAgentActionOverlay.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptFileContributions.js +4 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptToolsCodeLensProvider.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/promptUrlHandler.js +8 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/runPromptAction.js +7 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/saveAsPromptFileActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptSyntax/skillActions.js +3 -3
- package/vscode/src/vs/workbench/contrib/chat/browser/promptsDebugContribution.js +20 -20
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsConfirmationService.js +39 -39
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.d.ts +9 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/languageModelToolsService.js +111 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.d.ts +3 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/renameTool.js +13 -47
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.d.ts +3 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolHelpers.js +4 -8
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolResultCompressorService.d.ts +18 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/toolResultCompressorService.js +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.d.ts +3 -7
- package/vscode/src/vs/workbench/contrib/chat/browser/tools/usagesTool.js +14 -52
- package/vscode/src/vs/workbench/contrib/chat/browser/viewsWelcome/chatViewsWelcomeHandler.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.d.ts +3 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/chatWidgetService.js +17 -2
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.d.ts +2 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatQueuePickerActionItem.js +23 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.d.ts +39 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletions.js +136 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.d.ts +72 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/agentHostInputCompletionsBase.js +56 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.d.ts +7 -0
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletionUtils.js +14 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputCompletions.js +41 -26
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorContrib.js +30 -12
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/editor/chatInputEditorHover.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/chatQuick.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/editor/chatEditor.js +2 -5
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewPane.js +25 -6
- package/vscode/src/vs/workbench/contrib/chat/browser/widgetHosts/viewPane/chatViewTitleControl.js +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.d.ts +2 -2
- package/vscode/src/vs/workbench/contrib/chat/common/chatDebugServiceImpl.js +5 -4
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceImpl.js +108 -45
- package/vscode/src/vs/workbench/contrib/chat/common/chatService/chatServiceTelemetry.js +7 -3
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionOperationLog.js +3 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.d.ts +20 -1
- package/vscode/src/vs/workbench/contrib/chat/common/model/chatSessionStore.js +65 -26
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.d.ts +5 -3
- package/vscode/src/vs/workbench/contrib/chat/common/participants/chatSlashCommands.js +38 -11
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.d.ts +17 -1
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginServiceImpl.js +165 -16
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/pluginMarketplaceService.js +62 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/chatPromptFilesContribution.js +18 -18
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/PromptHeaderDefinitionProvider.js +2 -1
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptCodeActions.js +5 -5
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHeaderAutocompletion.js +15 -21
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.d.ts +1 -3
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptHovers.js +18 -24
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.d.ts +4 -2
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/languageProviders/promptValidator.js +203 -180
- package/vscode/src/vs/workbench/contrib/chat/common/voiceChatService.js +1 -1
- package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.d.ts +30 -0
- package/vscode/src/vs/workbench/contrib/chat/common/workingDirectory.js +35 -0
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/editTelemetry/browser/telemetry/aiEditTelemetry/aiEditTelemetryServiceImpl.js +27 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.d.ts +1 -1
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChat.contribution.js +14 -49
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.d.ts +0 -16
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatActions.js +35 -177
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatDefaultModel.js +2 -8
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.d.ts +1 -2
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatNotebook.js +2 -3
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.d.ts +4 -4
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatSessionServiceImpl.js +11 -11
- package/vscode/src/vs/workbench/contrib/mcp/browser/mcpPromptArgumentPick.js +14 -14
- package/vscode/src/vs/workbench/contrib/notebook/browser/contrib/chat/notebookChatUtils.js +1 -1
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/cellChatActions.js +13 -13
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebook.chat.contribution.js +5 -5
- package/vscode/src/vs/workbench/contrib/notebook/browser/controller/chat/notebookChatContext.js +1 -1
- package/vscode/src/vs/workbench/contrib/remoteCodingAgents/browser/remoteCodingAgents.contribution.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatAccessibilityHelp.js +16 -16
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatActions.js +20 -20
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.d.ts +29 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chat/browser/terminalChatWidget.js +129 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/taskHelpers.js +3 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.d.ts +2 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/terminal.chatAgentTools.contribution.js +14 -6
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalLastCommandTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.d.ts +1 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalOutputTool.js +12 -38
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/getTerminalSelectionTool.js +3 -3
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/killTerminalTool.js +4 -4
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/runInTerminalConfirmationTool.js +2 -2
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.d.ts +12 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/sendToTerminalTool.js +77 -70
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/createAndRunTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/getTaskOutputTool.js +7 -7
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/runTaskTool.js +14 -14
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/task/taskHelpers.js +1 -1
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.d.ts +32 -0
- package/vscode/src/vs/workbench/contrib/terminalContrib/chatAgentTools/browser/tools/terminalOutputCompressor.js +232 -0
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostPermissionService.d.ts +83 -0
- package/vscode/src/vs/workbench/services/agentHost/common/agentHostPermissionService.js +243 -0
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.d.ts +0 -749
- package/vscode/src/vs/platform/agentHost/common/state/protocol/commands.js +0 -14
- package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.d.ts +0 -17
- package/vscode/src/vs/platform/agentHost/common/state/sessionCapabilities.js +0 -5
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.d.ts +0 -40
- package/vscode/src/vs/platform/agentHost/common/state/sessionProtocol.js +0 -14
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.d.ts +0 -131
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/aiCustomizationItemSource.js +0 -363
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.d.ts +0 -24
- package/vscode/src/vs/workbench/contrib/chat/browser/aiCustomization/promptsServiceCustomizationItemProvider.js +0 -306
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.d.ts +0 -23
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/chatStatusWidget.js +0 -97
- package/vscode/src/vs/workbench/contrib/chat/browser/widget/input/media/chatStatusWidget.css +0 -57
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/chat/common/plugins/agentPluginService.js +0 -29
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.d.ts +0 -50
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookClaudeCompat.js +0 -78
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.d.ts +0 -77
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCompatibility.js +0 -120
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.d.ts +0 -10
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/hookCopilotCliCompat.js +0 -23
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.d.ts +0 -242
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/service/promptsServiceImpl.js +0 -1701
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.d.ts +0 -191
- package/vscode/src/vs/workbench/contrib/chat/common/promptSyntax/utils/promptFilesLocator.js +0 -728
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.d.ts +0 -14
- package/vscode/src/vs/workbench/contrib/inlineChat/browser/inlineChatHistoryService.js +0 -69
|
@@ -0,0 +1,1216 @@
|
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from '@codingame/monaco-vscode-api/external/tslib/tslib.es6';
|
|
3
|
+
import { $ as $$1, append, hide, show, clearNode, addDisposableListener, EventType, createTextNode } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
4
|
+
import { Sash, Orientation, SashState } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/sash/sash';
|
|
5
|
+
import { BreadcrumbsWidget } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/breadcrumbs/breadcrumbsWidget';
|
|
6
|
+
import { RunOnceScheduler } from '@codingame/monaco-vscode-api/vscode/vs/base/common/async';
|
|
7
|
+
import { Codicon } from '@codingame/monaco-vscode-api/vscode/vs/base/common/codicons';
|
|
8
|
+
import { safeIntl } from '@codingame/monaco-vscode-api/vscode/vs/base/common/date';
|
|
9
|
+
import { equals } from '@codingame/monaco-vscode-api/vscode/vs/base/common/objects';
|
|
10
|
+
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
11
|
+
import { Disposable, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
12
|
+
import { localize } from '@codingame/monaco-vscode-api/vscode/vs/nls';
|
|
13
|
+
import { defaultBreadcrumbsWidgetStyles } from '@codingame/monaco-vscode-api/vscode/vs/platform/theme/browser/defaultStyles';
|
|
14
|
+
import { linesDiffComputers } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/diff/linesDiffComputers';
|
|
15
|
+
import { IChatDebugService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatDebugService.service';
|
|
16
|
+
import { IChatService } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/chatService/chatService.service';
|
|
17
|
+
import { LocalChatSessionUri } from '@codingame/monaco-vscode-api/vscode/vs/workbench/contrib/chat/common/model/chatUri';
|
|
18
|
+
import { diffPromptSignature, appendToolsDrift, appendSystemDrift, parseInputMessages, CacheDiffKind } from './chatDebugCacheDiff.js';
|
|
19
|
+
import { setupBreadcrumbKeyboardNavigation, TextBreadcrumbItem } from './chatDebugTypes.js';
|
|
20
|
+
|
|
21
|
+
const $ = $$1;
|
|
22
|
+
const numberFormatter = safeIntl.NumberFormat();
|
|
23
|
+
const timeFormatter = safeIntl.DateTimeFormat(undefined, {
|
|
24
|
+
hour: "numeric",
|
|
25
|
+
minute: "2-digit",
|
|
26
|
+
second: "2-digit"
|
|
27
|
+
});
|
|
28
|
+
const RAIL_DEFAULT_WIDTH = 280;
|
|
29
|
+
const RAIL_MIN_WIDTH = 180;
|
|
30
|
+
const RAIL_MAX_WIDTH = 600;
|
|
31
|
+
const CURRENT_CONTINUATION_DELTA_COMPONENT = "current continuation delta";
|
|
32
|
+
var CacheExplorerNavigation;
|
|
33
|
+
(function(CacheExplorerNavigation) {
|
|
34
|
+
CacheExplorerNavigation["Home"] = "home";
|
|
35
|
+
CacheExplorerNavigation["Overview"] = "overview";
|
|
36
|
+
})(CacheExplorerNavigation || (CacheExplorerNavigation = {}));
|
|
37
|
+
let ChatDebugCacheExplorerView = class ChatDebugCacheExplorerView extends Disposable {
|
|
38
|
+
constructor(parent, chatService, chatDebugService) {
|
|
39
|
+
super();
|
|
40
|
+
this.chatService = chatService;
|
|
41
|
+
this.chatDebugService = chatDebugService;
|
|
42
|
+
this._onNavigate = this._register(( new Emitter()));
|
|
43
|
+
this.onNavigate = this._onNavigate.event;
|
|
44
|
+
this.railWidth = RAIL_DEFAULT_WIDTH;
|
|
45
|
+
this.loadDisposables = this._register(( new DisposableStore()));
|
|
46
|
+
this.modelTurns = [];
|
|
47
|
+
this.selectedIndex = -1;
|
|
48
|
+
this.renderToken = 0;
|
|
49
|
+
this.resolvedCache = ( new Map());
|
|
50
|
+
this.openComponents = ( new Set(["system", "tools"]));
|
|
51
|
+
this.collapsedGroups = ( new Set());
|
|
52
|
+
this.container = append(parent, $(".chat-debug-cache"));
|
|
53
|
+
hide(this.container);
|
|
54
|
+
const breadcrumbContainer = append(this.container, $(".chat-debug-breadcrumb"));
|
|
55
|
+
this.breadcrumbWidget = this._register(( new BreadcrumbsWidget(
|
|
56
|
+
breadcrumbContainer,
|
|
57
|
+
3,
|
|
58
|
+
undefined,
|
|
59
|
+
Codicon.chevronRight,
|
|
60
|
+
defaultBreadcrumbsWidgetStyles
|
|
61
|
+
)));
|
|
62
|
+
this._register(
|
|
63
|
+
setupBreadcrumbKeyboardNavigation(breadcrumbContainer, this.breadcrumbWidget)
|
|
64
|
+
);
|
|
65
|
+
this._register(this.breadcrumbWidget.onDidSelectItem(e => {
|
|
66
|
+
if (e.type === "select" && e.item instanceof TextBreadcrumbItem) {
|
|
67
|
+
this.breadcrumbWidget.setSelection(undefined);
|
|
68
|
+
const items = this.breadcrumbWidget.getItems();
|
|
69
|
+
const idx = items.indexOf(e.item);
|
|
70
|
+
if (idx === 0) {
|
|
71
|
+
this._onNavigate.fire(CacheExplorerNavigation.Home);
|
|
72
|
+
} else if (idx === 1) {
|
|
73
|
+
this._onNavigate.fire(CacheExplorerNavigation.Overview);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}));
|
|
77
|
+
const body = append(this.container, $(".chat-debug-cache-body"));
|
|
78
|
+
this.rail = append(body, $(".chat-debug-cache-rail"));
|
|
79
|
+
this.rail.style.width = `${this.railWidth}px`;
|
|
80
|
+
this.railList = append(this.rail, $(".chat-debug-cache-rail-list"));
|
|
81
|
+
this.content = append(body, $(".chat-debug-cache-content"));
|
|
82
|
+
this.sash = this._register(( new Sash(body, {
|
|
83
|
+
getVerticalSashLeft: () => this.railWidth
|
|
84
|
+
}, {
|
|
85
|
+
orientation: Orientation.VERTICAL
|
|
86
|
+
})));
|
|
87
|
+
this.sash.state = SashState.Enabled;
|
|
88
|
+
let sashStartWidth;
|
|
89
|
+
this._register(this.sash.onDidStart(() => sashStartWidth = this.railWidth));
|
|
90
|
+
this._register(this.sash.onDidEnd(() => {
|
|
91
|
+
sashStartWidth = undefined;
|
|
92
|
+
this.sash.layout();
|
|
93
|
+
}));
|
|
94
|
+
this._register(this.sash.onDidChange(e => {
|
|
95
|
+
if (sashStartWidth === undefined) {
|
|
96
|
+
return;
|
|
97
|
+
}
|
|
98
|
+
const delta = e.currentX - e.startX;
|
|
99
|
+
const next = Math.max(RAIL_MIN_WIDTH, Math.min(RAIL_MAX_WIDTH, sashStartWidth + delta));
|
|
100
|
+
this.railWidth = next;
|
|
101
|
+
this.rail.style.width = `${next}px`;
|
|
102
|
+
this.sash.layout();
|
|
103
|
+
}));
|
|
104
|
+
this.refreshScheduler = this._register(( new RunOnceScheduler(() => this.render(), 50)));
|
|
105
|
+
}
|
|
106
|
+
setSession(sessionResource) {
|
|
107
|
+
if (!this.currentSessionResource || ( this.currentSessionResource.toString()) !== ( sessionResource.toString())) {
|
|
108
|
+
this.resolvedCache.clear();
|
|
109
|
+
this.collapsedGroups.clear();
|
|
110
|
+
this.openComponents.clear();
|
|
111
|
+
this.openComponents.add("system");
|
|
112
|
+
this.openComponents.add("tools");
|
|
113
|
+
this.selectedIndex = -1;
|
|
114
|
+
}
|
|
115
|
+
this.currentSessionResource = sessionResource;
|
|
116
|
+
}
|
|
117
|
+
show() {
|
|
118
|
+
show(this.container);
|
|
119
|
+
this.render();
|
|
120
|
+
}
|
|
121
|
+
hide() {
|
|
122
|
+
hide(this.container);
|
|
123
|
+
this.refreshScheduler.cancel();
|
|
124
|
+
}
|
|
125
|
+
refresh() {
|
|
126
|
+
if (this.container.style.display !== "none" && !this.refreshScheduler.isScheduled()) {
|
|
127
|
+
this.refreshScheduler.schedule();
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
updateBreadcrumb() {
|
|
131
|
+
if (!this.currentSessionResource) {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const sessionTitle = this.chatService.getSessionTitle(this.currentSessionResource) || LocalChatSessionUri.parseLocalSessionId(this.currentSessionResource) || ( this.currentSessionResource.toString());
|
|
135
|
+
this.breadcrumbWidget.setItems([( new TextBreadcrumbItem(( localize(6018, "Agent Debug Logs")), true)), ( new TextBreadcrumbItem(sessionTitle, true)), ( new TextBreadcrumbItem(( localize(6019, "Cache Explorer"))))]);
|
|
136
|
+
}
|
|
137
|
+
async render() {
|
|
138
|
+
const token = ++this.renderToken;
|
|
139
|
+
const isCurrent = () => token === this.renderToken;
|
|
140
|
+
this.updateBreadcrumb();
|
|
141
|
+
this.loadDisposables.clear();
|
|
142
|
+
clearNode(this.railList);
|
|
143
|
+
clearNode(this.content);
|
|
144
|
+
if (!this.currentSessionResource) {
|
|
145
|
+
return;
|
|
146
|
+
}
|
|
147
|
+
const events = this.chatDebugService.getEvents(this.currentSessionResource);
|
|
148
|
+
this.modelTurns = events.filter(e => e.kind === "modelTurn");
|
|
149
|
+
const userMessages = events.filter(e => e.kind === "userMessage");
|
|
150
|
+
if (this.modelTurns.length === 0) {
|
|
151
|
+
const empty = append(this.content, $(".chat-debug-cache-empty"));
|
|
152
|
+
empty.textContent = ( localize(6020, "No model turns recorded for this session yet."));
|
|
153
|
+
return;
|
|
154
|
+
}
|
|
155
|
+
if (this.selectedIndex < 0 || this.selectedIndex >= this.modelTurns.length) {
|
|
156
|
+
this.selectedIndex = this.modelTurns.length - 1;
|
|
157
|
+
}
|
|
158
|
+
this.renderRail(buildTurnGroups(this.modelTurns, userMessages));
|
|
159
|
+
this.renderTitleRow();
|
|
160
|
+
const bEvent = this.modelTurns[this.selectedIndex];
|
|
161
|
+
const aEvent = this.selectedIndex > 0 ? this.modelTurns[this.selectedIndex - 1] : undefined;
|
|
162
|
+
if (!aEvent) {
|
|
163
|
+
const b = await this.resolveSide(bEvent);
|
|
164
|
+
if (!isCurrent()) {
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
this.renderSingleSummary(b);
|
|
168
|
+
return;
|
|
169
|
+
}
|
|
170
|
+
const [a, b] = await Promise.all([this.resolveSide(aEvent), this.resolveSide(bEvent)]);
|
|
171
|
+
if (!isCurrent()) {
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
const compareInputMessages = shouldCompareInputMessages(a, b);
|
|
175
|
+
const diff = compareInputMessages ? diffPromptSignature(a.inputMessages, b.inputMessages) : diffPromptSignature([], []);
|
|
176
|
+
const drift = appendToolsDrift(appendSystemDrift([...diff.drift], a.system, b.system), a.tools, b.tools);
|
|
177
|
+
this.renderSummary(a, b, diff);
|
|
178
|
+
this.renderSignature(a, b, diff, compareInputMessages);
|
|
179
|
+
this.renderRequestOptions(a, b);
|
|
180
|
+
this.renderComponents(drift, a, b, compareInputMessages);
|
|
181
|
+
}
|
|
182
|
+
async resolveSide(event) {
|
|
183
|
+
let content;
|
|
184
|
+
if (event.id) {
|
|
185
|
+
if (( this.resolvedCache.has(event.id))) {
|
|
186
|
+
content = this.resolvedCache.get(event.id);
|
|
187
|
+
} else {
|
|
188
|
+
const r = await this.chatDebugService.resolveEvent(event.id);
|
|
189
|
+
content = r && r.kind === "modelTurn" ? r : undefined;
|
|
190
|
+
this.resolvedCache.set(event.id, content);
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
const system = findSection(content?.sections, "System");
|
|
194
|
+
const tools = findSection(content?.sections, "Tools");
|
|
195
|
+
const requestShapeJson = findSection(content?.sections, "Request Shape");
|
|
196
|
+
const inputMessagesJson = findSection(content?.sections, "Input Messages");
|
|
197
|
+
const rawMessages = parseInputMessages(inputMessagesJson);
|
|
198
|
+
let stripFrom = 0;
|
|
199
|
+
if (system) {
|
|
200
|
+
while (stripFrom < rawMessages.length && rawMessages[stripFrom].role === "system") {
|
|
201
|
+
stripFrom++;
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
const inputMessages = stripFrom > 0 ? rawMessages.slice(stripFrom) : rawMessages;
|
|
205
|
+
return {
|
|
206
|
+
event,
|
|
207
|
+
content,
|
|
208
|
+
system,
|
|
209
|
+
tools,
|
|
210
|
+
inputMessages,
|
|
211
|
+
requestShape: describeRequestShape(inputMessages, requestShapeJson)
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
renderRail(groups) {
|
|
215
|
+
for (const group of groups) {
|
|
216
|
+
const collapsed = ( this.collapsedGroups.has(group.key));
|
|
217
|
+
const header = append(this.railList, $(".chat-debug-cache-group-header"));
|
|
218
|
+
if (collapsed) {
|
|
219
|
+
header.classList.add("is-collapsed");
|
|
220
|
+
}
|
|
221
|
+
header.tabIndex = 0;
|
|
222
|
+
header.setAttribute("role", "button");
|
|
223
|
+
header.setAttribute("aria-expanded", collapsed ? "false" : "true");
|
|
224
|
+
header.title = ( localize(6021, "Toggle group"));
|
|
225
|
+
const topLine = append(header, $(".chat-debug-cache-group-top"));
|
|
226
|
+
append(topLine, $("span.chat-debug-cache-group-chev"));
|
|
227
|
+
const headerLine = append(topLine, $(".chat-debug-cache-group-prompt"));
|
|
228
|
+
headerLine.textContent = group.userMessage?.message?.trim() || ( localize(6022, "(no prompt captured)"));
|
|
229
|
+
const countBadge = append(topLine, $("span.chat-debug-cache-group-count"));
|
|
230
|
+
countBadge.textContent = String(group.turns.length);
|
|
231
|
+
const headerMeta = append(header, $(".chat-debug-cache-group-meta"));
|
|
232
|
+
headerMeta.textContent = group.key;
|
|
233
|
+
headerMeta.title = ( localize(6023, "Request id: {0}", group.key));
|
|
234
|
+
const toggle = () => {
|
|
235
|
+
if (( this.collapsedGroups.has(group.key))) {
|
|
236
|
+
this.collapsedGroups.delete(group.key);
|
|
237
|
+
} else {
|
|
238
|
+
this.collapsedGroups.add(group.key);
|
|
239
|
+
}
|
|
240
|
+
this.refresh();
|
|
241
|
+
};
|
|
242
|
+
this.loadDisposables.add(addDisposableListener(header, EventType.CLICK, toggle));
|
|
243
|
+
this.loadDisposables.add(addDisposableListener(header, EventType.KEY_DOWN, e => {
|
|
244
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
245
|
+
e.preventDefault();
|
|
246
|
+
toggle();
|
|
247
|
+
}
|
|
248
|
+
}));
|
|
249
|
+
if (collapsed) {
|
|
250
|
+
continue;
|
|
251
|
+
}
|
|
252
|
+
for (const {
|
|
253
|
+
turn: evt,
|
|
254
|
+
index: i
|
|
255
|
+
} of group.turns) {
|
|
256
|
+
const row = append(this.railList, $(".chat-debug-cache-turn"));
|
|
257
|
+
if (i === this.selectedIndex) {
|
|
258
|
+
row.classList.add("is-selected");
|
|
259
|
+
}
|
|
260
|
+
const idx = append(row, $(".chat-debug-cache-turn-idx"));
|
|
261
|
+
idx.textContent = String(i).padStart(2, " ");
|
|
262
|
+
const main = append(row, $(".chat-debug-cache-turn-main"));
|
|
263
|
+
const top = append(main, $(".chat-debug-cache-turn-top"));
|
|
264
|
+
const source = append(top, $("span.chat-debug-cache-turn-source"));
|
|
265
|
+
source.textContent = evt.requestName || ( localize(6024, "Model Turn"));
|
|
266
|
+
if (evt.cachedTokens !== undefined && evt.inputTokens) {
|
|
267
|
+
const hit = computeCacheHit(evt);
|
|
268
|
+
const hitChip = append(top, $(
|
|
269
|
+
"span.chat-debug-cache-turn-chip.chat-debug-cache-turn-hit",
|
|
270
|
+
undefined,
|
|
271
|
+
( localize(6025, "[cache {0}%]", formatCachePctInt(hit)))
|
|
272
|
+
));
|
|
273
|
+
if (hit < 90) {
|
|
274
|
+
hitChip.classList.add("is-bad");
|
|
275
|
+
}
|
|
276
|
+
}
|
|
277
|
+
if (evt.durationInMillis !== undefined) {
|
|
278
|
+
append(top, $("span.chat-debug-cache-turn-chip", undefined, ( localize(
|
|
279
|
+
6026,
|
|
280
|
+
"[{0}ms]",
|
|
281
|
+
numberFormatter.value.format(Math.round(evt.durationInMillis))
|
|
282
|
+
))));
|
|
283
|
+
}
|
|
284
|
+
append(top, $(
|
|
285
|
+
"span.chat-debug-cache-turn-chip",
|
|
286
|
+
undefined,
|
|
287
|
+
`[${timeFormatter.value.format(evt.created)}]`
|
|
288
|
+
));
|
|
289
|
+
if (evt.model) {
|
|
290
|
+
const sub = append(main, $(".chat-debug-cache-turn-sub"));
|
|
291
|
+
sub.textContent = evt.model;
|
|
292
|
+
}
|
|
293
|
+
row.title = ( localize(6027, "Click to compare this request against the previous one"));
|
|
294
|
+
row.tabIndex = 0;
|
|
295
|
+
row.setAttribute("role", "button");
|
|
296
|
+
row.setAttribute("aria-selected", i === this.selectedIndex ? "true" : "false");
|
|
297
|
+
row.setAttribute("aria-label", ( localize(
|
|
298
|
+
6028,
|
|
299
|
+
"Turn {0}: {1}",
|
|
300
|
+
i,
|
|
301
|
+
evt.requestName ?? evt.model ?? ( localize(6024, "Model Turn"))
|
|
302
|
+
)));
|
|
303
|
+
const select = () => {
|
|
304
|
+
if (this.selectedIndex !== i) {
|
|
305
|
+
this.selectedIndex = i;
|
|
306
|
+
this.refresh();
|
|
307
|
+
}
|
|
308
|
+
};
|
|
309
|
+
this.loadDisposables.add(addDisposableListener(row, EventType.CLICK, select));
|
|
310
|
+
this.loadDisposables.add(addDisposableListener(row, EventType.KEY_DOWN, e => {
|
|
311
|
+
if (e.key === "Enter" || e.key === " ") {
|
|
312
|
+
e.preventDefault();
|
|
313
|
+
select();
|
|
314
|
+
}
|
|
315
|
+
}));
|
|
316
|
+
}
|
|
317
|
+
}
|
|
318
|
+
}
|
|
319
|
+
renderTitleRow() {
|
|
320
|
+
const titleRow = append(this.content, $(".chat-debug-cache-title-row"));
|
|
321
|
+
const title = append(titleRow, $("h2.chat-debug-cache-title"));
|
|
322
|
+
title.textContent = ( localize(6029, "Cache Explorer — Prefix Diff"));
|
|
323
|
+
}
|
|
324
|
+
renderSummary(a, b, diff) {
|
|
325
|
+
const row = append(this.content, $(".chat-debug-cache-summary"));
|
|
326
|
+
row.appendChild(this.renderSideCard(a, ( localize(6030, "Previous request"))));
|
|
327
|
+
row.appendChild(this.renderSideCard(b, ( localize(6031, "Request"))));
|
|
328
|
+
const breakCard = append(row, $(".chat-debug-cache-card.break"));
|
|
329
|
+
append(breakCard, $(".chat-debug-cache-card-h", undefined, ( localize(6032, "Cache performance"))));
|
|
330
|
+
const hit = computeCacheHit(b.event);
|
|
331
|
+
const inputTokens = b.event.inputTokens ?? 0;
|
|
332
|
+
const cachedTokens = b.event.cachedTokens ?? 0;
|
|
333
|
+
const lostTokens = Math.max(0, inputTokens - cachedTokens);
|
|
334
|
+
const optionsDiff = computeOptionsDiff(a, b);
|
|
335
|
+
const systemChanged = (a.system ?? "") !== (b.system ?? "");
|
|
336
|
+
const toolsChanged = (a.tools ?? "") !== (b.tools ?? "");
|
|
337
|
+
const continuationComparison = b.requestShape.isContinuation;
|
|
338
|
+
const expiration = !continuationComparison && isLikelyCacheExpiration(hit, diff, optionsDiff, systemChanged, toolsChanged);
|
|
339
|
+
const headline = append(breakCard, $(".chat-debug-cache-card-headline"));
|
|
340
|
+
if (expiration) {
|
|
341
|
+
headline.textContent = ( localize(6033, "{0}% cache hit — likely cache expiration", formatCachePct(hit)));
|
|
342
|
+
} else {
|
|
343
|
+
headline.textContent = ( localize(6034, "{0}% cache hit", formatCachePct(hit)));
|
|
344
|
+
}
|
|
345
|
+
const counts = append(breakCard, $(".chat-debug-cache-card-sub"));
|
|
346
|
+
counts.textContent = ( localize(
|
|
347
|
+
6035,
|
|
348
|
+
"{0} of {1} input tokens reused",
|
|
349
|
+
numberFormatter.value.format(cachedTokens),
|
|
350
|
+
numberFormatter.value.format(inputTokens)
|
|
351
|
+
));
|
|
352
|
+
if (b.requestShape.description) {
|
|
353
|
+
const shapeLine = append(
|
|
354
|
+
breakCard,
|
|
355
|
+
$(".chat-debug-cache-perf-line.chat-debug-cache-request-shape-note")
|
|
356
|
+
);
|
|
357
|
+
shapeLine.textContent = b.requestShape.description;
|
|
358
|
+
}
|
|
359
|
+
append(breakCard, $(".chat-debug-cache-perf-rule"));
|
|
360
|
+
append(breakCard, $(
|
|
361
|
+
".chat-debug-cache-perf-section-h",
|
|
362
|
+
undefined,
|
|
363
|
+
continuationComparison ? ( localize(6036, "Visible wire input")) : ( localize(6037, "Where the cache broke"))
|
|
364
|
+
));
|
|
365
|
+
const breakLine = append(breakCard, $(".chat-debug-cache-perf-line"));
|
|
366
|
+
if (expiration) {
|
|
367
|
+
breakLine.textContent = ( localize(
|
|
368
|
+
6038,
|
|
369
|
+
"The prompt prefix matches but the model still treated this as a fresh request. Most likely the cached entry expired between requests."
|
|
370
|
+
));
|
|
371
|
+
} else if (systemChanged) {
|
|
372
|
+
breakLine.textContent = ( localize(
|
|
373
|
+
6039,
|
|
374
|
+
"System instructions changed — the cache was invalidated even though the message prefix matches."
|
|
375
|
+
));
|
|
376
|
+
} else if (toolsChanged) {
|
|
377
|
+
breakLine.textContent = ( localize(
|
|
378
|
+
6040,
|
|
379
|
+
"Tool definitions changed — the catalog of available tools differs between requests, which invalidates the cache even though the message prefix matches."
|
|
380
|
+
));
|
|
381
|
+
if (continuationComparison && diff.break) {
|
|
382
|
+
const deltaName = diff.break.index === 0 ? ( localize(6041, "the first message")) : `messages[${diff.break.index}]`;
|
|
383
|
+
const deltaLine = append(breakCard, $(".chat-debug-cache-perf-line"));
|
|
384
|
+
deltaLine.textContent = ( localize(
|
|
385
|
+
6042,
|
|
386
|
+
"The visible wire delta also changed at {0}. That is expected when comparing consecutive continuation requests of different kinds, such as tool_search_output followed by a new user input.",
|
|
387
|
+
deltaName
|
|
388
|
+
));
|
|
389
|
+
}
|
|
390
|
+
} else if (continuationComparison && diff.break) {
|
|
391
|
+
const componentName = diff.break.index === 0 ? ( localize(6041, "the first message")) : `messages[${diff.break.index}]`;
|
|
392
|
+
breakLine.textContent = ( localize(
|
|
393
|
+
6043,
|
|
394
|
+
"The captured wire delta changed at {0} — {1}. This is a delta-to-delta comparison between consecutive Responses API requests, not the full reconstructed prompt prefix.",
|
|
395
|
+
componentName,
|
|
396
|
+
describeBreakKind(diff.break.kind, diff, b)
|
|
397
|
+
));
|
|
398
|
+
if (lostTokens > 0 && inputTokens > 0) {
|
|
399
|
+
const lostPct = (lostTokens / inputTokens) * 100;
|
|
400
|
+
const lossLine = append(breakCard, $(".chat-debug-cache-perf-line"));
|
|
401
|
+
lossLine.textContent = ( localize(
|
|
402
|
+
6044,
|
|
403
|
+
"Uncached in this request: {0} tokens ({1}% of this request)",
|
|
404
|
+
numberFormatter.value.format(lostTokens),
|
|
405
|
+
formatCachePct(lostPct)
|
|
406
|
+
));
|
|
407
|
+
}
|
|
408
|
+
} else if (diff.break) {
|
|
409
|
+
const componentName = diff.break.index === 0 ? ( localize(6041, "the first message")) : `messages[${diff.break.index}]`;
|
|
410
|
+
breakLine.textContent = ( localize(
|
|
411
|
+
6045,
|
|
412
|
+
"At {0} — {1}",
|
|
413
|
+
componentName,
|
|
414
|
+
describeBreakKind(diff.break.kind, diff, b)
|
|
415
|
+
));
|
|
416
|
+
if (lostTokens > 0 && inputTokens > 0) {
|
|
417
|
+
const lostPct = (lostTokens / inputTokens) * 100;
|
|
418
|
+
const lossLine = append(breakCard, $(".chat-debug-cache-perf-line"));
|
|
419
|
+
lossLine.textContent = ( localize(
|
|
420
|
+
6046,
|
|
421
|
+
"Lost: {0} tokens ({1}% of this request)",
|
|
422
|
+
numberFormatter.value.format(lostTokens),
|
|
423
|
+
formatCachePct(lostPct)
|
|
424
|
+
));
|
|
425
|
+
}
|
|
426
|
+
} else if (optionsDiff.length > 0) {
|
|
427
|
+
breakLine.textContent = ( localize(
|
|
428
|
+
6047,
|
|
429
|
+
"Request options changed — the cache was invalidated even though the message prefix matches."
|
|
430
|
+
));
|
|
431
|
+
} else if (continuationComparison) {
|
|
432
|
+
breakLine.textContent = ( localize(
|
|
433
|
+
6048,
|
|
434
|
+
"No divergence detected in the captured wire delta. The full reconstructed prompt prefix is provider-side for this continuation request."
|
|
435
|
+
));
|
|
436
|
+
} else {
|
|
437
|
+
breakLine.textContent = ( localize(6049, "No prefix divergence detected."));
|
|
438
|
+
}
|
|
439
|
+
append(breakCard, $(".chat-debug-cache-perf-rule"));
|
|
440
|
+
append(breakCard, $(".chat-debug-cache-perf-section-h", undefined, ( localize(6050, "Diff summary"))));
|
|
441
|
+
const summaryLine = append(breakCard, $(".chat-debug-cache-perf-line"));
|
|
442
|
+
const inPlaceChanged = diff.counts.contentDrift + diff.counts.lengthChange;
|
|
443
|
+
const addedInB = diff.counts.onlyInB;
|
|
444
|
+
const droppedFromA = diff.counts.onlyInA;
|
|
445
|
+
const parts = [( localize(6051, "{0} identical", diff.counts.identical)), ( localize(6052, "{0} in-place changed", inPlaceChanged))];
|
|
446
|
+
if (addedInB > 0) {
|
|
447
|
+
parts.push(( localize(6053, "{0} added in this request", addedInB)));
|
|
448
|
+
}
|
|
449
|
+
if (droppedFromA > 0) {
|
|
450
|
+
parts.push(( localize(6054, "{0} dropped from previous", droppedFromA)));
|
|
451
|
+
}
|
|
452
|
+
summaryLine.textContent = parts.join(" · ");
|
|
453
|
+
if (optionsDiff.length > 0) {
|
|
454
|
+
const optsLine = append(this.content, $(".chat-debug-cache-options-banner"));
|
|
455
|
+
optsLine.textContent = ( localize(6055, "Options changed: {0}", ( optionsDiff.map(
|
|
456
|
+
d => `${d.key} (${formatOptionValue(d.previous)} \u2192 ${formatOptionValue(d.current)})`
|
|
457
|
+
)).join(", ")));
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
renderSideCard(data, title) {
|
|
461
|
+
const card = $(".chat-debug-cache-card");
|
|
462
|
+
if (title) {
|
|
463
|
+
append(card, $(".chat-debug-cache-card-h", undefined, title));
|
|
464
|
+
}
|
|
465
|
+
this.appendKv(card, ( localize(6056, "model")), data.event.model ?? "—");
|
|
466
|
+
this.appendKv(card, ( localize(6057, "input tok")), formatTokens(data.event.inputTokens));
|
|
467
|
+
this.appendKv(card, ( localize(6058, "cached tok")), formatTokens(data.event.cachedTokens));
|
|
468
|
+
this.appendKv(card, ( localize(6059, "cache hit")), `${formatCachePct(computeCacheHit(data.event))}%`);
|
|
469
|
+
this.appendKv(card, ( localize(6060, "shape")), data.requestShape.label);
|
|
470
|
+
const startTime = data.event.created;
|
|
471
|
+
const endTime = data.event.durationInMillis !== undefined ? ( new Date(startTime.getTime() + data.event.durationInMillis)) : undefined;
|
|
472
|
+
this.appendKv(card, ( localize(6061, "startTime")), startTime.toISOString(), true);
|
|
473
|
+
if (endTime) {
|
|
474
|
+
this.appendKv(card, ( localize(6062, "endTime")), endTime.toISOString(), true);
|
|
475
|
+
}
|
|
476
|
+
if (data.event.durationInMillis !== undefined) {
|
|
477
|
+
this.appendKv(card, ( localize(6063, "duration")), `${numberFormatter.value.format(Math.round(data.event.durationInMillis))}ms`);
|
|
478
|
+
}
|
|
479
|
+
const ttft = data.content?.timeToFirstTokenInMillis;
|
|
480
|
+
if (ttft !== undefined) {
|
|
481
|
+
this.appendKv(card, ( localize(6064, "timeToFirstToken")), `${numberFormatter.value.format(Math.round(ttft))}ms`);
|
|
482
|
+
}
|
|
483
|
+
const requestId = data.content?.requestId ?? data.event.parentEventId ?? data.event.id;
|
|
484
|
+
if (requestId) {
|
|
485
|
+
this.appendKv(card, ( localize(6065, "requestId")), requestId, true);
|
|
486
|
+
}
|
|
487
|
+
return card;
|
|
488
|
+
}
|
|
489
|
+
renderSingleSummary(b) {
|
|
490
|
+
const row = append(this.content, $(".chat-debug-cache-summary"));
|
|
491
|
+
row.appendChild(this.renderSideCard(b, ( localize(6031, "Request"))));
|
|
492
|
+
const note = append(row, $(".chat-debug-cache-card.break"));
|
|
493
|
+
append(note, $(".chat-debug-cache-card-h", undefined, ( localize(6066, "First request in session"))));
|
|
494
|
+
const headline = append(note, $(".chat-debug-cache-card-headline"));
|
|
495
|
+
headline.textContent = `${formatCachePct(computeCacheHit(b.event))}%`;
|
|
496
|
+
const sub = append(note, $(".chat-debug-cache-card-sub"));
|
|
497
|
+
sub.textContent = ( localize(
|
|
498
|
+
6067,
|
|
499
|
+
"OTel-reported cache hit. Nothing earlier in this session to diff against — the system prompt and tools may still match a previous session's cache."
|
|
500
|
+
));
|
|
501
|
+
if (b.requestShape.description) {
|
|
502
|
+
const shapeLine = append(note, $(".chat-debug-cache-perf-line.chat-debug-cache-request-shape-note"));
|
|
503
|
+
shapeLine.textContent = b.requestShape.description;
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
appendKv(parent, key, value, copyable = false) {
|
|
507
|
+
const row = append(parent, $(".chat-debug-cache-kv"));
|
|
508
|
+
append(row, $("span.k", undefined, key));
|
|
509
|
+
const valueEl = append(row, $("span.v", undefined, value));
|
|
510
|
+
if (copyable) {
|
|
511
|
+
valueEl.classList.add("chat-debug-cache-request-id");
|
|
512
|
+
valueEl.title = value;
|
|
513
|
+
}
|
|
514
|
+
}
|
|
515
|
+
renderSignature(a, b, diff, compareInputMessages) {
|
|
516
|
+
const continuationComparison = b.requestShape.isContinuation;
|
|
517
|
+
const section = append(this.content, $(".chat-debug-cache-section"));
|
|
518
|
+
const heading = append(section, $("h3.chat-debug-cache-section-h"));
|
|
519
|
+
heading.textContent = continuationComparison ? ( localize(6068, "Visible Request Signature")) : ( localize(6069, "Prompt Signature"));
|
|
520
|
+
if (continuationComparison) {
|
|
521
|
+
const note = append(
|
|
522
|
+
section,
|
|
523
|
+
$(".chat-debug-cache-sig-summary.chat-debug-cache-request-shape-note")
|
|
524
|
+
);
|
|
525
|
+
note.textContent = ( localize(
|
|
526
|
+
6070,
|
|
527
|
+
"For Responses API continuations, this shows the captured request inputs: system instructions, tools sent on this request, and the visible input delta. Earlier conversation state is referenced by previous response id and is not expanded here."
|
|
528
|
+
));
|
|
529
|
+
}
|
|
530
|
+
const legend = append(section, $(".chat-debug-cache-sig-legend"));
|
|
531
|
+
for (const role of ["system", "user", "assistant", "tool", "tool_search", "tools"]) {
|
|
532
|
+
const entry = append(legend, $("span.chat-debug-cache-sig-legend-entry"));
|
|
533
|
+
append(entry, $(`span.chat-debug-cache-sig-swatch.role-${roleClass(role)}`));
|
|
534
|
+
append(entry, $$1("span", undefined, role === "tools" ? ( localize(6071, "tools (catalog)")) : role === "tool_search" ? ( localize(6072, "tool search")) : role));
|
|
535
|
+
}
|
|
536
|
+
const driftEntry = append(legend, $("span.chat-debug-cache-sig-legend-entry"));
|
|
537
|
+
append(driftEntry, $("span.chat-debug-cache-sig-swatch.role-drift"));
|
|
538
|
+
append(driftEntry, $$1("span", undefined, ( localize(6073, "drift"))));
|
|
539
|
+
const toSegments = (side, isA) => {
|
|
540
|
+
const segs = [];
|
|
541
|
+
const sys = side.system;
|
|
542
|
+
if (sys) {
|
|
543
|
+
const other = isA ? b.system : a.system;
|
|
544
|
+
segs.push({
|
|
545
|
+
role: "system",
|
|
546
|
+
chars: sys.length,
|
|
547
|
+
drift: sys !== (other ?? ""),
|
|
548
|
+
label: "system",
|
|
549
|
+
synthetic: true
|
|
550
|
+
});
|
|
551
|
+
}
|
|
552
|
+
const tools = side.tools;
|
|
553
|
+
if (tools) {
|
|
554
|
+
const other = isA ? b.tools : a.tools;
|
|
555
|
+
segs.push({
|
|
556
|
+
role: "tools",
|
|
557
|
+
chars: tools.length,
|
|
558
|
+
drift: tools !== (other ?? ""),
|
|
559
|
+
label: "tools",
|
|
560
|
+
synthetic: true
|
|
561
|
+
});
|
|
562
|
+
}
|
|
563
|
+
side.inputMessages.forEach((m, i) => {
|
|
564
|
+
const tok = diff.signature[i];
|
|
565
|
+
const kind = tok?.kind;
|
|
566
|
+
const drift = compareInputMessages && (kind === CacheDiffKind.ContentDrift || kind === CacheDiffKind.LengthChange || (isA && kind === CacheDiffKind.OnlyInA) || (!isA && kind === CacheDiffKind.OnlyInB));
|
|
567
|
+
segs.push({
|
|
568
|
+
role: m.role,
|
|
569
|
+
chars: m.charLength,
|
|
570
|
+
drift,
|
|
571
|
+
label: m.name ? `${m.role}-${m.name}` : m.role,
|
|
572
|
+
synthetic: false
|
|
573
|
+
});
|
|
574
|
+
});
|
|
575
|
+
return segs;
|
|
576
|
+
};
|
|
577
|
+
const aSegs = toSegments(a, true);
|
|
578
|
+
const bSegs = toSegments(b, false);
|
|
579
|
+
const totalA = aSegs.reduce((s, x) => s + x.chars, 0);
|
|
580
|
+
const totalB = bSegs.reduce((s, x) => s + x.chars, 0);
|
|
581
|
+
const max = Math.max(totalA, totalB, 1);
|
|
582
|
+
const breakCharPos = segs => {
|
|
583
|
+
if (!diff.break) {
|
|
584
|
+
return undefined;
|
|
585
|
+
}
|
|
586
|
+
let cumulative = 0;
|
|
587
|
+
let idx = 0;
|
|
588
|
+
for (const s of segs) {
|
|
589
|
+
if (s.synthetic) {
|
|
590
|
+
cumulative += s.chars;
|
|
591
|
+
continue;
|
|
592
|
+
}
|
|
593
|
+
if (idx === diff.break.index) {
|
|
594
|
+
return cumulative;
|
|
595
|
+
}
|
|
596
|
+
cumulative += s.chars;
|
|
597
|
+
idx++;
|
|
598
|
+
}
|
|
599
|
+
return undefined;
|
|
600
|
+
};
|
|
601
|
+
const buildLane = (label, segs, breakPos) => {
|
|
602
|
+
const row = $(".chat-debug-cache-sig-lane-row");
|
|
603
|
+
append(row, $(".chat-debug-cache-sig-lane-label", undefined, label));
|
|
604
|
+
const bar = append(row, $(".chat-debug-cache-sig-bar"));
|
|
605
|
+
let sideTotal = 0;
|
|
606
|
+
for (const s of segs) {
|
|
607
|
+
if (s.chars <= 0) {
|
|
608
|
+
sideTotal += s.chars;
|
|
609
|
+
continue;
|
|
610
|
+
}
|
|
611
|
+
const widthPct = (s.chars / max) * 100;
|
|
612
|
+
const seg = append(bar, $(`span.chat-debug-cache-sig-seg.role-${roleClass(s.role)}`));
|
|
613
|
+
if (s.drift) {
|
|
614
|
+
seg.classList.add("is-drift");
|
|
615
|
+
}
|
|
616
|
+
seg.style.width = `${widthPct}%`;
|
|
617
|
+
seg.title = `${s.label}: ${numberFormatter.value.format(s.chars)} chars` + (s.drift ? ` \u2014 drift` : "");
|
|
618
|
+
if (s.chars > max * 0.05) {
|
|
619
|
+
seg.textContent = `${s.label}:${numberFormatter.value.format(s.chars)}`;
|
|
620
|
+
}
|
|
621
|
+
sideTotal += s.chars;
|
|
622
|
+
}
|
|
623
|
+
if (sideTotal < max) {
|
|
624
|
+
const pad = append(bar, $("span.chat-debug-cache-sig-seg.role-empty"));
|
|
625
|
+
pad.style.width = `${((max - sideTotal) / max) * 100}%`;
|
|
626
|
+
}
|
|
627
|
+
if (breakPos !== undefined && diff.break) {
|
|
628
|
+
const line = append(bar, $(".chat-debug-cache-sig-break"));
|
|
629
|
+
line.style.left = `${(breakPos / max) * 100}%`;
|
|
630
|
+
line.title = ( localize(6074, "Cache break at messages[{0}]", diff.break.index));
|
|
631
|
+
}
|
|
632
|
+
append(row, $(".chat-debug-cache-sig-lane-total", undefined, ( localize(6075, "{0} chars", numberFormatter.value.format(sideTotal)))));
|
|
633
|
+
return row;
|
|
634
|
+
};
|
|
635
|
+
const lanes = append(section, $(".chat-debug-cache-sig-lanes"));
|
|
636
|
+
lanes.appendChild(buildLane(( localize(6076, "Previous")), aSegs, breakCharPos(aSegs)));
|
|
637
|
+
lanes.appendChild(buildLane(( localize(6077, "Current")), bSegs, breakCharPos(bSegs)));
|
|
638
|
+
let shared = 0;
|
|
639
|
+
let firstDrift;
|
|
640
|
+
if (a.system || b.system) {
|
|
641
|
+
if ((a.system ?? "") === (b.system ?? "")) {
|
|
642
|
+
shared += b.system?.length ?? 0;
|
|
643
|
+
} else {
|
|
644
|
+
firstDrift = ( localize(6078, "system"));
|
|
645
|
+
}
|
|
646
|
+
}
|
|
647
|
+
if (!firstDrift && (a.tools || b.tools)) {
|
|
648
|
+
if ((a.tools ?? "") === (b.tools ?? "")) {
|
|
649
|
+
shared += b.tools?.length ?? 0;
|
|
650
|
+
} else {
|
|
651
|
+
firstDrift = ( localize(6079, "tools catalog"));
|
|
652
|
+
}
|
|
653
|
+
}
|
|
654
|
+
if (!firstDrift) {
|
|
655
|
+
for (const tok of diff.signature) {
|
|
656
|
+
if (tok.kind === CacheDiffKind.Identical) {
|
|
657
|
+
shared += tok.bCharLength ?? 0;
|
|
658
|
+
} else {
|
|
659
|
+
firstDrift = `messages[${tok.index}]`;
|
|
660
|
+
break;
|
|
661
|
+
}
|
|
662
|
+
}
|
|
663
|
+
}
|
|
664
|
+
const summary = append(section, $(".chat-debug-cache-sig-summary"));
|
|
665
|
+
if (firstDrift) {
|
|
666
|
+
summary.textContent = continuationComparison ? ( localize(
|
|
667
|
+
6080,
|
|
668
|
+
"{0} of {1} captured request chars match before first captured drift: {2}",
|
|
669
|
+
numberFormatter.value.format(shared),
|
|
670
|
+
numberFormatter.value.format(totalB),
|
|
671
|
+
firstDrift
|
|
672
|
+
)) : ( localize(
|
|
673
|
+
6081,
|
|
674
|
+
"{0} of {1} chars reused · break at {2}",
|
|
675
|
+
numberFormatter.value.format(shared),
|
|
676
|
+
numberFormatter.value.format(totalB),
|
|
677
|
+
firstDrift
|
|
678
|
+
));
|
|
679
|
+
} else {
|
|
680
|
+
summary.textContent = continuationComparison ? ( localize(
|
|
681
|
+
6082,
|
|
682
|
+
"{0} of {1} captured request chars match · no captured divergence detected",
|
|
683
|
+
numberFormatter.value.format(shared),
|
|
684
|
+
numberFormatter.value.format(totalB)
|
|
685
|
+
)) : ( localize(
|
|
686
|
+
6083,
|
|
687
|
+
"{0} of {1} chars reused · no divergence detected",
|
|
688
|
+
numberFormatter.value.format(shared),
|
|
689
|
+
numberFormatter.value.format(totalB)
|
|
690
|
+
));
|
|
691
|
+
}
|
|
692
|
+
}
|
|
693
|
+
renderRequestOptions(a, b) {
|
|
694
|
+
const prev = sideOptions(a);
|
|
695
|
+
const curr = sideOptions(b);
|
|
696
|
+
const keys = ( new Set([...( Object.keys(prev)), ...( Object.keys(curr))]));
|
|
697
|
+
if (keys.size === 0) {
|
|
698
|
+
return;
|
|
699
|
+
}
|
|
700
|
+
const section = append(this.content, $(".chat-debug-cache-section"));
|
|
701
|
+
append(section, $("h3.chat-debug-cache-section-h", undefined, ( localize(6084, "Request Options"))));
|
|
702
|
+
const table = append(section, $(".chat-debug-cache-options-table"));
|
|
703
|
+
const head = append(table, $(".chat-debug-cache-options-row.head"));
|
|
704
|
+
append(head, $(".chat-debug-cache-options-cell.key", undefined, ( localize(6085, "Option"))));
|
|
705
|
+
append(head, $(".chat-debug-cache-options-cell", undefined, ( localize(6086, "Previous"))));
|
|
706
|
+
append(head, $(".chat-debug-cache-options-cell", undefined, ( localize(6087, "Current"))));
|
|
707
|
+
const sortedKeys = [...keys].sort((x, y) => x.localeCompare(y));
|
|
708
|
+
for (const key of sortedKeys) {
|
|
709
|
+
const row = append(table, $(".chat-debug-cache-options-row"));
|
|
710
|
+
const av = prev[key];
|
|
711
|
+
const bv = curr[key];
|
|
712
|
+
const changed = !equals(av, bv);
|
|
713
|
+
if (changed) {
|
|
714
|
+
row.classList.add("changed");
|
|
715
|
+
}
|
|
716
|
+
append(row, $(".chat-debug-cache-options-cell.key", undefined, key));
|
|
717
|
+
append(row, $(".chat-debug-cache-options-cell", undefined, formatOptionValue(av)));
|
|
718
|
+
append(row, $(".chat-debug-cache-options-cell", undefined, formatOptionValue(bv)));
|
|
719
|
+
}
|
|
720
|
+
}
|
|
721
|
+
renderComponents(drift, a, b, compareInputMessages) {
|
|
722
|
+
const section = append(this.content, $(".chat-debug-cache-section"));
|
|
723
|
+
append(section, $("h3.chat-debug-cache-section-h", undefined, ( localize(6088, "Components"))));
|
|
724
|
+
if (!compareInputMessages && b.requestShape.isContinuation) {
|
|
725
|
+
const note = append(
|
|
726
|
+
section,
|
|
727
|
+
$(".chat-debug-cache-sig-summary.chat-debug-cache-request-shape-note")
|
|
728
|
+
);
|
|
729
|
+
note.textContent = ( localize(
|
|
730
|
+
6089,
|
|
731
|
+
"This request uses previous_response_id, so input messages are not positionally diffed against the previous request. Components below show cache-key shape changes; the current continuation delta is shown separately."
|
|
732
|
+
));
|
|
733
|
+
}
|
|
734
|
+
const acc = append(section, $(".chat-debug-cache-acc"));
|
|
735
|
+
const effectiveDrift = !compareInputMessages && b.requestShape.isContinuation && b.inputMessages.length > 0 ? [...drift, currentDeltaComponent(b)] : drift;
|
|
736
|
+
if (effectiveDrift.length === 0) {
|
|
737
|
+
const empty = append(acc, $(".chat-debug-cache-acc-empty"));
|
|
738
|
+
empty.textContent = ( localize(6090, "All components are identical between A and B."));
|
|
739
|
+
return;
|
|
740
|
+
}
|
|
741
|
+
for (const c of effectiveDrift) {
|
|
742
|
+
const item = append(acc, $(".chat-debug-cache-acc-item"));
|
|
743
|
+
item.classList.add(c.status);
|
|
744
|
+
if (( this.openComponents.has(c.name))) {
|
|
745
|
+
item.classList.add("open");
|
|
746
|
+
}
|
|
747
|
+
const head = append(item, $(".chat-debug-cache-acc-head"));
|
|
748
|
+
append(head, $("span.chat-debug-cache-chev"));
|
|
749
|
+
const name = append(head, $(".chat-debug-cache-acc-name"));
|
|
750
|
+
if (c.role) {
|
|
751
|
+
append(name, $("span.role", undefined, c.role));
|
|
752
|
+
}
|
|
753
|
+
append(name, $$1("span", undefined, c.name));
|
|
754
|
+
const badge = append(head, $(`span.chat-debug-cache-acc-badge.${c.status}`));
|
|
755
|
+
badge.textContent = badgeLabel(c.status);
|
|
756
|
+
const sizes = append(head, $("span.chat-debug-cache-acc-sizes"));
|
|
757
|
+
sizes.textContent = ( localize(6091, "{0} → {1} chars", formatTokens(c.aSize), formatTokens(c.bSize)));
|
|
758
|
+
const body = append(item, $(".chat-debug-cache-acc-body"));
|
|
759
|
+
const aText = c.name === CURRENT_CONTINUATION_DELTA_COMPONENT ? "" : textForComponent(c, a);
|
|
760
|
+
const bText = c.name === CURRENT_CONTINUATION_DELTA_COMPONENT ? continuationDeltaText(b) : textForComponent(c, b);
|
|
761
|
+
const truncationNote = describeTruncation(aText, bText);
|
|
762
|
+
if (truncationNote) {
|
|
763
|
+
const note = append(item, $(".chat-debug-cache-acc-truncated"));
|
|
764
|
+
note.textContent = truncationNote;
|
|
765
|
+
note.title = truncationNote;
|
|
766
|
+
head.title = truncationNote;
|
|
767
|
+
}
|
|
768
|
+
body.appendChild(this.renderComponentDiff(aText, bText, c.aSize, c.bSize));
|
|
769
|
+
this.loadDisposables.add(addDisposableListener(head, EventType.CLICK, () => {
|
|
770
|
+
if (( this.openComponents.has(c.name))) {
|
|
771
|
+
this.openComponents.delete(c.name);
|
|
772
|
+
item.classList.remove("open");
|
|
773
|
+
} else {
|
|
774
|
+
this.openComponents.add(c.name);
|
|
775
|
+
item.classList.add("open");
|
|
776
|
+
}
|
|
777
|
+
}));
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
renderComponentDiff(aText, bText, aSize, bSize) {
|
|
781
|
+
const grid = $(".chat-debug-cache-diff");
|
|
782
|
+
const colA = append(grid, $(".chat-debug-cache-diff-col"));
|
|
783
|
+
append(colA, $("h4", undefined, ( localize(6092, "Previous · {0} chars", numberFormatter.value.format(aSize)))));
|
|
784
|
+
const aBody = append(colA, $(".chat-debug-cache-diff-body"));
|
|
785
|
+
const colB = append(grid, $(".chat-debug-cache-diff-col"));
|
|
786
|
+
append(colB, $("h4", undefined, ( localize(6093, "Current · {0} chars", numberFormatter.value.format(bSize)))));
|
|
787
|
+
const bBody = append(colB, $(".chat-debug-cache-diff-body"));
|
|
788
|
+
if (!aText && !bText) {
|
|
789
|
+
aBody.textContent = ( localize(6094, "(not present)"));
|
|
790
|
+
bBody.textContent = ( localize(6094, "(not present)"));
|
|
791
|
+
return grid;
|
|
792
|
+
}
|
|
793
|
+
renderInlineDiff(aBody, bBody, aText, bText);
|
|
794
|
+
return grid;
|
|
795
|
+
}
|
|
796
|
+
};
|
|
797
|
+
ChatDebugCacheExplorerView = ( __decorate([( __param(1, IChatService)), ( __param(2, IChatDebugService))], ChatDebugCacheExplorerView));
|
|
798
|
+
function findSection(sections, name) {
|
|
799
|
+
if (!sections) {
|
|
800
|
+
return undefined;
|
|
801
|
+
}
|
|
802
|
+
for (const s of sections) {
|
|
803
|
+
if (s.name === name) {
|
|
804
|
+
return s.content;
|
|
805
|
+
}
|
|
806
|
+
}
|
|
807
|
+
return undefined;
|
|
808
|
+
}
|
|
809
|
+
function buildTurnGroups(turns, userMessages) {
|
|
810
|
+
const userById = ( new Map());
|
|
811
|
+
for (const um of userMessages) {
|
|
812
|
+
if (!um.id) {
|
|
813
|
+
continue;
|
|
814
|
+
}
|
|
815
|
+
userById.set(um.id, um);
|
|
816
|
+
const stripped = um.id.startsWith("user-msg-") ? um.id.slice("user-msg-".length) : um.id;
|
|
817
|
+
userById.set(stripped, um);
|
|
818
|
+
}
|
|
819
|
+
const groups = ( new Map());
|
|
820
|
+
const order = [];
|
|
821
|
+
turns.forEach((turn, index) => {
|
|
822
|
+
const key = turn.parentEventId ?? turn.id ?? `turn-${index}`;
|
|
823
|
+
let entry = groups.get(key);
|
|
824
|
+
if (!entry) {
|
|
825
|
+
entry = {
|
|
826
|
+
userMessage: userById.get(key) ?? userById.get(`user-msg-${key}`),
|
|
827
|
+
turns: []
|
|
828
|
+
};
|
|
829
|
+
groups.set(key, entry);
|
|
830
|
+
order.push(key);
|
|
831
|
+
}
|
|
832
|
+
entry.turns.push({
|
|
833
|
+
turn,
|
|
834
|
+
index
|
|
835
|
+
});
|
|
836
|
+
});
|
|
837
|
+
return ( order.map(key => ({
|
|
838
|
+
key,
|
|
839
|
+
userMessage: groups.get(key).userMessage,
|
|
840
|
+
turns: groups.get(key).turns
|
|
841
|
+
})));
|
|
842
|
+
}
|
|
843
|
+
function textForComponent(c, side) {
|
|
844
|
+
if (c.name === "system") {
|
|
845
|
+
return side.system ?? "";
|
|
846
|
+
}
|
|
847
|
+
if (c.name === "tools") {
|
|
848
|
+
return side.tools ?? "";
|
|
849
|
+
}
|
|
850
|
+
if (c.name === CURRENT_CONTINUATION_DELTA_COMPONENT) {
|
|
851
|
+
return continuationDeltaText(side);
|
|
852
|
+
}
|
|
853
|
+
const m = /^messages\[(\d+)\]$/.exec(c.name);
|
|
854
|
+
if (m) {
|
|
855
|
+
const idx = parseInt(m[1], 10);
|
|
856
|
+
return side.inputMessages[idx]?.text ?? "";
|
|
857
|
+
}
|
|
858
|
+
return "";
|
|
859
|
+
}
|
|
860
|
+
function continuationDeltaText(side) {
|
|
861
|
+
return side.requestShape.isContinuation ? ( side.inputMessages.map((m, index) => `input[${index}] ${m.role}\n${m.text}`)).join("\n\n") : "";
|
|
862
|
+
}
|
|
863
|
+
function currentDeltaComponent(side) {
|
|
864
|
+
const size = side.inputMessages.reduce((sum, m) => sum + m.charLength, 0);
|
|
865
|
+
return {
|
|
866
|
+
name: CURRENT_CONTINUATION_DELTA_COMPONENT,
|
|
867
|
+
role: side.requestShape.inputItemTypes.join(", ") || ( side.inputMessages.map(m => m.role)).join(", ") || undefined,
|
|
868
|
+
status: CacheDiffKind.OnlyInB,
|
|
869
|
+
aSize: 0,
|
|
870
|
+
bSize: size
|
|
871
|
+
};
|
|
872
|
+
}
|
|
873
|
+
function badgeLabel(status) {
|
|
874
|
+
switch (status) {
|
|
875
|
+
case CacheDiffKind.Identical:
|
|
876
|
+
return localize(6095, "identical");
|
|
877
|
+
case CacheDiffKind.ContentDrift:
|
|
878
|
+
return localize(6096, "content drift");
|
|
879
|
+
case CacheDiffKind.LengthChange:
|
|
880
|
+
return localize(6097, "length change");
|
|
881
|
+
case CacheDiffKind.OnlyInA:
|
|
882
|
+
return localize(6098, "only in A");
|
|
883
|
+
case CacheDiffKind.OnlyInB:
|
|
884
|
+
return localize(6099, "only in B");
|
|
885
|
+
}
|
|
886
|
+
}
|
|
887
|
+
function describeTruncation(aText, bText) {
|
|
888
|
+
const re = /\.\.\.\[truncated, original (\d+) chars\]$/;
|
|
889
|
+
const aMatch = re.exec(aText);
|
|
890
|
+
const bMatch = re.exec(bText);
|
|
891
|
+
if (!aMatch && !bMatch) {
|
|
892
|
+
return undefined;
|
|
893
|
+
}
|
|
894
|
+
if (aMatch && bMatch) {
|
|
895
|
+
return localize(
|
|
896
|
+
6100,
|
|
897
|
+
"Both sides truncated by the OTel attribute cap (originals were {0} and {1} chars) — diff may be partial.",
|
|
898
|
+
numberFormatter.value.format(parseInt(aMatch[1], 10)),
|
|
899
|
+
numberFormatter.value.format(parseInt(bMatch[1], 10))
|
|
900
|
+
);
|
|
901
|
+
}
|
|
902
|
+
const match = (aMatch ?? bMatch);
|
|
903
|
+
const side = aMatch ? ( localize(6101, "Previous")) : ( localize(6102, "Current"));
|
|
904
|
+
return localize(
|
|
905
|
+
6103,
|
|
906
|
+
"{0} side truncated by the OTel attribute cap (original was {1} chars) — diff may be partial.",
|
|
907
|
+
side,
|
|
908
|
+
numberFormatter.value.format(parseInt(match[1], 10))
|
|
909
|
+
);
|
|
910
|
+
}
|
|
911
|
+
function describeBreakKind(kind, diff, b) {
|
|
912
|
+
const tok = diff.signature.find(t => t.index === diff.break?.index);
|
|
913
|
+
const role = tok?.bRole ?? tok?.aRole ?? "message";
|
|
914
|
+
const bMsg = b.inputMessages[diff.break?.index ?? -1];
|
|
915
|
+
const charsB = bMsg ? numberFormatter.value.format(bMsg.charLength) : undefined;
|
|
916
|
+
switch (kind) {
|
|
917
|
+
case CacheDiffKind.OnlyInB:
|
|
918
|
+
return charsB ? ( localize(6104, "added {0} message ({1} chars)", role, charsB)) : ( localize(6105, "added {0} message", role));
|
|
919
|
+
case CacheDiffKind.OnlyInA:
|
|
920
|
+
return localize(6106, "previous {0} message dropped", role);
|
|
921
|
+
case CacheDiffKind.ContentDrift:
|
|
922
|
+
return charsB ? ( localize(6107, "{0} message body changed ({1} chars)", role, charsB)) : ( localize(6108, "{0} message body changed", role));
|
|
923
|
+
case CacheDiffKind.LengthChange:
|
|
924
|
+
return charsB ? ( localize(6109, "{0} message resized to {1} chars", role, charsB)) : ( localize(6110, "{0} message size changed", role));
|
|
925
|
+
}
|
|
926
|
+
}
|
|
927
|
+
function computeCacheHit(event) {
|
|
928
|
+
if (!event.inputTokens || event.cachedTokens === undefined) {
|
|
929
|
+
return 0;
|
|
930
|
+
}
|
|
931
|
+
return Math.min(100, (event.cachedTokens / event.inputTokens) * 100);
|
|
932
|
+
}
|
|
933
|
+
function shouldCompareInputMessages(a, b) {
|
|
934
|
+
return !a.requestShape.isContinuation && !b.requestShape.isContinuation;
|
|
935
|
+
}
|
|
936
|
+
function describeRequestShape(inputMessages, requestShapeJson) {
|
|
937
|
+
const metadata = parseRequestShapeMetadata(requestShapeJson);
|
|
938
|
+
const inputItemTypes = Array.isArray(metadata?.inputItemTypes) ? metadata.inputItemTypes.filter(x => typeof x === "string") : [];
|
|
939
|
+
const common = {
|
|
940
|
+
api: typeof metadata?.api === "string" ? metadata.api : undefined,
|
|
941
|
+
inputItemTypes
|
|
942
|
+
};
|
|
943
|
+
const hasPreviousResponseId = metadata?.hasPreviousResponseId === true;
|
|
944
|
+
const hasToolSearchOutput = inputItemTypes.includes("tool_search_output") || ( inputMessages.some(m => m.role === "tool_search"));
|
|
945
|
+
const hasOnlyToolOutput = inputMessages.length > 0 && inputMessages.every(m => m.role === "tool");
|
|
946
|
+
if (hasPreviousResponseId && hasToolSearchOutput) {
|
|
947
|
+
return {
|
|
948
|
+
label: ( localize(6111, "tool_search_output continuation")),
|
|
949
|
+
description: ( localize(
|
|
950
|
+
6112,
|
|
951
|
+
"Responses API continuation: the displayed input is only the tool-search delta sent over the wire. The provider reconstructs prior context from the previous response id."
|
|
952
|
+
)),
|
|
953
|
+
isContinuation: true,
|
|
954
|
+
...common
|
|
955
|
+
};
|
|
956
|
+
}
|
|
957
|
+
if (hasPreviousResponseId && hasOnlyToolOutput) {
|
|
958
|
+
return {
|
|
959
|
+
label: ( localize(6113, "tool output continuation")),
|
|
960
|
+
description: ( localize(
|
|
961
|
+
6114,
|
|
962
|
+
"Responses API continuation: the displayed input is only the tool-output delta sent over the wire. The provider reconstructs prior context from the previous response id."
|
|
963
|
+
)),
|
|
964
|
+
isContinuation: true,
|
|
965
|
+
...common
|
|
966
|
+
};
|
|
967
|
+
}
|
|
968
|
+
if (hasPreviousResponseId) {
|
|
969
|
+
return {
|
|
970
|
+
label: ( localize(6115, "Responses API continuation")),
|
|
971
|
+
description: ( localize(
|
|
972
|
+
6116,
|
|
973
|
+
"Responses API continuation: the displayed input is only the delta sent over the wire. The provider reconstructs prior context from the previous response id."
|
|
974
|
+
)),
|
|
975
|
+
isContinuation: true,
|
|
976
|
+
...common
|
|
977
|
+
};
|
|
978
|
+
}
|
|
979
|
+
if (hasToolSearchOutput) {
|
|
980
|
+
return {
|
|
981
|
+
label: ( localize(6117, "tool_search_output request")),
|
|
982
|
+
description: ( localize(
|
|
983
|
+
6118,
|
|
984
|
+
"This request contains a Responses API tool_search_output item. No previous-response continuation marker was captured, so the displayed input may be a full or history-sliced request rather than only a continuation delta."
|
|
985
|
+
)),
|
|
986
|
+
isContinuation: false,
|
|
987
|
+
...common
|
|
988
|
+
};
|
|
989
|
+
}
|
|
990
|
+
if (hasOnlyToolOutput) {
|
|
991
|
+
return {
|
|
992
|
+
label: ( localize(6119, "tool output request")),
|
|
993
|
+
description: undefined,
|
|
994
|
+
isContinuation: false,
|
|
995
|
+
...common
|
|
996
|
+
};
|
|
997
|
+
}
|
|
998
|
+
return {
|
|
999
|
+
label: ( localize(6120, "full input request")),
|
|
1000
|
+
description: undefined,
|
|
1001
|
+
isContinuation: false,
|
|
1002
|
+
...common
|
|
1003
|
+
};
|
|
1004
|
+
}
|
|
1005
|
+
function parseRequestShapeMetadata(requestShapeJson) {
|
|
1006
|
+
if (!requestShapeJson) {
|
|
1007
|
+
return undefined;
|
|
1008
|
+
}
|
|
1009
|
+
try {
|
|
1010
|
+
const parsed = JSON.parse(requestShapeJson);
|
|
1011
|
+
if (parsed && typeof parsed === "object") {
|
|
1012
|
+
return parsed;
|
|
1013
|
+
}
|
|
1014
|
+
} catch {}
|
|
1015
|
+
return undefined;
|
|
1016
|
+
}
|
|
1017
|
+
function roleClass(role) {
|
|
1018
|
+
switch (role) {
|
|
1019
|
+
case "system":
|
|
1020
|
+
case "tools":
|
|
1021
|
+
case "user":
|
|
1022
|
+
case "assistant":
|
|
1023
|
+
case "tool":
|
|
1024
|
+
return role;
|
|
1025
|
+
case "tool_search":
|
|
1026
|
+
return "tool-search";
|
|
1027
|
+
default:
|
|
1028
|
+
return "tool";
|
|
1029
|
+
}
|
|
1030
|
+
}
|
|
1031
|
+
function formatCachePct(pct) {
|
|
1032
|
+
const truncated = Math.floor(pct * 100) / 100;
|
|
1033
|
+
return truncated.toFixed(2);
|
|
1034
|
+
}
|
|
1035
|
+
function formatCachePctInt(pct) {
|
|
1036
|
+
return String(Math.floor(pct));
|
|
1037
|
+
}
|
|
1038
|
+
function formatTokens(value) {
|
|
1039
|
+
if (value === undefined) {
|
|
1040
|
+
return "—";
|
|
1041
|
+
}
|
|
1042
|
+
return numberFormatter.value.format(value);
|
|
1043
|
+
}
|
|
1044
|
+
function sideOptions(side) {
|
|
1045
|
+
const out = {};
|
|
1046
|
+
if (side.event.model !== undefined) {
|
|
1047
|
+
out.model = side.event.model;
|
|
1048
|
+
}
|
|
1049
|
+
Object.assign(out, parseOptions(side.content?.requestOptions));
|
|
1050
|
+
return out;
|
|
1051
|
+
}
|
|
1052
|
+
function computeOptionsDiff(a, b) {
|
|
1053
|
+
const prev = sideOptions(a);
|
|
1054
|
+
const curr = sideOptions(b);
|
|
1055
|
+
const keys = ( new Set([...( Object.keys(prev)), ...( Object.keys(curr))]));
|
|
1056
|
+
const out = [];
|
|
1057
|
+
for (const key of keys) {
|
|
1058
|
+
const av = prev[key];
|
|
1059
|
+
const bv = curr[key];
|
|
1060
|
+
if (!equals(av, bv)) {
|
|
1061
|
+
out.push({
|
|
1062
|
+
key,
|
|
1063
|
+
previous: av,
|
|
1064
|
+
current: bv
|
|
1065
|
+
});
|
|
1066
|
+
}
|
|
1067
|
+
}
|
|
1068
|
+
out.sort((x, y) => x.key.localeCompare(y.key));
|
|
1069
|
+
return out;
|
|
1070
|
+
}
|
|
1071
|
+
function parseOptions(blob) {
|
|
1072
|
+
if (!blob) {
|
|
1073
|
+
return {};
|
|
1074
|
+
}
|
|
1075
|
+
let parsed;
|
|
1076
|
+
try {
|
|
1077
|
+
parsed = JSON.parse(blob);
|
|
1078
|
+
} catch {
|
|
1079
|
+
return {};
|
|
1080
|
+
}
|
|
1081
|
+
if (!parsed || typeof parsed !== "object" || Array.isArray(parsed)) {
|
|
1082
|
+
return {};
|
|
1083
|
+
}
|
|
1084
|
+
const flat = {};
|
|
1085
|
+
for (const [k, v] of Object.entries(parsed)) {
|
|
1086
|
+
if (v && typeof v === "object" && !Array.isArray(v)) {
|
|
1087
|
+
for (const [nk, nv] of Object.entries(v)) {
|
|
1088
|
+
flat[`${k}.${nk}`] = nv;
|
|
1089
|
+
}
|
|
1090
|
+
} else {
|
|
1091
|
+
flat[k] = v;
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
return flat;
|
|
1095
|
+
}
|
|
1096
|
+
function formatOptionValue(value) {
|
|
1097
|
+
if (value === undefined) {
|
|
1098
|
+
return "—";
|
|
1099
|
+
}
|
|
1100
|
+
if (value === null) {
|
|
1101
|
+
return "null";
|
|
1102
|
+
}
|
|
1103
|
+
if (typeof value === "string") {
|
|
1104
|
+
return value;
|
|
1105
|
+
}
|
|
1106
|
+
if (typeof value === "number" || typeof value === "boolean") {
|
|
1107
|
+
return String(value);
|
|
1108
|
+
}
|
|
1109
|
+
try {
|
|
1110
|
+
return JSON.stringify(value);
|
|
1111
|
+
} catch {
|
|
1112
|
+
return String(value);
|
|
1113
|
+
}
|
|
1114
|
+
}
|
|
1115
|
+
function isLikelyCacheExpiration(hitPct, diff, optionsDiff, systemChanged, toolsChanged) {
|
|
1116
|
+
if (hitPct >= 1) {
|
|
1117
|
+
return false;
|
|
1118
|
+
}
|
|
1119
|
+
if (diff.break) {
|
|
1120
|
+
return false;
|
|
1121
|
+
}
|
|
1122
|
+
if (optionsDiff.length > 0) {
|
|
1123
|
+
return false;
|
|
1124
|
+
}
|
|
1125
|
+
if (systemChanged || toolsChanged) {
|
|
1126
|
+
return false;
|
|
1127
|
+
}
|
|
1128
|
+
return true;
|
|
1129
|
+
}
|
|
1130
|
+
const DIFF_OPTIONS = {
|
|
1131
|
+
ignoreTrimWhitespace: false,
|
|
1132
|
+
maxComputationTimeMs: 200,
|
|
1133
|
+
computeMoves: false
|
|
1134
|
+
};
|
|
1135
|
+
function renderInlineDiff(prevHost, currHost, prev, curr) {
|
|
1136
|
+
const prevLines = prev.split(/\r?\n/);
|
|
1137
|
+
const currLines = curr.split(/\r?\n/);
|
|
1138
|
+
const result = linesDiffComputers.getDefault().computeDiff(prevLines, currLines, DIFF_OPTIONS);
|
|
1139
|
+
let prevIdx = 0;
|
|
1140
|
+
let currIdx = 0;
|
|
1141
|
+
for (const change of result.changes) {
|
|
1142
|
+
const origStart = change.original.startLineNumber;
|
|
1143
|
+
const origEnd = change.original.endLineNumberExclusive;
|
|
1144
|
+
const modStart = change.modified.startLineNumber;
|
|
1145
|
+
const modEnd = change.modified.endLineNumberExclusive;
|
|
1146
|
+
while (prevIdx + 1 < origStart && currIdx + 1 < modStart) {
|
|
1147
|
+
appendLine(prevHost, prevLines[prevIdx], "context");
|
|
1148
|
+
appendLine(currHost, currLines[currIdx], "context");
|
|
1149
|
+
prevIdx++;
|
|
1150
|
+
currIdx++;
|
|
1151
|
+
}
|
|
1152
|
+
const innerByOrig = groupInnerChangesByLine(change.innerChanges, true);
|
|
1153
|
+
const innerByMod = groupInnerChangesByLine(change.innerChanges, false);
|
|
1154
|
+
for (let line = origStart; line < origEnd; line++) {
|
|
1155
|
+
const lineText = prevLines[line - 1] ?? "";
|
|
1156
|
+
appendChangedLine(prevHost, lineText, innerByOrig.get(line), "remove");
|
|
1157
|
+
}
|
|
1158
|
+
prevIdx = origEnd - 1;
|
|
1159
|
+
for (let line = modStart; line < modEnd; line++) {
|
|
1160
|
+
const lineText = currLines[line - 1] ?? "";
|
|
1161
|
+
appendChangedLine(currHost, lineText, innerByMod.get(line), "add");
|
|
1162
|
+
}
|
|
1163
|
+
currIdx = modEnd - 1;
|
|
1164
|
+
}
|
|
1165
|
+
while (prevIdx < prevLines.length && currIdx < currLines.length) {
|
|
1166
|
+
appendLine(prevHost, prevLines[prevIdx], "context");
|
|
1167
|
+
appendLine(currHost, currLines[currIdx], "context");
|
|
1168
|
+
prevIdx++;
|
|
1169
|
+
currIdx++;
|
|
1170
|
+
}
|
|
1171
|
+
}
|
|
1172
|
+
function appendLine(host, text, kind) {
|
|
1173
|
+
const line = append(host, $(`.chat-debug-cache-diff-line.${kind}`));
|
|
1174
|
+
line.textContent = text === "" ? " " : text;
|
|
1175
|
+
}
|
|
1176
|
+
function appendChangedLine(host, text, ranges, kind) {
|
|
1177
|
+
const line = append(host, $(`.chat-debug-cache-diff-line.${kind}`));
|
|
1178
|
+
if (!ranges || ranges.length === 0) {
|
|
1179
|
+
line.textContent = text === "" ? " " : text;
|
|
1180
|
+
return;
|
|
1181
|
+
}
|
|
1182
|
+
let cursor = 1;
|
|
1183
|
+
const sorted = [...ranges].sort((a, b) => a.startColumn - b.startColumn);
|
|
1184
|
+
for (const r of sorted) {
|
|
1185
|
+
if (r.startColumn > cursor) {
|
|
1186
|
+
append(line, createTextNode(text.substring(cursor - 1, r.startColumn - 1)));
|
|
1187
|
+
}
|
|
1188
|
+
const span = append(line, $("span.chat-debug-cache-diff-inner"));
|
|
1189
|
+
span.textContent = text.substring(r.startColumn - 1, r.endColumn - 1);
|
|
1190
|
+
cursor = r.endColumn;
|
|
1191
|
+
}
|
|
1192
|
+
if (cursor - 1 < text.length) {
|
|
1193
|
+
append(line, createTextNode(text.substring(cursor - 1)));
|
|
1194
|
+
}
|
|
1195
|
+
}
|
|
1196
|
+
function groupInnerChangesByLine(innerChanges, useOriginal) {
|
|
1197
|
+
const out = ( new Map());
|
|
1198
|
+
if (!innerChanges) {
|
|
1199
|
+
return out;
|
|
1200
|
+
}
|
|
1201
|
+
for (const r of innerChanges) {
|
|
1202
|
+
const range = useOriginal ? r.originalRange : r.modifiedRange;
|
|
1203
|
+
if (range.startLineNumber !== range.endLineNumber) {
|
|
1204
|
+
continue;
|
|
1205
|
+
}
|
|
1206
|
+
const list = out.get(range.startLineNumber) ?? [];
|
|
1207
|
+
list.push({
|
|
1208
|
+
startColumn: range.startColumn,
|
|
1209
|
+
endColumn: range.endColumn
|
|
1210
|
+
});
|
|
1211
|
+
out.set(range.startLineNumber, list);
|
|
1212
|
+
}
|
|
1213
|
+
return out;
|
|
1214
|
+
}
|
|
1215
|
+
|
|
1216
|
+
export { CacheExplorerNavigation, ChatDebugCacheExplorerView };
|