From b4672ed5f1b6627586f69e7835e4d5182168f227 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kondratek?= Date: Fri, 9 Aug 2024 15:02:00 +0200 Subject: [PATCH] Add integration tests for the chat (context files) (#1930) This is a follow up PR for https://github.com/sourcegraph/jetbrains/pull/1928. ## Test plan 1. Green CI --- build.gradle.kts | 1 - .../kotlin/com/sourcegraph/cody/AllSuites.kt | 5 +- .../com/sourcegraph/cody/chat/ChatTest.kt | 102 + .../sourcegraph/cody/edit/DocumentCodeTest.kt | 29 +- ...xture.kt => CodyIntegrationTestFixture.kt} | 60 +- .../chat_2722888107/recording.har.yaml | 2414 +++++++++++++++++ .../recording.har.yaml | 124 +- .../com/sourcegraph/cody/agent/CodyAgent.kt | 12 +- .../sourcegraph/cody/agent/CodyAgentServer.kt | 8 +- .../cody/agent/CodyAgentService.kt | 8 +- .../cody/agent/protocol/NetworkRequest.kt | 3 - .../sourcegraph/cody/chat/AgentChatSession.kt | 2 +- .../cody/chat/ui/BlinkingCursorComponent.kt | 7 +- .../com/sourcegraph/cody/chat/ui/ChatPanel.kt | 2 +- .../sourcegraph/cody/chat/ui/MessagesPanel.kt | 10 +- ...nterpriseEnhancedContextStateController.kt | 2 + .../cody/context/ui/EnhancedContextPanel.kt | 2 +- 17 files changed, 2649 insertions(+), 142 deletions(-) create mode 100644 src/integrationTest/kotlin/com/sourcegraph/cody/chat/ChatTest.kt rename src/integrationTest/kotlin/com/sourcegraph/cody/util/{CodyIntegrationTextFixture.kt => CodyIntegrationTestFixture.kt} (82%) create mode 100644 src/integrationTest/resources/recordings/chat_2722888107/recording.har.yaml rename src/integrationTest/resources/recordings/{integration-test_2927926756 => documentCode_2994921345}/recording.har.yaml (90%) delete mode 100644 src/main/kotlin/com/sourcegraph/cody/agent/protocol/NetworkRequest.kt diff --git a/build.gradle.kts b/build.gradle.kts index 11be605540..2870a5112d 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -227,7 +227,6 @@ fun Test.sharedIntegrationTestConfig(buildCodyDir: File, mode: String) { environment( "CODY_RECORDING_MODE" to mode, - "CODY_RECORDING_NAME" to "integration-test", "CODY_RECORDING_DIRECTORY" to resourcesDir.resolve("recordings").absolutePath, "CODY_SHIM_TESTING" to "true", "CODY_TEMPERATURE_ZERO" to "true", diff --git a/src/integrationTest/kotlin/com/sourcegraph/cody/AllSuites.kt b/src/integrationTest/kotlin/com/sourcegraph/cody/AllSuites.kt index 67c8ebd3c7..171b0a4103 100644 --- a/src/integrationTest/kotlin/com/sourcegraph/cody/AllSuites.kt +++ b/src/integrationTest/kotlin/com/sourcegraph/cody/AllSuites.kt @@ -1,8 +1,11 @@ package com.sourcegraph.cody +import com.sourcegraph.cody.chat.ChatTest import com.sourcegraph.cody.edit.DocumentCodeTest import com.sourcegraph.cody.util.RepeatableSuite import org.junit.runner.RunWith import org.junit.runners.Suite -@RunWith(RepeatableSuite::class) @Suite.SuiteClasses(DocumentCodeTest::class) class AllSuites +@RunWith(RepeatableSuite::class) +@Suite.SuiteClasses(ChatTest::class, DocumentCodeTest::class) +class AllSuites diff --git a/src/integrationTest/kotlin/com/sourcegraph/cody/chat/ChatTest.kt b/src/integrationTest/kotlin/com/sourcegraph/cody/chat/ChatTest.kt new file mode 100644 index 0000000000..57656a1104 --- /dev/null +++ b/src/integrationTest/kotlin/com/sourcegraph/cody/chat/ChatTest.kt @@ -0,0 +1,102 @@ +package com.sourcegraph.cody.chat + +import com.intellij.testFramework.runInEdtAndGet +import com.intellij.testFramework.runInEdtAndWait +import com.sourcegraph.cody.chat.ui.ContextFileActionLink +import com.sourcegraph.cody.context.ui.EnterpriseEnhancedContextPanel +import com.sourcegraph.cody.history.HistoryService +import com.sourcegraph.cody.history.state.EnhancedContextState +import com.sourcegraph.cody.history.state.RemoteRepositoryState +import com.sourcegraph.cody.util.CodyIntegrationTestFixture +import com.sourcegraph.cody.util.CustomJunitClassRunner +import com.sourcegraph.cody.util.TestingCredentials +import java.awt.Component +import java.awt.Container +import java.util.concurrent.TimeUnit +import junit.framework.TestCase +import org.awaitility.kotlin.await +import org.awaitility.kotlin.until +import org.junit.Test +import org.junit.runner.RunWith + +@RunWith(CustomJunitClassRunner::class) +class ChatTest : CodyIntegrationTestFixture() { + override fun recordingName() = "chat" + + override fun credentials() = TestingCredentials.enterprise + + override fun checkSuiteSpecificInitialConditions() = Unit + + @Test + fun testRemoteContextFileItems() { + val enhancedContextState = + EnhancedContextState().apply { + remoteRepositories.add( + RemoteRepositoryState().apply { + isEnabled = true + remoteUrl = "github.com/sourcegraph/cody" + codebaseName = "github.com/sourcegraph/cody" + }) + } + HistoryService.getInstance(project).updateDefaultContextState(enhancedContextState) + + val session = runInEdtAndGet { AgentChatSession.createNew(project) } + + await.atMost(30, TimeUnit.SECONDS) until + { + (session.getPanel().contextView as EnterpriseEnhancedContextPanel) + .controller + .getConfiguredState() + .find { it.name == "github.com/sourcegraph/cody" && !it.isIgnored } != null + } + + runInEdtAndWait { session.sendMessage("What is JSON RPC?", emptyList()) } + + await.atMost(30, TimeUnit.SECONDS) until { !session.messages[0].contextFiles.isNullOrEmpty() } + await.atMost(30, TimeUnit.SECONDS) until { session.messages.size == 2 } + await.atMost(30, TimeUnit.SECONDS) until { session.messages[1].text?.isNotBlank() == true } + + val linkPanels = + findComponentsRecursively(session.getPanel(), ContextFileActionLink::class.java) + + TestCase.assertEquals( + listOf( + "cody agent/CHANGELOG.md", + "cody agent/README.md", + "cody agent/src/__tests__/chat-response-quality/README.md", + "cody agent/src/cli/command-jsonrpc-stdio.ts", + "cody agent/src/cli/command-jsonrpc-websocket.ts", + "cody agent/src/cli/command-root.ts", + "cody agent/src/cli/scip-codegen/JvmCodegen.ts", + "cody agent/src/cli/scip-codegen/JvmFormatter.ts", + "cody agent/src/jsonrpc-alias.ts", + "cody agent/src/local-e2e/README.md", + "cody lib/icons/README.md", + "cody vscode/src/graph/bfg/spawn-bfg.ts", + "cody vscode/src/jsonrpc/bfg-protocol.ts", + "cody vscode/src/jsonrpc/CodyJsonRpcErrorCode.ts", + "cody vscode/src/jsonrpc/embeddings-protocol.ts", + "cody vscode/src/jsonrpc/isRunningInsideAgent.ts", + "cody vscode/src/jsonrpc/jsonrpc.ts", + "cody vscode/src/jsonrpc/TextDocumentWithUri.test.ts", + "cody vscode/src/jsonrpc/TextDocumentWithUri.ts", + "cody web/lib/agent/agent.client.ts"), + linkPanels.map { panel -> panel.text }) + } + + private fun findComponentsRecursively(parent: Component, targetClass: Class): List { + val result = mutableListOf() + + if (targetClass.isInstance(parent)) { + result.add(parent as A) + } + + if (parent is Container) { + for (component in parent.components) { + result.addAll(findComponentsRecursively(component, targetClass)) + } + } + + return result + } +} diff --git a/src/integrationTest/kotlin/com/sourcegraph/cody/edit/DocumentCodeTest.kt b/src/integrationTest/kotlin/com/sourcegraph/cody/edit/DocumentCodeTest.kt index 251f31590d..3189164621 100644 --- a/src/integrationTest/kotlin/com/sourcegraph/cody/edit/DocumentCodeTest.kt +++ b/src/integrationTest/kotlin/com/sourcegraph/cody/edit/DocumentCodeTest.kt @@ -1,5 +1,10 @@ package com.sourcegraph.cody.edit +import com.intellij.openapi.actionSystem.ActionManager +import com.intellij.openapi.actionSystem.AnActionEvent +import com.intellij.openapi.actionSystem.DataContext +import com.intellij.openapi.editor.Editor +import com.intellij.openapi.editor.ex.EditorEx import com.sourcegraph.cody.edit.actions.DocumentCodeAction import com.sourcegraph.cody.edit.actions.lenses.EditAcceptAction import com.sourcegraph.cody.edit.actions.lenses.EditCancelAction @@ -10,15 +15,35 @@ import com.sourcegraph.cody.edit.widget.LensIcon import com.sourcegraph.cody.edit.widget.LensLabel import com.sourcegraph.cody.edit.widget.LensSpinner import com.sourcegraph.cody.edit.widget.LensWidgetGroup -import com.sourcegraph.cody.util.CodyIntegrationTextFixture +import com.sourcegraph.cody.util.CodyIntegrationTestFixture import com.sourcegraph.cody.util.CustomJunitClassRunner +import com.sourcegraph.cody.util.TestingCredentials import org.hamcrest.Matchers.startsWith import org.junit.Assert.assertThat import org.junit.Test import org.junit.runner.RunWith @RunWith(CustomJunitClassRunner::class) -class DocumentCodeTest : CodyIntegrationTextFixture() { +class DocumentCodeTest : CodyIntegrationTestFixture() { + override fun recordingName() = "documentCode" + + override fun credentials() = TestingCredentials.dotcom + + override fun checkSuiteSpecificInitialConditions() { + // Check the initial state of the action's presentation + val action = ActionManager.getInstance().getAction("cody.documentCodeAction") + val event = + AnActionEvent.createFromAnAction(action, null, "", createEditorContext(myFixture.editor)) + action.update(event) + val presentation = event.presentation + assertTrue("Action should be enabled", presentation.isEnabled) + assertTrue("Action should be visible", presentation.isVisible) + } + + private fun createEditorContext(editor: Editor): DataContext { + return (editor as? EditorEx)?.dataContext ?: DataContext.EMPTY_CONTEXT + } + @Test fun testGetsWorkingGroupLens() { val codeLensGroup = runAndWaitForLenses(DocumentCodeAction.ID, EditCancelAction.ID) diff --git a/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt b/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTestFixture.kt similarity index 82% rename from src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt rename to src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTestFixture.kt index 1ec0e0c4b8..bce07d2ebc 100644 --- a/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTextFixture.kt +++ b/src/integrationTest/kotlin/com/sourcegraph/cody/util/CodyIntegrationTestFixture.kt @@ -1,16 +1,11 @@ package com.sourcegraph.cody.util import com.intellij.ide.lightEdit.LightEdit -import com.intellij.openapi.actionSystem.ActionManager -import com.intellij.openapi.actionSystem.AnActionEvent -import com.intellij.openapi.actionSystem.DataContext import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.application.WriteAction import com.intellij.openapi.application.runInEdt import com.intellij.openapi.command.WriteCommandAction import com.intellij.openapi.diagnostic.Logger -import com.intellij.openapi.editor.Editor -import com.intellij.openapi.editor.ex.EditorEx import com.intellij.openapi.fileEditor.FileDocumentManager import com.intellij.openapi.project.DumbService import com.intellij.openapi.project.Project @@ -31,8 +26,8 @@ import java.util.concurrent.TimeUnit import java.util.regex.Pattern import junit.framework.TestCase -open class CodyIntegrationTextFixture : BasePlatformTestCase(), LensListener { - private val logger = Logger.getInstance(CodyIntegrationTextFixture::class.java) +abstract class CodyIntegrationTestFixture : BasePlatformTestCase(), LensListener { + private val logger = Logger.getInstance(CodyIntegrationTestFixture::class.java) private val lensSubscribers = mutableListOf< Pair<(List) -> Boolean, CompletableFuture>>() @@ -61,23 +56,7 @@ open class CodyIntegrationTextFixture : BasePlatformTestCase(), LensListener { val recordingsFuture = CompletableFuture() CodyAgentService.withAgent(project) { agent -> - val errors = agent.server.testingRequestErrors().get() - // We extract polly.js errors to notify users about the missing recordings, if any - val missingRecordings = errors.filter { it.error?.contains("`recordIfMissing` is") == true } - missingRecordings.forEach { missing -> - logger.error( - """Recording is missing: ${missing.error} - | - |${missing.body} - | - |------------------------------------------------------------------------------------------ - |To fix this problem please run `./gradlew :recordingIntegrationTest`. - |You need to export access tokens first, using script from the `sourcegraph/cody` repository: - |`agent/scripts/export-cody-http-recording-tokens.sh` - |------------------------------------------------------------------------------------------ - """ - .trimMargin()) - } + agent.server.testing_requestErrors(params = null).get() recordingsFuture.complete(null) } recordingsFuture.get(ASYNC_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS) @@ -95,7 +74,14 @@ open class CodyIntegrationTextFixture : BasePlatformTestCase(), LensListener { // Methods there are mostly idempotent though, so calling again for every test case should not // change anything. private fun initCredentialsAndAgent() { - val credentials = TestingCredentials.dotcom + assertNotNull( + "Unable to start agent in a timely fashion!", + CodyAgentService.getInstance(project) + .startAgent(project, additionalEnvs = mapOf("CODY_RECORDING_NAME" to recordingName())) + .completeOnTimeout(null, ASYNC_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS) + .get()) + + val credentials = credentials() CodyPersistentAccountsHost(project) .addAccount( SourcegraphServerPath.from(credentials.serverEndpoint, ""), @@ -103,15 +89,12 @@ open class CodyIntegrationTextFixture : BasePlatformTestCase(), LensListener { displayName = "Test User", token = credentials.token ?: credentials.redactedToken, id = "random-unique-testing-id-1337") - - assertNotNull( - "Unable to start agent in a timely fashion!", - CodyAgentService.getInstance(project) - .startAgent(project) - .completeOnTimeout(null, ASYNC_WAIT_TIMEOUT_SECONDS, TimeUnit.SECONDS) - .get()) } + abstract fun recordingName(): String + + abstract fun credentials(): TestingCredentials + private fun checkInitialConditions() { // If you don't specify this system property with this setting when running the tests, // the tests will fail, because IntelliJ will run them from the EDT, which can't block. @@ -130,19 +113,10 @@ open class CodyIntegrationTextFixture : BasePlatformTestCase(), LensListener { val isLightEditMode = LightEdit.owns(project) assertFalse("Project should not be in LightEdit mode", isLightEditMode) - // Check the initial state of the action's presentation - val action = ActionManager.getInstance().getAction("cody.documentCodeAction") - val event = - AnActionEvent.createFromAnAction(action, null, "", createEditorContext(myFixture.editor)) - action.update(event) - val presentation = event.presentation - assertTrue("Action should be enabled", presentation.isEnabled) - assertTrue("Action should be visible", presentation.isVisible) + checkSuiteSpecificInitialConditions() } - private fun createEditorContext(editor: Editor): DataContext { - return (editor as? EditorEx)?.dataContext ?: DataContext.EMPTY_CONTEXT - } + abstract fun checkSuiteSpecificInitialConditions() // This provides a crude mechanism for specifying the caret position in the test file. private fun initCaretPosition() { diff --git a/src/integrationTest/resources/recordings/chat_2722888107/recording.har.yaml b/src/integrationTest/resources/recordings/chat_2722888107/recording.har.yaml new file mode 100644 index 0000000000..b4ef71acc2 --- /dev/null +++ b/src/integrationTest/resources/recordings/chat_2722888107/recording.har.yaml @@ -0,0 +1,2414 @@ +log: + _recordingName: chat + creator: + comment: persister:fs + name: Polly.JS + version: 6.0.6 + entries: + - _id: 55e4b30d65f8bef20b754a5b102111d0 + _order: 0 + cache: {} + request: + bodySize: 0 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 296 + httpVersion: HTTP/1.1 + method: GET + queryString: [] + url: https://demo.sourcegraph.com/.api/client-config + response: + bodySize: 184 + content: + encoding: base64 + mimeType: text/plain; charset=utf-8 + size: 184 + text: "[\"H4sIAAAAAAAAA2zMsQpCMQyF4b1PEe7sE7hJcXBzc861EQtNI80pKnLf3UVwyfz953wSE\ + dFytfI+dl6blGVPGFN2P7gzQuAJy6aPJpB4OR2m2VS5F48/gFHXiWo9dFceyNYhL1xq\ + L/YMM7UizQ/n019v3FzSlr4AAAD//wMAmGWdCt8AAAA=\"]" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:20 GMT + - name: content-type + value: text/plain; charset=utf-8 + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "176" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1364 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.849Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 132f966d98fb83a3612d47239060956e + _order: 0 + cache: {} + request: + bodySize: 20390 + cookies: [] + headers: + - name: content-type + value: application/json + - name: accept-encoding + value: gzip;q=0 + - name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - name: user-agent + value: JetBrains / 6.0-localbuild + - name: traceparent + value: 00-86dd245a47c1f0f20c9a2f9b5ff9a829-b8a845bad6768fe0-01 + - name: connection + value: keep-alive + - name: host + value: demo.sourcegraph.com + headersSize: 430 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json + params: [] + textJSON: + maxTokensToSample: 4000 + messages: + - speaker: system + text: You are Cody, an AI coding assistant from Sourcegraph. + - speaker: human + text: >- + Codebase context from file /web/lib/agent/agent.client.ts in + repository github.com/sourcegraph/cody: + + ```typescript + + // @ts-ignore + + import AgentWorker from './agent.worker.ts?worker&inline' + + + // TODO(sqs): dedupe with agentClient.ts in [experimental Cody CLI](https://github.com/sourcegraph/cody/pull/3418) + + export interface AgentClient { + serverInfo: ServerInfo + rpc: MessageConnection + dispose(): void + } + + + interface AgentClientOptions { + serverEndpoint: string + accessToken: string + workspaceRootUri: string + telemetryClientName?: string + customHeaders?: Record + debug?: boolean + trace?: boolean + } + + + export async function createAgentClient({ + serverEndpoint, + accessToken, + workspaceRootUri, + customHeaders, + telemetryClientName, + debug = true, + trace = false, + }: AgentClientOptions): Promise { + // Run agent worker and set up a transport bridge between + // main thread and web-worker thread via json-rpc protocol + const worker = new AgentWorker() as Worker + const rpc = createMessageConnection( + new BrowserMessageReader(worker), + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /vscode/src/jsonrpc/TextDocumentWithUri.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + } from './agent-protocol' + + + /** + * Wrapper around `ProtocolTextDocument` that also contains a parsed vscode.Uri. + * + * We can't use `vscode.Uri` in `ProtocolTextDocument` because we use that type + * in the JSON-RPC protocol where URIs are string-encoded. + */ + export class ProtocolTextDocumentWithUri { + public underlying: ProtocolTextDocument + private constructor( + public readonly uri: vscode.Uri, + underlying?: ProtocolTextDocument + ) { + this.underlying = underlying ?? { uri: uri.toString() } + if (this.underlying.uri !== uri.toString()) { + logDebug( + 'ProtocolTextDocumentWithUri', + 'correcting invariant violation', + `${this.uri} (this.uri) !== ${this.underlying.uri} (this.underlying.uri)` + ) + this.underlying.uri = uri.toString() + } + } + + public static fromDocument(document: ProtocolTextDocument): ProtocolTextDocumentWithUri { + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /vscode/src/jsonrpc/TextDocumentWithUri.test.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + import { describe, expect, it } from 'vitest' + + import { ProtocolTextDocumentWithUri } from './TextDocumentWithUri' + + + describe('TextDocumentWithUri', () => { + it('handles URIs with exclamation marks', () => { + const uri = + 'file:///Users/com.jetbrains/ideaIC-2022.1-sources.jar!/com/intellij/RequiresBackgroundThread.java' + const textDocument = ProtocolTextDocumentWithUri.fromDocument({ uri }) + expect(textDocument.uri.toString()).toStrictEqual(textDocument.underlying.uri) + expect(textDocument.uri.toString()).toStrictEqual( + 'file:///Users/com.jetbrains/ideaIC-2022.1-sources.jar%21/com/intellij/RequiresBackgroundThread.java' + ) + }) + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /vscode/src/jsonrpc/jsonrpc.ts in + repository github.com/sourcegraph/cody: + + ```typescript + + import { appendFileSync, existsSync, mkdirSync, rmSync } from 'node:fs' + + import { dirname } from 'node:path' + + + import { isRateLimitError } from '@sourcegraph/cody-shared' + + import * as vscode from 'vscode' + + import { type CancellationToken, type MessageConnection, ResponseError, Trace } from 'vscode-jsonrpc' + + import { CodyJsonRpcErrorCode } from './CodyJsonRpcErrorCode' + + import type * as agent from './agent-protocol' + + import type * as bfg from './bfg-protocol' + + import type * as embeddings from './embeddings-protocol' + + + type Requests = bfg.Requests & agent.Requests & embeddings.Requests + + type Notifications = bfg.Notifications & agent.Notifications & embeddings.Notifications + + + // String literal types for the names of the Cody Agent protocol methods. + + export type RequestMethodName = keyof Requests + + export type NotificationMethodName = keyof Notifications + + type MethodName = RequestMethodName | NotificationMethodName + + + // Parameter type of a request or notification. Note: JSON-RPC methods can only + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /vscode/src/jsonrpc/isRunningInsideAgent.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + import * as vscode from 'vscode' + + + let cached: boolean | undefined + + export function isRunningInsideAgent(): boolean { + if (cached === undefined) { + cached = vscode.workspace.getConfiguration().get('cody.advanced.agent.running', false) + } + return cached + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /vscode/src/jsonrpc/embeddings-protocol.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + /** + * The protocol for communicating between Cody and local embeddings. + */ + + interface InitializeParams { + codyGatewayEndpoint: string + indexPath: string + chunkingPolicy?: ChunkingPolicy | undefined | null + } + + + interface ChunkingPolicy { + maxFileSizeBytes: number + pathsToExcludeRegexp: string + } + + + interface QueryParams { + repoName: string + query: string + numResults: number + } + + + export interface QueryResultSet { + results: QueryResult[] + } + + + interface QueryResult { + fileName: string + startLine: number + endLine: number + content: string + } + + + interface IndexHealthRequest { + // The name of the repository to scrutinize the index for. Note, this + // is a repo name, like github.com/sourcegraph/cody, not a file path. + repoName: string + } + + + type IndexHealthResult = IndexHealthResultFound | IndexHealthResultNotFound + + + export interface IndexHealthResultFound { + type: 'found' + repoName: string + format: 'App' | 'LocalEmbeddings' + commit: string + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /vscode/src/jsonrpc/CodyJsonRpcErrorCode.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + export enum CodyJsonRpcErrorCode { + ParseError = -32700, + InvalidRequest = -32600, + MethodNotFound = -32601, + InvalidParams = -32602, + InternalError = -32603, + RequestCanceled = -32604, + RateLimitError = -32000, + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /vscode/src/jsonrpc/bfg-protocol.ts + in repository github.com/sourcegraph/cody: + + ```typescript + + /** + * This file declares the protocol for communicating between Cody and BFG (Blazingly Fast Graph), a Rust implementation + * of the "Graph Context" feature flag. + */ + import type { Position } from './agent-protocol' + + + interface BFGFileContextSnippet { + fileName: string + content: string + } + + + interface BFGSymbolContextSnippet extends BFGFileContextSnippet { + symbol: string + } + + + export type Requests = { + 'bfg/initialize': [{ clientName: string }, { serverVersion: string }] + 'bfg/contextAtPosition': [ + { uri: string; content: string; position: Position; maxSnippets: number; maxDepth: number }, + { + symbols?: BFGSymbolContextSnippet[] | undefined | null + files?: BFGFileContextSnippet[] | undefined | null + }, + ] + 'bfg/contextForIdentifiers': [ + { uri: string; identifiers: string[]; maxSnippets: number; maxDepth: number }, + { symbols?: BFGSymbolContextSnippet[] | undefined | null }, + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /vscode/src/graph/bfg/spawn-bfg.ts + in repository github.com/sourcegraph/cody: + + ```typescript + + import * as child_process from 'node:child_process' + + + import * as vscode from 'vscode' + + + import { StreamMessageReader, StreamMessageWriter, createMessageConnection } from 'vscode-jsonrpc/node' + + import { MessageHandler } from '../../jsonrpc/jsonrpc' + + import { logDebug } from '../../log' + + import { getBfgPath } from './download-bfg' + + + export async function spawnBfg( + context: vscode.ExtensionContext, + reject: (reason?: any) => void + ): Promise { + const codyrpc = await getBfgPath(context) + if (!codyrpc) { + throw new Error( + 'Failed to download BFG binary. To fix this problem, set the "cody.experimental.cody-engine.path" configuration to the path of your BFG binary' + ) + } + const isVerboseDebug = vscode.workspace.getConfiguration().get('cody.debug.verbose', false) + const child = child_process.spawn(codyrpc, { + stdio: 'pipe', + env: { + ...process.env, + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /lib/icons/README.md in repository + github.com/sourcegraph/cody: + + ```markdown + + + ```sh + + cp font/cody-icons.ttf ../../vscode/resources/cody-icons.ttf + + cp font/cody-icons.woff ../../vscode/resources/cody-icons.woff + + ``` + + + 2. Register the icons in `vscode/package.json` in the `icons` field. + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /agent/src/local-e2e/README.md in + repository github.com/sourcegraph/cody: + + ```markdown + "completionModel": "anthropic/claude-instant-1", + // truncated + } + + ``` + + + While you can totally edit those over https://sourcegraph.test:3443/site-admin/configuration, the + + recommended method is through the escape hatch: `~/.sourcegraph/site-config.json`. Once the local + + instance is running, saving that file will reload the instance. + + + ## Running the tests + + + 1. In your Sourcegraph folder, run `sg start dotcom-cody-e2e`. + 1. To ensure the default site-admin is available (mandatory), still in the Sourcegraph folder you can run `sg db default-site-admin`. + 1. Back to the Cody repo, run `pnpm run test:local-e2e` + + + ## FAQ + + + ### Why write a test if I'm going to throw it away? + + + First, because it's a starting point. Even if you can't solve the problem, you can at least try + + to reproduce the prolbem and just share that with your teammates. + + + And second, the final integration/e2e test that will be shipped with the fix will most likely + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /agent/src/jsonrpc-alias.ts in + repository github.com/sourcegraph/cody: + + ```typescript + + export * from '../../vscode/src/jsonrpc/jsonrpc' + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /agent/src/cli/scip-codegen/JvmFormatter.ts in repository + github.com/sourcegraph/cody: + + ```typescript + .replaceAll('$/', '') + .split('/') + .map(part => capitalize(part)) + .join('_') + } + + public jsonrpcMethodParameter(jsonrpcMethod: scip.SymbolInformation): { + parameterSyntax: string + parameterType: scip.Type + } { + const parameterType = jsonrpcMethod.signature.value_signature.tpe.type_ref.type_arguments[0] + const parameterSyntax = this.jsonrpcTypeName(jsonrpcMethod, parameterType, 'parameter') + if (this.language === JvmLanguage.Kotlin) { + return { parameterType, parameterSyntax: `params: ${parameterSyntax}` } + } + return { parameterType, parameterSyntax: `${parameterSyntax} params` } + } + + public isNullish(symbol: string): boolean { + return symbol === typescriptKeyword('undefined') || symbol === typescriptKeyword('null') + } + + public isNullableInfo(info: scip.SymbolInformation): boolean { + return this.isNullable(info.signature.value_signature.tpe) + } + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /agent/src/cli/scip-codegen/JvmCodegen.ts in repository + github.com/sourcegraph/cody: + + ```typescript + continue + } + // Process a JSON-RPC request signature. For example: + // type Notifications = { 'textDocument/inlineCompletions': [NotificationParams] } + const { parameterType, parameterSyntax } = f.jsonrpcMethodParameter(notification) + this.queueClassLikeType(parameterType, notification, 'parameter') + p.line(`@JsonNotification("${notification.display_name}")`) + if (this.language === JvmLanguage.Kotlin) { + p.line(`fun ${f.functionName(notification)}(${parameterSyntax})`) + } else { + p.line(`void ${f.functionName(notification)}(${parameterSyntax});`) + } + } + }) + + p.line('}') + + await fspromises.writeFile( + path.join(this.options.output, `${name}.${this.fileExtension()}`), + p.build() + ) + } + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /agent/src/cli/command-root.ts in + repository github.com/sourcegraph/cody: + + ```typescript + + import { authCommand } from './command-auth/command-auth' + + import { benchCommand } from './command-bench/command-bench' + + import { chatCommand } from './command-chat' + + import { jsonrpcCommand } from './command-jsonrpc-stdio' + + import { serverCommand } from './command-jsonrpc-websocket' + + + import { version } from '../../package.json' + + + export const rootCommand = new Command() + .name('cody') + .version(version, '-v, --version') + .description( + 'The Cody cli supports running Cody in headless mode and interacting with it via JSON-RPC. Run `cody chat -m "Hello" to get started.' + ) + .addCommand(authCommand()) + .addCommand(chatCommand()) + .addCommand(new Command('api').addCommand(serverCommand).addCommand(jsonrpcCommand)) + .addCommand(new Command('internal').addCommand(benchCommand)) + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /agent/src/cli/command-jsonrpc-websocket.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + import { logDebug, logError } from '@sourcegraph/cody-shared' + + import { Command } from 'commander' + + import { WebSocketServer } from 'ws' + + import { newAgentClient } from '../agent' + + import type { RpcMessageHandler } from '../jsonrpc-alias' + + import { intOption } from './command-bench/cli-parsers' + + + interface ServerOptions { + port: number + } + + + export const serverCommand = new Command('jsonrpc-websocket') + .description( + 'Start a server that opens JSON-RPC connections through websockets. This command does not work at the moment.' + ) + .option('--port ', 'Which port to listen to', intOption, 7000) + .action(async (options: ServerOptions) => { + const wss = new WebSocketServer({ + port: options.port, + }) + logDebug('cody-server', `Listening... http://localhost:${options.port}`) + wss.on('connection', async ws => { + logDebug('cody-server', 'New client') + let client: RpcMessageHandler | undefined + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /agent/src/cli/command-jsonrpc-stdio.ts in repository + github.com/sourcegraph/cody: + + ```typescript + + import { startPollyRecording } from '../../../vscode/src/testutils/polly' + + import { Agent } from '../agent' + + + import { activate } from '../../../vscode/src/extension.node' + + import { booleanOption } from './command-bench/cli-parsers' + + + interface JsonrpcCommandOptions { + expiresIn?: string | null | undefined + recordingDirectory?: string + keepUnusedRecordings?: boolean + recordingMode?: MODE + recordIfMissing?: boolean + recordingExpiryStrategy?: EXPIRY_STRATEGY + recordingName?: string + } + + + export interface PollyRequestError { + request: Request + error: string + } + + + function recordingModeOption(value: string): MODE { + switch (value) { + case 'record': + case 'replay': + case 'passthrough': + case 'stopped': + return value + default: + throw new commander.InvalidArgumentError( + 'Not a valid recording mode. Valid options are record, replay-or-record, replay, passthrough, or stopped.' + ) + } + } + + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file + /agent/src/__tests__/chat-response-quality/README.md in + repository github.com/sourcegraph/cody: + + ```markdown + + + ### Web interface + + go install github.com/sourcegraph/zoekt/cmd/zoekt-webserver + $GOPATH/bin/zoekt-webserver -listen :6070 + + ### JSON API + + + You can retrieve search results as JSON by sending a GET request to zoekt-webserver. + + curl --get /n --url "http://localhost:6070/search" /n --data-urlencode "q=ngram f:READ" /n --data-urlencode "num=50" /n --data-urlencode "format=json" + + The response data is a JSON object. You can refer to [web.ApiSearchResult](https://sourcegraph.com/github.com/sourcegraph/zoekt@6b1df4f8a3d7b34f13ba0cafd8e1a9b3fc728cf0/-/blob/web/api.go?L23:6&subtree=true) to learn about the structure of the object. + + + ### CLI + + go install github.com/sourcegraph/zoekt/cmd/zoekt + $GOPATH/bin/zoekt 'ngram f:READ' + + ## Installation + + A more organized installation on a Linux server should use a systemd unit file, + + eg. + + [Unit] + Description=zoekt webserver + + [Service] + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /agent/README.md in repository + github.com/sourcegraph/cody: + + ```markdown + + # Cody Agent + + + The `@sourcegraph/cody-agent` package implements a JSON-RPC server to interact + + with Cody via stdout/stdin. This package is intended to be used by + + non-ECMAScript clients such as the JetBrains and NeoVim plugins. + + + ## Releases + + + Cody Agent releases are available: + + + - as self-contained executables for various platforms at [Cody Agent releases](https://github.com/sourcegraph/cody/releases) on GitHub + + - from the `@sourcegraph/cody-agent` npm package (`npx @sourcegraph/cody-agent help`) + + + To build and publish a release using GitHub Actions, bump the version number in the agent's [package.json](package.json) and then push to the `agent-vN.N.N` tag (where `N.N.N` is that version number). + + + ## Protocol + + + The protocol is defined in the file [`protocol.ts`](../vscode/src/jsonrpc/agent-protocol.ts). The TypeScript code is the single source of truth of what JSON-RPC methods are + + supported in the protocol. + + + ## Updating the protocol + + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: >- + Codebase context from file /agent/CHANGELOG.md in repository + github.com/sourcegraph/cody: + + ```markdown + + + - New command `auth login --web` to authenticate the cli through the browser. The access token is stored in the operating system's secret storage (Keychain on macOS, Credential Vault on Windows, Secret Service API/libsecret on Linux). + + - New command `auth login --access-token` to authenticate with an access token or `SRC_ACCESS_TOKEN` environment variable. + + - New command `auth logout` to log out of the cli. + + - New command `auth whoami` to determine what account is logged in. + + - New command `auth accounts` to list all available Sourcegraph accounts. + + - New command `auth settings-path` to print the JSON file path where non-sensitive configuration is stored. + + + ### Changed + + + - The `chat` command now runs faster + + - The `chat` command now prints the reply to the standard output stream instead of system error. + + - The `chat` command now interacively streams the reply to system error. Use `--silent` to disable interactive streaming. + + ``` + - speaker: assistant + text: Ok. + - speaker: human + text: |- + You have access to the provided codebase context. + + Question: What is JSON RPC? + model: anthropic/claude-3-opus-20240229 + temperature: 0 + topK: -1 + topP: -1 + queryString: + - name: api-version + value: "1" + - name: client-name + value: jetbrains + - name: client-version + value: 6.0-localbuild + url: https://demo.sourcegraph.com/.api/completions/stream?api-version=1&client-name=jetbrains&client-version=6.0-localbuild + response: + bodySize: 121498 + content: + mimeType: text/event-stream + size: 121498 + text: >+ + event: completion + + data: {"completion":"Based on the provided codebase context, JSON-RPC (JSON Remote Procedure Call) is a protocol used for communication between different components of the Cody system. Here are a few key points about JSON-RPC in the context of this codebase:\n\n1. JSON-RPC is used to define the protocol for communication between Cody and other components like the BFG (Blazingly Fast Graph) and local embeddings (files `bfg-protocol.ts` and `embeddings-protocol.ts`).\n\n2. The protocol is defined in the file `agent-protocol.ts` in the `vscode/src/jsonrpc` directory. This TypeScript code serves as the single source of truth for the supported JSON-RPC methods in the protocol.\n\n3. The `@sourcegraph/cody-agent` package implements a JSON-RPC server to interact with Cody via stdout/stdin. This is intended for non-ECMAScript clients such as JetBrains and NeoVim plugins to communicate with Cody.\n\n4. The `jsonrpc.ts` file in `vscode/src/jsonrpc` defines types for request method names (`RequestMethodName`) and notification method names (`NotificationMethodName`) based on the protocol definition.\n\n5. The `command-jsonrpc-stdio.ts` and `command-jsonrpc-websocket.ts` files in the `agent/src/cli` directory implement JSON-RPC communication via stdio and WebSocket respectively.\n\nIn summary, JSON-RPC is used as a protocol for communication between different parts of the Cody system, with the protocol defined in TypeScript and implemented in various components for interoperability with non-ECMAScript clients.","stopReason":"end_turn"} + + + event: done + + data: {} + + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:25 GMT + - name: content-type + value: text/event-stream + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "175" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1321 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:21.167Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 904d184d3559994254e824161e4c5c77 + _order: 0 + cache: {} + request: + bodySize: 144 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "144" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 327 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query ContextFilters { + site { + codyContextFilters(version: V1) { + raw + } + } + } + variables: {} + queryString: + - name: ContextFilters + value: null + url: https://demo.sourcegraph.com/.api/graphql?ContextFilters + response: + bodySize: 111 + content: + encoding: base64 + mimeType: application/json + size: 111 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVzvl5JakVJW6ZOSWpRcUg0aLEciWrv\ + NKcnNra2loAAAAA//8=\",\"AwA2LshlNQAAAA==\"]" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:20 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "176" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:20.531Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 5007670687f0520c7adc88dbc7af3663 + _order: 0 + cache: {} + request: + bodySize: 318 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "318" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 344 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query CurrentSiteCodyLlmConfiguration { + site { + codyLLMConfiguration { + chatModel + chatModelMaxTokens + fastChatModel + fastChatModelMaxTokens + completionModel + completionModelMaxTokens + } + } + } + variables: {} + queryString: + - name: CurrentSiteCodyLlmConfiguration + value: null + url: https://demo.sourcegraph.com/.api/graphql?CurrentSiteCodyLlmConfiguration + response: + bodySize: 244 + content: + encoding: base64 + mimeType: application/json + size: 244 + text: "[\"H4sIAAAAAAAAA3zOTQqDMBAF4LvMWnEaC0W3bnXnBYYk1qDNSH5oi+TuxZbSUqGrB8Obj\ + 7eCokBQr+BN0FtKVve27Rq2gzlHR8Gwfd5HCh0rPUMNZMPoeDGykDNFpfMy5yX6XKA4\ + ohAVZJ96R7eeJ2091AeBiBkM5EPzXxvJTPHFlXiCn589KfmyzHqb+kYH4/SV3eQLH8h\ + JVtrBrvcFVYiYUkoPAAAA//8DAJ/xqakRAQAA\"]" + textDecoded: + data: + site: + codyLLMConfiguration: + chatModel: anthropic/claude-3-opus-20240229 + chatModelMaxTokens: 12000 + completionModel: fireworks/starcoder + completionModelMaxTokens: 9000 + fastChatModel: anthropic/claude-3-haiku-20240307 + fastChatModelMaxTokens: 12000 + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.006Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: df222ef86be999cf54ffad2c1b3ab52b + _order: 0 + cache: {} + request: + bodySize: 165 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "165" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 344 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query CurrentSiteCodyLlmConfiguration { + site { + codyLLMConfiguration { + smartContextWindow + } + } + } + variables: {} + queryString: + - name: CurrentSiteCodyLlmConfiguration + value: null + url: https://demo.sourcegraph.com/.api/graphql?CurrentSiteCodyLlmConfiguration + response: + bodySize: 139 + content: + encoding: base64 + mimeType: application/json + size: 139 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVPj6+zvl5aZnppUWJJZn5eWD53MSiE\ + uf8vJLUipLwzLyU/HIlK6XUvMSknNQUpdra2loAAAAA//8=\",\"AwDoCDSlSwAAAA==\ + \"]" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.046Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: ce5b1e7cdbf1da3406b7de4cf77fe38d + _order: 0 + cache: {} + request: + bodySize: 150 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "150" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 339 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query CurrentSiteCodyLlmProvider { + site { + codyLLMConfiguration { + provider + } + } + } + variables: {} + queryString: + - name: CurrentSiteCodyLlmProvider + value: null + url: https://demo.sourcegraph.com/.api/graphql?CurrentSiteCodyLlmProvider + response: + bodySize: 128 + content: + encoding: base64 + mimeType: application/json + size: 128 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVPj6+zvl5aZnppUWJJZn5eSDxgqL8s\ + syU1CIlK6Xi/NKi5NT0osSCDKXa2tpaAAAAAP//AwAfFAXARQAAAA==\"]" + textDecoded: + data: + site: + codyLLMConfiguration: + provider: sourcegraph + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.026Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 1e4155184524e985a9d3113dc68b8f02 + _order: 0 + cache: {} + request: + bodySize: 341 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "341" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 324 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query CurrentUser { + currentUser { + id + hasVerifiedEmail + displayName + username + avatarURL + primaryEmail { + email + } + organizations { + nodes { + id + name + } + } + } + } + variables: {} + queryString: + - name: CurrentUser + value: null + url: https://demo.sourcegraph.com/.api/graphql?CurrentUser + response: + bodySize: 260 + content: + encoding: base64 + mimeType: application/json + size: 260 + text: "[\"H4sIAAAAAAAAAzSOwQrCQAxE/yXnevK24NGLaAWxRRAPoRtrZJstyVassv8u1Xp8wzDz3\ + uAxIbg3NIMqSaqMdEL24KA+laG5x1d53K2ggBtaTcpXJr/ukAO4KwajAjxbH3AssSNw\ + MoRQwGCk8mVooh8TWWJpoQB8YEKtDtt/s1fuUMd58ZdFbVH4hYmj2KQj0ZOBO89ix+V\ + G9vdqkppPWIzbW7IFPbHrAxnkS845fwAAAP//AwC8qhJW4QAAAA==\"]" + textDecoded: + data: + currentUser: + avatarURL: null + displayName: null + hasVerifiedEmail: false + id: VXNlcjozNTM= + organizations: + nodes: + - id: T3JnOjU= + name: insights-examples + primaryEmail: null + username: codytesting + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.065Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 48fcaa63c10513ba4765138404e0f5b2 + _order: 0 + cache: {} + request: + bodySize: 739 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: traceparent + value: 00-86dd245a47c1f0f20c9a2f9b5ff9a829-4f0ec2d152676d63-01 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "739" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 397 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: >- + + query GetCodyContext($repos: [ID!]!, $query: String!, $codeResultsCount: Int!, $textResultsCount: Int!) { + getCodyContext(repos: $repos, query: $query, codeResultsCount: $codeResultsCount, textResultsCount: $textResultsCount) { + ...on FileChunkContext { + blob { + path + repository { + id + name + } + commit { + oid + } + url + } + startLine + endLine + chunkContent + } + } + } + variables: + codeResultsCount: 15 + query: What is JSON RPC? + repos: + - UmVwb3NpdG9yeTozNzI2MQ== + textResultsCount: 5 + queryString: + - name: GetCodyContext + value: null + url: https://demo.sourcegraph.com/.api/graphql?GetCodyContext + response: + bodySize: 8500 + content: + encoding: base64 + mimeType: application/json + size: 8500 + text: "[\"H4sIAAAAAAAA/+R86XIbt7Lwq/Rh/BXJFDmjxVuYUjmyLDtKvB1Jjr9TpssEZ5okrCEwB\ + jCiaIX32W81gFm52PG5/6Q/IoFGo9FoNHoDb1sxM6w1uG1N0ZzIeHkihcEb0xp8uG2N\ + EzmmrpSZWWvQYlMUJtQqCj99MqiN/vQpjGbM9BXqVAqN/S8ZS7hZhuenx89enQbzuNV\ + rKUyl5kaqJaHicWvQejf/azE+fJ3GL35Z4qX8+vrr2cGrfx8dtXotwebYGrS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q9b8BAAD//6qPyUCLXAAA\"]" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:21 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "175" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: content-encoding + value: gzip + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:20.804Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 0420907dbc8d483fb0caefdcb56dc902 + _order: 0 + cache: {} + request: + bodySize: 246 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "246" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 325 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: | + + query Repositories($names: [String!]!, $first: Int!) { + repositories(names: $names, first: $first) { + nodes { + name + id + } + } + } + variables: + first: 1 + names: + - github.com/sourcegraph/cody + queryString: + - name: Repositories + value: null + url: https://demo.sourcegraph.com/.api/graphql?Repositories + response: + bodySize: 180 + content: + encoding: base64 + mimeType: application/json + size: 180 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqSi3IL84syS/KTC0G8fPyU0CM6GqlvMTcVCUrpfTMk\ + ozSJL3k/Fz94vzSouTU9KLEggz95PyUSiUdpcwUJSul0Nyw8iRjv4IUd8vK1JD8Kr8q\ + TyPfQFtbpdrY2tpaAAAAAP//AwDQIawwbAAAAA==\"]" + textDecoded: + data: + repositories: + nodes: + - id: UmVwb3NpdG9yeTozNzI2MQ== + name: github.com/sourcegraph/cody + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:20 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "176" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:20.028Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: ad724b1d99cd03b5ca781ef8a218294c + _order: 0 + cache: {} + request: + bodySize: 141 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "141" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 330 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query SiteGraphQLFields { + __type(name: "Site") { + fields { + name + } + } + } + variables: {} + queryString: + - name: SiteGraphQLFields + value: null + url: https://demo.sourcegraph.com/.api/graphql?SiteGraphQLFields + response: + bodySize: 596 + content: + encoding: base64 + mimeType: application/json + size: 596 + text: "[\"H4sIAAAAAAAAA3ySwY7bMAxE/8XnfkFuCzcuFkiBNt5sD0WxYKSJQ6wsuSKVxAjy74WSb\ + hEZTm82Z0yTb3iuLClVi3P19qbjgPy0Yzgr1eLnufLUo1pUbKvLp39vwornz/cVE/yO\ + uxRJOfh7wZFCtIUq+06KJn9rNYkhizlps14VPyG/hgtkW9bCf2AcEWvyT7Znz6KI9zI\ + ZA5GX8A5fTEBJ999iOLBFLAScFNGTezImJK+Ftk3s7CuiTBYdYrDJ6IySBkuKeg/zfl\ + /2gJU1hiCsIY71I4Ifw7SIBzaQJoa+YVcAIOfCcWlZlxPzD9b91LyLwEYQZXkygIUtO\ + yGWC+9J6mDx7BXOcQdvJll5K8ue2L0i8o7NdYFrQWb4tGkrJvIw3TIJdWiVlEXZlDF5\ + cuO0mGSSWR985si+e9AlI8qH83GLGVfZcugiWaxBlj1keiphc9OXnrauhDYgZqB16Ae\ + HvJl8T0Fp1mLxP1vE78QRcmMJe+XYhPzdeO/jnMk4M4oJdlytvj68pqzfxAakKUKm6h\ + dSHGlck2LFPWvGmWSmh+KkDTu9BvHrcrn8AQAA//8DAOln405LBAAA\"]" + textDecoded: + data: + __type: + fields: + - name: id + - name: siteID + - name: configuration + - name: latestSettings + - name: settingsCascade + - name: settingsURL + - name: canReloadSite + - name: viewerCanAdminister + - name: accessTokens + - name: authProviders + - name: externalAccounts + - name: buildVersion + - name: productVersion + - name: updateCheck + - name: needsRepositoryConfiguration + - name: externalServicesFromFile + - name: allowEditExternalServicesWithFile + - name: freeUsersExceeded + - name: alerts + - name: hasCodeIntelligence + - name: sendsEmailVerificationEmails + - name: productSubscription + - name: usageStatistics + - name: analytics + - name: users + - name: monitoringStatistics + - name: allowSiteSettingsEdits + - name: upgradeReadiness + - name: autoUpgradeEnabled + - name: perUserCompletionsQuota + - name: perUserCodeCompletionsQuota + - name: requiresVerifiedEmailForCody + - name: isCodyEnabled + - name: codyLLMConfiguration + - name: codyConfigFeatures + - name: codyGatewayRateLimitStatus + - name: codyContextFilters + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1355 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.316Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: e2304ad643386d8500a41a21d240755f + _order: 0 + cache: {} + request: + bodySize: 100 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "100" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 331 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query SiteHasCodyEnabled { + site { + isCodyEnabled + } + } + variables: {} + queryString: + - name: SiteHasCodyEnabled + value: null + url: https://demo.sourcegraph.com/.api/graphql?SiteHasCodyEnabled + response: + bodySize: 40 + content: + mimeType: application/json + size: 40 + text: "{\"data\":{\"site\":{\"isCodyEnabled\":true}}}" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: content-length + value: "40" + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1323 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:19.494Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 2f61c4440220a7c49cbf07315e5225db + _order: 0 + cache: {} + request: + bodySize: 101 + cookies: [] + headers: + - _fromType: array + name: authorization + value: token + REDACTED_b20717265e7ab1d132874d8ff0be053ab9c1dacccec8dce0bbba76888b6a0a69 + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "101" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: demo.sourcegraph.com + headersSize: 331 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query SiteProductVersion { + site { + productVersion + } + } + variables: {} + queryString: + - name: SiteProductVersion + value: null + url: https://demo.sourcegraph.com/.api/graphql?SiteProductVersion + response: + bodySize: 44 + content: + mimeType: application/json + size: 44 + text: "{\"data\":{\"site\":{\"productVersion\":\"5.6.0\"}}}" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:19 GMT + - name: content-type + value: application/json + - name: content-length + value: "44" + - name: connection + value: keep-alive + - name: retry-after + value: "177" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Accept-Encoding, Authorization, Cookie, Authorization, X-Requested-With, + Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + headersSize: 1323 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:18.984Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 09b59ac55ce3c40d6f9ab8c79846a2c6 + _order: 0 + cache: {} + request: + bodySize: 144 + cookies: [] + headers: + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "144" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: sourcegraph.com + headersSize: 244 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query ContextFilters { + site { + codyContextFilters(version: V1) { + raw + } + } + } + variables: {} + queryString: + - name: ContextFilters + value: null + url: https://sourcegraph.com/.api/graphql?ContextFilters + response: + bodySize: 104 + content: + encoding: base64 + mimeType: application/json + size: 104 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVzvl5JakVJW6ZOSWpRcUg0aLEciWrv\ + NKcnNra2loAAAAA//8DADYuyGU1AAAA\"]" + textDecoded: + data: + site: + codyContextFilters: + raw: null + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:18 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "178" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1440 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:18.537Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + - _id: 203c1896021c3a09dfe619120ea1b725 + _order: 0 + cache: {} + request: + bodySize: 101 + cookies: [] + headers: + - _fromType: array + name: content-type + value: application/json; charset=utf-8 + - _fromType: array + name: user-agent + value: JetBrains / 6.0-localbuild + - _fromType: array + name: accept + value: "*/*" + - _fromType: array + name: content-length + value: "101" + - _fromType: array + name: accept-encoding + value: gzip,deflate + - name: host + value: sourcegraph.com + headersSize: 248 + httpVersion: HTTP/1.1 + method: POST + postData: + mimeType: application/json; charset=utf-8 + params: [] + textJSON: + query: |- + + query SiteProductVersion { + site { + productVersion + } + } + variables: {} + queryString: + - name: SiteProductVersion + value: null + url: https://sourcegraph.com/.api/graphql?SiteProductVersion + response: + bodySize: 139 + content: + encoding: base64 + mimeType: application/json + size: 139 + text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdEFRfkppcklYalFxZn5eUpWSkYWZhamxvFGB\ + kYmugYWugaW8aZ6ZropBkkWFqbGxkkmpmZKtbW1AAAAAP//\",\"AwDAvJF7SQAAAA==\ + \"]" + cookies: [] + headers: + - name: date + value: Fri, 09 Aug 2024 12:48:18 GMT + - name: content-type + value: application/json + - name: transfer-encoding + value: chunked + - name: connection + value: keep-alive + - name: retry-after + value: "178" + - name: access-control-allow-credentials + value: "true" + - name: access-control-allow-origin + value: "" + - name: cache-control + value: no-cache, max-age=0 + - name: vary + value: Cookie,Accept-Encoding,Authorization,Cookie, Authorization, + X-Requested-With,Cookie + - name: x-content-type-options + value: nosniff + - name: x-frame-options + value: DENY + - name: x-xss-protection + value: 1; mode=block + - name: strict-transport-security + value: max-age=31536000; includeSubDomains; preload + - name: content-encoding + value: gzip + headersSize: 1440 + httpVersion: HTTP/1.1 + redirectURL: "" + status: 200 + statusText: OK + startedDateTime: 2024-08-09T12:48:18.242Z + time: 0 + timings: + blocked: -1 + connect: -1 + dns: -1 + receive: 0 + send: 0 + ssl: -1 + wait: 0 + pages: [] + version: "1.2" diff --git a/src/integrationTest/resources/recordings/integration-test_2927926756/recording.har.yaml b/src/integrationTest/resources/recordings/documentCode_2994921345/recording.har.yaml similarity index 90% rename from src/integrationTest/resources/recordings/integration-test_2927926756/recording.har.yaml rename to src/integrationTest/resources/recordings/documentCode_2994921345/recording.har.yaml index f43e01b968..6dacb4e2bf 100644 --- a/src/integrationTest/resources/recordings/integration-test_2927926756/recording.har.yaml +++ b/src/integrationTest/resources/recordings/documentCode_2994921345/recording.har.yaml @@ -1,5 +1,5 @@ log: - _recordingName: integration-test + _recordingName: documentCode creator: comment: persister:fs name: Polly.JS @@ -36,26 +36,24 @@ log: queryString: [] url: https://sourcegraph.com/.api/client-config response: - bodySize: 188 + bodySize: 198 content: encoding: base64 mimeType: text/plain; charset=utf-8 - size: 188 - text: "[\"H4sIAAAAAAAAA2zMsQoCMRCE4T5PsVztE9hJsLjOznrPrBjI7koyQeW4d7dRBEn9z3xrI\ - CKaLp5eR+OlSJr2hNpl9wk3xjBwh0fXexHI+NkbXKOrsqU2NoCal47s9utXLu07aMoV\ - 0Q3yxDlb8sfQUU9S2uE0/ylhC28AAAD//wMAK/Ow9eAAAAA=\"]" + size: 198 + text: "[\"H4sIAAAA\",\"AAAAA2zMsQoCMRCE4T5PsVztE9hJsLjOznrPrBjI7koyQeW4d7dRBEn9\ + z3xrICKaLp5eR+OlSJr2hNpl9wk3xjBwh0fXexHI+NkbXKOrsqU2NoCal47s9utXLu0\ + 7aMoV0Q3yxDlb8sfQUU9S2uE0/ylhC28AAAD//w==\",\"AwAr87D14AAAAA==\"]" cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:46 GMT + value: Fri, 09 Aug 2024 12:41:14 GMT - name: content-type value: text/plain; charset=utf-8 - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "403" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -75,12 +73,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1449 + headersSize: 1342 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:45.841Z + startedDateTime: 2024-08-09T12:41:14.596Z time: 0 timings: blocked: -1 @@ -107,7 +105,7 @@ log: - name: user-agent value: JetBrains / 6.0-localbuild - name: traceparent - value: 00-0ec7441b05369c730163041565b0a6c3-ec2f5176d73290f6-01 + value: 00-5fb0e28015d22fc1aee471c93c766b0e-c3b43e35617cba56-01 - name: connection value: keep-alive - name: host @@ -206,14 +204,14 @@ log: value: 6.0-localbuild url: https://sourcegraph.com/.api/completions/stream?api-version=1&client-name=jetbrains&client-version=6.0-localbuild response: - bodySize: 1837 + bodySize: 1168 content: mimeType: text/event-stream - size: 1837 + size: 1168 text: >+ event: completion - data: {"completion":"/**\n * Imports the necessary Java utility classes, including {@link java.util.List} and {@link java.util.ArrayList}.\n */","stopReason":"stop_sequence"} + data: {"completion":"/**\n * Imports the necessary Java utility classes, including ArrayList and List.\n */","stopReason":"stop_sequence"} event: done @@ -223,7 +221,7 @@ log: cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:48 GMT + value: Fri, 09 Aug 2024 12:41:17 GMT - name: content-type value: text/event-stream - name: transfer-encoding @@ -231,7 +229,7 @@ log: - name: connection value: keep-alive - name: retry-after - value: "401" + value: "600" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -254,7 +252,7 @@ log: redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:47.322Z + startedDateTime: 2024-08-09T12:41:16.156Z time: 0 timings: blocked: -1 @@ -329,15 +327,13 @@ log: cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:46 GMT + value: Fri, 09 Aug 2024 12:41:15 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "403" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -357,12 +353,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:46.212Z + startedDateTime: 2024-08-09T12:41:14.978Z time: 0 timings: blocked: -1 @@ -427,37 +423,25 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentSiteCodyLlmConfiguration response: - bodySize: 248 + bodySize: 251 content: encoding: base64 mimeType: application/json - size: 248 - text: "[\"H4sIAAAAAAAAA3zOwQqCQBAG4HeZs+K0BqFXr3rrBYbdMRdtJ3ZXKmTfPSyiSOg08PP/H\ - 7OAoUhQLxBs5PVqMfe27RpxvT3NnqIV98wHip0YnqAGcnHwcrG60BPNhvMyD+Icx1yh\ - 2qNSFWSfQUe3o4zsAtQ7hYgZ9BRi898byI7ziyvxAD+bLanlfJl4ffaN9tbzVfwYihD\ - JazHsYdP7gipETCmlBwAAAP//AwBQeP+1EwEAAA==\"]" - textDecoded: - data: - site: - codyLLMConfiguration: - chatModel: anthropic/claude-3-sonnet-20240229 - chatModelMaxTokens: 12000 - completionModel: fireworks/starcoder - completionModelMaxTokens: 9000 - fastChatModel: anthropic/claude-3-haiku-20240307 - fastChatModelMaxTokens: 12000 + size: 251 + text: "[\"H4sIAAAAAAAAA3zOwQqC\",\"QBAG4HeZs+K0BqFXr3rrBYbdMRdtJ3ZXKmTfPSyiSOg0\ + 8PP/H7OAoUhQLxBs5PVqMfe27RpxvT3NnqIV98wHip0YnqAGcnHwcrG60BPNhvMyD+I\ + cx1yh2qNSFWSfQUe3o4zsAtQ7hYgZ9BRi898byI7ziyvxAD+bLanlfJl4ffaN9tbzVf\ + wYihDJazHsYdP7gipETCmlBwAAAP//AwBQeP+1EwEAAA==\"]" cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:45 GMT + value: Fri, 09 Aug 2024 12:41:14 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "404" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -477,12 +461,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:44.993Z + startedDateTime: 2024-08-09T12:41:13.684Z time: 0 timings: blocked: -1 @@ -557,15 +541,13 @@ log: cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:45 GMT + value: Fri, 09 Aug 2024 12:41:14 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "404" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -585,12 +567,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:45.025Z + startedDateTime: 2024-08-09T12:41:13.720Z time: 0 timings: blocked: -1 @@ -650,30 +632,28 @@ log: value: null url: https://sourcegraph.com/.api/graphql?CurrentSiteCodyLlmProvider response: - bodySize: 124 + bodySize: 128 content: encoding: base64 mimeType: application/json - size: 124 + size: 128 text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdHJ+SmVPj6+zvl5aZnppUWJJZn5eSDxgqL8s\ - syU1CIlK6W0zKLU8vyi7GKl2traWgAAAAD//wMAf38NDUMAAAA=\"]" + syU1CIlK6Xi/NKi5NT0osSCDKXa2tpaAAAAAP//AwAfFAXARQAAAA==\"]" textDecoded: data: site: codyLLMConfiguration: - provider: fireworks + provider: sourcegraph cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:45 GMT + value: Fri, 09 Aug 2024 12:41:13 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "404" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -693,12 +673,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:45.009Z + startedDateTime: 2024-08-09T12:41:13.703Z time: 0 timings: blocked: -1 @@ -795,15 +775,13 @@ log: cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:45 GMT + value: Fri, 09 Aug 2024 12:41:14 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "404" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -823,12 +801,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:45.041Z + startedDateTime: 2024-08-09T12:41:13.738Z time: 0 timings: blocked: -1 @@ -913,15 +891,13 @@ log: cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:45 GMT + value: Fri, 09 Aug 2024 12:41:14 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "403" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -941,12 +917,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:45.289Z + startedDateTime: 2024-08-09T12:41:14.014Z time: 0 timings: blocked: -1 @@ -1009,21 +985,19 @@ log: encoding: base64 mimeType: application/json size: 139 - text: "[\"H4sIAAAAAAAAA6pWSkksSVSyqlYqzixJBdEFRfkppcklYalFxZn5eUpWSkYWphamxvFGB\ - kYmugYWugam8aZ6prqpxsZGhkYmZpYWlqlKtbW1AAAAAP//\",\"AwDZmR/0SQAAAA==\ + text: "[\"H4sIAAAAAAAAA6pWSkks\",\"SVSyqlYqzixJBdEFRfkppcklYalFxZn5eUpWSkYWZham\ + xvFGBkYmugYWugaW8aZ6ZropBkkWFqbGxkkmpmZKtbW1AAAAAP//AwDAvJF7SQAAAA==\ \"]" cookies: [] headers: - name: date - value: Mon, 05 Aug 2024 10:11:45 GMT + value: Fri, 09 Aug 2024 12:41:14 GMT - name: content-type value: application/json - name: transfer-encoding value: chunked - name: connection value: keep-alive - - name: retry-after - value: "404" - name: access-control-allow-credentials value: "true" - name: access-control-allow-origin @@ -1043,12 +1017,12 @@ log: value: max-age=31536000; includeSubDomains; preload - name: content-encoding value: gzip - headersSize: 1440 + headersSize: 1333 httpVersion: HTTP/1.1 redirectURL: "" status: 200 statusText: OK - startedDateTime: 2024-08-05T10:11:44.958Z + startedDateTime: 2024-08-09T12:41:13.645Z time: 0 timings: blocked: -1 diff --git a/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgent.kt b/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgent.kt index 2ed832d464..0e60ff4ead 100644 --- a/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgent.kt +++ b/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgent.kt @@ -98,9 +98,12 @@ private constructor( private fun shouldSpawnDebuggableAgent() = System.getenv("CODY_AGENT_DEBUG_INSPECT") == "true" - fun create(project: Project): CompletableFuture { + fun create( + project: Project, + additionalEnvs: Map + ): CompletableFuture { try { - val conn = startAgentProcess() + val conn = startAgentProcess(additionalEnvs) val client = CodyAgentClient() client.onSetConfigFeatures = project.service() val launcher = startAgentLauncher(conn, client) @@ -142,7 +145,7 @@ private constructor( } } - private fun startAgentProcess(): AgentConnection { + private fun startAgentProcess(additionalEnvs: Map): AgentConnection { if (ConfigUtil.shouldConnectToDebugAgent()) { return connectToDebugAgent() } @@ -204,6 +207,9 @@ private constructor( } } + // Add optional environment variables + additionalEnvs.forEach { (key, value) -> processBuilder.environment()[key] = value } + logger.info("starting Cody agent ${command.joinToString(" ")}") logger.info( "Cody agent proxyUrl ${proxyUrl} PROXY_TYPE_IS_SOCKS ${proxy.PROXY_TYPE_IS_SOCKS}") diff --git a/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentServer.kt b/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentServer.kt index 39f8c69bde..de7a08b684 100644 --- a/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentServer.kt +++ b/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentServer.kt @@ -19,7 +19,6 @@ import com.sourcegraph.cody.agent.protocol.IgnorePolicySpec import com.sourcegraph.cody.agent.protocol.IgnoreTestParams import com.sourcegraph.cody.agent.protocol.IgnoreTestResponse import com.sourcegraph.cody.agent.protocol.InlineEditParams -import com.sourcegraph.cody.agent.protocol.NetworkRequest import com.sourcegraph.cody.agent.protocol.ProtocolTextDocument import com.sourcegraph.cody.agent.protocol.RemoteRepoHasParams import com.sourcegraph.cody.agent.protocol.RemoteRepoHasResponse @@ -42,6 +41,7 @@ import com.sourcegraph.cody.agent.protocol_generated.Graphql_GetRepoIdsParams import com.sourcegraph.cody.agent.protocol_generated.Graphql_GetRepoIdsResult import com.sourcegraph.cody.agent.protocol_generated.Null import com.sourcegraph.cody.agent.protocol_generated.ServerInfo +import com.sourcegraph.cody.agent.protocol_generated.Testing_RequestErrorsResult import com.sourcegraph.cody.chat.ConnectionId import java.util.concurrent.CompletableFuture import org.eclipse.lsp4j.jsonrpc.services.JsonNotification @@ -83,6 +83,9 @@ interface _SubsetGeneratedCodyAgentServer { @JsonRequest("extensionConfiguration/getSettingsSchema") fun extensionConfiguration_getSettingsSchema(params: Null?): CompletableFuture + @JsonRequest("testing/requestErrors") + fun testing_requestErrors(params: Null?): CompletableFuture + // // ============= // // Notifications // // ============= @@ -202,7 +205,4 @@ interface _LegacyAgentServer { @JsonRequest("testing/ignore/overridePolicy") fun testingIgnoreOverridePolicy(params: IgnorePolicySpec?): CompletableFuture - - @JsonRequest("testing/requestErrors") - fun testingRequestErrors(): CompletableFuture> } diff --git a/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentService.kt b/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentService.kt index 2315dffe25..09b4d50b3a 100644 --- a/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentService.kt +++ b/src/main/kotlin/com/sourcegraph/cody/agent/CodyAgentService.kt @@ -159,11 +159,15 @@ class CodyAgentService(private val project: Project) : Disposable { synchronized(startupActions) { startupActions.add(action) } } - fun startAgent(project: Project, secondsTimeout: Long = 45): CompletableFuture { + fun startAgent( + project: Project, + secondsTimeout: Long = 45, + additionalEnvs: Map = emptyMap() + ): CompletableFuture { ApplicationManager.getApplication().executeOnPooledThread { try { val future = - CodyAgent.create(project).exceptionally { err -> + CodyAgent.create(project, additionalEnvs).exceptionally { err -> val msg = "Creating agent unsuccessful: ${err.localizedMessage}" logger.error(msg) throw (CodyAgentException(msg)) diff --git a/src/main/kotlin/com/sourcegraph/cody/agent/protocol/NetworkRequest.kt b/src/main/kotlin/com/sourcegraph/cody/agent/protocol/NetworkRequest.kt deleted file mode 100644 index 5c287b6633..0000000000 --- a/src/main/kotlin/com/sourcegraph/cody/agent/protocol/NetworkRequest.kt +++ /dev/null @@ -1,3 +0,0 @@ -package com.sourcegraph.cody.agent.protocol - -data class NetworkRequest(val url: String?, val body: String?, val error: String?) diff --git a/src/main/kotlin/com/sourcegraph/cody/chat/AgentChatSession.kt b/src/main/kotlin/com/sourcegraph/cody/chat/AgentChatSession.kt index e4a17de2ab..26c493e436 100644 --- a/src/main/kotlin/com/sourcegraph/cody/chat/AgentChatSession.kt +++ b/src/main/kotlin/com/sourcegraph/cody/chat/AgentChatSession.kt @@ -57,7 +57,7 @@ private constructor( private val chatPanel: ChatPanel = ChatPanel(project, chatSession = this, chatModelProviderFromState) private val cancellationToken = AtomicReference(CancellationToken()) - private val messages = mutableListOf() + val messages = mutableListOf() init { cancellationToken.get().dispose() diff --git a/src/main/kotlin/com/sourcegraph/cody/chat/ui/BlinkingCursorComponent.kt b/src/main/kotlin/com/sourcegraph/cody/chat/ui/BlinkingCursorComponent.kt index b398724a1a..06ab4617c9 100644 --- a/src/main/kotlin/com/sourcegraph/cody/chat/ui/BlinkingCursorComponent.kt +++ b/src/main/kotlin/com/sourcegraph/cody/chat/ui/BlinkingCursorComponent.kt @@ -1,5 +1,6 @@ package com.sourcegraph.cody.chat.ui +import com.intellij.openapi.Disposable import com.intellij.util.ui.UIUtil import java.awt.Dimension import java.awt.Font @@ -7,7 +8,7 @@ import java.awt.Graphics import javax.swing.JPanel import javax.swing.Timer -class BlinkingCursorComponent private constructor() : JPanel() { +class BlinkingCursorComponent : JPanel(), Disposable { private var showCursor = true private val timer: Timer = @@ -34,7 +35,7 @@ class BlinkingCursorComponent private constructor() : JPanel() { return Dimension(30, 30) } - companion object { - var instance = BlinkingCursorComponent() + override fun dispose() { + timer.stop() } } diff --git a/src/main/kotlin/com/sourcegraph/cody/chat/ui/ChatPanel.kt b/src/main/kotlin/com/sourcegraph/cody/chat/ui/ChatPanel.kt index 5b97c4598d..add6a3b4a9 100644 --- a/src/main/kotlin/com/sourcegraph/cody/chat/ui/ChatPanel.kt +++ b/src/main/kotlin/com/sourcegraph/cody/chat/ui/ChatPanel.kt @@ -41,7 +41,7 @@ class ChatPanel( private val messagesPanel = MessagesPanel(project, chatSession) private val chatPanel = ChatScrollPane(messagesPanel) - internal val contextView: EnhancedContextPanel = EnhancedContextPanel.create(project, chatSession) + val contextView: EnhancedContextPanel = EnhancedContextPanel.create(project, chatSession) private val stopGeneratingButton = object : JButton("Stop generating", IconUtil.desaturate(AllIcons.Actions.Suspend)) { diff --git a/src/main/kotlin/com/sourcegraph/cody/chat/ui/MessagesPanel.kt b/src/main/kotlin/com/sourcegraph/cody/chat/ui/MessagesPanel.kt index 769e7fe8ce..9092bfd5b9 100644 --- a/src/main/kotlin/com/sourcegraph/cody/chat/ui/MessagesPanel.kt +++ b/src/main/kotlin/com/sourcegraph/cody/chat/ui/MessagesPanel.kt @@ -4,6 +4,7 @@ import com.intellij.openapi.application.ApplicationManager import com.intellij.openapi.keymap.KeymapUtil import com.intellij.openapi.project.Project import com.intellij.openapi.ui.VerticalFlowLayout +import com.intellij.openapi.util.Disposer import com.intellij.util.concurrency.annotations.RequiresEdt import com.sourcegraph.cody.agent.protocol.ChatMessage import com.sourcegraph.cody.agent.protocol.Speaker @@ -45,7 +46,7 @@ class MessagesPanel(private val project: Project, private val chatSession: ChatS } if (message.speaker == Speaker.ASSISTANT && message.actualMessage().isBlank()) { - add(BlinkingCursorComponent.instance) + add(BlinkingCursorComponent()) } revalidate() @@ -54,7 +55,12 @@ class MessagesPanel(private val project: Project, private val chatSession: ChatS @RequiresEdt fun removeBlinkingCursor() { - components.find { it is BlinkingCursorComponent }?.let { remove(it) } + components + .firstNotNullOfOrNull { it as? BlinkingCursorComponent } + ?.let { + Disposer.dispose(it) + remove(it) + } } fun registerCancellationToken(cancellationToken: CancellationToken) { diff --git a/src/main/kotlin/com/sourcegraph/cody/context/EnterpriseEnhancedContextStateController.kt b/src/main/kotlin/com/sourcegraph/cody/context/EnterpriseEnhancedContextStateController.kt index 53148c51a8..7a0e974b50 100644 --- a/src/main/kotlin/com/sourcegraph/cody/context/EnterpriseEnhancedContextStateController.kt +++ b/src/main/kotlin/com/sourcegraph/cody/context/EnterpriseEnhancedContextStateController.kt @@ -342,4 +342,6 @@ class EnterpriseEnhancedContextStateController( fun requestUIUpdate() { ApplicationManager.getApplication().executeOnPooledThread(this::updateUI) } + + fun getConfiguredState() = model_.configured } diff --git a/src/main/kotlin/com/sourcegraph/cody/context/ui/EnhancedContextPanel.kt b/src/main/kotlin/com/sourcegraph/cody/context/ui/EnhancedContextPanel.kt index 3421cfc474..e77e35143e 100644 --- a/src/main/kotlin/com/sourcegraph/cody/context/ui/EnhancedContextPanel.kt +++ b/src/main/kotlin/com/sourcegraph/cody/context/ui/EnhancedContextPanel.kt @@ -205,7 +205,7 @@ class EnterpriseEnhancedContextPanel(project: Project, chatSession: ChatSession) private const val ENTER_MAP_KEY = "enter" } - private var controller = + val controller = EnterpriseEnhancedContextStateController( project, object : ChatEnhancedContextStateProvider {