From 501b98002aa93420d971cebbb33d48f426a8b4da Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=93lafur=20P=C3=A1ll=20Geirsson?= Date: Wed, 14 Feb 2024 13:30:58 +0100 Subject: [PATCH] Agent: automate generation of Kotlin bindings (#3142) Until now, we have been manually writing Kotlin bindings for the agent protocol. This worked fine when only a small number of people worked on the protocol and the protocol was small, but has become increasingly problematic as more people are actively working on the JetBrains plugin and the size of the Agent protocol has grown. For example, if you make a mistake in the bindings, you may end up spending a long time debugging why something is not working because the error messages can be cryptic. This PR adds a new script to automatically generate Kotlin bindings so that we no longer need to rely on manually written bindings. Simplified, the script works like this: - Index the codebase with a fork of scip-typescript. This fork uses an extension of SCIP that adds `SymbolInformation.signature` (more details here https://github.com/sourcegraph/scip/pull/231). - Use the structured type signatures from the SCIP index, translate it into Kotlin code, and report errors if something in the protocol has no clean translation to Kotlin. - Add the generated code to the Cody repo so that we can closely track what Cody PRs are influencing the protocol, and how they're influencing it. ## Test plan Green CI --- .github/workflows/agent-bindings.yml | 40 + agent/bindings/kotlin/.gitattributes | 9 + agent/bindings/kotlin/.gitignore | 42 + agent/bindings/kotlin/build | 19 + .../bindings/kotlin/gradle/libs.versions.toml | 14 + .../kotlin/gradle/wrapper/gradle-wrapper.jar | Bin 0 -> 43462 bytes .../gradle/wrapper/gradle-wrapper.properties | 7 + agent/bindings/kotlin/gradlew | 249 + agent/bindings/kotlin/gradlew.bat | 92 + agent/bindings/kotlin/lib/build.gradle.kts | 44 + .../ActiveTextEditorSelectionRange.kt | 8 + .../protocol_generated/AttributionParams.kt | 8 + .../Attribution_SearchParams.kt | 8 + .../Attribution_SearchResult.kt | 9 + .../cody/protocol_generated/AuthMethod.kt | 5 + .../cody/protocol_generated/AuthStatus.kt | 22 + .../protocol_generated/AutocompleteItem.kt | 9 + .../protocol_generated/AutocompleteParams.kt | 11 + .../protocol_generated/AutocompleteResult.kt | 8 + .../cody/protocol_generated/CancelParams.kt | 7 + .../cody/protocol_generated/ChatButton.kt | 9 + .../cody/protocol_generated/ChatError.kt | 18 + .../protocol_generated/ChatEventSource.kt | 5 + .../cody/protocol_generated/ChatHistory.kt | 7 + .../protocol_generated/ChatInputHistory.kt | 8 + .../cody/protocol_generated/ChatMessage.kt | 13 + .../cody/protocol_generated/ChatMetadata.kt | 9 + .../cody/protocol_generated/ChatSubmitType.kt | 5 + .../Chat_EditMessageParams.kt | 8 + .../protocol_generated/Chat_ModelsParams.kt | 7 + .../protocol_generated/Chat_ModelsResult.kt | 7 + .../Chat_RemoteReposParams.kt | 7 + .../Chat_RemoteReposResult.kt | 7 + .../protocol_generated/Chat_RestoreParams.kt | 9 + .../Chat_SubmitMessageParams.kt | 8 + .../Check_IsCodyIgnoredFileParams.kt | 7 + .../protocol_generated/ClientCapabilities.kt | 16 + .../cody/protocol_generated/ClientInfo.kt | 12 + .../cody/protocol_generated/CodeBlockMeta.kt | 8 + .../protocol_generated/CodyAgentClient.kt | 43 + .../protocol_generated/CodyAgentServer.kt | 123 + .../cody/protocol_generated/CodyError.kt | 9 + .../CodyLLMSiteConfiguration.kt | 13 + .../cody/protocol_generated/CodyTaskState.kt | 15 + .../Commands_CustomParams.kt | 7 + .../CompletionBookkeepingEvent.kt | 17 + .../protocol_generated/CompletionItemInfo.kt | 10 + .../CompletionItemParams.kt | 7 + .../protocol_generated/CompletionLogID.kt | 5 + .../ConfigFeaturesParams.kt | 8 + .../cody/protocol_generated/ConfigParams.kt | 14 + .../cody/protocol_generated/ContextFile.kt | 16 + .../protocol_generated/ContextFileSource.kt | 5 + .../protocol_generated/ContextFileType.kt | 5 + .../cody/protocol_generated/ContextGroup.kt | 9 + .../protocol_generated/ContextProvider.kt | 12 + .../protocol_generated/CreateFilesParams.kt | 7 + .../CurrentUserCodySubscription.kt | 11 + .../protocol_generated/CustomCommandResult.kt | 9 + .../cody/protocol_generated/Date.kt | 5 + .../cody/protocol_generated/DebugMessage.kt | 8 + .../protocol_generated/DeleteFilesParams.kt | 7 + .../protocol_generated/DeleteOptionsParams.kt | 8 + .../DisplayCodeLensParams.kt | 8 + .../cody/protocol_generated/EditTask.kt | 9 + .../cody/protocol_generated/EndParams.kt | 8 + .../EnhancedContextContextT.kt | 7 + .../cody/protocol_generated/Event.kt | 15 + .../protocol_generated/EventProperties.kt | 10 + .../ExecuteCommandParams.kt | 8 + .../ExtensionConfiguration.kt | 18 + .../protocol_generated/ExtensionMessage.kt | 32 + .../FeatureFlags_GetFeatureFlagParams.kt | 7 + .../cody/protocol_generated/FileIdentifier.kt | 7 + .../Git_CodebaseNameParams.kt | 7 + ...raphql_GetRepoIdIfEmbeddingExistsParams.kt | 7 + .../Graphql_GetRepoIdParams.kt | 7 + .../Graphql_GetRepoIdsParams.kt | 8 + .../Graphql_GetRepoIdsResult.kt | 7 + .../cody/protocol_generated/MessageOptions.kt | 8 + .../cody/protocol_generated/ModelProvider.kt | 12 + .../cody/protocol_generated/NetworkRequest.kt | 9 + .../cody/protocol_generated/NoticeParams.kt | 7 + .../cody/protocol_generated/Null.kt | 3 + .../cody/protocol_generated/OptionsParams.kt | 8 + .../cody/protocol_generated/Position.kt | 8 + .../cody/protocol_generated/PreciseContext.kt | 11 + .../protocol_generated/ProgressOptions.kt | 10 + .../ProgressReportParams.kt | 9 + .../protocol_generated/ProgressStartParams.kt | 8 + .../Progress_CancelParams.kt | 7 + .../protocol_generated/Progress_EndParams.kt | 7 + .../protocol_generated/ProtocolCodeLens.kt | 9 + .../protocol_generated/ProtocolCommand.kt | 10 + .../ProtocolTextDocument.kt | 10 + .../cody/protocol_generated/Range.kt | 8 + .../cody/protocol_generated/RangeParams.kt | 10 + .../cody/protocol_generated/RenameFile.kt | 8 + .../protocol_generated/RenameFilesParams.kt | 7 + .../cody/protocol_generated/Repo.kt | 8 + .../cody/protocol_generated/ReposParams.kt | 8 + .../protocol_generated/SearchPanelFile.kt | 8 + .../protocol_generated/SearchPanelSnippet.kt | 8 + .../SelectedCompletionInfo.kt | 8 + .../cody/protocol_generated/Selection.kt | 9 + .../cody/protocol_generated/ServerInfo.kt | 11 + .../ShowWindowMessageParams.kt | 10 + .../cody/protocol_generated/StartParams.kt | 8 + .../cody/protocol_generated/SymbolKind.kt | 5 + .../cody/protocol_generated/SymbolParams.kt | 7 + .../cody/protocol_generated/TelemetryEvent.kt | 8 + .../TelemetryEventProperties.kt | 7 + .../Testing_NetworkRequestsResult.kt | 7 + .../Testing_ProgressCancelationParams.kt | 7 + .../Testing_ProgressCancelationResult.kt | 7 + .../Testing_ProgressParams.kt | 7 + .../Testing_ProgressResult.kt | 7 + .../Testing_RequestErrorsResult.kt | 7 + .../TextDocumentEditParams.kt | 9 + .../TextDocumentShowOptions.kt | 10 + .../TextDocument_DidFocusParams.kt | 7 + .../TextDocument_DidSaveParams.kt | 7 + .../TextDocument_ShowParams.kt | 8 + .../cody/protocol_generated/TextEdit.kt | 11 + .../UntitledTextDocument.kt | 9 + .../cody/protocol_generated/Uri.kt | 12 + .../protocol_generated/UserLocalHistory.kt | 8 + .../cody/protocol_generated/View.kt | 5 + .../cody/protocol_generated/ViewColumn.kt | 17 + .../cody/protocol_generated/WebviewMessage.kt | 32 + .../WebviewPostMessageParams.kt | 8 + .../Webview_CreateParams.kt | 8 + .../Webview_DidDisposeParams.kt | 7 + .../Webview_ReceiveMessageParams.kt | 8 + .../WorkspaceEditEntryMetadata.kt | 10 + .../WorkspaceEditMetadata.kt | 7 + .../WorkspaceEditOperation.kt | 15 + .../protocol_generated/WorkspaceEditParams.kt | 8 + .../protocol_generated/WriteFileOptions.kt | 8 + .../test/kotlin/org/example/LibraryTest.kt | 15 + agent/bindings/kotlin/settings.gradle.kts | 14 + .../cody/protocol_generated/Null.kt | 3 + agent/package.json | 2 + agent/scripts/compile-bindings-if-diff.sh | 8 + agent/scripts/error-if-diff.sh | 18 + .../scripts/generate-agent-kotlin-bindings.sh | 17 + agent/src/agent.ts | 5 +- agent/src/cli/scip-codegen/CodePrinter.ts | 29 + agent/src/cli/scip-codegen/ConsoleReporter.ts | 111 + agent/src/cli/scip-codegen/Diagnostic.ts | 12 + agent/src/cli/scip-codegen/KotlinCodegen.ts | 636 ++ agent/src/cli/scip-codegen/KotlinFormatter.ts | 136 + agent/src/cli/scip-codegen/SymbolTable.ts | 74 + agent/src/cli/scip-codegen/command.ts | 52 + .../isNullOrUndefinedOrUnknownType.ts | 12 + agent/src/cli/scip-codegen/scip.ts | 6802 +++++++++++++++++ agent/src/cli/scip-codegen/utils.ts | 35 + agent/src/index.test.ts | 36 +- agent/tsconfig.json | 2 +- biome.json | 3 + lib/shared/src/index.ts | 1 + package.json | 1 + pnpm-lock.yaml | 14 + .../chat/chat-view/SidebarViewController.ts | 10 +- .../chat/chat-view/SimpleChatPanelProvider.ts | 12 +- vscode/src/chat/protocol.ts | 24 +- vscode/src/jsonrpc/agent-protocol.ts | 79 +- vscode/src/services/utils/workspace-action.ts | 8 +- vscode/src/testutils/AgentWorkspaceEdit.ts | 2 +- vscode/src/testutils/CodyPersister.ts | 1 + vscode/webviews/App.tsx | 16 +- vscode/webviews/OnboardingExperiment.tsx | 4 +- vscode/webviews/SymbolLink.tsx | 5 +- 173 files changed, 9951 insertions(+), 97 deletions(-) create mode 100644 .github/workflows/agent-bindings.yml create mode 100644 agent/bindings/kotlin/.gitattributes create mode 100644 agent/bindings/kotlin/.gitignore create mode 100644 agent/bindings/kotlin/build create mode 100644 agent/bindings/kotlin/gradle/libs.versions.toml create mode 100644 agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.jar create mode 100644 agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.properties create mode 100755 agent/bindings/kotlin/gradlew create mode 100644 agent/bindings/kotlin/gradlew.bat create mode 100644 agent/bindings/kotlin/lib/build.gradle.kts create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ActiveTextEditorSelectionRange.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AttributionParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthMethod.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthStatus.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteItem.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CancelParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatButton.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatError.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatEventSource.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatHistory.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatInputHistory.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMessage.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMetadata.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatSubmitType.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_EditMessageParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RestoreParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_SubmitMessageParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Check_IsCodyIgnoredFileParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientCapabilities.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientInfo.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodeBlockMeta.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentClient.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentServer.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyError.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyLLMSiteConfiguration.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyTaskState.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Commands_CustomParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionBookkeepingEvent.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemInfo.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionLogID.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigFeaturesParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFile.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileSource.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileType.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextGroup.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextProvider.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CreateFilesParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CurrentUserCodySubscription.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CustomCommandResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Date.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DebugMessage.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteFilesParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteOptionsParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DisplayCodeLensParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EditTask.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EndParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EnhancedContextContextT.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Event.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EventProperties.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExecuteCommandParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionConfiguration.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionMessage.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FeatureFlags_GetFeatureFlagParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FileIdentifier.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Git_CodebaseNameParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdIfEmbeddingExistsParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/MessageOptions.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ModelProvider.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NetworkRequest.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NoticeParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/OptionsParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Position.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/PreciseContext.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressOptions.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressReportParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressStartParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_CancelParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_EndParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCodeLens.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCommand.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolTextDocument.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Range.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RangeParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFile.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFilesParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Repo.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ReposParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelFile.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelSnippet.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SelectedCompletionInfo.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Selection.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ServerInfo.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ShowWindowMessageParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/StartParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolKind.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEvent.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEventProperties.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_NetworkRequestsResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_RequestErrorsResult.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentEditParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentShowOptions.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidFocusParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidSaveParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_ShowParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextEdit.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UntitledTextDocument.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Uri.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UserLocalHistory.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/View.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ViewColumn.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewMessage.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewPostMessageParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_CreateParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_DidDisposeParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_ReceiveMessageParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditEntryMetadata.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditMetadata.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditOperation.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditParams.kt create mode 100644 agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WriteFileOptions.kt create mode 100644 agent/bindings/kotlin/lib/src/test/kotlin/org/example/LibraryTest.kt create mode 100644 agent/bindings/kotlin/settings.gradle.kts create mode 100644 agent/bindings/kotlin/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt create mode 100755 agent/scripts/compile-bindings-if-diff.sh create mode 100755 agent/scripts/error-if-diff.sh create mode 100755 agent/scripts/generate-agent-kotlin-bindings.sh create mode 100644 agent/src/cli/scip-codegen/CodePrinter.ts create mode 100644 agent/src/cli/scip-codegen/ConsoleReporter.ts create mode 100644 agent/src/cli/scip-codegen/Diagnostic.ts create mode 100644 agent/src/cli/scip-codegen/KotlinCodegen.ts create mode 100644 agent/src/cli/scip-codegen/KotlinFormatter.ts create mode 100644 agent/src/cli/scip-codegen/SymbolTable.ts create mode 100644 agent/src/cli/scip-codegen/command.ts create mode 100644 agent/src/cli/scip-codegen/isNullOrUndefinedOrUnknownType.ts create mode 100644 agent/src/cli/scip-codegen/scip.ts create mode 100644 agent/src/cli/scip-codegen/utils.ts diff --git a/.github/workflows/agent-bindings.yml b/.github/workflows/agent-bindings.yml new file mode 100644 index 000000000000..836919f1e3de --- /dev/null +++ b/.github/workflows/agent-bindings.yml @@ -0,0 +1,40 @@ +name: agent-bindings +on: + pull_request: + paths: + - '**.ts' + - '**.tsx' + - '**.js' + push: + paths: + - '**.ts' + - '**.tsx' + - '**.js' + +jobs: + kotlin: + if: github.repository == 'sourcegraph/cody' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + - uses: pnpm/action-setup@v2 + id: pnpm-install + with: + version: 8.6.7 + run_install: false + - name: Get pnpm store directory + id: pnpm-cache + shell: bash + run: | + echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT + - uses: actions/cache@v3 + name: Setup pnpm cache + with: + path: ${{ steps.pnpm-cache.outputs.STORE_PATH }} + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + - run: pnpm install --frozen-lockfile + - run: ./agent/scripts/generate-agent-kotlin-bindings.sh + - run: ./agent/scripts/error-if-diff.sh + - run: ./agent/scripts/compile-bindings-if-diff.sh diff --git a/agent/bindings/kotlin/.gitattributes b/agent/bindings/kotlin/.gitattributes new file mode 100644 index 000000000000..097f9f98d9ee --- /dev/null +++ b/agent/bindings/kotlin/.gitattributes @@ -0,0 +1,9 @@ +# +# https://help.github.com/articles/dealing-with-line-endings/ +# +# Linux start script should use lf +/gradlew text eol=lf + +# These are Windows script files and should use crlf +*.bat text eol=crlf + diff --git a/agent/bindings/kotlin/.gitignore b/agent/bindings/kotlin/.gitignore new file mode 100644 index 000000000000..32f50b1ca7aa --- /dev/null +++ b/agent/bindings/kotlin/.gitignore @@ -0,0 +1,42 @@ +# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and Webstorm +# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839 + +*.jar +!gradle-wrapper.jar + +# User local IDEA configuration files +.idea/ +.run/ + +# IntelliJ project +*.iml + +# Build output & caches for IntelliJ plugin development +build/ +idea-sandbox/ +.gradle/ + +## File-based project format: +*.iws + +# IntelliJ +/out/ + +# mpeltonen/sbt-idea plugin +.idea_modules/ + +# JIRA plugin +atlassian-ide-plugin.xml + +# Crashlytics plugin (for Android Studio and IntelliJ) +com_crashlytics_export_strings.xml +crashlytics.properties +crashlytics-build.properties +fabric.properties + +# JavaScript resources +src/main/resources/dist/* + +# VSCode langserver artifacts +/bin/ +.DS_Store diff --git a/agent/bindings/kotlin/build b/agent/bindings/kotlin/build new file mode 100644 index 000000000000..dea30787a17b --- /dev/null +++ b/agent/bindings/kotlin/build @@ -0,0 +1,19 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This is a general purpose Gradle build. + * To learn more about Gradle by exploring our Samples at https://docs.gradle.org/8.6/samples + */ + +dependencies { + implementation("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:0.21.0") +} + +java { + toolchain { + // Always compile the codebase with Java 11 regardless of what Java + // version is installed on the computer. Gradle will download Java 11 + // even if you already have it installed on your computer. + languageVersion.set(JavaLanguageVersion.of("8")) + } +} diff --git a/agent/bindings/kotlin/gradle/libs.versions.toml b/agent/bindings/kotlin/gradle/libs.versions.toml new file mode 100644 index 000000000000..1747dab47771 --- /dev/null +++ b/agent/bindings/kotlin/gradle/libs.versions.toml @@ -0,0 +1,14 @@ +# This file was generated by the Gradle 'init' task. +# https://docs.gradle.org/current/userguide/platforms.html#sub::toml-dependencies-format + +[versions] +commons-math3 = "3.6.1" +guava = "32.1.3-jre" +junit-jupiter-engine = "5.10.0" + +[libraries] +guava = { module = "com.google.guava:guava", version.ref = "guava" } +junit-jupiter-engine = { module = "org.junit.jupiter:junit-jupiter-engine", version.ref = "junit-jupiter-engine" } + +[plugins] +jvm = { id = "org.jetbrains.kotlin.jvm", version = "1.9.20" } diff --git a/agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.jar b/agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.jar new file mode 100644 index 0000000000000000000000000000000000000000..d64cd4917707c1f8861d8cb53dd15194d4248596 GIT binary patch literal 43462 zcma&NWl&^owk(X(xVyW%ySuwf;qI=D6|RlDJ2cR^yEKh!@I- zp9QeisK*rlxC>+~7Dk4IxIRsKBHqdR9b3+fyL=ynHmIDe&|>O*VlvO+%z5;9Z$|DJ zb4dO}-R=MKr^6EKJiOrJdLnCJn>np?~vU-1sSFgPu;pthGwf}bG z(1db%xwr#x)r+`4AGu$j7~u2MpVs3VpLp|mx&;>`0p0vH6kF+D2CY0fVdQOZ@h;A` z{infNyvmFUiu*XG}RNMNwXrbec_*a3N=2zJ|Wh5z* z5rAX$JJR{#zP>KY**>xHTuw?|-Rg|o24V)74HcfVT;WtQHXlE+_4iPE8QE#DUm%x0 zEKr75ur~W%w#-My3Tj`hH6EuEW+8K-^5P62$7Sc5OK+22qj&Pd1;)1#4tKihi=~8C zHiQSst0cpri6%OeaR`PY>HH_;CPaRNty%WTm4{wDK8V6gCZlG@U3$~JQZ;HPvDJcT1V{ z?>H@13MJcCNe#5z+MecYNi@VT5|&UiN1D4ATT+%M+h4c$t;C#UAs3O_q=GxK0}8%8 z8J(_M9bayxN}69ex4dzM_P3oh@ZGREjVvn%%r7=xjkqxJP4kj}5tlf;QosR=%4L5y zWhgejO=vao5oX%mOHbhJ8V+SG&K5dABn6!WiKl{|oPkq(9z8l&Mm%(=qGcFzI=eLu zWc_oCLyf;hVlB@dnwY98?75B20=n$>u3b|NB28H0u-6Rpl((%KWEBOfElVWJx+5yg z#SGqwza7f}$z;n~g%4HDU{;V{gXIhft*q2=4zSezGK~nBgu9-Q*rZ#2f=Q}i2|qOp z!!y4p)4o=LVU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L6E(g+tN!6CA!CP* zCpWtCujIea)ENl0liwVfj)Nc<9mV%+e@=d`haoZ*`B7+PNjEbXBkv=B+Pi^~L#EO$D$ZqTiD8f<5$eyb54-(=3 zh)6i8i|jp(@OnRrY5B8t|LFXFQVQ895n*P16cEKTrT*~yLH6Z4e*bZ5otpRDri&+A zfNbK1D5@O=sm`fN=WzWyse!za5n%^+6dHPGX#8DyIK>?9qyX}2XvBWVqbP%%D)7$= z=#$WulZlZR<{m#gU7lwqK4WS1Ne$#_P{b17qe$~UOXCl>5b|6WVh;5vVnR<%d+Lnp z$uEmML38}U4vaW8>shm6CzB(Wei3s#NAWE3)a2)z@i{4jTn;;aQS)O@l{rUM`J@K& l00vQ5JBs~;vo!vr%%-k{2_Fq1Mn4QF81S)AQ99zk{{c4yR+0b! literal 0 HcmV?d00001 diff --git a/agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.properties b/agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.properties new file mode 100644 index 000000000000..a80b22ce5cff --- /dev/null +++ b/agent/bindings/kotlin/gradle/wrapper/gradle-wrapper.properties @@ -0,0 +1,7 @@ +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-bin.zip +networkTimeout=10000 +validateDistributionUrl=true +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/agent/bindings/kotlin/gradlew b/agent/bindings/kotlin/gradlew new file mode 100755 index 000000000000..1aa94a426907 --- /dev/null +++ b/agent/bindings/kotlin/gradlew @@ -0,0 +1,249 @@ +#!/bin/sh + +# +# Copyright © 2015-2021 the original authors. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# https://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +############################################################################## +# +# Gradle start up script for POSIX generated by Gradle. +# +# Important for running: +# +# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is +# noncompliant, but you have some other compliant shell such as ksh or +# bash, then to run this script, type that shell name before the whole +# command line, like: +# +# ksh Gradle +# +# Busybox and similar reduced shells will NOT work, because this script +# requires all of these POSIX shell features: +# * functions; +# * expansions «$var», «${var}», «${var:-default}», «${var+SET}», +# «${var#prefix}», «${var%suffix}», and «$( cmd )»; +# * compound commands having a testable exit status, especially «case»; +# * various built-in commands including «command», «set», and «ulimit». +# +# Important for patching: +# +# (2) This script targets any POSIX shell, so it avoids extensions provided +# by Bash, Ksh, etc; in particular arrays are avoided. +# +# The "traditional" practice of packing multiple parameters into a +# space-separated string is a well documented source of bugs and security +# problems, so this is (mostly) avoided, by progressively accumulating +# options in "$@", and eventually passing that to Java. +# +# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, +# and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; +# see the in-line comments for details. +# +# There are tweaks for specific operating systems such as AIX, CygWin, +# Darwin, MinGW, and NonStop. +# +# (3) This script is generated from the Groovy template +# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# within the Gradle project. +# +# You can find Gradle at https://github.com/gradle/gradle/. +# +############################################################################## + +# Attempt to set APP_HOME + +# Resolve links: $0 may be a link +app_path=$0 + +# Need this for daisy-chained symlinks. +while + APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path + [ -h "$app_path" ] +do + ls=$( ls -ld "$app_path" ) + link=${ls#*' -> '} + case $link in #( + /*) app_path=$link ;; #( + *) app_path=$APP_HOME$link ;; + esac +done + +# This is normally unused +# shellcheck disable=SC2034 +APP_BASE_NAME=${0##*/} +# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) +APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit + +# Use the maximum available, or set MAX_FD != -1 to use that value. +MAX_FD=maximum + +warn () { + echo "$*" +} >&2 + +die () { + echo + echo "$*" + echo + exit 1 +} >&2 + +# OS specific support (must be 'true' or 'false'). +cygwin=false +msys=false +darwin=false +nonstop=false +case "$( uname )" in #( + CYGWIN* ) cygwin=true ;; #( + Darwin* ) darwin=true ;; #( + MSYS* | MINGW* ) msys=true ;; #( + NONSTOP* ) nonstop=true ;; +esac + +CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar + + +# Determine the Java command to use to start the JVM. +if [ -n "$JAVA_HOME" ] ; then + if [ -x "$JAVA_HOME/jre/sh/java" ] ; then + # IBM's JDK on AIX uses strange locations for the executables + JAVACMD=$JAVA_HOME/jre/sh/java + else + JAVACMD=$JAVA_HOME/bin/java + fi + if [ ! -x "$JAVACMD" ] ; then + die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +else + JAVACMD=java + if ! command -v java >/dev/null 2>&1 + then + die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. + +Please set the JAVA_HOME variable in your environment to match the +location of your Java installation." + fi +fi + +# Increase the maximum file descriptors if we can. +if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then + case $MAX_FD in #( + max*) + # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + MAX_FD=$( ulimit -H -n ) || + warn "Could not query maximum file descriptor limit" + esac + case $MAX_FD in #( + '' | soft) :;; #( + *) + # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. + # shellcheck disable=SC2039,SC3045 + ulimit -n "$MAX_FD" || + warn "Could not set maximum file descriptor limit to $MAX_FD" + esac +fi + +# Collect all arguments for the java command, stacking in reverse order: +# * args from the command line +# * the main class name +# * -classpath +# * -D...appname settings +# * --module-path (only if needed) +# * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. + +# For Cygwin or MSYS, switch paths to Windows format before running java +if "$cygwin" || "$msys" ; then + APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) + CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) + + JAVACMD=$( cygpath --unix "$JAVACMD" ) + + # Now convert the arguments - kludge to limit ourselves to /bin/sh + for arg do + if + case $arg in #( + -*) false ;; # don't mess with options #( + /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath + [ -e "$t" ] ;; #( + *) false ;; + esac + then + arg=$( cygpath --path --ignore --mixed "$arg" ) + fi + # Roll the args list around exactly as many times as the number of + # args, so each arg winds up back in the position where it started, but + # possibly modified. + # + # NB: a `for` loop captures its iteration list before it begins, so + # changing the positional parameters here affects neither the number of + # iterations, nor the values presented in `arg`. + shift # remove old arg + set -- "$@" "$arg" # push replacement arg + done +fi + + +# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' + +# Collect all arguments for the java command: +# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, +# and any embedded shellness will be escaped. +# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be +# treated as '${Hostname}' itself on the command line. + +set -- \ + "-Dorg.gradle.appname=$APP_BASE_NAME" \ + -classpath "$CLASSPATH" \ + org.gradle.wrapper.GradleWrapperMain \ + "$@" + +# Stop when "xargs" is not available. +if ! command -v xargs >/dev/null 2>&1 +then + die "xargs is not available" +fi + +# Use "xargs" to parse quoted args. +# +# With -n1 it outputs one arg per line, with the quotes and backslashes removed. +# +# In Bash we could simply go: +# +# readarray ARGS < <( xargs -n1 <<<"$var" ) && +# set -- "${ARGS[@]}" "$@" +# +# but POSIX shell has neither arrays nor command substitution, so instead we +# post-process each arg (as a line of input to sed) to backslash-escape any +# character that might be a shell metacharacter, then use eval to reverse +# that process (while maintaining the separation between arguments), and wrap +# the whole thing up as a single "set" statement. +# +# This will of course break if any of these variables contains a newline or +# an unmatched quote. +# + +eval "set -- $( + printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | + xargs -n1 | + sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | + tr '\n' ' ' + )" '"$@"' + +exec "$JAVACMD" "$@" diff --git a/agent/bindings/kotlin/gradlew.bat b/agent/bindings/kotlin/gradlew.bat new file mode 100644 index 000000000000..25da30dbdeee --- /dev/null +++ b/agent/bindings/kotlin/gradlew.bat @@ -0,0 +1,92 @@ +@rem +@rem Copyright 2015 the original author or authors. +@rem +@rem Licensed under the Apache License, Version 2.0 (the "License"); +@rem you may not use this file except in compliance with the License. +@rem You may obtain a copy of the License at +@rem +@rem https://www.apache.org/licenses/LICENSE-2.0 +@rem +@rem Unless required by applicable law or agreed to in writing, software +@rem distributed under the License is distributed on an "AS IS" BASIS, +@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@rem See the License for the specific language governing permissions and +@rem limitations under the License. +@rem + +@if "%DEBUG%"=="" @echo off +@rem ########################################################################## +@rem +@rem Gradle startup script for Windows +@rem +@rem ########################################################################## + +@rem Set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" setlocal + +set DIRNAME=%~dp0 +if "%DIRNAME%"=="" set DIRNAME=. +@rem This is normally unused +set APP_BASE_NAME=%~n0 +set APP_HOME=%DIRNAME% + +@rem Resolve any "." and ".." in APP_HOME to make it shorter. +for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi + +@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. +set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" + +@rem Find java.exe +if defined JAVA_HOME goto findJavaFromJavaHome + +set JAVA_EXE=java.exe +%JAVA_EXE% -version >NUL 2>&1 +if %ERRORLEVEL% equ 0 goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:findJavaFromJavaHome +set JAVA_HOME=%JAVA_HOME:"=% +set JAVA_EXE=%JAVA_HOME%/bin/java.exe + +if exist "%JAVA_EXE%" goto execute + +echo. 1>&2 +echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 +echo. 1>&2 +echo Please set the JAVA_HOME variable in your environment to match the 1>&2 +echo location of your Java installation. 1>&2 + +goto fail + +:execute +@rem Setup the command line + +set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar + + +@rem Execute Gradle +"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* + +:end +@rem End local scope for the variables with windows NT shell +if %ERRORLEVEL% equ 0 goto mainEnd + +:fail +rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of +rem the _cmd.exe /c_ return code! +set EXIT_CODE=%ERRORLEVEL% +if %EXIT_CODE% equ 0 set EXIT_CODE=1 +if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% +exit /b %EXIT_CODE% + +:mainEnd +if "%OS%"=="Windows_NT" endlocal + +:omega diff --git a/agent/bindings/kotlin/lib/build.gradle.kts b/agent/bindings/kotlin/lib/build.gradle.kts new file mode 100644 index 000000000000..337122f855f6 --- /dev/null +++ b/agent/bindings/kotlin/lib/build.gradle.kts @@ -0,0 +1,44 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * This generated file contains a sample Kotlin library project to get you started. + * For more details on building Java & JVM projects, please refer to https://docs.gradle.org/8.6/userguide/building_java_projects.html in the Gradle documentation. + */ + +plugins { + // Apply the org.jetbrains.kotlin.jvm Plugin to add support for Kotlin. + alias(libs.plugins.jvm) + + // Apply the java-library plugin for API and implementation separation. + `java-library` +} + +repositories { + // Use Maven Central for resolving dependencies. + mavenCentral() +} + +dependencies { + api("org.eclipse.lsp4j:org.eclipse.lsp4j.jsonrpc:0.21.0") + + // Use the Kotlin JUnit 5 integration. + testImplementation("org.jetbrains.kotlin:kotlin-test-junit5") + + // Use the JUnit 5 integration. + testImplementation(libs.junit.jupiter.engine) + + testRuntimeOnly("org.junit.platform:junit-platform-launcher") + +} + +// Apply a specific Java toolchain to ease working on different environments. +java { + toolchain { + languageVersion = JavaLanguageVersion.of(11) + } +} + +tasks.named("test") { + // Use JUnit Platform for unit tests. + useJUnitPlatform() +} diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ActiveTextEditorSelectionRange.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ActiveTextEditorSelectionRange.kt new file mode 100644 index 000000000000..15d969d8d453 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ActiveTextEditorSelectionRange.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ActiveTextEditorSelectionRange( + var start: StartParams? = null, + var end: EndParams? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AttributionParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AttributionParams.kt new file mode 100644 index 000000000000..45230be92253 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AttributionParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class AttributionParams( + var repositoryNames: List? = null, + var limitHit: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchParams.kt new file mode 100644 index 000000000000..9eda08dfcf2e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Attribution_SearchParams( + var id: String? = null, + var snippet: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchResult.kt new file mode 100644 index 000000000000..d9eef272f0f5 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Attribution_SearchResult.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Attribution_SearchResult( + var error: String? = null, + var repoNames: List? = null, + var limitHit: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthMethod.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthMethod.kt new file mode 100644 index 000000000000..624be7e4d82a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthMethod.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias AuthMethod = String // One of: dotcom, github, gitlab, google + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthStatus.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthStatus.kt new file mode 100644 index 000000000000..274043323e81 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AuthStatus.kt @@ -0,0 +1,22 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class AuthStatus( + var username: String? = null, + var endpoint: String? = null, + var isDotCom: Boolean? = null, + var isLoggedIn: Boolean? = null, + var showInvalidAccessTokenError: Boolean? = null, + var authenticated: Boolean? = null, + var hasVerifiedEmail: Boolean? = null, + var requiresVerifiedEmail: Boolean? = null, + var siteHasCodyEnabled: Boolean? = null, + var siteVersion: String? = null, + var configOverwrites: CodyLLMSiteConfiguration? = null, + var showNetworkError: Boolean? = null, + var primaryEmail: String? = null, + var displayName: String? = null, + var avatarURL: String? = null, + var userCanUpgrade: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteItem.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteItem.kt new file mode 100644 index 000000000000..39fb03ddcaf5 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteItem.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class AutocompleteItem( + var id: String? = null, + var insertText: String? = null, + var range: Range? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteParams.kt new file mode 100644 index 000000000000..74c0fdd7a4be --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteParams.kt @@ -0,0 +1,11 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class AutocompleteParams( + var uri: String? = null, + var filePath: String? = null, + var position: Position? = null, + var triggerKind: String? = null, // Oneof: Automatic, Invoke + var selectedCompletionInfo: SelectedCompletionInfo? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteResult.kt new file mode 100644 index 000000000000..33ab6c4139aa --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/AutocompleteResult.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class AutocompleteResult( + var items: List? = null, + var completionEvent: CompletionBookkeepingEvent? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CancelParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CancelParams.kt new file mode 100644 index 000000000000..fc4d6e3ed2ea --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CancelParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CancelParams( + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatButton.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatButton.kt new file mode 100644 index 000000000000..c66c1e8d5a9b --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatButton.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ChatButton( + var label: String? = null, + var action: String? = null, + var appearance: String? = null, // Oneof: primary, secondary, icon +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatError.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatError.kt new file mode 100644 index 000000000000..91fe2319face --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatError.kt @@ -0,0 +1,18 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ChatError( + var kind: String? = null, + var name: String? = null, + var message: String? = null, + var retryAfter: String? = null, + var limit: Int? = null, + var userMessage: String? = null, + var retryAfterDate: Date? = null, + var retryAfterDateString: String? = null, + var retryMessage: String? = null, + var feature: String? = null, + var upgradeIsAvailable: Boolean? = null, + var isChatErrorGuard: String? = null, // Oneof: isChatErrorGuard +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatEventSource.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatEventSource.kt new file mode 100644 index 000000000000..176e12f95430 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatEventSource.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias ChatEventSource = String // One of: chat, editor, menu, sidebar, code-action:explain, code-action:document, code-action:edit, code-action:fix, code-action:generate, custom-commands, test, code-lens, explain, unit, smell, terminal, test, doc + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatHistory.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatHistory.kt new file mode 100644 index 000000000000..2927bd0f00f2 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatHistory.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ChatHistory( + var chatID: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatInputHistory.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatInputHistory.kt new file mode 100644 index 000000000000..5ef4457b50c7 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatInputHistory.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ChatInputHistory( + var inputText: String? = null, + var inputContextFiles: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMessage.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMessage.kt new file mode 100644 index 000000000000..308271c75f59 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMessage.kt @@ -0,0 +1,13 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ChatMessage( + var displayText: String? = null, + var contextFiles: List? = null, + var preciseContext: List? = null, + var buttons: List? = null, + var data: Any? = null, + var metadata: ChatMetadata? = null, + var error: ChatError? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMetadata.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMetadata.kt new file mode 100644 index 000000000000..1987bb54d5b2 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatMetadata.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ChatMetadata( + var source: ChatEventSource? = null, // Oneof: chat, editor, menu, sidebar, code-action:explain, code-action:document, code-action:edit, code-action:fix, code-action:generate, custom-commands, test, code-lens, explain, unit, smell, terminal, test, doc + var requestID: String? = null, + var chatModel: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatSubmitType.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatSubmitType.kt new file mode 100644 index 000000000000..6b82f851c90a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ChatSubmitType.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias ChatSubmitType = String // One of: user, user-newchat + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_EditMessageParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_EditMessageParams.kt new file mode 100644 index 000000000000..34435ce235f9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_EditMessageParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_EditMessageParams( + var id: String? = null, + var message: WebviewMessage? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsParams.kt new file mode 100644 index 000000000000..d0cc4b6194da --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_ModelsParams( + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsResult.kt new file mode 100644 index 000000000000..22f797d0582c --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_ModelsResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_ModelsResult( + var models: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposParams.kt new file mode 100644 index 000000000000..859be8d9ef21 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_RemoteReposParams( + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposResult.kt new file mode 100644 index 000000000000..625200580778 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RemoteReposResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_RemoteReposResult( + var remoteRepos: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RestoreParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RestoreParams.kt new file mode 100644 index 000000000000..6a29d6d8716e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_RestoreParams.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_RestoreParams( + var modelID: String? = null, + var messages: List? = null, + var chatID: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_SubmitMessageParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_SubmitMessageParams.kt new file mode 100644 index 000000000000..bc7150977811 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Chat_SubmitMessageParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Chat_SubmitMessageParams( + var id: String? = null, + var message: WebviewMessage? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Check_IsCodyIgnoredFileParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Check_IsCodyIgnoredFileParams.kt new file mode 100644 index 000000000000..3f119e9797ab --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Check_IsCodyIgnoredFileParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Check_IsCodyIgnoredFileParams( + var urls: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientCapabilities.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientCapabilities.kt new file mode 100644 index 000000000000..00f23d00cbe0 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientCapabilities.kt @@ -0,0 +1,16 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ClientCapabilities( + var completions: String? = null, // Oneof: none + var chat: String? = null, // Oneof: none, streaming + var git: String? = null, // Oneof: none, disabled + var progressBars: String? = null, // Oneof: none, enabled + var edit: String? = null, // Oneof: none, enabled + var editWorkspace: String? = null, // Oneof: none, enabled + var untitledDocuments: String? = null, // Oneof: none, enabled + var showDocument: String? = null, // Oneof: none, enabled + var codeLenses: String? = null, // Oneof: none, enabled + var showWindowMessage: String? = null, // Oneof: notification, request +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientInfo.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientInfo.kt new file mode 100644 index 000000000000..82fb1bd7b0dc --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ClientInfo.kt @@ -0,0 +1,12 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ClientInfo( + var name: String? = null, + var version: String? = null, + var workspaceRootUri: String? = null, + var workspaceRootPath: String? = null, + var extensionConfiguration: ExtensionConfiguration? = null, + var capabilities: ClientCapabilities? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodeBlockMeta.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodeBlockMeta.kt new file mode 100644 index 000000000000..25bca86f66fb --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodeBlockMeta.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CodeBlockMeta( + var source: String? = null, + var requestID: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentClient.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentClient.kt new file mode 100644 index 000000000000..73c487953f8d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentClient.kt @@ -0,0 +1,43 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +import org.eclipse.lsp4j.jsonrpc.services.JsonNotification +import org.eclipse.lsp4j.jsonrpc.services.JsonRequest +import java.util.concurrent.CompletableFuture + +@Suppress("unused") +interface CodyAgentClient { + // ======== + // Requests + // ======== + @JsonRequest("window/showMessage") + fun window_showMessage(params: ShowWindowMessageParams): CompletableFuture + @JsonRequest("textDocument/edit") + fun textDocument_edit(params: TextDocumentEditParams): CompletableFuture + @JsonRequest("textDocument/openUntitledDocument") + fun textDocument_openUntitledDocument(params: UntitledTextDocument): CompletableFuture + @JsonRequest("textDocument/show") + fun textDocument_show(params: TextDocument_ShowParams): CompletableFuture + @JsonRequest("workspace/edit") + fun workspace_edit(params: WorkspaceEditParams): CompletableFuture + @JsonRequest("webview/create") + fun webview_create(params: Webview_CreateParams): CompletableFuture + + // ============= + // Notifications + // ============= + @JsonNotification("debug/message") + fun debug_message(params: DebugMessage) + @JsonNotification("editTaskState/didChange") + fun editTaskState_didChange(params: EditTask) + @JsonNotification("codeLenses/display") + fun codeLenses_display(params: DisplayCodeLensParams) + @JsonNotification("webview/postMessage") + fun webview_postMessage(params: WebviewPostMessageParams) + @JsonNotification("progress/start") + fun progress_start(params: ProgressStartParams) + @JsonNotification("progress/report") + fun progress_report(params: ProgressReportParams) + @JsonNotification("progress/end") + fun progress_end(params: Progress_EndParams) +} diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentServer.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentServer.kt new file mode 100644 index 000000000000..f68bb8e994e5 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyAgentServer.kt @@ -0,0 +1,123 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +import org.eclipse.lsp4j.jsonrpc.services.JsonNotification +import org.eclipse.lsp4j.jsonrpc.services.JsonRequest +import java.util.concurrent.CompletableFuture + +@Suppress("unused") +interface CodyAgentServer { + // ======== + // Requests + // ======== + @JsonRequest("initialize") + fun initialize(params: ClientInfo): CompletableFuture + @JsonRequest("shutdown") + fun shutdown(params: Null): CompletableFuture + @JsonRequest("chat/new") + fun chat_new(params: Null): CompletableFuture + @JsonRequest("chat/restore") + fun chat_restore(params: Chat_RestoreParams): CompletableFuture + @JsonRequest("chat/models") + fun chat_models(params: Chat_ModelsParams): CompletableFuture + @JsonRequest("chat/remoteRepos") + fun chat_remoteRepos(params: Chat_RemoteReposParams): CompletableFuture + @JsonRequest("chat/submitMessage") + fun chat_submitMessage(params: Chat_SubmitMessageParams): CompletableFuture + @JsonRequest("chat/editMessage") + fun chat_editMessage(params: Chat_EditMessageParams): CompletableFuture + @JsonRequest("commands/explain") + fun commands_explain(params: Null): CompletableFuture + @JsonRequest("commands/test") + fun commands_test(params: Null): CompletableFuture + @JsonRequest("commands/smell") + fun commands_smell(params: Null): CompletableFuture + @JsonRequest("commands/custom") + fun commands_custom(params: Commands_CustomParams): CompletableFuture + @JsonRequest("editCommands/test") + fun editCommands_test(params: Null): CompletableFuture + @JsonRequest("commands/document") + fun commands_document(params: Null): CompletableFuture + @JsonRequest("command/execute") + fun command_execute(params: ExecuteCommandParams): CompletableFuture + @JsonRequest("autocomplete/execute") + fun autocomplete_execute(params: AutocompleteParams): CompletableFuture + @JsonRequest("graphql/getRepoIds") + fun graphql_getRepoIds(params: Graphql_GetRepoIdsParams): CompletableFuture + @JsonRequest("graphql/currentUserId") + fun graphql_currentUserId(params: Null): CompletableFuture + @JsonRequest("graphql/currentUserIsPro") + fun graphql_currentUserIsPro(params: Null): CompletableFuture + @JsonRequest("featureFlags/getFeatureFlag") + fun featureFlags_getFeatureFlag(params: FeatureFlags_GetFeatureFlagParams): CompletableFuture + @JsonRequest("graphql/getCurrentUserCodySubscription") + fun graphql_getCurrentUserCodySubscription(params: Null): CompletableFuture + @JsonRequest("graphql/logEvent") + fun graphql_logEvent(params: Event): CompletableFuture + @JsonRequest("telemetry/recordEvent") + fun telemetry_recordEvent(params: TelemetryEvent): CompletableFuture + @JsonRequest("graphql/getRepoIdIfEmbeddingExists") + fun graphql_getRepoIdIfEmbeddingExists(params: Graphql_GetRepoIdIfEmbeddingExistsParams): CompletableFuture + @JsonRequest("graphql/getRepoId") + fun graphql_getRepoId(params: Graphql_GetRepoIdParams): CompletableFuture + @JsonRequest("check/isCodyIgnoredFile") + fun check_isCodyIgnoredFile(params: Check_IsCodyIgnoredFileParams): CompletableFuture + @JsonRequest("git/codebaseName") + fun git_codebaseName(params: Git_CodebaseNameParams): CompletableFuture + @JsonRequest("webview/didDispose") + fun webview_didDispose(params: Webview_DidDisposeParams): CompletableFuture + @JsonRequest("webview/receiveMessage") + fun webview_receiveMessage(params: Webview_ReceiveMessageParams): CompletableFuture + @JsonRequest("testing/progress") + fun testing_progress(params: Testing_ProgressParams): CompletableFuture + @JsonRequest("testing/networkRequests") + fun testing_networkRequests(params: Null): CompletableFuture + @JsonRequest("testing/requestErrors") + fun testing_requestErrors(params: Null): CompletableFuture + @JsonRequest("testing/progressCancelation") + fun testing_progressCancelation(params: Testing_ProgressCancelationParams): CompletableFuture + @JsonRequest("testing/reset") + fun testing_reset(params: Null): CompletableFuture + @JsonRequest("extensionConfiguration/change") + fun extensionConfiguration_change(params: ExtensionConfiguration): CompletableFuture + @JsonRequest("extensionConfiguration/status") + fun extensionConfiguration_status(params: Null): CompletableFuture + @JsonRequest("attribution/search") + fun attribution_search(params: Attribution_SearchParams): CompletableFuture + + // ============= + // Notifications + // ============= + @JsonNotification("initialized") + fun initialized(params: Null) + @JsonNotification("exit") + fun exit(params: Null) + @JsonNotification("extensionConfiguration/didChange") + fun extensionConfiguration_didChange(params: ExtensionConfiguration) + @JsonNotification("textDocument/didOpen") + fun textDocument_didOpen(params: ProtocolTextDocument) + @JsonNotification("textDocument/didChange") + fun textDocument_didChange(params: ProtocolTextDocument) + @JsonNotification("textDocument/didFocus") + fun textDocument_didFocus(params: TextDocument_DidFocusParams) + @JsonNotification("textDocument/didSave") + fun textDocument_didSave(params: TextDocument_DidSaveParams) + @JsonNotification("textDocument/didClose") + fun textDocument_didClose(params: ProtocolTextDocument) + @JsonNotification("workspace/didDeleteFiles") + fun workspace_didDeleteFiles(params: DeleteFilesParams) + @JsonNotification("workspace/didCreateFiles") + fun workspace_didCreateFiles(params: CreateFilesParams) + @JsonNotification("workspace/didRenameFiles") + fun workspace_didRenameFiles(params: RenameFilesParams) + @JsonNotification("$/cancelRequest") + fun cancelRequest(params: CancelParams) + @JsonNotification("autocomplete/clearLastCandidate") + fun autocomplete_clearLastCandidate(params: Null) + @JsonNotification("autocomplete/completionSuggested") + fun autocomplete_completionSuggested(params: CompletionItemParams) + @JsonNotification("autocomplete/completionAccepted") + fun autocomplete_completionAccepted(params: CompletionItemParams) + @JsonNotification("progress/cancel") + fun progress_cancel(params: Progress_CancelParams) +} diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyError.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyError.kt new file mode 100644 index 000000000000..d4b0a532d69d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyError.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CodyError( + var message: String? = null, + var cause: CodyError? = null, + var stack: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyLLMSiteConfiguration.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyLLMSiteConfiguration.kt new file mode 100644 index 000000000000..912534f66073 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyLLMSiteConfiguration.kt @@ -0,0 +1,13 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CodyLLMSiteConfiguration( + var chatModel: String? = null, + var chatModelMaxTokens: Int? = null, + var fastChatModel: String? = null, + var fastChatModelMaxTokens: Int? = null, + var completionModel: String? = null, + var completionModelMaxTokens: Int? = null, + var provider: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyTaskState.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyTaskState.kt new file mode 100644 index 000000000000..91e732df52e8 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CodyTaskState.kt @@ -0,0 +1,15 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CodyTaskState( + var idle: Int? = null, + var working: Int? = null, + var inserting: Int? = null, + var applying: Int? = null, + var formatting: Int? = null, + var applied: Int? = null, + var finished: Int? = null, + var error: Int? = null, + var pending: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Commands_CustomParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Commands_CustomParams.kt new file mode 100644 index 000000000000..8df71ffb1524 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Commands_CustomParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Commands_CustomParams( + var key: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionBookkeepingEvent.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionBookkeepingEvent.kt new file mode 100644 index 000000000000..b7909193151c --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionBookkeepingEvent.kt @@ -0,0 +1,17 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CompletionBookkeepingEvent( + var id: CompletionLogID? = null, + var startedAt: Int? = null, + var networkRequestStartedAt: Int? = null, + var startLoggedAt: Int? = null, + var loadedAt: Int? = null, + var suggestedAt: Int? = null, + var suggestionLoggedAt: Int? = null, + var suggestionAnalyticsLoggedAt: Int? = null, + var acceptedAt: Int? = null, + var items: List? = null, + var loggedPartialAcceptedLength: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemInfo.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemInfo.kt new file mode 100644 index 000000000000..c7f257191399 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemInfo.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CompletionItemInfo( + var lineCount: Int? = null, + var charCount: Int? = null, + var insertText: String? = null, + var stopReason: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemParams.kt new file mode 100644 index 000000000000..7f4787eafa1e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionItemParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CompletionItemParams( + var completionID: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionLogID.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionLogID.kt new file mode 100644 index 000000000000..0b1ff928a8d1 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CompletionLogID.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias CompletionLogID = String // One of: + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigFeaturesParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigFeaturesParams.kt new file mode 100644 index 000000000000..28dee577f53a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigFeaturesParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ConfigFeaturesParams( + var chat: Boolean? = null, + var attribution: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigParams.kt new file mode 100644 index 000000000000..3ce73e0f6c7e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ConfigParams.kt @@ -0,0 +1,14 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ConfigParams( + var serverEndpoint: String? = null, + var debugEnable: Boolean? = null, + var experimentalGuardrails: Boolean? = null, + var os: String? = null, + var arch: String? = null, + var homeDir: String? = null, + var extensionVersion: String? = null, + var uiKindIsWeb: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFile.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFile.kt new file mode 100644 index 000000000000..249d8913e14a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFile.kt @@ -0,0 +1,16 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ContextFile( + var uri: Uri? = null, + var range: ActiveTextEditorSelectionRange? = null, + var repoName: String? = null, + var revision: String? = null, + var title: String? = null, + var source: ContextFileSource? = null, // Oneof: embeddings, user, keyword, editor, filename, search, unified, selection, terminal + var content: String? = null, + var type: String? = null, // Oneof: symbol, file + var symbolName: String? = null, + var kind: SymbolKind? = null, // Oneof: class, function, method +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileSource.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileSource.kt new file mode 100644 index 000000000000..e1dddf8066a9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileSource.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias ContextFileSource = String // One of: embeddings, user, keyword, editor, filename, search, unified, selection, terminal + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileType.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileType.kt new file mode 100644 index 000000000000..14680e853f1e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextFileType.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias ContextFileType = String // One of: file, symbol + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextGroup.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextGroup.kt new file mode 100644 index 000000000000..0a6bb70e7dc6 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextGroup.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ContextGroup( + var dir: Uri? = null, + var displayName: String? = null, + var providers: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextProvider.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextProvider.kt new file mode 100644 index 000000000000..5dfc523961ad --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ContextProvider.kt @@ -0,0 +1,12 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ContextProvider( + var kind: String? = null, // Oneof: search, search, embeddings + var state: String? = null, // Oneof: unindexed, indexing, ready, failed, ready, no-match, indeterminate, no-match, unconsented, indexing, ready + var errorReason: String? = null, // Oneof: not-a-git-repo, git-repo-has-no-remote + var type: String? = null, // Oneof: remote, local + var id: String? = null, + var inclusion: String? = null, // Oneof: auto, manual +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CreateFilesParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CreateFilesParams.kt new file mode 100644 index 000000000000..0fea09b4c435 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CreateFilesParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CreateFilesParams( + var files: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CurrentUserCodySubscription.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CurrentUserCodySubscription.kt new file mode 100644 index 000000000000..4daba3a89e74 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CurrentUserCodySubscription.kt @@ -0,0 +1,11 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CurrentUserCodySubscription( + var status: String? = null, + var plan: String? = null, + var applyProRateLimits: Boolean? = null, + var currentPeriodStartAt: Date? = null, + var currentPeriodEndAt: Date? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CustomCommandResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CustomCommandResult.kt new file mode 100644 index 000000000000..4930190a7ad7 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/CustomCommandResult.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class CustomCommandResult( + var type: String? = null, // Oneof: edit, chat + var chatResult: String? = null, + var editResult: EditTask? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Date.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Date.kt new file mode 100644 index 000000000000..b60cf3af3673 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Date.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias Date = Double + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DebugMessage.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DebugMessage.kt new file mode 100644 index 000000000000..87c75711a3f9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DebugMessage.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class DebugMessage( + var channel: String? = null, + var message: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteFilesParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteFilesParams.kt new file mode 100644 index 000000000000..7d9b508b9a53 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteFilesParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class DeleteFilesParams( + var files: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteOptionsParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteOptionsParams.kt new file mode 100644 index 000000000000..e7c76f80fd6a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DeleteOptionsParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class DeleteOptionsParams( + var recursive: Boolean? = null, + var ignoreIfNotExists: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DisplayCodeLensParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DisplayCodeLensParams.kt new file mode 100644 index 000000000000..d63128739ee1 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/DisplayCodeLensParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class DisplayCodeLensParams( + var uri: String? = null, + var codeLenses: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EditTask.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EditTask.kt new file mode 100644 index 000000000000..a7a198a22e14 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EditTask.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class EditTask( + var id: String? = null, + var state: CodyTaskState? = null, + var error: CodyError? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EndParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EndParams.kt new file mode 100644 index 000000000000..9f627eed49a6 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EndParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class EndParams( + var line: Int? = null, + var character: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EnhancedContextContextT.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EnhancedContextContextT.kt new file mode 100644 index 000000000000..57db9e36e380 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EnhancedContextContextT.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class EnhancedContextContextT( + var groups: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Event.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Event.kt new file mode 100644 index 000000000000..d5cb196d5bd4 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Event.kt @@ -0,0 +1,15 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Event( + var event: String? = null, + var userCookieID: String? = null, + var url: String? = null, + var source: String? = null, + var argument: String? = null, + var publicArgument: String? = null, + var client: String? = null, + var connectedSiteID: String? = null, + var hashedLicenseKey: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EventProperties.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EventProperties.kt new file mode 100644 index 000000000000..a0db7f2e4675 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/EventProperties.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class EventProperties( + var anonymousUserID: String? = null, + var prefix: String? = null, + var client: String? = null, + var source: String? = null, // Oneof: IDEEXTENSION +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExecuteCommandParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExecuteCommandParams.kt new file mode 100644 index 000000000000..8b0966140b43 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExecuteCommandParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ExecuteCommandParams( + var command: String? = null, + var arguments: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionConfiguration.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionConfiguration.kt new file mode 100644 index 000000000000..f141baeaf5d3 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionConfiguration.kt @@ -0,0 +1,18 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ExtensionConfiguration( + var serverEndpoint: String? = null, + var proxy: String? = null, + var accessToken: String? = null, + var customHeaders: Map? = null, + var anonymousUserID: String? = null, + var autocompleteAdvancedProvider: String? = null, + var autocompleteAdvancedModel: String? = null, + var debug: Boolean? = null, + var verboseDebug: Boolean? = null, + var codebase: String? = null, + var eventProperties: EventProperties? = null, + var customConfiguration: Map? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionMessage.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionMessage.kt new file mode 100644 index 000000000000..50ed4ab919bd --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ExtensionMessage.kt @@ -0,0 +1,32 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ExtensionMessage( + var type: String? = null, // Oneof: search:config, history, transcript, view, errors, notice, transcript-errors, userContextFiles, chatModels, update-search-results, index-updated, enhanced-context, attribution, setChatEnabledConfigFeature, webview-state, context/remote-repos, setConfigFeatures, config + var config: ConfigParams? = null, + var authStatus: AuthStatus? = null, + var workspaceFolderUris: List? = null, + var localHistory: UserLocalHistory? = null, + var messages: List? = null, + var isMessageInProgress: Boolean? = null, + var chatID: String? = null, + var view: View? = null, // Oneof: chat, login + var errors: String? = null, + var notice: NoticeParams? = null, + var isTranscriptError: Boolean? = null, + var userContextFiles: List? = null, + var kind: ContextFileType? = null, // Oneof: file, symbol + var models: List? = null, + var results: List? = null, + var query: String? = null, + var scopeDir: String? = null, + var enhancedContextStatus: EnhancedContextContextT? = null, + var snippet: String? = null, + var attribution: AttributionParams? = null, + var error: String? = null, + var data: Boolean? = null, + var isActive: Boolean? = null, + var repos: List? = null, + var configFeatures: ConfigFeaturesParams? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FeatureFlags_GetFeatureFlagParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FeatureFlags_GetFeatureFlagParams.kt new file mode 100644 index 000000000000..25b8715f33c5 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FeatureFlags_GetFeatureFlagParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class FeatureFlags_GetFeatureFlagParams( + var flagName: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FileIdentifier.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FileIdentifier.kt new file mode 100644 index 000000000000..3dbe38072703 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/FileIdentifier.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class FileIdentifier( + var uri: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Git_CodebaseNameParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Git_CodebaseNameParams.kt new file mode 100644 index 000000000000..6b456fe4a780 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Git_CodebaseNameParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Git_CodebaseNameParams( + var url: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdIfEmbeddingExistsParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdIfEmbeddingExistsParams.kt new file mode 100644 index 000000000000..5dcdbe12e23c --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdIfEmbeddingExistsParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Graphql_GetRepoIdIfEmbeddingExistsParams( + var repoName: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdParams.kt new file mode 100644 index 000000000000..e75a178789be --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Graphql_GetRepoIdParams( + var repoName: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsParams.kt new file mode 100644 index 000000000000..452d806f688f --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Graphql_GetRepoIdsParams( + var names: List? = null, + var first: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsResult.kt new file mode 100644 index 000000000000..030104009901 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Graphql_GetRepoIdsResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Graphql_GetRepoIdsResult( + var repos: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/MessageOptions.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/MessageOptions.kt new file mode 100644 index 000000000000..2acb6b673eb5 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/MessageOptions.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class MessageOptions( + var modal: Boolean? = null, + var detail: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ModelProvider.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ModelProvider.kt new file mode 100644 index 000000000000..3d61936e4203 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ModelProvider.kt @@ -0,0 +1,12 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ModelProvider( + var default: Boolean? = null, + var codyProOnly: Boolean? = null, + var provider: String? = null, + var title: String? = null, + var privateProviders: Map? = null, + var dotComProviders: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NetworkRequest.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NetworkRequest.kt new file mode 100644 index 000000000000..63f796bba886 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NetworkRequest.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class NetworkRequest( + var url: String? = null, + var body: String? = null, + var error: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NoticeParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NoticeParams.kt new file mode 100644 index 000000000000..b9a942c50860 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/NoticeParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class NoticeParams( + var key: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt new file mode 100644 index 000000000000..aaee46079a2f --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt @@ -0,0 +1,3 @@ +package com.sourcegraph.cody.protocol_generated + +typealias Null = Void? diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/OptionsParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/OptionsParams.kt new file mode 100644 index 000000000000..582282c92ac9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/OptionsParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class OptionsParams( + var undoStopBefore: Boolean? = null, + var undoStopAfter: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Position.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Position.kt new file mode 100644 index 000000000000..359665970ef9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Position.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Position( + var line: Int? = null, + var character: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/PreciseContext.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/PreciseContext.kt new file mode 100644 index 000000000000..6ad2b405f7c2 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/PreciseContext.kt @@ -0,0 +1,11 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class PreciseContext( + var symbol: SymbolParams? = null, + var hoverText: List? = null, + var definitionSnippet: String? = null, + var filePath: String? = null, + var range: RangeParams? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressOptions.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressOptions.kt new file mode 100644 index 000000000000..f095817a223d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressOptions.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ProgressOptions( + var title: String? = null, + var location: String? = null, + var locationViewId: String? = null, + var cancellable: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressReportParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressReportParams.kt new file mode 100644 index 000000000000..fa00bf56a919 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressReportParams.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ProgressReportParams( + var id: String? = null, + var message: String? = null, + var increment: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressStartParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressStartParams.kt new file mode 100644 index 000000000000..2859efeb789e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProgressStartParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ProgressStartParams( + var id: String? = null, + var options: ProgressOptions? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_CancelParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_CancelParams.kt new file mode 100644 index 000000000000..8822de516213 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_CancelParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Progress_CancelParams( + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_EndParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_EndParams.kt new file mode 100644 index 000000000000..9f22ecc23bee --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Progress_EndParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Progress_EndParams( + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCodeLens.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCodeLens.kt new file mode 100644 index 000000000000..d0e7c000f24d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCodeLens.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ProtocolCodeLens( + var range: Range? = null, + var command: ProtocolCommand? = null, + var isResolved: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCommand.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCommand.kt new file mode 100644 index 000000000000..5b1df9d39805 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolCommand.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ProtocolCommand( + var title: String? = null, + var command: String? = null, + var tooltip: String? = null, + var arguments: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolTextDocument.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolTextDocument.kt new file mode 100644 index 000000000000..f3682ec6204c --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ProtocolTextDocument.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ProtocolTextDocument( + var uri: String? = null, + var filePath: String? = null, + var content: String? = null, + var selection: Range? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Range.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Range.kt new file mode 100644 index 000000000000..75e345e8a5ac --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Range.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Range( + var start: Position? = null, + var end: Position? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RangeParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RangeParams.kt new file mode 100644 index 000000000000..ed3261db737c --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RangeParams.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class RangeParams( + var startLine: Int? = null, + var startCharacter: Int? = null, + var endLine: Int? = null, + var endCharacter: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFile.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFile.kt new file mode 100644 index 000000000000..df51cf29fb03 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFile.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class RenameFile( + var oldUri: String? = null, + var newUri: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFilesParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFilesParams.kt new file mode 100644 index 000000000000..5b0496b5532e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/RenameFilesParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class RenameFilesParams( + var files: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Repo.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Repo.kt new file mode 100644 index 000000000000..b7979289c668 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Repo.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Repo( + var name: String? = null, + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ReposParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ReposParams.kt new file mode 100644 index 000000000000..e791bbb2c7f1 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ReposParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ReposParams( + var name: String? = null, + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelFile.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelFile.kt new file mode 100644 index 000000000000..0a15d5fcbb30 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelFile.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class SearchPanelFile( + var uri: Uri? = null, + var snippets: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelSnippet.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelSnippet.kt new file mode 100644 index 000000000000..c500f1136276 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SearchPanelSnippet.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class SearchPanelSnippet( + var contents: String? = null, + var range: RangeParams? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SelectedCompletionInfo.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SelectedCompletionInfo.kt new file mode 100644 index 000000000000..3216f2a707b7 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SelectedCompletionInfo.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class SelectedCompletionInfo( + var range: Range? = null, + var text: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Selection.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Selection.kt new file mode 100644 index 000000000000..3f63a9ff5207 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Selection.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Selection( + var anchor: Position? = null, + var active: Position? = null, + var isReversed: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ServerInfo.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ServerInfo.kt new file mode 100644 index 000000000000..82367bd28e9d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ServerInfo.kt @@ -0,0 +1,11 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ServerInfo( + var name: String? = null, + var authenticated: Boolean? = null, + var codyEnabled: Boolean? = null, + var codyVersion: String? = null, + var authStatus: AuthStatus? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ShowWindowMessageParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ShowWindowMessageParams.kt new file mode 100644 index 000000000000..84324a4f3fa2 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ShowWindowMessageParams.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ShowWindowMessageParams( + var severity: String? = null, // Oneof: error, warning, information + var message: String? = null, + var options: MessageOptions? = null, + var items: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/StartParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/StartParams.kt new file mode 100644 index 000000000000..e128e0e4633d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/StartParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class StartParams( + var line: Int? = null, + var character: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolKind.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolKind.kt new file mode 100644 index 000000000000..065e72681150 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolKind.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias SymbolKind = String // One of: class, function, method + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolParams.kt new file mode 100644 index 000000000000..223fca9e1e25 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/SymbolParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class SymbolParams( + var fuzzyName: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEvent.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEvent.kt new file mode 100644 index 000000000000..6c6cc0c5466b --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEvent.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TelemetryEvent( + var feature: String? = null, + var action: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEventProperties.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEventProperties.kt new file mode 100644 index 000000000000..2aee7f068b1e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TelemetryEventProperties.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TelemetryEventProperties( + var key: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_NetworkRequestsResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_NetworkRequestsResult.kt new file mode 100644 index 000000000000..cadfb78b7e8b --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_NetworkRequestsResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Testing_NetworkRequestsResult( + var requests: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationParams.kt new file mode 100644 index 000000000000..880d0e2a2c0d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Testing_ProgressCancelationParams( + var title: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationResult.kt new file mode 100644 index 000000000000..bdb13d787034 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressCancelationResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Testing_ProgressCancelationResult( + var result: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressParams.kt new file mode 100644 index 000000000000..65d0a645547b --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Testing_ProgressParams( + var title: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressResult.kt new file mode 100644 index 000000000000..657c0e604609 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_ProgressResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Testing_ProgressResult( + var result: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_RequestErrorsResult.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_RequestErrorsResult.kt new file mode 100644 index 000000000000..d21728a4c07e --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Testing_RequestErrorsResult.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Testing_RequestErrorsResult( + var errors: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentEditParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentEditParams.kt new file mode 100644 index 000000000000..a8a63c316745 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentEditParams.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TextDocumentEditParams( + var uri: String? = null, + var edits: List? = null, + var options: OptionsParams? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentShowOptions.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentShowOptions.kt new file mode 100644 index 000000000000..64aa6a7d5bfb --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocumentShowOptions.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TextDocumentShowOptions( + var viewColumn: ViewColumn? = null, + var preserveFocus: Boolean? = null, + var preview: Boolean? = null, + var selection: Selection? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidFocusParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidFocusParams.kt new file mode 100644 index 000000000000..6721e70f57ae --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidFocusParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TextDocument_DidFocusParams( + var uri: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidSaveParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidSaveParams.kt new file mode 100644 index 000000000000..79e3afdbb28a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_DidSaveParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TextDocument_DidSaveParams( + var uri: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_ShowParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_ShowParams.kt new file mode 100644 index 000000000000..89ecb02f767a --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextDocument_ShowParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TextDocument_ShowParams( + var uri: String? = null, + var options: TextDocumentShowOptions? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextEdit.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextEdit.kt new file mode 100644 index 000000000000..1904f17c3446 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/TextEdit.kt @@ -0,0 +1,11 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class TextEdit( + var type: String? = null, // Oneof: insert, delete, replace + var range: Range? = null, + var value: String? = null, + var metadata: WorkspaceEditEntryMetadata? = null, + var position: Position? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UntitledTextDocument.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UntitledTextDocument.kt new file mode 100644 index 000000000000..68a22271324f --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UntitledTextDocument.kt @@ -0,0 +1,9 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class UntitledTextDocument( + var uri: String? = null, + var content: String? = null, + var language: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Uri.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Uri.kt new file mode 100644 index 000000000000..aeadac741979 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Uri.kt @@ -0,0 +1,12 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Uri( + var scheme: String? = null, + var authority: String? = null, + var path: String? = null, + var query: String? = null, + var fragment: String? = null, + var fsPath: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UserLocalHistory.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UserLocalHistory.kt new file mode 100644 index 000000000000..51bd59b2236d --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/UserLocalHistory.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class UserLocalHistory( + var chat: ChatHistory? = null, + var input: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/View.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/View.kt new file mode 100644 index 000000000000..5be1b205db26 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/View.kt @@ -0,0 +1,5 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +typealias View = String // One of: chat, login + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ViewColumn.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ViewColumn.kt new file mode 100644 index 000000000000..5989b1b39077 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/ViewColumn.kt @@ -0,0 +1,17 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class ViewColumn( + var Active: Int? = null, + var Beside: Int? = null, + var One: Int? = null, + var Two: Int? = null, + var Three: Int? = null, + var Four: Int? = null, + var Five: Int? = null, + var Six: Int? = null, + var Seven: Int? = null, + var Eight: Int? = null, + var Nine: Int? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewMessage.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewMessage.kt new file mode 100644 index 000000000000..498bce86e772 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewMessage.kt @@ -0,0 +1,32 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WebviewMessage( + var command: String? = null, // Oneof: initialized, event, submit, history, restoreHistory, deleteHistory, links, show-page, chatModel, get-chat-models, openFile, openLocalFileWithRange, edit, context/get-remote-search-repos, context/choose-remote-search-repo, context/remove-remote-search-repo, embeddings/index, symf/index, insert, newFile, copy, auth, abort, reload, simplified-onboarding, getUserContext, search, show-search-result, reset, attribution-search, ready + var eventName: String? = null, + var properties: TelemetryEventProperties? = null, + var text: String? = null, + var submitType: ChatSubmitType? = null, // Oneof: user, user-newchat + var addEnhancedContext: Boolean? = null, + var contextFiles: List? = null, + var action: String? = null, // Oneof: clear, export + var chatID: String? = null, + var value: String? = null, + var page: String? = null, + var model: String? = null, + var uri: Uri? = null, + var range: ActiveTextEditorSelectionRange? = null, + var filePath: String? = null, + var index: Int? = null, + var explicitRepos: List? = null, + var repoId: String? = null, + var metadata: CodeBlockMeta? = null, + var eventType: String? = null, // Oneof: Button, Keydown + var authKind: String? = null, // Oneof: signin, signout, support, callback, simplified-onboarding, simplified-onboarding-exposure + var endpoint: String? = null, + var authMethod: AuthMethod? = null, // Oneof: dotcom, github, gitlab, google + var onboardingKind: String? = null, // Oneof: web-sign-in-token + var query: String? = null, + var snippet: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewPostMessageParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewPostMessageParams.kt new file mode 100644 index 000000000000..0ea235f764bb --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WebviewPostMessageParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WebviewPostMessageParams( + var id: String? = null, + var message: ExtensionMessage? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_CreateParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_CreateParams.kt new file mode 100644 index 000000000000..5533dc52f4c0 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_CreateParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Webview_CreateParams( + var id: String? = null, + var data: Any? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_DidDisposeParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_DidDisposeParams.kt new file mode 100644 index 000000000000..3dcb51411606 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_DidDisposeParams.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Webview_DidDisposeParams( + var id: String? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_ReceiveMessageParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_ReceiveMessageParams.kt new file mode 100644 index 000000000000..9b52aa931060 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Webview_ReceiveMessageParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class Webview_ReceiveMessageParams( + var id: String? = null, + var message: WebviewMessage? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditEntryMetadata.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditEntryMetadata.kt new file mode 100644 index 000000000000..c0f3a65678d2 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditEntryMetadata.kt @@ -0,0 +1,10 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WorkspaceEditEntryMetadata( + var needsConfirmation: Boolean? = null, + var label: String? = null, + var description: String? = null, + var iconPath: Uri? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditMetadata.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditMetadata.kt new file mode 100644 index 000000000000..3be17489473f --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditMetadata.kt @@ -0,0 +1,7 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WorkspaceEditMetadata( + var isRefactoring: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditOperation.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditOperation.kt new file mode 100644 index 000000000000..5510ddb3c3a9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditOperation.kt @@ -0,0 +1,15 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WorkspaceEditOperation( + var type: String? = null, // Oneof: rename-file, delete-file, edit-file, create-file + var uri: String? = null, + var options: WriteFileOptions? = null, + var textContents: String? = null, + var metadata: WorkspaceEditEntryMetadata? = null, + var oldUri: String? = null, + var newUri: String? = null, + var deleteOptions: DeleteOptionsParams? = null, + var edits: List? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditParams.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditParams.kt new file mode 100644 index 000000000000..3598792a5a77 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WorkspaceEditParams.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WorkspaceEditParams( + var operations: List? = null, + var metadata: WorkspaceEditMetadata? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WriteFileOptions.kt b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WriteFileOptions.kt new file mode 100644 index 000000000000..971f24a488d9 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated/WriteFileOptions.kt @@ -0,0 +1,8 @@ +@file:Suppress("FunctionName", "ClassName") +package com.sourcegraph.cody.protocol_generated + +data class WriteFileOptions( + var overwrite: Boolean? = null, + var ignoreIfExists: Boolean? = null, +) + diff --git a/agent/bindings/kotlin/lib/src/test/kotlin/org/example/LibraryTest.kt b/agent/bindings/kotlin/lib/src/test/kotlin/org/example/LibraryTest.kt new file mode 100644 index 000000000000..edaeb8957502 --- /dev/null +++ b/agent/bindings/kotlin/lib/src/test/kotlin/org/example/LibraryTest.kt @@ -0,0 +1,15 @@ +/* + * This Kotlin source file was generated by the Gradle 'init' task. + */ +package org.example + +import com.sourcegraph.cody.protocol_generated.CodyAgentServer +import kotlin.test.Test +import kotlin.test.assertTrue + +class LibraryTest { + @Test fun someLibraryMethodReturnsTrue() { + val classUnderTest: CodyAgentServer? = null + println(classUnderTest) + } +} diff --git a/agent/bindings/kotlin/settings.gradle.kts b/agent/bindings/kotlin/settings.gradle.kts new file mode 100644 index 000000000000..04c73ae0c8ef --- /dev/null +++ b/agent/bindings/kotlin/settings.gradle.kts @@ -0,0 +1,14 @@ +/* + * This file was generated by the Gradle 'init' task. + * + * The settings file is used to specify which projects to include in your build. + * For more detailed information on multi-project builds, please refer to https://docs.gradle.org/8.6/userguide/multi_project_builds.html in the Gradle documentation. + */ + +plugins { + // Apply the foojay-resolver plugin to allow automatic download of JDKs + id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0" +} + +rootProject.name = "cody-agent-kotlin" +include("lib") diff --git a/agent/bindings/kotlin/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt b/agent/bindings/kotlin/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt new file mode 100644 index 000000000000..aaee46079a2f --- /dev/null +++ b/agent/bindings/kotlin/src/main/kotlin/com/sourcegraph/cody/protocol_generated/Null.kt @@ -0,0 +1,3 @@ +package com.sourcegraph.cody.protocol_generated + +typealias Null = Void? diff --git a/agent/package.json b/agent/package.json index d1c69c95df59..0a923a96c330 100644 --- a/agent/package.json +++ b/agent/package.json @@ -37,6 +37,8 @@ "vscode-uri": "^3.0.7" }, "devDependencies": { + "google-protobuf": "^3.21.2", + "@types/google-protobuf": "3.15.12", "@types/dedent": "^0.7.0", "@types/minimatch": "^5.1.2", "@types/uuid": "^9.0.2", diff --git a/agent/scripts/compile-bindings-if-diff.sh b/agent/scripts/compile-bindings-if-diff.sh new file mode 100755 index 000000000000..81caef84c097 --- /dev/null +++ b/agent/scripts/compile-bindings-if-diff.sh @@ -0,0 +1,8 @@ +#!/bin/bash +set -eux +git fetch origin main +REVISION="${GITHUB_BASE_REF:-origin/main}" +if [ $(git diff --name-only "HEAD..$REVISION" agent/bindings/kotlin | wc -l) -gt 0 ]; then + cd agent/bindings/kotlin + ./gradlew compileKotlin +fi diff --git a/agent/scripts/error-if-diff.sh b/agent/scripts/error-if-diff.sh new file mode 100755 index 000000000000..1cedd4d244d3 --- /dev/null +++ b/agent/scripts/error-if-diff.sh @@ -0,0 +1,18 @@ +#!/bin/bash +set -eu +if ! git diff --exit-code; then + echo '============================= +Failing this CI check because the changes in this PR influence the Cody Agent protocol. +The most common reason for this problem is that the commit adds a new property to an existing +type that is transitively referenced by the Cody Agent protocol (vscode/src/jsonrpc/agent-protocol.ts). + +To fix this problem, re-generate the Kotlin bindings to confirm that the new changes +can be easily represented in non-TypeScript clients: + + ./agent/scripts/generate-agent-kotlin-bindings.sh + git add . + git commit -am "Re-generate Kotlin bindings" + git push +' + exit 1 +fi diff --git a/agent/scripts/generate-agent-kotlin-bindings.sh b/agent/scripts/generate-agent-kotlin-bindings.sh new file mode 100755 index 000000000000..dce893b6a1c4 --- /dev/null +++ b/agent/scripts/generate-agent-kotlin-bindings.sh @@ -0,0 +1,17 @@ +#!/bin/bash +set -eux +INDEXER_DIR=${SCIP_TYPESCRIPT_DIR:-../scip-typescript-cody-bindings} + +if [ ! -d $INDEXER_DIR ]; then + git clone https://github.com/sourcegraph/scip-typescript.git $INDEXER_DIR +fi + +pushd $INDEXER_DIR +git checkout olafurpg/signatures +yarn install +popd + +pnpm build +# TODO: invoke @sourcegraph/scip-typescript npm package instead +pnpm dlx ts-node $INDEXER_DIR/src/main.ts index --emit-signatures --emit-external-symbols +pnpm dlx ts-node agent/src/cli/scip-codegen/command.ts --output agent/bindings/kotlin/lib/src/main/kotlin/com/sourcegraph/cody/protocol_generated diff --git a/agent/src/agent.ts b/agent/src/agent.ts index ab388564d0f2..4b7099e391ef 100644 --- a/agent/src/agent.ts +++ b/agent/src/agent.ts @@ -52,6 +52,7 @@ import { AgentCodeLenses } from './AgentCodeLenses' import { emptyEvent } from '../../vscode/src/testutils/emptyEvent' import type { PollyRequestError } from './cli/jsonrpc' import { AgentWorkspaceEdit } from '../../vscode/src/testutils/AgentWorkspaceEdit' +import type { CompletionItemID } from '../../vscode/src/completions/logger' const inMemorySecretStorageMap = new Map() const globalState = new AgentGlobalState() @@ -539,12 +540,12 @@ export class Agent extends MessageHandler { this.registerNotification('autocomplete/completionAccepted', async ({ completionID }) => { const provider = await vscode_shim.completionProvider() - await provider.handleDidAcceptCompletionItem(completionID) + await provider.handleDidAcceptCompletionItem(completionID as CompletionItemID) }) this.registerNotification('autocomplete/completionSuggested', async ({ completionID }) => { const provider = await vscode_shim.completionProvider() - provider.unstable_handleDidShowCompletionItem(completionID) + provider.unstable_handleDidShowCompletionItem(completionID as CompletionItemID) }) this.registerAuthenticatedRequest('graphql/getRepoIds', async ({ names, first }) => { diff --git a/agent/src/cli/scip-codegen/CodePrinter.ts b/agent/src/cli/scip-codegen/CodePrinter.ts new file mode 100644 index 000000000000..1429cdfdad87 --- /dev/null +++ b/agent/src/cli/scip-codegen/CodePrinter.ts @@ -0,0 +1,29 @@ +export class CodePrinter { + out: string[] = [] + indent = 0 + private printIndent(): void { + this.out.push(' '.repeat(this.indent)) + } + public sectionComment(label: string): void { + const header = '='.repeat(label.length) + this.line(`// ${header}`) + this.line(`// ${label}`) + this.line(`// ${header}`) + } + + public line(text?: string): void { + if (text) { + this.printIndent() + this.out.push(text) + } + this.out.push('\n') + } + public block(handler: () => void): void { + this.indent += 2 + handler() + this.indent -= 2 + } + public build(): string { + return this.out.join('') + } +} diff --git a/agent/src/cli/scip-codegen/ConsoleReporter.ts b/agent/src/cli/scip-codegen/ConsoleReporter.ts new file mode 100644 index 000000000000..4e81f0844608 --- /dev/null +++ b/agent/src/cli/scip-codegen/ConsoleReporter.ts @@ -0,0 +1,111 @@ +import { scip } from './scip' +import path from 'path' +import { URI } from 'vscode-uri' +import { readFileSync } from 'fs' +import { type Diagnostic, Severity } from './Diagnostic' + +export class ConsoleReporter { + public diagnostics: Diagnostic[] = [] + private c: Console + private maxSeverity: Severity + + constructor( + private readonly index: scip.Index, + params: { console?: Console; severity: 'error' | 'warning' } + ) { + this.c = params.console ?? console + this.maxSeverity = params.severity === 'error' ? Severity.Error : Severity.Warning + } + + public hasErrors(): boolean { + return this.errorCount() > 0 + } + + public errorCount(): number { + return this.diagnostics.filter(({ severity }) => severity === Severity.Error).length + } + + public reportErrorCount(): void { + const count = this.errorCount() + if (count === 0) { + return + } + this.c.error(count === 1 ? '1 error' : `${count} errors`) + } + public warn(symbol: string, message: string): void { + this.report({ severity: Severity.Warning, symbol, message }) + } + public error(symbol: string, message: string): void { + this.report({ severity: Severity.Error, symbol, message }) + } + public report(diagnostic: Diagnostic): void { + if (diagnostic.severity < this.maxSeverity) { + return + } + this.diagnostics.push(diagnostic) + this.reportDiagnostic(diagnostic) + for (const extra of diagnostic.additionalInformation ?? []) { + this.reportDiagnostic(extra) + } + } + + private reportDiagnostic(diagnostic: Diagnostic): void { + const definition = this.definition(diagnostic.symbol) + if (!definition) { + // TODO: infer a better location to report this warning, for example + // where the symbol is referenced from protocol types. + const [, , ...symbol] = diagnostic.symbol.split(' ') + const severity = Severity[diagnostic.severity].toLowerCase() + this.c.error(`${severity}: "${symbol.join(' ')}": ${diagnostic.message}`) + return + } + + const text = this.format(diagnostic, definition.document, definition.occ) + this.c.error(text) + } + + private definition(symbol: string): { document: scip.Document; occ: scip.Occurrence } | undefined { + for (const document of this.index.documents) { + for (const occ of document.occurrences) { + if (occ.symbol_roles & scip.SymbolRole.Definition && occ.symbol === symbol) { + return { document, occ } + } + } + } + return undefined + } + + private readDocument(document: scip.Document): { absolutePath: string; text: string } { + const absolutePath = path.join( + URI.parse(this.index.metadata.project_root).fsPath, + document.relative_path + ) + if (!document.text) { + const text = readFileSync(absolutePath, 'utf8').toString() + document.text = text + } + return { absolutePath, text: document.text } + } + + private format( + diagnostic: Diagnostic, + document: scip.Document, + occurrence: scip.Occurrence + ): string { + const { absolutePath, text } = this.readDocument(document) + const lines = text.split('\n') + const startLine = occurrence.range[0] + const startCharacter = occurrence.range[1] + const endCharacter = occurrence.range.length === 3 ? occurrence.range[2] : startCharacter + const out: string[] = [] + const severity = Severity[diagnostic.severity].toLowerCase() + const isMultiline = diagnostic.message.includes('\n') + const [header, suffix] = isMultiline ? ['', diagnostic.message] : [` ${diagnostic.message}`, ''] + out.push(`${severity}: ${absolutePath}:${startLine}:${startCharacter}:${header}`) + const count = this.diagnostics.length + out.push(count.toString().padStart(4) + '| ' + lines[startLine]) + out.push(' | ' + ' '.repeat(startCharacter) + '^'.repeat(endCharacter - startCharacter)) + out.push(suffix) + return out.join('\n') + } +} diff --git a/agent/src/cli/scip-codegen/Diagnostic.ts b/agent/src/cli/scip-codegen/Diagnostic.ts new file mode 100644 index 000000000000..3d5a7e0d84bd --- /dev/null +++ b/agent/src/cli/scip-codegen/Diagnostic.ts @@ -0,0 +1,12 @@ +export interface Diagnostic { + severity: Severity + symbol: string + additionalInformation?: Diagnostic[] + message: string +} + +export enum Severity {} +export enum Severity { + Error = 2, + Warning = 1, +} diff --git a/agent/src/cli/scip-codegen/KotlinCodegen.ts b/agent/src/cli/scip-codegen/KotlinCodegen.ts new file mode 100644 index 000000000000..85fdfce7241d --- /dev/null +++ b/agent/src/cli/scip-codegen/KotlinCodegen.ts @@ -0,0 +1,636 @@ +import fspromises from 'fs/promises' +import { scip } from './scip' +import { CodePrinter } from './CodePrinter' +import path from 'path' +import type { SymbolTable } from './SymbolTable' +import { typescriptKeyword, typescriptKeywordSyntax } from './utils' +import { KotlinFormatter } from './KotlinFormatter' +import { isNullOrUndefinedOrUnknownType } from './isNullOrUndefinedOrUnknownType' +import type * as pb_1 from 'google-protobuf' +import type { CodegenOptions } from './command' +import type { ConsoleReporter } from './ConsoleReporter' +import { type Diagnostic, Severity } from './Diagnostic' +import dedent from 'dedent' + +interface DocumentContext { + f: KotlinFormatter + p: CodePrinter + symtab: SymbolTable +} + +export class KotlinCodegen { + private f: KotlinFormatter + public queue: scip.SymbolInformation[] = [] + public generatedSymbols = new Set() + public siblingDiscriminatedUnionProperties = new Map() + + constructor( + private readonly options: CodegenOptions, + private readonly symtab: SymbolTable, + private readonly reporter: ConsoleReporter + ) { + this.f = new KotlinFormatter(this.symtab) + } + + public async run(): Promise { + try { + await fspromises.stat(this.options.output) + await fspromises.rm(this.options.output, { recursive: true }) + } catch { + // ignore + } + await fspromises.mkdir(this.options.output, { recursive: true }) + await this.writeNullAlias() + // TODO: infer package version from package.json + await this.writeProtocolInterface( + 'CodyAgentServer', + 'cody-ai src/jsonrpc/`agent-protocol.ts`/ClientRequests#', + 'cody-ai src/jsonrpc/`agent-protocol.ts`/ClientNotifications#' + ) + await this.writeProtocolInterface( + 'CodyAgentClient', + 'cody-ai src/jsonrpc/`agent-protocol.ts`/ServerRequests#', + 'cody-ai src/jsonrpc/`agent-protocol.ts`/ServerNotifications#' + ) + let info = this.queue.pop() + while (info !== undefined) { + if (!this.generatedSymbols.has(info.symbol)) { + this.writeType(info) + this.generatedSymbols.add(info.symbol) + } + info = this.queue.pop() + } + + await fspromises.mkdir(this.options.output, { recursive: true }) + } + + // Intentionally not private to prevent "unused method" warnings. + public debug(msg: pb_1.Message, params?: { verbose: boolean }): string { + if (params?.verbose) { + return JSON.stringify( + { + message: msg.toObject(), + debug: this.symtab.debuggingInfo.map(({ line, info }) => ({ + line, + info: info.toObject(), + })), + }, + null, + 2 + ) + } + return JSON.stringify(msg.toObject(), null, 2) + } + + private context(): DocumentContext & { + c: DocumentContext + } { + const context: DocumentContext = { f: this.f, p: new CodePrinter(), symtab: this.symtab } + return { ...context, c: context } + } + + private async writeNullAlias(): Promise { + const { p } = this.context() + p.line(`package ${this.options.kotlinPackage}`) + p.line() + p.line('typealias Null = Void?') + await fspromises.writeFile(path.join(this.options.output, 'Null.kt'), p.build()) + } + + private async writeDataClass( + { p, f, symtab }: DocumentContext, + name: string, + info: scip.SymbolInformation + ): Promise { + if (info.kind === scip.SymbolInformation.Kind.Class) { + this.reporter.warn( + info.symbol, + `classes should not be exposed in the agent protocol because they don't serialize to JSON.` + ) + } + p.line(`data class ${name}(`) + p.block(() => { + for (const memberSymbol of info.signature.class_signature.declarations.symlinks) { + if ( + this.f.ignoredProperties.find(ignoredProperty => + memberSymbol.endsWith(ignoredProperty) + ) + ) { + continue + } + if (memberSymbol.endsWith('().')) { + // Ignore method members because they should not leak into + // the protocol in the first place because functions don't + // have meaningful JSON serialization. The most common cause + // is that a class leaks into the protocol. + continue + } + const member = symtab.info(memberSymbol) + if (!member.signature.has_value_signature) { + throw new TypeError( + `not a value signature: ${JSON.stringify(member.toObject(), null, 2)}` + ) + } + if (member.signature.value_signature.tpe.has_lambda_type) { + this.reporter.warn( + memberSymbol, + `ignoring property '${member.display_name}' because it does not serialize correctly to JSON. ` + + `To fix this warning, don't expose this lambda type to the protocol` + ) + // Ignore properties with signatures like + // `ChatButton.onClick: (action: string) => void` + continue + } + const memberType = member.signature.value_signature.tpe + if (memberType === undefined) { + throw new TypeError(`no type: ${JSON.stringify(member.toObject(), null, 2)}`) + } + if ( + memberType.has_type_ref && + memberType.type_ref.symbol.endsWith(' lib/`lib.es5.d.ts`/Omit#') + ) { + // FIXME + continue + } + this.queueClassLikeType(memberType, member, 'parameter') + const memberTypeSyntax = f.jsonrpcTypeName(member, memberType, 'parameter') + const constants = this.stringConstantsFromInfo(member) + const oneofSyntax = constants.length > 0 ? ' // Oneof: ' + constants.join(', ') : '' + p.line(`var ${member.display_name}: ${memberTypeSyntax}? = null,${oneofSyntax}`) + } + }) + p.line(')') + } + + private aliasType(info: scip.SymbolInformation): string | undefined { + if (info.display_name === 'Date') { + // HACK: we should not be using `Date` in our protocol because it doesn't have serializate properly + return 'Double' + } + + if (this.isStringTypeInfo(info)) { + const constants = this.stringConstantsFromInfo(info) + return `String // One of: ${constants.join(', ')}` + } + + return undefined + } + + private async writeType(info: scip.SymbolInformation): Promise { + const { f, p, c } = this.context() + const name = f.typeName(info) + p.line('@file:Suppress("FunctionName", "ClassName")') + p.line(`package ${this.options.kotlinPackage}`) + p.line() + const alias = this.aliasType(info) + if (alias) { + p.line(`typealias ${name} = ${alias}`) + } else { + this.writeDataClass(c, name, info) + } + p.line() + await fspromises.writeFile(path.join(this.options.output, `${name}.kt`), p.build()) + } + + private async writeProtocolInterface( + name: string, + requests: string, + notifications: string + ): Promise { + const { f, p, symtab } = this.context() + p.line('@file:Suppress("FunctionName", "ClassName")') + p.line(`package ${this.options.kotlinPackage}`) + p.line() + p.line('import org.eclipse.lsp4j.jsonrpc.services.JsonNotification') + p.line('import org.eclipse.lsp4j.jsonrpc.services.JsonRequest') + p.line('import java.util.concurrent.CompletableFuture') + p.line() + p.line('@Suppress("unused")') + p.line(`interface ${name} {`) + + p.block(() => { + p.sectionComment('Requests') + for (const request of symtab.structuralType(symtab.canonicalSymbol(requests))) { + // Process a JSON-RPC request signature. For example: + // type Requests = { 'textDocument/inlineCompletions': [RequestParams, RequestResult] } + let resultType = request.signature.value_signature.tpe.type_ref.type_arguments[1] + + // TODO: make nullable handling generic for any type, not just request parameters + let nullableSyntax = '' + if ( + resultType.has_union_type && + resultType.union_type.types.length === 2 && + resultType.union_type.types[1].type_ref.symbol === typescriptKeyword('null') + ) { + nullableSyntax = '?' + resultType = resultType.union_type.types[0] + } + + const { parameterType, parameterSyntax } = f.jsonrpcMethodParameter(request) + this.queueClassLikeType(parameterType, request, 'parameter') + this.queueClassLikeType(resultType, request, 'result') + const resultTypeSyntax = f.jsonrpcTypeName(request, resultType, 'result') + + p.line(`@JsonRequest("${request.display_name}")`) + p.line( + `fun ${f.functionName(request)}(${parameterSyntax}): ` + + `CompletableFuture<${resultTypeSyntax}${nullableSyntax}>` + ) + } + + p.line() + p.sectionComment('Notifications') + for (const notification of symtab.structuralType(symtab.canonicalSymbol(notifications))) { + // 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}")`) + p.line(`fun ${f.functionName(notification)}(${parameterSyntax})`) + } + }) + + p.line('}') + + await fspromises.writeFile(path.join(this.options.output, `${name}.kt`), p.build()) + } + + private isStringType(type: scip.Type): boolean { + if (type.has_constant_type) { + return type.constant_type.constant.has_string_constant + } + + if (type.has_union_type) { + return type.union_type.types.every(type => this.isStringType(type)) + } + + if (type.has_intersection_type) { + return Boolean( + type.intersection_type.types.find( + type => type.has_type_ref && type.type_ref.symbol === typescriptKeyword('string') + ) + ) + } + + if (type.has_type_ref) { + return ( + type.type_ref.symbol === typescriptKeyword('string') || + this.isStringTypeInfo(this.symtab.info(type.type_ref.symbol)) + ) + } + + return false + } + + private isStringTypeInfo(info: scip.SymbolInformation): boolean { + if (info.signature.has_value_signature) { + return this.isStringType(info.signature.value_signature.tpe) + } + + if ( + info.signature.has_type_signature && + info.signature.type_signature.type_parameters && + info.signature.type_signature.type_parameters.symlinks.length === 0 + ) { + return this.isStringType(info.signature.type_signature.lower_bound) + } + + if (info.signature.has_class_signature && info.kind === scip.SymbolInformation.Kind.Enum) { + return info.signature.class_signature.declarations.symlinks.every(member => + this.isStringTypeInfo(this.symtab.info(member)) + ) + } + + return false + } + + public compatibleSignatures(a: scip.SymbolInformation, b: scip.SymbolInformation): boolean { + if (this.isStringTypeInfo(a) && this.isStringTypeInfo(b)) { + return true + } + // TODO: more optimized comparison? + return JSON.stringify(a.signature.toObject()) === JSON.stringify(b.signature.toObject()) + } + + private infoProperties(info: scip.SymbolInformation): string[] { + if (info.signature.has_class_signature) { + const result: string[] = [] + result.push(...info.signature.class_signature.declarations.symlinks) + for (const parent of info.signature.class_signature.parents) { + result.push(...this.properties(parent)) + } + return result + } + + if (info.signature.has_type_signature) { + return this.properties(info.signature.type_signature.lower_bound) + } + + this.reporter.error(info.symbol, `info has no properties: ${this.debug(info)}`) + return [] + } + + private stringConstantsFromType(type: scip.Type): string[] { + return this.stringConstantsFromInfo( + new scip.SymbolInformation({ + signature: new scip.Signature({ + value_signature: new scip.ValueSignature({ tpe: type }), + }), + }) + ) + } + private stringConstantsFromInfo(info: scip.SymbolInformation): string[] { + const result: string[] = [] + const isVisited = new Set() + const visitInfo = (info: scip.SymbolInformation) => { + if (isVisited.has(info.symbol)) { + return + } + isVisited.add(info.symbol) + for (const sibling of this.siblingDiscriminatedUnionProperties.get(info.symbol) ?? []) { + visitInfo(this.symtab.info(sibling)) + } + if (info.signature.has_value_signature) { + visitType(info.signature.value_signature.tpe) + return + } + if (info.signature.has_type_signature) { + visitType(info.signature.type_signature.lower_bound) + return + } + if (info.signature.has_class_signature && info.kind === scip.SymbolInformation.Kind.Enum) { + for (const member of info.signature.class_signature.declarations.symlinks) { + visitInfo(this.symtab.info(member)) + } + return + } + return info.symbol === typescriptKeyword('string') + } + const visitType = (type: scip.Type) => { + if (type.has_constant_type && type.constant_type.constant.has_string_constant) { + result.push(type.constant_type.constant.string_constant.value) + } + if (type.has_union_type) { + for (const constant of type.union_type.types) { + visitType(constant) + } + } + if (type.has_type_ref) { + visitInfo(this.symtab.info(type.type_ref.symbol)) + } + } + visitInfo(info) + return result + } + + private pickProperties(type: scip.Type): string[] { + const [t, k] = type.type_ref.type_arguments + const constants = new Set(this.stringConstantsFromType(k)) + return this.properties(t).filter(property => + constants.has(this.symtab.info(property).display_name) + ) + } + + private omitProperties(type: scip.Type): string[] { + const [t, k] = type.type_ref.type_arguments + const constants = new Set(this.stringConstantsFromType(k)) + return this.properties(t).filter( + property => !constants.has(this.symtab.info(property).display_name) + ) + } + + private properties(type: scip.Type): string[] { + if (type.has_structural_type) { + return type.structural_type.declarations.symlinks + } + + if (type.has_intersection_type) { + return type.intersection_type.types.flatMap(intersectionType => + this.properties(intersectionType) + ) + } + + if (type.has_union_type) { + return type.union_type.types.flatMap(unionType => this.properties(unionType)) + } + + if (type.has_type_ref) { + if (type.type_ref.symbol.endsWith(' lib/`lib.es5.d.ts`/Pick#')) { + return this.pickProperties(type) + } + if (type.type_ref.symbol.endsWith(' lib/`lib.es5.d.ts`/Omit#')) { + return this.omitProperties(type) + } + return this.infoProperties(this.symtab.info(type.type_ref.symbol)) + } + + // NOTE: we must not return [] for non-class-like types such as string + // literals. If you're hitting on this error with types like string + // literals it means you are not guarding against it higher up in the + // call stack. + // throw new TypeError(`type has no properties: ${this.debug(type)}`) + this.reporter.error('', `type has no properties: ${this.debug(type)}`) + return [] + } + + public isEmptySignature(signature: scip.Signature): boolean { + if ( + signature.has_value_signature && + Object.keys(signature.value_signature.tpe.toObject()).length === 0 + ) { + return true + } + return false + } + + // We are referencing the given type in the generated code. If this type + // references a class-like symbol (example, TypeScript interface), then we + // should queue the generation of this type. + private queueClassLikeType( + type: scip.Type, + jsonrpcMethod: scip.SymbolInformation, + kind: 'parameter' | 'result' + ): void { + if (type.has_type_ref) { + if (type.type_ref.symbol === typescriptKeyword('array')) { + this.queueClassLikeType(type.type_ref.type_arguments[0], jsonrpcMethod, kind) + } else if (this.f.isRecord(type.type_ref.symbol)) { + if (type.type_ref.type_arguments.length !== 2) { + throw new TypeError(`record must have 2 type arguments: ${this.debug(type)}`) + } + this.queueClassLikeType(type.type_ref.type_arguments[0], jsonrpcMethod, kind) + this.queueClassLikeType(type.type_ref.type_arguments[1], jsonrpcMethod, kind) + } else if (typescriptKeywordSyntax(type.type_ref.symbol)) { + // Typescript keywords map to primitive types (Int, Double) or built-in types like String + } else { + this.queueClassLikeInfo(this.symtab.info(type.type_ref.symbol)) + } + return + } + + if (type.has_structural_type || type.has_intersection_type) { + // Generate new (nominal) type for this anonymous + // structural/intersection type. For example, consider the property + // `foo` in `interface Foo { foo: A & B }` or `foo: { a: b, c: d}`, + // we create a new type with the name `FooParams` that contains the + // aggregate properties of `A & B` or `{a: b, c: d}`. + this.queueClassLikeInfo( + new scip.SymbolInformation({ + display_name: this.f.jsonrpcTypeName(jsonrpcMethod, type, kind), + // Need unique symbol for parameter+result types + symbol: `${jsonrpcMethod.symbol}(${kind}).`, + signature: new scip.Signature({ + // Convert structural types to class signature with name of the JSON-RPC method + class_signature: new scip.ClassSignature({ + declarations: new scip.Scope({ symlinks: this.properties(type) }), + }), + }), + }) + ) + return + } + + if (type.has_union_type && type.union_type.types.every(type => type.has_constant_type)) { + // No need need to come up with a nominal type for unions of string + // contants, like `foo: 'a' | 'b'`. + return + } + + if (type.has_union_type) { + const nonNullTypes = type.union_type.types.filter( + type => !isNullOrUndefinedOrUnknownType(type) + ) + if (nonNullTypes.length === 1) { + // Ignore `| null` union types and just queue the non-null type. + // All properties in the generated bindings are nullable by + // defaults anyways, even if the original type is not nullable. + this.queueClassLikeType(nonNullTypes[0], jsonrpcMethod, kind) + } else { + // Used hardcoded list of exceptions for how to resolve union + // types. In some cases, we are exposing VS Code APIs that have + // unions like `string | MarkdownString` where we just assume + // the type will always be `string`. + const exceptionIndex = this.f.unionTypeExceptionIndex.find(({ prefix }) => + jsonrpcMethod.symbol.startsWith(prefix) + )?.index + if (exceptionIndex !== undefined) { + this.reporter.warn( + jsonrpcMethod.symbol, + `resolving unsupported union by picking type ${exceptionIndex}. ${this.debug( + jsonrpcMethod + )}` + ) + this.queueClassLikeType(nonNullTypes[exceptionIndex], jsonrpcMethod, kind) + } else { + throw new Error( + `unsupported union type: ${JSON.stringify(jsonrpcMethod.toObject(), null, 2)}` + ) + } + } + return + } + + if (type.has_constant_type) { + return + } + + throw new Error(`unsupported type: ${this.debug(type)}`) + } + + // Same as `queueClassLikeType` but for `scip.SymbolInformation` instead of `scip.Type`. + private queueClassLikeInfo(jsonrpcMethod: scip.SymbolInformation): void { + if (jsonrpcMethod.signature.has_class_signature) { + // Easy, this looks like a class/interface. + this.queue.push(jsonrpcMethod) + return + } + + if (this.isStringTypeInfo(jsonrpcMethod)) { + // Easy, we can create a string type alias + this.queue.push(jsonrpcMethod) + return + } + + if (jsonrpcMethod.signature.has_type_signature) { + // Tricky case, creatively convert this type alias into a class signature. This is tricky because + // a type alias can have all sorts of shapes. For example, + // type Foo1 = A & B + // type Foo2 = { kind: 'a' } | {kind: 'b'} + // type Foo3 = ({ kind: 'a' } & A) | ({kind: 'b'} & B) + // The logic below does a best-effort to convert any shape into a + // basic data class (aka. struct). Simplified, we collect all the transitive properties of the referenced + // types and create a class with all those properties while ensuring that no two properties have the same + // name but incompatible type signatures. For example, there's no straighforward translation for the + // following case because `member` has the type `string | number`: + // type ExtensionMessage = + // { kind: 'a', member: string } | + // { kind: 'a', member: number } + // When encountering these cases, we report an error message. + + const declarations = new Map< + string, + { info: scip.SymbolInformation; diagnostic: Diagnostic; siblings: string[] } + >() + for (const property of this.properties(jsonrpcMethod.signature.type_signature.lower_bound)) { + const propertyInfo = this.symtab.info(property) + const sibling = declarations.get(propertyInfo.display_name) + if (!sibling) { + declarations.set(propertyInfo.display_name, { + info: propertyInfo, + diagnostic: { + severity: Severity.Error, + symbol: property, + message: dedent`Incompatible signatures. For discriminated unions, each property name must map to a unique type. + For example, it's not allowed to have a property named 'result', which is a string for one type in the + discrimated union and a number for another type in the union. To fix this problem, give one of the + following properties a unique name and try running the code generator again.`, + additionalInformation: [], + }, + siblings: [], + }) + continue + } + const { info: siblingProperty, diagnostic, siblings } = sibling + + if (!this.compatibleSignatures(siblingProperty, propertyInfo)) { + diagnostic.additionalInformation?.push({ + severity: Severity.Error, + symbol: property, + message: 'conflict here', + }) + } else { + siblings.push(property) + } + } + + if (declarations.size > 0) { + for (const { info, diagnostic, siblings } of declarations.values()) { + this.siblingDiscriminatedUnionProperties.set(info.symbol, siblings) + if ( + diagnostic.additionalInformation && + diagnostic.additionalInformation.length > 0 + ) { + this.reporter.report(diagnostic) + } + } + + this.queue.push( + new scip.SymbolInformation({ + display_name: jsonrpcMethod.display_name, + symbol: jsonrpcMethod.symbol, + signature: new scip.Signature({ + class_signature: new scip.ClassSignature({ + declarations: new scip.Scope({ + symlinks: [...declarations.values()].map(({ info }) => info.symbol), + }), + }), + }), + }) + ) + } + return + } + + throw new TypeError(`unknown info: ${JSON.stringify(jsonrpcMethod.toObject(), null, 2)}`) + } +} diff --git a/agent/src/cli/scip-codegen/KotlinFormatter.ts b/agent/src/cli/scip-codegen/KotlinFormatter.ts new file mode 100644 index 000000000000..e38c054c4eed --- /dev/null +++ b/agent/src/cli/scip-codegen/KotlinFormatter.ts @@ -0,0 +1,136 @@ +import { isNullOrUndefinedOrUnknownType } from './isNullOrUndefinedOrUnknownType' +import type { scip } from './scip' +import type { SymbolTable } from './SymbolTable' +import { capitalize, typescriptKeywordSyntax } from './utils' + +export class KotlinFormatter { + constructor(private readonly symtab: SymbolTable) {} + public functionName(info: scip.SymbolInformation): string { + return info.display_name.replaceAll('$/', '').replaceAll('/', '_') + } + + public typeName(info: scip.SymbolInformation): string { + if (info.display_name === 'URI') { + // HACK, just need to get this compiling + return 'Uri' + } + return info.display_name + .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') + return { parameterType, parameterSyntax: `params: ${parameterSyntax}` } + } + + public jsonrpcTypeName( + jsonrpcMethod: scip.SymbolInformation, + parameterOrResultType: scip.Type, + kind: 'parameter' | 'result' + ): string { + if (parameterOrResultType.has_type_ref) { + if (this.isRecord(parameterOrResultType.type_ref.symbol)) { + const [k, v] = parameterOrResultType.type_ref.type_arguments + const key = this.jsonrpcTypeName(jsonrpcMethod, k, kind) + const value = this.jsonrpcTypeName(jsonrpcMethod, v, kind) + return `Map<${key}, ${value}>` + } + const keyword = typescriptKeywordSyntax(parameterOrResultType.type_ref.symbol) + if (keyword === 'List') { + const elementType = this.jsonrpcTypeName( + jsonrpcMethod, + parameterOrResultType.type_ref.type_arguments[0], + kind + ) + return `List<${elementType}>` + } + if (keyword) { + return keyword + } + const name = this.typeName(this.symtab.info(parameterOrResultType.type_ref.symbol)) + if (name === 'Map') { + console.log(JSON.stringify(parameterOrResultType.toObject(), null, 2)) + } + return name + } + + if ( + parameterOrResultType.has_constant_type && + parameterOrResultType.constant_type.constant.has_string_constant + ) { + return 'String' + } + + if ( + parameterOrResultType.has_constant_type && + parameterOrResultType.constant_type.constant.has_int_constant + ) { + return 'Int' + } + + if (parameterOrResultType.has_structural_type || parameterOrResultType.has_intersection_type) { + const suffix = kind === 'parameter' ? 'Params' : 'Result' + return this.typeName(jsonrpcMethod) + suffix + } + + if (parameterOrResultType.has_union_type) { + if ( + parameterOrResultType.union_type.types.every( + type => type.has_constant_type && type.constant_type.constant.has_string_constant + ) + ) { + return 'String' + } + const nonNullTypes = parameterOrResultType.union_type.types.filter( + type => !isNullOrUndefinedOrUnknownType(type) + ) + if (nonNullTypes.length === 1) { + return this.jsonrpcTypeName(jsonrpcMethod, nonNullTypes[0], kind) + } + + const exceptionIndex = this.unionTypeExceptionIndex.find(({ prefix }) => + jsonrpcMethod.symbol.startsWith(prefix) + )?.index + if (exceptionIndex !== undefined) { + return this.jsonrpcTypeName(jsonrpcMethod, nonNullTypes[exceptionIndex], kind) + } + } + + throw new Error( + `no syntax: ${JSON.stringify( + { + jsonrpcMethod: jsonrpcMethod.toObject(), + parameterOrResultType: parameterOrResultType.toObject(), + }, + null, + 2 + )}` + ) + } + + public readonly ignoredProperties = [ + ' src/jsonrpc/`agent-protocol.ts`/parameters0:', + 'marketingTracking0:', // Too complicated signature + ] + + // Hacky workaround: we are exposing a few tricky union types in the + // protocol that don't have a clean encoding in other languages. We use this + // list to manually pick one of the types in the union type. + public readonly unionTypeExceptionIndex: { prefix: string; index: number }[] = [ + { prefix: 'scip-typescript npm @types/vscode ', index: 0 }, + ] + + public isRecord(symbol: string): boolean { + return ( + symbol.endsWith(' lib/`lib.es5.d.ts`/Record#') || + symbol.endsWith(' lib/`lib.es2015.collection.d.ts`/Map#') + ) + } +} diff --git a/agent/src/cli/scip-codegen/SymbolTable.ts b/agent/src/cli/scip-codegen/SymbolTable.ts new file mode 100644 index 000000000000..71da44387ee8 --- /dev/null +++ b/agent/src/cli/scip-codegen/SymbolTable.ts @@ -0,0 +1,74 @@ +import { scip } from './scip' + +export class SymbolTable { + public table = new Map() + public simplifiedTable = new Map() + public debuggingInfo: { line: string; info: scip.SymbolInformation }[] = [] + public pushDebug(info: scip.SymbolInformation): void { + const line = new Error().stack!.split('\n')[2] + this.debuggingInfo.push({ line, info }) + } + constructor(public readonly index: scip.Index) { + for (const document of index.documents) { + this.loadSymbols(document.symbols) + } + this.loadSymbols(index.external_symbols) + } + + private loadSymbols(symbols: scip.SymbolInformation[]): void { + for (const info of symbols) { + if (info.symbol.startsWith('local ')) { + continue + } + this.table.set(info.symbol, info) + this.simplifiedTable.set(this.simplifiedSymbolSyntax(info.symbol), info) + } + } + public canonicalSymbol(simplifiedSymbol: string): string { + return this.simplifiedTable.get(simplifiedSymbol)?.symbol ?? simplifiedSymbol + } + + // Converts a global symbol like "scip-typescript npm package-name + // package-version descriptor" into "package-name descriptor". The motivation to do this + // is so that we can load + private simplifiedSymbolSyntax(symbol: string): string { + const [scipTypescript, npm, packageName, , descriptor] = symbol.split(' ') + if (scipTypescript !== 'scip-typescript' || npm !== 'npm') { + throw new TypeError(`invalid symbol: ${symbol}`) + } + return `${packageName} ${descriptor}` + } + + public info(symbol: string): scip.SymbolInformation { + if (symbol === '') { + return new scip.SymbolInformation() + } + const result = this.table.get(symbol) + if (!result) { + throw new Error( + `no symbol: ${JSON.stringify( + { + symbol, + debuggingInfo: this.debuggingInfo.map(({ line, info }) => ({ + line, + info: info.toObject(), + })), + }, + null, + 2 + )}` + ) + } + return result + } + + public structuralType(symbol: string): scip.SymbolInformation[] { + const info = this.info(symbol) + if (!info.signature.has_type_signature) { + throw new Error('illegal state') + } + return info.signature.type_signature.lower_bound.structural_type.declarations.symlinks.map( + symbol => this.info(symbol) + ) + } +} diff --git a/agent/src/cli/scip-codegen/command.ts b/agent/src/cli/scip-codegen/command.ts new file mode 100644 index 000000000000..dfe456615d2e --- /dev/null +++ b/agent/src/cli/scip-codegen/command.ts @@ -0,0 +1,52 @@ +import fspromises from 'fs/promises' +import { Command } from 'commander' +import { KotlinCodegen } from './KotlinCodegen' +import { scip } from './scip' +import { SymbolTable } from './SymbolTable' +import { ConsoleReporter } from './ConsoleReporter' + +export interface CodegenOptions { + input: string + output: string + language: string + protocol: string + kotlinPackage: string + severity: string +} + +const command = new Command('scip-codegen') + .option('--input ', 'path to SCIP file', 'index.scip') + .option('--output ', 'path where to generate bindings') + .option('--language ', 'what programming language to generate the bindings', 'kotlin') + .option('--protocol ', 'what protocol to generate bindings for', 'agent') + .option('--severity ', 'what protocol to generate bindings for', 'error') + .option( + '--kotlin-package ', + 'what package name to use for the kotlin classes', + 'com.sourcegraph.cody.protocol_generated' + ) + .action(async (options: CodegenOptions) => { + const bytes = await fspromises.readFile(options.input) + if (options.language === 'kotlin') { + const index = scip.Index.deserialize(bytes) + const symtab = new SymbolTable(index) + const reporter = new ConsoleReporter(index, { severity: options.severity as any }) + const codegen = new KotlinCodegen(options, symtab, reporter) + await codegen.run() + + if (reporter.hasErrors()) { + reporter.reportErrorCount() + process.exit(1) + } + } else { + console.error(`unknown language: ${options.language}`) + process.exit(1) + } + }) + +const args = process.argv.slice(2) + +command.parseAsync(args, { from: 'user' }).catch(error => { + console.error(error) + process.exit(1) +}) diff --git a/agent/src/cli/scip-codegen/isNullOrUndefinedOrUnknownType.ts b/agent/src/cli/scip-codegen/isNullOrUndefinedOrUnknownType.ts new file mode 100644 index 000000000000..81994e9c5fe7 --- /dev/null +++ b/agent/src/cli/scip-codegen/isNullOrUndefinedOrUnknownType.ts @@ -0,0 +1,12 @@ +import type { scip } from './scip' +import { typescriptKeyword } from './utils' + +export function isNullOrUndefinedOrUnknownType(type: scip.Type): boolean { + return ( + type.has_type_ref && + type.type_ref.type_arguments.length === 0 && + (type.type_ref.symbol === typescriptKeyword('undefined') || + type.type_ref.symbol === typescriptKeyword('null') || + type.type_ref.symbol === typescriptKeyword('unknown')) + ) +} diff --git a/agent/src/cli/scip-codegen/scip.ts b/agent/src/cli/scip-codegen/scip.ts new file mode 100644 index 000000000000..f2d44652bdc8 --- /dev/null +++ b/agent/src/cli/scip-codegen/scip.ts @@ -0,0 +1,6802 @@ +/** + * Generated by the protoc-gen-ts. DO NOT EDIT! + * compiler version: 0.0.0 + * source: scip.proto + * git: https://github.com/thesayyn/protoc-gen-ts */ +import * as pb_1 from 'google-protobuf' +export namespace scip { + export enum ProtocolVersion { + UnspecifiedProtocolVersion = 0, + } + export enum TextEncoding { + UnspecifiedTextEncoding = 0, + UTF8 = 1, + UTF16 = 2, + } + export enum PositionEncoding { + UnspecifiedPositionEncoding = 0, + UTF8CodeUnitOffsetFromLineStart = 1, + UTF16CodeUnitOffsetFromLineStart = 2, + UTF32CodeUnitOffsetFromLineStart = 3, + } + export enum SymbolRole { + UnspecifiedSymbolRole = 0, + Definition = 1, + Import = 2, + WriteAccess = 4, + ReadAccess = 8, + Generated = 16, + Test = 32, + ForwardDefinition = 64, + } + export enum SyntaxKind { + UnspecifiedSyntaxKind = 0, + Comment = 1, + PunctuationDelimiter = 2, + PunctuationBracket = 3, + Keyword = 4, + /** @deprecated*/ + IdentifierKeyword = 4, + IdentifierOperator = 5, + Identifier = 6, + IdentifierBuiltin = 7, + IdentifierNull = 8, + IdentifierConstant = 9, + IdentifierMutableGlobal = 10, + IdentifierParameter = 11, + IdentifierLocal = 12, + IdentifierShadowed = 13, + IdentifierNamespace = 14, + /** @deprecated*/ + IdentifierModule = 14, + IdentifierFunction = 15, + IdentifierFunctionDefinition = 16, + IdentifierMacro = 17, + IdentifierMacroDefinition = 18, + IdentifierType = 19, + IdentifierBuiltinType = 20, + IdentifierAttribute = 21, + RegexEscape = 22, + RegexRepeated = 23, + RegexWildcard = 24, + RegexDelimiter = 25, + RegexJoin = 26, + StringLiteral = 27, + StringLiteralEscape = 28, + StringLiteralSpecial = 29, + StringLiteralKey = 30, + CharacterLiteral = 31, + NumericLiteral = 32, + BooleanLiteral = 33, + Tag = 34, + TagAttribute = 35, + TagDelimiter = 36, + } + export enum Severity { + UnspecifiedSeverity = 0, + Error = 1, + Warning = 2, + Information = 3, + Hint = 4, + } + export enum DiagnosticTag { + UnspecifiedDiagnosticTag = 0, + Unnecessary = 1, + Deprecated = 2, + } + export enum Language { + UnspecifiedLanguage = 0, + ABAP = 60, + Apex = 96, + APL = 49, + Ada = 39, + Agda = 45, + AsciiDoc = 86, + Assembly = 58, + Awk = 66, + Bat = 68, + BibTeX = 81, + C = 34, + COBOL = 59, + CPP = 35, + CSS = 26, + CSharp = 1, + Clojure = 8, + Coffeescript = 21, + CommonLisp = 9, + Coq = 47, + CUDA = 97, + Dart = 3, + Delphi = 57, + Diff = 88, + Dockerfile = 80, + Dyalog = 50, + Elixir = 17, + Erlang = 18, + FSharp = 42, + Fish = 65, + Flow = 24, + Fortran = 56, + Git_Commit = 91, + Git_Config = 89, + Git_Rebase = 92, + Go = 33, + GraphQL = 98, + Groovy = 7, + HTML = 30, + Hack = 20, + Handlebars = 90, + Haskell = 44, + Idris = 46, + Ini = 72, + J = 51, + JSON = 75, + Java = 6, + JavaScript = 22, + JavaScriptReact = 93, + Jsonnet = 76, + Julia = 55, + Justfile = 109, + Kotlin = 4, + LaTeX = 83, + Lean = 48, + Less = 27, + Lua = 12, + Luau = 108, + Makefile = 79, + Markdown = 84, + Matlab = 52, + Nickel = 110, + Nix = 77, + OCaml = 41, + Objective_C = 36, + Objective_CPP = 37, + Pascal = 99, + PHP = 19, + PLSQL = 70, + Perl = 13, + PowerShell = 67, + Prolog = 71, + Protobuf = 100, + Python = 15, + R = 54, + Racket = 11, + Raku = 14, + Razor = 62, + Repro = 102, + ReST = 85, + Ruby = 16, + Rust = 40, + SAS = 61, + SCSS = 29, + SML = 43, + SQL = 69, + Sass = 28, + Scala = 5, + Scheme = 10, + ShellScript = 64, + Skylark = 78, + Slang = 107, + Solidity = 95, + Svelte = 106, + Swift = 2, + Tcl = 101, + TOML = 73, + TeX = 82, + Thrift = 103, + TypeScript = 23, + TypeScriptReact = 94, + Verilog = 104, + VHDL = 105, + VisualBasic = 63, + Vue = 25, + Wolfram = 53, + XML = 31, + XSL = 32, + YAML = 74, + Zig = 38, + } + export class Index extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + metadata?: Metadata + documents?: Document[] + external_symbols?: SymbolInformation[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [2, 3], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('metadata' in data && data.metadata != undefined) { + this.metadata = data.metadata + } + if ('documents' in data && data.documents != undefined) { + this.documents = data.documents + } + if ('external_symbols' in data && data.external_symbols != undefined) { + this.external_symbols = data.external_symbols + } + } + } + get metadata() { + return pb_1.Message.getWrapperField(this, Metadata, 1) as Metadata + } + set metadata(value: Metadata) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_metadata() { + return pb_1.Message.getField(this, 1) != null + } + get documents() { + return pb_1.Message.getRepeatedWrapperField(this, Document, 2) as Document[] + } + set documents(value: Document[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value) + } + get external_symbols() { + return pb_1.Message.getRepeatedWrapperField( + this, + SymbolInformation, + 3 + ) as SymbolInformation[] + } + set external_symbols(value: SymbolInformation[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value) + } + static fromObject(data: { + metadata?: ReturnType + documents?: ReturnType[] + external_symbols?: ReturnType[] + }): Index { + const message = new Index({}) + if (data.metadata != null) { + message.metadata = Metadata.fromObject(data.metadata) + } + if (data.documents != null) { + message.documents = data.documents.map(item => Document.fromObject(item)) + } + if (data.external_symbols != null) { + message.external_symbols = data.external_symbols.map(item => + SymbolInformation.fromObject(item) + ) + } + return message + } + toObject() { + const data: { + metadata?: ReturnType + documents?: ReturnType[] + external_symbols?: ReturnType[] + } = {} + if (this.metadata != null) { + data.metadata = this.metadata.toObject() + } + if (this.documents != null) { + data.documents = this.documents.map((item: Document) => item.toObject()) + } + if (this.external_symbols != null) { + data.external_symbols = this.external_symbols.map((item: SymbolInformation) => + item.toObject() + ) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_metadata) + writer.writeMessage(1, this.metadata, () => this.metadata.serialize(writer)) + if (this.documents.length) + writer.writeRepeatedMessage(2, this.documents, (item: Document) => + item.serialize(writer) + ) + if (this.external_symbols.length) + writer.writeRepeatedMessage(3, this.external_symbols, (item: SymbolInformation) => + item.serialize(writer) + ) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Index { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Index() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.metadata, + () => (message.metadata = Metadata.deserialize(reader)) + ) + break + case 2: + reader.readMessage(message.documents, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 2, + Document.deserialize(reader), + Document + ) + ) + break + case 3: + reader.readMessage(message.external_symbols, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 3, + SymbolInformation.deserialize(reader), + SymbolInformation + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Index { + return Index.deserialize(bytes) + } + } + export class Metadata extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + version?: ProtocolVersion + tool_info?: ToolInfo + project_root?: string + text_document_encoding?: TextEncoding + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('version' in data && data.version != undefined) { + this.version = data.version + } + if ('tool_info' in data && data.tool_info != undefined) { + this.tool_info = data.tool_info + } + if ('project_root' in data && data.project_root != undefined) { + this.project_root = data.project_root + } + if ('text_document_encoding' in data && data.text_document_encoding != undefined) { + this.text_document_encoding = data.text_document_encoding + } + } + } + get version() { + return pb_1.Message.getFieldWithDefault( + this, + 1, + ProtocolVersion.UnspecifiedProtocolVersion + ) as ProtocolVersion + } + set version(value: ProtocolVersion) { + pb_1.Message.setField(this, 1, value) + } + get tool_info() { + return pb_1.Message.getWrapperField(this, ToolInfo, 2) as ToolInfo + } + set tool_info(value: ToolInfo) { + pb_1.Message.setWrapperField(this, 2, value) + } + get has_tool_info() { + return pb_1.Message.getField(this, 2) != null + } + get project_root() { + return pb_1.Message.getFieldWithDefault(this, 3, '') as string + } + set project_root(value: string) { + pb_1.Message.setField(this, 3, value) + } + get text_document_encoding() { + return pb_1.Message.getFieldWithDefault( + this, + 4, + TextEncoding.UnspecifiedTextEncoding + ) as TextEncoding + } + set text_document_encoding(value: TextEncoding) { + pb_1.Message.setField(this, 4, value) + } + static fromObject(data: { + version?: ProtocolVersion + tool_info?: ReturnType + project_root?: string + text_document_encoding?: TextEncoding + }): Metadata { + const message = new Metadata({}) + if (data.version != null) { + message.version = data.version + } + if (data.tool_info != null) { + message.tool_info = ToolInfo.fromObject(data.tool_info) + } + if (data.project_root != null) { + message.project_root = data.project_root + } + if (data.text_document_encoding != null) { + message.text_document_encoding = data.text_document_encoding + } + return message + } + toObject() { + const data: { + version?: ProtocolVersion + tool_info?: ReturnType + project_root?: string + text_document_encoding?: TextEncoding + } = {} + if (this.version != null) { + data.version = this.version + } + if (this.tool_info != null) { + data.tool_info = this.tool_info.toObject() + } + if (this.project_root != null) { + data.project_root = this.project_root + } + if (this.text_document_encoding != null) { + data.text_document_encoding = this.text_document_encoding + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.version != ProtocolVersion.UnspecifiedProtocolVersion) + writer.writeEnum(1, this.version) + if (this.has_tool_info) + writer.writeMessage(2, this.tool_info, () => this.tool_info.serialize(writer)) + if (this.project_root.length) writer.writeString(3, this.project_root) + if (this.text_document_encoding != TextEncoding.UnspecifiedTextEncoding) + writer.writeEnum(4, this.text_document_encoding) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Metadata { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Metadata() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.version = reader.readEnum() + break + case 2: + reader.readMessage( + message.tool_info, + () => (message.tool_info = ToolInfo.deserialize(reader)) + ) + break + case 3: + message.project_root = reader.readString() + break + case 4: + message.text_document_encoding = reader.readEnum() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Metadata { + return Metadata.deserialize(bytes) + } + } + export class ToolInfo extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + name?: string + version?: string + arguments?: string[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [3], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('name' in data && data.name != undefined) { + this.name = data.name + } + if ('version' in data && data.version != undefined) { + this.version = data.version + } + if ('arguments' in data && data.arguments != undefined) { + this.arguments = data.arguments + } + } + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set name(value: string) { + pb_1.Message.setField(this, 1, value) + } + get version() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set version(value: string) { + pb_1.Message.setField(this, 2, value) + } + get arguments() { + return pb_1.Message.getFieldWithDefault(this, 3, []) as string[] + } + set arguments(value: string[]) { + pb_1.Message.setField(this, 3, value) + } + static fromObject(data: { + name?: string + version?: string + arguments?: string[] + }): ToolInfo { + const message = new ToolInfo({}) + if (data.name != null) { + message.name = data.name + } + if (data.version != null) { + message.version = data.version + } + if (data.arguments != null) { + message.arguments = data.arguments + } + return message + } + toObject() { + const data: { + name?: string + version?: string + arguments?: string[] + } = {} + if (this.name != null) { + data.name = this.name + } + if (this.version != null) { + data.version = this.version + } + if (this.arguments != null) { + data.arguments = this.arguments + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.name.length) writer.writeString(1, this.name) + if (this.version.length) writer.writeString(2, this.version) + if (this.arguments.length) writer.writeRepeatedString(3, this.arguments) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ToolInfo { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ToolInfo() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.name = reader.readString() + break + case 2: + message.version = reader.readString() + break + case 3: + pb_1.Message.addToRepeatedField(message, 3, reader.readString()) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ToolInfo { + return ToolInfo.deserialize(bytes) + } + } + export class Document extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + language?: string + relative_path?: string + occurrences?: Occurrence[] + symbols?: SymbolInformation[] + text?: string + position_encoding?: PositionEncoding + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [2, 3], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('language' in data && data.language != undefined) { + this.language = data.language + } + if ('relative_path' in data && data.relative_path != undefined) { + this.relative_path = data.relative_path + } + if ('occurrences' in data && data.occurrences != undefined) { + this.occurrences = data.occurrences + } + if ('symbols' in data && data.symbols != undefined) { + this.symbols = data.symbols + } + if ('text' in data && data.text != undefined) { + this.text = data.text + } + if ('position_encoding' in data && data.position_encoding != undefined) { + this.position_encoding = data.position_encoding + } + } + } + get language() { + return pb_1.Message.getFieldWithDefault(this, 4, '') as string + } + set language(value: string) { + pb_1.Message.setField(this, 4, value) + } + get relative_path() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set relative_path(value: string) { + pb_1.Message.setField(this, 1, value) + } + get occurrences() { + return pb_1.Message.getRepeatedWrapperField(this, Occurrence, 2) as Occurrence[] + } + set occurrences(value: Occurrence[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value) + } + get symbols() { + return pb_1.Message.getRepeatedWrapperField( + this, + SymbolInformation, + 3 + ) as SymbolInformation[] + } + set symbols(value: SymbolInformation[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value) + } + get text() { + return pb_1.Message.getFieldWithDefault(this, 5, '') as string + } + set text(value: string) { + pb_1.Message.setField(this, 5, value) + } + get position_encoding() { + return pb_1.Message.getFieldWithDefault( + this, + 6, + PositionEncoding.UnspecifiedPositionEncoding + ) as PositionEncoding + } + set position_encoding(value: PositionEncoding) { + pb_1.Message.setField(this, 6, value) + } + static fromObject(data: { + language?: string + relative_path?: string + occurrences?: ReturnType[] + symbols?: ReturnType[] + text?: string + position_encoding?: PositionEncoding + }): Document { + const message = new Document({}) + if (data.language != null) { + message.language = data.language + } + if (data.relative_path != null) { + message.relative_path = data.relative_path + } + if (data.occurrences != null) { + message.occurrences = data.occurrences.map(item => Occurrence.fromObject(item)) + } + if (data.symbols != null) { + message.symbols = data.symbols.map(item => SymbolInformation.fromObject(item)) + } + if (data.text != null) { + message.text = data.text + } + if (data.position_encoding != null) { + message.position_encoding = data.position_encoding + } + return message + } + toObject() { + const data: { + language?: string + relative_path?: string + occurrences?: ReturnType[] + symbols?: ReturnType[] + text?: string + position_encoding?: PositionEncoding + } = {} + if (this.language != null) { + data.language = this.language + } + if (this.relative_path != null) { + data.relative_path = this.relative_path + } + if (this.occurrences != null) { + data.occurrences = this.occurrences.map((item: Occurrence) => item.toObject()) + } + if (this.symbols != null) { + data.symbols = this.symbols.map((item: SymbolInformation) => item.toObject()) + } + if (this.text != null) { + data.text = this.text + } + if (this.position_encoding != null) { + data.position_encoding = this.position_encoding + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.language.length) writer.writeString(4, this.language) + if (this.relative_path.length) writer.writeString(1, this.relative_path) + if (this.occurrences.length) + writer.writeRepeatedMessage(2, this.occurrences, (item: Occurrence) => + item.serialize(writer) + ) + if (this.symbols.length) + writer.writeRepeatedMessage(3, this.symbols, (item: SymbolInformation) => + item.serialize(writer) + ) + if (this.text.length) writer.writeString(5, this.text) + if (this.position_encoding != PositionEncoding.UnspecifiedPositionEncoding) + writer.writeEnum(6, this.position_encoding) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Document { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Document() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 4: + message.language = reader.readString() + break + case 1: + message.relative_path = reader.readString() + break + case 2: + reader.readMessage(message.occurrences, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 2, + Occurrence.deserialize(reader), + Occurrence + ) + ) + break + case 3: + reader.readMessage(message.symbols, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 3, + SymbolInformation.deserialize(reader), + SymbolInformation + ) + ) + break + case 5: + message.text = reader.readString() + break + case 6: + message.position_encoding = reader.readEnum() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Document { + return Document.deserialize(bytes) + } + } + export class Symbol extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + scheme?: string + package?: Package + descriptors?: Descriptor[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [3], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('scheme' in data && data.scheme != undefined) { + this.scheme = data.scheme + } + if ('package' in data && data.package != undefined) { + this.package = data.package + } + if ('descriptors' in data && data.descriptors != undefined) { + this.descriptors = data.descriptors + } + } + } + get scheme() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set scheme(value: string) { + pb_1.Message.setField(this, 1, value) + } + get package() { + return pb_1.Message.getWrapperField(this, Package, 2) as Package + } + set package(value: Package) { + pb_1.Message.setWrapperField(this, 2, value) + } + get has_package() { + return pb_1.Message.getField(this, 2) != null + } + get descriptors() { + return pb_1.Message.getRepeatedWrapperField(this, Descriptor, 3) as Descriptor[] + } + set descriptors(value: Descriptor[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value) + } + static fromObject(data: { + scheme?: string + package?: ReturnType + descriptors?: ReturnType[] + }): Symbol { + const message = new Symbol({}) + if (data.scheme != null) { + message.scheme = data.scheme + } + if (data.package != null) { + message.package = Package.fromObject(data.package) + } + if (data.descriptors != null) { + message.descriptors = data.descriptors.map(item => Descriptor.fromObject(item)) + } + return message + } + toObject() { + const data: { + scheme?: string + package?: ReturnType + descriptors?: ReturnType[] + } = {} + if (this.scheme != null) { + data.scheme = this.scheme + } + if (this.package != null) { + data.package = this.package.toObject() + } + if (this.descriptors != null) { + data.descriptors = this.descriptors.map((item: Descriptor) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.scheme.length) writer.writeString(1, this.scheme) + if (this.has_package) + writer.writeMessage(2, this.package, () => this.package.serialize(writer)) + if (this.descriptors.length) + writer.writeRepeatedMessage(3, this.descriptors, (item: Descriptor) => + item.serialize(writer) + ) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Symbol { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Symbol() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.scheme = reader.readString() + break + case 2: + reader.readMessage( + message.package, + () => (message.package = Package.deserialize(reader)) + ) + break + case 3: + reader.readMessage(message.descriptors, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 3, + Descriptor.deserialize(reader), + Descriptor + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Symbol { + return Symbol.deserialize(bytes) + } + } + export class Package extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + manager?: string + name?: string + version?: string + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('manager' in data && data.manager != undefined) { + this.manager = data.manager + } + if ('name' in data && data.name != undefined) { + this.name = data.name + } + if ('version' in data && data.version != undefined) { + this.version = data.version + } + } + } + get manager() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set manager(value: string) { + pb_1.Message.setField(this, 1, value) + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set name(value: string) { + pb_1.Message.setField(this, 2, value) + } + get version() { + return pb_1.Message.getFieldWithDefault(this, 3, '') as string + } + set version(value: string) { + pb_1.Message.setField(this, 3, value) + } + static fromObject(data: { + manager?: string + name?: string + version?: string + }): Package { + const message = new Package({}) + if (data.manager != null) { + message.manager = data.manager + } + if (data.name != null) { + message.name = data.name + } + if (data.version != null) { + message.version = data.version + } + return message + } + toObject() { + const data: { + manager?: string + name?: string + version?: string + } = {} + if (this.manager != null) { + data.manager = this.manager + } + if (this.name != null) { + data.name = this.name + } + if (this.version != null) { + data.version = this.version + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.manager.length) writer.writeString(1, this.manager) + if (this.name.length) writer.writeString(2, this.name) + if (this.version.length) writer.writeString(3, this.version) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Package { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Package() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.manager = reader.readString() + break + case 2: + message.name = reader.readString() + break + case 3: + message.version = reader.readString() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Package { + return Package.deserialize(bytes) + } + } + export class Descriptor extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + name?: string + disambiguator?: string + suffix?: Descriptor.Suffix + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('name' in data && data.name != undefined) { + this.name = data.name + } + if ('disambiguator' in data && data.disambiguator != undefined) { + this.disambiguator = data.disambiguator + } + if ('suffix' in data && data.suffix != undefined) { + this.suffix = data.suffix + } + } + } + get name() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set name(value: string) { + pb_1.Message.setField(this, 1, value) + } + get disambiguator() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set disambiguator(value: string) { + pb_1.Message.setField(this, 2, value) + } + get suffix() { + return pb_1.Message.getFieldWithDefault( + this, + 3, + Descriptor.Suffix.UnspecifiedSuffix + ) as Descriptor.Suffix + } + set suffix(value: Descriptor.Suffix) { + pb_1.Message.setField(this, 3, value) + } + static fromObject(data: { + name?: string + disambiguator?: string + suffix?: Descriptor.Suffix + }): Descriptor { + const message = new Descriptor({}) + if (data.name != null) { + message.name = data.name + } + if (data.disambiguator != null) { + message.disambiguator = data.disambiguator + } + if (data.suffix != null) { + message.suffix = data.suffix + } + return message + } + toObject() { + const data: { + name?: string + disambiguator?: string + suffix?: Descriptor.Suffix + } = {} + if (this.name != null) { + data.name = this.name + } + if (this.disambiguator != null) { + data.disambiguator = this.disambiguator + } + if (this.suffix != null) { + data.suffix = this.suffix + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.name.length) writer.writeString(1, this.name) + if (this.disambiguator.length) writer.writeString(2, this.disambiguator) + if (this.suffix != Descriptor.Suffix.UnspecifiedSuffix) writer.writeEnum(3, this.suffix) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Descriptor { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Descriptor() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.name = reader.readString() + break + case 2: + message.disambiguator = reader.readString() + break + case 3: + message.suffix = reader.readEnum() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Descriptor { + return Descriptor.deserialize(bytes) + } + } + export namespace Descriptor { + export enum Suffix { + UnspecifiedSuffix = 0, + Namespace = 1, + /** @deprecated*/ + Package = 1, + Type = 2, + Term = 3, + Method = 4, + TypeParameter = 5, + Parameter = 6, + Meta = 7, + Local = 8, + Macro = 9, + } + } + export class SymbolInformation extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + symbol?: string + documentation?: string[] + relationships?: Relationship[] + kind?: SymbolInformation.Kind + display_name?: string + signature_documentation?: Document + enclosing_symbol?: string + signature?: Signature + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [3, 4], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + if ('documentation' in data && data.documentation != undefined) { + this.documentation = data.documentation + } + if ('relationships' in data && data.relationships != undefined) { + this.relationships = data.relationships + } + if ('kind' in data && data.kind != undefined) { + this.kind = data.kind + } + if ('display_name' in data && data.display_name != undefined) { + this.display_name = data.display_name + } + if ('signature_documentation' in data && data.signature_documentation != undefined) { + this.signature_documentation = data.signature_documentation + } + if ('enclosing_symbol' in data && data.enclosing_symbol != undefined) { + this.enclosing_symbol = data.enclosing_symbol + } + if ('signature' in data && data.signature != undefined) { + this.signature = data.signature + } + } + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 1, value) + } + get documentation() { + return pb_1.Message.getFieldWithDefault(this, 3, []) as string[] + } + set documentation(value: string[]) { + pb_1.Message.setField(this, 3, value) + } + get relationships() { + return pb_1.Message.getRepeatedWrapperField(this, Relationship, 4) as Relationship[] + } + set relationships(value: Relationship[]) { + pb_1.Message.setRepeatedWrapperField(this, 4, value) + } + get kind() { + return pb_1.Message.getFieldWithDefault( + this, + 5, + SymbolInformation.Kind.UnspecifiedKind + ) as SymbolInformation.Kind + } + set kind(value: SymbolInformation.Kind) { + pb_1.Message.setField(this, 5, value) + } + get display_name() { + return pb_1.Message.getFieldWithDefault(this, 6, '') as string + } + set display_name(value: string) { + pb_1.Message.setField(this, 6, value) + } + get signature_documentation() { + return pb_1.Message.getWrapperField(this, Document, 7) as Document + } + set signature_documentation(value: Document) { + pb_1.Message.setWrapperField(this, 7, value) + } + get has_signature_documentation() { + return pb_1.Message.getField(this, 7) != null + } + get enclosing_symbol() { + return pb_1.Message.getFieldWithDefault(this, 8, '') as string + } + set enclosing_symbol(value: string) { + pb_1.Message.setField(this, 8, value) + } + get signature() { + return pb_1.Message.getWrapperField(this, Signature, 9) as Signature + } + set signature(value: Signature) { + pb_1.Message.setWrapperField(this, 9, value) + } + get has_signature() { + return pb_1.Message.getField(this, 9) != null + } + static fromObject(data: { + symbol?: string + documentation?: string[] + relationships?: ReturnType[] + kind?: SymbolInformation.Kind + display_name?: string + signature_documentation?: ReturnType + enclosing_symbol?: string + signature?: ReturnType + }): SymbolInformation { + const message = new SymbolInformation({}) + if (data.symbol != null) { + message.symbol = data.symbol + } + if (data.documentation != null) { + message.documentation = data.documentation + } + if (data.relationships != null) { + message.relationships = data.relationships.map(item => Relationship.fromObject(item)) + } + if (data.kind != null) { + message.kind = data.kind + } + if (data.display_name != null) { + message.display_name = data.display_name + } + if (data.signature_documentation != null) { + message.signature_documentation = Document.fromObject(data.signature_documentation) + } + if (data.enclosing_symbol != null) { + message.enclosing_symbol = data.enclosing_symbol + } + if (data.signature != null) { + message.signature = Signature.fromObject(data.signature) + } + return message + } + toObject() { + const data: { + symbol?: string + documentation?: string[] + relationships?: ReturnType[] + kind?: SymbolInformation.Kind + display_name?: string + signature_documentation?: ReturnType + enclosing_symbol?: string + signature?: ReturnType + } = {} + if (this.symbol != null) { + data.symbol = this.symbol + } + if (this.documentation != null) { + data.documentation = this.documentation + } + if (this.relationships != null) { + data.relationships = this.relationships.map((item: Relationship) => item.toObject()) + } + if (this.kind != null) { + data.kind = this.kind + } + if (this.display_name != null) { + data.display_name = this.display_name + } + if (this.signature_documentation != null) { + data.signature_documentation = this.signature_documentation.toObject() + } + if (this.enclosing_symbol != null) { + data.enclosing_symbol = this.enclosing_symbol + } + if (this.signature != null) { + data.signature = this.signature.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.symbol.length) writer.writeString(1, this.symbol) + if (this.documentation.length) writer.writeRepeatedString(3, this.documentation) + if (this.relationships.length) + writer.writeRepeatedMessage(4, this.relationships, (item: Relationship) => + item.serialize(writer) + ) + if (this.kind != SymbolInformation.Kind.UnspecifiedKind) writer.writeEnum(5, this.kind) + if (this.display_name.length) writer.writeString(6, this.display_name) + if (this.has_signature_documentation) + writer.writeMessage(7, this.signature_documentation, () => + this.signature_documentation.serialize(writer) + ) + if (this.enclosing_symbol.length) writer.writeString(8, this.enclosing_symbol) + if (this.has_signature) + writer.writeMessage(9, this.signature, () => this.signature.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SymbolInformation { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new SymbolInformation() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.symbol = reader.readString() + break + case 3: + pb_1.Message.addToRepeatedField(message, 3, reader.readString()) + break + case 4: + reader.readMessage(message.relationships, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 4, + Relationship.deserialize(reader), + Relationship + ) + ) + break + case 5: + message.kind = reader.readEnum() + break + case 6: + message.display_name = reader.readString() + break + case 7: + reader.readMessage( + message.signature_documentation, + () => (message.signature_documentation = Document.deserialize(reader)) + ) + break + case 8: + message.enclosing_symbol = reader.readString() + break + case 9: + reader.readMessage( + message.signature, + () => (message.signature = Signature.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): SymbolInformation { + return SymbolInformation.deserialize(bytes) + } + } + export namespace SymbolInformation { + export enum Kind { + UnspecifiedKind = 0, + AbstractMethod = 66, + Accessor = 72, + Array = 1, + Assertion = 2, + AssociatedType = 3, + Attribute = 4, + Axiom = 5, + Boolean = 6, + Class = 7, + Constant = 8, + Constructor = 9, + Contract = 62, + DataFamily = 10, + Delegate = 73, + Enum = 11, + EnumMember = 12, + Error = 63, + Event = 13, + Fact = 14, + Field = 15, + File = 16, + Function = 17, + Getter = 18, + Grammar = 19, + Instance = 20, + Interface = 21, + Key = 22, + Lang = 23, + Lemma = 24, + Library = 64, + Macro = 25, + Method = 26, + MethodAlias = 74, + MethodReceiver = 27, + MethodSpecification = 67, + Message = 28, + Modifier = 65, + Module = 29, + Namespace = 30, + Null = 31, + Number = 32, + Object = 33, + Operator = 34, + Package = 35, + PackageObject = 36, + Parameter = 37, + ParameterLabel = 38, + Pattern = 39, + Predicate = 40, + Property = 41, + Protocol = 42, + ProtocolMethod = 68, + PureVirtualMethod = 69, + Quasiquoter = 43, + SelfParameter = 44, + Setter = 45, + Signature = 46, + SingletonClass = 75, + SingletonMethod = 76, + StaticDataMember = 77, + StaticEvent = 78, + StaticField = 79, + StaticMethod = 80, + StaticProperty = 81, + StaticVariable = 82, + String = 48, + Struct = 49, + Subscript = 47, + Tactic = 50, + Theorem = 51, + ThisParameter = 52, + Trait = 53, + TraitMethod = 70, + Type = 54, + TypeAlias = 55, + TypeClass = 56, + TypeClassMethod = 71, + TypeFamily = 57, + TypeParameter = 58, + Union = 59, + Value = 60, + Variable = 61, + } + } + export class Relationship extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + symbol?: string + is_reference?: boolean + is_implementation?: boolean + is_type_definition?: boolean + is_definition?: boolean + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + if ('is_reference' in data && data.is_reference != undefined) { + this.is_reference = data.is_reference + } + if ('is_implementation' in data && data.is_implementation != undefined) { + this.is_implementation = data.is_implementation + } + if ('is_type_definition' in data && data.is_type_definition != undefined) { + this.is_type_definition = data.is_type_definition + } + if ('is_definition' in data && data.is_definition != undefined) { + this.is_definition = data.is_definition + } + } + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 1, value) + } + get is_reference() { + return pb_1.Message.getFieldWithDefault(this, 2, false) as boolean + } + set is_reference(value: boolean) { + pb_1.Message.setField(this, 2, value) + } + get is_implementation() { + return pb_1.Message.getFieldWithDefault(this, 3, false) as boolean + } + set is_implementation(value: boolean) { + pb_1.Message.setField(this, 3, value) + } + get is_type_definition() { + return pb_1.Message.getFieldWithDefault(this, 4, false) as boolean + } + set is_type_definition(value: boolean) { + pb_1.Message.setField(this, 4, value) + } + get is_definition() { + return pb_1.Message.getFieldWithDefault(this, 5, false) as boolean + } + set is_definition(value: boolean) { + pb_1.Message.setField(this, 5, value) + } + static fromObject(data: { + symbol?: string + is_reference?: boolean + is_implementation?: boolean + is_type_definition?: boolean + is_definition?: boolean + }): Relationship { + const message = new Relationship({}) + if (data.symbol != null) { + message.symbol = data.symbol + } + if (data.is_reference != null) { + message.is_reference = data.is_reference + } + if (data.is_implementation != null) { + message.is_implementation = data.is_implementation + } + if (data.is_type_definition != null) { + message.is_type_definition = data.is_type_definition + } + if (data.is_definition != null) { + message.is_definition = data.is_definition + } + return message + } + toObject() { + const data: { + symbol?: string + is_reference?: boolean + is_implementation?: boolean + is_type_definition?: boolean + is_definition?: boolean + } = {} + if (this.symbol != null) { + data.symbol = this.symbol + } + if (this.is_reference != null) { + data.is_reference = this.is_reference + } + if (this.is_implementation != null) { + data.is_implementation = this.is_implementation + } + if (this.is_type_definition != null) { + data.is_type_definition = this.is_type_definition + } + if (this.is_definition != null) { + data.is_definition = this.is_definition + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.symbol.length) writer.writeString(1, this.symbol) + if (this.is_reference != false) writer.writeBool(2, this.is_reference) + if (this.is_implementation != false) writer.writeBool(3, this.is_implementation) + if (this.is_type_definition != false) writer.writeBool(4, this.is_type_definition) + if (this.is_definition != false) writer.writeBool(5, this.is_definition) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Relationship { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Relationship() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.symbol = reader.readString() + break + case 2: + message.is_reference = reader.readBool() + break + case 3: + message.is_implementation = reader.readBool() + break + case 4: + message.is_type_definition = reader.readBool() + break + case 5: + message.is_definition = reader.readBool() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Relationship { + return Relationship.deserialize(bytes) + } + } + export class Occurrence extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + range?: number[] + symbol?: string + symbol_roles?: number + override_documentation?: string[] + syntax_kind?: SyntaxKind + diagnostics?: Diagnostic[] + enclosing_range?: number[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [1, 4, 6, 7], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('range' in data && data.range != undefined) { + this.range = data.range + } + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + if ('symbol_roles' in data && data.symbol_roles != undefined) { + this.symbol_roles = data.symbol_roles + } + if ('override_documentation' in data && data.override_documentation != undefined) { + this.override_documentation = data.override_documentation + } + if ('syntax_kind' in data && data.syntax_kind != undefined) { + this.syntax_kind = data.syntax_kind + } + if ('diagnostics' in data && data.diagnostics != undefined) { + this.diagnostics = data.diagnostics + } + if ('enclosing_range' in data && data.enclosing_range != undefined) { + this.enclosing_range = data.enclosing_range + } + } + } + get range() { + return pb_1.Message.getFieldWithDefault(this, 1, []) as number[] + } + set range(value: number[]) { + pb_1.Message.setField(this, 1, value) + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 2, value) + } + get symbol_roles() { + return pb_1.Message.getFieldWithDefault(this, 3, 0) as number + } + set symbol_roles(value: number) { + pb_1.Message.setField(this, 3, value) + } + get override_documentation() { + return pb_1.Message.getFieldWithDefault(this, 4, []) as string[] + } + set override_documentation(value: string[]) { + pb_1.Message.setField(this, 4, value) + } + get syntax_kind() { + return pb_1.Message.getFieldWithDefault( + this, + 5, + SyntaxKind.UnspecifiedSyntaxKind + ) as SyntaxKind + } + set syntax_kind(value: SyntaxKind) { + pb_1.Message.setField(this, 5, value) + } + get diagnostics() { + return pb_1.Message.getRepeatedWrapperField(this, Diagnostic, 6) as Diagnostic[] + } + set diagnostics(value: Diagnostic[]) { + pb_1.Message.setRepeatedWrapperField(this, 6, value) + } + get enclosing_range() { + return pb_1.Message.getFieldWithDefault(this, 7, []) as number[] + } + set enclosing_range(value: number[]) { + pb_1.Message.setField(this, 7, value) + } + static fromObject(data: { + range?: number[] + symbol?: string + symbol_roles?: number + override_documentation?: string[] + syntax_kind?: SyntaxKind + diagnostics?: ReturnType[] + enclosing_range?: number[] + }): Occurrence { + const message = new Occurrence({}) + if (data.range != null) { + message.range = data.range + } + if (data.symbol != null) { + message.symbol = data.symbol + } + if (data.symbol_roles != null) { + message.symbol_roles = data.symbol_roles + } + if (data.override_documentation != null) { + message.override_documentation = data.override_documentation + } + if (data.syntax_kind != null) { + message.syntax_kind = data.syntax_kind + } + if (data.diagnostics != null) { + message.diagnostics = data.diagnostics.map(item => Diagnostic.fromObject(item)) + } + if (data.enclosing_range != null) { + message.enclosing_range = data.enclosing_range + } + return message + } + toObject() { + const data: { + range?: number[] + symbol?: string + symbol_roles?: number + override_documentation?: string[] + syntax_kind?: SyntaxKind + diagnostics?: ReturnType[] + enclosing_range?: number[] + } = {} + if (this.range != null) { + data.range = this.range + } + if (this.symbol != null) { + data.symbol = this.symbol + } + if (this.symbol_roles != null) { + data.symbol_roles = this.symbol_roles + } + if (this.override_documentation != null) { + data.override_documentation = this.override_documentation + } + if (this.syntax_kind != null) { + data.syntax_kind = this.syntax_kind + } + if (this.diagnostics != null) { + data.diagnostics = this.diagnostics.map((item: Diagnostic) => item.toObject()) + } + if (this.enclosing_range != null) { + data.enclosing_range = this.enclosing_range + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.range.length) writer.writePackedInt32(1, this.range) + if (this.symbol.length) writer.writeString(2, this.symbol) + if (this.symbol_roles != 0) writer.writeInt32(3, this.symbol_roles) + if (this.override_documentation.length) + writer.writeRepeatedString(4, this.override_documentation) + if (this.syntax_kind != SyntaxKind.UnspecifiedSyntaxKind) + writer.writeEnum(5, this.syntax_kind) + if (this.diagnostics.length) + writer.writeRepeatedMessage(6, this.diagnostics, (item: Diagnostic) => + item.serialize(writer) + ) + if (this.enclosing_range.length) writer.writePackedInt32(7, this.enclosing_range) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Occurrence { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Occurrence() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.range = reader.readPackedInt32() + break + case 2: + message.symbol = reader.readString() + break + case 3: + message.symbol_roles = reader.readInt32() + break + case 4: + pb_1.Message.addToRepeatedField(message, 4, reader.readString()) + break + case 5: + message.syntax_kind = reader.readEnum() + break + case 6: + reader.readMessage(message.diagnostics, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 6, + Diagnostic.deserialize(reader), + Diagnostic + ) + ) + break + case 7: + message.enclosing_range = reader.readPackedInt32() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Occurrence { + return Occurrence.deserialize(bytes) + } + } + export class Diagnostic extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + severity?: Severity + code?: string + message?: string + source?: string + tags?: DiagnosticTag[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [5], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('severity' in data && data.severity != undefined) { + this.severity = data.severity + } + if ('code' in data && data.code != undefined) { + this.code = data.code + } + if ('message' in data && data.message != undefined) { + this.message = data.message + } + if ('source' in data && data.source != undefined) { + this.source = data.source + } + if ('tags' in data && data.tags != undefined) { + this.tags = data.tags + } + } + } + get severity() { + return pb_1.Message.getFieldWithDefault(this, 1, Severity.UnspecifiedSeverity) as Severity + } + set severity(value: Severity) { + pb_1.Message.setField(this, 1, value) + } + get code() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set code(value: string) { + pb_1.Message.setField(this, 2, value) + } + get message() { + return pb_1.Message.getFieldWithDefault(this, 3, '') as string + } + set message(value: string) { + pb_1.Message.setField(this, 3, value) + } + get source() { + return pb_1.Message.getFieldWithDefault(this, 4, '') as string + } + set source(value: string) { + pb_1.Message.setField(this, 4, value) + } + get tags() { + return pb_1.Message.getFieldWithDefault(this, 5, []) as DiagnosticTag[] + } + set tags(value: DiagnosticTag[]) { + pb_1.Message.setField(this, 5, value) + } + static fromObject(data: { + severity?: Severity + code?: string + message?: string + source?: string + tags?: DiagnosticTag[] + }): Diagnostic { + const message = new Diagnostic({}) + if (data.severity != null) { + message.severity = data.severity + } + if (data.code != null) { + message.code = data.code + } + if (data.message != null) { + message.message = data.message + } + if (data.source != null) { + message.source = data.source + } + if (data.tags != null) { + message.tags = data.tags + } + return message + } + toObject() { + const data: { + severity?: Severity + code?: string + message?: string + source?: string + tags?: DiagnosticTag[] + } = {} + if (this.severity != null) { + data.severity = this.severity + } + if (this.code != null) { + data.code = this.code + } + if (this.message != null) { + data.message = this.message + } + if (this.source != null) { + data.source = this.source + } + if (this.tags != null) { + data.tags = this.tags + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.severity != Severity.UnspecifiedSeverity) writer.writeEnum(1, this.severity) + if (this.code.length) writer.writeString(2, this.code) + if (this.message.length) writer.writeString(3, this.message) + if (this.source.length) writer.writeString(4, this.source) + if (this.tags.length) writer.writePackedEnum(5, this.tags) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Diagnostic { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Diagnostic() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.severity = reader.readEnum() + break + case 2: + message.code = reader.readString() + break + case 3: + message.message = reader.readString() + break + case 4: + message.source = reader.readString() + break + case 5: + message.tags = reader.readPackedEnum() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Diagnostic { + return Diagnostic.deserialize(bytes) + } + } + export class Annotation extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + tpe?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + } + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 1) != null + } + static fromObject(data: { + tpe?: ReturnType + }): Annotation { + const message = new Annotation({}) + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + return message + } + toObject() { + const data: { + tpe?: ReturnType + } = {} + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_tpe) writer.writeMessage(1, this.tpe, () => this.tpe.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Annotation { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Annotation() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Annotation { + return Annotation.deserialize(bytes) + } + } + export class Scope extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + symlinks?: string[] + hardlinks?: SymbolInformation[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [1, 2], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('symlinks' in data && data.symlinks != undefined) { + this.symlinks = data.symlinks + } + if ('hardlinks' in data && data.hardlinks != undefined) { + this.hardlinks = data.hardlinks + } + } + } + get symlinks() { + return pb_1.Message.getFieldWithDefault(this, 1, []) as string[] + } + set symlinks(value: string[]) { + pb_1.Message.setField(this, 1, value) + } + get hardlinks() { + return pb_1.Message.getRepeatedWrapperField( + this, + SymbolInformation, + 2 + ) as SymbolInformation[] + } + set hardlinks(value: SymbolInformation[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value) + } + static fromObject(data: { + symlinks?: string[] + hardlinks?: ReturnType[] + }): Scope { + const message = new Scope({}) + if (data.symlinks != null) { + message.symlinks = data.symlinks + } + if (data.hardlinks != null) { + message.hardlinks = data.hardlinks.map(item => SymbolInformation.fromObject(item)) + } + return message + } + toObject() { + const data: { + symlinks?: string[] + hardlinks?: ReturnType[] + } = {} + if (this.symlinks != null) { + data.symlinks = this.symlinks + } + if (this.hardlinks != null) { + data.hardlinks = this.hardlinks.map((item: SymbolInformation) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.symlinks.length) writer.writeRepeatedString(1, this.symlinks) + if (this.hardlinks.length) + writer.writeRepeatedMessage(2, this.hardlinks, (item: SymbolInformation) => + item.serialize(writer) + ) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Scope { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Scope() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + pb_1.Message.addToRepeatedField(message, 1, reader.readString()) + break + case 2: + reader.readMessage(message.hardlinks, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 2, + SymbolInformation.deserialize(reader), + SymbolInformation + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Scope { + return Scope.deserialize(bytes) + } + } + export class Type extends pb_1.Message { + #one_of_decls: number[][] = [[2, 20, 21, 22, 23, 17, 18, 19, 7, 8, 9, 10, 13, 14, 25, 26]] + constructor( + data?: + | any[] + | ({} & ( + | { + type_ref?: TypeRef + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: SingleType + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: ThisType + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: SuperType + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: ConstantType + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: IntersectionType + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: UnionType + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: WithType + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: StructuralType + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: AnnotatedType + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: ExistentialType + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: UniversalType + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: ByNameType + repeated_type?: never + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: RepeatedType + match_type?: never + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: MatchType + lambda_type?: never + } + | { + type_ref?: never + single_type?: never + this_type?: never + super_type?: never + constant_type?: never + intersection_type?: never + union_type?: never + with_type?: never + structural_type?: never + annotated_type?: never + existential_type?: never + universal_type?: never + by_name_type?: never + repeated_type?: never + match_type?: never + lambda_type?: LambdaType + } + )) + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('type_ref' in data && data.type_ref != undefined) { + this.type_ref = data.type_ref + } + if ('single_type' in data && data.single_type != undefined) { + this.single_type = data.single_type + } + if ('this_type' in data && data.this_type != undefined) { + this.this_type = data.this_type + } + if ('super_type' in data && data.super_type != undefined) { + this.super_type = data.super_type + } + if ('constant_type' in data && data.constant_type != undefined) { + this.constant_type = data.constant_type + } + if ('intersection_type' in data && data.intersection_type != undefined) { + this.intersection_type = data.intersection_type + } + if ('union_type' in data && data.union_type != undefined) { + this.union_type = data.union_type + } + if ('with_type' in data && data.with_type != undefined) { + this.with_type = data.with_type + } + if ('structural_type' in data && data.structural_type != undefined) { + this.structural_type = data.structural_type + } + if ('annotated_type' in data && data.annotated_type != undefined) { + this.annotated_type = data.annotated_type + } + if ('existential_type' in data && data.existential_type != undefined) { + this.existential_type = data.existential_type + } + if ('universal_type' in data && data.universal_type != undefined) { + this.universal_type = data.universal_type + } + if ('by_name_type' in data && data.by_name_type != undefined) { + this.by_name_type = data.by_name_type + } + if ('repeated_type' in data && data.repeated_type != undefined) { + this.repeated_type = data.repeated_type + } + if ('match_type' in data && data.match_type != undefined) { + this.match_type = data.match_type + } + if ('lambda_type' in data && data.lambda_type != undefined) { + this.lambda_type = data.lambda_type + } + } + } + get type_ref() { + return pb_1.Message.getWrapperField(this, TypeRef, 2) as TypeRef + } + set type_ref(value: TypeRef) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[0], value) + } + get has_type_ref() { + return pb_1.Message.getField(this, 2) != null + } + get single_type() { + return pb_1.Message.getWrapperField(this, SingleType, 20) as SingleType + } + set single_type(value: SingleType) { + pb_1.Message.setOneofWrapperField(this, 20, this.#one_of_decls[0], value) + } + get has_single_type() { + return pb_1.Message.getField(this, 20) != null + } + get this_type() { + return pb_1.Message.getWrapperField(this, ThisType, 21) as ThisType + } + set this_type(value: ThisType) { + pb_1.Message.setOneofWrapperField(this, 21, this.#one_of_decls[0], value) + } + get has_this_type() { + return pb_1.Message.getField(this, 21) != null + } + get super_type() { + return pb_1.Message.getWrapperField(this, SuperType, 22) as SuperType + } + set super_type(value: SuperType) { + pb_1.Message.setOneofWrapperField(this, 22, this.#one_of_decls[0], value) + } + get has_super_type() { + return pb_1.Message.getField(this, 22) != null + } + get constant_type() { + return pb_1.Message.getWrapperField(this, ConstantType, 23) as ConstantType + } + set constant_type(value: ConstantType) { + pb_1.Message.setOneofWrapperField(this, 23, this.#one_of_decls[0], value) + } + get has_constant_type() { + return pb_1.Message.getField(this, 23) != null + } + get intersection_type() { + return pb_1.Message.getWrapperField(this, IntersectionType, 17) as IntersectionType + } + set intersection_type(value: IntersectionType) { + pb_1.Message.setOneofWrapperField(this, 17, this.#one_of_decls[0], value) + } + get has_intersection_type() { + return pb_1.Message.getField(this, 17) != null + } + get union_type() { + return pb_1.Message.getWrapperField(this, UnionType, 18) as UnionType + } + set union_type(value: UnionType) { + pb_1.Message.setOneofWrapperField(this, 18, this.#one_of_decls[0], value) + } + get has_union_type() { + return pb_1.Message.getField(this, 18) != null + } + get with_type() { + return pb_1.Message.getWrapperField(this, WithType, 19) as WithType + } + set with_type(value: WithType) { + pb_1.Message.setOneofWrapperField(this, 19, this.#one_of_decls[0], value) + } + get has_with_type() { + return pb_1.Message.getField(this, 19) != null + } + get structural_type() { + return pb_1.Message.getWrapperField(this, StructuralType, 7) as StructuralType + } + set structural_type(value: StructuralType) { + pb_1.Message.setOneofWrapperField(this, 7, this.#one_of_decls[0], value) + } + get has_structural_type() { + return pb_1.Message.getField(this, 7) != null + } + get annotated_type() { + return pb_1.Message.getWrapperField(this, AnnotatedType, 8) as AnnotatedType + } + set annotated_type(value: AnnotatedType) { + pb_1.Message.setOneofWrapperField(this, 8, this.#one_of_decls[0], value) + } + get has_annotated_type() { + return pb_1.Message.getField(this, 8) != null + } + get existential_type() { + return pb_1.Message.getWrapperField(this, ExistentialType, 9) as ExistentialType + } + set existential_type(value: ExistentialType) { + pb_1.Message.setOneofWrapperField(this, 9, this.#one_of_decls[0], value) + } + get has_existential_type() { + return pb_1.Message.getField(this, 9) != null + } + get universal_type() { + return pb_1.Message.getWrapperField(this, UniversalType, 10) as UniversalType + } + set universal_type(value: UniversalType) { + pb_1.Message.setOneofWrapperField(this, 10, this.#one_of_decls[0], value) + } + get has_universal_type() { + return pb_1.Message.getField(this, 10) != null + } + get by_name_type() { + return pb_1.Message.getWrapperField(this, ByNameType, 13) as ByNameType + } + set by_name_type(value: ByNameType) { + pb_1.Message.setOneofWrapperField(this, 13, this.#one_of_decls[0], value) + } + get has_by_name_type() { + return pb_1.Message.getField(this, 13) != null + } + get repeated_type() { + return pb_1.Message.getWrapperField(this, RepeatedType, 14) as RepeatedType + } + set repeated_type(value: RepeatedType) { + pb_1.Message.setOneofWrapperField(this, 14, this.#one_of_decls[0], value) + } + get has_repeated_type() { + return pb_1.Message.getField(this, 14) != null + } + get match_type() { + return pb_1.Message.getWrapperField(this, MatchType, 25) as MatchType + } + set match_type(value: MatchType) { + pb_1.Message.setOneofWrapperField(this, 25, this.#one_of_decls[0], value) + } + get has_match_type() { + return pb_1.Message.getField(this, 25) != null + } + get lambda_type() { + return pb_1.Message.getWrapperField(this, LambdaType, 26) as LambdaType + } + set lambda_type(value: LambdaType) { + pb_1.Message.setOneofWrapperField(this, 26, this.#one_of_decls[0], value) + } + get has_lambda_type() { + return pb_1.Message.getField(this, 26) != null + } + get sealed_value() { + const cases: { + [index: number]: + | 'none' + | 'type_ref' + | 'single_type' + | 'this_type' + | 'super_type' + | 'constant_type' + | 'intersection_type' + | 'union_type' + | 'with_type' + | 'structural_type' + | 'annotated_type' + | 'existential_type' + | 'universal_type' + | 'by_name_type' + | 'repeated_type' + | 'match_type' + | 'lambda_type' + } = { + 0: 'none', + 2: 'type_ref', + 20: 'single_type', + 21: 'this_type', + 22: 'super_type', + 23: 'constant_type', + 17: 'intersection_type', + 18: 'union_type', + 19: 'with_type', + 7: 'structural_type', + 8: 'annotated_type', + 9: 'existential_type', + 10: 'universal_type', + 13: 'by_name_type', + 14: 'repeated_type', + 25: 'match_type', + 26: 'lambda_type', + } + return cases[ + pb_1.Message.computeOneofCase( + this, + [2, 20, 21, 22, 23, 17, 18, 19, 7, 8, 9, 10, 13, 14, 25, 26] + ) + ] + } + static fromObject(data: { + type_ref?: ReturnType + single_type?: ReturnType + this_type?: ReturnType + super_type?: ReturnType + constant_type?: ReturnType + intersection_type?: ReturnType + union_type?: ReturnType + with_type?: ReturnType + structural_type?: ReturnType + annotated_type?: ReturnType + existential_type?: ReturnType + universal_type?: ReturnType + by_name_type?: ReturnType + repeated_type?: ReturnType + match_type?: ReturnType + lambda_type?: ReturnType + }): Type { + const message = new Type({}) + if (data.type_ref != null) { + message.type_ref = TypeRef.fromObject(data.type_ref) + } + if (data.single_type != null) { + message.single_type = SingleType.fromObject(data.single_type) + } + if (data.this_type != null) { + message.this_type = ThisType.fromObject(data.this_type) + } + if (data.super_type != null) { + message.super_type = SuperType.fromObject(data.super_type) + } + if (data.constant_type != null) { + message.constant_type = ConstantType.fromObject(data.constant_type) + } + if (data.intersection_type != null) { + message.intersection_type = IntersectionType.fromObject(data.intersection_type) + } + if (data.union_type != null) { + message.union_type = UnionType.fromObject(data.union_type) + } + if (data.with_type != null) { + message.with_type = WithType.fromObject(data.with_type) + } + if (data.structural_type != null) { + message.structural_type = StructuralType.fromObject(data.structural_type) + } + if (data.annotated_type != null) { + message.annotated_type = AnnotatedType.fromObject(data.annotated_type) + } + if (data.existential_type != null) { + message.existential_type = ExistentialType.fromObject(data.existential_type) + } + if (data.universal_type != null) { + message.universal_type = UniversalType.fromObject(data.universal_type) + } + if (data.by_name_type != null) { + message.by_name_type = ByNameType.fromObject(data.by_name_type) + } + if (data.repeated_type != null) { + message.repeated_type = RepeatedType.fromObject(data.repeated_type) + } + if (data.match_type != null) { + message.match_type = MatchType.fromObject(data.match_type) + } + if (data.lambda_type != null) { + message.lambda_type = LambdaType.fromObject(data.lambda_type) + } + return message + } + toObject() { + const data: { + type_ref?: ReturnType + single_type?: ReturnType + this_type?: ReturnType + super_type?: ReturnType + constant_type?: ReturnType + intersection_type?: ReturnType + union_type?: ReturnType + with_type?: ReturnType + structural_type?: ReturnType + annotated_type?: ReturnType + existential_type?: ReturnType + universal_type?: ReturnType + by_name_type?: ReturnType + repeated_type?: ReturnType + match_type?: ReturnType + lambda_type?: ReturnType + } = {} + if (this.type_ref != null) { + data.type_ref = this.type_ref.toObject() + } + if (this.single_type != null) { + data.single_type = this.single_type.toObject() + } + if (this.this_type != null) { + data.this_type = this.this_type.toObject() + } + if (this.super_type != null) { + data.super_type = this.super_type.toObject() + } + if (this.constant_type != null) { + data.constant_type = this.constant_type.toObject() + } + if (this.intersection_type != null) { + data.intersection_type = this.intersection_type.toObject() + } + if (this.union_type != null) { + data.union_type = this.union_type.toObject() + } + if (this.with_type != null) { + data.with_type = this.with_type.toObject() + } + if (this.structural_type != null) { + data.structural_type = this.structural_type.toObject() + } + if (this.annotated_type != null) { + data.annotated_type = this.annotated_type.toObject() + } + if (this.existential_type != null) { + data.existential_type = this.existential_type.toObject() + } + if (this.universal_type != null) { + data.universal_type = this.universal_type.toObject() + } + if (this.by_name_type != null) { + data.by_name_type = this.by_name_type.toObject() + } + if (this.repeated_type != null) { + data.repeated_type = this.repeated_type.toObject() + } + if (this.match_type != null) { + data.match_type = this.match_type.toObject() + } + if (this.lambda_type != null) { + data.lambda_type = this.lambda_type.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_type_ref) + writer.writeMessage(2, this.type_ref, () => this.type_ref.serialize(writer)) + if (this.has_single_type) + writer.writeMessage(20, this.single_type, () => this.single_type.serialize(writer)) + if (this.has_this_type) + writer.writeMessage(21, this.this_type, () => this.this_type.serialize(writer)) + if (this.has_super_type) + writer.writeMessage(22, this.super_type, () => this.super_type.serialize(writer)) + if (this.has_constant_type) + writer.writeMessage(23, this.constant_type, () => this.constant_type.serialize(writer)) + if (this.has_intersection_type) + writer.writeMessage(17, this.intersection_type, () => + this.intersection_type.serialize(writer) + ) + if (this.has_union_type) + writer.writeMessage(18, this.union_type, () => this.union_type.serialize(writer)) + if (this.has_with_type) + writer.writeMessage(19, this.with_type, () => this.with_type.serialize(writer)) + if (this.has_structural_type) + writer.writeMessage(7, this.structural_type, () => + this.structural_type.serialize(writer) + ) + if (this.has_annotated_type) + writer.writeMessage(8, this.annotated_type, () => this.annotated_type.serialize(writer)) + if (this.has_existential_type) + writer.writeMessage(9, this.existential_type, () => + this.existential_type.serialize(writer) + ) + if (this.has_universal_type) + writer.writeMessage(10, this.universal_type, () => this.universal_type.serialize(writer)) + if (this.has_by_name_type) + writer.writeMessage(13, this.by_name_type, () => this.by_name_type.serialize(writer)) + if (this.has_repeated_type) + writer.writeMessage(14, this.repeated_type, () => this.repeated_type.serialize(writer)) + if (this.has_match_type) + writer.writeMessage(25, this.match_type, () => this.match_type.serialize(writer)) + if (this.has_lambda_type) + writer.writeMessage(26, this.lambda_type, () => this.lambda_type.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Type { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Type() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 2: + reader.readMessage( + message.type_ref, + () => (message.type_ref = TypeRef.deserialize(reader)) + ) + break + case 20: + reader.readMessage( + message.single_type, + () => (message.single_type = SingleType.deserialize(reader)) + ) + break + case 21: + reader.readMessage( + message.this_type, + () => (message.this_type = ThisType.deserialize(reader)) + ) + break + case 22: + reader.readMessage( + message.super_type, + () => (message.super_type = SuperType.deserialize(reader)) + ) + break + case 23: + reader.readMessage( + message.constant_type, + () => (message.constant_type = ConstantType.deserialize(reader)) + ) + break + case 17: + reader.readMessage( + message.intersection_type, + () => (message.intersection_type = IntersectionType.deserialize(reader)) + ) + break + case 18: + reader.readMessage( + message.union_type, + () => (message.union_type = UnionType.deserialize(reader)) + ) + break + case 19: + reader.readMessage( + message.with_type, + () => (message.with_type = WithType.deserialize(reader)) + ) + break + case 7: + reader.readMessage( + message.structural_type, + () => (message.structural_type = StructuralType.deserialize(reader)) + ) + break + case 8: + reader.readMessage( + message.annotated_type, + () => (message.annotated_type = AnnotatedType.deserialize(reader)) + ) + break + case 9: + reader.readMessage( + message.existential_type, + () => (message.existential_type = ExistentialType.deserialize(reader)) + ) + break + case 10: + reader.readMessage( + message.universal_type, + () => (message.universal_type = UniversalType.deserialize(reader)) + ) + break + case 13: + reader.readMessage( + message.by_name_type, + () => (message.by_name_type = ByNameType.deserialize(reader)) + ) + break + case 14: + reader.readMessage( + message.repeated_type, + () => (message.repeated_type = RepeatedType.deserialize(reader)) + ) + break + case 25: + reader.readMessage( + message.match_type, + () => (message.match_type = MatchType.deserialize(reader)) + ) + break + case 26: + reader.readMessage( + message.lambda_type, + () => (message.lambda_type = LambdaType.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Type { + return Type.deserialize(bytes) + } + } + export class TypeRef extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + prefix?: Type + symbol?: string + type_arguments?: Type[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [3], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('prefix' in data && data.prefix != undefined) { + this.prefix = data.prefix + } + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + if ('type_arguments' in data && data.type_arguments != undefined) { + this.type_arguments = data.type_arguments + } + } + } + get prefix() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set prefix(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_prefix() { + return pb_1.Message.getField(this, 1) != null + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 2, value) + } + get type_arguments() { + return pb_1.Message.getRepeatedWrapperField(this, Type, 3) as Type[] + } + set type_arguments(value: Type[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value) + } + static fromObject(data: { + prefix?: ReturnType + symbol?: string + type_arguments?: ReturnType[] + }): TypeRef { + const message = new TypeRef({}) + if (data.prefix != null) { + message.prefix = Type.fromObject(data.prefix) + } + if (data.symbol != null) { + message.symbol = data.symbol + } + if (data.type_arguments != null) { + message.type_arguments = data.type_arguments.map(item => Type.fromObject(item)) + } + return message + } + toObject() { + const data: { + prefix?: ReturnType + symbol?: string + type_arguments?: ReturnType[] + } = {} + if (this.prefix != null) { + data.prefix = this.prefix.toObject() + } + if (this.symbol != null) { + data.symbol = this.symbol + } + if (this.type_arguments != null) { + data.type_arguments = this.type_arguments.map((item: Type) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_prefix) writer.writeMessage(1, this.prefix, () => this.prefix.serialize(writer)) + if (this.symbol.length) writer.writeString(2, this.symbol) + if (this.type_arguments.length) + writer.writeRepeatedMessage(3, this.type_arguments, (item: Type) => + item.serialize(writer) + ) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TypeRef { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new TypeRef() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.prefix, + () => (message.prefix = Type.deserialize(reader)) + ) + break + case 2: + message.symbol = reader.readString() + break + case 3: + reader.readMessage(message.type_arguments, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 3, + Type.deserialize(reader), + Type + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): TypeRef { + return TypeRef.deserialize(bytes) + } + } + export class SingleType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + prefix?: Type + symbol?: string + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('prefix' in data && data.prefix != undefined) { + this.prefix = data.prefix + } + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + } + } + get prefix() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set prefix(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_prefix() { + return pb_1.Message.getField(this, 1) != null + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 2, value) + } + static fromObject(data: { + prefix?: ReturnType + symbol?: string + }): SingleType { + const message = new SingleType({}) + if (data.prefix != null) { + message.prefix = Type.fromObject(data.prefix) + } + if (data.symbol != null) { + message.symbol = data.symbol + } + return message + } + toObject() { + const data: { + prefix?: ReturnType + symbol?: string + } = {} + if (this.prefix != null) { + data.prefix = this.prefix.toObject() + } + if (this.symbol != null) { + data.symbol = this.symbol + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_prefix) writer.writeMessage(1, this.prefix, () => this.prefix.serialize(writer)) + if (this.symbol.length) writer.writeString(2, this.symbol) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SingleType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new SingleType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.prefix, + () => (message.prefix = Type.deserialize(reader)) + ) + break + case 2: + message.symbol = reader.readString() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): SingleType { + return SingleType.deserialize(bytes) + } + } + export class ThisType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + symbol?: string + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + } + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + symbol?: string + }): ThisType { + const message = new ThisType({}) + if (data.symbol != null) { + message.symbol = data.symbol + } + return message + } + toObject() { + const data: { + symbol?: string + } = {} + if (this.symbol != null) { + data.symbol = this.symbol + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.symbol.length) writer.writeString(1, this.symbol) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ThisType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ThisType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.symbol = reader.readString() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ThisType { + return ThisType.deserialize(bytes) + } + } + export class SuperType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + prefix?: Type + symbol?: string + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('prefix' in data && data.prefix != undefined) { + this.prefix = data.prefix + } + if ('symbol' in data && data.symbol != undefined) { + this.symbol = data.symbol + } + } + } + get prefix() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set prefix(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_prefix() { + return pb_1.Message.getField(this, 1) != null + } + get symbol() { + return pb_1.Message.getFieldWithDefault(this, 2, '') as string + } + set symbol(value: string) { + pb_1.Message.setField(this, 2, value) + } + static fromObject(data: { + prefix?: ReturnType + symbol?: string + }): SuperType { + const message = new SuperType({}) + if (data.prefix != null) { + message.prefix = Type.fromObject(data.prefix) + } + if (data.symbol != null) { + message.symbol = data.symbol + } + return message + } + toObject() { + const data: { + prefix?: ReturnType + symbol?: string + } = {} + if (this.prefix != null) { + data.prefix = this.prefix.toObject() + } + if (this.symbol != null) { + data.symbol = this.symbol + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_prefix) writer.writeMessage(1, this.prefix, () => this.prefix.serialize(writer)) + if (this.symbol.length) writer.writeString(2, this.symbol) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): SuperType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new SuperType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.prefix, + () => (message.prefix = Type.deserialize(reader)) + ) + break + case 2: + message.symbol = reader.readString() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): SuperType { + return SuperType.deserialize(bytes) + } + } + export class ConstantType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + constant?: Constant + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('constant' in data && data.constant != undefined) { + this.constant = data.constant + } + } + } + get constant() { + return pb_1.Message.getWrapperField(this, Constant, 1) as Constant + } + set constant(value: Constant) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_constant() { + return pb_1.Message.getField(this, 1) != null + } + static fromObject(data: { + constant?: ReturnType + }): ConstantType { + const message = new ConstantType({}) + if (data.constant != null) { + message.constant = Constant.fromObject(data.constant) + } + return message + } + toObject() { + const data: { + constant?: ReturnType + } = {} + if (this.constant != null) { + data.constant = this.constant.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_constant) + writer.writeMessage(1, this.constant, () => this.constant.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ConstantType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ConstantType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.constant, + () => (message.constant = Constant.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ConstantType { + return ConstantType.deserialize(bytes) + } + } + export class IntersectionType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + types?: Type[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [1], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('types' in data && data.types != undefined) { + this.types = data.types + } + } + } + get types() { + return pb_1.Message.getRepeatedWrapperField(this, Type, 1) as Type[] + } + set types(value: Type[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value) + } + static fromObject(data: { + types?: ReturnType[] + }): IntersectionType { + const message = new IntersectionType({}) + if (data.types != null) { + message.types = data.types.map(item => Type.fromObject(item)) + } + return message + } + toObject() { + const data: { + types?: ReturnType[] + } = {} + if (this.types != null) { + data.types = this.types.map((item: Type) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.types.length) + writer.writeRepeatedMessage(1, this.types, (item: Type) => item.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IntersectionType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new IntersectionType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.types, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 1, + Type.deserialize(reader), + Type + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): IntersectionType { + return IntersectionType.deserialize(bytes) + } + } + export class UnionType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + types?: Type[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [1], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('types' in data && data.types != undefined) { + this.types = data.types + } + } + } + get types() { + return pb_1.Message.getRepeatedWrapperField(this, Type, 1) as Type[] + } + set types(value: Type[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value) + } + static fromObject(data: { + types?: ReturnType[] + }): UnionType { + const message = new UnionType({}) + if (data.types != null) { + message.types = data.types.map(item => Type.fromObject(item)) + } + return message + } + toObject() { + const data: { + types?: ReturnType[] + } = {} + if (this.types != null) { + data.types = this.types.map((item: Type) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.types.length) + writer.writeRepeatedMessage(1, this.types, (item: Type) => item.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UnionType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new UnionType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.types, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 1, + Type.deserialize(reader), + Type + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): UnionType { + return UnionType.deserialize(bytes) + } + } + export class WithType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + types?: Type[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [1], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('types' in data && data.types != undefined) { + this.types = data.types + } + } + } + get types() { + return pb_1.Message.getRepeatedWrapperField(this, Type, 1) as Type[] + } + set types(value: Type[]) { + pb_1.Message.setRepeatedWrapperField(this, 1, value) + } + static fromObject(data: { + types?: ReturnType[] + }): WithType { + const message = new WithType({}) + if (data.types != null) { + message.types = data.types.map(item => Type.fromObject(item)) + } + return message + } + toObject() { + const data: { + types?: ReturnType[] + } = {} + if (this.types != null) { + data.types = this.types.map((item: Type) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.types.length) + writer.writeRepeatedMessage(1, this.types, (item: Type) => item.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): WithType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new WithType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.types, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 1, + Type.deserialize(reader), + Type + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): WithType { + return WithType.deserialize(bytes) + } + } + export class StructuralType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + tpe?: Type + declarations?: Scope + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + if ('declarations' in data && data.declarations != undefined) { + this.declarations = data.declarations + } + } + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 4) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 4, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 4) != null + } + get declarations() { + return pb_1.Message.getWrapperField(this, Scope, 5) as Scope + } + set declarations(value: Scope) { + pb_1.Message.setWrapperField(this, 5, value) + } + get has_declarations() { + return pb_1.Message.getField(this, 5) != null + } + static fromObject(data: { + tpe?: ReturnType + declarations?: ReturnType + }): StructuralType { + const message = new StructuralType({}) + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + if (data.declarations != null) { + message.declarations = Scope.fromObject(data.declarations) + } + return message + } + toObject() { + const data: { + tpe?: ReturnType + declarations?: ReturnType + } = {} + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + if (this.declarations != null) { + data.declarations = this.declarations.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_tpe) writer.writeMessage(4, this.tpe, () => this.tpe.serialize(writer)) + if (this.has_declarations) + writer.writeMessage(5, this.declarations, () => this.declarations.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StructuralType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new StructuralType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 4: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + case 5: + reader.readMessage( + message.declarations, + () => (message.declarations = Scope.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): StructuralType { + return StructuralType.deserialize(bytes) + } + } + export class AnnotatedType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + annotations?: Annotation[] + tpe?: Type + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [3], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('annotations' in data && data.annotations != undefined) { + this.annotations = data.annotations + } + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + } + } + get annotations() { + return pb_1.Message.getRepeatedWrapperField(this, Annotation, 3) as Annotation[] + } + set annotations(value: Annotation[]) { + pb_1.Message.setRepeatedWrapperField(this, 3, value) + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 1) != null + } + static fromObject(data: { + annotations?: ReturnType[] + tpe?: ReturnType + }): AnnotatedType { + const message = new AnnotatedType({}) + if (data.annotations != null) { + message.annotations = data.annotations.map(item => Annotation.fromObject(item)) + } + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + return message + } + toObject() { + const data: { + annotations?: ReturnType[] + tpe?: ReturnType + } = {} + if (this.annotations != null) { + data.annotations = this.annotations.map((item: Annotation) => item.toObject()) + } + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.annotations.length) + writer.writeRepeatedMessage(3, this.annotations, (item: Annotation) => + item.serialize(writer) + ) + if (this.has_tpe) writer.writeMessage(1, this.tpe, () => this.tpe.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): AnnotatedType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new AnnotatedType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 3: + reader.readMessage(message.annotations, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 3, + Annotation.deserialize(reader), + Annotation + ) + ) + break + case 1: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): AnnotatedType { + return AnnotatedType.deserialize(bytes) + } + } + export class ExistentialType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + tpe?: Type + declarations?: Scope + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + if ('declarations' in data && data.declarations != undefined) { + this.declarations = data.declarations + } + } + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 1) != null + } + get declarations() { + return pb_1.Message.getWrapperField(this, Scope, 3) as Scope + } + set declarations(value: Scope) { + pb_1.Message.setWrapperField(this, 3, value) + } + get has_declarations() { + return pb_1.Message.getField(this, 3) != null + } + static fromObject(data: { + tpe?: ReturnType + declarations?: ReturnType + }): ExistentialType { + const message = new ExistentialType({}) + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + if (data.declarations != null) { + message.declarations = Scope.fromObject(data.declarations) + } + return message + } + toObject() { + const data: { + tpe?: ReturnType + declarations?: ReturnType + } = {} + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + if (this.declarations != null) { + data.declarations = this.declarations.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_tpe) writer.writeMessage(1, this.tpe, () => this.tpe.serialize(writer)) + if (this.has_declarations) + writer.writeMessage(3, this.declarations, () => this.declarations.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ExistentialType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ExistentialType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + case 3: + reader.readMessage( + message.declarations, + () => (message.declarations = Scope.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ExistentialType { + return ExistentialType.deserialize(bytes) + } + } + export class UniversalType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + type_parameters?: Scope + tpe?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('type_parameters' in data && data.type_parameters != undefined) { + this.type_parameters = data.type_parameters + } + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + } + } + get type_parameters() { + return pb_1.Message.getWrapperField(this, Scope, 3) as Scope + } + set type_parameters(value: Scope) { + pb_1.Message.setWrapperField(this, 3, value) + } + get has_type_parameters() { + return pb_1.Message.getField(this, 3) != null + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 2) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 2, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 2) != null + } + static fromObject(data: { + type_parameters?: ReturnType + tpe?: ReturnType + }): UniversalType { + const message = new UniversalType({}) + if (data.type_parameters != null) { + message.type_parameters = Scope.fromObject(data.type_parameters) + } + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + return message + } + toObject() { + const data: { + type_parameters?: ReturnType + tpe?: ReturnType + } = {} + if (this.type_parameters != null) { + data.type_parameters = this.type_parameters.toObject() + } + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_type_parameters) + writer.writeMessage(3, this.type_parameters, () => + this.type_parameters.serialize(writer) + ) + if (this.has_tpe) writer.writeMessage(2, this.tpe, () => this.tpe.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UniversalType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new UniversalType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 3: + reader.readMessage( + message.type_parameters, + () => (message.type_parameters = Scope.deserialize(reader)) + ) + break + case 2: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): UniversalType { + return UniversalType.deserialize(bytes) + } + } + export class ByNameType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + tpe?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + } + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 1) != null + } + static fromObject(data: { + tpe?: ReturnType + }): ByNameType { + const message = new ByNameType({}) + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + return message + } + toObject() { + const data: { + tpe?: ReturnType + } = {} + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_tpe) writer.writeMessage(1, this.tpe, () => this.tpe.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ByNameType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ByNameType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ByNameType { + return ByNameType.deserialize(bytes) + } + } + export class RepeatedType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + tpe?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + } + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 1) != null + } + static fromObject(data: { + tpe?: ReturnType + }): RepeatedType { + const message = new RepeatedType({}) + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + return message + } + toObject() { + const data: { + tpe?: ReturnType + } = {} + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_tpe) writer.writeMessage(1, this.tpe, () => this.tpe.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): RepeatedType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new RepeatedType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): RepeatedType { + return RepeatedType.deserialize(bytes) + } + } + export class MatchType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + scrutinee?: Type + cases?: MatchType.CaseType[] + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [2], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('scrutinee' in data && data.scrutinee != undefined) { + this.scrutinee = data.scrutinee + } + if ('cases' in data && data.cases != undefined) { + this.cases = data.cases + } + } + } + get scrutinee() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set scrutinee(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_scrutinee() { + return pb_1.Message.getField(this, 1) != null + } + get cases() { + return pb_1.Message.getRepeatedWrapperField( + this, + MatchType.CaseType, + 2 + ) as MatchType.CaseType[] + } + set cases(value: MatchType.CaseType[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value) + } + static fromObject(data: { + scrutinee?: ReturnType + cases?: ReturnType[] + }): MatchType { + const message = new MatchType({}) + if (data.scrutinee != null) { + message.scrutinee = Type.fromObject(data.scrutinee) + } + if (data.cases != null) { + message.cases = data.cases.map(item => MatchType.CaseType.fromObject(item)) + } + return message + } + toObject() { + const data: { + scrutinee?: ReturnType + cases?: ReturnType[] + } = {} + if (this.scrutinee != null) { + data.scrutinee = this.scrutinee.toObject() + } + if (this.cases != null) { + data.cases = this.cases.map((item: MatchType.CaseType) => item.toObject()) + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_scrutinee) + writer.writeMessage(1, this.scrutinee, () => this.scrutinee.serialize(writer)) + if (this.cases.length) + writer.writeRepeatedMessage(2, this.cases, (item: MatchType.CaseType) => + item.serialize(writer) + ) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MatchType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new MatchType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.scrutinee, + () => (message.scrutinee = Type.deserialize(reader)) + ) + break + case 2: + reader.readMessage(message.cases, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 2, + MatchType.CaseType.deserialize(reader), + MatchType.CaseType + ) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): MatchType { + return MatchType.deserialize(bytes) + } + } + export namespace MatchType { + export class CaseType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + key?: Type + body?: Type + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('key' in data && data.key != undefined) { + this.key = data.key + } + if ('body' in data && data.body != undefined) { + this.body = data.body + } + } + } + get key() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set key(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_key() { + return pb_1.Message.getField(this, 1) != null + } + get body() { + return pb_1.Message.getWrapperField(this, Type, 2) as Type + } + set body(value: Type) { + pb_1.Message.setWrapperField(this, 2, value) + } + get has_body() { + return pb_1.Message.getField(this, 2) != null + } + static fromObject(data: { + key?: ReturnType + body?: ReturnType + }): CaseType { + const message = new CaseType({}) + if (data.key != null) { + message.key = Type.fromObject(data.key) + } + if (data.body != null) { + message.body = Type.fromObject(data.body) + } + return message + } + toObject() { + const data: { + key?: ReturnType + body?: ReturnType + } = {} + if (this.key != null) { + data.key = this.key.toObject() + } + if (this.body != null) { + data.body = this.body.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_key) writer.writeMessage(1, this.key, () => this.key.serialize(writer)) + if (this.has_body) writer.writeMessage(2, this.body, () => this.body.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CaseType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new CaseType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.key, + () => (message.key = Type.deserialize(reader)) + ) + break + case 2: + reader.readMessage( + message.body, + () => (message.body = Type.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): CaseType { + return CaseType.deserialize(bytes) + } + } + } + export class LambdaType extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + type_parameters?: Scope + parameters?: Scope + return_type?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('type_parameters' in data && data.type_parameters != undefined) { + this.type_parameters = data.type_parameters + } + if ('parameters' in data && data.parameters != undefined) { + this.parameters = data.parameters + } + if ('return_type' in data && data.return_type != undefined) { + this.return_type = data.return_type + } + } + } + get type_parameters() { + return pb_1.Message.getWrapperField(this, Scope, 3) as Scope + } + set type_parameters(value: Scope) { + pb_1.Message.setWrapperField(this, 3, value) + } + get has_type_parameters() { + return pb_1.Message.getField(this, 3) != null + } + get parameters() { + return pb_1.Message.getWrapperField(this, Scope, 1) as Scope + } + set parameters(value: Scope) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_parameters() { + return pb_1.Message.getField(this, 1) != null + } + get return_type() { + return pb_1.Message.getWrapperField(this, Type, 2) as Type + } + set return_type(value: Type) { + pb_1.Message.setWrapperField(this, 2, value) + } + get has_return_type() { + return pb_1.Message.getField(this, 2) != null + } + static fromObject(data: { + type_parameters?: ReturnType + parameters?: ReturnType + return_type?: ReturnType + }): LambdaType { + const message = new LambdaType({}) + if (data.type_parameters != null) { + message.type_parameters = Scope.fromObject(data.type_parameters) + } + if (data.parameters != null) { + message.parameters = Scope.fromObject(data.parameters) + } + if (data.return_type != null) { + message.return_type = Type.fromObject(data.return_type) + } + return message + } + toObject() { + const data: { + type_parameters?: ReturnType + parameters?: ReturnType + return_type?: ReturnType + } = {} + if (this.type_parameters != null) { + data.type_parameters = this.type_parameters.toObject() + } + if (this.parameters != null) { + data.parameters = this.parameters.toObject() + } + if (this.return_type != null) { + data.return_type = this.return_type.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_type_parameters) + writer.writeMessage(3, this.type_parameters, () => + this.type_parameters.serialize(writer) + ) + if (this.has_parameters) + writer.writeMessage(1, this.parameters, () => this.parameters.serialize(writer)) + if (this.has_return_type) + writer.writeMessage(2, this.return_type, () => this.return_type.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LambdaType { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new LambdaType() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 3: + reader.readMessage( + message.type_parameters, + () => (message.type_parameters = Scope.deserialize(reader)) + ) + break + case 1: + reader.readMessage( + message.parameters, + () => (message.parameters = Scope.deserialize(reader)) + ) + break + case 2: + reader.readMessage( + message.return_type, + () => (message.return_type = Type.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): LambdaType { + return LambdaType.deserialize(bytes) + } + } + export class Constant extends pb_1.Message { + #one_of_decls: number[][] = [[1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11]] + constructor( + data?: + | any[] + | ({} & ( + | { + unit_constant?: UnitConstant + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: BooleanConstant + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: ByteConstant + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: ShortConstant + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: CharConstant + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: IntConstant + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: LongConstant + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: FloatConstant + double_constant?: never + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: DoubleConstant + string_constant?: never + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: StringConstant + null_constant?: never + } + | { + unit_constant?: never + boolean_constant?: never + byte_constant?: never + short_constant?: never + char_constant?: never + int_constant?: never + long_constant?: never + float_constant?: never + double_constant?: never + string_constant?: never + null_constant?: NullConstant + } + )) + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('unit_constant' in data && data.unit_constant != undefined) { + this.unit_constant = data.unit_constant + } + if ('boolean_constant' in data && data.boolean_constant != undefined) { + this.boolean_constant = data.boolean_constant + } + if ('byte_constant' in data && data.byte_constant != undefined) { + this.byte_constant = data.byte_constant + } + if ('short_constant' in data && data.short_constant != undefined) { + this.short_constant = data.short_constant + } + if ('char_constant' in data && data.char_constant != undefined) { + this.char_constant = data.char_constant + } + if ('int_constant' in data && data.int_constant != undefined) { + this.int_constant = data.int_constant + } + if ('long_constant' in data && data.long_constant != undefined) { + this.long_constant = data.long_constant + } + if ('float_constant' in data && data.float_constant != undefined) { + this.float_constant = data.float_constant + } + if ('double_constant' in data && data.double_constant != undefined) { + this.double_constant = data.double_constant + } + if ('string_constant' in data && data.string_constant != undefined) { + this.string_constant = data.string_constant + } + if ('null_constant' in data && data.null_constant != undefined) { + this.null_constant = data.null_constant + } + } + } + get unit_constant() { + return pb_1.Message.getWrapperField(this, UnitConstant, 1) as UnitConstant + } + set unit_constant(value: UnitConstant) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value) + } + get has_unit_constant() { + return pb_1.Message.getField(this, 1) != null + } + get boolean_constant() { + return pb_1.Message.getWrapperField(this, BooleanConstant, 2) as BooleanConstant + } + set boolean_constant(value: BooleanConstant) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[0], value) + } + get has_boolean_constant() { + return pb_1.Message.getField(this, 2) != null + } + get byte_constant() { + return pb_1.Message.getWrapperField(this, ByteConstant, 3) as ByteConstant + } + set byte_constant(value: ByteConstant) { + pb_1.Message.setOneofWrapperField(this, 3, this.#one_of_decls[0], value) + } + get has_byte_constant() { + return pb_1.Message.getField(this, 3) != null + } + get short_constant() { + return pb_1.Message.getWrapperField(this, ShortConstant, 4) as ShortConstant + } + set short_constant(value: ShortConstant) { + pb_1.Message.setOneofWrapperField(this, 4, this.#one_of_decls[0], value) + } + get has_short_constant() { + return pb_1.Message.getField(this, 4) != null + } + get char_constant() { + return pb_1.Message.getWrapperField(this, CharConstant, 5) as CharConstant + } + set char_constant(value: CharConstant) { + pb_1.Message.setOneofWrapperField(this, 5, this.#one_of_decls[0], value) + } + get has_char_constant() { + return pb_1.Message.getField(this, 5) != null + } + get int_constant() { + return pb_1.Message.getWrapperField(this, IntConstant, 6) as IntConstant + } + set int_constant(value: IntConstant) { + pb_1.Message.setOneofWrapperField(this, 6, this.#one_of_decls[0], value) + } + get has_int_constant() { + return pb_1.Message.getField(this, 6) != null + } + get long_constant() { + return pb_1.Message.getWrapperField(this, LongConstant, 7) as LongConstant + } + set long_constant(value: LongConstant) { + pb_1.Message.setOneofWrapperField(this, 7, this.#one_of_decls[0], value) + } + get has_long_constant() { + return pb_1.Message.getField(this, 7) != null + } + get float_constant() { + return pb_1.Message.getWrapperField(this, FloatConstant, 8) as FloatConstant + } + set float_constant(value: FloatConstant) { + pb_1.Message.setOneofWrapperField(this, 8, this.#one_of_decls[0], value) + } + get has_float_constant() { + return pb_1.Message.getField(this, 8) != null + } + get double_constant() { + return pb_1.Message.getWrapperField(this, DoubleConstant, 9) as DoubleConstant + } + set double_constant(value: DoubleConstant) { + pb_1.Message.setOneofWrapperField(this, 9, this.#one_of_decls[0], value) + } + get has_double_constant() { + return pb_1.Message.getField(this, 9) != null + } + get string_constant() { + return pb_1.Message.getWrapperField(this, StringConstant, 10) as StringConstant + } + set string_constant(value: StringConstant) { + pb_1.Message.setOneofWrapperField(this, 10, this.#one_of_decls[0], value) + } + get has_string_constant() { + return pb_1.Message.getField(this, 10) != null + } + get null_constant() { + return pb_1.Message.getWrapperField(this, NullConstant, 11) as NullConstant + } + set null_constant(value: NullConstant) { + pb_1.Message.setOneofWrapperField(this, 11, this.#one_of_decls[0], value) + } + get has_null_constant() { + return pb_1.Message.getField(this, 11) != null + } + get sealed_value() { + const cases: { + [index: number]: + | 'none' + | 'unit_constant' + | 'boolean_constant' + | 'byte_constant' + | 'short_constant' + | 'char_constant' + | 'int_constant' + | 'long_constant' + | 'float_constant' + | 'double_constant' + | 'string_constant' + | 'null_constant' + } = { + 0: 'none', + 1: 'unit_constant', + 2: 'boolean_constant', + 3: 'byte_constant', + 4: 'short_constant', + 5: 'char_constant', + 6: 'int_constant', + 7: 'long_constant', + 8: 'float_constant', + 9: 'double_constant', + 10: 'string_constant', + 11: 'null_constant', + } + return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11])] + } + static fromObject(data: { + unit_constant?: ReturnType + boolean_constant?: ReturnType + byte_constant?: ReturnType + short_constant?: ReturnType + char_constant?: ReturnType + int_constant?: ReturnType + long_constant?: ReturnType + float_constant?: ReturnType + double_constant?: ReturnType + string_constant?: ReturnType + null_constant?: ReturnType + }): Constant { + const message = new Constant({}) + if (data.unit_constant != null) { + message.unit_constant = UnitConstant.fromObject(data.unit_constant) + } + if (data.boolean_constant != null) { + message.boolean_constant = BooleanConstant.fromObject(data.boolean_constant) + } + if (data.byte_constant != null) { + message.byte_constant = ByteConstant.fromObject(data.byte_constant) + } + if (data.short_constant != null) { + message.short_constant = ShortConstant.fromObject(data.short_constant) + } + if (data.char_constant != null) { + message.char_constant = CharConstant.fromObject(data.char_constant) + } + if (data.int_constant != null) { + message.int_constant = IntConstant.fromObject(data.int_constant) + } + if (data.long_constant != null) { + message.long_constant = LongConstant.fromObject(data.long_constant) + } + if (data.float_constant != null) { + message.float_constant = FloatConstant.fromObject(data.float_constant) + } + if (data.double_constant != null) { + message.double_constant = DoubleConstant.fromObject(data.double_constant) + } + if (data.string_constant != null) { + message.string_constant = StringConstant.fromObject(data.string_constant) + } + if (data.null_constant != null) { + message.null_constant = NullConstant.fromObject(data.null_constant) + } + return message + } + toObject() { + const data: { + unit_constant?: ReturnType + boolean_constant?: ReturnType + byte_constant?: ReturnType + short_constant?: ReturnType + char_constant?: ReturnType + int_constant?: ReturnType + long_constant?: ReturnType + float_constant?: ReturnType + double_constant?: ReturnType + string_constant?: ReturnType + null_constant?: ReturnType + } = {} + if (this.unit_constant != null) { + data.unit_constant = this.unit_constant.toObject() + } + if (this.boolean_constant != null) { + data.boolean_constant = this.boolean_constant.toObject() + } + if (this.byte_constant != null) { + data.byte_constant = this.byte_constant.toObject() + } + if (this.short_constant != null) { + data.short_constant = this.short_constant.toObject() + } + if (this.char_constant != null) { + data.char_constant = this.char_constant.toObject() + } + if (this.int_constant != null) { + data.int_constant = this.int_constant.toObject() + } + if (this.long_constant != null) { + data.long_constant = this.long_constant.toObject() + } + if (this.float_constant != null) { + data.float_constant = this.float_constant.toObject() + } + if (this.double_constant != null) { + data.double_constant = this.double_constant.toObject() + } + if (this.string_constant != null) { + data.string_constant = this.string_constant.toObject() + } + if (this.null_constant != null) { + data.null_constant = this.null_constant.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_unit_constant) + writer.writeMessage(1, this.unit_constant, () => this.unit_constant.serialize(writer)) + if (this.has_boolean_constant) + writer.writeMessage(2, this.boolean_constant, () => + this.boolean_constant.serialize(writer) + ) + if (this.has_byte_constant) + writer.writeMessage(3, this.byte_constant, () => this.byte_constant.serialize(writer)) + if (this.has_short_constant) + writer.writeMessage(4, this.short_constant, () => this.short_constant.serialize(writer)) + if (this.has_char_constant) + writer.writeMessage(5, this.char_constant, () => this.char_constant.serialize(writer)) + if (this.has_int_constant) + writer.writeMessage(6, this.int_constant, () => this.int_constant.serialize(writer)) + if (this.has_long_constant) + writer.writeMessage(7, this.long_constant, () => this.long_constant.serialize(writer)) + if (this.has_float_constant) + writer.writeMessage(8, this.float_constant, () => this.float_constant.serialize(writer)) + if (this.has_double_constant) + writer.writeMessage(9, this.double_constant, () => + this.double_constant.serialize(writer) + ) + if (this.has_string_constant) + writer.writeMessage(10, this.string_constant, () => + this.string_constant.serialize(writer) + ) + if (this.has_null_constant) + writer.writeMessage(11, this.null_constant, () => this.null_constant.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Constant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Constant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.unit_constant, + () => (message.unit_constant = UnitConstant.deserialize(reader)) + ) + break + case 2: + reader.readMessage( + message.boolean_constant, + () => (message.boolean_constant = BooleanConstant.deserialize(reader)) + ) + break + case 3: + reader.readMessage( + message.byte_constant, + () => (message.byte_constant = ByteConstant.deserialize(reader)) + ) + break + case 4: + reader.readMessage( + message.short_constant, + () => (message.short_constant = ShortConstant.deserialize(reader)) + ) + break + case 5: + reader.readMessage( + message.char_constant, + () => (message.char_constant = CharConstant.deserialize(reader)) + ) + break + case 6: + reader.readMessage( + message.int_constant, + () => (message.int_constant = IntConstant.deserialize(reader)) + ) + break + case 7: + reader.readMessage( + message.long_constant, + () => (message.long_constant = LongConstant.deserialize(reader)) + ) + break + case 8: + reader.readMessage( + message.float_constant, + () => (message.float_constant = FloatConstant.deserialize(reader)) + ) + break + case 9: + reader.readMessage( + message.double_constant, + () => (message.double_constant = DoubleConstant.deserialize(reader)) + ) + break + case 10: + reader.readMessage( + message.string_constant, + () => (message.string_constant = StringConstant.deserialize(reader)) + ) + break + case 11: + reader.readMessage( + message.null_constant, + () => (message.null_constant = NullConstant.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Constant { + return Constant.deserialize(bytes) + } + } + export class UnitConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor(data?: any[] | {}) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + } + } + static fromObject(data: {}): UnitConstant { + const message = new UnitConstant({}) + return message + } + toObject() { + const data: {} = {} + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): UnitConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new UnitConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): UnitConstant { + return UnitConstant.deserialize(bytes) + } + } + export class BooleanConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: boolean + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, false) as boolean + } + set value(value: boolean) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: boolean + }): BooleanConstant { + const message = new BooleanConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: boolean + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != false) writer.writeBool(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): BooleanConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new BooleanConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readBool() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): BooleanConstant { + return BooleanConstant.deserialize(bytes) + } + } + export class ByteConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): ByteConstant { + const message = new ByteConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeInt32(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ByteConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ByteConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readInt32() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ByteConstant { + return ByteConstant.deserialize(bytes) + } + } + export class ShortConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): ShortConstant { + const message = new ShortConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeInt32(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ShortConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ShortConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readInt32() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ShortConstant { + return ShortConstant.deserialize(bytes) + } + } + export class CharConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): CharConstant { + const message = new CharConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeInt32(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): CharConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new CharConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readInt32() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): CharConstant { + return CharConstant.deserialize(bytes) + } + } + export class IntConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): IntConstant { + const message = new IntConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeInt32(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): IntConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new IntConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readInt32() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): IntConstant { + return IntConstant.deserialize(bytes) + } + } + export class LongConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): LongConstant { + const message = new LongConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeInt64(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): LongConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new LongConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readInt64() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): LongConstant { + return LongConstant.deserialize(bytes) + } + } + export class FloatConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): FloatConstant { + const message = new FloatConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeFloat(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): FloatConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new FloatConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readFloat() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): FloatConstant { + return FloatConstant.deserialize(bytes) + } + } + export class DoubleConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: number + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, 0) as number + } + set value(value: number) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: number + }): DoubleConstant { + const message = new DoubleConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: number + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value != 0) writer.writeDouble(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): DoubleConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new DoubleConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readDouble() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): DoubleConstant { + return DoubleConstant.deserialize(bytes) + } + } + export class StringConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + value?: string + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('value' in data && data.value != undefined) { + this.value = data.value + } + } + } + get value() { + return pb_1.Message.getFieldWithDefault(this, 1, '') as string + } + set value(value: string) { + pb_1.Message.setField(this, 1, value) + } + static fromObject(data: { + value?: string + }): StringConstant { + const message = new StringConstant({}) + if (data.value != null) { + message.value = data.value + } + return message + } + toObject() { + const data: { + value?: string + } = {} + if (this.value != null) { + data.value = this.value + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.value.length) writer.writeString(1, this.value) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): StringConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new StringConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + message.value = reader.readString() + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): StringConstant { + return StringConstant.deserialize(bytes) + } + } + export class NullConstant extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor(data?: any[] | {}) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + } + } + static fromObject(data: {}): NullConstant { + const message = new NullConstant({}) + return message + } + toObject() { + const data: {} = {} + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): NullConstant { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new NullConstant() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): NullConstant { + return NullConstant.deserialize(bytes) + } + } + export class Signature extends pb_1.Message { + #one_of_decls: number[][] = [[1, 2, 3, 4]] + constructor( + data?: + | any[] + | ({} & ( + | { + class_signature?: ClassSignature + method_signature?: never + type_signature?: never + value_signature?: never + } + | { + class_signature?: never + method_signature?: MethodSignature + type_signature?: never + value_signature?: never + } + | { + class_signature?: never + method_signature?: never + type_signature?: TypeSignature + value_signature?: never + } + | { + class_signature?: never + method_signature?: never + type_signature?: never + value_signature?: ValueSignature + } + )) + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('class_signature' in data && data.class_signature != undefined) { + this.class_signature = data.class_signature + } + if ('method_signature' in data && data.method_signature != undefined) { + this.method_signature = data.method_signature + } + if ('type_signature' in data && data.type_signature != undefined) { + this.type_signature = data.type_signature + } + if ('value_signature' in data && data.value_signature != undefined) { + this.value_signature = data.value_signature + } + } + } + get class_signature() { + return pb_1.Message.getWrapperField(this, ClassSignature, 1) as ClassSignature + } + set class_signature(value: ClassSignature) { + pb_1.Message.setOneofWrapperField(this, 1, this.#one_of_decls[0], value) + } + get has_class_signature() { + return pb_1.Message.getField(this, 1) != null + } + get method_signature() { + return pb_1.Message.getWrapperField(this, MethodSignature, 2) as MethodSignature + } + set method_signature(value: MethodSignature) { + pb_1.Message.setOneofWrapperField(this, 2, this.#one_of_decls[0], value) + } + get has_method_signature() { + return pb_1.Message.getField(this, 2) != null + } + get type_signature() { + return pb_1.Message.getWrapperField(this, TypeSignature, 3) as TypeSignature + } + set type_signature(value: TypeSignature) { + pb_1.Message.setOneofWrapperField(this, 3, this.#one_of_decls[0], value) + } + get has_type_signature() { + return pb_1.Message.getField(this, 3) != null + } + get value_signature() { + return pb_1.Message.getWrapperField(this, ValueSignature, 4) as ValueSignature + } + set value_signature(value: ValueSignature) { + pb_1.Message.setOneofWrapperField(this, 4, this.#one_of_decls[0], value) + } + get has_value_signature() { + return pb_1.Message.getField(this, 4) != null + } + get sealed_value() { + const cases: { + [index: number]: + | 'none' + | 'class_signature' + | 'method_signature' + | 'type_signature' + | 'value_signature' + } = { + 0: 'none', + 1: 'class_signature', + 2: 'method_signature', + 3: 'type_signature', + 4: 'value_signature', + } + return cases[pb_1.Message.computeOneofCase(this, [1, 2, 3, 4])] + } + static fromObject(data: { + class_signature?: ReturnType + method_signature?: ReturnType + type_signature?: ReturnType + value_signature?: ReturnType + }): Signature { + const message = new Signature({}) + if (data.class_signature != null) { + message.class_signature = ClassSignature.fromObject(data.class_signature) + } + if (data.method_signature != null) { + message.method_signature = MethodSignature.fromObject(data.method_signature) + } + if (data.type_signature != null) { + message.type_signature = TypeSignature.fromObject(data.type_signature) + } + if (data.value_signature != null) { + message.value_signature = ValueSignature.fromObject(data.value_signature) + } + return message + } + toObject() { + const data: { + class_signature?: ReturnType + method_signature?: ReturnType + type_signature?: ReturnType + value_signature?: ReturnType + } = {} + if (this.class_signature != null) { + data.class_signature = this.class_signature.toObject() + } + if (this.method_signature != null) { + data.method_signature = this.method_signature.toObject() + } + if (this.type_signature != null) { + data.type_signature = this.type_signature.toObject() + } + if (this.value_signature != null) { + data.value_signature = this.value_signature.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_class_signature) + writer.writeMessage(1, this.class_signature, () => + this.class_signature.serialize(writer) + ) + if (this.has_method_signature) + writer.writeMessage(2, this.method_signature, () => + this.method_signature.serialize(writer) + ) + if (this.has_type_signature) + writer.writeMessage(3, this.type_signature, () => this.type_signature.serialize(writer)) + if (this.has_value_signature) + writer.writeMessage(4, this.value_signature, () => + this.value_signature.serialize(writer) + ) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): Signature { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new Signature() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.class_signature, + () => (message.class_signature = ClassSignature.deserialize(reader)) + ) + break + case 2: + reader.readMessage( + message.method_signature, + () => (message.method_signature = MethodSignature.deserialize(reader)) + ) + break + case 3: + reader.readMessage( + message.type_signature, + () => (message.type_signature = TypeSignature.deserialize(reader)) + ) + break + case 4: + reader.readMessage( + message.value_signature, + () => (message.value_signature = ValueSignature.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): Signature { + return Signature.deserialize(bytes) + } + } + export class ClassSignature extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + type_parameters?: Scope + parents?: Type[] + self?: Type + declarations?: Scope + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [2], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('type_parameters' in data && data.type_parameters != undefined) { + this.type_parameters = data.type_parameters + } + if ('parents' in data && data.parents != undefined) { + this.parents = data.parents + } + if ('self' in data && data.self != undefined) { + this.self = data.self + } + if ('declarations' in data && data.declarations != undefined) { + this.declarations = data.declarations + } + } + } + get type_parameters() { + return pb_1.Message.getWrapperField(this, Scope, 1) as Scope + } + set type_parameters(value: Scope) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_type_parameters() { + return pb_1.Message.getField(this, 1) != null + } + get parents() { + return pb_1.Message.getRepeatedWrapperField(this, Type, 2) as Type[] + } + set parents(value: Type[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value) + } + get self() { + return pb_1.Message.getWrapperField(this, Type, 3) as Type + } + set self(value: Type) { + pb_1.Message.setWrapperField(this, 3, value) + } + get has_self() { + return pb_1.Message.getField(this, 3) != null + } + get declarations() { + return pb_1.Message.getWrapperField(this, Scope, 4) as Scope + } + set declarations(value: Scope) { + pb_1.Message.setWrapperField(this, 4, value) + } + get has_declarations() { + return pb_1.Message.getField(this, 4) != null + } + static fromObject(data: { + type_parameters?: ReturnType + parents?: ReturnType[] + self?: ReturnType + declarations?: ReturnType + }): ClassSignature { + const message = new ClassSignature({}) + if (data.type_parameters != null) { + message.type_parameters = Scope.fromObject(data.type_parameters) + } + if (data.parents != null) { + message.parents = data.parents.map(item => Type.fromObject(item)) + } + if (data.self != null) { + message.self = Type.fromObject(data.self) + } + if (data.declarations != null) { + message.declarations = Scope.fromObject(data.declarations) + } + return message + } + toObject() { + const data: { + type_parameters?: ReturnType + parents?: ReturnType[] + self?: ReturnType + declarations?: ReturnType + } = {} + if (this.type_parameters != null) { + data.type_parameters = this.type_parameters.toObject() + } + if (this.parents != null) { + data.parents = this.parents.map((item: Type) => item.toObject()) + } + if (this.self != null) { + data.self = this.self.toObject() + } + if (this.declarations != null) { + data.declarations = this.declarations.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_type_parameters) + writer.writeMessage(1, this.type_parameters, () => + this.type_parameters.serialize(writer) + ) + if (this.parents.length) + writer.writeRepeatedMessage(2, this.parents, (item: Type) => item.serialize(writer)) + if (this.has_self) writer.writeMessage(3, this.self, () => this.self.serialize(writer)) + if (this.has_declarations) + writer.writeMessage(4, this.declarations, () => this.declarations.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ClassSignature { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ClassSignature() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.type_parameters, + () => (message.type_parameters = Scope.deserialize(reader)) + ) + break + case 2: + reader.readMessage(message.parents, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 2, + Type.deserialize(reader), + Type + ) + ) + break + case 3: + reader.readMessage(message.self, () => (message.self = Type.deserialize(reader))) + break + case 4: + reader.readMessage( + message.declarations, + () => (message.declarations = Scope.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ClassSignature { + return ClassSignature.deserialize(bytes) + } + } + export class MethodSignature extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + type_parameters?: Scope + parameter_lists?: Scope[] + return_type?: Type + } + ) { + super() + pb_1.Message.initialize( + this, + Array.isArray(data) ? data : [], + 0, + -1, + [2], + this.#one_of_decls + ) + if (!Array.isArray(data) && typeof data == 'object') { + if ('type_parameters' in data && data.type_parameters != undefined) { + this.type_parameters = data.type_parameters + } + if ('parameter_lists' in data && data.parameter_lists != undefined) { + this.parameter_lists = data.parameter_lists + } + if ('return_type' in data && data.return_type != undefined) { + this.return_type = data.return_type + } + } + } + get type_parameters() { + return pb_1.Message.getWrapperField(this, Scope, 1) as Scope + } + set type_parameters(value: Scope) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_type_parameters() { + return pb_1.Message.getField(this, 1) != null + } + get parameter_lists() { + return pb_1.Message.getRepeatedWrapperField(this, Scope, 2) as Scope[] + } + set parameter_lists(value: Scope[]) { + pb_1.Message.setRepeatedWrapperField(this, 2, value) + } + get return_type() { + return pb_1.Message.getWrapperField(this, Type, 3) as Type + } + set return_type(value: Type) { + pb_1.Message.setWrapperField(this, 3, value) + } + get has_return_type() { + return pb_1.Message.getField(this, 3) != null + } + static fromObject(data: { + type_parameters?: ReturnType + parameter_lists?: ReturnType[] + return_type?: ReturnType + }): MethodSignature { + const message = new MethodSignature({}) + if (data.type_parameters != null) { + message.type_parameters = Scope.fromObject(data.type_parameters) + } + if (data.parameter_lists != null) { + message.parameter_lists = data.parameter_lists.map(item => Scope.fromObject(item)) + } + if (data.return_type != null) { + message.return_type = Type.fromObject(data.return_type) + } + return message + } + toObject() { + const data: { + type_parameters?: ReturnType + parameter_lists?: ReturnType[] + return_type?: ReturnType + } = {} + if (this.type_parameters != null) { + data.type_parameters = this.type_parameters.toObject() + } + if (this.parameter_lists != null) { + data.parameter_lists = this.parameter_lists.map((item: Scope) => item.toObject()) + } + if (this.return_type != null) { + data.return_type = this.return_type.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_type_parameters) + writer.writeMessage(1, this.type_parameters, () => + this.type_parameters.serialize(writer) + ) + if (this.parameter_lists.length) + writer.writeRepeatedMessage(2, this.parameter_lists, (item: Scope) => + item.serialize(writer) + ) + if (this.has_return_type) + writer.writeMessage(3, this.return_type, () => this.return_type.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): MethodSignature { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new MethodSignature() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.type_parameters, + () => (message.type_parameters = Scope.deserialize(reader)) + ) + break + case 2: + reader.readMessage(message.parameter_lists, () => + pb_1.Message.addToRepeatedWrapperField( + message, + 2, + Scope.deserialize(reader), + Scope + ) + ) + break + case 3: + reader.readMessage( + message.return_type, + () => (message.return_type = Type.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): MethodSignature { + return MethodSignature.deserialize(bytes) + } + } + export class TypeSignature extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + type_parameters?: Scope + lower_bound?: Type + upper_bound?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('type_parameters' in data && data.type_parameters != undefined) { + this.type_parameters = data.type_parameters + } + if ('lower_bound' in data && data.lower_bound != undefined) { + this.lower_bound = data.lower_bound + } + if ('upper_bound' in data && data.upper_bound != undefined) { + this.upper_bound = data.upper_bound + } + } + } + get type_parameters() { + return pb_1.Message.getWrapperField(this, Scope, 1) as Scope + } + set type_parameters(value: Scope) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_type_parameters() { + return pb_1.Message.getField(this, 1) != null + } + get lower_bound() { + return pb_1.Message.getWrapperField(this, Type, 2) as Type + } + set lower_bound(value: Type) { + pb_1.Message.setWrapperField(this, 2, value) + } + get has_lower_bound() { + return pb_1.Message.getField(this, 2) != null + } + get upper_bound() { + return pb_1.Message.getWrapperField(this, Type, 3) as Type + } + set upper_bound(value: Type) { + pb_1.Message.setWrapperField(this, 3, value) + } + get has_upper_bound() { + return pb_1.Message.getField(this, 3) != null + } + static fromObject(data: { + type_parameters?: ReturnType + lower_bound?: ReturnType + upper_bound?: ReturnType + }): TypeSignature { + const message = new TypeSignature({}) + if (data.type_parameters != null) { + message.type_parameters = Scope.fromObject(data.type_parameters) + } + if (data.lower_bound != null) { + message.lower_bound = Type.fromObject(data.lower_bound) + } + if (data.upper_bound != null) { + message.upper_bound = Type.fromObject(data.upper_bound) + } + return message + } + toObject() { + const data: { + type_parameters?: ReturnType + lower_bound?: ReturnType + upper_bound?: ReturnType + } = {} + if (this.type_parameters != null) { + data.type_parameters = this.type_parameters.toObject() + } + if (this.lower_bound != null) { + data.lower_bound = this.lower_bound.toObject() + } + if (this.upper_bound != null) { + data.upper_bound = this.upper_bound.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_type_parameters) + writer.writeMessage(1, this.type_parameters, () => + this.type_parameters.serialize(writer) + ) + if (this.has_lower_bound) + writer.writeMessage(2, this.lower_bound, () => this.lower_bound.serialize(writer)) + if (this.has_upper_bound) + writer.writeMessage(3, this.upper_bound, () => this.upper_bound.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): TypeSignature { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new TypeSignature() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage( + message.type_parameters, + () => (message.type_parameters = Scope.deserialize(reader)) + ) + break + case 2: + reader.readMessage( + message.lower_bound, + () => (message.lower_bound = Type.deserialize(reader)) + ) + break + case 3: + reader.readMessage( + message.upper_bound, + () => (message.upper_bound = Type.deserialize(reader)) + ) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): TypeSignature { + return TypeSignature.deserialize(bytes) + } + } + export class ValueSignature extends pb_1.Message { + #one_of_decls: number[][] = [] + constructor( + data?: + | any[] + | { + tpe?: Type + } + ) { + super() + pb_1.Message.initialize(this, Array.isArray(data) ? data : [], 0, -1, [], this.#one_of_decls) + if (!Array.isArray(data) && typeof data == 'object') { + if ('tpe' in data && data.tpe != undefined) { + this.tpe = data.tpe + } + } + } + get tpe() { + return pb_1.Message.getWrapperField(this, Type, 1) as Type + } + set tpe(value: Type) { + pb_1.Message.setWrapperField(this, 1, value) + } + get has_tpe() { + return pb_1.Message.getField(this, 1) != null + } + static fromObject(data: { + tpe?: ReturnType + }): ValueSignature { + const message = new ValueSignature({}) + if (data.tpe != null) { + message.tpe = Type.fromObject(data.tpe) + } + return message + } + toObject() { + const data: { + tpe?: ReturnType + } = {} + if (this.tpe != null) { + data.tpe = this.tpe.toObject() + } + return data + } + serialize(): Uint8Array + serialize(w: pb_1.BinaryWriter): void + serialize(w?: pb_1.BinaryWriter): Uint8Array | void { + const writer = w || new pb_1.BinaryWriter() + if (this.has_tpe) writer.writeMessage(1, this.tpe, () => this.tpe.serialize(writer)) + if (!w) return writer.getResultBuffer() + } + static deserialize(bytes: Uint8Array | pb_1.BinaryReader): ValueSignature { + const reader = bytes instanceof pb_1.BinaryReader ? bytes : new pb_1.BinaryReader(bytes), + message = new ValueSignature() + while (reader.nextField()) { + if (reader.isEndGroup()) break + switch (reader.getFieldNumber()) { + case 1: + reader.readMessage(message.tpe, () => (message.tpe = Type.deserialize(reader))) + break + default: + reader.skipField() + } + } + return message + } + serializeBinary(): Uint8Array { + return this.serialize() + } + static deserializeBinary(bytes: Uint8Array): ValueSignature { + return ValueSignature.deserialize(bytes) + } + } +} diff --git a/agent/src/cli/scip-codegen/utils.ts b/agent/src/cli/scip-codegen/utils.ts new file mode 100644 index 000000000000..b373512c0d41 --- /dev/null +++ b/agent/src/cli/scip-codegen/utils.ts @@ -0,0 +1,35 @@ +export function typescriptKeywordSyntax(symbol: string): string | undefined { + switch (symbol) { + case 'scip-typescript npm typescript . array#': + return 'List' + case 'scip-typescript npm typescript . null#': + return 'Null' + case 'scip-typescript npm typescript . string#': + return 'String' + case 'scip-typescript npm typescript . false#': + case 'scip-typescript npm typescript . true#': + case 'scip-typescript npm typescript . boolean#': + return 'Boolean' + case 'scip-typescript npm typescript . number#': + return 'Int' + case 'scip-typescript npm typescript . any#': + return 'Any' + default: + return undefined + } +} + +export function capitalize(text: string): string { + if (text.length === 0) { + return text + } + return text[0].toUpperCase() + text.slice(1) +} + +export function isTypescriptKeyword(symbol: string): boolean { + return typescriptKeywordSyntax(symbol) !== undefined +} + +export function typescriptKeyword(keyword: string): string { + return `scip-typescript npm typescript . ${keyword}#` +} diff --git a/agent/src/index.test.ts b/agent/src/index.test.ts index 5662fe202fe1..f5a334127ae0 100644 --- a/agent/src/index.test.ts +++ b/agent/src/index.test.ts @@ -164,27 +164,29 @@ describe('Agent', () => { expect(valid?.username).toStrictEqual('olafurpg-testing') }, 10_000) - it('autocomplete/execute (non-empty result)', async () => { - await client.openFile(sumUri) - const completions = await client.request('autocomplete/execute', { - uri: sumUri.toString(), - position: { line: 1, character: 3 }, - triggerKind: 'Invoke', - }) - const texts = completions.items.map(item => item.insertText) - expect(completions.items.length).toBeGreaterThan(0) - expect(texts).toMatchInlineSnapshot( - ` + describe('Autocomplete', () => { + it('autocomplete/execute (non-empty result)', async () => { + await client.openFile(sumUri) + const completions = await client.request('autocomplete/execute', { + uri: sumUri.toString(), + position: { line: 1, character: 3 }, + triggerKind: 'Invoke', + }) + const texts = completions.items.map(item => item.insertText) + expect(completions.items.length).toBeGreaterThan(0) + expect(texts).toMatchInlineSnapshot( + ` [ " return a + b;", ] `, - explainPollyError - ) - client.notify('autocomplete/completionAccepted', { - completionID: completions.items[0].id, - }) - }, 10_000) + explainPollyError + ) + client.notify('autocomplete/completionAccepted', { + completionID: completions.items[0].id, + }) + }, 10_000) + }) it('graphql/getCurrentUserCodySubscription', async () => { const currentUserCodySubscription = await client.request( diff --git a/agent/tsconfig.json b/agent/tsconfig.json index 0eb1428d2ebb..498c6d06ffd6 100644 --- a/agent/tsconfig.json +++ b/agent/tsconfig.json @@ -8,6 +8,6 @@ "allowJs": true, }, "include": ["**/*", ".*", "package.json", "src/language-file-extensions.json"], - "exclude": ["dist", "src/__tests__", "src/bfg/__tests__", "scip.ts", "vitest.config.ts"], + "exclude": ["dist", "bindings", "src/__tests__", "src/bfg/__tests__", "vitest.config.ts"], "references": [{ "path": "../lib/shared" }, { "path": "../vscode" }], } diff --git a/biome.json b/biome.json index 34a8a3756fbd..1dfdb178c1d9 100644 --- a/biome.json +++ b/biome.json @@ -33,9 +33,11 @@ "build/", "**/test-data/**", "vscode/src/testutils/vscode/", + "agent/bindings/**", "agent/src/bfg/__tests__/**", "agent/src/__tests__/**", "agent/recordings/**", + "agent/src/cli/scip-codegen/scip.ts", "/vitest.workspace.js", "vitest.config.ts", "vite.config.ts", @@ -46,6 +48,7 @@ }, "formatter": { "ignore": [ + "agent/bindings/**", "node_modules/", ".github/PULL_REQUEST_TEMPLATE.md", "dist/**", diff --git a/lib/shared/src/index.ts b/lib/shared/src/index.ts index 726a3cc7848f..0a36a1327165 100644 --- a/lib/shared/src/index.ts +++ b/lib/shared/src/index.ts @@ -196,3 +196,4 @@ export type { ExtensionDetails } from './telemetry/EventLogger' export { testFileUri } from './test/path-helpers' export { addTraceparent, getActiveTraceAndSpanId, wrapInActiveSpan } from './tracing' export { convertGitCloneURLToCodebaseName, isError } from './utils' +export { CurrentUserCodySubscription } from './sourcegraph-api/graphql/client' diff --git a/package.json b/package.json index f2fe10f8b87e..992fce57332f 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "test:unit": "vitest run", "test:integration": "pnpm -C vscode test:integration", "test:e2e": "pnpm -C vscode test:e2e", + "generate-agent-kotlin-bindings": "pnpm build && pnpm dlx ts-node agent/src/cli/scip-codegen/command.ts --output ../jetbrains/src/main/kotlin/com/sourcegraph/cody/protocol_generated", "update-agent-recordings": "pnpm build && CODY_KEEP_UNUSED_RECORDINGS=false CODY_RECORD_IF_MISSING=true vitest agent/src/index.test.ts", "update-symf-recordings": "rm -rf recordings && CODY_RECORD_IF_MISSING=true vitest vscode/src/local-context/symf.test.ts" }, diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6e76fcbc446d..2d469af1faa8 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -133,6 +133,9 @@ importers: '@types/dedent': specifier: ^0.7.0 version: 0.7.0 + '@types/google-protobuf': + specifier: 3.15.12 + version: 3.15.12 '@types/minimatch': specifier: ^5.1.2 version: 5.1.2 @@ -145,6 +148,9 @@ importers: esbuild: specifier: ^0.18.19 version: 0.18.19 + google-protobuf: + specifier: ^3.21.2 + version: 3.21.2 parse-git-diff: specifier: ^0.0.14 version: 0.0.14 @@ -5918,6 +5924,10 @@ packages: '@types/node': 20.4.0 dev: true + /@types/google-protobuf@3.15.12: + resolution: {integrity: sha512-40um9QqwHjRS92qnOaDpL7RmDK15NuZYo9HihiJRbYkMQZlWnuH8AdvbMy8/o6lgLmKbDUKa+OALCltHdbOTpQ==} + dev: true + /@types/graceful-fs@4.1.5: resolution: {integrity: sha512-anKkLmZZ+xm4p8JWBf4hElkM4XR+EZeA2M9BAkkTldmcyDY4mbdIJnRghDJH3Ov5ooY7/UAoENtmdMSkaAd7Cw==} dependencies: @@ -9132,6 +9142,10 @@ packages: node-forge: 1.3.1 dev: true + /google-protobuf@3.21.2: + resolution: {integrity: sha512-3MSOYFO5U9mPGikIYCzK0SaThypfGgS6bHqrUGXG3DPHCrb+txNqeEcns1W0lkGfk0rCyNXm7xB9rMxnCiZOoA==} + dev: true + /gopd@1.0.1: resolution: {integrity: sha512-d65bNlIadxvpb/A2abVdlqKqV563juRnZ1Wtk6s1sIR8uNsXR70xqIzVqxVf1eTqDunwT2MkczEeaezCKTZhwA==} dependencies: diff --git a/vscode/src/chat/chat-view/SidebarViewController.ts b/vscode/src/chat/chat-view/SidebarViewController.ts index 07307dd87c33..52577322f056 100644 --- a/vscode/src/chat/chat-view/SidebarViewController.ts +++ b/vscode/src/chat/chat-view/SidebarViewController.ts @@ -50,18 +50,18 @@ export class SidebarViewController implements vscode.WebviewViewProvider { await this.contextProvider.init() break case 'auth': - if (message.type === 'callback' && message.endpoint) { + if (message.authKind === 'callback' && message.endpoint) { this.authProvider.redirectToEndpointLogin(message.endpoint) break } - if (message.type === 'simplified-onboarding') { + if (message.authKind === 'simplified-onboarding') { const authProviderSimplified = new AuthProviderSimplified() const authMethod = message.authMethod || 'dotcom' void authProviderSimplified.openExternalAuthUrl(this.authProvider, authMethod) break } // cody.auth.signin or cody.auth.signout - await vscode.commands.executeCommand(`cody.auth.${message.type}`) + await vscode.commands.executeCommand(`cody.auth.${message.authKind}`) break case 'reload': await this.authProvider.reloadAuthStatus() @@ -77,7 +77,7 @@ export class SidebarViewController implements vscode.WebviewViewProvider { void openExternalLinks(message.value) break case 'simplified-onboarding': - if (message.type === 'web-sign-in-token') { + if (message.onboardingKind === 'web-sign-in-token') { void vscode.window .showInputBox({ prompt: 'Enter web sign-in token' }) .then(async token => { @@ -124,7 +124,7 @@ export class SidebarViewController implements vscode.WebviewViewProvider { await vscode.commands.executeCommand('cody.chat.focus') await this.webview?.postMessage({ type: 'view', - messages: view, + view: view, }) } diff --git a/vscode/src/chat/chat-view/SimpleChatPanelProvider.ts b/vscode/src/chat/chat-view/SimpleChatPanelProvider.ts index 65eb8e1bc5a4..a9ee27e5b918 100644 --- a/vscode/src/chat/chat-view/SimpleChatPanelProvider.ts +++ b/vscode/src/chat/chat-view/SimpleChatPanelProvider.ts @@ -527,7 +527,7 @@ export class SimpleChatPanelProvider implements vscode.Disposable, ChatSession { const tabs = getOpenTabsContextFile() void this.postMessage({ type: 'userContextFiles', - context: tabs, + userContextFiles: tabs, }) return } @@ -556,7 +556,7 @@ export class SimpleChatPanelProvider implements vscode.Disposable, ChatSession { if (!cancellation.token.isCancellationRequested) { await this.postMessage({ type: 'userContextFiles', - context: symbolResults, + userContextFiles: symbolResults, }) } } else { @@ -568,7 +568,7 @@ export class SimpleChatPanelProvider implements vscode.Disposable, ChatSession { if (!cancellation.token.isCancellationRequested) { await this.postMessage({ type: 'userContextFiles', - context: fileResults, + userContextFiles: fileResults, }) } } @@ -713,7 +713,7 @@ export class SimpleChatPanelProvider implements vscode.Disposable, ChatSession { ) void this.postMessage({ type: 'enhanced-context', - context: { + enhancedContextStatus: { groups: this.contextStatusAggregator.status, }, }) @@ -965,7 +965,7 @@ export class SimpleChatPanelProvider implements vscode.Disposable, ChatSession { if (allHistory) { void this.postMessage({ type: 'history', - messages: allHistory, + localHistory: allHistory, }) } await this.treeView.updateTree(this.authProvider.getAuthStatus()) @@ -1122,7 +1122,7 @@ export class SimpleChatPanelProvider implements vscode.Disposable, ChatSession { await this.postMessage({ type: 'view', - messages: view, + view: view, }) } diff --git a/vscode/src/chat/protocol.ts b/vscode/src/chat/protocol.ts index f68bf7d94340..c593d98b5cee 100644 --- a/vscode/src/chat/protocol.ts +++ b/vscode/src/chat/protocol.ts @@ -50,12 +50,7 @@ export type WebviewMessage = filePath: string // Note: we're not using vscode.Range objects or nesting here, as the protocol // tends to munge the type in a weird way (nested fields become array indices). - range?: { - startLine: number - startCharacter: number - endLine: number - endCharacter: number - } + range?: ActiveTextEditorSelectionRange } | ({ command: 'edit' } & WebviewEditMessage) | { command: 'context/get-remote-search-repos' } @@ -73,7 +68,7 @@ export type WebviewMessage = } | { command: 'auth' - type: + authKind: | 'signin' | 'signout' | 'support' @@ -88,17 +83,14 @@ export type WebviewMessage = | { command: 'reload' } | { command: 'simplified-onboarding' - type: 'web-sign-in-token' + onboardingKind: 'web-sign-in-token' } | { command: 'getUserContext'; query: string } | { command: 'search'; query: string } | { command: 'show-search-result' uri: URI - range: { - start: { line: number; character: number } - end: { line: number; character: number } - } + range: ActiveTextEditorSelectionRange } | { command: 'reset' @@ -122,15 +114,15 @@ export type ExtensionMessage = type: 'search:config' workspaceFolderUris: string[] } - | { type: 'history'; messages: UserLocalHistory | null } + | { type: 'history'; localHistory: UserLocalHistory | null } | ({ type: 'transcript' } & ExtensionTranscriptMessage) - | { type: 'view'; messages: View } + | { type: 'view'; view: View } | { type: 'errors'; errors: string } | { type: 'notice'; notice: { key: string } } | { type: 'transcript-errors'; isTranscriptError: boolean } | { type: 'userContextFiles' - context: ContextFile[] | null + userContextFiles: ContextFile[] | null kind?: ContextFileType } | { type: 'chatModels'; models: ModelProvider[] } @@ -140,7 +132,7 @@ export type ExtensionMessage = query: string } | { type: 'index-updated'; scopeDir: string } - | { type: 'enhanced-context'; context: EnhancedContextContextT } + | { type: 'enhanced-context'; enhancedContextStatus: EnhancedContextContextT } | ({ type: 'attribution' } & ExtensionAttributionMessage) | { type: 'setChatEnabledConfigFeature'; data: boolean } | { type: 'webview-state'; isActive: boolean } diff --git a/vscode/src/jsonrpc/agent-protocol.ts b/vscode/src/jsonrpc/agent-protocol.ts index d47c19958039..b7c85170d9e1 100644 --- a/vscode/src/jsonrpc/agent-protocol.ts +++ b/vscode/src/jsonrpc/agent-protocol.ts @@ -5,6 +5,7 @@ import type { ChatMessage, ModelProvider, event, + CurrentUserCodySubscription, } from '@sourcegraph/cody-shared' import type { KnownKeys, @@ -14,9 +15,8 @@ import type { } from '@sourcegraph/telemetry' import type { AuthStatus, ExtensionMessage, WebviewMessage } from '../chat/protocol' -import type { CompletionBookkeepingEvent, CompletionItemID } from '../completions/logger' +import type { CompletionBookkeepingEvent } from '../completions/logger' import type { CodyTaskState } from '../non-stop/utils' -import type { CurrentUserCodySubscription } from '@sourcegraph/cody-shared/dist/sourcegraph-api/graphql/client' import type { Repo } from '../context/repo-fetcher' // This file documents the Cody Agent JSON-RPC protocol. Consult the JSON-RPC @@ -25,11 +25,12 @@ import type { Repo } from '../context/repo-fetcher' // The JSON-RPC requests of the Cody Agent protocol. Requests are async // functions that return some (possibly null) value. -export type Requests = { - // ================ - // Client -> Server - // ================ +export type Requests = ClientRequests & ServerRequests +// ================ +// Client -> Server +// ================ +export type ClientRequests = { // The 'initialize' request must be sent at the start of the connection // before any other request/notification is sent. initialize: [ClientInfo, ServerInfo] @@ -156,11 +157,12 @@ export type Requests = { limitHit: boolean }, ] +} - // ================ - // Server -> Client - // ================ - +// ================ +// Server -> Client +// ================ +export type ServerRequests = { 'window/showMessage': [ShowWindowMessageParams, string | null] 'textDocument/edit': [TextDocumentEditParams, boolean] @@ -178,11 +180,12 @@ export type Requests = { // The JSON-RPC notifications of the Cody Agent protocol. Notifications are // synchronous fire-and-forget messages that have no return value. Notifications are // conventionally used to represent streams of values. -export type Notifications = { - // ================ - // Client -> Server - // ================ +export type Notifications = ClientNotifications & ServerNotifications +// ================ +// Client -> Server +// ================ +export type ClientNotifications = { // The 'initalized' notification must be sent after receiving the 'initialize' response. initialized: [null] // The 'exit' notification must be sent after the client receives the 'shutdown' response. @@ -231,11 +234,12 @@ export type Notifications = { // User requested to cancel this progress bar. Only supported for progress // bars with `cancelable: true`. 'progress/cancel': [{ id: string }] +} - // ================ - // Server -> Client - // ================ - +// ================ +// Server -> Client +// ================ +export type ServerNotifications = { 'debug/message': [DebugMessage] 'editTaskState/didChange': [EditTask] @@ -257,11 +261,11 @@ export type Notifications = { } interface CancelParams { - id: string | number + id: string // actuall: string | number } interface CompletionItemParams { - completionID: CompletionItemID + completionID: string } interface AutocompleteParams { @@ -286,7 +290,7 @@ export interface AutocompleteResult { } export interface AutocompleteItem { - id: CompletionItemID + id: string insertText: string range: Range } @@ -330,10 +334,8 @@ export interface ServerInfo { authenticated?: boolean codyEnabled?: boolean codyVersion?: string | null - capabilities?: ServerCapabilities authStatus?: AuthStatus } -type ServerCapabilities = Record export interface ExtensionConfiguration { serverEndpoint: string @@ -516,13 +518,15 @@ export type WorkspaceEditOperation = | DeleteFileOperation | EditFileOperation +export interface WriteFileOptions { + overwrite?: boolean + ignoreIfExists?: boolean +} + export interface CreateFileOperation { type: 'create-file' uri: string - options?: { - readonly overwrite?: boolean - readonly ignoreIfExists?: boolean - } + options?: WriteFileOptions textContents: string metadata?: vscode.WorkspaceEditEntryMetadata } @@ -530,16 +534,13 @@ export interface RenameFileOperation { type: 'rename-file' oldUri: string newUri: string - options?: { - readonly overwrite?: boolean - readonly ignoreIfExists?: boolean - } + options?: WriteFileOptions metadata?: vscode.WorkspaceEditEntryMetadata } export interface DeleteFileOperation { type: 'delete-file' uri: string - options?: { + deleteOptions?: { readonly recursive?: boolean readonly ignoreIfNotExists?: boolean } @@ -624,14 +625,22 @@ export interface ShowWindowMessageParams { items?: string[] } +interface FileIdentifier { + uri: string +} + export interface DeleteFilesParams { - files: { uri: string }[] + files: FileIdentifier[] } export interface CreateFilesParams { - files: { uri: string }[] + files: FileIdentifier[] +} +interface RenameFile { + oldUri: string + newUri: string } export interface RenameFilesParams { - files: { oldUri: string; newUri: string }[] + files: RenameFile[] } export type CustomCommandResult = CustomChatCommandResult | CustomEditCommandResult diff --git a/vscode/src/services/utils/workspace-action.ts b/vscode/src/services/utils/workspace-action.ts index fc0acae7d16c..09a2a638a545 100644 --- a/vscode/src/services/utils/workspace-action.ts +++ b/vscode/src/services/utils/workspace-action.ts @@ -6,7 +6,7 @@ import * as vscode from 'vscode' export async function openLocalFileWithRange(filePath: string, range?: CodeRange): Promise { const doc = await vscode.workspace.openTextDocument(vscode.Uri.file(filePath)) const selection = range - ? new vscode.Range(range.startLine, range.startCharacter, range.endLine, range.endCharacter) + ? new vscode.Range(range.start.line, range.start.character, range.end.line, range.end.character) : range await vscode.window.showTextDocument(doc, { selection }) } @@ -23,8 +23,6 @@ export async function openExternalLinks(uri: string): Promise { } interface CodeRange { - startLine: number - startCharacter: number - endLine: number - endCharacter: number + start: { line: number; character: number } + end: { line: number; character: number } } diff --git a/vscode/src/testutils/AgentWorkspaceEdit.ts b/vscode/src/testutils/AgentWorkspaceEdit.ts index 6086b6a2a71b..064c8328921e 100644 --- a/vscode/src/testutils/AgentWorkspaceEdit.ts +++ b/vscode/src/testutils/AgentWorkspaceEdit.ts @@ -73,7 +73,7 @@ export class AgentWorkspaceEdit implements vscode.WorkspaceEdit { this.edits.push({ type: 'delete-file', uri: uri.toString(), - options, + deleteOptions: options, metadata, }) } diff --git a/vscode/src/testutils/CodyPersister.ts b/vscode/src/testutils/CodyPersister.ts index 72b52c3fec86..8a5b3bc125af 100644 --- a/vscode/src/testutils/CodyPersister.ts +++ b/vscode/src/testutils/CodyPersister.ts @@ -97,6 +97,7 @@ export class CodyPersister extends FSPersister { // Remove any headers and cookies we don't need at all. entry.request.headers = this.filterHeaders(entry.request.headers) entry.response.headers = this.filterHeaders(entry.response.headers) + entry.response.content.text entry.request.cookies.length = 0 entry.response.cookies.length = 0 diff --git a/vscode/webviews/App.tsx b/vscode/webviews/App.tsx index 5fa17562dd32..09aa600983b3 100644 --- a/vscode/webviews/App.tsx +++ b/vscode/webviews/App.tsx @@ -129,20 +129,20 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc setAttributionEnabled(message.configFeatures.attribution) break case 'history': - setInputHistory(message.messages?.input ?? []) - setUserHistory(message.messages?.chat ?? null) + setInputHistory(message.localHistory?.input ?? []) + setUserHistory(message.localHistory?.chat ?? null) break case 'enhanced-context': - setEnhancedContextStatus(message.context) + setEnhancedContextStatus(message.enhancedContextStatus) break case 'userContextFiles': - setContextSelection(message.context) + setContextSelection(message.userContextFiles) break case 'errors': setErrorMessages([...errorMessages, message.errors].slice(-5)) break case 'view': - setView(message.messages) + setView(message.view) break case 'webview-state': setIsWebviewActive(message.isActive) @@ -190,7 +190,11 @@ export const App: React.FunctionComponent<{ vscodeAPI: VSCodeWrapper }> = ({ vsc // We do not change the view here. We want to keep presenting the // login buttons until we get a token so users don't get stuck if // they close the browser during an auth flow. - vscodeAPI.postMessage({ command: 'auth', type: 'simplified-onboarding', authMethod: method }) + vscodeAPI.postMessage({ + command: 'auth', + authKind: 'simplified-onboarding', + authMethod: method, + }) }, [vscodeAPI] ) diff --git a/vscode/webviews/OnboardingExperiment.tsx b/vscode/webviews/OnboardingExperiment.tsx index 2426291e79e9..1d1c6a8cf545 100644 --- a/vscode/webviews/OnboardingExperiment.tsx +++ b/vscode/webviews/OnboardingExperiment.tsx @@ -45,7 +45,7 @@ const WebLogin: React.FunctionComponent< telemetryService.log('CodyVSCodeExtension:auth:clickSignInWeb') vscodeAPI.postMessage({ command: 'simplified-onboarding', - type: 'web-sign-in-token', + onboardingKind: 'web-sign-in-token', }) event.preventDefault() event.stopPropagation() @@ -67,7 +67,7 @@ export const LoginSimplified: React.FunctionComponent { const otherSignInClick = (): void => { telemetryService.log('CodyVSCodeExtension:auth:clickOtherSignInOptions') - vscodeAPI.postMessage({ command: 'auth', type: 'signin' }) + vscodeAPI.postMessage({ command: 'auth', authKind: 'signin' }) } return (

diff --git a/vscode/webviews/SymbolLink.tsx b/vscode/webviews/SymbolLink.tsx index d5ea681f4b25..4c10046c5ae4 100644 --- a/vscode/webviews/SymbolLink.tsx +++ b/vscode/webviews/SymbolLink.tsx @@ -14,7 +14,10 @@ export const SymbolLink: React.FunctionComponent = ({ symbol, p getVSCodeAPI().postMessage({ command: 'openLocalFileWithRange', filePath: path, - range, + range: { + start: { line: range?.startLine ?? 0, character: range?.startCharacter ?? 0 }, + end: { line: range?.endLine ?? 0, character: range?.endCharacter ?? 0 }, + }, }) }} title={symbol}